[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdenonbeta/kmobiletools/kmobiletools/engines/at_engine
From:       Marco Gulino <marco () kmobiletools ! org>
Date:       2005-07-22 20:21:18
Message-ID: 1122063678.266923.27929.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 437706 by gulino:

Reorganizing jobs

 M  +2 -2      Makefile.am  
 M  +0 -132    at_jobs.cpp  
 M  +3 -24     at_jobs.h  
 M  +1 -0      kmobiletoolsat_engine.h  
 A             phonebook_jobs.cpp   [License: UNKNOWN]
 A             phonebook_jobs.h   [License: UNKNOWN]


--- trunk/kdenonbeta/kmobiletools/kmobiletools/engines/at_engine/Makefile.am \
#437705:437706 @@ -5,8 +5,8 @@
 libkmobiletools_at_la_LDFLAGS = -avoid-version -module -no-undefined \
 	$(all_libraries)
 libkmobiletools_at_la_SOURCES = device.cpp kmobiletoolsat_engine.cpp \
-	at_jobs.cpp atabilities.cpp
+		at_jobs.cpp atabilities.cpp phonebook_jobs.cpp
 noinst_HEADERS = device.h kmobiletoolsat_engine.h at_jobs.h sms_defs.h \
-	atabilities.h
+		atabilities.h phonebook_jobs.h
 libkmobiletools_at_la_LIBADD = \
 	$(top_builddir)/kmobiletools/kmobiletools/libkmobiletoolsprivate/libkmobiletoolsprivate.la \
                $(LIB_KABC) $(LIB_KDECORE)
--- trunk/kdenonbeta/kmobiletools/kmobiletools/engines/at_engine/at_jobs.cpp \
#437705:437706 @@ -18,10 +18,8 @@
 #include <unistd.h>
 #include <qstringlist.h>
 #include <qdatetime.h>
-#include <kabc/vcardconverter.h>
 #include "kmobiletoolsat_engine.h"
 
-#define CMDERROR (buffer==QString::null || buffer=="ERROR")
 #define odd(a) ( a % 2 == 1 )
 #define even(a) ( a % 2 == 0 )
 
@@ -294,102 +292,6 @@
     }
 }
 
-FetchAddressee::FetchAddressee(Device *device, kmobiletoolsAT_engine* parent, const \
                char* name) : kmobiletoolsATJob(device, parent, name){}
-
-void FetchAddressee::run()
-{
-    QString buffer, temp;
-
-    // Enumerate entries
-    buffer = p_device->sendCommand( "AT+CPBR=?\r" );
-    if ( CMDERROR ) return;
-
-    // Format buffer
-    QStringList list = formatBuffer( buffer );
-    if ( list.count()!=1 && !list[0].startsWith( "+CPBR:" ) ) return;
-
-    // Get List
-    temp = list[0].remove( '(' ).remove( ')' ).replace( '-', ',' );
-    list = kmobiletoolsATJob::parseList( temp );
-
-    int leftIndex = list[0].toInt();
-    int rightIndex = list[1].toInt();
-    QRegExp expr;
-    // Request entries
-    if ( engine->getATAbilities().isMotorola() )
-    {
-        buffer= p_device->sendCommand( "AT+MPBR="+QString::number(leftIndex) + "," + \
                QString::number(rightIndex) + "\r" , 300);
-        expr.setPattern( \
                "^[+]MPBR:\\s*\\d+,+\"?([^\"]*)\"?,+\\d+,+\"?([^\"]*)\"?,+(\\d).*$" \
                );
-    }
-    else
-    {
-        buffer= p_device->sendCommand( "AT+CPBR="+QString::number(leftIndex) + "," + \
                QString::number(rightIndex) + "\r" , 300);
-        expr.setPattern( "^[+]CPBR:\\s*\\d+,+\"?([^\"]*)\"?,+\\d+,+\"?([^\"]*)\"?$" \
                );
-    }
-    if ( CMDERROR ) return;
-
-    // get a nice QStringList
-    QStringList tempbuffer = kmobiletoolsATJob::formatBuffer( buffer );
-
-    // Regular expression for response
-    bool new_addr=true;
-    int PhoneType=KABC::PhoneNumber::Cell;
-    KABC::Addressee *addr=NULL;
-    KABC::Addressee *tempaddr=NULL;
-    QString givenName;
-    kdDebug() << expr.pattern() << endl;
-    for ( uint i=0; i<tempbuffer.count(); i++ )
-    {
-        if ( expr.search(tempbuffer[i])<0 ) break;
-        addr=NULL;
-        new_addr=true;
-        PhoneType=KABC::PhoneNumber::Cell;
-        addr=NULL;
-        tempaddr=NULL;
-        givenName=decodeString( expr.cap( 2 ) );
-        if( engine->getATAbilities().isSonyEricsson() )
-        {
-           QString  type=givenName.mid(givenName.findRev('/') + 1);
-            givenName=givenName.left(givenName.findRev('/'));
-            if(type=="W") PhoneType=KABC::PhoneNumber::Work;
-            if(type=="M") PhoneType=KABC::PhoneNumber::Cell;
-            if(type=="H") PhoneType=KABC::PhoneNumber::Home;
-            if(type=="F") PhoneType=KABC::PhoneNumber::Fax;
-            if(type=="O") PhoneType=KABC::PhoneNumber::Voice;
-        }
-        if ( engine->getATAbilities().isMotorola() )
-        {
-            int type=decodeString( expr.cap( 3 ) ).toInt();
-            if(type == 0 ) PhoneType=KABC::PhoneNumber::Work;
-            if(type == 1 ) PhoneType=KABC::PhoneNumber::Home;
-            if(type == 2 ) PhoneType=KABC::PhoneNumber::Pref;
-            if(type == 3 ) PhoneType=KABC::PhoneNumber::Cell;
-            if(type == 4 ) PhoneType=KABC::PhoneNumber::Fax;
-            if(type == 5 ) PhoneType=KABC::PhoneNumber::Pager;
-            if(type == 6 ) PhoneType=KABC::PhoneNumber::Msg;
-            if(type == 7 ) PhoneType=KABC::PhoneNumber::Msg;
-        }
-        QPtrListIterator<KABC::Addressee> it(addresseeList);
-        while ( (tempaddr=it.current() ) != 0)
-        {
-            ++it;
-            if(tempaddr->givenName() == givenName) 
-            {
-                addr=tempaddr;
-                new_addr=false;
-            }
-        }
-
-        if(!addr) addr = new KABC::Addressee();
-        addr->insertPhoneNumber( KABC::PhoneNumber( expr.cap( 1 ), PhoneType ) );
-        addr->setGivenName( givenName );
-        if(new_addr)  addresseeList.append( addr );
-        kdDebug() << "new addressee!" << addr->assembledName() << endl;
-
-        buffer = buffer.remove( expr.pos(), expr.matchedLength() );
-    }
-}
-
 /*
  * class UpdateSMS
  */
