summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-10-06 16:02:56 (UTC)
committer zautrix <zautrix>2004-10-06 16:02:56 (UTC)
commita22de800110d8350a5200a994b041e47d51bf4c6 (patch) (unidiff)
treea4de195003d1ceabc3fd9ca4e5cd0510570bcb97
parentef71411c2f248d1dc908aa2f119c9b281e0e8bb9 (diff)
downloadkdepimpi-a22de800110d8350a5200a994b041e47d51bf4c6.zip
kdepimpi-a22de800110d8350a5200a994b041e47d51bf4c6.tar.gz
kdepimpi-a22de800110d8350a5200a994b041e47d51bf4c6.tar.bz2
added phone export
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
@@ -1,84 +1,88 @@
1/* 1/*
2 This file is part of KAddressbook. 2 This file is part of KAddressbook.
3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> 3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24/* 24/*
25Enhanced Version of the file for platform independent KDE tools. 25Enhanced Version of the file for platform independent KDE tools.
26Copyright (c) 2004 Ulf Schenk 26Copyright (c) 2004 Ulf Schenk
27 27
28$Id$ 28$Id$
29*/ 29*/
30 30
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>
43#include <qapplicaton.h> 47#include <qapplicaton.h>
44#include <qprogressbar.h> 48#include <qprogressbar.h>
45#include <qlayout.h> 49#include <qlayout.h>
46#include <qregexp.h> 50#include <qregexp.h>
47#include <qvbox.h> 51#include <qvbox.h>
48#include <kabc/addresseelist.h> 52#include <kabc/addresseelist.h>
49#include <kabc/errorhandler.h> 53#include <kabc/errorhandler.h>
50#include <kabc/resource.h> 54#include <kabc/resource.h>
51#include <kabc/vcardconverter.h> 55#include <kabc/vcardconverter.h>
52#include <kapplication.h> 56#include <kapplication.h>
53#include <kactionclasses.h> 57#include <kactionclasses.h>
54#include <kcmultidialog.h> 58#include <kcmultidialog.h>
55#include <kdebug.h> 59#include <kdebug.h>
56#include <kdeversion.h> 60#include <kdeversion.h>
57#include <kkeydialog.h> 61#include <kkeydialog.h>
58#include <kmessagebox.h> 62#include <kmessagebox.h>
59#include <kprinter.h> 63#include <kprinter.h>
60#include <kprotocolinfo.h> 64#include <kprotocolinfo.h>
61#include <kresources/selectdialog.h> 65#include <kresources/selectdialog.h>
62#include <kstandarddirs.h> 66#include <kstandarddirs.h>
63#include <ktempfile.h> 67#include <ktempfile.h>
64#include <kxmlguiclient.h> 68#include <kxmlguiclient.h>
65#include <kaboutdata.h> 69#include <kaboutdata.h>
66#include <libkdepim/categoryselectdialog.h> 70#include <libkdepim/categoryselectdialog.h>
67 71
68#include "addresseeutil.h" 72#include "addresseeutil.h"
69#include "addresseeeditordialog.h" 73#include "addresseeeditordialog.h"
70#include "extensionmanager.h" 74#include "extensionmanager.h"
71#include "kstdaction.h" 75#include "kstdaction.h"
72#include "kaddressbookservice.h" 76#include "kaddressbookservice.h"
73#include "ldapsearchdialog.h" 77#include "ldapsearchdialog.h"
74#include "printing/printingwizard.h" 78#include "printing/printingwizard.h"
75#else // KAB_EMBEDDED 79#else // KAB_EMBEDDED
76 80
77#include <kapplication.h> 81#include <kapplication.h>
78#include "KDGanttMinimizeSplitter.h" 82#include "KDGanttMinimizeSplitter.h"
79#include "kaddressbookmain.h" 83#include "kaddressbookmain.h"
80#include "kactioncollection.h" 84#include "kactioncollection.h"
81#include "addresseedialog.h" 85#include "addresseedialog.h"
82//US 86//US
83#include <addresseeview.h> 87#include <addresseeview.h>
84 88
@@ -108,96 +112,140 @@ $Id$
108#include "kcmconfigs/kcmkabconfig.h" 112#include "kcmconfigs/kcmkabconfig.h"
109#include "kcmconfigs/kcmkdepimconfig.h" 113#include "kcmconfigs/kcmkdepimconfig.h"
110#include "kpimglobalprefs.h" 114#include "kpimglobalprefs.h"
111#include "externalapphandler.h" 115#include "externalapphandler.h"
112 116
113 117
114#include <kresources/selectdialog.h> 118#include <kresources/selectdialog.h>
115#include <kmessagebox.h> 119#include <kmessagebox.h>
116 120
117#include <picture.h> 121#include <picture.h>
118#include <resource.h> 122#include <resource.h>
119 123
120//US#include <qsplitter.h> 124//US#include <qsplitter.h>
121#include <qmap.h> 125#include <qmap.h>
122#include <qdir.h> 126#include <qdir.h>
123#include <qfile.h> 127#include <qfile.h>
124#include <qvbox.h> 128#include <qvbox.h>
125#include <qlayout.h> 129#include <qlayout.h>
126#include <qclipboard.h> 130#include <qclipboard.h>
127#include <qtextstream.h> 131#include <qtextstream.h>
128 132
129#include <libkdepim/categoryselectdialog.h> 133#include <libkdepim/categoryselectdialog.h>
130#include <kabc/vcardconverter.h> 134#include <kabc/vcardconverter.h>
131 135
132 136
133#include "addresseeutil.h" 137#include "addresseeutil.h"
134#include "undocmds.h" 138#include "undocmds.h"
135#include "addresseeeditordialog.h" 139#include "addresseeeditordialog.h"
136#include "viewmanager.h" 140#include "viewmanager.h"
137#include "details/detailsviewcontainer.h" 141#include "details/detailsviewcontainer.h"
138#include "kabprefs.h" 142#include "kabprefs.h"
139#include "xxportmanager.h" 143#include "xxportmanager.h"
140#include "incsearchwidget.h" 144#include "incsearchwidget.h"
141#include "jumpbuttonbar.h" 145#include "jumpbuttonbar.h"
142#include "extensionmanager.h" 146#include "extensionmanager.h"
143#include "addresseeconfig.h" 147#include "addresseeconfig.h"
144#include <kcmultidialog.h> 148#include <kcmultidialog.h>
145 149
146#ifdef _WIN32_ 150#ifdef _WIN32_
147 151
148#include "kaimportoldialog.h" 152#include "kaimportoldialog.h"
149#else 153#else
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 ),
162 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ 210 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/
163 mReadWrite( readWrite ), mModified( false ), mMainWindow(client) 211 mReadWrite( readWrite ), mModified( false ), mMainWindow(client)
164#else //KAB_EMBEDDED 212#else //KAB_EMBEDDED
165KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) 213KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name )
166 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), 214 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ),
167 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), 215 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ),
168 mReadWrite( readWrite ), mModified( false ) 216 mReadWrite( readWrite ), mModified( false )
169#endif //KAB_EMBEDDED 217#endif //KAB_EMBEDDED
170{ 218{
171 // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); 219 // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu);
172 // syncManager->setBlockSave(false); 220 // syncManager->setBlockSave(false);
173 mExtensionBarSplitter = 0; 221 mExtensionBarSplitter = 0;
174 mIsPart = !parent->inherits( "KAddressBookMain" ); 222 mIsPart = !parent->inherits( "KAddressBookMain" );
175 223
176 mAddressBook = KABC::StdAddressBook::self(); 224 mAddressBook = KABC::StdAddressBook::self();
177 KABC::StdAddressBook::setAutomaticSave( false ); 225 KABC::StdAddressBook::setAutomaticSave( false );
178 226
179#ifndef KAB_EMBEDDED 227#ifndef KAB_EMBEDDED
180 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); 228 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler );
181#endif //KAB_EMBEDDED 229#endif //KAB_EMBEDDED
182 230
183 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), 231 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ),
184 SLOT( addressBookChanged() ) ); 232 SLOT( addressBookChanged() ) );
185 233
186#if 0 234#if 0
187 // LP moved to addressbook init method 235 // LP moved to addressbook init method
188 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, 236 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization,
189 "X-Department", "KADDRESSBOOK" ); 237 "X-Department", "KADDRESSBOOK" );
190 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, 238 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization,
191 "X-Profession", "KADDRESSBOOK" ); 239 "X-Profession", "KADDRESSBOOK" );
192 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, 240 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization,
193 "X-AssistantsName", "KADDRESSBOOK" ); 241 "X-AssistantsName", "KADDRESSBOOK" );
194 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, 242 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization,
195 "X-ManagersName", "KADDRESSBOOK" ); 243 "X-ManagersName", "KADDRESSBOOK" );
196 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, 244 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal,
197 "X-SpousesName", "KADDRESSBOOK" ); 245 "X-SpousesName", "KADDRESSBOOK" );
198 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, 246 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal,
199 "X-Office", "KADDRESSBOOK" ); 247 "X-Office", "KADDRESSBOOK" );
200 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, 248 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal,
201 "X-IMAddress", "KADDRESSBOOK" ); 249 "X-IMAddress", "KADDRESSBOOK" );
202 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, 250 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal,
203 "X-Anniversary", "KADDRESSBOOK" ); 251 "X-Anniversary", "KADDRESSBOOK" );
@@ -465,96 +513,97 @@ void KABCore::createAboutData()
465#endif 513#endif
466 ); 514 );
467} 515}
468 516
469void KABCore::setContactSelected( const QString &uid ) 517void KABCore::setContactSelected( const QString &uid )
470{ 518{
471 KABC::Addressee addr = mAddressBook->findByUid( uid ); 519 KABC::Addressee addr = mAddressBook->findByUid( uid );
472 if ( !mDetails->isHidden() ) 520 if ( !mDetails->isHidden() )
473 mDetails->setAddressee( addr ); 521 mDetails->setAddressee( addr );
474 522
475 if ( !addr.isEmpty() ) { 523 if ( !addr.isEmpty() ) {
476 emit contactSelected( addr.formattedName() ); 524 emit contactSelected( addr.formattedName() );
477 KABC::Picture pic = addr.photo(); 525 KABC::Picture pic = addr.photo();
478 if ( pic.isIntern() ) { 526 if ( pic.isIntern() ) {
479//US emit contactSelected( pic.data() ); 527//US emit contactSelected( pic.data() );
480//US instead use: 528//US instead use:
481 QPixmap px; 529 QPixmap px;
482 if (pic.data().isNull() != true) 530 if (pic.data().isNull() != true)
483 { 531 {
484 px.convertFromImage(pic.data()); 532 px.convertFromImage(pic.data());
485 } 533 }
486 534
487 emit contactSelected( px ); 535 emit contactSelected( px );
488 } 536 }
489 } 537 }
490 538
491 539
492 mExtensionManager->setSelectionChanged(); 540 mExtensionManager->setSelectionChanged();
493 541
494 // update the actions 542 // update the actions
495 bool selected = !uid.isEmpty(); 543 bool selected = !uid.isEmpty();
496 544
497 if ( mReadWrite ) { 545 if ( mReadWrite ) {
498 mActionCut->setEnabled( selected ); 546 mActionCut->setEnabled( selected );
499 mActionPaste->setEnabled( selected ); 547 mActionPaste->setEnabled( selected );
500 } 548 }
501 549
502 mActionCopy->setEnabled( selected ); 550 mActionCopy->setEnabled( selected );
503 mActionDelete->setEnabled( selected ); 551 mActionDelete->setEnabled( selected );
504 mActionEditAddressee->setEnabled( selected ); 552 mActionEditAddressee->setEnabled( selected );
505 mActionMail->setEnabled( selected ); 553 mActionMail->setEnabled( selected );
506 mActionMailVCard->setEnabled( selected ); 554 mActionMailVCard->setEnabled( selected );
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{
519 sendMail( mViewManager->selectedEmails().join( ", " ) ); 568 sendMail( mViewManager->selectedEmails().join( ", " ) );
520} 569}
521 570
522void KABCore::sendMail( const QString& emaillist ) 571void KABCore::sendMail( const QString& emaillist )
523{ 572{
524 // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... " 573 // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... "
525 if (emaillist.contains(",") > 0) 574 if (emaillist.contains(",") > 0)
526 ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null ); 575 ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null );
527 else 576 else
528 ExternalAppHandler::instance()->mailToOneContact( emaillist ); 577 ExternalAppHandler::instance()->mailToOneContact( emaillist );
529} 578}
530 579
531 580
532 581
533void KABCore::mailVCard() 582void KABCore::mailVCard()
534{ 583{
535 QStringList uids = mViewManager->selectedUids(); 584 QStringList uids = mViewManager->selectedUids();
536 if ( !uids.isEmpty() ) 585 if ( !uids.isEmpty() )
537 mailVCard( uids ); 586 mailVCard( uids );
538} 587}
539 588
540void KABCore::mailVCard( const QStringList& uids ) 589void KABCore::mailVCard( const QStringList& uids )
541{ 590{
542 QStringList urls; 591 QStringList urls;
543 592
544// QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); 593// QString tmpdir = locateLocal("tmp", KGlobal::getAppName());
545 594
546 QString dirName = "/tmp/" + KApplication::randomString( 8 ); 595 QString dirName = "/tmp/" + KApplication::randomString( 8 );
547 596
548 597
549 598
550 QDir().mkdir( dirName, true ); 599 QDir().mkdir( dirName, true );
551 600
552 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { 601 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
553 KABC::Addressee a = mAddressBook->findByUid( *it ); 602 KABC::Addressee a = mAddressBook->findByUid( *it );
554 603
555 if ( a.isEmpty() ) 604 if ( a.isEmpty() )
556 continue; 605 continue;
557 606
558 QString name = a.givenName() + "_" + a.familyName() + ".vcf"; 607 QString name = a.givenName() + "_" + a.familyName() + ".vcf";
559 608
560 QString fileName = dirName + "/" + name; 609 QString fileName = dirName + "/" + name;
@@ -564,96 +613,185 @@ void KABCore::mailVCard( const QStringList& uids )
564 if ( outFile.open(IO_WriteOnly) ) { // file opened successfully 613 if ( outFile.open(IO_WriteOnly) ) { // file opened successfully
565 KABC::VCardConverter converter; 614 KABC::VCardConverter converter;
566 QString vcard; 615 QString vcard;
567 616
568 converter.addresseeToVCard( a, vcard ); 617 converter.addresseeToVCard( a, vcard );
569 618
570 QTextStream t( &outFile ); // use a text stream 619 QTextStream t( &outFile ); // use a text stream
571 t.setEncoding( QTextStream::UnicodeUTF8 ); 620 t.setEncoding( QTextStream::UnicodeUTF8 );
572 t << vcard; 621 t << vcard;
573 622
574 outFile.close(); 623 outFile.close();
575 624
576 urls.append( fileName ); 625 urls.append( fileName );
577 } 626 }
578 } 627 }
579 628
580 bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") ); 629 bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") );
581 630
582 631
583/*US 632/*US
584 kapp->invokeMailer( QString::null, QString::null, QString::null, 633 kapp->invokeMailer( QString::null, QString::null, QString::null,
585 QString::null, // subject 634 QString::null, // subject
586 QString::null, // body 635 QString::null, // body
587 QString::null, 636 QString::null,
588 urls ); // attachments 637 urls ); // attachments
589*/ 638*/
590 639
591} 640}
592 641
593/** 642/**
594 Beams the "WhoAmI contact. 643 Beams the "WhoAmI contact.
595*/ 644*/
596void KABCore::beamMySelf() 645void KABCore::beamMySelf()
597{ 646{
598 KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); 647 KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI();
599 if (!a.isEmpty()) 648 if (!a.isEmpty())
600 { 649 {
601 QStringList uids; 650 QStringList uids;
602 uids << a.uid(); 651 uids << a.uid();
603 652
604 beamVCard(uids); 653 beamVCard(uids);
605 } else { 654 } else {
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}
618 756
619 757
620void KABCore::beamVCard(const QStringList& uids) 758void KABCore::beamVCard(const QStringList& uids)
621{ 759{
622/*US 760/*US
623 QString beamFilename; 761 QString beamFilename;
624 Opie::OPimContact c; 762 Opie::OPimContact c;
625 if ( actionPersonal->isOn() ) { 763 if ( actionPersonal->isOn() ) {
626 beamFilename = addressbookPersonalVCardName(); 764 beamFilename = addressbookPersonalVCardName();
627 if ( !QFile::exists( beamFilename ) ) 765 if ( !QFile::exists( beamFilename ) )
628 return; // can't beam a non-existent file 766 return; // can't beam a non-existent file
629 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, 767 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null,
630 beamFilename ); 768 beamFilename );
631 Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); 769 Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true );
632 Opie::OPimContactAccess::List allList = access->allRecords(); 770 Opie::OPimContactAccess::List allList = access->allRecords();
633 Opie::OPimContactAccess::List::Iterator it = allList.begin(); // Just take first 771 Opie::OPimContactAccess::List::Iterator it = allList.begin(); // Just take first
634 c = *it; 772 c = *it;
635 773
636 delete access; 774 delete access;
637 } else { 775 } else {
638 unlink( beamfile ); // delete if exists 776 unlink( beamfile ); // delete if exists
639 mkdir("/tmp/obex/", 0755); 777 mkdir("/tmp/obex/", 0755);
640 c = m_abView -> currentEntry(); 778 c = m_abView -> currentEntry();
641 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, 779 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null,
642 beamfile ); 780 beamfile );
643 Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); 781 Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true );
644 access->add( c ); 782 access->add( c );
645 access->save(); 783 access->save();
646 delete access; 784 delete access;
647 785
648 beamFilename = beamfile; 786 beamFilename = beamfile;
649 } 787 }
650 788
651 owarn << "Beaming: " << beamFilename << oendl; 789 owarn << "Beaming: " << beamFilename << oendl;
652*/ 790*/
653 791
654#if 0 792#if 0
655 QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); 793 QString tmpdir = locateLocal("tmp", KGlobal::getAppName());
656 794
657 QString dirName = tmpdir + "/" + KApplication::randomString( 8 ); 795 QString dirName = tmpdir + "/" + KApplication::randomString( 8 );
658 796
659 QString name = "contact.vcf"; 797 QString name = "contact.vcf";
@@ -1559,96 +1697,100 @@ void KABCore::initGUI()
1559 // mIncSearchWidget->hide(); 1697 // mIncSearchWidget->hide();
1560 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1698 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1561 SLOT( incrementalSearch( const QString& ) ) ); 1699 SLOT( incrementalSearch( const QString& ) ) );
1562 1700
1563 1701
1564 mJumpButtonBar = new JumpButtonBar( this, this ); 1702 mJumpButtonBar = new JumpButtonBar( this, this );
1565 1703
1566 topLayout->addWidget( mJumpButtonBar ); 1704 topLayout->addWidget( mJumpButtonBar );
1567//US topLayout->setStretchFactor( mJumpButtonBar, 10 ); 1705//US topLayout->setStretchFactor( mJumpButtonBar, 10 );
1568 1706
1569// mMainWindow->getIconToolBar()->raise(); 1707// mMainWindow->getIconToolBar()->raise();
1570 1708
1571#endif //KAB_EMBEDDED 1709#endif //KAB_EMBEDDED
1572 1710
1573} 1711}
1574void KABCore::initActions() 1712void KABCore::initActions()
1575{ 1713{
1576//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); 1714//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
1577 1715
1578#ifndef KAB_EMBEDDED 1716#ifndef KAB_EMBEDDED
1579 connect( QApplication::clipboard(), SIGNAL( dataChanged() ), 1717 connect( QApplication::clipboard(), SIGNAL( dataChanged() ),
1580 SLOT( clipboardDataChanged() ) ); 1718 SLOT( clipboardDataChanged() ) );
1581#endif //KAB_EMBEDDED 1719#endif //KAB_EMBEDDED
1582 1720
1583 // file menu 1721 // file menu
1584 if ( mIsPart ) { 1722 if ( mIsPart ) {
1585 mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, 1723 mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this,
1586 SLOT( sendMail() ), actionCollection(), 1724 SLOT( sendMail() ), actionCollection(),
1587 "kaddressbook_mail" ); 1725 "kaddressbook_mail" );
1588 mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, 1726 mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this,
1589 SLOT( print() ), actionCollection(), "kaddressbook_print" ); 1727 SLOT( print() ), actionCollection(), "kaddressbook_print" );
1590 1728
1591 } else { 1729 } else {
1592 mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); 1730 mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() );
1593 mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); 1731 mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() );
1594 } 1732 }
1595 1733
1596 1734
1597 mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, 1735 mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this,
1598 SLOT( save() ), actionCollection(), "file_sync" ); 1736 SLOT( save() ), actionCollection(), "file_sync" );
1599 1737
1600 mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, 1738 mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this,
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,
1613 SLOT( beamVCard() ), actionCollection(), 1755 SLOT( beamVCard() ), actionCollection(),
1614 "kaddressbook_beam_vcard" ); 1756 "kaddressbook_beam_vcard" );
1615 1757
1616 mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, 1758 mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this,
1617 SLOT( beamMySelf() ), actionCollection(), 1759 SLOT( beamMySelf() ), actionCollection(),
1618 "kaddressbook_beam_myself" ); 1760 "kaddressbook_beam_myself" );
1619 } 1761 }
1620#endif 1762#endif
1621 1763
1622 mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, 1764 mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0,
1623 this, SLOT( editContact2() ), 1765 this, SLOT( editContact2() ),
1624 actionCollection(), "file_properties" ); 1766 actionCollection(), "file_properties" );
1625 1767
1626#ifdef KAB_EMBEDDED 1768#ifdef KAB_EMBEDDED
1627 // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); 1769 // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() );
1628 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, 1770 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0,
1629 mMainWindow, SLOT( exit() ), 1771 mMainWindow, SLOT( exit() ),
1630 actionCollection(), "quit" ); 1772 actionCollection(), "quit" );
1631#endif //KAB_EMBEDDED 1773#endif //KAB_EMBEDDED
1632 1774
1633 // edit menu 1775 // edit menu
1634 if ( mIsPart ) { 1776 if ( mIsPart ) {
1635 mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, 1777 mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this,
1636 SLOT( copyContacts() ), actionCollection(), 1778 SLOT( copyContacts() ), actionCollection(),
1637 "kaddressbook_copy" ); 1779 "kaddressbook_copy" );
1638 mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, 1780 mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this,
1639 SLOT( cutContacts() ), actionCollection(), 1781 SLOT( cutContacts() ), actionCollection(),
1640 "kaddressbook_cut" ); 1782 "kaddressbook_cut" );
1641 mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, 1783 mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this,
1642 SLOT( pasteContacts() ), actionCollection(), 1784 SLOT( pasteContacts() ), actionCollection(),
1643 "kaddressbook_paste" ); 1785 "kaddressbook_paste" );
1644 mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, 1786 mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this,
1645 SLOT( selectAllContacts() ), actionCollection(), 1787 SLOT( selectAllContacts() ), actionCollection(),
1646 "kaddressbook_select_all" ); 1788 "kaddressbook_select_all" );
1647 mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, 1789 mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this,
1648 SLOT( undo() ), actionCollection(), 1790 SLOT( undo() ), actionCollection(),
1649 "kaddressbook_undo" ); 1791 "kaddressbook_undo" );
1650 mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, 1792 mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z,
1651 this, SLOT( redo() ), actionCollection(), 1793 this, SLOT( redo() ), actionCollection(),
1652 "kaddressbook_redo" ); 1794 "kaddressbook_redo" );
1653 } else { 1795 } else {
1654 mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); 1796 mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() );
@@ -1859,96 +2001,97 @@ void KABCore::addActionsManually()
1859 mActionKeyBindings->plug( settingsMenu ); 2001 mActionKeyBindings->plug( settingsMenu );
1860 } 2002 }
1861 2003
1862 settingsMenu->insertSeparator(); 2004 settingsMenu->insertSeparator();
1863 2005
1864 mActionJumpBar->plug( settingsMenu ); 2006 mActionJumpBar->plug( settingsMenu );
1865 mActionDetails->plug( settingsMenu ); 2007 mActionDetails->plug( settingsMenu );
1866 if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) 2008 if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop )
1867 mActionDetails->plug( tb ); 2009 mActionDetails->plug( tb );
1868 settingsMenu->insertSeparator(); 2010 settingsMenu->insertSeparator();
1869 2011
1870 mActionWhoAmI->plug( settingsMenu ); 2012 mActionWhoAmI->plug( settingsMenu );
1871 mActionCategories->plug( settingsMenu ); 2013 mActionCategories->plug( settingsMenu );
1872 2014
1873 mActionLicence->plug( helpMenu ); 2015 mActionLicence->plug( helpMenu );
1874 mActionFaq->plug( helpMenu ); 2016 mActionFaq->plug( helpMenu );
1875 mActionAboutKAddressbook->plug( helpMenu ); 2017 mActionAboutKAddressbook->plug( helpMenu );
1876 2018
1877 if (KGlobal::getDesktopSize() > KGlobal::Small ) { 2019 if (KGlobal::getDesktopSize() > KGlobal::Small ) {
1878 2020
1879 mActionSave->plug( tb ); 2021 mActionSave->plug( tb );
1880 mViewManager->getFilterAction()->plug ( tb); 2022 mViewManager->getFilterAction()->plug ( tb);
1881 if (KGlobal::getDesktopSize() == KGlobal::Desktop ) { 2023 if (KGlobal::getDesktopSize() == KGlobal::Desktop ) {
1882 mActionUndo->plug( tb ); 2024 mActionUndo->plug( tb );
1883 mActionDelete->plug( tb ); 2025 mActionDelete->plug( tb );
1884 mActionRedo->plug( tb ); 2026 mActionRedo->plug( tb );
1885 } 2027 }
1886 } 2028 }
1887 //mActionQuit->plug ( tb ); 2029 //mActionQuit->plug ( tb );
1888 // tb->insertWidget(-1, 0, mIncSearchWidget, 6); 2030 // tb->insertWidget(-1, 0, mIncSearchWidget, 6);
1889 2031
1890 //US link the searchwidget first to this. 2032 //US link the searchwidget first to this.
1891 // The real linkage to the toolbar happens later. 2033 // The real linkage to the toolbar happens later.
1892//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); 2034//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE);
1893//US tb->insertItem( mIncSearchWidget ); 2035//US tb->insertItem( mIncSearchWidget );
1894/*US 2036/*US
1895 mIncSearchWidget = new IncSearchWidget( tb ); 2037 mIncSearchWidget = new IncSearchWidget( tb );
1896 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 2038 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1897 SLOT( incrementalSearch( const QString& ) ) ); 2039 SLOT( incrementalSearch( const QString& ) ) );
1898 2040
1899 mJumpButtonBar = new JumpButtonBar( this, this ); 2041 mJumpButtonBar = new JumpButtonBar( this, this );
1900 2042
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{
1913 KApplication::showLicence(); 2056 KApplication::showLicence();
1914} 2057}
1915void KABCore::removeVoice() 2058void KABCore::removeVoice()
1916{ 2059{
1917 if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No ) 2060 if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No )
1918 return; 2061 return;
1919 KABC::Addressee::List list = mViewManager->selectedAddressees(); 2062 KABC::Addressee::List list = mViewManager->selectedAddressees();
1920 KABC::Addressee::List::Iterator it; 2063 KABC::Addressee::List::Iterator it;
1921 for ( it = list.begin(); it != list.end(); ++it ) { 2064 for ( it = list.begin(); it != list.end(); ++it ) {
1922 PhoneNumber::List phoneNumbers = (*it).phoneNumbers(); 2065 PhoneNumber::List phoneNumbers = (*it).phoneNumbers();
1923 PhoneNumber::List::Iterator phoneIt; 2066 PhoneNumber::List::Iterator phoneIt;
1924 bool found = false; 2067 bool found = false;
1925 for ( phoneIt = phoneNumbers.begin(); phoneIt != phoneNumbers.end(); ++phoneIt ) { 2068 for ( phoneIt = phoneNumbers.begin(); phoneIt != phoneNumbers.end(); ++phoneIt ) {
1926 if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found 2069 if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found
1927 if ((*phoneIt).type() - PhoneNumber::Voice ) { 2070 if ((*phoneIt).type() - PhoneNumber::Voice ) {
1928 (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice ); 2071 (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice );
1929 (*it).insertPhoneNumber( (*phoneIt) ); 2072 (*it).insertPhoneNumber( (*phoneIt) );
1930 found = true; 2073 found = true;
1931 } 2074 }
1932 } 2075 }
1933 2076
1934 } 2077 }
1935 if ( found ) 2078 if ( found )
1936 contactModified((*it) ); 2079 contactModified((*it) );
1937 } 2080 }
1938} 2081}
1939 2082
1940 2083
1941 2084
1942void KABCore::clipboardDataChanged() 2085void KABCore::clipboardDataChanged()
1943{ 2086{
1944 2087
1945 if ( mReadWrite ) 2088 if ( mReadWrite )
1946 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); 2089 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() );
1947 2090
1948} 2091}
1949 2092
1950void KABCore::updateActionMenu() 2093void KABCore::updateActionMenu()
1951{ 2094{
1952 UndoStack *undo = UndoStack::instance(); 2095 UndoStack *undo = UndoStack::instance();
1953 RedoStack *redo = RedoStack::instance(); 2096 RedoStack *redo = RedoStack::instance();
1954 2097
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index 941458d..e6f286b 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -129,96 +129,97 @@ class KABCore : public QWidget, public KSyncInterface
129 */ 129 */
130 KABC::Resource *requestResource( QWidget *parent ); 130 KABC::Resource *requestResource( QWidget *parent );
131 131
132#ifndef KAB_EMBEDDED 132#ifndef KAB_EMBEDDED
133 static KAboutData *createAboutData(); 133 static KAboutData *createAboutData();
134#endif //KAB_EMBEDDED 134#endif //KAB_EMBEDDED
135 135
136#ifdef KAB_EMBEDDED 136#ifdef KAB_EMBEDDED
137 inline QPopupMenu* getImportMenu() { return ImportMenu;} 137 inline QPopupMenu* getImportMenu() { return ImportMenu;}
138 inline QPopupMenu* getExportMenu() { return ExportMenu;} 138 inline QPopupMenu* getExportMenu() { return ExportMenu;}
139#endif //KAB_EMBEDDED 139#endif //KAB_EMBEDDED
140 140
141 public slots: 141 public slots:
142#ifdef KAB_EMBEDDED 142#ifdef KAB_EMBEDDED
143 void createAboutData(); 143 void createAboutData();
144#endif //KAB_EMBEDDED 144#endif //KAB_EMBEDDED
145 145
146 void statusMessage(QString, int time = 0 ); 146 void statusMessage(QString, int time = 0 );
147 void showLicence(); 147 void showLicence();
148 void faq(); 148 void faq();
149 149
150 /** 150 /**
151 Is called whenever a contact is selected in the view. 151 Is called whenever a contact is selected in the view.
152 */ 152 */
153 void setContactSelected( const QString &uid ); 153 void setContactSelected( const QString &uid );
154 154
155 /** 155 /**
156 Opens the preferred mail composer with all selected contacts as 156 Opens the preferred mail composer with all selected contacts as
157 arguments. 157 arguments.
158 */ 158 */
159 void sendMail(); 159 void sendMail();
160 160
161 /** 161 /**
162 Opens the preferred mail composer with the given contacts as 162 Opens the preferred mail composer with the given contacts as
163 arguments. 163 arguments.
164 */ 164 */
165 void sendMail( const QString& email ); 165 void sendMail( const QString& email );
166 166
167 167
168 void mailVCard(); 168 void mailVCard();
169 void mailVCard(const QStringList& uids); 169 void mailVCard(const QStringList& uids);
170 170
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.
183 */ 184 */
184 void browse( const QString& url ); 185 void browse( const QString& url );
185 186
186 /** 187 /**
187 Select all contacts in the view. 188 Select all contacts in the view.
188 */ 189 */
189 void selectAllContacts(); 190 void selectAllContacts();
190 191
191 /** 192 /**
192 Deletes all selected contacts from the address book. 193 Deletes all selected contacts from the address book.
193 */ 194 */
194 void deleteContacts(); 195 void deleteContacts();
195 196
196 /** 197 /**
197 Deletes given contacts from the address book. 198 Deletes given contacts from the address book.
198 199
199 @param uids The uids of the contacts, which shall be deleted. 200 @param uids The uids of the contacts, which shall be deleted.
200 */ 201 */
201 void deleteContacts( const QStringList &uids ); 202 void deleteContacts( const QStringList &uids );
202 203
203 /** 204 /**
204 Copys the selected contacts into clipboard for later pasting. 205 Copys the selected contacts into clipboard for later pasting.
205 */ 206 */
206 void copyContacts(); 207 void copyContacts();
207 208
208 /** 209 /**
209 Cuts the selected contacts and stores them for later pasting. 210 Cuts the selected contacts and stores them for later pasting.
210 */ 211 */
211 void cutContacts(); 212 void cutContacts();
212 213
213 /** 214 /**
214 Paste contacts from clipboard into the address book. 215 Paste contacts from clipboard into the address book.
215 */ 216 */
216 void pasteContacts(); 217 void pasteContacts();
217 218
218 /** 219 /**
219 Paste given contacts into the address book. 220 Paste given contacts into the address book.
220 221
221 @param list The list of addressee, which shall be pasted. 222 @param list The list of addressee, which shall be pasted.
222 */ 223 */
223 void pasteContacts( KABC::Addressee::List &list ); 224 void pasteContacts( KABC::Addressee::List &list );
224 225
@@ -352,96 +353,97 @@ class KABCore : public QWidget, public KSyncInterface
352 void updateActionMenu(); 353 void updateActionMenu();
353 void configureKeyBindings(); 354 void configureKeyBindings();
354 void removeVoice(); 355 void removeVoice();
355#ifdef KAB_EMBEDDED 356#ifdef KAB_EMBEDDED
356 void configureResources(); 357 void configureResources();
357#endif //KAB_EMBEDDED 358#endif //KAB_EMBEDDED
358 359
359 void slotEditorDestroyed( const QString &uid ); 360 void slotEditorDestroyed( const QString &uid );
360 void configurationChanged(); 361 void configurationChanged();
361 void addressBookChanged(); 362 void addressBookChanged();
362 363
363 private: 364 private:
364 void initGUI(); 365 void initGUI();
365 void initActions(); 366 void initActions();
366 367
367 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, 368 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent,
368 const char *name = 0 ); 369 const char *name = 0 );
369 370
370 KXMLGUIClient *mGUIClient; 371 KXMLGUIClient *mGUIClient;
371 372
372 KABC::AddressBook *mAddressBook; 373 KABC::AddressBook *mAddressBook;
373 374
374 ViewManager *mViewManager; 375 ViewManager *mViewManager;
375 // QSplitter *mDetailsSplitter; 376 // QSplitter *mDetailsSplitter;
376 KDGanttMinimizeSplitter *mExtensionBarSplitter; 377 KDGanttMinimizeSplitter *mExtensionBarSplitter;
377 ViewContainer *mDetails; 378 ViewContainer *mDetails;
378 KDGanttMinimizeSplitter* mMiniSplitter; 379 KDGanttMinimizeSplitter* mMiniSplitter;
379 XXPortManager *mXXPortManager; 380 XXPortManager *mXXPortManager;
380 JumpButtonBar *mJumpButtonBar; 381 JumpButtonBar *mJumpButtonBar;
381 IncSearchWidget *mIncSearchWidget; 382 IncSearchWidget *mIncSearchWidget;
382 ExtensionManager *mExtensionManager; 383 ExtensionManager *mExtensionManager;
383 384
384 KCMultiDialog *mConfigureDialog; 385 KCMultiDialog *mConfigureDialog;
385 386
386#ifndef KAB_EMBEDDED 387#ifndef KAB_EMBEDDED
387 LDAPSearchDialog *mLdapSearchDialog; 388 LDAPSearchDialog *mLdapSearchDialog;
388#endif //KAB_EMBEDDED 389#endif //KAB_EMBEDDED
389 // QDict<AddresseeEditorDialog> mEditorDict; 390 // QDict<AddresseeEditorDialog> mEditorDict;
390 AddresseeEditorDialog *mEditorDialog; 391 AddresseeEditorDialog *mEditorDialog;
391 bool mReadWrite; 392 bool mReadWrite;
392 bool mModified; 393 bool mModified;
393 bool mIsPart; 394 bool mIsPart;
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;
406 408
407 KAction *mActionQuit; 409 KAction *mActionQuit;
408 410
409 //US edit menu 411 //US edit menu
410 KAction *mActionCopy; 412 KAction *mActionCopy;
411 KAction *mActionCut; 413 KAction *mActionCut;
412 KAction *mActionPaste; 414 KAction *mActionPaste;
413 KAction *mActionSelectAll; 415 KAction *mActionSelectAll;
414 KAction *mActionUndo; 416 KAction *mActionUndo;
415 KAction *mActionRedo; 417 KAction *mActionRedo;
416 KAction *mActionDelete; 418 KAction *mActionDelete;
417 419
418 //US settings menu 420 //US settings menu
419 KAction *mActionConfigResources; 421 KAction *mActionConfigResources;
420 KAction *mActionConfigKAddressbook; 422 KAction *mActionConfigKAddressbook;
421 KAction *mActionConfigShortcuts; 423 KAction *mActionConfigShortcuts;
422 KAction *mActionConfigureToolbars; 424 KAction *mActionConfigureToolbars;
423 KAction *mActionKeyBindings; 425 KAction *mActionKeyBindings;
424 KToggleAction *mActionJumpBar; 426 KToggleAction *mActionJumpBar;
425 KToggleAction *mActionDetails; 427 KToggleAction *mActionDetails;
426 KAction *mActionWhoAmI; 428 KAction *mActionWhoAmI;
427 KAction *mActionCategories; 429 KAction *mActionCategories;
428 KAction *mActionAboutKAddressbook; 430 KAction *mActionAboutKAddressbook;
429 KAction *mActionLicence; 431 KAction *mActionLicence;
430 KAction *mActionFaq; 432 KAction *mActionFaq;
431 433
432 KAction *mActionDeleteView; 434 KAction *mActionDeleteView;
433 435
434 QPopupMenu *viewMenu; 436 QPopupMenu *viewMenu;
435 QPopupMenu *filterMenu; 437 QPopupMenu *filterMenu;
436 QPopupMenu *settingsMenu; 438 QPopupMenu *settingsMenu;
437 QPopupMenu *changeMenu; 439 QPopupMenu *changeMenu;
438//US QAction *mActionSave; 440//US QAction *mActionSave;
439 QPopupMenu *ImportMenu; 441 QPopupMenu *ImportMenu;
440 QPopupMenu *ExportMenu; 442 QPopupMenu *ExportMenu;
441 //LR additional methods 443 //LR additional methods
442 KAction *mActionRemoveVoice; 444 KAction *mActionRemoveVoice;
443 KAction * mActionImportOL; 445 KAction * mActionImportOL;
444 446
445#ifndef KAB_EMBEDDED 447#ifndef KAB_EMBEDDED
446 KAddressBookService *mAddressBookService; 448 KAddressBookService *mAddressBookService;
447#endif //KAB_EMBEDDED 449#endif //KAB_EMBEDDED
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index 716a125..84e3d00 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -34,100 +34,96 @@
34#include <qcolor.h> 34#include <qcolor.h>
35#include <qstringlist.h> 35#include <qstringlist.h>
36#include <stdlib.h> 36#include <stdlib.h>
37 37
38#include <kglobal.h> 38#include <kglobal.h>
39#include <kconfig.h> 39#include <kconfig.h>
40#include <klocale.h> 40#include <klocale.h>
41#include <kdebug.h> 41#include <kdebug.h>
42#include <kemailsettings.h> 42#include <kemailsettings.h>
43#include <kstaticdeleter.h> 43#include <kstaticdeleter.h>
44#include <libkdepim/kpimglobalprefs.h> 44#include <libkdepim/kpimglobalprefs.h>
45 45
46#include "koprefs.h" 46#include "koprefs.h"
47#include "mainwindow.h" 47#include "mainwindow.h"
48 48
49const char *germanwords[][2] = { 49const char *germanwords[][2] = {
50#include "wordsgerman.h" 50#include "wordsgerman.h"
51 "", "" 51 "", ""
52}; 52};
53 53
54KOPrefs *KOPrefs::mInstance = 0; 54KOPrefs *KOPrefs::mInstance = 0;
55static KStaticDeleter<KOPrefs> insd; 55static KStaticDeleter<KOPrefs> insd;
56 56
57KOPrefs::KOPrefs() : 57KOPrefs::KOPrefs() :
58 KPimPrefs("korganizerrc") 58 KPimPrefs("korganizerrc")
59{ 59{
60 mCategoryColors.setAutoDelete(true); 60 mCategoryColors.setAutoDelete(true);
61 mLocaleDict = 0; 61 mLocaleDict = 0;
62 fillMailDefaults(); 62 fillMailDefaults();
63 mDefaultCategoryColor = QColor(175,210,255);//196,196,196); 63 mDefaultCategoryColor = QColor(175,210,255);//196,196,196);
64 QColor defaultHolidayColor = QColor(255,0,0); 64 QColor defaultHolidayColor = QColor(255,0,0);
65 QColor defaultHighlightColor = QColor(129,112,255);//64,64,255); 65 QColor defaultHighlightColor = QColor(129,112,255);//64,64,255);
66 QColor defaultAgendaBgColor = QColor(239,241,169);//128,128,128); 66 QColor defaultAgendaBgColor = QColor(239,241,169);//128,128,128);
67 QColor defaultWorkingHoursColor = QColor(170,223,150);//160,160,160); 67 QColor defaultWorkingHoursColor = QColor(170,223,150);//160,160,160);
68 QColor defaultTodoDueTodayColor = QColor(255,220,100); 68 QColor defaultTodoDueTodayColor = QColor(255,220,100);
69 QColor defaultTodoOverdueColor = QColor(255,153,125); 69 QColor defaultTodoOverdueColor = QColor(255,153,125);
70 70
71 mTimeBarFont = QFont("helvetica",10);//,QFont::Bold); 71 mTimeBarFont = QFont("helvetica",10);//,QFont::Bold);
72 mDefaultViewFont = QFont("helvetica",10); 72 mDefaultViewFont = QFont("helvetica",10);
73 mDefaultMonthViewFont = QFont("helvetica",8); 73 mDefaultMonthViewFont = QFont("helvetica",8);
74 mMarcusBainsFont= QFont("helvetica",10); 74 mMarcusBainsFont= QFont("helvetica",10);
75 mDateNavigatorFont= QFont("helvetica",10, QFont::Bold); 75 mDateNavigatorFont= QFont("helvetica",10, QFont::Bold);
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);
92 addItemBool("ShowIconDay1",&mShowIconDay1,true); 88 addItemBool("ShowIconDay1",&mShowIconDay1,true);
93 addItemBool("ShowIconDay5",&mShowIconDay5,true); 89 addItemBool("ShowIconDay5",&mShowIconDay5,true);
94 addItemBool("ShowIconDay7",&mShowIconDay7,true); 90 addItemBool("ShowIconDay7",&mShowIconDay7,true);
95 addItemBool("ShowIconMonth",&mShowIconMonth,true); 91 addItemBool("ShowIconMonth",&mShowIconMonth,true);
96 addItemBool("ShowIconTodoview",&mShowIconTodoview,true); 92 addItemBool("ShowIconTodoview",&mShowIconTodoview,true);
97 addItemBool("ShowIconBackFast",&mShowIconBackFast,true); 93 addItemBool("ShowIconBackFast",&mShowIconBackFast,true);
98 addItemBool("ShowIconBack",&mShowIconBack,true); 94 addItemBool("ShowIconBack",&mShowIconBack,true);
99 addItemBool("ShowIconToday",&mShowIconToday,true); 95 addItemBool("ShowIconToday",&mShowIconToday,true);
100 addItemBool("ShowIconForward",&mShowIconForward,true); 96 addItemBool("ShowIconForward",&mShowIconForward,true);
101 addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true); 97 addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true);
102 addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,false); 98 addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,false);
103 addItemBool("ShowIconNextDays",&mShowIconNextDays,true); 99 addItemBool("ShowIconNextDays",&mShowIconNextDays,true);
104 addItemBool("ShowIconNext",&mShowIconNext,true); 100 addItemBool("ShowIconNext",&mShowIconNext,true);
105 addItemBool("ShowIconJournal",&mShowIconJournal,true); 101 addItemBool("ShowIconJournal",&mShowIconJournal,true);
106 addItemBool("ShowIconStretch",&mShowIconStretch,true); 102 addItemBool("ShowIconStretch",&mShowIconStretch,true);
107 addItemBool("LanguageChanged",&mLanguageChanged,false); 103 addItemBool("LanguageChanged",&mLanguageChanged,false);
108 104
109 addItemBool("AskForQuit",&mAskForQuit,false); 105 addItemBool("AskForQuit",&mAskForQuit,false);
110 106
111#ifndef DESKTOP_VERSION 107#ifndef DESKTOP_VERSION
112 addItemBool("ShowFullMenu",&mShowFullMenu,false); 108 addItemBool("ShowFullMenu",&mShowFullMenu,false);
113#else 109#else
114 addItemBool("ShowFullMenu",&mShowFullMenu,true); 110 addItemBool("ShowFullMenu",&mShowFullMenu,true);
115#endif 111#endif
116 addItemBool("ToolBarHor",&mToolBarHor, true ); 112 addItemBool("ToolBarHor",&mToolBarHor, true );
117 addItemBool("ToolBarUp",&mToolBarUp, false ); 113 addItemBool("ToolBarUp",&mToolBarUp, false );
118 addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false ); 114 addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false );
119 addItemInt("Whats Next Days",&mWhatsNextDays,3); 115 addItemInt("Whats Next Days",&mWhatsNextDays,3);
120 addItemInt("Whats Next Prios",&mWhatsNextPrios,1); 116 addItemInt("Whats Next Prios",&mWhatsNextPrios,1);
121 117
122 addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true); 118 addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true);
123 addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true); 119 addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true);
124 addItemInt("AllDay Size",&mAllDaySize,28); 120 addItemInt("AllDay Size",&mAllDaySize,28);
125 QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav"; 121 QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav";
126 addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm ); 122 addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm );
127 123
128 addItemStringList("LocationDefaults",&mLocationDefaults ); 124 addItemStringList("LocationDefaults",&mLocationDefaults );
129 addItemStringList("EventSummary User",&mEventSummaryUser); 125 addItemStringList("EventSummary User",&mEventSummaryUser);
130 addItemStringList("TodoSummary User",&mTodoSummaryUser); 126 addItemStringList("TodoSummary User",&mTodoSummaryUser);
131 127
132 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); 128 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false);
133 addItemBool("Enable Project View",&mEnableProjectView,false); 129 addItemBool("Enable Project View",&mEnableProjectView,false);
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h
index a1ba8b3..d9ac851 100644
--- a/korganizer/koprefs.h
+++ b/korganizer/koprefs.h
@@ -165,99 +165,96 @@ class KOPrefs : public KPimPrefs
165 bool mLanguageChanged; 165 bool mLanguageChanged;
166 166
167 bool mCompactDialogs; 167 bool mCompactDialogs;
168 bool mVerticalScreen; 168 bool mVerticalScreen;
169 169
170 bool mShowIconNewTodo; 170 bool mShowIconNewTodo;
171 bool mShowIconNewEvent; 171 bool mShowIconNewEvent;
172 bool mShowIconSearch; 172 bool mShowIconSearch;
173 bool mShowIconList; 173 bool mShowIconList;
174 bool mShowIconDay1; 174 bool mShowIconDay1;
175 bool mShowIconDay5; 175 bool mShowIconDay5;
176 bool mShowIconDay7; 176 bool mShowIconDay7;
177 bool mShowIconMonth; 177 bool mShowIconMonth;
178 bool mShowIconTodoview; 178 bool mShowIconTodoview;
179 bool mShowIconBackFast; 179 bool mShowIconBackFast;
180 bool mShowIconBack; 180 bool mShowIconBack;
181 bool mShowIconToday; 181 bool mShowIconToday;
182 bool mShowIconForward; 182 bool mShowIconForward;
183 bool mShowIconForwardFast; 183 bool mShowIconForwardFast;
184 bool mShowIconWhatsThis; 184 bool mShowIconWhatsThis;
185 bool mShowIconNextDays; 185 bool mShowIconNextDays;
186 bool mShowIconNext; 186 bool mShowIconNext;
187 bool mShowIconJournal; 187 bool mShowIconJournal;
188 188
189 bool mShowIconStretch; 189 bool mShowIconStretch;
190 190
191 bool mToolBarHor; 191 bool mToolBarHor;
192 bool mToolBarUp; 192 bool mToolBarUp;
193 bool mToolBarMiniIcons; 193 bool mToolBarMiniIcons;
194 194
195 bool mAskForQuit; 195 bool mAskForQuit;
196 bool mUsePassWd; 196 bool mUsePassWd;
197 bool mWriteBackFile; 197 bool mWriteBackFile;
198 int mWriteBackInFuture; 198 int mWriteBackInFuture;
199 bool mAskForPreferences; 199 bool mAskForPreferences;
200 bool mShowSyncSummary; 200 bool mShowSyncSummary;
201 bool mShowSyncEvents; 201 bool mShowSyncEvents;
202 bool mShowTodoInAgenda; 202 bool mShowTodoInAgenda;
203 bool mWriteBackExistingOnly; 203 bool mWriteBackExistingOnly;
204 204
205 QString mRemoteIP; 205 QString mRemoteIP;
206 QString mRemoteUser; 206 QString mRemoteUser;
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;
222 QString mLocalMachineName; 219 QString mLocalMachineName;
223 void setCategoryColor(QString cat,const QColor & color); 220 void setCategoryColor(QString cat,const QColor & color);
224 QColor *categoryColor(QString cat); 221 QColor *categoryColor(QString cat);
225 222
226 QString mArchiveFile; 223 QString mArchiveFile;
227 QString mHtmlExportFile; 224 QString mHtmlExportFile;
228 bool mHtmlWithSave; 225 bool mHtmlWithSave;
229 226
230 QStringList mSelectedPlugins; 227 QStringList mSelectedPlugins;
231 228
232 QString mLastImportFile; 229 QString mLastImportFile;
233 QString mLastVcalFile; 230 QString mLastVcalFile;
234 QString mLastSaveFile; 231 QString mLastSaveFile;
235 QString mLastLoadFile; 232 QString mLastLoadFile;
236 QString mLastSyncedLocalFile; 233 QString mLastSyncedLocalFile;
237 234
238 235
239 QString mDefaultAlarmFile; 236 QString mDefaultAlarmFile;
240 int mIMIPScheduler; 237 int mIMIPScheduler;
241 int mIMIPSend; 238 int mIMIPSend;
242 QStringList mAdditionalMails; 239 QStringList mAdditionalMails;
243 int mIMIPAutoRefresh; 240 int mIMIPAutoRefresh;
244 int mIMIPAutoInsertReply; 241 int mIMIPAutoInsertReply;
245 int mIMIPAutoInsertRequest; 242 int mIMIPAutoInsertRequest;
246 int mIMIPAutoFreeBusy; 243 int mIMIPAutoFreeBusy;
247 int mIMIPAutoFreeBusyReply; 244 int mIMIPAutoFreeBusyReply;
248 245
249 QStringList mTodoTemplates; 246 QStringList mTodoTemplates;
250 QStringList mEventTemplates; 247 QStringList mEventTemplates;
251 248
252 int mDestination; 249 int mDestination;
253 250
254 251
255 bool mEditOnDoubleClick; 252 bool mEditOnDoubleClick;
256 bool mViewChangeHoldFullscreen; 253 bool mViewChangeHoldFullscreen;
257 bool mViewChangeHoldNonFullscreen; 254 bool mViewChangeHoldNonFullscreen;
258 bool mCenterOnCurrentTime; 255 bool mCenterOnCurrentTime;
259 bool mSetTimeToDayStartAt; 256 bool mSetTimeToDayStartAt;
260 bool mHighlightCurrentDay; 257 bool mHighlightCurrentDay;
261 bool mUseHighlightLightColor; 258 bool mUseHighlightLightColor;
262 bool mListViewMonthTimespan; 259 bool mListViewMonthTimespan;
263 bool mWNViewShowsParents; 260 bool mWNViewShowsParents;
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index bd14fbf..2f286e0 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -58,97 +58,97 @@
58#include "kglobal.h" 58#include "kglobal.h"
59#include "klocale.h" 59#include "klocale.h"
60#include "kconfig.h" 60#include "kconfig.h"
61#include "simplealarmclient.h" 61#include "simplealarmclient.h"
62#include "externalapphandler.h" 62#include "externalapphandler.h"
63 63
64using namespace KCal; 64using namespace KCal;
65#ifndef _WIN32_ 65#ifndef _WIN32_
66#include <unistd.h> 66#include <unistd.h>
67#else 67#else
68#include "koimportoldialog.h" 68#include "koimportoldialog.h"
69#endif 69#endif
70#include "mainwindow.h" 70#include "mainwindow.h"
71 71
72class KOex2phonePrefs : public QDialog 72class KOex2phonePrefs : public QDialog
73{ 73{
74 public: 74 public:
75 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : 75 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) :
76 QDialog( parent, name, true ) 76 QDialog( parent, name, true )
77 { 77 {
78 setCaption( i18n("Export to phone options") ); 78 setCaption( i18n("Export to phone options") );
79 QVBoxLayout* lay = new QVBoxLayout( this ); 79 QVBoxLayout* lay = new QVBoxLayout( this );
80 lay->setSpacing( 3 ); 80 lay->setSpacing( 3 );
81 lay->setMargin( 3 ); 81 lay->setMargin( 3 );
82 QLabel *lab; 82 QLabel *lab;
83 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); 83 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) );
84 lab->setAlignment (AlignHCenter ); 84 lab->setAlignment (AlignHCenter );
85 QHBox* temphb; 85 QHBox* temphb;
86 temphb = new QHBox( this ); 86 temphb = new QHBox( this );
87 new QLabel( i18n("I/O device: "), temphb ); 87 new QLabel( i18n("I/O device: "), temphb );
88 mPhoneDevice = new QLineEdit( temphb); 88 mPhoneDevice = new QLineEdit( temphb);
89 lay->addWidget( temphb ); 89 lay->addWidget( temphb );
90 temphb = new QHBox( this ); 90 temphb = new QHBox( this );
91 new QLabel( i18n("Connection: "), temphb ); 91 new QLabel( i18n("Connection: "), temphb );
92 mPhoneConnection = new QLineEdit( temphb); 92 mPhoneConnection = new QLineEdit( temphb);
93 lay->addWidget( temphb ); 93 lay->addWidget( temphb );
94 temphb = new QHBox( this ); 94 temphb = new QHBox( this );
95 new QLabel( i18n("Model(opt.): "), temphb ); 95 new QLabel( i18n("Model(opt.): "), temphb );
96 mPhoneModel = new QLineEdit( temphb); 96 mPhoneModel = new QLineEdit( temphb);
97 lay->addWidget( temphb ); 97 lay->addWidget( temphb );
98 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); 98 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this );
99 mWriteBackFuture->setChecked( true ); 99 mWriteBackFuture->setChecked( true );
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() ) );
113 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 113 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
114 resize( 220, 240 ); 114 resize( 220, 240 );
115 115
116 } 116 }
117 117
118public: 118public:
119 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; 119 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
120 QCheckBox* mWriteBackFuture; 120 QCheckBox* mWriteBackFuture;
121 QSpinBox* mWriteBackFutureWeeks; 121 QSpinBox* mWriteBackFutureWeeks;
122}; 122};
123 123
124int globalFlagBlockStartup; 124int globalFlagBlockStartup;
125MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : 125MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
126 QMainWindow( parent, name ) 126 QMainWindow( parent, name )
127{ 127{
128 mPassWordPiSync = "abc"; 128 mPassWordPiSync = "abc";
129#ifdef DESKTOP_VERSION 129#ifdef DESKTOP_VERSION
130 setFont( QFont("Arial"), 14 ); 130 setFont( QFont("Arial"), 14 );
131#endif 131#endif
132 mSyncActionDialog = 0; 132 mSyncActionDialog = 0;
133 mServerSocket = 0; 133 mServerSocket = 0;
134 mClosed = false; 134 mClosed = false;
135 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; 135 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc";
136 QString confFile = locateLocal("config","korganizerrc"); 136 QString confFile = locateLocal("config","korganizerrc");
137 QFileInfo finf ( confFile ); 137 QFileInfo finf ( confFile );
138 bool showWarning = !finf.exists(); 138 bool showWarning = !finf.exists();
139 setIcon(SmallIcon( "ko24" ) ); 139 setIcon(SmallIcon( "ko24" ) );
140 mBlockAtStartup = true; 140 mBlockAtStartup = true;
141 mFlagKeyPressed = false; 141 mFlagKeyPressed = false;
142 setCaption("KOrganizer/Pi"); 142 setCaption("KOrganizer/Pi");
143 KOPrefs *p = KOPrefs::instance(); 143 KOPrefs *p = KOPrefs::instance();
144 KPimGlobalPrefs::instance()->setGlobalConfig(); 144 KPimGlobalPrefs::instance()->setGlobalConfig();
145 // if ( QApplication::desktop()->height() > 480 ) { 145 // if ( QApplication::desktop()->height() > 480 ) {
146// if ( p->mHourSize == 4 ) 146// if ( p->mHourSize == 4 )
147// p->mHourSize = 6; 147// p->mHourSize = 6;
148// } 148// }
149 if ( p->mHourSize > 18 ) 149 if ( p->mHourSize > 18 )
150 p->mHourSize = 18; 150 p->mHourSize = 18;
151 QMainWindow::ToolBarDock tbd; 151 QMainWindow::ToolBarDock tbd;
152 if ( p->mToolBarHor ) { 152 if ( p->mToolBarHor ) {
153 if ( p->mToolBarUp ) 153 if ( p->mToolBarUp )
154 tbd = Bottom; 154 tbd = Bottom;
@@ -1126,160 +1126,161 @@ void MainWindow::slotSyncMenu( int action )
1126 mView->setSyncDevice(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile] ); 1126 mView->setSyncDevice(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile] );
1127 mView->setSyncName( KOPrefs::instance()->mLocalMachineName ); 1127 mView->setSyncName( KOPrefs::instance()->mLocalMachineName );
1128 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); 1128 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) );
1129 KSyncProfile* temp = new KSyncProfile (); 1129 KSyncProfile* temp = new KSyncProfile ();
1130 temp->setName(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); 1130 temp->setName(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]);
1131 temp->readConfig(&config); 1131 temp->readConfig(&config);
1132 KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences(); 1132 KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences();
1133 KOPrefs::instance()->mSyncAlgoPrefs = temp->getSyncPrefs(); 1133 KOPrefs::instance()->mSyncAlgoPrefs = temp->getSyncPrefs();
1134 KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile(); 1134 KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile();
1135 KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting(); 1135 KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting();
1136 KOPrefs::instance()->mWriteBackInFuture = 0; 1136 KOPrefs::instance()->mWriteBackInFuture = 0;
1137 if ( temp->getWriteBackFuture() ) 1137 if ( temp->getWriteBackFuture() )
1138 KOPrefs::instance()->mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); 1138 KOPrefs::instance()->mWriteBackInFuture = temp->getWriteBackFutureWeeks( );
1139 KOPrefs::instance()->mShowSyncSummary = temp->getShowSummaryAfterSync(); 1139 KOPrefs::instance()->mShowSyncSummary = temp->getShowSummaryAfterSync();
1140 if ( action == 1000 ) { 1140 if ( action == 1000 ) {
1141 syncSharp(); 1141 syncSharp();
1142 1142
1143 } else if ( action == 1001 ) { 1143 } else if ( action == 1001 ) {
1144 syncLocalFile(); 1144 syncLocalFile();
1145 1145
1146 } else if ( action == 1002 ) { 1146 } else if ( action == 1002 ) {
1147 quickSyncLocalFile(); 1147 quickSyncLocalFile();
1148 1148
1149 } else if ( action >= 1003 ) { 1149 } else if ( action >= 1003 ) {
1150 if ( temp->getIsLocalFileSync() ) { 1150 if ( temp->getIsLocalFileSync() ) {
1151 if ( syncWithFile( temp->getRemoteFileName( ), false ) ) 1151 if ( syncWithFile( temp->getRemoteFileName( ), false ) )
1152 KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName(); 1152 KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName();
1153 } else { 1153 } else {
1154 if ( temp->getIsPhoneSync() ) { 1154 if ( temp->getIsPhoneSync() ) {
1155 KOPrefs::instance()->mPhoneDevice = temp->getPhoneDevice( ) ; 1155 KOPrefs::instance()->mPhoneDevice = temp->getPhoneDevice( ) ;
1156 KOPrefs::instance()->mPhoneConnection = temp->getPhoneConnection( ); 1156 KOPrefs::instance()->mPhoneConnection = temp->getPhoneConnection( );
1157 KOPrefs::instance()->mPhoneModel = temp->getPhoneModel( ); 1157 KOPrefs::instance()->mPhoneModel = temp->getPhoneModel( );
1158 syncPhone(); 1158 syncPhone();
1159 } else if ( temp->getIsPiSync() ) { 1159 } else if ( temp->getIsPiSync() ) {
1160 mPassWordPiSync = temp->getRemotePw(); 1160 mPassWordPiSync = temp->getRemotePw();
1161 KOPrefs::instance()->mActiveSyncPort = temp->getRemotePort(); 1161 KOPrefs::instance()->mActiveSyncPort = temp->getRemotePort();
1162 KOPrefs::instance()->mActiveSyncIP = temp->getRemoteIP(); 1162 KOPrefs::instance()->mActiveSyncIP = temp->getRemoteIP();
1163 syncPi(); 1163 syncPi();
1164 } else 1164 } else
1165 syncRemote( temp ); 1165 syncRemote( temp );
1166 1166
1167 } 1167 }
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 )
1198 delSel = mCalendar->rawIncidences(); 1199 delSel = mCalendar->rawIncidences();
1199 if ( mode == 2 ) 1200 if ( mode == 2 )
1200 delSel = mCalendar->incidences(); 1201 delSel = mCalendar->incidences();
1201 CalendarLocal* cal = new CalendarLocal(); 1202 CalendarLocal* cal = new CalendarLocal();
1202 cal->setLocalTime(); 1203 cal->setLocalTime();
1203 Incidence *incidence = delSel.first(); 1204 Incidence *incidence = delSel.first();
1204 QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); 1205 QDateTime cur = QDateTime::currentDateTime().addDays( -7 );
1205 QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); 1206 QDateTime end = cur.addDays( ( inFuture +1 ) *7 );
1206 while ( incidence ) { 1207 while ( incidence ) {
1207 if ( incidence->type() != "Journal" ) { 1208 if ( incidence->type() != "Journal" ) {
1208 bool add = true; 1209 bool add = true;
1209 if ( inFuture ) { 1210 if ( inFuture ) {
1210 QDateTime dt; 1211 QDateTime dt;
1211 if ( incidence->type() == "Todo" ) { 1212 if ( incidence->type() == "Todo" ) {
1212 Todo * t = (Todo*)incidence; 1213 Todo * t = (Todo*)incidence;
1213 if ( t->hasDueDate() ) 1214 if ( t->hasDueDate() )
1214 dt = t->dtDue(); 1215 dt = t->dtDue();
1215 else 1216 else
1216 dt = cur.addSecs( 62 ); 1217 dt = cur.addSecs( 62 );
1217 } 1218 }
1218 else { 1219 else {
1219 bool ok; 1220 bool ok;
1220 dt = incidence->getNextOccurence( cur, &ok ); 1221 dt = incidence->getNextOccurence( cur, &ok );
1221 if ( !ok ) 1222 if ( !ok )
1222 dt = cur.addSecs( -62 ); 1223 dt = cur.addSecs( -62 );
1223 } 1224 }
1224 if ( dt < cur || dt > end ) { 1225 if ( dt < cur || dt > end ) {
1225 add = false; 1226 add = false;
1226 } 1227 }
1227 } 1228 }
1228 if ( add ) { 1229 if ( add ) {
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!"));
1244 delete cal; 1245 delete cal;
1245} 1246}
1246 1247
1247 1248
1248void MainWindow::setDefaultPreferences() 1249void MainWindow::setDefaultPreferences()
1249{ 1250{
1250 KOPrefs *p = KOPrefs::instance(); 1251 KOPrefs *p = KOPrefs::instance();
1251 1252
1252 p->mCompactDialogs = true; 1253 p->mCompactDialogs = true;
1253 p->mConfirm = true; 1254 p->mConfirm = true;
1254 // p->mEnableQuickTodo = false; 1255 // p->mEnableQuickTodo = false;
1255 1256
1256} 1257}
1257 1258
1258QString MainWindow::resourcePath() 1259QString MainWindow::resourcePath()
1259{ 1260{
1260 return KGlobal::iconLoader()->iconPath(); 1261 return KGlobal::iconLoader()->iconPath();
1261} 1262}
1262 1263
1263void MainWindow::displayText( QString text ,QString cap ) 1264void MainWindow::displayText( QString text ,QString cap )
1264{ 1265{
1265 QDialog dia( this, "name", true ); ; 1266 QDialog dia( this, "name", true ); ;
1266 dia.setCaption( cap ); 1267 dia.setCaption( cap );
1267 QVBoxLayout* lay = new QVBoxLayout( &dia ); 1268 QVBoxLayout* lay = new QVBoxLayout( &dia );
1268 lay->setSpacing( 3 ); 1269 lay->setSpacing( 3 );
1269 lay->setMargin( 3 ); 1270 lay->setMargin( 3 );
1270 QTextBrowser tb ( &dia ); 1271 QTextBrowser tb ( &dia );
1271 lay->addWidget( &tb ); 1272 lay->addWidget( &tb );
1272 tb.setText( text ); 1273 tb.setText( text );
1273#ifdef DESKTOP_VERSION 1274#ifdef DESKTOP_VERSION
1274 dia.resize( 640, 480); 1275 dia.resize( 640, 480);
1275#else 1276#else
1276 dia.showMaximized(); 1277 dia.showMaximized();
1277#endif 1278#endif
1278 dia.exec(); 1279 dia.exec();
1279} 1280}
1280void MainWindow::displayFile( QString fn, QString cap ) 1281void MainWindow::displayFile( QString fn, QString cap )
1281{ 1282{
1282 QString fileName = resourcePath() + fn; 1283 QString fileName = resourcePath() + fn;
1283 QString text; 1284 QString text;
1284 QFile file( fileName ); 1285 QFile file( fileName );
1285 if (!file.open( IO_ReadOnly ) ) { 1286 if (!file.open( IO_ReadOnly ) ) {
diff --git a/libkdepim/kpimglobalprefs.cpp b/libkdepim/kpimglobalprefs.cpp
index b2b7663..b71e18d 100644
--- a/libkdepim/kpimglobalprefs.cpp
+++ b/libkdepim/kpimglobalprefs.cpp
@@ -54,80 +54,87 @@ KPimGlobalPrefs::KPimGlobalPrefs( const QString &name )
54 // addItemBool("ShortDateInViewer",&mShortDateInViewer,false); 54 // addItemBool("ShortDateInViewer",&mShortDateInViewer,false);
55 addItemString("UserDateFormatLong", &mUserDateFormatLong, "%A %d %b %y"); 55 addItemString("UserDateFormatLong", &mUserDateFormatLong, "%A %d %b %y");
56 addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y"); 56 addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y");
57 57
58 KPrefs::setCurrentGroup("Time & Date"); 58 KPrefs::setCurrentGroup("Time & Date");
59 59
60 addItemString("TimeZoneName",&mTimeZoneId,i18n ("+01:00 Europe/Oslo(CET)") ); 60 addItemString("TimeZoneName",&mTimeZoneId,i18n ("+01:00 Europe/Oslo(CET)") );
61 addItemBool("UseDaylightsaving",&mUseDaylightsaving,true); 61 addItemBool("UseDaylightsaving",&mUseDaylightsaving,true);
62 addItemInt("DaylightsavingStart",&mDaylightsavingStart,90); 62 addItemInt("DaylightsavingStart",&mDaylightsavingStart,90);
63 addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304); 63 addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304);
64 64
65 65
66 66
67 67
68 KPrefs::setCurrentGroup( "ExternalApplications" ); 68 KPrefs::setCurrentGroup( "ExternalApplications" );
69 69
70 addItemInt( "EmailChannelType", &mEmailClient, OMPI_EMC ); 70 addItemInt( "EmailChannelType", &mEmailClient, OMPI_EMC );
71 addItemString( "EmailChannel", &mEmailOtherChannel, "" ); 71 addItemString( "EmailChannel", &mEmailOtherChannel, "" );
72 addItemString( "EmailChannelMessage", &mEmailOtherMessage, "" ); 72 addItemString( "EmailChannelMessage", &mEmailOtherMessage, "" );
73 addItemString( "EmailChannelParameters", &mEmailOtherMessageParameters, "" ); 73 addItemString( "EmailChannelParameters", &mEmailOtherMessageParameters, "" );
74 addItemString( "EmailChannelMessage2", &mEmailOtherMessage2, "" ); 74 addItemString( "EmailChannelMessage2", &mEmailOtherMessage2, "" );
75 addItemString( "EmailChannelParameters2", &mEmailOtherMessageParameters2, "" ); 75 addItemString( "EmailChannelParameters2", &mEmailOtherMessageParameters2, "" );
76 76
77 addItemInt( "PhoneChannelType", &mPhoneClient, KPPI_PHC ); 77 addItemInt( "PhoneChannelType", &mPhoneClient, KPPI_PHC );
78 addItemString( "PhoneChannel", &mPhoneOtherChannel, "" ); 78 addItemString( "PhoneChannel", &mPhoneOtherChannel, "" );
79 addItemString( "PhoneChannelMessage", &mPhoneOtherMessage, "" ); 79 addItemString( "PhoneChannelMessage", &mPhoneOtherMessage, "" );
80 addItemString( "PhoneChannelParameters", &mPhoneOtherMessageParameters, "" ); 80 addItemString( "PhoneChannelParameters", &mPhoneOtherMessageParameters, "" );
81 81
82 addItemInt( "FaxChannelType", &mFaxClient, NONE_FAC ); 82 addItemInt( "FaxChannelType", &mFaxClient, NONE_FAC );
83 addItemString( "FaxChannel", &mFaxOtherChannel, "" ); 83 addItemString( "FaxChannel", &mFaxOtherChannel, "" );
84 addItemString( "FaxChannelMessage", &mFaxOtherMessage, "" ); 84 addItemString( "FaxChannelMessage", &mFaxOtherMessage, "" );
85 addItemString( "FaxChannelParameters", &mFaxOtherMessageParameters, "" ); 85 addItemString( "FaxChannelParameters", &mFaxOtherMessageParameters, "" );
86 86
87 addItemInt( "SMSChannelType", &mSMSClient, NONE_SMC ); 87 addItemInt( "SMSChannelType", &mSMSClient, NONE_SMC );
88 addItemString( "SMSChannel", &mSMSOtherChannel, "" ); 88 addItemString( "SMSChannel", &mSMSOtherChannel, "" );
89 addItemString( "SMSChannelMessage", &mSMSOtherMessage, "" ); 89 addItemString( "SMSChannelMessage", &mSMSOtherMessage, "" );
90 addItemString( "SMSChannelParameters", &mSMSOtherMessageParameters, "" ); 90 addItemString( "SMSChannelParameters", &mSMSOtherMessageParameters, "" );
91 91
92 addItemInt( "PagerChannelType", &mPagerClient, NONE_PAC ); 92 addItemInt( "PagerChannelType", &mPagerClient, NONE_PAC );
93 addItemString( "PagerChannel", &mPagerOtherChannel, "" ); 93 addItemString( "PagerChannel", &mPagerOtherChannel, "" );
94 addItemString( "PagerChannelMessage", &mPagerOtherMessage, "" ); 94 addItemString( "PagerChannelMessage", &mPagerOtherMessage, "" );
95 addItemString( "PagerChannelParameters", &mPagerOtherMessageParameters, "" ); 95 addItemString( "PagerChannelParameters", &mPagerOtherMessageParameters, "" );
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 );
108 KGlobal::locale()->setWeekStartMonday( !mWeekStartsOnSunday ); 115 KGlobal::locale()->setWeekStartMonday( !mWeekStartsOnSunday );
109 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)mPreferredDate ); 116 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)mPreferredDate );
110 KGlobal::locale()->setLanguage( mPreferredLanguage ); 117 KGlobal::locale()->setLanguage( mPreferredLanguage );
111 QString dummy = mUserDateFormatLong; 118 QString dummy = mUserDateFormatLong;
112 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); 119 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") ));
113 dummy = mUserDateFormatShort; 120 dummy = mUserDateFormatShort;
114 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); 121 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") ));
115 KGlobal::locale()->setDaylightSaving( mUseDaylightsaving, 122 KGlobal::locale()->setDaylightSaving( mUseDaylightsaving,
116 mDaylightsavingStart, 123 mDaylightsavingStart,
117 mDaylightsavingEnd ); 124 mDaylightsavingEnd );
118 KGlobal::locale()->setTimezone( mTimeZoneId ); 125 KGlobal::locale()->setTimezone( mTimeZoneId );
119 126
120} 127}
121KPimGlobalPrefs::~KPimGlobalPrefs() 128KPimGlobalPrefs::~KPimGlobalPrefs()
122{ 129{
123} 130}
124 131
125KPimGlobalPrefs *KPimGlobalPrefs::instance() 132KPimGlobalPrefs *KPimGlobalPrefs::instance()
126{ 133{
127 if ( !sInstance ) { 134 if ( !sInstance ) {
128 sInstance = staticDeleter.setObject( new KPimGlobalPrefs() ); 135 sInstance = staticDeleter.setObject( new KPimGlobalPrefs() );
129 sInstance->readConfig(); 136 sInstance->readConfig();
130 } 137 }
131 138
132 return sInstance; 139 return sInstance;
133} 140}
diff --git a/libkdepim/kpimglobalprefs.h b/libkdepim/kpimglobalprefs.h
index 84ba689..f6b6628 100644
--- a/libkdepim/kpimglobalprefs.h
+++ b/libkdepim/kpimglobalprefs.h
@@ -84,52 +84,55 @@ class KPimGlobalPrefs : public KPrefs
84 static KPimGlobalPrefs *sInstance; 84 static KPimGlobalPrefs *sInstance;
85 85
86 86
87 public: 87 public:
88 //US I copied the following "locale" settings from KOPrefs 88 //US I copied the following "locale" settings from KOPrefs
89 int mPreferredDate; 89 int mPreferredDate;
90 QString mUserDateFormatLong; 90 QString mUserDateFormatLong;
91 QString mUserDateFormatShort; 91 QString mUserDateFormatShort;
92 int mPreferredLanguage; 92 int mPreferredLanguage;
93 int mPreferredTime; 93 int mPreferredTime;
94 bool mWeekStartsOnSunday; 94 bool mWeekStartsOnSunday;
95 QString mTimeZoneId; 95 QString mTimeZoneId;
96 bool mUseDaylightsaving; 96 bool mUseDaylightsaving;
97 int mDaylightsavingStart; 97 int mDaylightsavingStart;
98 int mDaylightsavingEnd; 98 int mDaylightsavingEnd;
99 99
100 int mEmailClient; 100 int mEmailClient;
101 QString mEmailOtherChannel; 101 QString mEmailOtherChannel;
102 QString mEmailOtherMessage; 102 QString mEmailOtherMessage;
103 QString mEmailOtherMessageParameters; 103 QString mEmailOtherMessageParameters;
104 QString mEmailOtherMessage2; 104 QString mEmailOtherMessage2;
105 QString mEmailOtherMessageParameters2; 105 QString mEmailOtherMessageParameters2;
106 106
107 int mPhoneClient; 107 int mPhoneClient;
108 QString mPhoneOtherChannel; 108 QString mPhoneOtherChannel;
109 QString mPhoneOtherMessage; 109 QString mPhoneOtherMessage;
110 QString mPhoneOtherMessageParameters; 110 QString mPhoneOtherMessageParameters;
111 111
112 int mFaxClient; 112 int mFaxClient;
113 QString mFaxOtherChannel; 113 QString mFaxOtherChannel;
114 QString mFaxOtherMessage; 114 QString mFaxOtherMessage;
115 QString mFaxOtherMessageParameters; 115 QString mFaxOtherMessageParameters;
116 116
117 int mSMSClient; 117 int mSMSClient;
118 QString mSMSOtherChannel; 118 QString mSMSOtherChannel;
119 QString mSMSOtherMessage; 119 QString mSMSOtherMessage;
120 QString mSMSOtherMessageParameters; 120 QString mSMSOtherMessageParameters;
121 121
122 int mPagerClient; 122 int mPagerClient;
123 QString mPagerOtherChannel; 123 QString mPagerOtherChannel;
124 QString mPagerOtherMessage; 124 QString mPagerOtherMessage;
125 QString mPagerOtherMessageParameters; 125 QString mPagerOtherMessageParameters;
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
@@ -1,59 +1,61 @@
1 TEMPLATE= lib 1 TEMPLATE= lib
2 CONFIG = qt warn_on 2 CONFIG = qt warn_on
3DEFINES +=KORG_NOKABC 3DEFINES +=KORG_NOKABC
4TARGET = microkdepim 4TARGET = microkdepim
5INCLUDEPATH += ../microkde ../microkde/kdecore ../microkde/kdeui . .. 5INCLUDEPATH += ../microkde ../microkde/kdecore ../microkde/kdeui . ..
6DESTDIR=../bin 6DESTDIR=../bin
7 7
8DEFINES += DESKTOP_VERSION 8DEFINES += DESKTOP_VERSION
9include( ../variables.pri ) 9include( ../variables.pri )
10unix : { 10unix : {
11OBJECTS_DIR = obj/unix 11OBJECTS_DIR = obj/unix
12MOC_DIR = moc/unix 12MOC_DIR = moc/unix
13} 13}
14win32: { 14win32: {
15DEFINES += _WIN32_ 15DEFINES += _WIN32_
16OBJECTS_DIR = obj/win 16OBJECTS_DIR = obj/win
17MOC_DIR = moc/win 17MOC_DIR = moc/win
18} 18}
19INTERFACES = \ 19INTERFACES = \
20 20
21HEADERS = \ 21HEADERS = \
22 categoryeditdialog.h \ 22 categoryeditdialog.h \
23 categoryeditdialog_base.h \ 23 categoryeditdialog_base.h \
24 categoryselectdialog.h \ 24 categoryselectdialog.h \
25 categoryselectdialog_base.h \ 25 categoryselectdialog_base.h \
26 externalapphandler.h \ 26 externalapphandler.h \
27 kdateedit.h \ 27 kdateedit.h \
28 kdatepicker.h \ 28 kdatepicker.h \
29 kinputdialog.h \ 29 kinputdialog.h \
30 kpimprefs.h \ 30 kpimprefs.h \
31 kpimglobalprefs.h \ 31 kpimglobalprefs.h \
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 \
45 externalapphandler.cpp \ 46 externalapphandler.cpp \
46 kdateedit.cpp \ 47 kdateedit.cpp \
47 kdatepicker.cpp \ 48 kdatepicker.cpp \
48 kinputdialog.cpp \ 49 kinputdialog.cpp \
49 kpimprefs.cpp \ 50 kpimprefs.cpp \
50 kpimglobalprefs.cpp \ 51 kpimglobalprefs.cpp \
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
@@ -1,55 +1,57 @@
1 TEMPLATE= lib 1 TEMPLATE= lib
2 CONFIG += qt warn_on 2 CONFIG += qt warn_on
3TARGET = microkdepim 3TARGET = microkdepim
4INCLUDEPATH += . $(KDEPIMDIR) $(KDEPIMDIR)/microkde $(KDEPIMDIR)/qtcompat $(KDEPIMDIR)/microkde/kdecore $(KDEPIMDIR)/microkde/kdeui $(QPEDIR)/include 4INCLUDEPATH += . $(KDEPIMDIR) $(KDEPIMDIR)/microkde $(KDEPIMDIR)/qtcompat $(KDEPIMDIR)/microkde/kdecore $(KDEPIMDIR)/microkde/kdeui $(QPEDIR)/include
5LIBS += -lmicrokde 5LIBS += -lmicrokde
6#LIBS += -lmicrokcal 6#LIBS += -lmicrokcal
7LIBS += -L$(QPEDIR)/lib 7LIBS += -L$(QPEDIR)/lib
8OBJECTS_DIR = obj/$(PLATFORM) 8OBJECTS_DIR = obj/$(PLATFORM)
9MOC_DIR = moc/$(PLATFORM) 9MOC_DIR = moc/$(PLATFORM)
10DESTDIR=$(QPEDIR)/lib 10DESTDIR=$(QPEDIR)/lib
11 11
12 12
13INTERFACES = \ 13INTERFACES = \
14 14
15HEADERS = \ 15HEADERS = \
16 categoryeditdialog.h \ 16 categoryeditdialog.h \
17 categoryeditdialog_base.h \ 17 categoryeditdialog_base.h \
18 categoryselectdialog.h \ 18 categoryselectdialog.h \
19 categoryselectdialog_base.h \ 19 categoryselectdialog_base.h \
20 externalapphandler.h \ 20 externalapphandler.h \
21 kdateedit.h \ 21 kdateedit.h \
22 kdatepicker.h \ 22 kdatepicker.h \
23 kinputdialog.h \ 23 kinputdialog.h \
24 kpimprefs.h \ 24 kpimprefs.h \
25 kpimglobalprefs.h \ 25 kpimglobalprefs.h \
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 \
39 categoryselectdialog.cpp \ 40 categoryselectdialog.cpp \
40 categoryselectdialog_base.cpp \ 41 categoryselectdialog_base.cpp \
41 externalapphandler.cpp \ 42 externalapphandler.cpp \
42 kdateedit.cpp \ 43 kdateedit.cpp \
43 kinputdialog.cpp \ 44 kinputdialog.cpp \
44 kdatepicker.cpp \ 45 kdatepicker.cpp \
45 kpimprefs.cpp \ 46 kpimprefs.cpp \
46 kpimglobalprefs.cpp \ 47 kpimglobalprefs.cpp \
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