Index: kmdimainfrm.cpp
===================================================================
RCS file: /home/kde/kdelibs/kmdi/kmdimainfrm.cpp,v
retrieving revision 1.83
diff -u -r1.83 kmdimainfrm.cpp
--- kmdimainfrm.cpp	30 Dec 2004 05:25:49 -0000	1.83
+++ kmdimainfrm.cpp	6 Jan 2005 20:11:33 -0000
@@ -130,6 +130,7 @@
 	KMdiFocusList *focusList;
 	int m_styleIDEAlMode;
 	int m_toolviewStyle;
+	KAction *closeWindowAction;
 };
 
 //============ constructor ============//
@@ -214,6 +215,14 @@
 
 	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();
 
@@ -433,6 +442,8 @@
 		return ;
 	}
 
+	d->closeWindowAction->setEnabled(true);
+
 	// common connections used when under MDI control
 	QObject::connect( pWnd, SIGNAL( clickedInWindowMenu( int ) ), this, SLOT( windowMenuItemActivated( int ) ) );
 	QObject::connect( pWnd, SIGNAL( focusInEventOccurs( KMdiChildView* ) ), this, SLOT( activateView( KMdiChildView* ) ) );
@@ -905,8 +916,10 @@
 		}
 	}
 
-	if ( !m_pCurrentWindow )
+	if ( !m_pCurrentWindow ) {
+		d->closeWindowAction->setEnabled(false);
 		emit lastChildViewClosed();
+	}
 }
 
 //================== findWindow =================//
@@ -2383,8 +2396,8 @@
 		
 		KMdiChildFrm* pCurrentChild = m_pMdi->topChild();
 		
-		//If we have no child and there is no menubar, we do nothing
-		if ( !pCurrentChild && !m_pMainMenuBar )
+		//If we have no child or there is no menubar, we do nothing
+		if ( !pCurrentChild || !m_pMainMenuBar )
 			return ;
 
 		QObject::connect( m_pUndock, SIGNAL( clicked() ), pCurrentChild, SLOT( undockPressed() ) );
@@ -2527,11 +2540,12 @@
 	if ( !m_bClearingOfWindowMenuBlocked )
 		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 );
 	}
 	
