Add saveFileAs() && init setting page.

This commit is contained in:
Black Hat 2018-07-19 21:02:06 +08:00
parent febff558fd
commit 80fca26092
5 changed files with 55 additions and 6 deletions

View File

@ -1,5 +1,39 @@
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Controls.Material 2.2
Page {
SwipeView {
id: settingView
currentIndex: 1
anchors.fill: parent
Item {
id: accountPage
}
Item {
id: secondPage
}
Item {
id: thirdPage
}
}
header: TabBar {
id: tabBar
width: parent.width
currentIndex: settingView.currentIndex
TabButton {
text: qsTr("Account")
}
TabButton {
text: qsTr("Call History")
}
TabButton {
text: qsTr("Dail Pad")
}
}
}

View File

@ -1,6 +1,7 @@
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Controls.Material 2.2
import QtQuick.Dialogs 1.2
Item {
property bool openOnFinished: false
@ -14,9 +15,22 @@ Item {
opacity: 0.4
}
FileDialog {
id: locationDialog
title: "Please choose a location"
folder: shortcuts.home
selectFolder: true
onAccepted: currentRoom.downloadFile(eventId, folder + "/" + currentRoom.fileNameToDownload(eventId))
}
onDownloadedChanged: {
if (downloaded && openOnFinished)
openSavedFile()
if (downloaded && openOnFinished) openSavedFile()
}
function saveFileAs() {
locationDialog.open()
}
function downloadAndOpen()

View File

@ -16,7 +16,7 @@ AvatarContainer {
highlighted: !sentByMe
flat: true
onClicked: downloadable.downloadAndOpen()
onClicked: downloadable.saveFileAs()
}
}
}

View File

@ -26,11 +26,12 @@ AvatarContainer {
anchors.fill: parent
hoverEnabled: true
acceptedButtons: Qt.LeftButton | Qt.RightButton
propagateComposedEvents: true
ToolTip.visible: containsMouse
ToolTip.text: content.body
onClicked: downloadable.downloadAndOpen()
onClicked: mouse.button & Qt.LeftButton ? downloadable.downloadAndOpen() : downloadable.saveFileAs()
}
}
}

View File

@ -10,7 +10,7 @@ Item {
width: delegateLoader.width
height: delegateLoader.height
anchors.right: (eventType === "message" || eventType === "image" || eventType === "file" || eventType === "video" || eventType === "audio" || eventType === "notice") && sentByMe ? parent.right : undefined
anchors.right: !(eventType === "state" || eventType === "emote") && sentByMe ? parent.right : undefined
anchors.horizontalCenter: (eventType === "state" || eventType === "emote") ? parent.horizontalCenter : undefined
MouseArea {