1
0
Fork 0
mirror of https://git.jami.net/savoirfairelinux/jami-client-qt.git synced 2025-08-04 14:55:43 +02:00

backupkeypage: transform into TipBox

Split TipBox into dynamic components to avoid to load all the things.
Show the Customize Tip Box only if necessary
Replace backup key page by a tipbox

Change-Id: Ie499fb16fe67648bbdd327eb24705a1881d9cea8
This commit is contained in:
Sébastien Blin 2022-08-29 14:20:28 -04:00 committed by Nicolas
parent 95f1c4d76d
commit fe3f8521e8
14 changed files with 441 additions and 442 deletions

View file

@ -87,7 +87,6 @@
<file>src/app/wizardview/components/CreateAccountPage.qml</file>
<file>src/app/wizardview/components/CreateSIPAccountPage.qml</file>
<file>src/app/wizardview/components/ImportFromBackupPage.qml</file>
<file>src/app/wizardview/components/BackupKeyPage.qml</file>
<file>src/app/wizardview/components/ImportFromDevicePage.qml</file>
<file>src/app/wizardview/components/ConnectToAccountManagerPage.qml</file>
<file>src/app/wizardview/components/ProfilePage.qml</file>
@ -201,5 +200,8 @@
<file>src/app/wizardview/components/AdvancedAccountSettings.qml</file>
<file>src/app/commoncomponents/InfoBox.qml</file>
<file>src/app/mainview/components/TipBox.qml</file>
<file>src/app/mainview/components/CustomizeTipBox.qml</file>
<file>src/app/mainview/components/BackupTipBox.qml</file>
<file>src/app/mainview/components/InformativeTipBox.qml</file>
</qresource>
</RCC>

View file

@ -204,12 +204,12 @@ Item {
property string noVideo: qsTr("no video")
// BackupKeyPage
property string whyBackupAccount: qsTr("Why should I back-up this account?")
property string backupAccountInfos: qsTr("Your account only exists on this device. " +
"If you lose your device or uninstall the application, " +
"your account will be deleted and CANNOT be recovered. " +
"You can back up your account now or later.")
"You can back up your account now or later (in the Account Settings).")
property string backupAccountHere: qsTr("Back up account here")
property string backupAccount: qsTr("Back up your account!")
property string backupAccountBtn: qsTr("Back up account")
property string skip: qsTr("Skip")
property string success: qsTr("Success")

View file

@ -0,0 +1,162 @@
/*
* Copyright (C) 2022 Savoir-faire Linux Inc.
*
* 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 <https://www.gnu.org/licenses/>.
*/
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import Qt.labs.platform
import net.jami.Models 1.1
import net.jami.Adapters 1.1
import net.jami.Constants 1.1
import "../../commoncomponents"
Item {
id: root
width: parent.width
height: backupLayout.height
signal ignore
PasswordDialog {
id: passwordDialog
visible: false
purpose: PasswordDialog.ExportAccount
onDoneSignal: function (success) {
root.ignore()
}
}
// JamiFileDialog for exporting account
JamiFileDialog {
id: exportDialog
mode: JamiFileDialog.SaveFile
title: JamiStrings.backupAccountHere
folder: StandardPaths.writableLocation(StandardPaths.HomeLocation) + "/Desktop"
nameFilters: [JamiStrings.jamiArchiveFiles, JamiStrings.allFiles]
onAccepted: {
// Is there password? If so, go to password dialog, else, go to following directly
if (AccountAdapter.hasPassword()) {
passwordDialog.path = UtilsAdapter.getAbsPath(file)
passwordDialog.open()
} else {
if (file.toString().length > 0)
root.ignore()
}
}
onVisibleChanged: {
if (!visible) {
rejected()
}
}
onRejected: {
backupBtn.forceActiveFocus()
}
}
ColumnLayout {
id: backupLayout
anchors.top: parent.top
width: parent.width
RowLayout {
Layout.leftMargin: 15
Layout.alignment: Qt.AlignLeft
ResponsiveImage {
id: icon
visible: !opened
Layout.alignment: Qt.AlignLeft
Layout.topMargin: 5
Layout.preferredWidth: 26
Layout.preferredHeight: 26
containerHeight: Layout.preferredHeight
containerWidth: Layout.preferredWidth
source: JamiResources.noun_paint_svg
color: "#005699"
}
Label {
text: JamiStrings.backupAccountBtn
color: JamiTheme.textColor
font.weight: Font.Medium
Layout.topMargin: 5
visible: !opened
Layout.alignment: Qt.AlignLeft
Layout.leftMargin: 5
font.pixelSize: JamiTheme.tipBoxTitleFontSize
}
}
Text {
Layout.preferredWidth: 170
Layout.leftMargin: 20
Layout.topMargin: 8
Layout.bottomMargin: 15
font.pixelSize: JamiTheme.tipBoxContentFontSize
visible: !opened
wrapMode: Text.WordWrap
font.weight: Font.Normal
text: JamiStrings.whyBackupAccount
color: JamiTheme.textColor
}
Text {
Layout.preferredWidth: root.width - 32
Layout.leftMargin: 20
Layout.topMargin: 20
font.pixelSize: JamiTheme.tipBoxContentFontSize
visible: opened
wrapMode: Text.WordWrap
text: JamiStrings.backupAccountInfos
color: JamiTheme.textColor
}
MaterialButton {
id: backupBtn
Layout.alignment: Qt.AlignCenter
preferredWidth: parent.width
visible: opened
text: JamiStrings.backupAccountBtn
autoAccelerator: true
color: JamiTheme.buttonTintedGrey
hoveredColor: JamiTheme.buttonTintedGreyHovered
pressedColor: JamiTheme.buttonTintedGreyPressed
onClicked: exportDialog.open()
}
}
}

