diff --git a/source/img/BernaFace.jpg b/source/img/BernaFace.jpg new file mode 100644 index 0000000..4bfb94a Binary files /dev/null and b/source/img/BernaFace.jpg differ diff --git a/source/img/MattFace.jpg b/source/img/MattFace.jpg new file mode 100644 index 0000000..adecb0a Binary files /dev/null and b/source/img/MattFace.jpg differ diff --git a/source/img/PhilipFace.jpg b/source/img/PhilipFace.jpg new file mode 100644 index 0000000..b0c81a9 Binary files /dev/null and b/source/img/PhilipFace.jpg differ diff --git a/source/img/SantiagoFace.jpg b/source/img/SantiagoFace.jpg new file mode 100644 index 0000000..99bd20b Binary files /dev/null and b/source/img/SantiagoFace.jpg differ diff --git a/source/img/SusanFace.jpg b/source/img/SusanFace.jpg new file mode 100644 index 0000000..a7ec68b Binary files /dev/null and b/source/img/SusanFace.jpg differ diff --git a/source/qml/addr/Detail.qml b/source/qml/addr/Detail.qml new file mode 100644 index 0000000..ba6c033 --- /dev/null +++ b/source/qml/addr/Detail.qml @@ -0,0 +1,181 @@ +/* + * Copyright 2018 Fabian Riethmayer + * + * 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 2, 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 +import QtQuick.Layouts 1.2 +import org.kde.kirigami 2.4 as Kirigami +import QtGraphicalEffects 1.0 + +import "../lib/" as HIG + + +Flickable { + id: root + property var model; + + HIG.Header { + id: header + content.anchors.leftMargin: Kirigami.Units.largeSpacing + content.anchors.topMargin: Kirigami.Units.largeSpacing + content.anchors.bottomMargin: Kirigami.Units.largeSpacing + //status: root.contentY == 0 ? 1 : Math.min(1, Math.max(2 / 11, 1 - root.contentY / Kirigami.Units.gridUnit)) + source: "../../img/" + model.image + + + stripContent: Row { + anchors.fill: parent + spacing: (header.width - 3 * Kirigami.Units.iconSizes.medium) / 4 + anchors.leftMargin: spacing + + + Kirigami.Icon { + source: "favorite" + width: Kirigami.Units.iconSizes.smallMedium + height: width + anchors.verticalCenter: parent.verticalCenter + } + Kirigami.Icon { + source: "view-barcode" + width: Kirigami.Units.iconSizes.smallMedium + height: width + anchors.verticalCenter: parent.verticalCenter + } + Kirigami.Icon { + source: "document-edit" + width: Kirigami.Units.iconSizes.smallMedium + height: width + anchors.verticalCenter: parent.verticalCenter + } + } + + Label { + text: model.firstname + " " + model.lastname + color: "#fcfcfc" + font.pointSize: 12 + } + } + + Column { + id: comm + anchors.top: header.bottom + anchors.topMargin: 2 * Kirigami.Units.largeSpacing + width: parent.width + + Repeater { + model: root.model.communication + + delegate: Kirigami.BasicListItem { + //height: Kirigami.Units.gridUnit * 2 + id: delegate + contentItem: RowLayout { + spacing: Kirigami.Units.largeSpacing * 2 + anchors.verticalCenter: parent.verticalCenter + + Kirigami.Icon { + id: icon + width: Kirigami.Units.iconSizes.smallMedium + height: width + source: model.icon + color: "#232627" + Layout.alignment: Qt.AlignVCenter + } + Column { + Layout.alignment: Qt.AlignVCenter + Label { + text: model.text + color: model.default ? "#2980b9" : "#232627" + } + Label { + text: model.description + font.pointSize: 8 + color: "#7f8c8d" + } + } + Rectangle { + Layout.fillWidth: true + Layout.alignment: Qt.AlignVCenter + + Kirigami.Icon { + visible: typeof model.actions !== "undefined" + source: "kmouth-phrase-new" + width: Kirigami.Units.iconSizes.smallMedium + height: width + anchors.right: parent.right + anchors.rightMargin: Kirigami.Units.largeSpacing + anchors.verticalCenter: parent.verticalCenter + id: call + } + } + } + + Component.onCompleted: { + if (typeof model.actions !== "undefined") { + delegate.actions = model.actions + } + } + } + } + } + + Label { + visible: typeof root.model.history !== "undefined" && root.model.history.count + text: "History" + id: history + anchors.top: comm.bottom + anchors.left: parent.left + anchors.topMargin: 2 * Kirigami.Units.largeSpacing + anchors.leftMargin: Kirigami.Units.largeSpacing + } + + ListView { + anchors.top: history.bottom + anchors.topMargin: Kirigami.Units.largeSpacing + width: root.width + model: root.model.history + height: 200 + interactive: false + + delegate: Kirigami.SwipeListItem { + Row { + spacing: Kirigami.Units.largeSpacing * 2 + anchors.verticalCenter: parent.verticalCenter + + Kirigami.Icon { + width: Kirigami.Units.iconSizes.smallMedium + height: width + source: model.icon + color: "#232627" + anchors.verticalCenter: parent.verticalCenter + } + Column { + anchors.verticalCenter: parent.verticalCenter + Label { + text: model.text + color: "#232627" + } + Label { + text: model.date + font.pointSize: 8 + color: "#7f8c8d" + } + } + } + } + } +} diff --git a/source/qml/addr/DetailPage.qml b/source/qml/addr/DetailPage.qml new file mode 100644 index 0000000..fbc9bcc --- /dev/null +++ b/source/qml/addr/DetailPage.qml @@ -0,0 +1,60 @@ +/* + * Copyright 2018 Fabian Riethmayer + * + * 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 2, 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.Controls 2.2 +import QtQuick.Layouts 1.2 +import org.kde.kirigami 2.4 as Kirigami + +Kirigami.ScrollablePage { + property var model; + visible: false + id: page + title: model.firstname + Kirigami.Theme.colorSet: Kirigami.Theme.View + + background: Rectangle { + color: Kirigami.Theme.backgroundColor + } + + Detail { + model: page.model + } + + actions { + left: Kirigami.Action { + iconName: "mail-message" + } + main: Kirigami.Action { + iconName: "call-start" + //onTriggered: d.state = "large" + } + right: Kirigami.Action { + iconName: "kmouth-phrase-new" + } + } + + /*contextualActions: [ + Kirigami.Action { + iconName: "edit" + text: "Action text" + } + ]*/ + +} diff --git a/source/qml/addr/Form.qml b/source/qml/addr/Form.qml new file mode 100644 index 0000000..a204eba --- /dev/null +++ b/source/qml/addr/Form.qml @@ -0,0 +1,99 @@ +/* + * Copyright 2018 Fabian Riethmayer + * + * 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 2, 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 +import QtQuick.Layouts 1.2 +import org.kde.kirigami 2.4 as Kirigami +import QtGraphicalEffects 1.0 + +import "../lib/" as HIG + + +Flickable { + id: root + property var model; + + HIG.Header { + id: header + content.anchors.leftMargin: Kirigami.Units.largeSpacing + content.anchors.topMargin: Kirigami.Units.largeSpacing + content.anchors.bottomMargin: Kirigami.Units.largeSpacing + //status: root.contentY == 0 ? 1 : Math.min(1, Math.max(2 / 11, 1 - root.contentY / Kirigami.Units.gridUnit)) + source: "../../img/" + model.image + + + stripContent: Row { + anchors.fill: parent + spacing: (header.width - 3 * Kirigami.Units.iconSizes.medium) / 4 + anchors.leftMargin: spacing + + + Kirigami.Icon { + source: "view-preview" + width: Kirigami.Units.iconSizes.smallMedium + height: width + anchors.verticalCenter: parent.verticalCenter + } + } + + Label { + text: model.firstname + " " + model.lastname + color: "#fcfcfc" + font.pointSize: 12 + } + } + + Kirigami.FormLayout { + anchors.top: header.bottom + anchors.topMargin: Kirigami.Units.largeSpacing + width: root.width + + TextField { + Kirigami.FormData.label: "Firstname:" + text: model.firstname + } + TextField { + Kirigami.FormData.label: "Lastname:" + text: model.lastname + } + Kirigami.Separator { + Kirigami.FormData.label: "Phone" + } + Repeater { + model: root.model.communication + delegate: TextField { + visible: model.type === "phone" + Kirigami.FormData.label: model.description + ":" + text: model.text + } + } + Kirigami.Separator { + Kirigami.FormData.label: "Email" + } + Repeater { + model: root.model.communication + delegate: TextField { + visible: model.type === "email" + Kirigami.FormData.label: model.description + ":" + text: model.text + } + } + } + +} diff --git a/source/qml/addr/FormPage.qml b/source/qml/addr/FormPage.qml new file mode 100644 index 0000000..8b6b78f --- /dev/null +++ b/source/qml/addr/FormPage.qml @@ -0,0 +1,54 @@ +/* + * Copyright 2018 Fabian Riethmayer + * + * 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 2, 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.Controls 2.2 +import QtQuick.Layouts 1.2 +import org.kde.kirigami 2.4 as Kirigami + +Kirigami.ScrollablePage { + property var model; + visible: false + id: page + title: "Edit" + Kirigami.Theme.colorSet: Kirigami.Theme.View + + background: Rectangle { + color: Kirigami.Theme.backgroundColor + } + + Form { + model: page.model + } + + actions { + main: Kirigami.Action { + iconName: "dialog-ok-apply" + //onTriggered: d.state = "large" + } + } + + /*contextualActions: [ + Kirigami.Action { + iconName: "edit" + text: "Action text" + } + ]*/ + +} diff --git a/source/qml/addr/List.qml b/source/qml/addr/List.qml new file mode 100644 index 0000000..4b1b945 --- /dev/null +++ b/source/qml/addr/List.qml @@ -0,0 +1,73 @@ + +/* + * Copyright 2018 Fabian Riethmayer + * + * 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 2, 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 +import org.kde.kirigami 2.4 as Kirigami +import QtGraphicalEffects 1.0 + +import "../lib/" as HIG + +ListView { + currentIndex: -1 + id: list + + delegate: Kirigami.SwipeListItem { + property alias image: img + onClicked: list.currentIndex = index + + contentItem: Row { + spacing: 2 * Kirigami.Units.largeSpacing + + Item { + width: Kirigami.Units.iconSizes.medium + height: width + + Image { + id: img + width: Kirigami.Units.iconSizes.medium + height: width + source: "../../img/" + model.image + visible: false + } + OpacityMask { + anchors.fill: img + source: img + maskSource: Rectangle { + height: img.width + width: height + radius: height / 2 + } + } + } + Label { + anchors.verticalCenter: parent.verticalCenter + text: model.firstname + " " + model.lastname + } + } + actions: [ + Kirigami.Action { + iconName: "call-start" + }, + Kirigami.Action { + iconName: "mail-message" + } + ] + } +} diff --git a/source/qml/addr/ListPage.qml b/source/qml/addr/ListPage.qml new file mode 100644 index 0000000..b61334e --- /dev/null +++ b/source/qml/addr/ListPage.qml @@ -0,0 +1,69 @@ +/* + * Copyright 2018 Fabian Riethmayer + * + * 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 2, 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.Controls 2.2 +import QtQuick.Layouts 1.2 +import org.kde.kirigami 2.4 as Kirigami + +Kirigami.ScrollablePage { + property alias currentIndex: list.currentIndex; + + Kirigami.Theme.colorSet: Kirigami.Theme.View + title: "Address book" + id: page + + background: Rectangle { + color: Kirigami.Theme.backgroundColor + } + + header: Rectangle { + clip: true + id: header + color: "#3daee9" + height: searchField.implicitHeight + 2 * Kirigami.Units.largeSpacing + width: root.width + //border.width: 1 + //border.color: "#bdc3c7" + + TextField { + id: searchField + placeholderText: "Search" + anchors.centerIn: parent + anchors.margins: Kirigami.Units.largeSpacing + width: parent.width - 2 * Kirigami.Units.largeSpacing + } + } + + List { + id: list + width: page.width + height: page.height + model: root.mydata + } + + actions { + main: Kirigami.Action { + iconName: "contact-new" + } + /*right: Kirigami.Action { + iconName: "system-search" + }*/ + } +} diff --git a/source/qml/addr/Test2.qml b/source/qml/addr/Test2.qml new file mode 100644 index 0000000..32b7412 --- /dev/null +++ b/source/qml/addr/Test2.qml @@ -0,0 +1,100 @@ +/* + * Copyright 2018 Fabian Riethmayer + * + * 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 2, 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.Controls 2.2 +import QtQuick.Layouts 1.2 +import org.kde.kirigami 2.4 as Kirigami +import "../models/" as Models +import "../lib/annotate.js" as A + +Kirigami.ApplicationItem { + width: 320 + height: 600 + id: root + + property var mydata : Models.Contacts { + Component.onCompleted: { + detail.model = mydata.get(3) + detail.visible = true + form.model = mydata.get(3) + form.visible = true + } + } + + pageStack.initialPage: ListPage { + id: list + } + + pageStack.defaultColumnWidth: root.width < 320 ? root.width : 320 + pageStack.globalToolBar.style: Kirigami.ApplicationHeaderStyle.Breadcrumb + + DetailPage { + id: detail + visible: false + } + + FormPage { + id: form + visible: false + } + + contextDrawer: Kirigami.ContextDrawer { + id: contextDrawer + } + + /*globalDrawer: Kirigami.GlobalDrawer { + actions: [Kirigami.Action { + iconName: "call-start" + }, + Kirigami.Action { + iconName: "mail-message" + } + ] + }*/ + + Component.onCompleted: { + root.pageStack.push(detail) + root.pageStack.push(form) + } + + + + // HACK + Timer { + interval: 2000 + repeat: false + running: true + onTriggered: { + var a = new A.An(list); + a.find("swipelistitem").eq(3).swipe({fromX: +140, fromY: 0, toX: -80, toY: 0}); + //a.find("swipelistitem").eq(3).find("qquickimage").touch(); + } + } + + Timer { + interval: 5000 + repeat: false + running: true + onTriggered: { + var b = new A.An(root); + //b.find("pagerowglobaltoolbarui").find("heading").first().touch(); + } + } +} diff --git a/source/qml/addr/Test3.qml b/source/qml/addr/Test3.qml new file mode 100644 index 0000000..a41de99 --- /dev/null +++ b/source/qml/addr/Test3.qml @@ -0,0 +1,53 @@ +/* + * Copyright 2018 Fabian Riethmayer + * + * 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 2, 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.Controls 2.2 +import QtQuick.Layouts 1.2 +import org.kde.kirigami 2.4 as Kirigami +import "../models/" as Models +import "../lib/annotate.js" as A + +Kirigami.ApplicationItem { + width: 800 + height: 600 + id: root + + property var mydata : Models.Contacts { + Component.onCompleted: { + detail.model = mydata.get(3) + detail.visible = true + } + } + + pageStack.initialPage: ListPage { + id: list + } + + pageStack.defaultColumnWidth: root.width < 320 ? root.width : 320 + + DetailPage { + id: detail + visible: false + } + + Component.onCompleted: { + root.pageStack.push(detail) + } +} diff --git a/source/qml/models/Contacts.qml b/source/qml/models/Contacts.qml new file mode 100644 index 0000000..d5d5c39 --- /dev/null +++ b/source/qml/models/Contacts.qml @@ -0,0 +1,115 @@ +/* + * Copyright 2018 Fabian Riethmayer + * + * 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 2, 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 + +ListModel { + id: model + // Pattern + ListElement { + firstname: "" + lastname: "" + image: "" + communication: [ + ListElement { + icon: "" + text: "+12 34 1234 5678" + description: "mobile" + type: "phone" + actions: [ + ListElement { + icon: "" + } + ] + } + ] + } + + Component.onCompleted: { + model.clear() + var data = [{ + "firstname": "Berna", + "lastname": "Hicks", + "image": "BernaFace.jpg" + }, { + "firstname": "Matt", + "lastname": "Byrne", + "image": "MattFace.jpg" + }, { + "firstname": "Santiago", + "lastname": "Thorne", + "image": "SantiagoFace.jpg" + }, { + "firstname": "Susan", + "lastname": "Hoffman", + "image": "SusanFace.jpg", + "communication": [{ + "icon": "call-start", + "type": "phone", + "text": "+12 34 1234 5678", + "description": "Mobile private", + "default": true, + "actions": [{ + "icon": "kmouth-phrase-new", + "text": "SMS" + }] + }, { + "icon": "", + "type": "phone", + "text": "+12 34 1234 5678", + "description": "VOIP" + }, { + "type": "email", + "icon": "mail-message", + "text": "susan@kde.org", + "default": true, + "description": "E-Mail private" + }], + "history": [{ + "icon": "call-start", + "text": "+12 34 1234 5678", + "date": "2018-10-10" + }, { + "icon": "mail-message", + "text": "Lorem ipsum", + "date": "2018-10-10" + }, { + "icon": "call-start", + "text": "+12 34 1234 5678", + "date": "2018-10-10" + }, { + "icon": "mail-message", + "text": "Lorem ipsum", + "date": "2018-10-10" + },{ + "icon": "call-start", + "text": "+12 34 1234 5678", + "date": "2018-10-10" + }, { + "icon": "mail-message", + "text": "Lorem ipsum", + "date": "2018-10-10" + }] + }, { + "firstname": "Philip", + "lastname": "Steele", + "image": "PhilipFace.jpg" + }] + model.insert(0, data) + } +}