summaryrefslogtreecommitdiffabout
path: root/kaddressbook
Unidiff
Diffstat (limited to 'kaddressbook') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/filter.cpp2
-rw-r--r--kaddressbook/filter.h2
-rw-r--r--kaddressbook/filtereditdialog.cpp1
-rw-r--r--kaddressbook/kabcore.cpp16
-rw-r--r--kaddressbook/kaddressbookmain.cpp2
-rw-r--r--kaddressbook/viewmanager.cpp3
6 files changed, 15 insertions, 11 deletions
diff --git a/kaddressbook/filter.cpp b/kaddressbook/filter.cpp
index 9cb4c2d..7a869fa 100644
--- a/kaddressbook/filter.cpp
+++ b/kaddressbook/filter.cpp
@@ -128,49 +128,49 @@ void Filter::setCategories( const QStringList &list )
128{ 128{
129 mCategoryList = list; 129 mCategoryList = list;
130} 130}
131 131
132const QStringList &Filter::categories() const 132const QStringList &Filter::categories() const
133{ 133{
134 return mCategoryList; 134 return mCategoryList;
135} 135}
136 136
137void Filter::save( KConfig *config ) 137void Filter::save( KConfig *config )
138{ 138{
139 config->writeEntry( "Name", mName ); 139 config->writeEntry( "Name", mName );
140 config->writeEntry( "Enabled", mEnabled ); 140 config->writeEntry( "Enabled", mEnabled );
141 config->writeEntry( "Categories", mCategoryList ); 141 config->writeEntry( "Categories", mCategoryList );
142 config->writeEntry( "MatchRule", (int)mMatchRule ); 142 config->writeEntry( "MatchRule", (int)mMatchRule );
143 config->writeEntry( "Criteria", (int)mCriteria ); 143 config->writeEntry( "Criteria", (int)mCriteria );
144} 144}
145 145
146void Filter::restore( KConfig *config ) 146void Filter::restore( KConfig *config )
147{ 147{
148 mName = config->readEntry( "Name", "<internal error>" ); 148 mName = config->readEntry( "Name", "<internal error>" );
149 mEnabled = config->readBoolEntry( "Enabled", true ); 149 mEnabled = config->readBoolEntry( "Enabled", true );
150 mCategoryList = config->readListEntry( "Categories" ); 150 mCategoryList = config->readListEntry( "Categories" );
151 mMatchRule = (MatchRule)config->readNumEntry( "MatchRule", Matching ); 151 mMatchRule = (MatchRule)config->readNumEntry( "MatchRule", Matching );
152 mCriteria = config->readNumEntry( "Criteria", (ShowPublic | ShowPrivate| ShowConfidential) ); 152 mCriteria = config->readNumEntry( "Criteria", (ShowPublic | ShowPrivate| ShowConfidential ) );
153} 153}
154 154
155void Filter::save( KConfig *config, QString baseGroup, Filter::List &list ) 155void Filter::save( KConfig *config, QString baseGroup, Filter::List &list )
156{ 156{
157 { 157 {
158 KConfigGroupSaver s( config, baseGroup ); 158 KConfigGroupSaver s( config, baseGroup );
159 159
160 // remove the old filters 160 // remove the old filters
161 uint count = config->readNumEntry( "Count" ); 161 uint count = config->readNumEntry( "Count" );
162 /* // memory access violation here 162 /* // memory access violation here
163 for ( uint i = 0; i < count; ++i ) 163 for ( uint i = 0; i < count; ++i )
164 config->deleteGroup( QString( "%1_%2" ).arg( baseGroup ).arg( i ) ); 164 config->deleteGroup( QString( "%1_%2" ).arg( baseGroup ).arg( i ) );
165 */ 165 */
166 } 166 }
167 167
168 int index = 0; 168 int index = 0;
169 Filter::List::Iterator iter; 169 Filter::List::Iterator iter;
170 for ( iter = list.begin(); iter != list.end(); ++iter ) { 170 for ( iter = list.begin(); iter != list.end(); ++iter ) {
171 if ( !(*iter).mInternal ) { 171 if ( !(*iter).mInternal ) {
172 KConfigGroupSaver s( config, QString( "%1_%2" ).arg( baseGroup ).arg( index ) ); 172 KConfigGroupSaver s( config, QString( "%1_%2" ).arg( baseGroup ).arg( index ) );
173 173
174 (*iter).save( config ); 174 (*iter).save( config );
175 index++; 175 index++;
176 } 176 }
diff --git a/kaddressbook/filter.h b/kaddressbook/filter.h
index 26870d7..93f1352 100644
--- a/kaddressbook/filter.h
+++ b/kaddressbook/filter.h
@@ -18,49 +18,49 @@
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#ifndef FILTER_H 24#ifndef FILTER_H
25#define FILTER_H 25#define FILTER_H
26 26
27#include <qstring.h> 27#include <qstring.h>
28#include <qstringlist.h> 28#include <qstringlist.h>
29#include <qvaluelist.h> 29#include <qvaluelist.h>
30 30
31#include <kabc/addressee.h> 31#include <kabc/addressee.h>
32#include <kconfig.h> 32#include <kconfig.h>
33 33
34/** 34/**
35 Filter for AddressBook related objects (Addressees) 35 Filter for AddressBook related objects (Addressees)
36 36
37 @todo This class should be switched to use shared data. 37 @todo This class should be switched to use shared data.
38 */ 38 */
39class Filter 39class Filter
40{ 40{
41 public: 41 public:
42 enum { ShowPublic = 1, ShowPrivate = 2, ShowConfidential = 4}; 42 enum { ShowPublic = 1, ShowPrivate = 2, ShowConfidential = 4 };
43 void setCriteria(int c) { mCriteria = c ;} 43 void setCriteria(int c) { mCriteria = c ;}
44 int criteria() const { return mCriteria;} 44 int criteria() const { return mCriteria;}
45 typedef QValueList<Filter> List; 45 typedef QValueList<Filter> List;
46 46
47 enum MatchRule { Matching = 0, NotMatching = 1 }; 47 enum MatchRule { Matching = 0, NotMatching = 1 };
48 48
49 Filter(); 49 Filter();
50 Filter( const QString& name ); 50 Filter( const QString& name );
51 ~Filter(); 51 ~Filter();
52 52
53 /** 53 /**
54 Set the name of the filter. 54 Set the name of the filter.
55 */ 55 */
56 void setName( const QString &name ); 56 void setName( const QString &name );
57 57
58 /** 58 /**
59 @return The name of the filter. 59 @return The name of the filter.
60 */ 60 */
61 const QString &name() const; 61 const QString &name() const;
62 62
63 /** 63 /**
64 @return Whether the filter is an internal one. 64 @return Whether the filter is an internal one.
65 */ 65 */
66 bool isInternal() const; 66 bool isInternal() const;
diff --git a/kaddressbook/filtereditdialog.cpp b/kaddressbook/filtereditdialog.cpp
index 987f234..1194406 100644
--- a/kaddressbook/filtereditdialog.cpp
+++ b/kaddressbook/filtereditdialog.cpp
@@ -75,49 +75,48 @@ FilterEditDialog::~FilterEditDialog()
75void FilterEditDialog::setFilter( const Filter &filter ) 75void FilterEditDialog::setFilter( const Filter &filter )
76{ 76{
77 mNameEdit->setText( filter.name() ); 77 mNameEdit->setText( filter.name() );
78 78
79 QStringList categories = filter.categories(); 79 QStringList categories = filter.categories();
80 QListViewItem *item = mCategoriesView->firstChild(); 80 QListViewItem *item = mCategoriesView->firstChild();
81 while ( item != 0 ) { 81 while ( item != 0 ) {
82 if ( categories.contains( item->text( 0 ) ) ) { 82 if ( categories.contains( item->text( 0 ) ) ) {
83 QCheckListItem *checkItem = static_cast<QCheckListItem*>( item ); 83 QCheckListItem *checkItem = static_cast<QCheckListItem*>( item );
84 checkItem->setOn( true ); 84 checkItem->setOn( true );
85 } 85 }
86 86
87 item = item->nextSibling(); 87 item = item->nextSibling();
88 } 88 }
89 89
90 if ( filter.matchRule() == Filter::Matching ) 90 if ( filter.matchRule() == Filter::Matching )
91 mMatchRuleGroup->setButton( 0 ); 91 mMatchRuleGroup->setButton( 0 );
92 else 92 else
93 mMatchRuleGroup->setButton( 1 ); 93 mMatchRuleGroup->setButton( 1 );
94 94
95 int c = filter.criteria() ; 95 int c = filter.criteria() ;
96 mPublic->setChecked(c &Filter::ShowPublic); 96 mPublic->setChecked(c &Filter::ShowPublic);
97 mPrivate->setChecked(c & Filter::ShowPrivate); 97 mPrivate->setChecked(c & Filter::ShowPrivate);
98 mConfidential->setChecked(c & Filter::ShowConfidential); 98 mConfidential->setChecked(c & Filter::ShowConfidential);
99
100} 99}
101 100
102Filter FilterEditDialog::filter() 101Filter FilterEditDialog::filter()
103{ 102{
104 Filter filter; 103 Filter filter;
105 104
106 filter.setName( mNameEdit->text() ); 105 filter.setName( mNameEdit->text() );
107 106
108 QStringList categories; 107 QStringList categories;
109 QListViewItem *item = mCategoriesView->firstChild(); 108 QListViewItem *item = mCategoriesView->firstChild();
110 while ( item != 0 ) { 109 while ( item != 0 ) {
111 QCheckListItem *checkItem = static_cast<QCheckListItem*>( item ); 110 QCheckListItem *checkItem = static_cast<QCheckListItem*>( item );
112 if ( checkItem->isOn() ) 111 if ( checkItem->isOn() )
113 categories.append( item->text( 0 ) ); 112 categories.append( item->text( 0 ) );
114 113
115 item = item->nextSibling(); 114 item = item->nextSibling();
116 } 115 }
117 filter.setCategories( categories ); 116 filter.setCategories( categories );
118 117
119 if ( mMatchRuleGroup->find( 0 )->isOn() ) 118 if ( mMatchRuleGroup->find( 0 )->isOn() )
120 filter.setMatchRule( Filter::Matching ); 119 filter.setMatchRule( Filter::Matching );
121 else 120 else
122 filter.setMatchRule( Filter::NotMatching ); 121 filter.setMatchRule( Filter::NotMatching );
123 122
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index e61f65f..aa04631 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -242,49 +242,49 @@ class KAex2phonePrefs : public QDialog
242 { 242 {
243 setCaption( i18n("Export to phone options") ); 243 setCaption( i18n("Export to phone options") );
244 QVBoxLayout* lay = new QVBoxLayout( this ); 244 QVBoxLayout* lay = new QVBoxLayout( this );
245 lay->setSpacing( 3 ); 245 lay->setSpacing( 3 );
246 lay->setMargin( 3 ); 246 lay->setMargin( 3 );
247 QLabel *lab; 247 QLabel *lab;
248 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); 248 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) );
249 lab->setAlignment (AlignHCenter ); 249 lab->setAlignment (AlignHCenter );
250 QHBox* temphb; 250 QHBox* temphb;
251 temphb = new QHBox( this ); 251 temphb = new QHBox( this );
252 new QLabel( i18n("I/O device: "), temphb ); 252 new QLabel( i18n("I/O device: "), temphb );
253 mPhoneDevice = new QLineEdit( temphb); 253 mPhoneDevice = new QLineEdit( temphb);
254 lay->addWidget( temphb ); 254 lay->addWidget( temphb );
255 temphb = new QHBox( this ); 255 temphb = new QHBox( this );
256 new QLabel( i18n("Connection: "), temphb ); 256 new QLabel( i18n("Connection: "), temphb );
257 mPhoneConnection = new QLineEdit( temphb); 257 mPhoneConnection = new QLineEdit( temphb);
258 lay->addWidget( temphb ); 258 lay->addWidget( temphb );
259 temphb = new QHBox( this ); 259 temphb = new QHBox( this );
260 new QLabel( i18n("Model(opt.): "), temphb ); 260 new QLabel( i18n("Model(opt.): "), temphb );
261 mPhoneModel = new QLineEdit( temphb); 261 mPhoneModel = new QLineEdit( temphb);
262 lay->addWidget( temphb ); 262 lay->addWidget( temphb );
263 // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this ); 263 // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this );
264 // lay->addWidget( mWriteToSim ); 264 // lay->addWidget( mWriteToSim );
265 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) ); 265 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) );
266 lab->setAlignment (AlignHCenter ); 266 lab->setAlignment (AlignHCenter);
267 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); 267 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
268 lay->addWidget( ok ); 268 lay->addWidget( ok );
269 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 269 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
270 lay->addWidget( cancel ); 270 lay->addWidget( cancel );
271 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 271 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
272 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 272 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
273 resize( 220, 240 ); 273 resize( 220, 240 );
274 274
275 } 275 }
276 276
277public: 277public:
278 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; 278 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
279 QCheckBox* mWriteToSim; 279 QCheckBox* mWriteToSim;
280}; 280};
281 281
282 282
283bool pasteWithNewUid = true; 283bool pasteWithNewUid = true;
284 284
285#ifdef KAB_EMBEDDED 285#ifdef KAB_EMBEDDED
286KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) 286KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name )
287 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), 287 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ),
288 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ 288 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/
289 mReadWrite( readWrite ), mModified( false ), mMainWindow(client) 289 mReadWrite( readWrite ), mModified( false ), mMainWindow(client)
290#else //KAB_EMBEDDED 290#else //KAB_EMBEDDED
@@ -544,48 +544,50 @@ void KABCore::restoreSettings()
544 } 544 }
545 mExtensionBarSplitter->setSizes( splitterSize ); 545 mExtensionBarSplitter->setSizes( splitterSize );
546 546
547 } 547 }
548 548
549 549
550} 550}
551 551
552void KABCore::saveSettings() 552void KABCore::saveSettings()
553{ 553{
554 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); 554 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked();
555 if ( mExtensionBarSplitter ) 555 if ( mExtensionBarSplitter )
556 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 556 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
557 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); 557 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked();
558 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); 558 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes();
559#ifndef KAB_EMBEDDED 559#ifndef KAB_EMBEDDED
560 560
561 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 561 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
562 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); 562 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes();
563#endif //KAB_EMBEDDED 563#endif //KAB_EMBEDDED
564 mExtensionManager->saveSettings(); 564 mExtensionManager->saveSettings();
565 mViewManager->saveSettings(); 565 mViewManager->saveSettings();
566 566
567 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); 567 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem();
568 KABPrefs::instance()->writeConfig();
569 qDebug("KABPrefs::instance()->writeConfig() ");
568} 570}
569 571
570KABC::AddressBook *KABCore::addressBook() const 572KABC::AddressBook *KABCore::addressBook() const
571{ 573{
572 return mAddressBook; 574 return mAddressBook;
573} 575}
574 576
575KConfig *KABCore::config() 577KConfig *KABCore::config()
576{ 578{
577#ifndef KAB_EMBEDDED 579#ifndef KAB_EMBEDDED
578 return KABPrefs::instance()->config(); 580 return KABPrefs::instance()->config();
579#else //KAB_EMBEDDED 581#else //KAB_EMBEDDED
580 return KABPrefs::instance()->getConfig(); 582 return KABPrefs::instance()->getConfig();
581#endif //KAB_EMBEDDED 583#endif //KAB_EMBEDDED
582} 584}
583 585
584KActionCollection *KABCore::actionCollection() const 586KActionCollection *KABCore::actionCollection() const
585{ 587{
586 return mGUIClient->actionCollection(); 588 return mGUIClient->actionCollection();
587} 589}
588 590
589KABC::Field *KABCore::currentSearchField() const 591KABC::Field *KABCore::currentSearchField() const
590{ 592{
591 if (mIncSearchWidget) 593 if (mIncSearchWidget)
@@ -2664,48 +2666,49 @@ KABC::Addressee KABCore::getLastSyncAddressee()
2664int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ) 2666int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full )
2665{ 2667{
2666 2668
2667 //void setZaurusId(int id); 2669 //void setZaurusId(int id);
2668 // int zaurusId() const; 2670 // int zaurusId() const;
2669 // void setZaurusUid(int id); 2671 // void setZaurusUid(int id);
2670 // int zaurusUid() const; 2672 // int zaurusUid() const;
2671 // void setZaurusStat(int id); 2673 // void setZaurusStat(int id);
2672 // int zaurusStat() const; 2674 // int zaurusStat() const;
2673 // 0 equal 2675 // 0 equal
2674 // 1 take local 2676 // 1 take local
2675 // 2 take remote 2677 // 2 take remote
2676 // 3 cancel 2678 // 3 cancel
2677 QDateTime lastSync = mLastAddressbookSync; 2679 QDateTime lastSync = mLastAddressbookSync;
2678 QDateTime localMod = local->revision(); 2680 QDateTime localMod = local->revision();
2679 QDateTime remoteMod = remote->revision(); 2681 QDateTime remoteMod = remote->revision();
2680 2682
2681 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); 2683 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice();
2682 2684
2683 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2685 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2684 bool remCh, locCh; 2686 bool remCh, locCh;
2685 remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); 2687 remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) );
2686 //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); 2688 //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() );
2687 locCh = ( localMod > mLastAddressbookSync ); 2689 locCh = ( localMod > mLastAddressbookSync );
2690 //qDebug("cahnged rem %d loc %d",remCh, locCh );
2688 if ( !remCh && ! locCh ) { 2691 if ( !remCh && ! locCh ) {
2689 //qDebug("both not changed "); 2692 //qDebug("both not changed ");
2690 lastSync = localMod.addDays(1); 2693 lastSync = localMod.addDays(1);
2691 if ( mode <= SYNC_PREF_ASK ) 2694 if ( mode <= SYNC_PREF_ASK )
2692 return 0; 2695 return 0;
2693 } else { 2696 } else {
2694 if ( locCh ) { 2697 if ( locCh ) {
2695 //qDebug("loc changed %s %s", localMod.toString().latin1(), mLastAddressbookSync.toString().latin1()); 2698 //qDebug("loc changed %s %s", localMod.toString().latin1(), mLastAddressbookSync.toString().latin1());
2696 lastSync = localMod.addDays( -1 ); 2699 lastSync = localMod.addDays( -1 );
2697 if ( !remCh ) 2700 if ( !remCh )
2698 remoteMod =( lastSync.addDays( -1 ) ); 2701 remoteMod =( lastSync.addDays( -1 ) );
2699 } else { 2702 } else {
2700 //qDebug(" not loc changed "); 2703 //qDebug(" not loc changed ");
2701 lastSync = localMod.addDays( 1 ); 2704 lastSync = localMod.addDays( 1 );
2702 if ( remCh ) { 2705 if ( remCh ) {
2703 //qDebug("rem changed "); 2706 //qDebug("rem changed ");
2704 remoteMod =( lastSync.addDays( 1 ) ); 2707 remoteMod =( lastSync.addDays( 1 ) );
2705 } 2708 }
2706 2709
2707 } 2710 }
2708 } 2711 }
2709 full = true; 2712 full = true;
2710 if ( mode < SYNC_PREF_ASK ) 2713 if ( mode < SYNC_PREF_ASK )
2711 mode = SYNC_PREF_ASK; 2714 mode = SYNC_PREF_ASK;
@@ -2741,50 +2744,51 @@ int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, i
2741 case SYNC_PREF_LOCAL: 2744 case SYNC_PREF_LOCAL:
2742 if ( lastSync > remoteMod ) 2745 if ( lastSync > remoteMod )
2743 return 1; 2746 return 1;
2744 if ( lastSync > localMod ) 2747 if ( lastSync > localMod )
2745 return 2; 2748 return 2;
2746 return 1; 2749 return 1;
2747 break; 2750 break;
2748 case SYNC_PREF_REMOTE: 2751 case SYNC_PREF_REMOTE:
2749 if ( lastSync > remoteMod ) 2752 if ( lastSync > remoteMod )
2750 return 1; 2753 return 1;
2751 if ( lastSync > localMod ) 2754 if ( lastSync > localMod )
2752 return 2; 2755 return 2;
2753 return 2; 2756 return 2;
2754 break; 2757 break;
2755 case SYNC_PREF_NEWEST: 2758 case SYNC_PREF_NEWEST:
2756 if ( localMod > remoteMod ) 2759 if ( localMod > remoteMod )
2757 return 1; 2760 return 1;
2758 else 2761 else
2759 return 2; 2762 return 2;
2760 break; 2763 break;
2761 case SYNC_PREF_ASK: 2764 case SYNC_PREF_ASK:
2762 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); 2765 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() );
2763 if ( lastSync > remoteMod ) 2766 if ( lastSync > remoteMod )
2764 return 1; 2767 return 1;
2765 if ( lastSync > localMod ) 2768 if ( lastSync > localMod ) {
2766 return 2; 2769 return 2;
2770 }
2767 localIsNew = localMod >= remoteMod; 2771 localIsNew = localMod >= remoteMod;
2768 //qDebug("conflict! ************************************** "); 2772 //qDebug("conflict! ************************************** ");
2769 { 2773 {
2770 KABC::AddresseeChooser acd ( *local,*remote, localIsNew , this ); 2774 KABC::AddresseeChooser acd ( *local,*remote, localIsNew , this );
2771 result = acd.executeD(localIsNew); 2775 result = acd.executeD(localIsNew);
2772 return result; 2776 return result;
2773 } 2777 }
2774 break; 2778 break;
2775 case SYNC_PREF_FORCE_LOCAL: 2779 case SYNC_PREF_FORCE_LOCAL:
2776 return 1; 2780 return 1;
2777 break; 2781 break;
2778 case SYNC_PREF_FORCE_REMOTE: 2782 case SYNC_PREF_FORCE_REMOTE:
2779 return 2; 2783 return 2;
2780 break; 2784 break;
2781 2785
2782 default: 2786 default:
2783 // SYNC_PREF_TAKE_BOTH not implemented 2787 // SYNC_PREF_TAKE_BOTH not implemented
2784 break; 2788 break;
2785 } 2789 }
2786 return 0; 2790 return 0;
2787} 2791}
2788 2792
2789 2793
2790bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode) 2794bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode)
@@ -2985,52 +2989,54 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo
2985 ++deletedAddresseeR; 2989 ++deletedAddresseeR;
2986 } 2990 }
2987 } 2991 }
2988 } 2992 }
2989 } 2993 }
2990 } 2994 }
2991 ++incCounter; 2995 ++incCounter;
2992 } 2996 }
2993 er.clear(); 2997 er.clear();
2994 QStringList el = local->uidList(); 2998 QStringList el = local->uidList();
2995 modulo = (el.count()/10)+1; 2999 modulo = (el.count()/10)+1;
2996 3000
2997 syncManager->showProgressBar(0, i18n("Add / remove addressees"), el.count()); 3001 syncManager->showProgressBar(0, i18n("Add / remove addressees"), el.count());
2998 incCounter = 0; 3002 incCounter = 0;
2999 while ( incCounter < el.count()) { 3003 while ( incCounter < el.count()) {
3000 qApp->processEvents(); 3004 qApp->processEvents();
3001 if (syncManager->isProgressBarCanceled()) 3005 if (syncManager->isProgressBarCanceled())
3002 return false; 3006 return false;
3003 if ( incCounter % modulo == 0 ) 3007 if ( incCounter % modulo == 0 )
3004 syncManager->showProgressBar(incCounter); 3008 syncManager->showProgressBar(incCounter);
3005 uid = el[ incCounter ]; 3009 uid = el[ incCounter ];
3006 bool skipIncidence = false; 3010 bool skipIncidence = false;
3007 if ( uid.left(19) == QString("last-syncAddressee-") ) 3011 if ( uid.left(19) == QString("last-syncAddressee-") )
3008 skipIncidence = true; 3012 skipIncidence = true;
3009 if ( !filterOUT.name().isEmpty() && ! filterOUT.filterAddressee( inL ) ) 3013 if ( ! skipIncidence ) {
3010 skipIncidence = true;
3011 if ( !skipIncidence ) {
3012 inL = local->findByUid( uid ); 3014 inL = local->findByUid( uid );
3015 if ( (!filterOUT.name().isEmpty()) && (! filterOUT.filterAddressee( inL ) ) )
3016 skipIncidence = true;
3017 }
3018 if ( !skipIncidence ) {
3013 if ( !inL.resource() || inL.resource()->includeInSync() ) { 3019 if ( !inL.resource() || inL.resource()->includeInSync() ) {
3014 inR = remote->findByUid( uid ); 3020 inR = remote->findByUid( uid );
3015 if ( inR.isEmpty() ) { // no conflict ********** add or delete local 3021 if ( inR.isEmpty() ) { // no conflict ********** add or delete local
3016 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 3022 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
3017 if ( !inL.getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { 3023 if ( !inL.getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) {
3018 // pending checkExternSyncAddressee(addresseeLSyncSharp, inL); 3024 // pending checkExternSyncAddressee(addresseeLSyncSharp, inL);
3019 local->removeAddressee( inL ); 3025 local->removeAddressee( inL );
3020 ++deletedAddresseeL; 3026 ++deletedAddresseeL;
3021 } else { 3027 } else {
3022 if ( ! syncManager->mWriteBackExistingOnly ) { 3028 if ( ! syncManager->mWriteBackExistingOnly ) {
3023 inL.removeID(mCurrentSyncDevice ); 3029 inL.removeID(mCurrentSyncDevice );
3024 ++addedAddresseeR; 3030 ++addedAddresseeR;
3025 inL.setRevision( modifiedCalendar ); 3031 inL.setRevision( modifiedCalendar );
3026 local->insertAddressee( inL, false ); 3032 local->insertAddressee( inL, false );
3027 inR = inL; 3033 inR = inL;
3028 inR.setTempSyncStat( SYNC_TEMPSTATE_ADDED_EXTERNAL ); 3034 inR.setTempSyncStat( SYNC_TEMPSTATE_ADDED_EXTERNAL );
3029 inR.setResource( 0 ); 3035 inR.setResource( 0 );
3030 remote->insertAddressee( inR, false ); 3036 remote->insertAddressee( inR, false );
3031 } 3037 }
3032 } 3038 }
3033 } else { 3039 } else {
3034 if ( inL.revision() < mLastAddressbookSync && mode != 4 ) { 3040 if ( inL.revision() < mLastAddressbookSync && mode != 4 ) {
3035 //qDebug("data %s ", inL.revision().toString().latin1()); 3041 //qDebug("data %s ", inL.revision().toString().latin1());
3036 // pending checkExternSyncAddressee(addresseeLSyncSharp, inL); 3042 // pending checkExternSyncAddressee(addresseeLSyncSharp, inL);
diff --git a/kaddressbook/kaddressbookmain.cpp b/kaddressbook/kaddressbookmain.cpp
index 2832257..519dc92 100644
--- a/kaddressbook/kaddressbookmain.cpp
+++ b/kaddressbook/kaddressbookmain.cpp
@@ -206,34 +206,34 @@ void KAddressBookMain::closeEvent( QCloseEvent* ce )
206 mess += i18n( "\nChanges will be saved!"); 206 mess += i18n( "\nChanges will be saved!");
207 else 207 else
208 mess += i18n( "\nNo unsaved changes detected!\nNothing will be saved!"); 208 mess += i18n( "\nNo unsaved changes detected!\nNothing will be saved!");
209 209
210 bool mQuit = true; 210 bool mQuit = true;
211 211
212 212
213 if (mAskForQuit) 213 if (mAskForQuit)
214 { 214 {
215 215
216 int res = QMessageBox::information( this, "KA/Pi", mess , i18n("Yes!"), i18n("No"), 0, 0 ); 216 int res = QMessageBox::information( this, "KA/Pi", mess , i18n("Yes!"), i18n("No"), 0, 0 );
217 if (res == 0) 217 if (res == 0)
218 mQuit = true; 218 mQuit = true;
219 else 219 else
220 mQuit = false; 220 mQuit = false;
221 } 221 }
222 222
223 if (mQuit == false) 223 if (mQuit == false)
224 return; 224 return;
225 225
226 if (mModified == true) 226 if (mModified == true)
227 { 227 {
228 save(); 228 save();
229 mCore->saveSettings(); 229 mCore->saveSettings();
230 KABPrefs::instance()->writeConfig(); 230 //KABPrefs::instance()->writeConfig();
231 } 231 }
232 232
233 ce->accept(); 233 ce->accept();
234} 234}
235 235
236#ifndef KAB_EMBEDDED 236#ifndef KAB_EMBEDDED
237#include "kaddressbookmain.moc" 237#include "kaddressbookmain.moc"
238#endif //KAB_EMBEDDED 238#endif //KAB_EMBEDDED
239 239
diff --git a/kaddressbook/viewmanager.cpp b/kaddressbook/viewmanager.cpp
index 9c3a641..4be860e 100644
--- a/kaddressbook/viewmanager.cpp
+++ b/kaddressbook/viewmanager.cpp
@@ -262,54 +262,53 @@ void ViewManager::setActiveView( const QString &name )
262 mViewWidgetStack->raiseWidget( view ); 262 mViewWidgetStack->raiseWidget( view );
263 // Set the proper filter in the view. By setting the combo 263 // Set the proper filter in the view. By setting the combo
264 // box, the activated slot will be called, which will push 264 // box, the activated slot will be called, which will push
265 // the filter to the view and refresh it. 265 // the filter to the view and refresh it.
266 266
267 if ( view->defaultFilterType() == KAddressBookView::None ) { 267 if ( view->defaultFilterType() == KAddressBookView::None ) {
268 268
269 mActionSelectFilter->setCurrentItem( 0 ); 269 mActionSelectFilter->setCurrentItem( 0 );
270 setActiveFilter( 0 ); 270 setActiveFilter( 0 );
271 } else if ( view->defaultFilterType() == KAddressBookView::Active ) { 271 } else if ( view->defaultFilterType() == KAddressBookView::Active ) {
272 setActiveFilter( mActionSelectFilter->currentItem() ); 272 setActiveFilter( mActionSelectFilter->currentItem() );
273 } else { 273 } else {
274 uint pos = filterPosition( view->defaultFilterName() ); 274 uint pos = filterPosition( view->defaultFilterName() );
275 mActionSelectFilter->setCurrentItem( pos ); 275 mActionSelectFilter->setCurrentItem( pos );
276 setActiveFilter( pos ); 276 setActiveFilter( pos );
277 } 277 }
278//US qDebug("ViewManager::setActiveView 6" ); 278//US qDebug("ViewManager::setActiveView 6" );
279 279
280 // Update the inc search widget to show the fields in the new active 280 // Update the inc search widget to show the fields in the new active
281 // view. 281 // view.
282 mCore->setSearchFields( mActiveView->fields() ); 282 mCore->setSearchFields( mActiveView->fields() );
283 283
284//US performance optimization. setActiveFilter calls also mActiveView->refresh() 284//US performance optimization. setActiveFilter calls also mActiveView->refresh()
285//US mActiveView->refresh(); 285//US mActiveView->refresh();
286 286 mCore->saveSettings();
287 } 287 }
288 else 288 else
289 { 289 {
290 qDebug("ViewManager::setActiveView: unable to find view" ); 290 qDebug("ViewManager::setActiveView: unable to find view" );
291 kdDebug(5720) << "ViewManager::setActiveView: unable to find view\n";
292 } 291 }
293} 292}
294 293
295//US added another method with no parameter, since my moc compiler does not support default parameters. 294//US added another method with no parameter, since my moc compiler does not support default parameters.
296void ViewManager::refreshView() 295void ViewManager::refreshView()
297{ 296{
298 refreshView( QString::null ); 297 refreshView( QString::null );
299} 298}
300 299
301void ViewManager::refreshView( const QString &uid ) 300void ViewManager::refreshView( const QString &uid )
302{ 301{
303 if ( mActiveView ) 302 if ( mActiveView )
304 mActiveView->refresh( uid ); 303 mActiveView->refresh( uid );
305} 304}
306 305
307void ViewManager::setFocusAV() 306void ViewManager::setFocusAV()
308{ 307{
309 if ( mActiveView ) 308 if ( mActiveView )
310 mActiveView->setFocusAV(); 309 mActiveView->setFocusAV();
311} 310}
312void ViewManager::editView() 311void ViewManager::editView()
313{ 312{
314 if ( !mActiveView ) 313 if ( !mActiveView )
315 return; 314 return;