diff --git a/app/dockconfigview.cpp b/app/dockconfigview.cpp index a468fff70..4b2c7e4b0 100644 --- a/app/dockconfigview.cpp +++ b/app/dockconfigview.cpp @@ -282,87 +282,6 @@ void DockConfigView::addPanelSpacer() } } -void DockConfigView::addTasksSeparator() -{ - const auto &applets = m_dockView->containment()->applets(); - - for (auto *applet : applets) { - KPluginMetaData meta = applet->kPackage().metadata(); - - if (meta.pluginId() == "org.kde.latte.plasmoid") { - - if (QQuickItem *appletInterface = applet->property("_plasma_graphicObject").value()) { - const auto &childItems = appletInterface->childItems(); - - if (childItems.isEmpty()) { - continue; - } - - for (QQuickItem *item : childItems) { - if (auto *metaObject = item->metaObject()) { - // not using QMetaObject::invokeMethod to avoid warnings when calling - // this on applets that don't have it or other child items since this - // is pretty much trial and error. - // Also, "var" arguments are treated as QVariant in QMetaObject - int methodIndex = metaObject->indexOfMethod("addSeparator(QVariant)"); - - if (methodIndex == -1) { - continue; - } - - QMetaMethod method = metaObject->method(methodIndex); - - if (method.invoke(item, Q_ARG(QVariant, QString(m_dockView->corona()->kPackage().filePath("separator0"))))) { - return; - } - } - } - } - } - } -} - -void DockConfigView::removeTasksSeparator() -{ - const auto &applets = m_dockView->containment()->applets(); - - for (auto *applet : applets) { - KPluginMetaData meta = applet->kPackage().metadata(); - - if (meta.pluginId() == "org.kde.latte.plasmoid") { - - if (QQuickItem *appletInterface = applet->property("_plasma_graphicObject").value()) { - const auto &childItems = appletInterface->childItems(); - - if (childItems.isEmpty()) { - continue; - } - - for (QQuickItem *item : childItems) { - if (auto *metaObject = item->metaObject()) { - // not using QMetaObject::invokeMethod to avoid warnings when calling - // this on applets that don't have it or other child items since this - // is pretty much trial and error. - // Also, "var" arguments are treated as QVariant in QMetaObject - int methodIndex = metaObject->indexOfMethod("removeSeparator(QVariant)"); - - if (methodIndex == -1) { - continue; - } - - QMetaMethod method = metaObject->method(methodIndex); - - if (method.invoke(item, Q_ARG(QVariant, QString(m_dockView->corona()->kPackage().filePath("separator0"))))) { - return; - } - } - } - } - } - } -} - - void DockConfigView::hideConfigWindow() { hide(); diff --git a/app/dockconfigview.h b/app/dockconfigview.h index 712ba4e5a..eb61420f8 100644 --- a/app/dockconfigview.h +++ b/app/dockconfigview.h @@ -53,8 +53,6 @@ public: public slots: Q_INVOKABLE void addPanelSpacer(); - Q_INVOKABLE void addTasksSeparator(); - Q_INVOKABLE void removeTasksSeparator(); Q_INVOKABLE void hideConfigWindow(); Q_INVOKABLE void setSticker(bool blockFocusLost); Q_INVOKABLE void syncGeometry(); diff --git a/containment/package/contents/config/main.xml b/containment/package/contents/config/main.xml index 3a42090f7..ec444fb36 100644 --- a/containment/package/contents/config/main.xml +++ b/containment/package/contents/config/main.xml @@ -186,9 +186,6 @@ true - - false - true diff --git a/containment/package/contents/ui/main.qml b/containment/package/contents/ui/main.qml index 01d61b51e..e13420fd6 100644 --- a/containment/package/contents/ui/main.qml +++ b/containment/package/contents/ui/main.qml @@ -234,8 +234,6 @@ DragDrop.DropArea { property int latteAppletHoveredIndex: latteApplet ? latteApplet.hoveredIndex : -1 property int tasksCount: latteApplet ? latteApplet.tasksCount : 0 - property bool hasInternalSeparator: latteApplet ? latteApplet.hasInternalSeparator : false - property real durationTime: { if (plasmoid.configuration.durationTime === 0 || plasmoid.configuration.durationTime === 2 ) return plasmoid.configuration.durationTime; @@ -433,11 +431,6 @@ DragDrop.DropArea { // dndSpacer.parent = root; } - //! it is used in order to provide to config window the internalSeparator state - onHasInternalSeparatorChanged: { - plasmoid.configuration.hasInternalSeparator = root.hasInternalSeparator; - } - onLatteAppletChanged: { if (latteApplet) { latteApplet.signalAnimationsNeedBothAxis.connect(slotAnimationsNeedBothAxis); diff --git a/plasmoid/package/contents/ui/ContextMenu.qml b/plasmoid/package/contents/ui/ContextMenu.qml index e98102ed3..01688c144 100644 --- a/plasmoid/package/contents/ui/ContextMenu.qml +++ b/plasmoid/package/contents/ui/ContextMenu.qml @@ -829,6 +829,27 @@ PlasmaComponents.ContextMenu { separator: true } + PlasmaComponents.MenuItem { + id: internalSeparatorItem + visible: root.editMode + + icon: "view-split-left-right" + text: i18n("Internal Separator") + checkable: true + + Component.onCompleted: { + checked = root.hasInternalSeparator; + } + + onClicked: { + if (checked) { + root.addSeparator(); + } else { + root.removeSeparator(); + } + } + } + PlasmaComponents.MenuItem { id: altSession visible: root.exposeAltSession diff --git a/plasmoid/package/contents/ui/main.qml b/plasmoid/package/contents/ui/main.qml index 12f64403a..6ed075b03 100644 --- a/plasmoid/package/contents/ui/main.qml +++ b/plasmoid/package/contents/ui/main.qml @@ -1279,12 +1279,12 @@ Item { //! it is used to add the fake desktop file which represents //! the separator (fake launcher) - function addSeparator(filepath){ - tasksModel.requestAddLauncher(filepath); + function addSeparator(){ + tasksModel.requestAddLauncher("file:///latte-separator.desktop"); } - function removeSeparator(filepath){ - tasksModel.requestRemoveLauncher(filepath); + function removeSeparator(){ + tasksModel.requestRemoveLauncher("file:///latte-separator.desktop"); } function previewContainsMouse() { diff --git a/shell/package/contents/configuration/TweaksConfig.qml b/shell/package/contents/configuration/TweaksConfig.qml index 24e769dcb..e1b306d6d 100644 --- a/shell/package/contents/configuration/TweaksConfig.qml +++ b/shell/package/contents/configuration/TweaksConfig.qml @@ -303,29 +303,6 @@ PlasmaComponents.Page { } } - PlasmaComponents.Button { - iconSource: plasmoid.configuration.hasInternalSeparator ? "edit-delete" : "list-add" - text: i18n("Tasks Separator") - Layout.fillWidth: true - Layout.alignment: Qt.AlignLeft - visible: dock.tasksPresent() - // tooltip: i18n("Add a separator for tasks") - - onClicked: { - if (plasmoid.configuration.hasInternalSeparator) - dockConfig.removeTasksSeparator(); - else - dockConfig.addTasksSeparator(); - } - } - } - - RowLayout { - Layout.fillWidth: true - Layout.leftMargin: units.smallSpacing * 2 - Layout.rightMargin: units.smallSpacing * 2 - spacing: units.smallSpacing - PlasmaComponents.Button { iconSource: "edit-delete" text: i18n("Remove Tasks")