diff --git a/kdebase-workspace-4.0.3-kde#158301.patch b/kdebase-workspace-4.0.3-kde#158301.patch deleted file mode 100644 index 5a2bc8b..0000000 --- a/kdebase-workspace-4.0.3-kde#158301.patch +++ /dev/null @@ -1,217 +0,0 @@ -diff -ur kdebase-workspace-4.0.3/libs/plasma/containment.cpp kdebase-workspace-4.0.3-kde#158301/libs/plasma/containment.cpp ---- kdebase-workspace-4.0.3/libs/plasma/containment.cpp 2008-03-27 21:34:44.000000000 +0100 -+++ kdebase-workspace-4.0.3-kde#158301/libs/plasma/containment.cpp 2008-04-19 16:55:46.000000000 +0200 -@@ -271,6 +271,11 @@ - desktopMenu.addSeparator(); - } - -+ QList 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(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(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 Containment::contextAppletActions(Applet *) -+{ -+ //kDebug() << "empty context actions"; -+ return QList(); -+} -+ -+ - } // Plasma namespace - - #include "containment.moc" -diff -ur kdebase-workspace-4.0.3/libs/plasma/containment.h kdebase-workspace-4.0.3-kde#158301/libs/plasma/containment.h ---- kdebase-workspace-4.0.3/libs/plasma/containment.h 2008-03-27 21:34:44.000000000 +0100 -+++ kdebase-workspace-4.0.3-kde#158301/libs/plasma/containment.h 2008-04-19 16:55:46.000000000 +0200 -@@ -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 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: - /** -diff -ur kdebase-workspace-4.0.3/plasma/containments/panel/panel.cpp kdebase-workspace-4.0.3-kde#158301/plasma/containments/panel/panel.cpp ---- kdebase-workspace-4.0.3/plasma/containments/panel/panel.cpp 2008-03-27 21:34:50.000000000 +0100 -+++ kdebase-workspace-4.0.3-kde#158301/plasma/containments/panel/panel.cpp 2008-04-19 16:57:14.000000000 +0200 -@@ -21,6 +21,7 @@ - #include - - #include -+#include - #include - #include - #include -@@ -48,7 +49,9 @@ - m_drawLeft(true), - m_drawRight(true), - m_drawBottom(true), -- m_size(48) -+ m_size(48), -+ 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 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 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(sender()); -+ if (!action) { -+ return; -+ } -+ -+ m_movedApplet = qobject_cast(action->data().value()); -+ 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" -diff -ur kdebase-workspace-4.0.3/plasma/containments/panel/panel.h kdebase-workspace-4.0.3-kde#158301/plasma/containments/panel/panel.h ---- kdebase-workspace-4.0.3/plasma/containments/panel/panel.h 2008-03-27 21:34:50.000000000 +0100 -+++ kdebase-workspace-4.0.3-kde#158301/plasma/containments/panel/panel.h 2008-04-19 16:55:46.000000000 +0200 -@@ -48,12 +48,18 @@ - const QRect &contentsRect); - void paintBackground(QPainter *painter, const QRect &contentsRect); - -+ QList 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; - }; - - diff --git a/kdebase-workspace-4.0.83-kde#154119.patch b/kdebase-workspace-4.0.83-kde#154119.patch new file mode 100644 index 0000000..2dcc06c --- /dev/null +++ b/kdebase-workspace-4.0.83-kde#154119.patch @@ -0,0 +1,222 @@ +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 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 Containment::contextAppletActions(Applet *) ++{ ++ //kDebug() << "empty context actions"; ++ return QList(); ++} ++ + KActionCollection& Containment::Private::actions() + { + return static_cast(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 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 + #include ++#include + #include + #include + #include +@@ -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 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 actions; ++ actions << m_moveAppletAction; ++ return actions; ++} ++ + void Panel::backgroundChanged() + { + constraintsEvent(Plasma::LocationConstraint); +@@ -443,6 +477,83 @@ + } + } + ++void Panel::startAppletMove() ++{ ++ QAction *action = qobject_cast(sender()); ++ if (!action) { ++ return; ++ } ++ ++ m_movedApplet = qobject_cast(action->data().value()); ++ 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(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 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; diff --git a/kdebase-workspace.spec b/kdebase-workspace.spec index 93dce2f..9fa195e 100644 --- a/kdebase-workspace.spec +++ b/kdebase-workspace.spec @@ -2,7 +2,7 @@ Summary: K Desktop Environment - Workspace 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 @@ Patch10: kdebase-workspace-4.0.72-klipper-url.patch 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 @@ Group: System Environment/Daemons # 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 @@ xdg-desktop-menu forceupdate 2> /dev/null || : %changelog +* Fri Jun 27 2008 Kevin Kofler 4.0.83-2 +- port and apply kde#154119/kde#158301 patch for moving icons on panel (#439587) + * Thu Jun 19 2008 Than Ngo 4.0.83-1 - 4.0.83 (beta2)