Quick GUI: Allow to retry opening/saving
This commit is contained in:
parent
62d5a24bca
commit
d904a3c1bc
|
@ -286,7 +286,14 @@ Kirigami.ApplicationWindow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onFileError: {
|
onFileError: {
|
||||||
showPassiveNotification(errorMessage)
|
if (retryAction.length === 0) {
|
||||||
|
showPassiveNotification(errorMessage)
|
||||||
|
} else {
|
||||||
|
showPassiveNotification(errorMessage, 2500, qsTr("Retry"),
|
||||||
|
function () {
|
||||||
|
nativeInterface[retryAction]()
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
onPasswordRequired: {
|
onPasswordRequired: {
|
||||||
enterPasswordDialog.askForExistingPassword(
|
enterPasswordDialog.askForExistingPassword(
|
||||||
|
|
|
@ -135,10 +135,10 @@ void Controller::load(const QString &filePath)
|
||||||
} else {
|
} else {
|
||||||
// clear password since the password which has been provided likely wasn't correct
|
// clear password since the password which has been provided likely wasn't correct
|
||||||
clearPassword();
|
clearPassword();
|
||||||
emit fileError(tr("A crypto error occured when opening the file: ") + QString::fromLocal8Bit(e.what()));
|
emit fileError(tr("A crypto error occured when opening the file: ") + QString::fromLocal8Bit(e.what()), QStringLiteral("load"));
|
||||||
}
|
}
|
||||||
} catch (const runtime_error &e) {
|
} catch (const runtime_error &e) {
|
||||||
emit fileError(tr("A parsing error occured when opening the file: ") + QString::fromLocal8Bit(e.what()));
|
emit fileError(tr("A parsing error occured when opening the file: ") + QString::fromLocal8Bit(e.what()), QStringLiteral("load"));
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
emitIoError(tr("loading"));
|
emitIoError(tr("loading"));
|
||||||
}
|
}
|
||||||
|
@ -211,9 +211,9 @@ void Controller::save()
|
||||||
#endif
|
#endif
|
||||||
emit fileSaved();
|
emit fileSaved();
|
||||||
} catch (const CryptoException &e) {
|
} catch (const CryptoException &e) {
|
||||||
emit fileError(tr("A crypto error occured when saving the file: ") + QString::fromLocal8Bit(e.what()));
|
emit fileError(tr("A crypto error occured when saving the file: ") + QString::fromLocal8Bit(e.what()), QStringLiteral("save"));
|
||||||
} catch (const runtime_error &e) {
|
} catch (const runtime_error &e) {
|
||||||
emit fileError(tr("An internal error occured when saving the file: ") + QString::fromLocal8Bit(e.what()));
|
emit fileError(tr("An internal error occured when saving the file: ") + QString::fromLocal8Bit(e.what()), QStringLiteral("save"));
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
emitIoError(tr("saving"));
|
emitIoError(tr("saving"));
|
||||||
}
|
}
|
||||||
|
@ -408,11 +408,12 @@ void Controller::emitIoError(const QString &when)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
const auto *const msg = catchIoFailure();
|
const auto *const msg = catchIoFailure();
|
||||||
emit fileError(tr("An IO error occured when %1 the file %2: ").arg(when, m_filePath) + QString::fromLocal8Bit(msg));
|
emit fileError(tr("An IO error occured when %1 the file %2: ").arg(when, m_filePath) + QString::fromLocal8Bit(msg), QStringLiteral("load"));
|
||||||
} catch (const exception &e) {
|
} catch (const exception &e) {
|
||||||
emit fileError(tr("An unknown exception occured when %1 the file %2: ").arg(when, m_filePath) + QString::fromLocal8Bit(e.what()));
|
emit fileError(tr("An unknown exception occured when %1 the file %2: ").arg(when, m_filePath) + QString::fromLocal8Bit(e.what()),
|
||||||
|
QStringLiteral("load"));
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
emit fileError(tr("An unknown error occured when %1 the file %2.").arg(when, m_filePath));
|
emit fileError(tr("An unknown error occured when %1 the file %2.").arg(when, m_filePath), QStringLiteral("load"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -95,7 +95,7 @@ signals:
|
||||||
void passwordRequired(const QString &filePath);
|
void passwordRequired(const QString &filePath);
|
||||||
void windowTitleChanged(const QString &windowTitle);
|
void windowTitleChanged(const QString &windowTitle);
|
||||||
void fileOpenChanged(bool fileOpen);
|
void fileOpenChanged(bool fileOpen);
|
||||||
void fileError(const QString &errorMessage);
|
void fileError(const QString &errorMessage, const QString &retryAction = QString());
|
||||||
void fileSaved();
|
void fileSaved();
|
||||||
void entryModelChanged();
|
void entryModelChanged();
|
||||||
void entryFilterModelChanged();
|
void entryFilterModelChanged();
|
||||||
|
|
Loading…
Reference in New Issue