diff --git a/main.qml b/main.qml index ebe02f6..4419a47 100644 --- a/main.qml +++ b/main.qml @@ -1,240 +1,230 @@ import QtQuick 2.9 import QtQuick.Controls 2.2 -import org.kde.kirigami 2.4 as Kirigami +import org.kde.kirigami 2.7 as Kirigami import org.kde.mauikit 1.0 as Maui import "src/widgets" import "src/views/notes" import "src/views/links" import "src/views/books" Maui.ApplicationWindow { id: root title: qsTr("Buho") /***** PROPS *****/ - floatingBar: true - footBarOverlap: true - allowRiseContent: false // altToolBars: false /**** BRANDING COLORS ****/ - menuButton.colorScheme.highlightColor: accentColor - searchButton.colorScheme.highlightColor: accentColor +// menuButton.colorScheme.highlightColor: accentColor +// searchButton.colorScheme.highlightColor: accentColor headBarBGColor: viewBackgroundColor headBarFGColor: textColor accentColor : "#ff9494" // highlightColor: accentColor altColorText : "white"/*Qt.darker(accentColor, 2.5)*/ about.appDescription: qsTr("Buho allows you to take quick notes, collect links and take long notes organized by chapters.") about.appIcon: "qrc:/buho.svg" property int currentView : views.notes readonly property var views : ({ notes: 0, links: 1, books: 2, tags: 3, search: 4 }) property color headBarTint : Qt.lighter(headBarBGColor, 1.25) headBar.middleContent: [ - Maui.ToolButton + ToolButton { onClicked: currentView = views.notes - iconColor: active ? accentColor : textColor - colorScheme.highlightColor: accentColor - iconName: "view-notes" + icon.color: active ? accentColor : textColor + Kirigami.Theme.highlightColor: accentColor + icon.name: "view-notes" text: qsTr("Notes") - active: currentView === views.notes - showIndicator: true + checked: currentView === views.notes }, - Maui.ToolButton + ToolButton { onClicked: currentView = views.links - iconColor: active ? accentColor : textColor - colorScheme.highlightColor: accentColor - iconName: "view-links" + icon.color: active ? accentColor : textColor + Kirigami.Theme.highlightColor: accentColor + icon.name: "view-links" text: qsTr("Links") - active: currentView === views.links - showIndicator: true + checked: currentView === views.links }, - Maui.ToolButton + ToolButton { onClicked: currentView = views.books - iconColor: active? accentColor : textColor - colorScheme.highlightColor: accentColor - iconName: "view-books" + icon.color: active? accentColor : textColor + Kirigami.Theme.highlightColor: accentColor + icon.name: "view-books" text: qsTr("Books") - active: currentView === views.books - showIndicator: true + checked: currentView === views.books }, - Maui.ToolButton + ToolButton { - iconColor: active ? accentColor : textColor - colorScheme.highlightColor: accentColor - iconName: "tag" + icon.color: active ? accentColor : textColor + Kirigami.Theme.highlightColor: accentColor + icon.name: "tag" text: qsTr("Tags") - active: currentView === views.tags - showIndicator: true + checked: currentView === views.tags } ] // headBar.colorScheme.borderColor: Qt.darker(accentColor, 1.4) headBar.drawBorder: false headBar.implicitHeight: toolBarHeight * 1.5 - Rectangle { z: 999 anchors.right: parent.right anchors.bottom: parent.bottom anchors.margins: space.medium anchors.bottomMargin: toolBarHeight height: toolBarHeight width: height color: accentColor radius: radiusV Maui.PieButton { id: addButton anchors.fill : parent - iconName: "list-add" - iconColor: altColorText + icon.name: "list-add" + icon.color: altColorText barHeight: parent.height alignment: Qt.AlignLeft content: [ - Maui.ToolButton + ToolButton { - iconName: "view-notes" + icon.name: "view-notes" onClicked: newNote() }, - Maui.ToolButton + ToolButton { - iconName: "view-links" + icon.name: "view-links" onClicked: newLink() }, - Maui.ToolButton + ToolButton { - iconName: "view-books" + icon.name: "view-books" } ] } } Maui.SyncDialog { id: syncDialog } mainMenu: [ - Maui.MenuItem + MenuItem { text: qsTr("Syncing") onTriggered: syncDialog.open() } ] // /***** COMPONENTS *****/ NewNoteDialog { id: newNoteDialog onNoteSaved: notesView.list.insert(note) } NewNoteDialog { id: editNote onNoteSaved: notesView.list.update(note, notesView.currentIndex) } NewLinkDialog { id: newLinkDialog onLinkSaved: linksView.list.insert(link) } // /***** VIEWS *****/ SwipeView { id: swipeView anchors.fill: parent currentIndex: currentView onCurrentIndexChanged: { currentView = currentIndex if(currentView === views.notes) accentColor = "#ff9494" else if(currentView === views.links) accentColor = "#25affb" else if(currentView === views.books) accentColor = "#6bc5a5" } interactive: isMobile NotesView { id: notesView onNoteClicked: setNote(note) - altToolBars: !isMobile } LinksView { id: linksView onLinkClicked: previewLink(link) - altToolBars: !isMobile } BooksView { id: booksView } } function newNote() { currentView = views.notes newNoteDialog.open() } function newLink() { currentView = views.links newLinkDialog.open() } function setNote(note) { var tags = notesView.list.getTags(notesView.currentIndex) note.tags = tags notesView.currentNote = note editNote.fill(note) } function previewLink(link) { var tags = linksView.list.getTags(linksView.currentIndex) link.tags = tags linksView.previewer.show(link) } } diff --git a/src/views/books/BooksView.qml b/src/views/books/BooksView.qml index 21e03ee..9bc04c6 100644 --- a/src/views/books/BooksView.qml +++ b/src/views/books/BooksView.qml @@ -1,27 +1,27 @@ import QtQuick 2.9 import "../../widgets" import org.kde.mauikit 1.0 as Maui Maui.Page { id: control property alias cardsView : cardsView headBar.visible: false - margins: isMobile ? space.big : space.enormous + padding: isMobile ? space.big : space.enormous CardsView { id: cardsView anchors.fill: parent // onItemClicked: linkClicked(cardsView.model.get(index)) holder.emoji: "qrc:/E-reading.png" holder.isMask: false holder.title : "No Books!" holder.body: "Click here to save a new link" holder.emojiSize: iconSizes.huge } } diff --git a/src/views/links/LinksView.qml b/src/views/links/LinksView.qml index dc1f5fe..a751ebd 100644 --- a/src/views/links/LinksView.qml +++ b/src/views/links/LinksView.qml @@ -1,214 +1,213 @@ import QtQuick 2.9 import QtQuick.Controls 2.3 import org.kde.mauikit 1.0 as Maui import org.kde.kirigami 2.2 as Kirigami import BuhoModel 1.0 import Links 1.0 import OWL 1.0 import "../../widgets" Maui.Page { id: control property alias cardsView : cardsView property alias previewer : previewer property alias model : linksModel property alias list : linksList property alias currentIndex : cardsView.currentIndex property var currentLink : ({}) signal linkClicked(var link) headBar.visible: !cardsView.holder.visible headBar.drawBorder: false - margins: space.big - headBarExit: false - headBarTitle : cardsView.count + " links" + padding: space.big + title : cardsView.count + " links" headBar.leftContent: [ - Maui.ToolButton + ToolButton { - iconName: cardsView.gridView ? "view-list-icons" : "view-list-details" + icon.name: cardsView.gridView ? "view-list-icons" : "view-list-details" onClicked: cardsView.gridView = !cardsView.gridView }, - Maui.ToolButton + ToolButton { - iconName: "view-sort" + icon.name: "view-sort" onClicked: sortMenu.open(); Menu { id: sortMenu - Maui.MenuItem + MenuItem { text: qsTr("Ascedent") checkable: true checked: linksList.order === Links.ASC onTriggered: linksList.order = Links.ASC } - Maui.MenuItem + MenuItem { text: qsTr("Descendent") checkable: true checked: linksList.order === Links.DESC onTriggered: linksList.order = Links.DESC } MenuSeparator{} - Maui.MenuItem + MenuItem { text: qsTr("Title") onTriggered: KEY.TITLE } - Maui.MenuItem + MenuItem { text: qsTr("Color") onTriggered: linksList.sortBy = KEY.COLOR } - Maui.MenuItem + MenuItem { text: qsTr("Add date") onTriggered: linksList.sortBy = KEY.ADD_DATE } - Maui.MenuItem + MenuItem { text: qsTr("Updated") onTriggered: linksList.sortBy = KEY.UPDATED } - Maui.MenuItem + MenuItem { text: qsTr("Fav") onTriggered: linksList.sortBy = KEY.FAV } } } ] headBar.rightContent: [ - Maui.ToolButton + ToolButton { - iconName: "tag-recents" + icon.name: "tag-recents" }, - Maui.ToolButton + ToolButton { - iconName: "edit-pin" + icon.name: "edit-pin" }, - Maui.ToolButton + ToolButton { - iconName: "view-calendar" + icon.name: "view-calendar" } ] Previewer { id: previewer onLinkSaved: linksList.update(link, linksView.currentIndex) } Links { id: linksList } BuhoModel { id: linksModel list: linksList } CardsView { id: cardsView anchors.fill: parent holder.emoji: "qrc:/Astronaut.png" holder.isMask: false holder.title : "No Links!" holder.body: "Click here to save a new link" holder.emojiSize: iconSizes.huge itemHeight: unit * 250 model: linksModel delegate: LinkCardDelegate { id: delegate cardWidth: Math.min(cardsView.cellWidth, cardsView.itemWidth) - Kirigami.Units.largeSpacing * 2 cardHeight: cardsView.itemHeight anchors.left: parent.left anchors.leftMargin: cardsView.width <= cardsView.itemWidth ? 0 : (index % 2 === 0 ? Math.max(0, cardsView.cellWidth - cardsView.itemWidth) : cardsView.cellWidth) onClicked: { currentIndex = index currentLink = linksList.get(index) linkClicked(linksList.get(index)) } onRightClicked: { currentIndex = index currentLink = linksList.get(index) cardsView.menu.popup() } onPressAndHold: { currentIndex = index currentLink = linksList.get(index) cardsView.menu.popup() } } Connections { target: cardsView.holder onActionTriggered: newLink() } Connections { target: cardsView.menu onDeleteClicked: linksList.remove(cardsView.currentIndex) onOpened: { cardsView.menu.isFav = currentLink.fav == 1 ? true : false cardsView.menu.isPin = currentLink.pin == 1 ? true : false } onColorClicked: { linksList.update(({"color": color}), cardsView.currentIndex) } onFavClicked: { linksList.update(({"fav": fav}), cardsView.currentIndex) } onPinClicked: { linksList.update(({"pin": pin}), cardsView.currentIndex) } onCopyClicked: { Maui.Handy.copyToClipboard(currentLink.title+"\n"+currentLink.link) } } } } diff --git a/src/views/links/Previewer.qml b/src/views/links/Previewer.qml index 3defbcd..4c6055c 100644 --- a/src/views/links/Previewer.qml +++ b/src/views/links/Previewer.qml @@ -1,164 +1,164 @@ import QtQuick 2.0 import QtQuick.Controls 2.2 import QtQuick.Layouts 1.0 import org.kde.mauikit 1.0 as Maui import "../../widgets" Maui.Dialog { parent: parent heightHint: 0.97 widthHint: 0.97 maxWidth: 800*unit maxHeight: maxWidth - page.margins: 0 + page.padding: 0 property color selectedColor : "transparent" property alias webView: webViewer.item signal linkSaved(var link) headBar.leftContent: [ - Maui.ToolButton + ToolButton { id: pinButton - iconName: "edit-pin" + icon.name: "edit-pin" checkable: true - iconColor: checked ? highlightColor : textColor + icon.color: checked ? highlightColor : textColor // onClicked: checked = !checked }, - Maui.ToolButton + ToolButton { - iconName: "document-save" + icon.name: "document-save" }, - Maui.ToolButton + ToolButton { - iconName: "document-launch" + icon.name: "document-launch" onClicked: Maui.FM.openUrl(webView.url) } ] headBar.rightContent: ColorsBar { id: colorBar onColorPicked: selectedColor = color } footBar.leftContent: [ - Maui.ToolButton + ToolButton { id: favButton - iconName: "love" + icon.name: "love" checkable: true - iconColor: checked ? "#ff007f" : textColor + icon.color: checked ? "#ff007f" : textColor }, - Maui.ToolButton + ToolButton { - iconName: "document-share" + icon.name: "document-share" onClicked: isAndroid ? Maui.Android.shareLink(webView.url) : shareDialog.show(webView.url) }, - Maui.ToolButton + ToolButton { - iconName: "document-export" + icon.name: "document-export" }, - Maui.ToolButton + ToolButton { - iconName: "entry-delete" + icon.name: "entry-delete" } ] onAccepted: { packLink() close() } onRejected: close() acceptText: qsTr("Save") rejectText: qsTr("Discard") // colorScheme.backgroundColor: selectedColor ColumnLayout { anchors.fill: parent // Item // { // Layout.fillWidth: true // height: rowHeightAlt // Label // { // clip: true // text: webView.title // width: parent.width // height: parent.height // horizontalAlignment: Qt.AlignHCenter // verticalAlignment: Qt.AlignVCenter // font.bold: true // font.pointSize: fontSizes.big // font.weight: Font.Bold // elide: Label.ElideRight // } // } Loader { id: webViewer Layout.fillWidth: true Layout.fillHeight: true Layout.margins: 0 source: isAndroid ? "qrc:/src/views/links/WebViewAndroid.qml" : "qrc:/src/views/links/WebViewLinux.qml" onVisibleChanged: { if(!visible) webView.url = "about:blank" } } Maui.TagsBar { id: tagBar Layout.fillWidth: true allowEditMode: true list.abstract: true list.key: "links" onTagsEdited: list.updateToAbstract(tags) onTagRemovedClicked: list.removeFromAbstract(index) } } function show(link) { console.log("STATE:" , link.fav) webView.url = link.link tagBar.list.lot = link.link pinButton.checked = link.pin == 1 favButton.checked = link.fav == 1 selectedColor = link.color open() } function packLink() { console.log(favButton.checked) linkSaved({ title: webView.title, link: webView.url, color: selectedColor, tag: tagBar.getTags(), pin: pinButton.checked ? 1 : 0, fav: favButton.checked ? 1 : 0, updated: new Date() }) } } diff --git a/src/views/notes/NotesView.qml b/src/views/notes/NotesView.qml index d5458c8..b5c9204 100644 --- a/src/views/notes/NotesView.qml +++ b/src/views/notes/NotesView.qml @@ -1,247 +1,246 @@ import QtQuick 2.9 import QtQuick.Controls 2.3 import QtQuick.Layouts 1.3 import org.kde.mauikit 1.0 as Maui import org.kde.kirigami 2.2 as Kirigami import BuhoModel 1.0 import Notes 1.0 import OWL 1.0 //To get the enums import "../../widgets" Maui.Page { property var currentNote : ({}) property alias cardsView : cardsView property alias model : notesModel property alias list : notesList property alias currentIndex : cardsView.currentIndex signal noteClicked(var note) - margins: space.big + padding: space.big - headBarExit : false headBar.drawBorder: false headBar.visible: !cardsView.holder.visible - headBarTitle : cardsView.count + " notes" + title : cardsView.count + " notes" headBar.leftContent: [ - Maui.ToolButton + ToolButton { - iconName: cardsView.gridView ? "view-list-details" : "view-list-icons" + icon.name: cardsView.gridView ? "view-list-details" : "view-list-icons" onClicked: { cardsView.gridView = !cardsView.gridView } } ] headBar.rightContent: [ - Maui.ToolButton + ToolButton { - iconName: "view-sort" + icon.name: "view-sort" onClicked: sortMenu.open(); - Maui.Menu + Menu { id: sortMenu parent: parent - Maui.MenuItem + MenuItem { text: qsTr("Ascedent") checkable: true checked: notesList.order === Notes.ASC onTriggered: notesList.order = Notes.ASC } - Maui.MenuItem + MenuItem { text: qsTr("Descendent") checkable: true checked: notesList.order === Notes.DESC onTriggered: notesList.order = Notes.DESC } MenuSeparator{} - Maui.MenuItem + MenuItem { text: qsTr("Title") checkable: true checked: notesList.sortBy === KEY.TITLE onTriggered: notesList.sortBy = KEY.TITLE } - Maui.MenuItem + MenuItem { text: qsTr("Color") checkable: true checked: notesList.sortBy === KEY.COLOR onTriggered: notesList.sortBy = KEY.COLOR } - Maui.MenuItem + MenuItem { text: qsTr("Add date") checkable: true checked: notesList.sortBy === KEY.ADD_DATE onTriggered: notesList.sortBy = KEY.ADD_DATE } - Maui.MenuItem + MenuItem { text: qsTr("Updated") checkable: true checked: notesList.sortBy === KEY.UPDATED onTriggered: notesList.sortBy = KEY.UPDATED } - Maui.MenuItem + MenuItem { text: qsTr("Fav") checkable: true checked: notesList.sortBy === KEY.FAV onTriggered: notesList.sortBy = KEY.FAV } } }, - Maui.ToolButton + ToolButton { id: pinButton - iconName: "edit-pin" + icon.name: "edit-pin" checkable: true - iconColor: checked ? highlightColor : textColor + icon.color: checked ? highlightColor : textColor } ] Notes { id: notesList } BuhoModel { id: notesModel list: notesList } ColumnLayout { anchors.fill: parent spacing: 0 Rectangle { visible: pinButton.checked Layout.alignment: Qt.AlignVCenter Layout.fillWidth: true height: cardsView.itemHeight CardsList { id: pinnedList height: parent.height *0.9 width: parent.width * 0.9 anchors.centerIn: parent itemHeight: cardsView.itemHeight * 0.9 itemWidth: itemHeight * 1.5 onItemClicked: noteClicked(cardsView.model.get(index)) } color: altColor radius: radiusV border.color: Qt.darker(altColor, 1.4) } CardsView { id: cardsView Layout.fillHeight: true Layout.fillWidth: true width: parent.width holder.emoji: "qrc:/Type.png" holder.emojiSize: iconSizes.huge holder.isMask: false holder.title : "No notes!" holder.body: "Click here to create a new note" model: notesModel delegate: CardDelegate { id: delegate cardWidth: Math.min(cardsView.cellWidth, cardsView.itemWidth) - Kirigami.Units.largeSpacing * 2 cardHeight: cardsView.itemHeight anchors.left: parent.left anchors.leftMargin: cardsView.width <= cardsView.itemWidth ? 0 : (index % 2 === 0 ? Math.max(0, cardsView.cellWidth - cardsView.itemWidth) : cardsView.cellWidth) onClicked: { currentIndex = index currentNote = notesList.get(index) noteClicked(currentNote) } onRightClicked: { currentIndex = index currentNote = notesList.get(index) cardsView.menu.popup() } onPressAndHold: { currentIndex = index currentNote = notesList.get(index) cardsView.menu.popup() } } Connections { target: cardsView.holder onActionTriggered: newNote() } Connections { target: cardsView.menu onOpened: { cardsView.menu.isFav = currentNote.fav == 1 cardsView.menu.isPin = currentNote.pin == 1 } onDeleteClicked: notesList.remove(cardsView.currentIndex) onColorClicked: { notesList.update(({"color": color}), cardsView.currentIndex) } onFavClicked: { notesList.update(({"fav": fav}), cardsView.currentIndex) } onPinClicked: { notesList.update(({"pin": pin}), cardsView.currentIndex) } onCopyClicked: { Maui.Handy.copyToClipboard(currentNote.title+"\n"+currentNote.body) } } } } } diff --git a/src/widgets/CardMenu.qml b/src/widgets/CardMenu.qml index ad4013f..fb0d8ae 100644 --- a/src/widgets/CardMenu.qml +++ b/src/widgets/CardMenu.qml @@ -1,87 +1,87 @@ import QtQuick 2.9 import QtQuick.Controls 2.3 import org.kde.mauikit 1.0 as Maui -Maui.Menu +Menu { implicitWidth: colorBar.implicitWidth + space.medium property bool isFav : false property bool isPin: false signal deleteClicked() signal colorClicked(color color) signal favClicked(int fav) signal pinClicked(int pin) signal copyClicked() - Maui.MenuItem + MenuItem { text: qsTr(isFav? "UnFav" : "Fav") onTriggered: { favClicked(!isFav) close() } } - Maui.MenuItem + MenuItem { text: qsTr(isPin? "UnPin" : "Pin") onTriggered: { pinClicked(!isPin) close() } } - Maui.MenuItem + MenuItem { text: qsTr("Export") onTriggered: { close() } } - Maui.MenuItem + MenuItem { text: qsTr("Copy") onTriggered: { copyClicked() close() } } - Maui.MenuItem + MenuItem { text: qsTr("Delete") onTriggered: { deleteClicked() close() } } MenuSeparator { } - Maui.MenuItem + MenuItem { width: parent.width height: rowHeight ColorsBar { id: colorBar anchors.centerIn: parent onColorPicked: { colorClicked(color) close() } } } } diff --git a/src/widgets/NewLinkDialog.qml b/src/widgets/NewLinkDialog.qml index 6f36fd9..7a1be8a 100644 --- a/src/widgets/NewLinkDialog.qml +++ b/src/widgets/NewLinkDialog.qml @@ -1,234 +1,234 @@ import QtQuick 2.9 import QtQuick.Controls 2.2 import QtQuick.Layouts 1.0 import org.kde.mauikit 1.0 as Maui import org.kde.kirigami 2.2 as Kirigami Maui.Dialog { parent: parent heightHint: 0.95 widthHint: 0.95 maxHeight: previewReady ? unit * 800 : contentLayout.implicitHeight maxWidth: unit *700 signal linkSaved(var link) property string selectedColor : "#ffffe6" property string fgColor: Qt.darker(selectedColor, 2.5) property bool previewReady : false x: (parent.width / 2) - (width / 2) y: (parent.height /2 ) - (height / 2) modal: true padding: isAndroid ? 1 : undefined Connections { target: linker onPreviewReady: { previewReady = true fill(link) } } headBar.visible: previewReady footBar.visible: previewReady - headBar.leftContent: Maui.ToolButton + headBar.leftContent: ToolButton { id: pinButton - iconName: "window-pin" + icon.name: "window-pin" checkable: true - iconColor: checked ? highlightColor : textColor + icon.color: checked ? highlightColor : textColor // onClicked: checked = !checked } headBar.rightContent: ColorsBar { onColorPicked: selectedColor = color } footBar.leftContent: [ - Maui.ToolButton + ToolButton { id: favButton - iconName: "love" + icon.name: "love" checkable: true - iconColor: checked ? "#ff007f" : textColor + icon.color: checked ? "#ff007f" : textColor }, - Maui.ToolButton + ToolButton { - iconName: "document-share" + icon.name: "document-share" onClicked: isAndroid ? Maui.Android.shareText(link.text) : shareDialog.show(link.text) }, - Maui.ToolButton + ToolButton { - iconName: "document-export" + icon.name: "document-export" } ] acceptText: qsTr("Save") rejectText: qsTr("Discard") onAccepted: { packLink() clear() } onRejected: clear() ColumnLayout { id: contentLayout anchors.fill: parent TextField { id: link Layout.fillWidth: true Layout.margins: space.medium height: rowHeight verticalAlignment: Qt.AlignVCenter placeholderText: qsTr("URL") font.weight: Font.Bold font.bold: true font.pointSize: fontSizes.large color: fgColor Layout.alignment: Qt.AlignCenter background: Rectangle { color: "transparent" } onAccepted: linker.extract(link.text) } TextField { id: title visible: previewReady Layout.fillWidth: true Layout.margins: space.medium height: 24 placeholderText: qsTr("Title") font.weight: Font.Bold font.bold: true font.pointSize: fontSizes.large color: fgColor background: Rectangle { color: "transparent" } } Item { Layout.fillWidth: true Layout.fillHeight: true visible: previewReady ListView { id: previewList anchors.fill: parent anchors.centerIn: parent visible: count > 0 clip: true snapMode: ListView.SnapOneItem orientation: ListView.Horizontal interactive: count > 1 highlightFollowsCurrentItem: true model: ListModel{} onMovementEnded: { var index = indexAt(contentX, contentY) currentIndex = index } delegate: ItemDelegate { height: previewList.height width: previewList.width background: Rectangle { color: "transparent" } Image { id: img source: model.url fillMode: Image.PreserveAspectFit asynchronous: true width: parent.width height: parent.height sourceSize.height: height horizontalAlignment: Qt.AlignHCenter verticalAlignment: Qt.AlignVCenter } } } } Maui.TagsBar { id: tagBar visible: previewReady Layout.fillWidth: true allowEditMode: true list.abstract: true list.key: "links" onTagsEdited: list.updateToAbstract(tags) onTagRemovedClicked: list.removeFromAbstract(index) } } function clear() { title.clear() link.clear() previewList.model.clear() tagBar.clear() previewReady = false close() } function fill(link) { title.text = link.title populatePreviews(link.image) tagBar.list.lot= link.url open() } function populatePreviews(imgs) { for(var i in imgs) { console.log("PREVIEW:", imgs[i]) previewList.model.append({url : imgs[i]}) } } function packLink() { var data = ({ link : link.text, title: title.text, preview: previewList.count > 0 ? previewList.model.get(previewList.currentIndex).url : "", color: selectedColor, tag: tagBar.getTags(), pin: pinButton.checked, fav: favButton.checked }) linkSaved(data) } } diff --git a/src/widgets/NewNoteDialog.qml b/src/widgets/NewNoteDialog.qml index 76a123f..0799caf 100644 --- a/src/widgets/NewNoteDialog.qml +++ b/src/widgets/NewNoteDialog.qml @@ -1,231 +1,232 @@ import QtQuick 2.9 import QtQuick.Controls 2.2 import QtQuick.Layouts 1.0 import org.kde.mauikit 1.0 as Maui +import org.kde.kirigami 2.6 as Kirigami Maui.Dialog { id: control parent: parent heightHint: 0.95 widthHint: 0.95 maxWidth: 700*unit maxHeight: maxWidth property string selectedColor : "#ffffe6" property string fgColor: Qt.darker(selectedColor, 3) property bool showEditActions : false rejectButton.visible: false signal noteSaved(var note) - page.margins: 0 + page.padding: 0 colorScheme.backgroundColor: selectedColor colorScheme.textColor: fgColor headBar.leftContent: [ - Maui.ToolButton + ToolButton { - iconName: "edit-undo" + icon.name: "edit-undo" enabled: editor.body.canUndo onClicked: editor.body.undo() opacity: enabled ? 1 : 0.5 - iconColor: control.colorScheme.textColor + icon.color: control.colorScheme.textColor }, - Maui.ToolButton + ToolButton { - iconName: "edit-redo" + icon.name: "edit-redo" enabled: editor.body.canRedo onClicked: editor.body.redo() opacity: enabled ? 1 : 0.5 - iconColor: control.colorScheme.textColor + icon.color: control.colorScheme.textColor }, - Maui.ToolButton + ToolButton { - iconName: "format-text-bold" + icon.name: "format-text-bold" focusPolicy: Qt.TabFocus - iconColor: checked ? highlightColor : control.colorScheme.textColor + icon.color: checked ? highlightColor : control.colorScheme.textColor checkable: true checked: editor.document.bold onClicked: editor.document.bold = !editor.document.bold }, - Maui.ToolButton + ToolButton { - iconName: "format-text-italic" - iconColor: checked ? highlightColor : control.colorScheme.textColor + icon.name: "format-text-italic" + icon.color: checked ? highlightColor : control.colorScheme.textColor focusPolicy: Qt.TabFocus checkable: true checked: editor.document.italic onClicked: editor.document.italic = !editor.document.italic }, - Maui.ToolButton + ToolButton { - iconName: "format-text-underline" - iconColor: checked ? highlightColor : control.colorScheme.textColor + icon.name: "format-text-underline" + icon.color: checked ? highlightColor : control.colorScheme.textColor focusPolicy: Qt.TabFocus checkable: true checked: editor.document.underline onClicked: editor.document.underline = !editor.document.underline }, - Maui.ToolButton + ToolButton { - iconName: "format-text-uppercase" - iconColor: checked ? highlightColor : control.colorScheme.textColor + icon.name: "format-text-uppercase" + icon.color: checked ? highlightColor : control.colorScheme.textColor focusPolicy: Qt.TabFocus checkable: true checked: editor.document.uppercase onClicked: editor.document.uppercase = !editor.document.uppercase }, - Maui.ToolButton + ToolButton { - iconName: "image" - iconColor: control.colorScheme.textColor + icon.name: "image" + icon.color: control.colorScheme.textColor } ] headBar.rightContent: ColorsBar { onColorPicked: selectedColor = color } footBar.leftContent: [ - Maui.ToolButton + ToolButton { id: pinButton - iconName: "edit-pin" + icon.name: "edit-pin" checkable: true - iconColor: checked ? highlightColor : control.colorScheme.textColor + icon.color: checked ? highlightColor : control.colorScheme.textColor // onClicked: checked = !checked }, - Maui.ToolButton + ToolButton { id: favButton - iconName: "love" + icon.name: "love" checkable: true - iconColor: checked ? "#ff007f" : control.colorScheme.textColor + icon.color: checked ? "#ff007f" : control.colorScheme.textColor }, - Maui.ToolButton + ToolButton { - iconName: "document-share" + icon.name: "document-share" onClicked: isAndroid ? Maui.Android.shareText(editor.body.text) : shareDialog.show(editor.body.text) - iconColor: control.colorScheme.textColor + icon.color: control.colorScheme.textColor }, - Maui.ToolButton + ToolButton { - iconName: "document-export" - iconColor: control.colorScheme.textColor + icon.name: "document-export" + icon.color: control.colorScheme.textColor }, - Maui.ToolButton + ToolButton { - iconName: "entry-delete" - iconColor: control.colorScheme.textColor + icon.name: "entry-delete" + icon.color: control.colorScheme.textColor } ] acceptText: qsTr("Save") rejectText: qsTr("Discard") onAccepted: { if(editor.body.text.length > 0) packNote() clear() } onRejected: clear() ColumnLayout { anchors.fill: parent TextField { id: title Layout.fillWidth: true Layout.margins: space.medium height: 24 placeholderText: qsTr("Title") font.weight: Font.Bold font.bold: true font.pointSize: fontSizes.large color: fgColor background: Rectangle { color: "transparent" } } Maui.Editor { id: editor Layout.fillHeight: true Layout.fillWidth: true - colorScheme.backgroundColor: selectedColor + Kirigami.Theme.backgroundColor: selectedColor + Kirigami.Theme.textColor: control.colorScheme.textColor headBar.visible: false - colorScheme.textColor: control.colorScheme.textColor } Maui.TagsBar { id: tagBar Layout.fillWidth: true allowEditMode: true list.abstract: true list.key: "notes" onTagsEdited: list.updateToAbstract(tags) onTagRemovedClicked: list.removeFromAbstract(index) - colorScheme.backgroundColor: "transparent" - colorScheme.textColor: control.colorScheme.textColor + Kirigami.Theme.backgroundColor: "transparent" + Kirigami.Theme.textColor: control.colorScheme.textColor } } onOpened: if(isMobile) editor.body.forceActiveFocus() function clear() { title.clear() editor.body.clear() close() } function fill(note) { title.text = note.title editor.body.text = note.body selectedColor = note.color pinButton.checked = note.pin == 1 favButton.checked = note.fav == 1 tagBar.list.lot= note.id open() } function packNote() { noteSaved({ id: notesView.currentNote.id, title: title.text.trim(), body: editor.body.text, color: selectedColor, tag: tagBar.getTags(), pin: pinButton.checked ? 1 : 0, fav: favButton.checked ? 1 : 0, updated: new Date() }) } }