void Frame::refreshList() { m_wallpaperList->clear(); if (m_mode == WallpaperMode) { QDBusPendingCall call = m_dbusAppearance->List("background"); QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(call, this); connect(watcher, &QDBusPendingCallWatcher::finished, this, [this, call] { if (call.isError()) { qWarning() << "failed to get all backgrounds: " << call.error().message(); } else { QDBusReply<QString> reply = call.reply(); QString value = reply.value(); QStringList strings = processListReply(value); foreach (QString path, strings) { WallpaperItem * item = m_wallpaperList->addWallpaper(path); item->setData(item->getPath()); item->setDeletable(m_deletableInfo.value(path)); item->addButton(DESKTOP_BUTTON_ID, tr("Only desktop")); item->addButton(LOCK_SCREEN_BUTTON_ID, tr("Only lock screen")); item->show(); connect(item, &WallpaperItem::buttonClicked, this, &Frame::onItemButtonClicked); } m_wallpaperList->setFixedWidth(width()); m_wallpaperList->updateItemThumb(); m_wallpaperList->show(); } });
void AccountsWorker::randomUserIcon(User *user) { QDBusPendingCall call = m_accountsInter->RandUserIcon(); QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(call, this); connect(watcher, &QDBusPendingCallWatcher::finished, [=] { if (!call.isError()) { QDBusReply<QString> reply = call.reply(); user->setCurrentAvatar(reply.value()); } watcher->deleteLater(); }); }