Add accept/reject and use .cache

This commit is contained in:
Black Hat
2018-08-17 12:55:57 +08:00
parent 6f527402e0
commit 43e0ccaf2f
8 changed files with 95 additions and 41 deletions

View File

@@ -1,6 +1,7 @@
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Controls.Material 2.2
import Qt.labs.platform 1.0
Item {
property bool openOnFinished: false
@@ -27,7 +28,7 @@ Item {
else
{
openOnFinished = true
currentRoom.downloadFile(eventId)
currentRoom.downloadFile(eventId, StandardPaths.writableLocation(StandardPaths.CacheLocation) + "/" + eventId.replace(":", "_") + ".tmp")
}
}

View File

@@ -89,15 +89,36 @@ Item {
pattern: searchField.text
caseSensitivity: Qt.CaseInsensitive
}
proxyRoles: [
ExpressionRole { name: "isFavorite"; expression: category === "Favorites" },
ExpressionRole { name: "isDirectChat"; expression: category === "People" },
ExpressionRole { name: "isLowPriority"; expression: category === "Low Priorities" }
]
proxyRoles: ExpressionRole {
name: "display"
expression: {
switch (category) {
case 1: return "Invited"
case 2: return "Favorites"
case 3: return "Rooms"
case 4: return "People"
case 5: return "Low Priorities"
}
}
}
sorters: [
RoleSorter { roleName: "isFavorite"; sortOrder: Qt.DescendingOrder },
RoleSorter { roleName: "isLowPriority" },
RoleSorter { roleName: "isDirectChat" },
ExpressionSorter {
expression: {
var leftCategory = modelLeft.category
var rightCategory = modelRight.category
if (leftCategory === 1) return true
if (rightCategory === 1) return false
if (leftCategory === 2) return true
if (rightCategory === 2) return false
if (leftCategory === 5) return false
if (rightCategory === 5) return true
if (leftCategory === 4) return false
if (rightCategory === 4) return true
return true
}
},
StringSorter { roleName: "name" }
]
}
@@ -126,7 +147,7 @@ Item {
height: 80
onPressed: listView.currentIndex = index
onPressAndHold: roomListMenu.popup()
onClicked: enterRoom()
onClicked: category === RoomType.Invited ? inviteDialog.open() : enterRoom()
ToolTip.visible: mini && hovered
ToolTip.text: name
@@ -180,7 +201,7 @@ Item {
}
}
section.property: "category"
section.property: "display"
section.criteria: ViewSection.FullString
section.delegate: Label {
width: parent.width
@@ -192,11 +213,29 @@ Item {
verticalAlignment: Text.AlignVCenter
horizontalAlignment: mini ? Text.AlignHCenter : undefined
background: Rectangle {
anchors.fill:parent
anchors.fill: parent
color: Material.theme == Material.Light ? "#dbdbdb" : "#363636"
}
}
Dialog {
id: inviteDialog
parent: ApplicationWindow.overlay
x: (window.width - width) / 2
y: (window.height - height) / 2
width: 360
title: "Action Required"
modal: true
standardButtons: Dialog.Ok | Dialog.Cancel
contentItem: Label { text: "Accept this invitation?" }
onAccepted: matriqueController.acceptRoom(currentRoom)
onRejected: matriqueController.rejectRoom(currentRoom)
}
Menu {
id: roomListMenu