summaryrefslogtreecommitdiffabout
path: root/kaddressbook
authorulf69 <ulf69>2004-07-15 05:06:06 (UTC)
committer ulf69 <ulf69>2004-07-15 05:06:06 (UTC)
commit59f727076930aada485db6531d4084f2bfe0b928 (patch) (unidiff)
treed68ab61d9f78759d36d8ccb2cdd3312987bf7917 /kaddressbook
parent2ada2bfd67b5488115268e6667e55a9b4b297fa2 (diff)
downloadkdepimpi-59f727076930aada485db6531d4084f2bfe0b928.zip
kdepimpi-59f727076930aada485db6531d4084f2bfe0b928.tar.gz
kdepimpi-59f727076930aada485db6531d4084f2bfe0b928.tar.bz2
ask for readwrite resources if the user wants them to reload in the case of an
external change.
Diffstat (limited to 'kaddressbook') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/details/detailsviewcontainer.cpp3
-rw-r--r--kaddressbook/kabcore.cpp1
2 files changed, 3 insertions, 1 deletions
diff --git a/kaddressbook/details/detailsviewcontainer.cpp b/kaddressbook/details/detailsviewcontainer.cpp
index 8f566cf..a42499f 100644
--- a/kaddressbook/details/detailsviewcontainer.cpp
+++ b/kaddressbook/details/detailsviewcontainer.cpp
@@ -113,50 +113,51 @@ void ViewContainer::slotStyleSelected( int index )
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 kdDebug(5720) << "ViewContainer::slotStyleSelected: " 119 kdDebug(5720) << "ViewContainer::slotStyleSelected: "
120 << "creating look " 120 << "creating look "
121 << factory->description() << endl; 121 << factory->description() << endl;
122 122
123 mCurrentLook = factory->create(); 123 mCurrentLook = factory->create();
124 mDetailsStack->raiseWidget( mCurrentLook ); 124 mDetailsStack->raiseWidget( mCurrentLook );
125 125
126 connect( mCurrentLook, SIGNAL( sendEmail( const QString& ) ), this, 126 connect( mCurrentLook, SIGNAL( sendEmail( const QString& ) ), this,
127 SIGNAL( sendEmail( const QString& ) ) ); 127 SIGNAL( sendEmail( const QString& ) ) );
128 connect( mCurrentLook, SIGNAL( browse( const QString& ) ), this, 128 connect( mCurrentLook, SIGNAL( browse( const QString& ) ), this,
129 SIGNAL( browse( const QString& ) ) ); 129 SIGNAL( browse( const QString& ) ) );
130 } 130 }
131 131
132 mCurrentLook->restoreSettings( config ); 132 mCurrentLook->restoreSettings( config );
133 mCurrentLook->setAddressee( addr ); 133 mCurrentLook->setAddressee( addr );
134} 134}
135void ViewContainer::refreshView() 135void ViewContainer::refreshView()
136{ 136{
137 if ( mCurrentLook ) 137 if ( mCurrentLook ) {
138 mCurrentLook->setAddressee( mCurrentAddressee ); 138 mCurrentLook->setAddressee( mCurrentAddressee );
139 }
139} 140}
140 141
141void ViewContainer::setAddressee( const KABC::Addressee& addressee ) 142void ViewContainer::setAddressee( const KABC::Addressee& addressee )
142{ 143{
143 if ( mCurrentLook != 0 ) { 144 if ( mCurrentLook != 0 ) {
144 if ( addressee == mCurrentAddressee ) 145 if ( addressee == mCurrentAddressee )
145 return; 146 return;
146 else { 147 else {
147 mCurrentAddressee = addressee; 148 mCurrentAddressee = addressee;
148 mCurrentLook->setAddressee( mCurrentAddressee ); 149 mCurrentLook->setAddressee( mCurrentAddressee );
149 } 150 }
150 } 151 }
151} 152}
152 153
153KABC::Addressee ViewContainer::addressee() 154KABC::Addressee ViewContainer::addressee()
154{ 155{
155 static KABC::Addressee empty; // do not use! 156 static KABC::Addressee empty; // do not use!
156 157
157 if ( !mCurrentLook ) 158 if ( !mCurrentLook )
158 return empty; 159 return empty;
159 else 160 else
160 return mCurrentLook->addressee(); 161 return mCurrentLook->addressee();
161} 162}
162 163
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 2b07541..a7ca0ce 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -1103,48 +1103,49 @@ void KABCore::addressBookChanged()
1103/*US 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) 1115 if (mEditorDialog)
1116 { 1116 {
1117 if (mEditorDialog->dirty()) 1117 if (mEditorDialog->dirty())
1118 { 1118 {
1119 QString text = i18n( "Data has been changed externally. Unsaved " 1119 QString text = i18n( "Data has been changed externally. Unsaved "
1120 "changes will be lost." ); 1120 "changes will be lost." );
1121 KMessageBox::information( this, text ); 1121 KMessageBox::information( this, text );
1122 } 1122 }
1123 QString currentuid = mEditorDialog->addressee().uid(); 1123 QString currentuid = mEditorDialog->addressee().uid();
1124 mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) ); 1124 mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) );
1125 } 1125 }
1126 mViewManager->refreshView(); 1126 mViewManager->refreshView();
1127// mDetails->refreshView();
1127 1128
1128 1129
1129} 1130}
1130 1131
1131AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, 1132AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent,
1132 const char *name ) 1133 const char *name )
1133{ 1134{
1134 1135
1135 if ( mEditorDialog == 0 ) { 1136 if ( mEditorDialog == 0 ) {
1136 mEditorDialog = new AddresseeEditorDialog( this, parent, 1137 mEditorDialog = new AddresseeEditorDialog( this, parent,
1137 name ? name : "editorDialog" ); 1138 name ? name : "editorDialog" );
1138 1139
1139 1140
1140 connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ), 1141 connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ),
1141 SLOT( contactModified( const KABC::Addressee& ) ) ); 1142 SLOT( contactModified( const KABC::Addressee& ) ) );
1142 //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ), 1143 //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ),
1143 // SLOT( slotEditorDestroyed( const QString& ) ) ); 1144 // SLOT( slotEditorDestroyed( const QString& ) ) );
1144 } 1145 }
1145 1146
1146 return mEditorDialog; 1147 return mEditorDialog;
1147} 1148}
1148 1149
1149void KABCore::slotEditorDestroyed( const QString &uid ) 1150void KABCore::slotEditorDestroyed( const QString &uid )
1150{ 1151{