Diffstat (limited to 'kaddressbook/viewmanager.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kaddressbook/viewmanager.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/kaddressbook/viewmanager.cpp b/kaddressbook/viewmanager.cpp index f4fb08b..81e0d99 100644 --- a/kaddressbook/viewmanager.cpp +++ b/kaddressbook/viewmanager.cpp | |||
@@ -239,128 +239,133 @@ void ViewManager::setActiveView( const QString &name ) | |||
239 | // The manager just relays the signals | 239 | // The manager just relays the signals |
240 | connect( view, SIGNAL( selected( const QString& ) ), | 240 | connect( view, SIGNAL( selected( const QString& ) ), |
241 | SIGNAL( selected( const QString & ) ) ); | 241 | SIGNAL( selected( const QString & ) ) ); |
242 | connect( view, SIGNAL( executed( const QString& ) ), | 242 | connect( view, SIGNAL( executed( const QString& ) ), |
243 | SIGNAL( executed( const QString& ) ) ); | 243 | SIGNAL( executed( const QString& ) ) ); |
244 | 244 | ||
245 | connect( view, SIGNAL( deleteRequest( ) ), | 245 | connect( view, SIGNAL( deleteRequest( ) ), |
246 | SIGNAL( deleteRequest( ) ) ); | 246 | SIGNAL( deleteRequest( ) ) ); |
247 | 247 | ||
248 | connect( view, SIGNAL( modified() ), SIGNAL( modified() ) ); | 248 | connect( view, SIGNAL( modified() ), SIGNAL( modified() ) ); |
249 | connect( view, SIGNAL( dropped( QDropEvent* ) ), | 249 | connect( view, SIGNAL( dropped( QDropEvent* ) ), |
250 | SLOT( dropped( QDropEvent* ) ) ); | 250 | SLOT( dropped( QDropEvent* ) ) ); |
251 | connect( view, SIGNAL( startDrag() ), SLOT( startDrag() ) ); | 251 | connect( view, SIGNAL( startDrag() ), SLOT( startDrag() ) ); |
252 | } | 252 | } |
253 | } | 253 | } |
254 | 254 | ||
255 | // If we found or created the view, raise it and refresh it | 255 | // If we found or created the view, raise it and refresh it |
256 | if ( view ) { | 256 | if ( view ) { |
257 | mActiveView = view; | 257 | mActiveView = view; |
258 | mViewWidgetStack->raiseWidget( view ); | 258 | mViewWidgetStack->raiseWidget( view ); |
259 | // Set the proper filter in the view. By setting the combo | 259 | // Set the proper filter in the view. By setting the combo |
260 | // box, the activated slot will be called, which will push | 260 | // box, the activated slot will be called, which will push |
261 | // the filter to the view and refresh it. | 261 | // the filter to the view and refresh it. |
262 | 262 | ||
263 | if ( view->defaultFilterType() == KAddressBookView::None ) { | 263 | if ( view->defaultFilterType() == KAddressBookView::None ) { |
264 | 264 | ||
265 | mActionSelectFilter->setCurrentItem( 0 ); | 265 | mActionSelectFilter->setCurrentItem( 0 ); |
266 | setActiveFilter( 0 ); | 266 | setActiveFilter( 0 ); |
267 | } else if ( view->defaultFilterType() == KAddressBookView::Active ) { | 267 | } else if ( view->defaultFilterType() == KAddressBookView::Active ) { |
268 | setActiveFilter( mActionSelectFilter->currentItem() ); | 268 | setActiveFilter( mActionSelectFilter->currentItem() ); |
269 | } else { | 269 | } else { |
270 | uint pos = filterPosition( view->defaultFilterName() ); | 270 | uint pos = filterPosition( view->defaultFilterName() ); |
271 | mActionSelectFilter->setCurrentItem( pos ); | 271 | mActionSelectFilter->setCurrentItem( pos ); |
272 | setActiveFilter( pos ); | 272 | setActiveFilter( pos ); |
273 | } | 273 | } |
274 | //US qDebug("ViewManager::setActiveView 6" ); | 274 | //US qDebug("ViewManager::setActiveView 6" ); |
275 | 275 | ||
276 | // Update the inc search widget to show the fields in the new active | 276 | // Update the inc search widget to show the fields in the new active |
277 | // view. | 277 | // view. |
278 | mCore->setSearchFields( mActiveView->fields() ); | 278 | mCore->setSearchFields( mActiveView->fields() ); |
279 | 279 | ||
280 | //US performance optimization. setActiveFilter calls also mActiveView->refresh() | 280 | //US performance optimization. setActiveFilter calls also mActiveView->refresh() |
281 | //US mActiveView->refresh(); | 281 | //US mActiveView->refresh(); |
282 | 282 | ||
283 | } | 283 | } |
284 | else | 284 | else |
285 | { | 285 | { |
286 | qDebug("ViewManager::setActiveView: unable to find view" ); | 286 | qDebug("ViewManager::setActiveView: unable to find view" ); |
287 | kdDebug(5720) << "ViewManager::setActiveView: unable to find view\n"; | 287 | kdDebug(5720) << "ViewManager::setActiveView: unable to find view\n"; |
288 | } | 288 | } |
289 | } | 289 | } |
290 | 290 | ||
291 | //US added another method with no parameter, since my moc compiler does not support default parameters. | 291 | //US added another method with no parameter, since my moc compiler does not support default parameters. |
292 | void ViewManager::refreshView() | 292 | void ViewManager::refreshView() |
293 | { | 293 | { |
294 | refreshView( QString::null ); | 294 | refreshView( QString::null ); |
295 | } | 295 | } |
296 | 296 | ||
297 | void ViewManager::refreshView( const QString &uid ) | 297 | void ViewManager::refreshView( const QString &uid ) |
298 | { | 298 | { |
299 | if ( mActiveView ) | 299 | if ( mActiveView ) |
300 | mActiveView->refresh( uid ); | 300 | mActiveView->refresh( uid ); |
301 | } | 301 | } |
302 | 302 | ||
303 | void ViewManager::setFocusAV() | ||
304 | { | ||
305 | if ( mActiveView ) | ||
306 | mActiveView->setFocus(); | ||
307 | } | ||
303 | void ViewManager::editView() | 308 | void ViewManager::editView() |
304 | { | 309 | { |
305 | if ( !mActiveView ) | 310 | if ( !mActiveView ) |
306 | return; | 311 | return; |
307 | 312 | ||
308 | ViewFactory *factory = mViewFactoryDict.find( mActiveView->type() ); | 313 | ViewFactory *factory = mViewFactoryDict.find( mActiveView->type() ); |
309 | ViewConfigureWidget *wdg = 0; | 314 | ViewConfigureWidget *wdg = 0; |
310 | ViewConfigureDialog* dlg = 0; | 315 | ViewConfigureDialog* dlg = 0; |
311 | if ( factory ) { | 316 | if ( factory ) { |
312 | // Save the filters so the dialog has the latest set | 317 | // Save the filters so the dialog has the latest set |
313 | Filter::save( mCore->config(), "Filter", mFilterList ); | 318 | Filter::save( mCore->config(), "Filter", mFilterList ); |
314 | dlg = new ViewConfigureDialog( 0, mActiveView->caption(), this, "conf_dlg" ); | 319 | dlg = new ViewConfigureDialog( 0, mActiveView->caption(), this, "conf_dlg" ); |
315 | wdg = factory->configureWidget( mCore->addressBook(), dlg,"conf_wid" ); | 320 | wdg = factory->configureWidget( mCore->addressBook(), dlg,"conf_wid" ); |
316 | } else { | 321 | } else { |
317 | qDebug("ViewManager::editView()::cannot find viewfactory "); | 322 | qDebug("ViewManager::editView()::cannot find viewfactory "); |
318 | return; | 323 | return; |
319 | } | 324 | } |
320 | if ( wdg ) { | 325 | if ( wdg ) { |
321 | dlg->setWidget( wdg ); | 326 | dlg->setWidget( wdg ); |
322 | 327 | ||
323 | #ifndef DESKTOP_VERSION | 328 | #ifndef DESKTOP_VERSION |
324 | //dlg.setMaximumSize( 640, 480 ); | 329 | //dlg.setMaximumSize( 640, 480 ); |
325 | //dlg->setGeometry( 40,40, 400, 300); | 330 | //dlg->setGeometry( 40,40, 400, 300); |
326 | dlg->showMaximized(); | 331 | dlg->showMaximized(); |
327 | #endif | 332 | #endif |
328 | 333 | ||
329 | KConfigGroupSaver saver( mCore->config(), mActiveView->caption() ); | 334 | KConfigGroupSaver saver( mCore->config(), mActiveView->caption() ); |
330 | 335 | ||
331 | dlg->restoreSettings( mCore->config() ); | 336 | dlg->restoreSettings( mCore->config() ); |
332 | 337 | ||
333 | if ( dlg->exec() ) { | 338 | if ( dlg->exec() ) { |
334 | dlg->saveSettings( mCore->config() ); | 339 | dlg->saveSettings( mCore->config() ); |
335 | mActiveView->readConfig( mCore->config() ); | 340 | mActiveView->readConfig( mCore->config() ); |
336 | 341 | ||
337 | // Set the proper filter in the view. By setting the combo | 342 | // Set the proper filter in the view. By setting the combo |
338 | // box, the activated slot will be called, which will push | 343 | // box, the activated slot will be called, which will push |
339 | // the filter to the view and refresh it. | 344 | // the filter to the view and refresh it. |
340 | if ( mActiveView->defaultFilterType() == KAddressBookView::None ) { | 345 | if ( mActiveView->defaultFilterType() == KAddressBookView::None ) { |
341 | mActionSelectFilter->setCurrentItem( 0 ); | 346 | mActionSelectFilter->setCurrentItem( 0 ); |
342 | setActiveFilter( 0 ); | 347 | setActiveFilter( 0 ); |
343 | } else if ( mActiveView->defaultFilterType() == KAddressBookView::Active ) { | 348 | } else if ( mActiveView->defaultFilterType() == KAddressBookView::Active ) { |
344 | setActiveFilter( mActionSelectFilter->currentItem() ); | 349 | setActiveFilter( mActionSelectFilter->currentItem() ); |
345 | } else { | 350 | } else { |
346 | uint pos = filterPosition( mActiveView->defaultFilterName() ); | 351 | uint pos = filterPosition( mActiveView->defaultFilterName() ); |
347 | mActionSelectFilter->setCurrentItem( pos ); | 352 | mActionSelectFilter->setCurrentItem( pos ); |
348 | setActiveFilter( pos ); | 353 | setActiveFilter( pos ); |
349 | } | 354 | } |
350 | mCore->setSearchFields( mActiveView->fields() ); | 355 | mCore->setSearchFields( mActiveView->fields() ); |
351 | //US performance optimization. setActiveFilter calls also mActiveView->refresh() | 356 | //US performance optimization. setActiveFilter calls also mActiveView->refresh() |
352 | //US mActiveView->refresh(); | 357 | //US mActiveView->refresh(); |
353 | 358 | ||
354 | 359 | ||
355 | //US this is a bugfix, that we get notified if we change a views configuration | 360 | //US this is a bugfix, that we get notified if we change a views configuration |
356 | emit modified(); | 361 | emit modified(); |
357 | 362 | ||
358 | } | 363 | } |
359 | 364 | ||
360 | } | 365 | } |
361 | delete dlg; | 366 | delete dlg; |
362 | } | 367 | } |
363 | 368 | ||
364 | void ViewManager::deleteView() | 369 | void ViewManager::deleteView() |
365 | { | 370 | { |
366 | QString text = i18n( "<qt>Are you sure that you want to delete the view <b>%1</b>?</qt>" ) | 371 | QString text = i18n( "<qt>Are you sure that you want to delete the view <b>%1</b>?</qt>" ) |