summaryrefslogtreecommitdiffabout
path: root/kaddressbook
Unidiff
Diffstat (limited to 'kaddressbook') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp8
-rw-r--r--kaddressbook/kabprefs.cpp3
2 files changed, 7 insertions, 4 deletions
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.