mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-04-21 21:52:03 +02:00
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
This commit is contained in:
parent
42c5de9d3c
commit
9807ed0947
3 changed files with 26 additions and 30 deletions
|
@ -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: {
|
||||
|
|
Loading…
Add table
Reference in a new issue