Fix build when disabling libsecret

Build when libsecret support is disabled explicitly or if
libsecret wasn't found.
This commit is contained in:
Frank Osterfeld 2016-10-31 16:43:44 +01:00
parent 8d68e1929e
commit 496979af09
2 changed files with 6 additions and 2 deletions

View File

@ -155,7 +155,9 @@ if(UNIX AND NOT APPLE AND NOT ANDROID)
if(LIBSECRET_SUPPORT)
pkg_check_modules(LIBSECRET libsecret-1)
add_definitions(-DHAVE_LIBSECRET=${LIBSECRET_FOUND})
if (LIBSECRET_FOUND)
add_definitions(-DHAVE_LIBSECRET=1)
endif()
INCLUDE_DIRECTORIES(${LIBSECRET_INCLUDE_DIRS})
endif()

View File

@ -194,8 +194,8 @@ static QString modeToString(QKeychain::JobPrivate::Mode mode) {
#endif
bool LibSecretKeyring::isAvailable() {
const LibSecretKeyring& keyring = instance();
#if defined(HAVE_LIBSECRET)
const LibSecretKeyring& keyring = instance();
if (!keyring.isLoaded())
return false;
if (secret_password_lookup_fn == NULL)
@ -307,6 +307,7 @@ bool LibSecretKeyring::deletePassword(const QString &key, const QString &service
LibSecretKeyring::LibSecretKeyring()
: QLibrary("secret-1")
{
#ifdef HAVE_LIBSECRET
if (load()) {
secret_password_lookup_fn =
(secret_password_lookup_t)resolve("secret_password_lookup");
@ -325,6 +326,7 @@ LibSecretKeyring::LibSecretKeyring()
secret_error_get_quark_fn =
(secret_error_get_quark_t)resolve("secret_error_get_quark");
}
#endif
}
LibSecretKeyring &LibSecretKeyring::instance() {