View file

@ -0,0 +1,130 @@
/*
* Copyright (C) 2022 Savoir-faire Linux Inc.
*
* 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 <https://www.gnu.org/licenses/>.
*/
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import net.jami.Models 1.1
import net.jami.Adapters 1.1
import net.jami.Constants 1.1
import "../../commoncomponents"
ColumnLayout {
width: parent.width
RowLayout {
Layout.leftMargin: 15
Layout.alignment: Qt.AlignLeft
ResponsiveImage {
id: icon
visible: !opened
Layout.alignment: Qt.AlignLeft
Layout.topMargin: 5
Layout.preferredWidth: 26
Layout.preferredHeight: 26
containerHeight: Layout.preferredHeight
containerWidth: Layout.preferredWidth
source: JamiResources.noun_paint_svg
color: "#005699"
}
Label {
text: JamiStrings.customize
color: JamiTheme.textColor
font.weight: Font.Medium
Layout.topMargin: 5
visible: !opened
Layout.alignment: Qt.AlignLeft
Layout.leftMargin: 5
font.pixelSize: JamiTheme.tipBoxTitleFontSize
}
}
Text {
Layout.preferredWidth: 170
Layout.leftMargin: 20
Layout.topMargin: 8
Layout.bottomMargin: 15
font.pixelSize: JamiTheme.tipBoxContentFontSize
visible: !opened
wrapMode: Text.WordWrap
font.weight: Font.Normal
text: JamiStrings.customizeText
color: JamiTheme.textColor
}
PhotoboothView {
id: setAvatarWidget
Layout.preferredWidth: JamiTheme.accountListAvatarSize
Layout.preferredHeight: JamiTheme.accountListAvatarSize
Layout.topMargin: 10
Layout.alignment: Qt.AlignHCenter
darkTheme: UtilsAdapter.luma(JamiTheme.primaryBackgroundColor)
visible: opened
enabled: true
buttonSize: 35
imageId: CurrentAccount.id
avatarSize: 53
cancelButton: false
}
EditableLineEdit {
id: displayNameLineEdit
visible: opened
Layout.alignment: Qt.AlignCenter
Layout.preferredWidth: root.width - 32
text: CurrentAccount.alias
placeholderText: JamiStrings.enterNickname
color: JamiTheme.textColor
fontSize: JamiTheme.tipBoxContentFontSize
onEditingFinished: {
AccountAdapter.setCurrAccDisplayName(text)
}
}
Text {
Layout.preferredWidth: root.width - 32
Layout.leftMargin: 20
Layout.topMargin: 6
font.pixelSize: JamiTheme.tipBoxContentFontSize
visible: opened
wrapMode: Text.WordWrap
text: JamiStrings.customizationDescription2
color: JamiTheme.textColor
}
}

