mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-11-26 01:26:42 -05:00
Replace MessageBox Dialog with inline MessageWidget in
EditWidget and in UnlockDatabaseWidget. Add missing method to show Information Message.
This commit is contained in:
parent
8fa070f01c
commit
c2826bb1af
5 changed files with 54 additions and 13 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue