From db60d347d06e82ad05ff8ffcf5af6e7c5aa23b07 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Thu, 3 Mar 2016 10:28:31 +0100 Subject: A maildir settings page. Not how it should be at all (it should all become part of a nice account plugin), but it's a start. --- .../package/contents/ui/MaildirAccountSettings.qml | 100 +++++++++++++++++++++ .../kube-mail/package/contents/ui/Settings.qml | 79 +++------------- 2 files changed, 114 insertions(+), 65 deletions(-) create mode 100644 applications/kube-mail/package/contents/ui/MaildirAccountSettings.qml (limited to 'applications') diff --git a/applications/kube-mail/package/contents/ui/MaildirAccountSettings.qml b/applications/kube-mail/package/contents/ui/MaildirAccountSettings.qml new file mode 100644 index 00000000..5ba9f0c1 --- /dev/null +++ b/applications/kube-mail/package/contents/ui/MaildirAccountSettings.qml @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2016 Michael Bohlender + * + * 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.4 +import QtQuick.Controls 1.4 +import QtQuick.Layouts 1.1 + +import org.kde.kube.settings 1.0 as KubeSettings +// import org.kde.kube.accounts.maildir 1.0 as MaildirAccount + +Rectangle { + id: root + property string accountId + property string accountName + + color: colorPalette.background + + GridLayout { + id: gridLayout + columns: 2 + Layout.fillWidth: true + + Text { + Layout.columnSpan: 2 + Layout.fillWidth: true + text: "Account: " + accountName + } + + Label { text: "Username" } + TextField { + id: username + text: "username" + Layout.fillWidth: true + } + + Label { text: "Password" } + TextField { + id: password + text: "password" + Layout.fillWidth: true + } + + Label { text: "Server" } + TextField { + id: server + text: "server" + Layout.fillWidth: true + } + + //If we had a settings controller + // MaildirAccount.SmtpSettings { + // id: smtpSettings + // identifier: accountId + // property alias username: username.text + // property alias password: password.text + // property alias server: server.text + // } + + KubeSettings.Settings { + id: accountSettings + identifier: "account." + modelData + property string primaryIdentity: "current" + } + KubeSettings.Settings { + id: identitySettings + identifier: "identity.current" + property string transport: "current" + } + KubeSettings.Settings { + id: transportSettings + identifier: "transport.current" + property alias username: username.text + property alias password: password.text + property alias server: server.text + } + + Button { + id: button + text: "Save" + onClicked: { + smtpSettings.save(); + root.visible = false; + } + } + } +} diff --git a/applications/kube-mail/package/contents/ui/Settings.qml b/applications/kube-mail/package/contents/ui/Settings.qml index 71fcf359..34755df0 100644 --- a/applications/kube-mail/package/contents/ui/Settings.qml +++ b/applications/kube-mail/package/contents/ui/Settings.qml @@ -50,74 +50,23 @@ Rectangle { anchors.fill: parent } - GridLayout { - columns: 2 - anchors.fill: parent - anchors.margins: 10 - rowSpacing: 10 - columnSpacing: 10 - - Label { text: "Username" } - TextField { - id: username - text: "username" - Layout.fillWidth: true - } - - Label { text: "Password" } - TextField { - id: password - text: "password" - Layout.fillWidth: true - } - - Label { text: "Server" } - TextField { - id: server - text: "server" - Layout.fillWidth: true - } - - KubeSettings.Settings { - id: contextSettings - identifier: "applicationcontext" - property string currentAccountId: "current" - } - KubeSettings.Settings { - id: accountSettings - identifier: "account.current" - property string primaryIdentity: "current" - } - KubeSettings.Settings { - id: identitySettings - identifier: "identity.current" - property string transport: "current" - } - KubeSettings.Settings { - id: transportSettings - identifier: "transport.current" - property alias username: username.text - property alias password: password.text - property alias server: server.text - } + KubeSettings.Settings { + id: contextSettings + identifier: "applicationcontext" + property string currentAccountId: "current" + } - Item { - Layout.columnSpan: 2 - Layout.fillWidth: true - Button { - id: button - anchors.centerIn: parent - text: "Save" - onClicked: { - contextSettings.save(); - accountSettings.save(); - identitySettings.save(); - transportSettings.save(); - root.visible = false; - } + Column { + spacing: 5 + Repeater { + model: ["current"] //Get from context settings + delegate: MaildirAccountSettings { //This should be retrieved from the accounts plugin: KubeAccounts { identifier: modelData }.settingsUi + accountId: modelData + accountName: "Maildir" } } - } + + //Add possibility to add more accounts } } -- cgit v1.2.3