[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-08-02 10:49:33
Message-ID: 1122979773.129468.15338.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 442332 by gulino:

Faster phonebook import algorithm

 M  +14 -4     phonebook_jobs.cpp  


--- trunk/kdenonbeta/kmobiletools/kmobiletools/engines/at_engine/phonebook_jobs.cpp \
#442331:442332 @@ -259,20 +259,30 @@
 {
     QValueListIterator<KABC::Addressee> it;
     KABC::Addressee *addressee;
-    int startpoint=0;
+    int maxPBSlots=engine->availPbSlots()+1;
+    kdDebug() << "Max phonebook slot number: " << maxPBSlots << endl;
+    int *startpoints=new int[ maxPBSlots ];
+    for ( int i=0; i<maxPBSlots; i++) startpoints[i]=0;
+    int curmemslot=0;
     for ( it = p_abclist->begin(); it != p_abclist->end(); ++it )
     {
+        curmemslot=(*it).custom("KMobileTools","memslot").toInt();
+        kdDebug() << "StartPoint: " << startpoints[curmemslot] << endl;
         kdDebug() << (*it).formattedName() << endl;
         addressee=new KABC::Addressee(*it);
         kdDebug() << addressee->formattedName() << endl;
-        kdDebug() << addressee->assembledName() << endl;
-        startpoint=addAddressee(addressee, startpoint)+1;
-        kdDebug() << startpoint << endl;
+        startpoints[curmemslot]=addAddressee(addressee, startpoints[curmemslot] )+1;
+        kdDebug() << "New StartPoint: " << startpoints[curmemslot] << endl;
+        QString dbg=QString::null;
+        for ( int i=0; i<maxPBSlots; i++) \
dbg+=QString::number(i).append("=").append(QString::number(startpoints[i]) \
).append("; "); +        kdDebug() << dbg << endl;
     }
+    delete [] startpoints;
 }
 
 int AddAddressee::findFreeIndex(int startpoint)
 {
+    kdDebug() << "FindIndexStartPoint" << startpoint << endl;
     QString buffer=p_device->sendCommand("AT+CPBR=?\r");
     if ( CMDERROR ) return 0;
     QRegExp expr("^[+]CPBR:\\s?\\(?(\\d*)-(\\d*)\\)?.*$");


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

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