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 | e9ae80694875f869892f13f4fcaf1170a00dea41 (patch) | |
tree | aa2f8d8a217e2d376224c8d46b7397b68d35de2d /kommander/part | |
download | tdewebdev-e9ae80694875f869892f13f4fcaf1170a00dea41.tar.gz tdewebdev-e9ae80694875f869892f13f4fcaf1170a00dea41.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/kdewebdev@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kommander/part')
-rw-r--r-- | kommander/part/Makefile.am | 8 | ||||
-rw-r--r-- | kommander/part/kommander_part.cpp | 86 | ||||
-rw-r--r-- | kommander/part/kommander_part.desktop | 15 | ||||
-rw-r--r-- | kommander/part/kommander_part.h | 48 |
4 files changed, 157 insertions, 0 deletions
diff --git a/kommander/part/Makefile.am b/kommander/part/Makefile.am new file mode 100644 index 00000000..9ba32668 --- /dev/null +++ b/kommander/part/Makefile.am @@ -0,0 +1,8 @@ +INCLUDES = -I$(top_srcdir)/kommander/executor -I$(top_srcdir)/kommander/factory $(all_includes) +METASOURCES = AUTO +kde_module_LTLIBRARIES = libkommander_part.la +libkommander_part_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries) +libkommander_part_la_LIBADD = $(top_builddir)/kommander/executor/libinstance.la $(top_builddir)/kommander/widget/libkommanderwidget.la $(LIB_KFILE) $(LIB_KPARTS) $(LIB_KHTML) +kde_services_DATA = kommander_part.desktop +libkommander_part_la_SOURCES = kommander_part.cpp +noinst_HEADERS = kommander_part.h diff --git a/kommander/part/kommander_part.cpp b/kommander/part/kommander_part.cpp new file mode 100644 index 00000000..ef8ab5e1 --- /dev/null +++ b/kommander/part/kommander_part.cpp @@ -0,0 +1,86 @@ +/*************************************************************************** + begin : Wed Jan 30 2008 + copyright : (C) 2008, Andras Mantia <amantia@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 "kommander_part.h" + +#include <kdebug.h> + +#include <kinstance.h> +#include <kparts/genericfactory.h> + +#include <qpoint.h> +#include <qlayout.h> +#include <qtimer.h> + +#include "instance.h" +#include "kommanderversion.h" + +static const char *description = + I18N_NOOP("Executor Part is a component of the Kommander dialog system that executes .kmdr files inside a KDE KPart"); + +typedef KParts::GenericFactory<KommanderPart> KommanderPartFactory; + +K_EXPORT_COMPONENT_FACTORY( libkommander_part, KommanderPartFactory ) + +KommanderPart::KommanderPart( QWidget *parentWidget, const char * /*widgetName*/, + QObject *parent, const char *name, const QStringList & /*args*/ ) + : KParts::ReadOnlyPart(parent, name) +{ + setInstance( KommanderPartFactory::instance() ); + m_instance = 0L; + m_widget = new QWidget(parentWidget); + setWidget(m_widget); + m_layout = new QGridLayout(m_widget); +} + +KommanderPart::~KommanderPart() +{ + delete m_instance; +} + +KAboutData* KommanderPart::createAboutData() +{ + KAboutData * aboutData = new KAboutData("kommander_part", I18N_NOOP("Kommander Executor Part"), + KOMMANDER_VERSION, description, KAboutData::License_GPL, + "(c) 2008 Andras Mantia", I18N_NOOP("Part of the KDEWebDev module."), "http://www.kdewebdev.org"); + + aboutData->addAuthor("Andras Mantia", I18N_NOOP("Current maintainer"), "amantia@kdewebdev.org"); + aboutData->addAuthor("Michal Rudolf", I18N_NOOP("Previous maintainer"), "mrudolf@kdewebdev.org"); + aboutData->addAuthor("Marc Britton", I18N_NOOP("Original author"), "consume@optusnet.com.au"); + return aboutData; +} + +bool KommanderPart::openFile() +{ + delete m_instance; + m_instance = new Instance(0L); + m_instance->build(m_url); + QTimer::singleShot(0, this, SLOT(slotRun())); + + emit setStatusBarText( m_url.prettyURL() ); + return true; +} + +void KommanderPart::slotRun() +{ + QWidget *w = m_instance->widget(); + if (w) + { + w->reparent(m_widget, 0, QPoint(0,0)); + m_layout->addWidget(w, 0, 0); + w->show(); //show, not execute, so it doesn't block the parent + } +} + +#include "kommander_part.moc" diff --git a/kommander/part/kommander_part.desktop b/kommander/part/kommander_part.desktop new file mode 100644 index 00000000..38e47dbf --- /dev/null +++ b/kommander/part/kommander_part.desktop @@ -0,0 +1,15 @@ +[Desktop Entry] +Name=KommanderPart +Name[ca]=Part del Kommander +Name[de]=Kommander-Komponente +Name[et]=Kommanderi komponent +Name[nds]=Kommander-Komponent +Name[nl]=Kommander-component +Name[pl]=Moduł Kommandera +Name[ru]=Компонент Kommander +Name[sv]=Kommander-delprogram +Name[zh_TW]=Kommander 部件 +MimeType=application/x-kommander; +ServiceTypes=KParts/ReadOnlyPart +X-KDE-Library=libkommander_part +Type=Service diff --git a/kommander/part/kommander_part.h b/kommander/part/kommander_part.h new file mode 100644 index 00000000..fc9b876c --- /dev/null +++ b/kommander/part/kommander_part.h @@ -0,0 +1,48 @@ +/*************************************************************************** + begin : Wed Jan 30 2008 + copyright : (C) 2008, Andras Mantia <amantia@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 KOMMANDERPART_H +#define KOMMANDERPART_H + +#include <kparts/part.h> +#include <kparts/factory.h> + +class Instance; +class QGridLayout; + +class KommanderPart : public KParts::ReadOnlyPart +{ + Q_OBJECT +public: + KommanderPart(QWidget *parentWidget, const char *widgetName, + QObject *parent, const char *name, const QStringList &args); + + virtual ~KommanderPart(); + + static KAboutData* createAboutData(); + +protected: + virtual bool openFile(); + +protected slots: + void slotRun(); + +private: + Instance *m_instance; + QWidget *m_widget; + QGridLayout *m_layout; +}; + + +#endif // KOMMANDERPART_H |