-
Notifications
You must be signed in to change notification settings - Fork 0
/
keychain.cpp
45 lines (39 loc) · 940 Bytes
/
keychain.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#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
const QString Keychain::kServiceName = "Purplehatstands";
const Keychain::KeychainDefinition* Keychain::kCompiledImplementations[] = {
#ifdef Q_OS_DARWIN
new KeychainImpl<MacKeychain>(),
#elif defined(Q_OS_LINUX)
#ifndef NO_KWALLET
new KeychainImpl<KWalletKeychain>(),
#endif
#ifndef NO_GNOME_KEYRING
new KeychainImpl<GnomeKeychain>(),
#endif
#endif
new KeychainImpl<DefaultKeychain>(),
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;
}