From 13c85cdfcb507380b9e399229114cf6a3b9e8007 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Wed, 21 Jan 2015 16:19:05 +0000 Subject: [PATCH] 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. --- src/gui/ChangeMasterKeyWidget.cpp | 9 +++++---- src/gui/DatabaseOpenWidget.cpp | 11 +++++----- src/gui/DatabaseTabWidget.cpp | 22 +++++++++++++------- src/gui/DatabaseTabWidget.h | 6 ++++++ src/gui/DatabaseWidget.cpp | 23 +++++++++++++++++++-- src/gui/DatabaseWidget.h | 9 +++++++++ src/gui/DatabaseWidgetStateSync.cpp | 1 + src/gui/EditWidget.cpp | 14 ++----------- src/gui/EditWidget.h | 7 +++---- src/gui/EditWidgetIcons.cpp | 7 +++---- src/gui/EditWidgetIcons.h | 5 +++++ src/gui/KeePass1OpenWidget.cpp | 5 +++-- src/gui/MainWindow.cpp | 31 +++++++++++++++++++++++++++++ src/gui/MainWindow.h | 4 ++++ src/gui/MainWindow.ui | 30 +++++++++++++++++++++++++++- src/gui/MessageWidget.cpp | 28 +++++--------------------- src/gui/MessageWidget.h | 12 +++++------ src/gui/entry/EditEntryWidget.cpp | 17 +++++++++------- src/gui/group/EditGroupWidget.cpp | 3 +++ src/gui/group/EditGroupWidget.h | 2 ++ 20 files changed, 169 insertions(+), 77 deletions(-) diff --git a/src/gui/ChangeMasterKeyWidget.cpp b/src/gui/ChangeMasterKeyWidget.cpp index ba241875a..37fe9b0d4 100644 --- a/src/gui/ChangeMasterKeyWidget.cpp +++ b/src/gui/ChangeMasterKeyWidget.cpp @@ -54,7 +54,7 @@ void ChangeMasterKeyWidget::createKeyFile() QString errorMsg; bool created = FileKey::create(fileName, &errorMsg); if (!created) { - m_ui->messageWidget->showMessageError(tr("Unable to create Key File : ").append(errorMsg)); + m_ui->messageWidget->showMessage(tr("Unable to create Key File : ").append(errorMsg), MessageWidget::Error); } else { m_ui->keyFileCombo->setEditText(fileName); @@ -112,7 +112,7 @@ void ChangeMasterKeyWidget::generateKey() m_key.addKey(PasswordKey(m_ui->enterPasswordEdit->text())); } else { - m_ui->messageWidget->showMessageError(tr("Different passwords supplied.")); + m_ui->messageWidget->showMessage(tr("Different passwords supplied."), MessageWidget::Error); m_ui->enterPasswordEdit->setText(""); m_ui->repeatPasswordEdit->setText(""); return; @@ -123,13 +123,14 @@ void ChangeMasterKeyWidget::generateKey() QString errorMsg; QString fileKeyName = m_ui->keyFileCombo->currentText(); if (!fileKey.load(fileKeyName, &errorMsg)) { - m_ui->messageWidget->showMessageError( - tr("Failed to set %1 as the Key file:\n%2: ").arg(fileKeyName, errorMsg)); + m_ui->messageWidget->showMessage( + tr("Failed to set %1 as the Key file:\n%2").arg(fileKeyName, errorMsg), MessageWidget::Error); return; } m_key.addKey(fileKey); } + m_ui->messageWidget->hideMessage(); Q_EMIT editFinished(true); } diff --git a/src/gui/DatabaseOpenWidget.cpp b/src/gui/DatabaseOpenWidget.cpp index fcc029ab6..c9d266fae 100644 --- a/src/gui/DatabaseOpenWidget.cpp +++ b/src/gui/DatabaseOpenWidget.cpp @@ -108,8 +108,8 @@ void DatabaseOpenWidget::openDatabase() QFile file(m_filename); if (!file.open(QIODevice::ReadOnly)) { - m_ui->messageWidget->showMessageError( - tr("Unable to open the database.").append("\n").append(file.errorString())); + m_ui->messageWidget->showMessage( + tr("Unable to open the database.").append("\n").append(file.errorString()), MessageWidget::Error); return; } if (m_db) { @@ -126,8 +126,8 @@ void DatabaseOpenWidget::openDatabase() Q_EMIT editFinished(true); } else { - m_ui->messageWidget->showMessageError(tr("Unable to open the database.") - .append("\n").append(reader.errorString())); + m_ui->messageWidget->showMessage(tr("Unable to open the database.") + .append("\n").append(reader.errorString()), MessageWidget::Error); m_ui->editPassword->clear(); } } @@ -147,7 +147,8 @@ CompositeKey DatabaseOpenWidget::databaseKey() QString keyFilename = m_ui->comboKeyFile->currentText(); QString errorMsg; if (!key.load(keyFilename, &errorMsg)) { - m_ui->messageWidget->showMessageError(tr("Can't open key file").append(":\n").append(errorMsg)); + m_ui->messageWidget->showMessage(tr("Can't open key file").append(":\n") + .append(errorMsg), MessageWidget::Error); return CompositeKey(); } masterKey.addKey(key); diff --git a/src/gui/DatabaseTabWidget.cpp b/src/gui/DatabaseTabWidget.cpp index 0c784eb2f..b1eb9a0a5 100644 --- a/src/gui/DatabaseTabWidget.cpp +++ b/src/gui/DatabaseTabWidget.cpp @@ -116,7 +116,7 @@ void DatabaseTabWidget::openDatabase(const QString& fileName, const QString& pw, QFileInfo fileInfo(fileName); QString canonicalFilePath = fileInfo.canonicalFilePath(); if (canonicalFilePath.isEmpty()) { - MessageBox::warning(this, tr("Warning"), tr("File not found!")); + Q_EMIT messageGlobal(tr("File not found!"), MessageWidget::Error); return; } @@ -136,8 +136,9 @@ void DatabaseTabWidget::openDatabase(const QString& fileName, const QString& pw, QFile file(fileName); if (!file.open(QIODevice::ReadWrite)) { if (!file.open(QIODevice::ReadOnly)) { - MessageBox::warning(this, tr("Error"), tr("Unable to open the database.").append("\n") - .append(file.errorString())); + // can't open + Q_EMIT messageGlobal( + tr("Unable to open the database.").append("\n").append(file.errorString()), MessageWidget::Error); return; } else { @@ -184,6 +185,10 @@ void DatabaseTabWidget::openDatabase(const QString& fileName, const QString& pw, insertDatabase(db, dbStruct); + if (dbStruct.readOnly) { + Q_EMIT messageTab(tr("File opened in read only mode."), MessageWidget::Warning); + } + updateLastDatabases(dbStruct.filePath); if (!pw.isNull() || !keyFile.isEmpty()) { @@ -192,6 +197,7 @@ void DatabaseTabWidget::openDatabase(const QString& fileName, const QString& pw, else { dbStruct.dbWidget->switchToOpenDatabase(dbStruct.filePath); } + Q_EMIT messageDismissGlobal(); } void DatabaseTabWidget::mergeDatabase() @@ -332,6 +338,7 @@ bool DatabaseTabWidget::saveDatabase(Database* db) dbStruct.modified = false; dbStruct.dbWidget->databaseSaved(); updateTabName(db); + Q_EMIT messageDismissTab(); return true; } else { @@ -341,8 +348,8 @@ bool DatabaseTabWidget::saveDatabase(Database* db) } } else { - MessageBox::critical(this, tr("Error"), tr("Writing the database failed.") + "\n\n" - + saveFile.errorString()); + Q_EMIT messageTab(tr("Writing the database failed.\n") + .append("\n").append(saveFile.errorString()), MessageWidget::Error); return false; } } @@ -486,8 +493,9 @@ void DatabaseTabWidget::exportToCsv() CsvExporter csvExporter; if (!csvExporter.exportDatabase(fileName, db)) { - MessageBox::critical(this, tr("Error"), tr("Writing the CSV file failed.") + "\n\n" - + csvExporter.errorString()); + Q_EMIT messageGlobal( + tr("Writing the CSV file failed.").append("\n\n") + .append(csvExporter.errorString()), MessageWidget::Error); } } diff --git a/src/gui/DatabaseTabWidget.h b/src/gui/DatabaseTabWidget.h index 24bdbde2f..8f01a987d 100644 --- a/src/gui/DatabaseTabWidget.h +++ b/src/gui/DatabaseTabWidget.h @@ -23,12 +23,14 @@ #include "format/KeePass2Writer.h" #include "gui/DatabaseWidget.h" +#include "gui/MessageWidget.h" class DatabaseWidget; class DatabaseWidgetStateSync; class DatabaseOpenWidget; class QFile; class QLockFile; +class MessageWidget; struct DatabaseManagerStruct { @@ -84,6 +86,10 @@ Q_SIGNALS: void activateDatabaseChanged(DatabaseWidget* dbWidget); void databaseLocked(DatabaseWidget* dbWidget); void databaseUnlocked(DatabaseWidget* dbWidget); + void messageGlobal(const QString&, MessageWidget::MessageType type); + void messageTab(const QString&, MessageWidget::MessageType type); + void messageDismissGlobal(); + void messageDismissTab(); private Q_SLOTS: void updateTabName(Database* db); diff --git a/src/gui/DatabaseWidget.cpp b/src/gui/DatabaseWidget.cpp index 4a1298deb..74fc2d7cc 100644 --- a/src/gui/DatabaseWidget.cpp +++ b/src/gui/DatabaseWidget.cpp @@ -60,7 +60,14 @@ DatabaseWidget::DatabaseWidget(Database* db, QWidget* parent) , m_newParent(nullptr) { m_mainWidget = new QWidget(this); - QLayout* layout = new QHBoxLayout(m_mainWidget); + + m_messageWidget = new MessageWidget(this); + m_messageWidget->setHidden(true); + + QVBoxLayout* mainLayout = new QVBoxLayout(); + QLayout* layout = new QHBoxLayout(); + mainLayout->addWidget(m_messageWidget); + mainLayout->addLayout(layout); m_splitter = new QSplitter(m_mainWidget); m_splitter->setChildrenCollapsible(false); @@ -105,7 +112,7 @@ DatabaseWidget::DatabaseWidget(Database* db, QWidget* parent) m_splitter->setStretchFactor(1, 70); layout->addWidget(m_splitter); - m_mainWidget->setLayout(layout); + m_mainWidget->setLayout(mainLayout); m_editEntryWidget = new EditEntryWidget(); m_editEntryWidget->setObjectName("editEntryWidget"); @@ -1220,3 +1227,15 @@ void DatabaseWidget::closeUnlockDialog() { m_unlockDatabaseDialog->close(); } + +void DatabaseWidget::showMessage(const QString& text, MessageWidget::MessageType type) +{ + m_messageWidget->showMessage(text, type); +} + +void DatabaseWidget::hideMessage() +{ + if (m_messageWidget->isVisible()) { + m_messageWidget->animatedHide(); + } +} diff --git a/src/gui/DatabaseWidget.h b/src/gui/DatabaseWidget.h index 79e58cecf..4133e52b4 100644 --- a/src/gui/DatabaseWidget.h +++ b/src/gui/DatabaseWidget.h @@ -26,6 +26,7 @@ #include "core/Uuid.h" #include "gui/entry/EntryModel.h" +#include "gui/MessageWidget.h" class ChangeMasterKeyWidget; class DatabaseOpenWidget; @@ -43,9 +44,14 @@ class QMenu; class QSplitter; class QLabel; class UnlockDatabaseWidget; +class MessageWidget; class UnlockDatabaseDialog; class QFileSystemWatcher; +namespace Ui { + class SearchWidget; +} + class DatabaseWidget : public QStackedWidget { Q_OBJECT @@ -145,6 +151,8 @@ public Q_SLOTS: void search(const QString& searchtext); void setSearchCaseSensitive(bool state); void endSearch(); + void showMessage(const QString& text, MessageWidget::MessageType type); + void hideMessage(); private Q_SLOTS: void entryActivationSignalReceived(Entry* entry, EntryModel::ModelColumn column); @@ -192,6 +200,7 @@ private: QString m_filename; Uuid m_groupBeforeLock; Uuid m_entryBeforeLock; + MessageWidget* m_messageWidget; // Search state QString m_lastSearchText; diff --git a/src/gui/DatabaseWidgetStateSync.cpp b/src/gui/DatabaseWidgetStateSync.cpp index fd5719f5a..1510d8440 100644 --- a/src/gui/DatabaseWidgetStateSync.cpp +++ b/src/gui/DatabaseWidgetStateSync.cpp @@ -149,3 +149,4 @@ QVariant DatabaseWidgetStateSync::intListToVariant(const QList& list) return result; } + diff --git a/src/gui/EditWidget.cpp b/src/gui/EditWidget.cpp index c2f9551c4..ef29f0132 100644 --- a/src/gui/EditWidget.cpp +++ b/src/gui/EditWidget.cpp @@ -89,19 +89,9 @@ bool EditWidget::readOnly() const return m_readOnly; } -void EditWidget::showMessageError(const QString& text) +void EditWidget::showMessage(const QString& text, MessageWidget::MessageType type) { - m_ui->messageWidget->showMessageError(text); -} - -void EditWidget::showMessageWarning(const QString& text) -{ - m_ui->messageWidget->showMessageWarning(text); -} - -void EditWidget::showMessageInformation(const QString& text) -{ - m_ui->messageWidget->showMessageInformation(text); + m_ui->messageWidget->showMessage(text, type); } void EditWidget::hideMessage() diff --git a/src/gui/EditWidget.h b/src/gui/EditWidget.h index 97dfda880..6f2c8f2dc 100644 --- a/src/gui/EditWidget.h +++ b/src/gui/EditWidget.h @@ -21,6 +21,7 @@ #include #include "gui/DialogyWidget.h" +#include "gui/MessageWidget.h" class QLabel; @@ -48,10 +49,8 @@ Q_SIGNALS: void accepted(); void rejected(); -protected: - void showMessageError(const QString& text); - void showMessageWarning(const QString& text); - void showMessageInformation(const QString& text); +protected Q_SLOTS: + void showMessage(const QString& text, MessageWidget::MessageType type); void hideMessage(); private: diff --git a/src/gui/EditWidgetIcons.cpp b/src/gui/EditWidgetIcons.cpp index 145957ab9..fcfff5ca3 100644 --- a/src/gui/EditWidgetIcons.cpp +++ b/src/gui/EditWidgetIcons.cpp @@ -248,7 +248,7 @@ void EditWidgetIcons::addCustomIcon() m_ui->customIconsView->setCurrentIndex(index); } else { - MessageBox::critical(this, tr("Error"), tr("Can't read icon")); + Q_EMIT messageEditEntry(tr("Can't read icon"), MessageWidget::Error); } } } @@ -302,9 +302,8 @@ void EditWidgetIcons::removeCustomIcon() } } else { - MessageBox::information(this, tr("Can't delete icon!"), - tr("Can't delete icon. Still used by %1 items.") - .arg(iconUsedCount)); + Q_EMIT messageEditEntry( + tr("Can't delete icon. Still used by %1 items.").arg(iconUsedCount), MessageWidget::Error); } } } diff --git a/src/gui/EditWidgetIcons.h b/src/gui/EditWidgetIcons.h index 508c56864..ae5f86951 100644 --- a/src/gui/EditWidgetIcons.h +++ b/src/gui/EditWidgetIcons.h @@ -26,6 +26,7 @@ #include "core/Global.h" #include "core/Uuid.h" +#include "gui/MessageWidget.h" class Database; class DefaultIconModel; @@ -58,6 +59,10 @@ public: public Q_SLOTS: void setUrl(const QString &url); +Q_SIGNALS: + void messageEditEntry(QString, MessageWidget::MessageType); + void messageEditEntryDismiss(); + private Q_SLOTS: void downloadFavicon(); void fetchFavicon(QUrl url); diff --git a/src/gui/KeePass1OpenWidget.cpp b/src/gui/KeePass1OpenWidget.cpp index 4f70a9787..c5159aaba 100644 --- a/src/gui/KeePass1OpenWidget.cpp +++ b/src/gui/KeePass1OpenWidget.cpp @@ -65,8 +65,9 @@ void KeePass1OpenWidget::openDatabase() Q_EMIT editFinished(true); } else { - MessageBox::warning(this, tr("Error"), tr("Unable to open the database.").append("\n") - .append(reader.errorString())); + m_ui->messageWidget->showMessage(tr("Unable to open the database.").append("\n") + .append(reader.errorString()), MessageWidget::Error); + m_ui->editPassword->clear(); } } diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp index 819bda5dc..92a9cbdd4 100644 --- a/src/gui/MainWindow.cpp +++ b/src/gui/MainWindow.cpp @@ -104,6 +104,7 @@ MainWindow::MainWindow() #endif setWindowIcon(filePath()->applicationIcon()); + m_ui->globalMessageWidget->setHidden(true); QAction* toggleViewAction = m_ui->toolBar->toggleViewAction(); toggleViewAction->setText(tr("Show toolbar")); m_ui->menuView->addAction(toggleViewAction); @@ -277,6 +278,11 @@ MainWindow::MainWindow() connect(m_ui->actionAbout, SIGNAL(triggered()), SLOT(showAboutDialog())); + connect(m_ui->tabWidget, SIGNAL(messageGlobal(QString,MessageWidget::MessageType)), this, SLOT(displayGlobalMessage(QString, MessageWidget::MessageType))); + connect(m_ui->tabWidget, SIGNAL(messageDismissGlobal()), this, SLOT(hideGlobalMessage())); + connect(m_ui->tabWidget, SIGNAL(messageTab(QString,MessageWidget::MessageType)), this, SLOT(displayTabMessage(QString, MessageWidget::MessageType))); + connect(m_ui->tabWidget, SIGNAL(messageDismissTab()), this, SLOT(hideTabMessage())); + updateTrayIcon(); } @@ -787,3 +793,28 @@ bool MainWindow::isTrayIconEnabled() const && QSystemTrayIcon::isSystemTrayAvailable(); #endif } + +void MainWindow::displayGlobalMessage(const QString& text, MessageWidget::MessageType type) +{ + m_ui->globalMessageWidget->showMessage(text, type); +} + +void MainWindow::displayTabMessage(const QString& text, MessageWidget::MessageType type) +{ + //if (m_ui->stackedWidget->currentIndex() == 0) { + m_ui->tabWidget->currentDatabaseWidget()->showMessage(text, type); + //} +} + +void MainWindow::hideGlobalMessage() +{ + m_ui->globalMessageWidget->hideMessage(); +} + +void MainWindow::hideTabMessage() +{ + if (m_ui->stackedWidget->currentIndex() == 0) { + m_ui->tabWidget->currentDatabaseWidget()->hideMessage(); + } +} + diff --git a/src/gui/MainWindow.h b/src/gui/MainWindow.h index ab9924a75..4182140c7 100644 --- a/src/gui/MainWindow.h +++ b/src/gui/MainWindow.h @@ -71,6 +71,10 @@ private Q_SLOTS: void toggleWindow(); void lockDatabasesAfterInactivity(); void repairDatabase(); + void displayGlobalMessage(const QString& text, MessageWidget::MessageType type); + void displayTabMessage(const QString& text, MessageWidget::MessageType type); + void hideGlobalMessage(); + void hideTabMessage(); private: static void setShortcut(QAction* action, QKeySequence::StandardKey standard, int fallback = 0); diff --git a/src/gui/MainWindow.ui b/src/gui/MainWindow.ui index 188ef1586..bb7ff779c 100644 --- a/src/gui/MainWindow.ui +++ b/src/gui/MainWindow.ui @@ -2,6 +2,9 @@ MainWindow + + true + 0 @@ -14,6 +17,9 @@ KeePassXC + + true + 0 @@ -27,8 +33,24 @@ 0 + + + + + 0 + 0 + + + + + + + 0 + 0 + + 2 @@ -104,7 +126,7 @@ 0 0 800 - 26 + 29 @@ -452,6 +474,12 @@ + + MessageWidget + QWidget +
gui/MessageWidget.h
+ 1 +
DatabaseTabWidget QTabWidget diff --git a/src/gui/MessageWidget.cpp b/src/gui/MessageWidget.cpp index 19badfea8..15e6b2562 100644 --- a/src/gui/MessageWidget.cpp +++ b/src/gui/MessageWidget.cpp @@ -23,32 +23,14 @@ MessageWidget::MessageWidget(QWidget* parent) } -void MessageWidget::showMessageError(const QString& text) -{ - showMessage(text, MessageType::Error); -} - -void MessageWidget::showMessageWarning(const QString& text) -{ - showMessage(text, MessageType::Warning); -} - -void MessageWidget::showMessageInformation(const QString& text) -{ - showMessage(text, MessageType::Information); -} - -void MessageWidget::showMessagePositive(const QString& text) -{ - showMessage(text, MessageType::Positive); -} - -void MessageWidget::showMessage(const QString& text, MessageType type) +void MessageWidget::showMessage(const QString& text, MessageWidget::MessageType type) { setMessageType(type); setText(text); animatedShow(); } - - +void MessageWidget::hideMessage() +{ + animatedHide(); +} diff --git a/src/gui/MessageWidget.h b/src/gui/MessageWidget.h index 6e8366fae..af97c6f4c 100644 --- a/src/gui/MessageWidget.h +++ b/src/gui/MessageWidget.h @@ -7,15 +7,15 @@ class MessageWidget : public KMessageWidget { + Q_OBJECT + public: explicit MessageWidget(QWidget* parent = 0); - void showMessageError(const QString& text); - void showMessageWarning(const QString& text); - void showMessageInformation(const QString& text); - void showMessagePositive(const QString& text); -private: - void showMessage(const QString& text, MessageType type); +public Q_SLOTS: + void showMessage(const QString& text, MessageWidget::MessageType type); + void hideMessage(); + }; #endif // MESSAGEWIDGET_H diff --git a/src/gui/entry/EditEntryWidget.cpp b/src/gui/entry/EditEntryWidget.cpp index c56f70232..d9b235f3b 100644 --- a/src/gui/entry/EditEntryWidget.cpp +++ b/src/gui/entry/EditEntryWidget.cpp @@ -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; } diff --git a/src/gui/group/EditGroupWidget.cpp b/src/gui/group/EditGroupWidget.cpp index 177c62bb0..5b9dfcbc8 100644 --- a/src/gui/group/EditGroupWidget.cpp +++ b/src/gui/group/EditGroupWidget.cpp @@ -43,6 +43,9 @@ EditGroupWidget::EditGroupWidget(QWidget* parent) connect(this, SIGNAL(accepted()), SLOT(save())); connect(this, SIGNAL(rejected()), SLOT(cancel())); + + connect(m_editGroupWidgetIcons, SIGNAL(messageEditEntry(QString, MessageWidget::MessageType)), SLOT(showMessage(QString, MessageWidget::MessageType))); + connect(m_editGroupWidgetIcons, SIGNAL(messageEditEntryDismiss()), SLOT(hideMessage())); } EditGroupWidget::~EditGroupWidget() diff --git a/src/gui/group/EditGroupWidget.h b/src/gui/group/EditGroupWidget.h index 94ad891db..606cc77b0 100644 --- a/src/gui/group/EditGroupWidget.h +++ b/src/gui/group/EditGroupWidget.h @@ -45,6 +45,8 @@ public: Q_SIGNALS: void editFinished(bool accepted); + void messageEditEntry(QString, MessageWidget::MessageType); + void messageEditEntryDismiss(); private Q_SLOTS: void save();