mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
improve activities applet
add it by default in panel
This commit is contained in:
parent
bd07bf8ff3
commit
43f05e4cae
3 changed files with 74 additions and 14 deletions
|
|
@ -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() {});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
Loading…
Reference in a new issue