void LocalBloggingPlatform::RestoreAccounts () { QSettings settings (QSettings::IniFormat, QSettings::UserScope, QCoreApplication::organizationName (), QCoreApplication::applicationName () + "_Blogique_Hestia_Accounts"); int size = settings.beginReadArray ("Accounts"); for (int i = 0; i < size; ++i) { settings.setArrayIndex (i); QByteArray data = settings.value ("SerializedData").toByteArray (); LocalBlogAccount *acc = LocalBlogAccount::Deserialize (data, this); if (!acc) { qWarning () << Q_FUNC_INFO << "unserializable acount" << i; continue; } Accounts_ << acc; if (!acc->IsValid ()) Core::Instance ().SendEntity (Util::MakeNotification ("Blogique", tr ("You have invalid account data."), PWarning_)); emit accountAdded (acc); acc->Init (); } settings.endArray (); }
void DeliciousService::RestoreAccounts () { QSettings settings (QSettings::IniFormat, QSettings::UserScope, QCoreApplication::organizationName (), QCoreApplication::applicationName () + "_Poshuku_OnlineBookmarks_Delicious_Accounts"); int size = settings.beginReadArray ("Accounts"); for (int i = 0; i < size; ++i) { settings.setArrayIndex (i); QByteArray data = settings .value ("SerializedData").toByteArray (); DeliciousAccount *acc = DeliciousAccount::Deserialize (data, this); if (!acc) { qWarning () << Q_FUNC_INFO << "undeserializable account" << i; continue; } Accounts_ << acc; } if (!Accounts_.isEmpty ()) { QObjectList list; Q_FOREACH (DeliciousAccount *acc, Accounts_) list << acc->GetQObject (); emit accountAdded (list); } }
void LJBloggingPlatform::RestoreAccounts () { QSettings settings (QSettings::IniFormat, QSettings::UserScope, QCoreApplication::organizationName (), QCoreApplication::applicationName () + "_Blogique_Metida_Accounts"); int size = settings.beginReadArray ("Accounts"); for (int i = 0; i < size; ++i) { settings.setArrayIndex (i); QByteArray data = settings.value ("SerializedData").toByteArray (); LJAccount *acc = LJAccount::Deserialize (data, this); if (!acc) { qWarning () << Q_FUNC_INFO << "unserializable acount" << i; continue; } LJAccounts_ << acc; emit accountAdded (acc); acc->Init (); Core::Instance ().GetLocalStorage ()->AddAccount (acc->GetAccountID ()); } settings.endArray (); }
// a is new account allocated and configured by the caller bool KNAccountManager::newAccount(KNNntpAccount *a) { // find a unused id for the new account... QString dir( KStandardDirs::locateLocal( "data", "knode/" ) ); if (dir.isNull()) { delete a; KNHelper::displayInternalFileError(); return false; } QDir d(dir); QStringList entries = d.entryList( QStringList( "nntp.*" ), QDir::Dirs ); int id = 1; while (entries.indexOf(QString("nntp.%1").arg(id))!=-1) ++id; a->setId(id); dir = KStandardDirs::locateLocal( "data", QString( "knode/nntp.%1/" ).arg( a->id() ) ); if (!dir.isNull()) { mAccounts.append(a); emit(accountAdded(a)); return true; } else { delete a; KMessageBox::error(knGlobals.topWidget, i18n("Cannot create a folder for this account.")); return false; } }
void IrcProtocol::RestoreAccounts () { QSettings settings (QSettings::IniFormat, QSettings::UserScope, QCoreApplication::organizationName (), QCoreApplication::applicationName () + "_Azoth_Acetamide_Accounts"); int size = settings.beginReadArray ("Accounts"); for (int i = 0; i < size; ++i) { settings.setArrayIndex (i); QByteArray data = settings.value ("SerializedData").toByteArray (); IrcAccount *acc = IrcAccount::Deserialize (data, this); if (!acc) { qWarning () << Q_FUNC_INFO << "unserializable acount" << i; continue; } connect (acc, SIGNAL (accountSettingsChanged ()), this, SLOT (saveAccounts ())); if (acc->GetAccountName () == "DefaultIrcAccount") Core::Instance ().SetDefaultIrcAcoount (acc); else Accounts_ << acc; emit accountAdded (acc); } }
AccountWrapper* ProtoWrapper::handleNewAccount (Tp::AccountPtr acc) { if (ProtoName_ != acc->protocolName ()) return 0; Q_FOREACH (AccountWrapper *w, Accounts_) if (w->GetOurID () == acc->uniqueIdentifier ()) return w; qDebug () << Q_FUNC_INFO << ProtoName_ << acc->nickname () << acc->iconName (); auto w = new AccountWrapper (acc, this); connect (w, SIGNAL (gotEntity (LeechCraft::Entity)), this, SIGNAL (gotEntity (LeechCraft::Entity))); connect (w, SIGNAL (delegateEntity (LeechCraft::Entity, int*, QObject**)), this, SIGNAL (delegateEntity (LeechCraft::Entity, int*, QObject**))); connect (w, SIGNAL (removeFinished (AccountWrapper*)), this, SLOT (handleAccountRemoved (AccountWrapper*))); Accounts_ << w; emit accountAdded (w); return w; }
void MRIMProtocol::RestoreAccounts () { QSettings settings (QSettings::IniFormat, QSettings::UserScope, QCoreApplication::organizationName (), QCoreApplication::applicationName () + "_Azoth_Vader_Accounts"); int size = settings.beginReadArray ("Accounts"); for (int i = 0; i < size; ++i) { settings.setArrayIndex (i); const QByteArray& data = settings.value ("SerializedData").toByteArray (); MRIMAccount *acc = MRIMAccount::Deserialize (data, this); if (!acc) { qWarning () << Q_FUNC_INFO << "undeserializable acount" << i; continue; } connect (acc, SIGNAL (accountSettingsChanged ()), this, SLOT (saveAccounts ())); Accounts_ << acc; emit accountAdded (acc); } settings.endArray (); }
void Plugin::handleAuthSuccess (QObject *accObj) { Account_ptr acc (qobject_cast<Account*> (accObj)); Accounts_ << acc; WriteAccounts (); emit accountAdded (accObj); }
void AccountManager::addAccount(Account *account, bool saveData) { m_accounts << account; connect(account, &Account::accountSaved, this, &AccountManager::save); emit accountAdded(account); emit changed(saveData); }
void ShowXmlConsoleAction::init() { connect(m_accountManager, SIGNAL(accountAdded(Account)), this, SLOT(updateShowXmlConsoleMenu())); connect(m_accountManager, SIGNAL(accountRemoved(Account)), this, SLOT(updateShowXmlConsoleMenu())); // It is needed bacause of loading protocol plugins before creating GUI. // TODO: Fix somehow. Maybe creating all action descriptions could be delayed. QTimer::singleShot(0, this, SLOT(insertMenuActionDescription())); }
void NewAccountDialog::addAccount() { if (!ui->newAccountName->text().simplified().isEmpty()) { Q_EMIT accountAdded(); } else { ui->newAccountName->setFocus(); setValid(ui->newAccountName, false); } }
void FacebookAddAccountWidget::init() { setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); connect(m_accountManager, SIGNAL(accountAdded(Account)), this, SLOT(dataChanged())); createGui(m_showButtons); resetGui(); }
void VkService::AddAccount (VkAccount *account) { Accounts_ << account; emit accountAdded (account); connect (account, SIGNAL (accountChanged (VkAccount*)), this, SLOT (saveAccount (VkAccount*))); }
SettingsDialog::SettingsDialog(ownCloudGui *gui, QWidget *parent) : QDialog(parent) , _ui(new Ui::SettingsDialog), _gui(gui) { setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); _ui->setupUi(this); _toolBar = new QToolBar; _toolBar->setIconSize(QSize(32, 32)); _toolBar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); layout()->setMenuBar(_toolBar); // People perceive this as a Window, so also make Ctrl+W work QAction *closeWindowAction = new QAction(this); closeWindowAction->setShortcut(QKeySequence("Ctrl+W")); connect(closeWindowAction, SIGNAL(triggered()), SLOT(accept())); addAction(closeWindowAction); setObjectName("Settings"); // required as group for saveGeometry call setWindowTitle(Theme::instance()->appNameGUI()); _actionGroup = new QActionGroup(this); _actionGroup->setExclusive(true); // Note: all the actions have a '\n' because the account name is in two lines and // all buttons must have the same size in order to keep a good layout _protocolAction = createColorAwareAction(QLatin1String(":/client/resources/activity.png"), tr("Activity")); _actionGroup->addAction(_protocolAction); _toolBar->addAction(_protocolAction); ProtocolWidget *protocolWidget = new ProtocolWidget; _ui->stack->addWidget(protocolWidget); QAction *generalAction = createColorAwareAction(QLatin1String(":/client/resources/settings.png"), tr("General")); _actionGroup->addAction(generalAction); _toolBar->addAction(generalAction); GeneralSettings *generalSettings = new GeneralSettings; _ui->stack->addWidget(generalSettings); QAction *networkAction = createColorAwareAction(QLatin1String(":/client/resources/network.png"), tr("Network")); _actionGroup->addAction(networkAction); _toolBar->addAction(networkAction); NetworkSettings *networkSettings = new NetworkSettings; _ui->stack->addWidget(networkSettings); _actionGroupWidgets.insert(_protocolAction, protocolWidget); _actionGroupWidgets.insert(generalAction, generalSettings); _actionGroupWidgets.insert(networkAction, networkSettings); connect(_actionGroup, SIGNAL(triggered(QAction*)), SLOT(slotSwitchPage(QAction*))); connect(AccountManager::instance(), SIGNAL(accountAdded(AccountState*)), this, SLOT(accountAdded(AccountState*))); connect(AccountManager::instance(), SIGNAL(accountRemoved(AccountState*)), this, SLOT(accountRemoved(AccountState*))); foreach (auto ai , AccountManager::instance()->accounts()) { accountAdded(ai.data()); }
void Plugin::RegisterAccount (const QString& accName) { Account_ptr acc (new Account (this)); acc->SetAccountName (accName); if (!acc->ExecConfigDialog ()) return; Accounts_ << acc; WriteAccounts (); emit accountAdded (acc.get ()); }
/*-------------------*/ void Settings::addAccount( const QString &acc ) { beginGroup( "accounts" ); QVariant retList = value( "accounts", QStringList() ); QStringList sl = retList.toStringList(); if( sl.indexOf(acc) < 0 ) { sl.append(acc); setValue( "accounts", QVariant(sl) ); } endGroup(); initListOfAccounts(); emit accountAdded(acc); }
void ToxProtocol::RegisterAccount (const QString& name, const QList<QWidget*>& widgets) { const auto detailsPage = qobject_cast<AccRegisterDetailsPage*> (widgets.value (0)); auto acc = new ToxAccount { name, this }; acc->SetNickname (detailsPage->GetNickname ()); SaveAccount (acc); Accounts_ << acc; emit accountAdded (acc); InitConnections (acc); }
MetaEntry* Core::CreateMetaEntry () { const QString& id = QUuid::createUuid ().toString (); MetaEntry *result = new MetaEntry (id, Account_); ConnectSignals (result); if (Entries_.isEmpty ()) emit accountAdded (Account_); Entries_ << result; emit gotCLItems ({ result }); return result; }
void Plugin::ReadAccounts () { QSettings settings (QSettings::IniFormat, QSettings::UserScope, QCoreApplication::organizationName (), QCoreApplication::applicationName () + "_NSM_GD_Accounts"); int size = settings.beginReadArray ("Accounts"); for (int i = 0; i < size; ++i) { settings.setArrayIndex (i); const QByteArray& data = settings.value ("SerializedData").toByteArray (); Account_ptr acc = Account::Deserialize (data, this); Accounts_ << acc; emit accountAdded (acc.get ()); } settings.endArray (); }
void GlooxProtocol::InitiateAccountRegistration () { QString name = QInputDialog::getText (0, tr ("LeechCraft"), tr ("Enter new account name")); if (name.isEmpty ()) return; GlooxAccount *account = new GlooxAccount (name, this); account->OpenConfigurationDialog (); Accounts_ << account; SaveAccounts (); emit accountAdded (account); account->ChangeState (IAccount::SOnline); }
void MRIMProtocol::RegisterAccount (const QString& name, const QList<QWidget*>& widgets) { auto w = qobject_cast<MRIMAccountConfigWidget*> (widgets.value (0)); if (!w) { qWarning () << Q_FUNC_INFO << "first widget is invalid" << widgets; return; } MRIMAccount *acc = new MRIMAccount (name, this); acc->FillConfig (w); Accounts_ << acc; emit accountAdded (acc); saveAccounts (); }
// // Whenever you change something here check both settingsdialog.cpp and settingsdialogmac.cpp ! // SettingsDialogMac::SettingsDialogMac(ownCloudGui *gui, QWidget *parent) : MacPreferencesWindow(parent), _gui(gui) { // do not show minimize button. There is no use, and restoring the // dialog from minimize is broken in MacPreferencesWindow setWindowFlags(Qt::Window | Qt::WindowTitleHint | Qt::CustomizeWindowHint | Qt::WindowCloseButtonHint | Qt::WindowMaximizeButtonHint); // Emulate dialog behavior: Escape means close QAction *closeDialogAction = new QAction(this); closeDialogAction->setShortcut(QKeySequence(Qt::Key_Escape)); connect(closeDialogAction, &QAction::triggered, this, &SettingsDialogMac::close); addAction(closeDialogAction); // People perceive this as a Window, so also make Ctrl+W work QAction *closeWindowAction = new QAction(this); closeWindowAction->setShortcut(QKeySequence("Ctrl+W")); connect(closeWindowAction, &QAction::triggered, this, &SettingsDialogMac::close); addAction(closeWindowAction); // People perceive this as a Window, so also make Ctrl+H work QAction *hideWindowAction = new QAction(this); hideWindowAction->setShortcut(QKeySequence("Ctrl+H")); connect(hideWindowAction, &QAction::triggered, this, &SettingsDialogMac::hide); addAction(hideWindowAction); setObjectName("SettingsMac"); // required as group for saveGeometry call setWindowTitle(tr("%1").arg(Theme::instance()->appNameGUI())); QIcon activityIcon(QLatin1String(":/client/resources/activity.png")); _activitySettings = new ActivitySettings; addPreferencesPanel(activityIcon, tr("Activity"), _activitySettings); connect( _activitySettings, SIGNAL(guiLog(QString,QString)), _gui, SLOT(slotShowOptionalTrayMessage(QString,QString)) ); connect(AccountManager::instance(), &AccountManager::accountAdded, this, &SettingsDialogMac::accountAdded); connect(AccountManager::instance(), &AccountManager::accountRemoved, this, &SettingsDialogMac::accountRemoved); foreach (auto ai , AccountManager::instance()->accounts()) { accountAdded(ai.data()); }
MessagesHandler::MessagesHandler() { foreach (Account *account, IcqProtocol::instance()->accounts()) accountAdded(account); connect(IcqProtocol::instance(), SIGNAL(accountCreated(qutim_sdk_0_3::Account*)), SLOT(accountAdded(qutim_sdk_0_3::Account*))); m_infos << SNACInfo(ServiceFamily, ServiceServerAsksServices) << SNACInfo(MessageFamily, MessageSrvReplyIcbm) << SNACInfo(MessageFamily, MessageResponse) << SNACInfo(MessageFamily, MessageSrvRecv) << SNACInfo(MessageFamily, MessageSrvAck) << SNACInfo(MessageFamily, MessageMtn) << SNACInfo(MessageFamily, MessageSrvError) << SNACInfo(ExtensionsFamily, ExtensionsMetaSrvReply); foreach(const ObjectGenerator *gen, ObjectGenerator::module<MessagePlugin>()) { MessagePlugin *plugin = gen->generate<MessagePlugin>(); foreach(const Capability &cap, plugin->capabilities()) m_msg_plugins.insert(cap, plugin); }
void GlobalPresence::setAccountManager(const Tp::AccountManagerPtr &accountManager) { if (! accountManager->isReady()) { qCWarning(KTP_COMMONINTERNALS) << "GlobalPresence used with unready account manager"; } m_enabledAccounts = accountManager->enabledAccounts(); m_onlineAccounts = accountManager->onlineAccounts(); Q_FOREACH(const Tp::AccountPtr &account, m_enabledAccounts->accounts()) { onAccountAdded(account); } onCurrentPresenceChanged(); onRequestedPresenceChanged(); onChangingPresence(); onConnectionStatusChanged(); connect(m_enabledAccounts.data(), SIGNAL(accountAdded(Tp::AccountPtr)), SLOT(onAccountAdded(Tp::AccountPtr))); connect(m_enabledAccounts.data(), SIGNAL(accountRemoved(Tp::AccountPtr)), this, SIGNAL(enabledAccountsChanged())); }
void AccountsManager::handleAccountAdded (QObject *obj) { IStorageAccount *acc = qobject_cast<IStorageAccount*> (obj); if (!acc) { qWarning () << Q_FUNC_INFO << "unable to cast" << obj; return; } QObject *pObj = acc->GetParentPlugin (); IStoragePlugin *plugin = qobject_cast<IStoragePlugin*> (pObj); QList<QStandardItem*> row; row << new QStandardItem (plugin->GetStorageIcon (), acc->GetAccountName ()); row << new QStandardItem (plugin->GetStorageName ()); Model_->appendRow (row); row.first ()->setData (QVariant::fromValue<QObject*> (obj), Roles::AccountObj); emit accountAdded (obj); }
void IrcProtocol::InitiateAccountRegistration () { QString name = QInputDialog::getText (0, "LeechCraft", tr ("Enter new account name")); if (name.isEmpty ()) return; IrcAccount *account = new IrcAccount (name, this); account->OpenConfigurationDialog (); connect (account, SIGNAL (accountSettingsChanged ()), this, SLOT (saveAccounts ())); Accounts_ << account; saveAccounts (); emit accountAdded (account); // account->ChangeState (EntryStatus (SOnline, QString ())); }
void LocalBloggingPlatform::RegisterAccount (const QString& name, const QList<QWidget*>& widgets) { auto w = qobject_cast<AccountConfigurationWidget*> (widgets.value (0)); if (!w) { qWarning () << Q_FUNC_INFO << "got invalid widgets" << widgets; return; } LocalBlogAccount *account = new LocalBlogAccount (name, this); account->FillSettings (w); const QString& path = w->GetAccountBasePath (); if (!path.isEmpty ()) { Accounts_ << account; saveAccounts (); emit accountAdded (account); account->Init (); } }
void KNAccountManager::loadAccounts() { QString dir( KStandardDirs::locateLocal( "data", "knode/" ) ); if (dir.isNull()) { KNHelper::displayInternalFileError(); return; } QDir d(dir); KNNntpAccount *a; QStringList entries(d.entryList(QStringList("nntp.*"), QDir::Dirs)); QStringList::Iterator it; for(it = entries.begin(); it != entries.end(); ++it) { a = new KNNntpAccount(); if (a->readInfo(dir+(*it) + "/info")) { mAccounts.append(a); gManager->loadGroups(a); emit accountAdded(a); } else { delete a; kError(5003) <<"Unable to load account" << (*it) <<"!"; } } }
// // Whenever you change something here check both settingsdialog.cpp and settingsdialogmac.cpp ! // SettingsDialog::SettingsDialog(ownCloudGui *gui, QWidget *parent) : QDialog(parent) , _ui(new Ui::SettingsDialog), _gui(gui) { setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); _ui->setupUi(this); QToolBar *toolBar = new QToolBar; toolBar->setIconSize(QSize(32,32)); QString highlightColor(palette().highlight().color().name()); QString altBase(palette().alternateBase().color().name()); QString dark(palette().dark().color().name()); toolBar->setStyleSheet(QString::fromAscii(TOOLBAR_CSS).arg(dark).arg(highlightColor).arg(altBase)); toolBar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); layout()->setMenuBar(toolBar); // People perceive this as a Window, so also make Ctrl+W work QAction *closeWindowAction = new QAction(this); closeWindowAction->setShortcut(QKeySequence("Ctrl+W")); connect(closeWindowAction, SIGNAL(triggered()), SLOT(accept())); addAction(closeWindowAction); setObjectName("Settings"); // required as group for saveGeometry call setWindowTitle(Theme::instance()->appNameGUI()); // Add a spacer so config buttonns are right aligned and account buttons will be left aligned auto spacer = new QWidget(); spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); toolBar->addWidget(spacer); // Note: all the actions have a '\n' because the account name is in two lines and // all buttons must have the same size in order to keep a good layout QIcon protocolIcon(QLatin1String(":/client/resources/activity.png")); _protocolAction = toolBar->addAction(protocolIcon, tr("Activity") + QLatin1Char('\n')); _protocolAction->setCheckable(true); ProtocolWidget *protocolWidget = new ProtocolWidget; _ui->stack->addWidget(protocolWidget); QIcon generalIcon(QLatin1String(":/client/resources/settings.png")); QAction *generalAction = toolBar->addAction(generalIcon, tr("General") + QLatin1Char('\n')); generalAction->setCheckable(true); GeneralSettings *generalSettings = new GeneralSettings; _ui->stack->addWidget(generalSettings); QIcon networkIcon(QLatin1String(":/client/resources/network.png")); QAction *networkAction = toolBar->addAction(networkIcon, tr("Network") + QLatin1Char('\n')); networkAction->setCheckable(true); NetworkSettings *networkSettings = new NetworkSettings; _ui->stack->addWidget(networkSettings); _actions.insert(_protocolAction, protocolWidget); _actions.insert(generalAction, generalSettings); _actions.insert(networkAction, networkSettings); QActionGroup *group = new QActionGroup(this); group->addAction(_protocolAction); group->addAction(generalAction); group->addAction(networkAction); group->setExclusive(true); connect(group, SIGNAL(triggered(QAction*)), SLOT(slotSwitchPage(QAction*))); connect(AccountManager::instance(), SIGNAL(accountAdded(AccountState*)), this, SLOT(accountAdded(AccountState*))); connect(AccountManager::instance(), SIGNAL(accountRemoved(AccountState*)), this, SLOT(accountRemoved(AccountState*))); foreach (auto ai , AccountManager::instance()->accounts()) { accountAdded(ai.data()); }
void AccountsAwareObject::triggerAllAccountsAdded() { foreach (const Account &account, AccountManager::instance()->items()) accountAdded(account); }