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

tfry at users.sourceforge.net tfry at users.sourceforge.net
Tue Oct 16 14:06:55 UTC 2007


Revision: 2083
          http://rkward.svn.sourceforge.net/rkward/?rev=2083&view=rev
Author:   tfry
Date:     2007-10-16 07:06:54 -0700 (Tue, 16 Oct 2007)

Log Message:
-----------
some cleanups

Modified Paths:
--------------
    branches/KDE4_port/rkward/rkconsole.cpp
    branches/KDE4_port/rkward/rkconsole.h
    branches/KDE4_port/version.h

Modified: branches/KDE4_port/rkward/rkconsole.cpp
===================================================================
--- branches/KDE4_port/rkward/rkconsole.cpp	2007-10-16 13:33:16 UTC (rev 2082)
+++ branches/KDE4_port/rkward/rkconsole.cpp	2007-10-16 14:06:54 UTC (rev 2083)
@@ -24,11 +24,10 @@
 #include <qobject.h>
 #include <qevent.h>
 #include <qtimer.h>
-//Added by qt3to4:
+#include <QMenu>
 #include <QKeyEvent>
-#include <Q3PopupMenu>
 #include <QMouseEvent>
-#include <Q3VBoxLayout>
+#include <QVBoxLayout>
 
 #include <klocale.h>
 #include <kaction.h>
@@ -61,7 +60,8 @@
 RKConsole::RKConsole (QWidget *parent, bool tool_window, const char *name) : RKMDIWindow (parent, RKMDIWindow::ConsoleWindow, tool_window, name) {
 	RK_TRACE (APP);
 
-	Q3VBoxLayout *layout = new Q3VBoxLayout (this);
+	QVBoxLayout *layout = new QVBoxLayout (this);
+	layout->setContentsMargins (0, 0, 0, 0);
 
 	// create a Kate-part as command-editor
 	KTextEditor::Editor* editor = KTextEditor::editor("katepart");
@@ -325,7 +325,7 @@
 		// do all entries have a common start?
 		QString common;
 		bool done = false;
-		unsigned int i = 0;
+		int i = 0;
 		while (!done) {
 			bool ok = true;
 			QChar current;
@@ -427,10 +427,11 @@
 	if (e->type () == QEvent::KeyPress) {
 		QKeyEvent *k = (QKeyEvent *)e;
 		return handleKeyPress (k);
-	} else if (e->type () == QEvent::MouseButtonPress){
+	} else if (e->type () == QEvent::MouseButtonPress) {
+		// we seem to need this, as the kateview will swallow the contextMenuEvent, otherwise
 		QMouseEvent *m = (QMouseEvent *)e;
 		if (m->button() == Qt::RightButton) {
-			doPopupMenu (m->globalPos ());
+			qApp->sendEvent (this, new QContextMenuEvent (QContextMenuEvent::Other, m->globalPos ()));
 			return (true);
 		}
 	} else if (e->type () == QEvent::MouseButtonRelease){
@@ -858,14 +859,14 @@
 	}
 }
 
-void RKConsole::doPopupMenu (const QPoint &pos) {
+void RKConsole::contextMenuEvent (QContextMenuEvent * event) {
 	RK_TRACE (APP);
 
 	copy_action->setEnabled (view->selection ());
 	copy_literal_action->setEnabled (view->selection ());
 	run_selection_action->setEnabled (view->selection ());
 
-	console_part->showPopupMenu (pos);
+	console_part->showPopupMenu (event->pos ());
 
 	run_selection_action->setEnabled (true);
 	copy_literal_action->setEnabled (true);
@@ -893,7 +894,7 @@
 void RKConsolePart::showPopupMenu (const QPoint &pos) {
 	RK_TRACE (APP);
 
-	Q3PopupMenu *menu = static_cast<Q3PopupMenu *> (factory ()->container ("rkconsole_context_menu", this));
+	QMenu *menu = static_cast<QMenu *> (factory ()->container ("rkconsole_context_menu", this));
 
 	if (!menu) {
 		RK_ASSERT (false);

Modified: branches/KDE4_port/rkward/rkconsole.h
===================================================================
--- branches/KDE4_port/rkward/rkconsole.h	2007-10-16 13:33:16 UTC (rev 2082)
+++ branches/KDE4_port/rkward/rkconsole.h	2007-10-16 14:06:54 UTC (rev 2083)
@@ -87,6 +87,8 @@
 	void rCommandDone (RCommand *command);
 /** reimplemented from RCommandReceiver::newOutput () to handle output of console commands */
 	void newOutput (RCommand *command, ROutput *output);
+/** reimplemented from QWidget to show the context menu */
+	void contextMenuEvent (QContextMenuEvent * event);
 private:
 friend class RKConsolePart;
 	bool eventFilter (QObject *o, QEvent *e);
@@ -166,8 +168,6 @@
 	bool command_was_piped;
 
 	RKConsolePart *console_part;
-
-	void doPopupMenu (const QPoint &pos);
 public slots:
 /** We intercept paste commands and get them executed through submitBatch.
 @sa submitBatch */

Modified: branches/KDE4_port/version.h
===================================================================
--- branches/KDE4_port/version.h	2007-10-16 13:33:16 UTC (rev 2082)
+++ branches/KDE4_port/version.h	2007-10-16 14:06:54 UTC (rev 2083)
@@ -1,4 +1,2 @@
-/* TODO: rename to version.h */
-
 /* Version number of package */
-#define VERSION "0.4.9pre1"
+#define VERSION "0.5.0pre1"


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