Commit 9625b820 authored by camilo higuita's avatar camilo higuita
Browse files

mor ework but might be going back to previous layout btter

parent dbce26b8
......@@ -61,9 +61,10 @@ int Q_DECL_EXPORT main(int argc, char *argv[])
KAboutData::setApplicationData(about);
QCommandLineParser parser;
parser.process(app);
about.setupCommandLine(&parser);
parser.process(app);
about.processCommandLine(&parser);
QQmlApplicationEngine engine;
......
......@@ -61,20 +61,50 @@ Maui.ApplicationWindow
id: editorView
anchors.fill: parent
onNoteSaved:
headBar.rightContent: ToolButton
{
if(!FB.FM.fileExists(editorView.document.fileUrl))
{
notesView.saveNote(note)
}else
icon.name: "list-add"
onClicked: editorView.setNote({url: ""})
}
headBar.farLeftContent: ToolButton
{
icon.name: _sidebar.visible? "sidebar-collapse" : "sidebar-expand"
text: i18n("Notes")
checkable: true
checked: _sidebar.visible
onClicked:
{
notesView.updateNote(note, noteIndex)
_sidebar.toggle()
}
}
onNoteSaved:
{
console.log("note saved")
notesView.updateNote(note, noteIndex)
}
function setNote(note)
{
if(_sidebar.collapsed)
{
_sidebar.close()
}
if(editorView.document.modified && !FB.FM.fileExists(editorView.document.fileUrl))
{
notesView.saveNote(packNote())
}
// if(editorView.document.modified && FB.FM.fileExists(document.fileUrl))
// {
// editorView.noteSaved(packNote(), noteIndex)
// }
editorView.clear()
editorView.note = note
editorView.editor.body.forceActiveFocus()
editorView.noteIndex = notesView.currentIndex
}
......
......@@ -25,14 +25,9 @@ Maui.Page
property alias currentIndex : cardsView.currentIndex
flickable : cardsView.flickable
headBar.rightContent: ToolButton
{
icon.name: "list-add"
onClicked: control.newNote()
}
flickable : cardsView.flickable
headBar.forceCenterMiddleContent: false
headBar.middleContent: Maui.TextField
{
Layout.fillWidth: true
......@@ -86,7 +81,7 @@ Maui.Page
}
Maui.ListBrowser
Maui.ListBrowser
{
id: cardsView
anchors.fill: parent
......@@ -99,36 +94,35 @@ Maui.Page
enableLassoSelection: true
property string typingQuery
Maui.Chip
{
z: cardsView.z + 99999
Kirigami.Theme.colorSet:Kirigami.Theme.Complementary
visible: _typingTimer.running
label.text: cardsView.typingQuery
anchors.left: parent.left
anchors.bottom: parent.bottom
showCloseButton: false
anchors.margins: Maui.Style.space.medium
}
Timer
{
id: _typingTimer
interval: 250
onTriggered:
{
const index = notesList.indexOfName(cardsView.typingQuery)
if(index > -1)
{
control.currentIndex = notesModel.mappedFromSource(index)
}
cardsView.typingQuery = ""
}
}
Maui.Chip
{
z: cardsView.z + 99999
Kirigami.Theme.colorSet:Kirigami.Theme.Complementary
visible: _typingTimer.running
label.text: cardsView.typingQuery
anchors.left: parent.left
anchors.bottom: parent.bottom
showCloseButton: false
anchors.margins: Maui.Style.space.medium
}
Timer
{
id: _typingTimer
interval: 250
onTriggered:
{
const index = notesList.indexOfName(cardsView.typingQuery)
if(index > -1)
{
control.currentIndex = notesModel.mappedFromSource(index)
}
cardsView.typingQuery = ""
}
}
Connections
{
......@@ -180,8 +174,7 @@ Maui.Page
filterCaseSensitivity: Qt.CaseInsensitive
}
delegate: CardDelegate
delegate: CardDelegate
{
id: _listDelegate
width: ListView.view.width
......@@ -285,7 +278,7 @@ Maui.Page
cardsView.selectionMode = true
}
cardsView.currentView.itemsSelected([cardsView.currentIndex])
cardsView.itemsSelected([cardsView.currentIndex])
}
}
......@@ -316,7 +309,7 @@ Maui.Page
text: i18n("Copy")
onTriggered:
{
Maui.Handy.copyToClipboard({'text': currentNote.content})
Maui.Handy.copyToClipboard({'text': _notesMenu.currentNote.content})
_notesMenu.close()
}
}
......@@ -337,7 +330,7 @@ Maui.Page
MenuSeparator { }
MenuItem
Item
{
width: parent.width
height: Maui.Style.rowHeight
......@@ -346,7 +339,7 @@ Maui.Page
{
id: colorBar
anchors.centerIn: parent
currentColor: currentNote.color
currentColor: _notesMenu.currentNote.color
onColorPicked:
{
notesList.update(({"color": color}), notesModel.mappedToSource(cardsView.currentIndex))
......@@ -357,79 +350,72 @@ Maui.Page
}
}
footer: Maui.SelectionBar
{
id: _selectionbar
visible: count > 0
anchors.horizontalCenter: parent.horizontalCenter
width: Math.min(parent.width-(Maui.Style.space.medium*2), implicitWidth)
padding: Maui.Style.space.big
maxListHeight: control.height - Maui.Style.space.medium
display: ToolButton.IconOnly
onExitClicked:
{
cardsView.selectionMode = false
clear()
}
footer: Maui.SelectionBar
{
id: _selectionbar
visible: count > 0
anchors.horizontalCenter: parent.horizontalCenter
width: Math.min(parent.width-(Maui.Style.space.medium*2), implicitWidth)
padding: Maui.Style.space.big
maxListHeight: control.height - Maui.Style.space.medium
onExitClicked:
{
cardsView.selectionMode = false
clear()
}
listDelegate: Maui.ListBrowserDelegate
{
height: Maui.Style.rowHeight * 2
width: ListView.view.width
background: Rectangle
{
color: model.color ? model.color : "transparent"
radius:Maui.Style.radiusV
}
label1.text: model.title
template.iconVisible: false
iconSource: "view-pim-notes"
checkable: true
checked: true
onToggled: _selectionbar.removeAtIndex(index)
}
Action
{
text: i18n("Favorite")
icon.name: "love"
onTriggered:
{
for(var item of _selectionbar.items)
notesList.update(({"favorite": _notesMenu.isFav ? 0 : 1}), notesModel.mappedToSource(notesList.indexOfNote(item.path)))
_selectionbar.clear()
}
}
Action
{
text: i18n("Share")
icon.name: "document-share"
}
Action
{
text: i18n("Export")
icon.name: "document-export"
}
Action
{
text: i18n("Delete")
Kirigami.Theme.textColor: Kirigami.Theme.negativeTextColor
icon.name: "edit-delete"
onTriggered:
{
_removeNotesDialog.notes = _selectionbar.uris
_removeNotesDialog.open()
}
}
}
listDelegate: Maui.ListBrowserDelegate
{
height: Maui.Style.rowHeight * 2
width: ListView.view.width
background: Rectangle
{
color: model.color ? model.color : "transparent"
radius:Maui.Style.radiusV
}
label1.text: model.title
template.iconVisible: false
iconSource: "view-pim-notes"
checkable: true
checked: true
onToggled: _selectionbar.removeAtIndex(index)
}
Action
{
text: i18n("Favorite")
icon.name: "love"
onTriggered:
{
for(var item of _selectionbar.items)
notesList.update(({"favorite": _notesMenu.isFav ? 0 : 1}), notesModel.mappedToSource(notesList.indexOfNote(item.path)))
_selectionbar.clear()
}
}
Action
{
text: i18n("Share")
icon.name: "document-share"
}
Action
{
text: i18n("Delete")
Kirigami.Theme.textColor: Kirigami.Theme.negativeTextColor
icon.name: "edit-delete"
onTriggered:
{
_removeNotesDialog.notes = _selectionbar.uris
_removeNotesDialog.open()
}
}
}
function select(item)
{
......@@ -441,7 +427,7 @@ Maui.Page
_selectionbar.append(item.path, item)
}
}
}
function updateNote(note, index)
{
......
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
import QtGraphicalEffects 1.0
import org.kde.kirigami 2.7 as Kirigami
import org.kde.kirigami 2.14 as Kirigami
import org.mauikit.controls 1.2 as Maui
Maui.ItemDelegate
......@@ -13,7 +12,6 @@ Maui.ItemDelegate
implicitWidth: Maui.Style.unit * 200
implicitHeight: Maui.Style.unit * 120
property string noteColor : model.color ? model.color : "transparent"
property int cardRadius: Maui.Style.radiusV
property bool checkable: false
......@@ -23,184 +21,160 @@ Maui.ItemDelegate
draggable: true
Drag.keys: ["text/uri-list"]
Drag.mimeData: Drag.active ?
{
"text/uri-list": control.filterSelectedItems(model.path)
} : {}
Rectangle
{
anchors.fill: parent
color: Qt.darker(Kirigami.Theme.textColor)
opacity: 0.2
visible: control.checkable || control.checked
radius: control.cardRadius
}
background: Rectangle
{
readonly property color m_color : Qt.tint(Qt.lighter(control.Kirigami.Theme.textColor), Qt.rgba(control.Kirigami.Theme.backgroundColor.r, control.Kirigami.Theme.backgroundColor.g, control.Kirigami.Theme.backgroundColor.b, 0.9))
Rectangle
{
anchors.fill: parent
color: Qt.darker(Kirigami.Theme.textColor)
opacity: 0.2
visible: control.checkable || control.checked
radius: control.cardRadius
}
color: control.isCurrentItem || control.hovered || control.containsPress ? Qt.rgba(control.Kirigami.Theme.highlightColor.r, control.Kirigami.Theme.highlightColor.g, control.Kirigami.Theme.highlightColor.b, 0.2) : Qt.rgba(m_color.r, m_color.g, m_color.b, 0.4)
border.color: control.isCurrentItem || control.checked || hovered ? Kirigami.Theme.highlightColor : "transparent"
radius: control.cardRadius
}
background: Rectangle
{
Kirigami.Theme.inherit: false
border.color: control.isCurrentItem || control.checked || hovered ? Kirigami.Theme.highlightColor : "transparent"
color: control.noteColor !== "transparent" ? control.noteColor : Qt.lighter(Kirigami.Theme.backgroundColor)
radius: control.cardRadius
border.width: control.isCurrentItem || control.checked || hovered ? 2 : 1
}
Maui.Holder
{
anchors.fill: parent
visible: !body.visible && !title.visible
title: i18n("Empty")
body: i18n("Edit this note")
}
Kirigami.Icon
{
anchors.right: parent.right
anchors.bottom: parent.bottom
anchors.margins: Maui.Style.space.medium
source: "love"
color: model.color ? Qt.darker(model.color, 3) : Kirigami.Theme.textColor
height: Maui.Style.iconSizes.small
width: height
visible: model.favorite == 1
}
Maui.Badge
{
id: _emblem
Maui.Holder
visible: control.checkable || control.checked
size: Maui.Style.iconSizes.medium
anchors.margins: Maui.Style.space.medium
anchors.right: parent.right
anchors.bottom: parent.bottom
color: control.checked ? Kirigami.Theme.highlightColor : Qt.rgba(Kirigami.Theme.backgroundColor.r, Kirigami.Theme.backgroundColor.g, Kirigami.Theme.backgroundColor.b, 0.5)
border.color: Kirigami.Theme.textColor
onClicked:
{
anchors.fill: parent
visible: !title.visible
title: i18n("Empty")
body: i18n("Edit this note")
emoji: "qrc:/view-notes.svg"
emojiSize: Maui.Style.iconSizes.large
Kirigami.Theme.textColor: date.color
control.checked = !control.checked
control.toggled(control.checked)
}
Kirigami.Icon
{
anchors.right: parent.right
anchors.top: parent.top
anchors.margins: Maui.Style.space.medium
source: "love"
color: model.color ? Qt.darker(model.color, 3) : Kirigami.Theme.textColor
height: Maui.Style.iconSizes.small
visible: opacity > 0
color: Kirigami.Theme.highlightedTextColor
anchors.centerIn: parent
height: control.checked ? Math.round(parent.height * 0.9) : 0
width: height
visible: model.favorite == 1
}
Maui.Badge
{
id: _emblem
opacity: control.checked ? 1 : 0
isMask: true
visible: control.checkable || control.checked
size: Maui.Style.iconSizes.medium
anchors.margins: Maui.Style.space.medium
anchors.right: parent.right
anchors.bottom: parent.bottom
color: control.checked ? Kirigami.Theme.highlightColor : Qt.rgba(Kirigami.Theme.backgroundColor.r, Kirigami.Theme.backgroundColor.g, Kirigami.Theme.backgroundColor.b, 0.5)
border.color: Kirigami.Theme.textColor
onClicked:
{
control.checked = !control.checked
control.toggled(control.checked)
}
source: "qrc:/assets/checkmark.svg"
Kirigami.Icon
Behavior on opacity
{
visible: opacity > 0
color: Kirigami.Theme.highlightedTextColor
anchors.centerIn: parent
height: control.checked ? Math.round(parent.height * 0.9) : 0
width: height
opacity: control.checked ? 1 : 0
isMask: true
source: "qrc:/assets/checkmark.svg"
Behavior on opacity
NumberAnimation
{
NumberAnimation
{
duration: Kirigami.Units.shortDuration
easing.type: Easing.InOutQuad
}
duration: Kirigami.Units.shortDuration
easing.type: Easing.InOutQuad
}
}
}
}
ColumnLayout
{
anchors.fill: parent
anchors.margins: Maui.Style.space.medium
anchors.leftMargin: _tagColor.width + Maui.Style.space.medium
spacing: Maui.Style.space.medium
clip: true
ColumnLayout
Label
{
anchors.fill: parent
anchors.margins: Maui.Style.space.big
spacing: Maui.Style.space.small
id: title
padding: 0
visible: title.text.length > 0
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
Layout.preferredHeight: model.preview ? parent.height * 0.4 : implicitHeight
Layout.fillWidth: true
text: model.title
color: Kirigami.Theme.textColor
elide: Qt.ElideRight
wrapMode: TextEdit.WrapAnywhere
font.family: settings.font.family
font.weight: Font.Bold
font.bold: true
font.pointSize: Maui.Style.fontSizes.large
clip: true
}
Label
{
id: date
padding: 0
visible: date.text.length > 0
Layout.leftMargin: Maui.Style.space.medium
Layout.topMargin: Maui.Style.space.medium
Layout.rightMargin: Maui.Style.space.medium
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
Layout.fillWidth: true
text: Qt.formatDateTime(new Date(model.modified), "h:mm d MMM yyyy")
color: model.color ? Qt.darker(model.color) : Kirigami.Theme.textColor
elide: Qt.ElideRight
wrapMode: TextEdit.WrapAnywhere
font.family: settings.font.family
font.weight: Font.Bold
font.bold: true
font.pointSize: Maui.Style.fontSizes.small
}
Label
{
id: title
padding: 0
visible: title.text.length > 0
Layout.leftMargin: Maui.Style.space.medium
Layout.bottomMargin: Maui.Style.space.medium
Layout.rightMargin: Maui.Style.space.medium
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
Layout.preferredHeight: model.preview ? parent.height * 0.4 : implicitHeight
Layout.fillWidth: true
text: model.title
color: model.color ? Qt.darker(model.color, 3) : Kirigami.Theme.textColor
elide: Qt.ElideRight
wrapMode: TextEdit.WrapAnywhere
font.family: settings.font.family
font.weight: Font.Bold
font.bold: true
font.pointSize: Maui.Style.fontSizes.large
clip: true
}
Text
{
id: body
Layout.fillHeight: true
Layout.fillWidth: true