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

tfry at users.sourceforge.net tfry at users.sourceforge.net
Fri Sep 3 15:31:28 UTC 2010


Revision: 2991
          http://rkward.svn.sourceforge.net/rkward/?rev=2991&view=rev
Author:   tfry
Date:     2010-09-03 15:31:28 +0000 (Fri, 03 Sep 2010)

Log Message:
-----------
Use MovingInterface, instead of SmartInterface for KDE 4.5 and above

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

Modified: trunk/rkward/ChangeLog
===================================================================
--- trunk/rkward/ChangeLog	2010-09-03 15:27:56 UTC (rev 2990)
+++ trunk/rkward/ChangeLog	2010-09-03 15:31:28 UTC (rev 2991)
@@ -4,7 +4,7 @@
 - New functions rk.show.message() and rk.show.question() for user interaction from R code
 - New options for scripting GUI logic in plugins		TODO: document, merge common functionality of common.js and rkcomponentscriptiong.js, error handling
 - The current object of an active data editor can be referenced in plugins		TODO: document
-- Fixed: Placement of several menu items was broken - again - with KDE 4.4 and above
+- Fixed: Placement of several menu items was broken - again - with KDE 4.4 and above		TODO: check again, seems bad in 4.4.4
 - Allow sorting of results in help search window
 - Fixed: CPU usage would go to 100% for no good reason under certain circumstances
 - The save-object selector in plugins now allows to save as part of a data.frame / list

Modified: trunk/rkward/rkward/windows/rkcommandeditorwindow.cpp
===================================================================
--- trunk/rkward/rkward/windows/rkcommandeditorwindow.cpp	2010-09-03 15:27:56 UTC (rev 2990)
+++ trunk/rkward/rkward/windows/rkcommandeditorwindow.cpp	2010-09-03 15:31:28 UTC (rev 2991)
@@ -138,7 +138,11 @@
 		hinter = new RKFunctionArgHinter (this, m_view);
 	}
 
+#if KDE_IS_VERSION(4,5,0)
+	smart_iface = qobject_cast<KTextEditor::MovingInterface*> (m_doc);
+#else
 	smart_iface = qobject_cast<KTextEditor::SmartInterface*> (m_doc);
+#endif
 	initBlocks ();
 	RK_ASSERT (smart_iface);
 
@@ -252,6 +256,10 @@
 		record.run->setData (i);
 		actionmenu_run_block->addAction (record.run);
 
+		// these two not strictly needed due to removeBlock(), below. Silences a GCC warning, however.
+		record.range = 0;
+		record.active = false;
+
 		block_records.append (record);
 		removeBlock (i, true);	// initialize to empty
 	}
@@ -659,8 +667,13 @@
 	clearUnusedBlocks ();
 	removeBlock (index);
 
+#if KDE_IS_VERSION(4,5,0)
+	KTextEditor::MovingRange* srange = smart_iface->newMovingRange (range);
+	srange->setInsertBehaviors (KTextEditor::MovingRange::ExpandRight);
+#else
 	KTextEditor::SmartRange* srange = smart_iface->newSmartRange (range);
 	srange->setInsertBehavior (KTextEditor::SmartRange::ExpandRight);
+#endif
 
 	QString actiontext = i18n ("%1 (Active)", index + 1);
 	block_records[index].range = srange;
@@ -672,7 +685,9 @@
 	block_records[index].run->setText (actiontext);
 	block_records[index].run->setEnabled (true);
 
+#if !KDE_IS_VERSION(4,5,0)
 	smart_iface->addHighlightToView (m_view, srange);
+#endif
 }
 
 void RKCommandEditorWindow::removeBlock (int index, bool was_deleted) {
@@ -681,7 +696,9 @@
 	RK_ASSERT ((index >= 0) && (index < block_records.size ()));
 
 	if (!was_deleted) {
+#if !KDE_IS_VERSION(4,5,0)
 		smart_iface->removeHighlightFromView (m_view, block_records[index].range);
+#endif
 		delete (block_records[index].range);
 	}
 

Modified: trunk/rkward/rkward/windows/rkcommandeditorwindow.h
===================================================================
--- trunk/rkward/rkward/windows/rkcommandeditorwindow.h	2010-09-03 15:27:56 UTC (rev 2990)
+++ trunk/rkward/rkward/windows/rkcommandeditorwindow.h	2010-09-03 15:31:28 UTC (rev 2991)
@@ -22,12 +22,18 @@
 #include <QTimer>
 #include <QString>
 
+#include <kdeversion.h>
 #include <ktexteditor/view.h>
 #include <ktexteditor/document.h>
 #include <ktexteditor/codecompletionmodel.h>
 #include <ktexteditor/codecompletioninterface.h>
-#include <ktexteditor/smartrange.h>
-#include <ktexteditor/smartinterface.h>
+#if KDE_IS_VERSION(4,5,0)
+#	include <ktexteditor/movingrange.h>
+#	include <ktexteditor/movinginterface.h>
+#else
+#	include <ktexteditor/smartrange.h>
+#	include <ktexteditor/smartinterface.h>
+#endif
 #include <kurl.h>
 
 #include "../windows/rkmdiwindow.h"
@@ -212,7 +218,11 @@
 	KTextEditor::Document *m_doc;
 	KTextEditor::View *m_view;
 	KTextEditor::CodeCompletionInterface *cc_iface;
+#if KDE_IS_VERSION(4,5,0)
+	KTextEditor::MovingInterface *smart_iface;
+#else
 	KTextEditor::SmartInterface *smart_iface;
+#endif
 	RKFunctionArgHinter *hinter;
 	RKCodeCompletionModel *completion_model;
 
@@ -223,7 +233,11 @@
 	void initializeActions (KActionCollection* ac);
 
 	struct BlockRecord {
+#if KDE_IS_VERSION(4,5,0)
+		KTextEditor::MovingRange* range;
+#else
 		KTextEditor::SmartRange* range;
+#endif
 		bool active;
 		KTextEditor::Attribute::Ptr attribute;
 		KAction* mark;


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