summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addressee.cpp16
-rw-r--r--kabc/addressee.h1
-rw-r--r--kaddressbook/kabcore.cpp8
-rw-r--r--kaddressbook/kabprefs.cpp3
-rw-r--r--kalarmd/simplealarmdaemonapplet.cpp1
-rw-r--r--kmicromail/koprefs.cpp381
-rw-r--r--korganizer/main.cpp6
-rw-r--r--korganizer/mainwindow.cpp6
-rw-r--r--korganizer/mainwindow.h2
-rw-r--r--libkdepim/kpimglobalprefs.cpp10
-rw-r--r--microkde/kstaticdeleter.h6
11 files changed, 40 insertions, 400 deletions
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp
index e571980..19a1845 100644
--- a/kabc/addressee.cpp
+++ b/kabc/addressee.cpp
@@ -294,48 +294,64 @@ void Addressee::mergeContact( const Addressee& ad )
294 if ( mData->mailer.isEmpty() ) mData->mailer = ad.mData->mailer; 294 if ( mData->mailer.isEmpty() ) mData->mailer = ad.mData->mailer;
295 if ( !mData->timeZone.isValid() ) mData->timeZone = ad.mData->timeZone; 295 if ( !mData->timeZone.isValid() ) mData->timeZone = ad.mData->timeZone;
296 if ( !mData->geo.isValid() ) mData->geo = ad.mData->geo; 296 if ( !mData->geo.isValid() ) mData->geo = ad.mData->geo;
297 if ( mData->title .isEmpty() ) mData->title = ad.mData->title ; 297 if ( mData->title .isEmpty() ) mData->title = ad.mData->title ;
298 if ( mData->role.isEmpty() ) mData->role = ad.mData->role ; 298 if ( mData->role.isEmpty() ) mData->role = ad.mData->role ;
299 if ( mData->organization.isEmpty() ) mData->organization = ad.mData->organization ; 299 if ( mData->organization.isEmpty() ) mData->organization = ad.mData->organization ;
300 if ( mData->note.isEmpty() ) mData->note = ad.mData->note ; 300 if ( mData->note.isEmpty() ) mData->note = ad.mData->note ;
301 if ( mData->productId.isEmpty() ) mData->productId = ad.mData->productId; 301 if ( mData->productId.isEmpty() ) mData->productId = ad.mData->productId;
302 if ( mData->sortString.isEmpty() ) mData->sortString = ad.mData->sortString; 302 if ( mData->sortString.isEmpty() ) mData->sortString = ad.mData->sortString;
303 if ( !mData->secrecy.isValid() ) mData->secrecy = ad.mData->secrecy; 303 if ( !mData->secrecy.isValid() ) mData->secrecy = ad.mData->secrecy;
304 if ( ( !mData->url.isValid() && ad.mData->url.isValid() ) ) mData->url = ad.mData->url ; 304 if ( ( !mData->url.isValid() && ad.mData->url.isValid() ) ) mData->url = ad.mData->url ;
305 305
306 // pending: 306 // pending:
307 // merging phonenumbers 307 // merging phonenumbers
308 // merging addresses 308 // merging addresses
309 // merging emails; 309 // merging emails;
310 // merging categories; 310 // merging categories;
311 // merging custom; 311 // merging custom;
312 // merging keys 312 // merging keys
313 qDebug("merge contact %s ", ad.uid().latin1()); 313 qDebug("merge contact %s ", ad.uid().latin1());
314 setUid( ad.uid() ); 314 setUid( ad.uid() );
315 setRevision( ad.revision() ); 315 setRevision( ad.revision() );
316} 316}
317 317
318void Addressee::simplifyAddresses()
319{
320 if ( mData->addresses.count() < 3 ) return ;
321 int count = 0;
322 Address::List list;
323 Address::List::Iterator it;
324 for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) {
325 if ( count > 1 )
326 list.append( *it );
327 ++count;
328 }
329 for( it = list.begin(); it != list.end(); ++it ) {
330 removeAddress( (*it) );
331 }
332}
333
318// removes all emails but the first 334// removes all emails but the first
319// needed by phone sync 335// needed by phone sync
320void Addressee::simplifyEmails() 336void Addressee::simplifyEmails()
321{ 337{
322 if ( mData->emails.count() == 0 ) return ; 338 if ( mData->emails.count() == 0 ) return ;
323 QString email = mData->emails.first(); 339 QString email = mData->emails.first();
324 detach(); 340 detach();
325 mData->emails.clear(); 341 mData->emails.clear();
326 mData->emails.append( email ); 342 mData->emails.append( email );
327} 343}
328 344
329void Addressee::simplifyPhoneNumbers() 345void Addressee::simplifyPhoneNumbers()
330{ 346{
331 KABC::PhoneNumber::List removeNumbers; 347 KABC::PhoneNumber::List removeNumbers;
332 KABC::PhoneNumber::List::Iterator phoneIter; 348 KABC::PhoneNumber::List::Iterator phoneIter;
333 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); 349 for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end();
334 ++phoneIter ) { 350 ++phoneIter ) {
335 if ( ! ( *phoneIter ).simplifyNumber() ) 351 if ( ! ( *phoneIter ).simplifyNumber() )
336 removeNumbers.append( ( *phoneIter ) ); 352 removeNumbers.append( ( *phoneIter ) );
337 } 353 }
338 for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end(); 354 for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end();
339 ++phoneIter ) { 355 ++phoneIter ) {
340 removePhoneNumber(( *phoneIter )); 356 removePhoneNumber(( *phoneIter ));
341 } 357 }
diff --git a/kabc/addressee.h b/kabc/addressee.h
index 4cafa86..44f0629 100644
--- a/kabc/addressee.h
+++ b/kabc/addressee.h
@@ -97,48 +97,49 @@ class Addressee
97 bool operator==( const Addressee & ) const; 97 bool operator==( const Addressee & ) const;
98 bool operator!=( const Addressee & ) const; 98 bool operator!=( const Addressee & ) const;
99 // sync stuff 99 // sync stuff
100 void setTempSyncStat(int id); 100 void setTempSyncStat(int id);
101 int tempSyncStat() const; 101 int tempSyncStat() const;
102 void setIDStr( const QString & ); 102 void setIDStr( const QString & );
103 QString IDStr() const; 103 QString IDStr() const;
104 void setID( const QString &, const QString & ); 104 void setID( const QString &, const QString & );
105 QString getID( const QString & ); 105 QString getID( const QString & );
106 void setCsum( const QString &, const QString & ); 106 void setCsum( const QString &, const QString & );
107 QString getCsum( const QString & ); 107 QString getCsum( const QString & );
108 void removeID(const QString &); 108 void removeID(const QString &);
109 void computeCsum(const QString &dev); 109 void computeCsum(const QString &dev);
110 ulong getCsum4List( const QStringList & attList); 110 ulong getCsum4List( const QStringList & attList);
111 /** 111 /**
112 Return, if the address book entry is empty. 112 Return, if the address book entry is empty.
113 */ 113 */
114 bool isEmpty() const; 114 bool isEmpty() const;
115 void setExternalUID( const QString &id ); 115 void setExternalUID( const QString &id );
116 QString externalUID() const; 116 QString externalUID() const;
117 void setOriginalExternalUID( const QString &id ); 117 void setOriginalExternalUID( const QString &id );
118 QString originalExternalUID() const; 118 QString originalExternalUID() const;
119 void mergeContact( const Addressee& ad ); 119 void mergeContact( const Addressee& ad );
120 void simplifyEmails(); 120 void simplifyEmails();
121 void simplifyAddresses();
121 void simplifyPhoneNumbers(); 122 void simplifyPhoneNumbers();
122 void simplifyPhoneNumberTypes(); 123 void simplifyPhoneNumberTypes();
123 124
124 /** 125 /**
125 Set unique identifier. 126 Set unique identifier.
126 */ 127 */
127 void setUid( const QString &uid ); 128 void setUid( const QString &uid );
128 /** 129 /**
129 Return unique identifier. 130 Return unique identifier.
130 */ 131 */
131 QString uid() const; 132 QString uid() const;
132 /** 133 /**
133 Return translated label for uid field. 134 Return translated label for uid field.
134 */ 135 */
135 static QString uidLabel(); 136 static QString uidLabel();
136 137
137 /** 138 /**
138 Set name. 139 Set name.
139 */ 140 */
140 void setName( const QString &name ); 141 void setName( const QString &name );
141 /** 142 /**
142 Return name. 143 Return name.
143 */ 144 */
144 QString name() const; 145 QString name() const;
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 939296f..9b059d3 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -297,52 +297,53 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const
297 297
298 298
299#ifndef KAB_EMBEDDED 299#ifndef KAB_EMBEDDED
300 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), 300 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ),
301 mXXPortManager, SLOT( importVCard( const KURL& ) ) ); 301 mXXPortManager, SLOT( importVCard( const KURL& ) ) );
302 302
303 connect( mDetails, SIGNAL( browse( const QString& ) ), 303 connect( mDetails, SIGNAL( browse( const QString& ) ),
304 SLOT( browse( const QString& ) ) ); 304 SLOT( browse( const QString& ) ) );
305 305
306 306
307 mAddressBookService = new KAddressBookService( this ); 307 mAddressBookService = new KAddressBookService( this );
308 308
309#endif //KAB_EMBEDDED 309#endif //KAB_EMBEDDED
310 mEditorDialog = 0; 310 mEditorDialog = 0;
311 createAddresseeEditorDialog( this ); 311 createAddresseeEditorDialog( this );
312 setModified( false ); 312 setModified( false );
313} 313}
314 314
315KABCore::~KABCore() 315KABCore::~KABCore()
316{ 316{
317 // save(); 317 // save();
318 //saveSettings(); 318 //saveSettings();
319 //KABPrefs::instance()->writeConfig(); 319 //KABPrefs::instance()->writeConfig();
320 delete AddresseeConfig::instance(); 320 delete AddresseeConfig::instance();
321 mAddressBook = 0; 321 mAddressBook = 0;
322 KABC::StdAddressBook::close(); 322 KABC::StdAddressBook::close();
323
324 delete syncManager;
323 325
324 delete syncManager;
325} 326}
326 327
327void KABCore::restoreSettings() 328void KABCore::restoreSettings()
328{ 329{
329 mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; 330 mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce;
330 331
331 bool state; 332 bool state;
332 333
333 if (mMultipleViewsAtOnce) 334 if (mMultipleViewsAtOnce)
334 state = KABPrefs::instance()->mDetailsPageVisible; 335 state = KABPrefs::instance()->mDetailsPageVisible;
335 else 336 else
336 state = false; 337 state = false;
337 338
338 mActionDetails->setChecked( state ); 339 mActionDetails->setChecked( state );
339 setDetailsVisible( state ); 340 setDetailsVisible( state );
340 341
341 state = KABPrefs::instance()->mJumpButtonBarVisible; 342 state = KABPrefs::instance()->mJumpButtonBarVisible;
342 343
343 mActionJumpBar->setChecked( state ); 344 mActionJumpBar->setChecked( state );
344 setJumpButtonBarVisible( state ); 345 setJumpButtonBarVisible( state );
345/*US 346/*US
346 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; 347 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter;
347 if ( splitterSize.count() == 0 ) { 348 if ( splitterSize.count() == 0 ) {
348 splitterSize.append( width() / 2 ); 349 splitterSize.append( width() / 2 );
@@ -681,48 +682,49 @@ void KABCore::export2phone()
681 KPimGlobalPrefs::instance()->mEx2PhoneConnection, 682 KPimGlobalPrefs::instance()->mEx2PhoneConnection,
682 KPimGlobalPrefs::instance()->mEx2PhoneModel ); 683 KPimGlobalPrefs::instance()->mEx2PhoneModel );
683 684
684 QStringList uids = mViewManager->selectedUids(); 685 QStringList uids = mViewManager->selectedUids();
685 if ( uids.isEmpty() ) 686 if ( uids.isEmpty() )
686 return; 687 return;
687 688
688#ifdef _WIN32_ 689#ifdef _WIN32_
689 QString fileName = locateLocal("tmp", "tempfile.vcf"); 690 QString fileName = locateLocal("tmp", "tempfile.vcf");
690#else 691#else
691 QString fileName = "/tmp/kdepimtemp.vcf"; 692 QString fileName = "/tmp/kdepimtemp.vcf";
692#endif 693#endif
693 694
694 KABC::VCardConverter converter; 695 KABC::VCardConverter converter;
695 QString description; 696 QString description;
696 QString datastream; 697 QString datastream;
697 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { 698 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
698 KABC::Addressee a = mAddressBook->findByUid( *it ); 699 KABC::Addressee a = mAddressBook->findByUid( *it );
699 700
700 if ( a.isEmpty() ) 701 if ( a.isEmpty() )
701 continue; 702 continue;
702 a.simplifyEmails(); 703 a.simplifyEmails();
703 a.simplifyPhoneNumbers(); 704 a.simplifyPhoneNumbers();
704 a.simplifyPhoneNumberTypes(); 705 a.simplifyPhoneNumberTypes();
706 a.simplifyAddresses();
705 707
706 if (description.isEmpty()) 708 if (description.isEmpty())
707 description = a.formattedName(); 709 description = a.formattedName();
708 QString vcard; 710 QString vcard;
709 QString vcardnew; 711 QString vcardnew;
710 converter.addresseeToVCard( a, vcard ); 712 converter.addresseeToVCard( a, vcard );
711 int start = 0; 713 int start = 0;
712 int next; 714 int next;
713 while ( (next = vcard.find("TYPE=", start) )>= 0 ) { 715 while ( (next = vcard.find("TYPE=", start) )>= 0 ) {
714 int semi = vcard.find(";", next); 716 int semi = vcard.find(";", next);
715 int dopp = vcard.find(":", next); 717 int dopp = vcard.find(":", next);
716 int sep; 718 int sep;
717 if ( semi < dopp && semi >= 0 ) 719 if ( semi < dopp && semi >= 0 )
718 sep = semi ; 720 sep = semi ;
719 else 721 else
720 sep = dopp; 722 sep = dopp;
721 vcardnew +=vcard.mid( start, next - start); 723 vcardnew +=vcard.mid( start, next - start);
722 vcardnew +=vcard.mid( next+5,sep -next -5 ).upper(); 724 vcardnew +=vcard.mid( next+5,sep -next -5 ).upper();
723 start = sep; 725 start = sep;
724 } 726 }
725 vcardnew += vcard.mid( start,vcard.length() ); 727 vcardnew += vcard.mid( start,vcard.length() );
726 vcard = ""; 728 vcard = "";
727 start = 0; 729 start = 0;
728 while ( (next = vcardnew.find("ADR", start) )>= 0 ) { 730 while ( (next = vcardnew.find("ADR", start) )>= 0 ) {
diff --git a/kaddressbook/kabprefs.cpp b/kaddressbook/kabprefs.cpp
index 552c933..dded2bf 100644
--- a/kaddressbook/kabprefs.cpp
+++ b/kaddressbook/kabprefs.cpp
@@ -61,50 +61,51 @@ KABPrefs::KABPrefs()
61 addItemIntList( "ExtensionsSplitter", &mExtensionsSplitter ); 61 addItemIntList( "ExtensionsSplitter", &mExtensionsSplitter );
62 addItemIntList( "DetailsSplitter", &mDetailsSplitter ); 62 addItemIntList( "DetailsSplitter", &mDetailsSplitter );
63 addItemBool( "MultipleViewsAtOnce", &mMultipleViewsAtOnce, true ); 63 addItemBool( "MultipleViewsAtOnce", &mMultipleViewsAtOnce, true );
64 64
65 65
66 KPrefs::setCurrentGroup( "Extensions_General" ); 66 KPrefs::setCurrentGroup( "Extensions_General" );
67 QStringList defaultExtensions; 67 QStringList defaultExtensions;
68 defaultExtensions << "merge"; 68 defaultExtensions << "merge";
69 defaultExtensions << "distribution_list_editor"; 69 defaultExtensions << "distribution_list_editor";
70 addItemInt( "CurrentExtension", &mCurrentExtension, 0 ); 70 addItemInt( "CurrentExtension", &mCurrentExtension, 0 );
71 addItemStringList( "ActiveExtensions", &mActiveExtensions, defaultExtensions ); 71 addItemStringList( "ActiveExtensions", &mActiveExtensions, defaultExtensions );
72 72
73 KPrefs::setCurrentGroup( "Views" ); 73 KPrefs::setCurrentGroup( "Views" );
74 QString defaultView = i18n( "Default Table View" ); 74 QString defaultView = i18n( "Default Table View" );
75 addItemString( "CurrentView", &mCurrentView, defaultView ); 75 addItemString( "CurrentView", &mCurrentView, defaultView );
76 addItemStringList( "ViewNames", &mViewNames, defaultView ); 76 addItemStringList( "ViewNames", &mViewNames, defaultView );
77 77
78 KPrefs::setCurrentGroup( "Filters" ); 78 KPrefs::setCurrentGroup( "Filters" );
79 addItemInt( "CurrentFilter", &mCurrentFilter, 0 ); 79 addItemInt( "CurrentFilter", &mCurrentFilter, 0 );
80 80
81} 81}
82 82
83KABPrefs::~KABPrefs() 83KABPrefs::~KABPrefs()
84{ 84{
85 //qDebug("KABPrefs::~KABPrefs() ");
85} 86}
86 87
87KABPrefs *KABPrefs::instance() 88KABPrefs *KABPrefs::instance()
88{ 89{
89 if ( !sInstance ) { 90 if ( !sInstance ) {
90#ifdef KAB_EMBEDDED 91#ifdef KAB_EMBEDDED
91 sInstance = staticDeleter.setObject( new KABPrefs() ); 92 sInstance = staticDeleter.setObject( new KABPrefs() );
92#else //KAB_EMBEDDED 93#else //KAB_EMBEDDED
93 //US the following line has changed ???. Why 94 //US the following line has changed ???. Why
94 staticDeleter.setObject( sInstance, new KABPrefs() ); 95 staticDeleter.setObject( sInstance, new KABPrefs() );
95#endif //KAB_EMBEDDED 96#endif //KAB_EMBEDDED
96 sInstance->readConfig(); 97 sInstance->readConfig();
97 } 98 }
98 99
99 return sInstance; 100 return sInstance;
100} 101}
101 102
102void KABPrefs::setCategoryDefaults() 103void KABPrefs::setCategoryDefaults()
103{ 104{
104 mCustomCategories.clear(); 105 mCustomCategories.clear();
105 106
106 mCustomCategories << i18n( "Business" ) << i18n( "Family" ) << i18n( "School" ) 107 mCustomCategories << i18n( "Business" ) << i18n( "Family" ) << i18n( "School" )
107 << i18n( "Customer" ) << i18n( "Friend" ); 108 << i18n( "Customer" ) << i18n( "Friend" );
108} 109}
109 110
110 // US introduce a nonconst way to return the config object. 111 // US introduce a nonconst way to return the config object.
diff --git a/kalarmd/simplealarmdaemonapplet.cpp b/kalarmd/simplealarmdaemonapplet.cpp
index bb89606..7e8125d 100644
--- a/kalarmd/simplealarmdaemonapplet.cpp
+++ b/kalarmd/simplealarmdaemonapplet.cpp
@@ -1,29 +1,28 @@
1#include "simplealarmdaemonapplet.h" 1#include "simplealarmdaemonapplet.h"
2 2
3#include "simplealarmdaemonimpl.h" 3#include "simplealarmdaemonimpl.h"
4 4
5#include <qpe/global.h>
6#include <qcopchannel_qws.h> 5#include <qcopchannel_qws.h>
7#include <qlabel.h> 6#include <qlabel.h>
8#include <qapp.h> 7#include <qapp.h>
9#include <qpe/resource.h> 8#include <qpe/resource.h>
10SimpleAlarmDaemonApplet::SimpleAlarmDaemonApplet() 9SimpleAlarmDaemonApplet::SimpleAlarmDaemonApplet()
11 : mApplet( 0 ), ref( 0 ) 10 : mApplet( 0 ), ref( 0 )
12{ 11{
13 12
14} 13}
15 14
16SimpleAlarmDaemonApplet::~SimpleAlarmDaemonApplet() 15SimpleAlarmDaemonApplet::~SimpleAlarmDaemonApplet()
17{ 16{
18 delete mApplet; 17 delete mApplet;
19} 18}
20 19
21 20
22QWidget *SimpleAlarmDaemonApplet::applet( QWidget *parent ) 21QWidget *SimpleAlarmDaemonApplet::applet( QWidget *parent )
23{ 22{
24 if ( !mApplet ) { 23 if ( !mApplet ) {
25 mApplet = new SimpleAlarmDaemonImpl( parent ); 24 mApplet = new SimpleAlarmDaemonImpl( parent );
26 if ( QApplication::desktop()->width() < 480 ) 25 if ( QApplication::desktop()->width() < 480 )
27 mApplet->setPixmap( Resource::loadPixmap( "ko16" ) ); 26 mApplet->setPixmap( Resource::loadPixmap( "ko16" ) );
28 else 27 else
29 mApplet->setPixmap( Resource::loadPixmap( "ko24" ) ); 28 mApplet->setPixmap( Resource::loadPixmap( "ko24" ) );
diff --git a/kmicromail/koprefs.cpp b/kmicromail/koprefs.cpp
index 6484c45..c0200ff 100644
--- a/kmicromail/koprefs.cpp
+++ b/kmicromail/koprefs.cpp
@@ -47,461 +47,82 @@
47 47
48 48
49KOPrefs *KOPrefs::mInstance = 0; 49KOPrefs *KOPrefs::mInstance = 0;
50static KStaticDeleter<KOPrefs> insd; 50static KStaticDeleter<KOPrefs> insd;
51 51
52KOPrefs::KOPrefs() : 52KOPrefs::KOPrefs() :
53 KPimPrefs("kopiemailrc") 53 KPimPrefs("kopiemailrc")
54{ 54{
55 mAppFont = QFont("helvetica",12); 55 mAppFont = QFont("helvetica",12);
56 mComposeFont = QFont("helvetica",12); 56 mComposeFont = QFont("helvetica",12);
57 mReadFont = QFont("helvetica",12); 57 mReadFont = QFont("helvetica",12);
58 58
59 KPrefs::setCurrentGroup("General"); 59 KPrefs::setCurrentGroup("General");
60 addItemString("SenderName",&mName,i18n ("Please set at") ); 60 addItemString("SenderName",&mName,i18n ("Please set at") );
61 addItemString("SenderEmail",&mEmail,i18n ("Settings@General TAB") ); 61 addItemString("SenderEmail",&mEmail,i18n ("Settings@General TAB") );
62 addItemBool("ViewMailAsHtml",&mViewAsHtml,false); 62 addItemBool("ViewMailAsHtml",&mViewAsHtml,false);
63 addItemBool("SendMailLater",&mSendLater,true); 63 addItemBool("SendMailLater",&mSendLater,true);
64 addItemBool("UseKapi",&mUseKapi,false); 64 addItemBool("UseKapi",&mUseKapi,false);
65 65
66 KPrefs::setCurrentGroup("Fonts"); 66 KPrefs::setCurrentGroup("Fonts");
67 addItemFont("Application Font",&mAppFont); 67 addItemFont("Application Font",&mAppFont);
68 addItemFont("Compose Font",&mComposeFont); 68 addItemFont("Compose Font",&mComposeFont);
69 addItemFont("Read Font",&mReadFont); 69 addItemFont("Read Font",&mReadFont);
70 70
71#if 0
72 mTimeBarFont = QFont("helvetica",10);//,QFont::Bold);
73 mDefaultViewFont = QFont("helvetica",10);
74 mDefaultMonthViewFont = QFont("helvetica",8);
75 mMarcusBainsFont= QFont("helvetica",10);
76 mDateNavigatorFont= QFont("helvetica",10, QFont::Bold);
77 mEditBoxFont = QFont("helvetica",12);
78 mJornalViewFont = QFont("helvetica",12);
79
80 KPrefs::setCurrentGroup("General");
81 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false);
82
83 addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true);
84 addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true);
85 addItemBool("ShowIconSearch",&mShowIconSearch,true);
86 addItemBool("ShowIconList",&mShowIconList,true);
87 addItemBool("ShowIconDay1",&mShowIconDay1,true);
88 addItemBool("ShowIconDay5",&mShowIconDay5,true);
89 addItemBool("ShowIconDay7",&mShowIconDay7,true);
90 addItemBool("ShowIconMonth",&mShowIconMonth,true);
91 addItemBool("ShowIconTodoview",&mShowIconTodoview,true);
92 addItemBool("ShowIconBackFast",&mShowIconBackFast,true);
93 addItemBool("ShowIconBack",&mShowIconBack,true);
94 addItemBool("ShowIconToday",&mShowIconToday,true);
95 addItemBool("ShowIconForward",&mShowIconForward,true);
96 addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true);
97 addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,false);
98 addItemBool("ShowIconNextDays",&mShowIconNextDays,true);
99 addItemBool("ShowIconNext",&mShowIconNext,true);
100 addItemBool("ShowIconJournal",&mShowIconJournal,true);
101 addItemBool("ShowIconStretch",&mShowIconStretch,true);
102 addItemBool("LanguageChanged",&mLanguageChanged,false);
103
104 addItemBool("AskForQuit",&mAskForQuit,false);
105
106#ifndef DESKTOP_VERSION
107 addItemBool("ShowFullMenu",&mShowFullMenu,false);
108#else
109 addItemBool("ShowFullMenu",&mShowFullMenu,true);
110#endif
111 addItemBool("ToolBarHor",&mToolBarHor, true );
112 addItemBool("ToolBarUp",&mToolBarUp, false );
113 addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false );
114 addItemInt("Whats Next Days",&mWhatsNextDays,3);
115 addItemInt("Whats Next Prios",&mWhatsNextPrios,1);
116
117 addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true);
118 addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true);
119 addItemInt("AllDay Size",&mAllDaySize,28);
120 QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav";
121 addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm );
122
123 addItemStringList("LocationDefaults",&mLocationDefaults );
124 addItemStringList("EventSummary User",&mEventSummaryUser);
125 addItemStringList("TodoSummary User",&mTodoSummaryUser);
126
127 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false);
128 addItemBool("Enable Project View",&mEnableProjectView,false);
129 addItemBool("Auto Save",&mAutoSave,false);
130 addItemInt("Auto Save Interval",&mAutoSaveInterval,3);
131 addItemBool("Confirm Deletes",&mConfirm,true);
132 addItemString("Archive File",&mArchiveFile);
133 addItemString("Html Export File",&mHtmlExportFile,
134 QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html"));
135 addItemBool("Html With Save",&mHtmlWithSave,false);
136
137 KPrefs::setCurrentGroup("Personal Settings");
138
139 addItemInt("Mail Client",&mMailClient,MailClientKMail);
140 addItemBool("Use Control Center Email",&mEmailControlCenter,false);
141 addItemBool("Bcc",&mBcc,false);
142
143 KPrefs::setCurrentGroup("Time & Date");
144
145 // addItemString("Time Zone",&mTimeZone,"+0100");
146 addItemString("TimeZoneName",&mTimeZoneId,i18n ("+01:00 Europe/Oslo(CET)") );
147 // addItemInt("TimeZoneOffset",&mTimeZoneOffset,60);
148 addItemBool("UseDaylightsaving",&mUseDaylightsaving,true);
149 addItemInt("DaylightsavingStart",&mDaylightsavingStart,90);
150 addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304);
151
152
153 addItemInt("Default Start Time",&mStartTime,10);
154 addItemInt("Default Duration",&mDefaultDuration,2);
155 addItemInt("Default Alarm Time",&mAlarmTime,3);
156 addItemInt("Daylight Savings",&mDaylightSavings,0);
157 KPrefs::setCurrentGroup("AlarmSettings");
158 addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20);
159 addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7);
160 addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5);
161 addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3);
162
163
164 KPrefs::setCurrentGroup("Calendar");
165
166 addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar);
167
168 KPrefs::setCurrentGroup("Fonts");
169 // qDebug(" KPrefs::setCurrentGroup(Fonts); ");
170 addItemFont("TimeBar Font",&mTimeBarFont);
171 addItemFont("MonthView Font",&mMonthViewFont);
172 addItemFont("AgendaView Font",&mAgendaViewFont);
173 addItemFont("MarcusBains Font",&mMarcusBainsFont);
174 addItemFont("TimeLabels Font",&mTimeLabelsFont);
175 addItemFont("TodoView Font",&mTodoViewFont);
176 addItemFont("ListView Font",&mListViewFont);
177 addItemFont("DateNavigator Font",&mDateNavigatorFont);
178 addItemFont("EditBox Font",&mEditBoxFont);
179 addItemFont("JournalView Font",&mJornalViewFont);
180 addItemFont("WhatsNextView Font",&mWhatsNextFont);
181 addItemFont("EventView Font",&mEventViewFont);
182
183// KPrefs::setCurrentGroup("SyncProfiles");
184// addItemString("LocalMachineName",&mLocalMachineName, "undefined");
185// addItemStringList("SyncProfileNames",&mSyncProfileNames);
186// addItemStringList("ExternSyncProfiles",&mExternSyncProfileNames);
187
188 KPrefs::setCurrentGroup("RemoteSyncing");
189// addItemBool("UsePasswd",&mUsePassWd,false);
190// addItemBool("WriteBackFile",&mWriteBackFile,true);
191// addItemBool("WriteBackExistingOnly",&mWriteBackExistingOnly,false);
192// addItemBool("AskForPreferences",&mAskForPreferences,true);
193// addItemBool("ShowSyncSummary",&mShowSyncSummary,true);
194 addItemBool("ShowSyncEvents",&mShowSyncEvents,false);
195 addItemInt("LastSyncTime",&mLastSyncTime,0);
196 addItemInt("SyncAlgoPrefs",&mSyncAlgoPrefs,3);
197 addItemInt("RingSyncAlgoPrefs",&mRingSyncAlgoPrefs,3);
198
199#ifdef _WIN32_
200 QString hdp= locateLocal("data","korganizer")+"\\\\";
201#else
202 QString hdp= locateLocal("data","korganizer")+"/";
203#endif
204// addItemString("RemoteIP",&mRemoteIP, "192.168.0.65");
205// addItemString("RemoteUser",&mRemoteUser, "zaurus");
206// addItemString("RemotePassWd",&mRemotePassWd, "");
207// addItemString("RemoteFile", &mRemoteFile, hdp+"mycalendar.ics");
208// addItemString("LocalTempFile",&mLocalTempFile, "/tmp/tempsyncfile.ics" );
209
210
211 KPrefs::setCurrentGroup("LoadSaveFileNames");
212
213 addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" );
214 addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" );
215 addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" );
216 addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" );
217 addItemString("LastSyncedLocalFile", &mLastSyncedLocalFile ,hdp +"lastsync.ics" );
218
219
220 KPrefs::setCurrentGroup("Locale");
221 addItemInt("PreferredLanguage",&mPreferredLanguage,0);
222 addItemInt("PreferredTime",&mPreferredTime,0);
223 addItemInt("PreferredDate",&mPreferredDate,0);
224 addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false);
225 addItemBool("QuickSavingWOUnicode",&mUseQuicksave,false);
226 addItemBool("ShortDateInViewer",&mShortDateInViewer,false);
227 addItemString("UserDateFormatLong", &mUserDateFormatLong, "%A %d %b %y");
228 addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y");
229
230
231 KPrefs::setCurrentGroup("Colors");
232 addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor);
233 addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor);
234 addItemColor("Event Color",&mEventColor,mDefaultCategoryColor);
235 addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor);
236 addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor);
237 addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor);
238 addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor);
239 addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 ));
240 addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 ));
241 addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 ));
242 addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true);
243 addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true);
244 addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false);
245 addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 ));
246 addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 ));
247 addItemBool("UseAppColors",&mUseAppColors,false);
248
249
250
251 KPrefs::setCurrentGroup("Views");
252 addItemInt("Hour Size",&mHourSize,8);
253 addItemBool("Show Daily Recurrences",&mDailyRecur,true);
254 addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true);
255 addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true);
256 addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true);
257 addItemBool("ShowShortMonthName",&mMonthShowShort,false);
258 addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true);
259 addItemBool("Enable ToolTips",&mEnableToolTips,false);
260 addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false);
261 addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false);
262 addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true);
263 addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true);
264 addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,false);
265 addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false);
266 addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false);
267 addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true);
268 addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true);
269 addItemBool("WNViewShowsParents",&mWNViewShowsParents,true);
270 addItemBool("WNViewShowLocation",&mWNViewShowLocation,false);
271 addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false);
272 addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true);
273 addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false);
274 addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false);
275 addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,false);
276 addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false);
277 addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false);
278#ifdef DESKTOP_VERSION
279 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true);
280#else
281 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false);
282#endif
283 addItemInt("Day Begins",&mDayBegins,7);
284 addItemInt("Working Hours Start",&mWorkingHoursStart,8);
285 addItemInt("Working Hours End",&mWorkingHoursEnd,17);
286 addItemBool("Exclude Holidays",&mExcludeHolidays,true);
287 addItemBool("Exclude Saturdays",&mExcludeSaturdays,true);
288
289 addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false);
290 addItemBool("Full View Month",&mFullViewMonth,true);
291 addItemBool("Full View Todo",&mFullViewTodo,true);
292 addItemBool("Quick Todo",&mEnableQuickTodo,false);
293
294 addItemInt("Next X Days",&mNextXDays,3);
295
296 KPrefs::setCurrentGroup("Printer");
297
298 KPrefs::setCurrentGroup("Layout");
299
300 addItemBool("CompactDialogs",&mCompactDialogs,false);
301 addItemBool("VerticalScreen",&mVerticalScreen,true);
302
303 KPrefs::setCurrentGroup("KOrganizer Plugins");
304
305 addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays");
306
307 KPrefs::setCurrentGroup("Group Scheduling");
308
309 addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail);
310 addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend);
311 addItemStringList("AdditionalMails",&mAdditionalMails,"");
312 addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto);
313 addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto);
314 addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto);
315 addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto);
316 addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto);
317
318 KPrefs::setCurrentGroup( "Editors" );
319
320 addItemStringList( "EventTemplates", &mEventTemplates );
321 addItemStringList( "TodoTemplates", &mTodoTemplates );
322
323 addItemInt("DestinationPolicy",&mDestination,standardDestination);
324
325#endif
326 71
327} 72}
328 73
329 74
330KOPrefs::~KOPrefs() 75KOPrefs::~KOPrefs()
331{ 76{
332 if (mInstance == this) 77 if (mInstance == this)
333 mInstance = insd.setObject(0); 78 mInstance = insd.setObject(0);
334#if 0 79
335 setLocaleDict( 0 );
336 if ( mLocaleDict )
337 delete mLocaleDict;
338 //qDebug("KOPrefs::~KOPrefs() ");
339#endif
340} 80}
341 81
342 82
343KOPrefs *KOPrefs::instance() 83KOPrefs *KOPrefs::instance()
344{ 84{
345 if (!mInstance) { 85 if (!mInstance) {
346 mInstance = insd.setObject(new KOPrefs()); 86 mInstance = insd.setObject(new KOPrefs());
347 mInstance->readConfig(); 87 mInstance->readConfig();
348 } 88 }
349 89
350 return mInstance; 90 return mInstance;
351} 91}
352 92
353void KOPrefs::usrSetDefaults() 93void KOPrefs::usrSetDefaults()
354{ 94{
355 95
356} 96}
357 97
358void KOPrefs::fillMailDefaults() 98void KOPrefs::fillMailDefaults()
359{ 99{
360 if (mName.isEmpty()) mName = i18n("Anonymous"); 100 if (mName.isEmpty()) mName = i18n("Anonymous");
361 if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere"); 101 if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere");
362} 102}
363 103
364void KOPrefs::setTimeZoneIdDefault() 104void KOPrefs::setTimeZoneIdDefault()
365{ 105{
366 mTimeZoneId = i18n("+01:00 Europe/Oslo(CET)"); 106 mTimeZoneId = i18n("+01:00 Europe/Oslo(CET)");
367} 107}
368 108
369 109
370void KOPrefs::usrReadConfig() 110void KOPrefs::usrReadConfig()
371{ 111{
372#if 0
373 mLocaleDict = 0;
374 // pending LR fix translation
375 // qDebug("KOPrefs::usrReadConfig() fix translation ");
376 if ( mPreferredLanguage > 0 && mPreferredLanguage < 4 ) {
377 if ( mPreferredLanguage == 1 ) {
378 mLocaleDict = new QDict<QString>;
379 int i = 0;
380 QString fw ( germanwords[i] [0]);
381 while ( !fw.isEmpty() ) {
382 mLocaleDict->insert( fw, new QString (germanwords[i] [1] ));
383 ++i;
384 fw = germanwords[i] [0];
385 }
386
387 setLocaleDict( mLocaleDict );
388 } else {
389 QString fileName ;
390 if ( mPreferredLanguage == 3 )
391 fileName = MainWindow::resourcePath()+"usertranslation.txt";
392 else if ( mPreferredLanguage == 2 )
393 fileName = MainWindow::resourcePath()+"frenchtranslation.txt";
394 QFile file( fileName );
395 if (file.open( IO_ReadOnly ) ) {
396 QTextStream ts( &file );
397 ts.setEncoding( QTextStream::Latin1 );
398 //ts.setCodec( QTextCodec::latin1 );
399 QString text = ts.read();
400 file.close();
401 text.replace( QRegExp("\\\\n"), "\n" );
402 QString line;
403 QString we;
404 QString wt;
405 int br = 0;
406 int nbr;
407 nbr = text.find ( "},", br );
408 line = text.mid( br, nbr - br );
409 br = nbr+1;
410 int se, ee, st, et;
411 mLocaleDict = new QDict<QString>;
412 QString end = "{ \"\",\"\" }";
413 while ( (line != end) && (br > 1) ) {
414 //qDebug("%d *%s* ", br, line.latin1());
415 se = line.find("\"")+1;
416 et = line.findRev("\"",-1);
417 ee = line.find("\",\"");
418 st = ee+3;
419 we = line.mid( se, ee-se );
420 wt = line.mid( st, et-st );
421 //qDebug("*%s* *%s* ", we.latin1(), wt.latin1());
422 mLocaleDict->insert( we, new QString (wt) );
423 nbr = text.find ( "}", br );
424 line = text.mid( br, nbr - br );
425 br = nbr+1;
426 }
427 //qDebug("end *%s* ", end.latin1());
428
429 setLocaleDict( mLocaleDict );
430 } else {
431 qDebug("KO: Cannot find translation file %s",fileName.latin1() );
432 }
433
434 }
435 }
436 config()->setGroup("General");
437
438 mCustomCategories = config()->readListEntry("Custom Categories");
439 if ( KOPrefs::instance()->mLanguageChanged ) {
440 mLocationDefaults.clear();
441 mEventSummaryUser.clear();
442 mTodoSummaryUser.clear();
443 }
444 if (mLocationDefaults.isEmpty()) {
445 mLocationDefaults << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach")
446 << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten")
447 << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ;
448 // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("")
449 mLocationDefaults.sort();
450 }
451
452 if (mEventSummaryUser.isEmpty()) {
453 mEventSummaryUser = getDefaultList() ;
454 }
455 if (mTodoSummaryUser.isEmpty()) {
456 mTodoSummaryUser = getDefaultList() ;
457 }
458
459 if (mCustomCategories.isEmpty()) setCategoryDefaults();
460
461 config()->setGroup("Personal Settings");
462 mName = config()->readEntry("user_name","");
463 mEmail = config()->readEntry("user_email","");
464 fillMailDefaults();
465 112
466 config()->setGroup("Category Colors");
467 QStringList::Iterator it;
468 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) {
469 setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor));
470
471 }
472
473 if (mTimeZoneId.isEmpty()) {
474 setTimeZoneIdDefault();
475 }
476#endif
477 KPimPrefs::usrReadConfig(); 113 KPimPrefs::usrReadConfig();
478} 114}
479 115
480 116
481void KOPrefs::usrWriteConfig() 117void KOPrefs::usrWriteConfig()
482{ 118{
483#if 0
484 config()->setGroup("General");
485 config()->writeEntry("Custom Categories",mCustomCategories);
486
487 config()->setGroup("Personal Settings");
488 config()->writeEntry("user_name",mName);
489 config()->writeEntry("user_email",mEmail);
490 119
491 config()->setGroup("Category Colors");
492 QDictIterator<QColor> it(mCategoryColors);
493 while (it.current()) {
494 config()->writeEntry(it.currentKey(),*(it.current()));
495 ++it;
496 }
497
498#endif
499 KPimPrefs::usrWriteConfig(); 120 KPimPrefs::usrWriteConfig();
500} 121}
501 122
502 123
503 124
504KConfig* KOPrefs::getConfig() 125KConfig* KOPrefs::getConfig()
505{ 126{
506 return config(); 127 return config();
507} 128}
diff --git a/korganizer/main.cpp b/korganizer/main.cpp
index 7f9b5c6..16186c0 100644
--- a/korganizer/main.cpp
+++ b/korganizer/main.cpp
@@ -1,28 +1,29 @@
1 1
2 2
3#ifndef DESKTOP_VERSION 3#ifndef DESKTOP_VERSION
4#include <qpe/qpeapplication.h> 4#include <qpe/qpeapplication.h>
5#include <qcopchannel_qws.h>
5#include <qpe/global.h> 6#include <qpe/global.h>
6#include <stdlib.h> 7#include <stdlib.h>
7#else 8#else
8#include <qapplication.h> 9#include <qapplication.h>
9#include <qstring.h> 10#include <qstring.h>
10#include <qwindowsstyle.h> 11#include <qwindowsstyle.h>
11#include <qplatinumstyle.h> 12#include <qplatinumstyle.h>
12#include <qsgistyle.h> 13#include <qsgistyle.h>
13#endif 14#endif
14 15
15#include <qdir.h> 16#include <qdir.h>
16#include <kstandarddirs.h> 17#include <kstandarddirs.h>
17#include <kglobal.h> 18#include <kglobal.h>
18#include <stdio.h> 19#include <stdio.h>
19#include "mainwindow.h" 20#include "mainwindow.h"
20 21
21int main( int argc, char **argv ) 22int main( int argc, char **argv )
22{ 23{
23#ifndef DESKTOP_VERSION 24#ifndef DESKTOP_VERSION
24 QPEApplication a( argc, argv ); 25 QPEApplication a( argc, argv );
25 a.setKeepRunning (); 26 a.setKeepRunning ();
26#else 27#else
27 QApplication a( argc, argv ); 28 QApplication a( argc, argv );
28 QApplication::setStyle( new QPlatinumStyle ()); 29 QApplication::setStyle( new QPlatinumStyle ());
@@ -58,45 +59,50 @@ int main( int argc, char **argv )
58 printf(" -showWeek: Week view\n"); 59 printf(" -showWeek: Week view\n");
59 printf(" -showTodo: Todo view\n"); 60 printf(" -showTodo: Todo view\n");
60 printf(" -showJournal: Journal view\n"); 61 printf(" -showJournal: Journal view\n");
61 printf(" -showKO: Next Days view\n"); 62 printf(" -showKO: Next Days view\n");
62 printf(" -showWNext: What's Next view\n"); 63 printf(" -showWNext: What's Next view\n");
63 printf(" -showNextXView: Next X View\n"); 64 printf(" -showNextXView: Next X View\n");
64 printf(" -new[Y] and -show[X] may be used togehther\n"); 65 printf(" -new[Y] and -show[X] may be used togehther\n");
65 printf(" KO/Pi is exiting now. Bye!\n"); 66 printf(" KO/Pi is exiting now. Bye!\n");
66 exitHelp = true; 67 exitHelp = true;
67 } 68 }
68 } 69 }
69 if ( ! exitHelp ) { 70 if ( ! exitHelp ) {
70 KGlobal::setAppName( "korganizer" ); 71 KGlobal::setAppName( "korganizer" );
71 QString fileName ; 72 QString fileName ;
72#ifndef DESKTOP_VERSION 73#ifndef DESKTOP_VERSION
73 fileName = getenv("QPEDIR"); 74 fileName = getenv("QPEDIR");
74 KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/korganizer/"); 75 KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/korganizer/");
75#else 76#else
76 fileName = qApp->applicationDirPath () + "/kdepim/korganizer/"; 77 fileName = qApp->applicationDirPath () + "/kdepim/korganizer/";
77 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); 78 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName));
78#endif 79#endif
79 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "korganizer"))); 80 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "korganizer")));
80 MainWindow m; 81 MainWindow m;
81#ifndef DESKTOP_VERSION 82#ifndef DESKTOP_VERSION
83 QCopChannel* c1 = new QCopChannel("QPE/Application/datebook",&m, "channel" ) ;
84 QObject::connect( c1, SIGNAL (received ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& )));
82 QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& ))); 85 QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& )));
83 a.showMainWidget(&m ); 86 a.showMainWidget(&m );
84#else 87#else
85 a.setMainWidget(&m ); 88 a.setMainWidget(&m );
86 m.show(); 89 m.show();
87 //m.resize( 800, 600 ); 90 //m.resize( 800, 600 );
88 QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); 91 QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
89#endif 92#endif
90 if ( argc > 1 ) { 93 if ( argc > 1 ) {
91 QCString command = argv[1]; 94 QCString command = argv[1];
92 if ( argc > 2 ) 95 if ( argc > 2 )
93 command += argv[2]; 96 command += argv[2];
94 qApp->processEvents(); 97 qApp->processEvents();
95 m.recieve(command, QByteArray() ); 98 m.recieve(command, QByteArray() );
96 99
97 } 100 }
98 a.exec(); 101 a.exec();
102#ifndef DESKTOP_VERSION
103 delete c1;
104#endif
99 105
100 } 106 }
101 qDebug("KO: Bye! "); 107 qDebug("KO: Bye! ");
102} 108}
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 2d17986..3c16458 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -109,49 +109,48 @@ class KOex2phonePrefs : public QDialog
109 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); 109 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
110 lay->addWidget( ok ); 110 lay->addWidget( ok );
111 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 111 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
112 lay->addWidget( cancel ); 112 lay->addWidget( cancel );
113 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 113 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
114 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 114 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
115 resize( 220, 240 ); 115 resize( 220, 240 );
116 116
117 } 117 }
118 118
119public: 119public:
120 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; 120 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
121 QCheckBox* mWriteBackFuture; 121 QCheckBox* mWriteBackFuture;
122 QSpinBox* mWriteBackFutureWeeks; 122 QSpinBox* mWriteBackFutureWeeks;
123}; 123};
124 124
125int globalFlagBlockStartup; 125int globalFlagBlockStartup;
126MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : 126MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
127 QMainWindow( parent, name ) 127 QMainWindow( parent, name )
128{ 128{
129 129
130#ifdef DESKTOP_VERSION 130#ifdef DESKTOP_VERSION
131 setFont( QFont("Arial"), 14 ); 131 setFont( QFont("Arial"), 14 );
132#endif 132#endif
133 mServerSocket = 0;
134 mClosed = false; 133 mClosed = false;
135 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; 134 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc";
136 QString confFile = locateLocal("config","korganizerrc"); 135 QString confFile = locateLocal("config","korganizerrc");
137 QFileInfo finf ( confFile ); 136 QFileInfo finf ( confFile );
138 bool showWarning = !finf.exists(); 137 bool showWarning = !finf.exists();
139 setIcon(SmallIcon( "ko24" ) ); 138 setIcon(SmallIcon( "ko24" ) );
140 mBlockAtStartup = true; 139 mBlockAtStartup = true;
141 mFlagKeyPressed = false; 140 mFlagKeyPressed = false;
142 setCaption("KOrganizer/Pi"); 141 setCaption("KOrganizer/Pi");
143 KOPrefs *p = KOPrefs::instance(); 142 KOPrefs *p = KOPrefs::instance();
144 KPimGlobalPrefs::instance()->setGlobalConfig(); 143 KPimGlobalPrefs::instance()->setGlobalConfig();
145 if ( p->mHourSize > 18 ) 144 if ( p->mHourSize > 18 )
146 p->mHourSize = 18; 145 p->mHourSize = 18;
147 QMainWindow::ToolBarDock tbd; 146 QMainWindow::ToolBarDock tbd;
148 if ( p->mToolBarHor ) { 147 if ( p->mToolBarHor ) {
149 if ( p->mToolBarUp ) 148 if ( p->mToolBarUp )
150 tbd = Bottom; 149 tbd = Bottom;
151 else 150 else
152 tbd = Top; 151 tbd = Top;
153 } 152 }
154 else { 153 else {
155 if ( p->mToolBarUp ) 154 if ( p->mToolBarUp )
156 tbd = Right; 155 tbd = Right;
157 else 156 else
@@ -258,52 +257,50 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
258 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); 257 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
259 mSyncManager->setDefaultFileName( defaultFileName()); 258 mSyncManager->setDefaultFileName( defaultFileName());
260 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); 259 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) );
261 mSyncManager->fillSyncMenu(); 260 mSyncManager->fillSyncMenu();
262 261
263 262
264 263
265 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); 264 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins );
266 if ( showWarning ) { 265 if ( showWarning ) {
267 KMessageBox::information( this, 266 KMessageBox::information( this,
268 "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); 267 "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information");
269 qApp->processEvents(); 268 qApp->processEvents();
270 mView->dialogManager()->showSyncOptions(); 269 mView->dialogManager()->showSyncOptions();
271 } 270 }
272 271
273 //US listen for result adressed from Ka/Pi 272 //US listen for result adressed from Ka/Pi
274#ifndef DESKTOP_VERSION 273#ifndef DESKTOP_VERSION
275 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 274 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
276#endif 275#endif
277} 276}
278MainWindow::~MainWindow() 277MainWindow::~MainWindow()
279{ 278{
280 //qDebug("MainWindow::~MainWindow() "); 279 //qDebug("MainWindow::~MainWindow() ");
281 //save toolbar location 280 //save toolbar location
282 delete mServerSocket;
283 delete mCalendar; 281 delete mCalendar;
284 delete KOPrefs::instance(); 282 delete mSyncManager;
285 delete KIncidenceFormatter::instance();
286 283
287 284
288} 285}
289void MainWindow::showMaximized () 286void MainWindow::showMaximized ()
290{ 287{
291#ifndef DESKTOP_VERSION 288#ifndef DESKTOP_VERSION
292 if ( ! globalFlagBlockStartup ) 289 if ( ! globalFlagBlockStartup )
293 if ( mClosed ) 290 if ( mClosed )
294 mView->goToday(); 291 mView->goToday();
295#endif 292#endif
296 QWidget::showMaximized () ; 293 QWidget::showMaximized () ;
297 mClosed = false; 294 mClosed = false;
298} 295}
299void MainWindow::closeEvent( QCloseEvent* ce ) 296void MainWindow::closeEvent( QCloseEvent* ce )
300{ 297{
301 298
302 299
303 300
304 if ( ! KOPrefs::instance()->mAskForQuit ) { 301 if ( ! KOPrefs::instance()->mAskForQuit ) {
305 saveOnClose(); 302 saveOnClose();
306 mClosed = true; 303 mClosed = true;
307 ce->accept(); 304 ce->accept();
308 return; 305 return;
309 306
@@ -461,49 +458,48 @@ void MainWindow::initActions()
461 menuBar1->insertItem( i18n("File"), importMenu ); 458 menuBar1->insertItem( i18n("File"), importMenu );
462 menuBar1->insertItem( i18n("View"), viewMenu ); 459 menuBar1->insertItem( i18n("View"), viewMenu );
463 menuBar1->insertItem( i18n("Actions"), actionMenu ); 460 menuBar1->insertItem( i18n("Actions"), actionMenu );
464 menuBar1->insertItem( i18n("Synchronize"), syncMenu ); 461 menuBar1->insertItem( i18n("Synchronize"), syncMenu );
465 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 462 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu );
466 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); 463 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu );
467 menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); 464 menuBar1->insertItem( i18n("Filter"),selectFilterMenu );
468 menuBar1->insertItem( i18n("Help"), helpMenu ); 465 menuBar1->insertItem( i18n("Help"), helpMenu );
469 } else { 466 } else {
470 QPEMenuBar *menuBar1; 467 QPEMenuBar *menuBar1;
471 menuBar1 = new QPEMenuBar( iconToolBar ); 468 menuBar1 = new QPEMenuBar( iconToolBar );
472 QPopupMenu *menuBar = new QPopupMenu( this ); 469 QPopupMenu *menuBar = new QPopupMenu( this );
473 menuBar1->insertItem( i18n("ME"), menuBar); 470 menuBar1->insertItem( i18n("ME"), menuBar);
474 menuBar->insertItem( i18n("File"), importMenu ); 471 menuBar->insertItem( i18n("File"), importMenu );
475 menuBar->insertItem( i18n("View"), viewMenu ); 472 menuBar->insertItem( i18n("View"), viewMenu );
476 menuBar->insertItem( i18n("Actions"), actionMenu ); 473 menuBar->insertItem( i18n("Actions"), actionMenu );
477 menuBar->insertItem( i18n("Synchronize"), syncMenu ); 474 menuBar->insertItem( i18n("Synchronize"), syncMenu );
478 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 475 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu );
479 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); 476 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu );
480 menuBar->insertItem( i18n("Filter"),selectFilterMenu ); 477 menuBar->insertItem( i18n("Filter"),selectFilterMenu );
481 menuBar->insertItem( i18n("Help"), helpMenu ); 478 menuBar->insertItem( i18n("Help"), helpMenu );
482 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); 479 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() );
483 menuBar1->setMaximumSize( menuBar1->sizeHint( )); 480 menuBar1->setMaximumSize( menuBar1->sizeHint( ));
484 } 481 }
485 connect ( syncMenu, SIGNAL( activated ( int ) ), this, SLOT (slotSyncMenu( int ) ) );
486 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 482 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
487 connect ( selectFilterMenu, SIGNAL( aboutToShow () ), this, SLOT (fillFilterMenu() ) ); 483 connect ( selectFilterMenu, SIGNAL( aboutToShow () ), this, SLOT (fillFilterMenu() ) );
488 484
489 // ****************** 485 // ******************
490 QAction *action; 486 QAction *action;
491 QIconSet icon; 487 QIconSet icon;
492 // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); 488 // QPopupMenu *configureMenu= new QPopupMenu( menuBar );
493 configureToolBarMenu->setCheckable( true ); 489 configureToolBarMenu->setCheckable( true );
494 490
495 QString pathString = ""; 491 QString pathString = "";
496 if ( !p->mToolBarMiniIcons ) { 492 if ( !p->mToolBarMiniIcons ) {
497 if ( QApplication::desktop()->width() < 480 ) 493 if ( QApplication::desktop()->width() < 480 )
498 pathString += "icons16/"; 494 pathString += "icons16/";
499 } else 495 } else
500 pathString += "iconsmini/"; 496 pathString += "iconsmini/";
501 configureAgendaMenu->setCheckable( true ); 497 configureAgendaMenu->setCheckable( true );
502 configureAgendaMenu->insertItem(i18n("Toggle Allday"), 1 ); 498 configureAgendaMenu->insertItem(i18n("Toggle Allday"), 1 );
503 configureAgendaMenu->insertSeparator(); 499 configureAgendaMenu->insertSeparator();
504 configureAgendaMenu->insertItem(i18n("Tiny"), 4 ); 500 configureAgendaMenu->insertItem(i18n("Tiny"), 4 );
505 configureAgendaMenu->insertItem(i18n("Small"), 6 ); 501 configureAgendaMenu->insertItem(i18n("Small"), 6 );
506 configureAgendaMenu->insertItem(i18n("Medium"), 8 ); 502 configureAgendaMenu->insertItem(i18n("Medium"), 8 );
507 configureAgendaMenu->insertItem(i18n("Normal"), 10 ); 503 configureAgendaMenu->insertItem(i18n("Normal"), 10 );
508 configureAgendaMenu->insertItem(i18n("Large"), 12 ); 504 configureAgendaMenu->insertItem(i18n("Large"), 12 );
509 configureAgendaMenu->insertItem(i18n("Big"), 14 ); 505 configureAgendaMenu->insertItem(i18n("Big"), 14 );
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h
index ee7bd87..e3383ed 100644
--- a/korganizer/mainwindow.h
+++ b/korganizer/mainwindow.h
@@ -71,50 +71,48 @@ class MainWindow : public QMainWindow
71 void printSel(); 71 void printSel();
72 void printCal(); 72 void printCal();
73 void saveCalendar(); 73 void saveCalendar();
74 void loadCalendar(); 74 void loadCalendar();
75 void exportVCalendar(); 75 void exportVCalendar();
76 void fillFilterMenu(); 76 void fillFilterMenu();
77 void selectFilter( int ); 77 void selectFilter( int );
78 void exportToPhone( int ); 78 void exportToPhone( int );
79 79
80 80
81 protected: 81 protected:
82 void displayText( QString, QString); 82 void displayText( QString, QString);
83 void displayFile( QString, QString); 83 void displayFile( QString, QString);
84 84
85 void enableIncidenceActions( bool ); 85 void enableIncidenceActions( bool );
86 86
87 private slots: 87 private slots:
88 QSocket* piSocket; 88 QSocket* piSocket;
89 QString piFileString; 89 QString piFileString;
90 QTime piTime; 90 QTime piTime;
91 void getFile( bool ); 91 void getFile( bool );
92 void syncFileRequest(); 92 void syncFileRequest();
93 private: 93 private:
94 KSyncManager* mSyncManager; 94 KSyncManager* mSyncManager;
95 //QTimer* mTimerCommandSocket;
96 KServerSocket * mServerSocket;
97 bool mClosed; 95 bool mClosed;
98 void saveOnClose(); 96 void saveOnClose();
99 bool mFlagKeyPressed; 97 bool mFlagKeyPressed;
100 bool mBlockAtStartup; 98 bool mBlockAtStartup;
101 QPEToolBar *iconToolBar; 99 QPEToolBar *iconToolBar;
102 void initActions(); 100 void initActions();
103 void setDefaultPreferences(); 101 void setDefaultPreferences();
104 void keyPressEvent ( QKeyEvent * ) ; 102 void keyPressEvent ( QKeyEvent * ) ;
105 void keyReleaseEvent ( QKeyEvent * ) ; 103 void keyReleaseEvent ( QKeyEvent * ) ;
106 QPopupMenu *configureToolBarMenu; 104 QPopupMenu *configureToolBarMenu;
107 QPopupMenu *selectFilterMenu; 105 QPopupMenu *selectFilterMenu;
108 QPopupMenu *configureAgendaMenu, *syncMenu; 106 QPopupMenu *configureAgendaMenu, *syncMenu;
109 CalendarLocal *mCalendar; 107 CalendarLocal *mCalendar;
110 CalendarView *mView; 108 CalendarView *mView;
111 QAction *mNewSubTodoAction; 109 QAction *mNewSubTodoAction;
112 110
113 QAction *mShowAction; 111 QAction *mShowAction;
114 QAction *mEditAction; 112 QAction *mEditAction;
115 QAction *mDeleteAction; 113 QAction *mDeleteAction;
116 QAction *mCloneAction; 114 QAction *mCloneAction;
117 QAction *mMoveAction; 115 QAction *mMoveAction;
118 QAction *mBeamAction; 116 QAction *mBeamAction;
119 QAction *mCancelAction; 117 QAction *mCancelAction;
120 118
diff --git a/libkdepim/kpimglobalprefs.cpp b/libkdepim/kpimglobalprefs.cpp
index b71e18d..5081b26 100644
--- a/libkdepim/kpimglobalprefs.cpp
+++ b/libkdepim/kpimglobalprefs.cpp
@@ -41,100 +41,98 @@ KPimGlobalPrefs *KPimGlobalPrefs::sInstance = 0;
41static KStaticDeleter<KPimGlobalPrefs> staticDeleter; 41static KStaticDeleter<KPimGlobalPrefs> staticDeleter;
42 42
43 43
44KPimGlobalPrefs::KPimGlobalPrefs( const QString &name ) 44KPimGlobalPrefs::KPimGlobalPrefs( const QString &name )
45 : KPrefs("microkdeglobalrc") 45 : KPrefs("microkdeglobalrc")
46{ 46{
47 47
48 KPrefs::setCurrentGroup("Locale"); 48 KPrefs::setCurrentGroup("Locale");
49 addItemInt("PreferredLanguage",&mPreferredLanguage,0); 49 addItemInt("PreferredLanguage",&mPreferredLanguage,0);
50 addItemInt("PreferredTime",&mPreferredTime,0); 50 addItemInt("PreferredTime",&mPreferredTime,0);
51 addItemInt("PreferredDate",&mPreferredDate,0); 51 addItemInt("PreferredDate",&mPreferredDate,0);
52 addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false); 52 addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false);
53 //addItemBool("QuickSavingWOUnicode",&mUseQuicksave,false); 53 //addItemBool("QuickSavingWOUnicode",&mUseQuicksave,false);
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
66
67
68 KPrefs::setCurrentGroup( "ExternalApplications" ); 65 KPrefs::setCurrentGroup( "ExternalApplications" );
69 66
70 addItemInt( "EmailChannelType", &mEmailClient, OMPI_EMC ); 67 addItemInt( "EmailChannelType", &mEmailClient, OMPI_EMC );
71 addItemString( "EmailChannel", &mEmailOtherChannel, "" ); 68 addItemString( "EmailChannel", &mEmailOtherChannel, "" );
72 addItemString( "EmailChannelMessage", &mEmailOtherMessage, "" ); 69 addItemString( "EmailChannelMessage", &mEmailOtherMessage, "" );
73 addItemString( "EmailChannelParameters", &mEmailOtherMessageParameters, "" ); 70 addItemString( "EmailChannelParameters", &mEmailOtherMessageParameters, "" );
74 addItemString( "EmailChannelMessage2", &mEmailOtherMessage2, "" ); 71 addItemString( "EmailChannelMessage2", &mEmailOtherMessage2, "" );
75 addItemString( "EmailChannelParameters2", &mEmailOtherMessageParameters2, "" ); 72 addItemString( "EmailChannelParameters2", &mEmailOtherMessageParameters2, "" );
76 73
77 addItemInt( "PhoneChannelType", &mPhoneClient, KPPI_PHC ); 74 addItemInt( "PhoneChannelType", &mPhoneClient, KPPI_PHC );
78 addItemString( "PhoneChannel", &mPhoneOtherChannel, "" ); 75 addItemString( "PhoneChannel", &mPhoneOtherChannel, "" );
79 addItemString( "PhoneChannelMessage", &mPhoneOtherMessage, "" ); 76 addItemString( "PhoneChannelMessage", &mPhoneOtherMessage, "" );
80 addItemString( "PhoneChannelParameters", &mPhoneOtherMessageParameters, "" ); 77 addItemString( "PhoneChannelParameters", &mPhoneOtherMessageParameters, "" );
81 78
82 addItemInt( "FaxChannelType", &mFaxClient, NONE_FAC ); 79 addItemInt( "FaxChannelType", &mFaxClient, NONE_FAC );
83 addItemString( "FaxChannel", &mFaxOtherChannel, "" ); 80 addItemString( "FaxChannel", &mFaxOtherChannel, "" );
84 addItemString( "FaxChannelMessage", &mFaxOtherMessage, "" ); 81 addItemString( "FaxChannelMessage", &mFaxOtherMessage, "" );
85 addItemString( "FaxChannelParameters", &mFaxOtherMessageParameters, "" ); 82 addItemString( "FaxChannelParameters", &mFaxOtherMessageParameters, "" );
86 83
87 addItemInt( "SMSChannelType", &mSMSClient, NONE_SMC ); 84 addItemInt( "SMSChannelType", &mSMSClient, NONE_SMC );
88 addItemString( "SMSChannel", &mSMSOtherChannel, "" ); 85 addItemString( "SMSChannel", &mSMSOtherChannel, "" );
89 addItemString( "SMSChannelMessage", &mSMSOtherMessage, "" ); 86 addItemString( "SMSChannelMessage", &mSMSOtherMessage, "" );
90 addItemString( "SMSChannelParameters", &mSMSOtherMessageParameters, "" ); 87 addItemString( "SMSChannelParameters", &mSMSOtherMessageParameters, "" );
91 88
92 addItemInt( "PagerChannelType", &mPagerClient, NONE_PAC ); 89 addItemInt( "PagerChannelType", &mPagerClient, NONE_PAC );
93 addItemString( "PagerChannel", &mPagerOtherChannel, "" ); 90 addItemString( "PagerChannel", &mPagerOtherChannel, "" );
94 addItemString( "PagerChannelMessage", &mPagerOtherMessage, "" ); 91 addItemString( "PagerChannelMessage", &mPagerOtherMessage, "" );
95 addItemString( "PagerChannelParameters", &mPagerOtherMessageParameters, "" ); 92 addItemString( "PagerChannelParameters", &mPagerOtherMessageParameters, "" );
96 93
97 addItemInt( "SIPChannelType", &mSipClient, NONE_SIC ); 94 addItemInt( "SIPChannelType", &mSipClient, NONE_SIC );
98 addItemString( "SIPChannel", &mSipOtherChannel, "" ); 95 addItemString( "SIPChannel", &mSipOtherChannel, "" );
99 addItemString( "SIPChannelMessage", &mSipOtherMessage, "" ); 96 addItemString( "SIPChannelMessage", &mSipOtherMessage, "" );
100 addItemString( "SIPChannelParameters", &mSipOtherMessageParameters, "" ); 97 addItemString( "SIPChannelParameters", &mSipOtherMessageParameters, "" );
101 98
102
103 KPrefs::setCurrentGroup( "PhoneAccess" ); 99 KPrefs::setCurrentGroup( "PhoneAccess" );
104 addItemString("Ex2PhoneDevice",&mEx2PhoneDevice,"/dev/ircomm"); 100 addItemString("Ex2PhoneDevice",&mEx2PhoneDevice,"/dev/ircomm");
105 addItemString("Ex2PhoneConnection",&mEx2PhoneConnection,"irda"); 101 addItemString("Ex2PhoneConnection",&mEx2PhoneConnection,"irda");
106 addItemString("Ex2PhoneModel",&mEx2PhoneModel,"6310i"); 102 addItemString("Ex2PhoneModel",&mEx2PhoneModel,"6310i");
107 103
108
109} 104}
110 105
106
111void KPimGlobalPrefs::setGlobalConfig() 107void KPimGlobalPrefs::setGlobalConfig()
112{ 108{
113 109
114 KGlobal::locale()->setHore24Format( !mPreferredTime ); 110 KGlobal::locale()->setHore24Format( !mPreferredTime );
115 KGlobal::locale()->setWeekStartMonday( !mWeekStartsOnSunday ); 111 KGlobal::locale()->setWeekStartMonday( !mWeekStartsOnSunday );
116 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)mPreferredDate ); 112 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)mPreferredDate );
117 KGlobal::locale()->setLanguage( mPreferredLanguage ); 113 KGlobal::locale()->setLanguage( mPreferredLanguage );
118 QString dummy = mUserDateFormatLong; 114 QString dummy = mUserDateFormatLong;
119 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); 115 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") ));
120 dummy = mUserDateFormatShort; 116 dummy = mUserDateFormatShort;
121 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); 117 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") ));
122 KGlobal::locale()->setDaylightSaving( mUseDaylightsaving, 118 KGlobal::locale()->setDaylightSaving( mUseDaylightsaving,
123 mDaylightsavingStart, 119 mDaylightsavingStart,
124 mDaylightsavingEnd ); 120 mDaylightsavingEnd );
125 KGlobal::locale()->setTimezone( mTimeZoneId ); 121 KGlobal::locale()->setTimezone( mTimeZoneId );
126 122
127} 123}
128KPimGlobalPrefs::~KPimGlobalPrefs() 124KPimGlobalPrefs::~KPimGlobalPrefs()
129{ 125{
126 //qDebug("KPimGlobalPrefs::~KPimGlobalPrefs() ");
127 writeConfig();
130} 128}
131 129
132KPimGlobalPrefs *KPimGlobalPrefs::instance() 130KPimGlobalPrefs *KPimGlobalPrefs::instance()
133{ 131{
134 if ( !sInstance ) { 132 if ( !sInstance ) {
135 sInstance = staticDeleter.setObject( new KPimGlobalPrefs() ); 133 sInstance = staticDeleter.setObject( new KPimGlobalPrefs() );
136 sInstance->readConfig(); 134 sInstance->readConfig();
137 } 135 }
138 136
139 return sInstance; 137 return sInstance;
140} 138}
diff --git a/microkde/kstaticdeleter.h b/microkde/kstaticdeleter.h
index 190f3e4..dfd3929 100644
--- a/microkde/kstaticdeleter.h
+++ b/microkde/kstaticdeleter.h
@@ -7,29 +7,31 @@
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
11 * This library is distributed in the hope that it will be useful, 11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details. 14 * Library General Public License for more details.
15 * 15 *
16 * You should have received a copy of the GNU Library General Public License 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 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, 18 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA. 19 * Boston, MA 02111-1307, USA.
20 * 20 *
21 */ 21 */
22 22
23#ifndef _KSTATIC_DELETER_H_ 23#ifndef _KSTATIC_DELETER_H_
24#define _KSTATIC_DELETER_H_ 24#define _KSTATIC_DELETER_H_
25 25
26template<class type> 26template<class type>
27class KStaticDeleter 27class KStaticDeleter
28{ 28{
29 public: 29 public:
30 KStaticDeleter() {}; 30 KStaticDeleter() {};
31 type *setObject( type *obj, bool isArray = false) { return obj; } 31 type *setObject( type *obj, bool isArray = false) { _mobj = obj;return obj; }
32 virtual ~KStaticDeleter() {}; 32 virtual ~KStaticDeleter() {delete _mobj;};
33 private:
34 type* _mobj;
33}; 35};
34 36
35#endif 37#endif