author | zautrix <zautrix> | 2004-10-06 00:33:20 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-06 00:33:20 (UTC) |
commit | 07fa092b413b7cde1bd4fc797ce0b30adcb8668d (patch) (side-by-side diff) | |
tree | 34b54fe692412be32d26bd85dbbb77bafcfe8efa /libkcal | |
parent | 191ced43b27c047b0a39f0acdc8ba1f8a58817df (diff) | |
download | kdepimpi-07fa092b413b7cde1bd4fc797ce0b30adcb8668d.zip kdepimpi-07fa092b413b7cde1bd4fc797ce0b30adcb8668d.tar.gz kdepimpi-07fa092b413b7cde1bd4fc797ce0b30adcb8668d.tar.bz2 |
export to phone added
-rw-r--r-- | libkcal/phoneformat.cpp | 68 | ||||
-rw-r--r-- | libkcal/phoneformat.h | 2 |
2 files changed, 44 insertions, 26 deletions
diff --git a/libkcal/phoneformat.cpp b/libkcal/phoneformat.cpp index 29c1ae6..b2a62b1 100644 --- a/libkcal/phoneformat.cpp +++ b/libkcal/phoneformat.cpp @@ -85,6 +85,17 @@ 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 ); QString content; @@ -177,8 +188,5 @@ PhoneFormat::PhoneFormat(QString profileName, QString device,QString connection, file.close(); } -} -PhoneFormat::~PhoneFormat() -{ } #if 0 @@ -570,4 +578,33 @@ 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) { @@ -584,9 +621,4 @@ bool PhoneFormat::save( Calendar *calendar) qApp->processEvents(); QString message; -#ifdef _WIN32_ - QString fileName = locateLocal("tmp", "tempfile.vcs"); -#else - QString fileName = "/tmp/kdepimtemp.vcs"; -#endif // 1 remove events which should be deleted @@ -615,22 +647,6 @@ bool PhoneFormat::save( Calendar *calendar) } // 3 save file - VCalFormat vfsave; - vfsave.setLocalTime ( true ); - if ( ! vfsave.save( calendar, fileName ) ) + if ( !writeToPhone( calendar ) ) 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 ) - return false; - } // 5 reread data diff --git a/libkcal/phoneformat.h b/libkcal/phoneformat.h index 2d1ff79..61e8160 100644 --- a/libkcal/phoneformat.h +++ b/libkcal/phoneformat.h @@ -49,4 +49,6 @@ class PhoneFormat : public QObject { static ulong getCsumTodo( Todo* to ); static ulong getCsumEvent( Event* ev ); + static void writeConfig( QString device,QString connection, QString model ); + static bool writeToPhone( Calendar * ); private: void copyEvent( Event* to, Event* from ); |