rpms/kdebase-workspace/devel kdebase-workspace-4.0.83-kde#154119.patch, NONE, 1.1 kdebase-workspace.spec, 1.90, 1.91 kdebase-workspace-4.0.3-kde#158301.patch, 1.2, NONE

Kevin Kofler (kkofler) fedora-extras-commits at redhat.com
Fri Jun 27 07:55:30 UTC 2008


Author: kkofler

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

Modified Files:
	kdebase-workspace.spec 
Added Files:
	kdebase-workspace-4.0.83-kde#154119.patch 
Removed Files:
	kdebase-workspace-4.0.3-kde#158301.patch 
Log Message:
* Fri Jun 27 2008 Kevin Kofler <Kevin at tigcc.ticalc.org> 4.0.83-2
- port and apply kde#154119/kde#158301 patch for moving icons on panel (#439587)

kdebase-workspace-4.0.83-kde#154119.patch:

--- NEW FILE kdebase-workspace-4.0.83-kde#154119.patch ---
diff -ur kdebase-workspace-4.0.83/libs/plasma/containment.cpp kdebase-workspace-4.0.83-kde#154119/libs/plasma/containment.cpp
--- kdebase-workspace-4.0.83/libs/plasma/containment.cpp	2008-06-18 14:41:38.000000000 +0200
+++ kdebase-workspace-4.0.83-kde#154119/libs/plasma/containment.cpp	2008-06-27 09:08:24.000000000 +0200
@@ -395,6 +395,11 @@
                 desktopMenu.addSeparator();
             }
 
+            QList<QAction*> containmentAppletActions = contextAppletActions(applet);
+            foreach(QAction* action, containmentAppletActions) {
+                desktopMenu.addAction(action);
+            }
+
             QAction* closeApplet = applet->d->actions.action("remove");
             if (!closeApplet) { //unlikely but not impossible
                 kDebug() << "no remove action!!!!!!!!";
@@ -938,6 +943,12 @@
     }
 }
 
