You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
65 lines
1.8 KiB
65 lines
1.8 KiB
15 years ago
|
#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>
|
||
15 years ago
|
#include <tqlineedit.h>
|
||
|
#include <tqdir.h>
|
||
15 years ago
|
|
||
|
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
|
||
15 years ago
|
KGlobal::dirs()->addResourceDir( "data", TQDir::currentDirPath() );
|
||
15 years ago
|
|
||
|
KMainWindow *mainwindow = new KMainWindow;
|
||
|
|
||
15 years ago
|
TQLineEdit* line = new TQLineEdit( mainwindow );
|
||
15 years ago
|
mainwindow->setCentralWidget( line );
|
||
|
|
||
|
mainwindow->show();
|
||
|
|
||
|
KXMLGUIBuilder *builder = new KXMLGUIBuilder( mainwindow );
|
||
|
|
||
|
KXMLGUIFactory *factory = new KXMLGUIFactory( builder );
|
||
|
|
||
|
Client *shell = new Client;
|
||
|
shell->setInstance( new KInstance( "konqueror" ) );
|
||
15 years ago
|
shell->instance()->dirs()->addResourceDir( "data", TQDir::currentDirPath() );
|
||
15 years ago
|
|
||
|
(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" );
|
||
15 years ago
|
(void)new KAction( "sec", "unlock", Qt::ALT + Qt::Key_1, part, TQT_SLOT( slotSec() ), part->actionCollection(), "security" );
|
||
15 years ago
|
|
||
|
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"
|