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