rpms/kdebase-workspace/devel kdebase-workspace-4.0.3-kde#158301.patch, NONE, 1.1 kdebase-workspace.spec, 1.71, 1.72

Kevin Kofler (kkofler) fedora-extras-commits at redhat.com
Sat Apr 19 14:42:04 UTC 2008


Author: kkofler

Update of /cvs/pkgs/rpms/kdebase-workspace/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv23100/devel

Modified Files:
	kdebase-workspace.spec 
Added Files:
	kdebase-workspace-4.0.3-kde#158301.patch 
Log Message:
* Sat Apr 19 2008 Kevin Kofler <Kevin at tigcc.ticalc.org> 4.0.3-17
- allow moving plasmoids on panels (#439587, kde#158301) (upstream patch)

kdebase-workspace-4.0.3-kde#158301.patch:

--- NEW FILE kdebase-workspace-4.0.3-kde#158301.patch ---
Index: libs/plasma/containment.h
===================================================================
--- libs/plasma/containment.h	(revision 791851)
+++ libs/plasma/containment.h	(revision 791852)
@@ -265,6 +265,14 @@
          */
         void hideToolbox();
 
+        /**
+         * Returns a list of applet-related QAction instances.
+         *
+         * @return A list of actions. The default implementation returns an
+         *         empty list.
+         **/
+        virtual QList<QAction*> contextAppletActions(Applet *applet);
+
     Q_SIGNALS:
         /**
          * This signal is emitted when a new applet is created by the containment
@@ -331,6 +339,7 @@
         void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
         void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
         bool sceneEventFilter(QGraphicsItem *watched, QEvent *event);
+        void repositionApplet(Applet* applet, int index);
 
     protected Q_SLOTS:
         /**
Index: libs/plasma/containment.cpp
===================================================================
--- libs/plasma/containment.cpp	(revision 791851)
+++ libs/plasma/containment.cpp	(revision 791852)
@@ -271,6 +271,11 @@
                 desktopMenu.addSeparator();
             }
 
+            QList<QAction*> containmentAppletActions = contextAppletActions(applet);
+            foreach(QAction* action, containmentAppletActions) {
+                desktopMenu.addAction(action);
+            }
+
             QAction* closeApplet = new QAction(i18n("Remove this %1", applet->name()), &desktopMenu);
             QVariant appletV;
             appletV.setValue((QObject*)applet);
@@ -517,12 +522,7 @@
 
     if (containmentType() == PanelContainment) {
         // Reposition the applet after adding has been done
-        if (index != -1) {
-            BoxLayout *l = dynamic_cast<BoxLayout *>(layout());
-            l->insertItem(index, l->takeAt(l->indexOf(applet)));
-            d->applets.removeAll(applet);
-            d->applets.insert(index, applet);
-        }
+        repositionApplet(applet, index);
     } else {
         //FIXME if it came from a panel its bg was disabled
         //maybe we should expect the applet to handle that on a constraint update?
@@ -536,6 +536,20 @@
     prepareApplet(applet, dontInit); //must at least flush constraints
 }
 
+void Containment::repositionApplet(Applet* applet, int index)
+{
+    BoxLayout *l = dynamic_cast<BoxLayout *>(layout());
+    const int currentindex = l->indexOf(applet);
+
+    if (index==-1 || index==currentindex) {
+        return;
+    }
+
+    l->insertItem(index, l->takeAt(currentindex));
+    d->applets.removeAll(applet);
+    d->applets.insert(index, applet);
+}
+
 //containment-relative pos... right?
 int Containment::indexAt(const QPointF &pos) const
 {
@@ -936,6 +950,13 @@
     d->createToolbox()->hideToolbox();
 }
 
+QList<QAction*> Containment::contextAppletActions(Applet *)
+{
+    //kDebug() << "empty context actions";
+    return QList<QAction*>();
+}
+
+
 } // Plasma namespace
 
 #include "containment.moc"
Index: plasma/containments/panel/panel.cpp
===================================================================
--- plasma/containments/panel/panel.cpp	(revision 791851)
+++ plasma/containments/panel/panel.cpp	(revision 791852)
@@ -21,6 +21,7 @@
 #include <limits>
 
 #include <QApplication>
+#include <QGraphicsSceneHoverEvent>
 #include <QPainter>
 #include <QDesktopWidget>
 #include <QGridLayout>
@@ -48,7 +49,9 @@
       m_drawLeft(true),
       m_drawRight(true),
       m_drawBottom(true),
-      m_size(40)
+      m_size(40),
+      m_moveAppletAction(0),
+      m_movedApplet(0)
 {
     m_background = new Plasma::SvgPanel("widgets/panel-background", this);
     m_background->setBorderFlags(Plasma::SvgPanel::DrawAllBorders);
@@ -89,6 +92,37 @@
     return m_actions;
 }
 
+QList<QAction*> Panel::contextAppletActions(Applet *applet)
+{
+    if (!m_moveAppletAction) {
+        m_moveAppletAction = new QAction( KIcon("transform-move"), i18n("transform-move"), this);
+    }
+
+    QVariant appletV;
+    appletV.setValue((QObject*)applet);
+    m_moveAppletAction->setData(appletV);
+
+    if (!m_movedApplet || (m_movedApplet && m_movedApplet!=applet)) {
+        m_moveAppletAction->setText(i18n("Start Move of %1", applet->name()));
+        if (!m_movedApplet) {
+            m_moveAppletAction->setEnabled(true);
+            connect(m_moveAppletAction, SIGNAL(triggered(bool)), SLOT(startAppletMove()));
+        }
+        else {
+            m_moveAppletAction->setEnabled(false);
+        }
+    }
+    else {
+        m_moveAppletAction->setEnabled(true);
+        m_moveAppletAction->setText(i18n("Stop Move of %1", applet->name()));
+        connect(m_moveAppletAction, SIGNAL(triggered(bool)), SLOT(stopAppletMove()));
+    }
+
+    QList<QAction*> actions;
+    actions << m_moveAppletAction;
+    return actions;
+}
+
 void Panel::backgroundChanged()
 {
     constraintsUpdated(Plasma::LocationConstraint);
@@ -339,6 +373,35 @@
     m_sizeEdit->setEnabled(v.isNull());
 }
 
+void Panel::startAppletMove()
+{
+    QAction *action = qobject_cast<QAction*>(sender());
+    if (!action) {
+        return;
+    }
+
+    m_movedApplet = qobject_cast<Applet*>(action->data().value<QObject*>());
+    setAcceptsHoverEvents(true);
+    setCursor(Qt::SizeAllCursor);
+}
+
+void Panel::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
+{
+    if (!m_movedApplet) {
+        Applet::hoverMoveEvent(event);
+        return;
+    }
+
+    repositionApplet(m_movedApplet, indexAt(event->pos()));
+}
+
+void Panel::stopAppletMove()
+{
+    setCursor(Qt::ArrowCursor);
+    setAcceptsHoverEvents(false);
+    m_movedApplet = 0;
+}
+
 K_EXPORT_PLASMA_APPLET(panel, Panel)
 
 #include "panel.moc"
Index: plasma/containments/panel/panel.h
===================================================================
--- plasma/containments/panel/panel.h	(revision 791851)
+++ plasma/containments/panel/panel.h	(revision 791852)
@@ -48,12 +48,18 @@
                         const QRect &contentsRect);
     void paintBackground(QPainter *painter, const QRect &contentsRect);
 
+    QList<QAction*> contextAppletActions(Applet *applet);
+    void hoverMoveEvent(QGraphicsSceneHoverEvent *event); 
+
 private slots:
     void configure();
     void applyConfig();
     void sizeComboChanged();
     void backgroundChanged();
 
+    void startAppletMove();
+    void stopAppletMove();
+
 private:
     Plasma::SvgPanel *m_background;
     QPixmap* m_cachedBackground;
@@ -68,6 +74,8 @@
     bool m_drawRight : 1;
     bool m_drawBottom : 1;
     int m_size;
+    QAction* m_moveAppletAction;
+    Applet *m_movedApplet;
 };
 
 


Index: kdebase-workspace.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kdebase-workspace/devel/kdebase-workspace.spec,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -r1.71 -r1.72
--- kdebase-workspace.spec	18 Apr 2008 09:21:42 -0000	1.71
+++ kdebase-workspace.spec	19 Apr 2008 14:41:28 -0000	1.72
@@ -6,7 +6,7 @@
 Name: kdebase-workspace
 Version: 4.0.3
 
-Release: 16%{?dist}
+Release: 17%{?dist}
 Source0: ftp://ftp.kde.org/pub/kde/stable/%{version}/src/kdebase-workspace-%{version}.tar.bz2
 License: GPLv2
 Group: User Interface/Desktops
@@ -25,6 +25,7 @@
 Patch8: kdebase-workspace-4.0.3-krdb.patch
 Patch9: kdebase-workspace-4.0.3-suspend.patch
 
+# upstream patches:
 # http://bugs.kde.org/155362 (show Name in addition to GenericName in simple menu)
 # backported from trunk (KDE 4.1): http://websvn.kde.org/?view=rev&revision=762886
 # This has been merged into 4.0.3 in http://websvn.kde.org/?view=rev&revision=790059
@@ -35,9 +36,15 @@
 # (fixed version of http://websvn.kde.org/?view=rev&revision=790063
 # which was reverted in http://websvn.kde.org/?view=rev&revision=790104)
 Patch101: kdebase-workspace-4.0.3-menu-switch.patch
+
+# plasma-4.0-openSUSE patches:
 # http://websvn.kde.org/?view=rev&revision=795438
 # allows to define a default wallpaper via plasmarc:wallpaper
-Patch102: kdebase-workspace-4.0.3-plasma-default-wallpaper.patch
+Patch200: kdebase-workspace-4.0.3-plasma-default-wallpaper.patch
+# http://websvn.kde.org/?view=rev&revision=791852
+# from Plasma review board: http://mattr.info/r/261/
+# allows moving plasmoids on panels (#439587, kde#158301)
+Patch201: kdebase-workspace-4.0.3-kde#158301.patch
 
 # upgrade path for former kde-redhat'ers
 Obsoletes: kdebase-kdm < 6:%{version}-%{release}
@@ -136,7 +143,10 @@
 # upstream patches
 %patch101 -p1 -b .menu-switch
 %patch100 -p0 -b .kde#155362
-%patch102 -p0 -b .plasma-default-wallpaper
+
+# plasma-4.0-openSUSE patches:
+%patch200 -p0 -b .plasma-default-wallpaper
+%patch201 -p0 -b .kde#158301
 
 %build
 
@@ -255,17 +265,20 @@
 
 
 %changelog
+* Sat Apr 19 2008 Kevin Kofler <Kevin at tigcc.ticalc.org> 4.0.3-17
+- allow moving plasmoids on panels (#439587, kde#158301) (upstream patch)
+
 * Fri Apr 18 2008 Than Ngo <than at redhat.com> 4.0.3-16
 - fix #442559, Suspend/Hibernate issue on logout
 
-* Tue Apr 15 2008 Lukáš Tinkl <ltinkl at redhat.com> - 4.0.3-15
+* Tue Apr 15 2008 Lukáš Tinkl <ltinkl at redhat.com> 4.0.3-15
 - workaround #434824: KDE4 System Settings - No Method To Enter Administrative Mode
 - fix #441062: packagekit tools do not show icons correctly on KDE
 
-* Tue Apr 15 2008 Sebastian Vahl <fedora at deadbabylon.de> - 4.0.3-13
-- update redhat-startkde.patch to match waves background colour (#442312)
+* Tue Apr 15 2008 Sebastian Vahl <fedora at deadbabylon.de> 4.0.3-13
+- update redhat-startkde.patch to match waves background color (#442312)
 
-* Fri Apr 11 2008 Lukáš Tinkl <ltinkl at redhat.com> - 4.0.3-12
+* Fri Apr 11 2008 Lukáš Tinkl <ltinkl at redhat.com> 4.0.3-12
 - allow to define a default wallpaper (plasmarc:wallpaper)
 
 * Wed Apr 09 2008 Kevin Kofler <Kevin at tigcc.ticalc.org> 4.0.3-11




More information about the fedora-extras-commits mailing list