mirror of
https://github.com/clementine-player/Clementine
synced 2024-12-18 04:19:55 +01:00
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; }
|
||||
|
||||
static void init() {}
|
||||
|
||||
static const QString kImplementationName;
|
||||
private:
|
||||
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 <glib.h>
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QtDebug>
|
||||
|
||||
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");
|
||||
}
|
||||
|
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; }
|
||||
|
||||
static void init();
|
||||
|
||||
static const QString kImplementationName;
|
||||
private:
|
||||
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 void init();
|
||||
protected:
|
||||
static const QString kServiceName;
|
||||
|
||||
@ -33,7 +32,7 @@ private:
|
||||
};
|
||||
template<typename T>
|
||||
struct KeychainImpl : public KeychainDefinition {
|
||||
KeychainImpl() : KeychainDefinition(T::kImplementationName) { T::init(); }
|
||||
KeychainImpl() : KeychainDefinition(T::kImplementationName) { }
|
||||
virtual Keychain* getInstance() const {
|
||||
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; }
|
||||
|
||||
static void init() {}
|
||||
|
||||
static const QString kImplementationName;
|
||||
private:
|
||||
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; }
|
||||
|
||||
static const QString kImplementationName;
|
||||
|
||||
static void init() {}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user