[rkward-cvs] SF.net SVN: rkward: [2078] branches/KDE4_port

tfry at users.sourceforge.net tfry at users.sourceforge.net
Tue Oct 16 09:19:12 UTC 2007


Revision: 2078
          http://rkward.svn.sourceforge.net/rkward/?rev=2078&view=rev
Author:   tfry
Date:     2007-10-16 02:19:11 -0700 (Tue, 16 Oct 2007)

Log Message:
-----------
Basic MDI seems to work, now

Modified Paths:
--------------
    branches/KDE4_port/TODO_KDE4
    branches/KDE4_port/rkward/rkward.cpp
    branches/KDE4_port/rkward/windows/rkfilebrowser.cpp
    branches/KDE4_port/rkward/windows/rkmdiwindow.cpp
    branches/KDE4_port/rkward/windows/rktoolwindowbar.cpp
    branches/KDE4_port/rkward/windows/rktoolwindowbar.h
    branches/KDE4_port/rkward/windows/rkworkplace.cpp
    branches/KDE4_port/rkward/windows/rkworkplace.h

Modified: branches/KDE4_port/TODO_KDE4
===================================================================
--- branches/KDE4_port/TODO_KDE4	2007-10-16 00:11:44 UTC (rev 2077)
+++ branches/KDE4_port/TODO_KDE4	2007-10-16 09:19:11 UTC (rev 2078)
@@ -84,4 +84,7 @@
 
 rkconsole:
 	- does it work at all?
-	- selection, editing, naivgating
\ No newline at end of file
+	- selection, editing, naivgating
+
+rkcommandlog:
+	- does the RMB-menu work?

Modified: branches/KDE4_port/rkward/rkward.cpp
===================================================================
--- branches/KDE4_port/rkward/rkward.cpp	2007-10-16 00:11:44 UTC (rev 2077)
+++ branches/KDE4_port/rkward/rkward.cpp	2007-10-16 09:19:11 UTC (rev 2078)
@@ -207,7 +207,6 @@
 
 	RKCommandLog *log = new RKCommandLog (0, true, "Command log");
 	log->setWindowIcon (SmallIcon ("format-justify-left"));
-	RKWorkplace::mainWorkplace ()->registerToolWindow (log);
 	RKWorkplace::mainWorkplace ()->placeInToolWindowBar (log, KMultiTabBar::Bottom);
 	RKCommandLog::rkcommand_log = log;
 
@@ -220,29 +219,24 @@
 
 	RObjectBrowser::mainBrowser ()->setWindowIcon(SmallIcon("fileview-detailed"));
 	RObjectBrowser::mainBrowser ()->setCaption (i18n ("Workspace"));
-	RKWorkplace::mainWorkplace ()->registerToolWindow (RObjectBrowser::mainBrowser ());
 	RKWorkplace::mainWorkplace ()->placeInToolWindowBar (RObjectBrowser::mainBrowser (), KMultiTabBar::Left);
 
 	RKFileBrowser::main_browser = new RKFileBrowser (0, true, "file_browser");
 	RKFileBrowser::main_browser->setWindowIcon (SmallIcon ("document-open"));
 	RKFileBrowser::main_browser->setCaption (i18n ("Files"));
-	RKWorkplace::mainWorkplace ()->registerToolWindow (RKFileBrowser::main_browser);
 	RKWorkplace::mainWorkplace ()->placeInToolWindowBar (RKFileBrowser::main_browser, KMultiTabBar::Left);
 
 	RControlWindow::getControl ()->setCaption (i18n ("Pending Jobs"));
 	RControlWindow::getControl ()->setWindowIcon (SmallIcon ("system-run"));
-	RKWorkplace::mainWorkplace ()->registerToolWindow (RControlWindow::getControl ());
 	RKWorkplace::mainWorkplace ()->placeInToolWindowBar (RControlWindow::getControl (), KMultiTabBar::Bottom);
 
 	RKConsole *console = new RKConsole (0, true, "r_console");
 	console->setWindowIcon (SmallIcon ("konsole"));
-	RKWorkplace::mainWorkplace ()->registerToolWindow (console);
 	RKConsole::setMainConsole (console);
 	RKWorkplace::mainWorkplace ()->placeInToolWindowBar (console, KMultiTabBar::Bottom);
 
 	RKHelpSearchWindow *help_search = new RKHelpSearchWindow (0, true, "r_help");
 	help_search->setWindowIcon (SmallIcon ("help-contents"));
-	RKWorkplace::mainWorkplace ()->registerToolWindow (help_search);
 	RKHelpSearchWindow::main_help_search = help_search;
 	RKWorkplace::mainWorkplace ()->placeInToolWindowBar (help_search, KMultiTabBar::Bottom);
 

