1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-04-17 11:26:26 +02:00

110 lines
2.1 KiB
QML
Raw Normal View History

2016-12-10 22:39:53 +00:00
import QtQuick 2.7
import QtQuick.Controls 2.0
2017-01-12 17:59:19 +01:00
//import QtQuick.Controls 1.4
2016-12-10 22:39:53 +00:00
import QtQuick.Layouts 1.0
Item {
2017-01-10 20:32:10 +01:00
property Item appRoot
2016-12-11 16:09:39 +00:00
property alias currentFolderIndex: folderList.currentIndex
2016-12-14 21:50:26 +00:00
property alias currentNoteIndex: noteList.currentIndex
2016-12-10 22:39:53 +00:00
function onShown() {
}
2016-12-10 22:39:53 +00:00
RowLayout {
id: layout
anchors.fill: parent
spacing: 0
2016-12-11 16:09:39 +00:00
FolderList {
id: folderList
model: folderListModel
2016-12-10 22:39:53 +00:00
Layout.fillWidth: true
Layout.fillHeight: true
Layout.minimumWidth: 50
Layout.preferredWidth: 100
2016-12-14 21:50:26 +00:00
Layout.maximumWidth: 200
2016-12-10 22:39:53 +00:00
Layout.minimumHeight: 150
onCurrentItemChanged: {
2017-01-10 20:32:10 +01:00
appRoot.currentFolderChanged()
2016-12-10 22:39:53 +00:00
}
2016-12-31 10:48:18 +01:00
onEditingAccepted: function(index, text) {
if (folderList.model.virtualItemShown()) {
2017-01-01 11:33:14 +01:00
folderList.model.hideVirtualItem();
2016-12-31 10:48:18 +01:00
folderList.model.addData(text)
2017-01-01 11:33:14 +01:00
folderList.selectItemById(folderList.model.lastInsertId());
2016-12-31 10:48:18 +01:00
} else {
folderList.model.setData(index, text)
}
}
onStoppedEditing: {
if (folderList.model.virtualItemShown()) {
folderList.model.hideVirtualItem();
}
}
onDeleteButtonClicked: {
folderList.model.deleteData(index)
}
2016-12-10 22:39:53 +00:00
}
2016-12-11 16:09:39 +00:00
NoteList {
id: noteList
2016-12-12 22:33:33 +00:00
model: noteListModel
2016-12-10 22:39:53 +00:00
Layout.fillWidth: true
2016-12-11 16:09:39 +00:00
Layout.fillHeight: true
2016-12-10 22:39:53 +00:00
Layout.minimumWidth: 100
2016-12-14 21:50:26 +00:00
Layout.maximumWidth: 200
2016-12-10 22:39:53 +00:00
Layout.preferredWidth: 200
Layout.preferredHeight: 100
2016-12-14 21:50:26 +00:00
onCurrentItemChanged: {
2017-01-10 20:32:10 +01:00
appRoot.currentNoteChanged()
2016-12-14 21:50:26 +00:00
}
}
NoteEditor {
id: noteEditor
model: noteModel
Layout.fillWidth: true
Layout.fillHeight: true
Layout.minimumWidth: 100
Layout.preferredHeight: 100
2016-12-10 22:39:53 +00:00
}
2016-12-11 16:09:39 +00:00
}
2016-12-10 22:39:53 +00:00
2016-12-29 20:19:00 +01:00
AddButton {
id: addButton
anchors.right: parent.right
anchors.bottom: parent.bottom
2016-12-31 10:48:18 +01:00
onAddFolderButtonClicked: {
folderList.model.showVirtualItem();
folderList.startEditing(folderList.model.rowCount() - 1);
}
2017-01-10 20:32:10 +01:00
onAddNoteButtonClicked: appRoot.addNoteButtonClicked()
2016-12-29 20:19:00 +01:00
}
2017-01-10 19:59:12 +01:00
Button {
id: syncButton
text: "Sync"
anchors.right: parent.right
anchors.top: parent.top
2017-01-10 20:32:10 +01:00
onClicked: appRoot.syncButtonClicked()
2017-01-10 19:59:12 +01:00
}
Button {
id: logoutButton
text: "Logout"
anchors.right: syncButton.left
anchors.top: parent.top
2017-01-12 17:59:19 +01:00
onClicked: appRoot.logoutClicked()
}
2016-12-10 22:39:53 +00:00
}