Small UI improvements during lunch time.

This commit is contained in:
Scharel 2018-10-17 12:58:55 +02:00
parent dcb487e0bf
commit a733c1150c
4 changed files with 40 additions and 19 deletions

View file

@ -13,7 +13,7 @@ ApplicationWindow
property string lastUpdate: qsTr("never") property string lastUpdate: qsTr("never")
property url server: "https://cloud.scharel.name" + "/index.php/apps/notes/api/v0.2/notes" property url server: "https://cloud.scharel.name" + "/index.php/apps/notes/api/v0.2/notes"
property string username: "test" property string username: "test"
property string password // TODO provide password before testing property string password: "9J4HQ-aq7b3-69fCY-4HpPj-69MPj" // TODO provide password before testing
} }
property var notes: NotesApi { property var notes: NotesApi {

View file

@ -30,7 +30,7 @@ Page {
EnterKey.iconSource: "image://theme/icon-m-enter-close" EnterKey.iconSource: "image://theme/icon-m-enter-close"
EnterKey.onClicked: focus = false EnterKey.onClicked: focus = false
enabled: notes.json.length > 0 enabled: false //notesList.count > 0 // TODO
} }
currentIndex: -1 currentIndex: -1
@ -44,12 +44,12 @@ Page {
delegate: ListItem { delegate: ListItem {
id: note id: note
contentHeight: Theme.itemSizeMedium contentHeight: titleLabel.height + previewLabel.height + 2*Theme.paddingSmall
IconButton { IconButton {
id: isFavoriteIcon id: isFavoriteIcon
x: Theme.horizontalPageMargin anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter anchors.top: titleLabel.top
width: Theme.iconSizeMedium width: Theme.iconSizeMedium
icon.source: (favorite ? "image://theme/icon-m-favorite-selected?" : "image://theme/icon-m-favorite?") + icon.source: (favorite ? "image://theme/icon-m-favorite-selected?" : "image://theme/icon-m-favorite?") +
(note.highlighted ? Theme.secondaryHighlightColor : Theme.secondaryColor) (note.highlighted ? Theme.secondaryHighlightColor : Theme.secondaryColor)
@ -65,36 +65,47 @@ Page {
anchors.left: isFavoriteIcon.right anchors.left: isFavoriteIcon.right
anchors.leftMargin: Theme.paddingSmall anchors.leftMargin: Theme.paddingSmall
anchors.right: parent.right anchors.right: parent.right
anchors.bottom: parent.verticalCenter anchors.rightMargin: Theme.horizontalPageMargin
anchors.top: parent.top
anchors.topMargin: Theme.paddingSmall
text: title text: title
truncationMode: TruncationMode.Fade truncationMode: TruncationMode.Fade
color: note.highlighted ? Theme.highlightColor : Theme.primaryColor color: note.highlighted ? Theme.highlightColor : Theme.primaryColor
} }
Label { Label {
id: modifiedLabel id: previewLabel
anchors.left: isFavoriteIcon.right anchors.left: isFavoriteIcon.right
anchors.leftMargin: Theme.paddingSmall anchors.leftMargin: Theme.paddingSmall
anchors.right: parent.right anchors.right: parent.right
anchors.top: parent.verticalCenter anchors.rightMargin: Theme.horizontalPageMargin
text: new Date(modified * 1000).toLocaleString(Qt.locale(), Locale.ShortFormat) anchors.top: titleLabel.bottom
anchors.bottomMargin: Theme.paddingSmall
text: content
font.pixelSize: Theme.fontSizeExtraSmall font.pixelSize: Theme.fontSizeExtraSmall
color: note.highlighted ? Theme.highlightColor : Theme.primaryColor wrapMode: Text.Wrap
maximumLineCount: 5
elide: Text.ElideRight
color: note.highlighted ? Theme.secondaryHighlightColor : Theme.secondaryColor
} }
onClicked: pageStack.push(Qt.resolvedUrl("NotePage.qml"), { note: notesList.model.get(index) } ) onClicked: pageStack.push(Qt.resolvedUrl("NotePage.qml"), { note: notesList.model.get(index) } )
menu: ContextMenu { menu: ContextMenu {
Text { /*Label {
id: descriptionText id: categoryLabel
width: parent.width - 2*Theme.horizontalPageMargin anchors.horizontalCenter: parent.horizontalCenter
height: contentHeight + Theme.paddingMedium text: (typeof category !== 'undefined') ? qsTr("Category") + ": " + category : ""
x: Theme.horizontalPageMargin
wrapMode: Text.Wrap
color: Theme.highlightColor
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
maximumLineCount: 5 color: Theme.highlightColor
text: content visible: text.length > 0
}*/
Label {
id: modifiedLabel
anchors.horizontalCenter: parent.horizontalCenter
text: qsTr("Modified") + ": " + new Date(modified * 1000).toLocaleString(Qt.locale(), Locale.ShortFormat)
font.pixelSize: Theme.fontSizeSmall
color: Theme.highlightColor
} }
MenuItem { MenuItem {
text: qsTr("Delete") text: qsTr("Delete")

View file

@ -36,6 +36,12 @@ Item {
model.append(elements[element]) model.append(elements[element])
} }
} }
else if (apiReq.status === 304) {
console.log("ETag does not differ!")
}
else if (apiReq.status === 401) {
console.log("Unauthorized!")
}
else if (apiReq.status === 404) { else if (apiReq.status === 404) {
console.log("Note does not exist!") console.log("Note does not exist!")
} }

View file

@ -38,6 +38,10 @@
<source>Pull down to add a note</source> <source>Pull down to add a note</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Modified</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>harbour-nextcloudnotes</name> <name>harbour-nextcloudnotes</name>