View file

@ -0,0 +1,90 @@
/*
* Copyright (C) 2022 Savoir-faire Linux Inc.
*
* 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 <https://www.gnu.org/licenses/>.
*/
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import net.jami.Models 1.1
import net.jami.Adapters 1.1
import net.jami.Constants 1.1
import "../../commoncomponents"
ColumnLayout {
width: parent.width
RowLayout {
Layout.leftMargin: 15
Layout.alignment: Qt.AlignLeft
ResponsiveImage {
id: icon
visible: !opened
Layout.alignment: Qt.AlignLeft
Layout.topMargin: 5
Layout.preferredWidth: 26
Layout.preferredHeight: 26
containerHeight: Layout.preferredHeight
containerWidth: Layout.preferredWidth
source: JamiResources.glasses_tips_svg
color: "#005699"
}
Label {
text: JamiStrings.tip
color: JamiTheme.textColor
font.weight: Font.Medium
Layout.topMargin: 5
visible: !opened
Layout.alignment: Qt.AlignLeft
Layout.leftMargin: 8
font.pixelSize: JamiTheme.tipBoxTitleFontSize
}
}
Text {
Layout.preferredWidth: opened ? 140 : 150
Layout.leftMargin: 20
Layout.topMargin: opened ? 0 : 8
Layout.bottomMargin: 15
font.pixelSize: JamiTheme.tipBoxContentFontSize
wrapMode: Text.WordWrap
font.weight: opened ? Font.Medium : Font.Normal
text: root.title
color: JamiTheme.textColor
}
Text {
Layout.preferredWidth: root.width - 32
Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
font.pixelSize: JamiTheme.tipBoxContentFontSize
visible: opened
wrapMode: Text.WordWrap
text: root.description
color: JamiTheme.textColor
}
}

View file

