summaryrefslogtreecommitdiffabout
path: root/libkcal
Side-by-side diff
Diffstat (limited to 'libkcal') (more/less context) (show whitespace changes)
-rw-r--r--libkcal/phoneformat.cpp66
-rw-r--r--libkcal/phoneformat.h2
2 files changed, 43 insertions, 25 deletions
diff --git a/libkcal/phoneformat.cpp b/libkcal/phoneformat.cpp
index 29c1ae6..b2a62b1 100644
--- a/libkcal/phoneformat.cpp
+++ b/libkcal/phoneformat.cpp
@@ -86,4 +86,15 @@ PhoneFormat::PhoneFormat(QString profileName, QString device,QString connection,
mProfileName = profileName;
+ writeConfig( device, connection, model );
+}
+PhoneFormat::~PhoneFormat()
+{
+}
+void PhoneFormat::writeConfig( QString device, QString connection, QString model )
+{
+#ifdef _WIN32_
+ QString fileName = qApp->applicationDirPath () +"\\gammurc";
+#else
QString fileName = QDir::homeDirPath() +"/.gammurc";
+#endif
//qDebug("save %d ", load );
@@ -178,6 +189,3 @@ PhoneFormat::PhoneFormat(QString profileName, QString device,QString connection,
}
-}
-PhoneFormat::~PhoneFormat()
-{
}
@@ -571,2 +579,31 @@ void PhoneFormat::afterSave( Incidence* inc)
}
+
+bool PhoneFormat::writeToPhone( Calendar * calendar)
+{
+#ifdef _WIN32_
+ QString fileName = locateLocal("tmp", "tempfile.vcs");
+#else
+ QString fileName = "/tmp/kdepimtemp.vcs";
+#endif
+
+ VCalFormat vfsave;
+ vfsave.setLocalTime ( true );
+ if ( ! vfsave.save( calendar, fileName ) )
+ return false;
+ // 4 call kammu
+#ifdef DESKTOP_VERSION
+ QString command ="./kammu --restore " + fileName ;
+#else
+ QString command ="kammu --restore " + fileName ;
+#endif
+ int ret;
+ while ( (ret = system ( command.latin1())) != 0 ) {
+ qDebug("Error S::command returned %d. asking users", 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"));
+ if ( retval != KMessageBox::Continue )
+ return false;
+ }
+ return true;
+}
bool PhoneFormat::save( Calendar *calendar)
@@ -585,7 +622,2 @@ bool PhoneFormat::save( Calendar *calendar)
QString message;
-#ifdef _WIN32_
- QString fileName = locateLocal("tmp", "tempfile.vcs");
-#else
- QString fileName = "/tmp/kdepimtemp.vcs";
-#endif
@@ -616,20 +648,4 @@ bool PhoneFormat::save( Calendar *calendar)
// 3 save file
- VCalFormat vfsave;
- vfsave.setLocalTime ( true );
- if ( ! vfsave.save( calendar, fileName ) )
- return false;
- // 4 call kammu
-#ifdef DESKTOP_VERSION
- QString command ="./kammu --restore " + fileName ;
-#else
- QString command ="kammu --restore " + fileName ;
-#endif
- int ret;
- while ( (ret = system ( command.latin1())) != 0 ) {
- qDebug("Error S::command returned %d. asking users", ret);
- int retval = KMessageBox::warningContinueCancel(0,
- i18n("Error accessing device!\nPlease turn on connection\nand retry!"),i18n("KO/Pi phone sync"),i18n("Retry"),i18n("Cancel"));
- if ( retval != KMessageBox::Continue )
+ if ( !writeToPhone( calendar ) )
return false;
- }
diff --git a/libkcal/phoneformat.h b/libkcal/phoneformat.h
index 2d1ff79..61e8160 100644
--- a/libkcal/phoneformat.h
+++ b/libkcal/phoneformat.h
@@ -50,2 +50,4 @@ class PhoneFormat : public QObject {
static ulong getCsumEvent( Event* ev );
+ static void writeConfig( QString device,QString connection, QString model );
+ static bool writeToPhone( Calendar * );
private: