[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:46:01
Message-ID: 20101027214601.C8E80AC8A4 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1190500 by mutz:

KeyListController: maintain our own currentView()

This is part of the decoupling of KeyListController from TabWidget.

 M  +7 -5      keylistcontroller.cpp  


--- trunk/KDE/kdepim/kleopatra/view/keylistcontroller.cpp #1190499:1190500
@@ -124,10 +124,6 @@
         views.erase( std::remove( views.begin(), views.end(), view ), views.end() );
     }
 
-    QAbstractItemView * currentView() const {
-        return tabWidget ? tabWidget->currentView() : 0 ;
-    }
-    
 public:
     void slotDestroyed( QObject * o ) {
         qDebug( "KeyListController::Private::slotDestroyed( %p )", ( void* )o );
@@ -148,6 +144,11 @@
     }
     void slotActionTriggered();
     void slotCurrentViewChanged( QAbstractItemView * view ) {
+        if ( view && !kdtools::binary_search( views, view ) ) {
+            kDebug() << "you need to register view" << view << "before trying to set \
it as the current view!"; +            addView( view );
+        }
+        currentView = view;
         q->enableDisableActions( view ? view->selectionModel() : 0 );
     }
 
@@ -167,6 +168,7 @@
     std::vector<QAbstractItemView*> views;
     std::vector<Command*> commands;
     QPointer<TabWidget> tabWidget;
+    QPointer<QAbstractItemView> currentView;
     QPointer<AbstractKeyListModel> flatModel, hierarchicalModel;
 };
 
@@ -613,7 +615,7 @@
         const std::vector<action_item>::const_iterator it
             = kdtools::find_if( actions, bind( &action_item::action, _1 ) == \
q->sender() );  if ( it != actions.end() )
-            if ( Command * const c = it->createCommand( this->currentView(), q ) )
+            if ( Command * const c = it->createCommand( this->currentView, q ) )
                 c->start();
             else
                 qDebug( "KeyListController::Private::slotActionTriggered: \
createCommand() == NULL for action(?) \"%s\"", qPrintable( s->objectName() ) );


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

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