summaryrefslogtreecommitdiffabout
path: root/libkdepim
Unidiff
Diffstat (limited to 'libkdepim') (more/less context) (show whitespace changes)
-rw-r--r--libkdepim/phoneaccess.cpp49
1 files changed, 46 insertions, 3 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 @@
25#include <qptrlist.h> 25#include <qptrlist.h>
26#include <qregexp.h> 26#include <qregexp.h>
27#include <qfile.h> 27#include <qfile.h>
28#include <qlabel.h>
28#include <qtextstream.h> 29#include <qtextstream.h>
29#include <qtextcodec.h> 30#include <qtextcodec.h>
30#include <qdir.h> 31#include <qdir.h>
@@ -139,14 +140,34 @@ bool PhoneAccess::writeToPhone( QString fileName)
139#else 140#else
140 QString command ="kammu --restore " + fileName ; 141 QString command ="kammu --restore " + fileName ;
141#endif 142#endif
142 int ret; 143 int ret = 1;
143 while ( (ret = system ( command.latin1())) != 0 ) { 144 while ( ret != 0 ) {
145 QLabel* status = new QLabel( i18n(" This may take 1-3 minutes!"), 0 );
146 int w = 235;
147 int h = status->sizeHint().height()+20 ;
148 int dw = QApplication::desktop()->width();
149 int dh = QApplication::desktop()->height();
150 if ( dw > 310 )
151 w = 310;
152 status->setCaption(i18n("Writing to phone...") );
153 status->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
154 status->show();
155 status->raise();
156 status->update();
157 qApp->processEvents();
158 status->update();
159 qApp->processEvents();
160 ret = system ( command.latin1());
161 delete status;
162 qApp->processEvents();
163 if ( ret ) {
144 qDebug("Error S::command returned %d.", ret); 164 qDebug("Error S::command returned %d.", ret);
145 int retval = KMessageBox::warningContinueCancel(0, 165 int retval = KMessageBox::warningContinueCancel(0,
146 i18n("Error accessing device!\nPlease turn on connection\nand retry!"),i18n("KDE/Pim phone access"),i18n("Retry"),i18n("Cancel")); 166 i18n("Error accessing device!\nPlease turn on connection\nand retry!"),i18n("KDE/Pim phone access"),i18n("Retry"),i18n("Cancel"));
147 if ( retval != KMessageBox::Continue ) 167 if ( retval != KMessageBox::Continue )
148 return false; 168 return false;
149 } 169 }
170 }
150 return true; 171 return true;
151} 172}
152bool PhoneAccess::readFromPhone( QString fileName) 173bool PhoneAccess::readFromPhone( QString fileName)
@@ -162,12 +183,34 @@ bool PhoneAccess::readFromPhone( QString fileName)
162 QString command ="kammu --backup " + fileName + " -yes" ; 183 QString command ="kammu --backup " + fileName + " -yes" ;
163#endif 184#endif
164 int ret; 185 int ret;
165 while ( (ret = system ( command.latin1())) != 0 ) { 186 while ( ret != 0 ) {
187 QLabel* status = new QLabel( i18n(" This may take 1-3 minutes!"), 0 );
188 int w = 235;
189 int h = status->sizeHint().height()+20 ;
190 int dw = QApplication::desktop()->width();
191 int dh = QApplication::desktop()->height();
192 if ( dw > 310 )
193 w = 310;
194 status->setCaption(i18n("Reading from phone...") );
195 status->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
196 status->show();
197 status->raise();
198 status->update();
199 qApp->processEvents();
200 status->update();
201 qApp->processEvents();
202 ret = system ( command.latin1() );
203 delete status;
204 qApp->processEvents();
205 if ( ret ) {
166 qDebug("Error reading from phone:Command returned %d", ret); 206 qDebug("Error reading from phone:Command returned %d", ret);
167 int retval = KMessageBox::warningContinueCancel(0, 207 int retval = KMessageBox::warningContinueCancel(0,
168 i18n("Error accessing device!\nPlease turn on connection\nand retry!"),i18n("KDE/Pim phone access"),i18n("Retry"),i18n("Cancel")); 208 i18n("Error accessing device!\nPlease turn on connection\nand retry!"),i18n("KDE/Pim phone access"),i18n("Retry"),i18n("Cancel"));
169 if ( retval != KMessageBox::Continue ) 209 if ( retval != KMessageBox::Continue )
170 return false; 210 return false;
211
212 }
171 } 213 }
214 qApp->processEvents();
172 return true; 215 return true;
173} 216}