Commit 4c337062 authored by Camilo Higuita's avatar Camilo Higuita

editing tools now working

parent 973b9912
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
#include "mauikit/src/mauikit.h" #include "mauikit/src/mauikit.h"
#include "src/buho.h" #include "src/buho.h"
#include "src/documenthandler.h"
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
...@@ -44,6 +46,8 @@ int main(int argc, char *argv[]) ...@@ -44,6 +46,8 @@ int main(int argc, char *argv[])
auto context = engine.rootContext(); auto context = engine.rootContext();
context->setContextProperty("owl", &owl); context->setContextProperty("owl", &owl);
qmlRegisterType<DocumentHandler>("org.buho.editor", 1, 0, "DocumentHandler");
engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
if (engine.rootObjects().isEmpty()) if (engine.rootObjects().isEmpty())
return -1; return -1;
......
...@@ -2,6 +2,7 @@ import QtQuick 2.9 ...@@ -2,6 +2,7 @@ import QtQuick 2.9
import QtQuick.Controls 2.2 import QtQuick.Controls 2.2
import QtQuick.Layouts 1.0 import QtQuick.Layouts 1.0
import org.kde.maui 1.0 as Maui import org.kde.maui 1.0 as Maui
import org.buho.editor 1.0
Popup Popup
{ {
...@@ -36,6 +37,10 @@ Popup ...@@ -36,6 +37,10 @@ Popup
Maui.ToolButton Maui.ToolButton
{ {
iconName: "format-text-bold" iconName: "format-text-bold"
focusPolicy: Qt.TabFocus
checkable: true
checked: document.bold
onClicked: document.bold = !document.bold
}, },
Maui.ToolButton Maui.ToolButton
...@@ -161,6 +166,23 @@ Popup ...@@ -161,6 +166,23 @@ Popup
} }
} }
DocumentHandler
{
id: document
document: body.textDocument
cursorPosition: body.cursorPosition
selectionStart: body.selectionStart
selectionEnd: body.selectionEnd
// textColor: TODO
// onLoaded: {
// body.text = text
// }
onError: {
body.text = message
body.visible = true
}
}
ScrollView ScrollView
{ {
Layout.fillHeight: true Layout.fillHeight: true
...@@ -232,6 +254,7 @@ Popup ...@@ -232,6 +254,7 @@ Popup
function fill(note) function fill(note)
{ {
document.load("qrc:/texteditor.html")
title.text = note.title title.text = note.title
body.text = note.body body.text = note.body
selectedColor = note.color selectedColor = note.color
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment