#include "keychain.h" #include "default_keychain.h" #ifdef Q_OS_DARWIN #include "mac_keychain.h" #elif defined(Q_OS_UNIX) #ifndef NO_KWALLET #include "kwallet_keychain.h" #endif #ifndef NO_GNOME_KEYRING #include "gnome_keychain.h" #endif #endif // Q_OS_UNIX // TODO: Make this configurable. const QString Keychain::kServiceName = "Google Account"; const Keychain::KeychainDefinition* Keychain::kCompiledImplementations[] = { #ifdef Q_OS_DARWIN new KeychainImpl(), #elif defined(Q_OS_LINUX) #ifndef NO_KWALLET new KeychainImpl(), #endif #ifndef NO_GNOME_KEYRING new KeychainImpl(), #endif #endif new KeychainImpl(), NULL }; Keychain* Keychain::getDefault() { const KeychainDefinition** ptr = kCompiledImplementations; while (*ptr != NULL) { Keychain* keychain = (*ptr)->getInstance(); if (keychain->isAvailable()) { return keychain; } else { delete keychain; } } return NULL; }