-rw-r--r-- | gammu/emb/common/gsmstate.h | 2 | ||||
-rw-r--r-- | kaddressbook/kabcore.cpp | 6 | ||||
-rw-r--r-- | libkdepim/phoneaccess.cpp | 12 |
3 files changed, 10 insertions, 10 deletions
diff --git a/gammu/emb/common/gsmstate.h b/gammu/emb/common/gsmstate.h index 2b4806c..f15a6a7 100644 --- a/gammu/emb/common/gsmstate.h +++ b/gammu/emb/common/gsmstate.h @@ -148,33 +148,32 @@ typedef struct _GSM_Reply_Function GSM_Reply_Function; #ifdef DJGPP # undef GSM_ENABLE_IRDADEVICE # undef GSM_ENABLE_IRDAPHONET # undef GSM_ENABLE_IRDAOBEX # undef GSM_ENABLE_IRDAAT # undef GSM_ENABLE_FBUS2IRDA # undef GSM_ENABLE_BLUETOOTHDEVICE # undef GSM_ENABLE_BLUEPHONET # undef GSM_ENABLE_BLUEOBEX # undef GSM_ENABLE_BLUEAT # undef GSM_ENABLE_BLUEFBUS2 # undef GSM_ENABLE_PHONETBLUE # undef GSM_ENABLE_FBUS2BLUE # undef GSM_ENABLE_MROUTERBLUE #endif - #ifndef WIN32 # ifdef ENABLE_LGPL # undef GSM_ENABLE_IRDADEVICE # undef GSM_ENABLE_IRDAPHONET # undef GSM_ENABLE_IRDAOBEX # undef GSM_ENABLE_IRDAAT # undef GSM_ENABLE_FBUS2IRDA # undef GSM_ENABLE_BLUETOOTHDEVICE # undef GSM_ENABLE_BLUEPHONET # undef GSM_ENABLE_BLUEOBEX # undef GSM_ENABLE_BLUEAT # undef GSM_ENABLE_BLUEFBUS2 # undef GSM_ENABLE_PHONETBLUE # undef GSM_ENABLE_FBUS2BLUE # undef GSM_ENABLE_MROUTERBLUE @@ -1564,16 +1563,17 @@ OnePhoneModel *GetModelData (char *model, char *number, char *irdamodel); #ifdef __GNUC__ __attribute__((format(printf, 2, 3))) #endif int smprintf(GSM_StateMachine *s, const char *format, ...); void GSM_OSErrorInfo(GSM_StateMachine *s, char *description); #ifdef GSM_ENABLE_BACKUP void GSM_GetPhoneFeaturesForBackup(GSM_StateMachine *s, GSM_Backup_Info *info); #endif #endif /* How should editor hadle tabs in this file? Add editor commands here. * vim: noexpandtab sw=8 ts=8 sts=8: */ + diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 7bec90a..b014cba 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp @@ -22,32 +22,33 @@ */ /*s Enhanced Version of the file for platform independent KDE tools. Copyright (c) 2004 Ulf Schenk $Id$ */ #include "kabcore.h" #include <stdaddressbook.h> #include <klocale.h> #include <kfiledialog.h> #include <qtimer.h> #include <qlabel.h> +#include <qregexp.h> #include <qlineedit.h> #include <qcheckbox.h> #include <qpushbutton.h> #include <qprogressbar.h> #include <libkdepim/phoneaccess.h> #ifndef KAB_EMBEDDED #include <qclipboard.h> #include <qdir.h> #include <qfile.h> #include <qapplicaton.h> #include <qprogressbar.h> #include <qlayout.h> #include <qregexp.h> #include <qvbox.h> #include <kabc/addresseelist.h> @@ -713,32 +714,37 @@ void KABCore::export2phone() sep = semi ; else sep = dopp; datastream +=vcard.mid( start, next - start); datastream +=vcard.mid( next+5,sep -next -5 ).upper(); start = sep; } datastream += vcard.mid( start,vcard.length() ); } QFile outFile(fileName); if ( outFile.open(IO_WriteOnly) ) { datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); QTextStream t( &outFile ); // use a text stream t.setEncoding( QTextStream::UnicodeUTF8 ); t <<datastream; outFile.close(); + if ( PhoneAccess::writeToPhone( fileName ) ) + qDebug("Export okay "); + else + qDebug("Error export contacts "); + } else { qDebug("Error open temp file "); return; } #if 0 setCaption( i18n("Writing to phone...")); if ( PhoneFormat::writeToPhone( cal ) ) setCaption( i18n("Export to phone successful!")); else setCaption( i18n("Error exporting to phone!")); #endif diff --git a/libkdepim/phoneaccess.cpp b/libkdepim/phoneaccess.cpp index c0bd6cc..357cd39 100644 --- a/libkdepim/phoneaccess.cpp +++ b/libkdepim/phoneaccess.cpp @@ -27,46 +27,46 @@ #include <qfile.h> #include <qtextstream.h> #include <qtextcodec.h> #include <qdir.h> #include <kmessagebox.h> #include <stdlib.h> #include "phoneaccess.h" void PhoneAccess::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; + QString content = "[gammu]\n";; 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" ) { @@ -80,53 +80,47 @@ void PhoneAccess::writeConfig( QString device, QString connection, QString model 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(); } |