Changeset 390:538d46794177 in SMSSender


Ignore:
Timestamp:
Apr 30, 2014 2:20:55 PM (5 years ago)
Author:
Sämy Zehnder <saemy.zehnder@…>
Branch:
separation-frontend-backend
Message:
  • Moves gui-code in GoogleContactImporter? from base to the frontend-specific source.
  • Sorts the source definitions in frontend-base.pro.
  • Fixes invalid usage of BaseGoogleContactImporter? usage.
  • Fixes wrong include path in mainstorage_base.cpp.
  • Makes Qt source path in gdbinit more general.
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • .gdbinit

    r133 r390  
    1 dir /usr/src/qt4-x11/src/corelib
    2 dir /usr/src/qt4-x11/src/gui
    3 dir /usr/src/qt4-x11/src/network
    4 dir /usr/src/qt4-x11/src/sql
     1dir /usr/src/qt4/src/corelib
     2dir /usr/src/qt4/src/gui
     3dir /usr/src/qt4/src/network
     4dir /usr/src/qt4/src/sql
     5dir /usr/src/qt4/src/xml
    56
    67define qprint
  • frontend/business/contactimporter/googlecontactimporter_base.cpp

    r382 r390  
    9797                contact->setNumber(number);
    9898
    99                 rx2.setPattern("<gContact:nickname>(.*)</gContact:nickname>");
    100                 if ((rx2.indexIn(entry) != -1) && !rx2.cap(1).isEmpty()) {
    101                     //qDebug() << rx2.cap(1);
    102                     QStringList aliases;
    103                     aliases.append(rx2.cap(1));
    104                     contact->setAliases(aliases);
    105                 }
    106 
    107 #ifdef FRONTEND_GUI
    108                 rx2.setPattern("<link rel='http://schemas.google.com/contacts/2008/rel#photo' type='image/\\*' href='([^']+)' gd:etag='([^']+)'/>");
    109                 if (rx2.indexIn(entry) != -1) {
    110                     QImage img = QImage::fromData(m_httpHelper.syncGet(rx2.cap(1))->readAll());
    111                     if (!img.isNull()) {
    112                         contact->setImage(img);
    113                     }
    114                 }
    115 #endif
     99                parseEntry(entry, contact.data());
    116100
    117101                contacts->insert(contact.take());
     
    121105        }
    122106    }
     107}
     108
     109void BaseGoogleContactImporter::parseEntry(const QString &entry, SContact *contact) {
     110    QRegExp rx("<gContact:nickname>(.*)</gContact:nickname>");
     111    rx.setMinimal(true);
     112
     113    if ((rx.indexIn(entry) != -1) && !rx.cap(1).isEmpty()) {
     114        //qDebug() << rx.cap(1);
     115        QStringList aliases;
     116        aliases.append(rx.cap(1));
     117        contact->setAliases(aliases);
     118    }
     119
    123120}
    124121
     
    147144}
    148145
     146SNetworkHelper *BaseGoogleContactImporter::httpHelper() {
     147    return &m_httpHelper;
     148}
     149
    149150
    150151/********************************** BUILDER ***********************************/
  • frontend/business/contactimporter/googlecontactimporter_base.h

    r382 r390  
    5050    };
    5151
     52protected:
     53    virtual void parseEntry(const QString &entry, SContact *contact);
     54    SNetworkHelper *httpHelper();
     55
    5256private:
    5357    void requestAuthToken();
  • frontend/frontend-base.pro

    r373 r390  
    5454    business/accountmanager.cpp \
    5555    business/contactimporter/contactfilelist.cpp \
     56    business/contactimporter/contactfilesimporter_base.cpp \
    5657    business/contactimporter/contactimporter.cpp \
     58    business/contactimporter/googlecontactimporter_base.cpp \
    5759    business/contactimportermanager.cpp \
    5860    business/contactmanager.cpp \
     
    7779    persistence/persistenceintegrationhelper.cpp \
    7880    persistence/restrictedmainstorage.cpp \
    79     business/contactimporter/googlecontactimporter_base.cpp \
    80     business/contactimporter/contactfilesimporter_base.cpp
    8181
    8282RESOURCES += \
  • frontend/gui/business/googlecontactimporter.cpp

    r324 r390  
    1818#include "googlecontactimporter.h"
    1919
     20#include "common/domain/scontact.h"
     21#include "common/network/snetworkreply.h"
    2022#include "frontend/gui/ui/importcontacts/pages/google_page_config.h"
    2123
     
    2830    pages->append(new UI::GCI::PageConfig(&m_authData));
    2931}
     32
     33void GoogleContactImporter::parseEntry(const QString &entry, SContact *contact) {
     34    BaseGoogleContactImporter::parseEntry(entry, contact);
     35
     36    QRegExp rx("<link rel='http://schemas.google.com/contacts/2008/rel#photo' type='image/\\*' href='([^']+)' gd:etag='([^']+)'/>");
     37    rx.setMinimal(true);
     38    if (rx.indexIn(entry) != -1) {
     39        QImage img =
     40                QImage::fromData(httpHelper()->syncGet(rx.cap(1))->readAll());
     41        if (!img.isNull()) {
     42            contact->setImage(img);
     43        }
     44    }
     45}
  • frontend/gui/business/googlecontactimporter.h

    r320 r390  
    2929        void createPreImportPages(QList<QWizardPage *> *pages);
    3030    };
     31
     32protected:
     33    void parseEntry(const QString &entry, SContact *contact);
    3134};
    3235
  • frontend/gui/ui/importcontacts/pages/google_page_config.cpp

    r320 r390  
    2121namespace GCI {
    2222
    23 PageConfig::PageConfig(BaseGoogleContactImporter::AuthData *authData)
     23PageConfig::PageConfig(GoogleContactImporter::AuthData *authData)
    2424    : QWizardPage()
    2525    , m_authData(authData)
  • frontend/persistence/mainstorage_base.cpp

    r382 r390  
    1616 along with this program.  If not, see <http://www.gnu.org/licenses/>.
    1717 */
    18 #include "frontend/persistence/mainstorage_base.h"
     18#include "mainstorage_base.h"
    1919
    2020#include <QBuffer>
Note: See TracChangeset for help on using the changeset viewer.