diff --git a/harbour-nextcloudnotes.pro b/harbour-nextcloudnotes.pro index 8f0b754..0a1b543 100644 --- a/harbour-nextcloudnotes.pro +++ b/harbour-nextcloudnotes.pro @@ -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 diff --git a/qml/harbour-nextcloudnotes.qml b/qml/harbour-nextcloudnotes.qml index 585a648..fea0397 100644 --- a/qml/harbour-nextcloudnotes.qml +++ b/qml/harbour-nextcloudnotes.qml @@ -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) } diff --git a/qml/pages/EditPage.qml b/qml/pages/EditPage.qml index a2daa2a..09e1872 100644 --- a/qml/pages/EditPage.qml +++ b/qml/pages/EditPage.qml @@ -36,7 +36,7 @@ Dialog { width: parent.width// - 2*x DialogHeader { - title: account.model.get(noteIndex).title + //title: account.model.get(noteIndex).title } TextArea { diff --git a/qml/pages/NotesPage.qml b/qml/pages/NotesPage.qml index 564d0f1..9426dde 100644 --- a/qml/pages/NotesPage.qml +++ b/qml/pages/NotesPage.qml @@ -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 { diff --git a/qml/pages/SettingsPage.qml b/qml/pages/SettingsPage.qml index f417049..966b443 100644 --- a/qml/pages/SettingsPage.qml +++ b/qml/pages/SettingsPage.qml @@ -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 { diff --git a/translations/harbour-nextcloudnotes.ts b/translations/harbour-nextcloudnotes.ts index 08a121a..186fe4c 100644 --- a/translations/harbour-nextcloudnotes.ts +++ b/translations/harbour-nextcloudnotes.ts @@ -255,18 +255,6 @@ Appearance - - Date - - - - Category - - - - Group notes by - - Show separator @@ -287,6 +275,22 @@ every + + by Date + + + + by Category + + + + Sort notes + + + + Alphabetically + + UnencryptedDialog