summaryrefslogtreecommitdiffstats
path: root/xparts/xpart_notepad/shell_xparthost.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
commit90825e2392b2d70e43c7a25b8a3752299a933894 (patch)
treee33aa27f02b74604afbfd0ea4f1cfca8833d882a /xparts/xpart_notepad/shell_xparthost.cpp
downloadtdebindings-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/xpart_notepad/shell_xparthost.cpp')
-rw-r--r--xparts/xpart_notepad/shell_xparthost.cpp80
1 files changed, 80 insertions, 0 deletions
diff --git a/xparts/xpart_notepad/shell_xparthost.cpp b/xparts/xpart_notepad/shell_xparthost.cpp
new file mode 100644
index 00000000..bd6a9418
--- /dev/null
+++ b/xparts/xpart_notepad/shell_xparthost.cpp
@@ -0,0 +1,80 @@
+
+#include "xparthost_kpart.h"
+#include "shell_xparthost.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>
+
+ShellWindow::ShellWindow()
+ : KParts::MainWindow()
+{
+ m_host = new XPartHost_KPart( this, 0, this, "parthost" );
+
+ setCentralWidget( m_host->widget() );
+
+ connect(m_host, SIGNAL( actionsInitialized() ), this, SLOT( mergeGUI() ) );
+
+ // Launch our XPart child.
+ m_partProcess = new KProcess;
+ *m_partProcess << "./xp_notepad"
+ << kapp->dcopClient()->appId() << m_host->objId();
+ m_partProcess->start();
+
+ // Init our Gui
+ (void) new KAction( "Hop", 0, this, SLOT(hop()), actionCollection(), "hop" );
+ 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);
+
+ kdDebug() << "KShell window created" << endl;
+}
+
+ShellWindow::~ShellWindow()
+{
+ delete m_partProcess;
+}
+
+void ShellWindow::hop()
+{
+ kdDebug() << "hop called!" << endl;
+}
+
+void ShellWindow::slotOpenUrl( const QString &url )
+{
+ kdDebug() << "this=" << this;
+ kdDebug() << "url=" << url << endl;
+ m_host->openURL(url.latin1());
+}
+
+void ShellWindow::mergeGUI()
+{
+ qDebug("initGUI");
+ setXMLFile("shell_xparthost.rc");
+ createGUI( m_host );
+ m_host->widget()->setFocus();
+ kdDebug() << "focus set to embedded widget" << endl;
+}
+
+int main( int argc, char **argv )
+{
+ KApplication app( argc, argv, "xparthost_shell" );
+
+ app.dcopClient()->registerAs("xparthost_shell");
+
+ ShellWindow *w = new ShellWindow;
+ w->resize(500, 500);
+ w->show();
+
+ return app.exec();
+}
+
+#include "shell_xparthost.moc"