From ef1cf433c9598430654e87790fdb1be11f82ecd1 Mon Sep 17 00:00:00 2001 From: Minijackson Date: Thu, 23 Aug 2018 09:22:21 +0200 Subject: Add caldav and carddav URLs + rename Gmail -> Google --- accounts/google/qml/AccountSettings.qml | 92 +++++++++++++++++++++++++++++++++ accounts/google/qml/Login.qml | 60 +++++++++++++++++++++ 2 files changed, 152 insertions(+) create mode 100644 accounts/google/qml/AccountSettings.qml create mode 100644 accounts/google/qml/Login.qml (limited to 'accounts/google/qml') diff --git a/accounts/google/qml/AccountSettings.qml b/accounts/google/qml/AccountSettings.qml new file mode 100644 index 00000000..73cdfbd7 --- /dev/null +++ b/accounts/google/qml/AccountSettings.qml @@ -0,0 +1,92 @@ +/* + Copyright (C) 2016 Michael Bohlender, + Copyright (C) 2017 Christian Mollekopf, + + 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) 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + +import QtQuick 2.4 +import QtQuick.Layouts 1.1 +import org.kube.framework 1.0 as Kube +import org.kube.accounts.google 1.0 as GoogleAccount + +Item { + + property string accountId + property string heading: qsTr("Connect your Google account") + property string subheadline: qsTr("To let Kube access your account, fill in email address, username and give the account a title that will be displayed inside Kube.") + property bool valid: true + implicitHeight: grid.implicitHeight + + GoogleAccount.GoogleSettings { + id: googleSettings + accountIdentifier: accountId + accountType: "google" + } + + function save(){ + googleSettings.save() + } + + function remove(){ + googleSettings.remove() + } + + GridLayout { + id: grid + anchors.fill: parent + columns: 2 + columnSpacing: Kube.Units.largeSpacing + rowSpacing: Kube.Units.largeSpacing + + Kube.Label { + text: "Please note that Google requires you to configure your account to allow IMAP connections from Kube: +
    +
  1. See https://support.google.com/mail/answer/7126229 to configure your account to allow IMAP connections. +
  2. Visit https://myaccount.google.com/lesssecureapps and enable the setting to allow Kube to connect to your account." + Layout.alignment: Qt.AlignCenter + Layout.columnSpan: 2 + textFormat: Text.StyledText + } + + Kube.Label { + text: qsTr("Name") + Layout.alignment: Qt.AlignRight + } + Kube.TextField { + Layout.fillWidth: true + placeholderText: qsTr("Your name") + text: googleSettings.userName + onTextChanged: { + googleSettings.userName = text + } + } + + Kube.Label { + text: qsTr("Email address") + Layout.alignment: Qt.AlignRight + } + Kube.TextField { + Layout.fillWidth: true + + text: googleSettings.emailAddress + onTextChanged: { + googleSettings.emailAddress = text + googleSettings.accountName = text + } + placeholderText: qsTr("Your email address") + } + } +} diff --git a/accounts/google/qml/Login.qml b/accounts/google/qml/Login.qml new file mode 100644 index 00000000..0a44aa8c --- /dev/null +++ b/accounts/google/qml/Login.qml @@ -0,0 +1,60 @@ +/* + Copyright (C) 2016 Michael Bohlender, + Copyright (C) 2017 Christian Mollekopf, + + 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) 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + +import QtQuick 2.4 +import QtQuick.Layouts 1.1 +import org.kube.framework 1.0 as Kube +import org.kube.accounts.google 1.0 as GoogleAccount + +Item { + property alias accountId: settings.accountIdentifier + property string heading: qsTr("Login") + property string subheadline: settings.accountName + property bool valid: pwField.acceptableInput + + GoogleAccount.GoogleSettings { + id: settings + accountType: "google" + } + + function login(){ + settings.login({accountSecret: pwField.text}) + } + + GridLayout { + anchors { + fill: parent + } + columns: 2 + columnSpacing: Kube.Units.largeSpacing + rowSpacing: Kube.Units.largeSpacing + + Kube.Label { + text: qsTr("Password") + Layout.alignment: Qt.AlignRight + } + + Kube.PasswordField { + id: pwField + Layout.fillWidth: true + focus: true + placeholderText: qsTr("Password of your IMAP account") + } + } +} -- cgit v1.2.3