123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147 |
- // import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
- import QtQuick 1.1
- import "../js/core.js" as Core
- import "../parts/"
- KPage {
- id: root
- property alias title: karmaTitle.text;
- property alias description: karmaDesc.text;
- property int points: 0 //: pointsSelection.text;
- property int karmaId: 0// listpanel.karmaId
- property variant indexmap: { "10": 0, '5': 1, '3': 2, '2': 3, '1': 4, '0': 5, '-1': 6, '-2': 7, '-3': 8, '-5': 9, '-10': 10 }
- Rectangle{
- anchors.fill: parent
- color: "#e1ecef"
- }
- anchors.fill:parent
- Flickable{
- id: flick
- width: parent.width; height: parent.height-titlebar.height
- contentWidth: parent.width;
- contentHeight: 700
- anchors.top: titlebar.bottom
- anchors.bottom: toolbar.top
- Column {
- id: grid1
- spacing: 20
- anchors{
- top:parent.top
- left: parent.left
- right: parent.right
- margins: 10
- }
- KLabel{id:intro; text:qsTr("You are goint to add a karma fact for:"); }
- Row{
- Image {
- id: selectImage
- width: 128
- height: 128
- source: "qrc:/violet/face"
- MouseArea{
- anchors.fill: parent;
- onClicked: pageStack.push(Qt.resolvedUrl("ImageSelectionDialog.qml"))
- }
- }
- KLabel{
- id:name;
- text:qsTr("Person name");
- anchors.verticalCenter: parent.verticalCenter
- }
- }
- KLabel{id:title; text:qsTr("Title"); }
- KTextInput{
- id:karmaTitle;
- width: parent.width
- focus: true
- }
- KLabel{text:qsTr("Points");}
- KButton {
- id: pointsSelection
- text: selectionDialog.model.get(indexmap[points]).modelData
- width:parent.width
- onClicked: {
- selectionDialog.visible=true
- }
- }
- /* TextEdit{
- id: pointsSelection s
- text: selectionDialog.model.get(indexmap[points]).modelData
- readOnly: true
- MouseArea{
- anchors.fill: parent;
- onClicked: selectionDialog.visible=true;
- }
- KarmaSelectionDialog {
- id: selectionDialog
- onAccepted :{
- pointsSelection.text = model.get(selectedIndex).modelData;
- points = model.get(selectedIndex).value;
- pointsSelection.cursorPosition= 0
- }
- }
- MouseArea{
- anchors.fill: parent;
- onClicked: selectionDialog.visible=true;
- }
- }*/
- KLabel{id:desc; text:qsTr("Description"); }
- KTextArea{
- id:karmaDesc;
- width: parent.width
- }
- }
- }
- //Page layout is divided in 3
- TitleBar{
- id: titlebar
- }
- KToolBar{
- id: toolbar
- KButton{
- text:qsTr("Cancel")
- onClicked: pageStack.pop();
- }
- KButton{
- text:qsTr("Ok")
- onClicked: {
- if (karmaId==0){
- var item = Core.defaultItem();
- item.points = points;
- item.title = root.title;
- item.description = description;
- Core.createKarma(item);
- //updateUi();
- }
- else{
- update();
- updateUi();
- }
- pageStack.pop();
- }
- }
- }
- KarmaSelectionDialog{
- id: selectionDialog
- onAccepted: points=selectionDialog.currentValue
- }
- }
|