@ -34,11 +34,20 @@ Item {
property var title: ""
property var description: ""
property int tipId: 0
property bool isTip : true
property string type : ""
property bool hovered: false
property bool clicked : false
property bool opened : false
property string alias: ""
property bool opened: false
property string customizeTip:"CustomizeTipBox {}"
property string backupTip: "BackupTipBox {
onIgnore: {
root.ignoreClicked()
}
}"
property string infoTip: "InformativeTipBox {}"
width: 200
height: tipColumnLayout.implicitHeight + 2 * JamiTheme.preferredMarginSize
@ -54,122 +63,22 @@ Item {
border.color: opened || hovered ? "transparent" : Qt.rgba(0, 0.34,0.6,0.16)
radius: 20
ColumnLayout {
Column {
id: tipColumnLayout
anchors.top: parent.top
width: parent.width
anchors.topMargin: 10
RowLayout {
Layout.leftMargin: 15
Layout.alignment: Qt.AlignLeft
ResponsiveImage {
id: icon
visible: !opened
Layout.alignment: Qt.AlignLeft
Layout.topMargin: 5
Layout.preferredWidth: 26
Layout.preferredHeight: 26
containerHeight: Layout.preferredHeight
containerWidth: Layout.preferredWidth
source: !isTip ? JamiResources.noun_paint_svg : JamiResources.glasses_tips_svg
color: "#005699"
}
Label {
text: root.isTip ? JamiStrings.tip : JamiStrings.customize
color: JamiTheme.textColor
font.weight: Font.Medium
Layout.topMargin: 5
visible: !opened
Layout.alignment: Qt.AlignLeft
Layout.leftMargin: isTip ? 8 : 5
font.pixelSize: JamiTheme.tipBoxTitleFontSize
Component.onCompleted: {
if (type === "customize") {
Qt.createQmlObject(customizeTip, this, 'tip')
} else if (type === "backup") {
Qt.createQmlObject(backupTip, this, 'tip')
} else {
Qt.createQmlObject(infoTip, this, 'tip')
}
}
Text {
Layout.preferredWidth: root.isTip ? opened ? 140 : 150 : 170
Layout.leftMargin: 20
Layout.topMargin: root.isTip && opened ? 0 : 8
Layout.bottomMargin: 15
font.pixelSize: JamiTheme.tipBoxContentFontSize
visible: !opened || root.isTip
wrapMode: Text.WordWrap
font.weight: root.isTip && opened ? Font.Medium : Font.Normal
text: !isTip ? JamiStrings.customizeText : root.title
color: JamiTheme.textColor
}
PhotoboothView {
id: setAvatarWidget
Layout.preferredWidth: JamiTheme.accountListAvatarSize
Layout.preferredHeight: JamiTheme.accountListAvatarSize
Layout.topMargin: 10
Layout.alignment: Qt.AlignHCenter
darkTheme: UtilsAdapter.luma(JamiTheme.primaryBackgroundColor)
visible: opened &&! isTip
enabled: true
buttonSize: 35
imageId: CurrentAccount.id
avatarSize: 53
cancelButton: false
}
EditableLineEdit {
id: displayNameLineEdit
visible: !isTip && opened
Layout.alignment: Qt.AlignCenter
Layout.preferredWidth: root.width - 32
text: CurrentAccount.alias
placeholderText: JamiStrings.enterNickname
color: JamiTheme.textColor
fontSize: JamiTheme.tipBoxContentFontSize
onEditingFinished: root.alias = text
}
Text {
Layout.preferredWidth: root.width - 32
Layout.leftMargin: 20
Layout.topMargin: 6
font.pixelSize: JamiTheme.tipBoxContentFontSize
visible: opened && !isTip
wrapMode: Text.WordWrap
text: JamiStrings.customizationDescription2
color: JamiTheme.textColor
}
Text {
Layout.preferredWidth: root.width - 32
Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
font.pixelSize: JamiTheme.tipBoxContentFontSize
visible: opened && isTip
wrapMode: Text.WordWrap
text: root.description
color: JamiTheme.textColor
}
}
}
HoverHandler {

View file

@ -186,8 +186,17 @@ Rectangle {
tipId: TipId
title: Title
description: Description
isTip: IsTip
visible: index < 3
type: Type
visible: {
if (type === "backup") {
return LRCInstance.currentAccountType !== Profile.Type.SIP
&& CurrentAccount.managerUri.length === 0
} else if (type === "customize") {
return CurrentAccount.alias.length === 0
}
return true
}
onIgnoreClicked: TipsModel.remove(TipId)
}

View file

@ -22,19 +22,20 @@ TipsModel::TipsModel(AppSettingsManager* settingsManager, QObject* parent)
: QAbstractListModel(parent)
, settingsManager_(settingsManager)
{
tips_.append({{"id", "0"}, {"title", tr("Customize")}, {"desc", ""}, {"isTip", "false"}});
tips_.append({{"id", "0"}, {"title", tr("Customize")}, {"desc", ""}, {"type", "customize"}});
tips_.append({{"id", "13"}, {"title", tr("Backup account")}, {"desc", ""}, {"type", "backup"}});
tips_.append({{"id", "1"},
{"title", tr("What does Jami mean?")},
{"desc",
tr("The choice of the name Jami was inspired by the Swahili word 'jamii', which "
"means 'community' as a noun and 'together' as an adverb.")},
{"isTip", "true"}});
{"type", "tip"}});
tips_.append({{"id", "2"},
{"title", tr("What is the green dot next to my account?")},
{"desc",
tr("A red dot means that your account is disconnected from the network; it "
"turns green when it's connected.")},
{"isTip", "true"}});
{"type", "tip"}});
tips_.append(
{{"id", "3"},
{"title", tr("Why should I back up my account?")},
@ -42,30 +43,29 @@ TipsModel::TipsModel(AppSettingsManager* settingsManager, QObject* parent)
tr("Jami is distributed and your account is only stored locally on your device. If "
"you lose your password or your local account data, you WILL NOT be able to "
"recover your account if you did not back it up earlier.")},
{"isTip", "true"}});
{"type", "tip"}});
tips_.append(
{{"id", "4"},
{"title", tr("Can I make a conference call?")},
{"desc",
tr("In a call, you can click on \"Add participants\" to add a contact to a call.")},
{"isTip", "true"}});
tips_.append(
{{"id", "5"},
{"title", tr("Does Jami have group chats?")},
{"desc", tr("In the settings, you can enabled support for groups (experimental).")},
{"isTip", "true"}});
{"type", "tip"}});
tips_.append({{"id", "5"},
{"title", tr("Does Jami have group chats?")},
{"desc", tr("In the settings, you can enabled support for groups (experimental)")},
{"type", "tip"}});
tips_.append({{"id", "6"},
{"title", tr("What is a Jami account?")},
{"desc",
tr("A Jami account is an asymmetric encryption key. Your account is identified "
"by a Jami ID, which is a fingerprint of your public key.")},
{"isTip", "true"}});
{"type", "tip"}});
tips_.append({{"id", "7"},
{"title", tr("What information do I need to provide to create a Jami account?")},
{"desc",
tr("When you create a new Jami account, you do not have to provide any private "
"information like an email, address, or phone number.")},
{"isTip", "true"}});
{"type", "tip"}});
tips_.append(
{{"id", "8"},
{"title", tr("Why don't I have to use a password?")},
@ -73,32 +73,32 @@ TipsModel::TipsModel(AppSettingsManager* settingsManager, QObject* parent)
tr("With Jami, your account is stored in a directory on your device. The password "
"is only used to encrypt your account in order to protect you from someone "
"who has physical access to your device.")},
{"isTip", "true"}});
{"type", "tip"}});
tips_.append(
{{"id", "9"},
{"title", tr("Why don't I have to register a username?")},
{"desc",
tr("The most permanent, secure identifier is your Jami ID, but since these are difficult "
"to use for some people, you also have the option of registering a username.")},
{"isTip", "true"}});
{"type", "tip"}});
tips_.append(
{{"id", "10"},
{"title", tr("How can I back up my account?")},
{"desc", tr("In Account Settings, a button is available to create a backup your account.")},
{"isTip", "true"}});
{"type", "tip"}});
tips_.append(
{{"id", "11"},
{"title", tr("What happens when I delete my account?")},
{"desc",
tr("Your account is only stored on your own devices. If you delete your account "
"from all of your devices, the account is gone forever and you CANNOT recover it.")},
{"isTip", "true"}});
{"type", "tip"}});
tips_.append({{"id", "12"},
{"title", tr("Can I use my account on multiple devices?")},
{"desc",
tr("Yes, you can link your account from the settings, or you can import your "
"backup on another device.")},
{"isTip", "true"}});
{"type", "tip"}});
QStringList hiddenIds = settingsManager_->getValue(Settings::Key::HiddenTips).toStringList();
@ -134,8 +134,8 @@ TipsModel::data(const QModelIndex& index, int role) const
return QVariant::fromValue(tip["title"]);
case Tips::Role::Description:
return QVariant::fromValue(tip["desc"]);
case Tips::Role::IsTip:
return QVariant::fromValue(tip["isTip"] == "true");
case Tips::Role::Type:
return QVariant::fromValue(tip["type"]);
}
return QVariant();
}

