summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp143
-rw-r--r--kaddressbook/kabcore.h2
-rw-r--r--korganizer/koprefs.cpp4
-rw-r--r--korganizer/koprefs.h3
-rw-r--r--korganizer/mainwindow.cpp25
-rw-r--r--libkdepim/kpimglobalprefs.cpp7
-rw-r--r--libkdepim/kpimglobalprefs.h3
-rw-r--r--libkdepim/libkdepim.pro6
-rw-r--r--libkdepim/libkdepimE.pro6
-rw-r--r--libkdepim/phoneaccess.cpp153
-rw-r--r--libkdepim/phoneaccess.h42
11 files changed, 371 insertions, 23 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index f8359de..185cf46 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -31,12 +31,16 @@ $Id$
31#include "kabcore.h" 31#include "kabcore.h"
32 32
33#include <stdaddressbook.h> 33#include <stdaddressbook.h>
34#include <klocale.h> 34#include <klocale.h>
35#include <kfiledialog.h> 35#include <kfiledialog.h>
36#include <qtimer.h> 36#include <qtimer.h>
37#include <qlabel.h>
38#include <qlineedit.h>
39#include <qcheckbox.h>
40#include <qpushbutton.h>
37#include <qprogressbar.h> 41#include <qprogressbar.h>
38 42
39#ifndef KAB_EMBEDDED 43#ifndef KAB_EMBEDDED
40#include <qclipboard.h> 44#include <qclipboard.h>
41#include <qdir.h> 45#include <qdir.h>
42#include <qfile.h> 46#include <qfile.h>
@@ -150,12 +154,56 @@ $Id$
150#include <unistd.h> 154#include <unistd.h>
151#endif 155#endif
152// sync includes 156// sync includes
153#include <libkdepim/ksyncprofile.h> 157#include <libkdepim/ksyncprofile.h>
154#include <libkdepim/ksyncprefsdialog.h> 158#include <libkdepim/ksyncprefsdialog.h>
155 159
160class KAex2phonePrefs : public QDialog
161{
162 public:
163 KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) :
164 QDialog( parent, name, true )
165 {
166 setCaption( i18n("Export to phone options") );
167 QVBoxLayout* lay = new QVBoxLayout( this );
168 lay->setSpacing( 3 );
169 lay->setMargin( 3 );
170 QLabel *lab;
171 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) );
172 lab->setAlignment (AlignHCenter );
173 QHBox* temphb;
174 temphb = new QHBox( this );
175 new QLabel( i18n("I/O device: "), temphb );
176 mPhoneDevice = new QLineEdit( temphb);
177 lay->addWidget( temphb );
178 temphb = new QHBox( this );
179 new QLabel( i18n("Connection: "), temphb );
180 mPhoneConnection = new QLineEdit( temphb);
181 lay->addWidget( temphb );
182 temphb = new QHBox( this );
183 new QLabel( i18n("Model(opt.): "), temphb );
184 mPhoneModel = new QLineEdit( temphb);
185 lay->addWidget( temphb );
186 mWriteToSim= new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this );
187 lay->addWidget( mWriteToSim );
188 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) );
189 lab->setAlignment (AlignHCenter );
190 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
191 lay->addWidget( ok );
192 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
193 lay->addWidget( cancel );
194 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
195 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
196 resize( 220, 240 );
197
198 }
199
200public:
201 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
202 QCheckBox* mWriteToSim;
203};
156 204
157bool pasteWithNewUid = true; 205bool pasteWithNewUid = true;
158 206
159#ifdef KAB_EMBEDDED 207#ifdef KAB_EMBEDDED
160KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) 208KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name )
161 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), 209 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ),
@@ -507,12 +555,13 @@ void KABCore::setContactSelected( const QString &uid )
507 //if (mActionBeam) 555 //if (mActionBeam)
508 //mActionBeam->setEnabled( selected ); 556 //mActionBeam->setEnabled( selected );
509 557
510 if (mActionBeamVCard) 558 if (mActionBeamVCard)
511 mActionBeamVCard->setEnabled( selected ); 559 mActionBeamVCard->setEnabled( selected );
512 560
561 mActionExport2phone->setEnabled( selected );
513 mActionWhoAmI->setEnabled( selected ); 562 mActionWhoAmI->setEnabled( selected );
514 mActionCategories->setEnabled( selected ); 563 mActionCategories->setEnabled( selected );
515} 564}
516 565
517void KABCore::sendMail() 566void KABCore::sendMail()
518{ 567{
@@ -606,12 +655,101 @@ void KABCore::beamMySelf()
606 KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); 655 KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) );
607 656
608 657
609 } 658 }
610} 659}
611 660
661void KABCore::export2phone()
662{
663
664 KAex2phonePrefs ex2phone;
665 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
666 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
667 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
668
669 if ( !ex2phone.exec() ) {
670 return;
671 }
672 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
673 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
674 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
675
676#if 0
677 PhoneFormat::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
678 KPimGlobalPrefs::instance()->mEx2PhoneConnection,
679 KPimGlobalPrefs::instance()->mEx2PhoneModel );
680
681
682
683
684
685 QString fileName = "/tmp/kapibeamfile.vcf";
686
687
688 //QDir().mkdir( dirName, true );
689
690
691 KABC::VCardConverter converter;
692 QString description;
693 QString datastream;
694 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
695 KABC::Addressee a = mAddressBook->findByUid( *it );
696
697 if ( a.isEmpty() )
698 continue;
699
700 if (description.isEmpty())
701 description = a.formattedName();
702
703 QString vcard;
704 converter.addresseeToVCard( a, vcard );
705 int start = 0;
706 int next;
707 while ( (next = vcard.find("TYPE=", start) )>= 0 ) {
708 int semi = vcard.find(";", next);
709 int dopp = vcard.find(":", next);
710 int sep;
711 if ( semi < dopp && semi >= 0 )
712 sep = semi ;
713 else
714 sep = dopp;
715 datastream +=vcard.mid( start, next - start);
716 datastream +=vcard.mid( next+5,sep -next -5 ).upper();
717 start = sep;
718 }
719 datastream += vcard.mid( start,vcard.length() );
720 }
721#ifndef DESKTOP_VERSION
722 QFile outFile(fileName);
723 if ( outFile.open(IO_WriteOnly) ) {
724 datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" );
725 QTextStream t( &outFile ); // use a text stream
726 t.setEncoding( QTextStream::UnicodeUTF8 );
727 t <<datastream;
728 outFile.close();
729 Ir *ir = new Ir( this );
730 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) );
731 ir->send( fileName, description, "text/x-vCard" );
732 } else {
733 qDebug("Error open temp beam file ");
734 return;
735 }
736#endif
737
738
739
740
741 setCaption( i18n("Writing to phone..."));
742 if ( PhoneFormat::writeToPhone( cal ) )
743 setCaption( i18n("Export to phone successful!"));
744 else
745 setCaption( i18n("Error exporting to phone!"));
746#endif
747
748
749}
612void KABCore::beamVCard() 750void KABCore::beamVCard()
613{ 751{
614 QStringList uids = mViewManager->selectedUids(); 752 QStringList uids = mViewManager->selectedUids();
615 if ( !uids.isEmpty() ) 753 if ( !uids.isEmpty() )
616 beamVCard( uids ); 754 beamVCard( uids );
617} 755}
@@ -1601,12 +1739,16 @@ void KABCore::initActions()
1601 SLOT( newContact() ), actionCollection(), "file_new_contact" ); 1739 SLOT( newContact() ), actionCollection(), "file_new_contact" );
1602 1740
1603 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, 1741 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0,
1604 this, SLOT( mailVCard() ), 1742 this, SLOT( mailVCard() ),
1605 actionCollection(), "file_mail_vcard"); 1743 actionCollection(), "file_mail_vcard");
1606 1744
1745 mActionExport2phone = new KAction( i18n( "Selected to phone" ), "ex2phone", 0, this,
1746 SLOT( export2phone() ), actionCollection(),
1747 "kaddressbook_ex2phone" );
1748
1607 mActionBeamVCard = 0; 1749 mActionBeamVCard = 0;
1608 mActionBeam = 0; 1750 mActionBeam = 0;
1609 1751
1610#ifndef DESKTOP_VERSION 1752#ifndef DESKTOP_VERSION
1611 if ( Ir::supported() ) { 1753 if ( Ir::supported() ) {
1612 mActionBeamVCard = new KAction( i18n( "Beam selected v&Card(s)" ), "beam", 0, this, 1754 mActionBeamVCard = new KAction( i18n( "Beam selected v&Card(s)" ), "beam", 0, this,
@@ -1901,12 +2043,13 @@ void KABCore::addActionsManually()
1901//US topLayout->addWidget( mJumpButtonBar ); 2043//US topLayout->addWidget( mJumpButtonBar );
1902 this->layout()->add( mJumpButtonBar ); 2044 this->layout()->add( mJumpButtonBar );
1903*/ 2045*/
1904 2046
1905#endif //KAB_EMBEDDED 2047#endif //KAB_EMBEDDED
1906 2048
2049 mActionExport2phone->plug( ExportMenu );
1907 connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); 2050 connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) );
1908 syncManager->fillSyncMenu(); 2051 syncManager->fillSyncMenu();
1909 2052
1910} 2053}
1911void KABCore::showLicence() 2054void KABCore::showLicence()
1912{ 2055{
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index 941458d..e6f286b 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -171,12 +171,13 @@ class KABCore : public QWidget, public KSyncInterface
171 /** 171 /**
172 Beams the "WhoAmI contact. 172 Beams the "WhoAmI contact.
173 */ 173 */
174 void beamMySelf(); 174 void beamMySelf();
175 175
176 void beamVCard(); 176 void beamVCard();
177 void export2phone();
177 void beamVCard(const QStringList& uids); 178 void beamVCard(const QStringList& uids);
178 void beamDone( Ir *ir ); 179 void beamDone( Ir *ir );
179 180
180 181
181 /** 182 /**
182 Starts the preferred web browser with the given URL as argument. 183 Starts the preferred web browser with the given URL as argument.
@@ -394,12 +395,13 @@ class KABCore : public QWidget, public KSyncInterface
394 bool mMultipleViewsAtOnce; 395 bool mMultipleViewsAtOnce;
395 396
396 397
397 //US file menu 398 //US file menu
398 KAction *mActionMail; 399 KAction *mActionMail;
399 KAction *mActionBeam; 400 KAction *mActionBeam;
401 KAction *mActionExport2phone;
400 KAction* mActionPrint; 402 KAction* mActionPrint;
401 KAction* mActionNewContact; 403 KAction* mActionNewContact;
402 KAction *mActionSave; 404 KAction *mActionSave;
403 KAction *mActionEditAddressee; 405 KAction *mActionEditAddressee;
404 KAction *mActionMailVCard; 406 KAction *mActionMailVCard;
405 KAction *mActionBeamVCard; 407 KAction *mActionBeamVCard;
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index 716a125..84e3d00 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -76,16 +76,12 @@ KOPrefs::KOPrefs() :
76 mEditBoxFont = QFont("helvetica",12); 76 mEditBoxFont = QFont("helvetica",12);
77 mJornalViewFont = QFont("helvetica",12); 77 mJornalViewFont = QFont("helvetica",12);
78 78
79 KPrefs::setCurrentGroup("General"); 79 KPrefs::setCurrentGroup("General");
80 80
81 81
82 addItemString("Ex2PhoneDevice",&mEx2PhoneDevice,"/dev/ircomm");
83 addItemString("Ex2PhoneConnection",&mEx2PhoneConnection,"irda");
84 addItemString("Ex2PhoneModel",&mEx2PhoneModel,"6310i");
85
86 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); 82 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false);
87 83
88 addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true); 84 addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true);
89 addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true); 85 addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true);
90 addItemBool("ShowIconSearch",&mShowIconSearch,true); 86 addItemBool("ShowIconSearch",&mShowIconSearch,true);
91 addItemBool("ShowIconList",&mShowIconList,true); 87 addItemBool("ShowIconList",&mShowIconList,true);
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h
index a1ba8b3..d9ac851 100644
--- a/korganizer/koprefs.h
+++ b/korganizer/koprefs.h
@@ -207,15 +207,12 @@ class KOPrefs : public KPimPrefs
207 QString mRemotePassWd; 207 QString mRemotePassWd;
208 QString mRemoteFile; 208 QString mRemoteFile;
209 QString mLocalTempFile; 209 QString mLocalTempFile;
210 QString mPhoneDevice; 210 QString mPhoneDevice;
211 QString mPhoneConnection; 211 QString mPhoneConnection;
212 QString mPhoneModel; 212 QString mPhoneModel;
213 QString mEx2PhoneDevice;
214 QString mEx2PhoneConnection;
215 QString mEx2PhoneModel;
216 213
217 int mLastSyncTime; 214 int mLastSyncTime;
218 int mSyncAlgoPrefs; 215 int mSyncAlgoPrefs;
219 int mRingSyncAlgoPrefs; 216 int mRingSyncAlgoPrefs;
220 QStringList mSyncProfileNames; 217 QStringList mSyncProfileNames;
221 QStringList mExternSyncProfiles; 218 QStringList mExternSyncProfiles;
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index bd14fbf..2f286e0 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -100,13 +100,13 @@ class KOex2phonePrefs : public QDialog
100 lay->addWidget( mWriteBackFuture ); 100 lay->addWidget( mWriteBackFuture );
101 temphb = new QHBox( this ); 101 temphb = new QHBox( this );
102 new QLabel( i18n("Max. weeks in future: ") , temphb ); 102 new QLabel( i18n("Max. weeks in future: ") , temphb );
103 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); 103 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb);
104 mWriteBackFutureWeeks->setValue( 8 ); 104 mWriteBackFutureWeeks->setValue( 8 );
105 lay->addWidget( temphb ); 105 lay->addWidget( temphb );
106 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\n todo/calendar data on phone!"), this ) ); 106 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) );
107 lab->setAlignment (AlignHCenter ); 107 lab->setAlignment (AlignHCenter );
108 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); 108 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
109 lay->addWidget( ok ); 109 lay->addWidget( ok );
110 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 110 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
111 lay->addWidget( cancel ); 111 lay->addWidget( cancel );
112 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 112 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
@@ -1168,30 +1168,31 @@ void MainWindow::slotSyncMenu( int action )
1168 } 1168 }
1169 delete temp; 1169 delete temp;
1170 mBlockSaveFlag = false; 1170 mBlockSaveFlag = false;
1171} 1171}
1172void MainWindow::exportToPhone( int mode ) 1172void MainWindow::exportToPhone( int mode )
1173{ 1173{
1174 1174
1175 //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 1175 //ex2phone->insertItem(i18n("Complete calendar..."), 1 );
1176 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 1176 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
1177 KOex2phonePrefs ex2phone; 1177 KOex2phonePrefs ex2phone;
1178 ex2phone.mPhoneConnection->setText( KOPrefs::instance()->mEx2PhoneConnection ); 1178
1179 ex2phone.mPhoneDevice->setText( KOPrefs::instance()->mEx2PhoneDevice ); 1179 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
1180 ex2phone.mPhoneModel->setText( KOPrefs::instance()->mEx2PhoneModel ); 1180 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
1181 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
1181 if ( mode == 1 ) 1182 if ( mode == 1 )
1182 ex2phone.setCaption(i18n("Export complete calendar")); 1183 ex2phone.setCaption(i18n("Export complete calendar"));
1183 if ( mode == 2 ) 1184 if ( mode == 2 )
1184 ex2phone.setCaption(i18n("Export filtered calendar")); 1185 ex2phone.setCaption(i18n("Export filtered calendar"));
1185 1186
1186 if ( !ex2phone.exec() ) { 1187 if ( !ex2phone.exec() ) {
1187 return; 1188 return;
1188 } 1189 }
1189 KOPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 1190 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
1190 KOPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 1191 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
1191 KOPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 1192 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
1192 1193
1193 int inFuture = 0; 1194 int inFuture = 0;
1194 if ( ex2phone.mWriteBackFuture->isChecked() ) 1195 if ( ex2phone.mWriteBackFuture->isChecked() )
1195 inFuture = ex2phone.mWriteBackFutureWeeks->value(); 1196 inFuture = ex2phone.mWriteBackFutureWeeks->value();
1196 QPtrList<Incidence> delSel; 1197 QPtrList<Incidence> delSel;
1197 if ( mode == 1 ) 1198 if ( mode == 1 )
@@ -1229,15 +1230,15 @@ void MainWindow::exportToPhone( int mode )
1229 Incidence *in = incidence->clone(); 1230 Incidence *in = incidence->clone();
1230 cal->addIncidence( in ); 1231 cal->addIncidence( in );
1231 } 1232 }
1232 } 1233 }
1233 incidence = delSel.next(); 1234 incidence = delSel.next();
1234 } 1235 }
1235 PhoneFormat::writeConfig( KOPrefs::instance()->mEx2PhoneDevice, 1236 PhoneFormat::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
1236 KOPrefs::instance()->mEx2PhoneConnection, 1237 KPimGlobalPrefs::instance()->mEx2PhoneConnection,
1237 KOPrefs::instance()->mEx2PhoneModel ); 1238 KPimGlobalPrefs::instance()->mEx2PhoneModel );
1238 1239
1239 setCaption( i18n("Writing to phone...")); 1240 setCaption( i18n("Writing to phone..."));
1240 if ( PhoneFormat::writeToPhone( cal ) ) 1241 if ( PhoneFormat::writeToPhone( cal ) )
1241 setCaption( i18n("Export to phone successful!")); 1242 setCaption( i18n("Export to phone successful!"));
1242 else 1243 else
1243 setCaption( i18n("Error exporting to phone!")); 1244 setCaption( i18n("Error exporting to phone!"));
diff --git a/libkdepim/kpimglobalprefs.cpp b/libkdepim/kpimglobalprefs.cpp
index b2b7663..b71e18d 100644
--- a/libkdepim/kpimglobalprefs.cpp
+++ b/libkdepim/kpimglobalprefs.cpp
@@ -96,12 +96,19 @@ KPimGlobalPrefs::KPimGlobalPrefs( const QString &name )
96 96
97 addItemInt( "SIPChannelType", &mSipClient, NONE_SIC ); 97 addItemInt( "SIPChannelType", &mSipClient, NONE_SIC );
98 addItemString( "SIPChannel", &mSipOtherChannel, "" ); 98 addItemString( "SIPChannel", &mSipOtherChannel, "" );
99 addItemString( "SIPChannelMessage", &mSipOtherMessage, "" ); 99 addItemString( "SIPChannelMessage", &mSipOtherMessage, "" );
100 addItemString( "SIPChannelParameters", &mSipOtherMessageParameters, "" ); 100 addItemString( "SIPChannelParameters", &mSipOtherMessageParameters, "" );
101 101
102
103 KPrefs::setCurrentGroup( "PhoneAccess" );
104 addItemString("Ex2PhoneDevice",&mEx2PhoneDevice,"/dev/ircomm");
105 addItemString("Ex2PhoneConnection",&mEx2PhoneConnection,"irda");
106 addItemString("Ex2PhoneModel",&mEx2PhoneModel,"6310i");
107
108
102} 109}
103 110
104void KPimGlobalPrefs::setGlobalConfig() 111void KPimGlobalPrefs::setGlobalConfig()
105{ 112{
106 113
107 KGlobal::locale()->setHore24Format( !mPreferredTime ); 114 KGlobal::locale()->setHore24Format( !mPreferredTime );
diff --git a/libkdepim/kpimglobalprefs.h b/libkdepim/kpimglobalprefs.h
index 84ba689..f6b6628 100644
--- a/libkdepim/kpimglobalprefs.h
+++ b/libkdepim/kpimglobalprefs.h
@@ -126,10 +126,13 @@ class KPimGlobalPrefs : public KPrefs
126 126
127 int mSipClient; 127 int mSipClient;
128 QString mSipOtherChannel; 128 QString mSipOtherChannel;
129 QString mSipOtherMessage; 129 QString mSipOtherMessage;
130 QString mSipOtherMessageParameters; 130 QString mSipOtherMessageParameters;
131 131
132 QString mEx2PhoneDevice;
133 QString mEx2PhoneConnection;
134 QString mEx2PhoneModel;
132 135
133}; 136};
134 137
135#endif 138#endif
diff --git a/libkdepim/libkdepim.pro b/libkdepim/libkdepim.pro
index eac19ea..84af7ad 100644
--- a/libkdepim/libkdepim.pro
+++ b/libkdepim/libkdepim.pro
@@ -32,13 +32,14 @@ HEADERS = \
32 kprefsdialog.h \ 32 kprefsdialog.h \
33 kprefswidget.h \ 33 kprefswidget.h \
34 ksyncmanager.h \ 34 ksyncmanager.h \
35 ksyncprofile.h \ 35 ksyncprofile.h \
36 ksyncprefsdialog.h \ 36 ksyncprefsdialog.h \
37 kcmconfigs/kcmkdepimconfig.h \ 37 kcmconfigs/kcmkdepimconfig.h \
38 kcmconfigs/kdepimconfigwidget.h 38 kcmconfigs/kdepimconfigwidget.h \
39 phoneaccess.h
39 40
40SOURCES = \ 41SOURCES = \
41 categoryeditdialog.cpp \ 42 categoryeditdialog.cpp \
42 categoryeditdialog_base.cpp \ 43 categoryeditdialog_base.cpp \
43 categoryselectdialog.cpp \ 44 categoryselectdialog.cpp \
44 categoryselectdialog_base.cpp \ 45 categoryselectdialog_base.cpp \
@@ -51,9 +52,10 @@ SOURCES = \
51 kprefsdialog.cpp \ 52 kprefsdialog.cpp \
52 kprefswidget.cpp \ 53 kprefswidget.cpp \
53 ksyncmanager.cpp \ 54 ksyncmanager.cpp \
54 ksyncprofile.cpp \ 55 ksyncprofile.cpp \
55 ksyncprefsdialog.cpp \ 56 ksyncprefsdialog.cpp \
56 kcmconfigs/kcmkdepimconfig.cpp \ 57 kcmconfigs/kcmkdepimconfig.cpp \
57 kcmconfigs/kdepimconfigwidget.cpp 58 kcmconfigs/kdepimconfigwidget.cpp \
59 phoneaccess.cpp
58 60
59 61
diff --git a/libkdepim/libkdepimE.pro b/libkdepim/libkdepimE.pro
index 156e247..f3db68e 100644
--- a/libkdepim/libkdepimE.pro
+++ b/libkdepim/libkdepimE.pro
@@ -26,13 +26,14 @@ HEADERS = \
26 kprefsdialog.h \ 26 kprefsdialog.h \
27 kprefswidget.h \ 27 kprefswidget.h \
28 ksyncmanager.h \ 28 ksyncmanager.h \
29 ksyncprofile.h \ 29 ksyncprofile.h \
30 ksyncprefsdialog.h \ 30 ksyncprefsdialog.h \
31 kcmconfigs/kcmkdepimconfig.h \ 31 kcmconfigs/kcmkdepimconfig.h \
32 kcmconfigs/kdepimconfigwidget.h 32 kcmconfigs/kdepimconfigwidget.h \
33 phoneaccess.h
33 34
34 35
35 36
36SOURCES = \ 37SOURCES = \
37 categoryeditdialog.cpp \ 38 categoryeditdialog.cpp \
38 categoryeditdialog_base.cpp \ 39 categoryeditdialog_base.cpp \
@@ -47,9 +48,10 @@ SOURCES = \
47 kprefsdialog.cpp \ 48 kprefsdialog.cpp \
48 kprefswidget.cpp \ 49 kprefswidget.cpp \
49 ksyncmanager.cpp \ 50 ksyncmanager.cpp \
50 ksyncprofile.cpp \ 51 ksyncprofile.cpp \
51 ksyncprefsdialog.cpp \ 52 ksyncprefsdialog.cpp \
52 kcmconfigs/kcmkdepimconfig.cpp \ 53 kcmconfigs/kcmkdepimconfig.cpp \
53 kcmconfigs/kdepimconfigwidget.cpp 54 kcmconfigs/kdepimconfigwidget.cpp \
55 phoneaccess.cpp
54 56
55 57
diff --git a/libkdepim/phoneaccess.cpp b/libkdepim/phoneaccess.cpp
new file mode 100644
index 0000000..c0bd6cc
--- a/dev/null
+++ b/libkdepim/phoneaccess.cpp
@@ -0,0 +1,153 @@
1/*
2 This file is part of libkdepim.
3
4 Copyright (c) 2004 Lutz Rogowski <rogowski@kde.org>
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version.
10
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
15
16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA.
20*/
21
22
23#include <qstring.h>
24#include <qapplication.h>
25#include <qptrlist.h>
26#include <qregexp.h>
27#include <qfile.h>
28#include <qtextstream.h>
29#include <qtextcodec.h>
30#include <qdir.h>
31#include <kmessagebox.h>
32#include <stdlib.h>
33#include "phoneaccess.h"
34
35void PhoneAccess::writeConfig( QString device, QString connection, QString model )
36{
37#ifdef _WIN32_
38 QString fileName = qApp->applicationDirPath () +"\\gammurc";
39#else
40 QString fileName = QDir::homeDirPath() +"/.gammurc";
41#endif
42 //qDebug("save %d ", load );
43 QString content;
44 bool write = false;
45 bool addPort = true, addConnection = true, addModel = true;
46 QFile file( fileName );
47 if ( QFile::exists( fileName) ) {
48 if (!file.open( IO_ReadOnly ) ) {
49 qDebug("Error: cannot open %s ", fileName.latin1() );
50 return;
51 }
52 QString line;
53 while ( file.readLine( line, 1024 ) > 0 ) {
54 //qDebug("*%s* ", line.latin1() );
55 if ( line.left(7 ) == "[gammu]" ) {
56 ;
57 } else
58 if ( line.left(4 ) == "port" ) {
59 if ( line == "port = " + device+"\n" ) {
60 content += line ;
61 addPort = false;
62 //qDebug("port found" );
63 }
64
65 } else if ( line.left(5 ) == "model" ) {
66 if ( line == "model = " + model +"\n") {
67 content += line ;
68 addModel = false;
69 //qDebug("model found" );
70 }
71
72 } else if ( line.left( 10 ) == "connection" ) {
73 if ( line == "connection = " + connection +"\n") {
74 addConnection = false;
75 content += line ;
76 //qDebug("con found" );
77 }
78
79 } else {
80 content += line ;
81 }
82 }
83 file.close();
84 } else {
85 if ( ! connection.isEmpty() ) {
86 addConnection = true;
87 }
88 if ( ! device.isEmpty() ) {
89 addPort = true;
90
91 }
92 if ( ! model.isEmpty() ) {
93 addModel = true;
94 }
95 }
96
97 if ( addConnection ) {
98 if ( ! write )
99 content += "[gammu]\n";
100 write = true;
101 content += "connection = ";
102 content += connection;
103 content += "\n";
104 }
105 if ( addPort ) {
106 if ( ! write )
107 content += "[gammu]\n";
108 write = true;
109 content += "port = ";
110 content += device;
111 content += "\n";
112
113 }
114 if ( addModel ) {
115 if ( ! write )
116 content += "[gammu]\n";
117 write = true;
118 content += "model = ";
119 content += model;
120 content += "\n";
121 }
122 if ( write ) {
123 if (!file.open( IO_WriteOnly ) ) {
124 qDebug("Error: cannot write file %s ", fileName.latin1() );
125 return;
126 }
127 qDebug("Writing file %s ", fileName.latin1() );
128 QTextStream ts( &file );
129 ts << content ;
130 file.close();
131 }
132
133}
134
135
136bool PhoneAccess::writeToPhone( QString fileName)
137{
138
139#ifdef DESKTOP_VERSION
140 QString command ="./kammu --restore " + fileName ;
141#else
142 QString command ="kammu --restore " + fileName ;
143#endif
144 int ret;
145 while ( (ret = system ( command.latin1())) != 0 ) {
146 qDebug("Error S::command returned %d. asking users", ret);
147 int retval = KMessageBox::warningContinueCancel(0,
148 i18n("Error accessing device!\nPlease turn on connection\nand retry!"),i18n("KO/Pi phone access"),i18n("Retry"),i18n("Cancel"));
149 if ( retval != KMessageBox::Continue )
150 return false;
151 }
152 return true;
153}
diff --git a/libkdepim/phoneaccess.h b/libkdepim/phoneaccess.h
new file mode 100644
index 0000000..b7c4732
--- a/dev/null
+++ b/libkdepim/phoneaccess.h
@@ -0,0 +1,42 @@
1/*
2 This file is part of libkcal.
3
4 Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version.
10
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
15
16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA.
20*/
21#ifndef PHONEACCESS_H
22#define PHONEACCESS_H
23
24#include <qstring.h>
25
26
27
28/**
29 This class implements the calendar format used by Phone.
30*/
31
32class PhoneAccess : public QObject {
33 public:
34
35 static void writeConfig( QString device,QString connection, QString model );
36 static bool writeToPhone( QString fileName );
37
38};
39
40
41
42#endif