diff --git a/src/apps/qml/LeaveChannelDialog.qml b/src/apps/qml/LeaveChannelDialog.qml index fa197b15..f6f604ad 100644 --- a/src/apps/qml/LeaveChannelDialog.qml +++ b/src/apps/qml/LeaveChannelDialog.qml @@ -1,53 +1,53 @@ /* Copyright (c) 2018-2019 Montel Laurent This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License or ( at your option ) version 3 or, at the discretion of KDE e.V. ( which shall act as a proxy as in section 14 of the GPLv3 ), any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import QtQuick.Layouts 1.12 import QtQuick.Controls 2.5 as QQC2 import QtQuick.Window 2.0 import QtQuick 2.9 QQC2.Dialog { id: leaveChannelDialog title: i18n("Leave Channel") signal leaveChannel(string roomId, string channelType) x: parent.width / 2 - width / 2 y: parent.height / 2 - height / 2 - property QtObject roomInfo + property string channelType: "" property string rId: "" modal: true standardButtons: QQC2.Dialog.Ok | QQC2.Dialog.Cancel Row { QQC2.Label { text: i18n("Do you want to leave this channel?") font.bold: true font.pointSize: 15 } } onAccepted: { - leaveChannelDialog.leaveChannel(rId, roomInfo.channelType) + leaveChannelDialog.leaveChannel(rId, channelType) } } diff --git a/src/apps/qml/RoomDelegate.qml b/src/apps/qml/RoomDelegate.qml index 7f3133f1..f1ae3c82 100644 --- a/src/apps/qml/RoomDelegate.qml +++ b/src/apps/qml/RoomDelegate.qml @@ -1,131 +1,131 @@ /* * Copyright 2016 Riccardo Iaconelli * Copyright 2017-2018 Montel Laurent * * This program 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 2 of * the License or (at your option) version 3 or any later version * accepted by the membership of KDE e.V. (or its successor approved * by the membership of KDE e.V.), which shall act as a proxy * defined in Section 14 of version 3 of the license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * */ import QtQuick 2.9 import org.kde.kirigami 2.4 as Kirigami import QtQuick.Layouts 1.1 import KDE.Ruqola.UsersModel 1.0 import QtQuick.Controls 2.5 as QQC2 Kirigami.BasicListItem { id: root property int d_unread: 0; property int d_userMentions: 0; property string d_name: "roomName"; property bool d_selected: false; property string d_roomID : ""; property string d_type: ""; property bool d_open: false; property bool d_alert: false; property var d_icon property bool d_editingMode: false; signal roomSelected(string roomID) - signal leaveRoom(string roomID) - signal hideRoom(string roomID) + signal leaveRoom(string roomID, string roomType) + signal hideRoom(string roomID, string roomType) icon: d_icon topPadding: 0 bottomPadding: 0 implicitHeight: contentItem.implicitHeight separatorVisible: false visible: !d_name.empty && d_open font.bold: (d_unread > 0) || d_alert label: d_name checked: d_selected onClicked: { root.roomSelected(d_roomID); } function generateText() { var str = ""; if (d_userMentions > 0) { str = "@"; } //Add space after (...) str += i18n("(%1)", d_unread) + ' '; return str; } RowLayout { id: editingActions QQC2.Label { id: unreadMessage visible: !d_editingMode && d_unread > 0 height: parent.height width: height font.bold: true //FIX COLOR color: (d_unread != 0) ? "#FF0000" : "#FFFFFF" text: generateText() Layout.alignment: Qt.AlignVCenter | Qt.AlignRight } Kirigami.Icon { id: hideAction visible: d_editingMode source: "hide_table_row" height: parent.height width: height opacity: d_selected ? 1 : .5 MouseArea { anchors.fill: parent hoverEnabled: true onEntered: parent.active = true; onExited: parent.active = false; onClicked: { - root.hideRoom(d_roomID) + root.hideRoom(d_roomID, d_type) } } Layout.alignment: Qt.AlignVCenter | Qt.AlignRight } Kirigami.Icon { id: quitAction //We can leave only channel not private chat visible: d_editingMode && (d_type == "c" || d_type == "p") source: "dialog-close" height: parent.height width: height opacity: d_selected ? 1 : .5 MouseArea { anchors.fill: parent hoverEnabled: true onEntered: parent.active = true; onExited: parent.active = false; onClicked: { - root.leaveRoom(d_roomID) + root.leaveRoom(d_roomID, d_type) } } Layout.alignment: Qt.AlignVCenter | Qt.AlignRight } } } diff --git a/src/apps/qml/RoomsComponent.qml b/src/apps/qml/RoomsComponent.qml index a0781adb..6638c0a9 100644 --- a/src/apps/qml/RoomsComponent.qml +++ b/src/apps/qml/RoomsComponent.qml @@ -1,120 +1,120 @@ /* * Copyright 2016 Riccardo Iaconelli * Copyright (C) 2017-2019 Laurent Montel * * This program 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 2 of * the License or (at your option) version 3 or any later version * accepted by the membership of KDE e.V. (or its successor approved * by the membership of KDE e.V.), which shall act as a proxy * defined in Section 14 of version 3 of the license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * */ import QtQuick 2.9 import QtQuick.Controls 1.4 import QtQuick.Window 2.2 import QtQuick.Dialogs 1.2 import QtQuick.Layouts 1.1 import QtQuick.Controls 2.5 as QQC2 import KDE.Ruqola.RocketChatAccount 1.0 import KDE.Ruqola.Ruqola 1.0 import KDE.Ruqola.RoomFilterProxyModel 1.0 import KDE.Ruqola.UsersForRoomFilterProxyModel 1.0 import org.kde.kirigami 2.4 as Kirigami import KDE.Ruqola.StatusModel 1.0 Component { id: roomsComponent Kirigami.ScrollablePage { id: roomsPage background: Rectangle { color: Kirigami.Theme.backgroundColor } header: Column { ColumnLayout { anchors.left: parent.left anchors.right: parent.right RowLayout { Layout.alignment: Qt.AlignLeft anchors.leftMargin: 2*Kirigami.Units.smallSpacing QQC2.Label { id: comboboxLabel text: i18n("Status:") } QQC2.ComboBox { id: statusCombobox Layout.alignment: Qt.AlignLeft model: appid.rocketChatAccount.statusModel() textRole: "statusi18n" onActivated: { appid.rocketChatAccount.changeDefaultStatus(index) } currentIndex: model.currentStatus delegate: Kirigami.BasicListItem { icon: model.icon label: model.statusi18n } } } QQC2.TextField { id: searchField focus: true Layout.minimumHeight: Layout.maximumHeight Layout.maximumHeight: Kirigami.Units.iconSizes.smallMedium + Kirigami.Units.smallSpacing * 2 Layout.fillWidth: true //width: parent.width placeholderText: i18n("Search room...") onTextChanged: { appid.rocketChatAccount.roomFilterProxyModel().setFilterString(text); //TODO filter list view } } } } mainItem: RoomsView { id: roomsList editingMode: appid.rocketChatAccount.editingMode implicitWidth: Kirigami.Units.gridUnit * 10 anchors.fill: parent model: appid.rocketChatAccount.roomFilterProxyModel() selectedRoomID: appid.selectedRoomID; onHideRoom: { - rocketChatAccount.hideRoom(roomID) + rocketChatAccount.hideRoom(roomID, roomType) } onLeaveRoom: { //TODO move to desktop.qml leaveChannelDialog.rId = roomID - leaveChannelDialog.roomInfo = appid.selectedRoom + leaveChannelDialog.channelType = roomType leaveChannelDialog.open() } onRoomSelected: { if (roomID == selectedRoomID) { return; } appid.rocketChatAccount.setUserCurrentMessage(appid.userInputMessageText, selectedRoomID) appid.selectedRoomID = roomID; appid.messageModel = appid.rocketChatAccount.messageModelForRoom(roomID) appid.selectedRoom = appid.rocketChatAccount.getRoomWrapper(roomID) appid.userModel = appid.rocketChatAccount.usersForRoomFilterProxyModel(roomID) appid.filesModel = appid.rocketChatAccount.filesForRoomFilterProxyModel(roomID) } } //RoomsView } } diff --git a/src/apps/qml/RoomsView.qml b/src/apps/qml/RoomsView.qml index 29487370..820b6fe5 100644 --- a/src/apps/qml/RoomsView.qml +++ b/src/apps/qml/RoomsView.qml @@ -1,84 +1,84 @@ /* * Copyright 2016 Riccardo Iaconelli * Copyright (c) 2017-2019 Montel Laurent * * This program 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 2 of * the License or (at your option) version 3 or any later version * accepted by the membership of KDE e.V. (or its successor approved * by the membership of KDE e.V.), which shall act as a proxy * defined in Section 14 of version 3 of the license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * */ import QtQuick 2.9 import org.kde.kirigami 2.4 as Kirigami import QtQuick.Layouts 1.1 import QtQuick.Controls 2.5 as QQC2 import KDE.Ruqola.RocketChatAccount 1.0 ListView { id: roomsList property string selectedRoomID; property bool editingMode: false; - signal hideRoom(string roomID) - signal leaveRoom(string roomID) + signal leaveRoom(string roomID, string roomType) + signal hideRoom(string roomID, string roomType) signal roomSelected(string roomID) section { property: "sectionname" delegate: Kirigami.AbstractListItem { enabled: false RowLayout { anchors { left: parent.left right: parent.right leftMargin: Kirigami.Units.smallSpacing } QQC2.Label { id: sectionLabel text: section Layout.minimumHeight: Math.max(implicitHeight, Kirigami.Units.iconSizes.smallMedium) elide: Text.ElideRight Layout.alignment: Qt.AlignHCenter Component.onCompleted: font.bold = true } } } } delegate: RoomDelegate { d_name: name d_unread: unread d_userMentions: userMentions d_roomID: room_id d_type: type d_open: open d_alert: alert d_selected: selectedRoomID == room_id d_editingMode: editingMode d_icon: channelicon onRoomSelected : { roomsList.roomSelected(roomID) applicationWindow().pageStack.currentIndex = 1; } onHideRoom: { - roomsList.hideRoom(roomID) + roomsList.hideRoom(roomID, roomType) } onLeaveRoom: { - roomsList.leaveRoom(roomID) + roomsList.leaveRoom(roomID, roomType) } } }