Replace MessageBox Dialog with inline MessageWidget in

EditWidget and in UnlockDatabaseWidget.
Add missing method to show Information Message.
This commit is contained in:
Pedro Alves 2015-01-20 01:27:56 +00:00 committed by Janek Bevendorff
parent 8fa070f01c
commit c2826bb1af
No known key found for this signature in database
GPG key ID: CFEC2F6850BFFA53
5 changed files with 54 additions and 13 deletions

View file

@ -395,12 +395,13 @@ void EditEntryWidget::saveEntry()
{
if (m_history) {
clear();
hideMessage();
Q_EMIT editFinished(false);
return;
}
if (!passwordsEqual()) {
MessageBox::warning(this, tr("Error"), tr("Different passwords supplied."));
showMessageError(tr("Different passwords supplied."));
return;
}
@ -474,6 +475,7 @@ void EditEntryWidget::cancel()
{
if (m_history) {
clear();
hideMessage();
Q_EMIT editFinished(false);
return;
}
@ -497,6 +499,7 @@ void EditEntryWidget::clear()
m_autoTypeAssoc->clear();
m_historyModel->clear();
m_iconsWidget->reset();
hideMessage();
}
bool EditEntryWidget::hasBeenModified() const
@ -630,15 +633,13 @@ void EditEntryWidget::insertAttachment()
QFile file(filename);
if (!file.open(QIODevice::ReadOnly)) {
MessageBox::warning(this, tr("Error"),
tr("Unable to open file").append(":\n").append(file.errorString()));
showMessageError(tr("Unable to open file").append(":\n").append(file.errorString()));
return;
}
QByteArray data;
if (!Tools::readAllFromDevice(&file, data)) {
MessageBox::warning(this, tr("Error"),
tr("Unable to open file").append(":\n").append(file.errorString()));
showMessageError(tr("Unable to open file").append(":\n").append(file.errorString()));
return;
}
@ -665,13 +666,11 @@ void EditEntryWidget::saveCurrentAttachment()
QFile file(savePath);
if (!file.open(QIODevice::WriteOnly)) {
MessageBox::warning(this, tr("Error"),
tr("Unable to save the attachment:\n").append(file.errorString()));
showMessageError(tr("Unable to save the attachment:\n").append(file.errorString()));
return;
}
if (file.write(attachmentData) != attachmentData.size()) {
MessageBox::warning(this, tr("Error"),
tr("Unable to save the attachment:\n").append(file.errorString()));
showMessageError(tr("Unable to save the attachment:\n").append(file.errorString()));
return;
}
}
@ -692,14 +691,12 @@ void EditEntryWidget::openAttachment(const QModelIndex& index)
QTemporaryFile* file = new QTemporaryFile(tmpFileTemplate, this);
if (!file->open()) {
MessageBox::warning(this, tr("Error"),
tr("Unable to save the attachment:\n").append(file->errorString()));
showMessageError(tr("Unable to save the attachment:\n").append(file->errorString()));
return;
}
if (file->write(attachmentData) != attachmentData.size()) {
MessageBox::warning(this, tr("Error"),
tr("Unable to save the attachment:\n").append(file->errorString()));
showMessageError(tr("Unable to save the attachment:\n").append(file->errorString()));
return;
}