diff options
Diffstat (limited to 'accounts/google/qml')
-rw-r--r-- | accounts/google/qml/AccountSettings.qml | 92 | ||||
-rw-r--r-- | accounts/google/qml/Login.qml | 60 |
2 files changed, 152 insertions, 0 deletions
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 @@ | |||
1 | /* | ||
2 | Copyright (C) 2016 Michael Bohlender, <michael.bohlender@kdemail.net> | ||
3 | Copyright (C) 2017 Christian Mollekopf, <mollekopf@kolabsys.com> | ||
4 | |||
5 | This program is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published by | ||
7 | the Free Software Foundation; either version 2 of the License, or | ||
8 | (at your option) any later version. | ||
9 | |||
10 | This program is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | GNU General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License along | ||
16 | with this program; if not, write to the Free Software Foundation, Inc., | ||
17 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
18 | */ | ||
19 | |||
20 | import QtQuick 2.4 | ||
21 | import QtQuick.Layouts 1.1 | ||
22 | import org.kube.framework 1.0 as Kube | ||
23 | import org.kube.accounts.google 1.0 as GoogleAccount | ||
24 | |||
25 | Item { | ||
26 | |||
27 | property string accountId | ||
28 | property string heading: qsTr("Connect your Google account") | ||
29 | 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.") | ||
30 | property bool valid: true | ||
31 | implicitHeight: grid.implicitHeight | ||
32 | |||
33 | GoogleAccount.GoogleSettings { | ||
34 | id: googleSettings | ||
35 | accountIdentifier: accountId | ||
36 | accountType: "google" | ||
37 | } | ||
38 | |||
39 | function save(){ | ||
40 | googleSettings.save() | ||
41 | } | ||
42 | |||
43 | function remove(){ | ||
44 | googleSettings.remove() | ||
45 | } | ||
46 | |||
47 | GridLayout { | ||
48 | id: grid | ||
49 | anchors.fill: parent | ||
50 | columns: 2 | ||
51 | columnSpacing: Kube.Units.largeSpacing | ||
52 | rowSpacing: Kube.Units.largeSpacing | ||
53 | |||
54 | Kube.Label { | ||
55 | text: "Please note that Google requires you to configure your account to allow IMAP connections from Kube: | ||
56 | <ol type=''> | ||
57 | <li> See <a href='https://support.google.com/mail/answer/7126229'>https://support.google.com/mail/answer/7126229</a> to configure your account to allow IMAP connections. | ||
58 | <li> Visit <a href='https://myaccount.google.com/lesssecureapps'>https://myaccount.google.com/lesssecureapps</a> and enable the setting to allow Kube to connect to your account." | ||
59 | Layout.alignment: Qt.AlignCenter | ||
60 | Layout.columnSpan: 2 | ||
61 | textFormat: Text.StyledText | ||
62 | } | ||
63 | |||
64 | Kube.Label { | ||
65 | text: qsTr("Name") | ||
66 | Layout.alignment: Qt.AlignRight | ||
67 | } | ||
68 | Kube.TextField { | ||
69 | Layout.fillWidth: true | ||
70 | placeholderText: qsTr("Your name") | ||
71 | text: googleSettings.userName | ||
72 | onTextChanged: { | ||
73 | googleSettings.userName = text | ||
74 | } | ||
75 | } | ||
76 | |||
77 | Kube.Label { | ||
78 | text: qsTr("Email address") | ||
79 | Layout.alignment: Qt.AlignRight | ||
80 | } | ||
81 | Kube.TextField { | ||
82 | Layout.fillWidth: true | ||
83 | |||
84 | text: googleSettings.emailAddress | ||
85 | onTextChanged: { | ||
86 | googleSettings.emailAddress = text | ||
87 | googleSettings.accountName = text | ||
88 | } | ||
89 | placeholderText: qsTr("Your email address") | ||
90 | } | ||
91 | } | ||
92 | } | ||
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 @@ | |||
1 | /* | ||
2 | Copyright (C) 2016 Michael Bohlender, <michael.bohlender@kdemail.net> | ||
3 | Copyright (C) 2017 Christian Mollekopf, <mollekopf@kolabsys.com> | ||
4 | |||
5 | This program is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published by | ||
7 | the Free Software Foundation; either version 2 of the License, or | ||
8 | (at your option) any later version. | ||
9 | |||
10 | This program is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | GNU General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License along | ||
16 | with this program; if not, write to the Free Software Foundation, Inc., | ||
17 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
18 | */ | ||
19 | |||
20 | import QtQuick 2.4 | ||
21 | import QtQuick.Layouts 1.1 | ||
22 | import org.kube.framework 1.0 as Kube | ||
23 | import org.kube.accounts.google 1.0 as GoogleAccount | ||
24 | |||
25 | Item { | ||
26 | property alias accountId: settings.accountIdentifier | ||
27 | property string heading: qsTr("Login") | ||
28 | property string subheadline: settings.accountName | ||
29 | property bool valid: pwField.acceptableInput | ||
30 | |||
31 | GoogleAccount.GoogleSettings { | ||
32 | id: settings | ||
33 | accountType: "google" | ||
34 | } | ||
35 | |||
36 | function login(){ | ||
37 | settings.login({accountSecret: pwField.text}) | ||
38 | } | ||
39 | |||
40 | GridLayout { | ||
41 | anchors { | ||
42 | fill: parent | ||
43 | } | ||
44 | columns: 2 | ||
45 | columnSpacing: Kube.Units.largeSpacing | ||
46 | rowSpacing: Kube.Units.largeSpacing | ||
47 | |||
48 | Kube.Label { | ||
49 | text: qsTr("Password") | ||
50 | Layout.alignment: Qt.AlignRight | ||
51 | } | ||
52 | |||
53 | Kube.PasswordField { | ||
54 | id: pwField | ||
55 | Layout.fillWidth: true | ||
56 | focus: true | ||
57 | placeholderText: qsTr("Password of your IMAP account") | ||
58 | } | ||
59 | } | ||
60 | } | ||