fix #188,fix launchers behavior for Plasma>=5.9

pull/1/head
Michail Vourlakos 8 years ago
parent 2a8bd25e0e
commit b5a98f41ee

@ -19,6 +19,7 @@
*/
#include "quickwindowsystem.h"
#include <plasma/version.h>
#include <QDebug>
@ -33,7 +34,7 @@ QuickWindowSystem::QuickWindowSystem(QObject *parent) :
//! TODO: Wayland compositing active
} else {
connect(KWindowSystem::self(), &KWindowSystem::compositingChanged
, this, [&](bool enabled){
, this, [&](bool enabled) {
if (m_compositing == enabled)
return;
@ -55,4 +56,9 @@ bool QuickWindowSystem::compositingActive() const
return m_compositing;
}
uint QuickWindowSystem::frameworksVersion() const
{
return Plasma::version();
}
} //end of namespace

@ -35,18 +35,21 @@ class QuickWindowSystem final : public QObject {
Q_OBJECT
Q_PROPERTY(bool compositingActive READ compositingActive NOTIFY compositingChanged FINAL)
Q_PROPERTY(uint frameworksVersion READ frameworksVersion NOTIFY frameworksVersionChanged)
public:
explicit QuickWindowSystem(QObject *parent = nullptr);
virtual ~QuickWindowSystem();
bool compositingActive() const;
uint frameworksVersion() const;
signals:
void compositingChanged();
void frameworksVersionChanged();
private:
bool m_compositing : 1;
bool m_compositing : 1;
};
static QObject *windowsystem_qobject_singletontype_provider(QQmlEngine *engine, QJSEngine *scriptEngine)

@ -571,8 +571,10 @@ PlasmaComponents.ContextMenu {
onClicked: {
if (tasksModel.launcherPosition(visualParent.m.LauncherUrlWithoutIcon) != -1) {
tasksModel.requestRemoveLauncher(visualParent.m.LauncherUrlWithoutIcon);
root.updateLaunchersNewArchitecture();
} else {
tasksModel.requestAddLauncher(visualParent.m.LauncherUrlWithoutIcon);
root.updateLaunchersNewArchitecture();
}
}
}
@ -595,7 +597,10 @@ PlasmaComponents.ContextMenu {
text: i18n("Remove Launcher")
onClicked: tasksModel.requestRemoveLauncher(visualParent.m.LauncherUrlWithoutIcon);
onClicked: {
tasksModel.requestRemoveLauncher(visualParent.m.LauncherUrlWithoutIcon);
root.updateLaunchersNewArchitecture();
}
}
PlasmaComponents.MenuItem {

@ -197,12 +197,42 @@ Item {
/////
function updateLaunchersNewArchitecture(){
///frameworks 5.29.0 provide id 335104
//work only after Plasma 5.9 and frameworks 5.29
if (Latte.WindowSystem.frameworksVersion < 335104) {
return;
}
var launchers = [];
var tasks = icList.contentItem.children;
var len = tasks.length
for(var i=0; i<len; ++i){
var task;
for (var j=0; j<len; ++j){
if (tasks && tasks[j] && tasks[j].itemIndex === i) {
task = tasks[j];
break;
}
}
if (task && task.m && task.m.LauncherUrlWithoutIcon
&& ActivitiesTools.getIndex(task.m.LauncherUrlWithoutIcon, tasksModel.launcherList)>=0) {
launchers.push(task.m.LauncherUrlWithoutIcon);
}
}
ActivitiesTools.updateLaunchers(launchers);
}
onDragSourceChanged: {
if (dragSource == null) {
root.draggingFinished();
root.signalActionsBlockHiding(-1);
//root.signalDraggingState(false);
updateLaunchersNewArchitecture();
tasksModel.syncLaunchers();
} else {
root.signalActionsBlockHiding(1);

Loading…
Cancel
Save