diff --git a/smsapp/qml/ContactList.qml b/smsapp/qml/ContactList.qml index babf418a..c269ca3b 100644 --- a/smsapp/qml/ContactList.qml +++ b/smsapp/qml/ContactList.qml @@ -1,96 +1,96 @@ /* * This file is part of KDE Telepathy Chat * * Copyright (C) 2015 Aleix Pol Gonzalez * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ import QtQuick 2.5 import QtQuick.Controls 2.1 import QtQuick.Layouts 1.1 import org.kde.people 1.0 import org.kde.plasma.core 2.0 as Core -import org.kde.kirigami 2.3 as Kirigami +import org.kde.kirigami 2.2 as Kirigami import org.kde.kdeconnect 1.0 Kirigami.ScrollablePage { Component { id: chatView ConversationDisplay {} } ListView { id: view spacing: 3 currentIndex: 0 model: PersonsSortFilterProxyModel { requiredProperties: ["phoneNumber"] sortRole: Qt.DisplayRole sortCaseSensitivity: Qt.CaseInsensitive sourceModel: PersonsModel { id: people } } header: TextField { id: filter placeholderText: i18n("Filter...") Layout.fillWidth: true onTextChanged: { view.model.filterRegExp = new RegExp(filter.text) view.currentIndex = 0 } Keys.onUpPressed: view.currentIndex = Math.max(view.currentIndex-1, 0) Keys.onDownPressed: view.currentIndex = Math.min(view.currentIndex+1, view.count-1) onAccepted: { view.currentItem.startChat() } Shortcut { sequence: "Ctrl+F" onActivated: filter.forceActiveFocus() } } delegate: Kirigami.BasicListItem { id: mouse hoverEnabled: true readonly property var person: PersonData { personUri: model.personUri } label: display icon: decoration function startChat() { applicationWindow().pageStack.push(chatView, { person: person.person, device: Qt.binding(function() {return devicesCombo.device })}) } onClicked: { startChat(); } } } footer: ComboBox { id: devicesCombo readonly property QtObject device: model.data(model.index(currentIndex, 0), DevicesModel.DeviceRole) model: DevicesSortProxyModel { //TODO: make it possible to sort only if they can do sms sourceModel: DevicesModel { displayFilter: DevicesModel.Paired | DevicesModel.Reachable } } textRole: "display" } } diff --git a/smsapp/qml/ConversationDisplay.qml b/smsapp/qml/ConversationDisplay.qml index b9750803..c8995967 100644 --- a/smsapp/qml/ConversationDisplay.qml +++ b/smsapp/qml/ConversationDisplay.qml @@ -1,66 +1,66 @@ /* * This file is part of KDE Telepathy Chat * * Copyright (C) 2015 Aleix Pol Gonzalez * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ import QtQuick 2.1 import QtQuick.Controls 2.1 import QtQuick.Layouts 1.1 -import org.kde.kirigami 2.4 as Kirigami +import org.kde.kirigami 2.2 as Kirigami Kirigami.ScrollablePage { id: page readonly property string phoneNumber: person.contactCustomProperty("phoneNumber") title: i18n("%1: %2", person.name, phoneNumber) property QtObject person property QtObject device readonly property QtObject telephony: TelephonyDbusInterfaceFactory.create(device.id()) - Kirigami.CardsListView { + ListView { model: ListModel { ListElement { display: "aaa"; fromMe: true } ListElement { display: "aaa" } ListElement { display: "aaa"; fromMe: true } ListElement { display: "aaa" } ListElement { display: "aaa" } ListElement { display: "aaa" } } - delegate: Kirigami.AbstractCard { + delegate: Kirigami.BasicListItem { readonly property real margin: 100 x: fromMe ? Kirigami.Units.gridUnit : margin width: parent.width - margin - Kirigami.Units.gridUnit contentItem: Label { text: model.display } } } footer: RowLayout { TextField { id: message Layout.fillWidth: true placeholderText: i18n("Say hi...") } Button { text: "Send" onClicked: { console.log("sending sms", page.phoneNumber) page.telephony.sendSms(page.phoneNumber, message.text) } } } } diff --git a/smsapp/qml/main.qml b/smsapp/qml/main.qml index f7bdf446..2645b0f8 100644 --- a/smsapp/qml/main.qml +++ b/smsapp/qml/main.qml @@ -1,37 +1,36 @@ /* * This file is part of KDE Telepathy Chat * * Copyright (C) 2014 Aleix Pol Gonzalez * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ import QtQuick 2.1 -import QtQuick.Controls 2.3 -import org.kde.kirigami 2.3 as Kirigami +import org.kde.kirigami 2.2 as Kirigami Kirigami.ApplicationWindow { id: root visible: true width: 800 height: 600 header: Kirigami.ToolBarApplicationHeader {} pageStack.initialPage: ContactList { title: i18n("KDE Connect SMS") } }