From 1f62cf29d038e1dfd9bd56505ecaae10ca14b60b Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Mon, 18 Dec 2017 20:32:57 +0100 Subject: Accounts without kpackage --- accounts/CMakeLists.txt | 7 +- accounts/gmail/CMakeLists.txt | 4 +- .../gmail/package/contents/ui/AccountSettings.qml | 122 +++++++++++++++++++ .../gmail/package/contents/ui/GmailSettings.qml | 122 ------------------- accounts/imap/CMakeLists.txt | 7 +- .../imap/package/contents/ui/AccountSettings.qml | 129 +++++++++++++++++++++ .../package/contents/ui/ImapAccountSettings.qml | 129 --------------------- accounts/kolabnow/CMakeLists.txt | 4 +- .../package/contents/ui/AccountSettings.qml | 84 ++++++++++++++ .../contents/ui/KolabnowAccountSettings.qml | 84 -------------- accounts/maildir/CMakeLists.txt | 4 +- .../package/contents/ui/AccountSettings.qml | 107 +++++++++++++++++ .../package/contents/ui/MaildirAccountSettings.qml | 107 ----------------- framework/src/CMakeLists.txt | 2 - framework/src/accounts/accountfactory.cpp | 44 +++---- framework/src/accounts/accountfactory.h | 5 - 16 files changed, 469 insertions(+), 492 deletions(-) create mode 100644 accounts/gmail/package/contents/ui/AccountSettings.qml delete mode 100644 accounts/gmail/package/contents/ui/GmailSettings.qml create mode 100644 accounts/imap/package/contents/ui/AccountSettings.qml delete mode 100644 accounts/imap/package/contents/ui/ImapAccountSettings.qml create mode 100644 accounts/kolabnow/package/contents/ui/AccountSettings.qml delete mode 100644 accounts/kolabnow/package/contents/ui/KolabnowAccountSettings.qml create mode 100644 accounts/maildir/package/contents/ui/AccountSettings.qml delete mode 100644 accounts/maildir/package/contents/ui/MaildirAccountSettings.qml diff --git a/accounts/CMakeLists.txt b/accounts/CMakeLists.txt index e14fda4e..26a45a0a 100644 --- a/accounts/CMakeLists.txt +++ b/accounts/CMakeLists.txt @@ -1,12 +1,13 @@ include_directories(../framework/src/) find_package(Qt5 REQUIRED NO_MODULE COMPONENTS Core Quick Qml) - find_package(Sink CONFIG REQUIRED) find_package(KAsync CONFIG REQUIRED) -find_package(KF5 REQUIRED COMPONENTS Package Mime) -include_directories(SYSTEM ${KDE_INSTALL_FULL_INCLUDEDIR}/KF5/) +macro(install_qml_account name) + install(DIRECTORY package/contents/ui/ DESTINATION ${QML_INSTALL_DIR}/org/kube/accounts/${name}) + install(FILES qmldir DESTINATION ${QML_INSTALL_DIR}/org/kube/accounts/${name}) +endmacro(install_qml_account) add_subdirectory(maildir) add_subdirectory(imap) diff --git a/accounts/gmail/CMakeLists.txt b/accounts/gmail/CMakeLists.txt index 5be1b134..42b95a45 100644 --- a/accounts/gmail/CMakeLists.txt +++ b/accounts/gmail/CMakeLists.txt @@ -14,7 +14,5 @@ target_link_libraries(gmailaccountplugin Qt5::Qml ) -kpackage_install_package(package org.kube.accounts.gmail "genericqml") - install(TARGETS gmailaccountplugin DESTINATION ${QML_INSTALL_DIR}/org/kube/accounts/gmail) -install(FILES qmldir DESTINATION ${QML_INSTALL_DIR}/org/kube/accounts/gmail) +install_qml_account(gmail) diff --git a/accounts/gmail/package/contents/ui/AccountSettings.qml b/accounts/gmail/package/contents/ui/AccountSettings.qml new file mode 100644 index 00000000..16f7dbf3 --- /dev/null +++ b/accounts/gmail/package/contents/ui/AccountSettings.qml @@ -0,0 +1,122 @@ +/* + 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.Controls 1.4 as Controls +import QtQuick.Layouts 1.1 +import org.kube.framework 1.0 as Kube +import org.kube.accounts.gmail 1.0 as GmailAccount + +Item { + + property string accountId + property string heading: qsTr("Connect your GMail account") + property string subheadline: qsTr("To let Kube access your account, fill in email address, username, password and give the account a title that will be displayed inside Kube.") + property bool valid: true + implicitHeight: grid.implicitHeight + + GmailAccount.GmailSettings { + id: gmailSettings + accountIdentifier: accountId + accountType: "gmail" + } + + function save(){ + gmailSettings.save() + } + + function remove(){ + gmailSettings.remove() + } + + GridLayout { + id: grid + anchors.fill: parent + columns: 2 + columnSpacing: Kube.Units.largeSpacing + rowSpacing: Kube.Units.largeSpacing + + Kube.Label { + text: "Please note that GMail 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("Title of Account") + Layout.alignment: Qt.AlignRight + } + Kube.TextField { + Layout.fillWidth: true + placeholderText: qsTr("E.g. \"Work\", \"Home\" that will be displayed in Kube as name") + text: gmailSettings.accountName + onTextChanged: { + gmailSettings.accountName = text + } + } + + Kube.Label { + text: qsTr("Name") + Layout.alignment: Qt.AlignRight + } + Kube.TextField { + Layout.fillWidth: true + placeholderText: qsTr("Your name") + text: gmailSettings.userName + onTextChanged: { + gmailSettings.userName = text + } + } + + Kube.Label { + text: qsTr("Email address") + Layout.alignment: Qt.AlignRight + } + Kube.TextField { + Layout.fillWidth: true + + text: gmailSettings.emailAddress + onTextChanged: { + gmailSettings.emailAddress = text + } + placeholderText: qsTr("Your email address") + } + + Kube.Label { + text: qsTr("Password") + Layout.alignment: Qt.AlignRight + } + + Kube.PasswordField { + id: pwField + Layout.fillWidth: true + + placeholderText: qsTr("Password of your email account") + text: gmailSettings.imapPassword + onTextChanged: { + gmailSettings.imapPassword = text + gmailSettings.smtpPassword = text + } + } + } +} diff --git a/accounts/gmail/package/contents/ui/GmailSettings.qml b/accounts/gmail/package/contents/ui/GmailSettings.qml deleted file mode 100644 index 16f7dbf3..00000000 --- a/accounts/gmail/package/contents/ui/GmailSettings.qml +++ /dev/null @@ -1,122 +0,0 @@ -/* - 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.Controls 1.4 as Controls -import QtQuick.Layouts 1.1 -import org.kube.framework 1.0 as Kube -import org.kube.accounts.gmail 1.0 as GmailAccount - -Item { - - property string accountId - property string heading: qsTr("Connect your GMail account") - property string subheadline: qsTr("To let Kube access your account, fill in email address, username, password and give the account a title that will be displayed inside Kube.") - property bool valid: true - implicitHeight: grid.implicitHeight - - GmailAccount.GmailSettings { - id: gmailSettings - accountIdentifier: accountId - accountType: "gmail" - } - - function save(){ - gmailSettings.save() - } - - function remove(){ - gmailSettings.remove() - } - - GridLayout { - id: grid - anchors.fill: parent - columns: 2 - columnSpacing: Kube.Units.largeSpacing - rowSpacing: Kube.Units.largeSpacing - - Kube.Label { - text: "Please note that GMail 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("Title of Account") - Layout.alignment: Qt.AlignRight - } - Kube.TextField { - Layout.fillWidth: true - placeholderText: qsTr("E.g. \"Work\", \"Home\" that will be displayed in Kube as name") - text: gmailSettings.accountName - onTextChanged: { - gmailSettings.accountName = text - } - } - - Kube.Label { - text: qsTr("Name") - Layout.alignment: Qt.AlignRight - } - Kube.TextField { - Layout.fillWidth: true - placeholderText: qsTr("Your name") - text: gmailSettings.userName - onTextChanged: { - gmailSettings.userName = text - } - } - - Kube.Label { - text: qsTr("Email address") - Layout.alignment: Qt.AlignRight - } - Kube.TextField { - Layout.fillWidth: true - - text: gmailSettings.emailAddress - onTextChanged: { - gmailSettings.emailAddress = text - } - placeholderText: qsTr("Your email address") - } - - Kube.Label { - text: qsTr("Password") - Layout.alignment: Qt.AlignRight - } - - Kube.PasswordField { - id: pwField - Layout.fillWidth: true - - placeholderText: qsTr("Password of your email account") - text: gmailSettings.imapPassword - onTextChanged: { - gmailSettings.imapPassword = text - gmailSettings.smtpPassword = text - } - } - } -} diff --git a/accounts/imap/CMakeLists.txt b/accounts/imap/CMakeLists.txt index 5bd25a93..97399490 100644 --- a/accounts/imap/CMakeLists.txt +++ b/accounts/imap/CMakeLists.txt @@ -4,9 +4,6 @@ find_package(Qt5 REQUIRED NO_MODULE COMPONENTS Core Quick Qml) find_package(Sink CONFIG REQUIRED) find_package(KAsync CONFIG REQUIRED) -find_package(KF5 REQUIRED COMPONENTS Package Mime) - -include_directories(SYSTEM ${KDE_INSTALL_FULL_INCLUDEDIR}/KF5/) set(SRCS imapsettings.cpp @@ -22,7 +19,5 @@ target_link_libraries(imapaccountplugin Qt5::Qml ) -kpackage_install_package(package org.kube.accounts.imap "genericqml") - install(TARGETS imapaccountplugin DESTINATION ${QML_INSTALL_DIR}/org/kube/accounts/imap) -install(FILES qmldir DESTINATION ${QML_INSTALL_DIR}/org/kube/accounts/imap) +install_qml_account(imap) diff --git a/accounts/imap/package/contents/ui/AccountSettings.qml b/accounts/imap/package/contents/ui/AccountSettings.qml new file mode 100644 index 00000000..d81f9c54 --- /dev/null +++ b/accounts/imap/package/contents/ui/AccountSettings.qml @@ -0,0 +1,129 @@ +/* + 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.Controls 1.4 as Controls +import QtQuick.Layouts 1.1 +import org.kube.framework 1.0 as Kube +import org.kube.accounts.imap 1.0 as ImapAccount + +Item { + + property string accountId + property string heading: qsTr("Connect your IMAP account") + property string subheadline: qsTr("To let Kube access your account, fill in email address, username, password and give the account a title that will be displayed inside Kube. For information about which SMTP, IMAP address, which authentification and port to be used, please contact your email provider.") + property bool valid: true + implicitHeight: grid.implicitHeight + + ImapAccount.ImapSettings { + id: imapSettings + accountIdentifier: accountId + accountType: "imap" + } + + function save(){ + imapSettings.save() + } + + function remove(){ + imapSettings.remove() + } + GridLayout { + id: grid + anchors.fill: parent + columns: 2 + columnSpacing: Kube.Units.largeSpacing + rowSpacing: Kube.Units.largeSpacing + + Kube.Label { + text: qsTr("Title of Account") + Layout.alignment: Qt.AlignRight + } + Kube.RequiredTextField { + Layout.fillWidth: true + placeholderText: qsTr("E.g. \"Work\", \"Home\" that will be displayed in Kube as name") + text: imapSettings.accountName + onTextChanged: { + imapSettings.accountName = text + } + } + + Kube.Label { + text: qsTr("Name") + Layout.alignment: Qt.AlignRight + } + Kube.RequiredTextField { + Layout.fillWidth: true + placeholderText: qsTr("Your name") + text: imapSettings.userName + onTextChanged: { + imapSettings.userName = text + } + } + + Kube.Label { + text: qsTr("Email address") + Layout.alignment: Qt.AlignRight + } + Kube.RequiredTextField { + Layout.fillWidth: true + + text: imapSettings.emailAddress + onTextChanged: { + imapSettings.emailAddress = text + imapSettings.imapUsername = text + imapSettings.smtpUsername = text + } + placeholderText: qsTr("Your email address") + } + + Kube.Label { + text: qsTr("IMAP server address") + Layout.alignment: Qt.AlignRight + } + Kube.RequiredTextField { + id: imapServer + + Layout.fillWidth: true + + placeholderText: "imaps://mainserver.example.net:993" + text: imapSettings.imapServer + onTextChanged: { + imapSettings.imapServer = text + } + validator: imapSettings.imapServerValidator + } + + Kube.Label { + text: qsTr("Smtp address") + Layout.alignment: Qt.AlignRight + } + Kube.RequiredTextField { + id: smtpServer + Layout.fillWidth: true + + placeholderText: "smtps://mainserver.example.net:993" + text: imapSettings.smtpServer + onTextChanged: { + imapSettings.smtpServer = text + } + validator: imapSettings.smtpServerValidator + } + } +} diff --git a/accounts/imap/package/contents/ui/ImapAccountSettings.qml b/accounts/imap/package/contents/ui/ImapAccountSettings.qml deleted file mode 100644 index d81f9c54..00000000 --- a/accounts/imap/package/contents/ui/ImapAccountSettings.qml +++ /dev/null @@ -1,129 +0,0 @@ -/* - 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.Controls 1.4 as Controls -import QtQuick.Layouts 1.1 -import org.kube.framework 1.0 as Kube -import org.kube.accounts.imap 1.0 as ImapAccount - -Item { - - property string accountId - property string heading: qsTr("Connect your IMAP account") - property string subheadline: qsTr("To let Kube access your account, fill in email address, username, password and give the account a title that will be displayed inside Kube. For information about which SMTP, IMAP address, which authentification and port to be used, please contact your email provider.") - property bool valid: true - implicitHeight: grid.implicitHeight - - ImapAccount.ImapSettings { - id: imapSettings - accountIdentifier: accountId - accountType: "imap" - } - - function save(){ - imapSettings.save() - } - - function remove(){ - imapSettings.remove() - } - GridLayout { - id: grid - anchors.fill: parent - columns: 2 - columnSpacing: Kube.Units.largeSpacing - rowSpacing: Kube.Units.largeSpacing - - Kube.Label { - text: qsTr("Title of Account") - Layout.alignment: Qt.AlignRight - } - Kube.RequiredTextField { - Layout.fillWidth: true - placeholderText: qsTr("E.g. \"Work\", \"Home\" that will be displayed in Kube as name") - text: imapSettings.accountName - onTextChanged: { - imapSettings.accountName = text - } - } - - Kube.Label { - text: qsTr("Name") - Layout.alignment: Qt.AlignRight - } - Kube.RequiredTextField { - Layout.fillWidth: true - placeholderText: qsTr("Your name") - text: imapSettings.userName - onTextChanged: { - imapSettings.userName = text - } - } - - Kube.Label { - text: qsTr("Email address") - Layout.alignment: Qt.AlignRight - } - Kube.RequiredTextField { - Layout.fillWidth: true - - text: imapSettings.emailAddress - onTextChanged: { - imapSettings.emailAddress = text - imapSettings.imapUsername = text - imapSettings.smtpUsername = text - } - placeholderText: qsTr("Your email address") - } - - Kube.Label { - text: qsTr("IMAP server address") - Layout.alignment: Qt.AlignRight - } - Kube.RequiredTextField { - id: imapServer - - Layout.fillWidth: true - - placeholderText: "imaps://mainserver.example.net:993" - text: imapSettings.imapServer - onTextChanged: { - imapSettings.imapServer = text - } - validator: imapSettings.imapServerValidator - } - - Kube.Label { - text: qsTr("Smtp address") - Layout.alignment: Qt.AlignRight - } - Kube.RequiredTextField { - id: smtpServer - Layout.fillWidth: true - - placeholderText: "smtps://mainserver.example.net:993" - text: imapSettings.smtpServer - onTextChanged: { - imapSettings.smtpServer = text - } - validator: imapSettings.smtpServerValidator - } - } -} diff --git a/accounts/kolabnow/CMakeLists.txt b/accounts/kolabnow/CMakeLists.txt index fd168537..92beab1c 100644 --- a/accounts/kolabnow/CMakeLists.txt +++ b/accounts/kolabnow/CMakeLists.txt @@ -14,7 +14,5 @@ target_link_libraries(kolabnowaccountplugin Qt5::Qml ) -kpackage_install_package(package org.kube.accounts.kolabnow "genericqml") - install(TARGETS kolabnowaccountplugin DESTINATION ${QML_INSTALL_DIR}/org/kube/accounts/kolabnow) -install(FILES qmldir DESTINATION ${QML_INSTALL_DIR}/org/kube/accounts/kolabnow) +install_qml_account(kolabnow) diff --git a/accounts/kolabnow/package/contents/ui/AccountSettings.qml b/accounts/kolabnow/package/contents/ui/AccountSettings.qml new file mode 100644 index 00000000..4161bc49 --- /dev/null +++ b/accounts/kolabnow/package/contents/ui/AccountSettings.qml @@ -0,0 +1,84 @@ +/* + 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.kolabnow 1.0 as KolabnowAccount + +Item { + property string accountId + property string heading: qsTr("Connect your Kolab Now account") + property string subheadline: qsTr("Please fill in your name and email address. No account yet? Sign up now!") + property bool valid: nameField.acceptableInput && emailField.acceptableInput + implicitHeight: grid.implicitHeight + + KolabnowAccount.KolabnowSettings { + id: kolabnowSettings + accountIdentifier: accountId + accountType: "kolabnow" + } + + function save(){ + kolabnowSettings.save() + } + + function remove(){ + kolabnowSettings.remove() + } + + GridLayout { + id: grid + anchors.fill: parent + columns: 2 + columnSpacing: Kube.Units.largeSpacing + rowSpacing: Kube.Units.largeSpacing + + Kube.Label { + text: qsTr("Name") + Layout.alignment: Qt.AlignRight + } + Kube.RequiredTextField { + id: nameField + focus: true + Layout.fillWidth: true + placeholderText: qsTr("Your name") + text: kolabnowSettings.userName + onTextChanged: { + kolabnowSettings.userName = text + } + } + + Kube.Label { + text: qsTr("Email address") + Layout.alignment: Qt.AlignRight + } + Kube.RequiredTextField { + id: emailField + Layout.fillWidth: true + + text: kolabnowSettings.emailAddress + onTextChanged: { + kolabnowSettings.emailAddress = text + kolabnowSettings.accountName = text + } + placeholderText: qsTr("Your email address") + } + } +} diff --git a/accounts/kolabnow/package/contents/ui/KolabnowAccountSettings.qml b/accounts/kolabnow/package/contents/ui/KolabnowAccountSettings.qml deleted file mode 100644 index 4161bc49..00000000 --- a/accounts/kolabnow/package/contents/ui/KolabnowAccountSettings.qml +++ /dev/null @@ -1,84 +0,0 @@ -/* - 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.kolabnow 1.0 as KolabnowAccount - -Item { - property string accountId - property string heading: qsTr("Connect your Kolab Now account") - property string subheadline: qsTr("Please fill in your name and email address. No account yet? Sign up now!") - property bool valid: nameField.acceptableInput && emailField.acceptableInput - implicitHeight: grid.implicitHeight - - KolabnowAccount.KolabnowSettings { - id: kolabnowSettings - accountIdentifier: accountId - accountType: "kolabnow" - } - - function save(){ - kolabnowSettings.save() - } - - function remove(){ - kolabnowSettings.remove() - } - - GridLayout { - id: grid - anchors.fill: parent - columns: 2 - columnSpacing: Kube.Units.largeSpacing - rowSpacing: Kube.Units.largeSpacing - - Kube.Label { - text: qsTr("Name") - Layout.alignment: Qt.AlignRight - } - Kube.RequiredTextField { - id: nameField - focus: true - Layout.fillWidth: true - placeholderText: qsTr("Your name") - text: kolabnowSettings.userName - onTextChanged: { - kolabnowSettings.userName = text - } - } - - Kube.Label { - text: qsTr("Email address") - Layout.alignment: Qt.AlignRight - } - Kube.RequiredTextField { - id: emailField - Layout.fillWidth: true - - text: kolabnowSettings.emailAddress - onTextChanged: { - kolabnowSettings.emailAddress = text - kolabnowSettings.accountName = text - } - placeholderText: qsTr("Your email address") - } - } -} diff --git a/accounts/maildir/CMakeLists.txt b/accounts/maildir/CMakeLists.txt index dc0f02fe..c396b6ba 100644 --- a/accounts/maildir/CMakeLists.txt +++ b/accounts/maildir/CMakeLists.txt @@ -14,7 +14,5 @@ target_link_libraries(maildiraccountplugin Qt5::Qml ) -kpackage_install_package(package org.kube.accounts.maildir "genericqml") - install(TARGETS maildiraccountplugin DESTINATION ${QML_INSTALL_DIR}/org/kube/accounts/maildir) -install(FILES qmldir DESTINATION ${QML_INSTALL_DIR}/org/kube/accounts/maildir) +install_qml_account(maildir) diff --git a/accounts/maildir/package/contents/ui/AccountSettings.qml b/accounts/maildir/package/contents/ui/AccountSettings.qml new file mode 100644 index 00000000..0fb87810 --- /dev/null +++ b/accounts/maildir/package/contents/ui/AccountSettings.qml @@ -0,0 +1,107 @@ +/* + 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.Controls 1.4 as Controls +import QtQuick.Layouts 1.1 +import QtQuick.Dialogs 1.0 as Dialogs +import org.kube.framework 1.0 as Kube +import org.kube.accounts.maildir 1.0 as MaildirAccount + +Item { + property string accountId + property string heading: qsTr("Add your Maildir archive") + property string subheadline: qsTr("To let Kube access your maildir archive, add the path to your archive and give the account a title that will be displayed inside Kube.") + property bool valid: true + implicitHeight: grid.implicitHeight + + MaildirAccount.MaildirSettings { + id: maildirSettings + accountIdentifier: accountId + accountType: "maildir" + } + + function save(){ + maildirSettings.save() + } + + function remove(){ + maildirSettings.remove() + } + + GridLayout { + id: grid + anchors.fill: parent + columns: 2 + columnSpacing: Kube.Units.largeSpacing + rowSpacing: Kube.Units.largeSpacing + + Kube.Label { + text: qsTr("Title of Account") + Layout.alignment: Qt.AlignRight + } + Kube.TextField { + Layout.fillWidth: true + placeholderText: qsTr("E.g. \"Work\", \"Home\" that will be displayed in Kube as name") + text: maildirSettings.accountName + onTextChanged: { + maildirSettings.accountName = text + } + } + + Kube.Label { + text: qsTr("Path") + Layout.alignment: Qt.AlignRight + } + RowLayout { + Layout.fillWidth: true + + Kube.TextField { + id: path + Layout.fillWidth: true + enabled: false + text: maildirSettings.path + } + + Controls.Button { + iconName: Kube.Icons.folder + + onClicked: { + fileDialogComponent.createObject(parent) + } + + Component { + id: fileDialogComponent + Dialogs.FileDialog { + id: fileDialog + + visible: true + title: "Choose the maildir folder" + + selectFolder: true + + onAccepted: { + maildirSettings.path = fileDialog.fileUrl + } + } + } + } + } + } +} diff --git a/accounts/maildir/package/contents/ui/MaildirAccountSettings.qml b/accounts/maildir/package/contents/ui/MaildirAccountSettings.qml deleted file mode 100644 index 0fb87810..00000000 --- a/accounts/maildir/package/contents/ui/MaildirAccountSettings.qml +++ /dev/null @@ -1,107 +0,0 @@ -/* - 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.Controls 1.4 as Controls -import QtQuick.Layouts 1.1 -import QtQuick.Dialogs 1.0 as Dialogs -import org.kube.framework 1.0 as Kube -import org.kube.accounts.maildir 1.0 as MaildirAccount - -Item { - property string accountId - property string heading: qsTr("Add your Maildir archive") - property string subheadline: qsTr("To let Kube access your maildir archive, add the path to your archive and give the account a title that will be displayed inside Kube.") - property bool valid: true - implicitHeight: grid.implicitHeight - - MaildirAccount.MaildirSettings { - id: maildirSettings - accountIdentifier: accountId - accountType: "maildir" - } - - function save(){ - maildirSettings.save() - } - - function remove(){ - maildirSettings.remove() - } - - GridLayout { - id: grid - anchors.fill: parent - columns: 2 - columnSpacing: Kube.Units.largeSpacing - rowSpacing: Kube.Units.largeSpacing - - Kube.Label { - text: qsTr("Title of Account") - Layout.alignment: Qt.AlignRight - } - Kube.TextField { - Layout.fillWidth: true - placeholderText: qsTr("E.g. \"Work\", \"Home\" that will be displayed in Kube as name") - text: maildirSettings.accountName - onTextChanged: { - maildirSettings.accountName = text - } - } - - Kube.Label { - text: qsTr("Path") - Layout.alignment: Qt.AlignRight - } - RowLayout { - Layout.fillWidth: true - - Kube.TextField { - id: path - Layout.fillWidth: true - enabled: false - text: maildirSettings.path - } - - Controls.Button { - iconName: Kube.Icons.folder - - onClicked: { - fileDialogComponent.createObject(parent) - } - - Component { - id: fileDialogComponent - Dialogs.FileDialog { - id: fileDialog - - visible: true - title: "Choose the maildir folder" - - selectFolder: true - - onAccepted: { - maildirSettings.path = fileDialog.fileUrl - } - } - } - } - } - } -} diff --git a/framework/src/CMakeLists.txt b/framework/src/CMakeLists.txt index 2febf91b..09a4c22d 100644 --- a/framework/src/CMakeLists.txt +++ b/framework/src/CMakeLists.txt @@ -5,7 +5,6 @@ find_package(Sink CONFIG REQUIRED) find_package(KAsync CONFIG REQUIRED) find_package(QGpgme CONFIG REQUIRED) find_package(KF5Codecs CONFIG REQUIRED) -find_package(KF5Package CONFIG REQUIRED) find_package(KF5Contacts CONFIG REQUIRED) add_definitions("-Wall -std=c++0x -g") @@ -62,7 +61,6 @@ target_link_libraries(kubeframework Qt5::WebEngine KF5::Codecs KF5::Contacts - KF5::Package KAsync QGpgme ) diff --git a/framework/src/accounts/accountfactory.cpp b/framework/src/accounts/accountfactory.cpp index 1af07ac6..2babeb5d 100644 --- a/framework/src/accounts/accountfactory.cpp +++ b/framework/src/accounts/accountfactory.cpp @@ -19,12 +19,9 @@ #include "accountfactory.h" #include +#include +#include -#include -#include -#include - -#include "settings/settings.h" #include AccountFactory::AccountFactory(QObject *parent) @@ -32,14 +29,6 @@ AccountFactory::AccountFactory(QObject *parent) { } -QString AccountFactory::name() const -{ - if (mName.isEmpty()) { - return tr("Account"); - } - return mName; -} - void AccountFactory::setAccountId(const QString &accountId) { mAccountId = accountId; @@ -60,22 +49,27 @@ void AccountFactory::setAccountType(const QString &type) void AccountFactory::loadPackage() { - auto package = KPackage::PackageLoader::self()->loadPackage("KPackage/GenericQML", "org.kube.accounts." + mAccountType); - if (!package.isValid()) { + auto engine = QtQml::qmlEngine(this); + Q_ASSERT(engine); + const QString pluginPath = [&] { + for (const auto &p : engine->importPathList()) { + const auto path = p + QString::fromLatin1("/org/kube/accounts/") + mAccountType; + if (QFileInfo::exists(path)) { + return path; + } + } + return QString{}; + }(); + if (pluginPath.isEmpty()) { qWarning() << "Failed to load account package: " << "org.kube.accounts." + mAccountType; mUiPath.clear(); mLoginUi.clear(); - mName.clear(); - mIcon.clear(); mRequiresKeyring = true; - emit accountLoaded(); - return; + } else { + mUiPath = pluginPath + "/AccountSettings.qml"; + mLoginUi = pluginPath + "/Login.qml"; + //FIXME + mRequiresKeyring = true; } - Q_ASSERT(package.isValid()); - mUiPath = package.filePath("mainscript"); - mLoginUi = package.filePath("ui", "Login.qml"); - mName = package.metadata().name(); - mIcon = package.metadata().iconName(); - mRequiresKeyring = package.metadata().value("X-KDE-Kube-RequiresKeyring", "True").toLower() == "true"; emit accountLoaded(); } diff --git a/framework/src/accounts/accountfactory.h b/framework/src/accounts/accountfactory.h index f49d475c..429559a1 100644 --- a/framework/src/accounts/accountfactory.h +++ b/framework/src/accounts/accountfactory.h @@ -30,8 +30,6 @@ class AccountFactory : public QObject Q_OBJECT Q_PROPERTY(QString accountId MEMBER mAccountId WRITE setAccountId); Q_PROPERTY(QString accountType MEMBER mAccountType WRITE setAccountType); - Q_PROPERTY(QString name MEMBER mName READ name NOTIFY accountLoaded); - Q_PROPERTY(QString icon MEMBER mIcon NOTIFY accountLoaded); Q_PROPERTY(QString uiPath MEMBER mUiPath NOTIFY accountLoaded); Q_PROPERTY(QString loginUi MEMBER mLoginUi NOTIFY accountLoaded); Q_PROPERTY(bool requiresKeyring MEMBER mRequiresKeyring NOTIFY accountLoaded); @@ -40,7 +38,6 @@ public: void setAccountId(const QString &); void setAccountType(const QString &); - QString name() const; signals: void accountLoaded(); @@ -48,8 +45,6 @@ signals: private: void loadPackage(); QString mAccountId; - QString mName; - QString mIcon; QString mUiPath; QString mLoginUi; QByteArray mAccountType; -- cgit v1.2.3