本文整理汇总了C++中IAccount::GetAccountID方法的典型用法代码示例。如果您正苦于以下问题:C++ IAccount::GetAccountID方法的具体用法?C++ IAccount::GetAccountID怎么用?C++ IAccount::GetAccountID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IAccount
的用法示例。
在下文中一共展示了IAccount::GetAccountID方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleAccountClicked
void AccountsListWidget::handleAccountClicked (const QModelIndex& idx)
{
QModelIndex index = idx.sibling (idx.row (), Columns::Name);
if (!index.isValid ())
return;
QStandardItem *item = AccountsModel_->itemFromIndex (index);
if (item &&
Item2Account_.contains (item))
{
IAccount *acc = Item2Account_ [item];
auto ibp = qobject_cast<IBloggingPlatform*> (acc->GetParentBloggingPlatform ());
if (!ibp)
{
qWarning () << Q_FUNC_INFO
<< "account"
<< acc->GetAccountID ()
<< "hasn't valid parent blogging platform"
<< acc->GetParentBloggingPlatform ();
return;
}
Ui_.Profile_->setEnabled ((ibp->GetFeatures () &
IBloggingPlatform::BPFSupportsProfiles) &&
acc->IsValidated ());
}
}
示例2: GetPassword
QString Core::GetPassword (QObject *accObj)
{
QVariantList keys;
IAccount *account = qobject_cast<IAccount*> (accObj);
keys << account->GetAccountID ();
const QVariantList& result = Util::GetPersistentData (keys, this);
if (result.size () != 1)
{
qWarning () << Q_FUNC_INFO
<< "incorrect result size"
<< result;
return QString ();
}
const QVariantList& strVarList = result.at (0).toList ();
if (strVarList.isEmpty () ||
!strVarList.at (0).canConvert<QString> ())
{
qWarning () << Q_FUNC_INFO
<< "invalid string variant list"
<< strVarList;
return QString ();
}
return strVarList.at (0).toString ();
}
示例3: on_Delete__released
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->GetObject ());
}
示例4: RequestLastMessages
void Plugin::RequestLastMessages (QObject *entryObj, int num)
{
ICLEntry *entry = qobject_cast<ICLEntry*> (entryObj);
if (!entry)
{
qWarning () << Q_FUNC_INFO
<< entryObj
<< "doesn't implement ICLEntry";
return;
}
if (entry->GetEntryType () != ICLEntry::ETChat)
return;
IAccount *account = qobject_cast<IAccount*> (entry->GetParentAccount ());
if (!account)
{
qWarning () << Q_FUNC_INFO
<< entry->GetParentAccount ()
<< "doesn't implement IAccount";
return;
}
const QString& accId = account->GetAccountID ();
const QString& entryId = entry->GetEntryID ();
Core::Instance ()->GetChatLogs (accId, entryId, 0, num);
RequestedLogs_ [accId] [entryId] = entryObj;
}
示例5: on_Delete__released
void AccountsListWidget::on_Delete__released()
{
QModelIndex index = Ui_.Accounts_->
selectionModel ()->currentIndex ();
if (!index.isValid ())
return;
IAccount *acc = index
.data (RAccObj).value<IAccount*> ();
if (QMessageBox::question (this,
"LeechCraft",
tr ("Are you sure you want to remove the account %1?")
.arg (acc->GetAccountName ()),
QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes)
return;
QObject *protoObj = acc->GetParentProtocol ();
IProtocol *proto = qobject_cast<IProtocol*> (protoObj);
if (!proto)
{
qWarning () << Q_FUNC_INFO
<< "parent protocol for"
<< acc->GetAccountID ()
<< "doesn't implement IProtocol";
return;
}
proto->RemoveAccount (acc->GetObject ());
}
示例6: DeletePassword
void Core::DeletePassword (QObject *accObj)
{
IAccount *account = qobject_cast<IAccount*> (accObj);
QVariantList keys;
keys << account->GetAccountID ();
Entity e = Util::MakeEntity (keys,
QString (),
Internal,
"x-leechcraft/data-persistent-clear");
emit gotEntity (e);
}
示例7: RereadProfileData
void ProfileWidget::RereadProfileData ()
{
//TODO
const LJProfileData& data = Profile_->GetProfileData ();
Ui_.JournalName_->setText (data.FullName_);
IAccount *acc = qobject_cast<IAccount*> (Profile_->GetParentAccount ());
const QString& path = Util::CreateIfNotExists ("blogique/metida/avatars")
.absoluteFilePath (acc->GetAccountID ().toBase64 ().replace ('/', '_'));
Ui_.JournalPic_->setPixmap (QPixmap (path));
ReFillModels ();
}
示例8: Process
void Core::Process (QObject *msgObj)
{
IMessage *msg = qobject_cast<IMessage*> (msgObj);
if (msg->GetMessageType () != IMessage::MTChatMessage &&
msg->GetMessageType () != IMessage::MTMUCMessage)
return;
if (msg->GetBody ().isEmpty ())
return;
if (msg->GetDirection () == IMessage::DOut &&
msg->GetMessageType () == IMessage::MTMUCMessage)
return;
ICLEntry *entry = qobject_cast<ICLEntry*> (msg->ParentCLEntry ());
if (!entry)
{
qWarning () << Q_FUNC_INFO
<< "message's other part doesn't implement ICLEntry"
<< msg->GetObject ()
<< msg->OtherPart ();
return;
}
if (DisabledIDs_.contains (entry->GetEntryID ()))
return;
IAccount *acc = qobject_cast<IAccount*> (entry->GetParentAccount ());
if (!acc)
{
qWarning () << Q_FUNC_INFO
<< "message's account doesn't implement IAccount"
<< entry->GetParentAccount ();
return;
}
QVariantMap data;
data ["EntryID"] = entry->GetEntryID ();
data ["VisibleName"] = entry->GetEntryName ();
data ["AccountID"] = acc->GetAccountID ();
data ["DateTime"] = msg->GetDateTime ();
data ["Direction"] = msg->GetDirection () == IMessage::DIn ? "IN" : "OUT";
data ["Body"] = msg->GetBody ();
data ["OtherVariant"] = msg->GetOtherVariant ();
data ["MessageType"] = static_cast<int> (msg->GetMessageType ());
QMetaObject::invokeMethod (StorageThread_->GetStorage (),
"addMessage",
Qt::QueuedConnection,
Q_ARG (QVariantMap, data));
}
示例9: handleAvatarDownloadFinished
void LJProfile::handleAvatarDownloadFinished ()
{
QNetworkReply *reply = qobject_cast<QNetworkReply*> (sender ());
if (!reply)
return;
reply->deleteLater ();
IAccount *acc = qobject_cast<IAccount*> (ParentAccount_);
if (!acc)
return;
const QByteArray filename = acc->GetAccountID ().toBase64 ().replace ('/', '_');
const QDir& avatarDir = Util::CreateIfNotExists ("blogique/metida/avatars");
const QString& path = avatarDir.absoluteFilePath (filename);
QFile file (path);
if (file.open (QIODevice::WriteOnly))
file.write (reply->readAll ());
}
示例10: SavePassword
void Core::SavePassword (QObject *accObj)
{
QVariantList keys;
IAccount *account = qobject_cast<IAccount*> (accObj);
keys << account->GetAccountID ();
QVariantList passwordVar;
passwordVar << account->GetPassword ();
QVariantList values;
values << QVariant (passwordVar);
Entity e = Util::MakeEntity (keys,
QString (),
Internal,
"x-leechcraft/data-persistent-save");
e.Additional_ ["Values"] = values;
e.Additional_ ["Overwrite"] = true;
emit gotEntity (e);
}
示例11: on_Delete__released
void AccountsListDialog::on_Delete__released()
{
QModelIndex index = Ui_.Accounts_->
selectionModel ()->currentIndex ();
if (!index.isValid ())
return;
IAccount *acc = index
.data (RAccObj).value<IAccount*> ();
QObject *protoObj = acc->GetParentProtocol ();
IProtocol *proto = qobject_cast<IProtocol*> (protoObj);
if (!proto)
{
qWarning () << Q_FUNC_INFO
<< "parent protocol for"
<< acc->GetAccountID ()
<< "doesn't implement IProtocol";
return;
}
proto->RemoveAccount (acc->GetObject ());
}
示例12: addAccount
void AccountsSettings::addAccount (QObjectList accObjects)
{
IBookmarksService *ibs = qobject_cast<IBookmarksService*> (sender ());
if (!ibs)
{
qWarning () << Q_FUNC_INFO
<< sender ()
<< "ins't IBookmarksService";
return;
}
QObjectList accounts;
Q_FOREACH (QObject *accObj, accObjects)
{
IAccount *account = qobject_cast<IAccount*> (accObj);
if (Id2Account_.contains (account->GetAccountID ()))
continue;
if (!account->GetPassword ().isEmpty ())
Core::Instance ().SavePassword (accObj);
else
account->SetPassword (Core::Instance ().GetPassword (accObj));
Id2Account_ [account->GetAccountID ()] = accObj;
accounts << accObj;
const QModelIndex& index = GetServiceIndex (ibs->GetObject ());
QStandardItem *parentItem = 0;
if (!index.isValid ())
{
parentItem = new QStandardItem (ibs->GetServiceIcon (), ibs->GetServiceName ());
parentItem->setEditable (false);
Item2Service_ [parentItem] = ibs;
AccountsModel_->appendRow (parentItem);
}
else
parentItem = AccountsModel_->itemFromIndex (index);
QList<QStandardItem*> record;
QStandardItem *item = new QStandardItem (account->GetLogin ());
item->setEditable (false);
item->setCheckable (true);
item->setCheckState (account->IsSyncing () ? Qt::Checked : Qt::Unchecked);
if (account->IsSyncing ())
{
Core::Instance ().AddActiveAccount (accObj);
IBookmarksService *ibs = qobject_cast<IBookmarksService*> (account->GetParentService ());
ibs->DownloadBookmarks (account->GetObject (), account->GetLastDownloadDateTime ());
ibs->UploadBookmarks (account->GetObject (), Core::Instance ().GetAllBookmarks ());
}
Item2Account_ [item] = account;
QStandardItem *uploaditem = new QStandardItem (account->GetLastUploadDateTime ()
.toString (Qt::DefaultLocaleShortDate));
uploaditem->setEditable (false);
QStandardItem *downloaditem = new QStandardItem (account->GetLastDownloadDateTime ()
.toString (Qt::DefaultLocaleShortDate));
uploaditem->setEditable (false);
record << item
<< uploaditem
<< downloaditem;
parentItem->appendRow (record);
if (account->IsSyncing ())
Core::Instance ().AddActiveAccount (accObj);
Ui_.AccountsView_->expandAll ();
Scheduled_ = false;
ScheduleResize ();
}