diff --git a/src/contactview/qml/contactinfo.qml b/src/contactview/qml/contactinfo.qml index 1325f187..f94a7f08 100644 --- a/src/contactview/qml/contactinfo.qml +++ b/src/contactview/qml/contactinfo.qml @@ -1,702 +1,702 @@ /*************************************************************************** * Copyright (C) 2017 by Bluesystems * * Author : Emmanuel Lepage Vallee * * * * 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 3 of the License, or * * (at your option) any later version. * * * * 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.7 import QtQuick.Controls 2.0 import QtQuick.Layouts 1.2 import org.kde.kirigami 2.2 as Kirigami import net.lvindustries.ringqtquick 1.0 as RingQtQuick import org.kde.ringkde.jamicontactview 1.0 as JamiContactView Kirigami.ScrollablePage { id: contactViewPage property string defaultName: "" property var individual: null property string forcedState: "" property bool editable: true property bool editing: editable signal changed() signal selectChat() signal selectHistory() property bool showStat: true property bool showImage: false property bool showSave: true property bool isChanged: false property var labelColor: Kirigami.Theme.textColor property var cachedPhoto: undefined state: forcedState // verticalScrollBarPolicy: Qt.ScrollBarAlwaysOff // horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff function save() { if (!individual) return var person = individual.person if (!person) person = contactBuilder.from(individual, vCardForm.name) if (!vCardForm.currentPerson) vCardForm.currentPerson = person vCardForm.syncDetails(person) if (contactViewPage.cachedPhoto != undefined) person.photo = contactViewPage.cachedPhoto person.save() //currentPerson = person isChanged = false } onChanged: { isChanged = true } actions { main: Kirigami.Action { iconName: editing ? "document-save" : "document-edit" visible: contactViewPage.state == "mobile" onTriggered: { if (editing && isChanged) { console.log("Saving!") contactViewPage.save() } editing = (!editing) && editable } } } onIndividualChanged: { vCardForm.currentPerson = individual ? individual.person : null vCardForm.individual = individual isChanged = false } GroupBox { id: advanced title: i18n("Advanced") clip: true height: 300 Behavior on height { NumberAnimation { duration: 200 } } ColumnLayout { id: tabbedContactInfo anchors.topMargin: contactViewPage.showImage ? 95 : 0 spacing: 0 clip: true anchors.fill: parent TabBar { Layout.fillWidth: true id: tabBar onCurrentIndexChanged: { sv.currentIndex = currentIndex } TabButton { text: i18n("Phone numbers") } // TabButton { // text: i18n("Addresses") // } } SwipeView { id: sv Layout.fillWidth: true Layout.fillHeight: true onCurrentIndexChanged: { tabBar.currentIndex = currentIndex } background: Rectangle { color: Kirigami.Theme.backgroundColor } Page { Layout.fillWidth: true Layout.fillHeight: true id: tabbedContactInfoPage1 JamiContactView.VCardForm { id: vCardForm height: preferredHeight editing: contactViewPage.editing onChanged: { isChanged = true } } background: Rectangle { color: Kirigami.Theme.backgroundColor } } Page { id: phoneNumbersPage Layout.fillWidth: true Layout.fillHeight: true JamiContactView.PhoneNumbers { id: phoneNumbers width: parent.width model: contactViewPage.individual buttonColor: contactViewPage.labelColor showAdd: contactViewPage.editing } background: Rectangle { color: Kirigami.Theme.backgroundColor } } // Page { // id: addressesPage // Layout.fillWidth: true // Layout.fillHeight: true // Addresses { // id: addresses // anchors.fill: parent // } // // background: Rectangle { color: Kirigami.Theme.backgroundColor } // } Page { Layout.fillWidth: true Layout.fillHeight: true background: Rectangle { color: Kirigami.Theme.backgroundColor } id: tabbedContactInfoPage4 JamiContactView.Statistics { id: statistics Layout.fillWidth: true visible: showStat individual: contactViewPage.individual labelColor: contactViewPage.labelColor } } } } } RingQtQuick.ContactBuilder { id: contactBuilder } Rectangle { id: saveButton z: 10 radius: 999 color: Kirigami.Theme.highlightColor visible: showSave && isChanged anchors.margins: 10 width: 56 height: 56 - Image { - source: "image://icon/edit-save" - height: 32 - width: 32 + Kirigami.Icon { + source: "edit-save" + height: Kirigami.Units.iconSizes.smallMedium + width: Kirigami.Units.iconSizes.smallMedium anchors.centerIn: parent } MouseArea { anchors.fill: parent hoverEnabled: true onClicked: { contactViewPage.save() } } } ColumnLayout { id: phoneLayout visible: false anchors.left: parent.left anchors.top: parent.top width: parent.width spacing: 10 /** * When showing the profile or adding a contact, display the image at the top. * * When showing the main GUI, this image is part of the header and should * not be shown. */ Item { id: contactPicture visible: showImage height: showImage ? 90 : 0 implicitHeight: showImage ? 90 : 0 Layout.fillWidth: true JamiContactView.ContactPhoto { id: photoRect tracked: false visible: showImage anchors.centerIn: parent height: 90 width: 90 defaultColor: contactViewPage.labelColor individual: contactViewPage.individual function onNewPhoto(p) { contactViewPage.cachedPhoto = p contactViewPage.changed() } MouseArea { anchors.fill: parent z: 100 onClicked: { if (!contactViewPage.editing) return false var component = Qt.createComponent("qrc:/photoselector/qml/editor.qml") if (component.status == Component.Ready) { var window = component.createObject(contactViewPage) window.person = individual ? individual.person : null window.newPhoto.connect(photoRect.onNewPhoto) } else console.log("ERROR", component.status, component.errorString()) } } } } Kirigami.Heading { id: statisticHeader text: i18n("Statistics") color: contactViewPage.labelColor level: 2 } Item { id: statisticHolder // Layout.leftAnchor: parent.left height: statistics.implicitHeight Layout.fillWidth: true } // Keep in columns to avoid spacing ColumnLayout { Layout.fillWidth: true Kirigami.BasicListItem { id: viewHistory label: i18n("View history") icon: "view-history" separatorVisible: true onClicked: { contactViewPage.selectHistory() } } Kirigami.BasicListItem { id: openChat label: i18n("Open chat") icon: "dialog-messages" onClicked: { contactViewPage.selectChat() } } } Kirigami.Heading { text: i18n("Contact details") color: contactViewPage.labelColor level: 2 } Item { id: contactHolder height: vCardForm.preferredHeight Layout.preferredHeight: height Layout.maximumHeight: height Layout.minimumHeight: height Layout.fillWidth: true } Kirigami.Heading { text: i18n("Phone numbers") color: contactViewPage.labelColor level: 2 } Item { id: phoneNumberHolder height: phoneNumbers.preferredHeight Layout.preferredHeight: height Layout.maximumHeight: height Layout.minimumHeight: height Layout.fillWidth: true } // Kirigami.Heading { // text: i18n("Addresses") // color: contactViewPage.labelColor // level: 2 // } // Item { // id: addressesHolder // height: addresses.contentHeight // width: parent.width // } } onStateChanged: { tabBar.currentIndex = 0 sv.currentIndex = 1 } /** * To make this page scale down, reparent everything depending on the * resolution. */ states: [ // In tablet mode, use 3 columns for the details State { name: "tablet" when: (forcedState == "" ) && (contactViewPage.width >= 600 && contactViewPage.height <= ( statistics.implicitHeight + 320) // 320 = advanced.height + 2*spacing ) ParentChange { target: advanced parent: contactViewPage } ParentChange { target: vCardForm parent: contactViewPage } ParentChange { target: statistics parent: contactViewPage } ParentChange { target: phoneNumbers parent: phoneNumbersPage } // ParentChange { // target: addresses // parent: addressesPage // } AnchorChanges { target: advanced anchors.right: advanced.parent.right anchors.bottom: advanced.parent.bottom anchors.top: contactPicture.bottom anchors.left: undefined } AnchorChanges { target: statistics anchors.top: contactPicture.visible ? contactPicture.bottom : contactViewPage.top anchors.left: statistics.parent.left } AnchorChanges { target: vCardForm anchors.left: vCardForm.parent.left anchors.top: statistics.bottom } AnchorChanges { target: phoneNumbers anchors.left: undefined anchors.top: undefined } // AnchorChanges { // target: addresses // anchors.left: undefined // } PropertyChanges { target: advanced visible: true width: contactViewPage.width / 2 height: contactViewPage.height } PropertyChanges { target: statistics width: contactViewPage.width / 2 height: statistics.implicitHeight } PropertyChanges { target: vCardForm width: contactViewPage.width / 2 } PropertyChanges { target: phoneNumbers anchors.fill: phoneNumbersPage width: undefined height: phoneNumbersPage.height interactive: true } PropertyChanges { target: contactViewPage editing: editable } AnchorChanges { target: saveButton anchors.bottom: saveButton.parent.bottom anchors.top: undefined anchors.left: saveButton.parent.left anchors.right: undefined anchors.horizontalCenter: undefined } PropertyChanges { target: saveButton width: 64 height: 64 } }, // In desktop mode, put everything on top of each other and get rid // of the second tabbar State { name: "" extend: "tablet" AnchorChanges { target: saveButton anchors.top: saveButton.parent.top anchors.right: saveButton.parent.right anchors.bottom: undefined anchors.left: undefined anchors.horizontalCenter: undefined } PropertyChanges { target: saveButton width: 64 height: 64 } AnchorChanges { target: advanced anchors.right: advanced.parent.right anchors.bottom: advanced.parent.bottom anchors.top: undefined anchors.left: advanced.parent.left } PropertyChanges { target: statistics width: contactViewPage.width } PropertyChanges { target: vCardForm width: vCardForm.implicitWidth height: vCardForm.implicitHeight anchors.topMargin: 10 anchors.horizontalCenter: undefined } PropertyChanges { target: advanced height: contactViewPage.height ? 300 : 299 //BUG prevent a race condition in QML visible: true anchors.topMargin: 10 } }, // The first phone mode was not very usable, lets try again State { name: "mobile" when: ((forcedState == "" && (contactViewPage.width < 600 || contactViewPage.height < ( statistics.implicitHeight + vCardForm.implicitHeight + 320) // 320 = advanced.height + 2*spacing ))) || forcedState == "mobile" // Mute the QML warning about having elements with anchors in `Column` AnchorChanges { target: saveButton anchors.right: undefined anchors.bottom: undefined anchors.top: undefined anchors.left: undefined anchors.horizontalCenter: undefined } AnchorChanges { target: advanced anchors.right: undefined anchors.bottom: undefined anchors.top: undefined anchors.left: undefined } ParentChange { target: vCardForm parent: contactHolder } AnchorChanges { target: vCardForm anchors.left: contactHolder.left anchors.top: contactHolder.top } PropertyChanges { target: vCardForm anchors.horizontalCenter: undefined } ParentChange { target: phoneNumbers parent: phoneNumberHolder } AnchorChanges { target: phoneNumbers anchors.left: phoneNumberHolder.left anchors.top: phoneNumberHolder.top } // ParentChange { // target: addresses // parent: addressesHolder // } // AnchorChanges { // target: addresses // anchors.left: contactViewPage.left // } ParentChange { target: statistics parent: statisticHolder } AnchorChanges { target: statistics anchors.left: statisticHolder.left anchors.top: statisticHolder.top } PropertyChanges { target: phoneNumbers anchors.fill: undefined width: contactViewPage.width interactive: false height: preferredHeight x: 0 y: 0 } // PropertyChanges { // target: addresses // anchors.fill: undefined // } PropertyChanges { target: phoneLayout visible: true } // Hide the tabs and groupbox in favor of standard rows PropertyChanges { target: advanced visible: false } PropertyChanges { target: tabBar visible: false } PropertyChanges { target: sv visible: false } PropertyChanges { target: contactViewPage bottomPadding: undefined topPadding: undefined leftPadding: undefined rightPadding: undefined editing: false } }, State { name: "profile" extend: "mobile" PropertyChanges { target: openChat visible: false } PropertyChanges { target: vCardForm anchors.horizontalCenter: contactHolder.horizontalCenter } PropertyChanges { target: statisticHolder visible: false } PropertyChanges { target: viewHistory visible: false } PropertyChanges { target: statisticHeader visible: false } PropertyChanges { target: contactViewPage bottomPadding: 0 topPadding: 0 leftPadding: 0 rightPadding: 0 editing: editable } AnchorChanges { target: phoneLayout anchors.top: contactPicture.bottom } } ] transitions: Transition { AnchorAnimation { duration: 300 } } } diff --git a/views/basic/basic.qrc b/views/basic/basic.qrc index cc2ac7bb..b9c2f1da 100644 --- a/views/basic/basic.qrc +++ b/views/basic/basic.qrc @@ -1,19 +1,18 @@ qml/actioncollection.qml qml/basic.qml qml/chatpage.qml qml/contacts.qml qml/desktopheader.qml qml/detailpage.qml qml/detail.qml qml/formpage.qml - qml/form.qml qml/listpage.qml qml/list.qml qml/globaldrawer.qml qml/sidebar.qml qml/actionswitch.qml qml/callpage.qml diff --git a/views/basic/basicviewplugin.cpp b/views/basic/basicviewplugin.cpp index 784c5a37..28c78b06 100644 --- a/views/basic/basicviewplugin.cpp +++ b/views/basic/basicviewplugin.cpp @@ -1,48 +1,47 @@ /*************************************************************************** * Copyright (C) 2017 by Bluesystems * * Author : Emmanuel Lepage Vallee * * * * 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 3 of the License, or * * (at your option) any later version. * * * * 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 . * **************************************************************************/ #include "basicviewplugin.h" #include #include #include void BasicView::registerTypes(const char *uri) { qmlRegisterType(QStringLiteral("qrc:/basicview/qml/actioncollection.qml"), uri, 1, 0, "ActionCollection"); qmlRegisterType(QStringLiteral("qrc:/basicview/qml/chatpage.qml"), uri, 1, 0, "ChatPage"); qmlRegisterType(QStringLiteral("qrc:/basicview/qml/callpage.qml"), uri, 1, 0, "CallPage"); qmlRegisterType(QStringLiteral("qrc:/basicview/qml/contacts.qml"), uri, 1, 0, "Contacts"); qmlRegisterType(QStringLiteral("qrc:/basicview/qml/desktopheader.qml"), uri, 1, 0, "DesktopHeader"); qmlRegisterType(QStringLiteral("qrc:/basicview/qml/detailpage.qml"), uri, 1, 0, "DetailPage"); qmlRegisterType(QStringLiteral("qrc:/basicview/qml/detail.qml"), uri, 1, 0, "Detail"); qmlRegisterType(QStringLiteral("qrc:/basicview/qml/formpage.qml"), uri, 1, 0, "FormPage"); - qmlRegisterType(QStringLiteral("qrc:/basicview/qml/form.qml"), uri, 1, 0, "Form"); qmlRegisterType(QStringLiteral("qrc:/basicview/qml/listpage.qml"), uri, 1, 0, "ListPage"); qmlRegisterType(QStringLiteral("qrc:/basicview/qml/list.qml"), uri, 1, 0, "List"); qmlRegisterType(QStringLiteral("qrc:/basicview/qml/globaldrawer.qml"), uri, 1, 0, "GlobalDrawer"); qmlRegisterType(QStringLiteral("qrc:/basicview/qml/sidebar.qml"), uri, 1, 0, "SideBar"); qmlRegisterType(QStringLiteral("qrc:/basicview/qml/actionswitch.qml"), uri, 1, 0, "ActionSwitch"); } void BasicView::initializeEngine(QQmlEngine* engine, const char* uri) { Q_UNUSED(engine) Q_UNUSED(uri) } diff --git a/views/basic/qml/chatpage.qml b/views/basic/qml/chatpage.qml index d00e29f4..adcf690d 100644 --- a/views/basic/qml/chatpage.qml +++ b/views/basic/qml/chatpage.qml @@ -1,128 +1,127 @@ /* * Copyright 2018 Fabian Riethmayer * Copyright 2019 Emmanuel Lepage * * This program 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 3, or * (at your option) any later version. * * 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 Library General Public License for more details * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import QtQuick 2.2 import QtQuick.Layouts 1.4 import QtQuick.Controls 2.2 as Controls import org.kde.kirigami 2.6 as Kirigami import org.kde.ringkde.basicview 1.0 as BasicView import org.kde.ringkde.jamichatview 1.0 as JamiChatView Kirigami.Page { property var model; property var currentIndividual: null property alias showContactDetails: detail.active property alias editContact: form.active property bool _fits: false Kirigami.Theme.colorSet: Kirigami.Theme.View id: chatPage spacing: 0 leftPadding: 0 rightPadding: 0 topPadding: 0 bottomPadding: 0 padding: 0 titleDelegate: BasicView.DesktopHeader { id: dheader visible: fits Component.onCompleted: _fits = fits onFitsChanged: _fits = fits } header: Controls.ToolBar { visible: (!_fits) height: visible ? Kirigami.Units.gridUnit * 2.5 : 0 Layout.fillWidth: true Layout.preferredHeight: visible ? Kirigami.Units.gridUnit * 5 : 0 Layout.margins: 0 BasicView.DesktopHeader { anchors.fill: parent } } RowLayout { anchors.fill: parent spacing: 0 JamiChatView.ChatPage { id: chatView Layout.fillWidth: true Layout.fillHeight: true Layout.bottomMargin: 0 currentIndividual: mainPage.currentIndividual timelineModel: mainPage.timelineModel } Loader { id: sidebarLoader // 750 is the 600pt maximum width of the chat + width of the sidebar active: pageStack.wideMode && (!Kirigami.Settings.isMobile) && parent.width > 750 Layout.preferredWidth: active ? 250 : 0 Layout.fillHeight: true sourceComponent: BasicView.SideBar { anchors.fill: sidebarLoader } } } Loader { active: false id: detail sourceComponent: BasicView.DetailPage { model: chatPage.model onSheetOpenChanged: detail.active = sheetOpen Component.onCompleted: sheetOpen = true } } Loader { active: false id: form - sourceComponent: BasicView.DetailPage { - model: chatPage.model + sourceComponent: BasicView.FormPage { onSheetOpenChanged: form.active = sheetOpen Component.onCompleted: {sheetOpen = true} } } actions { left : actionCollection.videoCallAction main : actionCollection.audioCallAction right: actionCollection.shareScreenAction } contextualActions: [ actionCollection.bookmarkAction, actionCollection.shareAction, actionCollection.editAction, actionCollection.photoAction, actionCollection.banAction, actionCollection.deleteAction, actionCollection.learAction, ] } diff --git a/views/basic/qml/desktopheader.qml b/views/basic/qml/desktopheader.qml index e367e7e1..8d2336d9 100644 --- a/views/basic/qml/desktopheader.qml +++ b/views/basic/qml/desktopheader.qml @@ -1,139 +1,138 @@ /* * Copyright 2018 Fabian Riethmayer * Copyright 2019 Emmanuel Lepage * * This program 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 3, or * (at your option) any later version. * * 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 Library General Public License for more details * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import QtQuick 2.2 import QtQuick.Layouts 1.4 import QtQuick.Controls 2.2 as Controls import org.kde.kirigami 2.6 as Kirigami import org.kde.ringkde.jamicontactview 1.0 as JamiContactView MouseArea { property var textColor: undefined property real photoSize: Kirigami.Units.largeSpacing // The `currentIndividual` is to force it to be reloaded property bool fits: mainPage.currentIndividual == mainPage.currentIndividual && pageStack.wideMode && grid.implicitWidth < parent.width implicitHeight: parent.parent.height - 2*photoSize GridLayout { id: grid rows: 2 columns: 5 rowSpacing: 0 flow: GridLayout.TopToBottom columnSpacing: Kirigami.Units.smallSpacing JamiContactView.ContactPhoto { Layout.preferredWidth: parent.parent.height Layout.preferredHeight: parent.parent.height Layout.rowSpan: 2 individual: mainPage.currentIndividual - defaultColor: index == currentIndex ? - Kirigami.Theme.highlightedTextColor : Kirigami.Theme.textColor + defaultColor: Kirigami.Theme.highlightedTextColor drawEmptyOutline: false MouseArea { - onClicked: chatPage.editContact = true + onClicked: chatPage.showContactDetails = true anchors.fill: parent } } Kirigami.Heading { id: mainHeading level: 3 text: mainPage.currentIndividual ? mainPage.currentIndividual.bestName : "" color: textColor Layout.preferredWidth: implicitWidth elide: Text.ElideRight //show only when at least half of the string has been painted: use //opacity as using visible it won't correctly recalculate the width opacity: width > implicitWidth/2 Layout.columnSpan: 1 MouseArea { - onClicked: chatPage.editContact = true + onClicked: chatPage.showContactDetails = true anchors.fill: parent } } Controls.Label { text: "Online" elide: Text.ElideRight color: textColor opacity: width > implicitWidth/2 // color: Qt.Tint( // mainHeading.color, // Kirigami.Theme.positiveTextColor // ) Layout.columnSpan: 2 MouseArea { - onClicked: chatPage.editContact = true + onClicked: chatPage.showContactDetails = true anchors.fill: parent } } Kirigami.Icon { id: edit opacity: Kirigami.Settings.isMobile source: "document-edit" Layout.preferredWidth: Kirigami.Units.iconSizes.smallMedium Layout.preferredHeight: Kirigami.Units.iconSizes.smallMedium MouseArea { onClicked: chatPage.editContact = true anchors.fill: parent } Behavior on opacity { NumberAnimation {duration: 200} } Layout.rowSpan: 2 } Kirigami.Icon { id: favorite source: "favorite" opacity: Kirigami.Settings.isMobile Layout.rowSpan: 2 Layout.preferredWidth: Kirigami.Units.iconSizes.smallMedium Layout.preferredHeight: Kirigami.Units.iconSizes.smallMedium Behavior on opacity { NumberAnimation {duration: 200} } } Item { Layout.fillWidth: true Layout.rowSpan: 2 } } hoverEnabled: !Kirigami.Settings.isMobile onContainsMouseChanged: { favorite.opacity = containsMouse edit.opacity = containsMouse } } diff --git a/views/basic/qml/form.qml b/views/basic/qml/form.qml deleted file mode 100644 index d7f71b9c..00000000 --- a/views/basic/qml/form.qml +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright 2018 Fabian Riethmayer - * Copyright 2019 Emmanuel Lepage - * - * This program 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 3, or - * (at your option) any later version. - * - * 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 Library General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import QtQuick 2.2 -import QtQuick.Controls 2.2 as Controls -import QtQuick.Layouts 1.2 as Layouts -import org.kde.kirigami 2.4 as Kirigami - -Layouts.ColumnLayout { - property var model - - id: root - spacing: 2 * Kirigami.Units.largeSpacing - - Controls.Label { - id: header - text: "Edit details" - font.pointSize: 16 - } - - Kirigami.FormLayout { - id: form - Layouts.Layout.fillWidth: true - - Controls.TextField { - Kirigami.FormData.label: i18n("Firstname:") - text: model.firstname - } - - Controls.TextField { - Kirigami.FormData.label: i18n("Lastname:") - text: model.lastname - } - - Kirigami.Separator { - Kirigami.FormData.isSection: true - Kirigami.FormData.label: i18n("Phone") - } - - Repeater { - model: root.model.communication - delegate: Controls.TextField { - visible: model.type === "phone" - Kirigami.FormData.label: model.description + ":" - text: model.text - } - } - - Kirigami.Separator { - Kirigami.FormData.isSection: true - Kirigami.FormData.label: i18n("Email") - } - - Repeater { - model: root.model.communication - delegate: Controls.TextField { - visible: model.type === "email" - Kirigami.FormData.label: model.description + ":" - text: model.text - } - } - - Kirigami.Separator { - Kirigami.FormData.isSection: true - } - - Controls.Switch { - Kirigami.FormData.label: i18n("Additional fields") - } - - } - - Controls.Button { - text: i18n("Save") - Layouts.Layout.alignment: Qt.AlignRight - anchors.rightMargin: Kirigami.Units.largeSpacing - } -} diff --git a/views/basic/qml/formpage.qml b/views/basic/qml/formpage.qml index 84d897f3..feddea21 100644 --- a/views/basic/qml/formpage.qml +++ b/views/basic/qml/formpage.qml @@ -1,32 +1,47 @@ /* * Copyright 2018 Fabian Riethmayer * Copyright 2019 Emmanuel Lepage * * This program 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 3, or * (at your option) any later version. * * 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 Library General Public License for more details * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import QtQuick 2.6 +import QtQuick.Layouts 1.4 import org.kde.kirigami 2.4 as Kirigami import org.kde.ringkde.basicview 1.0 as BasicView +import org.kde.ringkde.jamicontactview 1.0 as JamiContactView Kirigami.OverlaySheet { - property alias model: form.model - Kirigami.Theme.colorSet: Kirigami.Theme.View - BasicView.Form { - id: form + JamiContactView.ContactInfo { + id: contactInfo + + Layout.preferredWidth: applicationWindow().width * ( + Kirigami.Settings.isMobile ? 0.8 : 0.5 + ) + + height: applicationWindow().height * ( + Kirigami.Settings.isMobile ? 0.8 : 0.5 + ) + + individual: mainPage.currentIndividual + showStat: false + showImage: true + showSave: true + forcedState: "profile" + defaultName: "" } }