From 636f509299122d02087c6fd62e1e4a46dbd22026 Mon Sep 17 00:00:00 2001 From: Darrell Anderson Date: Wed, 8 Jan 2014 20:06:00 +0100 Subject: Rename many classes to avoid conflicts with KDE --- xparts/src/Makefile.am | 2 +- xparts/src/kde/Makefile.am | 17 ----- xparts/src/kde/kbrowsersignals.cpp | 31 -------- xparts/src/kde/kbrowsersignals.h | 27 ------- xparts/src/kde/xparthost_kpart.cpp | 150 ------------------------------------- xparts/src/kde/xparthost_kpart.h | 74 ------------------ xparts/src/tde/Makefile.am | 17 +++++ xparts/src/tde/kbrowsersignals.cpp | 31 ++++++++ xparts/src/tde/kbrowsersignals.h | 27 +++++++ xparts/src/tde/xparthost_kpart.cpp | 150 +++++++++++++++++++++++++++++++++++++ xparts/src/tde/xparthost_kpart.h | 74 ++++++++++++++++++ 11 files changed, 300 insertions(+), 300 deletions(-) delete mode 100644 xparts/src/kde/Makefile.am delete mode 100644 xparts/src/kde/kbrowsersignals.cpp delete mode 100644 xparts/src/kde/kbrowsersignals.h delete mode 100644 xparts/src/kde/xparthost_kpart.cpp delete mode 100644 xparts/src/kde/xparthost_kpart.h create mode 100644 xparts/src/tde/Makefile.am create mode 100644 xparts/src/tde/kbrowsersignals.cpp create mode 100644 xparts/src/tde/kbrowsersignals.h create mode 100644 xparts/src/tde/xparthost_kpart.cpp create mode 100644 xparts/src/tde/xparthost_kpart.h (limited to 'xparts/src') diff --git a/xparts/src/Makefile.am b/xparts/src/Makefile.am index 243ba3b3..30982205 100644 --- a/xparts/src/Makefile.am +++ b/xparts/src/Makefile.am @@ -3,5 +3,5 @@ if include_GTK_support SUPPORTGTKDIR=gtk endif -SUBDIRS = interfaces kde $(SUPPORTGTKDIR) +SUBDIRS = interfaces tde $(SUPPORTGTKDIR) diff --git a/xparts/src/kde/Makefile.am b/xparts/src/kde/Makefile.am deleted file mode 100644 index 9b70542e..00000000 --- a/xparts/src/kde/Makefile.am +++ /dev/null @@ -1,17 +0,0 @@ - -INCLUDES = -I$(srcdir)/../interfaces $(all_includes) - -lib_LTLIBRARIES = libkdexparts.la - -libkdexparts_la_SOURCES = xparthost_kpart.cpp xparthost.skel xpart.stub \ - kbrowsersignals.cpp xbrowsersignals.skel xbrowserextension.stub -libkdexparts_la_LIBADD = $(LIB_TDEPARTS) $(LIB_QT) $(LIB_TDECORE) $(LIB_TDEUI) -lDCOP -libkdexparts_la_LDFLAGS = $(all_libraries) -no-undefined -version-info 1:0 - -xpart_DIR=$(srcdir)/../interfaces -xparthost_DIR=$(srcdir)/../interfaces -xbrowsersignals_DIR=$(srcdir)/../interfaces -xbrowserextension_DIR=$(srcdir)/../interfaces - -METASOURCES = AUTO - diff --git a/xparts/src/kde/kbrowsersignals.cpp b/xparts/src/kde/kbrowsersignals.cpp deleted file mode 100644 index 59a688e4..00000000 --- a/xparts/src/kde/kbrowsersignals.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include "kbrowsersignals.h" -#include "xparthost_kpart.h" -#include "xbrowserextension_stub.h" -#include - -KBrowserSignals::KBrowserSignals( XPartHost_KPart *_part, DCOPRef extension ) - : KParts::BrowserExtension( _part ) -{ - tqDebug("KBrowserSignals constructor"); - part = _part; - ext = new XBrowserExtension_stub( extension.app(), extension.object() ); - ext->setBrowserSignals( DCOPRef( this ) ); -} - -KBrowserSignals::~KBrowserSignals() -{ - delete ext; -} - -void KBrowserSignals::openURLRequest( const TQCString &url) -{ - KURL u = TQString(url); - emit KParts::BrowserExtension::openURLRequest(u); -} - -void KBrowserSignals::createNewWindow( const TQCString &url ) -{ -} - -#include "kbrowsersignals.moc" - diff --git a/xparts/src/kde/kbrowsersignals.h b/xparts/src/kde/kbrowsersignals.h deleted file mode 100644 index baee95aa..00000000 --- a/xparts/src/kde/kbrowsersignals.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef __kbrowsersignals_h__ -#define __kbrowsersignals_h__ - -#include -#include -#include - -class XBrowserExtension_stub; -class XPartHost_KPart; - -class KBrowserSignals : public KParts::BrowserExtension, virtual public XBrowserSignals -{ - Q_OBJECT -public: - KBrowserSignals( XPartHost_KPart *part, DCOPRef ref ); - virtual ~KBrowserSignals(); - - - virtual ASYNC openURLRequest( const TQCString &url); - virtual ASYNC createNewWindow( const TQCString &url ); - -protected: - XPartHost_KPart *part; - XBrowserExtension_stub *ext; -}; - -#endif diff --git a/xparts/src/kde/xparthost_kpart.cpp b/xparts/src/kde/xparthost_kpart.cpp deleted file mode 100644 index cfbe57d2..00000000 --- a/xparts/src/kde/xparthost_kpart.cpp +++ /dev/null @@ -1,150 +0,0 @@ -#include "xparthost_kpart.h" -#include "kbrowsersignals.h" -#include "xpart_stub.h" - -#include -#include - -#include - -#include - -#include -#include - -#include - -XPartHost_KPart::XPartHost_KPart( TQWidget *parentWidget, const char *widgetName, - TQObject *parent, const char *name ) - : KParts::ReadOnlyPart( parent, name ), - XPartHost("parthost") -{ - m_stub = 0; - be = 0; - embed = new QXEmbed(parentWidget, widgetName); - setWidget(embed); -} - -XPartHost_KPart::~XPartHost_KPart() -{ - delete m_stub; -} - -DCOPRef XPartHost_KPart::part() -{ - return m_part; -} - -DCOPRef XPartHost_KPart::registerXPart( const DCOPRef &part ) -{ - m_part = part; - - assert( m_stub == 0 ); - - m_stub = new XPart_stub( part.app(), part.object() ); - m_stub->show(); - - kdDebug() << "embedding window " << m_stub->windowId() << endl; - embed->embed( static_cast( m_stub->windowId() ) ); - - embed->show(); - DCOPRef ref = m_stub->queryExtension("browserextension"); - if( !ref.isNull() ) { - tqDebug(" found browser extension "); - be = new KBrowserSignals( this, ref ); - } - return DCOPRef( kapp->dcopClient()->appId(), objId() ); -} - - -void XPartHost_KPart::createActions( const TQCString &xmlActions ) -{ - tqDebug("--> createActions"); - // creates a set of actions and adds them to the actionCollection - TQDomDocument d; - d.setContent( xmlActions ); - - TQDomElement docElem = d.documentElement(); - - kdDebug() << "docElement is " << docElem.tagName() << endl; - - TQDomNode n = docElem.firstChild(); - while( !n.isNull() ) { - TQDomElement e = n.toElement(); - if( !e.isNull() ) { - if ( e.tagName() == "Action") { - TQString name = e.attribute("name"); - TQString type = e.attribute("type"); - - if(type.isEmpty()) - new TDEAction( name, 0, this, TQT_SLOT( actionActivated() ), actionCollection(), name.latin1() ); - else if( type == "toggle" ) - new TDEToggleAction( name, 0, this, TQT_SLOT( actionActivated() ), actionCollection(), name.latin1() ); - kdDebug() << "action=" << name << " type=" << type << endl; - } else if ( e.tagName() == "XMLFile" ) { - TQString location = e.attribute("location"); - setXMLFile(location); - } - } - n = n.nextSibling(); - } - emit actionsInitialized(); -} - - -void XPartHost_KPart::setWindowCaption( const TQString &caption ) -{ - emit KParts::ReadOnlyPart::setWindowCaption( caption ); -} - -void XPartHost_KPart::setStatusBarText( const TQString &text ) -{ - emit KParts::ReadOnlyPart::setStatusBarText( text ); -} - -void XPartHost_KPart::started() -{ - emit KParts::ReadOnlyPart::started( 0 ); -} - -void XPartHost_KPart::completed() -{ - emit KParts::ReadOnlyPart::completed(); -} - -void XPartHost_KPart::canceled( const TQString &errMsg ) -{ - emit KParts::ReadOnlyPart::canceled( errMsg ); -} - -bool XPartHost_KPart::openURL( const KURL &url ) -{ - tqDebug("XPartHost_KPart::openUrl()"); - return m_stub->openURL( url.url().latin1() ); -} - -bool XPartHost_KPart::closeURL() -{ - return m_stub->closeURL(); -} - - -void XPartHost_KPart::actionActivated() -{ - const TQObject *o = sender(); - - if( !o->inherits("TDEAction") ) return; - - const TDEAction *action = static_cast(o); - TQString name = action->text(); - int state = 0; - - if(action->inherits("TDEToggleAction")) { - const TDEToggleAction *t = static_cast(action); - state = t->isChecked(); - } - - m_stub->activateAction(name, state); -} - -#include "xparthost_kpart.moc" diff --git a/xparts/src/kde/xparthost_kpart.h b/xparts/src/kde/xparthost_kpart.h deleted file mode 100644 index 829f7ca7..00000000 --- a/xparts/src/kde/xparthost_kpart.h +++ /dev/null @@ -1,74 +0,0 @@ -#ifndef __xparthost_kpart_h__ -#define __xparthost_kpart_h__ - -#include - -#include - -class XPart_stub; -class KBrowserSignals; -class QXEmbed; - - -/** - * This class is the middle class between the host of the KPart (usually a - * KParts::MainWindow) and the XPart. It transfer calls from the XPart to the - * KPartHost host and from the KPartHost to the XPart. - * - * Note : In the XPart white paper, this class is named KXPartHost - */ -class XPartHost_KPart : public KParts::ReadOnlyPart, public XPartHost -{ - Q_OBJECT -public: - XPartHost_KPart( TQWidget *parentWidget, const char *widgetName, - TQObject *parent, const char *name ); - virtual ~XPartHost_KPart(); - - // DCOP stuff - - /** The XPart uses this function to register itself */ - virtual DCOPRef registerXPart( const DCOPRef &part ); - - /** Return the XPart DCOPRef to someone willing to communicate with it */ - virtual DCOPRef part(); - - // KPart signals - - /** Emitted by the XPart, to be transfered to the KPart host */ - virtual ASYNC createActions( const TQCString &xmlActions ); - /** Emitted by the XPart, to be transfered to the KPart host */ - virtual ASYNC setWindowCaption( const TQString &caption ); - /** Emitted by the XPart, to be transfered to the KPart host */ - virtual ASYNC setStatusBarText( const TQString &text ); - - /** Emitted by the XPart, to be transfered to the KPart host */ - virtual ASYNC started(); - /** Emitted by the XPart, to be transfered to the KPart host */ - virtual ASYNC completed(); - /** Emitted by the XPart, to be transfered to the KPart host */ - virtual ASYNC canceled( const TQString &errMsg ); - - // reimplemented from KReadOnlyPart - /** function called by the KPart host to be forwarded to the XPart */ - virtual bool openURL( const KURL &url ); - /** function called by the KPart host to be forwarded to the XPart */ - virtual bool closeURL(); - -protected: - virtual bool openFile() { return false; } - -private slots: - void actionActivated(); - -signals: - void actionsInitialized(); - -private: - DCOPRef m_part; - XPart_stub *m_stub; - KBrowserSignals *be; - QXEmbed *embed; -}; - -#endif diff --git a/xparts/src/tde/Makefile.am b/xparts/src/tde/Makefile.am new file mode 100644 index 00000000..0a3d28ad --- /dev/null +++ b/xparts/src/tde/Makefile.am @@ -0,0 +1,17 @@ + +INCLUDES = -I$(srcdir)/../interfaces $(all_includes) + +lib_LTLIBRARIES = libtdexparts.la + +libtdexparts_la_SOURCES = xparthost_kpart.cpp xparthost.skel xpart.stub \ + kbrowsersignals.cpp xbrowsersignals.skel xbrowserextension.stub +libtdexparts_la_LIBADD = $(LIB_TDEPARTS) $(LIB_QT) $(LIB_TDECORE) $(LIB_TDEUI) -lDCOP +libtdexparts_la_LDFLAGS = $(all_libraries) -no-undefined -version-info 1:0 + +xpart_DIR=$(srcdir)/../interfaces +xparthost_DIR=$(srcdir)/../interfaces +xbrowsersignals_DIR=$(srcdir)/../interfaces +xbrowserextension_DIR=$(srcdir)/../interfaces + +METASOURCES = AUTO + diff --git a/xparts/src/tde/kbrowsersignals.cpp b/xparts/src/tde/kbrowsersignals.cpp new file mode 100644 index 00000000..59a688e4 --- /dev/null +++ b/xparts/src/tde/kbrowsersignals.cpp @@ -0,0 +1,31 @@ +#include "kbrowsersignals.h" +#include "xparthost_kpart.h" +#include "xbrowserextension_stub.h" +#include + +KBrowserSignals::KBrowserSignals( XPartHost_KPart *_part, DCOPRef extension ) + : KParts::BrowserExtension( _part ) +{ + tqDebug("KBrowserSignals constructor"); + part = _part; + ext = new XBrowserExtension_stub( extension.app(), extension.object() ); + ext->setBrowserSignals( DCOPRef( this ) ); +} + +KBrowserSignals::~KBrowserSignals() +{ + delete ext; +} + +void KBrowserSignals::openURLRequest( const TQCString &url) +{ + KURL u = TQString(url); + emit KParts::BrowserExtension::openURLRequest(u); +} + +void KBrowserSignals::createNewWindow( const TQCString &url ) +{ +} + +#include "kbrowsersignals.moc" + diff --git a/xparts/src/tde/kbrowsersignals.h b/xparts/src/tde/kbrowsersignals.h new file mode 100644 index 00000000..baee95aa --- /dev/null +++ b/xparts/src/tde/kbrowsersignals.h @@ -0,0 +1,27 @@ +#ifndef __kbrowsersignals_h__ +#define __kbrowsersignals_h__ + +#include +#include +#include + +class XBrowserExtension_stub; +class XPartHost_KPart; + +class KBrowserSignals : public KParts::BrowserExtension, virtual public XBrowserSignals +{ + Q_OBJECT +public: + KBrowserSignals( XPartHost_KPart *part, DCOPRef ref ); + virtual ~KBrowserSignals(); + + + virtual ASYNC openURLRequest( const TQCString &url); + virtual ASYNC createNewWindow( const TQCString &url ); + +protected: + XPartHost_KPart *part; + XBrowserExtension_stub *ext; +}; + +#endif diff --git a/xparts/src/tde/xparthost_kpart.cpp b/xparts/src/tde/xparthost_kpart.cpp new file mode 100644 index 00000000..54bcb804 --- /dev/null +++ b/xparts/src/tde/xparthost_kpart.cpp @@ -0,0 +1,150 @@ +#include "xparthost_kpart.h" +#include "kbrowsersignals.h" +#include "xpart_stub.h" + +#include +#include + +#include + +#include + +#include +#include + +#include + +XPartHost_KPart::XPartHost_KPart( TQWidget *parentWidget, const char *widgetName, + TQObject *parent, const char *name ) + : KParts::ReadOnlyPart( parent, name ), + XPartHost("parthost") +{ + m_stub = 0; + be = 0; + embed = new QXEmbed(parentWidget, widgetName); + setWidget(embed); +} + +XPartHost_KPart::~XPartHost_KPart() +{ + delete m_stub; +} + +DCOPRef XPartHost_KPart::part() +{ + return m_part; +} + +DCOPRef XPartHost_KPart::registerXPart( const DCOPRef &part ) +{ + m_part = part; + + assert( m_stub == 0 ); + + m_stub = new XPart_stub( part.app(), part.object() ); + m_stub->show(); + + kdDebug() << "embedding window " << m_stub->windowId() << endl; + embed->embed( static_cast( m_stub->windowId() ) ); + + embed->show(); + DCOPRef ref = m_stub->queryExtension("browserextension"); + if( !ref.isNull() ) { + tqDebug(" found browser extension "); + be = new KBrowserSignals( this, ref ); + } + return DCOPRef( kapp->dcopClient()->appId(), objId() ); +} + + +void XPartHost_KPart::createActions( const TQCString &xmlActions ) +{ + tqDebug("--> createActions"); + // creates a set of actions and adds them to the actionCollection + TQDomDocument d; + d.setContent( xmlActions ); + + TQDomElement docElem = d.documentElement(); + + kdDebug() << "docElement is " << docElem.tagName() << endl; + + TQDomNode n = docElem.firstChild(); + while( !n.isNull() ) { + TQDomElement e = n.toElement(); + if( !e.isNull() ) { + if ( e.tagName() == "Action") { + TQString name = e.attribute("name"); + TQString type = e.attribute("type"); + + if(type.isEmpty()) + new TDEAction( name, 0, this, TQT_SLOT( actionActivated() ), actionCollection(), name.latin1() ); + else if( type == "toggle" ) + new TDEToggleAction( name, 0, this, TQT_SLOT( actionActivated() ), actionCollection(), name.latin1() ); + kdDebug() << "action=" << name << " type=" << type << endl; + } else if ( e.tagName() == "XMLFile" ) { + TQString location = e.attribute("location"); + setXMLFile(location); + } + } + n = n.nextSibling(); + } + emit actionsInitialized(); +} + + +void XPartHost_KPart::setWindowCaption( const TQString &caption ) +{ + emit KParts::ReadOnlyPart::setWindowCaption( caption ); +} + +void XPartHost_KPart::setStatusBarText( const TQString &text ) +{ + emit KParts::ReadOnlyPart::setStatusBarText( text ); +} + +void XPartHost_KPart::started() +{ + emit KParts::ReadOnlyPart::started( 0 ); +} + +void XPartHost_KPart::completed() +{ + emit KParts::ReadOnlyPart::completed(); +} + +void XPartHost_KPart::canceled( const TQString &errMsg ) +{ + emit KParts::ReadOnlyPart::canceled( errMsg ); +} + +bool XPartHost_KPart::openURL( const KURL &url ) +{ + tqDebug("XPartHost_KPart::openUrl()"); + return m_stub->openURL( url.url().latin1() ); +} + +bool XPartHost_KPart::closeURL() +{ + return m_stub->closeURL(); +} + + +void XPartHost_KPart::actionActivated() +{ + const TQObject *o = sender(); + + if( !o->inherits("TDEAction") ) return; + + const TDEAction *action = static_cast(o); + TQString name = action->text(); + int state = 0; + + if(action->inherits("TDEToggleAction")) { + const TDEToggleAction *t = static_cast(action); + state = t->isChecked(); + } + + m_stub->activateAction(name, state); +} + +#include "xparthost_kpart.moc" diff --git a/xparts/src/tde/xparthost_kpart.h b/xparts/src/tde/xparthost_kpart.h new file mode 100644 index 00000000..8cc54699 --- /dev/null +++ b/xparts/src/tde/xparthost_kpart.h @@ -0,0 +1,74 @@ +#ifndef __xparthost_kpart_h__ +#define __xparthost_kpart_h__ + +#include + +#include + +class XPart_stub; +class KBrowserSignals; +class QXEmbed; + + +/** + * This class is the middle class between the host of the KPart (usually a + * KParts::MainWindow) and the XPart. It transfer calls from the XPart to the + * KPartHost host and from the KPartHost to the XPart. + * + * Note : In the XPart white paper, this class is named KXPartHost + */ +class XPartHost_KPart : public KParts::ReadOnlyPart, public XPartHost +{ + Q_OBJECT +public: + XPartHost_KPart( TQWidget *parentWidget, const char *widgetName, + TQObject *parent, const char *name ); + virtual ~XPartHost_KPart(); + + // DCOP stuff + + /** The XPart uses this function to register itself */ + virtual DCOPRef registerXPart( const DCOPRef &part ); + + /** Return the XPart DCOPRef to someone willing to communicate with it */ + virtual DCOPRef part(); + + // KPart signals + + /** Emitted by the XPart, to be transfered to the KPart host */ + virtual ASYNC createActions( const TQCString &xmlActions ); + /** Emitted by the XPart, to be transfered to the KPart host */ + virtual ASYNC setWindowCaption( const TQString &caption ); + /** Emitted by the XPart, to be transfered to the KPart host */ + virtual ASYNC setStatusBarText( const TQString &text ); + + /** Emitted by the XPart, to be transfered to the KPart host */ + virtual ASYNC started(); + /** Emitted by the XPart, to be transfered to the KPart host */ + virtual ASYNC completed(); + /** Emitted by the XPart, to be transfered to the KPart host */ + virtual ASYNC canceled( const TQString &errMsg ); + + // reimplemented from KReadOnlyPart + /** function called by the KPart host to be forwarded to the XPart */ + virtual bool openURL( const KURL &url ); + /** function called by the KPart host to be forwarded to the XPart */ + virtual bool closeURL(); + +protected: + virtual bool openFile() { return false; } + +private slots: + void actionActivated(); + +signals: + void actionsInitialized(); + +private: + DCOPRef m_part; + XPart_stub *m_stub; + KBrowserSignals *be; + QXEmbed *embed; +}; + +#endif -- cgit v1.2.1