[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdepim/kleopatra/view
From:       Marc Mutz <mutz () kde ! org>
Date:       2010-10-27 21:45:59
Message-ID: 20101027214559.BEF6EAC8A2 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1190499 by mutz:

KeyListController: add/remove all TabWidget::views() to/from the controller when setting a tab widget

So far, this has worked only because we've been creating the tabs after
calling controller.setTabWidget(), in which case the viewAdded/viewRemoved
signals of TabWidget took care of the registration of all views.

This is more robust, though.

Also adjust the current view in setTabWidget().

 M  +4 -0      keylistcontroller.cpp  


--- trunk/KDE/kdepim/kleopatra/view/keylistcontroller.cpp #1190498:1190499
@@ -266,6 +266,8 @@
     d->tabWidget = tabWidget;
 
     d->connectTabWidget();
+
+    d->slotCurrentViewChanged( tabWidget ? tabWidget->currentView() : 0 );
 }
 
 static const struct {
@@ -281,6 +283,7 @@
 void KeyListController::Private::connectTabWidget() {
     if ( !tabWidget )
         return;
+    kdtools::for_each( tabWidget->views(), bind( &Private::addView, this, _1 ) );
     for ( unsigned int i = 0 ; i < numTabs2Controller ; ++i )
         connect( tabWidget, tabs2controller[i].signal, q, tabs2controller[i].slot );
 }
@@ -290,6 +293,7 @@
         return;
     for ( unsigned int i = 0 ; i < numTabs2Controller ; ++i )
         disconnect( tabWidget, tabs2controller[i].signal, q, tabs2controller[i].slot );
+    kdtools::for_each( tabWidget->views(), bind( &Private::removeView, this, _1 ) );
 }
 
 AbstractKeyListModel * KeyListController::flatModel() const {
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic