summaryrefslogtreecommitdiffabout
path: root/kaddressbook
Unidiff
Diffstat (limited to 'kaddressbook') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp20
-rw-r--r--kaddressbook/kabprefs.cpp1
-rw-r--r--kaddressbook/kabprefs.h1
-rw-r--r--kaddressbook/kcmconfigs/kabconfigwidget.cpp6
-rw-r--r--kaddressbook/kcmconfigs/kabconfigwidget.h1
5 files changed, 27 insertions, 2 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index d5de9cb..b9830b1 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -983,167 +983,183 @@ void KABCore::beamVCard(const QStringList& uids)
983 QTextStream t( &outFile ); // use a text stream 983 QTextStream t( &outFile ); // use a text stream
984 //t.setEncoding( QTextStream::UnicodeUTF8 ); 984 //t.setEncoding( QTextStream::UnicodeUTF8 );
985 t.setEncoding( QTextStream::Latin1 ); 985 t.setEncoding( QTextStream::Latin1 );
986 t <<datastream.latin1(); 986 t <<datastream.latin1();
987 outFile.close(); 987 outFile.close();
988 Ir *ir = new Ir( this ); 988 Ir *ir = new Ir( this );
989 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); 989 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) );
990 ir->send( fileName, description, "text/x-vCard" ); 990 ir->send( fileName, description, "text/x-vCard" );
991 } else { 991 } else {
992 qDebug("KA: Error open temp beam file "); 992 qDebug("KA: Error open temp beam file ");
993 return; 993 return;
994 } 994 }
995#endif 995#endif
996 996
997} 997}
998 998
999void KABCore::beamDone( Ir *ir ) 999void KABCore::beamDone( Ir *ir )
1000{ 1000{
1001#ifndef DESKTOP_VERSION 1001#ifndef DESKTOP_VERSION
1002 delete ir; 1002 delete ir;
1003#endif 1003#endif
1004 topLevelWidget()->raise(); 1004 topLevelWidget()->raise();
1005 message( i18n("Beaming finished!") ); 1005 message( i18n("Beaming finished!") );
1006} 1006}
1007 1007
1008 1008
1009void KABCore::browse( const QString& url ) 1009void KABCore::browse( const QString& url )
1010{ 1010{
1011#ifndef KAB_EMBEDDED 1011#ifndef KAB_EMBEDDED
1012 kapp->invokeBrowser( url ); 1012 kapp->invokeBrowser( url );
1013#else //KAB_EMBEDDED 1013#else //KAB_EMBEDDED
1014 qDebug("KABCore::browse must be fixed"); 1014 qDebug("KABCore::browse must be fixed");
1015#endif //KAB_EMBEDDED 1015#endif //KAB_EMBEDDED
1016} 1016}
1017 1017
1018void KABCore::selectAllContacts() 1018void KABCore::selectAllContacts()
1019{ 1019{
1020 mViewManager->setSelected( QString::null, true ); 1020 mViewManager->setSelected( QString::null, true );
1021} 1021}
1022 1022
1023void KABCore::deleteContacts() 1023void KABCore::deleteContacts()
1024{ 1024{
1025 QStringList uidList = mViewManager->selectedUids(); 1025 QStringList uidList = mViewManager->selectedUids();
1026 deleteContacts( uidList ); 1026 deleteContacts( uidList );
1027} 1027}
1028 1028
1029void KABCore::deleteContacts( const QStringList &uids ) 1029void KABCore::deleteContacts( const QStringList &uids )
1030{ 1030{
1031
1031 if ( uids.count() > 0 ) { 1032 if ( uids.count() > 0 ) {
1033
1034 if ( KABPrefs::instance()->mAskForDelete ) {
1035 int count = uids.count();
1036 if ( count > 5 ) count = 5;
1037 QString cNames;
1038 int i;
1039 for ( i = 0; i < count ; ++i ) {
1040 cNames += KGlobal::formatMessage( mAddressBook->findByUid( uids[i] ).realName() ,0) + "\n";
1041 }
1042 if ( uids.count() > 5 )
1043 cNames += i18n("...and %1 more\ncontact(s) selected").arg( uids.count() - 5 );
1044 QString text = i18n( "Do you really\nwant to delete the\nsetected contact(s)?\n\n" ) + cNames ;
1045 if ( KMessageBox::questionYesNo( this, text ) != KMessageBox::Yes )
1046 return;
1047 }
1032 PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids ); 1048 PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids );
1033 UndoStack::instance()->push( command ); 1049 UndoStack::instance()->push( command );
1034 RedoStack::instance()->clear(); 1050 RedoStack::instance()->clear();
1035 1051
1036 // now if we deleted anything, refresh 1052 // now if we deleted anything, refresh
1037 setContactSelected( QString::null ); 1053 setContactSelected( QString::null );
1038 setModified( true ); 1054 setModified( true );
1039 } 1055 }
1040} 1056}
1041 1057
1042void KABCore::copyContacts() 1058void KABCore::copyContacts()
1043{ 1059{
1044 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 1060 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
1045 1061
1046 QString clipText = AddresseeUtil::addresseesToClipboard( addrList ); 1062 QString clipText = AddresseeUtil::addresseesToClipboard( addrList );
1047 1063
1048 kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl; 1064 kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl;
1049 1065
1050 QClipboard *cb = QApplication::clipboard(); 1066 QClipboard *cb = QApplication::clipboard();
1051 cb->setText( clipText ); 1067 cb->setText( clipText );
1052} 1068}
1053 1069
1054void KABCore::cutContacts() 1070void KABCore::cutContacts()
1055{ 1071{
1056 QStringList uidList = mViewManager->selectedUids(); 1072 QStringList uidList = mViewManager->selectedUids();
1057 1073
1058//US if ( uidList.size() > 0 ) { 1074//US if ( uidList.size() > 0 ) {
1059 if ( uidList.count() > 0 ) { 1075 if ( uidList.count() > 0 ) {
1060 PwCutCommand *command = new PwCutCommand( mAddressBook, uidList ); 1076 PwCutCommand *command = new PwCutCommand( mAddressBook, uidList );
1061 UndoStack::instance()->push( command ); 1077 UndoStack::instance()->push( command );
1062 RedoStack::instance()->clear(); 1078 RedoStack::instance()->clear();
1063 1079
1064 setModified( true ); 1080 setModified( true );
1065 } 1081 }
1066} 1082}
1067 1083
1068void KABCore::pasteContacts() 1084void KABCore::pasteContacts()
1069{ 1085{
1070 QClipboard *cb = QApplication::clipboard(); 1086 QClipboard *cb = QApplication::clipboard();
1071 1087
1072 KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() ); 1088 KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() );
1073 1089
1074 pasteContacts( list ); 1090 pasteContacts( list );
1075} 1091}
1076 1092
1077void KABCore::pasteContacts( KABC::Addressee::List &list ) 1093void KABCore::pasteContacts( KABC::Addressee::List &list )
1078{ 1094{
1079 KABC::Resource *resource = requestResource( this ); 1095 KABC::Resource *resource = requestResource( this );
1080 KABC::Addressee::List::Iterator it; 1096 KABC::Addressee::List::Iterator it;
1081 for ( it = list.begin(); it != list.end(); ++it ) 1097 for ( it = list.begin(); it != list.end(); ++it )
1082 (*it).setResource( resource ); 1098 (*it).setResource( resource );
1083 1099
1084 PwPasteCommand *command = new PwPasteCommand( this, list ); 1100 PwPasteCommand *command = new PwPasteCommand( this, list );
1085 UndoStack::instance()->push( command ); 1101 UndoStack::instance()->push( command );
1086 RedoStack::instance()->clear(); 1102 RedoStack::instance()->clear();
1087 1103
1088 setModified( true ); 1104 setModified( true );
1089} 1105}
1090 1106
1091void KABCore::setWhoAmI() 1107void KABCore::setWhoAmI()
1092{ 1108{
1093 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 1109 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
1094 1110
1095 if ( addrList.count() > 1 ) { 1111 if ( addrList.count() > 1 ) {
1096 KMessageBox::sorry( this, i18n( "Please select only one contact." ) ); 1112 KMessageBox::sorry( this, i18n( "Please select only one contact." ) );
1097 return; 1113 return;
1098 } 1114 }
1099 1115
1100 QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) ); 1116 QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) );
1101 if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes ) 1117 if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].realName() ) ) == KMessageBox::Yes )
1102 static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] ); 1118 static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] );
1103} 1119}
1104void KABCore::editCategories() 1120void KABCore::editCategories()
1105{ 1121{
1106 KPIM::CategoryEditDialog dlg ( KABPrefs::instance(), this, "", true ); 1122 KPIM::CategoryEditDialog dlg ( KABPrefs::instance(), this, "", true );
1107 dlg.exec(); 1123 dlg.exec();
1108} 1124}
1109void KABCore::setCategories() 1125void KABCore::setCategories()
1110{ 1126{
1111 1127
1112 QStringList uids; 1128 QStringList uids;
1113 XXPortSelectDialog dlgx( this, false, this ); 1129 XXPortSelectDialog dlgx( this, false, this );
1114 if ( dlgx.exec() ) 1130 if ( dlgx.exec() )
1115 uids = dlgx.uids(); 1131 uids = dlgx.uids();
1116 else 1132 else
1117 return; 1133 return;
1118 if ( uids.isEmpty() ) 1134 if ( uids.isEmpty() )
1119 return; 1135 return;
1120 // qDebug("count %d ", uids.count()); 1136 // qDebug("count %d ", uids.count());
1121 1137
1122 1138
1123 KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true ); 1139 KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true );
1124 if ( !dlg.exec() ) { 1140 if ( !dlg.exec() ) {
1125 message( i18n("Setting categories cancelled") ); 1141 message( i18n("Setting categories cancelled") );
1126 return; 1142 return;
1127 } 1143 }
1128 bool merge = false; 1144 bool merge = false;
1129 QString msg = i18n( "Merge with existing categories?" ); 1145 QString msg = i18n( "Merge with existing categories?" );
1130 if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes ) 1146 if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes )
1131 merge = true; 1147 merge = true;
1132 1148
1133 message( i18n("Setting categories ... please wait!") ); 1149 message( i18n("Setting categories ... please wait!") );
1134 QStringList categories = dlg.selectedCategories(); 1150 QStringList categories = dlg.selectedCategories();
1135 1151
1136 //QStringList uids = mViewManager->selectedUids(); 1152 //QStringList uids = mViewManager->selectedUids();
1137 QStringList::Iterator it; 1153 QStringList::Iterator it;
1138 for ( it = uids.begin(); it != uids.end(); ++it ) { 1154 for ( it = uids.begin(); it != uids.end(); ++it ) {
1139 KABC::Addressee addr = mAddressBook->findByUid( *it ); 1155 KABC::Addressee addr = mAddressBook->findByUid( *it );
1140 if ( !addr.isEmpty() ) { 1156 if ( !addr.isEmpty() ) {
1141 if ( !merge ) 1157 if ( !merge )
1142 addr.setCategories( categories ); 1158 addr.setCategories( categories );
1143 else { 1159 else {
1144 QStringList addrCategories = addr.categories(); 1160 QStringList addrCategories = addr.categories();
1145 QStringList::Iterator catIt; 1161 QStringList::Iterator catIt;
1146 for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) { 1162 for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) {
1147 if ( !addrCategories.contains( *catIt ) ) 1163 if ( !addrCategories.contains( *catIt ) )
1148 addrCategories.append( *catIt ); 1164 addrCategories.append( *catIt );
1149 } 1165 }
@@ -2621,97 +2637,97 @@ void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString
2621 QStringList preferredEmailList; 2637 QStringList preferredEmailList;
2622 QStringList assembledNameList; 2638 QStringList assembledNameList;
2623 QStringList uidList; 2639 QStringList uidList;
2624 2640
2625 KABC::AddressBook::Iterator it; 2641 KABC::AddressBook::Iterator it;
2626 2642
2627 int count = 0; 2643 int count = 0;
2628 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 2644 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2629 ++count; 2645 ++count;
2630 } 2646 }
2631 QProgressBar bar(count,0 ); 2647 QProgressBar bar(count,0 );
2632 int w = 300; 2648 int w = 300;
2633 if ( QApplication::desktop()->width() < 320 ) 2649 if ( QApplication::desktop()->width() < 320 )
2634 w = 220; 2650 w = 220;
2635 int h = bar.sizeHint().height() ; 2651 int h = bar.sizeHint().height() ;
2636 int dw = QApplication::desktop()->width(); 2652 int dw = QApplication::desktop()->width();
2637 int dh = QApplication::desktop()->height(); 2653 int dh = QApplication::desktop()->height();
2638 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2654 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2639 bar.show(); 2655 bar.show();
2640 bar.setCaption (i18n("Collecting birthdays - close to abort!") ); 2656 bar.setCaption (i18n("Collecting birthdays - close to abort!") );
2641 qApp->processEvents(); 2657 qApp->processEvents();
2642 2658
2643 QDate bday; 2659 QDate bday;
2644 QString anni; 2660 QString anni;
2645 QString formattedbday; 2661 QString formattedbday;
2646 2662
2647 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) 2663 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it )
2648 { 2664 {
2649 if ( ! bar.isVisible() ) 2665 if ( ! bar.isVisible() )
2650 return; 2666 return;
2651 bar.setProgress( count++ ); 2667 bar.setProgress( count++ );
2652 qApp->processEvents(); 2668 qApp->processEvents();
2653 bday = (*it).birthday().date(); 2669 bday = (*it).birthday().date();
2654 anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" ); 2670 anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" );
2655 2671
2656 if ( bday.isValid() || !anni.isEmpty()) 2672 if ( bday.isValid() || !anni.isEmpty())
2657 { 2673 {
2658 if (bday.isValid()) 2674 if (bday.isValid())
2659 formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate); 2675 formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate);
2660 else 2676 else
2661 formattedbday = "NOTVALID"; 2677 formattedbday = "NOTVALID";
2662 if (anni.isEmpty()) 2678 if (anni.isEmpty())
2663 anni = "INVALID"; 2679 anni = "INVALID";
2664 2680
2665 birthdayList.append(formattedbday); 2681 birthdayList.append(formattedbday);
2666 anniversaryList.append(anni); //should be ISODate 2682 anniversaryList.append(anni); //should be ISODate
2667 realNameList.append((*it).realName()); 2683 realNameList.append((*it).realName());
2668 preferredEmailList.append((*it).preferredEmail()); 2684 preferredEmailList.append((*it).preferredEmail());
2669 assembledNameList.append((*it).assembledName()); 2685 assembledNameList.append((*it).realName());
2670 uidList.append((*it).uid()); 2686 uidList.append((*it).uid());
2671 2687
2672 //qDebug("found birthday in KA/Pi: %s,%s,%s,%s: %s, %s", (*it).realName().latin1(), (*it).preferredEmail().latin1(), (*it).assembledName().latin1(), (*it).uid().latin1(), formattedbday.latin1(), anni.latin1() ); 2688 //qDebug("found birthday in KA/Pi: %s,%s,%s,%s: %s, %s", (*it).realName().latin1(), (*it).preferredEmail().latin1(), (*it).assembledName().latin1(), (*it).uid().latin1(), formattedbday.latin1(), anni.latin1() );
2673 } 2689 }
2674 } 2690 }
2675 2691
2676 bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList); 2692 bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList);
2677 2693
2678} 2694}
2679 2695
2680/* this method will be called through the QCop interface from other apps to show details of a contact. 2696/* this method will be called through the QCop interface from other apps to show details of a contact.
2681 */ 2697 */
2682void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) 2698void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid)
2683{ 2699{
2684 //qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); 2700 //qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1());
2685 2701
2686 QString foundUid = QString::null; 2702 QString foundUid = QString::null;
2687 if ( ! uid.isEmpty() ) { 2703 if ( ! uid.isEmpty() ) {
2688 Addressee adrr = mAddressBook->findByUid( uid ); 2704 Addressee adrr = mAddressBook->findByUid( uid );
2689 if ( !adrr.isEmpty() ) { 2705 if ( !adrr.isEmpty() ) {
2690 foundUid = uid; 2706 foundUid = uid;
2691 } 2707 }
2692 if ( email == "sendbacklist" ) { 2708 if ( email == "sendbacklist" ) {
2693 //qDebug("ssssssssssssssssssssssend "); 2709 //qDebug("ssssssssssssssssssssssend ");
2694 QStringList nameList; 2710 QStringList nameList;
2695 QStringList emailList; 2711 QStringList emailList;
2696 QStringList uidList; 2712 QStringList uidList;
2697 nameList.append(adrr.realName()); 2713 nameList.append(adrr.realName());
2698 emailList = adrr.emails(); 2714 emailList = adrr.emails();
2699 uidList.append( adrr.preferredEmail()); 2715 uidList.append( adrr.preferredEmail());
2700 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); 2716 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList);
2701 return; 2717 return;
2702 } 2718 }
2703 2719
2704 } 2720 }
2705 2721
2706 if ( email == "sendbacklist" ) 2722 if ( email == "sendbacklist" )
2707 return; 2723 return;
2708 if (foundUid.isEmpty()) 2724 if (foundUid.isEmpty())
2709 { 2725 {
2710 //find the uid of the person first 2726 //find the uid of the person first
2711 Addressee::List namelist; 2727 Addressee::List namelist;
2712 Addressee::List emaillist; 2728 Addressee::List emaillist;
2713 2729
2714 if (!name.isEmpty()) 2730 if (!name.isEmpty())
2715 namelist = mAddressBook->findByName( name ); 2731 namelist = mAddressBook->findByName( name );
2716 2732
2717 if (!email.isEmpty()) 2733 if (!email.isEmpty())
diff --git a/kaddressbook/kabprefs.cpp b/kaddressbook/kabprefs.cpp
index ea254b7..42d541b 100644
--- a/kaddressbook/kabprefs.cpp
+++ b/kaddressbook/kabprefs.cpp
@@ -11,96 +11,97 @@
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24//US#ifdef KAB_EMBEDDED 24//US#ifdef KAB_EMBEDDED
25//#include <qstring.h> 25//#include <qstring.h>
26//#endif //KAB_EMBEDDED 26//#endif //KAB_EMBEDDED
27 27
28#include <qtextstream.h> 28#include <qtextstream.h>
29#include <qfile.h> 29#include <qfile.h>
30#include <qregexp.h> 30#include <qregexp.h>
31#include <stdlib.h> 31#include <stdlib.h>
32#include <libkdepim/kpimglobalprefs.h> 32#include <libkdepim/kpimglobalprefs.h>
33 33
34#include <kconfig.h> 34#include <kconfig.h>
35#include <klocale.h> 35#include <klocale.h>
36#include <kstaticdeleter.h> 36#include <kstaticdeleter.h>
37#include <kglobalsettings.h> 37#include <kglobalsettings.h>
38//US#include <kdebug.h> // defines kdDebug() 38//US#include <kdebug.h> // defines kdDebug()
39 39
40#include "kabprefs.h" 40#include "kabprefs.h"
41 41
42#ifdef DESKTOP_VERSION 42#ifdef DESKTOP_VERSION
43#include <qapplication.h> 43#include <qapplication.h>
44#endif 44#endif
45 45
46KABPrefs *KABPrefs::sInstance = 0; 46KABPrefs *KABPrefs::sInstance = 0;
47static KStaticDeleter<KABPrefs> staticDeleterAB; 47static KStaticDeleter<KABPrefs> staticDeleterAB;
48 48
49KABPrefs::KABPrefs() 49KABPrefs::KABPrefs()
50 : KPimPrefs("kaddressbookrc") 50 : KPimPrefs("kaddressbookrc")
51{ 51{
52 KPrefs::setCurrentGroup( "Views" ); 52 KPrefs::setCurrentGroup( "Views" );
53 addItemBool( "HonorSingleClick", &mHonorSingleClick, false ); 53 addItemBool( "HonorSingleClick", &mHonorSingleClick, false );
54 54
55 KPrefs::setCurrentGroup( "General" ); 55 KPrefs::setCurrentGroup( "General" );
56 addItemBool( "AutomaticNameParsing", &mAutomaticNameParsing, true ); 56 addItemBool( "AutomaticNameParsing", &mAutomaticNameParsing, true );
57 addItemInt( "CurrentIncSearchField", &mCurrentIncSearchField, 0 ); 57 addItemInt( "CurrentIncSearchField", &mCurrentIncSearchField, 0 );
58#ifdef KAB_EMBEDDED 58#ifdef KAB_EMBEDDED
59 addItemBool("AskForDelete",&mAskForDelete,true);
59 addItemBool("AskForQuit",&mAskForQuit,true); 60 addItemBool("AskForQuit",&mAskForQuit,true);
60 addItemBool("ToolBarHor",&mToolBarHor, true ); 61 addItemBool("ToolBarHor",&mToolBarHor, true );
61 addItemBool("ToolBarUp",&mToolBarUp, false ); 62 addItemBool("ToolBarUp",&mToolBarUp, false );
62 addItemBool("SearchWithReturn",&mSearchWithReturn, false ); 63 addItemBool("SearchWithReturn",&mSearchWithReturn, false );
63 addItemBool("AutoSearchWithWildcard",&mAutoSearchWithWildcard, false ); 64 addItemBool("AutoSearchWithWildcard",&mAutoSearchWithWildcard, false );
64 addItemBool("HideSearchOnSwitch",&mHideSearchOnSwitch, false ); 65 addItemBool("HideSearchOnSwitch",&mHideSearchOnSwitch, false );
65 addItemFont("DetailsFont",&mDetailsFont,KGlobalSettings::generalFont()); 66 addItemFont("DetailsFont",&mDetailsFont,KGlobalSettings::generalFont());
66 67
67 68
68#endif //KAB_EMBEDDED 69#endif //KAB_EMBEDDED
69 70
70 KPrefs::setCurrentGroup( "MainWindow" ); 71 KPrefs::setCurrentGroup( "MainWindow" );
71 bool m_visible = false; 72 bool m_visible = false;
72#ifdef DESKTOP_VERSION 73#ifdef DESKTOP_VERSION
73 m_visible = true; 74 m_visible = true;
74#endif 75#endif
75 addItemBool( "FullMenuBarVisible", &mFullMenuBarVisible, m_visible ); 76 addItemBool( "FullMenuBarVisible", &mFullMenuBarVisible, m_visible );
76 addItemBool( "JumpButtonBarVisible", &mJumpButtonBarVisible, false ); 77 addItemBool( "JumpButtonBarVisible", &mJumpButtonBarVisible, false );
77 addItemBool( "DetailsPageVisible", &mDetailsPageVisible, true ); 78 addItemBool( "DetailsPageVisible", &mDetailsPageVisible, true );
78 addItemIntList( "ExtensionsSplitter", &mExtensionsSplitter ); 79 addItemIntList( "ExtensionsSplitter", &mExtensionsSplitter );
79 addItemIntList( "DetailsSplitter", &mDetailsSplitter ); 80 addItemIntList( "DetailsSplitter", &mDetailsSplitter );
80 addItemBool( "MultipleViewsAtOnce", &mMultipleViewsAtOnce, true ); 81 addItemBool( "MultipleViewsAtOnce", &mMultipleViewsAtOnce, true );
81 82
82 83
83 KPrefs::setCurrentGroup( "Extensions_General" ); 84 KPrefs::setCurrentGroup( "Extensions_General" );
84 QStringList defaultExtensions; 85 QStringList defaultExtensions;
85 defaultExtensions << "merge"; 86 defaultExtensions << "merge";
86 defaultExtensions << "distribution_list_editor"; 87 defaultExtensions << "distribution_list_editor";
87 addItemInt( "CurrentExtension", &mCurrentExtension, 0 ); 88 addItemInt( "CurrentExtension", &mCurrentExtension, 0 );
88 addItemStringList( "ActiveExtensions", &mActiveExtensions, defaultExtensions ); 89 addItemStringList( "ActiveExtensions", &mActiveExtensions, defaultExtensions );
89 90
90 KPrefs::setCurrentGroup( "Views" ); 91 KPrefs::setCurrentGroup( "Views" );
91 QString defaultView = i18n( "Default Table View" ); 92 QString defaultView = i18n( "Default Table View" );
92 addItemString( "CurrentView", &mCurrentView, defaultView ); 93 addItemString( "CurrentView", &mCurrentView, defaultView );
93 addItemStringList( "ViewNames", &mViewNames, defaultView ); 94 addItemStringList( "ViewNames", &mViewNames, defaultView );
94 95
95 KPrefs::setCurrentGroup( "Filters" ); 96 KPrefs::setCurrentGroup( "Filters" );
96 addItemInt( "CurrentFilter", &mCurrentFilter, 0 ); 97 addItemInt( "CurrentFilter", &mCurrentFilter, 0 );
97 98
98} 99}
99 100
100KABPrefs::~KABPrefs() 101KABPrefs::~KABPrefs()
101{ 102{
102 //qDebug("KABPrefs::~KABPrefs() "); 103 //qDebug("KABPrefs::~KABPrefs() ");
103 if (sInstance == this) 104 if (sInstance == this)
104 sInstance = staticDeleterAB.setObject(0); 105 sInstance = staticDeleterAB.setObject(0);
105} 106}
106 107
diff --git a/kaddressbook/kabprefs.h b/kaddressbook/kabprefs.h
index 2bb173d..ddbc0c0 100644
--- a/kaddressbook/kabprefs.h
+++ b/kaddressbook/kabprefs.h
@@ -27,72 +27,73 @@
27#include <qstringlist.h> 27#include <qstringlist.h>
28#include <qdict.h> 28#include <qdict.h>
29 29
30#include <libkdepim/kpimprefs.h> 30#include <libkdepim/kpimprefs.h>
31 31
32class KConfig; 32class KConfig;
33 33
34class KABPrefs : public KPimPrefs 34class KABPrefs : public KPimPrefs
35{ 35{
36 public: 36 public:
37 virtual ~KABPrefs(); 37 virtual ~KABPrefs();
38 38
39 static KABPrefs *instance(); 39 static KABPrefs *instance();
40 40
41 // General 41 // General
42 bool mHonorSingleClick; 42 bool mHonorSingleClick;
43 bool mAutomaticNameParsing; 43 bool mAutomaticNameParsing;
44 int mCurrentIncSearchField; 44 int mCurrentIncSearchField;
45 45
46#ifdef KAB_EMBEDDED 46#ifdef KAB_EMBEDDED
47 // US introduce a nonconst way to return the config object. 47 // US introduce a nonconst way to return the config object.
48 KConfig* getConfig(); 48 KConfig* getConfig();
49 49
50 bool mToolBarHor; 50 bool mToolBarHor;
51 bool mToolBarUp; 51 bool mToolBarUp;
52 bool mAskForQuit; 52 bool mAskForQuit;
53 53
54 54
55 /** Set preferences to default values */ 55 /** Set preferences to default values */
56// void usrSetDefaults(); 56// void usrSetDefaults();
57 57
58 /** Read preferences from config file */ 58 /** Read preferences from config file */
59// void usrReadConfig(); 59// void usrReadConfig();
60 60
61 /** Write preferences to config file */ 61 /** Write preferences to config file */
62// void usrWriteConfig(); 62// void usrWriteConfig();
63#endif //KAB_EMBEDDED 63#endif //KAB_EMBEDDED
64 void usrReadConfig(); 64 void usrReadConfig();
65 65
66 66
67 // GUI 67 // GUI
68 bool mFullMenuBarVisible; 68 bool mFullMenuBarVisible;
69 bool mJumpButtonBarVisible; 69 bool mJumpButtonBarVisible;
70 bool mDetailsPageVisible; 70 bool mDetailsPageVisible;
71 bool mMultipleViewsAtOnce; 71 bool mMultipleViewsAtOnce;
72 bool mSearchWithReturn; 72 bool mSearchWithReturn;
73 bool mAutoSearchWithWildcard; 73 bool mAutoSearchWithWildcard;
74 bool mHideSearchOnSwitch; 74 bool mHideSearchOnSwitch;
75 bool mAskForDelete;
75 QValueList<int> mExtensionsSplitter; 76 QValueList<int> mExtensionsSplitter;
76 QValueList<int> mDetailsSplitter; 77 QValueList<int> mDetailsSplitter;
77 78
78 // Extensions stuff 79 // Extensions stuff
79 int mCurrentExtension; 80 int mCurrentExtension;
80 QStringList mActiveExtensions; 81 QStringList mActiveExtensions;
81 82
82 // Views stuff 83 // Views stuff
83 QString mCurrentView; 84 QString mCurrentView;
84 QStringList mViewNames; 85 QStringList mViewNames;
85 86
86 // Filter 87 // Filter
87 int mCurrentFilter; 88 int mCurrentFilter;
88 89
89 void setCategoryDefaults(); 90 void setCategoryDefaults();
90 QFont mDetailsFont; 91 QFont mDetailsFont;
91 92
92 private: 93 private:
93 KABPrefs(); 94 KABPrefs();
94 95
95 static KABPrefs *sInstance; 96 static KABPrefs *sInstance;
96}; 97};
97 98
98#endif 99#endif
diff --git a/kaddressbook/kcmconfigs/kabconfigwidget.cpp b/kaddressbook/kcmconfigs/kabconfigwidget.cpp
index 1b4652a..9e4db74 100644
--- a/kaddressbook/kcmconfigs/kabconfigwidget.cpp
+++ b/kaddressbook/kcmconfigs/kabconfigwidget.cpp
@@ -97,190 +97,196 @@ KABConfigWidget::KABConfigWidget( KABPrefs* prefs, QWidget *parent, const char *
97 topLayout->addWidget( tabWidget ); 97 topLayout->addWidget( tabWidget );
98 98
99 // General page 99 // General page
100 QWidget *generalPage = new QWidget( this ); 100 QWidget *generalPage = new QWidget( this );
101 QVBoxLayout *layout = new QVBoxLayout( generalPage, KDialog::marginHintSmall(), 101 QVBoxLayout *layout = new QVBoxLayout( generalPage, KDialog::marginHintSmall(),
102 KDialog::spacingHintSmall() ); 102 KDialog::spacingHintSmall() );
103 103
104 104
105 QWidget *hBox = new QWidget( generalPage, "qhbox" ); 105 QWidget *hBox = new QWidget( generalPage, "qhbox" );
106 QHBoxLayout *hboxLayout = new QHBoxLayout( hBox); 106 QHBoxLayout *hboxLayout = new QHBoxLayout( hBox);
107 KPrefsWidFont *detailsFont = 107 KPrefsWidFont *detailsFont =
108 addWidFont(i18n("phone:123"),i18n("Details view font"), 108 addWidFont(i18n("phone:123"),i18n("Details view font"),
109 &(KABPrefs::instance()->mDetailsFont),hBox); 109 &(KABPrefs::instance()->mDetailsFont),hBox);
110 hboxLayout->addWidget(detailsFont->label()); 110 hboxLayout->addWidget(detailsFont->label());
111 hboxLayout->addWidget(detailsFont->preview()); 111 hboxLayout->addWidget(detailsFont->preview());
112 hboxLayout->addWidget(detailsFont->button()); 112 hboxLayout->addWidget(detailsFont->button());
113 hboxLayout->setMargin(KDialog::marginHintSmall() ); 113 hboxLayout->setMargin(KDialog::marginHintSmall() );
114 hboxLayout->setSpacing(KDialog::spacingHintSmall()); 114 hboxLayout->setSpacing(KDialog::spacingHintSmall());
115 //hBox->setBackgroundColor( black); 115 //hBox->setBackgroundColor( black);
116 layout->addWidget( hBox ); 116 layout->addWidget( hBox );
117 117
118 //general groupbox 118 //general groupbox
119 QWidget *vBox = new QWidget( generalPage, "qvbox" ); 119 QWidget *vBox = new QWidget( generalPage, "qvbox" );
120 QVBoxLayout *boxLayout = new QVBoxLayout( vBox ); 120 QVBoxLayout *boxLayout = new QVBoxLayout( vBox );
121 boxLayout->setAlignment( Qt::AlignTop ); 121 boxLayout->setAlignment( Qt::AlignTop );
122 boxLayout->setMargin(KDialog::marginHintSmall() ); 122 boxLayout->setMargin(KDialog::marginHintSmall() );
123 boxLayout->setSpacing( KDialog::spacingHintSmall() ); 123 boxLayout->setSpacing( KDialog::spacingHintSmall() );
124 mMenuBarBox = new QCheckBox( i18n( "Full Menu bar (restart)" ), vBox, "mremenuturn" ); 124 mMenuBarBox = new QCheckBox( i18n( "Full Menu bar (restart)" ), vBox, "mremenuturn" );
125 boxLayout->addWidget( mMenuBarBox ); 125 boxLayout->addWidget( mMenuBarBox );
126 mSearchReturnBox = new QCheckBox( i18n( "Search only after <return> key pressed" ), vBox, "mreturn" ); 126 mSearchReturnBox = new QCheckBox( i18n( "Search only after <return> key pressed" ), vBox, "mreturn" );
127 boxLayout->addWidget( mSearchReturnBox ); 127 boxLayout->addWidget( mSearchReturnBox );
128 mAutoSearchWithWildcardBox = new QCheckBox( i18n( "Search with '*' prefix (wildcard)" ), vBox, "mwildcard" ); 128 mAutoSearchWithWildcardBox = new QCheckBox( i18n( "Search with '*' prefix (wildcard)" ), vBox, "mwildcard" );
129 boxLayout->addWidget( mAutoSearchWithWildcardBox); 129 boxLayout->addWidget( mAutoSearchWithWildcardBox);
130 mHideSearchOnSwitchBox = new QCheckBox( i18n( "Shrink searchfield in portrait view" ), vBox, "mswitch" ); 130 mHideSearchOnSwitchBox = new QCheckBox( i18n( "Shrink searchfield in portrait view" ), vBox, "mswitch" );
131 boxLayout->addWidget( mHideSearchOnSwitchBox ); 131 boxLayout->addWidget( mHideSearchOnSwitchBox );
132 132
133#ifdef DESKTOP_VERSION 133#ifdef DESKTOP_VERSION
134 mHideSearchOnSwitchBox->hide(); 134 mHideSearchOnSwitchBox->hide();
135#endif 135#endif
136 mViewsSingleClickBox = new QCheckBox( i18n( "Show edit dialog on single click" ), vBox, "msingle" ); 136 mViewsSingleClickBox = new QCheckBox( i18n( "Show edit dialog on single click" ), vBox, "msingle" );
137 boxLayout->addWidget( mViewsSingleClickBox ); 137 boxLayout->addWidget( mViewsSingleClickBox );
138 138
139 mNameParsing = new QCheckBox( i18n( "Automatic name parsing for new contacts" ), vBox, "mparse" ); 139 mNameParsing = new QCheckBox( i18n( "Automatic name parsing for new contacts" ), vBox, "mparse" );
140 boxLayout->addWidget( mNameParsing ); 140 boxLayout->addWidget( mNameParsing );
141 141
142 mMultipleViewsAtOnce = new QCheckBox( i18n( "Display List and Details at once (restart)" ), vBox, "mdisplay" ); 142 mMultipleViewsAtOnce = new QCheckBox( i18n( "Display List and Details at once (restart)" ), vBox, "mdisplay" );
143 boxLayout->addWidget( mMultipleViewsAtOnce ); 143 boxLayout->addWidget( mMultipleViewsAtOnce );
144 144
145 mAskForDelete = new QCheckBox( i18n( "Ask before delete contact" ), vBox, "mdel" );
146 boxLayout->addWidget( mAskForDelete );
147
145 mAskForQuit = new QCheckBox( i18n( "Show exit confirmation" ), vBox, "mquit" ); 148 mAskForQuit = new QCheckBox( i18n( "Show exit confirmation" ), vBox, "mquit" );
146 boxLayout->addWidget( mAskForQuit ); 149 boxLayout->addWidget( mAskForQuit );
147 150
148 layout->addWidget( vBox ); 151 layout->addWidget( vBox );
149 152
150 tabWidget->addTab( generalPage, i18n( "General" ) ); 153 tabWidget->addTab( generalPage, i18n( "General" ) );
151 154
152 // Extension page 155 // Extension page
153 QWidget *extensionPage = new QWidget( this ); 156 QWidget *extensionPage = new QWidget( this );
154 QVBoxLayout *extensionLayout = new QVBoxLayout( extensionPage, KDialog::marginHintSmall(), 157 QVBoxLayout *extensionLayout = new QVBoxLayout( extensionPage, KDialog::marginHintSmall(),
155 KDialog::spacingHintSmall() ); 158 KDialog::spacingHintSmall() );
156 159
157 //extensions groupbox 160 //extensions groupbox
158 161
159 QGroupBox* groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Extensions (restart)" ), extensionPage ); 162 QGroupBox* groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Extensions (restart)" ), extensionPage );
160 boxLayout = new QVBoxLayout( groupBox->layout() ); 163 boxLayout = new QVBoxLayout( groupBox->layout() );
161 boxLayout->setAlignment( Qt::AlignTop ); 164 boxLayout->setAlignment( Qt::AlignTop );
162 boxLayout->setMargin(KDialog::marginHintSmall()); 165 boxLayout->setMargin(KDialog::marginHintSmall());
163 boxLayout->setSpacing(KDialog::spacingHintSmall()); 166 boxLayout->setSpacing(KDialog::spacingHintSmall());
164 groupBox->layout()->setMargin(1) ; 167 groupBox->layout()->setMargin(1) ;
165 groupBox->layout()->setSpacing(0); 168 groupBox->layout()->setSpacing(0);
166 mExtensionView = new KListView( groupBox ); 169 mExtensionView = new KListView( groupBox );
167 mExtensionView->setAllColumnsShowFocus( true ); 170 mExtensionView->setAllColumnsShowFocus( true );
168 mExtensionView->addColumn( i18n( "Name" ) ); 171 mExtensionView->addColumn( i18n( "Name" ) );
169 mExtensionView->addColumn( i18n( "Description" ) ); 172 mExtensionView->addColumn( i18n( "Description" ) );
170 //mExtensionView->setMaximumHeight(80); 173 //mExtensionView->setMaximumHeight(80);
171 174
172 boxLayout->addWidget( mExtensionView ); 175 boxLayout->addWidget( mExtensionView );
173 176
174 mConfigureButton = new QPushButton( i18n( "Configure..." ), groupBox ); 177 mConfigureButton = new QPushButton( i18n( "Configure..." ), groupBox );
175 mConfigureButton->setEnabled( false ); 178 mConfigureButton->setEnabled( false );
176 boxLayout->addWidget( mConfigureButton ); 179 boxLayout->addWidget( mConfigureButton );
177 180
178 extensionLayout->addWidget( groupBox ); 181 extensionLayout->addWidget( groupBox );
179 182
180 connect( mMenuBarBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 183 connect( mMenuBarBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
181 connect( mNameParsing, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 184 connect( mNameParsing, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
182 connect( mViewsSingleClickBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 185 connect( mViewsSingleClickBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
183 connect( mSearchReturnBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 186 connect( mSearchReturnBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
184 connect( mAutoSearchWithWildcardBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 187 connect( mAutoSearchWithWildcardBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
185 connect( mHideSearchOnSwitchBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 188 connect( mHideSearchOnSwitchBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
186 connect( mMultipleViewsAtOnce, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 189 connect( mMultipleViewsAtOnce, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
187 connect( mAskForQuit, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); 190 connect( mAskForQuit, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
191 connect( mAskForDelete, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
188 connect( mExtensionView, SIGNAL( selectionChanged( QListViewItem* ) ), 192 connect( mExtensionView, SIGNAL( selectionChanged( QListViewItem* ) ),
189 SLOT( selectionChanged( QListViewItem* ) ) ); 193 SLOT( selectionChanged( QListViewItem* ) ) );
190 connect( mExtensionView, SIGNAL( clicked( QListViewItem* ) ), 194 connect( mExtensionView, SIGNAL( clicked( QListViewItem* ) ),
191 SLOT( itemClicked( QListViewItem* ) ) ); 195 SLOT( itemClicked( QListViewItem* ) ) );
192 connect( mConfigureButton, SIGNAL( clicked() ), 196 connect( mConfigureButton, SIGNAL( clicked() ),
193 SLOT( configureExtension() ) ); 197 SLOT( configureExtension() ) );
194 198
195 tabWidget->addTab( extensionPage, i18n( "Extensions" ) ); 199 tabWidget->addTab( extensionPage, i18n( "Extensions" ) );
196 200
197 // Addressee page 201 // Addressee page
198 mAddresseeWidget = new AddresseeWidget( this ); 202 mAddresseeWidget = new AddresseeWidget( this );
199 tabWidget->addTab( mAddresseeWidget, i18n( "Contact" ) ); 203 tabWidget->addTab( mAddresseeWidget, i18n( "Contact" ) );
200 connect( mAddresseeWidget, SIGNAL( modified() ), SLOT( modified() ) ); 204 connect( mAddresseeWidget, SIGNAL( modified() ), SLOT( modified() ) );
201 205
202} 206}
203 207
204void KABConfigWidget::usrReadConfig() 208void KABConfigWidget::usrReadConfig()
205{ 209{
206 KABPrefs* prefs = KABPrefs::instance(); 210 KABPrefs* prefs = KABPrefs::instance();
207 211
208 bool blocked = signalsBlocked(); 212 bool blocked = signalsBlocked();
209 blockSignals( true ); 213 blockSignals( true );
210 mMenuBarBox->setChecked( prefs->mFullMenuBarVisible); 214 mMenuBarBox->setChecked( prefs->mFullMenuBarVisible);
211 mNameParsing->setChecked( prefs->mAutomaticNameParsing ); 215 mNameParsing->setChecked( prefs->mAutomaticNameParsing );
212 mViewsSingleClickBox->setChecked( prefs->mHonorSingleClick ); 216 mViewsSingleClickBox->setChecked( prefs->mHonorSingleClick );
213 mSearchReturnBox->setChecked( prefs->mSearchWithReturn ); 217 mSearchReturnBox->setChecked( prefs->mSearchWithReturn );
214 mAutoSearchWithWildcardBox->setChecked( prefs->mAutoSearchWithWildcard ); 218 mAutoSearchWithWildcardBox->setChecked( prefs->mAutoSearchWithWildcard );
215 mHideSearchOnSwitchBox->setChecked( prefs->mHideSearchOnSwitch ); 219 mHideSearchOnSwitchBox->setChecked( prefs->mHideSearchOnSwitch );
216 mMultipleViewsAtOnce->setChecked( prefs->mMultipleViewsAtOnce ); 220 mMultipleViewsAtOnce->setChecked( prefs->mMultipleViewsAtOnce );
217 mAskForQuit->setChecked( prefs->mAskForQuit ); 221 mAskForQuit->setChecked( prefs->mAskForQuit );
222 mAskForDelete->setChecked( prefs->mAskForDelete );
218 223
219 mAddresseeWidget->restoreSettings(); 224 mAddresseeWidget->restoreSettings();
220 225
221 restoreExtensionSettings(); 226 restoreExtensionSettings();
222 227
223 blockSignals( blocked ); 228 blockSignals( blocked );
224 229
225} 230}
226 231
227void KABConfigWidget::usrWriteConfig() 232void KABConfigWidget::usrWriteConfig()
228{ 233{
229 KABPrefs* prefs = KABPrefs::instance(); 234 KABPrefs* prefs = KABPrefs::instance();
230 prefs->mFullMenuBarVisible = mMenuBarBox->isChecked(); 235 prefs->mFullMenuBarVisible = mMenuBarBox->isChecked();
231 prefs->mAutomaticNameParsing = mNameParsing->isChecked(); 236 prefs->mAutomaticNameParsing = mNameParsing->isChecked();
232 prefs->mHonorSingleClick = mViewsSingleClickBox->isChecked(); 237 prefs->mHonorSingleClick = mViewsSingleClickBox->isChecked();
233 prefs->mSearchWithReturn = mSearchReturnBox->isChecked(); 238 prefs->mSearchWithReturn = mSearchReturnBox->isChecked();
234 prefs->mAutoSearchWithWildcard = mAutoSearchWithWildcardBox->isChecked(); 239 prefs->mAutoSearchWithWildcard = mAutoSearchWithWildcardBox->isChecked();
235 prefs->mHideSearchOnSwitch = mHideSearchOnSwitchBox->isChecked(); 240 prefs->mHideSearchOnSwitch = mHideSearchOnSwitchBox->isChecked();
236 241
237 prefs->mMultipleViewsAtOnce = mMultipleViewsAtOnce->isChecked(); 242 prefs->mMultipleViewsAtOnce = mMultipleViewsAtOnce->isChecked();
238 prefs->mAskForQuit = mAskForQuit->isChecked(); 243 prefs->mAskForQuit = mAskForQuit->isChecked();
244 prefs->mAskForDelete = mAskForDelete->isChecked();
239 245
240 mAddresseeWidget->saveSettings(); 246 mAddresseeWidget->saveSettings();
241 247
242 saveExtensionSettings(); 248 saveExtensionSettings();
243 249
244} 250}
245 251
246void KABConfigWidget::restoreExtensionSettings() 252void KABConfigWidget::restoreExtensionSettings()
247{ 253{
248 QStringList activeExtensions = KABPrefs::instance()->mActiveExtensions; 254 QStringList activeExtensions = KABPrefs::instance()->mActiveExtensions;
249 255
250 mExtensionView->clear(); 256 mExtensionView->clear();
251 257
252#ifndef KAB_EMBEDDED 258#ifndef KAB_EMBEDDED
253 KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/Extension" ); 259 KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/Extension" );
254 KTrader::OfferList::ConstIterator it; 260 KTrader::OfferList::ConstIterator it;
255 for ( it = plugins.begin(); it != plugins.end(); ++it ) { 261 for ( it = plugins.begin(); it != plugins.end(); ++it ) {
256 if ( !(*it)->hasServiceType( "KAddressBook/Extension" ) ) 262 if ( !(*it)->hasServiceType( "KAddressBook/Extension" ) )
257 continue; 263 continue;
258 264
259 ExtensionItem *item = new ExtensionItem( mExtensionView, (*it)->name() ); 265 ExtensionItem *item = new ExtensionItem( mExtensionView, (*it)->name() );
260 item->setService( *it ); 266 item->setService( *it );
261 if ( activeExtensions.contains( item->factory()->identifier() ) ) 267 if ( activeExtensions.contains( item->factory()->identifier() ) )
262 item->setOn( true ); 268 item->setOn( true );
263 } 269 }
264#else //KAB_EMBEDDED 270#else //KAB_EMBEDDED
265 ExtensionFactory *extensionFactory = new MergeFactory(); 271 ExtensionFactory *extensionFactory = new MergeFactory();
266 272
267 ExtensionItem *item = new ExtensionItem( mExtensionView, "Merge", "Merge", "Merge contacts"); 273 ExtensionItem *item = new ExtensionItem( mExtensionView, "Merge", "Merge", "Merge contacts");
268 274
269 item->setFactory( extensionFactory ); 275 item->setFactory( extensionFactory );
270 if ( activeExtensions.contains( extensionFactory->identifier() ) ) 276 if ( activeExtensions.contains( extensionFactory->identifier() ) )
271 item->setOn( true ); 277 item->setOn( true );
272 278
273 279
274 280
275 extensionFactory = new DistributionListFactory(); 281 extensionFactory = new DistributionListFactory();
276 282
277 item = new ExtensionItem( mExtensionView, "Distribution List", "Distribution List", "Manage Distribution Lists"); 283 item = new ExtensionItem( mExtensionView, "Distribution List", "Distribution List", "Manage Distribution Lists");
278 284
279 item->setFactory( extensionFactory ); 285 item->setFactory( extensionFactory );
280 if ( activeExtensions.contains( extensionFactory->identifier() ) ) 286 if ( activeExtensions.contains( extensionFactory->identifier() ) )
281 item->setOn( true ); 287 item->setOn( true );
282 288
283 289
284#endif //KAB_EMBEDDED 290#endif //KAB_EMBEDDED
285 291
286} 292}
diff --git a/kaddressbook/kcmconfigs/kabconfigwidget.h b/kaddressbook/kcmconfigs/kabconfigwidget.h
index a172e97..f2a6b1b 100644
--- a/kaddressbook/kcmconfigs/kabconfigwidget.h
+++ b/kaddressbook/kcmconfigs/kabconfigwidget.h
@@ -24,54 +24,55 @@
24#ifndef KABCONFIGWIDGET_H 24#ifndef KABCONFIGWIDGET_H
25#define KABCONFIGWIDGET_H 25#define KABCONFIGWIDGET_H
26 26
27#include <kprefswidget.h> 27#include <kprefswidget.h>
28 28
29class QCheckBox; 29class QCheckBox;
30class QListViewItem; 30class QListViewItem;
31class QPushButton; 31class QPushButton;
32class QComboBox; 32class QComboBox;
33class QLineEdit; 33class QLineEdit;
34class KListView; 34class KListView;
35class KABPrefs; 35class KABPrefs;
36 36
37class AddresseeWidget; 37class AddresseeWidget;
38 38
39class KABConfigWidget : public KPrefsWidget 39class KABConfigWidget : public KPrefsWidget
40{ 40{
41 Q_OBJECT 41 Q_OBJECT
42 42
43 public: 43 public:
44 KABConfigWidget(KABPrefs *prefs, QWidget *parent, const char *name = 0 ); 44 KABConfigWidget(KABPrefs *prefs, QWidget *parent, const char *name = 0 );
45 45
46 protected: 46 protected:
47 /** Implement this to read custom configuration widgets. */ 47 /** Implement this to read custom configuration widgets. */
48 virtual void usrReadConfig(); 48 virtual void usrReadConfig();
49 /** Implement this to write custom configuration widgets. */ 49 /** Implement this to write custom configuration widgets. */
50 virtual void usrWriteConfig(); 50 virtual void usrWriteConfig();
51 51
52 52
53 53
54 private slots: 54 private slots:
55 void configureExtension(); 55 void configureExtension();
56 void selectionChanged( QListViewItem* ); 56 void selectionChanged( QListViewItem* );
57 void itemClicked( QListViewItem* ); 57 void itemClicked( QListViewItem* );
58 58
59 private: 59 private:
60 void restoreExtensionSettings(); 60 void restoreExtensionSettings();
61 void saveExtensionSettings(); 61 void saveExtensionSettings();
62 62
63 KListView *mExtensionView; 63 KListView *mExtensionView;
64 QCheckBox *mSearchReturnBox; 64 QCheckBox *mSearchReturnBox;
65 QCheckBox *mNameParsing; 65 QCheckBox *mNameParsing;
66 QCheckBox *mViewsSingleClickBox; 66 QCheckBox *mViewsSingleClickBox;
67 QCheckBox *mAutoSearchWithWildcardBox; 67 QCheckBox *mAutoSearchWithWildcardBox;
68 QCheckBox *mHideSearchOnSwitchBox; 68 QCheckBox *mHideSearchOnSwitchBox;
69 QCheckBox *mMultipleViewsAtOnce; 69 QCheckBox *mMultipleViewsAtOnce;
70 QCheckBox *mAskForQuit; 70 QCheckBox *mAskForQuit;
71 QCheckBox *mMenuBarBox; 71 QCheckBox *mMenuBarBox;
72 QCheckBox *mAskForDelete;
72 QPushButton *mConfigureButton; 73 QPushButton *mConfigureButton;
73 74
74 AddresseeWidget *mAddresseeWidget; 75 AddresseeWidget *mAddresseeWidget;
75}; 76};
76 77
77#endif 78#endif