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

List:       kde-commits
Subject:    kdelibs/kmdi
From:       Jaroslaw Staniek <js () iidea ! pl>
Date:       2005-01-13 21:04:21
Message-ID: 20050113210421.C77661C01A () office ! kde ! org
[Download RAW message or body]

CVS commit by staniek: 


For win32, ctrl+F4 is proper shortcut for closing MDI child window, also
followed by Qt win32 apps. On !win32, this behaviour is unchanged. 


  M +18 -4     kmdimainfrm.cpp   1.85


--- kdelibs/kmdi/kmdimainfrm.cpp  #1.84:1.85
@@ -131,4 +131,5 @@ public:
         int m_styleIDEAlMode;
         int m_toolviewStyle;
+        KAction *closeWindowAction;
 };
 
@@ -215,4 +216,12 @@ KMdiMainFrm::KMdiMainFrm( QWidget* paren
         m_pPlacingMenu = new QPopupMenu( this, "placing_menu" );
 
+        d->closeWindowAction = new KAction(i18n("&Close"),
+#ifdef Q_WS_WIN
+                CTRL|Key_F4,
+#else
+                0,
+#endif
+                this, SLOT(closeActiveView()), actionCollection(), "window_close");
+
         // the MDI view taskbar
         createTaskBar();
@@ -434,4 +443,6 @@ void KMdiMainFrm::addWindow( KMdiChildVi
         }
 
+        d->closeWindowAction->setEnabled(true);
+
         // common connections used when under MDI control
         QObject::connect( pWnd, SIGNAL( clickedInWindowMenu( int ) ), this, SLOT( \
windowMenuItemActivated( int ) ) ); @@ -906,6 +917,8 @@ void \
KMdiMainFrm::closeWindow( KMdiChild  }
 
-        if ( !m_pCurrentWindow )
+        if ( !m_pCurrentWindow ) {
+                d->closeWindowAction->setEnabled(false);
                 emit lastChildViewClosed();
+        }
 }
 
@@ -2384,5 +2397,5 @@ void KMdiMainFrm::setEnableMaximizedChil
                 KMdiChildFrm* pCurrentChild = m_pMdi->topChild();
                 
-                //If we have no child and there is no menubar, we do nothing
+                //If we have no child or there is no menubar, we do nothing
                 if ( !pCurrentChild || !m_pMainMenuBar )
                         return ;
@@ -2528,9 +2541,10 @@ void KMdiMainFrm::fillWindowMenu()
                 m_pWindowMenu->clear();
 
-        int closeId = m_pWindowMenu->insertItem( i18n( "&Close" ), this, SLOT( \
closeActiveView() ) ); +        d->closeWindowAction->plug(m_pWindowMenu);
+
         int closeAllId = m_pWindowMenu->insertItem( i18n( "Close &All" ), this, \
SLOT( closeAllViews() ) );  if ( noViewOpened )
         {
-                m_pWindowMenu->setItemEnabled( closeId, false );
+                d->closeWindowAction->setEnabled(false);
                 m_pWindowMenu->setItemEnabled( closeAllId, false );
         }


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

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