2
* Copyright: 2013 - 2014 Canonical, Ltd
4
* This file is part of reminders
6
* reminders is free software: you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; version 3.
10
* reminders is distributed in the hope that it will be useful,
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.
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/>.
20
import Ubuntu.Components 1.1
21
import Ubuntu.Components.ListItems 1.0
23
import "../components"
27
objectName: 'tagsPage'
29
property bool narrowMode
31
signal openTaggedNotes(string title, string tagGuid, bool narrowMode)
35
// We really want to refresh notes, not tags here.
36
// If a new tag appears on a note, the plugin will automatically update tags
37
// but just refreshing tags alone wouldn't update the tag count because we
38
// still wouldn't know on which notes the tags are attached.
39
NotesStore.refreshNotes();
40
// Lets refresh tags nevertheless for the unlikely case that the user added
41
// a tag alone without attaching it to a note from another app (You can't do
42
// that in the webinterface)
47
// tools: ToolbarItems {
50
// objectName: "addNotebookButton"
51
// text: i18n.tr("Add notebook")
54
// contentColumn.newNotebook = true;
61
// text: i18n.tr("Search")
64
// pagestack.push(Qt.resolvedUrl("SearchNotesPage.qml"))
71
// text: i18n.tr("Refresh")
74
// NotesStore.refreshNotebooks();
81
// text: i18n.tr("Accounts")
82
// iconName: "contacts-app-symbolic"
83
// visible: accounts.count > 1
85
// openAccountPage(true);
98
property bool newNotebook: false
102
// name: "newNotebook"; when: contentColumn.newNotebook
103
// PropertyChanges { target: newNotebookContainer; opacity: 1; height: newNotebookContainer.implicitHeight }
104
// PropertyChanges { target: buttonRow; opacity: 1; height: cancelButton.height + units.gu(4) }
109
// id: newNotebookContainer
111
// visible: opacity > 0
115
// Behavior on height {
116
// UbuntuNumberAnimation {}
118
// Behavior on opacity {
119
// UbuntuNumberAnimation {}
122
// onVisibleChanged: {
123
// newNoteTitleTextField.forceActiveFocus();
127
// id: newNoteTitleTextField
128
// objectName: "newNoteTitleTextField"
129
// anchors { left: parent.left; right: parent.right; margins: units.gu(2); verticalCenter: parent.verticalCenter }
135
objectName: "tagsListView"
137
anchors { left: parent.left; right: parent.right }
138
height: parent.height - y - buttonRow.height - keyboardRect.height
142
NotesStore.refreshTags();
145
delegate: TagsDelegate {
147
print("selected tag:", model.guid)
148
root.openTaggedNotes(name, model.guid, narrowMode)
153
anchors.centerIn: parent
154
running: tags.loading
159
anchors.centerIn: parent
160
width: parent.width - units.gu(4)
161
wrapMode: Text.WordWrap
162
horizontalAlignment: Text.AlignHCenter
163
visible: !tags.loading && tags.error
170
anchors.centerIn: parent
171
visible: !tags.loading && (tags.error || tagsListView.count == 0)
172
width: parent.width - units.gu(4)
173
wrapMode: Text.WordWrap
174
horizontalAlignment: Text.AlignHCenter
175
text: tags.error ? tags.error : i18n.tr("No tags available. You can tag notes while viewing them.")
180
anchors { left: parent.left; right: parent.right; margins: units.gu(2) }
186
UbuntuNumberAnimation {}
191
anchors { left: parent.left; verticalCenter: parent.verticalCenter }
192
text: i18n.tr("Cancel")
194
newNoteTitleTextField.text = "";
195
contentColumn.newNotebook = false
199
objectName: "saveButton"
200
anchors { right: parent.right; verticalCenter: parent.verticalCenter }
201
text: i18n.tr("Save")
202
enabled: newNoteTitleTextField.text.length > 0
204
NotesStore.createNotebook(newNoteTitleTextField.text);
205
newNoteTitleTextField.text = "";
206
contentColumn.newNotebook = false
212
anchors { left: parent.left; right: parent.right }
213
height: Qt.inputMethod.keyboardRectangle.height