From e04319d86f485689c2ad3c7a01fabcf8a82fbead Mon Sep 17 00:00:00 2001 From: varjolintu Date: Sat, 11 Jan 2025 09:36:07 +0200 Subject: [PATCH] Draft --- CMakeLists.txt | 2 +- share/translations/CMakeLists.txt | 2 +- src/CMakeLists.txt | 79 +++++++++---------- src/autotype/AutoTypeSelectDialog.cpp | 12 +-- src/autotype/test/CMakeLists.txt | 2 +- src/autotype/windows/CMakeLists.txt | 2 +- src/autotype/xcb/CMakeLists.txt | 2 +- src/browser/CMakeLists.txt | 6 +- src/core/Entry.cpp | 5 +- src/core/Group.cpp | 5 -- src/core/Metadata.cpp | 2 - src/core/PassphraseGenerator.cpp | 3 +- src/core/Tools.cpp | 2 - src/fdosecrets/CMakeLists.txt | 2 +- src/format/BitwardenReader.cpp | 7 +- src/format/CsvParser.cpp | 2 +- src/format/KeePass1Reader.cpp | 2 +- src/gui/MainWindow.cpp | 45 +++-------- .../DatabaseSettingsWidgetEncryption.ui | 1 - src/gui/group/GroupView.cpp | 10 +-- .../remote/DatabaseSettingsWidgetRemote.cpp | 2 + src/gui/remote/RemoteSettings.h | 1 + src/gui/styles/base/BaseStyle.cpp | 8 +- tests/CMakeLists.txt | 4 +- 24 files changed, 84 insertions(+), 124 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1e402bba93..251b043873 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -205,7 +205,7 @@ if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.14.0") check_pie_supported() endif() -# Find Qt5 compatibility library +# Find Qt6 compatibility library find_package(Qt6 REQUIRED COMPONENTS Core5Compat) # Find Botan early since the version affects subsequent compiler options diff --git a/share/translations/CMakeLists.txt b/share/translations/CMakeLists.txt index 07292ba11d..33f2ca7fdc 100644 --- a/share/translations/CMakeLists.txt +++ b/share/translations/CMakeLists.txt @@ -27,7 +27,7 @@ if(WIN32) elseif(APPLE OR KEEPASSXC_DIST_APPIMAGE) file(GLOB QTBASE_TRANSLATIONS /usr/share/qt/translations/qtbase_*.qm - /usr/share/qt5/translations/qtbase_*.qm + /usr/share/qt6/translations/qtbase_*.qm ${Qt6_PREFIX}/translations/qtbase_*.qm) endif() set(QM_FILES ${QM_FILES} ${QTBASE_TRANSLATIONS}) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 372eb3e0dd..fc64819fe0 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2023 KeePassXC Team +# Copyright (C) 2025 KeePassXC Team # Copyright (C) 2010 Felix Geyer # # This program is free software: you can redistribute it and/or modify @@ -233,26 +233,26 @@ if(UNIX AND NOT APPLE) endif() if(WITH_XC_X11) list(APPEND gui_SOURCES - gui/osutils/nixutils/X11Funcs.cpp) + gui/osutils/nixutils/X11Funcs.cpp) endif() - qt6_add_dbus_adaptor(keepassx_SOURCES + qt6_add_dbus_adaptor(gui_SOURCES gui/org.keepassxc.KeePassXC.MainWindow.xml gui/MainWindow.h MainWindow) set_source_files_properties( - quickunlock/dbus/org.freedesktop.PolicyKit1.Authority.xml - PROPERTIES - INCLUDE "quickunlock/PolkitDbusTypes.h" - ) - qt6_add_dbus_interface(keepassx_SOURCES - quickunlock/dbus/org.freedesktop.PolicyKit1.Authority.xml - polkit_dbus + quickunlock/dbus/org.freedesktop.PolicyKit1.Authority.xml + PROPERTIES + INCLUDE "quickunlock/PolkitDbusTypes.h" + ) + qt6_add_dbus_interface(core_SOURCES + quickunlock/dbus/org.freedesktop.PolicyKit1.Authority.xml + polkit_dbus ) find_library(KEYUTILS_LIBRARIES NAMES keyutils) if(NOT KEYUTILS_LIBRARIES) - message(FATAL_ERROR "Could not find libkeyutils") + message(FATAL_ERROR "Could not find libkeyutils") endif() endif() @@ -329,19 +329,19 @@ set(autotype_SOURCES autotype/WindowSelectComboBox.cpp) add_library(autotype STATIC ${autotype_SOURCES}) -target_link_libraries(autotype Qt5::Core Qt5::Widgets) +target_link_libraries(autotype Qt6::Core Qt6::Widgets) if(WITH_XC_YUBIKEY) list(APPEND core_SOURCES - keys/drivers/YubiKey.h - keys/drivers/YubiKey.cpp - keys/drivers/YubiKeyInterface.cpp - keys/drivers/YubiKeyInterfaceUSB.cpp - keys/drivers/YubiKeyInterfacePCSC.cpp) + keys/drivers/YubiKey.h + keys/drivers/YubiKey.cpp + keys/drivers/YubiKeyInterface.cpp + keys/drivers/YubiKeyInterfaceUSB.cpp + keys/drivers/YubiKeyInterfacePCSC.cpp) else() list(APPEND core_SOURCES - keys/drivers/YubiKey.h - keys/drivers/YubiKeyStub.cpp) + keys/drivers/YubiKey.h + keys/drivers/YubiKeyStub.cpp) endif() if(WITH_XC_NETWORKING) @@ -357,25 +357,13 @@ endif() configure_file(config-keepassx.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-keepassx.h) configure_file(git-info.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/git-info.h) -add_library(autotype STATIC ${autotype_SOURCES}) -target_link_libraries(autotype Qt6::Core Qt6::Network Qt6::Widgets) - -add_library(keepassx_core STATIC ${keepassx_SOURCES}) - -find_package(Qt6 REQUIRED COMPONENTS SvgWidgets) - -set_target_properties(keepassx_core PROPERTIES COMPILE_DEFINITIONS KEEPASSX_BUILDING_CORE) -target_link_libraries(keepassx_core - autotype - ${keepassxcbrowser_LIB} +# Core Library Definition +add_library(keepassxc_core STATIC ${core_SOURCES}) +set_target_properties(keepassxc_core PROPERTIES COMPILE_DEFINITIONS KEEPASSX_BUILDING_CORE) +target_link_libraries(keepassxc_core ${qrcode_LIB} - ${fdosecrets_LIB} Qt6::Core - Qt6::Core5Compat Qt6::Concurrent - Qt6::Network - Qt6::SvgWidgets - Qt6::Widgets ${BOTAN_LIBRARIES} ${PCSC_LIBRARIES} ${ZXCVBN_LIBRARIES} @@ -387,11 +375,13 @@ target_link_libraries(keepassx_core # GUI Library Definition add_library(keepassxc_gui STATIC ${gui_SOURCES}) +find_package(Qt6 REQUIRED COMPONENTS SvgWidgets) set_target_properties(keepassxc_gui PROPERTIES COMPILE_DEFINITIONS KEEPASSX_BUILDING_CORE) target_link_libraries(keepassxc_gui keepassxc_core - Qt5::Network - Qt5::Widgets + Qt6::Network + Qt6::SvgWidgets + Qt6::Widgets autotype ${browser_LIB} ${fdosecrets_LIB} @@ -399,15 +389,18 @@ target_link_libraries(keepassxc_gui ${sshagent_LIB}) if(APPLE) - target_link_libraries(keepassx_core "-framework Foundation -framework AppKit -framework Carbon -framework Security -framework LocalAuthentication -framework ScreenCaptureKit") + target_link_libraries(keepassxc_gui "-framework Foundation -framework AppKit -framework Carbon -framework Security -framework LocalAuthentication -framework ScreenCaptureKit") + if(Qt6MacExtras_FOUND) + target_link_libraries(keepassxc_gui Qt6::MacExtras) + endif() endif() if(HAIKU) target_link_libraries(keepassxc_gui network) endif() if(UNIX AND NOT APPLE) - target_link_libraries(keepassx_core Qt6::DBus ${LIBUSB_LIBRARIES}) + target_link_libraries(keepassxc_core Qt6::DBus ${LIBUSB_LIBRARIES}) if(WITH_XC_X11) - target_link_libraries(keepassx_core Qt6::X11Extras X11) + target_link_libraries(keepassxc_gui Qt6::X11Extras X11) endif() include_directories(${Qt6Gui_PRIVATE_INCLUDE_DIRS}) endif() @@ -533,7 +526,7 @@ if(WIN32) COMPONENT Runtime) # Use windeployqt.exe to setup Qt dependencies - if(Qt6Core_VERSION VERSION_LESS "6.6.0") # TODO: Check this. + if(Qt6Core_VERSION VERSION_LESS "6.6.0") set(WINDEPLOYQT_MODE "--release") if(CMAKE_BUILD_TYPE_LOWER STREQUAL "debug") set(WINDEPLOYQT_MODE "--debug") @@ -548,7 +541,7 @@ if(WIN32) find_file(OPENSSL_DLL NAMES libssl-3.dll libssl-3-x64.dll HINTS "${OPENSSL_ROOT_DIR}/bin" - ) + ) if (NOT OPENSSL_DLL) message(FATAL_ERROR "Cannot find libssl dll, ensure openssl is properly installed.") endif() @@ -556,7 +549,7 @@ if(WIN32) find_file(CRYPTO_DLL NAMES libcrypto-3.dll libcrypto-3-x64.dll HINTS "${OPENSSL_ROOT_DIR}/bin" - ) + ) if (NOT CRYPTO_DLL) message(FATAL_ERROR "Cannot find libcrypto dll, ensure openssl is properly installed.") endif() diff --git a/src/autotype/AutoTypeSelectDialog.cpp b/src/autotype/AutoTypeSelectDialog.cpp index 46422102d5..6ad1865643 100644 --- a/src/autotype/AutoTypeSelectDialog.cpp +++ b/src/autotype/AutoTypeSelectDialog.cpp @@ -296,7 +296,7 @@ void AutoTypeSelectDialog::buildActionMenu() m_actionMenu->addAction(copyPasswordAction); m_actionMenu->addAction(copyTotpAction); - typeUsernameAction->setShortcut(Qt::CTRL + Qt::Key_1); + typeUsernameAction->setShortcut(Qt::CTRL | Qt::Key_1); typeUsernameAction->setProperty(MENU_FIELD_PROP_NAME, MENU_FIELD::USERNAME); connect(typeUsernameAction, &QAction::triggered, this, [&] { auto match = m_ui->view->currentMatch(); @@ -304,7 +304,7 @@ void AutoTypeSelectDialog::buildActionMenu() submitAutoTypeMatch(match); }); - typePasswordAction->setShortcut(Qt::CTRL + Qt::Key_2); + typePasswordAction->setShortcut(Qt::CTRL | Qt::Key_2); typePasswordAction->setProperty(MENU_FIELD_PROP_NAME, MENU_FIELD::PASSWORD); connect(typePasswordAction, &QAction::triggered, this, [&] { auto match = m_ui->view->currentMatch(); @@ -312,7 +312,7 @@ void AutoTypeSelectDialog::buildActionMenu() submitAutoTypeMatch(match); }); - typeTotpAction->setShortcut(Qt::CTRL + Qt::Key_3); + typeTotpAction->setShortcut(Qt::CTRL | Qt::Key_3); typeTotpAction->setProperty(MENU_FIELD_PROP_NAME, MENU_FIELD::TOTP); connect(typeTotpAction, &QAction::triggered, this, [&] { auto match = m_ui->view->currentMatch(); @@ -330,7 +330,7 @@ void AutoTypeSelectDialog::buildActionMenu() }); #endif - copyUsernameAction->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_1); + copyUsernameAction->setShortcut(Qt::CTRL | Qt::SHIFT | Qt::Key_1); copyUsernameAction->setProperty(MENU_FIELD_PROP_NAME, MENU_FIELD::USERNAME); connect(copyUsernameAction, &QAction::triggered, this, [&] { auto entry = m_ui->view->currentMatch().first; @@ -340,7 +340,7 @@ void AutoTypeSelectDialog::buildActionMenu() } }); - copyPasswordAction->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_2); + copyPasswordAction->setShortcut(Qt::CTRL | Qt::SHIFT | Qt::Key_2); copyPasswordAction->setProperty(MENU_FIELD_PROP_NAME, MENU_FIELD::PASSWORD); connect(copyPasswordAction, &QAction::triggered, this, [&] { auto entry = m_ui->view->currentMatch().first; @@ -350,7 +350,7 @@ void AutoTypeSelectDialog::buildActionMenu() } }); - copyTotpAction->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_3); + copyTotpAction->setShortcut(Qt::CTRL | Qt::SHIFT | Qt::Key_3); copyTotpAction->setProperty(MENU_FIELD_PROP_NAME, MENU_FIELD::TOTP); connect(copyTotpAction, &QAction::triggered, this, [&] { auto entry = m_ui->view->currentMatch().first; diff --git a/src/autotype/test/CMakeLists.txt b/src/autotype/test/CMakeLists.txt index e0e4e694df..27211fa4c7 100644 --- a/src/autotype/test/CMakeLists.txt +++ b/src/autotype/test/CMakeLists.txt @@ -1,4 +1,4 @@ set(autotype_test_SOURCES AutoTypeTest.cpp) add_library(keepassxc-autotype-test MODULE ${autotype_test_SOURCES}) -target_link_libraries(keepassxc-autotype-test keepassx_core ${autotype_LIB} Qt6::Core Qt6::Widgets) +target_link_libraries(keepassxc-autotype-test keepassxc_core ${autotype_LIB} Qt6::Core Qt6::Widgets) diff --git a/src/autotype/windows/CMakeLists.txt b/src/autotype/windows/CMakeLists.txt index 5b9cbecff9..6ed316e2d5 100644 --- a/src/autotype/windows/CMakeLists.txt +++ b/src/autotype/windows/CMakeLists.txt @@ -1,7 +1,7 @@ set(autotype_win_SOURCES AutoTypeWindows.cpp) add_library(keepassxc-autotype-windows MODULE ${autotype_win_SOURCES}) -target_link_libraries(keepassxc-autotype-windows keepassxc_gui ${autotype_LIB} Qt5::Core Qt5::Widgets) +target_link_libraries(keepassxc-autotype-windows keepassxc_gui ${autotype_LIB} Qt6::Core Qt6::Widgets) install(TARGETS keepassxc-autotype-windows BUNDLE DESTINATION . COMPONENT Runtime LIBRARY DESTINATION ${PLUGIN_INSTALL_DIR} COMPONENT Runtime) diff --git a/src/autotype/xcb/CMakeLists.txt b/src/autotype/xcb/CMakeLists.txt index f14017f63a..6d89737e62 100644 --- a/src/autotype/xcb/CMakeLists.txt +++ b/src/autotype/xcb/CMakeLists.txt @@ -3,7 +3,7 @@ include_directories(SYSTEM ${X11_X11_INCLUDE_PATH}) set(autotype_XCB_SOURCES AutoTypeXCB.cpp) add_library(keepassxc-autotype-xcb MODULE ${autotype_XCB_SOURCES}) -target_link_libraries(keepassxc-autotype-xcb keepassxc_gui Qt5::Core Qt5::Widgets Qt5::X11Extras ${X11_X11_LIB} ${X11_Xi_LIB} ${X11_XTest_LIB}) +target_link_libraries(keepassxc-autotype-xcb keepassxc_gui Qt6::Core Qt6::Widgets Qt6::X11Extras ${X11_X11_LIB} ${X11_Xi_LIB} ${X11_XTest_LIB}) install(TARGETS keepassxc-autotype-xcb BUNDLE DESTINATION . COMPONENT Runtime LIBRARY DESTINATION ${PLUGIN_INSTALL_DIR} COMPONENT Runtime) diff --git a/src/browser/CMakeLists.txt b/src/browser/CMakeLists.txt index 778b63e9a3..a1e35b15fa 100644 --- a/src/browser/CMakeLists.txt +++ b/src/browser/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2024 KeePassXC Team +# Copyright (C) 2025 KeePassXC Team # # 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 @@ -40,6 +40,6 @@ if(WITH_XC_BROWSER) PasskeyUtils.cpp) endif() - add_library(keepassxcbrowser STATIC ${keepassxcbrowser_SOURCES}) - target_link_libraries(keepassxcbrowser Qt6::Core Qt6::Concurrent Qt6::Widgets Qt6::Network ${BOTAN_LIBRARIES}) + add_library(browser STATIC ${browser_SOURCES}) + target_link_libraries(browser Qt6::Core Qt6::Concurrent Qt6::Widgets Qt6::Network ${BOTAN_LIBRARIES}) endif() diff --git a/src/core/Entry.cpp b/src/core/Entry.cpp index e12379b904..3feaf17cd5 100644 --- a/src/core/Entry.cpp +++ b/src/core/Entry.cpp @@ -1047,11 +1047,11 @@ QString Entry::resolveMultiplePlaceholdersRecursive(const QString& str, int maxD int capEnd = 0; while (matches.hasNext()) { const auto match = matches.next(); - result += str.midRef(capEnd, match.capturedStart() - capEnd); + result += QStringView{str}.mid(capEnd, match.capturedStart() - capEnd); result += resolvePlaceholderRecursive(match.captured(), maxDepth); capEnd = match.capturedEnd(); } - result += str.rightRef(str.length() - capEnd); + result += QStringView{str}.right(str.length() - capEnd); return result; } @@ -1530,7 +1530,6 @@ QString Entry::resolveUrl(const QString& url) const } else if (url.startsWith("cmd://")) { QStringList cmdList = newUrl.split(" "); for (int i = 1; i < cmdList.size(); ++i) { - QString& cmd = cmdList[i]; // Don't pass arguments to the resolveUrl function (they look like URL's) if (!cmdList[i].startsWith("-") && !cmdList[i].startsWith("/")) { return resolveUrl(cmdList[i].remove(QRegularExpression("'|\""))); diff --git a/src/core/Group.cpp b/src/core/Group.cpp index c3fff698b3..b4b24452fd 100644 --- a/src/core/Group.cpp +++ b/src/core/Group.cpp @@ -20,11 +20,6 @@ #include "config-keepassx.h" #include "core/Config.h" - -#ifdef WITH_XC_KEESHARE -#include "keeshare/KeeShare.h" -#endif - #include "core/Global.h" #include "core/Metadata.h" #include "core/Tools.h" diff --git a/src/core/Metadata.cpp b/src/core/Metadata.cpp index 8e714e0f22..18abd1edaf 100644 --- a/src/core/Metadata.cpp +++ b/src/core/Metadata.cpp @@ -19,10 +19,8 @@ #include "Metadata.h" #include "core/Clock.h" -#include "core/Entry.h" #include "core/Group.h" -#include #include #include diff --git a/src/core/PassphraseGenerator.cpp b/src/core/PassphraseGenerator.cpp index 36eddf01fe..cd448a0925 100644 --- a/src/core/PassphraseGenerator.cpp +++ b/src/core/PassphraseGenerator.cpp @@ -73,7 +73,6 @@ void PassphraseGenerator::setWordList(const QString& path) } QTextStream in(&file); - in.setCodec("UTF-8"); QString line = in.readLine(); bool isSigned = line.startsWith("-----BEGIN PGP SIGNED MESSAGE-----"); if (isSigned) { @@ -99,7 +98,7 @@ void PassphraseGenerator::setWordList(const QString& path) line = in.readLine(); } - m_wordlist = wordset.toList(); + m_wordlist = wordset.values(); if (m_wordlist.size() < m_minimum_wordlist_length) { qWarning("Wordlist is less than minimum acceptable size: %s", qPrintable(path)); diff --git a/src/core/Tools.cpp b/src/core/Tools.cpp index b0bd20c7f8..0d7c16c2fc 100644 --- a/src/core/Tools.cpp +++ b/src/core/Tools.cpp @@ -36,8 +36,6 @@ #include #include #include -#include -#include #include #include #include diff --git a/src/fdosecrets/CMakeLists.txt b/src/fdosecrets/CMakeLists.txt index 7489debef2..86d7a1c0f0 100644 --- a/src/fdosecrets/CMakeLists.txt +++ b/src/fdosecrets/CMakeLists.txt @@ -30,5 +30,5 @@ if(WITH_XC_FDOSECRETS) objects/Prompt.cpp dbus/DBusTypes.cpp ) - target_link_libraries(fdosecrets Qt5::Core Qt5::Widgets Qt5::DBus ${BOTAN_LIBRARIES}) + target_link_libraries(fdosecrets Qt6::Core Qt6::Widgets Qt6::DBus ${BOTAN_LIBRARIES}) endif() diff --git a/src/format/BitwardenReader.cpp b/src/format/BitwardenReader.cpp index 5f729aa776..12d9a5cc72 100644 --- a/src/format/BitwardenReader.cpp +++ b/src/format/BitwardenReader.cpp @@ -90,8 +90,11 @@ namespace // Change from UUID to base64 byte array const auto credentialIdValue = passkey.value("credentialId").toString(); if (!credentialIdValue.isEmpty()) { - const auto credentialUuid = Tools::uuidToHex(credentialIdValue); - const auto credentialIdArray = QByteArray::fromHex(credentialUuid.toUtf8()); + const auto uuid = Tools::hexToUuid(credentialIdValue); + // What? + //const auto credentialUuid = Tools::uuidToHex(credentialIdValue); + //const auto credentialIdArray = QByteArray::fromHex(credentialUuid.toUtf8()); + const auto credentialIdArray = QByteArray::fromHex(uuid.toByteArray()); const auto credentialId = credentialIdArray.toBase64(QByteArray::Base64UrlEncoding | QByteArray::OmitTrailingEquals); entry->attributes()->set(EntryAttributes::KPEX_PASSKEY_CREDENTIAL_ID, credentialId, true); diff --git a/src/format/CsvParser.cpp b/src/format/CsvParser.cpp index 9f2a1d6ba9..db9002a6be 100644 --- a/src/format/CsvParser.cpp +++ b/src/format/CsvParser.cpp @@ -19,7 +19,7 @@ #include "CsvParser.h" #include -#include +//#include #include "core/Tools.h" diff --git a/src/format/KeePass1Reader.cpp b/src/format/KeePass1Reader.cpp index 7d608ffb3f..6cb3468841 100644 --- a/src/format/KeePass1Reader.cpp +++ b/src/format/KeePass1Reader.cpp @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include "core/Endian.h" #include "core/Group.h" diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp index 394c6ecb77..74d0415a29 100644 --- a/src/gui/MainWindow.cpp +++ b/src/gui/MainWindow.cpp @@ -272,7 +272,6 @@ MainWindow::MainWindow() connect(m_inactivityTimer, SIGNAL(inactivityDetected()), this, SLOT(lockDatabasesAfterInactivity())); applySettingsChanges(); -#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) // Qt 5.10 introduced a new "feature" to hide shortcuts in context menus // Unfortunately, Qt::AA_DontShowShortcutsInContextMenus is broken, have to manually enable them m_ui->actionEntryNew->setShortcutVisibleInContextMenu(true); @@ -2112,47 +2111,21 @@ void MainWindow::initActionCollection() } // Actions with standard shortcuts - ac->setDefaultShortcut(m_ui->actionDatabaseOpen, QKeySequence::Open, Qt::CTRL | Qt::Key_O); - ac->setDefaultShortcut(m_ui->actionDatabaseSave, QKeySequence::Save, Qt::CTRL | Qt::Key_S); - ac->setDefaultShortcut(m_ui->actionDatabaseSaveAs, QKeySequence::SaveAs, Qt::CTRL | Qt::SHIFT | Qt::Key_S); - ac->setDefaultShortcut(m_ui->actionDatabaseClose, QKeySequence::Close, Qt::CTRL | Qt::Key_W); - ac->setDefaultShortcut(m_ui->actionSettings, QKeySequence::Preferences, Qt::CTRL | Qt::Key_Comma); - ac->setDefaultShortcut(m_ui->actionQuit, QKeySequence::Quit, Qt::CTRL | Qt::Key_Q); - ac->setDefaultShortcut(m_ui->actionEntryNew, QKeySequence::New, Qt::CTRL | Qt::Key_N); + ac->setDefaultShortcut(m_ui->actionDatabaseOpen, QKeySequence::Open); + ac->setDefaultShortcut(m_ui->actionDatabaseSave, QKeySequence::Save); + ac->setDefaultShortcut(m_ui->actionDatabaseSaveAs, QKeySequence::SaveAs); + ac->setDefaultShortcut(m_ui->actionDatabaseClose, QKeySequence::Close); + ac->setDefaultShortcut(m_ui->actionSettings, QKeySequence::Preferences); + ac->setDefaultShortcut(m_ui->actionQuit, QKeySequence::Quit); + ac->setDefaultShortcut(m_ui->actionEntryNew, QKeySequence::New); // Prevent conflicts with global Mac shortcuts (force Control on all platforms) // Note: Qt::META means Ctrl on Mac. #ifdef Q_OS_MAC - ac->setDefaultShortcut(m_ui->actionEntryAddToAgent, Qt::META + Qt::Key_H); - ac->setDefaultShortcut(m_ui->actionEntryRemoveFromAgent, Qt::META + Qt::SHIFT + Qt::Key_H); + ac->setDefaultShortcut(m_ui->actionEntryAddToAgent, Qt::META | Qt::Key_H); + ac->setDefaultShortcut(m_ui->actionEntryRemoveFromAgent, Qt::META | Qt::SHIFT | Qt::Key_H); #endif - // All other actions with default shortcuts - ac->setDefaultShortcut(m_ui->actionDatabaseNew, Qt::CTRL | Qt::SHIFT | Qt::Key_N); - ac->setDefaultShortcut(m_ui->actionDatabaseSettings, Qt::CTRL | Qt::SHIFT | Qt::Key_Comma); - ac->setDefaultShortcut(m_ui->actionReports, Qt::CTRL | Qt::SHIFT | Qt::Key_R); - ac->setDefaultShortcut(m_ui->actionLockDatabase, Qt::CTRL | Qt::Key_L); - ac->setDefaultShortcut(m_ui->actionLockAllDatabases, Qt::CTRL | Qt::SHIFT | Qt::Key_L); - ac->setDefaultShortcut(m_ui->actionEntryEdit, Qt::CTRL | Qt::Key_E); - ac->setDefaultShortcut(m_ui->actionEntryDelete, Qt::CTRL | Qt::Key_D); - ac->setDefaultShortcut(m_ui->actionEntryDelete, Qt::Key_Delete); - ac->setDefaultShortcut(m_ui->actionEntryClone, Qt::CTRL | Qt::Key_K); - ac->setDefaultShortcut(m_ui->actionEntryTotp, Qt::CTRL | Qt::SHIFT | Qt::Key_T); - ac->setDefaultShortcut(m_ui->actionEntryDownloadIcon, Qt::CTRL | Qt::SHIFT | Qt::Key_D); - ac->setDefaultShortcut(m_ui->actionEntryCopyTotp, Qt::CTRL + Qt::Key_T); - ac->setDefaultShortcut(m_ui->actionEntryCopyPasswordTotp, Qt::CTRL | Qt::Key_Y); - ac->setDefaultShortcut(m_ui->actionEntryMoveUp, Qt::CTRL | Qt::ALT | Qt::Key_Up); - ac->setDefaultShortcut(m_ui->actionEntryMoveDown, Qt::CTRL | Qt::ALT | Qt::Key_Down); - ac->setDefaultShortcut(m_ui->actionEntryCopyUsername, Qt::CTRL | Qt::Key_B); - ac->setDefaultShortcut(m_ui->actionEntryCopyPassword, Qt::CTRL | Qt::Key_C); - ac->setDefaultShortcut(m_ui->actionEntryCopyTitle, Qt::CTRL | Qt::Key_I); - ac->setDefaultShortcut(m_ui->actionEntryAutoTypeSequence, Qt::CTRL | Qt::SHIFT | Qt::Key_V); - ac->setDefaultShortcut(m_ui->actionEntryOpenUrl, Qt::CTRL | Qt::SHIFT | Qt::Key_U); - ac->setDefaultShortcut(m_ui->actionEntryCopyURL, Qt::CTRL | Qt::Key_U); - ac->setDefaultShortcut(m_ui->actionEntryRestore, Qt::CTRL | Qt::Key_R); - ac->setDefaultShortcut(m_ui->actionEntryAddToAgent, modifier | Qt::Key_H); - ac->setDefaultShortcut(m_ui->actionEntryRemoveFromAgent, modifier | Qt::SHIFT | Qt::Key_H); - QTimer::singleShot(1, ac, &ActionCollection::restoreShortcuts); } diff --git a/src/gui/dbsettings/DatabaseSettingsWidgetEncryption.ui b/src/gui/dbsettings/DatabaseSettingsWidgetEncryption.ui index dd5efe6710..581bc6ca2a 100644 --- a/src/gui/dbsettings/DatabaseSettingsWidgetEncryption.ui +++ b/src/gui/dbsettings/DatabaseSettingsWidgetEncryption.ui @@ -537,7 +537,6 @@ transformBenchmarkButton memorySpinBox parallelismSpinBox - advancedSettingsButton diff --git a/src/gui/group/GroupView.cpp b/src/gui/group/GroupView.cpp index 46cc0af6af..51ac46ffd1 100644 --- a/src/gui/group/GroupView.cpp +++ b/src/gui/group/GroupView.cpp @@ -44,16 +44,16 @@ GroupView::GroupView(Database* db, QWidget* parent) connect(selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), SIGNAL(groupSelectionChanged())); // clang-format on - new QShortcut(Qt::CTRL + Qt::Key_F10, this, SLOT(contextMenuShortcutPressed()), nullptr, Qt::WidgetShortcut); + new QShortcut(Qt::CTRL | Qt::Key_F10, this, SLOT(contextMenuShortcutPressed()), nullptr, Qt::WidgetShortcut); new QShortcut( - Qt::CTRL + Qt::SHIFT + Qt::Key_PageUp, this, SLOT(selectPreviousGroup()), nullptr, Qt::WindowShortcut); - new QShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_PageDown, this, SLOT(selectNextGroup()), nullptr, Qt::WindowShortcut); + Qt::CTRL | Qt::SHIFT | Qt::Key_PageUp, this, SLOT(selectPreviousGroup()), nullptr, Qt::WindowShortcut); + new QShortcut(Qt::CTRL | Qt::SHIFT | Qt::Key_PageDown, this, SLOT(selectNextGroup()), nullptr, Qt::WindowShortcut); // keyboard shortcuts to sort children of a group - auto shortcut = new QShortcut(Qt::CTRL + Qt::Key_Down, this, nullptr, nullptr, Qt::WidgetShortcut); + auto shortcut = new QShortcut(Qt::CTRL | Qt::Key_Down, this, nullptr, nullptr, Qt::WidgetShortcut); connect(shortcut, &QShortcut::activated, this, [this]() { sortGroups(false); }); - shortcut = new QShortcut(Qt::CTRL + Qt::Key_Up, this, nullptr, nullptr, Qt::WidgetShortcut); + shortcut = new QShortcut(Qt::CTRL | Qt::Key_Up, this, nullptr, nullptr, Qt::WidgetShortcut); connect(shortcut, &QShortcut::activated, this, [this]() { sortGroups(true); }); modelReset(); diff --git a/src/gui/remote/DatabaseSettingsWidgetRemote.cpp b/src/gui/remote/DatabaseSettingsWidgetRemote.cpp index f66edba7e7..d69e6b4f49 100644 --- a/src/gui/remote/DatabaseSettingsWidgetRemote.cpp +++ b/src/gui/remote/DatabaseSettingsWidgetRemote.cpp @@ -25,6 +25,8 @@ #include "RemoteSettings.h" #include "gui/MessageBox.h" +#include + DatabaseSettingsWidgetRemote::DatabaseSettingsWidgetRemote(QWidget* parent) : DatabaseSettingsWidget(parent) , m_remoteSettings(new RemoteSettings(nullptr, this)) diff --git a/src/gui/remote/RemoteSettings.h b/src/gui/remote/RemoteSettings.h index 4b414494c6..5c9c299d11 100644 --- a/src/gui/remote/RemoteSettings.h +++ b/src/gui/remote/RemoteSettings.h @@ -19,6 +19,7 @@ #define KEEPASSXC_REMOTESETTINGS_H #include +#include #include class Database; diff --git a/src/gui/styles/base/BaseStyle.cpp b/src/gui/styles/base/BaseStyle.cpp index 1ab632ec0a..c9a74d69a0 100644 --- a/src/gui/styles/base/BaseStyle.cpp +++ b/src/gui/styles/base/BaseStyle.cpp @@ -513,7 +513,7 @@ namespace Phantom // generated changes. If that happens, change to use the definition of // `fastfragile_hash_qpalette` below, which is less likely to collide with an // arbitrarily numbered key but also does more work. -#if QT_VERSION < QT_VERSION_CHECK(6, 7, 0) // TODO: What to do here? +#if QT_VERSION < QT_VERSION_CHECK(6, 6, 0) // TODO: What to do here? x.u = x.u ^ (static_cast(p.currentColorGroup()) << (64 - 3)); return x.u; #else @@ -522,11 +522,11 @@ namespace Phantom // guard for it, so that it will default to a more safe definition on the // next guaranteed big breaking change for Qt. A warning will hopefully get // someone to double-check it at some point in the future. -#warning "Verify contents and layout of QPalette::cacheKey() have not changed" +//#warning "Verify contents and layout of QPalette::cacheKey() have not changed" QtPrivate::QHashCombine c; uint h = qHash(p.currentColorGroup()); - h = c(h, (uint)(x.u & 0xFFFFFFFFu)); - h = c(h, (uint)((x.u >> 32) & 0xFFFFFFFFu)); + h = c(h, static_cast(x.u & 0xFFFFFFFFu)); + h = c(h, static_cast((x.u >> 32) & 0xFFFFFFFFu)); return h; #endif } diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 24623aa62f..1c1b698c49 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2023 KeePassXC Team +# Copyright (C) 2025 KeePassXC Team # Copyright (C) 2010 Felix Geyer # # This program is free software: you can redistribute it and/or modify @@ -90,7 +90,7 @@ macro(add_unit_test) endif() endmacro(add_unit_test) -set(TEST_LIBRARIES keepassx_core Qt6::Test) +set(TEST_LIBRARIES keepassxc_core Qt6::Test) set(testsupport_SOURCES modeltest.cpp