diff --git a/CMakeLists.txt b/CMakeLists.txt index 6b0f6461..138867e2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,7 +25,7 @@ include(FeatureSummary) find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED Core Gui Widgets Qml Quick Test) -find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS Plasma Service Declarative I18n) +find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS Plasma Service Declarative I18n KIO) find_package(KF5 REQUIRED COMPONENTS PlasmaQuick DBusAddons Notifications) find_package(TelepathyQt5 REQUIRED) find_package(KF5Wayland CONFIG) @@ -38,16 +38,9 @@ feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAG include(CheckIncludeFiles) -plasma_install_package(look-and-feel org.kde.satellite.phone look-and-feel) -plasma_install_package(shell org.kde.satellite.phone shells) -install(DIRECTORY wallpaper/ DESTINATION "${WALLPAPER_INSTALL_DIR}/org.kde.satellite.lockers") - -install(DIRECTORY compositor/ - DESTINATION ${DATA_INSTALL_DIR}/greenisland/org.kde.satellite.compositor.phone - PATTERN .svn EXCLUDE - PATTERN CMakeLists.txt EXCLUDE - PATTERN Messages.sh EXCLUDE - PATTERN dummydata EXCLUDE) +plasma_install_package(look-and-feel org.kde.plasma.phone look-and-feel) +plasma_install_package(shell org.kde.plasma.phone shells) +install(DIRECTORY wallpaper/ DESTINATION "${WALLPAPER_INSTALL_DIR}/org.kde.plasma.phone.lockers") kpackage_install_package(phonebook org.kde.phone.phonebook genericqml) install(FILES phonebook/metadata.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} RENAME org.kde.phone.phonebook.desktop) diff --git a/README.md b/README.md index f7137b63..ec7e46dc 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,6 @@ http://comments.gmane.org/gmane.comp.handhelds.ofono/12178 phonesim -p 12345 -gui /usr/share/phonesim/default.xml * from the oFono *source* directory, call /test/enable-modem to bring the modem up, the control UI should come up * call test/online-modem to activate the test phonesim modem -* start plasma with plasmashell -w -p org.kde.satellite.phone to start the phone homescreen in a window +* start plasma with plasmashell -w -p org.kde.plasma.phone to start the phone homescreen in a window Note that the oFono/phonesim part is necessary only if it's needed to test some part specific to telephony diff --git a/applets/notifications/contents/ui/NotificationStripe.qml b/applets/notifications/contents/ui/NotificationStripe.qml index f5719b73..69112a79 100644 --- a/applets/notifications/contents/ui/NotificationStripe.qml +++ b/applets/notifications/contents/ui/NotificationStripe.qml @@ -44,13 +44,6 @@ MouseArea { } } - Behavior on height { - NumberAnimation { - easing.type: Easing.InOutQuad - duration: units.longDuration - } - } - onReleased: { if (drag.active) { if (x > width / 4 || x < width / -4) { @@ -97,11 +90,8 @@ MouseArea { PlasmaComponents.Label { id: appLabel - anchors { - left: parent.left - verticalCenter: parent.verticalCenter - leftMargin: units.gridUnit * 3 - } + anchors.leftMargin: units.gridUnit * 3 + color: PlasmaCore.ColorScope.textColor text: model.appName } @@ -109,36 +99,45 @@ MouseArea { Column { id: messageLayout anchors { - left: appLabel.right - right: icon.left verticalCenter: parent.verticalCenter - rightMargin: units.smallSpacing + left: parent.left + right: icon.left + leftMargin: units.gridUnit * 3 } PlasmaComponents.Label { - anchors { - right: parent.right - left: parent.left - } + id: summaryLabel + anchors.right: parent.right + width: messageLayout.width - appLabel.width horizontalAlignment: Qt.AlignRight verticalAlignment: Qt.AlignVCenter text: summary + (!notificationItem.expanded && body ? "..." : "") wrapMode: Text.WordWrap } + PlasmaComponents.Label { + id: bodyLabel anchors { right: parent.right left: parent.left } - visible: notificationItem.expanded && body != undefined && body + visible: height > 0 + height: notificationItem.expanded && body != undefined && body ? implicitHeight : 0 + clip: true horizontalAlignment: Qt.AlignRight verticalAlignment: Qt.AlignVCenter text: body wrapMode: Text.WordWrap + Behavior on height { + NumberAnimation { + duration: units.longDuration + easing.type: Easing.InOutQuad + } + } } - } + PlasmaCore.IconItem { id: icon anchors { @@ -174,4 +173,34 @@ MouseArea { } } } + + states: [ + State { + name: "large" + when: appLabel.width + bodyLabel.paintedWidth < messageLayout.width + AnchorChanges { + target: appLabel + anchors { + verticalCenter: parent.verticalCenter + top: undefined + left: parent.left + } + } + PropertyChanges { + + } + }, + State { + name: "compact" + when: notificationItem.state != "large" + AnchorChanges { + target: appLabel + anchors { + verticalCenter: undefined + top: messageLayout.top + left: parent.left + } + } + } + ] } diff --git a/applets/quicksettings/package/contents/ui/main.qml b/applets/quicksettings/package/contents/ui/main.qml index 822858f5..d7cd163a 100644 --- a/applets/quicksettings/package/contents/ui/main.qml +++ b/applets/quicksettings/package/contents/ui/main.qml @@ -69,7 +69,7 @@ Item { text: "Wireless" icon: "network-wireless-on" enabled: true - settingsCommand: "active-settings -m org.kde.satellite.settings.wifi" + settingsCommand: "active-settings -m org.kde.plasma.phone.settings.wifi" } ListElement { text: "Alarms" diff --git a/bin/plasma-phone.cmake b/bin/plasma-phone.cmake index 436b329e..f7b7ea9b 100644 --- a/bin/plasma-phone.cmake +++ b/bin/plasma-phone.cmake @@ -40,4 +40,4 @@ init --user & mc-tool request ofono/ofono/account0 online paplay /usr/share/sounds/freedesktop/stereo/message.oga & -exec /usr/bin/plasmashell -p org.kde.satellite.phone 2>/tmp/plasmashell_logs +exec /usr/bin/plasmashell -p org.kde.plasma.phone 2>/tmp/plasmashell_logs diff --git a/compositor/ClientWindowWrapper.qml b/compositor/ClientWindowWrapper.qml deleted file mode 100644 index b18cbb52..00000000 --- a/compositor/ClientWindowWrapper.qml +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 2014 Pier Luigi Fiorini - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -import QtQuick 2.0 -import org.kde.plasma.core 2.0 as PlasmaCore - -WindowWrapper { - id: window - objectName: "clientWindow" - onXChanged: { - if (compositorRoot.currentWindow == window) { - compositorRoot.layers.windows.contentX = x; - } - } - Behavior on y { - enabled: !mouse.active - SequentialAnimation { - NumberAnimation { - easing.type: "InOutQuad" - duration: units.longDuration - } - ScriptAction { - script: { - if (window.opacity < 0.3) { - window.close(); - } - } - } - } - } - opacity: 1 - (Math.abs(y) / height) - - MouseArea { - id: mouse - z: 99 - anchors.fill: parent - enabled: compositorRoot.layers.windows.switchMode - property bool active - onPressed: { - active = true; - } - onClicked: { - compositorRoot.currentWindow = window; - window.child.takeFocus(); - } - onReleased: { - active = false; - if (window.opacity < 0.3) { - window.y = (window.y > 0 ? +1 : -1) * window.height; - } else { - window.y = 0; - } - } - drag { - axis: Drag.YAxis - target: window - } - } -} diff --git a/compositor/Compositor.qml b/compositor/Compositor.qml deleted file mode 100644 index b44f8f0e..00000000 --- a/compositor/Compositor.qml +++ /dev/null @@ -1,378 +0,0 @@ -/* - * Copyright 2014 Pier Luigi Fiorini - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -import QtQuick 2.0 -import QtQuick.Layouts 1.0 -import QtQml.Models 2.1 -import org.kde.plasma.core 2.0 as PlasmaCore -import "WindowManagement.js" as WindowManagement - -Rectangle { - property alias showSplash: splash.visible - property bool showPanel: true - property alias showKeyboard: keyboardLayer.visible - readonly property alias layers: layers - readonly property real topBarHeight: units.iconSizes.small - readonly property real bottomBarHeight: units.iconSizes.medium - property var currentWindow: null - property var shellWindow: null; - - onCurrentWindowChanged: { - if (!currentWindow) { - compositorRoot.state = "homeScreen"; - return; - } - compositorRoot.state = "application"; - } - - id: compositorRoot - color: "black" - state: "homeScreen" - - Image { - id: splash - anchors.fill: parent - source: "klogo.png" - sourceSize.width: width - sourceSize.height: height - fillMode: Image.PreserveAspectFit - z: 1000 - } - - ListModel { - id: surfaceModel - } - - Connections { - target: compositor - onSurfaceMapped: WindowManagement.surfaceMapped(surface) - onSurfaceUnmapped: WindowManagement.surfaceUnmapped(surface) - onSurfaceDestroyed: WindowManagement.surfaceDestroyed(surface) - } - - QtObject { - readonly property alias desktop: desktopLayer - readonly property alias windows: windowsLayerBackground - readonly property alias panel: panelLayer - readonly property alias keyboard: keyboardLayer - - id: layers - } - - Item { - id: desktopLayer - anchors.fill: parent - visible: true - } - - Rectangle { - id: windowsLayerBackground - anchors { - fill: parent - topMargin: topBarHeight - bottomMargin: bottomBarHeight - } - color: Qt.rgba(0, 0, 0, 0.9) - function addWindow (window) { - window.parent = windowsLayout - } - property bool switchMode: windowsZoom.scale < 1 - - Item { - id: windowsZoom - anchors.fill: parent - Flickable { - id: windowsLayer - anchors.centerIn: parent - - flickableDirection: Flickable.HorizontalFlick - height: windowsZoom.height * 2 - width: windowsZoom.width * 2 - interactive: windowsLayerBackground.switchMode - contentWidth: windowsLayout.width - contentHeight: windowsLayout.height - - MouseArea { - height: windowsLayer.height - width: windowsLayout.width - onClicked: { - compositorRoot.state = "homeScreen"; - } - Row { - id: windowsLayout - anchors.centerIn: parent - height: windowsLayerBackground.height - transformOrigin: Item.Left - onChildrenChanged: { - if (children.length == 0) { - compositorRoot.state = "homeScreen"; - } - } - } - } - } - } - } - - Item { - id: panelLayer - anchors.fill: parent - visible: showPanel - z: 3 - } - - Item { - id: keyboardLayer - anchors.fill: parent - z: 800 - onVisibleChanged: { - if (!visible && compositorRoot.shellWindow) { - compositorRoot.shellWindow.child.takeFocus(); - } - } - } - - Rectangle { - id: bottomBar - z: 4 - anchors.left: parent.left - anchors.right: parent.right - anchors.bottom: parent.bottom - height: bottomBarHeight - color: Qt.rgba(0, 0, 0, 0.9) - - Behavior on height { - NumberAnimation { - easing.type: "InOutQuad" - duration: units.shortDuration - } - } - - RowLayout { - anchors.fill: parent - - PlasmaCore.IconItem { - colorGroup: PlasmaCore.Theme.ComplementaryColorGroup - width: units.iconSizes.smallMedium - height: width - source: "distribute-horizontal-x" - enabled: compositorRoot.state != "switcher" && windowsLayout.children.length > 0 - opacity: enabled ? 1 : 0.2 - - Layout.alignment: Qt.AlignHCenter - Layout.preferredWidth: units.iconSizes.medium - Layout.preferredHeight: units.iconSizes.medium - - MouseArea { - anchors.fill: parent - onClicked: { - compositorRoot.state = "switcher"; - } - } - } - PlasmaCore.IconItem { - colorGroup: PlasmaCore.Theme.ComplementaryColorGroup - width: units.iconSizes.smallMedium - height: width - source: "go-home" - enabled: compositorRoot.state != "homeScreen"; - opacity: enabled ? 1 : 0.2 - - Layout.alignment: Qt.AlignHCenter - Layout.preferredWidth: units.iconSizes.medium - Layout.preferredHeight: units.iconSizes.medium - - MouseArea { - anchors.fill: parent - onClicked: { - compositorRoot.state = "homeScreen"; - } - } - } - PlasmaCore.IconItem { - colorGroup: PlasmaCore.Theme.ComplementaryColorGroup - width: units.iconSizes.smallMedium - height: width - source: "window-close" - enabled: compositorRoot.currentWindow - opacity: enabled ? 1 : 0.2 - - Layout.alignment: Qt.AlignHCenter - Layout.preferredWidth: units.iconSizes.medium - Layout.preferredHeight: units.iconSizes.medium - - MouseArea { - anchors.fill: parent - onClicked: { - compositorRoot.state = "homeScreen"; - compositorRoot.currentWindow.close(); - } - } - } - } - } - - MouseArea { - id: taskSwitchEdge - z: 1000 - anchors { - left: parent.left - right: parent.right - bottom: parent.bottom - } - height: 8 - enabled: windowsLayout.children.length > 0 && compositorRoot.state != "switcher" - property int oldX: 0 - onPressed: { - oldX = mouse.x; - } - onPositionChanged: { - compositorRoot.state = "changing"; - compositorRoot.showKeyboard = false; - - var newScale = (1-Math.abs(mouse.y)/(compositorRoot.height/2)) - if (newScale > 0.3) { - windowsZoom.scale = newScale - } - windowsLayer.contentX -= (mouse.x - oldX); - oldX = mouse.x; - } - onReleased: { - if (windowsZoom.scale > 0.7) { - compositorRoot.state = compositorRoot.currentWindow ? "application" : "homeScreen"; - } else { - compositorRoot.state = "switcher"; - } - } - } - - states: [ - State { - name: "homeScreen" - PropertyChanges { - target: windowsLayerBackground - opacity: 0 - } - PropertyChanges { - target: windowsZoom - scale: 1 - } - }, - State { - name: "application" - PropertyChanges { - target: windowsLayerBackground - opacity: 1 - } - PropertyChanges { - target: windowsZoom - scale: 1 - } - PropertyChanges { - target: windowsLayer - contentX: compositorRoot.currentWindow ? compositorRoot.currentWindow.x - windowsLayerBackground.width/2 : 0 - } - }, - State { - name: "switcher" - PropertyChanges { - target: windowsLayerBackground - opacity: 1 - } - PropertyChanges { - target: windowsZoom - scale: 0.5 - } - PropertyChanges { - target: windowsLayer - contentX: compositorRoot.currentWindow ? compositorRoot.currentWindow.x - windowsLayerBackground.width/2 : 0 - } - }, - State { - name: "changing" - PropertyChanges { - target: windowsLayerBackground - opacity: 1 - } - PropertyChanges { - target: windowsLayer - contentX: compositorRoot.currentWindow ? compositorRoot.currentWindow.x - windowsLayerBackground.width/2 : 0 - } - } - ] - - transitions: [ - Transition { - to: "changing" - SequentialAnimation { - ScriptAction { - script: { - desktopLayer.z = 1 - windowsLayerBackground.z = 800 - } - } - PropertyAnimation { - target: windowsLayerBackground - duration: units.longDuration - easing.type: Easing.InOutQuad - properties: "opacity" - } - } - }, - Transition { - SequentialAnimation { - ParallelAnimation { - PropertyAnimation { - target: windowsLayerBackground - duration: units.longDuration - easing.type: Easing.InOutQuad - properties: "opacity" - } - PropertyAnimation { - target: windowsZoom - duration: units.shortDuration - easing.type: Easing.InOutQuad - properties: "scale" - } - PropertyAnimation { - target: windowsLayer - duration: units.shortDuration - easing.type: Easing.InOutQuad - properties: "contentX" - } - } - ScriptAction { - script: { - if (compositorRoot.state == "homeScreen") { - desktopLayer.z = 2; - windowsLayerBackground.z = 1; - compositorRoot.currentWindow = null; - } else { - desktopLayer.z = 1; - windowsLayerBackground.z = 800; - if (compositorRoot.currentWindow) { - compositorRoot.currentWindow.child.takeFocus(); - } - } - } - } - } - } - ] -} diff --git a/compositor/ShellWindowWrapper.qml b/compositor/ShellWindowWrapper.qml deleted file mode 100644 index 00e30cce..00000000 --- a/compositor/ShellWindowWrapper.qml +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright 2014 Pier Luigi Fiorini - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -import QtQuick 2.0 - -WindowWrapper { - objectName: "shellWindow" -} diff --git a/compositor/WindowManagement.js b/compositor/WindowManagement.js deleted file mode 100644 index ba5d6c68..00000000 --- a/compositor/WindowManagement.js +++ /dev/null @@ -1,280 +0,0 @@ -/* - * Copyright 2014 Pier Luigi Fiorini - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -/* - * Main procedures - */ - -function surfaceMapped(surface) { - // Determine if it's a shell window - var firstView = compositor.firstViewOf(surface); - var isShellWindow = - (typeof(firstView.role) != "undefined") || - (surface.className == "plasmashell.desktop"); - - // Print some information - if (surface.className == "maliit-server.desktop") { - console.debug("Keyboard surface", surface, "mapped"); - console.debug("\tappId:", surface.className); - console.debug("\ttitle:", surface.title); - console.debug("\tsize:", surface.size.width + "x" + surface.size.height); - } else if (isShellWindow) { - console.debug("Shell surface", surface, "mapped"); - console.debug("\trole:", firstView.role); - console.debug("\tsize:", surface.size.width + "x" + surface.size.height); - } else { - console.debug("Application surface", surface, "mapped"); - console.debug("\tappId:", surface.className); - console.debug("\ttitle:", surface.title); - console.debug("\tsize:", surface.size.width + "x" + surface.size.height); - } - - if (surface.className == "maliit-server.desktop") { - mapKeyboardSurface(surface); - // Call a specialized method to deal with application or - // shell windows - } else if (isShellWindow) - mapShellSurface(surface, firstView); - else - mapApplicationSurface(surface); -} - -function surfaceUnmapped(surface) { - // Determine if it's a shell window - var firstView = compositor.firstViewOf(surface); - var isShellWindow = - (typeof(firstView.role) != "undefined") || - (surface.className == "plasmashell.desktop"); - - // Print some information - if (typeof(firstView.role) == "undefined") { - console.debug("Shell surface", surface, "unmapped"); - console.debug("\trole:", firstView.role); - console.debug("\tsize:", surface.size.width + "x" + surface.size.height); - } else { - console.debug("Application surface", surface, "unmapped"); - console.debug("\tappId:", surface.className); - console.debug("\ttitle:", surface.title); - } - - //Is it maliit? - if (surface.className == "maliit-server.desktop") { - unmapKeyboardSurface(surface); - // Call a specialized method to deal with application or - // shell windows - } else if (isShellWindow) - unmapShellSurface(surface); - else - unmapApplicationSurface(surface); -} - -function surfaceDestroyed(surface) { - console.debug("Surface", surface, "destroyed"); - - // Remove surface from model - var i; - for (i = 0; i < surfaceModel.count; i++) { - var entry = surfaceModel.get(i); - - if (entry.surface === surface) { - // Destroy window representation and - // remove the surface from the model - if (entry.window.chrome) - entry.window.chrome.destroy(); - entry.window.destroy(); - surfaceModel.remove(i, 1); - break; - } - } -} - -/* - * Map surfaces - */ - -function mapApplicationSurface(surface) { - // Just exit if we already created a window representation - var i; - for (i = 0; i < surfaceModel.count; i++) { - var entry = surfaceModel.get(i); - - if (entry.surface === surface) { - // Ask the client to resize - surface.requestSize(window.parent.width, window.parent.height); - - return; - } - } - - // Create surface item - var component = Qt.createComponent("ClientWindowWrapper.qml"); - if (component.status !== Component.Ready) { - console.error(component.errorString()); - return; - } - - // Request a view for this output although with phones will - // likely have just one output - var child = compositor.viewForOutput(surface, _greenisland_output); - - child.resizeSurfaceToItem = true; - child.width = compositorRoot.layers.windows.width; - child.height = compositorRoot.layers.windows.height; - - // Create and setup window container - var window = component.createObject(compositorRoot.layers.windows, {"child": child}); - compositorRoot.layers.windows.addWindow(window); - window.child.parent = window; - window.child.touchEventsEnabled = true; - window.width = surface.size.width; - window.height = surface.size.height; - - // Switch to the applications layer and take focus - compositorRoot.state = "application"; - compositorRoot.currentWindow = window; - window.child.takeFocus(); - - // Run map animation - if (typeof(window.runMapAnimation) != "undefined") - window.runMapAnimation(); - - // Add surface to the model - surfaceModel.append({"surface": surface, "window": window}); -} - -function mapShellSurface(surface, child) { - // Shell surfaces have only one view which is passed to us - // as an argument, check whether it's a view for this output - // or not - if (child.output !== _greenisland_output) - return; - - // Just set z-index and exit if we already created a - // window representation - var i; - for (i = 0; i < surfaceModel.count; i++) { - var entry = surfaceModel.get(i); - - if (entry.surface === surface) { - // Switch to layer and take focus - if (surface.className == "plasmashell.desktop") { - compositorRoot.showPanel = true; - } else { - compositorRoot.state = "homeScreen"; - } - entry.window.child.takeFocus(); - - return; - } - } - - // Create surface item - var component = Qt.createComponent("ShellWindowWrapper.qml"); - if (component.status !== Component.Ready) { - console.error(component.errorString()); - return; - } - - // Create and setup window container - // XXX: We only support desktop roles for now - var window = component.createObject(compositorRoot, {"child": child}); - window.parent = (surface.className == "plasmashell.desktop") ? compositorRoot.layers.panel : compositorRoot.layers.desktop; - window.child.parent = window; - window.child.touchEventsEnabled = true; - window.x = window.y = 0; - window.width = surface.size.width; - window.height = surface.size.height; - - // Switch to the desktop layer and take focus - compositorRoot.showSplash = false; - if (surface.className == "plasmashell.desktop") { - compositorRoot.showPanel = true; - } else { - compositorRoot.state = "homeScreen"; - compositorRoot.shellWindow = window; - } - window.child.takeFocus(); - - // Add surface to the model - surfaceModel.append({"surface": surface, "window": window}); -} - -function mapKeyboardSurface(surface) { - // Just exit if we already created a window representation - var i; - for (i = 0; i < surfaceModel.count; i++) { - var entry = surfaceModel.get(i); - - if (entry.surface === surface) { - compositorRoot.showKeyboard = true; - - return; - } - } - - // Create surface item - var component = Qt.createComponent("ShellWindowWrapper.qml"); - if (component.status !== Component.Ready) { - console.error(component.errorString()); - return; - } - - // Request a view for this output although with phones will - // likely have just one output - var child = compositor.viewForOutput(surface, _greenisland_output); - - // Create and setup window container - var window = component.createObject(compositorRoot.layers.keyboard, {"child": child}); - window.parent = compositorRoot.layers.keyboard; - window.child.parent = window; - window.child.touchEventsEnabled = true; - window.width = surface.size.width; - window.height = surface.size.height; - window.y = compositorRoot.layers.keyboard.height - window.height; - - // Add surface to the model - surfaceModel.append({"surface": surface, "window": window}); - compositorRoot.showKeyboard = true; -} - - -/* - * Unmap surfaces - */ - -function unmapApplicationSurface(surface) { - // Reactivate home layer as soon as an application window is unmapped - compositorRoot.state = "homeScreen"; - compositorRoot.currentWindow = null; -} - -function unmapShellSurface(surface) { - // Hide panel layer if this is the sliding panel - if (surface.className == "plasmashell.desktop") { - compositorRoot.showPanel = false; - } -} - -function unmapKeyboardSurface(surface) { - if (compositorRoot.currentWindow) { - compositorRoot.currentWindow.child.height = compositorRoot.layers.windows.height; - } - - compositorRoot.showKeyboard = false; -} diff --git a/compositor/WindowWrapper.qml b/compositor/WindowWrapper.qml deleted file mode 100644 index 69d68ee9..00000000 --- a/compositor/WindowWrapper.qml +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2014 Pier Luigi Fiorini - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -import QtQuick 2.0 -import QtCompositor 1.0 -import GreenIsland 1.0 - -Item { - property var child - property var role: child.surface.windowProperties.role - - id: window - onVisibleChanged: { - if (child) - child.surface.clientRenderingEnabled = visible; - } - - SurfaceRenderer { - anchors.fill: parent - source: child - } - - Connections { - target: child.surface - onSizeChanged: { - window.width = child.surface.size.width; - window.height = child.surface.size.height; - } - } - - function close() { - if (!child || !child.surface) - return; - - child.surface.client.close(); - window.destroy(); - } -} diff --git a/compositor/klogo.png b/compositor/klogo.png deleted file mode 100644 index b467f507..00000000 Binary files a/compositor/klogo.png and /dev/null differ diff --git a/containments/homescreen/CMakeLists.txt b/containments/homescreen/CMakeLists.txt index fe2649e2..8a4ffda4 100644 --- a/containments/homescreen/CMakeLists.txt +++ b/containments/homescreen/CMakeLists.txt @@ -13,6 +13,7 @@ target_link_libraries(plasma_containment_phone_homescreen Qt5::Qml KF5::I18n KF5::Service + KF5::KIOWidgets ) diff --git a/containments/homescreen/applicationlistmodel.cpp b/containments/homescreen/applicationlistmodel.cpp index a14adc86..f47b6abf 100644 --- a/containments/homescreen/applicationlistmodel.cpp +++ b/containments/homescreen/applicationlistmodel.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include ApplicationListModel::ApplicationListModel(QObject *parent) @@ -96,7 +97,7 @@ void ApplicationListModel::loadApplications() for(KServiceGroup::List::ConstIterator it = subGroupList.begin();it != subGroupList.end(); it++) { KSycocaEntry::Ptr groupEntry = (*it); - if (groupEntry->isType(KST_KServiceGroup) && groupEntry->name() != "System/" && groupEntry->name() != "Settingsmenu/") { + if (groupEntry->isType(KST_KServiceGroup)) { KServiceGroup::Ptr serviceGroup(static_cast(groupEntry.data())); if (!serviceGroup->noDisplay()) { @@ -110,7 +111,7 @@ void ApplicationListModel::loadApplications() KService::Ptr service(static_cast(entry.data())); if (service->isApplication() && !blacklist.contains(service->desktopEntryName() + QStringLiteral(".desktop")) && - !service->showOnCurrentPlatform() && + service->showOnCurrentPlatform() && !service->property("Terminal", QVariant::Bool).toBool()) { data.name = service->name(); @@ -218,6 +219,7 @@ Q_INVOKABLE void ApplicationListModel::moveItem(int row, int destination) endMoveRows(); } +//TODO: the implementation of runApplicationKRun should be the only one remaining void ApplicationListModel::runApplication(const QString &storageId) { if (storageId.isEmpty()) { @@ -230,6 +232,17 @@ void ApplicationListModel::runApplication(const QString &storageId) QProcess::startDetached(service->exec().replace(QRegExp("%\\w"), "")); } +void ApplicationListModel::runApplicationKRun(const QString &storageId) +{ + if (storageId.isEmpty()) { + return; + } + + KService::Ptr service = KService::serviceByStorageId(storageId); + + KRun::run(*service, QList(), 0); +} + QStringList ApplicationListModel::appOrder() const { return m_appOrder; diff --git a/containments/homescreen/applicationlistmodel.h b/containments/homescreen/applicationlistmodel.h index a5094566..2d2da610 100644 --- a/containments/homescreen/applicationlistmodel.h +++ b/containments/homescreen/applicationlistmodel.h @@ -71,6 +71,8 @@ public: Q_INVOKABLE void runApplication(const QString &storageId); + Q_INVOKABLE void runApplicationKRun(const QString &storageId); + Q_INVOKABLE void loadApplications(); public Q_SLOTS: diff --git a/containments/homescreen/package/contents/ui/FeedbackWindow.qml b/containments/homescreen/package/contents/ui/FeedbackWindow.qml new file mode 100644 index 00000000..b9b92f09 --- /dev/null +++ b/containments/homescreen/package/contents/ui/FeedbackWindow.qml @@ -0,0 +1,102 @@ +/* + * Copyright 2015 Marco Martin + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Library General Public License as + * published by the Free Software Foundation; either version 2, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +import QtQuick 2.0 +import QtQuick.Layouts 1.1 +import QtQuick.Window 2.2 +import org.kde.plasma.core 2.0 as PlasmaCore +import org.kde.plasma.components 2.0 as PlasmaComponents + +Window { + id: window + + property alias state: background.state + width: Screen.width + height: Screen.height + color: "transparent" + onVisibleChanged: { + if (!visible) { + background.state = "closed"; + } + } + onActiveChanged: { + if (!active) { + background.state = "closed"; + } + } + + PlasmaCore.ColorScope { + id: background + anchors.fill: parent + colorGroup: PlasmaCore.Theme.ComplementaryColorGroup + width: window.width + height: window.height + state: "closed" + Rectangle { + anchors.fill: parent + color: background.backgroundColor + + PlasmaComponents.BusyIndicator { + anchors.centerIn: parent + } + } + + states: [ + State { + name: "closed" + PropertyChanges { + target: background + scale: 0 + } + PropertyChanges { + target: window + visible: false + } + }, + State { + name: "open" + PropertyChanges { + target: background + scale: 1 + } + PropertyChanges { + target: window + visible: true + } + } + ] + + transitions: [ + Transition { + from: "closed" + SequentialAnimation { + ScriptAction { + script: window.visible = true; + } + PropertyAnimation { + target: background + duration: units.longDuration + easing.type: Easing.InOutQuad + properties: "scale" + } + } + } + ] + } +} diff --git a/containments/homescreen/package/contents/ui/HomeLauncher.qml b/containments/homescreen/package/contents/ui/HomeLauncher.qml index ffd23976..1aa8629b 100644 --- a/containments/homescreen/package/contents/ui/HomeLauncher.qml +++ b/containments/homescreen/package/contents/ui/HomeLauncher.qml @@ -15,7 +15,10 @@ Item { PlasmaCore.IconItem { id: icon - anchors.centerIn: parent + anchors { + centerIn: parent + verticalCenterOffset: -theme.mSize(theme.defaultFont).height + } width: parent.height / 2 height: width source: modelData.ApplicationIconRole diff --git a/containments/homescreen/package/contents/ui/KRunner.qml b/containments/homescreen/package/contents/ui/KRunner.qml new file mode 100644 index 00000000..80adf5d6 --- /dev/null +++ b/containments/homescreen/package/contents/ui/KRunner.qml @@ -0,0 +1,83 @@ +/* + * Copyright (C) 2015 Vishesh Handa + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) version 3, or any + * later version accepted by the membership of KDE e.V. (or its + * successor approved by the membership of KDE e.V.), which shall + * act as a proxy defined in Section 6 of version 3 of the license. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + * + */ + +import QtQuick 2.0 +import QtQuick.Layouts 1.1 +import QtQuick.Window 2.1 + +import org.kde.plasma.core 2.0 as PlasmaCore +import org.kde.plasma.components 2.0 as PlasmaComponents +import org.kde.plasma.extras 2.0 as PlasmaExtras + +import org.kde.milou 0.1 as Milou + +PlasmaCore.FrameSvgItem { + id: background + imagePath: "widgets/background" + enabledBorders: PlasmaCore.FrameSvg.BottomBorder + height: childrenRect.height + fixedMargins.top/2 + fixedMargins.bottom + + ColumnLayout { + anchors { + left: parent.left + right: parent.right + top: parent.top + topMargin: background.fixedMargins.top / 2 + leftMargin: background.fixedMargins.left / 2 + rightMargin: background.fixedMargins.right / 2 + } + PlasmaComponents.TextField { + id: queryField + clearButtonShown: true + Layout.fillWidth: true + Layout.alignment: Qt.AlignTop + + Keys.onEscapePressed: runnerWindow.visible = false + placeholderText: "Search ..." + } + + Milou.ResultsView { + id: listView + queryString: queryField.text + visible: count > 0 + + Layout.fillWidth: true + Layout.preferredHeight: listView.contentHeight + Layout.alignment: Qt.AlignTop + + onActivated: queryField.text = "" + onUpdateQueryString: { + queryField.text = text + queryField.cursorPosition = cursorPosition + } + } + + Keys.onReturnPressed: { + if (queryField.texr.length == 0) + runnerWindow.visible = false; + } + Keys.onEnterPressed: { + if (queryField.texr.length == 0) + runnerWindow.visible = false; + } + } +} + diff --git a/containments/homescreen/package/contents/ui/main.qml b/containments/homescreen/package/contents/ui/main.qml index e712fb7c..9221eea2 100644 --- a/containments/homescreen/package/contents/ui/main.qml +++ b/containments/homescreen/package/contents/ui/main.qml @@ -41,12 +41,6 @@ MouseEventListener { LayoutManager.save(); } - Plasmoid.onFocusChanged: { - if (!plasmoid.focus && applicationsView.contentY > -(applicationsView.headerItem.height - root.height/2)) { - applicationsView.contentY = -root.height; - } - } - function addApplet(applet, x, y) { var container = appletContainerComponent.createObject(appletsSpace.layout) container.visible = true @@ -256,6 +250,8 @@ MouseEventListener { return; } + feedbackWindow.title = item.modelData.ApplicationNameRole; + feedbackWindow.state = "open"; plasmoid.nativeInterface.applicationListModel.runApplication(item.modelData.ApplicationStorageIdRole); clickFedbackAnimation.target = item; clickFedbackAnimation.running = true; @@ -281,6 +277,19 @@ MouseEventListener { easing.type: Easing.InOutQuad } } + FeedbackWindow { + id: feedbackWindow + } + KRunner { + z: 1000 + anchors { + top: parent.top + left: parent.left + right: parent.right + topMargin: plasmoid.availableScreenRect.y + } + } + PlasmaCore.ColorScope { anchors.fill: parent //TODO: decide what color we want applets @@ -404,7 +413,7 @@ MouseEventListener { //scrolling up } else if (verticalVelocity < 0 && contentY < -headerItem.height + root.height && - contentY < (-headerItem.height + root.height/6)) { + contentY < (-headerItem.height + root.height/6*5)) { scrollAnim.to = -headerItem.height; scrollAnim.running = true; return; diff --git a/containments/taskpanel/package/contents/code/close.js b/containments/taskpanel/package/contents/code/close.js deleted file mode 100644 index 56f0ef10..00000000 --- a/containments/taskpanel/package/contents/code/close.js +++ /dev/null @@ -1,2 +0,0 @@ - -workspace.activeClient.closeWindow(); diff --git a/containments/taskpanel/package/contents/ui/Button.qml b/containments/taskpanel/package/contents/ui/Button.qml new file mode 100644 index 00000000..d3b2bf46 --- /dev/null +++ b/containments/taskpanel/package/contents/ui/Button.qml @@ -0,0 +1,52 @@ +/* + * Copyright 2015 Marco Martin + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA. + */ + +import QtQuick 2.4 +import QtQuick.Layouts 1.1 + +import org.kde.plasma.plasmoid 2.0 +import org.kde.plasma.core 2.0 as PlasmaCore +import org.kde.plasma.components 2.0 as PlasmaComponents +import org.kde.kquickcontrolsaddons 2.0 + +MouseArea { + id: button + width: Math.min(parent.width, parent.height) + height: width + property alias iconSource: icon.source + property bool checked + property bool checkable + + Rectangle { + anchors.fill:parent + radius: width/4 + visible: button.checked + color: theme.highlightColor + } + PlasmaCore.IconItem { + id: icon + anchors.fill: parent + colorGroup: PlasmaCore.Theme.ComplementaryColorGroup + enabled: button.enabled + } + onClicked: { + if (checkable) { + checked = !checked; + } + } +} diff --git a/containments/taskpanel/package/contents/ui/TaskSwitcher.qml b/containments/taskpanel/package/contents/ui/TaskSwitcher.qml new file mode 100644 index 00000000..7272f574 --- /dev/null +++ b/containments/taskpanel/package/contents/ui/TaskSwitcher.qml @@ -0,0 +1,133 @@ +/* + * Copyright 2015 Marco Martin + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Library General Public License as + * published by the Free Software Foundation; either version 2, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +import QtQuick 2.0 +import QtQuick.Layouts 1.1 +import QtQuick.Window 2.2 +import org.kde.plasma.core 2.0 as PlasmaCore +import org.kde.plasma.components 2.0 as PlasmaComponents + +Window { + id: window + + visible: false + width: Screen.width + height: Screen.height + property int offset: 0 + property int overShoot: units.gridUnit * 2 + + color: Qt.rgba(0, 0, 0, 0.6 * (Math.min(tasksView.contentY + window.height, window.height) / window.height)) + + function show() { + visible = true; + scrollAnim.to = 0; + scrollAnim.running = true; + } + function hide() { + scrollAnim.to = -tasksView.headerItem.height; + scrollAnim.running = true; + } + + SequentialAnimation { + id: scrollAnim + property alias to: internalAnim.to + ScriptAction { + script: window.visible = true; + } + NumberAnimation { + id: internalAnim + target: tasksView + properties: "contentY" + duration: units.longDuration + easing.type: Easing.InOutQuad + } + ScriptAction { + script: { + if (tasksView.contentY <= -tasksView.headerItem.height) { + window.visible = false; + } + } + } + } + GridView { + id: tasksView + width: window.width + height: window.height + cellWidth: window.width/2 + cellHeight: window.height/2 + onFlickingChanged: { + if (!draggingVertically && contentY < -headerItem.height + window.height) { + scrollAnim.to = Math.round(contentY/window.height) * window.height + scrollAnim.running = true; + } + } + onDraggingVerticallyChanged: { + if (draggingVertically) { + return; + } + + //manage separately the first page, the lockscreen + //scrolling down + if (verticalVelocity > 0 && contentY < -headerItem.height + window.height && + contentY > (-headerItem.height + window.height/6)) { + show(); + return; + + //scrolling up + } else if (verticalVelocity < 0 && contentY < -headerItem.height + window.height && + contentY < (-headerItem.height + window.height/6*5)) { + hide(); + return; + } + + if (contentY < 0) { + show(); + } + } + + model: 10 + header: Item { + width: window.width + height: window.height + } + delegate: Item { + width: window.width/2 + height: window.height/2 + Rectangle { + anchors { + fill: parent + margins: units.gridUnit + } + radius: units.gridUnit + opacity: 0.8 + PlasmaComponents.Label { + anchors { + bottom: parent.bottom + horizontalCenter: parent.horizontalCenter + } + text: "Task " + modelData + } + MouseArea { + anchors.fill: parent + onClicked: window.hide(); + } + } + } + } +} diff --git a/containments/taskpanel/package/contents/ui/main.qml b/containments/taskpanel/package/contents/ui/main.qml index 506bab38..04ce5f5a 100644 --- a/containments/taskpanel/package/contents/ui/main.qml +++ b/containments/taskpanel/package/contents/ui/main.qml @@ -24,39 +24,57 @@ import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.components 2.0 as PlasmaComponents import org.kde.kquickcontrolsaddons 2.0 -Rectangle { - anchors.fill: parent - //TODO: decide what color we want applets - color: theme.backgroundColor - +PlasmaCore.ColorScope { + id: root width: 600 - height: 40 + height: 480 + colorGroup: PlasmaCore.Theme.ComplementaryColorGroup - property Item toolBox - - PlasmaComponents.ToolButton { - id: showDesktopButton - height: parent.height - width: height - anchors.horizontalCenter: parent.horizontalCenter - iconSource: "go-home" - checkable: true - onCheckedChanged: { - plasmoid.nativeInterface.showDesktop = checked; + TaskSwitcher { + id: taskSwitcher + } + Rectangle { + anchors.fill: parent + color: root.backgroundColor + + width: 600 + height: 40 + + property Item toolBox + + Button { + anchors.left: parent.left + height: parent.height + width: parent.width/3 + iconSource: "applications-other" + onClicked: taskSwitcher.visible ? taskSwitcher.hide() : taskSwitcher.show(); } - Connections { - target: plasmoid.nativeInterface - onShowingDesktopChanged: { - showDesktopButton.checked = plasmoid.nativeInterface.showDesktop; + + Button { + id: showDesktopButton + height: parent.height + width: parent.width/3 + anchors.horizontalCenter: parent.horizontalCenter + iconSource: "go-home" + checkable: true + onCheckedChanged: {print (checked) + plasmoid.nativeInterface.showDesktop = checked; + } + Connections { + target: plasmoid.nativeInterface + onShowingDesktopChanged: { + showDesktopButton.checked = plasmoid.nativeInterface.showDesktop; + } } } - } - PlasmaComponents.ToolButton { - height: parent.height - width: height - anchors.right: parent.right - iconSource: "window-close" - onClicked: plasmoid.nativeInterface.executeScript("close"); + Button { + height: parent.height + width: parent.width/3 + anchors.right: parent.right + iconSource: "window-close" + enabled: plasmoid.nativeInterface.hasCloseableActiveWindow; + onClicked: plasmoid.nativeInterface.closeActiveWindow(); + } } } diff --git a/containments/taskpanel/taskpanel.cpp b/containments/taskpanel/taskpanel.cpp index 5c0fd801..a49ef718 100644 --- a/containments/taskpanel/taskpanel.cpp +++ b/containments/taskpanel/taskpanel.cpp @@ -21,10 +21,6 @@ #include #include -#include -#include -#include -#include #include @@ -47,35 +43,6 @@ TaskPanel::~TaskPanel() { } -void TaskPanel::executeScript(const QString &script) -{ - //Plasma::Package p = - QDBusMessage message = QDBusMessage::createMethodCall(s_kwinService, "/Scripting", QString(), "loadScript"); - QList arguments; - arguments << QVariant(package().filePath("scripts", script + ".js")); - message.setArguments(arguments); - QDBusPendingReply asyncCall = QDBusConnection::sessionBus().asyncCall(message); - - QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(asyncCall, this); - QObject::connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), - this, SLOT(loadScriptFinishedSlot(QDBusPendingCallWatcher*))); -} - -void TaskPanel::loadScriptFinishedSlot(QDBusPendingCallWatcher *watcher) -{ - QDBusMessage reply = watcher->reply(); - if (reply.type() == QDBusMessage::ErrorMessage) { - qWarning() << reply.errorMessage(); - } else { - const int id = reply.arguments().first().toInt(); - QDBusConnection::sessionBus().connect(s_kwinService, "/" + QString::number(id), QString(), "print", this, SLOT(print(QString))); - QDBusConnection::sessionBus().connect(s_kwinService, "/" + QString::number(id), QString(), "printError", this, SLOT(print(QString))); - QDBusMessage message = QDBusMessage::createMethodCall(s_kwinService, "/" + QString::number(id), QString(), "run"); - //fire blindly the call for now - reply = QDBusConnection::sessionBus().asyncCall(message); - } -} - void TaskPanel::requestShowingDesktop(bool showingDesktop) { if (!m_windowManagement) { @@ -108,11 +75,35 @@ void TaskPanel::initWayland() emit showingDesktopChanged(m_showingDesktop); } ); + connect(m_windowManagement, &PlasmaWindowManagement::activeWindowChanged, this, &TaskPanel::updateActiveWindow); + updateActiveWindow(); } ); registry->setup(); } +void TaskPanel::updateActiveWindow() +{ + if (!m_windowManagement) { + return; + } + m_activeWindow = m_windowManagement->activeWindow(); + // TODO: connect to closeableChanged, not needed right now as KWin doesn't provide this changeable + emit hasCloseableActiveWindowChanged(); +} + +bool TaskPanel::hasCloseableActiveWindow() const +{ + return m_activeWindow && m_activeWindow->isCloseable(); +} + +void TaskPanel::closeActiveWindow() +{ + if (m_activeWindow) { + m_activeWindow->requestClose(); + } +} + K_EXPORT_PLASMA_APPLET_WITH_JSON(taskpanel, TaskPanel, "metadata.json") #include "taskpanel.moc" diff --git a/containments/taskpanel/taskpanel.h b/containments/taskpanel/taskpanel.h index 7b73efdd..4e0ac3c7 100644 --- a/containments/taskpanel/taskpanel.h +++ b/containments/taskpanel/taskpanel.h @@ -24,13 +24,12 @@ #include -class QDBusPendingCallWatcher; - namespace KWayland { namespace Client { class PlasmaWindowManagement; +class PlasmaWindow; } } @@ -38,28 +37,31 @@ class TaskPanel : public Plasma::Containment { Q_OBJECT Q_PROPERTY(bool showDesktop READ isShowingDesktop WRITE requestShowingDesktop NOTIFY showingDesktopChanged) + Q_PROPERTY(bool hasCloseableActiveWindow READ hasCloseableActiveWindow NOTIFY hasCloseableActiveWindowChanged) public: TaskPanel( QObject *parent, const QVariantList &args ); ~TaskPanel(); - Q_INVOKABLE void executeScript(const QString &script); + Q_INVOKABLE void closeActiveWindow(); bool isShowingDesktop() const { return m_showingDesktop; } void requestShowingDesktop(bool showingDesktop); + bool hasCloseableActiveWindow() const; + Q_SIGNALS: void showingDesktopChanged(bool); - -private Q_SLOTS: - void loadScriptFinishedSlot(QDBusPendingCallWatcher *watcher); + void hasCloseableActiveWindowChanged(); private: void initWayland(); + void updateActiveWindow(); bool m_showingDesktop; KWayland::Client::PlasmaWindowManagement *m_windowManagement; + KWayland::Client::PlasmaWindow *m_activeWindow = nullptr; }; diff --git a/dbus/CMakeLists.txt b/dbus/CMakeLists.txt index 30124367..4120cdc7 100644 --- a/dbus/CMakeLists.txt +++ b/dbus/CMakeLists.txt @@ -1,9 +1,9 @@ -macro(satellite_install_dbus_service name) +macro(plasma_phone_install_dbus_service name) install(FILES ${name}.service DESTINATION ${CMAKE_INSTALL_FULL_SYSCONFDIR}/dbus-1/session.d) endmacro() -satellite_install_dbus_service(org.kde.kde5) -satellite_install_dbus_service(org.kde.kglobalaccel) -satellite_install_dbus_service(org.kde.klauncher5) -satellite_install_dbus_service(org.kde.kuiserver) +plasma_phone_install_dbus_service(org.kde.kde5) +plasma_phone_install_dbus_service(org.kde.kglobalaccel) +plasma_phone_install_dbus_service(org.kde.klauncher5) +plasma_phone_install_dbus_service(org.kde.kuiserver) diff --git a/look-and-feel/metadata.desktop b/look-and-feel/metadata.desktop index c6316e90..348a5490 100644 --- a/look-and-feel/metadata.desktop +++ b/look-and-feel/metadata.desktop @@ -1,5 +1,5 @@ [Desktop Entry] -Name=Satellite +Name=Plasma Phone Comment=Plasma workspace for smartphones Keywords=Phone, Workspace, Look and Feel Type=Service @@ -10,7 +10,7 @@ X-KDE-PluginInfo-Author= X-KDE-PluginInfo-Category= X-KDE-PluginInfo-Email= X-KDE-PluginInfo-License=GPLv2+ -X-KDE-PluginInfo-Name=org.kde.plasma.satellite +X-KDE-PluginInfo-Name=org.kde.plasma.phone X-KDE-PluginInfo-Version=0.1 X-KDE-PluginInfo-Website= X-Plasma-MainScript=defaults diff --git a/packaging/plasma-phone-components.spec b/packaging/plasma-phone-components.spec deleted file mode 100644 index 03d4b648..00000000 --- a/packaging/plasma-phone-components.spec +++ /dev/null @@ -1,151 +0,0 @@ -# -# Do NOT Edit the Auto-generated Part! -# Generated by: spectacle version 0.27 -# - -Name: plasma-phone-components - -# >> macros -# << macros - -Summary: Plasma Phone Components -Version: 0.2.2 -Release: 1 -Group: System/GUI/Other -License: GPLv2+ -URL: http://www.kde.org -Source0: %{name}-%{version}.tar.xz -Source100: plasma-phone-components.yaml -Requires: greenisland -Requires: plasma-workspace -Requires: plasma-workspace-wallpaper-image -Requires: plasma-desktop -Requires: breeze-icon-theme -Requires: oxygen-fonts -Requires: frameworkintegration -Requires: libqofono-qt5 -Requires: libqofono-qt5-declarative -Requires: voicecall-qt5 -Requires: voicecall-qt5-plugin-ofono -Requires: nemo-qml-plugin-contextkit-qt5 -Requires: tone-generator -BuildRequires: pkgconfig(Qt5Core) -BuildRequires: pkgconfig(Qt5DBus) -BuildRequires: pkgconfig(Qt5Xml) -BuildRequires: pkgconfig(Qt5Network) -BuildRequires: pkgconfig(Qt5Gui) -BuildRequires: pkgconfig(Qt5Widgets) -BuildRequires: pkgconfig(Qt5Test) -BuildRequires: pkgconfig(Qt5Qml) -BuildRequires: pkgconfig(Qt5Quick) -BuildRequires: pkgconfig(systemd) -BuildRequires: extra-cmake-modules -BuildRequires: kf5-rpm-macros -BuildRequires: qt5-tools -BuildRequires: plasma-devel - -%description -Plasma Phone Components. - - -%prep -%setup -q -n %{name}-%{version} - -# >> setup -# << setup - -%build -# >> build pre -%kf5_make -# << build pre - - - -# >> build post -# << build post - -%install -rm -rf %{buildroot} -# >> install pre -%kf5_make_install -# << install pre - -# >> install post - -# Script that runs the UI -# File with environment variables, used by compositor systemd unit -mkdir -p %{buildroot}%{_sharedstatedir}/environment/greenisland -cat > %{buildroot}%{_sharedstatedir}/environment/greenisland/greenisland.conf < %{buildroot}%{_sharedstatedir}/environment/plasma-phone/plasma-phone.conf < %{buildroot}%{_kf5_configdir}/kded5rc << EOF -[General] -CheckSycoca=false -EOF - -cat > %{buildroot}%{_kf5_configdir}/kdeglobals <> files -# << files diff --git a/packaging/plasma-phone-components.yaml b/packaging/plasma-phone-components.yaml deleted file mode 100644 index a334d17c..00000000 --- a/packaging/plasma-phone-components.yaml +++ /dev/null @@ -1,61 +0,0 @@ -Name : plasma-phone-components -Version : 0.2.2 -Release : 1 -Group : System/GUI/Other -License : GPLv2+ -Summary : Plasma Phone Components -Description : | - Plasma Phone Components. -URL : http://www.kde.org -Sources : - - "%{name}-%{version}.tar.xz" -SetupOptions: -q -n %{name}-%{version} - -Requires: - - greenisland - - plasma-workspace - - plasma-workspace-wallpaper-image - - plasma-desktop - - breeze-icon-theme - - oxygen-fonts - - frameworkintegration - - libqofono-qt5 - - libqofono-qt5-declarative - - voicecall-qt5 - - voicecall-qt5-plugin-ofono - - nemo-qml-plugin-contextkit-qt5 - - tone-generator - -PkgBR: - - extra-cmake-modules - - kf5-rpm-macros - - qt5-tools - - plasma-devel -PkgConfigBR: - - Qt5Core - - Qt5DBus - - Qt5Xml - - Qt5Network - - Qt5Gui - - Qt5Widgets - - Qt5Test - - Qt5Qml - - Qt5Quick - - systemd - -Configure: none -Builder: none - -Files: - - "%config %{_kf5_configdir}/kdeglobals" - - "%config %{_kf5_configdir}/kded5rc" - - "%{_bindir}/plasma-phone" - - "%{_kf5_sharedir}/plasma/*" - - "%{_kf5_sharedir}/wallpapers/*" - - "%{_kf5_sharedir}/settingsmodules/*" - - "%{_kf5_servicesdir}/*.desktop" - - "%{_sharedstatedir}/environment/greenisland/*" - - "%{_sharedstatedir}/environment/plasma-phone/*" - - "%{_libdir}/systemd/user/*" - - "%{_libdir}/systemd/user/user-session.target.wants/*" - - "%{_libdir}/qt5/qml/*" diff --git a/packaging/remotebuild b/packaging/remotebuild deleted file mode 100755 index 008cb0cc..00000000 --- a/packaging/remotebuild +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -gbs remotebuild -T home:plfiorini:phone diff --git a/services/CMakeLists.txt b/services/CMakeLists.txt index 31561f17..f0122473 100644 --- a/services/CMakeLists.txt +++ b/services/CMakeLists.txt @@ -3,17 +3,16 @@ pkg_check_modules(SYSTEMD systemd REQUIRED) execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=systemduserunitdir systemd OUTPUT_VARIABLE SYSTEMD_USER_UNIT_DIR) string(REGEX REPLACE "[ \t\n]+" "" SYSTEMD_USER_UNIT_DIR ${SYSTEMD_USER_UNIT_DIR}) -macro(satellite_install_service name) +macro(plasma_phone_install_service name) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${name}.service.cmake ${CMAKE_CURRENT_BINARY_DIR}/${name}.service) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${name}.service DESTINATION ${SYSTEMD_USER_UNIT_DIR}) endmacro() -satellite_install_service(kactivitymanagerd) -satellite_install_service(kded5) -satellite_install_service(kdeinit5) -satellite_install_service(kglobalaccel5) -satellite_install_service(kuiserver5) -satellite_install_service(plasma-phone-compositor) -satellite_install_service(plasma-phone-ui) -satellite_install_service(plasma-phone) +plasma_phone_install_service(kactivitymanagerd) +plasma_phone_install_service(kded5) +plasma_phone_install_service(kdeinit5) +plasma_phone_install_service(kglobalaccel5) +plasma_phone_install_service(kuiserver5) +plasma_phone_install_service(plasma-phone-ui) +plasma_phone_install_service(plasma-phone) diff --git a/services/README b/services/README new file mode 100644 index 00000000..3cb51ba6 --- /dev/null +++ b/services/README @@ -0,0 +1,9 @@ +This files are for systemd units. + +Our current implemention is based on top of the Ubuntu phone which +still uses upstart. So these files do nothing, but we're still keeping +them over here for now. + +The situation should be revisited in about 6 months. + +- 19th June 2015 diff --git a/services/plasma-phone-compositor.service.cmake b/services/plasma-phone-compositor.service.cmake deleted file mode 100644 index aa886a13..00000000 --- a/services/plasma-phone-compositor.service.cmake +++ /dev/null @@ -1,22 +0,0 @@ -# -# Copyright (C) 2014 Pier Luigi Fiorini -# -# Starts Green Island with the phone compositor plugin. -# - -[Unit] -Description=Green Island -Requires=dbus.socket pre-user-session.target -After=pre-user-session.target -Conflicts=maui-bootsplash.service - -[Service] -Type=notify -Environment=DBUS_SESSION_BUS_ADDRESS=unix:path=%t/dbus/user_bus_socket -EnvironmentFile=-/var/lib/environment/compositor/*.conf -EnvironmentFile=-/var/lib/environment/greenisland/*.conf -ExecStart=@CMAKE_INSTALL_FULL_BINDIR@/greenisland $LIPSTICK_OPTIONS -p org.kde.satellite.compositor.phone -Restart=on-failure - -[Install] -WantedBy=user-session.target diff --git a/services/plasma-phone-ui.service.cmake b/services/plasma-phone-ui.service.cmake index e16d45bd..8229f996 100644 --- a/services/plasma-phone-ui.service.cmake +++ b/services/plasma-phone-ui.service.cmake @@ -6,13 +6,13 @@ [Unit] Description=Plasma Phone UI -Requires=dbus.socket plasma-phone-compositor.service -After=plasma-phone-compositor.service +Requires=dbus.socket +After= [Service] Environment=DBUS_SESSION_BUS_ADDRESS=unix:path=%t/dbus/user_bus_socket EnvironmentFile=-/var/lib/environment/plasma-phone/*.conf -ExecStart=@CMAKE_INSTALL_FULL_BINDIR@/plasmashell -p org.kde.satellite.phone -n +ExecStart=@CMAKE_INSTALL_FULL_BINDIR@/plasmashell -p org.kde.plasma.phone -n ExecStop=@CMAKE_INSTALL_FULL_BINDIR@/kquitapp5 plasmashell Restart=on-failure BusName=org.kde.plasmashell diff --git a/settingsmodules/CMakeLists.txt b/settingsmodules/CMakeLists.txt index aa6f2d41..269ed3e3 100644 --- a/settingsmodules/CMakeLists.txt +++ b/settingsmodules/CMakeLists.txt @@ -1,4 +1,4 @@ -plasma_install_package(wireless org.kde.satellite.settings.wifi packages package) +plasma_install_package(wireless org.kde.plasma.phone.settings.wifi packages package) diff --git a/settingsmodules/wireless/metadata.desktop b/settingsmodules/wireless/metadata.desktop index 1091da5a..13063ac0 100644 --- a/settingsmodules/wireless/metadata.desktop +++ b/settingsmodules/wireless/metadata.desktop @@ -8,7 +8,7 @@ Icon=network-wireless X-KDE-ServiceTypes=Active/SettingsModule X-KDE-PluginInfo-Author=Marco Martin X-KDE-PluginInfo-Email=mart@kde.org -X-KDE-PluginInfo-Name=org.kde.satellite.settings.wifi +X-KDE-PluginInfo-Name=org.kde.plasma.phone.settings.wifi X-KDE-PluginInfo-Version=1.0 X-KDE-PluginInfo-Website= X-KDE-PluginInfo-Category=Networking diff --git a/shell/contents/defaults b/shell/contents/defaults index 8dc05ec7..a2d8500d 100644 --- a/shell/contents/defaults +++ b/shell/contents/defaults @@ -1,5 +1,5 @@ [kdeglobals][KDE] -LookAndFeelPackage=org.kde.satellite.phone +LookAndFeelPackage=org.kde.plasma.phone [Desktop] Containment=org.kde.phone.homescreen diff --git a/shell/contents/layout.js b/shell/contents/layout.js index c42e48f6..c1b48a5d 100644 --- a/shell/contents/layout.js +++ b/shell/contents/layout.js @@ -11,7 +11,7 @@ for (var j = 0; j < desktopsArray.length; j++) { desktopsArray[j].currentConfigGroup = ["Wallpaper", desktopsArray[j].wallpaperPlugin, "General"]; - desktopsArray[j].writeConfig("Image", "org.kde.satellite.lockers"); + desktopsArray[j].writeConfig("Image", "org.kde.plasma.phone.lockers"); } desktopsForActivity(id)[0].addWidget("org.kde.phone.notifications"); diff --git a/shell/contents/loader.qml b/shell/contents/loader.qml index 79546ccd..79e34f63 100644 --- a/shell/contents/loader.qml +++ b/shell/contents/loader.qml @@ -23,7 +23,7 @@ import QtQuick 2 Item { id: main - property string shell : "org.kde.satellite.phone" + property string shell : "org.kde.plasma.phone" property bool willing : true property int priority : 10 diff --git a/shell/metadata.desktop b/shell/metadata.desktop index c2a03e2c..e4027d15 100644 --- a/shell/metadata.desktop +++ b/shell/metadata.desktop @@ -8,7 +8,7 @@ X-KDE-PluginInfo-Author=Aaron Seigo X-KDE-PluginInfo-Category= X-KDE-PluginInfo-Email=aseigo@kde.org X-KDE-PluginInfo-License=GPLv2+ -X-KDE-PluginInfo-Name=org.kde.satellite.phone +X-KDE-PluginInfo-Name=org.kde.plasma.phone X-KDE-PluginInfo-Version=0.1 X-KDE-PluginInfo-Website= diff --git a/wallpaper/metadata.desktop b/wallpaper/metadata.desktop index d2ca3feb..efde647e 100644 --- a/wallpaper/metadata.desktop +++ b/wallpaper/metadata.desktop @@ -1,7 +1,7 @@ [Desktop Entry] -Name=Satellite Lockers +Name=Plasma Phone Lockers -X-KDE-PluginInfo-Name=org.kde.satellite.lockers +X-KDE-PluginInfo-Name=org.kde.plasma.phone.lockers X-KDE-PluginInfo-Author=Jens Reuterberg X-KDE-PluginInfo-Email=jens@ohyran.se X-KDE-PluginInfo-License=LGPLv3