Implemented #20 List of existing categories.

This commit is contained in:
Scharel Clemens 2018-12-06 13:37:29 +01:00
parent 19da7035a9
commit 829c265234
6 changed files with 70 additions and 3 deletions

View file

@ -16,6 +16,7 @@ Dialog {
if (status === PageStatus.Active) {
note = account.getNote(note.id, false)
favoriteButton.selected = note.favorite
categoryRepeater.model = account.categories
}
}
@ -83,6 +84,36 @@ Dialog {
}
}
Flow {
x: Theme.horizontalPageMargin
width: parent.width - 2*x
spacing: Theme.paddingMedium
visible: categoryField.focus
Repeater {
id: categoryRepeater
model: account.categories
BackgroundItem {
width: categoryRectangle.width
height: categoryRectangle.height
Rectangle {
id: categoryRectangle
width: categoryLabel.width + Theme.paddingLarge
height: categoryLabel.height + Theme.paddingSmall
color: "transparent"
border.color: Theme.highlightColor
radius: height / 4
Label {
id: categoryLabel
anchors.centerIn: parent
text: modelData
color: Theme.primaryColor
font.pixelSize: Theme.fontSizeSmall
}
}
onClicked: categoryField.text = modelData
}
}
}
Row {
x: Theme.horizontalPageMargin
width: parent.width - x

View file

@ -31,6 +31,7 @@ Dialog {
onBusyChanged: {
if (account.busy === false) {
note = account.getNote(note.id, false)
categoryRepeater.model = account.categories
acceptDestinationProperties = { account: account, note: note }
parseContent()
}
@ -158,6 +159,36 @@ Dialog {
Column {
width: parent.width
Flow {
x: Theme.horizontalPageMargin
width: parent.width - 2*x
spacing: Theme.paddingMedium
visible: categoryField.focus
Repeater {
id: categoryRepeater
model: account.categories
BackgroundItem {
width: categoryRectangle.width
height: categoryRectangle.height
Rectangle {
id: categoryRectangle
width: categoryLabel.width + Theme.paddingLarge
height: categoryLabel.height + Theme.paddingSmall
color: "transparent"
border.color: Theme.highlightColor
radius: height / 4
Label {
id: categoryLabel
anchors.centerIn: parent
text: modelData
color: Theme.primaryColor
font.pixelSize: Theme.fontSizeSmall
}
}
onClicked: categoryField.text = modelData
}
}
}
Row {
x: Theme.horizontalPageMargin
width: parent.width - x
@ -188,7 +219,6 @@ Dialog {
}
}
}
DetailItem {
id: modifiedDetail
label: qsTr("Modified")

View file

@ -16,6 +16,7 @@ Item {
property var modelData: [ ]
property var model: ListModel { }
property var categories: [ ]
property string file: StandardPaths.data + "/" + uuid + ".json"
property bool saveFile: false
property bool busy: false
@ -221,7 +222,11 @@ Item {
break
}
if (!searchActive) {
categories = [ ]
for (var element in modelData) {
if (categories.indexOf(modelData[element].category) === -1 && modelData[element].category !== "" && typeof(modelData[element].category) !== 'undefined') {
categories.push(modelData[element].category)
}
model.set(element, modelData[element])
}
element++

View file

@ -83,7 +83,7 @@ Page {
anchors.right: parent.right
anchors.rightMargin: Theme.horizontalPageMargin
size: BusyIndicatorSize.Medium
running: nextcloudAccounts.itemAt(appSettings.currentAccount) ? nextcloudAccounts.itemAt(appSettings.currentAccount).busy : false
running: nextcloudAccounts.itemAt(appSettings.currentAccount) ? nextcloudAccounts.itemAt(appSettings.currentAccount).busy && !busyIndicator.running : false
}
}

View file

@ -14,6 +14,7 @@
* Thu Dec 06 2018 Scharel Clemens <harbour-nextcloudnotes@scharel.name> 0.1-8
- Fix for #19 "Strikethrough is not shown"
- Added #20 "List of existing categories"
* Wed Dec 05 2018 Scharel Clemens <harbour-nextcloudnotes@scharel.name> 0.1-7
- Fix for #17 "Indents break the tick box bug"

View file

@ -14,7 +14,7 @@ Name: harbour-nextcloudnotes
%{?qtc_builddir:%define _builddir %qtc_builddir}
Summary: Nextcloud Notes
Version: 0.1
Release: 7
Release: 8
Group: Qt/Qt
License: LICENSE
URL: http://example.org/