Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F114445
D50.1732549118.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
6 KB
Referenced Files
None
Subscribers
None
D50.1732549118.diff
View Options
diff --git a/.gitignore b/.gitignore
--- a/.gitignore
+++ b/.gitignore
@@ -5,3 +5,5 @@
node_modules
TAGS
/src/contents/ui/AvatarAdapter.qml
+/src/contents/ui/FileDialogAdapter.qml
+/src/contents/ui/FolderDialogAdapter.qml
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -16,6 +16,8 @@
endif()
configure_file(${kazv_avatarAdapterFile} ${CMAKE_CURRENT_SOURCE_DIR}/contents/ui/AvatarAdapter.qml COPYONLY)
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/contents/ui/FileDialogAdapter_Qt${QT_MAJOR_VERSION}.qml ${CMAKE_CURRENT_SOURCE_DIR}/contents/ui/FileDialogAdapter.qml COPYONLY)
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/contents/ui/FolderDialogAdapter_Qt${QT_MAJOR_VERSION}.qml ${CMAKE_CURRENT_SOURCE_DIR}/contents/ui/FolderDialogAdapter.qml COPYONLY)
set(kazvprivlib_SRCS
qt-job-handler.cpp
diff --git a/src/contents/ui/FileDialogAdapter_Qt5.qml b/src/contents/ui/FileDialogAdapter_Qt5.qml
new file mode 100644
--- /dev/null
+++ b/src/contents/ui/FileDialogAdapter_Qt5.qml
@@ -0,0 +1,11 @@
+/*
+ * This file is part of kazv.
+ * SPDX-FileCopyrightText: 2024 tusooa <tusooa@kazv.moe>
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+import QtQuick 2.15
+import QtQuick.Dialogs 1.3
+
+FileDialog {
+}
diff --git a/src/contents/ui/FileDialogAdapter_Qt6.qml b/src/contents/ui/FileDialogAdapter_Qt6.qml
new file mode 100644
--- /dev/null
+++ b/src/contents/ui/FileDialogAdapter_Qt6.qml
@@ -0,0 +1,14 @@
+/*
+ * This file is part of kazv.
+ * SPDX-FileCopyrightText: 2024 tusooa <tusooa@kazv.moe>
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+import QtQuick 2.15
+import QtQuick.Dialogs
+
+FileDialog {
+ id: fileDialog
+ property alias fileUrl: fileDialog.selectedFile
+ property alias folder: fileDialog.currentFolder
+}
diff --git a/src/contents/ui/FolderDialogAdapter_Qt5.qml b/src/contents/ui/FolderDialogAdapter_Qt5.qml
new file mode 100644
--- /dev/null
+++ b/src/contents/ui/FolderDialogAdapter_Qt5.qml
@@ -0,0 +1,12 @@
+/*
+ * This file is part of kazv.
+ * SPDX-FileCopyrightText: 2024 tusooa <tusooa@kazv.moe>
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+import QtQuick 2.15
+import QtQuick.Dialogs 1.3
+
+FileDialog {
+ selectFolder: true
+}
diff --git a/src/contents/ui/FolderDialogAdapter_Qt6.qml b/src/contents/ui/FolderDialogAdapter_Qt6.qml
new file mode 100644
--- /dev/null
+++ b/src/contents/ui/FolderDialogAdapter_Qt6.qml
@@ -0,0 +1,13 @@
+/*
+ * This file is part of kazv.
+ * SPDX-FileCopyrightText: 2024 tusooa <tusooa@kazv.moe>
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+import QtQuick 2.15
+import QtQuick.Dialogs
+
+FolderDialog {
+ id: folderDialog
+ property alias folder: folderDialog.selectedFolder
+}
diff --git a/src/contents/ui/MediaFileMenu.qml b/src/contents/ui/MediaFileMenu.qml
--- a/src/contents/ui/MediaFileMenu.qml
+++ b/src/contents/ui/MediaFileMenu.qml
@@ -6,12 +6,11 @@
import QtQuick 2.15
import QtQuick.Controls 2.15
-import QtQuick.Dialogs 1.3
import Qt.labs.platform 1.1 as Platform
import org.kde.kirigami 2.13 as Kirigami
-
-import '.' as Types
+import moe.kazv.mxc.kazv 0.0 as MK
+import '.' as Kazv
QtObject {
id: mediaFileMenu
@@ -48,12 +47,20 @@
property var optionMenu: [viewAction, saveAction]
- property var fileDialog: FileDialog {
+ property var fileDialog: Kazv.FileDialogAdapter {
+ id: fileDialog
folder: Platform.StandardPaths.writableLocation(Platform.StandardPaths.DownloadLocation)
- selectExisting: false
onAccepted: {
mediaFileMenu.fileHandler.downloadFile(fileUrl)
}
+
+ Component.onCompleted: {
+ if (MK.KazvUtil.kfQtMajorVersion === 5) {
+ fileDialog.selectExisting = false;
+ } else {
+ fileDialog.fileMode = Kazv.FileDialogAdapter.SaveFile;
+ }
+ }
}
Component.onCompleted: {
diff --git a/src/contents/ui/SendMessageBox.qml b/src/contents/ui/SendMessageBox.qml
--- a/src/contents/ui/SendMessageBox.qml
+++ b/src/contents/ui/SendMessageBox.qml
@@ -7,7 +7,6 @@
import QtQuick 2.15
import QtQuick.Layouts 1.15
import QtQuick.Controls 2.15
-import QtQuick.Dialogs 1.3
import org.kde.kirigami 2.13 as Kirigami
import moe.kazv.mxc.kazv 0.0 as MK
@@ -201,7 +200,7 @@
}
}
- property var fileDialog: FileDialog {
+ property var fileDialog: Kazv.FileDialogAdapter {
onAccepted: {
sendMessageBox.uploadFile(fileUrl);
}
diff --git a/src/contents/ui/UploadFileHelper.qml b/src/contents/ui/UploadFileHelper.qml
--- a/src/contents/ui/UploadFileHelper.qml
+++ b/src/contents/ui/UploadFileHelper.qml
@@ -7,9 +7,9 @@
import QtQuick 2.15
import QtQuick.Layouts 1.15
import QtQuick.Controls 2.15
-import QtQuick.Dialogs 1.3
import moe.kazv.mxc.kazv 0.0 as MK
+import '.' as Kazv
QtObject {
id: uploadFileHelper
@@ -21,7 +21,7 @@
property var job: null
property var available: !!job
- property var fileDialog: FileDialog {
+ property var fileDialog: Kazv.FileDialogAdapter {
onAccepted: {
uploadFileHelper.job = kazvIOManager.startNewRoomlessUploadJob(matrixSdk.serverUrl, fileUrl, matrixSdk.token)
}
diff --git a/src/contents/ui/settings/CacheSettings.qml b/src/contents/ui/settings/CacheSettings.qml
--- a/src/contents/ui/settings/CacheSettings.qml
+++ b/src/contents/ui/settings/CacheSettings.qml
@@ -1,8 +1,16 @@
+/*
+ * This file is part of kazv.
+ * SPDX-FileCopyrightText: 2020-2023 nannanko <nannanko@kazv.moe>
+ * SPDX-FileCopyrightText: 2024 tusooa <tusooa@kazv.moe>
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
import org.kde.kirigami 2.13 as Kirigami
import QtQuick.Layouts 1.15
import QtQuick.Controls 2.15
-import QtQuick.Dialogs 1.3
+
+import '..' as Kazv
RowLayout {
id: cacheSettings
@@ -33,9 +41,8 @@
}
}
- FileDialog {
+ Kazv.FolderDialogAdapter {
id: folderDialog
- selectFolder: true
onAccepted: {
cacheDirectoryEntry.text = folder
}
diff --git a/src/resources.qrc b/src/resources.qrc
--- a/src/resources.qrc
+++ b/src/resources.qrc
@@ -77,6 +77,8 @@
<file alias="Notifier.qml">contents/ui/Notifier.qml</file>
<file alias="NotificationAction.qml">contents/ui/NotificationAction.qml</file>
<file alias="AvatarAdapter.qml">contents/ui/AvatarAdapter.qml</file>
+ <file alias="FileDialogAdapter.qml">contents/ui/FileDialogAdapter.qml</file>
+ <file alias="FolderDialogAdapter.qml">contents/ui/FolderDialogAdapter.qml</file>
<file alias="l10n.js">js/l10n.js</file>
<file alias="fluent-bundle.js">js/transformed-libs/fluent-bundle.js</file>
<file alias="fluent-sequence.js">js/transformed-libs/fluent-sequence.js</file>
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Nov 25, 7:38 AM (12 h, 37 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
39841
Default Alt Text
D50.1732549118.diff (6 KB)
Attached To
Mode
D50: Make FileDialog work with Qt6
Attached
Detach File
Event Timeline
Log In to Comment