diff --git a/app/widgets/views/BrowserMenu.qml b/app/widgets/views/BrowserMenu.qml index f25ce84..4cfd4dd 100644 --- a/app/widgets/views/BrowserMenu.qml +++ b/app/widgets/views/BrowserMenu.qml @@ -1,124 +1,141 @@ import QtQuick 2.9 import QtQuick.Controls 2.3 import QtQuick.Layouts 1.3 import org.kde.maui 1.0 as Maui import org.kde.kirigami 2.2 as Kirigami import "../../Index.js" as INX Menu { x: parent.width / 2 - width / 2 y: parent.height / 2 - height / 2 modal: true focus: true parent: ApplicationWindow.overlay margins: 1 padding: 2 property int pasteFiles : 0 MenuItem { text: qsTr(browser.selectionMode ? "Selection OFF" : "Selection ON") onTriggered: browser.selectionMode = !browser.selectionMode } MenuSeparator { } MenuItem { visible: !isMobile text: qsTr(terminalVisible ? "Hide terminal" : "Show terminal") onTriggered: { terminalVisible = !terminalVisible inx.saveSettings("TERMINAL_VISIBLE", terminalVisible, "BROWSER") close() } } MenuItem { text: qsTr("Compact mode") onTriggered: placesSidebar.isCollapsed = !placesSidebar.isCollapsed } MenuItem { text: qsTr("Show previews") onTriggered: { browser.previews = !browser.previews inx.saveSettings("SHOW_PREVIEWS", browser.previews, "BROWSER") close() } } + MenuItem + { + text: qsTr("Show hidden files") + onTriggered: + { + var state = Maui.KDE.dirConf(browser.currentPath+"/.directory").hidden + console.log(state) + Maui.KDE.setDirConf(browser.currentPath+"/.directory", "Settings", "HiddenFilesShown", !state) + browser.refresh() + close() + } + } + MenuSeparator { } MenuItem { text: qsTr("New folder") onTriggered: newFolderDialog.open() } MenuItem { text: qsTr("New file") onTriggered: newFileDialog.open() } MenuItem { text: qsTr("Bookmark") onTriggered: browser.bookmarkFolder(browser.currentPath) } MenuSeparator { } MenuItem { text: qsTr("Paste ")+"["+pasteFiles+"]" enabled: pasteFiles > 0 onTriggered: browser.paste() } MenuSeparator { } MenuItem { Rectangle { anchors.fill: parent color: viewBackgroundColor } - Row + RowLayout { anchors.centerIn: parent Maui.ToolButton { + Layout.fillHeight: true + Layout.fillWidth: true iconName: "list-add" onClicked: zoomIn() } Maui.ToolButton { + Layout.fillHeight: true + Layout.fillWidth: true iconName: "list-remove" onClicked: zoomOut() } } } function show() { if(browser.currentPathType === browser.pathType.directory || browser.currentPathType === browser.pathType.tags) { if(browser.isCopy) pasteFiles = copyPaths.length else if(browser.isCut) pasteFiles = cutPaths.length if(isMobile) open() else popup() } } } diff --git a/kde/kde.cpp b/kde/kde.cpp index cdf1318..d50840a 100644 --- a/kde/kde.cpp +++ b/kde/kde.cpp @@ -1,128 +1,129 @@ /*** Pix Copyright (C) 2018 Camilo Higuita This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, 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 General Public License along with this program. If not, see . ***/ #include "kde.h" #include #include #include #include #include #include #include #include #include #include + #include "../app/inx.h" KDE::KDE(QObject *parent) : QObject(parent) {} QVariantList KDE::getApps() { QVariantList res; KServiceGroup::Ptr group = KServiceGroup::root(); bool sortByGenericName = false; KServiceGroup::List list = group->entries(true /* sorted */, true /* excludeNoDisplay */, true /* allowSeparators */, sortByGenericName /* sortByGenericName */); for (KServiceGroup::List::ConstIterator it = list.constBegin(); it != list.constEnd(); it++) { const KSycocaEntry::Ptr p = (*it); if (p->isType(KST_KServiceGroup)) { KServiceGroup::Ptr s(static_cast(p.data())); if (!s->noDisplay() && s->childCount() > 0) { qDebug()<< "Getting app"<icon(); res << QVariantMap { {INX::MODEL_NAME[INX::MODEL_KEY::ICON], s->icon()}, {INX::MODEL_NAME[INX::MODEL_KEY::LABEL], s->name()}, {INX::MODEL_NAME[INX::MODEL_KEY::PATH], INX::CUSTOMPATH_PATH[INX::CUSTOMPATH::APPS]+"/"+s->entryPath()} }; } } } return res; } QVariantList KDE::getApps(const QString &groupStr) { if(groupStr.isEmpty()) return getApps(); QVariantList res; // const KServiceGroup::Ptr group(static_cast(groupStr)); auto group = new KServiceGroup(groupStr); KServiceGroup::List list = group->entries(true /* sorted */, true /* excludeNoDisplay */, false /* allowSeparators */, true /* sortByGenericName */); for (KServiceGroup::List::ConstIterator it = list.constBegin(); it != list.constEnd(); it++) { const KSycocaEntry::Ptr p = (*it); if (p->isType(KST_KService)) { const KService::Ptr s(static_cast(p.data())); if (s->noDisplay()) continue; res << QVariantMap { {INX::MODEL_NAME[INX::MODEL_KEY::ICON], s->icon()}, {INX::MODEL_NAME[INX::MODEL_KEY::LABEL], s->name()}, {INX::MODEL_NAME[INX::MODEL_KEY::PATH], s->entryPath()} }; } else if (p->isType(KST_KServiceSeparator)) { qDebug()<< "separator wtf"; } else if (p->isType(KST_KServiceGroup)) { const KServiceGroup::Ptr s(static_cast(p.data())); if (s->childCount() == 0) continue; res << QVariantMap { {INX::MODEL_NAME[INX::MODEL_KEY::ICON], s->icon()}, {INX::MODEL_NAME[INX::MODEL_KEY::LABEL], s->name()}, {INX::MODEL_NAME[INX::MODEL_KEY::PATH], INX::CUSTOMPATH_PATH[INX::CUSTOMPATH::APPS]+"/"+s->entryPath()} }; } } return res; } void KDE::launchApp(const QString &app) { KService service(app); KRun::runApplication(service,{}, nullptr); }