mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-12-04 15:39:34 +01:00
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:
@@ -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();
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ class TestConfig : public QObject
|
||||
Q_OBJECT
|
||||
private slots:
|
||||
void testUpgrade();
|
||||
void testURLDoubleClickMigration();
|
||||
};
|
||||
|
||||
#endif // KEEPASSX_TESTCONFIG_H
|
||||
|
||||
Reference in New Issue
Block a user