399.1.5
by Nekhelesh Ramananthan
Revamped CalendarChoicePopup.qml file |
1 |
/*
|
400.1.2
by mihirsoni-123
updated copyright year |
2 |
* Copyright (C) 2013-2014 Canonical Ltd
|
399.1.5
by Nekhelesh Ramananthan
Revamped CalendarChoicePopup.qml file |
3 |
*
|
4 |
* This file is part of Ubuntu Calendar App
|
|
5 |
*
|
|
6 |
* Ubuntu Calendar App is free software: you can redistribute it and/or modify
|
|
7 |
* it under the terms of the GNU General Public License version 3 as
|
|
8 |
* published by the Free Software Foundation.
|
|
9 |
*
|
|
400.1.1
by mihirsoni-123
Added copyright header comments in all the pages |
10 |
* Ubuntu Calendar App is distributed in the hope that it will be useful,
|
399.1.5
by Nekhelesh Ramananthan
Revamped CalendarChoicePopup.qml file |
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13 |
* GNU General Public License for more details.
|
|
14 |
*
|
|
15 |
* You should have received a copy of the GNU General Public License
|
|
16 |
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17 |
*/
|
|
212.4.1
by Kunal Parmar
Initial version of Cal Management |
18 |
import QtQuick 2.0 |
399.1.4
by Nekhelesh Ramananthan
Transitioned to the new headers |
19 |
import Ubuntu.Components 1.1 |
20 |
import Ubuntu.Components.Popups 1.0 |
|
399.1.5
by Nekhelesh Ramananthan
Revamped CalendarChoicePopup.qml file |
21 |
import Ubuntu.Components.ListItems 1.0 as ListItem |
212.4.1
by Kunal Parmar
Initial version of Cal Management |
22 |
import QtOrganizer 5.0 |
23 |
||
24 |
Page { |
|
25 |
id: root
|
|
26 |
||
212.4.10
by Kunal Parmar
merge from trunk |
27 |
property var model; |
28 |
||
212.4.28
by Kunal Parmar
Timer approach |
29 |
signal collectionUpdated(); |
212.4.1
by Kunal Parmar
Initial version of Cal Management |
30 |
|
399.1.5
by Nekhelesh Ramananthan
Revamped CalendarChoicePopup.qml file |
31 |
visible: false |
32 |
title: i18n.tr("Calendars") |
|
33 |
||
399.1.4
by Nekhelesh Ramananthan
Transitioned to the new headers |
34 |
head { |
35 |
backAction: Action { |
|
36 |
text: i18n.tr("Back") |
|
37 |
iconName: "back" |
|
38 |
onTriggered: { |
|
399.1.6
by Nekhelesh Ramananthan
simplified pop() |
39 |
pop(); |
212.4.1
by Kunal Parmar
Initial version of Cal Management |
40 |
}
|
41 |
}
|
|
42 |
||
399.1.4
by Nekhelesh Ramananthan
Transitioned to the new headers |
43 |
actions: Action { |
44 |
text: i18n.tr("Save"); |
|
45 |
iconName: "save" |
|
46 |
onTriggered: { |
|
47 |
root.collectionUpdated(); |
|
399.1.6
by Nekhelesh Ramananthan
simplified pop() |
48 |
pop(); |
212.4.1
by Kunal Parmar
Initial version of Cal Management |
49 |
}
|
50 |
}
|
|
51 |
}
|
|
52 |
||
53 |
ListView { |
|
54 |
id: calendarsList
|
|
212.4.3
by Kunal Parmar
Refinement |
55 |
|
399.1.5
by Nekhelesh Ramananthan
Revamped CalendarChoicePopup.qml file |
56 |
anchors.fill: parent |
212.4.1
by Kunal Parmar
Initial version of Cal Management |
57 |
|
212.4.10
by Kunal Parmar
merge from trunk |
58 |
model : root.model.getCollections(); |
399.1.5
by Nekhelesh Ramananthan
Revamped CalendarChoicePopup.qml file |
59 |
delegate: ListItem.Standard { |
212.4.1
by Kunal Parmar
Initial version of Cal Management |
60 |
id: delegateComp
|
399.1.5
by Nekhelesh Ramananthan
Revamped CalendarChoicePopup.qml file |
61 |
|
62 |
UbuntuShape { |
|
63 |
id: calendarColorCode
|
|
64 |
||
65 |
width: parent.height |
|
66 |
height: width - units.gu(2) |
|
67 |
||
68 |
anchors { |
|
69 |
left: parent.left |
|
70 |
leftMargin: units.gu(2) |
|
71 |
verticalCenter: parent.verticalCenter |
|
72 |
}
|
|
73 |
||
74 |
color: modelData.color |
|
75 |
||
76 |
MouseArea{ |
|
77 |
anchors.fill: parent |
|
78 |
onClicked: { |
|
79 |
//popup dialog
|
|
80 |
var dialog = PopupUtils.open(Qt.resolvedUrl("ColorPickerDialog.qml"),root); |
|
81 |
dialog.accepted.connect(function(color) { |
|
212.4.28
by Kunal Parmar
Timer approach |
82 |
var collection = root.model.collection(modelData.collectionId); |
399.1.5
by Nekhelesh Ramananthan
Revamped CalendarChoicePopup.qml file |
83 |
collection.color = color; |
212.4.28
by Kunal Parmar
Timer approach |
84 |
root.model.saveCollection(collection); |
399.1.5
by Nekhelesh Ramananthan
Revamped CalendarChoicePopup.qml file |
85 |
})
|
212.4.1
by Kunal Parmar
Initial version of Cal Management |
86 |
}
|
87 |
}
|
|
399.1.5
by Nekhelesh Ramananthan
Revamped CalendarChoicePopup.qml file |
88 |
}
|
89 |
||
90 |
Label{ |
|
91 |
text: modelData.name |
|
92 |
elide: Text.ElideRight |
|
93 |
color: UbuntuColors.midAubergine |
|
94 |
anchors { |
|
95 |
left: calendarColorCode.right |
|
96 |
margins: units.gu(2) |
|
97 |
verticalCenter: parent.verticalCenter |
|
98 |
}
|
|
99 |
}
|
|
100 |
||
101 |
control: CheckBox { |
|
102 |
id: checkBox
|
|
103 |
checked: modelData.extendedMetaData("collection-selected") |
|
104 |
enabled: !root.isInEditMode |
|
105 |
onCheckedChanged: { |
|
399.1.2
by Kunal Parmar
Calendar list click behavior |
106 |
modelData.setExtendedMetaData("collection-selected",checkBox.checked) |
107 |
var collection = root.model.collection(modelData.collectionId); |
|
108 |
root.model.saveCollection(collection); |
|
109 |
}
|
|
212.4.1
by Kunal Parmar
Initial version of Cal Management |
110 |
}
|
111 |
}
|
|
112 |
}
|
|
113 |
}
|
|
399.1.5
by Nekhelesh Ramananthan
Revamped CalendarChoicePopup.qml file |
114 |