Changeset 96:6a811dc9680e in SMSSender


Ignore:
Timestamp:
Jul 8, 2010 6:20:56 PM (8 years ago)
Author:
Sämy Zehnder <saemy.zehnder@…>
Branch:
3.0
Convert:
svn:3639001d-8e34-449c-bb86-3782b86c4877/branches/3.0@99
Message:
  • Implemented the ETHZ gateway.
  • Deploy-adjustments for alpha4 for ubuntu.
Files:
23 added
19 edited

Legend:

Unmodified
Added
Removed
  • deploy/howto.txt

    r94 r96  
    3434    * Check the version in the project files
    3535    * Create uploadable file with debuild -S
    36     * Upload it with: dput smssender XXX.changes
     36    * Doublecheck if debian/patches/ is not existing. Fix the differences otherwise.
     37    * Upload it with: dput smssender XXX_source.changes
    3738
    3839MAC:
  • deploy/ubuntu/smssender-gateway-swisscomxtrazone/debian/changelog

    r94 r96  
     1smssender-gateway-swisscomxtrazone (1.0.0.alpha3-0ubuntu1) lucid; urgency=low
     2
     3  * Importing contacts from the SwisscomXtraZone website is now possible.
     4
     5 -- Sämy Zehnder <saemy.zehnder@gorrion.ch>  Wed, 07 Jul 2010 14:06:46 +0200
     6
    17smssender-gateway-swisscomxtrazone (1.0.0.alpha2-0ubuntu2) lucid; urgency=low
    28
  • deploy/ubuntu/smssender-gateway-swisscomxtrazone/debian/control

    r92 r96  
    1212Package: smssender-gateway-swisscomxtrazone
    1313Architecture: any
    14 Depends: ${shlibs:Depends}, ${misc:Depends}, smssender
     14Depends: ${shlibs:Depends}, ${misc:Depends}, smssender (>= 3.0.0.alpha4)
    1515Description: A fast and easy-to-use client for sending sms over internet gateways
    1616 This application simplifies the procedure of sending sms via websites as of
  • deploy/ubuntu/smssender-gateway-swisscomxtrazone/debian/rules

    r94 r96  
    1414compile-translations:
    1515        cd `pwd`/gateways/SwisscomXtraZone/locale && lrelease *.ts
    16         ln -f -s `pwd`/gateways/SwisscomXtraZone/locale/*.qm `pwd`/gateways/SwisscomXtraZone/lib/
     16        ln -f -s `pwd`/gateways/SwisscomXtraZone/locale/de.qm `pwd`/gateways/SwisscomXtraZone/lib/xtra-de.qm
    1717
    1818generate-makefiles: compile-translations
  • deploy/ubuntu/smssender/debian/changelog

    r92 r96  
     1smssender (3.0.0.alpha4-0ubuntu1) lucid; urgency=low
     2
     3  * Contact import from old contacts file and Swisscom XtraZone website
     4    available now.
     5  * Fixed translation issue, that strings from the gateway SwisscomXtraZone
     6    were not translated.
     7  * Fixed issue, that numbers which were entered in the recipient edit were
     8    not resolved to a contact but the first (invisible) completion was taken
     9    instead.
     10
     11 -- Sämy Zehnder <saemy.zehnder@gorrion.ch>  Wed, 07 Jul 2010 13:39:30 +0200
     12
    113smssender (3.0.0.alpha3-0ubuntu1) lucid; urgency=low
    214
  • do_lupdate

    r95 r96  
    22
    33lupdate -recursive lib/libutils lib/libdatatypes src/ -ts locale/de.ts
     4
     5cd gateways/ETHZ
     6lupdate ethz.pro
     7cd ../../
    48
    59cd gateways/SwisscomXtraZone
     
    913cd gateways/SwisscomXtraZone_Old
    1014lupdate SwisscomXtraZone_Old.pro
     15cd ../../
  • gateways/SwisscomXtraZone/lib/SwisscomXtraZone.qrc

    r95 r96  
    22    <qresource prefix="/certs">
    33        <file>SwisscomRootCA1.crt</file>
    4         <file>SMSSender_XtraZone.crt</file>
     4        <file>SMSSender_XtraZone.crt.priv</file>
    55    </qresource>
    66    <qresource prefix="/images">
  • gateways/SwisscomXtraZone/locale/de.ts

    r95 r96  
    116116        <location filename="../src/business/bcaccount.cpp" line="638"/>
    117117        <source>You have only %1 SMS for free but you need at least %2 SMS left to send this message.</source>
    118         <translation>Du hast nur noch %1 Gratis-SMS, würdest aber %2 Gratis-SMS benötigen, um diese Mitteilung zu verschicken.</translation>
     118        <translation>Du hast nur noch %1 Gratis-SMS. Es werden jedoch %2 Gratis-SMS benötigt, um diese Mitteilung verschicken zu können.</translation>
    119119    </message>
    120120    <message>
    121         <location filename="../src/business/bcaccount.cpp" line="684"/>
     121        <location filename="../src/business/bcaccount.cpp" line="682"/>
    122122        <source>The sending of the sms was requested to cancel, but (a part of) the sms has already been sent.</source>
    123         <translation>Der SMS-Versandt sollte abgebrochen werden, ein Teil der SMS wurde zu diesem Zeitpunkt jedoch bereits versendet.</translation>
     123        <translation>Der SMS-Versandt wurde abgebrochen. Ein Teil der SMS wurde zu diesem Zeitpunkt jedoch bereits versendet.</translation>
    124124    </message>
    125125</context>
  • gateways/SwisscomXtraZone/src/business/bcaccount.cpp

    r95 r96  
    2121#include <math.h>
    2222
     23#include <QDebug>
    2324#include <QDialog>
    2425#include <QFile>
     
    2627#include <QSslCertificate>
    2728#include <QSslKey>
    28 #include <QDebug>
     29#include <QThread>
    2930
    3031#include <stdexceptions.h>
     
    8788    }
    8889
    89     SHttpHelper* httpHelper = new SHttpHelper(); // TODO: connect it to QThread as parent for autodelete
    90 
     90    SHttpHelper* httpHelper = new SHttpHelper(false, thread());
    9191
    9292    /* Insert the swisscom-mobile.ch certificate to allow propper loading of the websites... */
     
    115115 */
    116116int BCAccount::costsForText(const QString& message) const {
    117     return gateway()->splitTextToShortSMS(message + QString(gateway()->adTextLength(), QChar('*'))).size();
     117    return gateway()->shortSMSCount(message);
    118118}
    119119
     
    156156void BCAccount::_installAnticaptchaClientCertificate(SHttpHelper* http) {
    157157    /* Set the client certificate */
    158     QFile clientCrtFile(":/certs/SMSSender_XtraZone.crt");
     158    QFile clientCrtFile(":/certs/SMSSender_XtraZone.crt.priv");
    159159    clientCrtFile.open(QIODevice::ReadOnly);
    160160    QSslCertificate clientCrt(&clientCrtFile, QSsl::Pem);
     
    162162    http->httpSocket()->setLocalCertificate(clientCrt);
    163163
    164     http->httpSocket()->setPrivateKey(":/certs/SMSSender_XtraZone.crt");
     164    http->httpSocket()->setPrivateKey(":/certs/SMSSender_XtraZone.crt.priv");
    165165    Q_ASSERT(!http->httpSocket()->privateKey().isNull());
    166166}
     
    563563void BCAccount::_sendSMS(const QString& text) {
    564564    haltIfCancelled();
    565     qDebug() << "Start of sending parActionStateMS";
     565    qDebug() << "Start of sending part of SMS";
    566566
    567567    setStatus(Account::Action::SendingSMS);
     
    632632                _parseMainPage();
    633633
    634                 QStringList longSMSList  = gateway()->splitTextToLongSMS(message);
    635                 QStringList shortSMSList = gateway()->splitTextToShortSMS(message);
    636 
    637                 if (shortSMSList.size() * recipients.size() > freeSMSCount()) {
     634                QStringList longSMSList = gateway()->splitTextToLongSMS(message);
     635                int shortSMSCount       = gateway()->shortSMSCount(message);
     636
     637                if (shortSMSCount * recipients.size() > freeSMSCount()) {
    638638                    EException(tr("You have only %1 SMS for free but you need at least %2 SMS left to send this message.")
    639                                    .arg(freeSMSCount()).arg(shortSMSList.size() * recipients.size()))
     639                                   .arg(freeSMSCount()).arg(shortSMSCount * recipients.size()))
    640640                            .raise();
    641641                }
     
    673673
    674674            setStatus(LoginAccount::Action::Sleeping, 100);
    675             setProgress(90);
    676             logout();
    677675        } catch (EException& e) {
    678676            qWarning() << "Error occured while sending sms.";
  • gateways/SwisscomXtraZone/src/business/bcgateway.cpp

    r92 r96  
    1717*/
    1818#include "bcgateway.h"
     19
     20#include <math.h>
    1921
    2022#include "bcaccount.h"
     
    120122
    121123/**
    122  * Splits the given text into a list of short-sms. <br/>
     124 * Returns the short-sms count of the given text. <br/>
    123125 * This is only a hypotetic list, since the short-sms-lenght could vary and SHORTSMS_LENGTH is a static value.<br/>
    124126 * However, since the splitTextToLongSMS is the correct long-sms-list (which length is synchronized with the gateway)
    125127 * the short-sms count is not totally wrong.
     128 * Add this is btw. also the way it is calculated on the website.
    126129 *
    127130 * @param QString text The text which should be splitted.
    128131 * @return Returns a list of the short-sms texts
    129132 */
    130 QList<QString> BCGateway::splitTextToShortSMS(const QString& text) const {
    131     QList<QString> shortSMSList;
    132     QList<QString> longSMSList = splitTextToLongSMS(text);
    133 
    134     foreach (QString longSMSText, longSMSList) {
    135         while (longSMSText != "") {
    136             shortSMSList.append(longSMSText.left(SHORTSMS_LENGTH));
    137             longSMSText.remove(0, SHORTSMS_LENGTH);
    138         }
     133int BCGateway::shortSMSCount(const QString& text) const {
     134    QString txt(text);
     135    foreach (QString doublePriceChar, doublePriceChars_) {
     136        txt.replace(doublePriceChar, "xx"); // Just for counting purpose
    139137    }
    140138
    141     return shortSMSList;
     139    QList<QString> longSMSList = splitTextToLongSMS(txt);
     140    longSMSList.last() += QString(adTextLength(), QChar('x')); // extend it by a hypotetical ad text
     141
     142    int count = 0;
     143    foreach (QString longSMSText, longSMSList) {
     144        count += ceil(longSMSText.length() / (double)SHORTSMS_LENGTH);
     145    }
     146
     147    return count;
    142148}
    143149
  • gateways/SwisscomXtraZone/src/business/bcgateway.h

    r92 r96  
    4848
    4949    QList<QString> splitTextToLongSMS(const QString& text) const;
    50     QList<QString> splitTextToShortSMS(const QString& text) const;
     50    int            shortSMSCount(const QString& text) const;
    5151
    5252    IAccountSettingsWidget* getAccountSettingsWidget(QWidget* parent = 0) const;
  • gateways/SwisscomXtraZone/src/business/contactimporter/bccontactimporter.h

    r95 r96  
    1717 */
    1818
    19 #ifndef BCCONTACTIMPORTER_H_
    20 #define BCCONTACTIMPORTER_H_
     19#ifndef SWISSCOMXTRAZONE_BCCONTACTIMPORTER_H_
     20#define SWISSCOMXTRAZONE_BCCONTACTIMPORTER_H_
    2121
    2222#include <QObject>
     
    6767};
    6868
    69 #endif /* BCCONTACTIMPORTER_H_ */
     69#endif /* SWISSCOMXTRAZONE_BCCONTACTIMPORTER_H_ */
  • gateways/SwisscomXtraZone/src/main.cpp

    r95 r96  
    2424#include "business/contactimporter/bccontactimporter.h"
    2525#include "business/bcgateway.h"
    26 
    27 inline void initResource() { Q_INIT_RESOURCE(SwisscomXtraZone); }
    2826
    2927namespace SwisscomXtraZone {
  • lib/libdatatypes/src/interfaces/igateway.h

    r92 r96  
    4747
    4848    virtual QList<QString> splitTextToLongSMS(const QString& text) const =0;
    49     virtual QList<QString> splitTextToShortSMS(const QString& text) const =0;
     49    virtual int            shortSMSCount(const QString& text) const =0;
    5050
    5151    virtual IAccountSettingsWidget* getAccountSettingsWidget(QWidget* parent = 0) const =0;
  • lib/libdatatypes/src/sdummyaccount.cpp

    r92 r96  
    4646    return msgs;
    4747}
    48 QList<QString> SDummyGateway::splitTextToShortSMS(const QString& text) const {
    49     return splitTextToLongSMS(text);
     48int SDummyGateway::shortSMSCount(const QString& text) const {
     49    return splitTextToLongSMS(text).size();
    5050}
    5151
  • lib/libdatatypes/src/sdummyaccount.h

    r92 r96  
    3636
    3737    QList<QString> splitTextToLongSMS(const QString& text) const;
    38     QList<QString> splitTextToShortSMS(const QString& text) const;
     38    int            shortSMSCount(const QString& text) const;
    3939
    4040    IAccountSettingsWidget* getAccountSettingsWidget(QWidget* parent = 0) const;
  • locale/de.ts

    r95 r96  
    512512        <location filename="../src/ui/vcaddressbook/vcaddressbook.ui" line="244"/>
    513513        <source>Add a new group.</source>
    514         <translation>Ein neues Konto hinzufügen.</translation>
     514        <translation>Eine neue Gruppe hinzufügen.</translation>
    515515    </message>
    516516    <message>
  • src/ui/vcmain/vcmain.cpp

    r95 r96  
    500500}
    501501
    502 void VCMain::on_selAccounts_currentIndexChanged(int index) {
     502void VCMain::on_lstAccounts_currentIndexChanged(int index) {
    503503    Q_UNUSED(index);
    504504
  • src/ui/vcmain/vcmain.h

    r92 r96  
    109109
    110110    void on_txtMessage_textChanged();
    111     void on_selAccounts_currentIndexChanged(int index);
     111    void on_lstAccounts_currentIndexChanged(int index);
    112112
    113113    void on_lstContacts_editTextChanged(const QString& text);
Note: See TracChangeset for help on using the changeset viewer.