diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b0bd3e0ab..5f666281c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -89,6 +89,19 @@ set(keepassx_SOURCES format/OpVaultReaderAttachments.cpp format/OpVaultReaderBandEntry.cpp format/OpVaultReaderSections.cpp + keys/CompositeKey.cpp + keys/FileKey.cpp + keys/PasswordKey.cpp + keys/ChallengeResponseKey.cpp + streams/HashedBlockStream.cpp + streams/HmacBlockStream.cpp + streams/LayeredStream.cpp + streams/qtiocompressor.cpp + streams/StoreDataStream.cpp + streams/SymmetricCipherStream.cpp + totp/totp.cpp) + +set(gui_SOURCES gui/styles/styles.qrc gui/styles/StateColorPalette.cpp gui/styles/base/phantomcolor.cpp @@ -182,52 +195,41 @@ set(keepassx_SOURCES gui/wizard/NewDatabaseWizardPage.cpp gui/wizard/NewDatabaseWizardPageMetaData.cpp gui/wizard/NewDatabaseWizardPageEncryption.cpp - gui/wizard/NewDatabaseWizardPageDatabaseKey.cpp - keys/CompositeKey.cpp - keys/FileKey.cpp - keys/PasswordKey.cpp - keys/ChallengeResponseKey.cpp - streams/HashedBlockStream.cpp - streams/HmacBlockStream.cpp - streams/LayeredStream.cpp - streams/qtiocompressor.cpp - streams/StoreDataStream.cpp - streams/SymmetricCipherStream.cpp - totp/totp.cpp) + gui/wizard/NewDatabaseWizardPageDatabaseKey.cpp) + if(APPLE) - set(keepassx_SOURCES - ${keepassx_SOURCES} - core/MacPasteboard.cpp + set(gui_SOURCES + ${gui_SOURCES} gui/osutils/macutils/MacUtils.cpp gui/osutils/macutils/ScreenLockListenerMac.cpp gui/osutils/macutils/AppKitImpl.mm gui/osutils/macutils/AppKit.h) endif() if(UNIX AND NOT APPLE) - set(keepassx_SOURCES - ${keepassx_SOURCES} + set(gui_SOURCES + ${gui_SOURCES} gui/osutils/nixutils/ScreenLockListenerDBus.cpp gui/osutils/nixutils/NixUtils.cpp) if(WITH_XC_X11) - list(APPEND keepassx_SOURCES + list(APPEND gui_SOURCES gui/osutils/nixutils/X11Funcs.cpp) endif() - qt5_add_dbus_adaptor(keepassx_SOURCES + qt5_add_dbus_adaptor(gui_SOURCES gui/org.keepassxc.KeePassXC.MainWindow.xml gui/MainWindow.h MainWindow) endif() if(WIN32) - set(keepassx_SOURCES - ${keepassx_SOURCES} + set(gui_SOURCES + ${gui_SOURCES} gui/osutils/winutils/ScreenLockListenerWin.cpp gui/osutils/winutils/WinUtils.cpp) if (MSVC) - list(APPEND keepassx_SOURCES winhello/WindowsHello.cpp) + list(APPEND gui_SOURCES winhello/WindowsHello.cpp) endif() endif() -set(keepassx_SOURCES ${keepassx_SOURCES} +set(gui_SOURCES ${gui_SOURCES} ../share/icons/icons.qrc ../share/wizard/wizard.qrc) @@ -248,10 +250,10 @@ add_subdirectory(browser) add_subdirectory(proxy) if(WITH_XC_BROWSER) set(keepassxcbrowser_LIB keepassxcbrowser) - set(keepassx_SOURCES ${keepassx_SOURCES} gui/dbsettings/DatabaseSettingsWidgetBrowser.cpp) - set(keepassx_SOURCES ${keepassx_SOURCES} gui/entry/EntryURLModel.cpp) - set(keepassx_SOURCES ${keepassx_SOURCES} gui/reports/ReportsWidgetBrowserStatistics.cpp) - set(keepassx_SOURCES ${keepassx_SOURCES} gui/reports/ReportsPageBrowserStatistics.cpp) + set(gui_SOURCES ${gui_SOURCES} gui/dbsettings/DatabaseSettingsWidgetBrowser.cpp) + set(gui_SOURCES ${gui_SOURCES} gui/entry/EntryURLModel.cpp) + set(gui_SOURCES ${gui_SOURCES} gui/reports/ReportsWidgetBrowserStatistics.cpp) + set(gui_SOURCES ${gui_SOURCES} gui/reports/ReportsPageBrowserStatistics.cpp) endif() add_subdirectory(autotype) @@ -277,7 +279,6 @@ endif() add_subdirectory(thirdparty) set(autotype_SOURCES - core/Tools.cpp autotype/AutoType.cpp autotype/AutoTypeAction.cpp autotype/AutoTypeMatchModel.cpp @@ -305,13 +306,13 @@ else() endif() if(WITH_XC_NETWORKING) - list(APPEND keepassx_SOURCES - core/HibpDownloader.cpp - core/NetworkManager.cpp + list(APPEND gui_SOURCES + networking/HibpDownloader.cpp + networking/NetworkManager.cpp + networking/UpdateChecker.cpp gui/UpdateCheckDialog.cpp gui/IconDownloader.cpp - gui/IconDownloaderDialog.cpp - updatecheck/UpdateChecker.cpp) + gui/IconDownloaderDialog.cpp) endif() if(APPLE) @@ -328,51 +329,61 @@ target_link_libraries(autotype Qt5::Core Qt5::Widgets) add_library(keepassx_core STATIC ${keepassx_SOURCES}) -set_target_properties(keepassx_core PROPERTIES COMPILE_DEFINITIONS KEEPASSX_BUILDING_CORE) -target_link_libraries(keepassx_core - autotype - ${keepassxcbrowser_LIB} +set(gui_SOURCES + ${gui_SOURCES} + ${keepassx_SOURCES}) + +set(keepassx_core_LIBRARIES ${qrcode_LIB} - ${fdosecrets_LIB} Qt5::Core Qt5::Concurrent - Qt5::Network - Qt5::Widgets ${BOTAN2_LIBRARIES} ${PCSC_LIBRARIES} ${ZXCVBN_LIBRARIES} ${ZLIB_LIBRARIES} ${ARGON2_LIBRARIES} - ${thirdparty_LIBRARIES} - ) + ${thirdparty_LIBRARIES}) + +add_library(keepassx_gui STATIC ${gui_SOURCES}) +target_link_libraries(keepassx_gui + ${keepassx_core_LIBRARIES} + Qt5::Network + Qt5::Widgets + autotype + ${keepassxcbrowser_LIB} + ${fdosecrets_LIB} + ) + +set_target_properties(keepassx_core PROPERTIES COMPILE_DEFINITIONS KEEPASSX_BUILDING_CORE) +target_link_libraries(keepassx_core ${keepassx_core_LIBRARIES}) if(WITH_XC_SSHAGENT) - target_link_libraries(keepassx_core sshagent) + target_link_libraries(keepassx_gui sshagent) endif() if(WITH_XC_KEESHARE) - target_link_libraries(keepassx_core keeshare) + target_link_libraries(keepassx_gui keeshare) endif() if(APPLE) - target_link_libraries(keepassx_core "-framework Foundation -framework AppKit -framework Carbon -framework Security -framework LocalAuthentication") + target_link_libraries(keepassx_gui "-framework Foundation -framework AppKit -framework Carbon -framework Security -framework LocalAuthentication") if(Qt5MacExtras_FOUND) - target_link_libraries(keepassx_core Qt5::MacExtras) + target_link_libraries(keepassx_gui Qt5::MacExtras) endif() endif() if(HAIKU) - target_link_libraries(keepassx_core network) + target_link_libraries(keepassx_gui network) endif() if(UNIX AND NOT APPLE) - target_link_libraries(keepassx_core Qt5::DBus) + target_link_libraries(keepassx_gui Qt5::DBus) if(WITH_XC_X11) - target_link_libraries(keepassx_core Qt5::X11Extras X11) + target_link_libraries(keepassx_gui Qt5::X11Extras X11) endif() include_directories(${Qt5Gui_PRIVATE_INCLUDE_DIRS}) endif() if(WIN32) - target_link_libraries(keepassx_core Wtsapi32.lib Ws2_32.lib) + target_link_libraries(keepassx_gui Wtsapi32.lib Ws2_32.lib) if (MSVC) - target_link_libraries(keepassx_core WindowsApp.lib) + target_link_libraries(keepassx_gui WindowsApp.lib) endif() endif() @@ -389,7 +400,7 @@ if(WIN32) endif() add_executable(${PROGNAME} WIN32 ${keepassx_SOURCES_MAINEXE} ${WIN32_ProductVersionFiles}) -target_link_libraries(${PROGNAME} keepassx_core) +target_link_libraries(${PROGNAME} keepassx_gui) set_target_properties(${PROGNAME} PROPERTIES ENABLE_EXPORTS ON) @@ -532,5 +543,5 @@ if(WIN32) endif() # The install commands in this subdirectory will be executed after all the install commands in the -# current scope are ran. It is required for correct functtioning of macdeployqt. +# current scope are ran. It is required for correct functioning of macdeployqt. add_subdirectory(post_install) diff --git a/src/autotype/test/CMakeLists.txt b/src/autotype/test/CMakeLists.txt index 453e36af5..d395936e0 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} Qt5::Core Qt5::Widgets) +target_link_libraries(keepassxc-autotype-test keepassx_gui ${autotype_LIB} Qt5::Core Qt5::Widgets) diff --git a/src/autotype/windows/CMakeLists.txt b/src/autotype/windows/CMakeLists.txt index 33bd54c58..8ebfd1332 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 keepassx_core ${autotype_LIB} Qt5::Core Qt5::Widgets) +target_link_libraries(keepassxc-autotype-windows keepassx_gui ${autotype_LIB} Qt5::Core Qt5::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 0704de639..dbb5470c5 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 keepassx_core Qt5::Core Qt5::Widgets Qt5::X11Extras ${X11_X11_LIB} ${X11_Xi_LIB} ${X11_XTest_LIB}) +target_link_libraries(keepassxc-autotype-xcb keepassx_gui Qt5::Core Qt5::Widgets Qt5::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/gui/IconDownloader.cpp b/src/gui/IconDownloader.cpp index 7e3fff0ae..85cfe4a17 100644 --- a/src/gui/IconDownloader.cpp +++ b/src/gui/IconDownloader.cpp @@ -17,7 +17,7 @@ #include "IconDownloader.h" #include "core/Config.h" -#include "core/NetworkManager.h" +#include "networking/NetworkManager.h" #include #include diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp index 6e0207d66..437653a3a 100644 --- a/src/gui/MainWindow.cpp +++ b/src/gui/MainWindow.cpp @@ -48,7 +48,7 @@ #ifdef WITH_XC_UPDATECHECK #include "gui/UpdateCheckDialog.h" -#include "updatecheck/UpdateChecker.h" +#include "networking/UpdateChecker.h" #endif #ifdef WITH_XC_SSHAGENT diff --git a/src/gui/UpdateCheckDialog.cpp b/src/gui/UpdateCheckDialog.cpp index da3169901..6d7015f73 100644 --- a/src/gui/UpdateCheckDialog.cpp +++ b/src/gui/UpdateCheckDialog.cpp @@ -22,7 +22,7 @@ #include "config-keepassx.h" #include "gui/Icons.h" -#include "updatecheck/UpdateChecker.h" +#include "networking/UpdateChecker.h" UpdateCheckDialog::UpdateCheckDialog(QWidget* parent) : QDialog(parent) diff --git a/src/gui/reports/ReportsWidgetHibp.h b/src/gui/reports/ReportsWidgetHibp.h index 5410417b2..29a2c4ff1 100644 --- a/src/gui/reports/ReportsWidgetHibp.h +++ b/src/gui/reports/ReportsWidgetHibp.h @@ -24,7 +24,7 @@ #include #ifdef WITH_XC_NETWORKING -#include "core/HibpDownloader.h" +#include "networking/HibpDownloader.h" #endif class Database; diff --git a/src/core/HibpDownloader.cpp b/src/networking/HibpDownloader.cpp similarity index 99% rename from src/core/HibpDownloader.cpp rename to src/networking/HibpDownloader.cpp index 9ff181093..8b09ce2c4 100644 --- a/src/core/HibpDownloader.cpp +++ b/src/networking/HibpDownloader.cpp @@ -16,7 +16,7 @@ */ #include "HibpDownloader.h" -#include "core/NetworkManager.h" +#include "NetworkManager.h" #include #include diff --git a/src/core/HibpDownloader.h b/src/networking/HibpDownloader.h similarity index 100% rename from src/core/HibpDownloader.h rename to src/networking/HibpDownloader.h diff --git a/src/core/NetworkManager.cpp b/src/networking/NetworkManager.cpp similarity index 100% rename from src/core/NetworkManager.cpp rename to src/networking/NetworkManager.cpp diff --git a/src/core/NetworkManager.h b/src/networking/NetworkManager.h similarity index 100% rename from src/core/NetworkManager.h rename to src/networking/NetworkManager.h diff --git a/src/updatecheck/UpdateChecker.cpp b/src/networking/UpdateChecker.cpp similarity index 99% rename from src/updatecheck/UpdateChecker.cpp rename to src/networking/UpdateChecker.cpp index ff2240628..ea3d435df 100644 --- a/src/updatecheck/UpdateChecker.cpp +++ b/src/networking/UpdateChecker.cpp @@ -17,10 +17,10 @@ #include "UpdateChecker.h" +#include "NetworkManager.h" #include "config-keepassx.h" #include "core/Clock.h" #include "core/Config.h" -#include "core/NetworkManager.h" #include #include diff --git a/src/updatecheck/UpdateChecker.h b/src/networking/UpdateChecker.h similarity index 100% rename from src/updatecheck/UpdateChecker.h rename to src/networking/UpdateChecker.h diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index db82da163..fafe2c62e 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -90,7 +90,7 @@ macro(add_unit_test) endif() endmacro(add_unit_test) -set(TEST_LIBRARIES keepassx_core Qt5::Test) +set(TEST_LIBRARIES keepassx_gui Qt5::Test) set(testsupport_SOURCES modeltest.cpp diff --git a/tests/TestUpdateCheck.cpp b/tests/TestUpdateCheck.cpp index df2643fad..f89757ea6 100644 --- a/tests/TestUpdateCheck.cpp +++ b/tests/TestUpdateCheck.cpp @@ -17,7 +17,7 @@ #include "TestUpdateCheck.h" #include "crypto/Crypto.h" -#include "updatecheck/UpdateChecker.h" +#include "networking/UpdateChecker.h" #include