summaryrefslogtreecommitdiffstats
path: root/kdeui/tests/kxmlguitest.cpp
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commitce4a32fe52ef09d8f5ff1dd22c001110902b60a2 (patch)
tree5ac38a06f3dde268dc7927dc155896926aaf7012 /kdeui/tests/kxmlguitest.cpp
downloadtdelibs-ce4a32fe52ef09d8f5ff1dd22c001110902b60a2.tar.gz
tdelibs-ce4a32fe52ef09d8f5ff1dd22c001110902b60a2.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kdeui/tests/kxmlguitest.cpp')
-rw-r--r--kdeui/tests/kxmlguitest.cpp64
1 files changed, 64 insertions, 0 deletions
diff --git a/kdeui/tests/kxmlguitest.cpp b/kdeui/tests/kxmlguitest.cpp
new file mode 100644
index 000000000..949eb03c4
--- /dev/null
+++ b/kdeui/tests/kxmlguitest.cpp
@@ -0,0 +1,64 @@
+#include "kxmlguitest.h"
+#include <kapplication.h>
+#include <kmainwindow.h>
+#include <kxmlguifactory.h>
+#include <kxmlguiclient.h>
+#include <kxmlguibuilder.h>
+#include <kaction.h>
+#include <kdebug.h>
+#include <kstdaction.h>
+#include <kstandarddirs.h>
+#include <qlineedit.h>
+#include <qdir.h>
+
+void Client::slotSec()
+{
+ kdDebug() << "Client::slotSec()" << endl;
+}
+
+int main( int argc, char **argv )
+{
+ KApplication app( argc, argv, "kxmlguitest" );
+
+ // KXMLGUIClient looks in the "data" resource for the .rc files
+ // Let's add $PWD (ideally $srcdir instead...) to it
+ KGlobal::dirs()->addResourceDir( "data", QDir::currentDirPath() );
+
+ KMainWindow *mainwindow = new KMainWindow;
+
+ QLineEdit* line = new QLineEdit( mainwindow );
+ mainwindow->setCentralWidget( line );
+
+ mainwindow->show();
+
+ KXMLGUIBuilder *builder = new KXMLGUIBuilder( mainwindow );
+
+ KXMLGUIFactory *factory = new KXMLGUIFactory( builder );
+
+ Client *shell = new Client;
+ shell->setInstance( new KInstance( "konqueror" ) );
+ shell->instance()->dirs()->addResourceDir( "data", QDir::currentDirPath() );
+
+ (void)new KAction( "Split", "view_left_right", 0, 0, 0, shell->actionCollection(), "splitviewh" );
+
+ shell->setXMLFile( "./kxmlguitest_shell.rc" );
+
+ factory->addClient( shell );
+
+ Client *part = new Client;
+
+ (void)new KAction( "decfont", "viewmag-", 0, 0, 0, part->actionCollection(), "decFontSizes" );
+ (void)new KAction( "sec", "unlock", Qt::ALT + Qt::Key_1, part, SLOT( slotSec() ), part->actionCollection(), "security" );
+
+ part->setXMLFile( "./kxmlguitest_part.rc" );
+
+ factory->addClient( part );
+ for ( int i = 0; i < 10; ++i )
+ {
+ factory->removeClient( part );
+ factory->addClient( part );
+ }
+
+ return app.exec();
+}
+#include "kxmlguitest.moc"