From 742d9eeef308fafc281ca3de3f298b0c166cc84c Mon Sep 17 00:00:00 2001 From: Xavier Michelon Date: Fri, 29 Sep 2023 14:57:15 +0200 Subject: [PATCH] feat(GODT-2960): added content in empty view when there is no account. --- .../bridge-gui/bridge-gui/Resources.qrc | 1 + .../bridge-gui/qml/ContentWrapper.qml | 37 +++++++----- .../bridge-gui/qml/NoAccountView.qml | 56 +++++++++++++++++++ .../bridge-gui/qml/SetupWizard/LeftPane.qml | 12 ++-- 4 files changed, 88 insertions(+), 18 deletions(-) create mode 100644 internal/frontend/bridge-gui/bridge-gui/qml/NoAccountView.qml diff --git a/internal/frontend/bridge-gui/bridge-gui/Resources.qrc b/internal/frontend/bridge-gui/bridge-gui/Resources.qrc index 19126b21..9403ac97 100644 --- a/internal/frontend/bridge-gui/bridge-gui/Resources.qrc +++ b/internal/frontend/bridge-gui/bridge-gui/Resources.qrc @@ -81,6 +81,7 @@ qml/KeychainSettings.qml qml/LocalCacheSettings.qml qml/MainWindow.qml + qml/NoAccountView.qml qml/NotificationDialog.qml qml/NotificationPopups.qml qml/Notifications/Notification.qml diff --git a/internal/frontend/bridge-gui/bridge-gui/qml/ContentWrapper.qml b/internal/frontend/bridge-gui/bridge-gui/qml/ContentWrapper.qml index 4b7a7fa4..31cbe99e 100644 --- a/internal/frontend/bridge-gui/bridge-gui/qml/ContentWrapper.qml +++ b/internal/frontend/bridge-gui/bridge-gui/qml/ContentWrapper.qml @@ -324,23 +324,32 @@ Item { anchors.fill: parent - AccountView { + StackLayout { // 0 - colorScheme: root.colorScheme - notifications: root.notifications - user: { - if (accounts.currentIndex < 0) - return undefined; - if (Backend.users.count === 0) - return undefined; - return Backend.users.get(accounts.currentIndex); + currentIndex: (Backend.users.count > 0 ? 1 : 0) + NoAccountView { + colorScheme: root.colorScheme + onLinkClicked: function() { + root.showLogin("") + } } + AccountView { + colorScheme: root.colorScheme + notifications: root.notifications + user: { + if (accounts.currentIndex < 0) + return undefined; + if (Backend.users.count === 0) + return undefined; + return Backend.users.get(accounts.currentIndex); + } - onShowClientConfigurator: function (user, address, justLoggedIn) { - root.showClientConfigurator(user, address, justLoggedIn); - } - onShowLogin: function (username) { - root.showLogin(username); + onShowClientConfigurator: function (user, address, justLoggedIn) { + root.showClientConfigurator(user, address, justLoggedIn); + } + onShowLogin: function (username) { + root.showLogin(username); + } } } Rectangle { diff --git a/internal/frontend/bridge-gui/bridge-gui/qml/NoAccountView.qml b/internal/frontend/bridge-gui/bridge-gui/qml/NoAccountView.qml new file mode 100644 index 00000000..0dab4de4 --- /dev/null +++ b/internal/frontend/bridge-gui/bridge-gui/qml/NoAccountView.qml @@ -0,0 +1,56 @@ +// Copyright (c) 2023 Proton AG +// This file is part of Proton Mail Bridge. +// Proton Mail Bridge 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. +// Proton Mail Bridge 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 Proton Mail Bridge. If not, see . +import QtQuick +import QtQuick.Layouts +import QtQuick.Controls +import Proton +import "SetupWizard" + +Rectangle { + id: root + + property ColorScheme colorScheme + + color: root.colorScheme.background_norm + + signal linkClicked() + + ColumnLayout { + anchors.fill: parent + spacing: 0 + + // we use the setup wizard left pane (onboarding version) + LeftPane { + Layout.alignment: Qt.AlignHCenter + Layout.fillHeight: true + Layout.preferredWidth: ProtonStyle.wizard_pane_width + colorScheme: root.colorScheme + wizard: setupWizard + + Component.onCompleted: { + showOnboarding(); + link1.setCallback(root.linkClicked, "Start setup", false) + } + } + Image { + id: mailLogoWithWordmark + Layout.alignment: Qt.AlignHCenter + Layout.bottomMargin: ProtonStyle.wizard_window_margin + height: sourceSize.height + source: root.colorScheme.mail_logo_with_wordmark + sourceSize.height: 36 + sourceSize.width: 134 + width: sourceSize.width + } + } +} \ No newline at end of file diff --git a/internal/frontend/bridge-gui/bridge-gui/qml/SetupWizard/LeftPane.qml b/internal/frontend/bridge-gui/bridge-gui/qml/SetupWizard/LeftPane.qml index 5dd22bf8..433c1ac1 100644 --- a/internal/frontend/bridge-gui/bridge-gui/qml/SetupWizard/LeftPane.qml +++ b/internal/frontend/bridge-gui/bridge-gui/qml/SetupWizard/LeftPane.qml @@ -22,6 +22,10 @@ Item { property string iconSource property int iconWidth property var wizard + property ColorScheme colorScheme + property var _colorScheme: wizard ? wizard.colorScheme : colorScheme + property var link1: linkLabel1 + property var link2: linkLabel2 function showAppleMailAutoconfigCertificateInstall() { showAppleMailAutoconfigCommon(); @@ -100,7 +104,7 @@ Item { id: titleLabel Layout.alignment: Qt.AlignHCenter Layout.fillWidth: true - colorScheme: wizard.colorScheme + colorScheme: _colorScheme horizontalAlignment: Text.AlignHCenter text: "" type: Label.LabelType.Heading @@ -111,7 +115,7 @@ Item { id: descriptionLabel Layout.alignment: Qt.AlignHCenter Layout.fillWidth: true - colorScheme: wizard.colorScheme + colorScheme: _colorScheme horizontalAlignment: Text.AlignHCenter text: "" type: Label.LabelType.Body @@ -120,13 +124,13 @@ Item { LinkLabel { id: linkLabel1 Layout.alignment: Qt.AlignHCenter - colorScheme: wizard.colorScheme + colorScheme: _colorScheme visible: (text !== "") } LinkLabel { id: linkLabel2 Layout.alignment: Qt.AlignHCenter - colorScheme: wizard.colorScheme + colorScheme: _colorScheme visible: (text !== "") } }