summaryrefslogtreecommitdiffabout
authorulf69 <ulf69>2004-08-05 22:50:37 (UTC)
committer ulf69 <ulf69>2004-08-05 22:50:37 (UTC)
commitc807547c32dd25e9d181d396590af9915b7a1166 (patch) (unidiff)
tree0950df8ef9653ab30e2faebf67bdd254e0ec1b8a
parentbb1dd236b41cbd5cc4aed3b320801aa07974122d (diff)
downloadkdepimpi-c807547c32dd25e9d181d396590af9915b7a1166.zip
kdepimpi-c807547c32dd25e9d181d396590af9915b7a1166.tar.gz
kdepimpi-c807547c32dd25e9d181d396590af9915b7a1166.tar.bz2
enabled the sending of emails to selected contacts, and mailing of vCards
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp94
-rw-r--r--kaddressbook/kabprefs.cpp3
-rw-r--r--kaddressbook/kabprefs.h12
-rw-r--r--kaddressbook/kcmconfigs/kabconfigwidget.cpp109
-rw-r--r--kaddressbook/kcmconfigs/kabconfigwidget.h8
-rw-r--r--microkde/kdialogbase.cpp1
-rw-r--r--microkde/kutils/kcmultidialog.cpp3
7 files changed, 196 insertions, 34 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index a7ca0ce..2a54900 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -69,42 +69,54 @@
69#include "kactioncollection.h" 69#include "kactioncollection.h"
70#include <qapp.h> 70#include <qapp.h>
71#include <qmenubar.h> 71#include <qmenubar.h>
72//#include <qtoolbar.h> 72//#include <qtoolbar.h>
73#include <qmessagebox.h> 73#include <qmessagebox.h>
74#include <kdebug.h> 74#include <kdebug.h>
75#include <kiconloader.h> // needed for SmallIcon 75#include <kiconloader.h> // needed for SmallIcon
76#include <kresources/kcmkresources.h> 76#include <kresources/kcmkresources.h>
77#include <ktoolbar.h> 77#include <ktoolbar.h>
78 78
79#include <kcmkabconfig.h> 79#include <kcmkabconfig.h>
80 80
81//US#include <qpe/resource.h> // needed for Resource::loadPixmap
82//#include <qlabel.h> 81//#include <qlabel.h>
82
83
84#ifdef Q_WS_QWS
85#include <qtopia/services.h>
86#include <qtopia/qcopenvelope_qws.h>
87#endif
88
83#endif // KAB_EMBEDDED 89#endif // KAB_EMBEDDED
84#include <kcmkabconfig.h> 90#include <kcmkabconfig.h>
85 91
86 92
87#include <kresources/selectdialog.h> 93#include <kresources/selectdialog.h>
88#include <kmessagebox.h> 94#include <kmessagebox.h>
89 95
90#include <picture.h> 96#include <picture.h>
91#include <resource.h> 97#include <resource.h>
92 98
93//US#include <qsplitter.h> 99//US#include <qsplitter.h>
100#include <qmap.h>
101#include <qdir.h>
102#include <qfile.h>
94#include <qvbox.h> 103#include <qvbox.h>
95#include <qlayout.h> 104#include <qlayout.h>
96#include <qclipboard.h> 105#include <qclipboard.h>
106#include <qtextstream.h>
97 107
98#include <libkdepim/categoryselectdialog.h> 108#include <libkdepim/categoryselectdialog.h>
109#include <kabc/vcardconverter.h>
110
99 111
100#include "addresseeutil.h" 112#include "addresseeutil.h"
101#include "undocmds.h" 113#include "undocmds.h"
102#include "addresseeeditordialog.h" 114#include "addresseeeditordialog.h"
103#include "viewmanager.h" 115#include "viewmanager.h"
104#include "details/detailsviewcontainer.h" 116#include "details/detailsviewcontainer.h"
105#include "kabprefs.h" 117#include "kabprefs.h"
106#include "xxportmanager.h" 118#include "xxportmanager.h"
107#include "incsearchwidget.h" 119#include "incsearchwidget.h"
108#include "jumpbuttonbar.h" 120#include "jumpbuttonbar.h"
109#include "extensionmanager.h" 121#include "extensionmanager.h"
110#include "addresseeconfig.h" 122#include "addresseeconfig.h"
@@ -120,28 +132,25 @@ bool pasteWithNewUid = true;
120#ifdef KAB_EMBEDDED 132#ifdef KAB_EMBEDDED
121KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) 133KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name )
122 : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), 134 : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ),
123 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ 135 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/
124 mReadWrite( readWrite ), mModified( false ), mMainWindow(client) 136 mReadWrite( readWrite ), mModified( false ), mMainWindow(client)
125#else //KAB_EMBEDDED 137#else //KAB_EMBEDDED
126KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) 138KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name )
127 : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), 139 : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ),
128 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), 140 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ),
129 mReadWrite( readWrite ), mModified( false ) 141 mReadWrite( readWrite ), mModified( false )
130#endif //KAB_EMBEDDED 142#endif //KAB_EMBEDDED
131{ 143{
132#ifdef KAB_EMBEDDED 144
133 //US we define here our own global actioncollection.
134 //mActionCollection = new KActionCollection(this);
135#endif //KAB_EMBEDDED
136 mExtensionBarSplitter = 0; 145 mExtensionBarSplitter = 0;
137 mIsPart = !parent->inherits( "KAddressBookMain" ); 146 mIsPart = !parent->inherits( "KAddressBookMain" );
138 147
139 mAddressBook = KABC::StdAddressBook::self(); 148 mAddressBook = KABC::StdAddressBook::self();
140 KABC::StdAddressBook::setAutomaticSave( false ); 149 KABC::StdAddressBook::setAutomaticSave( false );
141 150
142#ifndef KAB_EMBEDDED 151#ifndef KAB_EMBEDDED
143 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); 152 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler );
144#endif //KAB_EMBEDDED 153#endif //KAB_EMBEDDED
145 154
146 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), 155 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ),
147 SLOT( addressBookChanged() ) ); 156 SLOT( addressBookChanged() ) );
@@ -187,55 +196,50 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const
187 SLOT( setModified() ) ); 196 SLOT( setModified() ) );
188 197
189 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); 198 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) );
190 199
191 connect( mXXPortManager, SIGNAL( modified() ), 200 connect( mXXPortManager, SIGNAL( modified() ),
192 SLOT( setModified() ) ); 201 SLOT( setModified() ) );
193 202
194 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), 203 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ),
195 SLOT( incrementalSearch( const QString& ) ) ); 204 SLOT( incrementalSearch( const QString& ) ) );
196 connect( mIncSearchWidget, SIGNAL( fieldChanged() ), 205 connect( mIncSearchWidget, SIGNAL( fieldChanged() ),
197 mJumpButtonBar, SLOT( recreateButtons() ) ); 206 mJumpButtonBar, SLOT( recreateButtons() ) );
198 207
208 connect( mDetails, SIGNAL( sendEmail( const QString& ) ),
209 SLOT( sendMail( const QString& ) ) );
210
199#ifndef KAB_EMBEDDED 211#ifndef KAB_EMBEDDED
200 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), 212 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ),
201 mXXPortManager, SLOT( importVCard( const KURL& ) ) ); 213 mXXPortManager, SLOT( importVCard( const KURL& ) ) );
202 214
203 connect( mDetails, SIGNAL( sendEmail( const QString& ) ),
204 SLOT( sendMail( const QString& ) ) );
205 connect( mDetails, SIGNAL( browse( const QString& ) ), 215 connect( mDetails, SIGNAL( browse( const QString& ) ),
206 SLOT( browse( const QString& ) ) ); 216 SLOT( browse( const QString& ) ) );
207 217
208 mAddressBookService = new KAddressBookService( this ); 218 mAddressBookService = new KAddressBookService( this );
209 219
210#endif //KAB_EMBEDDED 220#endif //KAB_EMBEDDED
211 mEditorDialog = 0; 221 mEditorDialog = 0;
212 createAddresseeEditorDialog( this ); 222 createAddresseeEditorDialog( this );
213 setModified( false ); 223 setModified( false );
214} 224}
215 225
216KABCore::~KABCore() 226KABCore::~KABCore()
217{ 227{
218 // save(); 228 // save();
219 //saveSettings(); 229 //saveSettings();
220 //KABPrefs::instance()->writeConfig(); 230 //KABPrefs::instance()->writeConfig();
221 delete AddresseeConfig::instance(); 231 delete AddresseeConfig::instance();
222 mAddressBook = 0; 232 mAddressBook = 0;
223 KABC::StdAddressBook::close(); 233 KABC::StdAddressBook::close();
224
225#ifdef KAB_EMBEDDED
226 //US we define here our own global actioncollection.
227 // delete mActionCollection;
228#endif //KAB_EMBEDDED
229
230} 234}
231 235
232void KABCore::restoreSettings() 236void KABCore::restoreSettings()
233{ 237{
234 bool state = KABPrefs::instance()->mJumpButtonBarVisible; 238 bool state = KABPrefs::instance()->mJumpButtonBarVisible;
235 239
236 mActionJumpBar->setChecked( state ); 240 mActionJumpBar->setChecked( state );
237 setJumpButtonBarVisible( state ); 241 setJumpButtonBarVisible( state );
238 242
239 state = KABPrefs::instance()->mDetailsPageVisible; 243 state = KABPrefs::instance()->mDetailsPageVisible;
240 244
241 mActionDetails->setChecked( state ); 245 mActionDetails->setChecked( state );
@@ -442,65 +446,82 @@ void KABCore::setContactSelected( const QString &uid )
442 446
443 mActionCopy->setEnabled( selected ); 447 mActionCopy->setEnabled( selected );
444 mActionDelete->setEnabled( selected ); 448 mActionDelete->setEnabled( selected );
445 mActionEditAddressee->setEnabled( selected ); 449 mActionEditAddressee->setEnabled( selected );
446 mActionMail->setEnabled( selected ); 450 mActionMail->setEnabled( selected );
447 mActionMailVCard->setEnabled( selected ); 451 mActionMailVCard->setEnabled( selected );
448 mActionWhoAmI->setEnabled( selected ); 452 mActionWhoAmI->setEnabled( selected );
449 mActionCategories->setEnabled( selected ); 453 mActionCategories->setEnabled( selected );
450} 454}
451 455
452void KABCore::sendMail() 456void KABCore::sendMail()
453{ 457{
454#ifndef KAB_EMBEDDED
455 sendMail( mViewManager->selectedEmails().join( ", " ) ); 458 sendMail( mViewManager->selectedEmails().join( ", " ) );
456#else //KAB_EMBEDDED
457 qDebug("KABCore::sendMail() ust be fixed");
458#endif //KAB_EMBEDDED
459} 459}
460 460
461void KABCore::sendMail( const QString& email ) 461void KABCore::sendMail( const QString& email )
462{ 462{
463#ifndef KAB_EMBEDDED 463//US original kde implementation : kapp->invokeMailer( email, "" );
464 kapp->invokeMailer( email, "" ); 464
465#else //KAB_EMBEDDED 465/*US original qtopia implementation
466 qDebug("KABCore::sendMail(const QString& email) ust be fixed"); 466 PimContact c = abList->currentEntry();
467#endif //KAB_EMBEDDED 467 QString name = c.fileAs();
468 QString email = c.defaultEmail();
469#ifndef QT_NO_COP
470 QCopEnvelope e(Service::channel("Email"), "writeMail(QString,QString)");
471 e << name << email;
472#else
473*/
474
475
476#ifndef QT_NO_COP
477 QCString channel = KABPrefs::instance()->mEmailChannel.latin1();
478 qDebug("Using QCopEnvelope e(\"" + channel + "\", \"writeMail(QMap(QString,QString))\")");
479
480 QCopEnvelope e(channel, "writeMail(QString,QString)");
481 //US we need no names in the To field. The emailadresses are enough
482 e << "" << email;
483#else
484 KMessageBox::sorry( this, i18n( "This version does not support sending emails." ) );
485#endif
468} 486}
469 487
470void KABCore::mailVCard() 488void KABCore::mailVCard()
471{ 489{
472#ifndef KAB_EMBEDDED
473 QStringList uids = mViewManager->selectedUids(); 490 QStringList uids = mViewManager->selectedUids();
474 if ( !uids.isEmpty() ) 491 if ( !uids.isEmpty() )
475 mailVCard( uids ); 492 mailVCard( uids );
476#else //KAB_EMBEDDED
477 qDebug("KABCore::mailVCard() must be fixed");
478#endif //KAB_EMBEDDED
479} 493}
480 494
481void KABCore::mailVCard( const QStringList& uids ) 495void KABCore::mailVCard( const QStringList& uids )
482{ 496{
483#ifndef KAB_EMBEDDED
484 QStringList urls; 497 QStringList urls;
485 498
499 QString tmpdir = locateLocal("tmp", KGlobal::getAppName());
500
501/*US
486 // Create a temp dir, so that we can put the files in it with proper names 502 // Create a temp dir, so that we can put the files in it with proper names
487 KTempFile tempDir; 503 KTempFile tempDir;
488 if ( tempDir.status() != 0 ) { 504 if ( tempDir.status() != 0 ) {
489 kdWarning() << strerror( tempDir.status() ) << endl; 505 kdWarning() << strerror( tempDir.status() ) << endl;
490 return; 506 return;
491 } 507 }
492 508
493 QString dirName = tempDir.name(); 509 QString dirName = tempDir.name();
494 tempDir.unlink(); 510 tempDir.unlink();
511*/
512 QString dirName = tmpdir + "/" + KApplication::randomString( 8 );
513
514
515
495 QDir().mkdir( dirName, true ); 516 QDir().mkdir( dirName, true );
496 517
497 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { 518 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
498 KABC::Addressee a = mAddressBook->findByUid( *it ); 519 KABC::Addressee a = mAddressBook->findByUid( *it );
499 520
500 if ( a.isEmpty() ) 521 if ( a.isEmpty() )
501 continue; 522 continue;
502 523
503 QString name = a.givenName() + "_" + a.familyName() + ".vcf"; 524 QString name = a.givenName() + "_" + a.familyName() + ".vcf";
504 525
505 QString fileName = dirName + "/" + name; 526 QString fileName = dirName + "/" + name;
506 527
@@ -511,33 +532,44 @@ void KABCore::mailVCard( const QStringList& uids )
511 532
512 converter.addresseeToVCard( a, vcard ); 533 converter.addresseeToVCard( a, vcard );
513 534
514 QTextStream t( &outFile ); // use a text stream 535 QTextStream t( &outFile ); // use a text stream
515 t.setEncoding( QTextStream::UnicodeUTF8 ); 536 t.setEncoding( QTextStream::UnicodeUTF8 );
516 t << vcard; 537 t << vcard;
517 538
518 outFile.close(); 539 outFile.close();
519 540
520 urls.append( fileName ); 541 urls.append( fileName );
521 } 542 }
522 } 543 }
523 544/*US
524 kapp->invokeMailer( QString::null, QString::null, QString::null, 545 kapp->invokeMailer( QString::null, QString::null, QString::null,
525 QString::null, // subject 546 QString::null, // subject
526 QString::null, // body 547 QString::null, // body
527 QString::null, 548 QString::null,
528 urls ); // attachments 549 urls ); // attachments
529#else //KAB_EMBEDDED 550*/
530 qDebug("KABCore::mailVCard( must be fixed"); 551#ifndef QT_NO_COP
531#endif //KAB_EMBEDDED 552 QCString channel = KABPrefs::instance()->mEmailChannel.latin1();
553 qDebug("Using QCopEnvelope e(\"" + channel + "\", \"writeMail(QMap(QString,QString))\")");
554
555 QMap<QString, QString> parameterMap;
556 parameterMap.insert("ATTACHMENT<n>", urls.join(", "));
557
558 QCopEnvelope e(channel, "writeMail(QMap(QString,QString))");
559 e << parameterMap;
560#else
561 KMessageBox::sorry( this, i18n( "This version does not support sending emails." ) );
562#endif
563
532 564
533} 565}
534 566
535void KABCore::browse( const QString& url ) 567void KABCore::browse( const QString& url )
536{ 568{
537#ifndef KAB_EMBEDDED 569#ifndef KAB_EMBEDDED
538 kapp->invokeBrowser( url ); 570 kapp->invokeBrowser( url );
539#else //KAB_EMBEDDED 571#else //KAB_EMBEDDED
540 qDebug("KABCore::browse must be fixed"); 572 qDebug("KABCore::browse must be fixed");
541#endif //KAB_EMBEDDED 573#endif //KAB_EMBEDDED
542} 574}
543 575
diff --git a/kaddressbook/kabprefs.cpp b/kaddressbook/kabprefs.cpp
index 5b3b1ab..8bd4b15 100644
--- a/kaddressbook/kabprefs.cpp
+++ b/kaddressbook/kabprefs.cpp
@@ -41,24 +41,27 @@ KABPrefs::KABPrefs()
41{ 41{
42 KPrefs::setCurrentGroup( "Views" ); 42 KPrefs::setCurrentGroup( "Views" );
43 addItemBool( "HonorSingleClick", &mHonorSingleClick, false ); 43 addItemBool( "HonorSingleClick", &mHonorSingleClick, false );
44 44
45 KPrefs::setCurrentGroup( "General" ); 45 KPrefs::setCurrentGroup( "General" );
46 addItemBool( "AutomaticNameParsing", &mAutomaticNameParsing, true ); 46 addItemBool( "AutomaticNameParsing", &mAutomaticNameParsing, true );
47 addItemInt( "CurrentIncSearchField", &mCurrentIncSearchField, 0 ); 47 addItemInt( "CurrentIncSearchField", &mCurrentIncSearchField, 0 );
48 48
49#ifdef KAB_EMBEDDED 49#ifdef KAB_EMBEDDED
50 addItemBool("AskForQuit",&mAskForQuit,false); 50 addItemBool("AskForQuit",&mAskForQuit,false);
51 addItemBool("ToolBarHor",&mToolBarHor, true ); 51 addItemBool("ToolBarHor",&mToolBarHor, true );
52 addItemBool("ToolBarUp",&mToolBarUp, false ); 52 addItemBool("ToolBarUp",&mToolBarUp, false );
53 addItemInt( "EmailChannelType", &mEmailClient, OMPI );
54 addItemString( "EmailChannelOther", &mEmailChannel, "" );
55
53#endif //KAB_EMBEDDED 56#endif //KAB_EMBEDDED
54 57
55 KPrefs::setCurrentGroup( "MainWindow" ); 58 KPrefs::setCurrentGroup( "MainWindow" );
56 addItemBool( "JumpButtonBarVisible", &mJumpButtonBarVisible, false ); 59 addItemBool( "JumpButtonBarVisible", &mJumpButtonBarVisible, false );
57 addItemBool( "DetailsPageVisible", &mDetailsPageVisible, true ); 60 addItemBool( "DetailsPageVisible", &mDetailsPageVisible, true );
58 addItemIntList( "ExtensionsSplitter", &mExtensionsSplitter ); 61 addItemIntList( "ExtensionsSplitter", &mExtensionsSplitter );
59 addItemIntList( "DetailsSplitter", &mDetailsSplitter ); 62 addItemIntList( "DetailsSplitter", &mDetailsSplitter );
60 63
61 KPrefs::setCurrentGroup( "Extensions_General" ); 64 KPrefs::setCurrentGroup( "Extensions_General" );
62 QStringList defaultExtensions; 65 QStringList defaultExtensions;
63 defaultExtensions << "merge"; 66 defaultExtensions << "merge";
64 defaultExtensions << "distribution_list_editor"; 67 defaultExtensions << "distribution_list_editor";
diff --git a/kaddressbook/kabprefs.h b/kaddressbook/kabprefs.h
index 370fc5b..c81a9a9 100644
--- a/kaddressbook/kabprefs.h
+++ b/kaddressbook/kabprefs.h
@@ -28,36 +28,48 @@
28 28
29#include <libkdepim/kpimprefs.h> 29#include <libkdepim/kpimprefs.h>
30 30
31class KConfig; 31class KConfig;
32 32
33class KABPrefs : public KPimPrefs 33class KABPrefs : public KPimPrefs
34{ 34{
35 public: 35 public:
36 virtual ~KABPrefs(); 36 virtual ~KABPrefs();
37 37
38 static KABPrefs *instance(); 38 static KABPrefs *instance();
39 39
40 enum EMailClients {
41 OMPI = 0,
42 QTOPIA = 1,
43 OPIE = 2,
44 OTHER = 3
45 };
46
47
40 // General 48 // General
41 bool mHonorSingleClick; 49 bool mHonorSingleClick;
42 bool mAutomaticNameParsing; 50 bool mAutomaticNameParsing;
43 int mCurrentIncSearchField; 51 int mCurrentIncSearchField;
44 52
45#ifdef KAB_EMBEDDED 53#ifdef KAB_EMBEDDED
46 // US introduce a nonconst way to return the config object. 54 // US introduce a nonconst way to return the config object.
47 KConfig* getConfig(); 55 KConfig* getConfig();
48 56
49 bool mToolBarHor; 57 bool mToolBarHor;
50 bool mToolBarUp; 58 bool mToolBarUp;
51 bool mAskForQuit; 59 bool mAskForQuit;
60
61 int mEmailClient;
62 QString mEmailChannel;
63
52 /** Set preferences to default values */ 64 /** Set preferences to default values */
53// void usrSetDefaults(); 65// void usrSetDefaults();
54 66
55 /** Read preferences from config file */ 67 /** Read preferences from config file */
56// void usrReadConfig(); 68// void usrReadConfig();
57 69
58 /** Write preferences to config file */ 70 /** Write preferences to config file */
59// void usrWriteConfig(); 71// void usrWriteConfig();
60#endif //KAB_EMBEDDED 72#endif //KAB_EMBEDDED
61 73
62 74
63 // GUI 75 // GUI
diff --git a/kaddressbook/kcmconfigs/kabconfigwidget.cpp b/kaddressbook/kcmconfigs/kabconfigwidget.cpp
index 38c7946..1bac26f 100644
--- a/kaddressbook/kcmconfigs/kabconfigwidget.cpp
+++ b/kaddressbook/kcmconfigs/kabconfigwidget.cpp
@@ -18,24 +18,28 @@
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#include <qcheckbox.h> 24#include <qcheckbox.h>
25#include <qframe.h> 25#include <qframe.h>
26#include <qgroupbox.h> 26#include <qgroupbox.h>
27#include <qlayout.h> 27#include <qlayout.h>
28#include <qpushbutton.h> 28#include <qpushbutton.h>
29#include <qtabwidget.h> 29#include <qtabwidget.h>
30#include <qcombobox.h>
31#include <qlineedit.h>
32#include <qlabel.h>
33#include <qfile.h>
30 34
31#include <kconfig.h> 35#include <kconfig.h>
32#include <kdebug.h> 36#include <kdebug.h>
33#include <kdialog.h> 37#include <kdialog.h>
34#include <klistview.h> 38#include <klistview.h>
35#include <klocale.h> 39#include <klocale.h>
36#include <kglobal.h> 40#include <kglobal.h>
37#include <kmessagebox.h> 41#include <kmessagebox.h>
38#include <kstandarddirs.h> 42#include <kstandarddirs.h>
39 43
40#ifndef KAB_EMBEDDED 44#ifndef KAB_EMBEDDED
41#include <ktrader.h> 45#include <ktrader.h>
@@ -84,40 +88,43 @@ KABConfigWidget::KABConfigWidget( QWidget *parent, const char *name )
84 : QWidget( parent, name ) 88 : QWidget( parent, name )
85{ 89{
86 QVBoxLayout *topLayout = new QVBoxLayout( this, 0, 90 QVBoxLayout *topLayout = new QVBoxLayout( this, 0,
87 KDialog::spacingHint() ); 91 KDialog::spacingHint() );
88 92
89 QTabWidget *tabWidget = new QTabWidget( this ); 93 QTabWidget *tabWidget = new QTabWidget( this );
90 topLayout->addWidget( tabWidget ); 94 topLayout->addWidget( tabWidget );
91 95
92 // General page 96 // General page
93 QWidget *generalPage = new QWidget( this ); 97 QWidget *generalPage = new QWidget( this );
94 QVBoxLayout *layout = new QVBoxLayout( generalPage, KDialog::marginHintSmall(), 98 QVBoxLayout *layout = new QVBoxLayout( generalPage, KDialog::marginHintSmall(),
95 KDialog::spacingHintSmall() ); 99 KDialog::spacingHintSmall() );
96 100 //general groupbox
97 QGroupBox *groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "General" ), generalPage ); 101 QGroupBox *groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "General" ), generalPage );
98 QVBoxLayout *boxLayout = new QVBoxLayout( groupBox->layout() ); 102 QVBoxLayout *boxLayout = new QVBoxLayout( groupBox->layout() );
99 boxLayout->setAlignment( Qt::AlignTop ); 103 boxLayout->setAlignment( Qt::AlignTop );
100 boxLayout->setMargin(KDialog::marginHintSmall() ); 104 boxLayout->setMargin(KDialog::marginHintSmall() );
101 groupBox->layout()->setMargin(KDialog::marginHintSmall()) ; 105 groupBox->layout()->setMargin(KDialog::marginHintSmall()) ;
102 groupBox->layout()->setSpacing(KDialog::spacingHintSmall()); 106 groupBox->layout()->setSpacing(KDialog::spacingHintSmall());
103 boxLayout->setSpacing( KDialog::spacingHintSmall() ); 107 boxLayout->setSpacing( KDialog::spacingHintSmall() );
104 mViewsSingleClickBox = new QCheckBox( i18n( "Honor KDE single click" ), groupBox, "msingle" ); 108 mViewsSingleClickBox = new QCheckBox( i18n( "Honor KDE single click" ), groupBox, "msingle" );
105 boxLayout->addWidget( mViewsSingleClickBox ); 109 boxLayout->addWidget( mViewsSingleClickBox );
106 110
107 mNameParsing = new QCheckBox( i18n( "Automatic name parsing for new addressees" ), groupBox, "mparse" ); 111 mNameParsing = new QCheckBox( i18n( "Automatic name parsing for new addressees" ), groupBox, "mparse" );
108 boxLayout->addWidget( mNameParsing ); 112 boxLayout->addWidget( mNameParsing );
109 113
110 layout->addWidget( groupBox ); 114 layout->addWidget( groupBox );
111 115
116
117 //extensions groupbox
118
112 groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Extensions" ), generalPage ); 119 groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Extensions" ), generalPage );
113 boxLayout = new QVBoxLayout( groupBox->layout() ); 120 boxLayout = new QVBoxLayout( groupBox->layout() );
114 boxLayout->setAlignment( Qt::AlignTop ); 121 boxLayout->setAlignment( Qt::AlignTop );
115 boxLayout->setMargin(KDialog::marginHintSmall()); 122 boxLayout->setMargin(KDialog::marginHintSmall());
116 boxLayout->setSpacing(KDialog::spacingHintSmall()); 123 boxLayout->setSpacing(KDialog::spacingHintSmall());
117 groupBox->layout()->setMargin(1) ; 124 groupBox->layout()->setMargin(1) ;
118 groupBox->layout()->setSpacing(0); 125 groupBox->layout()->setSpacing(0);
119 mExtensionView = new KListView( groupBox ); 126 mExtensionView = new KListView( groupBox );
120 mExtensionView->setAllColumnsShowFocus( true ); 127 mExtensionView->setAllColumnsShowFocus( true );
121 mExtensionView->addColumn( i18n( "Name" ) ); 128 mExtensionView->addColumn( i18n( "Name" ) );
122 mExtensionView->addColumn( i18n( "Description" ) ); 129 mExtensionView->addColumn( i18n( "Description" ) );
123 mExtensionView->setMaximumHeight(80); 130 mExtensionView->setMaximumHeight(80);
@@ -136,59 +143,159 @@ KABConfigWidget::KABConfigWidget( QWidget *parent, const char *name )
136 SLOT( selectionChanged( QListViewItem* ) ) ); 143 SLOT( selectionChanged( QListViewItem* ) ) );
137 connect( mExtensionView, SIGNAL( clicked( QListViewItem* ) ), 144 connect( mExtensionView, SIGNAL( clicked( QListViewItem* ) ),
138 SLOT( itemClicked( QListViewItem* ) ) ); 145 SLOT( itemClicked( QListViewItem* ) ) );
139 connect( mConfigureButton, SIGNAL( clicked() ), 146 connect( mConfigureButton, SIGNAL( clicked() ),
140 SLOT( configureExtension() ) ); 147 SLOT( configureExtension() ) );
141 148
142 tabWidget->addTab( generalPage, i18n( "General" ) ); 149 tabWidget->addTab( generalPage, i18n( "General" ) );
143 150
144 // Addressee page 151 // Addressee page
145 mAddresseeWidget = new AddresseeWidget( this ); 152 mAddresseeWidget = new AddresseeWidget( this );
146 tabWidget->addTab( mAddresseeWidget, i18n( "Contact" ) ); 153 tabWidget->addTab( mAddresseeWidget, i18n( "Contact" ) );
147 connect( mAddresseeWidget, SIGNAL( modified() ), SLOT( modified() ) ); 154 connect( mAddresseeWidget, SIGNAL( modified() ), SLOT( modified() ) );
155
156 // mailclient page
157 QWidget *mailclientPage = new QWidget( this );
158 layout = new QVBoxLayout( mailclientPage, KDialog::marginHintSmall(),
159 KDialog::spacingHintSmall() );
160
161 groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Used Mail Client" ), mailclientPage );
162 boxLayout = new QVBoxLayout( groupBox->layout() );
163 boxLayout->setAlignment( Qt::AlignTop );
164// boxLayout->setMargin(KDialog::marginHintSmall() );
165// groupBox->layout()->setMargin(KDialog::marginHintSmall()) ;
166// groupBox->layout()->setSpacing(KDialog::spacingHintSmall());
167// boxLayout->setSpacing( KDialog::spacingHintSmall() );
168
169 mEmailClient = new QComboBox( groupBox );
170 mEmailClient->insertItem( i18n("OM/Pi"), KABPrefs::OMPI );
171 mEmailClient->insertItem( i18n("Qtopia mail"), KABPrefs::QTOPIA );
172 mEmailClient->insertItem( i18n("Opie mail"), KABPrefs::OPIE );
173 mEmailClient->insertItem( i18n("Other"), KABPrefs::OTHER );
174 boxLayout->addWidget( mEmailClient );
175
176 connect( mEmailClient, SIGNAL( activated( int ) ),
177 this, SLOT (emailclient_changed( int ) ) );
178
179 QLabel* lab = new QLabel( i18n("Channel:"), groupBox);
180 boxLayout->addWidget( lab );
181 mEmailChannel = new QLineEdit(groupBox);
182 mEmailChannel->setReadOnly(true);
183 boxLayout->addWidget( mEmailChannel );
184
185 layout->addWidget( groupBox );
186 tabWidget->addTab( mailclientPage, i18n( "Mail" ) );
187
188
189
148} 190}
149 191
192
193
194void KABConfigWidget::emailclient_changed( int newClient )
195{
196 if (newClient == KABPrefs::OTHER)
197 mEmailChannel->setReadOnly(false);
198 else
199 mEmailChannel->setReadOnly(true);
200
201 QString opiepath = QString::fromLatin1( getenv("OPIEDIR") );
202 QString qtopiapath = QString::fromLatin1( getenv("QPEDIR") );
203
204 if (opiepath.isEmpty())
205 opiepath = qtopiapath;
206
207 QString text = mEmailChannel->text();
208
209 if (newClient == KABPrefs::OPIE)
210 {
211 if ( QFile::exists( opiepath + "/bin/opiemail" ))
212 text = "QPE/Application/opiemail";
213 else
214 text = "FILENOTFOUND: " + opiepath + "/bin/opiemail";
215 }
216 else if (newClient == KABPrefs::QTOPIA)
217 {
218 if ( QFile::exists( qtopiapath + "/bin/qtmail" ))
219 text = "QPE/Application/qtmail";
220 else
221 text = "FILENOTFOUND: " + qtopiapath + "/bin/qtmail";
222
223 }
224 else if (newClient == KABPrefs::OMPI)
225 {
226 if ( QFile::exists( qtopiapath + "/bin/ompi" ))
227 text = "QPE/Application/ompi";
228 else if ( QFile::exists( opiepath + "/bin/ompi" ))
229 text = "QPE/Application/ompi";
230 else
231 text = "FILENOTFOUND: " + qtopiapath + "/bin/ompi";
232
233 }
234 else
235 {
236 //do nothing if we choosed other
237 }
238
239 mEmailChannel->setText( text );
240
241
242}
243
244
150void KABConfigWidget::restoreSettings() 245void KABConfigWidget::restoreSettings()
151{ 246{
152 bool blocked = signalsBlocked(); 247 bool blocked = signalsBlocked();
153 blockSignals( true ); 248 blockSignals( true );
154 249
155 mNameParsing->setChecked( KABPrefs::instance()->mAutomaticNameParsing ); 250 mNameParsing->setChecked( KABPrefs::instance()->mAutomaticNameParsing );
156 mViewsSingleClickBox->setChecked( KABPrefs::instance()->mHonorSingleClick ); 251 mViewsSingleClickBox->setChecked( KABPrefs::instance()->mHonorSingleClick );
252
253 mEmailChannel->setText( KABPrefs::instance()->mEmailChannel );
254 mEmailClient->setCurrentItem(KABPrefs::instance()->mEmailClient);
255
157 mAddresseeWidget->restoreSettings(); 256 mAddresseeWidget->restoreSettings();
158 257
159 restoreExtensionSettings(); 258 restoreExtensionSettings();
160 259
161 blockSignals( blocked ); 260 blockSignals( blocked );
162 261
163 emit changed( false ); 262 emit changed( false );
164} 263}
165 264
166void KABConfigWidget::saveSettings() 265void KABConfigWidget::saveSettings()
167{ 266{
168 KABPrefs::instance()->mAutomaticNameParsing = mNameParsing->isChecked(); 267 KABPrefs::instance()->mAutomaticNameParsing = mNameParsing->isChecked();
169 KABPrefs::instance()->mHonorSingleClick = mViewsSingleClickBox->isChecked(); 268 KABPrefs::instance()->mHonorSingleClick = mViewsSingleClickBox->isChecked();
269
270 KABPrefs::instance()->mEmailClient = mEmailClient->currentItem();
271 KABPrefs::instance()->mEmailChannel = mEmailChannel->text();
272
170 mAddresseeWidget->saveSettings(); 273 mAddresseeWidget->saveSettings();
171 274
172 saveExtensionSettings(); 275 saveExtensionSettings();
173 KABPrefs::instance()->writeConfig(); 276 KABPrefs::instance()->writeConfig();
174 277
175 emit changed( false ); 278 emit changed( false );
176} 279}
177 280
178void KABConfigWidget::defaults() 281void KABConfigWidget::defaults()
179{ 282{
180 mNameParsing->setChecked( true ); 283 mNameParsing->setChecked( true );
181 mViewsSingleClickBox->setChecked( false ); 284 mViewsSingleClickBox->setChecked( false );
182 285
286 mEmailClient->setCurrentItem(KABPrefs::OMPI);
287 emailclient_changed( KABPrefs::OMPI );
288
289
183 emit changed( true ); 290 emit changed( true );
184} 291}
185 292
186void KABConfigWidget::modified() 293void KABConfigWidget::modified()
187{ 294{
188 emit changed( true ); 295 emit changed( true );
189} 296}
190 297
191void KABConfigWidget::restoreExtensionSettings() 298void KABConfigWidget::restoreExtensionSettings()
192{ 299{
193 QStringList activeExtensions = KABPrefs::instance()->mActiveExtensions; 300 QStringList activeExtensions = KABPrefs::instance()->mActiveExtensions;
194 301
diff --git a/kaddressbook/kcmconfigs/kabconfigwidget.h b/kaddressbook/kcmconfigs/kabconfigwidget.h
index 0f36d9e..9d1363b 100644
--- a/kaddressbook/kcmconfigs/kabconfigwidget.h
+++ b/kaddressbook/kcmconfigs/kabconfigwidget.h
@@ -20,53 +20,59 @@
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#ifndef KABCONFIGWIDGET_H 24#ifndef KABCONFIGWIDGET_H
25#define KABCONFIGWIDGET_H 25#define KABCONFIGWIDGET_H
26 26
27#include <qwidget.h> 27#include <qwidget.h>
28 28
29class QCheckBox; 29class QCheckBox;
30class QListViewItem; 30class QListViewItem;
31class QPushButton; 31class QPushButton;
32 32class QComboBox;
33class QLineEdit;
33class KListView; 34class KListView;
34 35
35class AddresseeWidget; 36class AddresseeWidget;
36 37
37class KABConfigWidget : public QWidget 38class KABConfigWidget : public QWidget
38{ 39{
39 Q_OBJECT 40 Q_OBJECT
40 41
41 public: 42 public:
42 KABConfigWidget( QWidget *parent, const char *name = 0 ); 43 KABConfigWidget( QWidget *parent, const char *name = 0 );
43 44
44 void restoreSettings(); 45 void restoreSettings();
45 void saveSettings(); 46 void saveSettings();
46 void defaults(); 47 void defaults();
47 48
48 signals: 49 signals:
49 void changed( bool ); 50 void changed( bool );
50 51
51 public slots: 52 public slots:
52 void modified(); 53 void modified();
53 54
55
56
54 private slots: 57 private slots:
55 void configureExtension(); 58 void configureExtension();
56 void selectionChanged( QListViewItem* ); 59 void selectionChanged( QListViewItem* );
57 void itemClicked( QListViewItem* ); 60 void itemClicked( QListViewItem* );
61 void emailclient_changed( int newClient );
58 62
59 private: 63 private:
60 void restoreExtensionSettings(); 64 void restoreExtensionSettings();
61 void saveExtensionSettings(); 65 void saveExtensionSettings();
62 66
63 KListView *mExtensionView; 67 KListView *mExtensionView;
64 68
65 QCheckBox *mNameParsing; 69 QCheckBox *mNameParsing;
66 QCheckBox *mViewsSingleClickBox; 70 QCheckBox *mViewsSingleClickBox;
67 QPushButton *mConfigureButton; 71 QPushButton *mConfigureButton;
72 QComboBox* mEmailClient;
73 QLineEdit* mEmailChannel;
68 74
69 AddresseeWidget *mAddresseeWidget; 75 AddresseeWidget *mAddresseeWidget;
70}; 76};
71 77
72#endif 78#endif
diff --git a/microkde/kdialogbase.cpp b/microkde/kdialogbase.cpp
index c953058..d1f7630 100644
--- a/microkde/kdialogbase.cpp
+++ b/microkde/kdialogbase.cpp
@@ -69,25 +69,24 @@ void KDialogBase::init( const QString &caption, int buttonMask,
69 connect( mUser2Button, SIGNAL( clicked() ), SLOT( slotUser2() ) ); 69 connect( mUser2Button, SIGNAL( clicked() ), SLOT( slotUser2() ) );
70 } else { 70 } else {
71 mUser2Button = 0; 71 mUser2Button = 0;
72 } 72 }
73 73
74 if ( buttonMask & Ok ) { 74 if ( buttonMask & Ok ) {
75 mOkButton = new QPushButton( i18n("Ok"), this ); 75 mOkButton = new QPushButton( i18n("Ok"), this );
76 connect( mOkButton, SIGNAL( clicked() ), SLOT( slotOk() ) ); 76 connect( mOkButton, SIGNAL( clicked() ), SLOT( slotOk() ) );
77 } else { 77 } else {
78 mOkButton = 0; 78 mOkButton = 0;
79 } 79 }
80 if ( buttonMask & Default ) { 80 if ( buttonMask & Default ) {
81 qDebug("buttonMask & Default ");
82 mDefaultButton = new QPushButton( i18n("Default"), this ); 81 mDefaultButton = new QPushButton( i18n("Default"), this );
83 connect( mDefaultButton, SIGNAL( clicked() ), SIGNAL( defaultClicked() ) ); 82 connect( mDefaultButton, SIGNAL( clicked() ), SIGNAL( defaultClicked() ) );
84 } else { 83 } else {
85 mDefaultButton = 0; 84 mDefaultButton = 0;
86 } 85 }
87 86
88 if ( buttonMask & Apply ) { 87 if ( buttonMask & Apply ) {
89 mApplyButton = new QPushButton( i18n("Apply"), this ); 88 mApplyButton = new QPushButton( i18n("Apply"), this );
90 connect( mApplyButton, SIGNAL( clicked() ), SLOT( slotApply() ) ); 89 connect( mApplyButton, SIGNAL( clicked() ), SLOT( slotApply() ) );
91 } else { 90 } else {
92 mApplyButton = 0; 91 mApplyButton = 0;
93 } 92 }
diff --git a/microkde/kutils/kcmultidialog.cpp b/microkde/kutils/kcmultidialog.cpp
index 4136622..13be2ce 100644
--- a/microkde/kutils/kcmultidialog.cpp
+++ b/microkde/kutils/kcmultidialog.cpp
@@ -34,24 +34,27 @@
34#include <kprocess.h> 34#include <kprocess.h>
35 35
36#include "kcmultidialog.h" 36#include "kcmultidialog.h"
37//US #include "kcmultidialog.moc" 37//US #include "kcmultidialog.moc"
38//US #include "kcmoduleloader.h" 38//US #include "kcmoduleloader.h"
39 39
40KCMultiDialog::KCMultiDialog(const QString& baseGroup, QWidget *parent, const char *name, bool modal) 40KCMultiDialog::KCMultiDialog(const QString& baseGroup, QWidget *parent, const char *name, bool modal)
41 : KDialogBase(IconList, i18n("Configure"), Default |Cancel | Apply | Ok, Ok, 41 : KDialogBase(IconList, i18n("Configure"), Default |Cancel | Apply | Ok, Ok,
42 parent, name, modal, true), d(0L) 42 parent, name, modal, true), d(0L)
43{ 43{
44 enableButton(Apply, false); 44 enableButton(Apply, false);
45 //connect(this, SIGNAL(aboutToShowPage(QWidget *)), this, SLOT(slotAboutToShow(QWidget *))); 45 //connect(this, SIGNAL(aboutToShowPage(QWidget *)), this, SLOT(slotAboutToShow(QWidget *)));
46
47 connect( this, SIGNAL( defaultClicked() ), SLOT( slotDefault() ) );
48
46 _baseGroup = baseGroup; 49 _baseGroup = baseGroup;
47 mMainWidget = new KJanusWidget( this, "JanusWidget", KJanusWidget::Tabbed ); 50 mMainWidget = new KJanusWidget( this, "JanusWidget", KJanusWidget::Tabbed );
48 setMainWidget(mMainWidget ); 51 setMainWidget(mMainWidget );
49#ifdef DESKTOP_VERSION 52#ifdef DESKTOP_VERSION
50 resize(640,480); 53 resize(640,480);
51#else 54#else
52 resize(640,480); 55 resize(640,480);
53 setMaximumSize( KMIN(KGlobal::getDesktopWidth()-5, 640), KMIN(KGlobal::getDesktopHeight()-20, 480)); 56 setMaximumSize( KMIN(KGlobal::getDesktopWidth()-5, 640), KMIN(KGlobal::getDesktopHeight()-20, 480));
54 //showMaximized(); 57 //showMaximized();
55#endif 58#endif
56 59
57} 60}