From 114a878c64ce6f8223cfd22d76a20eb16d177e5e Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: 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/kdevelop@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- .../cpp/app_templates/kscons_kmdi/appkmdiView.cpp | 63 ++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 languages/cpp/app_templates/kscons_kmdi/appkmdiView.cpp (limited to 'languages/cpp/app_templates/kscons_kmdi/appkmdiView.cpp') diff --git a/languages/cpp/app_templates/kscons_kmdi/appkmdiView.cpp b/languages/cpp/app_templates/kscons_kmdi/appkmdiView.cpp new file mode 100644 index 00000000..c4cfbf65 --- /dev/null +++ b/languages/cpp/app_templates/kscons_kmdi/appkmdiView.cpp @@ -0,0 +1,63 @@ +%{CPP_TEMPLATE} + +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "%{APPNAMELC}kmdiView.h" + + + %{APPNAMELC}kmdiView::%{APPNAMELC}kmdiView( QWidget *parentWidget, const char *name ) +: KMdiChildView( parentWidget, name ) +{ + m_part = NULL; + + // this routine will find and load our Part. it finds the Part by + // name which is a bad idea usually.. but it's alright in this + // case since our Part is made for this Shell + KLibFactory *factory = KLibLoader::self()->factory("lib%{APPNAMELC}part"); + //KLibFactory *factory = KLibLoader::self()->factory("libkatepart"); + if (factory) + { + // now that the Part is loaded, we cast it to a Part to get + // our hands on it + m_part = static_cast(factory->create( + this, "katepart", "KParts::ReadWritePart" )); + + if (m_part) + { + part()->widget()->setFocus(); + setFocusProxy(part()->widget()); + + QBoxLayout* layout = new QHBoxLayout(this, 0, -1, "kdissertviewlayout" ); + part()->widget()->reparent( this, QPoint(0, 0) ); + layout->addWidget( part()->widget() ); + + // connect( m_part, SIGNAL(stateChanged()), this, SLOT(updateCaption()) ); + } + else + { + KMessageBox::error(this, i18n("Could not find our part.")); + } + } + else + { + // if we couldn't find our Part, we exit since the Shell by + // itself can't do anything useful + KMessageBox::error(this, i18n("Could not find our part.")); + return; + } +} + +%{APPNAMELC}kmdiView::~%{APPNAMELC}kmdiView() +{ + delete m_part->widget(); +} + +#include "%{APPNAMELC}kmdiView.moc" -- cgit v1.2.1