Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
Buho
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
KDE
Buho
Commits
aa546e13
Commit
aa546e13
authored
Oct 22, 2018
by
Camilo higuita
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use more mauikit controls and tweaks on the baselist props
parent
c8c9683d
Changes
14
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
162 additions
and
756 deletions
+162
-756
buho.pro
buho.pro
+0
-2
main.cpp
main.cpp
+1
-3
src/documenthandler.cpp
src/documenthandler.cpp
+0
-388
src/documenthandler.h
src/documenthandler.h
+0
-175
src/models/baselist.h
src/models/baselist.h
+44
-6
src/models/links/links.cpp
src/models/links/links.cpp
+9
-5
src/models/links/links.h
src/models/links/links.h
+1
-1
src/models/notes/notes.cpp
src/models/notes/notes.cpp
+9
-3
src/models/notes/notes.h
src/models/notes/notes.h
+2
-3
src/utils/owl.h
src/utils/owl.h
+1
-2
src/views/links/LinksView.qml
src/views/links/LinksView.qml
+32
-12
src/views/notes/NotesView.qml
src/views/notes/NotesView.qml
+31
-11
src/widgets/NewLinkDialog.qml
src/widgets/NewLinkDialog.qml
+0
-3
src/widgets/NewNoteDialog.qml
src/widgets/NewNoteDialog.qml
+32
-142
No files found.
buho.pro
View file @
aa546e13
...
...
@@ -42,7 +42,6 @@ SOURCES += \
main
.
cpp
\
src
/
db
/
db
.
cpp
\
src
/
buho
.
cpp
\
src
/
documenthandler
.
cpp
\
src
/
linker
.
cpp
\
src
/
utils
/
htmlparser
.
cpp
\
src
/
models
/
notes
/
notes
.
cpp
\
...
...
@@ -73,7 +72,6 @@ HEADERS += \
src
/
db
/
db
.
h
\
src
/
buho
.
h
\
src
/
utils
/
owl
.
h
\
src
/
documenthandler
.
h
\
src
/
linker
.
h
\
src
/
utils
/
htmlparser
.
h
\
src
/
models
/
notes
/
notes
.
h
\
...
...
main.cpp
View file @
aa546e13
...
...
@@ -21,7 +21,6 @@
#endif
#include "src/buho.h"
#include "src/documenthandler.h"
#include "src/linker.h"
#include "models/basemodel.h"
...
...
@@ -65,8 +64,7 @@ int main(int argc, char *argv[])
Linker
linker
;
context
->
setContextProperty
(
"linker"
,
&
linker
);
qmlRegisterUncreatableMetaObject
(
OWL
::
staticMetaObject
,
"Owl"
,
1
,
0
,
"KEY"
,
"Error"
);
qmlRegisterType
<
DocumentHandler
>
(
"org.buho.editor"
,
1
,
0
,
"DocumentHandler"
);
qmlRegisterUncreatableMetaObject
(
OWL
::
staticMetaObject
,
"OWL"
,
1
,
0
,
"KEY"
,
"Error"
);
qmlRegisterUncreatableType
<
BaseList
>
(
"BaseList"
,
1
,
0
,
"BaseList"
,
QStringLiteral
(
"BaseList should not be created in QML"
));
qmlRegisterType
<
BaseModel
>
(
"BuhoModel"
,
1
,
0
,
"BuhoModel"
);
...
...
src/documenthandler.cpp
deleted
100644 → 0
View file @
c8c9683d
This diff is collapsed.
Click to expand it.
src/documenthandler.h
deleted
100644 → 0
View file @
c8c9683d
/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** BSD License Usage
** Alternatively, you may use this file under the terms of the BSD license
** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef DOCUMENTHANDLER_H
#define DOCUMENTHANDLER_H
#include <QFont>
#include <QObject>
#include <QTextCursor>
#include <QUrl>
QT_BEGIN_NAMESPACE
class
QTextDocument
;
class
QQuickTextDocument
;
QT_END_NAMESPACE
class
DocumentHandler
:
public
QObject
{
Q_OBJECT
Q_PROPERTY
(
QQuickTextDocument
*
document
READ
document
WRITE
setDocument
NOTIFY
documentChanged
)
Q_PROPERTY
(
int
cursorPosition
READ
cursorPosition
WRITE
setCursorPosition
NOTIFY
cursorPositionChanged
)
Q_PROPERTY
(
int
selectionStart
READ
selectionStart
WRITE
setSelectionStart
NOTIFY
selectionStartChanged
)
Q_PROPERTY
(
int
selectionEnd
READ
selectionEnd
WRITE
setSelectionEnd
NOTIFY
selectionEndChanged
)
Q_PROPERTY
(
QColor
textColor
READ
textColor
WRITE
setTextColor
NOTIFY
textColorChanged
)
Q_PROPERTY
(
QString
fontFamily
READ
fontFamily
WRITE
setFontFamily
NOTIFY
fontFamilyChanged
)
Q_PROPERTY
(
Qt
::
Alignment
alignment
READ
alignment
WRITE
setAlignment
NOTIFY
alignmentChanged
)
Q_PROPERTY
(
bool
bold
READ
bold
WRITE
setBold
NOTIFY
boldChanged
)
Q_PROPERTY
(
bool
uppercase
READ
uppercase
WRITE
setUppercase
NOTIFY
uppercaseChanged
)
Q_PROPERTY
(
bool
italic
READ
italic
WRITE
setItalic
NOTIFY
italicChanged
)
Q_PROPERTY
(
bool
underline
READ
underline
WRITE
setUnderline
NOTIFY
underlineChanged
)
Q_PROPERTY
(
int
fontSize
READ
fontSize
WRITE
setFontSize
NOTIFY
fontSizeChanged
)
Q_PROPERTY
(
QString
fileName
READ
fileName
NOTIFY
fileUrlChanged
)
Q_PROPERTY
(
QString
fileType
READ
fileType
NOTIFY
fileUrlChanged
)
Q_PROPERTY
(
QUrl
fileUrl
READ
fileUrl
NOTIFY
fileUrlChanged
)
public:
explicit
DocumentHandler
(
QObject
*
parent
=
nullptr
);
QQuickTextDocument
*
document
()
const
;
void
setDocument
(
QQuickTextDocument
*
document
);
int
cursorPosition
()
const
;
void
setCursorPosition
(
int
position
);
int
selectionStart
()
const
;
void
setSelectionStart
(
int
position
);
int
selectionEnd
()
const
;
void
setSelectionEnd
(
int
position
);
QString
fontFamily
()
const
;
void
setFontFamily
(
const
QString
&
family
);
QColor
textColor
()
const
;
void
setTextColor
(
const
QColor
&
color
);
Qt
::
Alignment
alignment
()
const
;
void
setAlignment
(
Qt
::
Alignment
alignment
);
bool
bold
()
const
;
void
setBold
(
bool
bold
);
bool
uppercase
()
const
;
void
setUppercase
(
bool
uppercase
);
bool
italic
()
const
;
void
setItalic
(
bool
italic
);
bool
underline
()
const
;
void
setUnderline
(
bool
underline
);
int
fontSize
()
const
;
void
setFontSize
(
int
size
);
QString
fileName
()
const
;
QString
fileType
()
const
;
QUrl
fileUrl
()
const
;
public
Q_SLOTS
:
void
load
(
const
QUrl
&
fileUrl
);
void
saveAs
(
const
QUrl
&
fileUrl
);
Q_SIGNALS:
void
documentChanged
();
void
cursorPositionChanged
();
void
selectionStartChanged
();
void
selectionEndChanged
();
void
fontFamilyChanged
();
void
textColorChanged
();
void
alignmentChanged
();
void
boldChanged
();
void
uppercaseChanged
();
void
italicChanged
();
void
underlineChanged
();
void
fontSizeChanged
();
void
textChanged
();
void
fileUrlChanged
();
void
loaded
(
const
QString
&
text
);
void
error
(
const
QString
&
message
);
private:
void
reset
();
QTextCursor
textCursor
()
const
;
QTextDocument
*
textDocument
()
const
;
void
mergeFormatOnWordOrSelection
(
const
QTextCharFormat
&
format
);
QQuickTextDocument
*
m_document
;
int
m_cursorPosition
;
int
m_selectionStart
;
int
m_selectionEnd
;
QFont
m_font
;
int
m_fontSize
;
QUrl
m_fileUrl
;
};
#endif // DOCUMENTHANDLER_H
src/models/baselist.h
View file @
aa546e13
...
...
@@ -7,15 +7,59 @@
class
BaseList
:
public
QObject
{
Q_OBJECT
Q_PROPERTY
(
OWL
::
KEY
sortBy
READ
getSortBy
WRITE
setSortBy
NOTIFY
sortByChanged
)
Q_PROPERTY
(
ORDER
order
READ
getOrder
WRITE
setOrder
NOTIFY
orderChanged
)
public:
explicit
BaseList
(
QObject
*
parent
=
nullptr
);
enum
ORDER
:
uint8_t
{
DESC
,
ASC
};
Q_ENUM
(
ORDER
)
Q_ENUM
(
OWL
::
KEY
)
//* To be overrided *//
virtual
OWL
::
DB_LIST
items
()
const
{
return
OWL
::
DB_LIST
({{}});}
virtual
void
setSortBy
(
const
OWL
::
KEY
&
sort
)
{
if
(
this
->
sort
==
sort
)
return
;
this
->
sort
=
sort
;
emit
this
->
sortByChanged
();
}
virtual
OWL
::
KEY
getSortBy
()
const
{
return
this
->
sort
;
}
virtual
void
setOrder
(
const
ORDER
&
order
)
{
if
(
this
->
order
==
order
)
return
;
this
->
order
=
order
;
emit
this
->
orderChanged
();
}
virtual
ORDER
getOrder
()
const
{
return
this
->
order
;
}
protected:
OWL
::
KEY
sort
=
OWL
::
KEY
::
UPDATED
;
ORDER
order
=
ORDER
::
DESC
;
signals:
void
orderChanged
();
void
sortByChanged
();
void
preItemAppended
();
void
postItemAppended
();
void
preItemRemoved
(
int
index
);
...
...
@@ -63,12 +107,6 @@ public slots:
Q_UNUSED
(
index
);
return
false
;
}
virtual
void
sortBy
(
const
int
&
role
,
const
QString
&
order
)
{
Q_UNUSED
(
role
);
Q_UNUSED
(
order
);
}
};
#endif // BASELIST_H
src/models/links/links.cpp
View file @
aa546e13
...
...
@@ -14,15 +14,19 @@ Links::Links(QObject *parent) : BaseList(parent)
{
this
->
db
=
DB
::
getInstance
();
this
->
tag
=
Tagging
::
getInstance
(
OWL
::
App
,
OWL
::
version
,
"org.kde.buho"
,
OWL
::
comment
);
this
->
sortBy
(
OWL
::
KEY
::
UPDATED
,
"DESC"
);
this
->
sortList
();
connect
(
this
,
&
Links
::
sortByChanged
,
this
,
&
Links
::
sortList
);
connect
(
this
,
&
Links
::
orderChanged
,
this
,
&
Links
::
sortList
);
}
void
Links
::
sort
By
(
const
int
&
role
,
const
QString
&
order
)
void
Links
::
sort
List
(
)
{
emit
this
->
preListChanged
();
this
->
links
=
this
->
db
->
getDBData
(
QString
(
"select * from links ORDER BY %1 %2"
).
arg
(
OWL
::
KEYMAP
[
static_cast
<
OWL
::
KEY
>
(
role
)],
order
));
this
->
links
=
this
->
db
->
getDBData
(
QString
(
"select * from links ORDER BY %1 %2"
).
arg
(
OWL
::
KEYMAP
[
this
->
sort
],
this
->
order
==
ORDER
::
ASC
?
"asc"
:
"desc"
));
emit
this
->
postListChanged
();
}
QVariantMap
Links
::
get
(
const
int
&
index
)
const
...
...
src/models/links/links.h
View file @
aa546e13
...
...
@@ -19,11 +19,11 @@ private:
Tagging
*
tag
;
DB
*
db
;
OWL
::
DB_LIST
links
;
void
sortList
();
signals:
public
slots
:
void
sortBy
(
const
int
&
role
,
const
QString
&
order
=
"DESC"
)
override
;
QVariantMap
get
(
const
int
&
index
)
const
override
;
bool
insert
(
const
QVariantMap
&
link
)
override
;
bool
update
(
const
int
&
index
,
const
QVariant
&
value
,
const
int
&
role
)
override
;
//deprecrated
...
...
src/models/notes/notes.cpp
View file @
aa546e13
...
...
@@ -14,13 +14,19 @@ Notes::Notes(QObject *parent) : BaseList(parent)
qDebug
()
<<
"CREATING NOTES LIST"
;
this
->
db
=
DB
::
getInstance
();
this
->
tag
=
Tagging
::
getInstance
(
OWL
::
App
,
OWL
::
version
,
"org.kde.buho"
,
OWL
::
comment
);
this
->
sortBy
(
OWL
::
KEY
::
UPDATED
,
"DESC"
);
this
->
sortList
();
connect
(
this
,
&
Notes
::
sortByChanged
,
this
,
&
Notes
::
sortList
);
connect
(
this
,
&
Notes
::
orderChanged
,
this
,
&
Notes
::
sortList
);
}
void
Notes
::
sort
By
(
const
int
&
role
,
const
QString
&
order
)
void
Notes
::
sort
List
(
)
{
emit
this
->
preListChanged
();
this
->
notes
=
this
->
db
->
getDBData
(
QString
(
"select * from notes ORDER BY %1 %2"
).
arg
(
OWL
::
KEYMAP
[
static_cast
<
OWL
::
KEY
>
(
role
)],
order
));
this
->
notes
=
this
->
db
->
getDBData
(
QString
(
"select * from notes ORDER BY %1 %2"
).
arg
(
OWL
::
KEYMAP
[
this
->
sort
],
this
->
order
==
ORDER
::
ASC
?
"asc"
:
"desc"
));
emit
this
->
postListChanged
();
}
...
...
src/models/notes/notes.h
View file @
aa546e13
...
...
@@ -3,6 +3,7 @@
#include <QObject>
#include "./../baselist.h"
#include "owl.h"
class
DB
;
class
Tagging
;
...
...
@@ -10,9 +11,7 @@ class Tagging;
class
Notes
:
public
BaseList
{
Q_OBJECT
public:
explicit
Notes
(
QObject
*
parent
=
nullptr
);
OWL
::
DB_LIST
items
()
const
override
;
...
...
@@ -20,6 +19,7 @@ private:
Tagging
*
tag
;
DB
*
db
;
OWL
::
DB_LIST
notes
;
void
sortList
();
signals:
...
...
@@ -27,7 +27,6 @@ public slots:
QVariantList
getTags
(
const
int
&
index
);
QVariantMap
get
(
const
int
&
index
)
const
override
;
void
sortBy
(
const
int
&
role
,
const
QString
&
order
=
"DESC"
)
override
;
bool
insert
(
const
QVariantMap
&
note
)
override
;
bool
update
(
const
int
&
index
,
const
QVariant
&
value
,
const
int
&
role
)
override
;
//deprecrated
bool
update
(
const
QVariantMap
&
data
,
const
int
&
index
)
override
;
...
...
src/utils/owl.h
View file @
aa546e13
...
...
@@ -76,7 +76,7 @@ namespace OWL
{
TABLE
::
LINKS_TAGS
,
"links_tags"
}
};
enum
KEY
:
uint8_t
enum
KEY
:
uint8_t
{
URL
,
UPDATED
,
...
...
@@ -112,7 +112,6 @@ namespace OWL
{
KEY
::
PREVIEW
,
"preview"
},
{
KEY
::
IMAGE
,
"image"
},
{
KEY
::
LINK
,
"link"
}
};
static
const
QHash
<
QString
,
OWL
::
KEY
>
MAPKEY
=
...
...
src/views/links/LinksView.qml
View file @
aa546e13
...
...
@@ -4,9 +4,9 @@ import QtQuick.Controls 2.3
import
org
.
kde
.
mauikit
1.0
as
Maui
import
org
.
kde
.
kirigami
2.2
as
Kirigami
import
Owl
1.0
import
BuhoModel
1.0
import
Links
1.0
import
OWL
1.0
import
"
../../widgets
"
...
...
@@ -44,36 +44,56 @@ Maui.Page
Menu
{
id
:
sortMenu
MenuItem
Maui.MenuItem
{
text
:
qsTr
(
"
Ascedent
"
)
checkable
:
true
checked
:
linksList
.
order
===
Links
.
ASC
onTriggered
:
linksList
.
order
=
Links
.
ASC
}
Maui.MenuItem
{
text
:
qsTr
(
"
Descendent
"
)
checkable
:
true
checked
:
linksList
.
order
===
Links
.
DESC
onTriggered
:
linksList
.
order
=
Links
.
DESC
}
MenuSeparator
{}
Maui.MenuItem
{
text
:
qsTr
(
"
Title
"
)
onTriggered
:
linksList
.
sortBy
(
KEY
.
TITLE
,
"
ASC
"
)
onTriggered
:
KEY
.
TITLE
}
MenuItem
Maui.MenuItem
{
text
:
qsTr
(
"
Color
"
)
onTriggered
:
linksList
.
sortBy
(
KEY
.
COLOR
,
"
ASC
"
)
onTriggered
:
linksList
.
sortBy
=
KEY
.
COLOR
}
MenuItem
M
aui.M
enuItem
{
text
:
qsTr
(
"
Add date
"
)
onTriggered
:
linksList
.
sortBy
(
KEY
.
ADD_DATE
,
"
DESC
"
)
onTriggered
:
linksList
.
sortBy
=
KEY
.
ADD_DATE
}
MenuItem
M
aui.M
enuItem
{
text
:
qsTr
(
"
Updated
"
)
onTriggered
:
linksList
.
sortBy
(
KEY
.
UPDATED
,
"
DESC
"
)
onTriggered
:
linksList
.
sortBy
=
KEY
.
UPDATED
}
MenuItem
Maui.MenuItem
{
text
:
qsTr
(
"
Fav
"
)
onTriggered
:
linksList
.
sortBy
(
KEY
.
FAV
,
"
DESC
"
)
onTriggered
:
linksList
.
sortBy
=
KEY
.
FAV
}
}
}
]
...
...
src/views/notes/NotesView.qml
View file @
aa546e13
...
...
@@ -7,7 +7,7 @@ import org.kde.kirigami 2.2 as Kirigami
import
BuhoModel
1.0
import
Notes
1.0
import
O
wl
1.0
import
O
WL
1.0
//To get the enums
import
"
../../widgets
"
...
...
@@ -46,33 +46,53 @@ Maui.Page
{
id
:
sortMenu
parent
:
parent
MenuItem
Maui.MenuItem
{
text
:
qsTr
(
"
Ascedent
"
)
checkable
:
true
checked
:
notesList
.
order
===
Notes
.
ASC
onTriggered
:
notesList
.
order
=
Notes
.
ASC
}
Maui.MenuItem
{
text
:
qsTr
(
"
Descendent
"
)
checkable
:
true
checked
:
notesList
.
order
===
Notes
.
DESC
onTriggered
:
notesList
.
order
=
Notes
.
DESC
}
MenuSeparator
{}
Maui.MenuItem
{
text
:
qsTr
(
"
Title
"
)
onTriggered
:
notesList
.
sortBy
(
KEY
.
TITLE
,
"
ASC
"
)
onTriggered
:
notesList
.
sortBy
=
KEY
.
TITLE
}
MenuItem
M
aui.M
enuItem
{
text
:
qsTr
(
"
Color
"
)
onTriggered
:
notesList
.
sortBy
(
KEY
.
COLOR
,
"
ASC
"
)
onTriggered
:
notesList
.
sortBy
=
KEY
.
COLOR
}
MenuItem
M
aui.M
enuItem
{
text
:
qsTr
(
"
Add date
"
)
onTriggered
:
notesList
.
sortBy
(
KEY
.
ADD_DATE
,
"
DESC
"
)
onTriggered
:
notesList
.
sortBy
=
KEY
.
ADD_DATE
}
MenuItem
M
aui.M
enuItem
{
text
:
qsTr
(
"
Updated
"
)
onTriggered
:
notesList
.
sortBy
(
KEY
.
UPDATED
,
"
DESC
"
)
onTriggered
:
notesList
.
sortBy
=
KEY
.
UPDATED
}
MenuItem
Maui.MenuItem
{
text
:
qsTr
(
"
Fav
"
)
onTriggered
:
notesList
.
sortBy
(
KEY
.
FAV
,
"
DESC
"
)
onTriggered
:
notesList
.
sortBy
=
KEY
.
FAV
}
}
}
...
...
src/widgets/NewLinkDialog.qml
View file @
aa546e13
...
...
@@ -2,7 +2,6 @@ import QtQuick 2.9
import
QtQuick
.
Controls
2.2
import
QtQuick
.
Layouts
1.0
import
org
.
kde
.
mauikit
1.0
as
Maui
import
org
.
buho
.
editor
1.0
import
org
.
kde
.
kirigami
2.2
as
Kirigami
Maui.Dialog
...
...
@@ -192,8 +191,6 @@ Maui.Dialog
}
}
function
clear
()
{
title
.
clear
()
...
...
src/widgets/NewNoteDialog.qml
View file @
aa546e13
...
...
@@ -2,7 +2,6 @@ import QtQuick 2.9
import
QtQuick
.
Controls
2.2
import
QtQuick
.
Layouts
1.0
import
org
.
kde
.
mauikit
1.0
as
Maui
import
org
.
buho
.
editor
1.0
Maui.Dialog
{
...
...
@@ -19,23 +18,14 @@ Maui.Dialog
rejectButton.visible
:
false
signal
noteSaved
(
var
note
)
page.margins
:
0
colorScheme.backgroundColor
:
selectedColor
headBar.leftContent
:
[
Maui.ToolButton
{
id
:
pinButton
iconName
:
"
edit-pin
"
checkable
:
true
iconColor
:
checked
?
highlightColor
:
textColor
// onClicked: checked = !checked
},
Maui.ToolButton
{
iconName
:
"
edit-undo
"
enabled
:
body
.
canUndo
onClicked
:
body
.
undo
()
enabled
:
editor
.
body
.
canUndo
onClicked
:
editor
.
body
.
undo
()
opacity
:
enabled
?
1
:
0.5
},
...
...
@@ -43,8 +33,8 @@ Maui.Dialog
Maui.ToolButton
{
iconName
:
"
edit-redo
"
enabled
:
body
.
canRedo
onClicked
:
body
.
redo
()
enabled
:
editor
.
body
.
canRedo
onClicked
:
editor
.
body
.
redo
()
opacity
:
enabled
?
1
:
0.5
},
...
...
@@ -54,8 +44,8 @@ Maui.Dialog
focusPolicy
:
Qt
.
TabFocus
iconColor
:
checked
?
highlightColor
:
textColor
checkable
:
true
checked
:
document
.
bold
onClicked
:
document
.
bold
=
!
document
.
bold
checked
:
editor
.
document
.
bold
onClicked
:
editor
.
document
.
bold
=
!
editor
.
document
.
bold
},
Maui.ToolButton
...
...
@@ -64,8 +54,8 @@ Maui.Dialog
iconColor
:
checked
?
highlightColor
:
textColor
focusPolicy
:
Qt
.
TabFocus
checkable
:
true
checked
:
document
.
italic
onClicked
:
document
.
italic
=
!
document
.
italic
checked
:
editor
.
document
.
italic
onClicked
:
editor
.
document
.
italic
=
!
editor
.
document
.
italic
},
Maui.ToolButton
...
...
@@ -74,8 +64,8 @@ Maui.Dialog
iconColor
:
checked
?
highlightColor
:
textColor
focusPolicy
:
Qt
.
TabFocus
checkable
:
true
checked
:
document
.
underline
onClicked
:
document
.
underline
=
!
document
.
underline
checked
:
editor
.
document
.
underline
onClicked
:
editor
.
document
.
underline
=
!
editor
.
document
.
underline
},
Maui.ToolButton
...
...
@@ -84,24 +74,29 @@ Maui.Dialog
iconColor
:
checked
?
highlightColor
:
textColor
focusPolicy
:
Qt
.
TabFocus
checkable
:
true
checked
:
document
.
uppercase
onClicked
:
document
.
uppercase
=
!
document
.
uppercase
checked
:
editor
.
document
.
uppercase
onClicked
:
editor
.
document
.
uppercase
=
!
editor
.
document
.
uppercase
},
Maui.ToolButton
{
iconName
:
"
image
"
}
]
colorScheme.backgroundColor
:
selectedColor
headBar.rightContent
:
ColorsBar
{
onColorPicked
:
selectedColor
=
color
}
footBar.leftContent
:
[
Maui.ToolButton
{
id
:
pinButton
iconName
:
"
edit-pin
"
checkable
:
true
iconColor
:
checked
?
highlightColor
:
textColor
// onClicked: checked = !checked
},
Maui.ToolButton
{
...
...
@@ -114,8 +109,8 @@ Maui.Dialog
Maui.ToolButton
{
iconName
:
"
document-share
"
onClicked
:
isAndroid
?
Maui
.
Android
.
shareText
(
body
.
text
)
:
shareDialog
.
show
(
body
.
text
)
onClicked
:
isAndroid
?
Maui
.
Android
.
shareText
(
editor
.
body
.
text
)
:
shareDialog
.
show
(
editor
.
body
.
text
)
},
Maui.ToolButton
...
...
@@ -133,7 +128,7 @@ Maui.Dialog
rejectText
:
qsTr
(
"
Discard
"
)
onAccepted
:
{
if
(
body
.
text
.
length
>
0
)
if
(
editor
.
body
.
text
.
length
>
0
)
packNote
()
clear
()
}
...
...
@@ -162,119 +157,14 @@ Maui.Dialog
}
}
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
Maui.Editor
{
id
:
editor
Layout.fillHeight
:
true
Layout.fillWidth
:
true
Layout.margins
:
space
.
medium
TextArea
{
id
:
body
width
:
parent
.
width
height
:
parent
.
height
placeholderText
:
qsTr
(
"
Body
"
)
selectByKeyboard
:
!
isMobile
selectByMouse
:
!
isMobile
textFormat
:
TextEdit
.
AutoText
color
:
fgColor
font.pointSize
:
fontSizes
.
large
wrapMode
:
TextEdit
.
WrapAnywhere
activeFocusOnPress
:
true