From 4f276d80bd977401d656851515474cc00c661e5b Mon Sep 17 00:00:00 2001 From: zautrix Date: Fri, 15 Oct 2004 14:26:07 +0000 Subject: many phone and sync fixes --- (limited to 'libkdepim/phoneaccess.cpp') 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 #include #include +#include #include #include #include @@ -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; } -- cgit v0.9.0.2