diff --git a/android/android.pri b/android/android.pri index 9881739..48f4d86 100644 --- a/android/android.pri +++ b/android/android.pri @@ -1,20 +1,5 @@ QT += androidextras webview -DISTFILES += \ - $$PWD/qtquickcontrols2.conf - - -DISTFILES += \ - $$PWD/AndroidManifest.xml \ - $$PWD/gradle/wrapper/gradle-wrapper.jar \ - $$PWD/gradlew \ - $$PWD/res/values/libs.xml \ - $$PWD/build.gradle \ - $$PWD/gradle/wrapper/gradle-wrapper.properties \ - $$PWD/gradlew.bat - - -ANDROID_PACKAGE_SOURCE_DIR = $$PWD - RESOURCES += \ - $$PWD/../icons.qrc + $$PWD/../icons.qrc \ + $$PWD/android.qrc diff --git a/android/android.qrc b/android/android.qrc new file mode 100644 index 0000000..4fbf17b --- /dev/null +++ b/android/android.qrc @@ -0,0 +1,5 @@ + + + qtquickcontrols2.conf + + diff --git a/buho.pro b/buho.pro index c1c0831..877090a 100644 --- a/buho.pro +++ b/buho.pro @@ -1,88 +1,78 @@ QT += qml QT += quick QT += sql QT += widgets QT += quickcontrols2 CONFIG += c++11 +CONFIG += ordered + +TARGET = buho +TEMPLATE = app + +DESTDIR = $$OUT_PWD/../ + +linux:unix:!android { + + message(Building for Linux KDE) + QT += webengine + +} else:android { + + message(Building helpers for Android) + include($$PWD/3rdparty/kirigami/kirigami.pri) + include($$PWD/android/android.pri) + include($$PWD/android/openssl/openssl.pri) + DEFINES += STATIC_KIRIGAMI + +} else { + message("Unknown configuration") +} + + +include($$PWD/mauikit/mauikit.pri) +include($$PWD/QGumboParser/QGumboParser.pri) DEFINES += QT_DEPRECATED_WARNINGS SOURCES += \ main.cpp \ src/db/db.cpp \ src/db/dbactions.cpp \ src/buho.cpp \ src/documenthandler.cpp \ src/linker.cpp \ src/utils/htmlparser.cpp RESOURCES += \ qml.qrc # Additional import path used to resolve QML modules in Qt Creator's code model QML_IMPORT_PATH = # Additional import path used to resolve QML modules just for Qt Quick Designer QML_DESIGNER_IMPORT_PATH = # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin else: unix:!android: target.path = /opt/$${TARGET}/bin !isEmpty(target.path): INSTALLS += target -include($$PWD/mauikit/mauikit.pri) -include($$PWD/QGumboParser/QGumboParser.pri) - -linux:unix:!android { - - message(Building for Linux KDE) - QT += webengine - - -} else:android { - - message(Building helpers for Android) - include($$PWD/3rdparty/kirigami/kirigami.pri) - include($$PWD/android/android.pri) - include($$PWD/android/openssl/openssl.pri) - DEFINES += STATIC_KIRIGAMI - -} else { - message("Unknown configuration") -} DISTFILES += \ src/db/script.sql \ src/utils/owl.js \ - android/AndroidManifest.xml \ - android/gradle/wrapper/gradle-wrapper.jar \ - android/gradlew \ - android/res/values/libs.xml \ - android/build.gradle \ - android/gradle/wrapper/gradle-wrapper.properties \ - android/gradlew.bat \ - android/AndroidManifest.xml \ - android/gradle/wrapper/gradle-wrapper.jar \ - android/gradlew \ - android/res/values/libs.xml \ - android/build.gradle \ - android/gradle/wrapper/gradle-wrapper.properties \ - android/gradlew.bat HEADERS += \ src/db/db.h \ src/db/dbactions.h \ src/buho.h \ src/utils/owl.h \ src/documenthandler.h \ src/linker.h \ src/utils/htmlparser.h INCLUDEPATH += \ src/utils/ \ src/ - -ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android - diff --git a/src/views/links/Previewer.qml b/src/views/links/Previewer.qml index 2e2d9af..b1f4a0e 100644 --- a/src/views/links/Previewer.qml +++ b/src/views/links/Previewer.qml @@ -1,96 +1,104 @@ import QtQuick 2.0 import QtQuick.Controls 2.2 import QtQuick.Layouts 1.0 import org.kde.maui 1.0 as Maui Popup { parent: ApplicationWindow.overlay height: parent.height * 0.9 width: parent.width * (isMobile ? 0.9 : 0.7) x: (parent.width / 2) - (width / 2) y: (parent.height /2 ) - (height / 2) modal: true clip: true padding: isAndroid ? 2 : "undefined" property alias webView: webViewer.item Maui.Page { anchors.fill: parent margins: 0 padding: 0 onExit: close() + headBar.leftContent: Maui.ToolButton + { + + iconName: "document-share" + onClicked: isAndroid ? Maui.Android.shareLink(webView.url) : + shareDialog.show(webView.url) + } headBar.rightContent: [ Maui.ToolButton { iconName: "entry-delete" }, Maui.ToolButton { iconName: "document-save" }, Maui.ToolButton { iconName: "view-fullscreen" onClicked: owl.openLink(webView.url) } ] + headBar.middleContent: Label { clip: true text: webView.title width: headBar.width * 0.5 horizontalAlignment: Qt.AlignHCenter font.bold: true font.pointSize: fontSizes.big font.weight: Font.Bold elide: Label.ElideRight } ColumnLayout { anchors.fill: parent Loader { id: webViewer Layout.fillWidth: true Layout.fillHeight: true 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 onTagsEdited: { for(var i in tags) append({tag : tags[i]}) } } } } function show(link) { webView.url = link.link tagBar.populate(link.tags) open() } } diff --git a/src/widgets/NewNoteDialog.qml b/src/widgets/NewNoteDialog.qml index a932277..012e548 100644 --- a/src/widgets/NewNoteDialog.qml +++ b/src/widgets/NewNoteDialog.qml @@ -1,322 +1,323 @@ import QtQuick 2.9 import QtQuick.Controls 2.2 import QtQuick.Layouts 1.0 import org.kde.maui 1.0 as Maui import org.buho.editor 1.0 Popup { parent: ApplicationWindow.overlay height: parent.height * (isMobile ? 0.8 : 0.7) width: parent.width * (isMobile ? 0.9 : 0.7) property string selectedColor : "#ffffe6" property string fgColor: Qt.darker(selectedColor, 2.5) property bool showEditActions : false signal noteSaved(var note) x: (parent.width / 2) - (width / 2) y: (parent.height /2 ) - (height / 2) modal: true padding: isAndroid ? 1 : "undefined" Maui.Page { id: content anchors.fill: parent margins: 0 onExit: clear() Rectangle { id: bg color: selectedColor z: -1 anchors.fill: parent } headBar.leftContent: [ Maui.ToolButton { iconName: "format-text-bold" focusPolicy: Qt.TabFocus iconColor: checked ? highlightColor : textColor checkable: true checked: document.bold onClicked: document.bold = !document.bold }, Maui.ToolButton { iconName: "format-text-italic-symbolic" iconColor: checked ? highlightColor : textColor focusPolicy: Qt.TabFocus checkable: true checked: document.italic onClicked: document.italic = !document.italic }, Maui.ToolButton { iconName: "format-text-underline-symbolic" }, Maui.ToolButton { iconName: "format-text-uppercase" }, Maui.ToolButton { iconName: "image" } ] headBar.rightContent: Row { spacing: space.medium Rectangle { color:"#ffded4" anchors.verticalCenter: parent.verticalCenter height: iconSizes.medium width: height radius: Math.max(height, width) border.color: borderColor MouseArea { anchors.fill: parent onClicked: selectedColor = parent.color } } Rectangle { color:"#d3ffda" anchors.verticalCenter: parent.verticalCenter height: iconSizes.medium width: height radius: Math.max(height, width) border.color: borderColor MouseArea { anchors.fill: parent onClicked: selectedColor = parent.color } } Rectangle { color:"#caf3ff" anchors.verticalCenter: parent.verticalCenter height: iconSizes.medium width: height radius: Math.max(height, width) border.color: borderColor MouseArea { anchors.fill: parent onClicked: selectedColor = parent.color } } Rectangle { color:"#ccc1ff" anchors.verticalCenter: parent.verticalCenter height: iconSizes.medium width: height radius: Math.max(height, width) border.color: borderColor MouseArea { anchors.fill: parent onClicked: selectedColor = parent.color } } Rectangle { color:"#ffcdf4" anchors.verticalCenter: parent.verticalCenter height: iconSizes.medium width: height radius: Math.max(height, width) border.color: borderColor MouseArea { anchors.fill: parent onClicked: selectedColor = parent.color } } Maui.ToolButton { iconName: "overflow-menu" } } 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" } } 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 { 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 background: Rectangle { color: "transparent" } } } Maui.TagsBar { id: tagBar Layout.fillWidth: true allowEditMode: true onTagsEdited: { for(var i in tags) append({tag : tags[i]}) } } } footBar.leftContent: [ Maui.ToolButton { iconName: "love" }, Maui.ToolButton { iconName: "document-share" - + onClicked: isAndroid ? Maui.Android.shareText(body.text) : + shareDialog.show(body.text) }, Maui.ToolButton { iconName: "document-export" }, Maui.ToolButton { iconName: "entry-delete" } ] footBar.rightContent: [ Button { id: save text: qsTr("Save") onClicked: { if(body.text.length > 0) noteSaved({ title: title.text, body: body.text, color: selectedColor, tags: tagBar.getTags() }) clear() } }, Button { id: discard text: qsTr("Discard") onClicked: clear() } ] } onOpened: body.forceActiveFocus() function clear() { title.clear() body.clear() close() } function fill(note) { document.load("qrc:/texteditor.html") title.text = note.title body.text = note.body selectedColor = note.color tagBar.populate(note.tags) open() } }