View file

@ -28,7 +28,7 @@
X(TipId) \
X(Title) \
X(Description) \
X(IsTip)
X(Type)
namespace Tips {
Q_NAMESPACE

View file

@ -114,14 +114,6 @@ Rectangle {
onShowThisPage: controlPanelStackView.setPage(this)
}
BackupKeyPage {
id: backupKeysPage
objectName: "backupKeysPage"
onShowThisPage: controlPanelStackView.setPage(this)
}
ImportFromDevicePage {
id: importFromDevicePage

View file

@ -1,237 +0,0 @@
/*
* Copyright (C) 2021-2022 Savoir-faire Linux Inc.
* Author: Yang Wang <yang.wang@savoirfairelinux.com>
* Author: Mingrui Zhang <mingrui.zhang@savoirfairelinux.com>
*
* 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 <https://www.gnu.org/licenses/>.
*/
import QtQuick
import QtQuick.Layouts
import QtQuick.Controls
import Qt.labs.platform
import net.jami.Models 1.1
import net.jami.Adapters 1.1
import net.jami.Constants 1.1
import net.jami.Enums 1.1
import "../../commoncomponents"
import "../../settingsview/components"
Rectangle {
id: root
property int preferredHeight: backupKeysPageColumnLayout.implicitHeight
signal showThisPage
function showBackupStatusDialog(success) {
var title = success ? JamiStrings.success : JamiStrings.error
var info = success ? JamiStrings.backupSuccessful : JamiStrings.backupFailed
msgDialog.openWithParameters(title, info)
}
Connections {
target: WizardViewStepModel
function onMainStepChanged() {
if (WizardViewStepModel.mainStep === WizardViewStepModel.MainSteps.BackupKeys)
root.showThisPage()
}
}
SimpleMessageDialog {
id: msgDialog
buttonTitles: [JamiStrings.optionOk]
buttonStyles: [SimpleMessageDialog.ButtonStyle.TintedBlue]
onClosed: {
if (title === JamiStrings.success)
WizardViewStepModel.nextStep()
}
}
PasswordDialog {
id: passwordDialog
visible: false
purpose: PasswordDialog.ExportAccount
onDoneSignal: function (success) {
showBackupStatusDialog(success)
}
}
// JamiFileDialog for exporting account
JamiFileDialog {
id: exportDialog
mode: JamiFileDialog.SaveFile
title: JamiStrings.backupAccountHere
folder: StandardPaths.writableLocation(StandardPaths.HomeLocation) + "/Desktop"
nameFilters: [JamiStrings.jamiArchiveFiles, JamiStrings.allFiles]
onAccepted: {
// Is there password? If so, go to password dialog, else, go to following directly
if (AccountAdapter.hasPassword()) {
passwordDialog.path = UtilsAdapter.getAbsPath(file)
passwordDialog.open()
} else {
if (file.toString().length > 0)
showBackupStatusDialog(AccountAdapter.exportToFile(
LRCInstance.currentAccountId,
UtilsAdapter.getAbsPath(file)))
}
}
onVisibleChanged: {
if (!visible) {
rejected()
}
}
onRejected: {
backupBtn.forceActiveFocus()
}
}
color: JamiTheme.backgroundColor
ColumnLayout {
id: backupKeysPageColumnLayout
spacing: JamiTheme.wizardViewPageLayoutSpacing
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
RowLayout {
spacing: JamiTheme.wizardViewPageLayoutSpacing
Layout.alignment: Qt.AlignCenter
Layout.topMargin: JamiTheme.wizardViewPageBackButtonMargins
Layout.preferredWidth: backupBtn.width
Label {
text: JamiStrings.backupAccount
color: JamiTheme.textColor
font.pointSize: JamiTheme.textFontSize + 3
}
BubbleLabel {
Layout.alignment: Qt.AlignRight
text: JamiStrings.recommended
}
}
Label {
property int preferredHeight: 0
Layout.alignment: Qt.AlignCenter
Layout.preferredWidth: backupBtn.width
Layout.preferredHeight: preferredHeight
text: JamiStrings.backupAccountInfos
color: JamiTheme.textColor
wrapMode: Text.WordWrap
font.pointSize: JamiTheme.textFontSize
onFontChanged: {
var boundingRect = JamiQmlUtils.getTextBoundingRect(font, text)
preferredHeight = (boundingRect.width / backupBtn.preferredWidth)
* boundingRect.height
}
}
RowLayout {
spacing: JamiTheme.wizardViewPageLayoutSpacing
Layout.alignment: Qt.AlignCenter
Label {
text: JamiStrings.neverShowAgain
color: JamiTheme.textColor
font.pointSize: JamiTheme.textFontSize
}
JamiSwitch {
id: neverShowMeAgainSwitch
objectName: "neverShowMeAgainSwitch"
Layout.alignment: Qt.AlignRight
focus: visible
KeyNavigation.tab: backupBtn
KeyNavigation.up: skipBackupBtn
KeyNavigation.down: KeyNavigation.tab
onToggled: AppSettingsManager.setValue(Settings.NeverShowMeAgain, checked)
}
}
MaterialButton {
id: backupBtn
objectName: "backupKeyPageBackupBtn"
Layout.alignment: Qt.AlignCenter
preferredWidth: JamiTheme.wizardButtonWidth
text: JamiStrings.backupAccountBtn
autoAccelerator: true
color: JamiTheme.buttonTintedGrey
hoveredColor: JamiTheme.buttonTintedGreyHovered
pressedColor: JamiTheme.buttonTintedGreyPressed
KeyNavigation.tab: skipBackupBtn
KeyNavigation.up: neverShowMeAgainSwitch
KeyNavigation.down: KeyNavigation.tab
onClicked: exportDialog.open()
}
MaterialButton {
id: skipBackupBtn
objectName: "backupKeyPageSkipBackupBtn"
Layout.alignment: Qt.AlignCenter
Layout.bottomMargin: JamiTheme.wizardViewPageBackButtonMargins
preferredWidth: JamiTheme.wizardButtonWidth
text: JamiStrings.skip
autoAccelerator: true
color: JamiTheme.buttonTintedGrey
hoveredColor: JamiTheme.buttonTintedGreyHovered
pressedColor: JamiTheme.buttonTintedGreyPressed
secondary: true
KeyNavigation.tab: neverShowMeAgainSwitch
KeyNavigation.up: backupBtn
KeyNavigation.down: KeyNavigation.tab
onClicked: WizardViewStepModel.nextStep()
}
}
}

View file

@ -41,16 +41,8 @@ WizardViewStepModel::WizardViewStepModel(LRCInstance* lrcInstance,
Q_EMIT closeWizardView();
reset();
} else if (accountCreationOption != AccountCreationOption::None) {
auto showBackup = (accountCreationOption == AccountCreationOption::CreateJamiAccount
|| accountCreationOption == AccountCreationOption::CreateRendezVous)
&& !appSettingsManager_->getValue(Settings::Key::NeverShowMeAgain)
.toBool();
if (showBackup)
set_mainStep(MainSteps::BackupKeys);
else {
Q_EMIT closeWizardView();
reset();
}
Q_EMIT closeWizardView();
reset();
}
Q_EMIT accountIsReady(accountId);
@ -99,12 +91,9 @@ WizardViewStepModel::nextStep()
}
break;
}
case MainSteps::BackupKeys: {
Q_EMIT closeWizardView();
reset();
default:
break;
}
}
}
void

