Small UI improvements

This commit is contained in:
Scharel Clemens 2018-11-25 14:08:00 +01:00
parent 7f27a87aa3
commit e600a72036
6 changed files with 59 additions and 50 deletions

View file

@ -18,7 +18,6 @@ SOURCES += src/harbour-nextcloudnotes.cpp
DISTFILES += qml/harbour-nextcloudnotes.qml \
qml/cover/CoverPage.qml \
qml/pages/NotesApi.qml \
rpm/harbour-nextcloudnotes.changes.in \
rpm/harbour-nextcloudnotes.changes.run.in \
rpm/harbour-nextcloudnotes.spec \
@ -32,7 +31,8 @@ DISTFILES += qml/harbour-nextcloudnotes.qml \
qml/pages/SettingsPage.qml \
qml/pages/AboutPage.qml \
qml/pages/MarkdownPage.qml \
qml/pages/UnencryptedDialog.qml
qml/pages/UnencryptedDialog.qml \
qml/pages/NotesApi.qml
SAILFISHAPP_ICONS = 86x86 108x108 128x128 172x172

View file

@ -15,7 +15,7 @@ ApplicationWindow
property int currentAccount: value("currentAccount", -1)
property int autoSyncInterval: value("autoSyncInterval", 0)
property int previewLineCount: value("previewLineCount", 4)
property string groupBy: value("groupBy", "date")
property string sortBy: value("sortBy", "date")
property bool showSeparator: value("showSeparator", false)
}

View file

@ -36,7 +36,7 @@ Dialog {
width: parent.width// - 2*x
DialogHeader {
title: account.model.get(noteIndex).title
//title: account.model.get(noteIndex).title
}
TextArea {

View file

@ -61,11 +61,11 @@ Page {
header: PageHeader {
title: nextcloudAccounts.itemAt(appSettings.currentAccount).name //qsTr("Nextclound Notes")
description: nextcloudAccounts.itemAt(appSettings.currentAccount).username + "@" + nextcloudAccounts.itemAt(appSettings.currentAccount).server
/*BusyIndicator {
running: nextcloudAccounts.itemAt(appSettings.currentAccount) ? nextcloudAccounts.itemAt(appSettings.currentAccount).busy : false
BusyIndicator {
x: Theme.horizontalPageMargin
anchors.verticalCenter: parent.verticalCenter
}*/
running: nextcloudAccounts.itemAt(appSettings.currentAccount) ? nextcloudAccounts.itemAt(appSettings.currentAccount).busy && !busyIndicator.running : false
}
/*SearchField {
width: parent.width
@ -85,9 +85,21 @@ Page {
onCurrentAccountChanged: notesList.model = nextcloudAccounts.itemAt(appSettings.currentAccount)? nextcloudAccounts.itemAt(appSettings.currentAccount).model : 0
}
delegate: ListItem {
delegate: BackgroundItem {
id: note
contentHeight: titleLabel.height + previewLabel.height + 2*Theme.paddingSmall
height: contentHeight + menu.height
width: parent.width
highlighted: down || menu.active
ListView.onAdd: AddAnimation {
target: note
}
ListView.onRemove: RemoveAnimation {
target: note
}
RemorseItem {
id: remorse
}
Separator {
width: parent.width
@ -112,8 +124,7 @@ Page {
id: titleLabel
anchors.left: isFavoriteIcon.right
anchors.leftMargin: Theme.paddingSmall
anchors.right: categoryRectangle.left
anchors.rightMargin: Theme.horizontalPageMargin
anchors.right: categoryRectangle.visible ? categoryRectangle.left : parent.right
anchors.top: parent.top
text: title
truncationMode: TruncationMode.Fade
@ -131,7 +142,7 @@ Page {
color: "transparent"
border.color: Theme.highlightColor
radius: height / 4
visible: appSettings.groupBy !== "category" && categoryLabel.text.length > 0
visible: appSettings.sortBy !== "category" && categoryLabel.text.length > 0
Label {
id: categoryLabel
anchors.centerIn: parent
@ -164,20 +175,21 @@ Page {
}
}
onClicked: pageStack.push(Qt.resolvedUrl("NotePage.qml"), { account: nextcloudAccounts.itemAt(appSettings.currentAccount), noteIndex: index } )
onClicked: pageStack.push(Qt.resolvedUrl("NotePage.qml"),
{ account: nextcloudAccounts.itemAt(appSettings.currentAccount), noteIndex: index } )
onPressAndHold: menu.open(note)
menu: ContextMenu {
Label {
ContextMenu {
id: menu
MenuLabel {
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 {
text: qsTr("Delete")
onClicked: {
note.remorseAction(qsTr("Deleting note"), function() {
remorse.execute(note, qsTr("Deleting note"), function() {
nextcloudAccounts.itemAt(appSettings.currentAccount).deleteNote(id)
})
}
@ -185,16 +197,9 @@ Page {
}
}
/*section.property: "category"
section.criteria: ViewSection.FullString
section.labelPositioning: ViewSection.InlineLabels
section.delegate: SectionHeader {
text: section
}*/
section.property: appSettings.groupBy
section.criteria: ViewSection.FullString
section.labelPositioning: ViewSection.InlineLabels
section.property: appSettings.sortBy
section.criteria: appSettings.sortBy === "title" ? ViewSection.FirstCharacter : ViewSection.FullString
section.labelPositioning: appSettings.sortBy === "title" ? ViewSection.FirstCharacter : ViewSection.InlineLabels
section.delegate: SectionHeader {
text: section
}
@ -203,8 +208,7 @@ Page {
id: busyIndicator
anchors.centerIn: parent
size: BusyIndicatorSize.Large
visible: nextcloudAccounts.itemAt(appSettings.currentAccount) ? (notesList.count === 0 && nextcloudAccounts.itemAt(appSettings.currentAccount).busy) : false
running: visible
running: nextcloudAccounts.itemAt(appSettings.currentAccount) ? (notesList.count === 0 && nextcloudAccounts.itemAt(appSettings.currentAccount).busy) : false
}
ViewPlaceholder {

View file

@ -99,25 +99,26 @@ Page {
text: qsTr("Appearance")
}
ComboBox {
id: groupByComboBox
property var names: [qsTr("Date"), qsTr("Category")]
label: qsTr("Group notes by")
id: sortByComboBox
property var names: [qsTr("by Date"), qsTr("by Category"), qsTr("Alphabetically")]
label: qsTr("Sort notes")
menu: ContextMenu {
Repeater {
id: groupByRepeater
model: ["date", "category"]
id: sortByRepeater
model: ["date", "category", "title"]
MenuItem {
text: groupByComboBox.names[index]
text: sortByComboBox.names[index]
//enabled: modelData !== "title"
Component.onCompleted: {
if (modelData === appSettings.groupBy) {
groupByComboBox.currentIndex = index
if (modelData === appSettings.sortBy) {
sortByComboBox.currentIndex = index
}
}
}
}
}
onCurrentIndexChanged: {
appSettings.groupBy = groupByRepeater.model[currentIndex]
appSettings.sortBy = sortByRepeater.model[currentIndex]
}
}
TextSwitch {

View file

@ -255,18 +255,6 @@
<source>Appearance</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Date</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Category</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Group notes by</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Show separator</source>
<translation type="unfinished"></translation>
@ -287,6 +275,22 @@
<source>every</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>by Date</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>by Category</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Sort notes</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Alphabetically</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>UnencryptedDialog</name>