Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/keepassxreboot/keepassxc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorvarjolintu <sami.vanttinen@protonmail.com>2021-10-10 14:49:25 +0300
committerJonathan White <support@dmapps.us>2021-10-11 06:41:58 +0300
commitc7cdce6e33533c889e057a8e8f95b618f3d1ee41 (patch)
treef635908601ed286857944ccc08872facb95c9fbb /src/gui
parentbe6835e42f4b13f3bfbc6805085111a21869c569 (diff)
Support for triggering Global Auto-Type from browser extension
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/DatabaseTabWidget.cpp14
-rw-r--r--src/gui/DatabaseTabWidget.h4
-rw-r--r--src/gui/DatabaseWidget.cpp9
-rw-r--r--src/gui/DatabaseWidget.h6
-rw-r--r--src/gui/osutils/OSUtilsBase.h4
5 files changed, 24 insertions, 13 deletions
diff --git a/src/gui/DatabaseTabWidget.cpp b/src/gui/DatabaseTabWidget.cpp
index 5b7067292..9aa58f556 100644
--- a/src/gui/DatabaseTabWidget.cpp
+++ b/src/gui/DatabaseTabWidget.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018 KeePassXC Team <team@keepassxc.org>
+ * Copyright (C) 2021 KeePassXC Team <team@keepassxc.org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -47,7 +47,7 @@ DatabaseTabWidget::DatabaseTabWidget(QWidget* parent)
connect(this, SIGNAL(currentChanged(int)), SLOT(emitActiveDatabaseChanged()));
connect(this, SIGNAL(activeDatabaseChanged(DatabaseWidget*)),
m_dbWidgetStateSync, SLOT(setActive(DatabaseWidget*)));
- connect(autoType(), SIGNAL(globalAutoTypeTriggered()), SLOT(performGlobalAutoType()));
+ connect(autoType(), SIGNAL(globalAutoTypeTriggered(const QString&)), SLOT(performGlobalAutoType(const QString&)));
connect(autoType(), SIGNAL(autotypePerformed()), SLOT(relockPendingDatabase()));
connect(autoType(), SIGNAL(autotypeRejected()), SLOT(relockPendingDatabase()));
connect(m_databaseOpenDialog.data(), &DatabaseOpenDialog::dialogFinished,
@@ -790,28 +790,30 @@ void DatabaseTabWidget::emitDatabaseLockChanged()
}
}
-void DatabaseTabWidget::performGlobalAutoType()
+void DatabaseTabWidget::performGlobalAutoType(const QString& search)
{
auto currentDbWidget = currentDatabaseWidget();
if (!currentDbWidget) {
- // no open databases, nothing to do
+ // No open databases, nothing to do
return;
} else if (currentDbWidget->isLocked()) {
// Current database tab is locked, match behavior of browser unlock - prompt with
// the unlock dialog even if there are additional unlocked open database tabs.
+ currentDbWidget->setSearchStringForAutoType(search);
unlockAnyDatabaseInDialog(DatabaseOpenDialog::Intent::AutoType);
} else {
- // current database is unlocked, use it for AutoType along with any other unlocked databases
+ // Current database is unlocked, use it for AutoType along with any other unlocked databases
QList<QSharedPointer<Database>> unlockedDatabases;
for (int i = 0, c = count(); i < c; ++i) {
auto* dbWidget = databaseWidgetFromIndex(i);
if (!dbWidget->isLocked()) {
+ dbWidget->setSearchStringForAutoType(search);
unlockedDatabases.append(dbWidget->database());
}
}
Q_ASSERT(!unlockedDatabases.isEmpty());
- autoType()->performGlobalAutoType(unlockedDatabases);
+ autoType()->performGlobalAutoType(unlockedDatabases, search);
}
}
diff --git a/src/gui/DatabaseTabWidget.h b/src/gui/DatabaseTabWidget.h
index 5afed77bd..4e539339b 100644
--- a/src/gui/DatabaseTabWidget.h
+++ b/src/gui/DatabaseTabWidget.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018 KeePassXC Team <team@keepassxc.org>
+ * Copyright (C) 2021 KeePassXC Team <team@keepassxc.org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -80,7 +80,7 @@ public slots:
void showDatabaseSecurity();
void showDatabaseReports();
void showDatabaseSettings();
- void performGlobalAutoType();
+ void performGlobalAutoType(const QString& search);
void performBrowserUnlock();
signals:
diff --git a/src/gui/DatabaseWidget.cpp b/src/gui/DatabaseWidget.cpp
index 50a379fb3..267b556f6 100644
--- a/src/gui/DatabaseWidget.cpp
+++ b/src/gui/DatabaseWidget.cpp
@@ -186,7 +186,7 @@ DatabaseWidget::DatabaseWidget(QSharedPointer<Database> db, QWidget* parent)
connect(m_opVaultOpenWidget, SIGNAL(dialogFinished(bool)), SLOT(loadDatabase(bool)));
connect(m_csvImportWizard, SIGNAL(importFinished(bool)), SLOT(csvImportFinished(bool)));
connect(this, SIGNAL(currentChanged(int)), SLOT(emitCurrentModeChanged()));
- connect(this, SIGNAL(requestGlobalAutoType()), parent, SLOT(performGlobalAutoType()));
+ connect(this, SIGNAL(requestGlobalAutoType(const QString&)), parent, SLOT(performGlobalAutoType(const QString&)));
// clang-format on
connectDatabaseSignals();
@@ -309,6 +309,11 @@ void DatabaseWidget::setPreviewSplitterSizes(const QList<int>& sizes)
m_previewSplitter->setSizes(sizes);
}
+void DatabaseWidget::setSearchStringForAutoType(const QString& search)
+{
+ m_searchStringForAutoType = search;
+}
+
/**
* Get current view state of entry view
*/
@@ -1118,7 +1123,7 @@ void DatabaseWidget::unlockDatabase(bool accepted)
// Rather than starting AutoType directly for this database, signal the parent DatabaseTabWidget to
// restart AutoType now that this database is unlocked, so that other open+unlocked databases
// can be included in the search.
- emit requestGlobalAutoType();
+ emit requestGlobalAutoType(m_searchStringForAutoType);
}
}
diff --git a/src/gui/DatabaseWidget.h b/src/gui/DatabaseWidget.h
index b0abdc29c..3909dfd77 100644
--- a/src/gui/DatabaseWidget.h
+++ b/src/gui/DatabaseWidget.h
@@ -121,6 +121,7 @@ public:
void setMainSplitterSizes(const QList<int>& sizes);
QList<int> previewSplitterSizes() const;
void setPreviewSplitterSizes(const QList<int>& sizes);
+ void setSearchStringForAutoType(const QString& search);
signals:
// relayed Database signals
@@ -151,7 +152,7 @@ signals:
void previewSplitterSizesChanged();
void entryViewStateChanged();
void clearSearch();
- void requestGlobalAutoType();
+ void requestGlobalAutoType(const QString& search);
public slots:
bool lock();
@@ -297,6 +298,9 @@ private:
// Autoreload
bool m_blockAutoSave;
+
+ // Auto-Type related
+ QString m_searchStringForAutoType;
};
#endif // KEEPASSX_DATABASEWIDGET_H
diff --git a/src/gui/osutils/OSUtilsBase.h b/src/gui/osutils/OSUtilsBase.h
index 6e96a6a5c..080a53413 100644
--- a/src/gui/osutils/OSUtilsBase.h
+++ b/src/gui/osutils/OSUtilsBase.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2020 KeePassXC Team <team@keepassxc.org>
+ * Copyright (C) 2021 KeePassXC Team <team@keepassxc.org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -68,7 +68,7 @@ public:
virtual bool setPreventScreenCapture(QWindow* window, bool allow) const;
signals:
- void globalShortcutTriggered(const QString& name);
+ void globalShortcutTriggered(const QString& name, const QString& search = {});
/**
* Indicates platform UI theme change (light mode to dark mode).