[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: 2010-05-07 23:05:11
Message-ID: 20100507230511.11826AC8B0 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1124149 by aseigo:
don't hold on to the groupable item as it has no life span guarantees; instead hold \
on to the tasks which are reference counted BUG:235418
M +33 -7 taskactions.cpp
M +26 -14 taskactions_p.h
--- trunk/KDE/kdebase/workspace/libs/taskmanager/taskactions.cpp #1124148:1124149
@@ -165,9 +165,31 @@
}
+AbstractGroupableItemAction::AbstractGroupableItemAction(QObject *parent, \
AbstractGroupableItem *item) + : QAction(parent)
+{
+ TaskGroup *group = qobject_cast<TaskGroup *>(item);
+ if (group) {
+ addToTasks(group);
+ } else if (TaskItem *taskItem = qobject_cast<TaskItem *>(item)) {
+ m_tasks.append(taskItem->task());
+ }
+}
+
+void AbstractGroupableItemAction::addToTasks(TaskGroup *group)
+{
+ foreach (AbstractGroupableItem *item, group->members()) {
+ TaskGroup *subGroup = qobject_cast<TaskGroup *>(item);
+ if (subGroup) {
+ addToTasks(subGroup);
+ } else if (TaskItem *taskItem = qobject_cast<TaskItem *>(item)) {
+ m_tasks.append(taskItem->task());
+ }
+ }
+}
+
ToCurrentDesktopActionImpl::ToCurrentDesktopActionImpl(QObject *parent, \
AbstractGroupableItem *item)
- : QAction(parent),
- m_item(item)
+ : AbstractGroupableItemAction(parent, item)
{
connect(this, SIGNAL(triggered()), this, SLOT(slotToCurrentDesktop()));
setText(i18n("&To Current Desktop"));
@@ -176,15 +198,17 @@
void ToCurrentDesktopActionImpl::slotToCurrentDesktop()
{
- m_item->toDesktop(KWindowSystem::currentDesktop());
+ const int desktop = KWindowSystem::currentDesktop();
+ foreach (TaskPtr task, m_tasks) {
+ task->toDesktop(desktop);
}
+}
ToDesktopActionImpl::ToDesktopActionImpl(QObject *parent, AbstractGroupableItem \
*item, int desktop)
- : QAction(parent),
- m_desktop(desktop),
- m_item(item)
+ : AbstractGroupableItemAction(parent, item),
+ m_desktop(desktop)
{
connect(this, SIGNAL(triggered()), this, SLOT(slotToDesktop()));
setCheckable(true);
@@ -201,8 +225,10 @@
void ToDesktopActionImpl::slotToDesktop()
{
- m_item->toDesktop(m_desktop);
+ foreach (TaskPtr task, m_tasks) {
+ task->toDesktop(m_desktop);
}
+}
--- trunk/KDE/kdebase/workspace/libs/taskmanager/taskactions_p.h #1124148:1124149
@@ -24,6 +24,8 @@
#ifndef TASKACTIONS_P_H
#define TASKACTIONS_P_H
+#include "taskmanager.h"
+
namespace TaskManager
{
@@ -44,18 +46,6 @@
MinimizeActionImpl(QObject *parent, AbstractGroupableItem *task);
};
-/** Move window to current desktop*/
-class ToCurrentDesktopActionImpl : public QAction
-{
- Q_OBJECT
-public:
- ToCurrentDesktopActionImpl(QObject *parent, AbstractGroupableItem *task);
-private Q_SLOTS:
- void slotToCurrentDesktop();
-private:
- AbstractGroupableItem *m_item;
-};
-
/** Shade a window or all windows in a group*/
class ShadeActionImpl : public QAction
{
@@ -88,8 +78,31 @@
CloseActionImpl(QObject *parent, AbstractGroupableItem *task);
};
+class AbstractGroupableItemAction : public QAction
+{
+ Q_OBJECT
+public:
+ AbstractGroupableItemAction(QObject *parent, AbstractGroupableItem *item);
+
+protected:
+ QList<TaskPtr> m_tasks;
+
+private:
+ void addToTasks(TaskGroup *group);
+};
+
+/** Move window to current desktop*/
+class ToCurrentDesktopActionImpl : public AbstractGroupableItemAction
+{
+ Q_OBJECT
+public:
+ ToCurrentDesktopActionImpl(QObject *parent, AbstractGroupableItem *task);
+private Q_SLOTS:
+ void slotToCurrentDesktop();
+};
+
/** Send a Task to a specific Desktop*/
-class ToDesktopActionImpl : public QAction
+class ToDesktopActionImpl : public AbstractGroupableItemAction
{
Q_OBJECT
public:
@@ -98,7 +111,6 @@
void slotToDesktop();
private:
int m_desktop;
- AbstractGroupableItem *m_item;
};
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic