Port away from Qt.Plaform.labs

This bring a QtWidget dependency on Android
This commit is contained in:
Carl Schwan
2024-09-21 11:39:01 +02:00
parent cfb663d399
commit 9d6b940b78
10 changed files with 34 additions and 33 deletions

View File

@@ -1,9 +1,10 @@
// SPDX-FileCopyrightText: 2019 Black Hat <bhat@encom.eu.org>
// SPDX-License-Identifier: GPL-3.0-only
import QtCore as Core
import QtQuick
import QtQuick.Controls as QQC2
import Qt.labs.platform
import QtQuick.Dialogs as Dialogs
import org.kde.kirigami as Kirigami
@@ -110,16 +111,16 @@ DelegateContextMenu {
Component {
id: saveAsDialog
FileDialog {
fileMode: FileDialog.SaveFile
folder: NeoChatConfig.lastSaveDirectory.length > 0 ? NeoChatConfig.lastSaveDirectory : StandardPaths.writableLocation(StandardPaths.DownloadLocation)
Dialogs.FileDialog {
fileMode: Dialogs.FileDialog.SaveFile
currentFolder: NeoChatConfig.lastSaveDirectory.length > 0 ? NeoChatConfig.lastSaveDirectory : Core.StandardPaths.writableLocation(Core.StandardPaths.DownloadLocation)
onAccepted: {
if (!currentFile) {
if (!selectedFile) {
return;
}
NeoChatConfig.lastSaveDirectory = folder;
NeoChatConfig.lastSaveDirectory = currentFolder;
NeoChatConfig.save();
currentRoom.downloadFile(eventId, currentFile);
currentRoom.downloadFile(eventId, selectedFile);
}
}
}

View File

@@ -4,7 +4,7 @@
import QtQuick
import QtQuick.Controls as QQC2
import QtQuick.Layouts
import Qt.labs.platform as Platform
import QtCore as Core
import org.kde.kirigami as Kirigami
import org.kde.kirigamiaddons.labs.components as KirigamiComponents
@@ -44,7 +44,7 @@ Kirigami.Page {
text: i18nc("@action:button Accept image modification", "Accept")
icon.name: "dialog-ok"
onTriggered: {
let newPath = Platform.StandardPaths.writableLocation(Platform.StandardPaths.CacheLocation) + "/" + (new Date()).getTime() + "." + imagePath.split('.').pop();
let newPath = Core.StandardPaths.writableLocation(Core.StandardPaths.CacheLocation) + "/" + (new Date()).getTime() + "." + imagePath.split('.').pop();
if (imageDoc.saveAs(newPath)) {
newPathChanged(newPath);
} else {

View File

@@ -1,10 +1,11 @@
// SPDX-FileCopyrightText: 2023 James Graham <james.h.graham@protonmail.com>
// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
import QtCore as Core
import QtQuick
import QtQuick.Controls as QQC2
import QtQuick.Layouts
import Qt.labs.platform as Platform
import QtQuick.Dialogs as Dialogs
import QtMultimedia
import org.kde.kirigami as Kirigami
@@ -36,7 +37,7 @@ Components.AlbumMaximizeComponent {
downloadAction: Components.DownloadAction {
id: downloadAction
onTriggered: {
currentRoom.downloadFile(root.currentEventId, Platform.StandardPaths.writableLocation(Platform.StandardPaths.CacheLocation) + "/" + root.currentEventId.replace(":", "_").replace("/", "_").replace("+", "_") + currentRoom.fileNameToDownload(root.currentEventId));
currentRoom.downloadFile(root.currentEventId, Core.StandardPaths.writableLocation(Core.StandardPaths.CacheLocation) + "/" + root.currentEventId.replace(":", "_").replace("/", "_").replace("+", "_") + currentRoom.fileNameToDownload(root.currentEventId));
}
}
@@ -120,16 +121,16 @@ Components.AlbumMaximizeComponent {
Component {
id: saveAsDialog
Platform.FileDialog {
fileMode: Platform.FileDialog.SaveFile
folder: root.saveFolder
Dialogs.FileDialog {
fileMode: Dialogs.FileDialog.SaveFile
currentFolder: root.saveFolder
onAccepted: {
NeoChatConfig.lastSaveDirectory = folder;
NeoChatConfig.lastSaveDirectory = currentFolder;
NeoChatConfig.save();
if (!currentFile) {
if (!selectedFile) {
return;
}
currentRoom.downloadFile(root.currentEventId, currentFile);
currentRoom.downloadFile(root.currentEventId, selectedFile);
}
}
}