summaryrefslogtreecommitdiffstats
path: root/languages/cpp/app_templates/kscons_tdemdi/tdemdikonsole.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-01-26 13:18:13 -0600
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-01-26 13:18:13 -0600
commit2fb700f92bb787fab0845a63a541cd5640daa449 (patch)
treec6f769db55585dd47a9fd415a40ee8b86926f683 /languages/cpp/app_templates/kscons_tdemdi/tdemdikonsole.cpp
parentfd1d1e1064eb09ddbbd67d3597c39856f5c0bc76 (diff)
downloadtdevelop-2fb700f92bb787fab0845a63a541cd5640daa449.tar.gz
tdevelop-2fb700f92bb787fab0845a63a541cd5640daa449.zip
Rename a number of libraries and executables to avoid conflicts with KDE4
Diffstat (limited to 'languages/cpp/app_templates/kscons_tdemdi/tdemdikonsole.cpp')
-rw-r--r--languages/cpp/app_templates/kscons_tdemdi/tdemdikonsole.cpp76
1 files changed, 76 insertions, 0 deletions
diff --git a/languages/cpp/app_templates/kscons_tdemdi/tdemdikonsole.cpp b/languages/cpp/app_templates/kscons_tdemdi/tdemdikonsole.cpp
new file mode 100644
index 00000000..0eab6525
--- /dev/null
+++ b/languages/cpp/app_templates/kscons_tdemdi/tdemdikonsole.cpp
@@ -0,0 +1,76 @@
+%{CPP_TEMPLATE}
+
+#include <tqfileinfo.h>
+#include <tqframe.h>
+
+#include <tdeparts/part.h>
+#include <kate/document.h>
+#include <kate/view.h>
+#include <klocale.h>
+#include <klibloader.h>
+#include <kurl.h>
+
+#include "tdemdikonsole.h"
+
+tdemdikonsole::tdemdikonsole(TQWidget *parent, const char *name) : TQVBox(parent, name)
+{
+ m_haskonsole = false;
+ respawn();
+}
+
+tdemdikonsole::~tdemdikonsole()
+{
+}
+
+void tdemdikonsole::respawn()
+{
+ KLibFactory *factory = KLibLoader::self()->factory("libkonsolepart");
+
+ if (!factory) return;
+ m_part = (KParts::ReadOnlyPart *) factory->create(this);
+
+ if (!m_part) return;
+
+ if (m_part->widget()->inherits(TQFRAME_OBJECT_NAME_STRING))
+ ((TQFrame*)m_part->widget())->setFrameStyle(TQFrame::Panel|TQFrame::Sunken);
+
+ m_haskonsole=true;
+ connect( m_part, TQT_SIGNAL(destroyed()), this, TQT_SLOT(slotDestroyed()) );
+
+ m_part->widget()->show();
+ show();
+}
+
+void tdemdikonsole::setDirectory(const TQString &dirname)
+{
+ if (m_haskonsole)
+ {
+ KURL url(dirname);
+ if (m_part->url() != url)
+ m_part->openURL(url);
+ }
+}
+
+void tdemdikonsole::showEvent(TQShowEvent *ev)
+{
+ TQWidget::showEvent(ev);
+ activate();
+}
+
+void tdemdikonsole::activate()
+{
+ if (m_haskonsole)
+ {
+ m_part->widget()->show();
+ setFocusProxy(m_part->widget());
+ m_part->widget()->setFocus();
+ }
+}
+
+void tdemdikonsole::slotDestroyed()
+{
+ m_haskonsole=false;
+ respawn();
+}
+
+#include "tdemdikonsole.moc"