summaryrefslogtreecommitdiffabout
path: root/kaddressbook/kaddressbookmain.cpp
Unidiff
Diffstat (limited to 'kaddressbook/kaddressbookmain.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kaddressbookmain.cpp86
1 files changed, 25 insertions, 61 deletions
diff --git a/kaddressbook/kaddressbookmain.cpp b/kaddressbook/kaddressbookmain.cpp
index 8ebb93a..f48f214 100644
--- a/kaddressbook/kaddressbookmain.cpp
+++ b/kaddressbook/kaddressbookmain.cpp
@@ -154,123 +154,87 @@ void KAddressBookMain::initActions()
154QToolBar * KAddressBookMain::getIconToolBar() 154QToolBar * KAddressBookMain::getIconToolBar()
155{ 155{
156 return iconToolBar; 156 return iconToolBar;
157} 157}
158*/ 158*/
159 159
160void KAddressBookMain::createGUI() 160void KAddressBookMain::createGUI()
161{ 161{
162 162
163 163
164 164
165} 165}
166#endif //KAB_EMBEDDED 166#endif //KAB_EMBEDDED
167 167
168void KAddressBookMain::configureToolbars() 168void KAddressBookMain::configureToolbars()
169{ 169{
170#ifndef KAB_EMBEDDED 170#ifndef KAB_EMBEDDED
171 saveMainWindowSettings( KGlobal::config(), "MainWindow" ); 171 saveMainWindowSettings( KGlobal::config(), "MainWindow" );
172 172
173 KEditToolbar dlg( factory() ); 173 KEditToolbar dlg( factory() );
174 connect( &dlg, SIGNAL( newToolbarConfig() ), SLOT( slotNewToolbarConfig() ) ); 174 connect( &dlg, SIGNAL( newToolbarConfig() ), SLOT( slotNewToolbarConfig() ) );
175 175
176 dlg.exec(); 176 dlg.exec();
177#else //KAB_EMBEDDED 177#else //KAB_EMBEDDED
178 qDebug("KAddressBookMain::configureToolbars() not implemented by ulf" ); 178 qDebug("KAddressBookMain::configureToolbars() not implemented by ulf" );
179#endif //KAB_EMBEDDED 179#endif //KAB_EMBEDDED
180} 180}
181 181
182void KAddressBookMain::slotNewToolbarConfig() 182void KAddressBookMain::slotNewToolbarConfig()
183{ 183{
184#ifndef KAB_EMBEDDED 184#ifndef KAB_EMBEDDED
185 applyMainWindowSettings( KGlobal::config(), "MainWindow" ); 185 applyMainWindowSettings( KGlobal::config(), "MainWindow" );
186#else //KAB_EMBEDDED 186#else //KAB_EMBEDDED
187 qDebug("KAddressBookMain::slotNewToolbarConfig() not implemented by ulf" ); 187 qDebug("KAddressBookMain::slotNewToolbarConfig() not implemented by ulf" );
188#endif //KAB_EMBEDDED 188#endif //KAB_EMBEDDED
189} 189}
190 190
191void KAddressBookMain::configureKeys() 191void KAddressBookMain::configureKeys()
192{ 192{
193#ifndef KAB_EMBEDDED 193#ifndef KAB_EMBEDDED
194 KKeyDialog::configureKeys( actionCollection(), xmlFile(), true, this ); 194 KKeyDialog::configureKeys( actionCollection(), xmlFile(), true, this );
195#else //KAB_EMBEDDED 195#else //KAB_EMBEDDED
196 qDebug("KAddressBookMain::configureKeys() not implemented by ulf" ); 196 qDebug("KAddressBookMain::configureKeys() not implemented by ulf" );
197#endif //KAB_EMBEDDED 197#endif //KAB_EMBEDDED
198} 198}
199 199
200void KAddressBookMain::closeEvent( QCloseEvent* ce ) 200void KAddressBookMain::closeEvent( QCloseEvent* ce )
201{ 201{
202 QString mess = i18n( "Close KA/Pi?"); 202 bool mModified = mCore->modified();
203 if ( mCore->modified() ) 203 bool mAskForQuit = KABPrefs::instance()->mAskForQuit;
204 mess += i18n( "\n\nChanges will be saved!");
205 else
206 mess += i18n( "\n\nNo unsaved changes detected!\nNothing will be saved!");
207
208 switch( QMessageBox::information( this, "KA/Pi", mess ,
209 i18n("Yes!"), i18n("No"), 0, 0 ) ) {
210 case 0:
211
212 break;
213 case 1:
214 return;
215 break;
216 case 2:
217 return;
218 break;
219
220 default:
221 return;
222 break;
223 }
224 204
225#if 0 205 QString mess = i18n( "Close KA/Pi?");
206 if ( mModified == true )
207 mess += i18n( "\nChanges will be saved!");
208 else
209 mess += i18n( "\nNo unsaved changes detected!\nNothing will be saved!");
226 210
227 if ( mCore->modified() ) { 211 bool mQuit = true;
228 QString text = i18n( "The address book has been modified.\nDo you want to save your changes?" );
229 212
230#ifndef KAB_EMBEDDED
231 int ret = KMessageBox::warningYesNoCancel( this, text, "",
232 KStdGuiItem::yes(),
233 KStdGuiItem::no(), "AskForSave" );
234 switch ( ret ) {
235 case KMessageBox::Yes:
236 save();
237 break;
238 case KMessageBox::No:
239 return true;
240 break;
241 default: //cancel
242 return ;
243 break;
244 }
245 213
246#else //KAB_EMBEDDED 214 if (mAskForQuit)
247 switch( QMessageBox::information( this, "KA/Pi", 215 {
248 text, 216
249 i18n("Yes!"), i18n("No"), 0, 0 ) ) { 217 int res = QMessageBox::information( this, "KA/Pi", mess , i18n("Yes!"), i18n("No"), 0, 0 );
250 case 0: 218 if (res == 0)
251 save(); 219 mQuit = true;
252 break; 220 else
253 case 1: 221 mQuit = false;
254 break;
255 case 2:
256 return;
257 default:
258 return;
259 break;
260 }
261#endif //KAB_EMBEDDED
262 } 222 }
263 223
264#endif 224 if (mQuit == false)
225 return;
226
227 if (mModified == true)
228 {
229 save();
230 mCore->saveSettings();
231 KABPrefs::instance()->writeConfig();
232 }
265 233
266 save();
267 mCore->saveSettings();
268 KABPrefs::instance()->writeConfig();
269 ce->accept(); 234 ce->accept();
270
271} 235}
272 236
273#ifndef KAB_EMBEDDED 237#ifndef KAB_EMBEDDED
274#include "kaddressbookmain.moc" 238#include "kaddressbookmain.moc"
275#endif //KAB_EMBEDDED 239#endif //KAB_EMBEDDED
276 240