Changeset 62:36700a2f4007 in SMSSender


Ignore:
Timestamp:
Feb 2, 2010 8:01:57 PM (8 years ago)
Author:
Sämy Zehnder <saemy.zehnder@…>
Branch:
3.0
Convert:
svn:3639001d-8e34-449c-bb86-3782b86c4877/branches/3.0@61
Message:
 
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • gateways/SwisscomXtraZone/src/business/BCAccount.cpp

    r47 r62  
    8686
    8787    if (lastHtml_.contains("Begin error region content", Qt::CaseInsensitive)) {
    88         throw new LoginAccount::ELoginException(LoginAccount::ELoginException::InvalidLoginData);
     88        throw LoginAccount::ELoginException(LoginAccount::ELoginException::InvalidLoginData);
    8989    }
    9090
    9191    if (!lastHtml_.contains("CobYouthSMSSenden:txtMessage", Qt::CaseInsensitive)) {
    92         throw new LoginAccount::ELoginException(LoginAccount::ELoginException::Unknown, "The returned page contains no message field.");
     92        throw LoginAccount::ELoginException(LoginAccount::ELoginException::Unknown, "The returned page contains no message field.");
    9393    }
    9494
     
    110110    bool result = httpHelper_->get(MAIN_PAGE).contains("CobYouthSMSSenden:txtMessage", Qt::CaseInsensitive);
    111111
    112     qDebug() << "Ended still-logged-in-check with result " + result;
     112    qDebug() << "Ended still-logged-in-check";
    113113    return result;
    114114}
     
    132132    rx.setPattern("<span.*id=\"CobYouthSMSSenden_lblErrorBox\".*>(.*)</span>");
    133133    if (rx.indexIn(lastHtml_) != -1) {
    134         throw new EException(rx.cap(1));
     134        throw EException(rx.cap(1));
    135135    }
    136136}
     
    147147    rx.setPattern("<input.*id=\"CobYouthSMSSenden_txtMessageDisabled\".*value=\"(.*)\".*/>");
    148148    if (rx.indexIn(lastHtml_) == -1) {
    149         throw new EException(tr("Could not get the addon text!"));
     149        throw EException(tr("Could not get the addon text!"));
    150150    }
    151151    gtwy->setAddonText(rx.cap(1));
     
    154154    rx.setPattern("<input.*id=\"lblcounter\".*value='(\\d*)'.*/?>");
    155155    if (rx.indexIn(lastHtml_) == -1){
    156         throw new EException(tr("Could not get the longSMSLength!"));
     156        throw EException(tr("Could not get the longSMSLength!"));
    157157    }
    158158    gtwy->setLongSMSLength(rx.cap(1).toInt() + gtwy->addonText().length());
     
    161161    rx.setPattern("<span.*id=\"CobYouthMMSSMSKonto_lblGuthaben\">(\\d*)</span>");
    162162    if (rx.indexIn(lastHtml_) == -1) {
    163         throw new EException(tr("Could not get the free sms count!"));
     163        throw EException(tr("Could not get the free sms count!"));
    164164    }
    165165    setFreeSMSCount(rx.cap(1).toInt());
     
    213213    }
    214214
     215    qDebug() << "Starting sending SMS";
     216   
    215217    /* PROGRESS:
    216218     *
     
    226228     */
    227229
    228     setProgress(0);
     230    try {
     231        setProgress(0);
    229232
    230233    uncancelSendingSMS();
     
    245248    int freeSMSNeeded = shortSMSLst.size() * recipients.size();
    246249    if (freeSMSNeeded > freeSMSCount()) {
    247         throw new EException(tr("You have only %1 SMS for free. (You need at least %2 SMS left to send this message!)").arg(freeSMSCount()).arg(freeSMSNeeded));
     250        throw EException(tr("You have only %1 SMS for free. (You need at least %2 SMS left to send this message!)").arg(freeSMSCount()).arg(freeSMSNeeded));
    248251    }
    249252
     
    295298    // TODO: check if sending was cancelled -> set status to "user abort"
    296299    setStatus(LoginAccount::Status::SMSSent, 100);
    297 }
    298 
    299 }
     300
     301    }catch (EException e) {
     302        // TODO
     303        qDebug() << "An error occured: " + QString::fromLatin1(e.what());
     304        setStatus(LoginAccount::Status::Error);
     305    }
     306   
     307    qDebug() << "SMS has been sent";
     308}
     309
     310}
  • src/business/BCAccountLoadThread.cpp

    r36 r62  
    3535        } catch (...) {
    3636        setLoadState(Failed);
    37             loadingFailed(account(), new EException("Unknown error occured.")); // Signal
     37            loadingFailed(account(), new EException("Unknown error occured while loading an account.")); // Signal
    3838        }
    3939
Note: See TracChangeset for help on using the changeset viewer.