harbour-quill 0.2.12: note markdown con sync WebDAV
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
import QtQuick 2.2
|
||||
import Sailfish.Silica 1.0
|
||||
|
||||
Dialog {
|
||||
id: dialog
|
||||
|
||||
property var dav
|
||||
property string resultPath: ""
|
||||
property string resultName: ""
|
||||
|
||||
canAccept: nameField.text.length > 0
|
||||
|
||||
onAccepted: {
|
||||
var name = nameField.text.trim()
|
||||
if (!name) return
|
||||
var lower = name.toLowerCase()
|
||||
var hasExt = lower.indexOf(".md") === lower.length - 3
|
||||
resultName = hasExt ? name : name + ".md"
|
||||
resultPath = resultName
|
||||
dav.writeFile(resultPath, "# " + resultName.replace(/\.md$/, "") + "\n\n")
|
||||
}
|
||||
|
||||
Column {
|
||||
width: parent.width
|
||||
|
||||
DialogHeader { title: qsTr("New note") }
|
||||
|
||||
TextField {
|
||||
id: nameField
|
||||
width: parent.width
|
||||
label: qsTr("Name")
|
||||
placeholderText: qsTr("e.g. Idea")
|
||||
EnterKey.enabled: text.length > 0
|
||||
EnterKey.onClicked: dialog.accept()
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user