[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: Fwd: [PATCH] desktop task grouping
From: David Faure <david () mandrakesoft ! com>
Date: 2001-05-16 8:10:20
[Download RAW message or body]
Sorry for the cross-post... Just not sure the kicker developers read kde-devel ?
---------- Forwarded Message ----------
Subject: [PATCH] desktop task grouping
Date: Wed, 16 May 2001 03:32:08 +0100
From: Alexander Kellett <a.kellett@lancaster.ac.uk>
To: kde-devel@kde.org
This is my first time so please excuse mistakes.
This patch (collection) gives the following:
A new "group tasks per desktop" option in kcmtaskbar,
together with its corresponding taskbar changes and a
small (protected -> public) change in taskmanager.
A very small cleanup for the arrow button orientation
handling code.
The addition of a "(n)" string to a task name to show the
number of windows in the TaskContainer.
My .ui for kcmtaskbar is severely broken as i've never
before used Qt Designer...
Thanks,
Alex
p.s: i'm unfortunately not on the kde-devel list... sorry...
-------------------------------------------------------
--
David FAURE, david@mandrakesoft.com, faure@kde.org
http://perso.mandrakesoft.com/~david/, http://www.konqueror.org/
KDE, Making The Future of Computing Available Today
["taskmanager.patch" (text/plain)]
Index: taskmanager.h
===================================================================
RCS file: /home/kde/kdebase/kicker/taskmanager/taskmanager.h,v
retrieving revision 1.20
diff -u -3 -p -r1.20 taskmanager.h
--- taskmanager.h 2001/05/15 03:37:55 1.20
+++ taskmanager.h 2001/05/16 01:51:48
@@ -186,6 +186,8 @@ public:
int currentDesktop();
bool isOnTop(Task*);
+ Task* findTask(WId w);
+
signals:
void taskAdded(Task*);
void taskRemoved(Task*);
@@ -203,9 +205,6 @@ protected slots:
void currentDesktopChanged(int);
void killStartup(pid_t pid);
void killStartup(Startup*);
-
-protected:
- Task* findTask(WId w);
private:
Task* _active;
["taskbar.patch" (text/plain)]
? TODO
Index: taskbar.cpp
===================================================================
RCS file: /home/kde/kdebase/kicker/taskbar/taskbar.cpp,v
retrieving revision 1.26
diff -u -3 -p -r1.26 taskbar.cpp
--- taskbar.cpp 2001/05/12 18:30:16 1.26
+++ taskbar.cpp 2001/05/16 01:51:31
@@ -93,11 +93,13 @@ void TaskBar::configure()
showAllWindows = c.readBoolEntry( "ShowAllWindows", true );
groupTasks = c.readBoolEntry( "GroupTasks", true );
+ taskPerDesktop = c.readBoolEntry( "TaskPerDesktop", false);
sortByDesktop = c.readBoolEntry( "SortByDesktop", true );
showIcon = c.readBoolEntry( "ShowIcon", true );
for ( TaskContainer *c = containers.first(); c; c = containers.next() ) {
c->setShowAll( showAllWindows );
+ c->setTaskPerDesktop( taskPerDesktop );
c->setSortByDesktop( sortByDesktop );
}
@@ -130,7 +132,8 @@ void TaskBar::add( Task* task )
// try to group
if ( groupTasks ) {
for ( TaskContainer *c = containers.first(); c; c = containers.next() )
- if ( idMatch( task->className().lower(), c->id().lower() ) ) {
+ if ( idMatch( task->className().lower(), c->id().lower() )
+ && ( !taskPerDesktop || (task->desktop() == c->desktop()) ) ) {
c->add( task );
if ( !blocklayout )
@@ -140,7 +143,7 @@ void TaskBar::add( Task* task )
}
// create new container
- TaskContainer *c = new TaskContainer( task, taskManager(), showAllWindows, \
sortByDesktop, showIcon, viewport() ); + TaskContainer *c = new TaskContainer( \
task, taskManager(), showAllWindows, sortByDesktop, taskPerDesktop, showIcon, \
viewport() ); addChild( c );
containers.append( c );
emit containerCountChanged();
@@ -166,7 +169,7 @@ void TaskBar::add( Startup* startup )
}
// create new container
- TaskContainer *c = new TaskContainer( startup, taskManager(), showAllWindows, \
sortByDesktop, showIcon, viewport() ); + TaskContainer *c = new TaskContainer( \
startup, taskManager(), showAllWindows, sortByDesktop, taskPerDesktop, showIcon, \
viewport() ); addChild( c );
containers.append( c );
emit containerCountChanged();
@@ -231,6 +234,12 @@ void TaskBar::windowDesktopChanged( WId
for ( TaskContainer *c = containers.first(); c; c = containers.next() )
if ( c->contains( win ) )
c->windowDesktopChanged( win );
+
+ if (taskPerDesktop) {
+ Task *task = taskManager()->findTask(win);
+ remove( task );
+ add( task );
+ }
reLayout();
}
Index: taskbar.h
===================================================================
RCS file: /home/kde/kdebase/kicker/taskbar/taskbar.h,v
retrieving revision 1.14
diff -u -3 -p -r1.14 taskbar.h
--- taskbar.h 2001/05/12 18:30:20 1.14
+++ taskbar.h 2001/05/16 01:51:31
@@ -83,6 +83,7 @@ private:
bool blocklayout;
bool showAllWindows;
bool groupTasks;
+ bool taskPerDesktop;
bool sortByDesktop;
bool showIcon;
ArrowType arrowType;
Index: taskcontainer.cpp
===================================================================
RCS file: /home/kde/kdebase/kicker/taskbar/taskcontainer.cpp,v
retrieving revision 1.26
diff -u -3 -p -r1.26 taskcontainer.cpp
--- taskcontainer.cpp 2001/05/14 16:56:41 1.26
+++ taskcontainer.cpp 2001/05/16 01:51:31
@@ -44,8 +44,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE
QImage TaskContainer::blendGradient = QImage();
-TaskContainer::TaskContainer( Task *task, TaskManager* manager, bool show, bool \
sort, bool icon, QWidget *parent, const char *name )
- : QToolButton( parent, name ), taskManager( manager ), showAll( show ), \
sortByDesktop( sort ), showIcon( icon ) +TaskContainer::TaskContainer( Task *task, \
TaskManager* manager, bool show, bool sort, bool perDesktop, bool icon, QWidget \
*parent, const char *name ) + : QToolButton( parent, name ), taskManager( manager \
), showAll( show ), sortByDesktop( sort ), showIcon( icon ), taskPerDesktop( \
perDesktop ) {
init();
@@ -56,8 +56,8 @@ TaskContainer::TaskContainer( Task *task
connect( task, SIGNAL( changed() ), SLOT( repaint() ) );
}
-TaskContainer::TaskContainer( Startup *startup, TaskManager* manager, bool show, \
bool sort, bool icon, QWidget *parent, const char *name )
- : QToolButton( parent, name ), taskManager( manager ), showAll( show ), \
sortByDesktop( sort ), showIcon( icon ) +TaskContainer::TaskContainer( Startup \
*startup, TaskManager* manager, bool show, bool sort, bool perDesktop, bool icon, \
QWidget *parent, const char *name ) + : QToolButton( parent, name ), taskManager( \
manager ), showAll( show ), sortByDesktop( sort ), showIcon( icon ), taskPerDesktop( \
perDesktop ) {
init();
@@ -315,6 +315,10 @@ void TaskContainer::drawButton( QPainter
if ( !ftasks.isEmpty() && alliconified )
text = QString( "(%1)" ).arg( text );
+ // add number of windows in task
+ if (ftasks.count() > 1)
+ text = QString("%1 (%2)").arg(text).arg(ftasks.count());
+
// draw text
if ( !text.isEmpty() ) {
@@ -445,53 +449,37 @@ void TaskContainer::popupRMB()
{
if ( ftasks.count() < 1 ) return;
+ QPopupMenu* menu;
+
if ( ftasks.count() == 1 ) {
OpMenu* opMenu = new OpMenu( ftasks.first(), taskManager, this );
+ menu = opMenu;
+ } else {
+ rmbMenu->init();
+ menu = rmbMenu;
+ }
- // calc popup menu position
- QPoint pos( mapToGlobal( QPoint( 0, 0 ) ) );
+ // calc popup menu position
+ QPoint pos( mapToGlobal( QPoint( 0, 0 ) ) );
- switch( arrowType ) {
- case RightArrow:
- pos.setX( pos.x() + width() );
- break;
- case LeftArrow:
- pos.setX( pos.x() - opMenu->sizeHint().width() );
- break;
- case DownArrow:
- pos.setY( pos.y() + height() );
- break;
- case UpArrow:
- pos.setY( pos.y() - opMenu->sizeHint().height() );
- default:
- break;
- }
- opMenu->exec( pos );
+ switch( arrowType ) {
+ case RightArrow:
+ pos.setX( pos.x() + width() );
+ break;
+ case LeftArrow:
+ pos.setX( pos.x() - menu->sizeHint().width() );
+ break;
+ case DownArrow:
+ pos.setY( pos.y() + height() );
+ break;
+ case UpArrow:
+ pos.setY( pos.y() - menu->sizeHint().height() );
+ default:
+ break;
}
- else {
- rmbMenu->init();
-
- // calc popup menu position
- QPoint pos( mapToGlobal( QPoint( 0, 0 ) ) );
+ menu->exec( pos );
- switch( arrowType ) {
- case RightArrow:
- pos.setX( pos.x() + width() );
- break;
- case LeftArrow:
- pos.setX( pos.x() - rmbMenu->sizeHint().width() );
- break;
- case DownArrow:
- pos.setY( pos.y() + height() );
- break;
- case UpArrow:
- pos.setY( pos.y() - rmbMenu->sizeHint().height() );
- default:
- break;
- }
- rmbMenu->exec( pos );
- }
}
void TaskContainer::publishIconGeometry( QPoint global )
@@ -534,7 +522,7 @@ int TaskContainer::desktop()
if ( tasks.isEmpty() )
return taskManager->currentDesktop();
- if ( tasks.count() > 1 )
+ if ( !taskPerDesktop && tasks.count() > 1 )
return taskManager->numberOfDesktops();
return tasks.first()->desktop();
@@ -565,6 +553,15 @@ void TaskContainer::setShowAll( bool s )
updateFilteredTaskList();
repaint();
}
+}
+
+void TaskContainer::setTaskPerDesktop( bool s)
+{
+ bool update = s != taskPerDesktop;
+ taskPerDesktop = s;
+
+ if ( update )
+ updateFilteredTaskList();
}
void TaskContainer::setSortByDesktop( bool s )
Index: taskcontainer.h
===================================================================
RCS file: /home/kde/kdebase/kicker/taskbar/taskcontainer.h,v
retrieving revision 1.14
diff -u -3 -p -r1.14 taskcontainer.h
--- taskcontainer.h 2001/05/12 18:30:20 1.14
+++ taskcontainer.h 2001/05/16 01:51:31
@@ -40,13 +40,14 @@ class TaskContainer : public QToolButton
Q_OBJECT
public:
- TaskContainer( Task*, TaskManager*, bool showAll, bool sort, bool icon, QWidget \
*parent = 0, const char *name = 0 );
- TaskContainer( Startup*, TaskManager*, bool showAll, bool sort, bool icon, \
QWidget *parent = 0, const char *name = 0 ); + TaskContainer( Task*, TaskManager*, \
bool showAll, bool sort, bool perDesktop, bool icon, QWidget *parent = 0, const char \
*name = 0 ); + TaskContainer( Startup*, TaskManager*, bool showAll, bool sort, \
bool perDesktop, bool icon, QWidget *parent = 0, const char *name = 0 ); virtual \
~TaskContainer();
void setArrowType( Qt::ArrowType at );
void setShowAll( bool );
void setSortByDesktop( bool );
+ void setTaskPerDesktop( bool );
void setShowIcon( bool );
void init();
@@ -103,6 +104,7 @@ private:
LMBMenu *lmbMenu;
RMBMenu *rmbMenu;
bool showAll;
+ bool taskPerDesktop;
bool sortByDesktop;
bool showIcon;
static QImage blendGradient;
["kcmtaskbar.patch" (text/plain)]
Index: kcmtaskbar.cpp
===================================================================
RCS file: /home/kde/kdebase/kcontrol/taskbar/kcmtaskbar.cpp,v
retrieving revision 1.15
diff -u -3 -p -r1.15 kcmtaskbar.cpp
--- kcmtaskbar.cpp 2001/05/07 18:17:36 1.15
+++ kcmtaskbar.cpp 2001/05/16 02:24:57
@@ -52,6 +52,7 @@ TaskbarConfig::TaskbarConfig( QWidget *p
connect(ui->showAllCheck, SIGNAL(clicked()), SLOT(configChanged()));
connect(ui->showListBtnCheck, SIGNAL(clicked()), SLOT(configChanged()));
connect(ui->groupCheck, SIGNAL(clicked()), SLOT(configChanged()));
+ connect(ui->perDesktopCheck, SIGNAL(clicked()), SLOT(configChanged()));
connect(ui->sortCheck, SIGNAL(clicked()), SLOT(configChanged()));
load();
@@ -75,6 +76,7 @@ void TaskbarConfig::load()
ui->showAllCheck->setChecked(c->readBoolEntry("ShowAllWindows", true));
ui->showListBtnCheck->setChecked(c->readBoolEntry("ShowWindowListBtn", \
true)); ui->groupCheck->setChecked(c->readBoolEntry("GroupTasks", true));
+ ui->perDesktopCheck->setChecked(c->readBoolEntry("TaskPerDesktop", true));
ui->sortCheck->setChecked(c->readBoolEntry("SortByDesktop", true));
}
@@ -91,6 +93,7 @@ void TaskbarConfig::save()
c->writeEntry("ShowAllWindows", ui->showAllCheck->isChecked());
c->writeEntry("ShowWindowListBtn", ui->showListBtnCheck->isChecked());
c->writeEntry("GroupTasks", ui->groupCheck->isChecked());
+ c->writeEntry("TaskPerDesktop", ui->perDesktopCheck->isChecked());
c->writeEntry("SortByDesktop", ui->sortCheck->isChecked());
c->sync();
}
@@ -111,6 +114,7 @@ void TaskbarConfig::defaults()
ui->showAllCheck->setChecked(true);
ui->showListBtnCheck->setChecked(true);
ui->groupCheck->setChecked(true);
+ ui->perDesktopCheck->setChecked(true);
ui->sortCheck->setChecked(true);
emit changed(true);
}
Index: kcmtaskbarui.ui
===================================================================
RCS file: /home/kde/kdebase/kcontrol/taskbar/kcmtaskbarui.ui,v
retrieving revision 1.2
diff -u -3 -p -r1.2 kcmtaskbarui.ui
--- kcmtaskbarui.ui 2001/05/07 18:17:36 1.2
+++ kcmtaskbarui.ui 2001/05/16 02:24:57
@@ -11,7 +11,7 @@
<rect>
<x>0</x>
<y>0</y>
- <width>605</width>
+ <width>597</width>
<height>454</height>
</rect>
</property>
@@ -22,35 +22,50 @@
<property>
<name>layoutMargin</name>
</property>
- <vbox>
+ <widget>
+ <class>QButtonGroup</class>
<property stdset="1">
- <name>margin</name>
- <number>4</number>
+ <name>name</name>
+ <cstring>taskbarGroup</cstring>
</property>
<property stdset="1">
- <name>spacing</name>
- <number>6</number>
+ <name>geometry</name>
+ <rect>
+ <x>4</x>
+ <y>4</y>
+ <width>593</width>
+ <height>160</height>
+ </rect>
</property>
+ <property stdset="1">
+ <name>title</name>
+ <string>Taskbar</string>
+ </property>
+ <property>
+ <name>layoutMargin</name>
+ </property>
+ <property>
+ <name>layoutSpacing</name>
+ </property>
<widget>
- <class>QButtonGroup</class>
+ <class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
- <cstring>taskbarGroup</cstring>
+ <cstring>Layout2</cstring>
</property>
<property stdset="1">
- <name>title</name>
- <string>Taskbar</string>
- </property>
- <property>
- <name>layoutMargin</name>
+ <name>geometry</name>
+ <rect>
+ <x>11</x>
+ <y>17</y>
+ <width>147</width>
+ <height>126</height>
+ </rect>
</property>
- <property>
- <name>layoutSpacing</name>
- </property>
<vbox>
<property stdset="1">
<name>margin</name>
- <number>11</number>
+ <number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
@@ -106,7 +121,7 @@
</property>
<property stdset="1">
<name>checked</name>
- <bool>true</bool>
+ <bool>false</bool>
</property>
<property>
<name>whatsThis</name>
@@ -117,6 +132,25 @@
<class>QCheckBox</class>
<property stdset="1">
<name>name</name>
+ <cstring>perDesktopCheck</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Group tasks &per desktop</string>
+ </property>
+ <property stdset="1">
+ <name>checked</name>
+ <bool>true</bool>
+ </property>
+ <property>
+ <name>whatsThis</name>
+ <string>Check this option if you want the taskbar to group \
tasks by deskop.</string> + </property>
+ </widget>
+ <widget>
+ <class>QCheckBox</class>
+ <property stdset="1">
+ <name>name</name>
<cstring>sortCheck</cstring>
</property>
<property stdset="1">
@@ -134,27 +168,27 @@
</widget>
</vbox>
</widget>
- <spacer>
- <property>
- <name>name</name>
- <cstring>Spacer1</cstring>
- </property>
- <property stdset="1">
- <name>orientation</name>
- <enum>Vertical</enum>
- </property>
- <property stdset="1">
- <name>sizeType</name>
- <enum>Expanding</enum>
- </property>
- <property>
- <name>sizeHint</name>
- <size>
- <width>20</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </vbox>
+ </widget>
+ <spacer>
+ <property>
+ <name>name</name>
+ <cstring>Spacer1</cstring>
+ </property>
+ <property stdset="1">
+ <name>orientation</name>
+ <enum>Vertical</enum>
+ </property>
+ <property stdset="1">
+ <name>sizeType</name>
+ <enum>Expanding</enum>
+ </property>
+ <property>
+ <name>sizeHint</name>
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
</widget>
</UI>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic