本文整理汇总了C++中Protocol::account方法的典型用法代码示例。如果您正苦于以下问题:C++ Protocol::account方法的具体用法?C++ Protocol::account怎么用?C++ Protocol::account使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Protocol
的用法示例。
在下文中一共展示了Protocol::account方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: create_privkey
void OtrInternal::create_privkey(const char *accountname,
const char *protocol)
{
Q_ASSERT(m_userstate);
if(!m_mutex.tryLock(10))
return;
QMessageBox infoMb(QMessageBox::Information, tr("qutim-otr"),
tr("Generating keys for account %1\nThis may take a while.\nPlease, move mouse and use keyoard to decrease generation time.").arg(QString(accountname)),
QMessageBox::Ok, NULL,
Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint);
infoMb.button(QMessageBox::Ok)->setEnabled(false);
infoMb.button(QMessageBox::Ok)->setText(tr("please wait..."));
infoMb.setWindowModality(Qt::NonModal);
infoMb.setModal(false);
infoMb.show();
Protocol *protocolObject = Protocol::all().value(QString::fromUtf8(protocol));
Account *account = protocolObject->account(QString::fromUtf8(accountname));
OTRCrypt::instance()->disableAccount(account);
{
QByteArray keysFile = m_keysFile.toLocal8Bit();
QEventLoop loop;
QFutureWatcher<gcry_error_t> watcher;
connect(&watcher, SIGNAL(finished()), &loop, SLOT(quit()));
QFuture<gcry_error_t> future = QtConcurrent::run(otrl_privkey_generate,
m_userstate,
keysFile.constData(),
accountname,
protocol);
watcher.setFuture(future);
loop.exec();
}
OTRCrypt::instance()->enableAccount(account);
m_mutex.unlock();
infoMb.button(QMessageBox::Ok)->setEnabled(true);
infoMb.button(QMessageBox::Ok)->setText("Ok");
char fingerprint[45];
if (otrl_privkey_fingerprint(m_userstate, fingerprint, accountname,
protocol) == NULL)
{
QMessageBox failMb(QMessageBox::Critical, tr("qutim-otr"),
tr("Failed to generate key for account %1\nThe OTR Plugin will not work.").arg(QString(accountname)),
QMessageBox::Ok, NULL,
Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint);
failMb.exec();
}
else
{
infoMb.setText(tr("The fingerprint for account %1 is\n").arg(QString(accountname)) + QString(fingerprint));
}
infoMb.exec();
}