void AccountShared::load() { if (!isValidStorage()) return; Shared::load(); Identity identity = IdentityManager::instance()->byUuid(loadValue<QString>("Identity")); if (identity.isNull() && !IdentityManager::instance()->items().isEmpty()) identity = IdentityManager::instance()->items().at(0); setAccountIdentity(identity); ProtocolName = loadValue<QString>("Protocol"); setId(loadValue<QString>("Id")); RememberPassword = loadValue<bool>("RememberPassword", true); HasPassword = RememberPassword; if (RememberPassword) Password = pwHash(loadValue<QString>("Password")); ProxySettings.setEnabled(loadValue<bool>("UseProxy")); ProxySettings.setAddress(loadValue<QString>("ProxyHost")); ProxySettings.setPort(loadValue<int>("ProxyPort")); ProxySettings.setRequiresAuthentication(loadValue<bool>("ProxyRequiresAuthentication")); ProxySettings.setUser(loadValue<QString>("ProxyUser")); ProxySettings.setPassword(loadValue<QString>("ProxyPassword")); PrivateStatus = loadValue<bool>("PrivateStatus", true); triggerAllProtocolsRegistered(); }
void JabberAddAccountWidget::apply() { auto jabberAccount = m_accountStorage->create("jabber"); jabberAccount.setId(Username->text() + '@' + Domain->currentText()); jabberAccount.setPassword(AccountPassword->text()); jabberAccount.setHasPassword(!AccountPassword->text().isEmpty()); jabberAccount.setRememberPassword(RememberPassword->isChecked()); // bad code: order of calls is important here // we have to set identity after password // so in cache of identity status container it already knows password and can do status change without asking user // for it jabberAccount.setAccountIdentity(Identity->currentIdentity()); auto accountData = JabberAccountData{jabberAccount}; accountData.setResource("Kadu"); accountData.setPriority(5); bool isGoogleAppsAccount = m_isGmail && !Domain->currentText().contains("gmail"); // Google Apps account sometimes needs custom host/port settings to work if (isGoogleAppsAccount) { accountData.setUseCustomHostPort(true); accountData.setCustomHost("talk.google.com"); accountData.setCustomPort(5222); } resetGui(); emit accountCreated(jabberAccount); }
void FacebookAddAccountWidget::apply() { auto facebookAccount = m_accountStorage->create("facebook"); facebookAccount.setId(m_username->text()); facebookAccount.setPassword(m_password->text()); facebookAccount.setHasPassword(!m_password->text().isEmpty()); facebookAccount.setRememberPassword(m_rememberPassword->isChecked()); // bad code: order of calls is important here // we have to set identity after password // so in cache of identity status container it already knows password and can do status change without asking user // for it facebookAccount.setAccountIdentity(m_identity->currentIdentity()); resetGui(); emit accountCreated(facebookAccount); }