Merge branch 'feature/cmake-fix-#50-#123' into develop

* Fixes #50 and #123
This commit is contained in:
Jonathan White 2017-01-02 22:27:20 -05:00
commit 534364454d
No known key found for this signature in database
GPG Key ID: 440FC65F2E0C6E01
14 changed files with 138 additions and 54 deletions

View File

@ -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

View File

@ -34,6 +34,10 @@ option(WITH_GUI_TESTS "Enable building of GUI tests" OFF)
option(WITH_DEV_BUILD "Use only for development. Disables/warns about deprecated methods." OFF)
option(WITH_COVERAGE "Use to build with coverage tests. (GCC ONLY)." OFF)
option(WITH_XC_AUTOTYPE "Include Autotype." OFF)
option(WITH_XC_HTTP "Include KeePassHTTP." OFF)
option(WITH_XC_YUBIKEY "Include Yubikey support." OFF)
set(KEEPASSXC_VERSION "2.1.0")
set(KEEPASSXC_VERSION_NUM "2.1.0")
@ -221,5 +225,10 @@ if(WITH_TESTS)
endif(WITH_TESTS)
if(PRINT_SUMMARY)
# This will print ENABLED, REQUIRED and DISABLED
feature_summary(WHAT ALL)
else()
# This will only print ENABLED and DISABLED feature
print_enabled_features()
print_disabled_features()
endif()

View File

