summaryrefslogtreecommitdiffabout
path: root/libkdepim/phoneaccess.cpp
Side-by-side diff
Diffstat (limited to 'libkdepim/phoneaccess.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/phoneaccess.cpp69
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
@@ -16,24 +16,25 @@
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <qstring.h>
#include <qapplication.h>
#include <qptrlist.h>
#include <qregexp.h>
#include <qfile.h>
+#include <qlabel.h>
#include <qtextstream.h>
#include <qtextcodec.h>
#include <qdir.h>
#include <kmessagebox.h>
#include <stdlib.h>
#include "phoneaccess.h"
void PhoneAccess::writeConfig( QString device, QString connection, QString model )
{
#ifdef _WIN32_
QString fileName = qApp->applicationDirPath () +"\\gammurc";
#else
@@ -130,44 +131,86 @@ void PhoneAccess::writeConfig( QString device, QString connection, QString model
bool PhoneAccess::writeToPhone( QString fileName)
{
#ifdef DESKTOP_VERSION
#ifdef _WIN32_
QString command ="kammu --restore " + fileName ;
#else
QString command ="./kammu --restore " + fileName ;
#endif
#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;
}
bool PhoneAccess::readFromPhone( QString fileName)
{
#ifdef DESKTOP_VERSION
#ifdef _WIN32_
QString command ="kammu --backup " + fileName + " -yes" ;
#else
QString command ="./kammu --backup " + fileName + " -yes" ;
#endif
#else
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;
}