author | ulf69 <ulf69> | 2004-07-14 15:19:43 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-07-14 15:19:43 (UTC) |
commit | 7868ec2225272318048026a602b842b38a05347f (patch) (unidiff) | |
tree | 5f74a46d29caf601ca52dba4df86cefb21c98e04 /kaddressbook | |
parent | 39df2ac65017a41891cd8f856d100378129faa4b (diff) | |
download | kdepimpi-7868ec2225272318048026a602b842b38a05347f.zip kdepimpi-7868ec2225272318048026a602b842b38a05347f.tar.gz kdepimpi-7868ec2225272318048026a602b842b38a05347f.tar.bz2 |
implemented automatic update in case of external resource changes (kdirwatch)
-rw-r--r-- | kaddressbook/kabcore.cpp | 21 | ||||
-rw-r--r-- | kaddressbook/kabcore.h | 2 |
2 files changed, 15 insertions, 8 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 8daca33..2b07541 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -1071,103 +1071,112 @@ void KABCore::print() | |||
1071 | #ifndef KAB_EMBEDDED | 1071 | #ifndef KAB_EMBEDDED |
1072 | KPrinter printer; | 1072 | KPrinter printer; |
1073 | if ( !printer.setup( this ) ) | 1073 | if ( !printer.setup( this ) ) |
1074 | return; | 1074 | return; |
1075 | 1075 | ||
1076 | KABPrinting::PrintingWizard wizard( &printer, mAddressBook, | 1076 | KABPrinting::PrintingWizard wizard( &printer, mAddressBook, |
1077 | mViewManager->selectedUids(), this ); | 1077 | mViewManager->selectedUids(), this ); |
1078 | 1078 | ||
1079 | wizard.exec(); | 1079 | wizard.exec(); |
1080 | #else //KAB_EMBEDDED | 1080 | #else //KAB_EMBEDDED |
1081 | qDebug("KABCore::print() finsih method"); | 1081 | qDebug("KABCore::print() finsih method"); |
1082 | #endif //KAB_EMBEDDED | 1082 | #endif //KAB_EMBEDDED |
1083 | 1083 | ||
1084 | } | 1084 | } |
1085 | 1085 | ||
1086 | 1086 | ||
1087 | void KABCore::addGUIClient( KXMLGUIClient *client ) | 1087 | void KABCore::addGUIClient( KXMLGUIClient *client ) |
1088 | { | 1088 | { |
1089 | if ( mGUIClient ) | 1089 | if ( mGUIClient ) |
1090 | mGUIClient->insertChildClient( client ); | 1090 | mGUIClient->insertChildClient( client ); |
1091 | else | 1091 | else |
1092 | KMessageBox::error( this, "no KXMLGUICLient"); | 1092 | KMessageBox::error( this, "no KXMLGUICLient"); |
1093 | } | 1093 | } |
1094 | 1094 | ||
1095 | 1095 | ||
1096 | void KABCore::configurationChanged() | 1096 | void KABCore::configurationChanged() |
1097 | { | 1097 | { |
1098 | mExtensionManager->reconfigure(); | 1098 | mExtensionManager->reconfigure(); |
1099 | } | 1099 | } |
1100 | 1100 | ||
1101 | void KABCore::addressBookChanged() | 1101 | void KABCore::addressBookChanged() |
1102 | { | 1102 | { |
1103 | #ifndef KAB_EMBEDDED | 1103 | /*US |
1104 | QDictIterator<AddresseeEditorDialog> it( mEditorDict ); | 1104 | QDictIterator<AddresseeEditorDialog> it( mEditorDict ); |
1105 | while ( it.current() ) { | 1105 | while ( it.current() ) { |
1106 | if ( it.current()->dirty() ) { | 1106 | if ( it.current()->dirty() ) { |
1107 | QString text = i18n( "Data has been changed externally. Unsaved " | 1107 | QString text = i18n( "Data has been changed externally. Unsaved " |
1108 | "changes will be lost." ); | 1108 | "changes will be lost." ); |
1109 | KMessageBox::information( this, text ); | 1109 | KMessageBox::information( this, text ); |
1110 | } | 1110 | } |
1111 | it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) ); | 1111 | it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) ); |
1112 | ++it; | 1112 | ++it; |
1113 | } | 1113 | } |
1114 | 1114 | */ | |
1115 | if (mEditorDialog) | ||
1116 | { | ||
1117 | if (mEditorDialog->dirty()) | ||
1118 | { | ||
1119 | QString text = i18n( "Data has been changed externally. Unsaved " | ||
1120 | "changes will be lost." ); | ||
1121 | KMessageBox::information( this, text ); | ||
1122 | } | ||
1123 | QString currentuid = mEditorDialog->addressee().uid(); | ||
1124 | mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) ); | ||
1125 | } | ||
1115 | mViewManager->refreshView(); | 1126 | mViewManager->refreshView(); |
1116 | #else //KAB_EMBEDDED | 1127 | |
1117 | qDebug("KABCore::addressBookChanged() finsih method"); | 1128 | |
1118 | #endif //KAB_EMBEDDED | ||
1119 | } | 1129 | } |
1120 | 1130 | ||
1121 | AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, | 1131 | AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, |
1122 | const char *name ) | 1132 | const char *name ) |
1123 | { | 1133 | { |
1124 | 1134 | ||
1125 | if ( mEditorDialog == 0 ) { | 1135 | if ( mEditorDialog == 0 ) { |
1126 | mEditorDialog = new AddresseeEditorDialog( this, parent, | 1136 | mEditorDialog = new AddresseeEditorDialog( this, parent, |
1127 | name ? name : "editorDialog" ); | 1137 | name ? name : "editorDialog" ); |
1128 | 1138 | ||
1129 | 1139 | ||
1130 | connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ), | 1140 | connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ), |
1131 | SLOT( contactModified( const KABC::Addressee& ) ) ); | 1141 | SLOT( contactModified( const KABC::Addressee& ) ) ); |
1132 | //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ), | 1142 | //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ), |
1133 | // SLOT( slotEditorDestroyed( const QString& ) ) ); | 1143 | // SLOT( slotEditorDestroyed( const QString& ) ) ); |
1134 | } | 1144 | } |
1135 | 1145 | ||
1136 | return mEditorDialog; | 1146 | return mEditorDialog; |
1137 | } | 1147 | } |
1138 | 1148 | ||
1139 | void KABCore::slotEditorDestroyed( const QString &uid ) | 1149 | void KABCore::slotEditorDestroyed( const QString &uid ) |
1140 | { | 1150 | { |
1141 | qDebug("KABCore::slotEditorDestroyed called. maybe a problem! "); | ||
1142 | //mEditorDict.remove( uid ); | 1151 | //mEditorDict.remove( uid ); |
1143 | } | 1152 | } |
1144 | 1153 | ||
1145 | void KABCore::initGUI() | 1154 | void KABCore::initGUI() |
1146 | { | 1155 | { |
1147 | #ifndef KAB_EMBEDDED | 1156 | #ifndef KAB_EMBEDDED |
1148 | QHBoxLayout *topLayout = new QHBoxLayout( this ); | 1157 | QHBoxLayout *topLayout = new QHBoxLayout( this ); |
1149 | topLayout->setSpacing( KDialogBase::spacingHint() ); | 1158 | topLayout->setSpacing( KDialogBase::spacingHint() ); |
1150 | 1159 | ||
1151 | mExtensionBarSplitter = new QSplitter( this ); | 1160 | mExtensionBarSplitter = new QSplitter( this ); |
1152 | mExtensionBarSplitter->setOrientation( Qt::Vertical ); | 1161 | mExtensionBarSplitter->setOrientation( Qt::Vertical ); |
1153 | 1162 | ||
1154 | mDetailsSplitter = new QSplitter( mExtensionBarSplitter ); | 1163 | mDetailsSplitter = new QSplitter( mExtensionBarSplitter ); |
1155 | 1164 | ||
1156 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); | 1165 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); |
1157 | mIncSearchWidget = new IncSearchWidget( viewSpace ); | 1166 | mIncSearchWidget = new IncSearchWidget( viewSpace ); |
1158 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 1167 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
1159 | SLOT( incrementalSearch( const QString& ) ) ); | 1168 | SLOT( incrementalSearch( const QString& ) ) ); |
1160 | 1169 | ||
1161 | mViewManager = new ViewManager( this, viewSpace ); | 1170 | mViewManager = new ViewManager( this, viewSpace ); |
1162 | viewSpace->setStretchFactor( mViewManager, 1 ); | 1171 | viewSpace->setStretchFactor( mViewManager, 1 ); |
1163 | 1172 | ||
1164 | mDetails = new ViewContainer( mDetailsSplitter ); | 1173 | mDetails = new ViewContainer( mDetailsSplitter ); |
1165 | 1174 | ||
1166 | mJumpButtonBar = new JumpButtonBar( this, this ); | 1175 | mJumpButtonBar = new JumpButtonBar( this, this ); |
1167 | 1176 | ||
1168 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); | 1177 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); |
1169 | 1178 | ||
1170 | topLayout->addWidget( mExtensionBarSplitter ); | 1179 | topLayout->addWidget( mExtensionBarSplitter ); |
1171 | topLayout->setStretchFactor( mExtensionBarSplitter, 100 ); | 1180 | topLayout->setStretchFactor( mExtensionBarSplitter, 100 ); |
1172 | topLayout->addWidget( mJumpButtonBar ); | 1181 | topLayout->addWidget( mJumpButtonBar ); |
1173 | topLayout->setStretchFactor( mJumpButtonBar, 1 ); | 1182 | topLayout->setStretchFactor( mJumpButtonBar, 1 ); |
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h index 69a98a5..6446974 100644 --- a/kaddressbook/kabcore.h +++ b/kaddressbook/kabcore.h | |||
@@ -327,66 +327,64 @@ class KABCore : public QWidget | |||
327 | #ifdef KAB_EMBEDDED | 327 | #ifdef KAB_EMBEDDED |
328 | void configureResources(); | 328 | void configureResources(); |
329 | #endif //KAB_EMBEDDED | 329 | #endif //KAB_EMBEDDED |
330 | 330 | ||
331 | void slotEditorDestroyed( const QString &uid ); | 331 | void slotEditorDestroyed( const QString &uid ); |
332 | void configurationChanged(); | 332 | void configurationChanged(); |
333 | void addressBookChanged(); | 333 | void addressBookChanged(); |
334 | 334 | ||
335 | private: | 335 | private: |
336 | void initGUI(); | 336 | void initGUI(); |
337 | void initActions(); | 337 | void initActions(); |
338 | 338 | ||
339 | AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, | 339 | AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, |
340 | const char *name = 0 ); | 340 | const char *name = 0 ); |
341 | 341 | ||
342 | KXMLGUIClient *mGUIClient; | 342 | KXMLGUIClient *mGUIClient; |
343 | 343 | ||
344 | KABC::AddressBook *mAddressBook; | 344 | KABC::AddressBook *mAddressBook; |
345 | 345 | ||
346 | ViewManager *mViewManager; | 346 | ViewManager *mViewManager; |
347 | // QSplitter *mDetailsSplitter; | 347 | // QSplitter *mDetailsSplitter; |
348 | KDGanttMinimizeSplitter *mExtensionBarSplitter; | 348 | KDGanttMinimizeSplitter *mExtensionBarSplitter; |
349 | ViewContainer *mDetails; | 349 | ViewContainer *mDetails; |
350 | KDGanttMinimizeSplitter* mMiniSplitter; | 350 | KDGanttMinimizeSplitter* mMiniSplitter; |
351 | XXPortManager *mXXPortManager; | 351 | XXPortManager *mXXPortManager; |
352 | JumpButtonBar *mJumpButtonBar; | 352 | JumpButtonBar *mJumpButtonBar; |
353 | IncSearchWidget *mIncSearchWidget; | 353 | IncSearchWidget *mIncSearchWidget; |
354 | ExtensionManager *mExtensionManager; | 354 | ExtensionManager *mExtensionManager; |
355 | 355 | ||
356 | KCMultiDialog *mConfigureDialog; | 356 | KCMultiDialog *mConfigureDialog; |
357 | 357 | ||
358 | #ifndef KAB_EMBEDDED | 358 | #ifndef KAB_EMBEDDED |
359 | |||
360 | KCMultiDialog *mConfigureDialog; | ||
361 | LDAPSearchDialog *mLdapSearchDialog; | 359 | LDAPSearchDialog *mLdapSearchDialog; |
362 | #endif //KAB_EMBEDDED | 360 | #endif //KAB_EMBEDDED |
363 | // QDict<AddresseeEditorDialog> mEditorDict; | 361 | // QDict<AddresseeEditorDialog> mEditorDict; |
364 | AddresseeEditorDialog *mEditorDialog; | 362 | AddresseeEditorDialog *mEditorDialog; |
365 | bool mReadWrite; | 363 | bool mReadWrite; |
366 | bool mModified; | 364 | bool mModified; |
367 | bool mIsPart; | 365 | bool mIsPart; |
368 | 366 | ||
369 | //US file menu | 367 | //US file menu |
370 | KAction *mActionMail; | 368 | KAction *mActionMail; |
371 | KAction* mActionPrint; | 369 | KAction* mActionPrint; |
372 | KAction* mActionNewContact; | 370 | KAction* mActionNewContact; |
373 | KAction *mActionSave; | 371 | KAction *mActionSave; |
374 | KAction *mActionEditAddressee; | 372 | KAction *mActionEditAddressee; |
375 | KAction *mActionMailVCard; | 373 | KAction *mActionMailVCard; |
376 | KAction *mActionQuit; | 374 | KAction *mActionQuit; |
377 | 375 | ||
378 | //US edit menu | 376 | //US edit menu |
379 | KAction *mActionCopy; | 377 | KAction *mActionCopy; |
380 | KAction *mActionCut; | 378 | KAction *mActionCut; |
381 | KAction *mActionPaste; | 379 | KAction *mActionPaste; |
382 | KAction *mActionSelectAll; | 380 | KAction *mActionSelectAll; |
383 | KAction *mActionUndo; | 381 | KAction *mActionUndo; |
384 | KAction *mActionRedo; | 382 | KAction *mActionRedo; |
385 | KAction *mActionDelete; | 383 | KAction *mActionDelete; |
386 | 384 | ||
387 | //US settings menu | 385 | //US settings menu |
388 | KAction *mActionConfigResources; | 386 | KAction *mActionConfigResources; |
389 | KAction *mActionConfigKAddressbook; | 387 | KAction *mActionConfigKAddressbook; |
390 | KAction *mActionConfigShortcuts; | 388 | KAction *mActionConfigShortcuts; |
391 | KAction *mActionConfigureToolbars; | 389 | KAction *mActionConfigureToolbars; |
392 | KAction *mActionKeyBindings; | 390 | KAction *mActionKeyBindings; |