@ -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
@ -118,14 +109,6 @@ set(keepassx_SOURCES
gui/group/EditGroupWidget.cpp
gui/group/GroupModel.cpp
gui/group/GroupView.cpp
http/AccessControlDialog.cpp
http/EntryConfig.cpp
http/HttpPasswordGeneratorWidget.cpp
http/HttpSettings.cpp
http/OptionDialog.cpp
http/Protocol.cpp
http/Server.cpp
http/Service.cpp
keys/CompositeKey.cpp
keys/CompositeKey_p.h
keys/FileKey.cpp
@ -161,9 +144,44 @@ set(keepassx_FORMS
gui/entry/EditEntryWidgetHistory.ui
gui/entry/EditEntryWidgetMain.ui
gui/group/EditGroupWidgetMain.ui
http/AccessControlDialog.ui
http/HttpPasswordGeneratorWidget.ui
http/OptionDialog.ui
)
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
http/AccessControlDialog.cpp
http/EntryConfig.cpp
http/HttpPasswordGeneratorWidget.cpp
http/HttpSettings.cpp
http/OptionDialog.cpp
http/Protocol.cpp
http/Server.cpp
http/Service.cpp
)
set(keepasshttp_FORMS
http/AccessControlDialog.ui
http/HttpPasswordGeneratorWidget.ui
http/OptionDialog.ui
)
set(keepasshttp_LIB keepasshttp)
qt5_wrap_ui(keepasshttp_SOURCES ${keepasshttp_FORMS})
endif()
add_subdirectory(autotype)
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
)
if(MINGW)
@ -177,15 +195,24 @@ qt5_wrap_ui(keepassx_SOURCES ${keepassx_FORMS})
add_library(zxcvbn STATIC zxcvbn/zxcvbn.cpp)
target_link_libraries(zxcvbn)
if(WITH_XC_HTTP)
add_library(keepasshttp STATIC ${keepasshttp_SOURCES})
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)
set(autotype_LIB autotype)
add_library(keepassx_core STATIC ${keepassx_SOURCES})
set_target_properties(keepassx_core PROPERTIES COMPILE_DEFINITIONS KEEPASSX_BUILDING_CORE)
target_link_libraries(keepassx_core zxcvbn 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
${MHD_LIBRARIES}
Qt5::Core
Qt5::Concurrent
Qt5::Widgets
@ -205,8 +232,6 @@ install(TARGETS ${PROGNAME}
BUNDLE DESTINATION . COMPONENT Runtime
RUNTIME DESTINATION ${BIN_INSTALL_DIR} COMPONENT Runtime)
add_subdirectory(autotype)
if(APPLE)
if(QT_MAC_USE_COCOA AND EXISTS "${QT_LIBRARY_DIR}/Resources/qt_menu.nib")
install(DIRECTORY "${QT_LIBRARY_DIR}/Resources/qt_menu.nib"

View File

@ -20,6 +20,8 @@
#include <QApplication>
#include <QPluginLoader>
#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()));

View File

@ -1,21 +1,23 @@
if(UNIX AND NOT APPLE)
find_package(X11)
find_package(Qt5X11Extras 5.2)
if(PRINT_SUMMARY)
add_feature_info(libXi X11_Xi_FOUND "The X11 Xi Protocol library is required for auto-type")
add_feature_info(libXtst X11_XTest_FOUND "The X11 XTEST Protocol library is required for auto-type")
add_feature_info(Qt5X11Extras Qt5X11Extras_FOUND "The Qt5X11Extras library is required for auto-type")
if(WITH_XC_AUTOTYPE)
if(UNIX AND NOT APPLE)
find_package(X11)
find_package(Qt5X11Extras 5.2)
if(PRINT_SUMMARY)
add_feature_info(libXi X11_Xi_FOUND "The X11 Xi Protocol library is required for auto-type")
add_feature_info(libXtst X11_XTest_FOUND "The X11 XTEST Protocol library is required for auto-type")
add_feature_info(Qt5X11Extras Qt5X11Extras_FOUND "The Qt5X11Extras library is required for auto-type")
endif()
if(X11_FOUND AND X11_Xi_FOUND AND X11_XTest_FOUND AND Qt5X11Extras_FOUND)
add_subdirectory(xcb)
endif()
elseif(APPLE)
add_subdirectory(mac)
elseif(WIN32)
add_subdirectory(windows)
endif()
if(X11_FOUND AND X11_Xi_FOUND AND X11_XTest_FOUND AND Qt5X11Extras_FOUND)
add_subdirectory(xcb)
if(WITH_TESTS)
add_subdirectory(test)
endif()
elseif(APPLE)
add_subdirectory(mac)
elseif(WIN32)
add_subdirectory(windows)
endif()
if(WITH_TESTS)
add_subdirectory(test)
endif()

View File

@ -3,4 +3,4 @@ set(autotype_test_SOURCES
)
add_library(keepassx-autotype-test MODULE ${autotype_test_SOURCES})
target_link_libraries(keepassx-autotype-test testautotype keepassx_core Qt5::Core Qt5::Widgets)
target_link_libraries(keepassx-autotype-test keepassx_core ${autotype_LIB} Qt5::Core Qt5::Widgets)

View File

@ -3,7 +3,7 @@ set(autotype_win_SOURCES
)
add_library(keepassx-autotype-windows MODULE ${autotype_win_SOURCES})
target_link_libraries(keepassx-autotype-windows ${PROGNAME} Qt5::Core Qt5::Widgets)
target_link_libraries(keepassx-autotype-windows keepassx_core ${autotype_LIB} Qt5::Core Qt5::Widgets)
install(TARGETS keepassx-autotype-windows
BUNDLE DESTINATION . COMPONENT Runtime
LIBRARY DESTINATION ${PLUGIN_INSTALL_DIR} COMPONENT Runtime)
LIBRARY DESTINATION ${PLUGIN_INSTALL_DIR} COMPONENT Runtime)

View File

@ -12,6 +12,10 @@
#define KEEPASSX_PLUGIN_DIR "${PLUGIN_INSTALL_DIR}"
#define KEEPASSX_DATA_DIR "${DATA_INSTALL_DIR}"
#cmakedefine WITH_XC_HTTP
#cmakedefine WITH_XC_AUTOTYPE
#cmakedefine WITH_XC_YUBIKEY
#cmakedefine HAVE_PR_SET_DUMPABLE 1
#cmakedefine HAVE_RLIMIT_CORE 1
#cmakedefine HAVE_PT_DENY_ATTACH 1

View File

@ -24,9 +24,9 @@
#if defined(Q_OS_WIN)
# if defined(KEEPASSX_BUILDING_CORE)
# define KEEPASSX_EXPORT Q_DECL_EXPORT
# else
# define KEEPASSX_EXPORT Q_DECL_IMPORT
# else
# define KEEPASSX_EXPORT Q_DECL_EXPORT
# endif
#else
# define KEEPASSX_EXPORT Q_DECL_EXPORT

View File

@ -56,6 +56,22 @@ AboutDialog::AboutDialog(QWidget* parent)
.arg(Crypto::backendVersion());
m_ui->label_libs->setText(libs);
QString extensions;
#ifdef WITH_XC_HTTP
extensions += "- KeePassHTTP\n";
#endif
#ifdef WITH_XC_AUTOTYPE
extensions += "- Autotype\n";
#endif
#ifdef WITH_XC_YUBIKEY
extensions += "- Yubikey\n";
#endif
if (extensions.isEmpty())
extensions = "None";
m_ui->label_features->setText(m_ui->label_features->text() + extensions);
setAttribute(Qt::WA_DeleteOnClose);
connect(m_ui->buttonBox, SIGNAL(rejected()), SLOT(close()));
}

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>375</width>
<height>210</height>
<width>455</width>
<height>238</height>
</rect>
</property>
<property name="windowTitle">
@ -93,6 +93,14 @@
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_features">
<property name="text">
<string>Extensions:
</string>
</property>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">

