author | zautrix <zautrix> | 2005-01-14 11:37:40 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-01-14 11:37:40 (UTC) |
commit | 61c95ce0295f1397db6499c5b468a9fb3d32a0f4 (patch) (unidiff) | |
tree | 2bceecc46d42a572adfad7d8e5000d1534642cbd /kaddressbook | |
parent | a46ecf5ed81460ec9a4e457798e1bf0fb74c5624 (diff) | |
download | kdepimpi-61c95ce0295f1397db6499c5b468a9fb3d32a0f4.zip kdepimpi-61c95ce0295f1397db6499c5b468a9fb3d32a0f4.tar.gz kdepimpi-61c95ce0295f1397db6499c5b468a9fb3d32a0f4.tar.bz2 |
made kapi saving faster
-rw-r--r-- | kaddressbook/details/detailsviewcontainer.cpp | 11 | ||||
-rw-r--r-- | kaddressbook/details/detailsviewcontainer.h | 1 | ||||
-rw-r--r-- | kaddressbook/imagewidget.cpp | 7 | ||||
-rw-r--r-- | kaddressbook/kabcore.cpp | 9 | ||||
-rw-r--r-- | kaddressbook/kabcore.h | 9 | ||||
-rw-r--r-- | kaddressbook/viewmanager.cpp | 1 |
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 | |||
@@ -108,62 +108,53 @@ void ViewContainer::slotStyleSelected( int index ) | |||
108 | 108 | ||
109 | if ( index >= 0 && index < mStyleCombo->count() ) { | 109 | if ( index >= 0 && index < mStyleCombo->count() ) { |
110 | if ( mCurrentLook != 0 ) { | 110 | if ( mCurrentLook != 0 ) { |
111 | mCurrentLook->saveSettings( config ); | 111 | mCurrentLook->saveSettings( config ); |
112 | addr = mCurrentLook->addressee(); | 112 | addr = mCurrentLook->addressee(); |
113 | 113 | ||
114 | delete mCurrentLook; | 114 | delete mCurrentLook; |
115 | mCurrentLook = 0; | 115 | mCurrentLook = 0; |
116 | } | 116 | } |
117 | 117 | ||
118 | KABLookFactory *factory = mLookFactories.at( index ); | 118 | KABLookFactory *factory = mLookFactories.at( index ); |
119 | 119 | ||
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 | } |
132 | void ViewContainer::refreshView() | ||
133 | { | ||
134 | if ( mCurrentLook ) { | ||
135 | mCurrentLook->setAddressee( mCurrentAddressee ); | ||
136 | } | ||
137 | } | ||
138 | 132 | ||
139 | void ViewContainer::setAddressee( const KABC::Addressee& addressee ) | 133 | void 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 | ||
151 | KABC::Addressee ViewContainer::addressee() | 142 | KABC::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 | } |
160 | 151 | ||
161 | void ViewContainer::setReadOnly( bool state ) | 152 | void ViewContainer::setReadOnly( bool state ) |
162 | { | 153 | { |
163 | if ( mCurrentLook ) | 154 | if ( mCurrentLook ) |
164 | mCurrentLook->setReadOnly( state ); | 155 | mCurrentLook->setReadOnly( state ); |
165 | } | 156 | } |
166 | 157 | ||
167 | #ifndef KAB_EMBEDDED | 158 | #ifndef KAB_EMBEDDED |
168 | #include "detailsviewcontainer.moc" | 159 | #include "detailsviewcontainer.moc" |
169 | #endif //KAB_EMBEDDED | 160 | #endif //KAB_EMBEDDED |
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 | |||
@@ -24,49 +24,48 @@ | |||
24 | #ifndef DETAILSVIEWCONTAINER_H | 24 | #ifndef DETAILSVIEWCONTAINER_H |
25 | #define DETAILSVIEWCONTAINER_H | 25 | #define DETAILSVIEWCONTAINER_H |
26 | 26 | ||
27 | #include <qptrlist.h> | 27 | #include <qptrlist.h> |
28 | 28 | ||
29 | #include "look_basic.h" | 29 | #include "look_basic.h" |
30 | 30 | ||
31 | class QComboBox; | 31 | class QComboBox; |
32 | class QWidgetStack; | 32 | class QWidgetStack; |
33 | 33 | ||
34 | class ViewContainer : public QWidget | 34 | class ViewContainer : public QWidget |
35 | { | 35 | { |
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 | /** |
61 | Set read-write state. | 60 | Set read-write state. |
62 | */ | 61 | */ |
63 | void setReadOnly( bool state ); | 62 | void setReadOnly( bool state ); |
64 | 63 | ||
65 | signals: | 64 | signals: |
66 | /** | 65 | /** |
67 | The contact has been changed. | 66 | The contact has been changed. |
68 | */ | 67 | */ |
69 | void addresseeChanged(); | 68 | void addresseeChanged(); |
70 | 69 | ||
71 | /** | 70 | /** |
72 | The user acticated the email address displayed. This may happen | 71 | The user acticated the email address displayed. This may happen |
diff --git a/kaddressbook/imagewidget.cpp b/kaddressbook/imagewidget.cpp index 49d456b..48370e3 100644 --- a/kaddressbook/imagewidget.cpp +++ b/kaddressbook/imagewidget.cpp | |||
@@ -110,52 +110,48 @@ ImageWidget::ImageWidget( QWidget *parent, const char *name ) | |||
110 | connect( mPhotoUrl, SIGNAL( urlSelected( const QString& ) ), | 110 | connect( mPhotoUrl, SIGNAL( urlSelected( const QString& ) ), |
111 | SLOT( loadPhoto() ) ); | 111 | SLOT( loadPhoto() ) ); |
112 | connect( mPhotoUrl, SIGNAL( urlSelected( const QString& ) ), | 112 | connect( mPhotoUrl, SIGNAL( urlSelected( const QString& ) ), |
113 | SIGNAL( changed() ) ); | 113 | SIGNAL( changed() ) ); |
114 | connect( mPhotoUrl, SIGNAL( urlSelected( const QString& ) ), | 114 | connect( mPhotoUrl, SIGNAL( urlSelected( const QString& ) ), |
115 | SLOT( updateGUI() ) ); | 115 | SLOT( updateGUI() ) ); |
116 | connect( mUsePhotoUrl, SIGNAL( toggled( bool ) ), | 116 | connect( mUsePhotoUrl, SIGNAL( toggled( bool ) ), |
117 | SIGNAL( changed() ) ); | 117 | SIGNAL( changed() ) ); |
118 | 118 | ||
119 | connect( mLogoUrl, SIGNAL( textChanged( const QString& ) ), | 119 | connect( mLogoUrl, SIGNAL( textChanged( const QString& ) ), |
120 | SIGNAL( changed() ) ); | 120 | SIGNAL( changed() ) ); |
121 | connect( mLogoUrl, SIGNAL( urlSelected( const QString& ) ), | 121 | connect( mLogoUrl, SIGNAL( urlSelected( const QString& ) ), |
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 | ||
140 | ImageWidget::~ImageWidget() | 136 | ImageWidget::~ImageWidget() |
141 | { | 137 | { |
142 | } | 138 | } |
143 | 139 | ||
144 | void ImageWidget::setPhoto( const KABC::Picture &photo ) | 140 | void 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() ) { |
150 | //US | 146 | //US |
151 | //US mPhotoLabel->setPixmap( photo.data() ); | 147 | //US mPhotoLabel->setPixmap( photo.data() ); |
152 | if (photo.data().isNull() != true) | 148 | if (photo.data().isNull() != true) |
153 | { | 149 | { |
154 | QPixmap pm; | 150 | QPixmap pm; |
155 | pm.convertFromImage(photo.data()); | 151 | pm.convertFromImage(photo.data()); |
156 | 152 | ||
157 | mPhotoLabel->setPixmap( pm ); | 153 | mPhotoLabel->setPixmap( pm ); |
158 | } | 154 | } |
159 | 155 | ||
160 | mUsePhotoUrl->setChecked( false ); | 156 | mUsePhotoUrl->setChecked( false ); |
161 | } else { | 157 | } else { |
@@ -239,54 +235,53 @@ KABC::Picture ImageWidget::logo() const | |||
239 | #endif //KAB_EMBEDDED | 235 | #endif //KAB_EMBEDDED |
240 | 236 | ||
241 | logo.setType( "PNG" ); | 237 | logo.setType( "PNG" ); |
242 | 238 | ||
243 | } | 239 | } |
244 | } | 240 | } |
245 | 241 | ||
246 | return logo; | 242 | return logo; |
247 | } | 243 | } |
248 | 244 | ||
249 | void ImageWidget::loadPhoto() | 245 | void ImageWidget::loadPhoto() |
250 | { | 246 | { |
251 | mPhotoLabel->setPixmap( loadPixmap( mPhotoUrl->url() ) ); | 247 | mPhotoLabel->setPixmap( loadPixmap( mPhotoUrl->url() ) ); |
252 | } | 248 | } |
253 | 249 | ||
254 | void ImageWidget::loadLogo() | 250 | void ImageWidget::loadLogo() |
255 | { | 251 | { |
256 | mLogoLabel->setPixmap( loadPixmap( mLogoUrl->url() ) ); | 252 | mLogoLabel->setPixmap( loadPixmap( mLogoUrl->url() ) ); |
257 | } | 253 | } |
258 | 254 | ||
259 | void ImageWidget::updateGUI() | 255 | void 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 | ||
271 | QPixmap ImageWidget::loadPixmap( const KURL &url ) | 266 | QPixmap 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() ); |
281 | else | 276 | else |
282 | { | 277 | { |
283 | #ifndef KAB_EMBEDDED | 278 | #ifndef KAB_EMBEDDED |
284 | if ( KIO::NetAccess::download( url, tempFile ) ) { | 279 | if ( KIO::NetAccess::download( url, tempFile ) ) { |
285 | pixmap = QPixmap( tempFile ); | 280 | pixmap = QPixmap( tempFile ); |
286 | KIO::NetAccess::removeTempFile( tempFile ); | 281 | KIO::NetAccess::removeTempFile( tempFile ); |
287 | } | 282 | } |
288 | #else //KAB_EMBEDDED | 283 | #else //KAB_EMBEDDED |
289 | qDebug("ImageWidget::loadPixmap : only local pixmaps are allowed"); | 284 | qDebug("ImageWidget::loadPixmap : only local pixmaps are allowed"); |
290 | #endif //KAB_EMBEDDED | 285 | #endif //KAB_EMBEDDED |
291 | 286 | ||
292 | } | 287 | } |
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index f6bdda4..e14e579 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -1105,89 +1105,86 @@ void KABCore::setCategories() | |||
1105 | setModified( true ); | 1105 | setModified( true ); |
1106 | message( i18n("Setting categories completed!") ); | 1106 | message( i18n("Setting categories completed!") ); |
1107 | } | 1107 | } |
1108 | 1108 | ||
1109 | void KABCore::setSearchFields( const KABC::Field::List &fields ) | 1109 | void KABCore::setSearchFields( const KABC::Field::List &fields ) |
1110 | { | 1110 | { |
1111 | mIncSearchWidget->setFields( fields ); | 1111 | mIncSearchWidget->setFields( fields ); |
1112 | } | 1112 | } |
1113 | 1113 | ||
1114 | void KABCore::incrementalSearch( const QString& text ) | 1114 | void KABCore::incrementalSearch( const QString& text ) |
1115 | { | 1115 | { |
1116 | mViewManager->doSearch( text, mIncSearchWidget->currentField() ); | 1116 | mViewManager->doSearch( text, mIncSearchWidget->currentField() ); |
1117 | } | 1117 | } |
1118 | 1118 | ||
1119 | void KABCore::setModified() | 1119 | void KABCore::setModified() |
1120 | { | 1120 | { |
1121 | setModified( true ); | 1121 | setModified( true ); |
1122 | } | 1122 | } |
1123 | 1123 | ||
1124 | void KABCore::setModifiedWOrefresh() | 1124 | void 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 | } |
1134 | void KABCore::setModified( bool modified ) | 1132 | void 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 | ||
1147 | bool KABCore::modified() const | 1144 | bool KABCore::modified() const |
1148 | { | 1145 | { |
1149 | return mModified; | 1146 | return mModified; |
1150 | } | 1147 | } |
1151 | 1148 | ||
1152 | void KABCore::contactModified( const KABC::Addressee &addr ) | 1149 | void KABCore::contactModified( const KABC::Addressee &addr ) |
1153 | { | 1150 | { |
1154 | 1151 | ||
1155 | Command *command = 0; | 1152 | Command *command = 0; |
1156 | QString uid; | 1153 | QString uid; |
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 | ||
1173 | void KABCore::newContact() | 1170 | void 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; |
1182 | while ( ( resource = it.current() ) != 0 ) { | 1179 | while ( ( resource = it.current() ) != 0 ) { |
1183 | ++it; | 1180 | ++it; |
1184 | if ( !resource->readOnly() ) { | 1181 | if ( !resource->readOnly() ) { |
1185 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); | 1182 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); |
1186 | if ( res ) | 1183 | if ( res ) |
1187 | kresResources.append( res ); | 1184 | kresResources.append( res ); |
1188 | } | 1185 | } |
1189 | } | 1186 | } |
1190 | 1187 | ||
1191 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); | 1188 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); |
1192 | resource = static_cast<KABC::Resource*>( res ); | 1189 | resource = static_cast<KABC::Resource*>( res ); |
1193 | 1190 | ||
@@ -1612,49 +1609,48 @@ void KABCore::addressBookChanged() | |||
1612 | /*US | 1609 | /*US |
1613 | QDictIterator<AddresseeEditorDialog> it( mEditorDict ); | 1610 | QDictIterator<AddresseeEditorDialog> it( mEditorDict ); |
1614 | while ( it.current() ) { | 1611 | while ( it.current() ) { |
1615 | if ( it.current()->dirty() ) { | 1612 | if ( it.current()->dirty() ) { |
1616 | QString text = i18n( "Data has been changed externally. Unsaved " | 1613 | QString text = i18n( "Data has been changed externally. Unsaved " |
1617 | "changes will be lost." ); | 1614 | "changes will be lost." ); |
1618 | KMessageBox::information( this, text ); | 1615 | KMessageBox::information( this, text ); |
1619 | } | 1616 | } |
1620 | it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) ); | 1617 | it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) ); |
1621 | ++it; | 1618 | ++it; |
1622 | } | 1619 | } |
1623 | */ | 1620 | */ |
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 | ||
1641 | AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, | 1637 | AddresseeEditorDialog *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 | ||
1649 | 1645 | ||
1650 | connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ), | 1646 | connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ), |
1651 | SLOT( contactModified( const KABC::Addressee& ) ) ); | 1647 | SLOT( contactModified( const KABC::Addressee& ) ) ); |
1652 | //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ), | 1648 | //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ), |
1653 | // SLOT( slotEditorDestroyed( const QString& ) ) ; | 1649 | // SLOT( slotEditorDestroyed( const QString& ) ) ; |
1654 | } | 1650 | } |
1655 | 1651 | ||
1656 | return mEditorDialog; | 1652 | return mEditorDialog; |
1657 | } | 1653 | } |
1658 | 1654 | ||
1659 | void KABCore::slotEditorDestroyed( const QString &uid ) | 1655 | void KABCore::slotEditorDestroyed( const QString &uid ) |
1660 | { | 1656 | { |
@@ -2268,49 +2264,48 @@ void KABCore::manageCategories( ) | |||
2268 | KABPrefs::instance()->writeConfig(); | 2264 | KABPrefs::instance()->writeConfig(); |
2269 | message(QString::number( count )+ i18n(" categories added to list! ")); | 2265 | message(QString::number( count )+ i18n(" categories added to list! ")); |
2270 | } else { | 2266 | } else { |
2271 | QStringList catList = KABPrefs::instance()->mCustomCategories; | 2267 | QStringList catList = KABPrefs::instance()->mCustomCategories; |
2272 | QStringList catIncList; | 2268 | QStringList catIncList; |
2273 | QStringList newCatList; | 2269 | QStringList newCatList; |
2274 | KABC::AddressBook::Iterator it; | 2270 | KABC::AddressBook::Iterator it; |
2275 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 2271 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
2276 | QStringList catIncList = (*it).categories(); | 2272 | QStringList catIncList = (*it).categories(); |
2277 | int i; | 2273 | int i; |
2278 | if ( catIncList.count() ) { | 2274 | if ( catIncList.count() ) { |
2279 | newCatList.clear(); | 2275 | newCatList.clear(); |
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 | } |
2297 | void KABCore::removeVoice() | 2292 | void 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(); |
2305 | else | 2300 | else |
2306 | return; | 2301 | return; |
2307 | KABC::Addressee::List::Iterator it; | 2302 | KABC::Addressee::List::Iterator it; |
2308 | for ( it = list.begin(); it != list.end(); ++it ) { | 2303 | for ( it = list.begin(); it != list.end(); ++it ) { |
2309 | if ( (*it).removeVoice() ) | 2304 | if ( (*it).removeVoice() ) |
2310 | contactModified((*it) ); | 2305 | contactModified((*it) ); |
2311 | } | 2306 | } |
2312 | } | 2307 | } |
2313 | 2308 | ||
2314 | 2309 | ||
2315 | 2310 | ||
2316 | void KABCore::clipboardDataChanged() | 2311 | void KABCore::clipboardDataChanged() |
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h index c7c12ff..85ffbdb 100644 --- a/kaddressbook/kabcore.h +++ b/kaddressbook/kabcore.h | |||
@@ -74,52 +74,49 @@ class Ir; | |||
74 | 74 | ||
75 | class KABCore : public QWidget, public KSyncInterface | 75 | class KABCore : public QWidget, public KSyncInterface |
76 | { | 76 | { |
77 | Q_OBJECT | 77 | Q_OBJECT |
78 | 78 | ||
79 | public: | 79 | public: |
80 | KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name = 0 ); | 80 | KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name = 0 ); |
81 | 81 | ||
82 | 82 | ||
83 | ~KABCore(); | 83 | ~KABCore(); |
84 | 84 | ||
85 | 85 | ||
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 | /** |
114 | Returns a pointer to the global KActionCollection object. So | 111 | Returns a pointer to the global KActionCollection object. So |
115 | other classes can register their actions easily. | 112 | other classes can register their actions easily. |
116 | */ | 113 | */ |
117 | KActionCollection *actionCollection() const; | 114 | KActionCollection *actionCollection() const; |
118 | 115 | ||
119 | /** | 116 | /** |
120 | Returns the current search field of the Incremental Search Widget. | 117 | Returns the current search field of the Incremental Search Widget. |
121 | */ | 118 | */ |
122 | KABC::Field *currentSearchField() const; | 119 | KABC::Field *currentSearchField() const; |
123 | 120 | ||
124 | /** | 121 | /** |
125 | Returns the uid list of the currently selected contacts. | 122 | Returns the uid list of the currently selected contacts. |
@@ -337,49 +334,51 @@ class KABCore : public QWidget, public KSyncInterface | |||
337 | Creates a KAddressBookPrinter, which will display the print | 334 | Creates a KAddressBookPrinter, which will display the print |
338 | dialog and do the printing. | 335 | dialog and do the printing. |
339 | */ | 336 | */ |
340 | void print(); | 337 | void print(); |
341 | 338 | ||
342 | /** | 339 | /** |
343 | Registers a new GUI client, so plugins can register its actions. | 340 | Registers a new GUI client, so plugins can register its actions. |
344 | */ | 341 | */ |
345 | void addGUIClient( KXMLGUIClient *client ); | 342 | void addGUIClient( KXMLGUIClient *client ); |
346 | 343 | ||
347 | void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid); | 344 | void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid); |
348 | void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); | 345 | void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); |
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(); |
374 | void updateActionMenu(); | 373 | void updateActionMenu(); |
375 | void configureKeyBindings(); | 374 | void configureKeyBindings(); |
376 | void removeVoice(); | 375 | void removeVoice(); |
377 | #ifdef KAB_EMBEDDED | 376 | #ifdef KAB_EMBEDDED |
378 | void configureResources(); | 377 | void configureResources(); |
379 | #endif //KAB_EMBEDDED | 378 | #endif //KAB_EMBEDDED |
380 | 379 | ||
381 | void slotEditorDestroyed( const QString &uid ); | 380 | void slotEditorDestroyed( const QString &uid ); |
382 | void configurationChanged(); | 381 | void configurationChanged(); |
383 | void addressBookChanged(); | 382 | void addressBookChanged(); |
384 | 383 | ||
385 | private: | 384 | private: |
diff --git a/kaddressbook/viewmanager.cpp b/kaddressbook/viewmanager.cpp index 33bef5a..59bddd9 100644 --- a/kaddressbook/viewmanager.cpp +++ b/kaddressbook/viewmanager.cpp | |||
@@ -584,48 +584,49 @@ void ViewManager::setActiveFilter( int index ) | |||
584 | if ( mActiveView ) { | 584 | if ( mActiveView ) { |
585 | mActiveView->setFilter( currentFilter ); | 585 | mActiveView->setFilter( currentFilter ); |
586 | mActiveView->refresh(); | 586 | mActiveView->refresh(); |
587 | emit selected( QString::null ); | 587 | emit selected( QString::null ); |
588 | } | 588 | } |
589 | } | 589 | } |
590 | 590 | ||
591 | void ViewManager::configureFilters() | 591 | void ViewManager::configureFilters() |
592 | { | 592 | { |
593 | FilterDialog dlg( this ); | 593 | FilterDialog dlg( this ); |
594 | 594 | ||
595 | dlg.setFilters( mFilterList ); | 595 | dlg.setFilters( mFilterList ); |
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 | ||
610 | QStringList ViewManager::filterNames() const | 611 | QStringList 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 | } |
620 | 621 | ||
621 | int ViewManager::filterPosition( const QString &name ) const | 622 | int ViewManager::filterPosition( const QString &name ) const |
622 | { | 623 | { |
623 | int pos = 0; | 624 | int pos = 0; |
624 | 625 | ||
625 | Filter::List::ConstIterator it; | 626 | Filter::List::ConstIterator it; |
626 | for ( it = mFilterList.begin(); it != mFilterList.end(); ++it, ++pos ) | 627 | for ( it = mFilterList.begin(); it != mFilterList.end(); ++it, ++pos ) |
627 | if ( name == (*it).name() ) | 628 | if ( name == (*it).name() ) |
628 | return pos + 1; | 629 | return pos + 1; |
629 | 630 | ||
630 | return 0; | 631 | return 0; |
631 | } | 632 | } |