mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
forget keyfile path, fix #1151
This commit is contained in:
parent
b0e6bcfaa0
commit
cd1e0571a5
@ -277,6 +277,9 @@ void DatabaseOpenWidget::activateChallengeResponse()
|
||||
void DatabaseOpenWidget::browseKeyFile()
|
||||
{
|
||||
QString filters = QString("%1 (*);;%2 (*.key)").arg(tr("All files"), tr("Key files"));
|
||||
if (!config()->get("RememberLastKeyFiles").toBool()) {
|
||||
fileDialog()->setNextForgetDialog();
|
||||
}
|
||||
QString filename = fileDialog()->getOpenFileName(this, tr("Select key file"), QString(), filters);
|
||||
|
||||
if (!filename.isEmpty()) {
|
||||
|
@ -42,11 +42,11 @@ QString FileDialog::getOpenFileName(QWidget* parent, const QString& caption, QSt
|
||||
if (parent) {
|
||||
parent->activateWindow();
|
||||
}
|
||||
|
||||
if (!result.isEmpty()) {
|
||||
if (!result.isEmpty() && m_nextSaveLastDir) {
|
||||
config()->set("LastDir", QFileInfo(result).absolutePath());
|
||||
}
|
||||
|
||||
m_nextSaveLastDir = true;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@ -73,10 +73,11 @@ QStringList FileDialog::getOpenFileNames(QWidget *parent, const QString &caption
|
||||
parent->activateWindow();
|
||||
}
|
||||
|
||||
if (!results.isEmpty()) {
|
||||
if (!results.isEmpty() && m_nextSaveLastDir) {
|
||||
config()->set("LastDir", QFileInfo(results[0]).absolutePath());
|
||||
}
|
||||
|
||||
m_nextSaveLastDir = true;
|
||||
return results;
|
||||
}
|
||||
}
|
||||
@ -125,10 +126,11 @@ QString FileDialog::getSaveFileName(QWidget* parent, const QString& caption, QSt
|
||||
parent->activateWindow();
|
||||
}
|
||||
|
||||
if (!result.isEmpty()) {
|
||||
if (!result.isEmpty() && m_nextSaveLastDir) {
|
||||
config()->set("LastDir", QFileInfo(result).absolutePath());
|
||||
}
|
||||
|
||||
m_nextSaveLastDir = true;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@ -153,10 +155,11 @@ QString FileDialog::getExistingDirectory(QWidget *parent, const QString &caption
|
||||
parent->activateWindow();
|
||||
}
|
||||
|
||||
if (!dir.isEmpty()) {
|
||||
if (!dir.isEmpty() && m_nextSaveLastDir) {
|
||||
config()->set("LastDir", QFileInfo(dir).absolutePath());
|
||||
}
|
||||
|
||||
m_nextSaveLastDir = true;
|
||||
return dir;
|
||||
}
|
||||
}
|
||||
@ -176,6 +179,11 @@ void FileDialog::setNextDirName(const QString &dirName)
|
||||
m_nextDirName = dirName;
|
||||
}
|
||||
|
||||
void FileDialog::setNextForgetDialog()
|
||||
{
|
||||
m_nextSaveLastDir = false;
|
||||
}
|
||||
|
||||
FileDialog::FileDialog()
|
||||
{
|
||||
}
|
||||
|
@ -36,6 +36,7 @@ public:
|
||||
QString getExistingDirectory(QWidget* parent = nullptr, const QString& caption = QString(),
|
||||
QString dir = QString(), QFileDialog::Options options = QFileDialog::ShowDirsOnly);
|
||||
|
||||
void setNextForgetDialog();
|
||||
/**
|
||||
* Sets the result of the next get* method call.
|
||||
* Use only for testing.
|
||||
@ -51,6 +52,7 @@ private:
|
||||
QString m_nextFileName;
|
||||
QStringList m_nextFileNames;
|
||||
QString m_nextDirName;
|
||||
bool m_nextSaveLastDir = true;
|
||||
|
||||
static FileDialog* m_instance;
|
||||
|
||||
|
@ -241,6 +241,7 @@ void SettingsWidget::saveSettings()
|
||||
|
||||
if (!config()->get("RememberLastKeyFiles").toBool()) {
|
||||
config()->set("LastKeyFiles", QVariant());
|
||||
config()->set("LastDir", "");
|
||||
}
|
||||
|
||||
for (const ExtraPage& page: asConst(m_extraPages)) {
|
||||
|
Loading…
Reference in New Issue
Block a user