diff --git a/applets/activities/contents/ui/main.qml b/applets/activities/contents/ui/main.qml index c7eebf60..dcf0c473 100644 --- a/applets/activities/contents/ui/main.qml +++ b/applets/activities/contents/ui/main.qml @@ -23,20 +23,79 @@ import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.components 2.0 as PlasmaComponents import org.kde.activities 0.1 as Activities -ListView { - id: listView - model: Activities.ActivityModel { - id: activityModel +ColumnLayout { + ListView { + id: listView + Layout.fillWidth: true + Layout.fillHeight: true + model: Activities.ActivityModel { + id: activityModel + } + highlight: PlasmaComponents.Highlight {} + delegate: MouseArea { + width: listView.width + height: label.height + onClicked: { + listView.currentIndex = index; + activityModel.setCurrentActivity(model.id, function() {}); + } + onPressAndHold: { + edit.visible = true + edit.focus = true + } + onReleased: { + if (edit.visible) { + edit.focus = true + edit.forceActiveFocus() + } + } + PlasmaComponents.Label { + id: label + text: model.name + x: units.smallSpacing + } + PlasmaComponents.TextField { + id: edit + visible: false + text: model.name + width: parent.width + onFocusChanged: { + if (!focus) { + visible = false + } + } + onAccepted: { + if (text != "") { + activityModel.setActivityName(model.id, text, function() {visible = false}); + } + } + } + } } - highlight: PlasmaComponents.Highlight {} - delegate: PlasmaComponents.Label { - text: model.name - width: listView.width - MouseArea { - anchors.fill: parent - onClicked: { - listView.currentIndex = index; - activityModel.setCurrentActivity(model.id, function() {}); + PlasmaComponents.ToolButton { + Layout.fillWidth: true + text: i18n("New Activity...") + onClicked: { + newEdit.visible = true; + newEdit.forceActiveFocus(); + } + PlasmaComponents.TextField { + id: newEdit + visible: false + width: parent.width + onFocusChanged: { + if (!focus) { + visible = false + } + } + onAccepted: { + if (text != "") { + activityModel.addActivity(text, function(id) { + visible = false; + print("AAA"+id) + activityModel.setCurrentActivity(id, function() {}); + }); + } } } } diff --git a/applets/activities/metadata.desktop b/applets/activities/metadata.desktop index d25921a2..765f8b67 100644 --- a/applets/activities/metadata.desktop +++ b/applets/activities/metadata.desktop @@ -3,7 +3,7 @@ Encoding=UTF-8 Name=Phone Activities Comment=Activity switcher for the phone -Icon=start-here-symbolic +Icon=preferences-activities Type=Service X-KDE-ParentApp= X-KDE-PluginInfo-Author=Marco Martin diff --git a/shell/contents/layout.js b/shell/contents/layout.js index bc44beb2..4304d939 100644 --- a/shell/contents/layout.js +++ b/shell/contents/layout.js @@ -16,6 +16,7 @@ panel.addWidget("org.kde.plasma.notifications"); panel.addWidget("org.kde.plasma.networkmanagement"); panel.addWidget("org.kde.plasma.battery"); panel.addWidget("org.kde.plasma.volume"); +panel.addWidget("org.kde.phone.activities"); panel.height = 60; var bottomPanel = new Panel("org.kde.phone.taskpanel");