From 43f55a7bcd629236df48e14af644cd3f98cf800b Mon Sep 17 00:00:00 2001 From: David Sansome Date: Fri, 18 Feb 2011 20:13:52 +0000 Subject: [PATCH] Fix compilation of the gnome keychain --- 3rdparty/keychain/default_keychain.h | 2 -- 3rdparty/keychain/gnome_keychain.cpp | 26 ++++++++++++-------------- 3rdparty/keychain/gnome_keychain.h | 2 -- 3rdparty/keychain/keychain.h | 3 +-- 3rdparty/keychain/kwallet_keychain.h | 2 -- 3rdparty/keychain/mac_keychain.h | 2 -- 6 files changed, 13 insertions(+), 24 deletions(-) diff --git a/3rdparty/keychain/default_keychain.h b/3rdparty/keychain/default_keychain.h index 21173d93e..ddfb3ab98 100644 --- a/3rdparty/keychain/default_keychain.h +++ b/3rdparty/keychain/default_keychain.h @@ -13,8 +13,6 @@ public: virtual const QString& implementationName() const { return kImplementationName; } - static void init() {} - static const QString kImplementationName; private: QString password_; diff --git a/3rdparty/keychain/gnome_keychain.cpp b/3rdparty/keychain/gnome_keychain.cpp index 75fc8e7c8..a4aeea7f4 100644 --- a/3rdparty/keychain/gnome_keychain.cpp +++ b/3rdparty/keychain/gnome_keychain.cpp @@ -1,8 +1,10 @@ -#include "config.h" #include "gnome_keychain.h" #include +#include +#include + const QString GnomeKeychain::kImplementationName = "Gnome Keyring"; const GnomeKeyringPasswordSchema GnomeKeychain::kOurSchema = { @@ -24,8 +26,8 @@ const QString GnomeKeychain::getPassword(const QString& account) { GnomeKeyringResult result = gnome_keyring_find_password_sync( &kOurSchema, &password, - "username", account.toStdString().c_str(), - "service", kServiceName.toStdString().c_str(), + "username", account.toUtf8().constData(), + "service", kServiceName.toUtf8().constData(), NULL); if (result == GNOME_KEYRING_RESULT_OK) { @@ -34,27 +36,23 @@ const QString GnomeKeychain::getPassword(const QString& account) { return pass; } + qWarning() << "Failed to get password from keychain for account" << account; return QString::null; } bool GnomeKeychain::setPassword(const QString& account, const QString& password) { Q_ASSERT(isAvailable()); - QString displayName = "%1 Google Reader account for %2"; - displayName.arg(TITLE); - displayName.arg(account); + QString displayName = QString("%1 account for %2").arg( + QCoreApplication::applicationName(), account); GnomeKeyringResult result = gnome_keyring_store_password_sync( &kOurSchema, NULL, - displayName.toStdString().c_str(), - password.toStdString().c_str(), - "username", account.toStdString().c_str(), - "service", kServiceName.toStdString().c_str(), + displayName.toUtf8().constData(), + password.toUtf8().constData(), + "username", account.toUtf8().constData(), + "service", kServiceName.toUtf8().constData(), NULL); return result == GNOME_KEYRING_RESULT_OK; } - -void GnomeKeychain::init() { - g_set_application_name("PurpleHatstands"); -} diff --git a/3rdparty/keychain/gnome_keychain.h b/3rdparty/keychain/gnome_keychain.h index dd7dd181b..adfd7e8af 100644 --- a/3rdparty/keychain/gnome_keychain.h +++ b/3rdparty/keychain/gnome_keychain.h @@ -16,8 +16,6 @@ public: virtual const QString& implementationName() const { return kImplementationName; } - static void init(); - static const QString kImplementationName; private: static const GnomeKeyringPasswordSchema kOurSchema; diff --git a/3rdparty/keychain/keychain.h b/3rdparty/keychain/keychain.h index 5921ad653..dcaf12817 100644 --- a/3rdparty/keychain/keychain.h +++ b/3rdparty/keychain/keychain.h @@ -17,7 +17,6 @@ public: static Keychain* getDefault(); - static void init(); protected: static const QString kServiceName; @@ -33,7 +32,7 @@ private: }; template struct KeychainImpl : public KeychainDefinition { - KeychainImpl() : KeychainDefinition(T::kImplementationName) { T::init(); } + KeychainImpl() : KeychainDefinition(T::kImplementationName) { } virtual Keychain* getInstance() const { return new T(); } diff --git a/3rdparty/keychain/kwallet_keychain.h b/3rdparty/keychain/kwallet_keychain.h index 6e5452904..435173ded 100644 --- a/3rdparty/keychain/kwallet_keychain.h +++ b/3rdparty/keychain/kwallet_keychain.h @@ -17,8 +17,6 @@ public: virtual const QString& implementationName() const { return kImplementationName; } - static void init() {} - static const QString kImplementationName; private: org::kde::KWallet kwallet_; diff --git a/3rdparty/keychain/mac_keychain.h b/3rdparty/keychain/mac_keychain.h index 564130142..820889788 100644 --- a/3rdparty/keychain/mac_keychain.h +++ b/3rdparty/keychain/mac_keychain.h @@ -14,8 +14,6 @@ public: virtual const QString& implementationName() const { return kImplementationName; } static const QString kImplementationName; - - static void init() {} }; #endif