Skip to content
Snippets Groups Projects
Commit 9807ed09 authored by Ming Rui Zhang's avatar Ming Rui Zhang
Browse files

backupKeyPage: fix unfunctional export account logic

1. Logic fix - use file url instead of folder url
2. Add informative dialog like it used to have

Gitlab: #540

Change-Id: I73e8335e65d7048294f88988991888ab244b3144
parent 42c5de9d
No related branches found
No related tags found
No related merge requests found
......@@ -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);
}
}
......@@ -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);
......
......@@ -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: {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment