author | zautrix <zautrix> | 2004-08-09 16:39:16 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-08-09 16:39:16 (UTC) |
commit | e1909ade2188e53feee65089d5f2882563876c58 (patch) (side-by-side diff) | |
tree | f812864838ff03b2758a27dd3fd77504a8295474 | |
parent | ecdcad49975976ff877ff506fae3b14934c01898 (diff) | |
download | kdepimpi-e1909ade2188e53feee65089d5f2882563876c58.zip kdepimpi-e1909ade2188e53feee65089d5f2882563876c58.tar.gz kdepimpi-e1909ade2188e53feee65089d5f2882563876c58.tar.bz2 |
added status info
-rw-r--r-- | libkcal/phoneformat.cpp | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/libkcal/phoneformat.cpp b/libkcal/phoneformat.cpp index e43a507..11c68c5 100644 --- a/libkcal/phoneformat.cpp +++ b/libkcal/phoneformat.cpp @@ -765,16 +765,27 @@ ulong PhoneFormat::getCsum( const QStringList & attList) #define DEBUGMODE false bool PhoneFormat::load( Calendar *calendar, Calendar *existingCal) { GSM_StateMachine s; qDebug(" load "); s.opened = false; s.msg = NULL; s.ConfigNum = 0; + QLabel status ( i18n("Reading data. Opening device ..."), 0 ); + int w = status.sizeHint().width()+20 ; + if ( w < 200 ) w = 200; + int h = status.sizeHint().height()+20 ; + int dw = QApplication::desktop()->width(); + int dh = QApplication::desktop()->height(); + status.setCaption(i18n("Reading Phone Data") ); + status.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); + status.show(); + status.raise(); + qApp->processEvents(); #if 0 static char *cp; static INI_Section *cfg = NULL; cfg=GSM_FindGammuRC(); int i; for (i = 0; i <= MAX_CONFIG_NUM; i++) { if (cfg!=NULL) { cp = (char *)INI_GetValue(cfg, (unsigned char*) "gammu", (unsigned char*)"gammucoding", false); @@ -819,30 +830,37 @@ bool PhoneFormat::load( Calendar *calendar, Calendar *existingCal) return false; GSM_Phone_Functions *Phone; GSM_CalendarEntry note; bool start = true; Phone=s.Phone.Functions; bool gshutdown = false; PhoneParser handler( calendar, mProfileName ); int ccc = 0; + QString message = i18n("Processing event # "); + int procCount = 0; qDebug("Debug: only 10 calender items are downloaded "); while (!gshutdown && ccc++ < 10) { - + status.setText ( message + QString::number ( ++procCount ) ); + qApp->processEvents(); qDebug("readEvent %d ", ccc); error=Phone->GetNextCalendar(&s,¬e,start); if (error == ERR_EMPTY) break; start = false; handler.readEvent( existingCal, ¬e ); } start = true; GSM_ToDoEntry ToDo; ccc = 0; + message = i18n("Processing todo # "); + procCount = 0; while (!gshutdown) { + status.setText ( message + QString::number ( ++procCount ) ); + qApp->processEvents(); error = Phone->GetNextToDo(&s, &ToDo, start); if (error == ERR_EMPTY) break; start = false; qDebug("ReadTodo %d ", ++ccc); handler.readTodo( existingCal, &ToDo, &s); } @@ -925,17 +943,17 @@ bool PhoneFormat::save( Calendar *calendar) s.msg = NULL; s.ConfigNum = 0; QLabel status ( i18n("Writing data. Opening device ..."), 0 ); int w = status.sizeHint().width()+20 ; if ( w < 200 ) w = 200; int h = status.sizeHint().height()+20 ; int dw = QApplication::desktop()->width(); int dh = QApplication::desktop()->height(); - status.setCaption(i18n("Writing DTM Data") ); + status.setCaption(i18n("Writing Phone Data") ); status.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); status.show(); status.raise(); qApp->processEvents(); int error=initDevice(&s); qDebug("GSM Init %d (no error is %d)", error, ERR_NONE); if ( error != ERR_NONE ) @@ -977,16 +995,17 @@ bool PhoneFormat::save( Calendar *calendar) status.setText ( message + QString::number ( ++procCount ) ); qApp->processEvents(); //int newID ;//= pending //ev->setID(mProfileName, QString::number( newID )); event2GSM( ev, &Note ); Note.Location = 0; error = Phone->AddCalendar(&s, &Note); ev->setID( mProfileName, QString::number( Note.Location ) ); + qDebug("New Calendar. Location %d ",Note.Location ); afterSave( ev ); } else { afterSave( ev ); // setting temp sync stat for changed items } } ev = er.next(); } GSM_ToDoEntry ToDoEntry; @@ -1002,17 +1021,17 @@ bool PhoneFormat::save( Calendar *calendar) todo2GSM( to, &ToDoEntry ); if ( to->tempSyncStat() == SYNC_TEMPSTATE_DELETE ) { // delete error=Phone->DeleteToDo(&s,&ToDoEntry); } else if ( to->getID("Sharp_DTM").isEmpty() ) { // add new ; } else { // change existing - error=Phone->AddToDo(&s,&ToDoEntry); + error=Phone->SetToDo(&s,&ToDoEntry); } } to = tl.next(); } // pending get empty slots to = tl.first(); while ( to ) { |