Modified: branches/KDE4_port/rkward/windows/rkfilebrowser.cpp
===================================================================
--- branches/KDE4_port/rkward/windows/rkfilebrowser.cpp	2007-10-16 00:11:44 UTC (rev 2077)
+++ branches/KDE4_port/rkward/windows/rkfilebrowser.cpp	2007-10-16 09:19:11 UTC (rev 2078)
@@ -86,6 +86,7 @@
 
 	KToolBar *toolbar = new KToolBar (this);
 	toolbar->setIconSize (QSize (16, 16));
+	toolbar->setToolButtonStyle (Qt::ToolButtonIconOnly);
 
 	urlbox = new KUrlComboBox (KUrlComboBox::Directories, true, this);
 	KUrlCompletion* cmpl = new KUrlCompletion (KUrlCompletion::DirCompletion);

Modified: branches/KDE4_port/rkward/windows/rkmdiwindow.cpp
===================================================================
--- branches/KDE4_port/rkward/windows/rkmdiwindow.cpp	2007-10-16 00:11:44 UTC (rev 2077)
+++ branches/KDE4_port/rkward/windows/rkmdiwindow.cpp	2007-10-16 09:19:11 UTC (rev 2078)
@@ -82,7 +82,6 @@
 void RKMDIWindow::activate (bool with_focus) {
 	RK_TRACE (APP);
 
-	// WORKAROUND for KMDI: it will always grab focus, so we need to make sure to release it again, if needed
 	QWidget *old_focus = qApp->focusWidget ();
 
 	if (isToolWindow ()) {
@@ -97,6 +96,7 @@
 	}
 
 	if (with_focus) {
+		old_focus->clearFocus ();
 		topLevelWidget ()->setActiveWindow ();
 		setFocus();
 	} else {
@@ -131,8 +131,10 @@
 void RKMDIWindow::prepareToBeDetached () {
 	RK_TRACE (APP);
 
-
-	// TODO: KDE4 do we still need this?
+	if (isToolWindow ()) {
+		RK_ASSERT (tool_window_bar);
+		tool_window_bar->hideWidget (this);
+	}
 }
 
 bool RKMDIWindow::eventFilter (QObject *watched, QEvent *e) {

Modified: branches/KDE4_port/rkward/windows/rktoolwindowbar.cpp
===================================================================
--- branches/KDE4_port/rkward/windows/rktoolwindowbar.cpp	2007-10-16 00:11:44 UTC (rev 2077)
+++ branches/KDE4_port/rkward/windows/rktoolwindowbar.cpp	2007-10-16 09:19:11 UTC (rev 2078)
@@ -86,6 +86,13 @@
 	show ();
 }
 
+void RKToolWindowBar::reclaimDetached (RKMDIWindow *window) {
+	RK_TRACE (APP);
+
+	window->hide();
+	window->setParent (container);
+}
+
 void RKToolWindowBar::removeWidget (RKMDIWindow *widget) {
 	RK_TRACE (APP);
 	RK_ASSERT (widget_to_id.contains (widget));
@@ -143,9 +150,8 @@
 	if (!widget->active) return;
 	int id = widget_to_id[widget];
 
-	bool was_active_in_bar = isTabRaised (id);
+	bool was_active_in_bar = ((widget->parent () == container) && widget->isVisible ());
 	if (was_active_in_bar) {
-		RK_ASSERT (widget->isAttached ());
 		container->hide ();
 	}
 

Modified: branches/KDE4_port/rkward/windows/rktoolwindowbar.h
===================================================================
--- branches/KDE4_port/rkward/windows/rktoolwindowbar.h	2007-10-16 00:11:44 UTC (rev 2077)
+++ branches/KDE4_port/rkward/windows/rktoolwindowbar.h	2007-10-16 09:19:11 UTC (rev 2078)
@@ -46,15 +46,16 @@
 
 	void showWidget (RKMDIWindow *widget);
 	void hideWidget (RKMDIWindow *widget);
-
 private slots:
 	void tabClicked (int id);
 	void buttonPopupActivate (QAction *a);
 
 protected:
 	bool eventFilter (QObject *obj, QEvent *ev);
+private:
+friend class RKWorkplace;
+	void reclaimDetached (RKMDIWindow *window);
 
-private:
 	QMap<RKMDIWindow*, int> widget_to_id;
 	RKMDIWindow * idToWidget (int id);
 

Modified: branches/KDE4_port/rkward/windows/rkworkplace.cpp
===================================================================
--- branches/KDE4_port/rkward/windows/rkworkplace.cpp	2007-10-16 00:11:44 UTC (rev 2077)
+++ branches/KDE4_port/rkward/windows/rkworkplace.cpp	2007-10-16 09:19:11 UTC (rev 2078)
@@ -61,28 +61,26 @@
 	main_workplace = this;
 
 	/* Splitter setup contains heavy copying from Kate's katemdi! */
-	KHBox *hbox = new KHBox (this);
-	tool_window_bars[KMultiTabBar::Left] = new RKToolWindowBar (KMultiTabBar::Left, hbox);
+	KVBox *vbox = new KVBox (this);
 
-	horiz_splitter = new QSplitter (Qt::Horizontal, hbox);
-	horiz_splitter->setOpaqueResize (KGlobalSettings::opaqueResize ());
-
-	tool_window_bars[KMultiTabBar::Left]->setSplitter (horiz_splitter);
-
-	KVBox *vbox = new KVBox (horiz_splitter);
-	horiz_splitter->setCollapsible (horiz_splitter->indexOf (vbox), false);
-	horiz_splitter->setStretchFactor (horiz_splitter->indexOf (vbox), 1);
-
 	tool_window_bars[KMultiTabBar::Top] = new RKToolWindowBar (KMultiTabBar::Top, vbox);
 	vert_splitter = new QSplitter (Qt::Vertical, vbox);
 	vert_splitter->setOpaqueResize (KGlobalSettings::opaqueResize ());
-
 	tool_window_bars[KMultiTabBar::Top]->setSplitter (vert_splitter);
-	wview = new RKWorkplaceView (vert_splitter);
 
-	vert_splitter->setCollapsible (vert_splitter->indexOf (wview), false);
-	vert_splitter->setStretchFactor(vert_splitter->indexOf (wview), 1);
+	KHBox *hbox = new KHBox (vert_splitter);
+	vert_splitter->setCollapsible (vert_splitter->indexOf (hbox), false);
+	vert_splitter->setStretchFactor (vert_splitter->indexOf (hbox), 1);
 
+	tool_window_bars[KMultiTabBar::Left] = new RKToolWindowBar (KMultiTabBar::Left, hbox);
+	horiz_splitter = new QSplitter (Qt::Horizontal, hbox);
+	horiz_splitter->setOpaqueResize (KGlobalSettings::opaqueResize ());
+	tool_window_bars[KMultiTabBar::Left]->setSplitter (horiz_splitter);
+
+	wview = new RKWorkplaceView (horiz_splitter);
+	horiz_splitter->setCollapsible (horiz_splitter->indexOf (wview), false);
+	horiz_splitter->setStretchFactor(horiz_splitter->indexOf (wview), 1);
+
 	tool_window_bars[KMultiTabBar::Bottom] = new RKToolWindowBar (KMultiTabBar::Bottom, vbox);
 	tool_window_bars[KMultiTabBar::Bottom]->setSplitter (vert_splitter);
 
@@ -91,7 +89,7 @@
 
 	// now add it all to this widget
 	QVBoxLayout *box = new QVBoxLayout (this);
-	box->addWidget (hbox);
+	box->addWidget (vbox);
 
 	history = new RKMDIWindowHistory (this);
 }
@@ -117,11 +115,13 @@
 
 	// all the rest is done, even if the window was previously "Attached", as this may also mean it was freshly created
 	window->state = RKMDIWindow::Attached;
-	if (!window->isToolWindow ()) {
+	if (window->isToolWindow ()) {
+		window->tool_window_bar->reclaimDetached (window);
+	} else {
 		view ()->addPage (window);
+		view ()->topLevelWidget ()->raise ();
+		view ()->topLevelWidget ()->setActiveWindow ();
 	}
-	view()->topLevelWidget ()->raise ();
-	view()->topLevelWidget ()->setActiveWindow ();
 
 	RK_ASSERT (window->getPart ());
 	RKWardMainWindow::getMain ()->partManager ()->addPart (window->getPart ());
@@ -158,16 +158,13 @@
 void RKWorkplace::placeInToolWindowBar (RKMDIWindow *window, KMultiTabBar::KMultiTabBarPosition position) {
 	RK_TRACE (APP);
 
+	RK_ASSERT (window->isToolWindow ());
 	tool_window_bars[position]->addWidget (window);
+	if (windows.find (window) == windows.end ()) {	// must be new
+		addWindow (window, true);
+	}
 }
 
-void RKWorkplace::registerToolWindow (RKMDIWindow *window) {
-	RK_TRACE (APP);
-
-	RK_ASSERT (window->isToolWindow ());
-	addWindow (window, true);
-}
-
 bool RKWorkplace::openScriptEditor (const KUrl &url, bool use_r_highlighting, bool read_only, const QString &force_caption) {
 	RK_TRACE (APP);
 

Modified: branches/KDE4_port/rkward/windows/rkworkplace.h
===================================================================
--- branches/KDE4_port/rkward/windows/rkworkplace.h	2007-10-16 00:11:44 UTC (rev 2077)
+++ branches/KDE4_port/rkward/windows/rkworkplace.h	2007-10-16 09:19:11 UTC (rev 2078)
@@ -153,7 +153,6 @@
 @returns a pointer to the workplace */
 	static RKWorkplace *mainWorkplace () { return main_workplace; };
 	void placeInToolWindowBar (RKMDIWindow *window, KMultiTabBar::KMultiTabBarPosition position);
-	void registerToolWindow (RKMDIWindow *window);
 signals:
 /** TODO: For future expansion. This signal is neither emitted nor used so far. It could be used to deactivate some options in the "Window" menu. Or maybe it can be removed? */
 	void lastWindowClosed ();


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the rkward-tracker mailing list