Changeset 362:f5af940455b5 in SMSSender


Ignore:
Timestamp:
Apr 1, 2014 12:59:19 PM (5 years ago)
Author:
Sämy Zehnder <saemy.zehnder@…>
Branch:
separation-frontend-backend
Message:
  • Adds a parent to every dialog s.t. they do not create an own entry in the task bar.
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • common/gui/business/iintegration.h

    r316 r362  
    6262    /**
    6363     * Shows the given error in a message box in the main thread.
     64     * @param parent The parent window of the message box.
    6465     * @param message The additional message for the error.
    6566     * @param exception The error.
    6667     * @return The result of the dialog execution
    6768     */
    68     virtual int execErrorDialog(const QString &message, const EException &exception) =0;
     69    virtual int execErrorDialog(QWidget *parent, const QString &message,
     70                                const EException &exception) =0;
    6971
    7072signals:
  • frontend/gui/ui/guiintegrationhelper.cpp

    r329 r362  
    4242}
    4343
    44 int GuiIntegrationHelper::execErrorDialog(const QString& message, const EException& exception) {
    45     return m_guiManager->execErrorDialog(message, exception);
     44int GuiIntegrationHelper::execErrorDialog(QWidget *parent,
     45                                          const QString& message,
     46                                          const EException& exception)
     47{
     48    return m_guiManager->execErrorDialog(parent, message, exception);
    4649}
    4750
  • frontend/gui/ui/guiintegrationhelper.h

    r329 r362  
    4545    int execDialog(IDialogWrapper* wrapper);
    4646    int execDialog(QMessageBox* msgBox);
    47     int execErrorDialog(const QString& message, const EException& exception);
     47    int execErrorDialog(QWidget *parent, const QString& message,
     48                        const EException& exception);
    4849
    4950    void addMenuAction(IGuiIntegrationHelper::Menu menu, QAction* action);
  • frontend/gui/ui/guimanager.cpp

    r317 r362  
    5555}
    5656
    57 int GuiManager::execErrorDialog(const QString& message, const EException& exception) {
     57int GuiManager::execErrorDialog(QWidget *parent, const QString& message,
     58                                const EException& exception) {
    5859    Q_ASSERT(QThread::currentThread() == qApp->thread());
    5960
    60     QMessageBox* msg = new QMessageBox;
     61    QScopedPointer<QMessageBox> msg(new QMessageBox(parent));
    6162    msg->setIcon(QMessageBox::Warning);
    6263    msg->setWindowTitle(QObject::tr("Error occured"));
     
    6970    msg->setDefaultButton(QMessageBox::Ok);
    7071
    71     return execDialog(msg);
     72    return execDialog(msg.take());
    7273}
    7374
     
    158159{
    159160    // Has to live in the main thread to work properly
    160     msgBox_->setParent(NULL);
     161    if (msgBox_->parent()->thread() != qApp->thread()) {
     162        msgBox_->setParent(NULL);
     163    }
    161164    msgBox_->moveToThread(qApp->thread());
    162165}
  • frontend/gui/ui/guimanager.h

    r319 r362  
    4141    int execDialog(IDialogWrapper* wrapper);
    4242    int execDialog(QMessageBox* msgBox);
    43     int execErrorDialog(const QString& message, const EException& exception);
     43    int execErrorDialog(QWidget *parent, const QString& message,
     44                        const EException& exception);
    4445
    4546    void addMenuAction(IGuiIntegrationHelper::Menu menu, QAction* action);
  • frontend/gui/ui/importcontacts/importcontacts_page_import.cpp

    r360 r362  
    107107    foreach (const EException &ex, m_contactImporter.importErrors()) {
    108108        m_guiManager->execErrorDialog(
    109                     tr("An error occured while importing contacts:"), ex);
     109                    this, tr("An error occured while importing contacts:"), ex);
    110110    }
    111111
  • frontend/gui/ui/main.cpp

    r352 r362  
    621621void Main::onAccountInitFailed(IAccount* account, const EException& exception) {
    622622    qWarning() << exception.chainedWhat();
    623     m_managerFactory.guiManager()->execErrorDialog(tr("An error occured while initializing the account \"%1\".").arg(account->name()), exception);
     623    m_managerFactory.guiManager()->execErrorDialog(
     624                this,
     625                tr("An error occured while initializing the account \"%1\".")
     626                    .arg(account->name()),
     627                exception);
    624628}
    625629
     
    687691
    688692    qWarning() << exception.chainedWhat();
    689     m_managerFactory.guiManager()->execErrorDialog(tr("An error occured while sending the sms."), exception);
     693    m_managerFactory.guiManager()->execErrorDialog(
     694                this, tr("An error occured while sending the sms."), exception);
    690695}
    691696
  • gateways/Sunrise/gui/business/account_task_sendsms.cpp

    r330 r362  
    4444        int createAndExecDialog() {
    4545            // Here we are in the gui-thread.
    46             QMessageBox mBox;
     46            QMessageBox mBox; // FIXME: Add a parent here.
    4747            mBox.setIcon(QMessageBox::Question);
    4848            mBox.setWindowTitle(QObject::tr("Select message format"));
  • gateways/Sunrise/gui/ui/settingswidget.cpp

    r330 r362  
    124124
    125125        if (imgBytes.size() > MMS_PICTURE_MAX_SIZE) {
    126             QMessageBox msg;
     126            QMessageBox msg(this);
    127127            msg.setIcon(QMessageBox::Warning);
    128128            msg.setWindowTitle(tr("Image too big"));
Note: See TracChangeset for help on using the changeset viewer.