[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdebase/workspace/libs/taskmanager
From: Aaron J. Seigo <aseigo () kde ! org>
Date: 2011-01-25 0:23:46
Message-ID: 20110125002346.A97BDAC8BB () svn ! kde ! org
[Download RAW message or body]
SVN commit 1216810 by aseigo:
* handle groups in the launcher action
* use launcherUrl
M +25 -21 taskactions.cpp
--- trunk/KDE/kdebase/workspace/libs/taskmanager/taskactions.cpp #1216809:1216810
@@ -323,33 +323,38 @@
: QAction(parent), m_abstractItem(item), m_groupingStrategy(strategy)
{
connect(this, SIGNAL(triggered()), this, SLOT(toggleLauncher()));
- if (item->itemType() == TaskItemType) {
- m_name = static_cast<TaskItem *>(item)->task()->classClass();
- } else {
+
+ switch (item->itemType()) {
+ case LauncherItemType:
m_name = item->name();
+ setText(i18n("Remove This Launcher"));
+ break;
+
+ case GroupItemType: {
+ TaskGroup *group = static_cast<TaskGroup *>(item);
+ foreach (AbstractGroupableItem *i, group->members()) {
+ if (i->itemType() != GroupItemType) {
+ item = i;
+ break;
}
+ }
- if (item->itemType() == LauncherItemType) {
- m_url = static_cast<LauncherItem *>(item)->url();
- setText(i18n("Remove This Launcher"));
- } else {
+ if (item->itemType() == GroupItemType) {
+ setVisible(false);
+ setChecked(false);
+ break;
+ }
+
+ } // fallthrough to TaskItemType below
+
+ case TaskItemType:
+ m_name = static_cast<TaskItem *>(item)->task()->classClass();
setText(i18n("&Show A Launcher For %1 When It Is Not Running", m_name));
setCheckable(true);
-
- // Search for applications which are executable and case-insensitively match \
the windowclass of the task and
- // See http://techbase.kde.org/Development/Tutorials/Services/Traders#The_KTrader_Query_Language
- // if the following is unclear to you.
- QString query = QString("exist Exec and ('%1' =~ Name)").arg(m_name);
- KService::List services = KServiceTypeTrader::self()->query("Application", \
query);
- if (!services.empty()) {
- m_url = KUrl::fromPath((services[0]->entryPath()));
- } else { // No desktop-file was found, so try to find at least the \
executable
- QString path = KStandardDirs::findExe(m_name.toLower());
- if (!path.isEmpty()) {
- m_url = KUrl::fromPath(path);
+ break;
}
- }
+ m_url = item->launcherUrl();
if (m_url.isEmpty()) {
//don't show the possibility to add a launcher if we don't have a url \
for it //kDebug() << "No executable found for" << m_name;
@@ -359,7 +364,6 @@
setChecked(m_groupingStrategy->launcherExists(m_url));
}
}
-}
void ToggleLauncherActionImpl::toggleLauncher()
{
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic