Fix compilation of the gnome keychain
This commit is contained in:
parent
ff66bc0ade
commit
43f55a7bcd
2
3rdparty/keychain/default_keychain.h
vendored
2
3rdparty/keychain/default_keychain.h
vendored
@ -13,8 +13,6 @@ public:
|
|||||||
|
|
||||||
virtual const QString& implementationName() const { return kImplementationName; }
|
virtual const QString& implementationName() const { return kImplementationName; }
|
||||||
|
|
||||||
static void init() {}
|
|
||||||
|
|
||||||
static const QString kImplementationName;
|
static const QString kImplementationName;
|
||||||
private:
|
private:
|
||||||
QString password_;
|
QString password_;
|
||||||
|
26
3rdparty/keychain/gnome_keychain.cpp
vendored
26
3rdparty/keychain/gnome_keychain.cpp
vendored
@ -1,8 +1,10 @@
|
|||||||
#include "config.h"
|
|
||||||
#include "gnome_keychain.h"
|
#include "gnome_keychain.h"
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
|
#include <QCoreApplication>
|
||||||
|
#include <QtDebug>
|
||||||
|
|
||||||
const QString GnomeKeychain::kImplementationName = "Gnome Keyring";
|
const QString GnomeKeychain::kImplementationName = "Gnome Keyring";
|
||||||
|
|
||||||
const GnomeKeyringPasswordSchema GnomeKeychain::kOurSchema = {
|
const GnomeKeyringPasswordSchema GnomeKeychain::kOurSchema = {
|
||||||
@ -24,8 +26,8 @@ const QString GnomeKeychain::getPassword(const QString& account) {
|
|||||||
GnomeKeyringResult result = gnome_keyring_find_password_sync(
|
GnomeKeyringResult result = gnome_keyring_find_password_sync(
|
||||||
&kOurSchema,
|
&kOurSchema,
|
||||||
&password,
|
&password,
|
||||||
"username", account.toStdString().c_str(),
|
"username", account.toUtf8().constData(),
|
||||||
"service", kServiceName.toStdString().c_str(),
|
"service", kServiceName.toUtf8().constData(),
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
if (result == GNOME_KEYRING_RESULT_OK) {
|
if (result == GNOME_KEYRING_RESULT_OK) {
|
||||||
@ -34,27 +36,23 @@ const QString GnomeKeychain::getPassword(const QString& account) {
|
|||||||
return pass;
|
return pass;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qWarning() << "Failed to get password from keychain for account" << account;
|
||||||
return QString::null;
|
return QString::null;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GnomeKeychain::setPassword(const QString& account, const QString& password) {
|
bool GnomeKeychain::setPassword(const QString& account, const QString& password) {
|
||||||
Q_ASSERT(isAvailable());
|
Q_ASSERT(isAvailable());
|
||||||
QString displayName = "%1 Google Reader account for %2";
|
QString displayName = QString("%1 account for %2").arg(
|
||||||
displayName.arg(TITLE);
|
QCoreApplication::applicationName(), account);
|
||||||
displayName.arg(account);
|
|
||||||
|
|
||||||
GnomeKeyringResult result = gnome_keyring_store_password_sync(
|
GnomeKeyringResult result = gnome_keyring_store_password_sync(
|
||||||
&kOurSchema,
|
&kOurSchema,
|
||||||
NULL,
|
NULL,
|
||||||
displayName.toStdString().c_str(),
|
displayName.toUtf8().constData(),
|
||||||
password.toStdString().c_str(),
|
password.toUtf8().constData(),
|
||||||
"username", account.toStdString().c_str(),
|
"username", account.toUtf8().constData(),
|
||||||
"service", kServiceName.toStdString().c_str(),
|
"service", kServiceName.toUtf8().constData(),
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
return result == GNOME_KEYRING_RESULT_OK;
|
return result == GNOME_KEYRING_RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GnomeKeychain::init() {
|
|
||||||
g_set_application_name("PurpleHatstands");
|
|
||||||
}
|
|
||||||
|
2
3rdparty/keychain/gnome_keychain.h
vendored
2
3rdparty/keychain/gnome_keychain.h
vendored
@ -16,8 +16,6 @@ public:
|
|||||||
|
|
||||||
virtual const QString& implementationName() const { return kImplementationName; }
|
virtual const QString& implementationName() const { return kImplementationName; }
|
||||||
|
|
||||||
static void init();
|
|
||||||
|
|
||||||
static const QString kImplementationName;
|
static const QString kImplementationName;
|
||||||
private:
|
private:
|
||||||
static const GnomeKeyringPasswordSchema kOurSchema;
|
static const GnomeKeyringPasswordSchema kOurSchema;
|
||||||
|
3
3rdparty/keychain/keychain.h
vendored
3
3rdparty/keychain/keychain.h
vendored
@ -17,7 +17,6 @@ public:
|
|||||||
|
|
||||||
static Keychain* getDefault();
|
static Keychain* getDefault();
|
||||||
|
|
||||||
static void init();
|
|
||||||
protected:
|
protected:
|
||||||
static const QString kServiceName;
|
static const QString kServiceName;
|
||||||
|
|
||||||
@ -33,7 +32,7 @@ private:
|
|||||||
};
|
};
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct KeychainImpl : public KeychainDefinition {
|
struct KeychainImpl : public KeychainDefinition {
|
||||||
KeychainImpl() : KeychainDefinition(T::kImplementationName) { T::init(); }
|
KeychainImpl() : KeychainDefinition(T::kImplementationName) { }
|
||||||
virtual Keychain* getInstance() const {
|
virtual Keychain* getInstance() const {
|
||||||
return new T();
|
return new T();
|
||||||
}
|
}
|
||||||
|
2
3rdparty/keychain/kwallet_keychain.h
vendored
2
3rdparty/keychain/kwallet_keychain.h
vendored
@ -17,8 +17,6 @@ public:
|
|||||||
|
|
||||||
virtual const QString& implementationName() const { return kImplementationName; }
|
virtual const QString& implementationName() const { return kImplementationName; }
|
||||||
|
|
||||||
static void init() {}
|
|
||||||
|
|
||||||
static const QString kImplementationName;
|
static const QString kImplementationName;
|
||||||
private:
|
private:
|
||||||
org::kde::KWallet kwallet_;
|
org::kde::KWallet kwallet_;
|
||||||
|
2
3rdparty/keychain/mac_keychain.h
vendored
2
3rdparty/keychain/mac_keychain.h
vendored
@ -14,8 +14,6 @@ public:
|
|||||||
virtual const QString& implementationName() const { return kImplementationName; }
|
virtual const QString& implementationName() const { return kImplementationName; }
|
||||||
|
|
||||||
static const QString kImplementationName;
|
static const QString kImplementationName;
|
||||||
|
|
||||||
static void init() {}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user