Verified Commit 3f7b11c4 authored by Jonah Brüchert's avatar Jonah Brüchert 🌳 Committed by Linus Jahn
Browse files

Add initial file selection GUI (#233)

parent be46e8c9
......@@ -14,6 +14,7 @@
<file alias="qml/elements/MessageCounter.qml">src/qml/elements/MessageCounter.qml</file>
<file alias="qml/elements/ChatMessage.qml">src/qml/elements/ChatMessage.qml</file>
<file alias="qml/elements/RoundImage.qml">src/qml/elements/RoundImage.qml</file>
<file alias="qml/elements/IconButton.qml">src/qml/elements/IconButton.qml</file>
<file alias="qtquickcontrols2.conf">misc/qtquickcontrols2.conf</file>
......@@ -20,5 +20,10 @@
<file alias="overflow-menu.svg">3rdparty/breeze-icons/icons/actions/22/overflow-menu.svg</file>
<file alias="system-shutdown.svg">3rdparty/breeze-icons/icons/actions/22/system-shutdown.svg</file>
<file alias="view-list-icons.svg">3rdparty/breeze-icons/icons/actions/22/view-list-icons.svg</file>
<file alias="image-jpeg.svg">3rdparty/breeze-icons/icons/mimetypes/64/image-jpeg.svg</file>
<file alias="video-mp4.svg">3rdparty/breeze-icons/icons/mimetypes/64/video-mp4.svg</file>
<file alias="x-office-document.svg">3rdparty/breeze-icons/icons/mimetypes/64/x-office-document.svg</file>
<file alias="audio-mp3.svg">3rdparty/breeze-icons/icons/mimetypes/64/audio-mp3.svg</file>
<file alias="text-x-plain.svg">3rdparty/breeze-icons/icons/mimetypes/22/text-x-plain.svg</file>
......@@ -30,18 +30,77 @@
import QtQuick 2.6
import QtQuick.Controls 2.0 as Controls
import QtQuick.Dialogs 1.0
import QtQuick.Layouts 1.3
import org.kde.kirigami 2.0 as Kirigami
import org.kde.kirigami 2.2 as Kirigami
import QtGraphicalEffects 1.0
import "elements"
Kirigami.ScrollablePage {
id: root
property string chatName
property string recipientJid
title: chatName
keyboardNavigationEnabled: true
FileDialog {
id: fileDialog
title: "Please choose a file to upload"
folder: shortcuts.home
nameFilters: [ "Image files (*.jpg *.png)", "Videos (*.mp4 *.mkv *.avi *.webm)", "Audio Files (*.mp3 *.wav *.flac *.ogg *.m4a *.mka)", "Documents (*.doc *.docx *.odt)", "All files (*)" ]
selectMultiple: true
onAccepted: {
console.log("You chose: " + fileDialog.fileUrls)
onRejected: {
Kirigami.OverlayDrawer {
id: mediaDrawer
edge: Qt.BottomEdge
contentItem: RowLayout {
id: content
Layout.alignment: Qt.AlignHCenter
Layout.fillHeight: true
IconButton {
buttonText: qsTr("Image")
iconSource: "image-jpeg"
onClicked: openFileDialog("Images (*.jpg *.jpeg *.png *.gif)")
Layout.alignment: Qt.AlignHCenter
IconButton {
buttonText: qsTr("Video")
iconSource: "video-mp4"
onClicked: openFileDialog("Videos (*.mp4 *.mkv *.avi *.webm)")
Layout.alignment: Qt.AlignHCenter
IconButton {
buttonText: qsTr("Audio")
iconSource: "audio-mp3"
onClicked: openFileDialog("Audio Files (*.mp3 *.wav *.flac *.ogg *.m4a *.mka)")
Layout.alignment: Qt.AlignHCenter
IconButton {
buttonText: qsTr("Document")
iconSource: "x-office-document"
onClicked: openFileDialog("Documents (*.doc *.docx *.odt)")
Layout.alignment: Qt.AlignHCenter
IconButton {
buttonText: qsTr("Other file")
iconSource: "text-x-plain"
onClicked: openFileDialog("All files (*)")
Layout.alignment: Qt.AlignHCenter
background: Image {
id: bgimage
source: kaidan.getResourcePath("images/chat.png")
......@@ -105,6 +164,12 @@ Kirigami.ScrollablePage {
width: Kirigami.Units.gridUnit * 2
height: width
onClicked: {
if (Kirigami.Settings.isMobile)
openFileDialog("All files (*)")
Controls.TextArea {
......@@ -163,4 +228,10 @@ Kirigami.ScrollablePage {
function openFileDialog(filter) {
fileDialog.selectedNameFilter = filter
* Kaidan - A user-friendly XMPP client for every device!
* Copyright (C) 2016-2018 Kaidan developers and contributors
* (see the LICENSE file for a full list of copyright authors)
* Kaidan 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.
* In addition, as a special exception, the author of Kaidan gives
* permission to link the code of its release with the OpenSSL
* project's "OpenSSL" library (or with modified versions of it that
* use the same license as the "OpenSSL" library), and distribute the
* linked executables. You must obey the GNU General Public License in
* all respects for all of the code used other than "OpenSSL". If you
* modify this file, you may extend this exception to your version of
* the file, but you are not obligated to do so. If you do not wish to
* do so, delete this exception statement from your version.
* Kaidan is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with Kaidan. If not, see <>.
import org.kde.kirigami 2.0 as Kirigami
import QtQuick.Controls 2.0 as Controls
import QtQuick.Layouts 1.3
Controls.ToolButton {
id: button
property string buttonText
property string iconSource
property real scaleFactor: 5
Layout.fillHeight: true
Layout.preferredHeight: Kirigami.Units.gridUnit * (scaleFactor + 2)
Layout.preferredWidth: Kirigami.Units.gridUnit * scaleFactor + Kirigami.Units.smallSpacing * 2
ColumnLayout {
Kirigami.Icon {
id: icon
Layout.fillHeight: true
Layout.fillWidth: true
height: Kirigami.Units.gridUnit * scaleFactor
width: Kirigami.Units.gridUnit * scaleFactor
Layout.leftMargin: Kirigami.Units.smallSpacing
Layout.rightMargin: Kirigami.Units.smallSpacing
Layout.alignment: Qt.AlignHCenter | Qt.AlignTop
source: iconSource
Controls.Label {
text: buttonText
Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment