diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-05-26 00:38:19 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-05-26 00:38:19 +0000 |
commit | f0296ef9e1f94e23c00d6f490e565d1dc768416d (patch) | |
tree | 7f3fd9f99621c111ff67f2d62feb5960a3371853 /src/part/part.cpp | |
parent | 3098eb909534268622ce776f9a7bb5310d31b3c1 (diff) | |
download | filelight-f0296ef9e1f94e23c00d6f490e565d1dc768416d.tar.gz filelight-f0296ef9e1f94e23c00d6f490e565d1dc768416d.zip |
TQt4 port Filelight
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/filelight@1233561 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/part/part.cpp')
-rw-r--r-- | src/part/part.cpp | 82 |
1 files changed, 41 insertions, 41 deletions
diff --git a/src/part/part.cpp b/src/part/part.cpp index 9a4742a..c399800 100644 --- a/src/part/part.cpp +++ b/src/part/part.cpp @@ -20,9 +20,9 @@ #include <kparts/genericfactory.h> #include <kstatusbar.h> #include <kstdaction.h> -#include <qfile.h> //encodeName() -#include <qtimer.h> //postInit() hack -#include <qvbox.h> +#include <tqfile.h> //encodeName() +#include <tqtimer.h> //postInit() hack +#include <tqvbox.h> #include <unistd.h> //access() @@ -33,46 +33,46 @@ typedef KParts::GenericFactory<Filelight::Part> Factory; K_EXPORT_COMPONENT_FACTORY( libfilelight, Filelight::Factory ) -BrowserExtension::BrowserExtension( Part *parent, const char *name ) - : KParts::BrowserExtension( parent, name ) +BrowserExtension::BrowserExtension( Part *tqparent, const char *name ) + : KParts::BrowserExtension( tqparent, name ) {} -Part::Part( QWidget *parentWidget, const char *widgetName, QObject *parent, const char *name, const QStringList& ) - : ReadOnlyPart( parent, name ) +Part::Part( TQWidget *tqparentWidget, const char *widgetName, TQObject *tqparent, const char *name, const TQStringList& ) + : ReadOnlyPart( tqparent, name ) , m_ext( new BrowserExtension( this ) ) , m_statusbar( new StatusBarExtension( this ) ) , m_map( 0 ) , m_manager( new ScanManager( this ) ) , m_started( false ) { - QPixmap::setDefaultOptimization( QPixmap::BestOptim ); + TQPixmap::setDefaultOptimization( TQPixmap::BestOptim ); Config::read(); setInstance( Factory::instance() ); - setWidget( new QVBox( parentWidget, widgetName ) ); + setWidget( new TQVBox( tqparentWidget, widgetName ) ); setXMLFile( "filelight_partui.rc" ); m_map = new RadialMap::Widget( widget() ); m_map->hide(); - KStdAction::zoomIn( m_map, SLOT(zoomIn()), actionCollection() ); - KStdAction::zoomOut( m_map, SLOT(zoomOut()), actionCollection() ); - KStdAction::preferences( this, SLOT(configFilelight()), actionCollection(), "configure_filelight" )->setText( i18n( "Configure Filelight..." ) ); + KStdAction::zoomIn( TQT_TQOBJECT(m_map), TQT_SLOT(zoomIn()), actionCollection() ); + KStdAction::zoomOut( TQT_TQOBJECT(m_map), TQT_SLOT(zoomOut()), actionCollection() ); + KStdAction::preferences( this, TQT_SLOT(configFilelight()), actionCollection(), "configure_filelight" )->setText( i18n( "Configure Filelight..." ) ); - connect( m_map, SIGNAL(created( const Directory* )), SIGNAL(completed()) ); - connect( m_map, SIGNAL(created( const Directory* )), SLOT(mapChanged( const Directory* )) ); - connect( m_map, SIGNAL(activated( const KURL& )), SLOT(updateURL( const KURL& )) ); + connect( m_map, TQT_SIGNAL(created( const Directory* )), TQT_SIGNAL(completed()) ); + connect( m_map, TQT_SIGNAL(created( const Directory* )), TQT_SLOT(mapChanged( const Directory* )) ); + connect( m_map, TQT_SIGNAL(activated( const KURL& )), TQT_SLOT(updateURL( const KURL& )) ); // TODO make better system - connect( m_map, SIGNAL(giveMeTreeFor( const KURL& )), SLOT(updateURL( const KURL& )) ); - connect( m_map, SIGNAL(giveMeTreeFor( const KURL& )), SLOT(openURL( const KURL& )) ); + connect( m_map, TQT_SIGNAL(giveMeTreeFor( const KURL& )), TQT_SLOT(updateURL( const KURL& )) ); + connect( m_map, TQT_SIGNAL(giveMeTreeFor( const KURL& )), TQT_SLOT(openURL( const KURL& )) ); - connect( m_manager, SIGNAL(completed( Directory* )), SLOT(scanCompleted( Directory* )) ); - connect( m_manager, SIGNAL(aboutToEmptyCache()), m_map, SLOT(invalidate()) ); + connect( m_manager, TQT_SIGNAL(completed( Directory* )), TQT_SLOT(scanCompleted( Directory* )) ); + connect( m_manager, TQT_SIGNAL(aboutToEmptyCache()), m_map, TQT_SLOT(tqinvalidate()) ); - QTimer::singleShot( 0, this, SLOT(postInit()) ); + TQTimer::singleShot( 0, this, TQT_SLOT(postInit()) ); } void @@ -80,8 +80,8 @@ Part::postInit() { if( m_url.isEmpty() ) //if url is not empty openURL() has been called immediately after ctor, which happens { - QWidget *summary = new SummaryWidget( widget(), "summaryWidget" ); - connect( summary, SIGNAL(activated( const KURL& )), SLOT(openURL( const KURL& )) ); + TQWidget *summary = new SummaryWidget( widget(), "summaryWidget" ); + connect( summary, TQT_SIGNAL(activated( const KURL& )), TQT_SLOT(openURL( const KURL& )) ); summary->show(); //FIXME KXMLGUI is b0rked, it should allow us to set this @@ -99,14 +99,14 @@ Part::openURL( const KURL &u ) //TODO everyone hates dialogs, instead render the text in big fonts on the Map //TODO should have an empty KURL until scan is confirmed successful - //TODO probably should set caption to QString::null while map is unusable + //TODO probably should set caption to TQString() while map is unusable #define KMSG( s ) KMessageBox::information( widget(), s ) KURL url = u; url.cleanPath( true ); - const QString path = url.path( 1 ); - const QCString path8bit = QFile::encodeName( path ); + const TQString path = url.path( 1 ); + const TQCString path8bit = TQFile::encodeName( path ); const bool isLocal = url.protocol() == "file"; if( url.isEmpty() ) @@ -119,15 +119,15 @@ Part::openURL( const KURL &u ) } else if( path[0] != '/' ) { - KMSG( i18n( "Filelight only accepts absolute paths, eg. /%1" ).arg( path ) ); + KMSG( i18n( "Filelight only accepts absolute paths, eg. /%1" ).tqarg( path ) ); } else if( isLocal && access( path8bit, F_OK ) != 0 ) //stat( path, &statbuf ) == 0 { - KMSG( i18n( "Directory not found: %1" ).arg( path ) ); + KMSG( i18n( "Directory not found: %1" ).tqarg( path ) ); } else if( isLocal && access( path8bit, R_OK | X_OK ) != 0 ) { - KMSG( i18n( "Unable to enter: %1\nYou do not have access rights to this location." ).arg( path ) ); + KMSG( i18n( "Unable to enter: %1\nYou do not have access rights to this location." ).tqarg( path ) ); } else { @@ -165,10 +165,10 @@ Part::updateURL( const KURL &u ) void Part::configFilelight() { - QWidget *dialog = new SettingsDialog( widget(), "settings_dialog" ); + TQWidget *dialog = new SettingsDialog( widget(), "settings_dialog" ); - connect( dialog, SIGNAL(canvasIsDirty( int )), m_map, SLOT(refresh( int )) ); - connect( dialog, SIGNAL(mapIsInvalid()), m_manager, SLOT(emptyCache()) ); + connect( dialog, TQT_SIGNAL(canvasIsDirty( int )), m_map, TQT_SLOT(refresh( int )) ); + connect( dialog, TQT_SIGNAL(mapIsInvalid()), m_manager, TQT_SLOT(emptyCache()) ); dialog->show(); //deletes itself } @@ -184,20 +184,20 @@ Part::start( const KURL &url ) { if( !m_started ) { m_statusbar->addStatusBarItem( new ProgressBox( statusBar(), this ), 0, true ); - connect( m_map, SIGNAL(mouseHover( const QString& )), statusBar(), SLOT(message( const QString& )) ); - connect( m_map, SIGNAL(created( const Directory* )), statusBar(), SLOT(clear()) ); + connect( m_map, TQT_SIGNAL(mouseHover( const TQString& )), statusBar(), TQT_SLOT(message( const TQString& )) ); + connect( m_map, TQT_SIGNAL(created( const Directory* )), statusBar(), TQT_SLOT(clear()) ); m_started = true; } if( m_manager->start( url ) ) { m_url = url; - const QString s = i18n( "Scanning: %1" ).arg( prettyURL() ); + const TQString s = i18n( "Scanning: %1" ).tqarg( prettyURL() ); stateChanged( "scan_started" ); emit started( 0 ); //as a Part, we have to do this emit setWindowCaption( s ); statusBar()->message( s ); - m_map->invalidate(); //to maintain ui consistency + m_map->tqinvalidate(); //to maintain ui consistency return true; } @@ -209,7 +209,7 @@ void Part::rescan() { //FIXME we have to empty the cache because otherwise rescan picks up the old tree.. - m_manager->emptyCache(); //causes canvas to invalidate + m_manager->emptyCache(); //causes canvas to tqinvalidate start( m_url ); } @@ -226,11 +226,11 @@ Part::scanCompleted( Directory *tree ) } else { stateChanged( "scan_failed" ); - emit canceled( i18n( "Scan failed: %1" ).arg( prettyURL() ) ); - emit setWindowCaption( QString::null ); + emit canceled( i18n( "Scan failed: %1" ).tqarg( prettyURL() ) ); + emit setWindowCaption( TQString() ); statusBar()->clear(); -// QTimer::singleShot( 2000, statusBar(), SLOT(clear()) ); +// TQTimer::singleShot( 2000, statusBar(), TQT_SLOT(clear()) ); m_url = KURL(); } @@ -243,10 +243,10 @@ Part::mapChanged( const Directory *tree ) emit setWindowCaption( prettyURL() ); - ProgressBox *progress = static_cast<ProgressBox *>(statusBar()->child( "ProgressBox" )); + ProgressBox *progress = static_cast<ProgressBox *>(TQT_TQWIDGET(statusBar()->child( "ProgressBox" ))); if( progress ) - progress->setText( tree->children() ); + progress->setText( tree->tqchildren() ); } } //namespace Filelight |