[rkward-cvs] SF.net SVN: rkward: [1854] trunk/rkward/rkward/windows

tfry at users.sourceforge.net tfry at users.sourceforge.net
Thu Apr 26 20:52:58 UTC 2007


Revision: 1854
          http://svn.sourceforge.net/rkward/?rev=1854&view=rev
Author:   tfry
Date:     2007-04-26 13:52:58 -0700 (Thu, 26 Apr 2007)

Log Message:
-----------
Add a file browser tool window. This is utterly useless, so far.

Modified Paths:
--------------
    trunk/rkward/rkward/windows/Makefile.am
    trunk/rkward/rkward/windows/rkmdiwindow.cpp
    trunk/rkward/rkward/windows/rkmdiwindow.h

Added Paths:
-----------
    trunk/rkward/rkward/windows/rkfilebrowser.cpp
    trunk/rkward/rkward/windows/rkfilebrowser.h

Modified: trunk/rkward/rkward/windows/Makefile.am
===================================================================
--- trunk/rkward/rkward/windows/Makefile.am	2007-04-26 10:11:17 UTC (rev 1853)
+++ trunk/rkward/rkward/windows/Makefile.am	2007-04-26 20:52:58 UTC (rev 1854)
@@ -4,11 +4,11 @@
 noinst_HEADERS = rkcommandeditorwindow.h rkcommandeditorwindowpart.h \
 	rkhtmlwindow.h rcontrolwindow.h detachedwindowcontainer.h rkmdiwindow.h \
 	rkworkplaceview.h rkworkplace.h qxembedcopy.h rkwindowcatcher.h rkcommandlog.h \
-	rkhelpsearchwindow.h rktoplevelwindowgui.h
+	rkhelpsearchwindow.h rktoplevelwindowgui.h rkfilebrowser.h
 libwindows_a_SOURCES = rkcommandeditorwindow.cpp rkcommandeditorwindowpart.cpp \
 	rkhtmlwindow.cpp rcontrolwindow.cpp detachedwindowcontainer.cpp rkmdiwindow.cpp \
 	rkworkplaceview.cpp rkworkplace.cpp qxembedcopy.cpp rkwindowcatcher.cpp rkcommandlog.cpp \
-	rkhelpsearchwindow.cpp rktoplevelwindowgui.cpp
+	rkhelpsearchwindow.cpp rktoplevelwindowgui.cpp rkfilebrowser.cpp
 rcdir = $(kde_datadir)/rkward
 rc_DATA = rkcommandeditorwindowpart.rc rkoutputwindow.rc rkhelpwindow.rc detachedwindowcontainer.rc \
 	rkcatchedx11windowpart.rc rkcommandlogpart.rc rktoplevelwindowgui.rc

Added: trunk/rkward/rkward/windows/rkfilebrowser.cpp
===================================================================
--- trunk/rkward/rkward/windows/rkfilebrowser.cpp	                        (rev 0)
+++ trunk/rkward/rkward/windows/rkfilebrowser.cpp	2007-04-26 20:52:58 UTC (rev 1854)
@@ -0,0 +1,79 @@
+/***************************************************************************
+                          rkfilebrowser  -  description
+                             -------------------
+    begin                : Thu Apr 26 2007
+    copyright            : (C) 2007 by Thomas Friedrichsmeier
+    email                : tfry at users.sourceforge.net
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+
+#include "rkfilebrowser.h"
+
+#include <kdiroperator.h>
+
+#include <qdir.h>
+#include <qlayout.h>
+#include <qvbox.h>
+
+#include "../misc/rkdummypart.h"
+
+#include "../debug.h"
+
+RKFileBrowser::RKFileBrowser (QWidget *parent, bool tool_window, char *name) : RKMDIWindow (parent, FileBrowserWindow, tool_window, name) {
+	RK_TRACE (APP);
+
+	real_widget = 0;
+
+	QVBoxLayout *layout = new QVBoxLayout (this);
+	wrapper = new QVBox (this);
+	wrapper->setFocusPolicy (QWidget::StrongFocus);
+	layout->addWidget (wrapper);
+
+	RKDummyPart *part = new RKDummyPart (this, wrapper);
+	setPart (part);
+	initializeActivationSignals ();
+}
+
+RKFileBrowser::~RKFileBrowser () {
+	RK_TRACE (APP);
+
+	hide ();
+}
+
+void RKFileBrowser::hide () {
+	RK_TRACE (APP);
+
+	if (real_widget) {
+		real_widget->close (false);
+	}
+}
+
+void RKFileBrowser::show () {
+	RK_TRACE (APP);
+
+	if (!real_widget) {
+		RK_DO (qDebug ("creating file browser"), APP, DL_INFO);
+
+		real_widget = new KDirOperator (QDir::currentDirPath (), wrapper);
+		real_widget->setView(KFile::Default);
+		real_widget->setPreviewWidget (0);
+		wrapper->setFocusProxy (real_widget);
+	}
+
+	real_widget->show ();
+	RKMDIWindow::show ();
+}
+
+void RKFileBrowser::currentWDChanged () {
+	RK_TRACE (APP);
+}
+
+#include "rkfilebrowser.moc"

Added: trunk/rkward/rkward/windows/rkfilebrowser.h
===================================================================
--- trunk/rkward/rkward/windows/rkfilebrowser.h	                        (rev 0)
+++ trunk/rkward/rkward/windows/rkfilebrowser.h	2007-04-26 20:52:58 UTC (rev 1854)
@@ -0,0 +1,43 @@
+/***************************************************************************
+                          rkfilebrowser  -  description
+                             -------------------
+    begin                : Thu Apr 26 2007
+    copyright            : (C) 2007 by Thomas Friedrichsmeier
+    email                : tfry at users.sourceforge.net
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+
+#ifndef RKFILEBROWSER_H
+#define RKFILEBROWSER_H
+
+#include "rkmdiwindow.h"
+
+class KDirOperator;
+class QVBox;
+
+class RKFileBrowser : public RKMDIWindow {
+	Q_OBJECT
+public:
+	RKFileBrowser (QWidget *parent, bool tool_window, char *name=0);
+	~RKFileBrowser ();
+
+/** reimplemented to create the real file browser widget only when the file browser is shown for the first time */
+	void show ();
+/** reimplemented to call close on the browser widget */
+	void hide ();
+public slots:
+	void currentWDChanged ();
+private:
+	KDirOperator *real_widget;
+	QVBox *wrapper;
+};
+
+#endif

