1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Improve dialogs around unencrypting history, per zetok's suggestions

This commit is contained in:
Dubslow 2015-01-19 21:16:28 -06:00
parent 826d60c876
commit b1180a2038
No known key found for this signature in database
GPG Key ID: 3DB8E05315C220AA

View File

@ -121,16 +121,44 @@ void PrivacyForm::onEncryptLogsUpdated()
} }
else else
{ {
if (Widget::getInstance()->askQuestion(tr("Old encrypted chat logs", "title"), tr("Would you like to un-encrypt your chat logs?\nOtherwise they will be deleted."), true, false)) QMessageBox::StandardButton button = QMessageBox::warning(
Widget::getInstance(),
tr("Old encrypted chat logs", "title"),
tr("Would you like to un-encrypt your chat logs?\nOtherwise they will be deleted."),
QMessageBox::Ok | QMessageBox::No | QMessageBox::Cancel,
QMessageBox::Ok
);
if (button == QMessageBox::Ok)
{ {
QList<HistoryKeeper::HistMessage> oldMessages = HistoryKeeper::exportMessagesDeleteFile(true); QList<HistoryKeeper::HistMessage> oldMessages = HistoryKeeper::exportMessagesDeleteFile(true);
core->clearPassword(Core::ptHistory); core->clearPassword(Core::ptHistory);
Settings::getInstance().setEncryptLogs(false); Settings::getInstance().setEncryptLogs(false);
HistoryKeeper::getInstance()->importMessages(oldMessages); HistoryKeeper::getInstance()->importMessages(oldMessages);
} }
else if (button == QMessageBox::No)
{
if (QMessageBox::critical(
Widget::getInstance(),
tr("Old encrypted chat logs", "title"),
tr("Are you sure you want to lose your entire chat history?"),
QMessageBox::No | QMessageBox::Cancel,
QMessageBox::Cancel
)
== QMessageBox::No)
{
HistoryKeeper::removeHistory(true);
}
else
{
bodyUI->cbEncryptHistory->setChecked(true);
return;
}
}
else else
{ {
HistoryKeeper::removeHistory(true); bodyUI->cbEncryptHistory->setChecked(true);
return;
} }
} }