本文整理汇总了C++中IAccount::GetTransferManager方法的典型用法代码示例。如果您正苦于以下问题:C++ IAccount::GetTransferManager方法的具体用法?C++ IAccount::GetTransferManager怎么用?C++ IAccount::GetTransferManager使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IAccount
的用法示例。
在下文中一共展示了IAccount::GetTransferManager方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TryDropFile
bool CLModel::TryDropFile (const QMimeData* mime, const QModelIndex& parent)
{
if (parent.data (Core::CLREntryType).value<Core::CLEntryType> () != Core::CLETContact)
return false;
QObject *entryObj = parent.data (Core::CLREntryObject).value<QObject*> ();
ICLEntry *entry = qobject_cast<ICLEntry*> (entryObj);
if (entry->Variants ().isEmpty ())
return false;
IAccount *acc = qobject_cast<IAccount*> (entry->GetParentAccount ());
ITransferManager *mgr = qobject_cast<ITransferManager*> (acc->GetTransferManager ());
if (!mgr)
return false;
const QList<QUrl>& urls = mime->urls ();
if (urls.isEmpty ())
return false;
QString text;
if (urls.size () > 2)
text = tr ("Are you sure you want to send %n files to %1?", 0, urls.size ())
.arg (entry->GetEntryName ());
else
{
QStringList list;
Q_FOREACH (const QUrl& url, urls)
list << QFileInfo (url.path ()).fileName ();
text = tr ("Are you sure you want to send %1 to %2?")
.arg ("<em>" + list.join (", ") + "</em>")
.arg (entry->GetEntryName ());
}
if (QMessageBox::question (0,
"LeechCraft",
text,
QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes)
return false;
Q_FOREACH (const QUrl& url, urls)
{
const QString& path = url.toLocalFile ();
if (!QFileInfo (path).exists ())
continue;
QObject *job = mgr->SendFile (entry->GetEntryID (),
entry->Variants ().first (), path);
Core::Instance ().GetTransferJobManager()->HandleJob (job);
}
return true;
}