mirror of
https://bitbucket.org/smil3y/kde-workspace.git
synced 2025-02-24 10:52:51 +00:00
plasma: handle tasks moving in tasks applet
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
1aca9ade6a
commit
f52f6e7de3
2 changed files with 18 additions and 9 deletions
|
@ -17,7 +17,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "tasks.h"
|
#include "tasks.h"
|
||||||
#include "kworkspace/ktaskmanager.h"
|
|
||||||
|
|
||||||
#include <QGraphicsSceneContextMenuEvent>
|
#include <QGraphicsSceneContextMenuEvent>
|
||||||
#include <Plasma/Svg>
|
#include <Plasma/Svg>
|
||||||
|
@ -225,6 +224,10 @@ void TasksApplet::init()
|
||||||
KTaskManager::self(), SIGNAL(taskAdded(KTaskManager::Task)),
|
KTaskManager::self(), SIGNAL(taskAdded(KTaskManager::Task)),
|
||||||
this, SLOT(slotUpdateLayout())
|
this, SLOT(slotUpdateLayout())
|
||||||
);
|
);
|
||||||
|
connect(
|
||||||
|
KTaskManager::self(), SIGNAL(taskChanged(KTaskManager::Task)),
|
||||||
|
this, SLOT(slotTaskChanged(KTaskManager::Task))
|
||||||
|
);
|
||||||
connect(
|
connect(
|
||||||
KTaskManager::self(), SIGNAL(taskRemoved(KTaskManager::Task)),
|
KTaskManager::self(), SIGNAL(taskRemoved(KTaskManager::Task)),
|
||||||
this, SLOT(slotUpdateLayout())
|
this, SLOT(slotUpdateLayout())
|
||||||
|
@ -252,15 +255,19 @@ void TasksApplet::constraintsEvent(Plasma::Constraints constraints)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
updateOrientation();
|
QMutexLocker locker(&m_mutex);
|
||||||
|
foreach (TasksSvg* taskssvg, m_taskssvgs) {
|
||||||
|
taskssvg->setOrientation(m_layout->orientation());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TasksApplet::updateOrientation()
|
void TasksApplet::slotTaskChanged(const KTaskManager::Task &task)
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&m_mutex);
|
// special case for tasks moved from one virtual desktop to another
|
||||||
foreach (TasksSvg* taskssvg, m_taskssvgs) {
|
const KWindowInfo kwindowinfo = KWindowSystem::windowInfo(task.window, NET::WMDesktop);
|
||||||
taskssvg->setOrientation(m_layout->orientation());
|
if (!kwindowinfo.isOnDesktop(KWindowSystem::currentDesktop())) {
|
||||||
|
slotUpdateLayout();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -278,7 +285,8 @@ void TasksApplet::slotUpdateLayout()
|
||||||
}
|
}
|
||||||
adjustSize();
|
adjustSize();
|
||||||
foreach (const KTaskManager::Task &task, KTaskManager::self()->tasks()) {
|
foreach (const KTaskManager::Task &task, KTaskManager::self()->tasks()) {
|
||||||
if (task.desktop != KWindowSystem::currentDesktop()) {
|
const KWindowInfo kwindowinfo = KWindowSystem::windowInfo(task.window, NET::WMDesktop);
|
||||||
|
if (!kwindowinfo.isOnDesktop(KWindowSystem::currentDesktop())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
TasksSvg* taskssvg = new TasksSvg(task, this);
|
TasksSvg* taskssvg = new TasksSvg(task, this);
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
#ifndef TASKS_H
|
#ifndef TASKS_H
|
||||||
#define TASKS_H
|
#define TASKS_H
|
||||||
|
|
||||||
|
#include "kworkspace/ktaskmanager.h"
|
||||||
|
|
||||||
#include <QMutex>
|
#include <QMutex>
|
||||||
#include <QGraphicsLinearLayout>
|
#include <QGraphicsLinearLayout>
|
||||||
#include <Plasma/Applet>
|
#include <Plasma/Applet>
|
||||||
|
@ -35,6 +37,7 @@ public:
|
||||||
void init() final;
|
void init() final;
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
|
void slotTaskChanged(const KTaskManager::Task &task);
|
||||||
void slotUpdateLayout();
|
void slotUpdateLayout();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -42,8 +45,6 @@ protected:
|
||||||
void constraintsEvent(Plasma::Constraints constraints) final;
|
void constraintsEvent(Plasma::Constraints constraints) final;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void updateOrientation();
|
|
||||||
|
|
||||||
QMutex m_mutex;
|
QMutex m_mutex;
|
||||||
QGraphicsLinearLayout* m_layout;
|
QGraphicsLinearLayout* m_layout;
|
||||||
QGraphicsWidget* m_spacer;
|
QGraphicsWidget* m_spacer;
|
||||||
|
|
Loading…
Add table
Reference in a new issue