mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-08-06 05:24:13 -04:00
Merge branch 'master' into develop
This commit is contained in:
commit
38524507d5
14 changed files with 1168 additions and 1248 deletions
|
@ -25,6 +25,7 @@
|
|||
#include <QMimeData>
|
||||
#include <QShortcut>
|
||||
#include <QTimer>
|
||||
#include <QWindow>
|
||||
|
||||
#include "config-keepassx.h"
|
||||
|
||||
|
@ -160,9 +161,9 @@ MainWindow::MainWindow()
|
|||
setAcceptDrops(true);
|
||||
|
||||
// Setup the search widget in the toolbar
|
||||
auto* search = new SearchWidget();
|
||||
search->connectSignals(m_actionMultiplexer);
|
||||
m_searchWidgetAction = m_ui->toolBar->addWidget(search);
|
||||
m_searchWidget = new SearchWidget();
|
||||
m_searchWidget->connectSignals(m_actionMultiplexer);
|
||||
m_searchWidgetAction = m_ui->toolBar->addWidget(m_searchWidget);
|
||||
m_searchWidgetAction->setEnabled(false);
|
||||
|
||||
m_countDefaultAttributes = m_ui->menuEntryCopyAttribute->actions().size();
|
||||
|
@ -268,7 +269,9 @@ MainWindow::MainWindow()
|
|||
m_ui->actionEntryCopyURL->setShortcutVisibleInContextMenu(true);
|
||||
#endif
|
||||
|
||||
connect(m_ui->menuEntries, SIGNAL(aboutToShow()), SLOT(obtainContextFocusLock()));
|
||||
connect(m_ui->menuEntries, SIGNAL(aboutToHide()), SLOT(releaseContextFocusLock()));
|
||||
connect(m_ui->menuGroups, SIGNAL(aboutToShow()), SLOT(obtainContextFocusLock()));
|
||||
connect(m_ui->menuGroups, SIGNAL(aboutToHide()), SLOT(releaseContextFocusLock()));
|
||||
|
||||
// Control window state
|
||||
|
@ -323,9 +326,9 @@ MainWindow::MainWindow()
|
|||
// Notify search when the active database changes or gets locked
|
||||
connect(m_ui->tabWidget,
|
||||
SIGNAL(activateDatabaseChanged(DatabaseWidget*)),
|
||||
search,
|
||||
m_searchWidget,
|
||||
SLOT(databaseChanged(DatabaseWidget*)));
|
||||
connect(m_ui->tabWidget, SIGNAL(databaseLocked(DatabaseWidget*)), search, SLOT(databaseChanged()));
|
||||
connect(m_ui->tabWidget, SIGNAL(databaseLocked(DatabaseWidget*)), m_searchWidget, SLOT(databaseChanged()));
|
||||
|
||||
connect(m_ui->tabWidget, SIGNAL(tabNameChanged()), SLOT(updateWindowTitle()));
|
||||
connect(m_ui->tabWidget, SIGNAL(currentChanged(int)), SLOT(updateWindowTitle()));
|
||||
|
@ -562,9 +565,10 @@ void MainWindow::setMenuActionState(DatabaseWidget::Mode mode)
|
|||
|
||||
switch (mode) {
|
||||
case DatabaseWidget::Mode::ViewMode: {
|
||||
// bool inSearch = dbWidget->isInSearchMode();
|
||||
bool singleEntrySelected = dbWidget->numberOfSelectedEntries() == 1 && (m_contextMenuFocusLock || dbWidget->currentEntryHasFocus());
|
||||
bool entriesSelected = dbWidget->numberOfSelectedEntries() > 0 && (m_contextMenuFocusLock || dbWidget->currentEntryHasFocus());
|
||||
bool hasFocus = m_contextMenuFocusLock || menuBar()->hasFocus() || m_searchWidget->hasFocus()
|
||||
|| dbWidget->currentEntryHasFocus();
|
||||
bool singleEntrySelected = dbWidget->numberOfSelectedEntries() == 1 && hasFocus;
|
||||
bool entriesSelected = dbWidget->numberOfSelectedEntries() > 0 && hasFocus;
|
||||
bool groupSelected = dbWidget->isGroupSelected();
|
||||
bool recycleBinSelected = dbWidget->isRecycleBinSelected();
|
||||
|
||||
|
@ -1014,6 +1018,11 @@ void MainWindow::updateTrayIcon()
|
|||
}
|
||||
}
|
||||
|
||||
void MainWindow::obtainContextFocusLock()
|
||||
{
|
||||
m_contextMenuFocusLock = true;
|
||||
}
|
||||
|
||||
void MainWindow::releaseContextFocusLock()
|
||||
{
|
||||
m_contextMenuFocusLock = false;
|
||||
|
@ -1021,13 +1030,11 @@ void MainWindow::releaseContextFocusLock()
|
|||
|
||||
void MainWindow::showEntryContextMenu(const QPoint& globalPos)
|
||||
{
|
||||
m_contextMenuFocusLock = true;
|
||||
m_ui->menuEntries->popup(globalPos);
|
||||
}
|
||||
|
||||
void MainWindow::showGroupContextMenu(const QPoint& globalPos)
|
||||
{
|
||||
m_contextMenuFocusLock = true;
|
||||
m_ui->menuGroups->popup(globalPos);
|
||||
}
|
||||
|
||||
|
@ -1106,9 +1113,16 @@ void MainWindow::processTrayIconTrigger()
|
|||
toggleWindow();
|
||||
} else if (m_trayIconTriggerReason == QSystemTrayIcon::Trigger
|
||||
|| m_trayIconTriggerReason == QSystemTrayIcon::MiddleClick) {
|
||||
// On single/middle click focus the window if it is not hidden
|
||||
// and did not have focus less than a second ago, otherwise toggle
|
||||
if (isHidden() || (Clock::currentSecondsSinceEpoch() - m_lastFocusOutTime) <= 1) {
|
||||
// Toggle window if hidden
|
||||
// If on windows, check if focus switched within the last second because
|
||||
// clicking the tray icon removes focus from main window
|
||||
// If on Linux or macOS, check if the window is active
|
||||
if (isHidden()
|
||||
#ifdef Q_OS_WIN
|
||||
|| (Clock::currentSecondsSinceEpoch() - m_lastFocusOutTime) <= 1) {
|
||||
#else
|
||||
|| windowHandle()->isActive()) {
|
||||
#endif
|
||||
toggleWindow();
|
||||
} else {
|
||||
bringToFront();
|
||||
|
|
|
@ -34,6 +34,7 @@ namespace Ui
|
|||
}
|
||||
|
||||
class InactivityTimer;
|
||||
class SearchWidget;
|
||||
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
|
@ -119,6 +120,7 @@ private slots:
|
|||
void selectPreviousDatabaseTab();
|
||||
void togglePasswordsHidden();
|
||||
void toggleUsernamesHidden();
|
||||
void obtainContextFocusLock();
|
||||
void releaseContextFocusLock();
|
||||
|
||||
private:
|
||||
|
@ -146,6 +148,7 @@ private:
|
|||
int m_countDefaultAttributes;
|
||||
QSystemTrayIcon* m_trayIcon;
|
||||
ScreenLockListener* m_screenLockListener;
|
||||
QPointer<SearchWidget> m_searchWidget;
|
||||
|
||||
Q_DISABLE_COPY(MainWindow)
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@ SearchWidget::SearchWidget(QWidget* parent)
|
|||
, m_clearSearchTimer(new QTimer(this))
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
setFocusProxy(m_ui->searchEdit);
|
||||
|
||||
m_helpWidget = new PopupHelpWidget(m_ui->searchEdit);
|
||||
m_helpWidget->setOffset(QPoint(0, 1));
|
||||
|
|
|
@ -44,6 +44,8 @@ if(WITH_XC_BROWSER)
|
|||
"@executable_path/../Frameworks/QtNetwork.framework/Versions/5/QtNetwork"
|
||||
-change /usr/local/opt/qt/lib/QtNetwork.framework/Versions/5/QtNetwork
|
||||
"@executable_path/../Frameworks/QtNetwork.framework/Versions/5/QtNetwork"
|
||||
-change /usr/local/opt/libsodium/lib/libsodium.23.dylib
|
||||
"@executable_path/../Frameworks/libsodium.23.dylib"
|
||||
keepassxc-proxy
|
||||
COMMENT "Changing linking of keepassxc-proxy")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue