void AccountsListWidget::handleAccountValidated (QObject *accObj, bool validated) { IAccount *acc = qobject_cast<IAccount*> (accObj); if (!acc) { qWarning () << Q_FUNC_INFO << accObj << "is not an IAccount"; return; } if (!Account2Item_.contains (acc)) { qWarning () << Q_FUNC_INFO << "account" << acc->GetAccountName () << acc->GetQObject () << "from" << sender () << "not found here"; return; } QStandardItem *item = Account2Item_ [acc]; AccountsModel_->item (item->row (), Columns::IsValidated)->setText (validated ? tr ("Validated") : tr ("Not validated")); Ui_.Accounts_->header ()->setResizeMode (QHeaderView::ResizeToContents); }
void AccountsListWidget::on_Delete__released () { auto index = Ui_.Accounts_->selectionModel ()->currentIndex (); index = index.sibling (index.row (), Columns::Name); if (!index.isValid ()) return; QStandardItem *item = AccountsModel_->itemFromIndex (index); IAccount *acc = 0; if (item && Item2Account_.contains (item)) acc = Item2Account_ [item]; else return; if (QMessageBox::question (this, "LeechCraft", tr ("Are you sure you want to remove the account %1?") .arg ("<em>" + acc->GetAccountName () + "</em>"), QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes) return; QObject *bpObj = acc->GetParentBloggingPlatform (); IBloggingPlatform *ibp = qobject_cast<IBloggingPlatform*> (bpObj); if (!ibp) { qWarning () << Q_FUNC_INFO << "parent blogging platform for" << acc->GetAccountID () << "doesn't implement IBloggingPlatform"; return; } ibp->RemoveAccount (acc->GetQObject ()); }
void AccountActionsManager::joinAccountConfFromBM () { IAccount *account = GetAccountFromSender (sender (), Q_FUNC_INFO); if (!account) return; const QVariant& bmData = sender ()->property ("Azoth/BMData"); if (bmData.isNull ()) return; const auto proto = qobject_cast<IMUCProtocol*> (account->GetParentProtocol ()); if (!proto) { qWarning () << Q_FUNC_INFO << account->GetAccountName () << "parent protocol does not implement IMUCProtocol"; return; } auto jWidget = proto->GetMUCJoinWidget (); IMUCJoinWidget *imjw = qobject_cast<IMUCJoinWidget*> (jWidget); imjw->SetIdentifyingData (bmData.toMap ()); imjw->Join (account->GetQObject ()); jWidget->deleteLater (); }
void AccountActionsManager::handleAccountSD () { IAccount *account = GetAccountFromSender (sender (), Q_FUNC_INFO); if (!account) return; auto w = new ServiceDiscoveryWidget (); w->SetAccount (account->GetQObject ()); emit gotSDWidget (w); }
void LocalBloggingPlatform::handleAccountValidated (bool valid) { IAccount *acc = qobject_cast<IAccount*> (sender ()); if (!acc) { qWarning () << Q_FUNC_INFO << sender () << "is not an IAccount";; return; } emit accountValidated (acc->GetQObject (), valid); }
void AccountActionsManager::handleAccountConsole () { IAccount *account = GetAccountFromSender (sender (), Q_FUNC_INFO); if (!account) return; if (!Account2CW_.contains (account)) { ConsoleWidget *cw = new ConsoleWidget (account->GetQObject ()); Account2CW_ [account] = cw; connect (cw, SIGNAL (removeTab (QWidget*)), this, SLOT (consoleRemoved (QWidget*))); }
void LJBloggingPlatform::handleAccountValidated (bool validated) { IAccount *acc = qobject_cast<IAccount*> (sender ()); if (!acc) { qWarning () << Q_FUNC_INFO << sender () << "is not an IAccount";; return; } emit accountValidated (acc->GetQObject (), validated); if (validated && XmlSettingsManager::Instance ().Property ("CheckingInboxEnabled", true).toBool ()) checkForMessages ();; }
void BookmarksManagerDialog::Save () { QVariantList datas; for (int i = 0; i < BMModel_->rowCount (); ++i) datas << BMModel_->item (i)->data (); const int index = Ui_.AccountBox_->currentIndex (); IAccount *account = Ui_.AccountBox_->itemData (index).value<IAccount*> (); if (!account) { qWarning () << Q_FUNC_INFO << "no account available for index" << index; return; } qobject_cast<ISupportBookmarks*> (account->GetQObject ())->SetBookmarkedMUCs (datas); on_AccountBox__currentIndexChanged (index); }
void AccountActionsManager::handleAccountSetLocation () { IAccount *account = GetAccountFromSender (sender (), Q_FUNC_INFO); if (!account) return; QObject *obj = account->GetQObject (); ISupportGeolocation *loc = qobject_cast<ISupportGeolocation*> (obj); if (!loc) { qWarning () << Q_FUNC_INFO << obj << "doesn't support geolocation"; return; } LocationDialog dia (MW_); if (dia.exec () != QDialog::Accepted) return; loc->SetGeolocationInfo (dia.GetInfo ()); }