本文整理汇总了C++中QDBusPendingReply::count方法的典型用法代码示例。如果您正苦于以下问题:C++ QDBusPendingReply::count方法的具体用法?C++ QDBusPendingReply::count怎么用?C++ QDBusPendingReply::count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDBusPendingReply
的用法示例。
在下文中一共展示了QDBusPendingReply::count方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onPasswordProvided
void ConferenceAuthOp::onPasswordProvided(QDBusPendingCallWatcher *watcher)
{
QDBusPendingReply<bool> reply = *watcher;
if (!reply.isValid() || reply.count() < 1) {
return;
}
if (reply.argumentAt<0>()) {
m_walletInterface->setEntry(m_account,m_channel->targetId(), m_password);
setFinished();
} else {
qDebug() << "Password was incorrect, enter again";
passwordDialog();
}
}
示例2: showMenu
void PanelMenu::showMenu(int x, int y)
{
if (m_menuManager && m_menuManager->isValid()){
QDBusPendingReply<QDBusObjectPath> pr = m_menuManager->RegisterMenu();
if (pr.count() == 1)
{
QDBusObjectPath op = pr.argumentAt(0).value<QDBusObjectPath>();
m_menuInterfacePath = op.path();
DBusMenu *m_menu = new DBusMenu(m_menuInterfacePath,this);
connect(m_menu,&DBusMenu::MenuUnregistered,m_menu,&DBusMenu::deleteLater);
connect(m_menu,&DBusMenu::ItemInvoked,this,&PanelMenu::onItemInvoked);
QJsonObject targetObj;
targetObj.insert("x",QJsonValue(x));
targetObj.insert("y",QJsonValue(y));
targetObj.insert("isDockMenu",QJsonValue(false));
QJsonArray contentArry;
contentArry.append(createRadioItemObj(tr("Fashion mode"),ToFashionMode,DockModeGroup,m_dockModeData->getDockMode() == Dock::FashionMode));
contentArry.append(createRadioItemObj(tr("Efficient mode"),ToEfficientMode,DockModeGroup,m_dockModeData->getDockMode() == Dock::EfficientMode));
contentArry.append(createRadioItemObj(tr("Classic mode"),ToClassicMode,DockModeGroup,m_dockModeData->getDockMode() == Dock::ClassicMode));
contentArry.append(createItemObj("",OperationType(-1)));
contentArry.append(createRadioItemObj(tr("Keep showing"),ToKeepShowing,HideModeGroup,m_dockModeData->getHideMode() == Dock::KeepShowing));
contentArry.append(createRadioItemObj(tr("Keep hidden"),ToKeepHidden,HideModeGroup,m_dockModeData->getHideMode() == Dock::KeepHidden));
contentArry.append(createRadioItemObj(tr("Smart hide"),ToSmartHide,HideModeGroup,m_dockModeData->getHideMode() == Dock::SmartHide));
contentArry.append(createItemObj("",OperationType(-1)));
contentArry.append(createItemObj(tr("Notification area settings"),ToPluginSetting));
QJsonObject contentObj;
contentObj.insert("items",contentArry);
targetObj.insert("menuJsonContent",QString(QJsonDocument(contentObj).toJson()));
m_menu->ShowMenu(QString(QJsonDocument(targetObj).toJson()));
}
}
}
示例3: verifyUiSlot
void SignonIdentity::verifyUiSlot(QDBusPendingCallWatcher *call)
{
TRACE();
setAutoDestruct(true);
QDBusMessage errReply;
QDBusPendingReply<QVariantMap> reply;
if (call != NULL) {
reply = *call;
call->deleteLater();
}
QVariantMap resultParameters;
if (!reply.isError() && reply.count()) {
resultParameters = reply.argumentAt<0>();
} else {
errReply = m_message.createErrorReply(SIGNOND_IDENTITY_OPERATION_CANCELED_ERR_NAME,
SIGNOND_IDENTITY_OPERATION_CANCELED_ERR_STR);
SIGNOND_BUS.send(errReply);
return;
}
if (!resultParameters.contains(SSOUI_KEY_ERROR)) {
//no reply code
errReply = m_message.createErrorReply(SIGNOND_INTERNAL_SERVER_ERR_NAME,
SIGNOND_INTERNAL_SERVER_ERR_STR);
SIGNOND_BUS.send(errReply);
return;
}
int errorCode = resultParameters.value(SSOUI_KEY_ERROR).toInt();
TRACE() << "error: " << errorCode;
if (errorCode != QUERY_ERROR_NONE) {
if (errorCode == QUERY_ERROR_CANCELED)
errReply = m_message.createErrorReply(SIGNOND_IDENTITY_OPERATION_CANCELED_ERR_NAME,
SIGNOND_IDENTITY_OPERATION_CANCELED_ERR_STR);
else if (errorCode == QUERY_ERROR_FORGOT_PASSWORD)
errReply = m_message.createErrorReply(SIGNOND_FORGOT_PASSWORD_ERR_NAME,
SIGNOND_FORGOT_PASSWORD_ERR_STR);
else
errReply = m_message.createErrorReply(SIGNOND_INTERNAL_SERVER_ERR_NAME,
QString(QLatin1String("signon-ui call returned error %1")).arg(errorCode));
SIGNOND_BUS.send(errReply);
return;
}
if (resultParameters.contains(SSOUI_KEY_PASSWORD)) {
CredentialsDB *db = CredentialsAccessManager::instance()->credentialsDB();
if (db == NULL) {
BLAME() << "NULL database handler object.";
errReply = m_message.createErrorReply(SIGNOND_STORE_FAILED_ERR_NAME,
SIGNOND_STORE_FAILED_ERR_STR);
SIGNOND_BUS.send(errReply);
return;
}
//compare passwords
if (m_pInfo) {
bool ret = m_pInfo->password() == resultParameters[SSOUI_KEY_PASSWORD].toString();
if (!ret && resultParameters.contains(SSOUI_KEY_CONFIRMCOUNT)) {
int count = resultParameters[SSOUI_KEY_CONFIRMCOUNT].toInt();
TRACE() << "retry count:" << count;
if (count > 0) { //retry
resultParameters[SSOUI_KEY_CONFIRMCOUNT] = (count-1);
resultParameters[SSOUI_KEY_MESSAGEID] = QUERY_MESSAGE_NOT_AUTHORIZED;
queryUserPassword(resultParameters);
return;
} else {
//TODO show error note here if needed
}
}
delete m_pInfo;
m_pInfo = NULL;
QDBusMessage dbusreply = m_message.createReply();
dbusreply << ret;
SIGNOND_BUS.send(dbusreply);
return;
}
}
//this should not happen, return error
errReply = m_message.createErrorReply(SIGNOND_INTERNAL_SERVER_ERR_NAME,
SIGNOND_INTERNAL_SERVER_ERR_STR);
SIGNOND_BUS.send(errReply);
return;
}
示例4: queryUiSlot
void SignonIdentity::queryUiSlot(QDBusPendingCallWatcher *call)
{
TRACE();
setAutoDestruct(true);
QDBusMessage errReply;
QDBusPendingReply<QVariantMap> reply;
if (call != NULL) {
reply = *call;
call->deleteLater();
}
QVariantMap resultParameters;
if (!reply.isError() && reply.count()) {
resultParameters = reply.argumentAt<0>();
} else {
errReply = m_message.createErrorReply(SIGNOND_IDENTITY_OPERATION_CANCELED_ERR_NAME,
SIGNOND_IDENTITY_OPERATION_CANCELED_ERR_STR);
SIGNOND_BUS.send(errReply);
return;
}
if (!resultParameters.contains(SSOUI_KEY_ERROR)) {
//no reply code
errReply = m_message.createErrorReply(SIGNOND_INTERNAL_SERVER_ERR_NAME,
SIGNOND_INTERNAL_SERVER_ERR_STR);
SIGNOND_BUS.send(errReply);
return;
}
int errorCode = resultParameters.value(SSOUI_KEY_ERROR).toInt();
TRACE() << "error: " << errorCode;
if (errorCode != QUERY_ERROR_NONE) {
if (errorCode == QUERY_ERROR_CANCELED)
errReply = m_message.createErrorReply(SIGNOND_IDENTITY_OPERATION_CANCELED_ERR_NAME,
SIGNOND_IDENTITY_OPERATION_CANCELED_ERR_STR);
else
errReply = m_message.createErrorReply(SIGNOND_INTERNAL_SERVER_ERR_NAME,
QString(QLatin1String("signon-ui call returned error %1")).arg(errorCode));
SIGNOND_BUS.send(errReply);
return;
}
if (resultParameters.contains(SSOUI_KEY_PASSWORD)) {
CredentialsDB *db = CredentialsAccessManager::instance()->credentialsDB();
if (db == NULL) {
BLAME() << "NULL database handler object.";
errReply = m_message.createErrorReply(SIGNOND_STORE_FAILED_ERR_NAME,
SIGNOND_STORE_FAILED_ERR_STR);
SIGNOND_BUS.send(errReply);
return;
}
//store new password
if (m_pInfo) {
m_pInfo->setPassword(resultParameters[SSOUI_KEY_PASSWORD].toString());
quint32 ret = db->updateCredentials(*m_pInfo, true);
delete m_pInfo;
m_pInfo = NULL;
if (ret != SIGNOND_NEW_IDENTITY) {
QDBusMessage dbusreply = m_message.createReply();
dbusreply << quint32(m_id);
SIGNOND_BUS.send(dbusreply);
return;
} else{
BLAME() << "Error during update";
}
}
}
//this should not happen, return error
errReply = m_message.createErrorReply(SIGNOND_INTERNAL_SERVER_ERR_NAME,
SIGNOND_INTERNAL_SERVER_ERR_STR);
SIGNOND_BUS.send(errReply);
return;
}