[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdelibs/kparts/tests
From: David Faure <faure () kde ! org>
Date: 2009-08-21 0:20:27
Message-ID: 1250814027.480068.6468.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1013868 by dfaure:
Ported the old testcase from bug 70459 to kde4; seems to work fine, the bug is fixed.
(was "shortcuts of actions inside a KActionMenu stop working after activating another part and back")
Ingo: if the workaround from comment 10 is still there in kmail, it can be removed :)
BUG: 70459
M +1 -0 kpartstest_part1.rc
A kpartstest_part2.rc
M +30 -3 parts.cpp
M +4 -0 parts.h
--- trunk/KDE/kdelibs/kparts/tests/kpartstest_part1.rc #1013867:1013868
@@ -6,6 +6,7 @@
</Menu>
<Menu name="Part1Menu"><text>Part1's Menu</text>
<Action name="p1_blah"/>
+ <Action name="p1_foo"/>
<Menu name="Part1Sub"><text>Stupid Submenu</text>
<Action name="p1_blah"/>
</Menu>
--- trunk/KDE/kdelibs/kparts/tests/parts.cpp #1013867:1013868
@@ -2,6 +2,7 @@
#include <kparts/event.h>
#include "parts.h"
+#include <kactionmenu.h>
#include <kactioncollection.h>
#include <QtGui/QCheckBox>
@@ -21,7 +22,7 @@
Part1::Part1( QObject *parent, QWidget * parentWidget )
: KParts::ReadOnlyPart(parent),
- m_componentData("kpartstestpart")
+ m_componentData("kpartstestpart")
{
setComponentData(m_componentData, false);
m_edit = new QTextEdit( parentWidget );
@@ -32,9 +33,22 @@
m_componentData.dirs()->addResourceDir( "data", KDESRCDIR );
setXMLFile( "kpartstest_part1.rc" );
+ // An action and an action menu (test code for #70459)
+
KAction* testAction = actionCollection()->addAction("p1_blah");
testAction->setText("Part1's action");
+ testAction->setShortcut(Qt::CTRL + Qt::Key_B);
+ connect(testAction, SIGNAL(triggered()), this, SLOT(slotBlah()));
+ KActionMenu * menu = new KActionMenu(KIcon("mail_forward"), "Foo", this);
+ actionCollection()->addAction("p1_foo", menu);
+
+ KAction* mailForward = new KAction(KIcon("mail_forward"), "Bar", this);
+ mailForward->setShortcut(Qt::CTRL + Qt::Key_F);
+ connect(mailForward, SIGNAL(triggered()), this, SLOT(slotFooBar()));
+ actionCollection()->addAction("p1_foo_bar", mailForward);
+ menu->addAction(mailForward);
+
loadPlugins();
}
@@ -42,6 +56,16 @@
{
}
+void Part1::slotBlah()
+{
+ m_edit->setText( "Blah" );
+}
+
+void Part1::slotFooBar()
+{
+ m_edit->setText( "FooBar" );
+}
+
bool Part1::openFile()
{
kDebug() << "Part1: opening " << QFile::encodeName(localFilePath());
@@ -72,10 +96,13 @@
w->setObjectName( "Part2Widget" );
setWidget( w );
+ m_componentData.dirs()->addResourceDir( "data", KDESRCDIR );
+ setXMLFile( "kpartstest_part2.rc" );
+
/*QCheckBox * cb =*/ new QCheckBox( "something", w );
- QLineEdit * l = new QLineEdit( "something", widget() );
- l->move(0,50);
+ //QLineEdit * l = new QLineEdit( "something", widget() );
+ //l->move(0,50);
// Since the main widget is a dummy one, we HAVE to set
// strong focus for it, otherwise we get the
// the famous activating-file-menu-switches-part bug.
--- trunk/KDE/kdelibs/kparts/tests/parts.h #1013867:1013868
@@ -17,6 +17,10 @@
Part1( QObject *parent, QWidget * parentWidget );
virtual ~Part1();
+public slots:
+ void slotBlah();
+ void slotFooBar();
+
protected:
virtual bool openFile();
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic