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 | 114a878c64ce6f8223cfd22d76a20eb16d177e5e (patch) | |
tree | acaf47eb0fa12142d3896416a69e74cbf5a72242 /parts/konsole | |
download | tdevelop-114a878c64ce6f8223cfd22d76a20eb16d177e5e.tar.gz tdevelop-114a878c64ce6f8223cfd22d76a20eb16d177e5e.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/kdevelop@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'parts/konsole')
-rw-r--r-- | parts/konsole/Makefile.am | 16 | ||||
-rw-r--r-- | parts/konsole/README.dox | 49 | ||||
-rw-r--r-- | parts/konsole/kdevkonsoleview.desktop | 86 | ||||
-rw-r--r-- | parts/konsole/konsoleviewpart.cpp | 69 | ||||
-rw-r--r-- | parts/konsole/konsoleviewpart.h | 36 | ||||
-rw-r--r-- | parts/konsole/konsoleviewwidget.cpp | 124 | ||||
-rw-r--r-- | parts/konsole/konsoleviewwidget.h | 55 |
7 files changed, 435 insertions, 0 deletions
diff --git a/parts/konsole/Makefile.am b/parts/konsole/Makefile.am new file mode 100644 index 00000000..b0faabf9 --- /dev/null +++ b/parts/konsole/Makefile.am @@ -0,0 +1,16 @@ +# Here resides the konsole view part. + +INCLUDES = -I$(top_srcdir)/lib/interfaces -I$(top_srcdir)/lib/util $(all_includes) + +kde_module_LTLIBRARIES = libkdevkonsoleview.la +libkdevkonsoleview_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) +libkdevkonsoleview_la_LIBADD = $(top_builddir)/lib/libkdevelop.la \ + $(top_builddir)/lib/util/libkdevutil.la + +libkdevkonsoleview_la_SOURCES = konsoleviewpart.cpp + +METASOURCES = AUTO + +servicedir = $(kde_servicesdir) +service_DATA = kdevkonsoleview.desktop + diff --git a/parts/konsole/README.dox b/parts/konsole/README.dox new file mode 100644 index 00000000..67641ebb --- /dev/null +++ b/parts/konsole/README.dox @@ -0,0 +1,49 @@ +/** \class KonsoleViewPart +Put a brief description here, the brief description ends at the first dot. +Put a more detailed description of your part in these lines. It can span +over several lines. You can even use some html commands in these lines like: +<code>This is code</code>, html links <a href="http://somelocation">link text</a>, +and images. + +\authors <a href="mailto:bernd AT kdevelop.org">Bernd Gehrmann</a> + +\maintainer <a href="mailto:$EMAIL$">$AUTHOR$</a> +\maintainer <a href="mailto:2nd maintainer AT provider.com">2nd maintainer full name</a> +... +\maintainer <a href="mailto:nth maintainer AT provider.com">nth maintainer full name</a> + +\feature Describe the first feature +\feature Describe the second feature +... +\feature Describe the last feature + +\bug Describe a the 1st bug that you know of, but probably hasn't been reported yet. +.. +\bug Describe a the nth bug that you know of, but probably hasn't been reported yet. + +\requirement Describe a the 1st requirement of your part. +\requirement Describe a the 2nd requirement of your part. +... +\requirement Describe a the nth requirement of your part. + +\todo Describe a the 1st TODO of your part. +\todo Describe a the 2nd TODO of your part. +... +\todo Describe a the nth TODO of your part. + +\faq <b>First frequenly asked question about your part ?</b> Answer. +\faq <b>Second frequenly asked question about your part ?</b> Answer. +... +\faq <b>Last frequenly asked question about your part ?</b> Answer. + +\note First note text. +\note Second note text. +... +\note Last note text. + +\warning First warning text. +\warning Second warning text. +... +\warning Last warning text. + +*/ diff --git a/parts/konsole/kdevkonsoleview.desktop b/parts/konsole/kdevkonsoleview.desktop new file mode 100644 index 00000000..789f76a6 --- /dev/null +++ b/parts/konsole/kdevkonsoleview.desktop @@ -0,0 +1,86 @@ +[Desktop Entry] +Type=Service +Exec=blubb +Comment=This plugin gives KDevelop an embedded konsole for quick and easy command line access. +Comment[ca]=Aquest connector ofereix a KDevelop una konsola encastada per a facilitar l'accés a la línia de comandaments. +Comment[da]=Dette plugin giver KDevelop en indlejret terminal for hurtig og nem kommandolinjeadgang. +Comment[de]=Dieses Modul stellt eine eingebettete Konsole für den schnellen und einfachen Zugriff auf die Kommandozeile zur Verfügung. +Comment[el]=Αυτό το πρόσθετο προσφέρει στο KDevelop μια ενσωματωμένη konsole για γρήγορη και εύκολη πρόσβαση σε γραμμή εντολών. +Comment[es]=Este complemento proporciona a KDevelop una consola empotrada para facilitar el acceso a la línea de órdenes. +Comment[et]=See plugin lisab KDevelopile võimaluse põimitult kasutada konsooli käsurea võimaluste kiireks ja hõlpsaks pruukimiseks. +Comment[eu]=Plugin honek KDevelop-i komando-lerroak azkar eta erraz sartzeko kapsultatutako kontsola bat eskeintzen dio. +Comment[fa]=این وصله برای دستیابی سریع و آسان به خط فرمان، به KDevelop یک konsole نهفته میدهد. +Comment[fr]=Ce module externe offre à KDevelop une Konsole intégrée permettant un accès à la ligne de commande rapide et facile. +Comment[gl]=Esta extensión engade a KDevelop unha konsole incrustada para un rápido e sinxelo acceso a liña de comandos. +Comment[hu]=Ez a bővítőmodul egy könnyen elérhető, beágyazott parancssort hoz létre a KDevelopon belül. +Comment[it]=Questo plugin offre una console integrata per KDevelop per l'accesso rapido e semplice alla linea di comando. +Comment[ja]=このプラグインは、KDevelop に迅速で容易なコマンドラインアクセス用の埋め込まれた konsole を与えます。 +Comment[ms]=Plugin ini memberikan KDevelop konsol embedded untuk akses arahan baris yang cepat dan mudah. +Comment[nds]=Dit Moduul stellt för't gaue un eenfache Togriepen op de Befehlsreeg en inbett Konsole för KDevelop praat. +Comment[ne]=यो प्लगइनले छिटो र सजिलो आदेशरेखा पहुँचका लागि केडीई विकासमा सम्मिलित कन्सोल प्रदान गर्दछ । +Comment[nl]=Deze plugin geeft KDevelop een ingebedde Konsole voor snelle toegang tot de commandoregel. +Comment[pl]=Ta wtyczka dodaje do KDevelopa wbudowaną konsolę umożliwiając szybki i łatwy dostęp do linii komend. +Comment[pt]=Este 'plugin' dá ao KDevelop um Konsole incorporado para um acesso rápido e simples à linha de comandos. +Comment[pt_BR]=Este plug-in fornece ao KDevelop um konsole embutido para acesso rápido e fácil à linha de comando. +Comment[ru]=Предоставляет встроенную консоль для быстрого вызова командной строки. +Comment[sk]=Modul vložiteľnej konzoly do Kdevelop pre rýchly a jednoduchý prístup k príkazovému riadku. +Comment[sr]=Овај прикључак даје KDevelop-у уграђену конзолу за брз и лак приступ командној линији. +Comment[sr@Latn]=Ovaj priključak daje KDevelop-u ugrađenu konzolu za brz i lak pristup komandnoj liniji. +Comment[sv]=Insticksprogrammet ger KDevelop en inbyggd terminal för snabb och enkel åtkomst av kommandoraden. +Comment[ta]=இந்த சொருகி உங்களுக்கு Kஉருவாக்கத்திற்கு கன்சோல் உட்பொதியின் மூலம் விரைவு மற்றும் எளிய கட்டளை வரி அனுமதி தரும். +Comment[tg]=Барои тез фарёд намудани фармони сатр рафаки бино карда шударо имкон медиҳад. +Comment[tr]=Bu eklenti, KDevelop'a hızlı komut satırı erişimi için gömülü bir terminal verir. +Comment[zh_CN]=这个插件为 KDevelop 提供KDE终端来快速和方便使用命令行。 +Comment[zh_TW]=此外掛程式提供 KDevelop 嵌入式的主控台,可以快速使用命令列。 +Name=KDevKonsoleView +Name[da]=KDevelop Konsole-visning +Name[de]=Unterstützung für Konsole (KDevelop) +Name[hi]=के-डेव-कंसोल-व्यू +Name[nds]=KDevelop-Konsoleünnerstütten +Name[pl]=KDevWidokKonsoli +Name[sk]=KDev pohľad na konzolu +Name[sv]=KDevelop terminalvy +Name[ta]=KDevKonsole காட்சி +Name[tg]=Намоиши KDevKonsole +Name[zh_TW]=KDevelop 主控台檢視 +GenericName=Embedded Konsole +GenericName[br]=Konsole enframmet +GenericName[ca]=Konsola encastada +GenericName[da]=Indlejret konsole +GenericName[de]=Eingebettete Konsole +GenericName[el]=Ενσωματωμένη Konsole +GenericName[es]=Consola empotrada +GenericName[et]=Põimitud Konsool +GenericName[eu]=Konsole kapsulatua +GenericName[fa]=Konsole نهفته +GenericName[fr]=Konsole intégrée +GenericName[ga]=Konsole Leabaithe +GenericName[gl]=Konsole incrustada +GenericName[hi]=अंतर्निर्मित कंसोल +GenericName[hu]=Beágyazott Konsole +GenericName[it]=Konsole integrata +GenericName[ja]=埋め込まれた Konsole +GenericName[ms]=Konsol Embedded +GenericName[nds]=Inbett Konsole +GenericName[ne]=सम्मिलित कन्सोल +GenericName[nl]=Ingebedde Konsole +GenericName[pl]=Wbudowana konsola +GenericName[pt]=Konsole Embebida +GenericName[pt_BR]=Konsole Embutido +GenericName[ru]=Встроенная консоль +GenericName[sk]=Vložiteľná konzola +GenericName[sl]=Vključena Konzola +GenericName[sr]=Уграђена конзола +GenericName[sr@Latn]=Ugrađena konzola +GenericName[sv]=Inbäddad terminal +GenericName[ta]=கன்சோல் உட்பொதி +GenericName[tg]=Бино намудани Embedded +GenericName[tr]=Gömülü Terminal +GenericName[zh_CN]=嵌入的 Konsole +GenericName[zh_TW]=嵌入式主控台 +Icon=konsole +ServiceTypes=KDevelop/Plugin +X-KDE-Library=libkdevkonsoleview +X-KDevelop-Version=5 +X-KDevelop-Scope=Global +X-KDevelop-Properties=Console diff --git a/parts/konsole/konsoleviewpart.cpp b/parts/konsole/konsoleviewpart.cpp new file mode 100644 index 00000000..8d7892a5 --- /dev/null +++ b/parts/konsole/konsoleviewpart.cpp @@ -0,0 +1,69 @@ +/*************************************************************************** + * Copyright (C) 2003 by KDevelop Authors * + * kdevelop-devel@kde.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "konsoleviewpart.h" + +#include <qwhatsthis.h> + +#include <kdevgenericfactory.h> +#include <kiconloader.h> +#include <klocale.h> + +#include "kdevcore.h" +#include "kdevproject.h" +#include "kdevmainwindow.h" +#include "kdevplugininfo.h" +#include "kdevshellwidget.h" + + +typedef KDevGenericFactory<KonsoleViewPart> KonsoleViewFactory; +static const KDevPluginInfo data("kdevkonsoleview"); +K_EXPORT_COMPONENT_FACTORY(libkdevkonsoleview, KonsoleViewFactory(data)) + +KonsoleViewPart::KonsoleViewPart(QObject *parent, const char *name, const QStringList &) + : KDevPlugin(&data, parent, name ? name : "KonsoleViewPart") +{ + setInstance( KonsoleViewFactory::instance() ); + + m_widget = new KDevShellWidget( 0, "konsole widget" ); + + QWhatsThis::add(m_widget, i18n("<b>Konsole</b><p>" + "This window contains an embedded konsole window. It will try to follow you when " + "you navigate in the source directories") + ); + + m_widget->setIcon( SmallIcon("konsole") ); + m_widget->setCaption(i18n("Konsole")); + + m_widget->activate(); + m_widget->setAutoReactivateOnClose( true ); + + mainWindow()->embedOutputView(m_widget, i18n("Konsole"), i18n("Embedded console window")); + + connect(core(), SIGNAL(projectOpened()), this, SLOT(projectOpened())); +} + + +KonsoleViewPart::~KonsoleViewPart() +{ + if ( m_widget ) + mainWindow()->removeView( m_widget ); + delete m_widget; +} + +void KonsoleViewPart::projectOpened() +{ + QString cd_projectdir = QString("cd ") + project()->projectDirectory() + "\n"; + m_widget->sendInput( cd_projectdir ); +} + + +#include "konsoleviewpart.moc" diff --git a/parts/konsole/konsoleviewpart.h b/parts/konsole/konsoleviewpart.h new file mode 100644 index 00000000..b7cea9d8 --- /dev/null +++ b/parts/konsole/konsoleviewpart.h @@ -0,0 +1,36 @@ +/*************************************************************************** + * Copyright (C) 2003 by KDevelop Authors * + * kdevelop-devel@kde.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef __KONSOLEVIEWPART_H__ +#define __KONSOLEVIEWPART_H__ + + +#include <qguardedptr.h> +#include "kdevplugin.h" + + +class KDevShellWidget; + +class KonsoleViewPart : public KDevPlugin +{ + Q_OBJECT +public: + KonsoleViewPart(QObject *parent, const char *name, const QStringList &); + virtual ~KonsoleViewPart(); + +private slots: + void projectOpened(); + +private: + QGuardedPtr<KDevShellWidget> m_widget; +}; + +#endif diff --git a/parts/konsole/konsoleviewwidget.cpp b/parts/konsole/konsoleviewwidget.cpp new file mode 100644 index 00000000..e7a84d94 --- /dev/null +++ b/parts/konsole/konsoleviewwidget.cpp @@ -0,0 +1,124 @@ +/*************************************************************************** + * Copyright (C) 2003 by KDevelop Authors * + * kdevelop-devel@kde.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include <qlayout.h> +#include <qframe.h> +#include <qdir.h> + +#include <kparts/part.h> +#include <klibloader.h> +#include <kurl.h> +#include <kdebug.h> +#include <kapplication.h> +#include <kconfig.h> + +#include "kdevcore.h" +#include "kdevproject.h" +#include "konsoleviewpart.h" +#include "kdevpartcontroller.h" + +#include "konsoleviewwidget.h" + +KonsoleViewWidget::KonsoleViewWidget(KonsoleViewPart *part) + : QWidget(0, "konsole widget"), part(0), owner( part ) +{ + connect(part->partController(), SIGNAL(activePartChanged(KParts::Part*)), this, SLOT(activePartChanged(KParts::Part*))); + vbox = new QVBoxLayout(this); +} + +KonsoleViewWidget::~KonsoleViewWidget() +{ +} + +void KonsoleViewWidget::show() +{ + activate(); + QWidget::show(); +} + +void KonsoleViewWidget::activate() +{ + kdDebug(9035) << k_funcinfo << endl; + if (part) + return; + + KLibFactory *factory = KLibLoader::self()->factory("libkonsolepart"); + if (!factory) + return; + + part = (KParts::ReadOnlyPart *) factory->create(this); + if (!part) + return; + + part->widget()->setFocusPolicy(QWidget::WheelFocus); + setFocusProxy(part->widget()); + part->widget()->setFocus(); + + if (part->widget()->inherits("QFrame")) + ((QFrame*)part->widget())->setFrameStyle(QFrame::Panel|QFrame::Sunken); + + vbox->addWidget(part->widget()); + +// this->activePartChanged( owner->partController()->activePart() ); + part->widget()->show(); + + connect(part, SIGNAL(destroyed()), this, SLOT(partDestroyed())); +} + + +void KonsoleViewWidget::activePartChanged(KParts::Part *activatedPart) +{ + kdDebug(9035) << k_funcinfo << endl; + KParts::ReadOnlyPart *ro_part = dynamic_cast<KParts::ReadOnlyPart*>(activatedPart); + + if (ro_part && !ro_part->url().isLocalFile()) + { + kdDebug(9035) << k_funcinfo << "part is null or not local" << endl; + return; + } + QString dir; + if (ro_part) + dir = ro_part->url().directory(); + else if (owner->project()) + dir = owner->project()->projectDirectory(); + + kdDebug(9035) << k_funcinfo "Changing dir to " << dir << endl; + if (dir.isEmpty()) + return; + setDirectory( KURL(dir) ); +} + +void KonsoleViewWidget::setDirectory(const KURL &dirUrl) +{ + kdDebug(9035) << k_funcinfo << "part is " << (long)part << endl; + + if (part && dirUrl != part->url()) + { + kdDebug(9035) << k_funcinfo << "Changing dirUrl.path() == " << dirUrl.path() << endl; + kdDebug(9035) << k_funcinfo << "Changing part->url.path() == " << part->url().path() << endl; + KConfig* config = kapp->config(); + + kdDebug(9035) << k_funcinfo << "SyncTerminalEmulator: " << config->readBoolEntry("SyncTerminalEmulator") << endl; + + if (config->readBoolEntry("SyncTerminalEmulator")) { + part->openURL( dirUrl ); + } + } +} + +void KonsoleViewWidget::partDestroyed() +{ + part = 0; + activate(); +} + + +#include "konsoleviewwidget.moc" diff --git a/parts/konsole/konsoleviewwidget.h b/parts/konsole/konsoleviewwidget.h new file mode 100644 index 00000000..0236dee4 --- /dev/null +++ b/parts/konsole/konsoleviewwidget.h @@ -0,0 +1,55 @@ +/*************************************************************************** + * Copyright (C) 2003 by KDevelop Authors * + * kdevelop-devel@kde.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef __KONSOLEVIEWWIDGET_H__ +#define __KONSOLEVIEWWIDGET_H__ + + +#include <qwidget.h> +#include <qstring.h> + + +class KDevProject; +class KonsoleWidgetPrivate; +class KonsoleViewPart; +namespace KParts { + class ReadOnlyPart; + class Part; +} +class QVBoxLayout; + + +class KonsoleViewWidget : public QWidget +{ + Q_OBJECT +public: + KonsoleViewWidget(KonsoleViewPart *part); + virtual ~KonsoleViewWidget(); + + virtual void show(); + +public slots: + void setDirectory(const KURL &dirUrl); + +private slots: + void activePartChanged(KParts::Part *activatedPart); + void partDestroyed(); + +private: + void activate(); + + KParts::ReadOnlyPart *part; + QVBoxLayout *vbox; + KonsoleViewPart *owner; +}; + + +#endif |