Changeset 98:62ba2aba1b7a in SMSSender


Ignore:
Timestamp:
Jul 11, 2010 2:43:43 PM (8 years ago)
Author:
Sämy Zehnder <saemy.zehnder@…>
Branch:
3.0
Convert:
svn:3639001d-8e34-449c-bb86-3782b86c4877/branches/3.0@101
Message:
  • Implemented google contacts importer. (Fixes #31)
Files:
12 added
7 deleted
8 edited

Legend:

Unmodified
Added
Removed
  • gateways/SwisscomXtraZone/locale/de.ts

    r96 r98  
    55    <name>QObject</name>
    66    <message>
    7         <location filename="../src/business/bcaccount.cpp" line="45"/>
     7        <location filename="../src/business/bcaccount.cpp" line="46"/>
    88        <source>Doing anticaptcha</source>
    99        <translation>Erkenne Captcha</translation>
  • lib/libdatatypes/src/shttphelper.cpp

    r95 r98  
    8282SHttpCookieManager* SHttpHelper::cookieManager() const {
    8383    return cookieManager_;
     84}
     85QHttpRequestHeader* SHttpHelper::defaultHeader() const {
     86    return defaultHeader_;
    8487}
    8588
  • lib/libdatatypes/src/shttphelper.h

    r95 r98  
    5555    QHttp*                     http() const;
    5656    SHttpCookieManager*        cookieManager() const;
     57    QHttpRequestHeader*        defaultHeader() const;
    5758
    5859    QByteArray                 syncGet(const QString& destination, const QMap<QString, QString>& requests = (QMap<QString, QString>()));
     
    6970
    7071    static QString             unescapeString(const QString& str);
     72    static QString             htmldecodeString(const QString& str);
    7173
    7274signals:
  • lib/libdatatypes/src/shttphelper_escapechars.cpp

    r95 r98  
    2929    return s;
    3030}
     31QString SHttpHelper::htmldecodeString(const QString& str) {
     32    QString s(str);
     33
     34    QRegExp rx("%([a-fA-F0-9]{2})");
     35    int pos = 0;
     36    while ((pos = rx.indexIn(str, pos)) != -1) {
     37        bool ok;
     38        s.replace("%" + rx.cap(1), QString(char(rx.cap(1).toInt(&ok, 16))));
     39        pos += rx.matchedLength();
     40    }
     41    return s;
     42}
     43
    3144
    3245QMap<QString, QString> SHttpHelper::escapeChars() {
  • locale/de.ts

    r96 r98  
    7474    <name>ContactFilesModel</name>
    7575    <message>
    76         <location filename="../src/ui/vcoldsettingscontactimporter/contactfilesmodel.cpp" line="32"/>
    7776        <source>Import</source>
    78         <translation>Importieren</translation>
    79     </message>
    80     <message>
    81         <location filename="../src/ui/vcoldsettingscontactimporter/contactfilesmodel.cpp" line="33"/>
     77        <translation type="obsolete">Importieren</translation>
     78    </message>
     79    <message>
    8280        <source>Filename</source>
    83         <translation>Dateiname</translation>
     81        <translation type="obsolete">Dateiname</translation>
    8482    </message>
    8583</context>
     
    214212</context>
    215213<context>
     214    <name>GCI::PageConfigClass</name>
     215    <message>
     216        <location filename="../src/ui/contactimporterpages/googlecontactsimporter/gci_page_config.ui" line="14"/>
     217        <source>PageConfig</source>
     218        <translation>PageConfig</translation>
     219    </message>
     220    <message>
     221        <location filename="../src/ui/contactimporterpages/googlecontactsimporter/gci_page_config.ui" line="20"/>
     222        <source>Please enter your username and password to allow smssender to login to google contacts.</source>
     223        <translation>Bitte gib deine Benutzerdaten ein um SMSSender das Login zu Google-Kontakte zu erlauben.</translation>
     224    </message>
     225    <message>
     226        <location filename="../src/ui/contactimporterpages/googlecontactsimporter/gci_page_config.ui" line="30"/>
     227        <source>Username:</source>
     228        <translation>Benutzername:</translation>
     229    </message>
     230    <message>
     231        <location filename="../src/ui/contactimporterpages/googlecontactsimporter/gci_page_config.ui" line="40"/>
     232        <source>Password:</source>
     233        <translation>Passwort:</translation>
     234    </message>
     235</context>
     236<context>
    216237    <name>GroupTableModel</name>
    217238    <message>
     
    227248</context>
    228249<context>
    229     <name>PageConfig</name>
    230     <message>
    231         <location filename="../src/ui/vcoldsettingscontactimporter/page_config.cpp" line="42"/>
     250    <name>OSCI::OSCIContactFilesModel</name>
     251    <message>
     252        <location filename="../src/ui/contactimporterpages/oldsettingscontactimporter/osci_contactfilesmodel.cpp" line="34"/>
     253        <source>Import</source>
     254        <translation>Importieren</translation>
     255    </message>
     256    <message>
     257        <location filename="../src/ui/contactimporterpages/oldsettingscontactimporter/osci_contactfilesmodel.cpp" line="35"/>
     258        <source>Filename</source>
     259        <translation>Dateiname</translation>
     260    </message>
     261</context>
     262<context>
     263    <name>OSCI::PageConfig</name>
     264    <message>
     265        <location filename="../src/ui/contactimporterpages/oldsettingscontactimporter/osci_page_config.cpp" line="44"/>
    232266        <source>Select the contacts file</source>
    233267        <translation>Wähle die Kontaktdatei</translation>
     
    235269</context>
    236270<context>
    237     <name>PageConfigClass</name>
    238     <message>
    239         <location filename="../src/ui/vcoldsettingscontactimporter/page_config.ui" line="14"/>
     271    <name>OSCI::PageConfigClass</name>
     272    <message>
     273        <location filename="../src/ui/contactimporterpages/oldsettingscontactimporter/osci_page_config.ui" line="14"/>
    240274        <source>PageConfig</source>
    241275        <translation>PageConfig</translation>
    242276    </message>
    243277    <message>
    244         <location filename="../src/ui/vcoldsettingscontactimporter/page_config.ui" line="20"/>
     278        <location filename="../src/ui/contactimporterpages/oldsettingscontactimporter/osci_page_config.ui" line="20"/>
    245279        <source>Please select the contact files from where the contacts should be imported. If you wish to import from a settings file which is not listed, you can manually add it to the list.</source>
    246280        <translation>Wähle die Kontaktdateien von welchen importiert werden soll. Sollte deine Kontaktdatei nicht aufgeführt sein, kannst du sie manuell zur Liste hinzufügen.</translation>
     281    </message>
     282</context>
     283<context>
     284    <name>PageConfig</name>
     285    <message>
     286        <source>Select the contacts file</source>
     287        <translation type="obsolete">Wähle die Kontaktdatei</translation>
     288    </message>
     289</context>
     290<context>
     291    <name>PageConfigClass</name>
     292    <message>
     293        <source>PageConfig</source>
     294        <translation type="obsolete">PageConfig</translation>
     295    </message>
     296    <message>
     297        <source>Please select the contact files from where the contacts should be imported. If you wish to import from a settings file which is not listed, you can manually add it to the list.</source>
     298        <translation type="obsolete">Wähle die Kontaktdateien von welchen importiert werden soll. Sollte deine Kontaktdatei nicht aufgeführt sein, kannst du sie manuell zur Liste hinzufügen.</translation>
    247299    </message>
    248300</context>
     
    352404    </message>
    353405    <message>
    354         <location filename="../src/business/bcoldsettingscontactimporter.cpp" line="37"/>
     406        <location filename="../src/business/contactimporters/oldsettingscontactimporter.cpp" line="37"/>
    355407        <source>Import contacts from older versions of smssender.</source>
    356408        <translation>Importiere Kontakte von älteren SMSSender-Versionen.</translation>
    357409    </message>
     410    <message>
     411        <location filename="../src/business/contactimporters/googlecontactimporter.cpp" line="34"/>
     412        <source>Import from google contacts.</source>
     413        <translation>Importiere von Google-Kontakte.</translation>
     414    </message>
    358415</context>
    359416<context>
    360417    <name>SHttpHelper</name>
    361418    <message>
    362         <location filename="../lib/libdatatypes/src/shttphelper.cpp" line="278"/>
     419        <location filename="../lib/libdatatypes/src/shttphelper.cpp" line="281"/>
    363420        <source>Unknown response code: %1</source>
    364421        <translation>Unbekannter Antwort-Code: %1</translation>
  • smssender.pro

    r97 r98  
    3030    src/business/bclibraryloader.h \
    3131    src/business/bcmanagerfactory.h \
    32     src/business/bcoldsettingscontactimporter.h \
    3332    src/business/bcsettings.h \
    3433    src/business/bcsuffixmanager.h \
     34    src/business/contactimporters/oldsettingscontactimporter.h \
     35    src/business/contactimporters/googlecontactimporter.h \
    3536    src/persistence/storage/daaccountlistmanager.h \
    3637    src/persistence/storage/dastorage.h \
     
    4647    src/ui/components/searchbutton.h \
    4748    src/ui/components/searchlineedit.h \
     49    src/ui/contactimporterpages/googlecontactsimporter/gci_page_config.h \
     50    src/ui/contactimporterpages/oldsettingscontactimporter/osci_contactfilesmodel.h \
     51    src/ui/contactimporterpages/oldsettingscontactimporter/osci_page_config.h \
    4852    src/ui/models/accounttreemodel.h \
    4953    src/ui/models/loadedaccountmodel.h \
     
    6670    src/ui/vcimportcontacts/vcimportcontacts_page_intro.h \
    6771    src/ui/vcmain/vcmain.h \
    68     src/ui/vcoldsettingscontactimporter/contactfilesmodel.h \
    69     src/ui/vcoldsettingscontactimporter/page_config.h \
    7072    src/ui/vcsendingdialog/vcsendingdialog.h \
    7173    src/ui/vcsettings/vcsettings.h \
     
    7981    src/business/bclibraryloader.cpp \
    8082    src/business/bcmanagerfactory.cpp \
    81     src/business/bcoldsettingscontactimporter.cpp \
     83    src/business/contactimporters/oldsettingscontactimporter.cpp \
     84    src/business/contactimporters/googlecontactimporter.cpp \
    8285    src/business/bcsettings.cpp \
    8386    src/business/bcsuffixmanager.cpp \
     
    9497    src/ui/components/searchbutton.cpp \
    9598    src/ui/components/searchlineedit.cpp \
     99    src/ui/contactimporterpages/googlecontactsimporter/gci_page_config.cpp \
     100    src/ui/contactimporterpages/oldsettingscontactimporter/osci_contactfilesmodel.cpp \
     101    src/ui/contactimporterpages/oldsettingscontactimporter/osci_page_config.cpp \
    96102    src/ui/models/accounttreemodel.cpp \
    97103    src/ui/models/aliascompletionmodel.cpp \
     
    116122    src/ui/vcimportcontacts/vcimportcontacts_page_intro.cpp \
    117123    src/ui/vcmain/vcmain.cpp \
    118     src/ui/vcoldsettingscontactimporter/contactfilesmodel.cpp \
    119     src/ui/vcoldsettingscontactimporter/page_config.cpp \
    120124    src/ui/vcsendingdialog/vcsendingdialog.cpp \
    121125    src/ui/vcsettings/vcsettings.cpp \
    122126    src/bootstrap.cpp \
    123127    src/main.cpp
    124 FORMS += src/ui/vcabout/vcabout.ui \
     128FORMS += src/ui/contactimporterpages/googlecontactsimporter/gci_page_config.ui \
     129    src/ui/contactimporterpages/oldsettingscontactimporter/osci_page_config.ui \
     130    src/ui/vcabout/vcabout.ui \
    125131    src/ui/vcaccountlist/vcaccountlist.ui \
    126132    src/ui/vcaddressbook/vcaddressbook.ui \
     
    133139    src/ui/vcimportcontacts/vcimportcontacts_page_intro.ui \
    134140    src/ui/vcmain/vcmain.ui \
    135     src/ui/vcoldsettingscontactimporter/page_config.ui \
    136141    src/ui/vcsendingdialog/vcsendingdialog.ui \
    137142    src/ui/vcsettings/vcsettings.ui
  • src/business/bccontactimportermanager.cpp

    r95 r98  
    1919#include "bccontactimportermanager.h"
    2020
    21 #include "bcoldsettingscontactimporter.h"
     21#include "contactimporters/oldsettingscontactimporter.h"
     22#include "contactimporters/googlecontactimporter.h"
    2223
    2324BCContactImporterManager* BCContactImporterManager::instance_=0;
     
    2728
    2829BCContactImporterManager::BCContactImporterManager() {
    29     registerContactImporter(new BCOldSettingsContactImporter);
     30    registerContactImporter(new OldSettingsContactImporter);
     31    registerContactImporter(new GoogleContactImporter);
    3032}
    3133
  • src/ui/vcimportcontacts/vcimportcontacts_page_import.cpp

    r95 r98  
    105105
    106106        QSet<QString> newNames(contactNames);
    107         if (newNames.subtract(existingNames).size() > 0) { // Some names are new
     107        bool someDataDiffers = false;
     108        someDataDiffers     |= newNames.subtract(existingNames).size() > 0;
     109        someDataDiffers     |= existing->image().isNull() && !contact->image().isNull();
     110        if (someDataDiffers) {
    108111            _addImportedContact(new SContact(*existing));
    109112            _addImportedContact(contact);
     
    149152            }
    150153            existing->setAliases(aliases);
     154        }
    151155
    152             if (existing->image().isNull() && !contact->image().isNull()) {
    153                 existing->setImage(contact->image());
    154             }
     156        if (existing->image().isNull() && !contact->image().isNull()) {
     157            existing->setImage(contact->image());
    155158        }
    156159    } else {
     
    178181}
    179182void ImportThread::doImport() {
    180     emit contactsImported(importer_->importContacts());
     183    try {
     184        emit contactsImported(importer_->importContacts());
     185    } catch (...) {
     186        // Don't fail to import from several importers because of one...
     187    }
    181188    quit();
    182189}
Note: See TracChangeset for help on using the changeset viewer.