diff --git a/src/accountadapter.cpp b/src/accountadapter.cpp index f43aaa94742ec4857821eef23d181d4d7735b902..07d2303d6ed5d75a37e1c5fae502121f2afa2c88 100644 --- a/src/accountadapter.cpp +++ b/src/accountadapter.cpp @@ -334,6 +334,7 @@ AccountAdapter::setArchiveHasPassword(bool isHavePassword) confProps.archiveHasPassword = isHavePassword; lrcInstance_->accountModel().setAccountConfig(lrcInstance_->get_currentAccountId(), confProps); } + bool AccountAdapter::exportToFile(const QString& accountId, const QString& path, @@ -351,13 +352,3 @@ AccountAdapter::setArchivePasswordAsync(const QString& accountID, const QString& lrcInstance_->accountModel().setAccountConfig(accountID, config); }); } - -void -AccountAdapter::passwordSetStatusMessageBox(bool success, QString title, QString infoToDisplay) -{ - if (success) { - QMessageBox::information(0, title, infoToDisplay); - } else { - QMessageBox::critical(0, title, infoToDisplay); - } -} diff --git a/src/accountadapter.h b/src/accountadapter.h index 0c69a8073296758b46ac5ba8b9dd05334dcb114f..b4ed472437a844655feb8df92d66d3f911b2a54c 100644 --- a/src/accountadapter.h +++ b/src/accountadapter.h @@ -62,9 +62,6 @@ public: // Delete current account Q_INVOKABLE void deleteCurrentAccount(); - // Setting related - Q_INVOKABLE void passwordSetStatusMessageBox(bool success, QString title, QString infoToDisplay); - // Conf property Q_INVOKABLE bool hasPassword(); Q_INVOKABLE void setArchiveHasPassword(bool isHavePassword); diff --git a/src/wizardview/components/BackupKeyPage.qml b/src/wizardview/components/BackupKeyPage.qml index 2aad45f7fbe1c4230c046840692238e43e63ab0a..18efe4304549eff7c87ccc6ecd00729b8dd69419 100644 --- a/src/wizardview/components/BackupKeyPage.qml +++ b/src/wizardview/components/BackupKeyPage.qml @@ -37,6 +37,13 @@ Rectangle { 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 @@ -46,20 +53,25 @@ Rectangle { } } + SimpleMessageDialog { + id: msgDialog + + buttonTitles: [JamiStrings.optionOk] + buttonStyles: [SimpleMessageDialog.ButtonStyle.TintedBlue] + + onVisibleChanged: { + if (title === JamiStrings.success && !visible) + WizardViewStepModel.nextStep() + } + } + PasswordDialog { id: passwordDialog visible: false purpose: PasswordDialog.ExportAccount - onDoneSignal: { - var title = success ? JamiStrings.success : JamiStrings.error - var info = success ? JamiStrings.backupSuccessful : JamiStrings.backupFailed - - AccountAdapter.passwordSetStatusMessageBox(success, title, info) - if (success) - loaderSourceChangeRequested(MainApplicationWindow.LoadedSource.MainView) - } + onDoneSignal: showBackupStatusDialog(success) } // JamiFileDialog for exporting account @@ -76,18 +88,14 @@ Rectangle { onAccepted: { // Is there password? If so, go to password dialog, else, go to following directly if (AccountAdapter.hasPassword()) { - passwordDialog.path = UtilsAdapter.getAbsPath(folder) + passwordDialog.path = UtilsAdapter.getAbsPath(file) passwordDialog.open() - return } else { - if (folder.length > 0) { - AccountAdapter.exportToFile( - LRCInstance.currentAccountId, - UtilsAdapter.getAbsPath(folder)) - } + if (file.toString().length > 0) + showBackupStatusDialog(AccountAdapter.exportToFile( + LRCInstance.currentAccountId, + UtilsAdapter.getAbsPath(file))) } - - WizardViewStepModel.nextStep() } onVisibleChanged: {