diff --git a/CMakeLists.txt b/CMakeLists.txt index da7d37d..0c59a2a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -67,7 +67,6 @@ add_library(cutefish-filemanager-core STATIC cio/cfilesizejob.cpp cio/archivejob.cpp - dialogs/createfolderdialog.cpp dialogs/filepropertiesdialog.cpp dialogs/openwithdialog.cpp diff --git a/dialogs/createfolderdialog.cpp b/dialogs/createfolderdialog.cpp deleted file mode 100644 index eea494b..0000000 --- a/dialogs/createfolderdialog.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (C) 2021 CutefishOS Team. - * - * Author: revenmartin - * - * 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 - * 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 "createfolderdialog.h" -#include -#include -#include - -#include - -CreateFolderDialog::CreateFolderDialog(QObject *parent) - : QObject(parent) -{ - -} - -void CreateFolderDialog::setPath(const QString &path) -{ - m_path = path; -} - -void CreateFolderDialog::show() -{ - QQmlApplicationEngine *engine = new QQmlApplicationEngine; - engine->rootContext()->setContextProperty("main", this); - engine->load(QUrl("qrc:/qml/Dialogs/CreateFolderDialog.qml")); -} - -void CreateFolderDialog::newFolder(const QString &folderName) -{ - if (m_path.isEmpty() || folderName.isEmpty()) - return; - - auto job = KIO::mkdir(QUrl(m_path + "/" + folderName)); - job->start(); -} diff --git a/dialogs/createfolderdialog.h b/dialogs/createfolderdialog.h deleted file mode 100644 index 7fb74f5..0000000 --- a/dialogs/createfolderdialog.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2021 CutefishOS Team. - * - * Author: revenmartin - * - * 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 - * 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 . - */ - -#ifndef CREATEFOLDERDIALOG_H -#define CREATEFOLDERDIALOG_H - -#include - -class CreateFolderDialog : public QObject -{ - Q_OBJECT - -public: - explicit CreateFolderDialog(QObject *parent = nullptr); - - void setPath(const QString &path); - void show(); - - Q_INVOKABLE void newFolder(const QString &folderName); - -private: - QString m_path; -}; - -#endif // CREATEFOLDERDIALOG_H diff --git a/dialogs/filepropertiesdialog.cpp b/dialogs/filepropertiesdialog.cpp index 7b4e304..3a353b9 100644 --- a/dialogs/filepropertiesdialog.cpp +++ b/dialogs/filepropertiesdialog.cpp @@ -18,46 +18,27 @@ */ #include "filepropertiesdialog.h" -#include "../desktopiconprovider.h" -#include "../helper/fm.h" #include -#include -#include -#include #include +#include -#include - -inline QString concatPaths(const QString &path1, const QString &path2) -{ - Q_ASSERT(!path2.startsWith(QLatin1Char('/'))); - - if (path1.isEmpty()) { - return path2; - } else if (!path1.endsWith(QLatin1Char('/'))) { - return path1 + QLatin1Char('/') + path2; - } else { - return path1 + path2; - } -} - -FilePropertiesDialog::FilePropertiesDialog(const KFileItem &item, QQuickView *parent) - : QQuickView(parent) +FilePropertiesDialog::FilePropertiesDialog(const KFileItem &item, QObject *parent) + : Window(parent) { m_items.append(item); init(); } -FilePropertiesDialog::FilePropertiesDialog(const KFileItemList &items, QQuickView *parent) - : QQuickView(parent) +FilePropertiesDialog::FilePropertiesDialog(const KFileItemList &items, QObject *parent) + : Window(parent) , m_items(items) { init(); } -FilePropertiesDialog::FilePropertiesDialog(const QUrl &url, QQuickView *parent) - : QQuickView(parent) +FilePropertiesDialog::FilePropertiesDialog(const QUrl &url, QObject *parent) + : Window(parent) { m_items.append(KFileItem(url)); @@ -68,62 +49,8 @@ FilePropertiesDialog::~FilePropertiesDialog() { if (m_sizeJob) { m_sizeJob->stop(); - m_sizeJob->deleteLater(); - m_sizeJob = nullptr; - } -} - -void FilePropertiesDialog::updateSize(int width, int height) -{ - resize(QSize(width, height)); - setMinimumSize(QSize(width, height)); - setMaximumSize(QSize(width, height)); -} - -void FilePropertiesDialog::accept(const QString &text) -{ - KFileItemList list = m_items; - - if (list.size() == 1) { - KFileItem item = list.first(); - - QString n = text; - while (!n.isEmpty() && n[n.length() - 1].isSpace()) - n.chop(1); - - if (n.isEmpty()) - return; - - QString newFileName = KIO::encodeFileName(n); - - if (fileName() != newFileName) { - QUrl newUrl; - - if (!location().isEmpty() && !Fm::isFixedFolder(m_items.first().url())) { - newUrl = location(); - newUrl.setPath(concatPaths(newUrl.path(), newFileName)); - newUrl.setScheme(item.url().scheme()); - - auto job = KIO::move(item.url(), newUrl, KIO::HideProgressInfo); - job->start(); - } - } - } - - this->destroy(); - this->deleteLater(); -} - -void FilePropertiesDialog::reject() -{ - if (m_sizeJob) { - m_sizeJob->stop(); - m_sizeJob->deleteLater(); - m_sizeJob = nullptr; + m_sizeJob.reset(); } - - this->destroy(); - this->deleteLater(); } bool FilePropertiesDialog::multiple() const @@ -131,11 +58,6 @@ bool FilePropertiesDialog::multiple() const return m_multiple; } -bool FilePropertiesDialog::isWritable() const -{ - return m_isWritable; -} - QString FilePropertiesDialog::location() const { return m_location; @@ -176,24 +98,11 @@ QString FilePropertiesDialog::accessedTime() const return m_accessedTime; } -bool FilePropertiesDialog::event(QEvent *e) -{ - if (e->type() == QEvent::Close) { - this->deleteLater(); - } - - return QQuickView::event(e); -} - void FilePropertiesDialog::init() { - engine()->rootContext()->setContextProperty("main", this); - engine()->addImageProvider(QStringLiteral("icontheme"), new DesktopIconProvider()); + rootContext()->setContextProperty("main", this); - setFlag(Qt::Dialog); - setTitle(tr("Properties")); - setResizeMode(QQuickView::SizeViewToRootObject); - setSource(QUrl("qrc:/qml/Dialogs/PropertiesDialog.qml")); + load(QUrl("qrc:/qml/Dialogs/PropertiesDialog.qml")); m_multiple = m_items.count() > 1; @@ -224,15 +133,9 @@ void FilePropertiesDialog::init() m_size = KIO::convertSize(m_items.first().size()); m_location = info.dir().path(); - m_creationTime = QLocale().toString(info.birthTime(), QLocale::LongFormat); - m_modifiedTime = QLocale().toString(info.lastModified(), QLocale::LongFormat); - m_accessedTime = QLocale().toString(info.lastRead(), QLocale::LongFormat); - -// m_creationTime = item.time(KFileItem::CreationTime).toString(); -// m_modifiedTime = item.time(KFileItem::ModificationTime).toString(); -// m_accessedTime = item.time(KFileItem::AccessTime).toString(); - - m_isWritable = m_items.first().isWritable(); + m_creationTime = item.time(KFileItem::CreationTime).toString(); + m_modifiedTime = item.time(KFileItem::ModificationTime).toString(); + m_accessedTime = item.time(KFileItem::AccessTime).toString(); emit fileNameChanged(); emit iconNameChanged(); @@ -243,7 +146,6 @@ void FilePropertiesDialog::init() emit modifiedTimeChanged(); emit accessedTimeChanged(); } else { - m_isWritable = false; m_fileName = tr("%1 files").arg(m_items.count()); m_location = QFileInfo(m_items.first().localPath()).dir().path(); m_iconName = "unknown"; @@ -252,8 +154,6 @@ void FilePropertiesDialog::init() emit locationChanged(); emit iconNameChanged(); } - - emit isWritableChanged(); } void FilePropertiesDialog::updateTotalSize() diff --git a/dialogs/filepropertiesdialog.h b/dialogs/filepropertiesdialog.h index a87bf5f..6741946 100644 --- a/dialogs/filepropertiesdialog.h +++ b/dialogs/filepropertiesdialog.h @@ -20,7 +20,7 @@ #ifndef FILEPROPERTIESDIALOG_H #define FILEPROPERTIESDIALOG_H -#include +#include "../window.h" #include #include #include @@ -30,7 +30,7 @@ #include "cio/cfilesizejob.h" -class FilePropertiesDialog : public QQuickView +class FilePropertiesDialog : public Window { Q_OBJECT Q_PROPERTY(QString location READ location NOTIFY locationChanged) @@ -42,21 +42,14 @@ class FilePropertiesDialog : public QQuickView Q_PROPERTY(QString modifiedTime READ modifiedTime NOTIFY modifiedTimeChanged) Q_PROPERTY(QString accessedTime READ accessedTime NOTIFY accessedTimeChanged) Q_PROPERTY(bool multiple READ multiple CONSTANT) - Q_PROPERTY(bool isWritable READ isWritable NOTIFY isWritableChanged) public: - explicit FilePropertiesDialog(const KFileItem &item, QQuickView *parent = nullptr); - explicit FilePropertiesDialog(const KFileItemList &items, QQuickView *parent = nullptr); - explicit FilePropertiesDialog(const QUrl &url, QQuickView *parent = nullptr); + explicit FilePropertiesDialog(const KFileItem &item, QObject *parent = nullptr); + explicit FilePropertiesDialog(const KFileItemList &items, QObject *parent = nullptr); + explicit FilePropertiesDialog(const QUrl &url, QObject *parent = nullptr); ~FilePropertiesDialog(); - Q_INVOKABLE void updateSize(int width, int height); - - Q_INVOKABLE void accept(const QString &text); - Q_INVOKABLE void reject(); - bool multiple() const; - bool isWritable() const; QString location() const; QString fileName() const; @@ -78,10 +71,6 @@ signals: void creationTimeChanged(); void modifiedTimeChanged(); void accessedTimeChanged(); - void isWritableChanged(); - -protected: - bool event(QEvent *e) override; private: void init(); @@ -103,7 +92,6 @@ private: std::shared_ptr m_sizeJob; bool m_multiple; - bool m_isWritable; }; #endif // FILEPROPERTIESDIALOG_H diff --git a/dialogs/openwithdialog.cpp b/dialogs/openwithdialog.cpp index 1231de3..beb09a8 100644 --- a/dialogs/openwithdialog.cpp +++ b/dialogs/openwithdialog.cpp @@ -24,28 +24,15 @@ #include #include -OpenWithDialog::OpenWithDialog(const QUrl &url, QQuickView *parent) - : QQuickView(parent) +OpenWithDialog::OpenWithDialog(const QUrl &url, QObject *parent) + : Window(parent) , m_url(url.toLocalFile()) { - setFlag(Qt::Dialog); - setTitle(tr("Open With")); - setResizeMode(QQuickView::SizeViewToRootObject); + rootContext()->setContextProperty("main", this); + rootContext()->setContextProperty("mimeAppManager", MimeAppManager::self()); + rootContext()->setContextProperty("launcher", FileLauncher::self()); - engine()->rootContext()->setContextProperty("main", this); - engine()->rootContext()->setContextProperty("mimeAppManager", MimeAppManager::self()); - engine()->rootContext()->setContextProperty("launcher", FileLauncher::self()); - - setSource(QUrl("qrc:/qml/Dialogs/OpenWithDialog.qml")); - - QRect rect = geometry(); - setMinimumSize(rect.size()); - setMaximumSize(rect.size()); - - connect(this, &QQuickView::visibleChanged, this, [=] { - if (!this->isVisible()) - this->deleteLater(); - }); + load(QUrl("qrc:/qml/Dialogs/OpenWithDialog.qml")); } QString OpenWithDialog::url() const diff --git a/dialogs/openwithdialog.h b/dialogs/openwithdialog.h index 7c1d464..f544738 100644 --- a/dialogs/openwithdialog.h +++ b/dialogs/openwithdialog.h @@ -20,15 +20,15 @@ #ifndef OPENWITHDIALOG_H #define OPENWITHDIALOG_H -#include +#include "../window.h" -class OpenWithDialog : public QQuickView +class OpenWithDialog : public Window { Q_OBJECT Q_PROPERTY(QString url READ url CONSTANT) public: - explicit OpenWithDialog(const QUrl &url, QQuickView *parent = nullptr); + explicit OpenWithDialog(const QUrl &url, QObject *parent = nullptr); QString url() const; diff --git a/model/foldermodel.cpp b/model/foldermodel.cpp index 3aa251f..618a2bc 100644 --- a/model/foldermodel.cpp +++ b/model/foldermodel.cpp @@ -28,7 +28,6 @@ #include "window.h" #include "../dialogs/filepropertiesdialog.h" -#include "../dialogs/createfolderdialog.h" #include "../dialogs/openwithdialog.h" #include "../helper/datehelper.h" @@ -1635,8 +1634,8 @@ void FolderModel::openChangeWallpaperDialog() void FolderModel::openDeleteDialog() { Window *w = new Window; - w->load(QUrl("qrc:/qml/Dialogs/DeleteDialog.qml")); w->rootContext()->setContextProperty("model", this); + w->load(QUrl("qrc:/qml/Dialogs/DeleteDialog.qml")); } void FolderModel::openInNewWindow(const QString &url) diff --git a/qml.qrc b/qml.qrc index 9aae416..db0b3ac 100644 --- a/qml.qrc +++ b/qml.qrc @@ -22,7 +22,6 @@ qml/FolderGridView.qml qml/GlobalSettings.qml qml/FolderGridItem.qml - qml/Dialogs/CreateFolderDialog.qml images/light/checked.svg images/dark/checked.svg images/light/order_by_name.svg diff --git a/qml/Dialogs/CreateFolderDialog.qml b/qml/Dialogs/CreateFolderDialog.qml deleted file mode 100644 index 8f0d2f0..0000000 --- a/qml/Dialogs/CreateFolderDialog.qml +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (C) 2021 CutefishOS Team. - * - * Author: revenmartin - * - * 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 - * 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 . - */ -import QtQuick 2.12 -import QtQuick.Controls 2.12 -import QtQuick.Window 2.12 -import QtQuick.Layouts 1.12 -import FishUI 1.0 as FishUI - -Window { - id: control - - title: qsTr("New folder name") - flags: Qt.Dialog - visible: true - - width: 400 + FishUI.Units.largeSpacing * 2 - height: _mainLayout.implicitHeight + FishUI.Units.largeSpacing * 2 - - minimumWidth: width - minimumHeight: height - maximumWidth: width - maximumHeight: height - - Rectangle { - anchors.fill: parent - color: FishUI.Theme.secondBackgroundColor - } - - ColumnLayout { - id: _mainLayout - anchors.fill: parent - anchors.margins: FishUI.Units.largeSpacing - spacing: FishUI.Units.largeSpacing - - FishUI.ActionTextField { - id: _textField - Layout.fillWidth: true - Keys.onEscapePressed: control.close() - text: qsTr("New folder") - focus: true - - onAccepted: { - main.newFolder(_textField.text) - control.close() - } - - Component.onCompleted: { - _textField.selectAll() - } - - rightActions: [ - Action { - icon.source: "image://icontheme/edit-clear" - onTriggered: { - _textField.text = "" - } - } - ] - } - - RowLayout { - spacing: FishUI.Units.largeSpacing - - Button { - text: qsTr("Cancel") - Layout.fillWidth: true - onClicked: control.close() - } - - Button { - text: qsTr("OK") - Layout.fillWidth: true - onClicked: { - main.newFolder(_textField.text) - control.close() - } - enabled: _textField.text - flat: true - } - } - } -} diff --git a/qml/Dialogs/OpenWithDialog.qml b/qml/Dialogs/OpenWithDialog.qml index e5da64b..ac7aa64 100644 --- a/qml/Dialogs/OpenWithDialog.qml +++ b/qml/Dialogs/OpenWithDialog.qml @@ -19,22 +19,31 @@ import QtQuick 2.12 import QtQuick.Controls 2.4 +import QtQuick.Window 2.12 import QtQuick.Layouts 1.3 import Qt5Compat.GraphicalEffects import FishUI 1.0 as FishUI -Item { +FishUI.Window { id: control property string url: main.url + property int contentWidth: 400 + FishUI.Units.largeSpacing * 2 + property int contentHeight: _mainLayout.implicitHeight + control.header.height + FishUI.Units.largeSpacing * 2 - width: 400 + FishUI.Units.largeSpacing * 2 - height: _mainLayout.implicitHeight + FishUI.Units.largeSpacing * 2 + title: qsTr("Open With") + flags: Qt.Dialog | Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint + minimizeButtonVisible: false + visible: false - Rectangle { - anchors.fill: parent - color: FishUI.Theme.secondBackgroundColor - } + width: contentWidth + height: contentHeight + minimumWidth: contentWidth + minimumHeight: contentHeight + maximumWidth: contentWidth + maximumHeight: contentHeight + + background.color: FishUI.Theme.secondBackgroundColor Component.onCompleted: { var items = mimeAppManager.recommendedApps(control.url) @@ -52,11 +61,11 @@ Item { mimeAppManager.setDefaultAppForFile(control.url, listView.model.get(listView.currentIndex).desktopFile) launcher.launchApp(listView.model.get(listView.currentIndex).desktopFile, control.url) - main.close() + control.close() } Keys.enabled: true - Keys.onEscapePressed: main.close() + Keys.onEscapePressed: control.close() ColumnLayout { id: _mainLayout @@ -170,7 +179,7 @@ Item { Button { text: qsTr("Cancel") Layout.fillWidth: true - onClicked: main.close() + onClicked: control.close() } Button { diff --git a/qml/Dialogs/PropertiesDialog.qml b/qml/Dialogs/PropertiesDialog.qml index e6908c5..b0325d0 100644 --- a/qml/Dialogs/PropertiesDialog.qml +++ b/qml/Dialogs/PropertiesDialog.qml @@ -23,41 +23,28 @@ import QtQuick.Controls 2.12 import QtQuick.Layouts 1.12 import FishUI 1.0 as FishUI -Item { +FishUI.Window { id: control property int widthValue: _mainLayout.implicitWidth + FishUI.Units.largeSpacing * 3 - property int heightValue: _mainLayout.implicitHeight + FishUI.Units.largeSpacing * 3 + property int heightValue: _mainLayout.implicitHeight + control.header.height + FishUI.Units.largeSpacing * 2 + + title: qsTr("Properties") + flags: Qt.Dialog | Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint + minimizeButtonVisible: false + visible: false width: widthValue height: heightValue + minimumWidth: widthValue + minimumHeight: heightValue + maximumWidth: widthValue + maximumHeight: heightValue - onWidthValueChanged: main.updateSize(widthValue, heightValue) - onHeightValueChanged: main.updateSize(widthValue, heightValue) - - focus: true Keys.enabled: true - Keys.onEscapePressed: main.reject() - - Rectangle { - anchors.fill: parent - color: FishUI.Theme.secondBackgroundColor - } - - onVisibleChanged: { - if (visible) updateWindowSize() - } - - function close() { - main.close() - } + Keys.onEscapePressed: control.close() - function updateWindowSize() { - if (visible) { - if (_textField.enabled) - _textField.forceActiveFocus() - } - } + background.color: FishUI.Theme.secondBackgroundColor ColumnLayout { id: _mainLayout @@ -72,30 +59,27 @@ Item { spacing: FishUI.Units.largeSpacing * 2 FishUI.IconItem { - width: 64 - height: 64 + width: 48 + height: 48 + Layout.preferredWidth: 48 + Layout.preferredHeight: 48 source: main.iconName } - TextField { - id: _textField + Label { text: main.fileName - focus: true Layout.fillWidth: true - Keys.onEscapePressed: main.reject() - enabled: main.isWritable + elide: Text.ElideMiddle } } GridLayout { columns: 2 + Layout.fillWidth: true columnSpacing: FishUI.Units.largeSpacing rowSpacing: FishUI.Units.largeSpacing Layout.alignment: Qt.AlignTop - onHeightChanged: updateWindowSize() - onImplicitHeightChanged: updateWindowSize() - Label { text: qsTr("Type:") Layout.alignment: Qt.AlignRight @@ -118,6 +102,8 @@ Item { Label { id: location text: main.location + Layout.fillWidth: true + wrapMode: Text.Wrap } Label { @@ -171,28 +157,5 @@ Item { } } - Item { - height: FishUI.Units.smallSpacing - } - - RowLayout { - Layout.alignment: Qt.AlignRight - spacing: FishUI.Units.largeSpacing - - Button { - text: qsTr("Cancel") - Layout.fillWidth: true - onClicked: main.reject() - } - - Button { - text: qsTr("OK") - Layout.fillWidth: true - onClicked: { - main.accept(_textField.text) - } - flat: true - } - } } } diff --git a/translations/ar_AA.ts b/translations/ar_AA.ts index 79bc601..7db22a8 100644 --- a/translations/ar_AA.ts +++ b/translations/ar_AA.ts @@ -1,29 +1,6 @@ - - CreateFolderDialog - - - New folder name - اسم المجلد الجديد - - - - New folder - مجلد جديد - - - - Cancel - إلغاء - - - - OK - موافق - - DateHelper diff --git a/translations/be_BY.ts b/translations/be_BY.ts index 21fd196..d74d572 100644 --- a/translations/be_BY.ts +++ b/translations/be_BY.ts @@ -1,29 +1,6 @@ - - CreateFolderDialog - - - New folder name - Назва новай папкі - - - - New folder - Новая папка - - - - Cancel - Адмена - - - - OK - ОК - - DateHelper diff --git a/translations/be_Latn.ts b/translations/be_Latn.ts index 8284a0e..b4e0633 100644 --- a/translations/be_Latn.ts +++ b/translations/be_Latn.ts @@ -1,29 +1,6 @@ - - CreateFolderDialog - - - New folder name - Nazva novaj papki - - - - New folder - Novaja papka - - - - Cancel - Admiena - - - - OK - OK - - DateHelper diff --git a/translations/bg_BG.ts b/translations/bg_BG.ts index c14252e..a629201 100644 --- a/translations/bg_BG.ts +++ b/translations/bg_BG.ts @@ -1,29 +1,6 @@ - - CreateFolderDialog - - - New folder name - Име на нова папка - - - - New folder - Нова папка - - - - Cancel - Отмени - - - - OK - Да - - DateHelper diff --git a/translations/bs_BA.ts b/translations/bs_BA.ts index 581c264..4fc74a4 100644 --- a/translations/bs_BA.ts +++ b/translations/bs_BA.ts @@ -1,29 +1,6 @@ - - CreateFolderDialog - - - New folder name - Novo ime fascikle - - - - New folder - Nova fascikla - - - - Cancel - Otkaži - - - - OK - U redu - - DateHelper diff --git a/translations/cs_CZ.ts b/translations/cs_CZ.ts index db118df..e166a5c 100644 --- a/translations/cs_CZ.ts +++ b/translations/cs_CZ.ts @@ -1,29 +1,6 @@ - - CreateFolderDialog - - - New folder name - Název nové složky - - - - New folder - Nová složka - - - - Cancel - Storno - - - - OK - OK - - DateHelper diff --git a/translations/da_DK.ts b/translations/da_DK.ts index 43de1e0..69266cf 100644 --- a/translations/da_DK.ts +++ b/translations/da_DK.ts @@ -1,29 +1,6 @@ - - CreateFolderDialog - - - New folder name - Nyt mappnavn - - - - New folder - Ny mappe - - - - Cancel - Annuller - - - - OK - OK - - DateHelper diff --git a/translations/de_DE.ts b/translations/de_DE.ts index 32fbb3c..f73ebce 100644 --- a/translations/de_DE.ts +++ b/translations/de_DE.ts @@ -1,29 +1,6 @@ - - CreateFolderDialog - - - New folder name - Neuer Ordnername - - - - New folder - Neuer Ordner - - - - Cancel - Abbrechen - - - - OK - OK - - DateHelper diff --git a/translations/en_US.ts b/translations/en_US.ts index 1299640..ce4a4a0 100644 --- a/translations/en_US.ts +++ b/translations/en_US.ts @@ -1,29 +1,6 @@ - - CreateFolderDialog - - - New folder name - New folder name - - - - New folder - New folder - - - - Cancel - Cancel - - - - OK - OK - - DateHelper diff --git a/translations/eo_XX.ts b/translations/eo_XX.ts index df36887..ef1062d 100644 --- a/translations/eo_XX.ts +++ b/translations/eo_XX.ts @@ -1,29 +1,6 @@ - - CreateFolderDialog - - - New folder name - - - - - New folder - - - - - Cancel - - - - - OK - - - DateHelper diff --git a/translations/es_ES.ts b/translations/es_ES.ts index fe3dfec..f717a9f 100644 --- a/translations/es_ES.ts +++ b/translations/es_ES.ts @@ -1,29 +1,6 @@ - - CreateFolderDialog - - - New folder name - Nuevo nombre de carpeta - - - - New folder - Nueva carpeta - - - - Cancel - Cancelar - - - - OK - OK - - DateHelper diff --git a/translations/es_MX.ts b/translations/es_MX.ts index 60e8b2d..b29a7d3 100644 --- a/translations/es_MX.ts +++ b/translations/es_MX.ts @@ -1,29 +1,6 @@ - - CreateFolderDialog - - - New folder name - Nombre de la nueva carpeta - - - - New folder - Nueva carpeta - - - - Cancel - Cancelar - - - - OK - De acuerdo - - DateHelper diff --git a/translations/fa_IR.ts b/translations/fa_IR.ts index 736d820..81eec0a 100644 --- a/translations/fa_IR.ts +++ b/translations/fa_IR.ts @@ -1,29 +1,6 @@ - - CreateFolderDialog - - - New folder name - نام پوشه جدید - - - - New folder - پوشه جدید - - - - Cancel - لغو کردن - - - - OK - ساختن - - DateHelper diff --git a/translations/fi_FI.ts b/translations/fi_FI.ts index cea9d78..888973a 100644 --- a/translations/fi_FI.ts +++ b/translations/fi_FI.ts @@ -1,29 +1,6 @@ - - CreateFolderDialog - - - New folder name - Uusi kansion nimi - - - - New folder - Uusi kansio - - - - Cancel - Peruuta - - - - OK - OK - - DateHelper diff --git a/translations/fr_FR.ts b/translations/fr_FR.ts index b3bfae9..cf89327 100644 --- a/translations/fr_FR.ts +++ b/translations/fr_FR.ts @@ -1,29 +1,6 @@ - - CreateFolderDialog - - - New folder name - Nouveau nom de dossier - - - - New folder - Nouveau dossier - - - - Cancel - Annuler - - - - OK - OK - - DateHelper diff --git a/translations/he_IL.ts b/translations/he_IL.ts index a56bf72..93600a2 100644 --- a/translations/he_IL.ts +++ b/translations/he_IL.ts @@ -1,29 +1,6 @@ - - CreateFolderDialog - - - New folder name - שם תיקייה חדשה - - - - New folder - תיקייה חדשה - - - - Cancel - ביטול - - - - OK - אישור - - DateHelper diff --git a/translations/hi_IN.ts b/translations/hi_IN.ts index 022c72d..4ced2da 100644 --- a/translations/hi_IN.ts +++ b/translations/hi_IN.ts @@ -1,29 +1,6 @@ - - CreateFolderDialog - - - New folder name - नया फ़ोल्डर का नाम - - - - New folder - नया फोल्डर - - - - Cancel - निरस्त करें - - - - OK - ठीक - - DateHelper diff --git a/translations/hu_HU.ts b/translations/hu_HU.ts index 7c0368e..f9e0a34 100644 --- a/translations/hu_HU.ts +++ b/translations/hu_HU.ts @@ -1,29 +1,6 @@ - - CreateFolderDialog - - - New folder name - Új mappa neve - - - - New folder - Új mappa - - - - Cancel - Mégsem - - - - OK - OK - - DateHelper diff --git a/translations/id_ID.ts b/translations/id_ID.ts index 343f4a6..92d6bbd 100644 --- a/translations/id_ID.ts +++ b/translations/id_ID.ts @@ -1,29 +1,6 @@ - - CreateFolderDialog - - - New folder name - Nama folder baru - - - - New folder - Folder baru - - - - Cancel - Batal - - - - OK - OK - - DateHelper diff --git a/translations/ie.ts b/translations/ie.ts index 2d6502a..28aeed3 100644 --- a/translations/ie.ts +++ b/translations/ie.ts @@ -1,29 +1,6 @@ - - CreateFolderDialog - - - New folder name - Nómine del nov fólder - - - - New folder - Nov fólder - - - - Cancel - Anullar - - - - OK - OK - - DateHelper diff --git a/translations/it_IT.ts b/translations/it_IT.ts index de2d2d7..a4c8fa8 100644 --- a/translations/it_IT.ts +++ b/translations/it_IT.ts @@ -1,29 +1,6 @@ - - CreateFolderDialog - - - New folder name - Nuovo nome di cartella - - - - New folder - Nuova cartella - - - - Cancel - Annulla - - - - OK - OK - - DateHelper diff --git a/translations/ja_JP.ts b/translations/ja_JP.ts index 6c737f0..8afca0e 100644 --- a/translations/ja_JP.ts +++ b/translations/ja_JP.ts @@ -1,29 +1,6 @@ - - CreateFolderDialog - - - New folder name - 新しいフォルダ名 - - - - New folder - 新しいフォルダ - - - - Cancel - 取り消し - - - - OK - はい - - DateHelper diff --git a/translations/lt_LT.ts b/translations/lt_LT.ts index 7d3ee63..c77caba 100644 --- a/translations/lt_LT.ts +++ b/translations/lt_LT.ts @@ -1,29 +1,6 @@ - - CreateFolderDialog - - - New folder name - - - - - New folder - Naujas aplankas - - - - Cancel - Atsisakyti - - - - OK - Gerai - - DateHelper diff --git a/translations/lv_LV.ts b/translations/lv_LV.ts index 0188d9a..22ff119 100644 --- a/translations/lv_LV.ts +++ b/translations/lv_LV.ts @@ -1,29 +1,6 @@ - - CreateFolderDialog - - - New folder name - Jaunās mapes nosaukums - - - - New folder - Jauna mape - - - - Cancel - Atcelt - - - - OK - OK - - DateHelper diff --git a/translations/ml_IN.ts b/translations/ml_IN.ts index 499f1aa..b686577 100644 --- a/translations/ml_IN.ts +++ b/translations/ml_IN.ts @@ -1,29 +1,6 @@ - - CreateFolderDialog - - - New folder name - - - - - New folder - - - - - Cancel - - - - - OK - - - DateHelper diff --git a/translations/nb_NO.ts b/translations/nb_NO.ts index f954401..3a30814 100644 --- a/translations/nb_NO.ts +++ b/translations/nb_NO.ts @@ -1,29 +1,6 @@ - - CreateFolderDialog - - - New folder name - Nytt mappenavn - - - - New folder - Ny mappe - - - - Cancel - Avbryt - - - - OK - OK - - DateHelper diff --git a/translations/ne_NP.ts b/translations/ne_NP.ts index 9e1567a..2b4f03d 100644 --- a/translations/ne_NP.ts +++ b/translations/ne_NP.ts @@ -1,29 +1,6 @@ - - CreateFolderDialog - - - New folder name - नयाँ फोल्डर नाम - - - - New folder - नयाँ फोल्डर - - - - Cancel - रद्द - - - - OK - हुन्छ - - DateHelper diff --git a/translations/pl_PL.ts b/translations/pl_PL.ts index 1c9c386..3c18e5f 100644 --- a/translations/pl_PL.ts +++ b/translations/pl_PL.ts @@ -1,29 +1,6 @@ - - CreateFolderDialog - - - New folder name - Nowa nazwa folderu - - - - New folder - Nowy folder - - - - Cancel - Anuluj - - - - OK - OK - - DateHelper diff --git a/translations/pt_BR.ts b/translations/pt_BR.ts index d57ba73..e3e4094 100644 --- a/translations/pt_BR.ts +++ b/translations/pt_BR.ts @@ -1,29 +1,6 @@ - - CreateFolderDialog - - - New folder name - Nome da nova pasta - - - - New folder - Nova pasta - - - - Cancel - Cancelar - - - - OK - OK - - DateHelper diff --git a/translations/pt_PT.ts b/translations/pt_PT.ts index 5163787..3248fc2 100644 --- a/translations/pt_PT.ts +++ b/translations/pt_PT.ts @@ -1,29 +1,6 @@ - - CreateFolderDialog - - - New folder name - Nome da nova pasta - - - - New folder - Nova pasta - - - - Cancel - Cancelar - - - - OK - Aceitar - - DateHelper diff --git a/translations/ro_RO.ts b/translations/ro_RO.ts index 033fe1e..9ac2128 100644 --- a/translations/ro_RO.ts +++ b/translations/ro_RO.ts @@ -1,29 +1,6 @@ - - CreateFolderDialog - - - New folder name - Noul nume de dosar - - - - New folder - Dosar nou - - - - Cancel - Anulare - - - - OK - Ok - - DateHelper diff --git a/translations/ru_RU.ts b/translations/ru_RU.ts index 1178d2e..a663202 100644 --- a/translations/ru_RU.ts +++ b/translations/ru_RU.ts @@ -1,29 +1,6 @@ - - CreateFolderDialog - - - New folder name - Имя новой папки - - - - New folder - Новая папка - - - - Cancel - Отмена - - - - OK - ОК - - DateHelper diff --git a/translations/si_LK.ts b/translations/si_LK.ts index b0f03ba..a383067 100644 --- a/translations/si_LK.ts +++ b/translations/si_LK.ts @@ -1,29 +1,6 @@ - - CreateFolderDialog - - - New folder name - නව බහාලුමේ නම - - - - New folder - නව බහාලුම - - - - Cancel - අවලංගු කරන්න - - - - OK - හරි - - DateHelper diff --git a/translations/sk_SK.ts b/translations/sk_SK.ts index 03dcf20..218e565 100644 --- a/translations/sk_SK.ts +++ b/translations/sk_SK.ts @@ -1,29 +1,6 @@ - - CreateFolderDialog - - - New folder name - Názov nového priečinku - - - - New folder - Nový priečinok - - - - Cancel - Zrušiť - - - - OK - OK - - DateHelper diff --git a/translations/so.ts b/translations/so.ts index 4643c11..b0f7ae1 100644 --- a/translations/so.ts +++ b/translations/so.ts @@ -1,29 +1,6 @@ - - CreateFolderDialog - - - New folder name - Magaca galka cusub - - - - New folder - Gal cusub - - - - Cancel - Xir - - - - OK - OK - - DateHelper diff --git a/translations/sr_RS.ts b/translations/sr_RS.ts index 1a29ec3..11878db 100644 --- a/translations/sr_RS.ts +++ b/translations/sr_RS.ts @@ -1,29 +1,6 @@ - - CreateFolderDialog - - - New folder name - Naziv nove fascikle - - - - New folder - Nova fascikla - - - - Cancel - Otkaži - - - - OK - OK - - DateHelper diff --git a/translations/sv_SE.ts b/translations/sv_SE.ts index 7d29fbd..d4c87a3 100644 --- a/translations/sv_SE.ts +++ b/translations/sv_SE.ts @@ -1,29 +1,6 @@ - - CreateFolderDialog - - - New folder name - Nytt mappnamn - - - - New folder - Ny mapp - - - - Cancel - Avbryt - - - - OK - OK - - DateHelper diff --git a/translations/sw.ts b/translations/sw.ts index 32ab5ca..1172599 100644 --- a/translations/sw.ts +++ b/translations/sw.ts @@ -1,29 +1,6 @@ - - CreateFolderDialog - - - New folder name - Jina la folda mpya - - - - New folder - Folda mpya - - - - Cancel - Ghairi - - - - OK - Sawa - - DateHelper diff --git a/translations/ta_IN.ts b/translations/ta_IN.ts index b20a25b..3c529c0 100644 --- a/translations/ta_IN.ts +++ b/translations/ta_IN.ts @@ -1,29 +1,6 @@ - - CreateFolderDialog - - - New folder name - - - - - New folder - - - - - Cancel - - - - - OK - - - DateHelper diff --git a/translations/tr_TR.ts b/translations/tr_TR.ts index ae94060..c8b4eae 100644 --- a/translations/tr_TR.ts +++ b/translations/tr_TR.ts @@ -1,29 +1,6 @@ - - CreateFolderDialog - - - New folder name - Yeni klasör adı - - - - New folder - Yeni klasör - - - - Cancel - İptal - - - - OK - Tamam - - DateHelper diff --git a/translations/uk_UA.ts b/translations/uk_UA.ts index 974f6d9..b3c8db1 100644 --- a/translations/uk_UA.ts +++ b/translations/uk_UA.ts @@ -1,29 +1,6 @@ - - CreateFolderDialog - - - New folder name - Ім'я нової папки - - - - New folder - Нова папка - - - - Cancel - Скасувати - - - - OK - ОК - - DateHelper diff --git a/translations/uz_UZ.ts b/translations/uz_UZ.ts index f6aecd7..c9a894f 100644 --- a/translations/uz_UZ.ts +++ b/translations/uz_UZ.ts @@ -1,29 +1,6 @@ - - CreateFolderDialog - - - New folder name - Yangi jild nomi - - - - New folder - Yangi jild - - - - Cancel - Bekor - - - - OK - Mayli - - DateHelper diff --git a/translations/zh_CN.ts b/translations/zh_CN.ts index 21abaaa..a91ad87 100644 --- a/translations/zh_CN.ts +++ b/translations/zh_CN.ts @@ -1,29 +1,6 @@ - - CreateFolderDialog - - - New folder name - 新建文件夹名称 - - - - New folder - 新建文件夹 - - - - Cancel - 取消 - - - - OK - 确定 - - DateHelper diff --git a/translations/zh_TW.ts b/translations/zh_TW.ts index 2e7c82c..4c65c7c 100644 --- a/translations/zh_TW.ts +++ b/translations/zh_TW.ts @@ -1,29 +1,6 @@ - - CreateFolderDialog - - - New folder name - 新建資料夾名稱 - - - - New folder - 新建資料夾 - - - - Cancel - 取消 - - - - OK - - - DateHelper diff --git a/window.cpp b/window.cpp index 67d1102..f8b24df 100644 --- a/window.cpp +++ b/window.cpp @@ -37,10 +37,32 @@ void Window::load(const QUrl &url) { QQmlApplicationEngine::load(url); - QQuickWindow *w = qobject_cast(rootObjects().first()); + QQuickWindow *w = quickWindow(); if (w) w->installEventFilter(this); + else + deleteLater(); +} + +void Window::show() +{ + if (QQuickWindow *w = quickWindow()) { + w->show(); + w->raise(); + w->requestActivate(); + } +} + +QQuickWindow *Window::quickWindow() const +{ + const QList objects = rootObjects(); + for (QObject *object : objects) { + if (QQuickWindow *w = qobject_cast(object)) + return w; + } + + return nullptr; } bool Window::eventFilter(QObject *obj, QEvent *e) diff --git a/window.h b/window.h index e4c30de..85e23e6 100644 --- a/window.h +++ b/window.h @@ -22,6 +22,8 @@ #include +class QQuickWindow; + class Window : public QQmlApplicationEngine { Q_OBJECT @@ -30,6 +32,9 @@ public: explicit Window(QObject *parent = nullptr); void load(const QUrl &url); + void show(); + + QQuickWindow *quickWindow() const; protected: bool eventFilter(QObject *o, QEvent *e);