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

tfry at users.sourceforge.net tfry at users.sourceforge.net
Fri Nov 24 14:38:25 UTC 2006


Revision: 932
          http://svn.sourceforge.net/rkward/?rev=932&view=rev
Author:   tfry
Date:     2006-11-24 06:38:24 -0800 (Fri, 24 Nov 2006)

Log Message:
-----------
do not open the same script url twice

Modified Paths:
--------------
    trunk/rkward/ChangeLog
    trunk/rkward/rkward/windows/rkcommandeditorwindow.cpp
    trunk/rkward/rkward/windows/rkcommandeditorwindow.h
    trunk/rkward/rkward/windows/rkworkplace.cpp

Modified: trunk/rkward/ChangeLog
===================================================================
--- trunk/rkward/ChangeLog	2006-11-24 14:01:26 UTC (rev 931)
+++ trunk/rkward/ChangeLog	2006-11-24 14:38:24 UTC (rev 932)
@@ -1,3 +1,4 @@
+- do not open the same script url twice (instead the corresponding window is raised on the second attempt)
 - fixed: when closing a detached script editor window, you would not be asked to save changes (if any)
 - fixed: occasional crash when re-attaching a script editor window
 - new translation: Greek

Modified: trunk/rkward/rkward/windows/rkcommandeditorwindow.cpp
===================================================================
--- trunk/rkward/rkward/windows/rkcommandeditorwindow.cpp	2006-11-24 14:01:26 UTC (rev 931)
+++ trunk/rkward/rkward/windows/rkcommandeditorwindow.cpp	2006-11-24 14:38:24 UTC (rev 932)
@@ -174,6 +174,13 @@
 	return false;
 }
 
+KURL RKCommandEditorWindow::url () {
+	RK_TRACE (COMMANDEDITOR);
+
+	return (m_doc->url ());
+}
+
+
 bool RKCommandEditorWindow::isModified() {
 	RK_TRACE (COMMANDEDITOR);
 	return m_doc->isModified();

Modified: trunk/rkward/rkward/windows/rkcommandeditorwindow.h
===================================================================
--- trunk/rkward/rkward/windows/rkcommandeditorwindow.h	2006-11-24 14:01:26 UTC (rev 931)
+++ trunk/rkward/rkward/windows/rkcommandeditorwindow.h	2006-11-24 14:38:24 UTC (rev 932)
@@ -109,6 +109,9 @@
 	QString getRDescription ();
 	KParts::Part *getPart () { return m_doc; };
 
+/** Return current url */
+	KURL url ();
+
 	bool provideContext (unsigned int line_rev, QString *context, int *cursor_position);
 public slots:
 /** update Tab caption according to the current url. Display the filename-component of the URL, or - if not available - a more elaborate description of the url. Also appends a "[modified]" if approriate */

Modified: trunk/rkward/rkward/windows/rkworkplace.cpp
===================================================================
--- trunk/rkward/rkward/windows/rkworkplace.cpp	2006-11-24 14:01:26 UTC (rev 931)
+++ trunk/rkward/rkward/windows/rkworkplace.cpp	2006-11-24 14:38:24 UTC (rev 932)
@@ -95,6 +95,20 @@
 bool RKWorkplace::openScriptEditor (const KURL &url, bool use_r_highlighting, bool read_only, const QString &force_caption) {
 	RK_TRACE (APP);
 
+// is this url already opened?
+	if (!url.isEmpty ()) {
+		for (RKWorkplaceObjectList::const_iterator it = windows.constBegin (); it != windows.constEnd (); ++it) {
+			if ((*it)->type == RKMDIWindow::CommandEditorWindow) {
+				KURL ourl = static_cast<RKCommandEditorWindow *> (*it)->url ();
+				if (url.equals (ourl, true)) {
+					(*it)->topLevelWidget ()->raise ();
+					if ((*it)->isAttached ()) view ()->setActivePage (*it);
+					return true;
+				}
+			}
+		}
+	}
+
 	RKCommandEditorWindow *editor = new RKCommandEditorWindow (view (), use_r_highlighting);
 
 	if (!url.isEmpty ()) {
@@ -188,8 +202,8 @@
 		if (existing_editor->isAttached ()) {
 			view ()->setActivePage (existing_editor);
 		} else {
-			object->getContainer ()->objectOpened ()->show ();
-			object->getContainer ()->objectOpened ()->raise ();
+			existing_editor->topLevelWidget ()->show ();
+			existing_editor->topLevelWidget ()->raise ();
 		}
 	}
 	


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