Add URL double-click action option to Settings (#12322)

* Closes #4717

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: juzu-o <3142026+juzu-o@users.noreply.github.com>
Co-authored-by: Jonathan White <support@dmapps.us>
This commit is contained in:
Juzu-O
2025-11-02 19:32:11 +02:00
committed by GitHub
parent a709f14cf3
commit 592d553ff8
8 changed files with 139 additions and 20 deletions

View File

@@ -17,6 +17,7 @@
#include "TestConfig.h"
#include <QSettings>
#include <QTest>
#include "config-keepassx-tests.h"
@@ -40,3 +41,39 @@ void TestConfig::testUpgrade()
tempFile.remove();
}
void TestConfig::testURLDoubleClickMigration()
{
// Test migration from OpenURLOnDoubleClick to URLDoubleClickAction
TemporaryFile tempFile;
tempFile.open();
// Create a config with old setting = true (open browser)
QSettings oldConfig(tempFile.fileName(), QSettings::IniFormat);
oldConfig.setValue("OpenURLOnDoubleClick", true);
oldConfig.sync();
tempFile.close();
Config::createConfigFromFile(tempFile.fileName());
// Should migrate to URLDoubleClickAction = 0 (open browser)
QCOMPARE(config()->get(Config::URLDoubleClickAction).toInt(), 0);
tempFile.remove();
// Test migration from OpenURLOnDoubleClick = false (edit entry)
TemporaryFile tempFile2;
tempFile2.open();
QSettings oldConfig2(tempFile2.fileName(), QSettings::IniFormat);
oldConfig2.setValue("OpenURLOnDoubleClick", false);
oldConfig2.sync();
tempFile2.close();
Config::createConfigFromFile(tempFile2.fileName());
// Should migrate to URLDoubleClickAction = 2 (edit entry)
QCOMPARE(config()->get(Config::URLDoubleClickAction).toInt(), 2);
tempFile2.remove();
}

View File

@@ -25,6 +25,7 @@ class TestConfig : public QObject
Q_OBJECT
private slots:
void testUpgrade();
void testURLDoubleClickMigration();
};
#endif // KEEPASSX_TESTCONFIG_H