+QList<QAction*> Containment::contextAppletActions(Applet *)
+{
+    //kDebug() << "empty context actions";
+    return QList<QAction*>();
+}
+
 KActionCollection& Containment::Private::actions()
 {
     return static_cast<Applet*>(q)->d->actions;
diff -ur kdebase-workspace-4.0.83/libs/plasma/containment.h kdebase-workspace-4.0.83-kde#154119/libs/plasma/containment.h
--- kdebase-workspace-4.0.83/libs/plasma/containment.h	2008-06-18 14:41:38.000000000 +0200
+++ kdebase-workspace-4.0.83-kde#154119/libs/plasma/containment.h	2008-06-27 08:56:14.000000000 +0200
@@ -266,6 +266,14 @@
          */
         void removeAssociatedWidget(QWidget *widget);
 
+        /**
+         * 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
diff -ur kdebase-workspace-4.0.83/plasma/containments/panel/panel.cpp kdebase-workspace-4.0.83-kde#154119/plasma/containments/panel/panel.cpp
--- kdebase-workspace-4.0.83/plasma/containments/panel/panel.cpp	2008-06-18 14:41:39.000000000 +0200
+++ kdebase-workspace-4.0.83-kde#154119/plasma/containments/panel/panel.cpp	2008-06-27 09:47:59.000000000 +0200
@@ -23,6 +23,7 @@
 
 #include <QApplication>
 #include <QGraphicsLinearLayout>
+#include <QGraphicsSceneHoverEvent>
 #include <QPainter>
 #include <QBitmap>
 #include <QDesktopWidget>
@@ -51,7 +52,9 @@
       m_configureAction(0),
       m_addPanelAction(0),
       m_currentSize(QSize(QApplication::desktop()->screenGeometry(screen()).width(), 38)),
-      m_lastViewGeom()
+      m_lastViewGeom(),
+      m_moveAppletAction(0),
+      m_movedApplet(0)
 {
     m_background = new Plasma::PanelSvg(this);
     m_background->setImagePath("widgets/panel-background");
@@ -102,6 +105,37 @@
     return 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()
 {
     constraintsEvent(Plasma::LocationConstraint);
@@ -443,6 +477,83 @@
     }
 }
 
+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;
+    }
+
+    QPointF pos = event->pos();
+    m_movedApplet->setPos(pos);
+
+    // reposition the applet in our layout
+    QGraphicsLinearLayout *lay = dynamic_cast<QGraphicsLinearLayout*>(layout());
+
+    if (!lay) {
+        return;
+    }
+
+    Plasma::FormFactor f = formFactor();
+    int currentIndex = -1, insertIndex = -1;
+
+    for (int i = 0; i < lay->count(); ++i) {
+        QGraphicsLayoutItem *sibling = lay->itemAt(i);
+        if (sibling == m_movedApplet) {
+            currentIndex = i;
+        }
+        QRectF siblingGeometry = sibling->geometry();
+        if (f == Plasma::Horizontal) {
+            qreal middle = (siblingGeometry.left() + siblingGeometry.right()) / 2.0;
+            if (pos.x() < middle) {
+                insertIndex = i;
+                break;
+            } else if (pos.x() <= siblingGeometry.right()) {
+                insertIndex = i + 1;
+                break;
+            }
+        } else { // Plasma::Vertical
+            qreal middle = (siblingGeometry.top() + siblingGeometry.bottom()) / 2.0;
+            if (pos.y() < middle) {
+                insertIndex = i;
+                break;
+            } else if (pos.y() <= siblingGeometry.bottom()) {
+                insertIndex = i + 1;
+                break;
+            }
+        }
+    }
+
+    if (currentIndex != -1 && insertIndex != -1) {
+        if (insertIndex > currentIndex) {
+            --insertIndex;
+        }
+        if (insertIndex != currentIndex) {
+            lay->removeAt(currentIndex);
+            lay->insertItem(insertIndex, m_movedApplet);
+        }
+    }
+}
+
+void Panel::stopAppletMove()
+{
+    setCursor(Qt::ArrowCursor);
+    setAcceptsHoverEvents(false);
+    m_movedApplet = 0;
+}
+
 K_EXPORT_PLASMA_APPLET(panel, Panel)
 
 #include "panel.moc"
diff -ur kdebase-workspace-4.0.83/plasma/containments/panel/panel.h kdebase-workspace-4.0.83-kde#154119/plasma/containments/panel/panel.h
--- kdebase-workspace-4.0.83/plasma/containments/panel/panel.h	2008-06-18 14:41:39.000000000 +0200
+++ kdebase-workspace-4.0.83-kde#154119/plasma/containments/panel/panel.h	2008-06-27 09:21:24.000000000 +0200
@@ -49,6 +49,9 @@
                         const QRect &contentsRect);
     void paintBackground(QPainter *painter, const QRect &contentsRect);
 
+    QList<QAction*> contextAppletActions(Applet *applet);
+    void hoverMoveEvent(QGraphicsSceneHoverEvent *event); 
+
 protected:
     void saveState(KConfigGroup &config) const;
 
@@ -59,6 +62,9 @@
     void appletRemoved(Plasma::Applet* applet);
     void addPanel();
 
+    void startAppletMove();
+    void stopAppletMove();
+
 private:
     /**
      * update the formfactor based on the location
@@ -73,6 +79,8 @@
     Plasma::PanelSvg *m_background;
     QAction* m_configureAction;
     QAction* m_addPanelAction;
+    QAction* m_moveAppletAction;
+    Applet *m_movedApplet;
 
     //cached values
     QSize m_currentSize;


Index: kdebase-workspace.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kdebase-workspace/devel/kdebase-workspace.spec,v
retrieving revision 1.90
retrieving revision 1.91
diff -u -r1.90 -r1.91
--- kdebase-workspace.spec	19 Jun 2008 09:50:27 -0000	1.90
+++ kdebase-workspace.spec	27 Jun 2008 07:54:41 -0000	1.91
@@ -2,7 +2,7 @@
 Name: kdebase-workspace
 Version: 4.0.83
 
-Release: 1%{?dist}
+Release: 2%{?dist}
 Source0: ftp://ftp.kde.org/pub/kde/unstable/%{version}/src/kdebase-workspace-%{version}.tar.bz2
 License: GPLv2
 Group: User Interface/Desktops
@@ -29,10 +29,8 @@
 Patch200: kdebase-workspace-4.0.72-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)
-# FIXME: Doesn't apply to 4.1, looks hard to port.
-#        Hopefully this is being fixed properly for 4.1.
-#Patch201: kdebase-workspace-4.0.3-kde#158301.patch
+# allows moving plasmoids on panels (#439587, kde#154119, kde#158301)
+Patch201: kdebase-workspace-4.0.83-kde#154119.patch
 # #444141: Initial wallpaper chooser has "EOS" preselected but wallpaper is "Fedora Waves"
 # http://websvn.kde.org/?view=rev&revision=801651
 Patch203: kdebase-workspace-4.0.3-plasma-default-wallpaper-config.patch
@@ -149,8 +147,7 @@
 
 # plasma-4.0-openSUSE patches:
 %patch200 -p1 -b .plasma-default-wallpaper
-# FIXME/TODO: fails to apply
-#%patch201 -p1 -b .kde#158301
+%patch201 -p1 -b .kde#154119
 %patch203 -p0 -b .plasma-default-wallpaper-config
 %patch204 -p1 -b .kickoff-suspend
 
@@ -274,6 +271,9 @@
 
 
 %changelog
+* Fri Jun 27 2008 Kevin Kofler <Kevin at tigcc.ticalc.org> 4.0.83-2
+- port and apply kde#154119/kde#158301 patch for moving icons on panel (#439587)
+
 * Thu Jun 19 2008 Than Ngo <than at redhat.com> 4.0.83-1
 - 4.0.83 (beta2)
 


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




More information about the fedora-extras-commits mailing list