<commit_before>import QtQuick 2.0
import Sailfish.Silica 1.0


Page {
    id: editpage
    property variant targetNote;
    property string selectedNotebookGuid;
    property date selectedDate;
    property date selectedTime;
    Timer {
        interval: 1
        running: true
        onTriggered: {
            Cache.fillWithNotebooks()
            selectedNotebookGuid = targetNote.notebookGUID
            console.log(targetNote.reminder)
        }
    }
    Connections {
        target: Cache
        onNotebookFired: {
            notebooksmodel.append(notebook)
            if (targetNote.notebookGUID == notebook.guid)
            {
                notesbox.currentIndex = notebooksmodel.count - 1
            }
        }
    }


    SilicaFlickable {
        anchors.fill: parent
        contentHeight: areacol.height
        PullDownMenu {
            MenuItem {
                text: "Help"
                onClicked: {
                    pageStack.push(Qt.resolvedUrl("help/EditContent.qml"));
                }
            }
            MenuItem {
                text: "Save"
                onClicked: {
                    targetNote.title = txtTitle.text
                    targetNote.noteContent = notearea.text
                    targetNote.notebookGUID = selectedNotebookGuid
                    var combdate = new Date(selectedDate.getFullYear(),
                                            selectedDate.getMonth(),
                                            selectedDate.getDate(),
                                            selectedTime.getHours(),
                                            selectedTime.getMinutes())
                    targetNote.reminder = combdate
                    EvernoteSession.updateNote(targetNote)
                    pageStack.pop()
                    EvernoteSession.syncAsync()
                    EvernoteSession.getNoteContentAsync(targetNote)
                }
            }
        }
        Column {
            id: areacol
            width: parent.width
            PageHeader {
                title: "Edit note"
            }
            TextField {
                id: txtTitle
                text: targetNote.title
            }

            ComboBox {
                label: "Notebook"
                id: notesbox
                menu: ContextMenu {
                    Repeater {
                        model: ListModel { id: notebooksmodel }
                        MenuItem {
                            text: name
                            onClicked: {
                                selectedNotebookGuid = guid
                            }
                        }
                    }
                }
            }
            SectionHeader {
                text: "Reminder"
            }
            Row {
                spacing: 80
                Button {
                    text: "Time"
                    onClicked: {
                        var date = targetNote.reminder || new Date()
                        var dialog = pageStack.openDialog("Sailfish.Silica.TimePickerDialog", {
                            hourMode: DateTime.TwentyFourHours,
                            hour: date.getHours(),
                            minute: date.getMinutes()
                        })
                        dialog.accepted.connect(function() {
                            selectedTime = dialog.time
                        })
                    }
                }
                Button {
                    text: "Date"
                    onClicked: {
                        var date = targetNote.reminder || new Date()

                        var dialog = pageStack.openDialog("Sailfish.Silica.DatePickerDialog", {
                            day: date.getDate(),
                            month: date.getMonth() + 1,
                            year: date.getFullYear()
                        })

                        dialog.accepted.connect(function() {
                            selectedDate = dialog.date
                        })
                    }

                }
            }

            TextArea {
                width: parent.width
                text: targetNote.noteContent
                id: notearea
            }
        }
    }
}<commit_msg>Set as rich text by default.<commit_after>import QtQuick 2.0
import Sailfish.Silica 1.0


Page {
    id: editpage
    property variant targetNote;
    property string selectedNotebookGuid;
    property date selectedDate;
    property date selectedTime;
    Timer {
        interval: 1
        running: true
        onTriggered: {
            Cache.fillWithNotebooks()
            selectedNotebookGuid = targetNote.notebookGUID
            console.log(targetNote.reminder)
        }
    }
    Connections {
        target: Cache
        onNotebookFired: {
            notebooksmodel.append(notebook)
            if (targetNote.notebookGUID == notebook.guid)
            {
                notesbox.currentIndex = notebooksmodel.count - 1
            }
        }
    }


    SilicaFlickable {
        anchors.fill: parent
        contentHeight: areacol.height
        PullDownMenu {
            MenuItem {
                text: "Help"
                onClicked: {
                    pageStack.push(Qt.resolvedUrl("help/EditContent.qml"));
                }
            }
            MenuItem {
                text: "Save"
                onClicked: {
                    targetNote.title = txtTitle.text
                    targetNote.noteContent = notearea.text
                    targetNote.notebookGUID = selectedNotebookGuid
                    var combdate = new Date(selectedDate.getFullYear(),
                                            selectedDate.getMonth(),
                                            selectedDate.getDate(),
                                            selectedTime.getHours(),
                                            selectedTime.getMinutes())
                    targetNote.reminder = combdate
                    EvernoteSession.updateNote(targetNote)
                    pageStack.pop()
                    EvernoteSession.syncAsync()
                    EvernoteSession.getNoteContentAsync(targetNote)
                }
            }
        }
        Column {
            id: areacol
            width: parent.width
            PageHeader {
                title: "Edit note"
            }
            TextField {
                id: txtTitle
                text: targetNote.title
            }

            ComboBox {
                label: "Notebook"
                id: notesbox
                menu: ContextMenu {
                    Repeater {
                        model: ListModel { id: notebooksmodel }
                        MenuItem {
                            text: name
                            onClicked: {
                                selectedNotebookGuid = guid
                            }
                        }
                    }
                }
            }
            SectionHeader {
                text: "Reminder"
            }
            Row {
                spacing: 80
                Button {
                    text: "Time"
                    onClicked: {
                        var date = targetNote.reminder || new Date()
                        var dialog = pageStack.openDialog("Sailfish.Silica.TimePickerDialog", {
                            hourMode: DateTime.TwentyFourHours,
                            hour: date.getHours(),
                            minute: date.getMinutes()
                        })
                        dialog.accepted.connect(function() {
                            selectedTime = dialog.time
                        })
                    }
                }
                Button {
                    text: "Date"
                    onClicked: {
                        var date = targetNote.reminder || new Date()

                        var dialog = pageStack.openDialog("Sailfish.Silica.DatePickerDialog", {
                            day: date.getDate(),
                            month: date.getMonth() + 1,
                            year: date.getFullYear()
                        })

                        dialog.accepted.connect(function() {
                            selectedDate = dialog.date
                        })
                    }

                }
            }

            TextArea {
                width: parent.width
                text: targetNote.noteContent
                id: notearea
                Component.onCompleted: {
                    _editor.textFormat = TextEdit.RichText
                }
            }
        }
    }
}
{'fraction_non_alphanumeric': 0.06480523957256118, 'fraction_numerical': 0.002068252326783868, 'mean_word_length': 0.8503401360544217, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 16, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6053019', 'n_tokens_mistral': 1961, 'n_tokens_neox': 1824, 'n_words': 338}