@@ -478,41 +380,7 @@
     engine->setATAbilities( abilities );
 }
 
-/*
- * class FetchAddresseeSiemens
- * Description:
- * Fetches the Siemens phone book.
- *
- * TODO: smarter parsing
- */
 
-
-FetchAddresseeSiemens::FetchAddresseeSiemens(Device *device, kmobiletoolsAT_engine* \
                parent, const char* name) : FetchAddressee( device, parent, name ){}
-
-void FetchAddresseeSiemens::run()
-{
-    QString buffer;
-    KABC::VCardConverter converter;
-
-    uint index = 0;
-    while ( 1 )
-    {
-        buffer = p_device->sendCommand( "AT^SBNR=vcf,"+QString::number(index)+"\r" \
                );
-        if ( CMDERROR ) break;
-        QStringList tempbuffer = kmobiletoolsATJob::formatBuffer( buffer );
-
-        buffer.truncate( 0 );
-        for ( uint i=1; i<tempbuffer.count(); i += 2 )
-            buffer.append( tempbuffer[i] );
-        buffer = Device::decodePDU( buffer );
-
-        addresseeList.append( new KABC::Addressee( converter.parseVCard( buffer ) ) \
                );
-        kdDebug() << buffer << endl;
-
-        index++;
-    }
-}
-
 /*
  * class ATSMS
  * Description:
--- trunk/kdenonbeta/kmobiletools/kmobiletools/engines/at_engine/at_jobs.h \
#437705:437706 @@ -22,6 +22,9 @@
 #include <qptrvector.h>
 #include "atabilities.h"
 
+#define CMDERROR (buffer==QString::null || buffer=="ERROR")
+
+
 class Device;
 class QStringList;
 class kmobiletoolsAT_engine;
@@ -154,30 +157,6 @@
         void run ();
 };
 
-class FetchAddressee : public kmobiletoolsATJob
-{
-    public:
-        FetchAddressee(Device *device, kmobiletoolsAT_engine* parent = 0 , const \
                char* name = 0);
-        int type()            { return kmobiletoolsEngine::fetchAddressBook; }
-        QPtrList<KABC::Addressee> addresseeList;
-    protected:
-        void run ();
-};
-
-/*
- * class FetchAddresseeSiemens
- * Description:
- * Fetches the Siemens phone book.
- */
-
-class FetchAddresseeSiemens : public FetchAddressee
-{
-    public:
-        FetchAddresseeSiemens(Device *device, kmobiletoolsAT_engine* parent = 0 , \
                const char* name = 0);
-    protected:
-        void run ();
-};
-
 /** \brief Some special attributes for the SMS class.
  */
 class ATSMS : public SMS
--- trunk/kdenonbeta/kmobiletools/kmobiletools/engines/at_engine/kmobiletoolsat_engine.h \
#437705:437706 @@ -16,6 +16,7 @@
 #include <kmobiletoolsengine.h>
 
 #include "at_jobs.h"
+#include "phonebook_jobs.h"
 class Device;
 class ATAbilities;
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic