115 lines
3.2 KiB
QML
115 lines
3.2 KiB
QML
/*
|
|
* Copyright 2012-2018 Morgan McMillian <gilag@monkeystew.com>
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
import bb.cascades 1.0
|
|
|
|
Page {
|
|
id: taskPage
|
|
signal itemUpdate(int idx, string text)
|
|
signal setValue(int idx, string key, variant value)
|
|
signal delTask(int idx)
|
|
property alias title: titleBar.title
|
|
property string itemtext
|
|
property variant idx
|
|
property bool complete
|
|
titleBar: TitleBar {
|
|
id: titleBar
|
|
title: " Task"
|
|
}
|
|
Container {
|
|
layout: DockLayout {
|
|
}
|
|
Container {
|
|
topPadding: 30
|
|
leftPadding: 30
|
|
rightPadding: 30
|
|
Label {
|
|
id: taskText
|
|
multiline: true
|
|
text: itemtext
|
|
}
|
|
}
|
|
}
|
|
actions: [
|
|
ActionItem {
|
|
title: "Edit"
|
|
imageSource: "icons/Pencil.png"
|
|
ActionBar.placement: ActionBarPlacement.OnBar
|
|
onTriggered: {
|
|
editItem.open()
|
|
editItem.newtask = false
|
|
editItem.text = itemtext
|
|
editItem.labels.removeAll();
|
|
for (var i = 0; i < taskModel.filters.length; i ++) {
|
|
var o = opt.createObject();
|
|
o.text = taskModel.filters[i].title;
|
|
o.value = taskModel.filters[i].title;
|
|
editItem.labels.add(o);
|
|
}
|
|
editItem.textfield.requestFocus()
|
|
}
|
|
},
|
|
ActionItem {
|
|
title: "Complete"
|
|
imageSource: "icons/Check.png"
|
|
enabled: complete ? false : true
|
|
onTriggered: {
|
|
setValue(idx, "complete", true)
|
|
navi.pop()
|
|
}
|
|
},
|
|
ActionItem {
|
|
title: "Undo Complete"
|
|
imageSource: "icons/Undo.png"
|
|
enabled: complete
|
|
onTriggered: {
|
|
setValue(idx, "complete", false)
|
|
navi.pop()
|
|
}
|
|
},
|
|
InvokeActionItem {
|
|
title: "Share"
|
|
query {
|
|
mimeType: "text/plain"
|
|
invokeActionId: "bb.action.SHARE"
|
|
}
|
|
data: itemtext
|
|
},
|
|
DeleteActionItem {
|
|
title: "Delete"
|
|
onTriggered: {
|
|
delTask(idx)
|
|
navi.pop()
|
|
}
|
|
}
|
|
]
|
|
attachedObjects: [
|
|
EditSheet {
|
|
id: editItem
|
|
title: "Edit"
|
|
onSaveTask: {
|
|
itemUpdate(idx, text)
|
|
itemtext = text
|
|
}
|
|
},
|
|
ComponentDefinition {
|
|
id: opt
|
|
Option {
|
|
}
|
|
}
|
|
]
|
|
}
|