-rw-r--r-- | kaddressbook/kabcore.cpp | 32 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 5 | ||||
-rw-r--r-- | libkcal/libkcal.pro | 2 | ||||
-rw-r--r-- | libkcal/libkcalE.pro | 2 | ||||
-rw-r--r-- | libkcal/phoneformat.cpp | 117 | ||||
-rw-r--r-- | libkcal/phoneformat.h | 1 |
6 files changed, 22 insertions, 137 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 185cf46..7bec90a 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp @@ -23,3 +23,3 @@ -/* +/*s Enhanced Version of the file for platform independent KDE tools. @@ -41,2 +41,3 @@ $Id$ #include <qprogressbar.h> +#include <libkdepim/phoneaccess.h> @@ -675,4 +676,4 @@ void KABCore::export2phone() -#if 0 - PhoneFormat::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, + + PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, KPimGlobalPrefs::instance()->mEx2PhoneConnection, @@ -680,12 +681,12 @@ void KABCore::export2phone() + QStringList uids = mViewManager->selectedUids(); + if ( uids.isEmpty() ) + return; +#ifdef _WIN32_ + QString fileName = locateLocal("tmp", "tempfile.vcf"); +#else + QString fileName = "/tmp/kdepimtemp.vcf"; +#endif - - - QString fileName = "/tmp/kapibeamfile.vcf"; - - - //QDir().mkdir( dirName, true ); - - KABC::VCardConverter converter; @@ -720,3 +721,2 @@ void KABCore::export2phone() } -#ifndef DESKTOP_VERSION QFile outFile(fileName); @@ -728,13 +728,9 @@ void KABCore::export2phone() outFile.close(); - Ir *ir = new Ir( this ); - connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); - ir->send( fileName, description, "text/x-vCard" ); } else { - qDebug("Error open temp beam file "); + qDebug("Error open temp file "); return; } -#endif - +#if 0 diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 2f286e0..ec69b11 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp @@ -41,2 +41,3 @@ #include <libkdepim/ksyncprofile.h> +#include <libkdepim/phoneaccess.h> #include <libkcal/kincidenceformatter.h> @@ -1234,4 +1235,4 @@ void MainWindow::exportToPhone( int mode ) incidence = delSel.next(); - } - PhoneFormat::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, + } + PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, KPimGlobalPrefs::instance()->mEx2PhoneConnection, diff --git a/libkcal/libkcal.pro b/libkcal/libkcal.pro index 7a0bd22..171c726 100644 --- a/libkcal/libkcal.pro +++ b/libkcal/libkcal.pro @@ -6,3 +6,3 @@ include( ../variables.pri ) -INCLUDEPATH += ../microkde versit ../microkde/kdecore +INCLUDEPATH += ../libkdepim ../microkde versit ../microkde/kdecore #../qtcompat diff --git a/libkcal/libkcalE.pro b/libkcal/libkcalE.pro index e379b95..e42dc9c 100644 --- a/libkcal/libkcalE.pro +++ b/libkcal/libkcalE.pro @@ -4,3 +4,3 @@ TARGET = komicrokcal -INCLUDEPATH += ../microkde ../qtcompat versit ../microkde/kdecore $(QPEDIR)/include +INCLUDEPATH += ../libkdepim ../microkde ../qtcompat versit ../microkde/kdecore $(QPEDIR)/include INCLUDEPATH += ../libical/src/libical diff --git a/libkcal/phoneformat.cpp b/libkcal/phoneformat.cpp index b2a62b1..c39413e 100644 --- a/libkcal/phoneformat.cpp +++ b/libkcal/phoneformat.cpp @@ -38,2 +38,3 @@ #include <kmessagebox.h> +#include <phoneaccess.h> @@ -86,3 +87,3 @@ PhoneFormat::PhoneFormat(QString profileName, QString device,QString connection, mProfileName = profileName; - writeConfig( device, connection, model ); + PhoneAccess::writeConfig( device, connection, model ); } @@ -92,101 +93,3 @@ 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; - bool write = false; - bool addPort = true, addConnection = true, addModel = true; - QFile file( fileName ); - if ( QFile::exists( fileName) ) { - if (!file.open( IO_ReadOnly ) ) { - qDebug("Error: cannot open %s ", fileName.latin1() ); - return; - } - QString line; - while ( file.readLine( line, 1024 ) > 0 ) { - //qDebug("*%s* ", line.latin1() ); - if ( line.left(7 ) == "[gammu]" ) { - ; - } else - if ( line.left(4 ) == "port" ) { - if ( line == "port = " + device+"\n" ) { - content += line ; - addPort = false; - //qDebug("port found" ); - } - - } else if ( line.left(5 ) == "model" ) { - if ( line == "model = " + model +"\n") { - content += line ; - addModel = false; - //qDebug("model found" ); - } - - } else if ( line.left( 10 ) == "connection" ) { - if ( line == "connection = " + connection +"\n") { - addConnection = false; - content += line ; - //qDebug("con found" ); - } - - } else { - content += line ; - } - } - file.close(); - } else { - if ( ! connection.isEmpty() ) { - addConnection = true; - } - if ( ! device.isEmpty() ) { - addPort = true; - } - if ( ! model.isEmpty() ) { - addModel = true; - } - } - - if ( addConnection ) { - if ( ! write ) - content += "[gammu]\n"; - write = true; - content += "connection = "; - content += connection; - content += "\n"; - } - if ( addPort ) { - if ( ! write ) - content += "[gammu]\n"; - write = true; - content += "port = "; - content += device; - content += "\n"; - - } - if ( addModel ) { - if ( ! write ) - content += "[gammu]\n"; - 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(); - } - -} #if 0 @@ -592,17 +495,3 @@ bool PhoneFormat::writeToPhone( Calendar * 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 access"),i18n("Retry"),i18n("Cancel")); - if ( retval != KMessageBox::Continue ) - return false; - } - return true; + return PhoneAccess::writeToPhone( fileName ); } diff --git a/libkcal/phoneformat.h b/libkcal/phoneformat.h index 61e8160..001fd81 100644 --- a/libkcal/phoneformat.h +++ b/libkcal/phoneformat.h @@ -50,3 +50,2 @@ class PhoneFormat : public QObject { static ulong getCsumEvent( Event* ev ); - static void writeConfig( QString device,QString connection, QString model ); static bool writeToPhone( Calendar * ); |