mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-11-26 01:26:42 -05:00
Replace MessageBox with MessageWidget in remaining classes.
Chnage to one method to set MessageWidget text passing type as parameter. Only messages with questions requiring user input reamin using MessageBox dialog. Use signal/slots to set message in MessageWidget and hide message, signal/slots only used when required.Maybe need to change all calls to signals/slots in the future.
This commit is contained in:
parent
c2826bb1af
commit
13c85cdfcb
20 changed files with 169 additions and 77 deletions
|
|
@ -77,6 +77,9 @@ EditEntryWidget::EditEntryWidget(QWidget* parent)
|
|||
|
||||
connect(this, SIGNAL(accepted()), SLOT(saveEntry()));
|
||||
connect(this, SIGNAL(rejected()), SLOT(cancel()));
|
||||
|
||||
connect(m_iconsWidget, SIGNAL(messageEditEntry(QString, MessageWidget::MessageType)), SLOT(showMessage(QString, MessageWidget::MessageType)));
|
||||
connect(m_iconsWidget, SIGNAL(messageEditEntryDismiss()), SLOT(hideMessage()));
|
||||
}
|
||||
|
||||
EditEntryWidget::~EditEntryWidget()
|
||||
|
|
@ -401,7 +404,7 @@ void EditEntryWidget::saveEntry()
|
|||
}
|
||||
|
||||
if (!passwordsEqual()) {
|
||||
showMessageError(tr("Different passwords supplied."));
|
||||
showMessage(tr("Different passwords supplied."), MessageWidget::Error);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -633,13 +636,13 @@ void EditEntryWidget::insertAttachment()
|
|||
|
||||
QFile file(filename);
|
||||
if (!file.open(QIODevice::ReadOnly)) {
|
||||
showMessageError(tr("Unable to open file").append(":\n").append(file.errorString()));
|
||||
showMessage(tr("Unable to open file").append(":\n").append(file.errorString()), MessageWidget::Error);
|
||||
return;
|
||||
}
|
||||
|
||||
QByteArray data;
|
||||
if (!Tools::readAllFromDevice(&file, data)) {
|
||||
showMessageError(tr("Unable to open file").append(":\n").append(file.errorString()));
|
||||
showMessage(tr("Unable to open file").append(":\n").append(file.errorString()), MessageWidget::Error);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -666,11 +669,11 @@ void EditEntryWidget::saveCurrentAttachment()
|
|||
|
||||
QFile file(savePath);
|
||||
if (!file.open(QIODevice::WriteOnly)) {
|
||||
showMessageError(tr("Unable to save the attachment:\n").append(file.errorString()));
|
||||
showMessage(tr("Unable to save the attachment:\n").append(file.errorString()), MessageWidget::Error);
|
||||
return;
|
||||
}
|
||||
if (file.write(attachmentData) != attachmentData.size()) {
|
||||
showMessageError(tr("Unable to save the attachment:\n").append(file.errorString()));
|
||||
showMessage(tr("Unable to save the attachment:\n").append(file.errorString()), MessageWidget::Error);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -691,12 +694,12 @@ void EditEntryWidget::openAttachment(const QModelIndex& index)
|
|||
QTemporaryFile* file = new QTemporaryFile(tmpFileTemplate, this);
|
||||
|
||||
if (!file->open()) {
|
||||
showMessageError(tr("Unable to save the attachment:\n").append(file->errorString()));
|
||||
showMessage(tr("Unable to save the attachment:\n").append(file->errorString()), MessageWidget::Error);
|
||||
return;
|
||||
}
|
||||
|
||||
if (file->write(attachmentData) != attachmentData.size()) {
|
||||
showMessageError(tr("Unable to save the attachment:\n").append(file->errorString()));
|
||||
showMessage(tr("Unable to save the attachment:\n").append(file->errorString()), MessageWidget::Error);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue