Changeset View
Changeset View
Standalone View
Standalone View
applets/kicker/plugin/appentry.cpp
Show First 20 Lines • Show All 138 Lines • ▼ Show 20 Line(s) | 137 | { | |||
---|---|---|---|---|---|
139 | 139 | | |||
140 | actionList << Kicker::jumpListActions(m_service); | 140 | actionList << Kicker::jumpListActions(m_service); | ||
141 | if (!actionList.isEmpty()) { | 141 | if (!actionList.isEmpty()) { | ||
142 | actionList << Kicker::createSeparatorActionItem(); | 142 | actionList << Kicker::createSeparatorActionItem(); | ||
143 | } | 143 | } | ||
144 | 144 | | |||
145 | QObject *appletInterface = m_owner->rootModel()->property("appletInterface").value<QObject *>(); | 145 | QObject *appletInterface = m_owner->rootModel()->property("appletInterface").value<QObject *>(); | ||
146 | 146 | | |||
147 | const bool systemImmutable = appletInterface->property("immutability").toInt() == Plasma::Types::SystemImmutable; | 147 | bool systemImmutable = false; | ||
148 | if (appletInterface) { | ||||
149 | systemImmutable = (appletInterface->property("immutability").toInt() == Plasma::Types::SystemImmutable); | ||||
150 | } | ||||
148 | 151 | | |||
149 | const QVariantList &addLauncherActions = Kicker::createAddLauncherActionList(appletInterface, m_service); | 152 | const QVariantList &addLauncherActions = Kicker::createAddLauncherActionList(appletInterface, m_service); | ||
150 | if (!systemImmutable && !addLauncherActions.isEmpty()) { | 153 | if (!systemImmutable && !addLauncherActions.isEmpty()) { | ||
151 | actionList << addLauncherActions | 154 | actionList << addLauncherActions | ||
152 | << Kicker::createSeparatorActionItem(); | 155 | << Kicker::createSeparatorActionItem(); | ||
153 | } | 156 | } | ||
154 | 157 | | |||
155 | const QVariantList &recentDocuments = Kicker::recentDocumentActions(m_service); | 158 | const QVariantList &recentDocuments = Kicker::recentDocumentActions(m_service); | ||
156 | if (!recentDocuments.isEmpty()) { | 159 | if (!recentDocuments.isEmpty()) { | ||
157 | actionList << recentDocuments << Kicker::createSeparatorActionItem(); | 160 | actionList << recentDocuments << Kicker::createSeparatorActionItem(); | ||
158 | } | 161 | } | ||
159 | 162 | | |||
160 | // Don't allow adding launchers, editing, hiding, or uninstalling applications | 163 | // Don't allow adding launchers, editing, hiding, or uninstalling applications | ||
161 | // when system is immutable. | 164 | // when system is immutable. | ||
162 | if (systemImmutable) { | 165 | if (systemImmutable) { | ||
163 | return actionList; | 166 | return actionList; | ||
164 | } | 167 | } | ||
165 | 168 | | |||
166 | if (m_service->isApplication()) { | 169 | if (m_service->isApplication()) { | ||
167 | actionList << Kicker::createSeparatorActionItem(); | 170 | actionList << Kicker::createSeparatorActionItem(); | ||
168 | actionList << Kicker::editApplicationAction(m_service); | 171 | actionList << Kicker::editApplicationAction(m_service); | ||
169 | actionList << Kicker::appstreamActions(m_service); | 172 | actionList << Kicker::appstreamActions(m_service); | ||
170 | } | 173 | } | ||
171 | 174 | | |||
175 | if (appletInterface) { | ||||
172 | QQmlPropertyMap *appletConfig = qobject_cast<QQmlPropertyMap *>(appletInterface->property("configuration").value<QObject *>()); | 176 | QQmlPropertyMap *appletConfig = qobject_cast<QQmlPropertyMap *>(appletInterface->property("configuration").value<QObject *>()); | ||
173 | 177 | | |||
174 | if (appletConfig && appletConfig->contains(QLatin1String("hiddenApplications")) && qobject_cast<AppsModel *>(m_owner)) { | 178 | if (appletConfig && appletConfig->contains(QLatin1String("hiddenApplications")) && qobject_cast<AppsModel *>(m_owner)) { | ||
175 | const QStringList &hiddenApps = appletConfig->value(QLatin1String("hiddenApplications")).toStringList(); | 179 | const QStringList &hiddenApps = appletConfig->value(QLatin1String("hiddenApplications")).toStringList(); | ||
176 | 180 | | |||
177 | if (!hiddenApps.contains(m_service->menuId())) { | 181 | if (!hiddenApps.contains(m_service->menuId())) { | ||
178 | QVariantMap hideAction = Kicker::createActionItem(i18n("Hide Application"), QStringLiteral("hideApplication")); | 182 | QVariantMap hideAction = Kicker::createActionItem(i18n("Hide Application"), QStringLiteral("hideApplication")); | ||
179 | hideAction[QStringLiteral("icon")] = QStringLiteral("hint"); | 183 | hideAction[QStringLiteral("icon")] = QStringLiteral("hint"); | ||
180 | actionList << hideAction; | 184 | actionList << hideAction; | ||
181 | } | 185 | } | ||
182 | } | 186 | } | ||
187 | } | ||||
183 | 188 | | |||
184 | return actionList; | 189 | return actionList; | ||
185 | } | 190 | } | ||
186 | 191 | | |||
187 | bool AppEntry::run(const QString& actionId, const QVariant &argument) | 192 | bool AppEntry::run(const QString& actionId, const QVariant &argument) | ||
188 | { | 193 | { | ||
189 | if (!m_service->isValid()) { | 194 | if (!m_service->isValid()) { | ||
190 | return false; | 195 | return false; | ||
▲ Show 20 Lines • Show All 113 Lines • Show Last 20 Lines |