diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | 90825e2392b2d70e43c7a25b8a3752299a933894 (patch) | |
tree | e33aa27f02b74604afbfd0ea4f1cfca8833d882a /xparts/mozilla/kshell.cpp | |
download | tdebindings-90825e2392b2d70e43c7a25b8a3752299a933894.tar.gz tdebindings-90825e2392b2d70e43c7a25b8a3752299a933894.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/kdebindings@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'xparts/mozilla/kshell.cpp')
-rw-r--r-- | xparts/mozilla/kshell.cpp | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/xparts/mozilla/kshell.cpp b/xparts/mozilla/kshell.cpp new file mode 100644 index 00000000..4f012dbb --- /dev/null +++ b/xparts/mozilla/kshell.cpp @@ -0,0 +1,76 @@ + +#include "xparthost_kpart.h" + +#include <dcopclient.h> +#include <dcopobject.h> +#include <kapplication.h> +#include <kstdaction.h> +#include <kaction.h> +#include <kmainwindow.h> +#include <kprocess.h> +#include <kparts/mainwindow.h> +#include <kdebug.h> + +class ShellWindow : public KParts::MainWindow +{ + Q_OBJECT + +public: + ShellWindow() + { + m_host = new XPartHost_KPart( this, "parthost" ); + + setCentralWidget( m_host->widget() ); + + connect(m_host, SIGNAL( actionsInitialized() ), this, SLOT( mergeGUI() ) ); + +#if 1 + m_partProcess = new KProcess; + *m_partProcess << "./kmozilla" + << kapp->dcopClient()->appId() << m_host->objId(); + m_partProcess->start(); +#endif + + KStdAction::quit( this, SLOT( close() ), actionCollection() ); + KSelectAction *s = new KSelectAction( "http://www.kde.org" , 0, + actionCollection(), "location" ); + connect( s, SIGNAL(activated( const QString& ) ), this, SLOT( slotOpenUrl( const QString & ) ) ); + s->setEditable(true); + } + virtual ~ShellWindow() + { + delete m_partProcess; + } +public slots: + void slotOpenUrl( const QString &url ) + { + kdDebug() << "this=" << this; + kdDebug() << "url=" << url << endl; + m_host->openURL(url.latin1()); + } + void mergeGUI() + { + qDebug("initGUI"); + setXMLFile("/home/lars/kmozilla/kmozilla/parthost.rc"); + createGUI( m_host ); + } + +private: + XPartHost_KPart *m_host; + KProcess *m_partProcess; +}; + +int main( int argc, char **argv ) +{ + KApplication app( argc, argv, "xkpartsshell" ); + + app.dcopClient()->registerAs("kshell"); + + ShellWindow *w = new ShellWindow; + w->resize(500, 500); + w->show(); + + return app.exec(); +} + +#include "kshell.moc" |