mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-12-29 01:06:27 -05:00
Merge pull request #1386 from keepassxreboot/feature/fix-browser-quirks
Fix browser integration quirks
This commit is contained in:
commit
243edda7f2
@ -31,6 +31,7 @@
|
|||||||
#include "core/Metadata.h"
|
#include "core/Metadata.h"
|
||||||
#include "core/Uuid.h"
|
#include "core/Uuid.h"
|
||||||
#include "core/PasswordGenerator.h"
|
#include "core/PasswordGenerator.h"
|
||||||
|
#include "gui/MainWindow.h"
|
||||||
|
|
||||||
|
|
||||||
// de887cc3-0363-43b8-974b-5911b8816224
|
// de887cc3-0363-43b8-974b-5911b8816224
|
||||||
@ -60,11 +61,8 @@ bool BrowserService::isDatabaseOpened() const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dbWidget->currentMode() == DatabaseWidget::ViewMode || dbWidget->currentMode() == DatabaseWidget::EditMode) {
|
return dbWidget->currentMode() == DatabaseWidget::ViewMode || dbWidget->currentMode() == DatabaseWidget::EditMode;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BrowserService::openDatabase()
|
bool BrowserService::openDatabase()
|
||||||
@ -82,7 +80,8 @@ bool BrowserService::openDatabase()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_dbTabWidget->activateWindow();
|
KEEPASSXC_MAIN_WINDOW->bringToFront();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -174,29 +173,38 @@ QString BrowserService::storeKey(const QString& key)
|
|||||||
|
|
||||||
Entry* config = getConfigEntry(true);
|
Entry* config = getConfigEntry(true);
|
||||||
if (!config) {
|
if (!config) {
|
||||||
return QString();
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
bool contains = false;
|
bool contains;
|
||||||
QMessageBox::StandardButton dialogResult = QMessageBox::No;
|
QMessageBox::StandardButton dialogResult = QMessageBox::No;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
bool ok = false;
|
QInputDialog keyDialog;
|
||||||
id = QInputDialog::getText(0, tr("KeePassXC: New key association request"),
|
keyDialog.setWindowTitle(tr("KeePassXC: New key association request"));
|
||||||
tr("You have received an association "
|
keyDialog.setLabelText(tr("You have received an association request for the above key.\n\n"
|
||||||
"request for the above key.\n"
|
"If you would like to allow it access to your KeePassXC database,\n"
|
||||||
"If you would like to allow it access "
|
"give it a unique name to identify and accept it."));
|
||||||
"to your KeePassXC database,\n"
|
keyDialog.setOkButtonText(tr("Save and allow access"));
|
||||||
"give it a unique name to identify and accept it."),
|
keyDialog.show();
|
||||||
QLineEdit::Normal, QString(), &ok);
|
keyDialog.activateWindow();
|
||||||
if (!ok || id.isEmpty()) {
|
keyDialog.raise();
|
||||||
return QString();
|
auto ok = keyDialog.exec();
|
||||||
|
|
||||||
|
id = keyDialog.textValue();
|
||||||
|
|
||||||
|
if (ok != QDialog::Accepted || id.isEmpty()) {
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
contains = config->attributes()->contains(QLatin1String(ASSOCIATE_KEY_PREFIX) + id);
|
contains = config->attributes()->contains(QLatin1String(ASSOCIATE_KEY_PREFIX) + id);
|
||||||
dialogResult = QMessageBox::warning(0, tr("KeePassXC: Overwrite existing key?"),
|
if (contains) {
|
||||||
tr("A shared encryption key with the name \"%1\" already exists.\nDo you want to overwrite it?").arg(id),
|
dialogResult = QMessageBox::warning(nullptr, tr("KeePassXC: Overwrite existing key?"),
|
||||||
QMessageBox::Yes | QMessageBox::No);
|
tr("A shared encryption key with the name \"%1\" "
|
||||||
|
"already exists.\nDo you want to overwrite it?")
|
||||||
|
.arg(id),
|
||||||
|
QMessageBox::Yes | QMessageBox::No);
|
||||||
|
}
|
||||||
} while (contains && dialogResult == QMessageBox::No);
|
} while (contains && dialogResult == QMessageBox::No);
|
||||||
|
|
||||||
config->attributes()->set(QLatin1String(ASSOCIATE_KEY_PREFIX) + id, key, true);
|
config->attributes()->set(QLatin1String(ASSOCIATE_KEY_PREFIX) + id, key, true);
|
||||||
|
@ -28,8 +28,7 @@
|
|||||||
const QString HostInstaller::HOST_NAME = "org.keepassxc.keepassxc_browser";
|
const QString HostInstaller::HOST_NAME = "org.keepassxc.keepassxc_browser";
|
||||||
const QStringList HostInstaller::ALLOWED_ORIGINS = QStringList()
|
const QStringList HostInstaller::ALLOWED_ORIGINS = QStringList()
|
||||||
<< "chrome-extension://iopaggbpplllidnfmcghoonnokmjoicf/"
|
<< "chrome-extension://iopaggbpplllidnfmcghoonnokmjoicf/"
|
||||||
<< "chrome-extension://fhakpkpdnjecjfceboihdjpfmgajebii/"
|
<< "chrome-extension://oboonakemofpalcgghocfoadofidjkkk/";
|
||||||
<< "chrome-extension://jaikbblhommnkeialomogohhdlndpfbi/";
|
|
||||||
|
|
||||||
const QStringList HostInstaller::ALLOWED_EXTENSIONS = QStringList()
|
const QStringList HostInstaller::ALLOWED_EXTENSIONS = QStringList()
|
||||||
<< "keepassxc-browser@keepassxc.org";
|
<< "keepassxc-browser@keepassxc.org";
|
||||||
|
Loading…
Reference in New Issue
Block a user