本文整理汇总了C++中kservice::Ptr::isApplication方法的典型用法代码示例。如果您正苦于以下问题:C++ Ptr::isApplication方法的具体用法?C++ Ptr::isApplication怎么用?C++ Ptr::isApplication使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kservice::Ptr
的用法示例。
在下文中一共展示了Ptr::isApplication方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: data
QVariant AppsModel::data(const QModelIndex &index, int role) const
{
if (!index.isValid() || index.row() >= m_entryList.count()) {
return QVariant();
}
const AbstractEntry *entry = m_entryList.at(index.row());
if (role == Qt::DisplayRole) {
return entry->name();
} else if (role == Qt::DecorationRole) {
return entry->icon();
} else if (role == Kicker::IsParentRole) {
return (entry->type() == AbstractEntry::GroupType);
} else if (role == Kicker::HasChildrenRole) {
if (entry->type() == AbstractEntry::GroupType) {
const AbstractGroupEntry *groupEntry = static_cast<const AbstractGroupEntry *>(entry);
if (groupEntry->model() && groupEntry->model()->count()) {
return true;
}
}
} else if (role == Kicker::FavoriteIdRole) {
if (entry->type() == AbstractEntry::RunnableType) {
return QVariant("app:" + static_cast<AppEntry *>(m_entryList.at(index.row()))->service()->storageId());
}
} else if (role == Kicker::HasActionListRole) {
if (entry->type() == AbstractEntry::RunnableType || !m_hiddenEntries.isEmpty()) {
return true;
} else if (entry->type() == AbstractEntry::GroupType) {
const AbstractGroupEntry *groupEntry = static_cast<const AbstractGroupEntry *>(entry);
if (groupEntry->model()) {
const AppsModel *appsModel = qobject_cast<const AppsModel *>(groupEntry->model());
if (appsModel && !appsModel->hiddenEntries().isEmpty()) {
return true;
}
}
}
} else if (role == Kicker::ActionListRole) {
QVariantList actionList;
if (entry->type() == AbstractEntry::RunnableType) {
const KService::Ptr service = static_cast<const AppEntry *>(entry)->service();
if (ContainmentInterface::mayAddLauncher(m_appletInterface, ContainmentInterface::Desktop)) {
actionList << Kicker::createActionItem(i18n("Add to Desktop"), "addToDesktop");
}
if (ContainmentInterface::mayAddLauncher(m_appletInterface, ContainmentInterface::Panel)) {
actionList << Kicker::createActionItem(i18n("Add to Panel"), "addToPanel");
}
if (ContainmentInterface::mayAddLauncher(m_appletInterface, ContainmentInterface::TaskManager, service->entryPath())) {
actionList << Kicker::createActionItem(i18n("Add as Launcher"), "addToTaskManager");
}
if (m_menuEntryEditor->canEdit(service->entryPath())) {
actionList << Kicker::createSeparatorActionItem();
QVariantMap editAction = Kicker::createActionItem(i18n("Edit Application..."), "editApplication");
editAction["icon"] = "kmenuedit"; // TODO: Using the KMenuEdit icon might be misleading.
actionList << editAction;
}
#ifdef PackageKitQt5_FOUND
QStringList files(service->entryPath());
if (service->isApplication()) {
files += QStandardPaths::findExecutable(KShell::splitArgs(service->exec()).first());
}
FindPackageJob* job = new FindPackageJob(files); // TODO: Would be great to make this async.
if (job->exec() && !job->packageNames().isEmpty()) {
QString packageName = job->packageNames().first();
QVariantMap removeAction = Kicker::createActionItem(i18n("Remove '%1'...", packageName), "removeApplication", packageName);
removeAction["icon"] = "applications-other";
actionList << removeAction;
}
#endif
if (appletConfig() && appletConfig()->contains("hiddenApplications")) {
const QStringList &hiddenApps = appletConfig()->value("hiddenApplications").toStringList();
if (!hiddenApps.contains(service->menuId())) {
actionList << Kicker::createActionItem(i18n("Hide Application"), "hideApplication");
}
}
}
if (!m_hiddenEntries.isEmpty()) {
actionList << Kicker::createSeparatorActionItem();
actionList << Kicker::createActionItem(i18n("Unhide Applications in this Submenu"), "unhideSiblingApplications");
}
if (entry->type() == AbstractEntry::GroupType) {
const AbstractGroupEntry *groupEntry = static_cast<const AbstractGroupEntry *>(entry);
//.........这里部分代码省略.........