Changeset 352:4e2ad2b5bfdb in SMSSender


Ignore:
Timestamp:
Mar 31, 2014 1:05:10 PM (5 years ago)
Author:
Sämy Zehnder <saemy.zehnder@…>
Branch:
separation-frontend-backend
Message:
  • Fixes bug where an error about erroneous accounts has been showed each startup even though no error occured.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • frontend/gui/ui/main.cpp

    r321 r352  
    628628    QString detailedMsg;
    629629
    630 
    631     foreach(IAccount* account, m_managerFactory.accountManager()->erroneousAccounts()) {
    632         const EException &ex = static_cast<ErrorAccount*>(account)->error();
    633 
    634         errorMsg += QString("[%1]: %2\n").arg(account->name(), ex.unchainedWhat());
    635         if (ex.hasChainedException()) {
    636             detailedMsg += QString("[%1]: %2\n").arg(account->name(), ex.chainedException().chainedWhat());
    637         }
    638     }
    639     errorMsg.remove(QRegExp("\n$"));
    640     detailedMsg.remove(QRegExp("\n$"));
    641 
    642     QMessageBox msg(QMessageBox::Warning, tr("Error occured"),
    643                     tr("Errors occured while loading your accounts."), QMessageBox::Ok, this);
    644     msg.setDefaultButton(QMessageBox::Ok);
    645     msg.setInformativeText(errorMsg);
    646     msg.setDetailedText(detailedMsg);
    647     msg.exec();
     630    QSet<IAccount *> erroneousAccounts =
     631        m_managerFactory.accountManager()->erroneousAccounts();
     632    if (!erroneousAccounts.empty()) {
     633        foreach(IAccount* account, erroneousAccounts) {
     634            const EException &ex = static_cast<ErrorAccount*>(account)->error();
     635
     636            errorMsg += QString("[%1]: %2\n").arg(account->name(), ex.unchainedWhat());
     637            if (ex.hasChainedException()) {
     638                detailedMsg += QString("[%1]: %2\n").arg(account->name(), ex.chainedException().chainedWhat());
     639            }
     640        }
     641        errorMsg.remove(QRegExp("\n$"));
     642        detailedMsg.remove(QRegExp("\n$"));
     643
     644        QMessageBox msg(QMessageBox::Warning, tr("Error occured"),
     645                        tr("Errors occured while loading your accounts."), QMessageBox::Ok, this);
     646        msg.setDefaultButton(QMessageBox::Ok);
     647        msg.setInformativeText(errorMsg);
     648        msg.setDetailedText(detailedMsg);
     649        msg.exec();
     650    }
    648651}
    649652
Note: See TracChangeset for help on using the changeset viewer.