diff --git a/.gitignore b/.gitignore index 31e310b..33eb797 100644 --- a/.gitignore +++ b/.gitignore @@ -1,66 +1,66 @@ build/ src/android/icons/luv-icon-theme/ -src/utils/store/attica/headers +src/utils/store/attica/ src/utils/syncing/openssl/ demo/3rdparty/ demo/mauikit/ *.kdev4 *.directory *.*~ *.properties #android stuff src/android/AndroidManifest.xml src/android/res/* #.* *.*~ ~*.* ~.* # C++ objects and libs *.slo *.lo *.o *.a *.la *.lai *.so *.dll *.dylib # Qt-es object_script.*.Release object_script.*.Debug *_plugin_import.cpp /.qmake.cache /.qmake.stash *.pro.user *.pro.user.* *.qbs.user *.qbs.user.* *.moc moc_*.cpp moc_*.h qrc_*.cpp ui_*.h *.qmlc *.jsc Makefile* *build-* # Qt unit tests target_wrapper.* # QtCreator *.autosave # QtCreator Qml *.qmlproject.user *.qmlproject.user.* # QtCreator CMake CMakeLists.txt.user* diff --git a/maui-style/ToolButton.qml b/maui-style/ToolButton.qml index 6060afc..98491a9 100755 --- a/maui-style/ToolButton.qml +++ b/maui-style/ToolButton.qml @@ -1,81 +1,81 @@ /**************************************************************************** ** ** Copyright (C) 2017 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL3$ ** 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 http://www.qt.io/terms-conditions. For further ** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 3 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPLv3 included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 3 requirements ** will be met: https://www.gnu.org/licenses/lgpl.html. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 2.0 or later as published by the Free ** Software Foundation and appearing in the file LICENSE.GPL included in ** the packaging of this file. Please review the following information to ** ensure the GNU General Public License version 2.0 requirements will be ** met: http://www.gnu.org/licenses/gpl-2.0.html. ** ** $QT_END_LICENSE$ ** ****************************************************************************/ import QtQuick 2.10 import QtQuick.Controls 2.3 import QtQuick.Controls.impl 2.3 import QtQuick.Templates 2.3 as T import org.kde.kirigami 2.2 as Kirigami T.ToolButton { id: control implicitWidth: Math.max(background ? background.implicitWidth : 0, contentItem.implicitWidth + leftPadding + rightPadding) implicitHeight: Math.max(background ? background.implicitHeight : 0, contentItem.implicitHeight + topPadding + bottomPadding) baselineOffset: contentItem.y + contentItem.baselineOffset padding: Kirigami.Units.smallSpacing spacing: Kirigami.Units.smallSpacing - icon.width: Kirigami.Units.iconSizes.medium - icon.height: Kirigami.Units.iconSizes.medium + icon.width: Kirigami.Units.iconSizes.smallMedium + icon.height: Kirigami.Units.iconSizes.smallMedium icon.color: visualFocus ? control.palette.highlight : control.palette.buttonText flat: control.parent === T.ToolBar contentItem: IconLabel { spacing: control.spacing mirrored: control.mirrored display: control.display icon: control.icon text: control.text font: control.font color: control.visualFocus ? control.palette.highlight : control.palette.buttonText } background: Rectangle { implicitWidth: Kirigami.Units.iconSizes.medium implicitHeight: Kirigami.Units.iconSizes.medium radius: height * 0.05 opacity: control.down ? 1.0 : 0.5 - color: control.flat ? "transparent" : (control.down || control.checked || control.highlighted ? Kirigami.Theme.buttonHoverColor : control.palette.button) + color: (control.down || control.checked || control.highlighted ? Kirigami.Theme.buttonHoverColor : "transparent") } } diff --git a/mauikit.pri b/mauikit.pri index 2ea40ce..42395e5 100644 --- a/mauikit.pri +++ b/mauikit.pri @@ -1,200 +1,202 @@ QT += \ core \ qml \ quick \ gui \ svg \ concurrent \ CONFIG += c++11 linux:unix:!android { message(Building Maui helpers for Linux KDE) include($$PWD/src/kde/kde.pri) } else:android { message(Building Maui helpers for Android) include($$PWD/src/android/android.pri) include($$PWD/src/utils/syncing/openssl/openssl.pri) include($$PWD/src/utils/syncing/libwebdavclient/webdavclient.pri) include($$PWD/src/utils/store/attica/attica.pri) } else { message("Unknown configuration") } include($$PWD/src/utils/tagging/tagging.pri) RESOURCES += \ $$PWD/mauikit.qrc \ $$PWD/assets.qrc \ $$PWD/src/fm/fm.qrc \ $$PWD/src/utils/store/store.qrc \ $$PWD/maui-style/style.qrc HEADERS += \ $$PWD/src/mauikit.h \ $$PWD/src/fm/fm.h \ $$PWD/src/fm/fmh.h \ $$PWD/src/fm/fmdb.h \ $$PWD/src/fm/fmlist.h \ $$PWD/src/fm/pathlist.h \ $$PWD/src/fm/placeslist.h \ - $$PWD/src/fm/basemodel.h \ - $$PWD/src/fm/modellist.h \ + $$PWD/src/utils/model_template/mauimodel.h \ + $$PWD/src/utils/model_template/mauilist.h \ $$PWD/src/utils/editor/documenthandler.h \ $$PWD/src/utils/handy.h \ $$PWD/src/utils/syncing/syncing.h \ $$PWD/src/utils/syncing/syncinglist.h \ $$PWD/src/utils/syncing/syncingmodel.h \ $$PWD/src/utils/store/store.h \ $$PWD/src/utils/store/storemodel.h \ $$PWD/src/utils/store/storelist.h SOURCES += \ $$PWD/src/mauikit.cpp \ $$PWD/src/fm/fm.cpp \ $$PWD/src/fm/fmdb.cpp \ $$PWD/src/fm/fmlist.cpp \ $$PWD/src/fm/pathlist.cpp \ $$PWD/src/fm/placeslist.cpp \ - $$PWD/src/fm/basemodel.cpp \ - $$PWD/src/fm/modellist.cpp \ + $$PWD/src/utils/model_template/mauimodel.cpp \ + $$PWD/src/utils/model_template/mauilist.cpp \ $$PWD/src/utils//editor/documenthandler.cpp \ $$PWD/src/utils/handy.cpp \ $$PWD/src/utils/syncing/syncing.cpp \ $$PWD/src/utils/syncing/syncinglist.cpp \ $$PWD/src/utils/syncing/syncingmodel.cpp \ $$PWD/src/utils/store/store.cpp \ $$PWD/src/utils/store/storemodel.cpp \ $$PWD/src/utils/store/storelist.cpp DEPENDPATH += \ $$PWD/src \ $$PWD/src/fm + $$PWD/src/utils/model_template INCLUDEPATH += \ $$PWD/src \ $$PWD/src/fm \ $$PWD/src/utils \ $$PWD/src/utils/editor \ $$PWD/src/utils/syncing \ + $$PWD/src/utils/model_template \ $$PWD/src/utils/store DEFINES += \ MAUI_APP \ STATIC_MAUIKIT API_VER = 1.0 DISTFILES += \ $$PWD/CMakeLists.txt #ANDROID_EXTRA_LIBS += $$PWD/libs/bin/libKF5KIOFileWidgets.so #ANDROID_EXTRA_LIBS += $$PWD/libs/bin/libKF5KIOWidgets.so #ANDROID_EXTRA_LIBS += $$PWD/libs/bin/libKF5Bookmarks.so #ANDROID_EXTRA_LIBS += $$PWD/libs/bin/libKF5Solid.so #ANDROID_EXTRA_LIBS += $$PWD/libs/bin/libKF5XmlGui.so #ANDROID_EXTRA_LIBS += $$PWD/libs/bin/libKF5IconThemes.so #ANDROID_EXTRA_LIBS += $$PWD/libs/bin/libKF5KIOCore.so #ANDROID_EXTRA_LIBS += $$PWD/libs/bin/libKF5JobWidgets.so #ANDROID_EXTRA_LIBS += $$PWD/libs/bin/libKF5Service.so #ANDROID_EXTRA_LIBS += $$PWD/libs/bin/libKF5Completion.so #ANDROID_EXTRA_LIBS += $$PWD/libs/bin/libKF5ItemViews.so #ANDROID_EXTRA_LIBS += $$PWD/libs/bin/libKF5ConfigWidgets.so #ANDROID_EXTRA_LIBS += $$PWD/libs/bin/libKF5I18n.so #ANDROID_EXTRA_LIBS += $$PWD/libs/bin/libKF5WidgetsAddons.so #ANDROID_EXTRA_LIBS += $$PWD/libs/bin/libKF5Codecs.so #ANDROID_EXTRA_LIBS += $$PWD/libs/bin/libKF5ConfigGui.so #ANDROID_EXTRA_LIBS += $$PWD/libs/bin/libKF5ConfigCore.so #ANDROID_EXTRA_LIBS += $$PWD/libs/bin/libKF5ConfigCore.so #ANDROID_EXTRA_LIBS += $$PWD/libs/bin/libdbus-1.so ##KIOFileWidgets #LIBS += -L$$PWD/libs/bin/ -lKF5KIOFileWidgets #INCLUDEPATH += $$PWD/libs/includes/KIOFileWidgets #DEPENDPATH += $$PWD/libs/includes/KIOFileWidgets ##KBookmarks #LIBS += -L$$PWD/libs/bin/ -lKF5Bookmarks #INCLUDEPATH += $$PWD/libs/includes/KBookmarks #DEPENDPATH += $$PWD/libs/includes/KBookmarks ##KSolid #LIBS += -L$$PWD//libs/bin/ -lKF5Solid #INCLUDEPATH += $$PWD//libs/includes/Solid #DEPENDPATH += $$PWD/libs/includes/Solid ##KIOWidgets #LIBS += -L$$PWD/libs/bin/ -lKF5KIOWidgets #INCLUDEPATH += $$PWD/libs/includes/KIOWidgets #DEPENDPATH += $$PWD/libs/includes/KIOWidgets ##KXmlGui #LIBS += -L$$PWD/libs/bin/ -lKF5XmlGui #INCLUDEPATH += $$PWD/libs/includes/KXmlGui #DEPENDPATH += $$PWD/libs/includes/KXmlGui ##KIconThemes #LIBS += -L$$PWD/libs/bin/ -lKF5IconThemes #INCLUDEPATH += $$PWD/libs/includes/KIconThemes #DEPENDPATH += $$PWD/libs/includes/KIconThemes ##KIOCore #LIBS += -L$$PWD/libs/bin/ -lKF5KIOCore #INCLUDEPATH += $$PWD/libs/includes/KIOCore #DEPENDPATH += $$PWD/libs/includes/KIOCore ##KJobWidgets #LIBS += -L$$PWD/libs/bin/ -lKF5JobWidgets #INCLUDEPATH += $$PWD/libs/includes/KJobWidgets #DEPENDPATH += $$PWD/libs/includes/KJobWidgets ##KService #LIBS += -L$$PWD/libs/bin/ -lKF5Service #INCLUDEPATH += $$PWD/libs/includes/KService #DEPENDPATH += $$PWD/libs/includes/KService ##KCompletion #LIBS += -L$$PWD/libs/bin/ -lKF5Completion #INCLUDEPATH += $$PWD/libs/includes/KCompletion #DEPENDPATH += $$PWD/libs/includes/KCompletion ##KItemViews #LIBS += -L$$PWD/libs/bin/ -lKF5ItemViews #INCLUDEPATH += $$PWD/libs/includes/KItemViews #DEPENDPATH += $$PWD/libs/includes/KItemViews ##KConfigWidgets #LIBS += -L$$PWD/libs/bin/ -lKF5ConfigWidgets #INCLUDEPATH += $$PWD/libs/includes/KConfigWidgets #DEPENDPATH += $$PWD/libs/includes/KConfigWidgets ##KI18n #LIBS += -L$$PWD/libs/bin/ -lKF5I18n #INCLUDEPATH += $$PWD/libs/includes/KI18n #DEPENDPATH += $$PWD/libs/includes/KI18n ##KWidgetsAddons #LIBS += -L$$PWD/libs/bin/ -lKF5WidgetsAddons #INCLUDEPATH += $$PWD/libs/includes/KWidgetsAddons #DEPENDPATH += $$PWD/libs/includes/KWidgetsAddons ##KCodecs #LIBS += -L$$PWD/libs/bin/ -lKF5Codecs #INCLUDEPATH += $$PWD/libs/includes/KCodecs #DEPENDPATH += $$PWD/libs/includes/KCodecs ##KConfigGui #LIBS += -L$$PWD/libs/bin/ -lKF5ConfigGui #INCLUDEPATH += $$PWD/libs/includes/KConfigGui #DEPENDPATH += $$PWD/libs/includes/KConfigGui ##KConfigCore #LIBS += -L$$PWD/libs/bin/ -lKF5ConfigCore #INCLUDEPATH += $$PWD/libs/includes/KConfigCore #DEPENDPATH += $$PWD/libs/includes/KConfigCore diff --git a/src/controls/ApplicationWindow.qml b/src/controls/ApplicationWindow.qml index a2f65a8..89b5496 100644 --- a/src/controls/ApplicationWindow.qml +++ b/src/controls/ApplicationWindow.qml @@ -1,596 +1,596 @@ /* * Copyright 2018 Camilo Higuita * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import QtQuick 2.9 import QtQuick.Controls 2.2 import QtQuick.Window 2.0 import QtQuick.Layouts 1.3 import QtGraphicalEffects 1.0 import QtQuick.Window 2.3 import org.kde.kirigami 2.2 as Kirigami import org.kde.mauikit 1.0 as Maui import QtQuick.Controls.Material 2.1 import "private" import SyncingModel 1.0 import SyncingList 1.0 Kirigami.AbstractApplicationWindow { id: root visible: true width: Screen.width * (isMobile ? 1 : 0.4) height: Screen.height * (isMobile ? 1 : 0.4) contentItem.anchors.leftMargin: 0 contentItem.anchors.rightMargin: 0 contentItem.anchors.margins: 0 property bool showAccounts : true /***************************************************/ /******************** ALIASES *********************/ /*************************************************/ property alias page : page property alias footBar : page.footBar property alias headBar : page.headBar property alias dialog: dialogLoader.item property alias leftIcon : menuBtn property alias rightIcon : searchBtn default property alias content : page.content property alias mainMenu : mainMenu.contentData property alias about : aboutDialog property alias accounts: _accountsDialogLoader.item property alias currentAccount: _accountCombobox.currentText property alias notifyDialog: _notify //redefines here as here we can know a pointer to PageRow wideScreen: isWide /***************************************************/ /*********************** UI ***********************/ /*************************************************/ property bool isWide : root.width >= Kirigami.Units.gridUnit * 30 property int radiusV : unit * 4 property int iconSize : iconSizes.medium * (isMobile ? 0.95 : 1) readonly property int unit : Maui.Style.unit readonly property int rowHeight: Maui.Style.rowHeight readonly property int rowHeightAlt: Maui.Style.rowHeightAlt readonly property int toolBarHeight: Maui.Style.toolBarHeight readonly property int toolBarHeightAlt: Maui.Style.toolBarHeightAlt readonly property int contentMargins: space.medium readonly property var fontSizes: Maui.Style.fontSizes readonly property var space : Maui.Style.space readonly property var iconSizes : Maui.Style.iconSizes property string colorSchemeName : Qt.application.name /***************************************************/ /********************* COLORS *********************/ /*************************************************/ readonly property var colorScheme: ({ Default : 1, Light : 2, Dark: 3, Custom: 4 }) property color borderColor: Qt.tint(textColor, Qt.rgba(backgroundColor.r, backgroundColor.g, backgroundColor.b, 0.7)) property color backgroundColor: Maui.Style.backgroundColor property color textColor: Maui.Style.textColor property color highlightColor: Maui.Style.highlightColor property color highlightedTextColor: Maui.Style.highlightedTextColor property color buttonBackgroundColor: Maui.Style.buttonBackgroundColor property color viewBackgroundColor: Maui.Style.viewBackgroundColor property color altColor: Maui.Style.altColor property color altColorText: Maui.Style.altColorText property color accentColor : buttonBackgroundColor property color bgColor: viewBackgroundColor property color headBarBGColor: backgroundColor property color headBarFGColor: textColor readonly property string darkBorderColor: Qt.darker(darkBackgroundColor, 1.5) readonly property string darkBackgroundColor: "#303030" readonly property string darkTextColor: "#FAFAFA" readonly property string darkHighlightColor: "#29B6F6" readonly property string darkHighlightedTextColor: darkTextColor readonly property string darkViewBackgroundColor: "#212121" readonly property string darkDarkColor: "#191919" readonly property string darkButtonBackgroundColor : "#191919" readonly property color darkAltColor: "#333" readonly property color darkAltColorText: darkTextColor readonly property color darkAccentColor : darkButtonBackgroundColor readonly property color darkBgColor: darkBackgroundColor property color warningColor : Maui.Style.warningColor property color dangerColor : Maui.Style.dangerColor property color infoColor : Maui.Style.infoColor property color suggestedColor : Maui.Style.suggestedColor /* ANDROID THEMING*/ Material.theme: Material.Light Material.accent: highlightColor Material.background: headBarBGColor Material.primary: headBarBGColor Material.foreground: textColor /***************************************************/ /**************** READONLY PROPS ******************/ /*************************************************/ readonly property bool isMobile : Kirigami.Settings.isMobile readonly property bool isAndroid: Qt.platform.os == "android" readonly property real screenWidth : Screen.width readonly property real screenHeight : Screen.height /***************************************************/ /********************* PROPS **********************/ /*************************************************/ property bool altToolBars : isMobile property bool floatingBar : altToolBars property int footBarAligment : Qt.AlignCenter property bool footBarOverlap : false property bool allowRiseContent: floatingBar && footBarOverlap property int footBarMargins: space.big property alias searchButton : searchBtn property alias menuButton : menuBtn /***************************************************/ /******************** SIGNALS *********************/ /*************************************************/ signal menuButtonClicked(); signal searchButtonClicked(); signal goBackTriggered(); signal goFowardTriggered(); // overlay.modal: Rectangle // { // color: Color.transparent(altColor, 0.5) // } // overlay.modeless: Rectangle { // color: "transparent" // } onClosing: { if(!isMobile) { var height = root.height var width = root.width var x = root.x var y = root.y Maui.FM.saveSettings("GEOMETRY", Qt.rect(x, y, width, height), "WINDOW") } } property bool isPortrait: Screen.primaryOrientation === Qt.PortraitOrientation || Screen.primaryOrientation === Qt.InvertedPortraitOrientation onIsPortraitChanged: { if(isPortrait) { console.log("PORTARIT MODE CHANGED") width: Screen.width height: Screen.height } } onHeadBarBGColorChanged: { if(!isMobile && colorSchemeName.length > 0 && !altToolBars) Maui.KDE.setColorScheme(colorSchemeName, headBarBGColor, headBarFGColor) else if(isAndroid && !altToolBars) Maui.Android.statusbarColor(headBarBGColor, false) else if(isAndroid && altToolBars) Maui.Android.statusbarColor(viewBackgroundColor, true) } onHeadBarFGColorChanged: { if(!isAndroid && !isMobile && colorSchemeName.length > 0 && !altToolBars) Maui.KDE.setColorScheme(colorSchemeName, headBarBGColor, headBarFGColor) else if(isAndroid && !altToolBars) Maui.Android.statusbarColor(headBarBGColor, false) else if(isAndroid && altToolBars) Maui.Android.statusbarColor(viewBackgroundColor, true) } background: Rectangle { color: bgColor } // globalDrawer.height: root.height - headBar.height // globalDrawer.y: headBar.height Maui.Page { id: page anchors.fill: parent leftMargin: root.globalDrawer && (root.globalDrawer.modal === false) ? root.globalDrawer.contentItem.width * root.globalDrawer.position : 0 margins: 0 headBar.plegable: false headBar.height: toolBarHeight + space.small headBar.implicitHeight: toolBarHeight + space.small headBarExit: false altToolBars: root.altToolBars floatingBar : root.floatingBar footBarAligment : root.footBarAligment footBarOverlap : root.footBarOverlap footBarMargins: root.footBarMargins allowRiseContent: root.allowRiseContent background: Rectangle { color: bgColor } headBar.colorScheme.backgroundColor: headBarBGColor headBar.colorScheme.textColor: headBarFGColor headBar.leftContent: ToolButton { id: menuBtn icon.name: "application-menu" icon.color: headBarFGColor checked: mainMenu.visible onClicked: { menuButtonClicked() mainMenu.visible ? mainMenu.close() : mainMenu.popup(parent, parent.x , altToolBars ? 0 : parent.height+ space.medium) } Menu { id: mainMenu modal: true z: 999 width: unit * 200 Item { height: _accountCombobox.visible ? unit * 90 : 0 anchors { left: parent.left right: parent.right top: parent.top margins: space.medium } ComboBox { id: _accountCombobox anchors.centerIn: parent // parent: mainMenu popup.z: 999 width: parent.width visible: (count > 1) && showAccounts textRole: "user" flat: true model: showAccounts ? accounts.model : undefined // icon.name: "user-identity" // iconButton.isMask: false } } MenuSeparator { visible: _accountCombobox.visible } MenuItem { text: qsTr("Accounts") visible: root.showAccounts icon.name: "list-add-user" onTriggered: { if(root.accounts) accounts.open() } } MenuItem { text: qsTr("About") icon.name: "documentinfo" onTriggered: aboutDialog.open() } MenuSeparator {} } } headBar.rightContent: ToolButton { id: searchBtn icon.name: "edit-find" icon.color: headBarFGColor onClicked: searchButtonClicked() } Keys.onBackPressed: { goBackTriggered(); console.log("GO BACK CLICKED") event.accepted = true } Shortcut { sequence: "Forward" onActivated: goFowardTriggered(); } Shortcut { sequence: StandardKey.Forward onActivated: goFowardTriggered(); } Shortcut { sequence: StandardKey.Back onActivated: goBackTriggered(); } } Maui.AboutDialog { id: aboutDialog } Loader { id: _accountsDialogLoader sourceComponent: root.showAccounts ? _accountsDialogComponent : undefined } Component { id: _accountsDialogComponent AccountsHelper {} } Maui.Dialog { id: _notify property var cb : ({}) verticalAlignment: Qt.AlignTop defaultButtons: false colorScheme.backgroundColor: altColor colorScheme.textColor: altColorText maxHeight: Math.max(unit * 120, (_notifyLayout.implicitHeight)) maxWidth: isMobile ? parent.width * 0.9 : unit * 500 Timer { id: _notifyTimer onTriggered: _notify.close() } onClosed: _notifyTimer.stop() MouseArea { anchors.fill: parent onClicked: { if(_notify.cb) _notify.cb() _notify.close() } } GridLayout { anchors.fill: parent columns: 2 rows: 1 Item { Layout.fillHeight: true Layout.preferredWidth: iconSizes.huge + space.big Layout.row: 1 Layout.column: 1 ToolButton { id: _notifyIcon icon.width: iconSizes.large anchors.centerIn: parent // isMask: false } } Item { Layout.fillHeight: true Layout.fillWidth: true Layout.row: 1 Layout.column: 2 ColumnLayout { anchors.fill: parent id: _notifyLayout Label { id: _notifyTitle Layout.fillHeight: true Layout.fillWidth: true font.weight: Font.Bold font.bold: true font.pointSize: fontSizes.big color: _notify.colorScheme.textColor elide: Qt.ElideRight wrapMode: Text.Wrap } Label { id: _notifyBody Layout.fillHeight: true Layout.fillWidth: true font.pointSize: fontSizes.default color: _notify.colorScheme.textColor elide: Qt.ElideRight wrapMode: Text.Wrap } } } } function show(callback) { _notify.cb = callback _notifyTimer.start() _notify.open() } } Loader { id: dialogLoader } Component.onCompleted: { if(isAndroid && altToolBars) Maui.Android.statusbarColor(backgroundColor, true) if(!isMobile) { var rect = Maui.FM.loadSettings("GEOMETRY", "WINDOW", Qt.rect(root.x, root.y, root.width, root.height)) root.x = rect.x root.y = rect.y root.width = rect.width root.height = rect.height } } // Connections // { // target: Maui.FM // // onNewItem: notify("dialog-information", qsTr("File uploaded"), "Your file has been uploaded to your account /n"+path) // onWarningMessage: notify("dialog-information", "Oops!", message) // } function switchColorScheme(variant) { switch(variant) { case colorScheme.Default: backgroundColor = Maui.Style.backgroundColor textColor = Maui.Style.textColor highlightColor = Maui.Style.highlightColor highlightedTextColor = Maui.Style.highlightedTextColor buttonBackgroundColor = Maui.Style.buttonBackgroundColor viewBackgroundColor = Maui.Style.viewBackgroundColor altColor = Maui.Style.altColor borderColor = Maui.Style.borderColor if(isAndroid) Maui.Android.statusbarColor(backgroundColor, true) break case colorScheme.Dark: borderColor = darkBorderColor backgroundColor = darkBackgroundColor textColor = darkTextColor highlightColor = darkHighlightColor highlightedTextColor = darkHighlightedTextColor buttonBackgroundColor = darkButtonBackgroundColor viewBackgroundColor = darkViewBackgroundColor altColor = darkDarkColor altColorText = darkAltColorText bgColor =darkBgColor if(isAndroid) Maui.Android.statusbarColor(backgroundColor, false) break } } function notify(icon, title, body, callback, timeout) { - _notifyIcon.iconName = icon + _notifyIcon.icon.name = icon _notifyTitle.text = title _notifyBody.text = body _notifyTimer.interval = timeout ? timeout : 2500 _notify.show(callback) } /** FUNCTIONS **/ // function riseContent() // { // if(allowRiseContent) // flickable.flick(0, flickable.contentHeight* -2) // } // function dropContent() // { // if(allowRiseContent) // flickable.flick(0, flickable.contentHeight* 2) // } } diff --git a/src/controls/FileBrowser.qml b/src/controls/FileBrowser.qml index ea1e759..f18d758 100644 --- a/src/controls/FileBrowser.qml +++ b/src/controls/FileBrowser.qml @@ -1,1049 +1,1049 @@ import QtQuick 2.9 -import QtQuick.Controls 2.5 +import QtQuick.Controls 2.2 import QtQuick.Layouts 1.3 import org.kde.kirigami 2.7 as Kirigami import org.kde.mauikit 1.0 as Maui import "private" Maui.Page { id: control /* Controlc color scheming */ ColorScheme {id: colorScheme} property alias colorScheme : colorScheme /***************************/ property alias trackChanges: modelList.trackChanges property alias saveDirProps: modelList.saveDirProps property string currentPath: Maui.FM.homePath() property var copyItems : [] property var cutItems : [] property var indexHistory : [] property bool isCopy : false property bool isCut : false property bool selectionMode : false property bool group : false property bool showEmblems: true property alias selectionBar : selectionBarLoader.item property alias model : folderModel property alias list : modelList property alias browser : viewLoader.item property var currentFMList : modelList property alias previewer : previewer property alias menu : browserMenu.actions property alias itemMenu: itemMenu property alias holder: holder property alias dialog : dialogLoader.item property alias goUpButton : goUpButton property alias currentPathType : modelList.pathType property int thumbnailsSize : iconSizes.large signal itemClicked(int index) signal itemDoubleClicked(int index) signal itemRightClicked(int index) signal itemLeftEmblemClicked(int index) signal itemRightEmblemClicked(int index) signal rightClicked() signal newBookmark(var paths) margins: 0 focus: true Loader { id: dialogLoader } Component { id: removeDialogComponent Maui.Dialog { property var items: [] title: qsTr("Delete files?") message: qsTr("If you are sure you want to delete the files click on Accept, otherwise click on Cancel") rejectButton.text: qsTr("Cancel") acceptButton.text: qsTr("Accept") onRejected: close() onAccepted: { if(control.selectionBar && control.selectionBar.visible) { control.selectionBar.clear() control.selectionBar.animate("red") } control.remove(items) close() } } } Component { id: newFolderDialogComponent Maui.NewDialog { title: qsTr("New folder") message: qsTr("Create a new folder with a custom name") acceptButton.text: qsTr("Create") onFinished: list.createDir(text) rejectButton.visible: false } } Component { id: newFileDialogComponent Maui.NewDialog { title: qsTr("New file") message: qsTr("Create a new file with a custom name and extension") acceptButton.text: qsTr("Create") onFinished: Maui.FM.createFile(control.currentPath, text) rejectButton.visible: false } } Component { id: renameDialogComponent Maui.NewDialog { title: qsTr("Rename file") message: qsTr("Rename a file or folder to a new custom name") textEntry.text: list.get(browser.currentIndex).label textEntry.placeholderText: qsTr("New name...") onFinished: Maui.FM.rename(itemMenu.items[0].path, textEntry.text) onRejected: close() acceptText: qsTr("Rename") rejectText: qsTr("Cancel") } } Component { id: shareDialogComponent Maui.ShareDialog {} } Component { id: tagsDialogComponent Maui.TagsDialog { onTagsReady: composerList.updateToUrls(tags) } } BrowserMenu { id: browserMenu // width: unit *200 z : control.z +1 } Maui.FilePreviewer { id: previewer parent: parent onShareButtonClicked: control.shareFiles([url]) } Maui.BaseModel { id: folderModel list: modelList } Maui.FMList { id: modelList preview: true path: currentPath foldersFirst: true onSortByChanged: if(group) groupBy() onContentReadyChanged: console.log("CONTENT READY?", contentReady) onWarning: { notify("dialog-information", "An error happened", message) } onProgress: { if(percent === 100) _progressBar.value = 0 else _progressBar.value = percent/100 } } FileMenu { id: itemMenu width: unit *200 onBookmarkClicked: control.newBookmark([items[0].path]) onCopyClicked: { if(items.length) control.copy(items) } onCutClicked: { if(items.length) control.cut(items) } onTagsClicked: { if(items.length) { dialogLoader.sourceComponent = tagsDialogComponent if(items.length > 1 && control.selectionBar) dialog.composerList.urls = control.selectionBar.selectedPaths else dialog.composerList.urls = items[0].path dialog.open() } } onRenameClicked: { if(items.length === 1) { dialogLoader.sourceComponent = renameDialogComponent dialog.open() } } // onSaveToClicked: // { // fmDialog.saveDialog = false // fmDialog.multipleSelection = true // fmDialog.onlyDirs= true // var myPath = path // var paths = browser.selectionBar.selectedPaths // fmDialog.show(function(paths) // { // inx.copy(myPath, paths) // }) // } onRemoveClicked: { dialogLoader.sourceComponent= removeDialogComponent dialog.items = items dialog.open() } onShareClicked: { if(items.length) control.shareFiles([items[0].path]) } } Component { id: listViewBrowser Maui.ListBrowser { showPreviewThumbnails: modelList.preview showEmblem: selectionMode rightEmblem: isMobile ? "document-share" : "" leftEmblem: "list-add" showDetailsInfo: true // itemSize: thumbnailsSize model: folderModel section.delegate: Maui.LabelDelegate { id: delegate label: section labelTxt.font.pointSize: fontSizes.big isSection: true boldLabel: true height: toolBarHeightAlt } } } Component { id: gridViewBrowser Maui.GridBrowser { itemSize : thumbnailsSize + fontSizes.default showEmblem: selectionMode showPreviewThumbnails: modelList.preview rightEmblem: isMobile ? "document-share" : "" leftEmblem: "list-add" model: folderModel } } Component { id: millerViewBrowser Kirigami.ColumnView { id: _millerColumns // columnWidth: Kirigami.Units.gridUnit * 22 // fillWidth: true columnResizeMode: Kirigami.ColumnView.DynamicColumns signal itemClicked(int index) signal itemDoubleClicked(int index) signal itemRightClicked(int index) signal rightEmblemClicked(int index) signal leftEmblemClicked(int index) Maui.PathList { id: _millerList path: control.currentPath } Maui.BaseModel { id: _millerModel list: _millerList } Repeater { id: _repeater model: _millerModel onItemAdded: { // if(viewLoader.sourceComponent === millerViewBrowser) // _millerColumns.currentIndex = _millerColumns.count-1 } Item { Maui.FMList { id: _millersFMList preview: modelList.preview path: model.path foldersFirst: modelList.foldersFirst onWarning: { notify("dialog-information", "An error happened", message) } onProgress: { if(percent === 100) _progressBar.value = 0 else _progressBar.value = percent/100 } } Maui.ListBrowser { id: _millerListView anchors.fill: parent showPreviewThumbnails: modelList.preview showEmblem: selectionMode rightEmblem: isMobile ? "document-share" : "" leftEmblem: "list-add" showDetailsInfo: true // itemSize: thumbnailsSize onItemClicked: { control.currentFMList = _millersFMList _millerColumns.itemClicked(index) } // onItemDoubleClicked: // { // modelList.path = _millersFMList.path // _millerColumns.onItemDoubleClicked(index) // } onItemRightClicked: _millerColumns.itemRightClicked(index) onRightEmblemClicked: _millerColumns.rightEmblemClicked(index) onLeftEmblemClicked: _millerColumns.leftEmblemClicked(index) model: Maui.BaseModel { list: _millersFMList } section.delegate: Maui.LabelDelegate { id: delegate label: section labelTxt.font.pointSize: fontSizes.big isSection: true boldLabel: true height: toolBarHeightAlt } } } } } } Connections { target: browser onItemClicked: { browser.currentIndex = index indexHistory.push(index) control.itemClicked(index) } onItemDoubleClicked: { browser.currentIndex = index indexHistory.push(index) control.itemDoubleClicked(index) } onItemRightClicked: { itemMenu.show([modelList.get(index)]) control.itemRightClicked(index) } onLeftEmblemClicked: { control.addToSelection(modelList.get(index), true) control.itemLeftEmblemClicked(index) } onRightEmblemClicked: { isAndroid ? Maui.Android.shareDialog([modelList.get(index).path]) : shareDialog.show([modelList.get(index).path]) control.itemRightEmblemClicked(index) } onAreaClicked: { if(!isMobile && mouse.button === Qt.RightButton) browserMenu.show() else return control.rightClicked() } onAreaRightClicked: browserMenu.show() } Maui.Holder { id: holder anchors.fill : parent z: -1 visible: !modelList.pathExists || modelList.pathEmpty || !modelList.contentReady emoji: if(modelList.pathExists && modelList.pathEmpty) "qrc:/assets/MoonSki.png" else if(!modelList.pathExists) "qrc:/assets/ElectricPlug.png" else if(!modelList.contentReady && currentPathType === Maui.FMList.SEARCH_PATH) "qrc:/assets/animat-search-color.gif" else if(!modelList.contentReady) "qrc:/assets/animat-rocket-color.gif" isGif: !modelList.contentReady isMask: false title : if(modelList.pathExists && modelList.pathEmpty) qsTr("Folder is empty!") else if(!modelList.pathExists) qsTr("Folder doesn't exists!") else if(!modelList.contentReady && currentPathType === Maui.FMList.SEARCH_PATH) qsTr("Searching for content!") else if(!modelList.contentReady) qsTr("Loading content!") body: if(modelList.pathExists && modelList.pathEmpty) qsTr("You can add new files to it") else if(!modelList.pathExists) qsTr("Create Folder?") else if(!modelList.contentReady && currentPathType === Maui.FMList.SEARCH_PATH) qsTr("This might take a while!") else if(!modelList.contentReady) qsTr("Almost ready!") emojiSize: iconSizes.huge onActionTriggered: { if(!modelList.pathExists) { Maui.FM.createDir(control.currentPath.slice(0, control.currentPath.lastIndexOf("/")), control.currentPath.split("/").pop()) control.openFolder(modelList.parentPath) } } } Keys.onSpacePressed: previewer.show(modelList.get(browser.currentIndex).path) headBarExit: false headBar.visible: currentPathType !== Maui.FMList.APPS_PATH altToolBars: isMobile headBar.rightContent:[ ToolButton { icon.name: "view-list-icons" onClicked: list.viewType = Maui.FMList.ICON_VIEW checkable: false checked: list.viewType === Maui.FMList.ICON_VIEW icon.width: iconSizes.medium autoExclusive: true }, ToolButton { icon.name: "view-list-details" onClicked: list.viewType = Maui.FMList.LIST_VIEW icon.width: iconSizes.medium checked: list.viewType === Maui.FMList.LIST_VIEW autoExclusive: true }, ToolButton { icon.name: "view-file-columns" onClicked: list.viewType = Maui.FMList.MILLERS_VIEW icon.width: iconSizes.medium checked: list.viewType === Maui.FMList.MILLERS_VIEW autoExclusive: true }, Kirigami.ActionToolBar { // Layout.fillWidth: fal z: 999 hiddenActions: browserMenu.actions - display: isMobile ? ToolButton.IconOnly : ToolButton.TextBesideIcon +// display: isMobile ? ToolButton.IconOnly : ToolButton.TextBesideIcon actions: [ Kirigami.Action { icon.name: "view-sort" text: qsTr("Sort") Kirigami.Action { text: qsTr("Folders first") checked: list.foldersFirst onTriggered: list.foldersFirst = !list.foldersFirst } Kirigami.Action { text: qsTr("Type") checked: list.sortBy === Maui.FMList.MIME onTriggered: list.sortBy = Maui.FMList.MIME } Kirigami.Action { text: qsTr("Date") checked: list.sortBy === Maui.FMList.DATE onTriggered: list.sortBy = Maui.FMList.DATE } Kirigami.Action { text: qsTr("Modified") checked: list.sortBy === Maui.FMList.MODIFIED onTriggered: list.sortBy = Maui.FMList.MODIFIED } Kirigami.Action { text: qsTr("Size") checked: list.sortBy === Maui.FMList.SIZE onTriggered: list.sortBy = Maui.FMList.SIZE } Kirigami.Action { text: qsTr("Name") checked: list.sortBy === Maui.FMList.LABEL onTriggered: list.sortBy = Maui.FMList.LABEL } Kirigami.Action { id: groupAction text: qsTr("Group") checked: group onTriggered: { group = !group if(group) groupBy() else browser.section.property = "" } } }, Kirigami.Action { text: qsTr("Select") icon.name: "item-select" checkable: false checked: selectionMode onTriggered: selectionMode = !selectionMode } ] } ] headBar.leftContent: [ ToolButton { icon.name: "go-previous" onClicked: control.goBack() }, ToolButton { id: goUpButton visible: true icon.name: "go-up" onClicked: control.goUp() }, ToolButton { icon.name: "go-next" onClicked: control.goNext() } ] footBar.visible: false Component { id: selectionBarComponent Maui.SelectionBar { anchors.fill: parent onIconClicked: _selectionBarmenu.popup() onExitClicked: clearSelection() Menu { id: _selectionBarmenu MenuItem { text: qsTr("Copy...") onTriggered: { if(control.selectionBar) control.selectionBar.animate("#6fff80") control.copy(selectedItems) console.log(selectedItems) _selectionBarmenu.close() } } MenuItem { text: qsTr("Cut...") onTriggered: { if(control.selectionBar) control.selectionBar.animate("#fff44f") control.cut(selectedItems) _selectionBarmenu.close() } } MenuItem { text: qsTr("Share") onTriggered: { control.shareFiles(selectedPaths) _selectionBarmenu.close() } } MenuSeparator{} MenuItem { text: qsTr("Remove...") Kirigami.Theme.textColor: dangerColor onTriggered: { dialogLoader.sourceComponent= removeDialogComponent dialog.items = selectedItems dialog.open() _selectionBarmenu.close() } } } } } ColumnLayout { anchors.fill: parent visible: !holder.visible z: holder.z + 1 spacing: 0 Loader { id: viewLoader z: holder.z + 1 sourceComponent: switch(list.viewType) { case Maui.FMList.ICON_VIEW: return gridViewBrowser case Maui.FMList.LIST_VIEW: return listViewBrowser case Maui.FMList.MILLERS_VIEW: return millerViewBrowser } onLoaded: { if(sourceComponent !== millerViewBrowser) control.currentFMList = modelList } Layout.topMargin: list.viewType == Maui.FMList.ICON_VIEW ? contentMargins * 2 : unit Layout.margins: 0 Layout.fillWidth: true Layout.fillHeight: true } Loader { id: selectionBarLoader Layout.fillWidth: true Layout.preferredHeight: control.selectionBar && control.selectionBar.visible ? control.selectionBar.barHeight: 0 Layout.leftMargin: contentMargins * (isMobile ? 3 : 2) Layout.rightMargin: contentMargins * (isMobile ? 3 : 2) Layout.bottomMargin: control.selectionBar && control.selectionBar.visible ? contentMargins*2 : 0 z: holder.z +1 } ProgressBar { id: _progressBar Layout.fillWidth: true Layout.alignment: Qt.AlignBottom Layout.preferredHeight: visible ? iconSizes.medium : 0 visible: value > 0 } } // PinchArea // { // anchors.fill: parent // // property real initialWidth // property real initialHeight // // onPinchStarted: // { // console.log("pinch started") // } // // onPinchUpdated: // { // console.log(pinch.scale) // } // // onPinchFinished: // { // console.log("pinch finished") // } // } onThumbnailsSizeChanged: { if(trackChanges && saveDirProps) Maui.FM.setDirConf(currentPath+"/.directory", "MAUIFM", "IconSize", thumbnailsSize) else Maui.FM.saveSettings("IconSize", thumbnailsSize, "SETTINGS") if(list.viewType == Maui.FMList.ICON_VIEW) browser.adaptGrid() } function shareFiles(urls) { if(urls.length <= 0) return; if(isAndroid) Maui.Android.shareDialog(urls[0]) else { dialogLoader.sourceComponent= shareDialogComponent dialog.show(urls) } } function openItem(index) { var item = control.currentFMList.get(index) var path = item.path switch(currentPathType) { case Maui.FMList.APPS_PATH: if(item.path.endsWith("/")) populate(path) else Maui.FM.runApplication(path) break case Maui.FMList.CLOUD_PATH: if(item.mime === "inode/directory") control.openFolder(path) else Maui.FM.openCloudItem(item) break; default: if(selectionMode && !Maui.FM.isDir(item.path)) addToSelection(item, true) else { if(Maui.FM.isDir(path)) control.openFolder(path) else if(Maui.FM.isApp(path)) control.launchApp(path) else { if (isMobile) previewer.show(path) else control.openFile(path) } } } } function launchApp(path) { Maui.FM.runApplication(path, "") } function openFile(path) { Maui.FM.openUrl(path) } function openFolder(path) { populate(path) } function setPath(path) { currentPath = path } function populate(path) { if(!path.length) return; browser.currentIndex = 0 setPath(path) if(currentPathType === Maui.FMList.PLACES_PATH) { if(trackChanges && saveDirProps) { var conf = Maui.FM.dirConf(path+"/.directory") var iconsize = conf["iconsize"] || iconSizes.large thumbnailsSize = parseInt(iconsize) }else { thumbnailsSize = parseInt(Maui.FM.loadSettings("IconSize", "SETTINGS", thumbnailsSize)) } } if(list.viewType == Maui.FMList.ICON_VIEW) browser.adaptGrid() } function goBack() { populate(modelList.previousPath) browser.currentIndex = indexHistory.pop() // browser.positionViewAtIndex(browser.currentIndex, ListView.Center) } function goNext() { openFolder(modelList.posteriorPath) } function goUp() { openFolder(modelList.parentPath) } function refresh() { var pos = browser.contentY modelList.refresh() browser.contentY = pos } function addToSelection(item, append) { selectionBarLoader.sourceComponent= selectionBarComponent selectionBar.append(item) } function clearSelection() { clean() // selectionMode = false } function clean() { copyItems = [] cutItems = [] browserMenu.pasteFiles = 0 if(control.selectionBar && control.selectionBar.visible) selectionBar.clear() } function copy(items) { copyItems = items isCut = false isCopy = true } function cut(items) { cutItems = items isCut = true isCopy = false } function paste() { if(isCopy) list.copyInto(copyItems, currentPath) else if(isCut) { list.cutInto(cutItems, currentPath) clearSelection() } } function remove(items) { for(var i in items) Maui.FM.removeFile(items[i].path) } function bookmarkFolder(paths) { newBookmark(paths) } function zoomIn() { control.thumbnailsSize = control.thumbnailsSize + 8 } function zoomOut() { var newSize = control.thumbnailsSize - 8 if(newSize >= iconSizes.small) control.thumbnailsSize = newSize } function groupBy() { var prop = "" var criteria = ViewSection.FullString switch(modelList.sortBy) { case Maui.FMList.LABEL: prop = "label" criteria = ViewSection.FirstCharacter break; case Maui.FMList.MIME: prop = "mime" break; case Maui.FMList.SIZE: prop = "size" break; case Maui.FMList.DATE: prop = "date" break; case Maui.FMList.MODIFIED: prop = "modified" break; } list.viewType = Maui.FMList.LIST_VIEW if(!prop) { browser.section.property = "" return } browser.section.property = prop browser.section.criteria = criteria } } diff --git a/src/controls/ListBrowser.qml b/src/controls/ListBrowser.qml index 931ab25..3a56c41 100644 --- a/src/controls/ListBrowser.qml +++ b/src/controls/ListBrowser.qml @@ -1,156 +1,156 @@ /* * Copyright 2018 Camilo Higuita * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import QtQuick 2.9 -import QtQuick.Controls 2.4 +import QtQuick.Controls 2.2 import QtQuick.Layouts 1.3 import org.kde.mauikit 1.0 as Maui ScrollView { id: control property int itemSize : iconSizes.big property bool showEmblem : true property string rightEmblem property string leftEmblem property bool showDetailsInfo : false property bool showPreviewThumbnails: true property alias model : _listView.model property alias delegate : _listView.delegate property alias section : _listView.section property alias contentY: _listView.contentY property alias currentIndex : _listView.currentIndex property alias currentItem : _listView.currentItem property alias count : _listView.count property alias cacheBuffer : _listView.cacheBuffer property alias topMargin: _listView.topMargin property alias bottomMargin: _listView.bottomMargin property alias rightMargin: _listView.rightMargin property alias leftMarging: _listView.leftMargin property alias header : _listView.header property alias listView: _listView signal itemClicked(int index) signal itemDoubleClicked(int index) signal itemRightClicked(int index) signal rightEmblemClicked(int index) signal leftEmblemClicked(int index) signal areaClicked(var mouse) signal areaRightClicked() padding: 0 spacing: 0 ListView { anchors.fill: parent id: _listView // maximumFlickVelocity: 400 snapMode: ListView.SnapToItem boundsBehavior: !isMobile? Flickable.StopAtBounds : Flickable.OvershootBounds keyNavigationEnabled: true clip: true focus: true interactive: true highlightFollowsCurrentItem: true highlightMoveDuration: 0 width: parent.width height: parent.height model: ListModel { id: listModel } delegate: Maui.IconDelegate { id: delegate isDetails: true width: parent.width height: itemSize + space.big showDetailsInfo: control.showDetailsInfo folderSize : itemSize showTooltip: true showEmblem: control.showEmblem showThumbnails: showPreviewThumbnails rightEmblem: control.rightEmblem leftEmblem: control.leftEmblem Connections { target: delegate onClicked: { control.currentIndex = index control.itemClicked(index) } onDoubleClicked: { control.currentIndex = index control.itemDoubleClicked(index) } onPressAndHold: { control.currentIndex = index control.itemRightClicked(index) } onRightClicked: { control.currentIndex = index control.itemRightClicked(index) } onRightEmblemClicked: { control.currentIndex = index control.rightEmblemClicked(index) } onLeftEmblemClicked: { control.currentIndex = index control.leftEmblemClicked(index) } } } MouseArea { anchors.fill: parent z: -1 acceptedButtons: Qt.RightButton | Qt.LeftButton onClicked: control.areaClicked(mouse) onPressAndHold: control.areaRightClicked() } } } diff --git a/src/mauikit.cpp b/src/mauikit.cpp index d27968c..853c41a 100644 --- a/src/mauikit.cpp +++ b/src/mauikit.cpp @@ -1,175 +1,175 @@ /* * Copyright 2018 Camilo Higuita * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mauikit.h" #include #include #include "fm.h" #include "fmh.h" #include "mauimodel.h" #include "mauilist.h" #include "placeslist.h" #include "fmlist.h" #include "pathlist.h" #include "syncingmodel.h" #include "syncinglist.h" #include "tagsmodel.h" #include "tagslist.h" #include "storemodel.h" #include "storelist.h" #include "handy.h" #include "documenthandler.h" #include "mauiapp.h" #ifdef Q_OS_ANDROID #include "mauiandroid.h" #include #else #include "mauikde.h" #endif QUrl MauiKit::componentUrl(const QString &fileName) const { #ifdef MAUI_APP return QUrl(QStringLiteral("qrc:/maui/kit/") + fileName); #else return QUrl(resolveFileUrl(fileName)); #endif } void MauiKit::registerTypes(const char *uri) { Q_ASSERT(uri == QLatin1String("org.kde.mauikit")); qmlRegisterSingletonType(componentUrl(QStringLiteral("Style.qml")), uri, 1, 0, "Style"); qmlRegisterType(componentUrl(QStringLiteral("ToolBar.qml")), uri, 1, 0, "ToolBar"); qmlRegisterType(componentUrl(QStringLiteral("ApplicationWindow.qml")), uri, 1, 0, "ApplicationWindow"); qmlRegisterType(componentUrl(QStringLiteral("Page.qml")), uri, 1, 0, "Page"); qmlRegisterType(componentUrl(QStringLiteral("ShareDialog.qml")), uri, 1, 0, "ShareDialog"); qmlRegisterType(componentUrl(QStringLiteral("PieButton.qml")), uri, 1, 0, "PieButton"); qmlRegisterType(componentUrl(QStringLiteral("SideBar.qml")), uri, 1, 0, "SideBar"); qmlRegisterType(componentUrl(QStringLiteral("Holder.qml")), uri, 1, 0, "Holder"); qmlRegisterType(componentUrl(QStringLiteral("Drawer.qml")), uri, 1, 0, "Drawer"); qmlRegisterType(componentUrl(QStringLiteral("GlobalDrawer.qml")), uri, 1, 0, "GlobalDrawer"); qmlRegisterType(componentUrl(QStringLiteral("ListDelegate.qml")), uri, 1, 0, "ListDelegate"); qmlRegisterType(componentUrl(QStringLiteral("SelectionBar.qml")), uri, 1, 0, "SelectionBar"); qmlRegisterType(componentUrl(QStringLiteral("IconDelegate.qml")), uri, 1, 0, "IconDelegate"); qmlRegisterType(componentUrl(QStringLiteral("LabelDelegate.qml")), uri, 1, 0, "LabelDelegate"); qmlRegisterType(componentUrl(QStringLiteral("NewDialog.qml")), uri, 1, 0, "NewDialog"); qmlRegisterType(componentUrl(QStringLiteral("Dialog.qml")), uri, 1, 0, "Dialog"); qmlRegisterType(componentUrl(QStringLiteral("AboutDialog.qml")), uri, 1, 0, "AboutDialog"); qmlRegisterType(componentUrl(QStringLiteral("Popup.qml")), uri, 1, 0, "Popup"); qmlRegisterType(componentUrl(QStringLiteral("TextField.qml")), uri, 1, 0, "TextField"); qmlRegisterType(componentUrl(QStringLiteral("SearchBar.qml")), uri, 1, 0, "SearchBar"); qmlRegisterType(componentUrl(QStringLiteral("TagsBar.qml")), uri, 1, 0, "TagsBar"); qmlRegisterType(componentUrl(QStringLiteral("TagsDialog.qml")), uri, 1, 0, "TagsDialog"); qmlRegisterType(componentUrl(QStringLiteral("Badge.qml")), uri, 1, 0, "Badge"); qmlRegisterType(componentUrl(QStringLiteral("GridView.qml")), uri, 1, 0, "GridView"); qmlRegisterType(componentUrl(QStringLiteral("ColorsBar.qml")), uri, 1, 0, "ColorsBar"); qmlRegisterType(componentUrl(QStringLiteral("ComboBox.qml")), uri, 1, 0, "ComboBox"); qmlRegisterType(componentUrl(QStringLiteral("ImageViewer.qml")), uri, 1, 0, "ImageViewer"); qmlRegisterType(componentUrl(QStringLiteral("private/TagList.qml")), uri, 1, 0, "TagList"); /** STORE CONTROLS **/ qmlRegisterType(componentUrl(QStringLiteral("private/StoreDelegate.qml")), uri, 1, 0, "StoreDelegate"); qmlRegisterType(componentUrl(QStringLiteral("Store.qml")), uri, 1, 0, "Store"); /** BROWSING CONTROLS **/ qmlRegisterType(componentUrl(QStringLiteral("ListBrowser.qml")), uri, 1, 0, "ListBrowser"); qmlRegisterType(componentUrl(QStringLiteral("GridBrowser.qml")), uri, 1, 0, "GridBrowser"); /** FM CONTROLS **/ qmlRegisterType(componentUrl(QStringLiteral("FileBrowser.qml")), uri, 1, 0, "FileBrowser"); qmlRegisterType(componentUrl(QStringLiteral("PlacesSidebar.qml")), uri, 1, 0, "PlacesSidebar"); qmlRegisterType(componentUrl(QStringLiteral("FilePreviewer.qml")), uri, 1, 0, "FilePreviewer"); qmlRegisterType(componentUrl(QStringLiteral("FileDialog.qml")), uri, 1, 0, "FileDialog"); qmlRegisterType(componentUrl(QStringLiteral("PathBar.qml")), uri, 1, 0, "PathBar"); qmlRegisterType(componentUrl(QStringLiteral("SyncDialog.qml")), uri, 1, 0, "SyncDialog"); qmlRegisterType(componentUrl(QStringLiteral("SyncDialog.qml")), uri, 1, 0, "SyncDialog"); /** EDITOR CONTROLS **/ qmlRegisterType(componentUrl(QStringLiteral("Editor.qml")), uri, 1, 0, "Editor"); #ifdef Q_OS_ANDROID qmlRegisterSingletonType(uri, 1, 0, "Android", [](QQmlEngine*, QJSEngine*) -> QObject* { MAUIAndroid *android = new MAUIAndroid; return android; }); #else qmlRegisterType(componentUrl(QStringLiteral("Terminal.qml")), uri, 1, 0, "Terminal"); qmlRegisterSingletonType(uri, 1, 0, "KDE", [](QQmlEngine*, QJSEngine*) -> QObject* { MAUIKDE *kde = new MAUIKDE; return kde; }); #endif qmlRegisterType(uri, 1, 0, "BaseModel"); //BASE MODEL qmlRegisterUncreatableType(uri, 1, 0, "ModelList", QStringLiteral("ModelList should not be created in QML")); qmlRegisterType(uri, 1, 0, "PlacesList"); qmlRegisterType(uri, 1, 0, "FMList"); qmlRegisterType(uri, 1, 0, "PathList"); qmlRegisterType("SyncingList", 1, 0, "SyncingList"); qmlRegisterType("SyncingModel", 1, 0, "SyncingModel"); qmlRegisterType("TagsList", 1, 0, "TagsList"); qmlRegisterType("TagsModel", 1, 0, "TagsModel"); qmlRegisterType("StoreList", 1, 0, "StoreList"); qmlRegisterType("StoreModel", 1, 0, "StoreModel"); // qmlRegisterType(uri, 1, 0, "App"); qmlRegisterType("DocumentHandler", 1, 0, "DocumentHandler"); qmlRegisterSingletonType(uri, 1, 0, "FM", [](QQmlEngine*, QJSEngine*) -> QObject* { auto fm = new FM(); return fm; }); qmlRegisterSingletonType(uri, 1, 0, "Handy", [](QQmlEngine*, QJSEngine*) -> QObject* { auto handy = new Handy; return handy; }); #ifdef Q_OS_ANDROID QIcon::setThemeSearchPaths({":/icons/luv-icon-theme"}); QIcon::setThemeName("Luv"); - QQuickStyle::setStyle(":/style"); + QQuickStyle::setStyle(":/style"); // #else // QQuickStyle::setStyle("maui-style"); #endif qmlProtectModule(uri, 1); }