View file

@ -38,7 +38,6 @@ public:
Initial, // Initial welcome step.
AccountCreation, // General account creation step.
NameRegistration, // Name registration step : CreateJamiAccount, CreateRendezVous
BackupKeys // Backup set up.
};
Q_ENUM(MainSteps)

View file

@ -1552,10 +1552,6 @@ WizardView {
var createAccountButton = findChild(createAccountPage, "createAccountButton")
var skipProfileSavingButton = findChild(profilePage, "skipProfileSavingButton")
var neverShowMeAgainSwitch = findChild(backupKeysPage, "neverShowMeAgainSwitch")
var backupKeyPageBackupBtn = findChild(backupKeysPage, "backupKeyPageBackupBtn")
var backupKeyPageSkipBackupBtn = findChild(backupKeysPage, "backupKeyPageSkipBackupBtn")
// WelcomePage initially
compare(controlPanelStackView.children[controlPanelStackView.currentIndex],
welcomePage)
@ -1580,48 +1576,6 @@ WizardView {
skipProfileSavingButton.clicked()
var showBackup = (WizardViewStepModel.accountCreationOption ===
WizardViewStepModel.AccountCreationOption.CreateJamiAccount
|| WizardViewStepModel.accountCreationOption ===
WizardViewStepModel.AccountCreationOption.CreateRendezVous)
&& !AppSettingsManager.getValue(Settings.NeverShowMeAgain)
if (showBackup) {
compare(controlPanelStackView.children[controlPanelStackView.currentIndex],
backupKeysPage)
// Navigation test
compare(neverShowMeAgainSwitch.focus, true)
keyClick(Qt.Key_Tab)
compare(backupKeyPageBackupBtn.focus, true)
keyClick(Qt.Key_Tab)
compare(backupKeyPageSkipBackupBtn.focus, true)
keyClick(Qt.Key_Tab)
compare(neverShowMeAgainSwitch.focus, true)
keyClick(Qt.Key_Down)
compare(backupKeyPageBackupBtn.focus, true)
keyClick(Qt.Key_Down)
compare(backupKeyPageSkipBackupBtn.focus, true)
keyClick(Qt.Key_Down)
compare(neverShowMeAgainSwitch.focus, true)
keyClick(Qt.Key_Up)
compare(backupKeyPageSkipBackupBtn.focus, true)
keyClick(Qt.Key_Up)
compare(backupKeyPageBackupBtn.focus, true)
keyClick(Qt.Key_Up)
compare(neverShowMeAgainSwitch.focus, true)
WizardViewStepModel.nextStep()
}
spyCloseWizardView.wait()
compare(spyCloseWizardView.count, 1)