Modified: trunk/rkward/rkward/windows/rkmdiwindow.cpp
===================================================================
--- trunk/rkward/rkward/windows/rkmdiwindow.cpp	2007-04-26 10:11:17 UTC (rev 1853)
+++ trunk/rkward/rkward/windows/rkmdiwindow.cpp	2007-04-26 20:52:58 UTC (rev 1854)
@@ -28,11 +28,15 @@
 
 #include "../debug.h"
 
-RKMDIWindow::RKMDIWindow (QWidget *parent, Type type, bool tool_window, char *name) : QFrame (parent, name) {
+RKMDIWindow::RKMDIWindow (QWidget *parent, int type, bool tool_window, char *name) : QFrame (parent, name) {
 	RK_TRACE (APP);
 
+	if (tool_window) {
+		type |= ToolWindow;
+	} else {
+		type |= DocumentWindow;
+	}
 	RKMDIWindow::type = type;
-	if (tool_window) RK_ASSERT (type & ToolWindow);
 	state = Attached;
 	wrapper = 0;
 	part = 0;

Modified: trunk/rkward/rkward/windows/rkmdiwindow.h
===================================================================
--- trunk/rkward/rkward/windows/rkmdiwindow.h	2007-04-26 10:11:17 UTC (rev 1853)
+++ trunk/rkward/rkward/windows/rkmdiwindow.h	2007-04-26 20:52:58 UTC (rev 1854)
@@ -40,9 +40,11 @@
 		WorkspaceBrowserWindow=128,
 		SearchHelpWindow=256,
 		PendingJobsWindow=512,
-		DocumentWindow = DataEditorWindow | CommandEditorWindow | OutputWindow | HelpWindow,
-		ToolWindow = ConsoleWindow | CommandLogWindow | WorkspaceBrowserWindow | SearchHelpWindow | PendingJobsWindow,
-		AnyType= DocumentWindow | ToolWindow
+		FileBrowserWindow=1024,
+
+		DocumentWindow=2048,
+		ToolWindow=4096,
+		AnyType=DocumentWindow | ToolWindow
 	};
 
 	enum State {
@@ -53,8 +55,8 @@
 protected:
 /** constructor
 @param parent parent widget
- at param type Type of window */
-	RKMDIWindow (QWidget *parent, Type type, bool tool_window=false, char *name=0);
+ at param type Type of window (see RKMDIWindow::Type).*/
+	RKMDIWindow (QWidget *parent, int type, bool tool_window=false, char *name=0);
 	virtual ~RKMDIWindow ();
 public:
 /** @returns true, if the window's document was modified (and would need to be saved) */
@@ -77,7 +79,7 @@
 	bool isToolWindow () { return (type & ToolWindow); };
 /** Activate (raise) this window, regardless of whether it is attached or detached
 @param with_focus Should the window also get keyboard focus? */
-	void activate (bool with_focus=true);
+	virtual void activate (bool with_focus=true);
 /** If your mdi window should perform any adjustments before being attached, reimplement this function. Default implementation does nothing, but raises an assert, if this is a tool window */
 	virtual void prepareToBeAttached ();
 /** If your mdi window should perform any adjustments before being detached, reimplement this function. Default implementation does nothing, but raises an assert, if this is a tool window */
@@ -103,7 +105,7 @@
 	void windowActivationChange (bool);
 friend class RKWorkplace;
 /** type of this window */
-	Type type;
+	int type;
 private:
 /** state of this window (attached / detached). This is usually set from the RKWorkplace */
 	KParts::Part *part;


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