View File

@ -22,6 +22,8 @@
#include <QShortcut>
#include <QTimer>
#include "config-keepassx.h"
#include "autotype/AutoType.h"
#include "core/Config.h"
#include "core/FilePath.h"
@ -35,12 +37,16 @@
#include "gui/MessageBox.h"
#include "gui/SearchWidget.h"
#ifdef WITH_XC_HTTP
#include "http/Service.h"
#include "http/HttpSettings.h"
#include "http/OptionDialog.h"
#endif
#include "gui/SettingsWidget.h"
#include "gui/PasswordGeneratorWidget.h"
#ifdef WITH_XC_HTTP
class HttpPlugin: public ISettingsPage
{
public:
@ -72,6 +78,7 @@ class HttpPlugin: public ISettingsPage
private:
Service *m_service;
};
#endif
const QString MainWindow::BaseWindowTitle = "KeePassXC";
@ -92,7 +99,9 @@ MainWindow::MainWindow()
m_countDefaultAttributes = m_ui->menuEntryCopyAttribute->actions().size();
restoreGeometry(config()->get("GUI/MainWindowGeometry").toByteArray());
#ifdef WITH_XC_HTTP
m_ui->settingsWidget->addSettingsPage(new HttpPlugin(m_ui->tabWidget));
#endif
setWindowIcon(filePath()->applicationIcon());
QAction* toggleViewAction = m_ui->toolBar->toggleViewAction();
@ -449,7 +458,7 @@ void MainWindow::setMenuActionState(DatabaseWidget::Mode mode)
m_ui->actionRepairDatabase->setEnabled(inDatabaseTabWidgetOrWelcomeWidget);
m_ui->actionLockDatabases->setEnabled(m_ui->tabWidget->hasLockableDatabases());
if ((3 == currentIndex) != m_ui->actionPasswordGenerator->isChecked()) {
bool blocked = m_ui->actionPasswordGenerator->blockSignals(true);
m_ui->actionPasswordGenerator->toggle();

View File

@ -85,13 +85,14 @@ endmacro(add_unit_test)
set(TEST_LIBRARIES
keepassx_core
${keepasshttp_LIB}
${autotype_LIB}
Qt5::Core
Qt5::Concurrent
Qt5::Widgets
Qt5::Test
${GCRYPT_LIBRARIES}
${ZLIB_LIBRARIES}
${MHD_LIBRARIES}
)
set(testsupport_SOURCES modeltest.cpp FailDevice.cpp)
@ -143,9 +144,11 @@ add_unit_test(NAME testkeepass1reader SOURCES TestKeePass1Reader.cpp
add_unit_test(NAME testwildcardmatcher SOURCES TestWildcardMatcher.cpp
LIBS ${TEST_LIBRARIES})
add_unit_test(NAME testautotype SOURCES TestAutoType.cpp
if(WITH_XC_AUTOTYPE)
add_unit_test(NAME testautotype SOURCES TestAutoType.cpp
LIBS ${TEST_LIBRARIES})
set_target_properties(testautotype PROPERTIES ENABLE_EXPORTS ON)
set_target_properties(testautotype PROPERTIES ENABLE_EXPORTS ON)
endif()
add_unit_test(NAME testentry SOURCES TestEntry.cpp
LIBS ${TEST_LIBRARIES})

View File

@ -5,4 +5,8 @@
#define KEEPASSX_TEST_DATA_DIR "${KEEPASSX_TEST_DATA_DIR}"
#cmakedefine WITH_XC_HTTP
#cmakedefine WITH_XC_AUTOTYPE
#cmakedefine WITH_XC_YUBIKEY
#endif // KEEPASSX_CONFIG_TESTS_H