From 07a41f58d72b6ffd688792d259dcd82cf0eac933 Mon Sep 17 00:00:00 2001 From: thez3ro Date: Tue, 13 Dec 2016 21:14:39 +0100 Subject: [PATCH] Add autotype library linking Added Autotype switch + updated Travis to always test all extension --- .travis.yml | 4 ++-- src/CMakeLists.txt | 30 ++++++++++++++++++++---------- src/autotype/AutoType.cpp | 4 ++++ src/autotype/CMakeLists.txt | 2 -- src/autotype/test/CMakeLists.txt | 2 +- tests/CMakeLists.txt | 1 + 6 files changed, 28 insertions(+), 15 deletions(-) diff --git a/.travis.yml b/.travis.yml index d4caf68d5..a7807b612 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,7 +10,7 @@ os: # Define clang compiler without any frills compiler: - clang - + # Define gcc compile with deploy option (only for master/develop merges) matrix: include: @@ -33,7 +33,7 @@ before_script: - mkdir build && pushd build script: - - cmake -DCMAKE_BUILD_TYPE=Release -DWITH_GUI_TESTS=ON $CMAKE_ARGS .. + - cmake -DCMAKE_BUILD_TYPE=Release -DWITH_GUI_TESTS=ON -DWITH_XC_HTTP=ON -DWITH_XC_AUTOTYPE=ON -DWITH_XC_YUBIKEY=ON $CMAKE_ARGS .. - make -j2 - if [ "$TRAVIS_OS_NAME" = "linux" ]; then make test ARGS+="-E testgui --output-on-failure"; fi - if [ "$TRAVIS_OS_NAME" = "linux" ]; then xvfb-run -a --server-args="-screen 0 800x600x24" make test ARGS+="-R testgui --output-on-failure"; fi diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b85032ef3..62ac6ef22 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -29,15 +29,6 @@ endif() configure_file(version.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/version.h @ONLY) set(keepassx_SOURCES - autotype/AutoType.cpp - autotype/AutoTypeAction.cpp - autotype/AutoTypePlatformPlugin.h - autotype/AutoTypeSelectDialog.cpp - autotype/AutoTypeSelectView.cpp - autotype/ShortcutWidget.cpp - autotype/WildcardMatcher.cpp - autotype/WindowSelectComboBox.cpp - autotype/test/AutoTypeTestInterface.h core/AutoTypeAssociations.cpp core/Config.cpp core/Database.cpp @@ -156,6 +147,7 @@ set(keepassx_FORMS ) add_feature_info(KeePassHTTP WITH_XC_HTTP "KeePassHTTP support for ChromeIPass and PassIFox") +add_feature_info(Autotype WITH_XC_AUTOTYPE "Auto-type passwords in Input fields") if(WITH_XC_HTTP) set(keepasshttp_SOURCES @@ -177,6 +169,20 @@ if(WITH_XC_HTTP) qt5_wrap_ui(keepasshttp_SOURCES ${keepasshttp_FORMS}) endif() +set(autotype_SOURCES + core/Tools.cpp + autotype/AutoType.cpp + autotype/AutoTypeAction.cpp + autotype/AutoTypePlatformPlugin.h + autotype/AutoTypeSelectDialog.cpp + autotype/AutoTypeSelectView.cpp + autotype/ShortcutWidget.cpp + autotype/WildcardMatcher.cpp + autotype/WindowSelectComboBox.cpp + autotype/test/AutoTypeTestInterface.h +) +set(autotype_LIB autotype) + if(MINGW) set(keepassx_SOURCES_MAINEXE ${keepassx_SOURCES_MAINEXE} @@ -193,15 +199,19 @@ if(WITH_XC_HTTP) target_link_libraries(keepasshttp ${MHD_LIBRARIES} Qt5::Core Qt5::Concurrent Qt5::Widgets Qt5::Network) endif() +add_library(autotype STATIC ${autotype_SOURCES}) +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 zxcvbn ${keepasshttp_LIB} Qt5::Core Qt5::Concurrent Qt5::Widgets Qt5::Network) +target_link_libraries(keepassx_core zxcvbn ${keepasshttp_LIB} ${autotype_LIB} Qt5::Core Qt5::Concurrent Qt5::Widgets Qt5::Network) add_executable(${PROGNAME} WIN32 MACOSX_BUNDLE ${keepassx_SOURCES_MAINEXE}) target_link_libraries(${PROGNAME} keepassx_core zxcvbn ${keepasshttp_LIB} + ${autotype_LIB} Qt5::Core Qt5::Concurrent Qt5::Widgets diff --git a/src/autotype/AutoType.cpp b/src/autotype/AutoType.cpp index 979fe3ad2..0c942e728 100644 --- a/src/autotype/AutoType.cpp +++ b/src/autotype/AutoType.cpp @@ -20,6 +20,8 @@ #include #include +#include "config-keepassx.h" + #include "autotype/AutoTypePlatformPlugin.h" #include "autotype/AutoTypeSelectDialog.h" #include "autotype/WildcardMatcher.h" @@ -59,7 +61,9 @@ AutoType::AutoType(QObject* parent, bool test) QString pluginPath = filePath()->pluginPath(pluginName); if (!pluginPath.isEmpty()) { + #ifdef WITH_XC_AUTOTYPE loadPlugin(pluginPath); + #endif } connect(qApp, SIGNAL(aboutToQuit()), SLOT(unloadPlugin())); diff --git a/src/autotype/CMakeLists.txt b/src/autotype/CMakeLists.txt index 613b122ff..4b3610538 100644 --- a/src/autotype/CMakeLists.txt +++ b/src/autotype/CMakeLists.txt @@ -1,5 +1,3 @@ -add_feature_info(Autotype WITH_XC_AUTOTYPE "Auto-type passwords in Input fields") - if(WITH_XC_AUTOTYPE) if(UNIX AND NOT APPLE) find_package(X11) diff --git a/src/autotype/test/CMakeLists.txt b/src/autotype/test/CMakeLists.txt index 9b3dbd490..f92a3fd90 100644 --- a/src/autotype/test/CMakeLists.txt +++ b/src/autotype/test/CMakeLists.txt @@ -3,4 +3,4 @@ set(autotype_test_SOURCES ) add_library(keepassx-autotype-test MODULE ${autotype_test_SOURCES}) -target_link_libraries(keepassx-autotype-test testautotype Qt5::Core Qt5::Widgets) +target_link_libraries(keepassx-autotype-test testautotype keepassx_core ${autotype_LIB} Qt5::Core Qt5::Widgets) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index af38acea6..0ea73b2fe 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -86,6 +86,7 @@ endmacro(add_unit_test) set(TEST_LIBRARIES keepassx_core ${keepasshttp_LIB} + ${autotype_LIB} Qt5::Core Qt5::Concurrent Qt5::Widgets