[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-panel-devel
Subject:    [Panel-devel] Allow TaskBar Context Menus
From:       Mike Evans <mike () www ! asrc ! info>
Date:       2007-10-19 1:59:32
Message-ID: 200710182159.32997.mike () asrc ! info
[Download RAW message or body]

Up until now, the taskbar would eat all right clicks in non-item areas, 
because the task group eats up all unused area. This patch passes the mouse 
click up to the containment, allowing the proper context menu to appear.


["taskclicks.diff" (text/x-diff)]

Index: tasks/tasks.cpp
===================================================================
--- tasks/tasks.cpp	(revision 726682)
+++ tasks/tasks.cpp	(working copy)
@@ -388,7 +388,18 @@ void AbstractTaskItem::close()
     finished();
 }
 
+Tasks * AbstractTaskItem::parentApplet() const
+{
+    if(qobject_cast<Tasks *>(parent()))
+    {
+        return qobject_cast<Tasks *>(parent());
+    }
+    else
+    {
+        return 0;
+    }
 
+}
 
 
 
@@ -485,6 +496,20 @@ void TaskGroupItem::reorderTasks(int fro
     _tasks.insert(to,TaskEntry(task));
 }
 
+void TaskGroupItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *e)
+{
+    //kDebug()<<"TaskGroupItem: "<<text()<<"Ignoring ContextEvent";
+    //So far, the task group doesn't care about being clicked.. let the parent handle it for now.
+    Tasks * mytask=AbstractTaskItem::parentApplet();
+    if(mytask)
+    {
+        mytask->contextMenuEvent(e);
+    }
+    
+    
+    
+}
+
 qreal TaskGroupItem::titleHeight() const 
 {
     if (_borderStyle != CaptionBorder) {
Index: tasks/tasks.h
===================================================================
--- tasks/tasks.h	(revision 726682)
+++ tasks/tasks.h	(working copy)
@@ -71,6 +71,9 @@ public:
         // a background
         //QRectF boundingRect() const;
 
+//         void contextMenuPublicEvent(QGraphicsSceneContextMenuEvent *);
+        friend class TaskGroupItem;
+        
 private slots:
         void addWindowTask(Task::TaskPtr);
         void removeWindowTask(Task::TaskPtr);
@@ -399,6 +402,9 @@ public:
     virtual void close();
     virtual QSizeF maximumSize() const;
 
+protected:
+    virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *);
+        
 private:
     enum DropAction
     {


_______________________________________________
Panel-devel mailing list
Panel-devel@kde.org
https://mail.kde.org/mailman/listinfo/panel-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic