From ed6e59662040eb15573dae9c323450e9a720ac01 Mon Sep 17 00:00:00 2001 From: tpearson Date: Fri, 1 Jul 2011 22:30:35 +0000 Subject: TQt4 port smb4k This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/smb4k@1239034 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- plugin/smb4k_konqplugin.cpp | 86 ++++++++++++++++++++++----------------------- plugin/smb4k_konqplugin.h | 32 +++++++++-------- 2 files changed, 60 insertions(+), 58 deletions(-) (limited to 'plugin') diff --git a/plugin/smb4k_konqplugin.cpp b/plugin/smb4k_konqplugin.cpp index 3cab7fa..e66ba97 100644 --- a/plugin/smb4k_konqplugin.cpp +++ b/plugin/smb4k_konqplugin.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * Copyright (C) 2004 by Massimo Callegari * - * massimocallegari@yahoo.it * + * massitqmocallegari@yahoo.it * * * * 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 * @@ -18,21 +18,21 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ -// Qt includes -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +// TQt includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // KDE includes #include @@ -53,23 +53,23 @@ #include "../smb4k/core/smb4kcore.h" #include "../smb4k/core/smb4kdefs.h" -smb4kWidget::smb4kWidget( QWidget * parent, const char * name, WFlags f ) - : QVBox(parent, name, f) +smb4kWidget::smb4kWidget( TQWidget * tqparent, const char * name, WFlags f ) + : TQVBox(tqparent, name, f) { // Nothing exciting to do ! } -KonqSidebar_Smb4K::KonqSidebar_Smb4K(KInstance *inst,QObject *parent,QWidget *widgetParent, QString &desktopName, const char* name): - KonqSidebarPlugin(inst,parent,widgetParent,desktopName,name) +KonqSidebar_Smb4K::KonqSidebar_Smb4K(KInstance *inst,TQObject *tqparent,TQWidget *widgetParent, TQString &desktopName, const char* name): + KonqSidebarPlugin(inst,tqparent,widgetParent,desktopName,name) { widget = new smb4kWidget( widgetParent ); KToolBar *topBar = new KToolBar( widget, "Topbar" ); topBar->setIconSize(16); - topBar->insertButton( "reload", 0, SIGNAL( clicked() ), this, SLOT( slotRescan() ) , TRUE, i18n( "Scan Network" ) ); - topBar->insertButton( "find", 1, SIGNAL( clicked() ), this, SLOT( slotSearch() ) , TRUE, i18n( "Search" ) ); - topBar->insertButton( "configure", 2, SIGNAL( clicked() ), this, SLOT( slotSmb4KOptionsDlg() ) , TRUE, i18n( "Configure" ) ); + topBar->insertButton( "reload", 0, TQT_SIGNAL( clicked() ), this, TQT_SLOT( slotRescan() ) , TRUE, i18n( "Scan Network" ) ); + topBar->insertButton( "tqfind", 1, TQT_SIGNAL( clicked() ), this, TQT_SLOT( slotSearch() ) , TRUE, i18n( "Search" ) ); + topBar->insertButton( "configure", 2, TQT_SIGNAL( clicked() ), this, TQT_SLOT( slotSmb4KOptionsDlg() ) , TRUE, i18n( "Configure" ) ); // // Browser widget: @@ -78,7 +78,7 @@ KonqSidebar_Smb4K::KonqSidebar_Smb4K(KInstance *inst,QObject *parent,QWidget *wi if ( browser_factory ) { - m_browser_part = static_cast( browser_factory->create( widget, "BrowserPart", "KParts::Part", QStringList( "konqplugin=\"true\"" ) ) ); + m_browser_part = static_cast( browser_factory->create( TQT_TQOBJECT(widget), "BrowserPart", "KParts::Part", TQStringList( "konqplugin=\"true\"" ) ) ); // Do nothing here. The network scan (and the mounting of recently used // shares) will be done by Smb4KCore::init() below. @@ -90,8 +90,8 @@ KonqSidebar_Smb4K::KonqSidebar_Smb4K(KInstance *inst,QObject *parent,QWidget *wi return; } - connect( Smb4KCore::mounter(), SIGNAL( mountedShare( const QString &) ), this, SLOT( slotMountedShare( const QString & ) ) ); - connect( Smb4KCore::mounter(), SIGNAL( aboutToUnmount( const QString& ) ), this, SLOT( slotPrepareUnmount( const QString& ) ) ); + connect( Smb4KCore::mounter(), TQT_SIGNAL( mountedShare( const TQString &) ), this, TQT_SLOT( slotMountedShare( const TQString & ) ) ); + connect( Smb4KCore::mounter(), TQT_SIGNAL( aboutToUnmount( const TQString& ) ), this, TQT_SLOT( slotPrepareUnmount( const TQString& ) ) ); // Scan the network and remount recently used shares: Smb4KCore::self()->init(); @@ -106,7 +106,7 @@ KonqSidebar_Smb4K::~KonqSidebar_Smb4K() extern "C" { - void* create_konqsidebar_smb4k(KInstance *instance,QObject *par,QWidget *widp,QString &desktopname,const char *name) + void* create_konqsidebar_smb4k(KInstance *instance,TQObject *par,TQWidget *widp,TQString &desktopname,const char *name) { KGlobal::locale()->insertCatalogue("smb4k"); return new KonqSidebar_Smb4K(instance,par,widp,desktopname,name); @@ -115,7 +115,7 @@ extern "C" extern "C" { - bool add_konqsidebar_smb4k(QString* fn, QString* /*param*/, QMap *map) + bool add_konqsidebar_smb4k(TQString* fn, TQString* /*param*/, TQMap *map) { map->insert("Type","Link"); map->insert("Icon","smb4k"); @@ -136,7 +136,7 @@ void KonqSidebar_Smb4K::handleURL(const KURL &url) void KonqSidebar_Smb4K::slotRescan() { // Send a custom rescan event to the browser part. - QApplication::postEvent( m_browser_part, new QCustomEvent( EVENT_SCAN_NETWORK ) ); + TQApplication::postEvent( m_browser_part, new TQCustomEvent( EVENT_SCAN_NETWORK ) ); } void KonqSidebar_Smb4K::slotSearch() @@ -149,22 +149,22 @@ void KonqSidebar_Smb4K::slotSearch() KDialogBase *searchDialog = new KDialogBase( KDialogBase::Plain, i18n( "Search Dialog" ), KDialogBase::Close, KDialogBase::NoDefault, widget, "sd", true, true ); - QFrame *frame = searchDialog->plainPage(); + TQFrame *frame = searchDialog->plainPage(); - m_search_part = static_cast( search_factory->create( frame, "SearchDialogPart", "KParts::Part" ) ); + m_search_part = static_cast( search_factory->create( TQT_TQOBJECT(frame), "SearchDialogPart", "KParts::Part" ) ); if ( m_search_part ) { - QGridLayout *layout = new QGridLayout( frame ); - layout->setSpacing( 10 ); - layout->setMargin( 0 ); - layout->addWidget ( m_search_part->widget(), 0, 0, 0 ); + TQGridLayout *tqlayout = new TQGridLayout( frame ); + tqlayout->setSpacing( 10 ); + tqlayout->setMargin( 0 ); + tqlayout->addWidget ( m_search_part->widget(), 0, 0, 0 ); searchDialog->resize(400,300); // We do not want the dialog to be closed if the user presses return. // Instead we want that a search is started: searchDialog->actionButton( KDialogBase::Close )->setAutoDefault( false ); - //connect( m_search_dialog, SIGNAL( searchResult( Smb4KHostItem * ) ), this, SLOT( slotInsertItem( Smb4KHostItem * ) ) ); + //connect( m_search_dialog, TQT_SIGNAL( searchResult( Smb4KHostItem * ) ), this, TQT_SLOT( slotInsertItem( Smb4KHostItem * ) ) ); searchDialog->show(); } @@ -188,11 +188,11 @@ void KonqSidebar_Smb4K::slotSmb4KOptionsDlg() if ( config_factory ) { - KConfigDialog *dlg = static_cast( config_factory->create( widget, "ConfigDialog", "KConfigDialog" ) ); + KConfigDialog *dlg = static_cast( TQT_TQWIDGET(config_factory->create( TQT_TQOBJECT(widget), "ConfigDialog", "KConfigDialog" )) ); if ( dlg ) { - connect( dlg, SIGNAL( settingsChanged() ), this, SLOT( slotSettingsChanged() ) ); + connect( dlg, TQT_SIGNAL( settingsChanged() ), this, TQT_SLOT( slotSettingsChanged() ) ); dlg->show(); } @@ -208,19 +208,19 @@ void KonqSidebar_Smb4K::slotSmb4KOptionsDlg() void KonqSidebar_Smb4K::slotSettingsChanged() { - QApplication::postEvent( m_browser_part, new QCustomEvent( EVENT_LOAD_SETTINGS ) ); + TQApplication::postEvent( m_browser_part, new TQCustomEvent( EVENT_LOAD_SETTINGS ) ); } -void KonqSidebar_Smb4K::slotMountedShare( const QString &mountedShare ) +void KonqSidebar_Smb4K::slotMountedShare( const TQString &mountedShare ) { emit openURLRequest( KURL(mountedShare) ); } -void KonqSidebar_Smb4K::slotPrepareUnmount( const QString &mountpoint ) +void KonqSidebar_Smb4K::slotPrepareUnmount( const TQString &mountpoint ) { - if ( QString::compare( currentKonquerorURL, mountpoint ) == 0 ) + if ( TQString::compare( currentKonquerorURL, mountpoint ) == 0 ) { - emit openURLRequest( KURL( QDir::home().canonicalPath() ) ); + emit openURLRequest( KURL( TQDir::home().canonicalPath() ) ); } else { diff --git a/plugin/smb4k_konqplugin.h b/plugin/smb4k_konqplugin.h index 7f57324..fbefb26 100644 --- a/plugin/smb4k_konqplugin.h +++ b/plugin/smb4k_konqplugin.h @@ -26,10 +26,10 @@ #endif #include -#include -#include -#include -#include +#include +#include +#include +#include #include #include #include @@ -40,11 +40,12 @@ #include -class smb4kWidget : public QVBox +class smb4kWidget : public TQVBox { Q_OBJECT + TQ_OBJECT public: - smb4kWidget( QWidget * parent = 0, const char * name = 0, WFlags f = 0 ); + smb4kWidget( TQWidget * tqparent = 0, const char * name = 0, WFlags f = 0 ); private: @@ -53,25 +54,26 @@ private: class KonqSidebar_Smb4K : public KonqSidebarPlugin { Q_OBJECT + TQ_OBJECT public: /** * Construct a @ref KonqSidebarPlugin. * * @param inst The sidebar's kinstance class. - * @param parent The sidebar internal button info class responsible for this plugin. + * @param tqparent The sidebar internal button info class responsible for this plugin. * @param widgetParent The container which will contain the plugins widget. * @param desktopName The filename of the configuration file. - * @param name A Qt object name for your plugin. + * @param name A TQt object name for your plugin. **/ - KonqSidebar_Smb4K(KInstance *inst,QObject *parent,QWidget *widgetParent, QString &desktopName, const char* name=0); + KonqSidebar_Smb4K(KInstance *inst,TQObject *tqparent,TQWidget *widgetParent, TQString &desktopName, const char* name=0); /** destructor */ ~KonqSidebar_Smb4K(); KHTMLPart* m_part; - virtual QWidget *getWidget(){ return (QWidget*)widget;} - virtual void *provides(const QString &) {return 0;} - void emitStatusBarText (const QString &) {;} + virtual TQWidget *getWidget(){ return (TQWidget*)widget;} + virtual void *provides(const TQString &) {return 0;} + void emitStatusBarText (const TQString &) {;} private: /** @@ -90,7 +92,7 @@ protected: */ smb4kWidget *widget; - QString currentKonquerorURL; + TQString currentKonquerorURL; virtual void handleURL(const KURL &url); @@ -117,7 +119,7 @@ protected slots: /** * Called from mounter when a share is mounted */ - void slotMountedShare( const QString & ); + void slotMountedShare( const TQString & ); /** * Called from the mounter just before a share is unmounted. This slot * changes the URL to the user's home so that we can unmount the share @@ -126,7 +128,7 @@ protected slots: * @param mountpoint The mount point of the share that's going to * be unmounted. */ - void slotPrepareUnmount( const QString &mounpoint ); + void slotPrepareUnmount( const TQString &mounpoint ); signals: // see void openURLRequest(const KURL &url, -- cgit v1.2.1