Ability to add and delete notes.
This commit is contained in:
parent
ad45fb0a91
commit
b2284de2e1
5 changed files with 28 additions and 24 deletions
|
@ -12,6 +12,8 @@ You can preview some screenshots [here](https://www.scharel.name/harbour/nextclo
|
||||||
- Show the content of the notes
|
- Show the content of the notes
|
||||||
- Basic [Markdown](https://en.wikipedia.org/wiki/Markdown) rendering
|
- Basic [Markdown](https://en.wikipedia.org/wiki/Markdown) rendering
|
||||||
- Edit the notes content
|
- Edit the notes content
|
||||||
|
- Create new notes
|
||||||
|
- Delete notes
|
||||||
- Edit favorite property
|
- Edit favorite property
|
||||||
- Edit category property
|
- Edit category property
|
||||||
|
|
||||||
|
@ -19,8 +21,6 @@ You can preview some screenshots [here](https://www.scharel.name/harbour/nextclo
|
||||||
|
|
||||||
(The ordering represents the priority for the implementation)
|
(The ordering represents the priority for the implementation)
|
||||||
- Login screen for the nextcloud account (using the [Login Flow](https://docs.nextcloud.com/server/14/developer_manual/client_apis/LoginFlow/index.html) if possible)
|
- Login screen for the nextcloud account (using the [Login Flow](https://docs.nextcloud.com/server/14/developer_manual/client_apis/LoginFlow/index.html) if possible)
|
||||||
- Create new notes
|
|
||||||
- Delete notes
|
|
||||||
- Automatically push changes to the server while editing a note
|
- Automatically push changes to the server while editing a note
|
||||||
- Better [Markdown](https://en.wikipedia.org/wiki/Markdown) rendering
|
- Better [Markdown](https://en.wikipedia.org/wiki/Markdown) rendering
|
||||||
- Search in notes
|
- Search in notes
|
||||||
|
|
|
@ -5,7 +5,7 @@ Dialog {
|
||||||
id: page
|
id: page
|
||||||
|
|
||||||
onAccepted: {
|
onAccepted: {
|
||||||
account.updateNote(account.model.get(noteIndex).id, { 'category': categoryField.text, 'content': contentArea.text, 'favorite': favoriteButton.down } )
|
account.updateNote(account.model.get(noteIndex).id, { 'category': categoryField.text, 'content': contentArea.text, 'favorite': favoriteButton.selected } )
|
||||||
}
|
}
|
||||||
|
|
||||||
property var account
|
property var account
|
||||||
|
@ -17,10 +17,17 @@ Dialog {
|
||||||
contentHeight: column.height
|
contentHeight: column.height
|
||||||
|
|
||||||
PullDownMenu {
|
PullDownMenu {
|
||||||
quickSelect: true
|
/*MenuItem {
|
||||||
MenuItem {
|
|
||||||
text: qsTr("Markdown Cheatsheet")
|
text: qsTr("Markdown Cheatsheet")
|
||||||
onClicked: pageStack.push(Qt.resolvedUrl("MarkdownPage.qml"))
|
onClicked: pageStack.push(Qt.resolvedUrl("MarkdownPage.qml"))
|
||||||
|
}*/
|
||||||
|
MenuItem {
|
||||||
|
text: qsTr("Reset")
|
||||||
|
onClicked: {
|
||||||
|
categoryField.text = account.model.get(noteIndex).category
|
||||||
|
contentArea.text = account.model.get(noteIndex).content
|
||||||
|
favoriteButton.selected = account.model.get(noteIndex).favorite
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,10 +50,11 @@ Dialog {
|
||||||
width: parent.width - x
|
width: parent.width - x
|
||||||
IconButton {
|
IconButton {
|
||||||
id: favoriteButton
|
id: favoriteButton
|
||||||
|
property bool selected: account.model.get(noteIndex).favorite
|
||||||
width: Theme.iconSizeMedium
|
width: Theme.iconSizeMedium
|
||||||
icon.source: (account.model.get(noteIndex).favorite ? "image://theme/icon-m-favorite-selected?" : "image://theme/icon-m-favorite?") +
|
icon.source: (selected ? "image://theme/icon-m-favorite-selected?" : "image://theme/icon-m-favorite?") +
|
||||||
(favoriteButton.highlighted ? Theme.secondaryHighlightColor : Theme.secondaryColor)
|
(favoriteButton.highlighted ? Theme.secondaryHighlightColor : Theme.secondaryColor)
|
||||||
onClicked: account.model.get(noteIndex).favorite = !account.model.get(noteIndex).favorite
|
onClicked: selected = !selected
|
||||||
}
|
}
|
||||||
TextField {
|
TextField {
|
||||||
id: categoryField
|
id: categoryField
|
||||||
|
|
|
@ -6,11 +6,6 @@ Dialog {
|
||||||
|
|
||||||
acceptDestination: Qt.resolvedUrl("EditPage.qml")
|
acceptDestination: Qt.resolvedUrl("EditPage.qml")
|
||||||
acceptDestinationProperties: { account: account; noteIndex: noteIndex }
|
acceptDestinationProperties: { account: account; noteIndex: noteIndex }
|
||||||
/*onAcceptPendingChanged: {
|
|
||||||
if (acceptPending) {
|
|
||||||
acceptDestinationInstance.note = note
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
Component.onCompleted: acceptDestinationProperties = { account: account, noteIndex: noteIndex }//acceptDestinationInstance.note = note
|
Component.onCompleted: acceptDestinationProperties = { account: account, noteIndex: noteIndex }//acceptDestinationInstance.note = note
|
||||||
|
|
||||||
property var account
|
property var account
|
||||||
|
@ -31,14 +26,6 @@ Dialog {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
contentHeight: column.height
|
contentHeight: column.height
|
||||||
|
|
||||||
/*PullDownMenu {
|
|
||||||
quickSelect: true
|
|
||||||
MenuItem {
|
|
||||||
text: qsTr("Edit")
|
|
||||||
onClicked: pageStack.push(Qt.resolvedUrl("EditPage.qml"), { note: note } )
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
id: column
|
id: column
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
@ -60,7 +47,6 @@ Dialog {
|
||||||
for (var i=0; i < markdown.length; i++) {
|
for (var i=0; i < markdown.length; i++) {
|
||||||
text = text.replace(markdown[i].regex, markdown[i].replace)
|
text = text.replace(markdown[i].regex, markdown[i].replace)
|
||||||
}
|
}
|
||||||
console.log(text)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,6 +105,12 @@ Item {
|
||||||
break;
|
break;
|
||||||
case "DELETE":
|
case "DELETE":
|
||||||
console.log("Deleted a note")
|
console.log("Deleted a note")
|
||||||
|
for (var i = 0; i < model.count; i++) {
|
||||||
|
var listItem = model.get(i)
|
||||||
|
if (listItem.id === data.id){
|
||||||
|
model.remove(i)
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
console.log("Unsupported method: " + method)
|
console.log("Unsupported method: " + method)
|
||||||
|
|
|
@ -31,7 +31,7 @@ Page {
|
||||||
text: qsTr("Add note")
|
text: qsTr("Add note")
|
||||||
enabled: nextcloudAccounts.itemAt(appSettings.currentAccount) ? !nextcloudAccounts.itemAt(appSettings.currentAccount).busy : false
|
enabled: nextcloudAccounts.itemAt(appSettings.currentAccount) ? !nextcloudAccounts.itemAt(appSettings.currentAccount).busy : false
|
||||||
visible: appSettings.currentAccount >= 0
|
visible: appSettings.currentAccount >= 0
|
||||||
onClicked: console.log("Add note")
|
onClicked: nextcloudAccounts.itemAt(appSettings.currentAccount).createNote()
|
||||||
}
|
}
|
||||||
MenuItem {
|
MenuItem {
|
||||||
text: qsTr("Reload")
|
text: qsTr("Reload")
|
||||||
|
@ -50,7 +50,7 @@ Page {
|
||||||
}
|
}
|
||||||
|
|
||||||
header: PageHeader {
|
header: PageHeader {
|
||||||
title: qsTr("Nextclound Notes")
|
title: nextcloudAccounts.itemAt(appSettings.currentAccount).name //qsTr("Nextclound Notes")
|
||||||
description: nextcloudAccounts.itemAt(appSettings.currentAccount).username + "@" + nextcloudAccounts.itemAt(appSettings.currentAccount).server
|
description: nextcloudAccounts.itemAt(appSettings.currentAccount).username + "@" + nextcloudAccounts.itemAt(appSettings.currentAccount).server
|
||||||
/*SearchField {
|
/*SearchField {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
@ -130,7 +130,11 @@ Page {
|
||||||
}
|
}
|
||||||
MenuItem {
|
MenuItem {
|
||||||
text: qsTr("Delete")
|
text: qsTr("Delete")
|
||||||
onClicked: console.log("Delete note")
|
onClicked: {
|
||||||
|
note.remorseAction(qsTr("Deleting note"), function() {
|
||||||
|
nextcloudAccounts.itemAt(appSettings.currentAccount).deleteNote(id)
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue