mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-02-22 15:39:57 -05:00
Add MinimizeOnUrlOpen feature
This commit is contained in:
parent
6dcd00b609
commit
a22e8a1f40
@ -6,6 +6,7 @@ AutoSaveAfterEveryChange=false
|
||||
AutoSaveOnExit=false
|
||||
AutoReloadOnChange=true
|
||||
MinimizeOnCopy=false
|
||||
MinimizeOnOpenUrl=false
|
||||
UseGroupIconOnEntryCreation=true
|
||||
IgnoreGroupExpansion=false
|
||||
AutoTypeEntryTitleMatch=true
|
||||
|
@ -178,6 +178,7 @@ void Config::init(const QString& fileName)
|
||||
m_defaults.insert("UseAtomicSaves", true);
|
||||
m_defaults.insert("SearchLimitGroup", false);
|
||||
m_defaults.insert("MinimizeOnCopy", false);
|
||||
m_defaults.insert("MinimizeOnOpenUrl", false);
|
||||
m_defaults.insert("UseGroupIconOnEntryCreation", false);
|
||||
m_defaults.insert("AutoTypeEntryTitleMatch", true);
|
||||
m_defaults.insert("AutoTypeEntryURLMatch", true);
|
||||
|
@ -148,6 +148,7 @@ void ApplicationSettingsWidget::loadSettings()
|
||||
m_generalUi->useAtomicSavesCheckBox->setChecked(config()->get("UseAtomicSaves").toBool());
|
||||
m_generalUi->autoReloadOnChangeCheckBox->setChecked(config()->get("AutoReloadOnChange").toBool());
|
||||
m_generalUi->minimizeOnCopyCheckBox->setChecked(config()->get("MinimizeOnCopy").toBool());
|
||||
m_generalUi->minimizeOnOpenUrlCheckBox->setChecked(config()->get("MinimizeOnOpenUrl").toBool());
|
||||
m_generalUi->useGroupIconOnEntryCreationCheckBox->setChecked(config()->get("UseGroupIconOnEntryCreation").toBool());
|
||||
m_generalUi->autoTypeEntryTitleMatchCheckBox->setChecked(config()->get("AutoTypeEntryTitleMatch").toBool());
|
||||
m_generalUi->autoTypeEntryURLMatchCheckBox->setChecked(config()->get("AutoTypeEntryURLMatch").toBool());
|
||||
@ -247,6 +248,7 @@ void ApplicationSettingsWidget::saveSettings()
|
||||
config()->set("UseAtomicSaves", m_generalUi->useAtomicSavesCheckBox->isChecked());
|
||||
config()->set("AutoReloadOnChange", m_generalUi->autoReloadOnChangeCheckBox->isChecked());
|
||||
config()->set("MinimizeOnCopy", m_generalUi->minimizeOnCopyCheckBox->isChecked());
|
||||
config()->set("MinimizeOnOpenUrl", m_generalUi->minimizeOnOpenUrlCheckBox->isChecked());
|
||||
config()->set("UseGroupIconOnEntryCreation", m_generalUi->useGroupIconOnEntryCreationCheckBox->isChecked());
|
||||
config()->set("IgnoreGroupExpansion", m_generalUi->ignoreGroupExpansionCheckBox->isChecked());
|
||||
config()->set("AutoTypeEntryTitleMatch", m_generalUi->autoTypeEntryTitleMatchCheckBox->isChecked());
|
||||
|
@ -255,6 +255,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="minimizeOnOpenUrlCheckBox">
|
||||
<property name="text">
|
||||
<string>Minimize when opening a URL</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="previewHideCheckBox">
|
||||
<property name="text">
|
||||
|
@ -656,15 +656,10 @@ void DatabaseWidget::openUrlForEntry(Entry* entry)
|
||||
QString cmdString = entry->resolveMultiplePlaceholders(entry->url());
|
||||
if (cmdString.startsWith("cmd://")) {
|
||||
// check if decision to execute command was stored
|
||||
if (entry->attributes()->hasKey(EntryAttributes::RememberCmdExecAttr)) {
|
||||
if (entry->attributes()->value(EntryAttributes::RememberCmdExecAttr) == "1") {
|
||||
QProcess::startDetached(cmdString.mid(6));
|
||||
}
|
||||
return;
|
||||
}
|
||||
bool launch = (entry->attributes()->value(EntryAttributes::RememberCmdExecAttr) == "1");
|
||||
|
||||
// otherwise ask user
|
||||
if (cmdString.length() > 6) {
|
||||
if (!launch && cmdString.length() > 6) {
|
||||
QString cmdTruncated = cmdString.mid(6);
|
||||
if (cmdTruncated.length() > 400) {
|
||||
cmdTruncated = cmdTruncated.left(400) + " […]";
|
||||
@ -687,18 +682,28 @@ void DatabaseWidget::openUrlForEntry(Entry* entry)
|
||||
});
|
||||
|
||||
int result = msgbox.exec();
|
||||
if (result == QMessageBox::Yes) {
|
||||
QProcess::startDetached(cmdString.mid(6));
|
||||
}
|
||||
launch = (result == QMessageBox::Yes);
|
||||
|
||||
if (remember) {
|
||||
entry->attributes()->set(EntryAttributes::RememberCmdExecAttr, result == QMessageBox::Yes ? "1" : "0");
|
||||
}
|
||||
}
|
||||
|
||||
if (launch) {
|
||||
QProcess::startDetached(cmdString.mid(6));
|
||||
|
||||
if (config()->get("MinimizeOnOpenUrl").toBool()) {
|
||||
window()->showMinimized();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
QUrl url = QUrl::fromUserInput(entry->resolveMultiplePlaceholders(entry->url()));
|
||||
if (!url.isEmpty()) {
|
||||
QDesktopServices::openUrl(url);
|
||||
|
||||
if (config()->get("MinimizeOnOpenUrl").toBool()) {
|
||||
window()->showMinimized();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user