[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-11-02 16:05:38
Message-ID: 20101102160538.D73CDAC8A3 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1192332 by mutz:

KeyListController: allow to set a parentWindow, which is subsequently set as parent \
window of all commands

 M  +16 -0     keylistcontroller.cpp  
 M  +3 -0      keylistcontroller.h  


--- trunk/KDE/kdepim/kleopatra/view/keylistcontroller.cpp #1192331:1192332
@@ -167,6 +167,7 @@
     std::vector<action_item> actions;
     std::vector<QAbstractItemView*> views;
     std::vector<Command*> commands;
+    QPointer<QWidget> parentWidget;
     QPointer<TabWidget> tabWidget;
     QPointer<QAbstractItemView> currentView;
     QPointer<AbstractKeyListModel> flatModel, hierarchicalModel;
@@ -178,6 +179,7 @@
       actions(),
       views(),
       commands(),
+      parentWidget(),
       tabWidget(),
       flatModel(),
       hierarchicalModel()
@@ -272,6 +274,14 @@
     d->slotCurrentViewChanged( tabWidget ? tabWidget->currentView() : 0 );
 }
 
+void KeyListController::setParentWidget( QWidget * parent ) {
+    d->parentWidget = parent;
+}
+
+QWidget * KeyListController::parentWidget() const {
+    return d->parentWidget;
+}
+
 static const struct {
     const char * signal;
     const char * slot;
@@ -500,6 +510,8 @@
 	return;
 
     DetailsCommand * const c = new DetailsCommand( view, q );
+    if ( parentWidget )
+        c->setParentWidget( parentWidget );
 
     c->setIndex( idx );
     c->start();
@@ -620,7 +632,11 @@
             = 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 ( parentWidget )
+                    c->setParentWidget( parentWidget );
                 c->start();
+            }
             else
                 qDebug( "KeyListController::Private::slotActionTriggered: \
createCommand() == NULL for action(?) \"%s\"", qPrintable( s->objectName() ) );  else
--- trunk/KDE/kdepim/kleopatra/view/keylistcontroller.h #1192331:1192332
@@ -66,6 +66,9 @@
         void setHierarchicalModel( AbstractKeyListModel * model );
         AbstractKeyListModel * hierarchicalModel() const;
 
+        void setParentWidget( QWidget * parent );
+        QWidget * parentWidget() const;
+
         QAbstractItemView * currentView() const;
 
         void setTabWidget( TabWidget * tabs );


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

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