mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-08-03 10:14:45 +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.plasma.components 2.0 as PlasmaComponents
|
||||||
import org.kde.activities 0.1 as Activities
|
import org.kde.activities 0.1 as Activities
|
||||||
|
|
||||||
ListView {
|
ColumnLayout {
|
||||||
id: listView
|
ListView {
|
||||||
model: Activities.ActivityModel {
|
id: listView
|
||||||
id: activityModel
|
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 {}
|
PlasmaComponents.ToolButton {
|
||||||
delegate: PlasmaComponents.Label {
|
Layout.fillWidth: true
|
||||||
text: model.name
|
text: i18n("New Activity...")
|
||||||
width: listView.width
|
onClicked: {
|
||||||
MouseArea {
|
newEdit.visible = true;
|
||||||
anchors.fill: parent
|
newEdit.forceActiveFocus();
|
||||||
onClicked: {
|
}
|
||||||
listView.currentIndex = index;
|
PlasmaComponents.TextField {
|
||||||
activityModel.setCurrentActivity(model.id, function() {});
|
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
|
Name=Phone Activities
|
||||||
|
|
||||||
Comment=Activity switcher for the phone
|
Comment=Activity switcher for the phone
|
||||||
Icon=start-here-symbolic
|
Icon=preferences-activities
|
||||||
Type=Service
|
Type=Service
|
||||||
X-KDE-ParentApp=
|
X-KDE-ParentApp=
|
||||||
X-KDE-PluginInfo-Author=Marco Martin
|
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.networkmanagement");
|
||||||
panel.addWidget("org.kde.plasma.battery");
|
panel.addWidget("org.kde.plasma.battery");
|
||||||
panel.addWidget("org.kde.plasma.volume");
|
panel.addWidget("org.kde.plasma.volume");
|
||||||
|
panel.addWidget("org.kde.phone.activities");
|
||||||
panel.height = 60;
|
panel.height = 60;
|
||||||
|
|
||||||
var bottomPanel = new Panel("org.kde.phone.taskpanel");
|
var bottomPanel = new Panel("org.kde.phone.taskpanel");
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue