void GaduEditAccountWidget::dataChanged() { ConfigurationValueState widgetsState = stateNotifier()->state(); auto accountData = GaduAccountData{account()}; if (account().accountIdentity() == Identities->currentIdentity() && account().id() == AccountId->text() && account().rememberPassword() == RememberPassword->isChecked() && account().password() == AccountPassword->text() && account().privateStatus() == ShowStatusToEveryone->isChecked() && account().useDefaultProxy() == ProxyCombo->isDefaultProxySelected() && account().proxy() == ProxyCombo->currentProxy() && accountData.receiveImagesDuringInvisibility() == ReceiveImagesDuringInvisibility->isChecked() && accountData.chatImageSizeWarning() == ChatImageSizeWarning->isChecked() && m_configuration->deprecatedApi()->readBoolEntry("Network", "isDefServers", true) == useDefaultServers->isChecked() && m_configuration->deprecatedApi()->readEntry("Network", "Server") == ipAddresses->text() && accountData.sendTypingNotification() == SendTypingNotification->isChecked() && accountData.receiveSpam() != ReceiveSpam->isChecked() && !gpiw->isModified()) { simpleStateNotifier()->setState(StateNotChanged); return; } bool sameIdExists = m_accountManager->byId(account().protocolName(), AccountId->text()) && m_accountManager->byId(account().protocolName(), AccountId->text()) != account(); if (AccountId->text().isEmpty() || sameIdExists || StateChangedDataInvalid == widgetsState) simpleStateNotifier()->setState(StateChangedDataInvalid); else simpleStateNotifier()->setState(StateChangedDataValid); }
void FacebookAddAccountWidget::dataChanged() { auto valid = !m_username->text().isEmpty() && !m_password->text().isEmpty() && !m_accountManager->byId("facebook", m_username->text()) && m_identity->currentIdentity(); m_addAccountButton->setEnabled(valid); if (m_username->text().isEmpty() && m_password->text().isEmpty() && m_rememberPassword->isChecked() && 0 == m_identity->currentIndex()) simpleStateNotifier()->setState(StateNotChanged); else simpleStateNotifier()->setState(valid ? StateChangedDataValid : StateChangedDataInvalid); }
void JabberAddAccountWidget::dataChanged() { bool valid = !Username->text().isEmpty() && !AccountPassword->text().isEmpty() && !Domain->currentText().isEmpty() && !m_accountManager->byId("jabber", Username->text() + '@' + Domain->currentText()) && Identity->currentIdentity(); AddAccountButton->setEnabled(valid); if (Username->text().isEmpty() && AccountPassword->text().isEmpty() && RememberPassword->isChecked() && Domain->currentText() == m_defaultServer && 0 == Identity->currentIndex()) simpleStateNotifier()->setState(StateNotChanged); else simpleStateNotifier()->setState(valid ? StateChangedDataValid : StateChangedDataInvalid); }
void GaduAddAccountWidget::dataChanged() { bool valid = !AccountId->text().isEmpty() && !AccountPassword->text().isEmpty() && !AccountManager::instance()->byId("gadu", AccountId->text()) && Identity->currentIdentity(); AddAccountButton->setEnabled(valid); if (AccountId->text().isEmpty() && AccountPassword->text().isEmpty() && RememberPassword->isChecked() && 0 == Identity->currentIndex()) simpleStateNotifier()->setState(StateNotChanged); else simpleStateNotifier()->setState(valid ? StateChangedDataValid : StateChangedDataInvalid); }
void FacebookAddAccountWidget::resetGui() { m_username->clear(); m_password->clear(); m_rememberPassword->setChecked(true); m_identityManager->removeUnused(); m_identity->setCurrentIndex(0); simpleStateNotifier()->setState(StateNotChanged); }
void GaduEditAccountWidget::cancel() { cancelAccountConfigurationWidgets(); loadAccountData(); gpiw->cancel(); m_identityManager->removeUnused(); simpleStateNotifier()->setState(StateNotChanged); }
void JabberAddAccountWidget::resetGui() { AccountPassword->clear(); Username->clear(); Domain->setEditText(m_defaultServer); RememberPassword->setChecked(true); m_identityManager->removeUnused(); Identity->setCurrentIndex(0); AddAccountButton->setDisabled(true); simpleStateNotifier()->setState(StateNotChanged); }
void GaduEditAccountWidget::apply() { applyAccountConfigurationWidgets(); account().setId(AccountId->text()); account().setRememberPassword(RememberPassword->isChecked()); account().setPassword(AccountPassword->text()); account().setHasPassword(!AccountPassword->text().isEmpty()); account().setPrivateStatus(ShowStatusToEveryone->isChecked()); account().setUseDefaultProxy(ProxyCombo->isDefaultProxySelected()); account().setProxy(ProxyCombo->currentProxy()); // 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 account().setAccountIdentity(Identities->currentIdentity()); auto accountData = GaduAccountData{account()}; accountData.setReceiveImagesDuringInvisibility(ReceiveImagesDuringInvisibility->isChecked()); accountData.setChatImageSizeWarning(ChatImageSizeWarning->isChecked()); accountData.setSendTypingNotification(SendTypingNotification->isChecked()); accountData.setReceiveSpam(!ReceiveSpam->isChecked()); m_configuration->deprecatedApi()->writeEntry("Network", "isDefServers", useDefaultServers->isChecked()); m_configuration->deprecatedApi()->writeEntry("Network", "Server", ipAddresses->text()); m_gaduServersManager->buildServerList(); if (gpiw->isModified()) gpiw->apply(); m_identityManager->removeUnused(); m_configurationManager->flush(); simpleStateNotifier()->setState(StateNotChanged); // TODO: 0.13, fix this // hack, changing details does not trigger this account().data()->forceEmitUpdated(); }
void GaduEditAccountWidget::loadAccountData() { Identities->setCurrentIdentity(account().accountIdentity()); AccountId->setText(account().id()); RememberPassword->setChecked(account().rememberPassword()); AccountPassword->setText(account().password()); ShowStatusToEveryone->setChecked(account().privateStatus()); if (account().useDefaultProxy()) ProxyCombo->selectDefaultProxy(); else ProxyCombo->setCurrentProxy(account().proxy()); auto accountData = GaduAccountData{account()}; ReceiveImagesDuringInvisibility->setChecked(accountData.receiveImagesDuringInvisibility());; ChatImageSizeWarning->setChecked(accountData.chatImageSizeWarning()); SendTypingNotification->setChecked(accountData.sendTypingNotification()); ReceiveSpam->setChecked(!accountData.receiveSpam()); useDefaultServers->setChecked(m_configuration->deprecatedApi()->readBoolEntry("Network", "isDefServers", true)); ipAddresses->setText(m_configuration->deprecatedApi()->readEntry("Network", "Server")); simpleStateNotifier()->setState(StateNotChanged); }