[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdebase/workspace/plasma/applets
From: Albert Astals Cid <tsdgeos () terra ! es>
Date: 2008-12-17 21:47:01
Message-ID: 1229550421.538904.25004.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 898292 by aacid:
the pager accepts taskbar entry drops now, one step closer to feature \
parity with kde3 aseigo pressed the shipIt! button
M +1 -1 pager/CMakeLists.txt
M +26 -2 pager/pager.cpp
M +1 -0 pager/pager.h
M +1 -0 tasks/abstracttaskitem.cpp
M +2 -0 tasks/abstracttaskitem.h
M +5 -0 tasks/windowtaskitem.cpp
M +1 -1 tasks/windowtaskitem.h
--- trunk/KDE/kdebase/workspace/plasma/applets/pager/CMakeLists.txt \
#898291:898292 @@ -8,7 +8,7 @@
kde4_add_ui_files(pager_SRCS pagerConfig.ui )
kde4_add_plugin(plasma_applet_pager ${pager_SRCS})
-target_link_libraries(plasma_applet_pager ${KDE4_KIO_LIBS} \
${KDE4_PLASMA_LIBS} kephal) +target_link_libraries(plasma_applet_pager \
${KDE4_KIO_LIBS} ${KDE4_PLASMA_LIBS} kephal taskmanager)
install(TARGETS plasma_applet_pager DESTINATION ${PLUGIN_INSTALL_DIR})
install(FILES plasma-pager-default.desktop DESTINATION \
${SERVICES_INSTALL_DIR})
--- trunk/KDE/kdebase/workspace/plasma/applets/pager/pager.cpp \
#898291:898292 @@ -48,6 +48,8 @@
#include <kephal/screens.h>
+#include <taskmanager/task.h>
+
const int FAST_UPDATE_DELAY = 200;
const int UPDATE_DELAY = 500;
const int DRAG_SWITCH_DELAY = 1000;
@@ -828,8 +830,11 @@
void Pager::dragEnterEvent(QGraphicsSceneDragDropEvent *event)
{
- //TODO: we need to accept window id drops eventually
- event->setAccepted(false);
+ if (event->mimeData()->hasFormat(TaskManager::Task::mimetype())) {
+ event->setAccepted(true);
+ return;
+ }
+ else event->setAccepted(false);
handleHoverMove(event->pos());
if (m_hoverIndex != -1) {
@@ -862,6 +867,25 @@
Applet::dragLeaveEvent(event);
}
+void Pager::dropEvent(QGraphicsSceneDragDropEvent *event)
+{
+ bool ok;
+ WId id = TaskManager::Task::idFromMimeData(event->mimeData(), &ok);
+ if (ok) {
+ int desktop = -1;
+ for (int i = 0; i < m_rects.count(); ++i) {
+ if (m_rects[i].contains(event->pos().toPoint())) {
+ desktop = i;
+ break;
+ }
+ }
+ if (desktop != -1) {
+ KWindowSystem::setOnDesktop(id, desktop + 1);
+ m_dragSwitchDesktop = -1;
+ }
+ }
+}
+
void Pager::animationUpdate(qreal progress, int animId)
{
int i = 0;
--- trunk/KDE/kdebase/workspace/plasma/applets/pager/pager.h #898291:898292
@@ -65,6 +65,7 @@
virtual void dragEnterEvent(QGraphicsSceneDragDropEvent *event);
virtual void dragMoveEvent(QGraphicsSceneDragDropEvent *event);
virtual void dragLeaveEvent(QGraphicsSceneDragDropEvent *event);
+ virtual void dropEvent(QGraphicsSceneDragDropEvent *event);
virtual void wheelEvent(QGraphicsSceneWheelEvent *);
void configAccepted();
--- trunk/KDE/kdebase/workspace/plasma/applets/tasks/abstracttaskitem.cpp \
#898291:898292 @@ -283,6 +283,7 @@
QMimeData* mimeData = new QMimeData();
mimeData->setData("taskbar/taskItem", data);
+ setAdditionalMimeData(mimeData);
QDrag *drag = new QDrag(event->widget());
drag->setMimeData(mimeData);
--- trunk/KDE/kdebase/workspace/plasma/applets/tasks/abstracttaskitem.h \
#898291:898292 @@ -119,6 +119,8 @@
virtual bool isWindowItem() const = 0;
virtual bool isActive() const = 0;
+ virtual void setAdditionalMimeData(QMimeData* /*mimeData*/){};
+
void setLayoutWidget(LayoutWidget* widget);
TaskManager::AbstractItemPtr abstractItem();
--- trunk/KDE/kdebase/workspace/plasma/applets/tasks/windowtaskitem.cpp \
#898291:898292 @@ -304,5 +304,10 @@
return m_task->isActive();
}
+void WindowTaskItem::setAdditionalMimeData(QMimeData* mimeData)
+{
+ m_task->task()->addMimeData(mimeData);
+}
+
#include "windowtaskitem.moc"
--- trunk/KDE/kdebase/workspace/plasma/applets/tasks/windowtaskitem.h \
#898291:898292 @@ -49,8 +49,8 @@
virtual bool isWindowItem() const;
virtual bool isActive() const;
+ virtual void setAdditionalMimeData(QMimeData* mimeData);
-
signals:
/** Emitted when a window is selected for activation, minimization, \
iconification */ //void windowSelected(WindowTaskItem *); //what is it \
for?
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic