summaryrefslogtreecommitdiffabout
path: root/kaddressbook
authorzautrix <zautrix>2005-01-14 11:37:40 (UTC)
committer zautrix <zautrix>2005-01-14 11:37:40 (UTC)
commit61c95ce0295f1397db6499c5b468a9fb3d32a0f4 (patch) (unidiff)
tree2bceecc46d42a572adfad7d8e5000d1534642cbd /kaddressbook
parenta46ecf5ed81460ec9a4e457798e1bf0fb74c5624 (diff)
downloadkdepimpi-61c95ce0295f1397db6499c5b468a9fb3d32a0f4.zip
kdepimpi-61c95ce0295f1397db6499c5b468a9fb3d32a0f4.tar.gz
kdepimpi-61c95ce0295f1397db6499c5b468a9fb3d32a0f4.tar.bz2
made kapi saving faster
Diffstat (limited to 'kaddressbook') (more/less context) (show whitespace changes)
-rw-r--r--kaddressbook/details/detailsviewcontainer.cpp11
-rw-r--r--kaddressbook/details/detailsviewcontainer.h1
-rw-r--r--kaddressbook/imagewidget.cpp7
-rw-r--r--kaddressbook/kabcore.cpp9
-rw-r--r--kaddressbook/kabcore.h9
-rw-r--r--kaddressbook/viewmanager.cpp1
6 files changed, 9 insertions, 29 deletions
diff --git a/kaddressbook/details/detailsviewcontainer.cpp b/kaddressbook/details/detailsviewcontainer.cpp
index ceffc77..229cce0 100644
--- a/kaddressbook/details/detailsviewcontainer.cpp
+++ b/kaddressbook/details/detailsviewcontainer.cpp
@@ -120,40 +120,31 @@ void ViewContainer::slotStyleSelected( int index )
120 mCurrentLook = factory->create(); 120 mCurrentLook = factory->create();
121 mDetailsStack->raiseWidget( mCurrentLook ); 121 mDetailsStack->raiseWidget( mCurrentLook );
122 122
123 connect( mCurrentLook, SIGNAL( sendEmail( const QString& ) ), this, 123 connect( mCurrentLook, SIGNAL( sendEmail( const QString& ) ), this,
124 SIGNAL( sendEmail( const QString& ) ) ); 124 SIGNAL( sendEmail( const QString& ) ) );
125 connect( mCurrentLook, SIGNAL( browse( const QString& ) ), this, 125 connect( mCurrentLook, SIGNAL( browse( const QString& ) ), this,
126 SIGNAL( browse( const QString& ) ) ); 126 SIGNAL( browse( const QString& ) ) );
127 } 127 }
128 128
129 mCurrentLook->restoreSettings( config ); 129 mCurrentLook->restoreSettings( config );
130 mCurrentLook->setAddressee( addr ); 130 mCurrentLook->setAddressee( addr );
131} 131}
132void ViewContainer::refreshView()
133{
134 if ( mCurrentLook ) {
135 mCurrentLook->setAddressee( mCurrentAddressee );
136 }
137}
138 132
139void ViewContainer::setAddressee( const KABC::Addressee& addressee ) 133void ViewContainer::setAddressee( const KABC::Addressee& addressee )
140{ 134{
141 if ( mCurrentLook != 0 ) { 135 if ( mCurrentLook != 0 ) {
142 if ( addressee == mCurrentAddressee )
143 return;
144 else {
145 mCurrentAddressee = addressee; 136 mCurrentAddressee = addressee;
146 mCurrentLook->setAddressee( mCurrentAddressee ); 137 mCurrentLook->setAddressee( mCurrentAddressee );
147 } 138
148 } 139 }
149} 140}
150 141
151KABC::Addressee ViewContainer::addressee() 142KABC::Addressee ViewContainer::addressee()
152{ 143{
153 static KABC::Addressee empty; // do not use! 144 static KABC::Addressee empty; // do not use!
154 145
155 if ( !mCurrentLook ) 146 if ( !mCurrentLook )
156 return empty; 147 return empty;
157 else 148 else
158 return mCurrentLook->addressee(); 149 return mCurrentLook->addressee();
159} 150}
diff --git a/kaddressbook/details/detailsviewcontainer.h b/kaddressbook/details/detailsviewcontainer.h
index b561d12..667f0cb 100644
--- a/kaddressbook/details/detailsviewcontainer.h
+++ b/kaddressbook/details/detailsviewcontainer.h
@@ -36,25 +36,24 @@ class ViewContainer : public QWidget
36 Q_OBJECT 36 Q_OBJECT
37 37
38 public: 38 public:
39 ViewContainer( QWidget *parent = 0, const char* name = 0 ); 39 ViewContainer( QWidget *parent = 0, const char* name = 0 );
40 40
41 /** 41 /**
42 Return the look currently selected. If there is none, it 42 Return the look currently selected. If there is none, it
43 returns zero. Do not use this pointer to store a reference 43 returns zero. Do not use this pointer to store a reference
44 to a look, the user might select another one (e.g., create 44 to a look, the user might select another one (e.g., create
45 a new object) at any time. 45 a new object) at any time.
46 */ 46 */
47 KABBasicLook *currentLook(); 47 KABBasicLook *currentLook();
48 void refreshView();
49 /** 48 /**
50 Return the contact currently displayed. 49 Return the contact currently displayed.
51 */ 50 */
52 KABC::Addressee addressee(); 51 KABC::Addressee addressee();
53 52
54 public slots: 53 public slots:
55 /** 54 /**
56 Set the contact currently displayed. 55 Set the contact currently displayed.
57 */ 56 */
58 void setAddressee( const KABC::Addressee& addressee ); 57 void setAddressee( const KABC::Addressee& addressee );
59 58
60 /** 59 /**
diff --git a/kaddressbook/imagewidget.cpp b/kaddressbook/imagewidget.cpp
index 49d456b..48370e3 100644
--- a/kaddressbook/imagewidget.cpp
+++ b/kaddressbook/imagewidget.cpp
@@ -122,28 +122,24 @@ ImageWidget::ImageWidget( QWidget *parent, const char *name )
122 SLOT( loadLogo() ) ); 122 SLOT( loadLogo() ) );
123 connect( mLogoUrl, SIGNAL( urlSelected( const QString& ) ), 123 connect( mLogoUrl, SIGNAL( urlSelected( const QString& ) ),
124 SIGNAL( changed() ) ); 124 SIGNAL( changed() ) );
125 connect( mLogoUrl, SIGNAL( urlSelected( const QString& ) ), 125 connect( mLogoUrl, SIGNAL( urlSelected( const QString& ) ),
126 SLOT( updateGUI() ) ); 126 SLOT( updateGUI() ) );
127 connect( mUseLogoUrl, SIGNAL( toggled( bool ) ), 127 connect( mUseLogoUrl, SIGNAL( toggled( bool ) ),
128 SIGNAL( changed() ) ); 128 SIGNAL( changed() ) );
129 129
130#ifndef KAB_EMBEDDED 130#ifndef KAB_EMBEDDED
131 KAcceleratorManager::manage( this ); 131 KAcceleratorManager::manage( this );
132#endif //KAB_EMBEDDED 132#endif //KAB_EMBEDDED
133 133
134#ifndef DESKTOP_VERSION
135 mUsePhotoUrl->setChecked( true );
136 mUseLogoUrl->setChecked( true );
137#endif
138} 134}
139 135
140ImageWidget::~ImageWidget() 136ImageWidget::~ImageWidget()
141{ 137{
142} 138}
143 139
144void ImageWidget::setPhoto( const KABC::Picture &photo ) 140void ImageWidget::setPhoto( const KABC::Picture &photo )
145{ 141{
146 bool blocked = signalsBlocked(); 142 bool blocked = signalsBlocked();
147 blockSignals( true ); 143 blockSignals( true );
148 144
149 if ( photo.isIntern() ) { 145 if ( photo.isIntern() ) {
@@ -251,30 +247,29 @@ void ImageWidget::loadPhoto()
251 mPhotoLabel->setPixmap( loadPixmap( mPhotoUrl->url() ) ); 247 mPhotoLabel->setPixmap( loadPixmap( mPhotoUrl->url() ) );
252} 248}
253 249
254void ImageWidget::loadLogo() 250void ImageWidget::loadLogo()
255{ 251{
256 mLogoLabel->setPixmap( loadPixmap( mLogoUrl->url() ) ); 252 mLogoLabel->setPixmap( loadPixmap( mLogoUrl->url() ) );
257} 253}
258 254
259void ImageWidget::updateGUI() 255void ImageWidget::updateGUI()
260{ 256{
261 KURLRequester *ptr = (KURLRequester*)sender(); 257 KURLRequester *ptr = (KURLRequester*)sender();
262 258
263#ifdef DESKTOP_VERSION 259
264 if ( ptr == mPhotoUrl ) 260 if ( ptr == mPhotoUrl )
265 mUsePhotoUrl->setEnabled( true ); 261 mUsePhotoUrl->setEnabled( true );
266 else if ( ptr == mLogoUrl ) 262 else if ( ptr == mLogoUrl )
267 mUseLogoUrl->setEnabled( true ); 263 mUseLogoUrl->setEnabled( true );
268#endif
269} 264}
270 265
271QPixmap ImageWidget::loadPixmap( const KURL &url ) 266QPixmap ImageWidget::loadPixmap( const KURL &url )
272{ 267{
273 QString tempFile; 268 QString tempFile;
274 QPixmap pixmap; 269 QPixmap pixmap;
275 270
276 if ( url.isEmpty() ) 271 if ( url.isEmpty() )
277 return pixmap; 272 return pixmap;
278 273
279 if ( url.isLocalFile() ) 274 if ( url.isLocalFile() )
280 pixmap = QPixmap( url.path() ); 275 pixmap = QPixmap( url.path() );
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index f6bdda4..e14e579 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -1117,39 +1117,36 @@ void KABCore::incrementalSearch( const QString& text )
1117} 1117}
1118 1118
1119void KABCore::setModified() 1119void KABCore::setModified()
1120{ 1120{
1121 setModified( true ); 1121 setModified( true );
1122} 1122}
1123 1123
1124void KABCore::setModifiedWOrefresh() 1124void KABCore::setModifiedWOrefresh()
1125{ 1125{
1126 // qDebug("KABCore::setModifiedWOrefresh() "); 1126 // qDebug("KABCore::setModifiedWOrefresh() ");
1127 mModified = true; 1127 mModified = true;
1128 mActionSave->setEnabled( mModified ); 1128 mActionSave->setEnabled( mModified );
1129#ifdef DESKTOP_VERSION 1129
1130 mDetails->refreshView();
1131#endif
1132 1130
1133} 1131}
1134void KABCore::setModified( bool modified ) 1132void KABCore::setModified( bool modified )
1135{ 1133{
1136 mModified = modified; 1134 mModified = modified;
1137 mActionSave->setEnabled( mModified ); 1135 mActionSave->setEnabled( mModified );
1138 1136
1139 if ( modified ) 1137 if ( modified )
1140 mJumpButtonBar->recreateButtons(); 1138 mJumpButtonBar->recreateButtons();
1141 1139
1142 mViewManager->refreshView(); 1140 mViewManager->refreshView();
1143 mDetails->refreshView();
1144 1141
1145} 1142}
1146 1143
1147bool KABCore::modified() const 1144bool KABCore::modified() const
1148{ 1145{
1149 return mModified; 1146 return mModified;
1150} 1147}
1151 1148
1152void KABCore::contactModified( const KABC::Addressee &addr ) 1149void KABCore::contactModified( const KABC::Addressee &addr )
1153{ 1150{
1154 1151
1155 Command *command = 0; 1152 Command *command = 0;
@@ -1157,25 +1154,25 @@ void KABCore::contactModified( const KABC::Addressee &addr )
1157 1154
1158 // check if it exists already 1155 // check if it exists already
1159 KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() ); 1156 KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() );
1160 if ( origAddr.isEmpty() ) 1157 if ( origAddr.isEmpty() )
1161 command = new PwNewCommand( mAddressBook, addr ); 1158 command = new PwNewCommand( mAddressBook, addr );
1162 else { 1159 else {
1163 command = new PwEditCommand( mAddressBook, origAddr, addr ); 1160 command = new PwEditCommand( mAddressBook, origAddr, addr );
1164 uid = addr.uid(); 1161 uid = addr.uid();
1165 } 1162 }
1166 1163
1167 UndoStack::instance()->push( command ); 1164 UndoStack::instance()->push( command );
1168 RedoStack::instance()->clear(); 1165 RedoStack::instance()->clear();
1169 1166 mDetails->setAddressee( addr );
1170 setModified( true ); 1167 setModified( true );
1171} 1168}
1172 1169
1173void KABCore::newContact() 1170void KABCore::newContact()
1174{ 1171{
1175 1172
1176 1173
1177 QPtrList<KABC::Resource> kabcResources = mAddressBook->resources(); 1174 QPtrList<KABC::Resource> kabcResources = mAddressBook->resources();
1178 1175
1179 QPtrList<KRES::Resource> kresResources; 1176 QPtrList<KRES::Resource> kresResources;
1180 QPtrListIterator<KABC::Resource> it( kabcResources ); 1177 QPtrListIterator<KABC::Resource> it( kabcResources );
1181 KABC::Resource *resource; 1178 KABC::Resource *resource;
@@ -1624,25 +1621,24 @@ void KABCore::addressBookChanged()
1624 if (mEditorDialog) 1621 if (mEditorDialog)
1625 { 1622 {
1626 if (mEditorDialog->dirty()) 1623 if (mEditorDialog->dirty())
1627 { 1624 {
1628 QString text = i18n( "Data has been changed externally. Unsaved " 1625 QString text = i18n( "Data has been changed externally. Unsaved "
1629 "changes will be lost." ); 1626 "changes will be lost." );
1630 KMessageBox::information( this, text ); 1627 KMessageBox::information( this, text );
1631 } 1628 }
1632 QString currentuid = mEditorDialog->addressee().uid(); 1629 QString currentuid = mEditorDialog->addressee().uid();
1633 mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) ); 1630 mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) );
1634 } 1631 }
1635 mViewManager->refreshView(); 1632 mViewManager->refreshView();
1636// mDetails->refreshView();
1637 1633
1638 1634
1639} 1635}
1640 1636
1641AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, 1637AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent,
1642 const char *name ) 1638 const char *name )
1643{ 1639{
1644 1640
1645 if ( mEditorDialog == 0 ) { 1641 if ( mEditorDialog == 0 ) {
1646 mEditorDialog = new AddresseeEditorDialog( this, parent, 1642 mEditorDialog = new AddresseeEditorDialog( this, parent,
1647 name ? name : "editorDialog" ); 1643 name ? name : "editorDialog" );
1648 1644
@@ -2280,25 +2276,24 @@ void KABCore::manageCategories( )
2280 for( i = 0; i< catIncList.count(); ++i ) { 2276 for( i = 0; i< catIncList.count(); ++i ) {
2281 if ( catList.contains (catIncList[i])) { 2277 if ( catList.contains (catIncList[i])) {
2282 newCatList.append( catIncList[i] ); 2278 newCatList.append( catIncList[i] );
2283 } 2279 }
2284 } 2280 }
2285 newCatList.sort(); 2281 newCatList.sort();
2286 (*it).setCategories( newCatList ); 2282 (*it).setCategories( newCatList );
2287 mAddressBook->insertAddressee( (*it) ); 2283 mAddressBook->insertAddressee( (*it) );
2288 } 2284 }
2289 } 2285 }
2290 setModified( true ); 2286 setModified( true );
2291 mViewManager->refreshView(); 2287 mViewManager->refreshView();
2292 mDetails->refreshView();
2293 message( i18n("Removing categories done!")); 2288 message( i18n("Removing categories done!"));
2294 } 2289 }
2295 delete cp; 2290 delete cp;
2296} 2291}
2297void KABCore::removeVoice() 2292void KABCore::removeVoice()
2298{ 2293{
2299 if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No ) 2294 if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No )
2300 return; 2295 return;
2301 KABC::Addressee::List list; 2296 KABC::Addressee::List list;
2302 XXPortSelectDialog dlg( this, false, this ); 2297 XXPortSelectDialog dlg( this, false, this );
2303 if ( dlg.exec() ) 2298 if ( dlg.exec() )
2304 list = dlg.contacts(); 2299 list = dlg.contacts();
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index c7c12ff..85ffbdb 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -86,28 +86,25 @@ class KABCore : public QWidget, public KSyncInterface
86#ifdef KAB_EMBEDDED 86#ifdef KAB_EMBEDDED
87 //US added functionality 87 //US added functionality
88 QPopupMenu* getViewMenu() {return viewMenu;} 88 QPopupMenu* getViewMenu() {return viewMenu;}
89 QPopupMenu* getFilterMenu() {return filterMenu;} 89 QPopupMenu* getFilterMenu() {return filterMenu;}
90 QPopupMenu* getSettingsMenu() {return settingsMenu;} 90 QPopupMenu* getSettingsMenu() {return settingsMenu;}
91 void addActionsManually(); 91 void addActionsManually();
92#endif //KAB_EMBEDDED 92#endif //KAB_EMBEDDED
93 /** 93 /**
94 Restores the global settings. 94 Restores the global settings.
95 */ 95 */
96 void restoreSettings(); 96 void restoreSettings();
97 97
98 /** 98
99 Saves the global settings.
100 */
101 void saveSettings();
102 99
103 /** 100 /**
104 Returns a pointer to the StdAddressBook of the application. 101 Returns a pointer to the StdAddressBook of the application.
105 */ 102 */
106 KABC::AddressBook *addressBook() const; 103 KABC::AddressBook *addressBook() const;
107 104
108 /** 105 /**
109 Returns a pointer to the KConfig object of the application. 106 Returns a pointer to the KConfig object of the application.
110 */ 107 */
111 static KConfig *config(); 108 static KConfig *config();
112 109
113 /** 110 /**
@@ -349,25 +346,27 @@ class KABCore : public QWidget, public KSyncInterface
349 void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid); 346 void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid);
350 347
351 348
352 signals: 349 signals:
353 void contactSelected( const QString &name ); 350 void contactSelected( const QString &name );
354 void contactSelected( const QPixmap &pixmap ); 351 void contactSelected( const QPixmap &pixmap );
355 public slots: 352 public slots:
356 void recieve(QString cmsg ); 353 void recieve(QString cmsg );
357 void getFile( bool success ); 354 void getFile( bool success );
358 void syncFileRequest(); 355 void syncFileRequest();
359 void setDetailsVisible( bool visible ); 356 void setDetailsVisible( bool visible );
360 void setDetailsToState(); 357 void setDetailsToState();
361 // void slotSyncMenu( int ); 358
359 void saveSettings();
360
362 private slots: 361 private slots:
363 void updateToolBar(); 362 void updateToolBar();
364 void updateMainWindow(); 363 void updateMainWindow();
365 void receive( const QCString& cmsg, const QByteArray& data ); 364 void receive( const QCString& cmsg, const QByteArray& data );
366 void toggleBeamReceive( ); 365 void toggleBeamReceive( );
367 void disableBR(bool); 366 void disableBR(bool);
368 void setJumpButtonBarVisible( bool visible ); 367 void setJumpButtonBarVisible( bool visible );
369 void setCaptionBack(); 368 void setCaptionBack();
370 void importFromOL(); 369 void importFromOL();
371 void extensionModified( const KABC::Addressee::List &list ); 370 void extensionModified( const KABC::Addressee::List &list );
372 void extensionChanged( int id ); 371 void extensionChanged( int id );
373 void clipboardDataChanged(); 372 void clipboardDataChanged();
diff --git a/kaddressbook/viewmanager.cpp b/kaddressbook/viewmanager.cpp
index 33bef5a..59bddd9 100644
--- a/kaddressbook/viewmanager.cpp
+++ b/kaddressbook/viewmanager.cpp
@@ -596,24 +596,25 @@ void ViewManager::configureFilters()
596 596
597 if ( dlg.exec() ) 597 if ( dlg.exec() )
598 mFilterList = dlg.filters(); 598 mFilterList = dlg.filters();
599 599
600 uint pos = mActionSelectFilter->currentItem(); 600 uint pos = mActionSelectFilter->currentItem();
601 mActionSelectFilter->setItems( filterNames() ); 601 mActionSelectFilter->setItems( filterNames() );
602 mActionSelectFilter->setCurrentItem( pos ); 602 mActionSelectFilter->setCurrentItem( pos );
603 setActiveFilter( pos ); 603 setActiveFilter( pos );
604 int cw = 150; 604 int cw = 150;
605 if (QApplication::desktop()->width() == 480 ) 605 if (QApplication::desktop()->width() == 480 )
606 cw = 0; 606 cw = 0;
607 mActionSelectFilter->setComboWidth( cw ); 607 mActionSelectFilter->setComboWidth( cw );
608 saveSettings();
608} 609}
609 610
610QStringList ViewManager::filterNames() const 611QStringList ViewManager::filterNames() const
611{ 612{
612 QStringList names( i18n( "No Filter" ) ); 613 QStringList names( i18n( "No Filter" ) );
613 614
614 Filter::List::ConstIterator it; 615 Filter::List::ConstIterator it;
615 for ( it = mFilterList.begin(); it != mFilterList.end(); ++it ) 616 for ( it = mFilterList.begin(); it != mFilterList.end(); ++it )
616 names.append( (*it).name() ); 617 names.append( (*it).name() );
617 618
618 return names; 619 return names;
619} 620}