Skip to content

Commit

Permalink
Add optional dependency on Gcrypt, references #832
Browse files Browse the repository at this point in the history
  • Loading branch information
Emdek committed May 1, 2016
1 parent e5dc86a commit c994170
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 2 deletions.
15 changes: 13 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ if (EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
set(CPACK_PACKAGE_NAME "otter-browser")
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}_${MAJOR_VERSION}.${MINOR_VERSION}.${CPACK_PACKAGE_VERSION_PATCH}")
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}_${MAJOR_VERSION}.${MINOR_VERSION}.${CPACK_PACKAGE_VERSION_PATCH}")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libhunspell-1.3-0 (>= 1.3.3), libqt5multimedia5 (>=5.2.0), libqt5qml5 (>=5.2.0), libqt5webkit5 (>=5.2.0), libqt5xmlpatterns5 (>=5.2.0)")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libgcrypt20 (>= 1.6.0), libhunspell-1.3-0 (>= 1.3.3), libqt5multimedia5 (>=5.2.0), libqt5qml5 (>=5.2.0), libqt5webkit5 (>=5.2.0), libqt5xmlpatterns5 (>=5.2.0)")
set(CPACK_DEBIAN_PACKAGE_RECOMMENDS "gstreamer0.10-plugins-base, gstreamer0.10-plugins-good")
set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
set(CPACK_DEBIAN_PACKAGE_SECTION "web")
Expand Down Expand Up @@ -72,13 +72,15 @@ option(ENABLE_QTWEBKIT "Enable QtWebKit backend (requires Qt 5.2)" ON)
find_package(Qt5 5.2.0 REQUIRED COMPONENTS Core DBus Gui Multimedia Network PrintSupport Qml Widgets XmlPatterns)
find_package(Qt5WebEngineWidgets 5.6.0 QUIET)
find_package(Qt5WebKitWidgets 5.2.0 QUIET)
find_package(Gcrypt 1.6.0 QUIET)
find_package(Hunspell 1.3.0 QUIET)

set_package_properties(Qt5WebEngineCore PROPERTIES URL "http://qt.io/" DESCRIPTION "QtWebEngine based backend (core)" TYPE OPTIONAL)
set_package_properties(Qt5WebEngineWidgets PROPERTIES URL "http://qt.io/" DESCRIPTION "QtWebEngine based backend (widgets)" TYPE OPTIONAL)
set_package_properties(Qt5WebKit PROPERTIES URL "http://qt.io/" DESCRIPTION "QtWebKit based backend (core)" TYPE OPTIONAL)
set_package_properties(Qt5WebKitWidgets PROPERTIES URL "http://qt.io/" DESCRIPTION "QtWebKit based backend (widgets)" TYPE OPTIONAL)
set_package_properties(Hunspell PROPERTIES URL "http://hunspell.github.io" DESCRIPTION "Generic spell checking support" TYPE OPTIONAL)
set_package_properties(GCrypt PROPERTIES URL "http://directory.fsf.org/project/libgcrypt/" DESCRIPTION "Data encryption support" TYPE OPTIONAL)
set_package_properties(Hunspell PROPERTIES URL "http://hunspell.github.io/" DESCRIPTION "Generic spell checking support" TYPE OPTIONAL)

set(otter_src
src/main.cpp
Expand Down Expand Up @@ -348,6 +350,11 @@ if (Qt5WebKitWidgets_FOUND AND ENABLE_QTWEBKIT)
)
endif (Qt5WebKitWidgets_FOUND AND ENABLE_QTWEBKIT)

if (GCRYPT_FOUND)
add_definitions(-DOTTER_ENABLE_ENCRYPTION)
include_directories(${GCRYPT_INCLUDE_DIR})
endif (GCRYPT_FOUND)

if (HUNSPELL_FOUND)
add_definitions(-DOTTER_ENABLE_SPELLCHECK)
add_definitions(-DSONNET_STATIC)
Expand Down Expand Up @@ -438,6 +445,10 @@ if (Qt5WebKitWidgets_FOUND AND ENABLE_QTWEBKIT)
qt5_use_modules(otter-browser WebKit WebKitWidgets)
endif (Qt5WebKitWidgets_FOUND AND ENABLE_QTWEBKIT)

if (GCRYPT_FOUND)
target_link_libraries(otter-browser ${GCRYPT_LIBRARIES})
endif (GCRYPT_FOUND)

if (HUNSPELL_FOUND)
target_link_libraries(otter-browser ${HUNSPELL_LIBRARIES})
endif (HUNSPELL_FOUND)
Expand Down
1 change: 1 addition & 0 deletions packaging/debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Priority: extra
Maintainer: Rog131 <samrog131@hotmail.com>
Build-Depends: debhelper (>= 9.0),
cmake,
libgcrypt20-dev (>= 1.6.0),
libhunspell-dev (>= 1.3.3),
libqt5webkit5-dev (>=5.2.0),
libqt5xmlpatterns5-dev (>=5.2.0),
Expand Down
13 changes: 13 additions & 0 deletions src/core/PasswordsManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
#include "PasswordsManager.h"
#include "PasswordsStorageBackend.h"

#ifdef OTTER_ENABLE_ENCRYPTION
#include <gcrypt.h>
#endif

namespace Otter
{

Expand Down Expand Up @@ -56,4 +60,13 @@ QList<PasswordsManager::PasswordInformation> PasswordsManager::getPasswords(cons
return (m_backend ? m_backend->getPasswords(url) : QList<PasswordsManager::PasswordInformation>());
}

bool PasswordsManager::isEncryptionAvailable()
{
#ifdef OTTER_ENABLE_ENCRYPTION
return true;
#else
return false;
#endif
}

}
1 change: 1 addition & 0 deletions src/core/PasswordsManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class PasswordsManager : public QObject
static void addPassword(const PasswordInformation &password);
static PasswordsManager* getInstance();
static QList<PasswordInformation> getPasswords(const QUrl &url);
static bool isEncryptionAvailable();

protected:
explicit PasswordsManager(QObject *parent = NULL);
Expand Down

0 comments on commit c994170

Please sign in to comment.