author | zautrix <zautrix> | 2004-10-15 14:26:07 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-15 14:26:07 (UTC) |
commit | 4f276d80bd977401d656851515474cc00c661e5b (patch) (side-by-side diff) | |
tree | 0d3a747bef0431ef791b69876f5bda554f9ca83f /libkdepim | |
parent | c2fb960297c4b08980921c818a4d347057732390 (diff) | |
download | kdepimpi-4f276d80bd977401d656851515474cc00c661e5b.zip kdepimpi-4f276d80bd977401d656851515474cc00c661e5b.tar.gz kdepimpi-4f276d80bd977401d656851515474cc00c661e5b.tar.bz2 |
many phone and sync fixes
-rw-r--r-- | libkdepim/phoneaccess.cpp | 69 |
1 files changed, 56 insertions, 13 deletions
diff --git a/libkdepim/phoneaccess.cpp b/libkdepim/phoneaccess.cpp index 8298aa6..e24ad9e 100644 --- a/libkdepim/phoneaccess.cpp +++ b/libkdepim/phoneaccess.cpp @@ -25,6 +25,7 @@ #include <qptrlist.h> #include <qregexp.h> #include <qfile.h> +#include <qlabel.h> #include <qtextstream.h> #include <qtextcodec.h> #include <qdir.h> @@ -139,13 +140,33 @@ bool PhoneAccess::writeToPhone( QString fileName) #else QString command ="kammu --restore " + fileName ; #endif - int ret; - while ( (ret = system ( command.latin1())) != 0 ) { - qDebug("Error S::command returned %d.", ret); - int retval = KMessageBox::warningContinueCancel(0, - i18n("Error accessing device!\nPlease turn on connection\nand retry!"),i18n("KDE/Pim phone access"),i18n("Retry"),i18n("Cancel")); - if ( retval != KMessageBox::Continue ) - return false; + int ret = 1; + while ( ret != 0 ) { + QLabel* status = new QLabel( i18n(" This may take 1-3 minutes!"), 0 ); + int w = 235; + int h = status->sizeHint().height()+20 ; + int dw = QApplication::desktop()->width(); + int dh = QApplication::desktop()->height(); + if ( dw > 310 ) + w = 310; + status->setCaption(i18n("Writing to phone...") ); + status->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); + status->show(); + status->raise(); + status->update(); + qApp->processEvents(); + status->update(); + qApp->processEvents(); + ret = system ( command.latin1()); + delete status; + qApp->processEvents(); + if ( ret ) { + qDebug("Error S::command returned %d.", ret); + int retval = KMessageBox::warningContinueCancel(0, + i18n("Error accessing device!\nPlease turn on connection\nand retry!"),i18n("KDE/Pim phone access"),i18n("Retry"),i18n("Cancel")); + if ( retval != KMessageBox::Continue ) + return false; + } } return true; } @@ -162,12 +183,34 @@ bool PhoneAccess::readFromPhone( QString fileName) QString command ="kammu --backup " + fileName + " -yes" ; #endif int ret; - while ( (ret = system ( command.latin1())) != 0 ) { - qDebug("Error reading from phone:Command returned %d", ret); - int retval = KMessageBox::warningContinueCancel(0, - i18n("Error accessing device!\nPlease turn on connection\nand retry!"),i18n("KDE/Pim phone access"),i18n("Retry"),i18n("Cancel")); - if ( retval != KMessageBox::Continue ) - return false; + while ( ret != 0 ) { + QLabel* status = new QLabel( i18n(" This may take 1-3 minutes!"), 0 ); + int w = 235; + int h = status->sizeHint().height()+20 ; + int dw = QApplication::desktop()->width(); + int dh = QApplication::desktop()->height(); + if ( dw > 310 ) + w = 310; + status->setCaption(i18n("Reading from phone...") ); + status->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); + status->show(); + status->raise(); + status->update(); + qApp->processEvents(); + status->update(); + qApp->processEvents(); + ret = system ( command.latin1() ); + delete status; + qApp->processEvents(); + if ( ret ) { + qDebug("Error reading from phone:Command returned %d", ret); + int retval = KMessageBox::warningContinueCancel(0, + i18n("Error accessing device!\nPlease turn on connection\nand retry!"),i18n("KDE/Pim phone access"),i18n("Retry"),i18n("Cancel")); + if ( retval != KMessageBox::Continue ) + return false; + + } } + qApp->processEvents(); return true; } |