summaryrefslogtreecommitdiffabout
path: root/libkdepim/phoneaccess.cpp
Side-by-side diff
Diffstat (limited to 'libkdepim/phoneaccess.cpp') (more/less context) (show whitespace changes)
-rw-r--r--libkdepim/phoneaccess.cpp24
1 files changed, 23 insertions, 1 deletions
diff --git a/libkdepim/phoneaccess.cpp b/libkdepim/phoneaccess.cpp
index fe914dd..5fafa1f 100644
--- a/libkdepim/phoneaccess.cpp
+++ b/libkdepim/phoneaccess.cpp
@@ -82,70 +82,92 @@ void PhoneAccess::writeConfig( QString device, QString connection, QString model
}
file.close();
} else {
if ( ! connection.isEmpty() ) {
addConnection = true;
}
if ( ! device.isEmpty() ) {
addPort = true;
}
if ( ! model.isEmpty() ) {
addModel = true;
}
}
if ( addConnection ) {
write = true;
content += "connection = ";
content += connection;
content += "\n";
}
if ( addPort ) {
write = true;
content += "port = ";
content += device;
content += "\n";
}
if ( addModel ) {
write = true;
content += "model = ";
content += model;
content += "\n";
}
if ( write ) {
if (!file.open( IO_WriteOnly ) ) {
qDebug("Error: cannot write file %s ", fileName.latin1() );
return;
}
qDebug("Writing file %s ", fileName.latin1() );
QTextStream ts( &file );
ts << content ;
file.close();
}
}
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("KO/Pi phone access"),i18n("Retry"),i18n("Cancel"));
+ 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 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;
}