MCPcopy Create free account
hub / github.com/KangLin/RabbitRemoteControl / OnLoad

Method OnLoad

Src/ParameterCompone/ParameterUser.cpp:38–121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36}
37
38int CParameterUser::OnLoad(QSettings &set)
39{
40 set.beginGroup("User");
41 SetUser(set.value("Name", GetUser()).toString());
42
43 set.beginGroup("Authentication");
44 QStringList type;
45 foreach(auto t, GetType()) {
46 type.push_back(QString::number((int)t));
47 }
48 QStringList vType;
49 vType = set.value("Type", type).toStringList();
50 QList<TYPE> lstType;
51 foreach(auto s, vType)
52 {
53 lstType.push_back((TYPE)s.toInt());
54 }
55 SetType(lstType);
56 SetUsedType((TYPE)set.value("Type/Used", (int)GetUsedType()).toInt());
57
58 SetSavePassword(set.value("SavePassword", GetSavePassword()).toBool());
59 if(GetSavePassword())
60 {
61#if HAVE_QTKEYCHAIN
62 auto para = GetPluginParameters();
63 if(para && para->GetUseSystemCredential()) {
64 QString key("Password");
65 auto net = qobject_cast<CParameterNet*>(parent());
66 if(net) {
67 key = ServiceName() + "/" + GetUser() + "@" + net->GetHost() + ":" + QString::number(net->GetPort()) + "/" + key;
68 }
69 auto pReadJob = new QKeychain::ReadPasswordJob(ServiceName());
70 connect(pReadJob, &QKeychain::ReadPasswordJob::finished, this, &CParameterUser::slotLoadPassword);
71 pReadJob->setKey(key);
72 pReadJob->start();
73 } else
74#endif
75 {
76 QString szPassword;
77 if(!LoadPassword(tr("Password"), "Password", szPassword, set))
78 SetPassword(szPassword);
79 }
80 }
81
82 set.beginGroup("PublicKey");
83 set.beginGroup("File");
84 SetUseSystemFile(set.value("UseSystemFile", GetUseSystemFile()).toBool());
85 SetPublicKeyFile(set.value("PublicKey",
86 GetPublicKeyFile()).toString());
87 SetPrivateKeyFile(set.value("PrivateKey",
88 GetPrivateKeyFile()).toString());
89 SetSavePassphrase(set.value("SavePassphrase", GetSavePassphrase()).toBool());
90 if(GetSavePassphrase()) {
91#if HAVE_QTKEYCHAIN
92 auto para = GetPluginParameters();
93 if(para && para->GetUseSystemCredential()) {
94 QString key("Passphrase");
95 auto net = qobject_cast<CParameterNet*>(parent());

Callers

nothing calls this directly

Calls 5

GetHostMethod · 0.80
startMethod · 0.80
ServiceNameFunction · 0.70
GetPortMethod · 0.45

Tested by

no test coverage detected