summaryrefslogtreecommitdiffstats
path: root/src/app/mainWindow.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-05-26 00:38:19 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-05-26 00:38:19 +0000
commitf0296ef9e1f94e23c00d6f490e565d1dc768416d (patch)
tree7f3fd9f99621c111ff67f2d62feb5960a3371853 /src/app/mainWindow.cpp
parent3098eb909534268622ce776f9a7bb5310d31b3c1 (diff)
downloadfilelight-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/app/mainWindow.cpp')
-rw-r--r--src/app/mainWindow.cpp82
1 files changed, 41 insertions, 41 deletions
diff --git a/src/app/mainWindow.cpp b/src/app/mainWindow.cpp
index 155ece0..7370784 100644
--- a/src/app/mainWindow.cpp
+++ b/src/app/mainWindow.cpp
@@ -22,9 +22,9 @@
#include <ktoolbar.h>
#include <kurl.h>
#include <kurlcompletion.h> //locationbar
-#include <qobjectlist.h>
-#include <qpopupmenu.h>
-#include <qtooltip.h>
+#include <tqobjectlist.h>
+#include <tqpopupmenu.h>
+#include <tqtooltip.h>
@@ -40,10 +40,10 @@ MainWindow::MainWindow()
KMessageBox::error( this, i18n("KDE could not find the Filelight Part, or the Filelight Part could not be started. Did you make install?") );
//exit() seems to not exist inside the std namespace for some users!
using namespace std;
- exit( 1 ); //don't use QApplication::exit() - it causes a crash
+ exit( 1 ); //don't use TQApplication::exit() - it causes a crash
}
- m_part = (Part *)factory->create( this, "part", "KParts::ReadOnlyPart" );
+ m_part = (Part *)factory->create( TQT_TQOBJECT(this), "part", "KParts::ReadOnlyPart" );
setCentralWidget( m_part->widget() );
setStandardToolBarMenuEnabled( true );
@@ -52,18 +52,18 @@ MainWindow::MainWindow()
stateChanged( "scan_failed" ); //bah! doesn't affect the parts' actions, should I add them to the actionCollection here?
- QObjectList *buttons = toolBar()->queryList( "KToolBarButton" );
+ TQObjectList *buttons = toolBar()->queryList( "KToolBarButton" );
if (buttons->isEmpty())
KMessageBox::error( this, i18n("Filelight is not installed properly, consequently its menus and toolbars will appear reduced or even empty") );
delete buttons;
- connect( m_part, SIGNAL(started( KIO::Job* )), SLOT(scanStarted()) );
- connect( m_part, SIGNAL(completed()), SLOT(scanCompleted()) );
- connect( m_part, SIGNAL(canceled( const QString& )), SLOT(scanFailed()) );
+ connect( m_part, TQT_SIGNAL(started( KIO::Job* )), TQT_SLOT(scanStarted()) );
+ connect( m_part, TQT_SIGNAL(completed()), TQT_SLOT(scanCompleted()) );
+ connect( m_part, TQT_SIGNAL(canceled( const TQString& )), TQT_SLOT(scanFailed()) );
//TODO test these
- connect( m_part, SIGNAL(canceled( const QString& )), m_histories, SLOT(stop()) );
- connect( BrowserExtension::childObject( m_part ), SIGNAL(openURLNotify()), SLOT(urlAboutToChange()) );
+ connect( m_part, TQT_SIGNAL(canceled( const TQString& )), m_histories, TQT_SLOT(stop()) );
+ connect( BrowserExtension::childObject( m_part ), TQT_SIGNAL(openURLNotify()), TQT_SLOT(urlAboutToChange()) );
KConfig* const config = KGlobal::config();
config->setGroup( "general" );
@@ -79,39 +79,39 @@ MainWindow::setupActions() //singleton function
m_combo = new KHistoryCombo( this, "history_combo" );
m_combo->setCompletionObject( new KURLCompletion( KURLCompletion::DirCompletion ) );
m_combo->setAutoDeleteCompletionObject( true );
- m_combo->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ m_combo->tqsetSizePolicy( TQSizePolicy( TQSizePolicy::Expanding, TQSizePolicy::Fixed ) );
m_combo->setDuplicatesEnabled( false );
- KStdAction::open( this, SLOT(slotScanDirectory()), ac, "scan_directory" );
- KStdAction::quit( this, SLOT(close()), ac );
- KStdAction::up( this, SLOT(slotUp()), ac );
- KStdAction::configureToolbars(this, SLOT(configToolbars()), ac);
- KStdAction::keyBindings(this, SLOT(configKeys()), ac);
+ KStdAction::open( TQT_TQOBJECT(this), TQT_SLOT(slotScanDirectory()), ac, "scan_directory" );
+ KStdAction::quit( TQT_TQOBJECT(this), TQT_SLOT(close()), ac );
+ KStdAction::up( TQT_TQOBJECT(this), TQT_SLOT(slotUp()), ac );
+ KStdAction::configureToolbars(TQT_TQOBJECT(this), TQT_SLOT(configToolbars()), ac);
+ KStdAction::keyBindings(TQT_TQOBJECT(this), TQT_SLOT(configKeys()), ac);
- new KAction( i18n( "Scan &Home Directory" ), "folder_home", CTRL+Key_Home, this, SLOT(slotScanHomeDirectory()), ac, "scan_home" );
- new KAction( i18n( "Scan &Root Directory" ), "folder_red", 0, this, SLOT(slotScanRootDirectory()), ac, "scan_root" );
- new KAction( i18n( "Rescan" ), "reload", KStdAccel::reload(), m_part, SLOT(rescan()), ac, "scan_rescan" );
- new KAction( i18n( "Stop" ), "stop", Qt::Key_Escape, this, SLOT(slotAbortScan()), ac, "scan_stop" );
- new KAction( i18n( "Clear Location Bar" ), KApplication::reverseLayout() ? "clear_left" : "locationbar_erase", 0, m_combo, SLOT(clearEdit()), ac, "clear_location" );
- new KAction( i18n( "Go" ), "key_enter", 0, m_combo, SIGNAL(returnPressed()), ac, "go" );
+ new KAction( i18n( "Scan &Home Directory" ), "folder_home", CTRL+Key_Home, TQT_TQOBJECT(this), TQT_SLOT(slotScanHomeDirectory()), ac, "scan_home" );
+ new KAction( i18n( "Scan &Root Directory" ), "folder_red", 0, TQT_TQOBJECT(this), TQT_SLOT(slotScanRootDirectory()), ac, "scan_root" );
+ new KAction( i18n( "Rescan" ), "reload", KStdAccel::reload(), TQT_TQOBJECT(m_part), TQT_SLOT(rescan()), ac, "scan_rescan" );
+ new KAction( i18n( "Stop" ), "stop", TQt::Key_Escape, TQT_TQOBJECT(this), TQT_SLOT(slotAbortScan()), ac, "scan_stop" );
+ new KAction( i18n( "Clear Location Bar" ), KApplication::reverseLayout() ? "clear_left" : "locationbar_erase", 0, TQT_TQOBJECT(m_combo), TQT_SLOT(clearEdit()), ac, "clear_location" );
+ new KAction( i18n( "Go" ), "key_enter", 0, TQT_TQOBJECT(m_combo), TQT_SIGNAL(returnPressed()), ac, "go" );
KWidgetAction *combo = new KWidgetAction( m_combo, i18n( "Location Bar" ), 0, 0, 0, ac, "location_bar" );
m_recentScans = new KRecentFilesAction( i18n( "&Recent Scans" ), 0, ac, "scan_recent", 8 );
- m_histories = new HistoryCollection( ac, this, "history_collection" );
+ m_histories = new HistoryCollection( ac, TQT_TQOBJECT(this), "history_collection" );
ac->action( "scan_directory" )->setText( i18n( "&Scan Directory..." ) );
m_recentScans->loadEntries( KGlobal::config() );
combo->setAutoSized( true ); //FIXME what does this do?
- connect( m_recentScans, SIGNAL(urlSelected( const KURL& )), SLOT(slotScanUrl( const KURL& )) );
- connect( m_combo, SIGNAL(returnPressed()), SLOT(slotComboScan()) );
- connect( m_histories, SIGNAL(activated( const KURL& )), SLOT(slotScanUrl( const KURL& )) );
+ connect( m_recentScans, TQT_SIGNAL(urlSelected( const KURL& )), TQT_SLOT(slotScanUrl( const KURL& )) );
+ connect( m_combo, TQT_SIGNAL(returnPressed()), TQT_SLOT(slotComboScan()) );
+ connect( m_histories, TQT_SIGNAL(activated( const KURL& )), TQT_SLOT(slotScanUrl( const KURL& )) );
}
bool
MainWindow::queryExit()
{
- if( !m_part ) //apparently std::exit() still calls this function, and abort() causes a crash..
+ if( !m_part ) //aptqparently std::exit() still calls this function, and abort() causes a crash..
return true;
KConfig* const config = KGlobal::config();
@@ -157,13 +157,13 @@ inline void MainWindow::slotUp() { slotScanUrl( m_part->url().upU
inline void
MainWindow::slotComboScan()
{
- const QString path = KShell::tildeExpand(m_combo->lineEdit()->text());
+ const TQString path = KShell::tildeExpand(m_combo->lineEdit()->text());
if (slotScanPath( path ))
m_combo->addToHistory( path );
}
inline bool
-MainWindow::slotScanPath( const QString &path )
+MainWindow::slotScanPath( const TQString &path )
{
return slotScanUrl( KURL::fromPathOrURL( path ) );
}
@@ -198,7 +198,7 @@ inline void
MainWindow::scanFailed()
{
stateChanged( "scan_failed" );
- setActionMenuTextOnly( action( "go_up" ), QString::null );
+ setActionMenuTextOnly( action( "go_up" ), TQString() );
m_combo->lineEdit()->clear();
}
@@ -214,7 +214,7 @@ MainWindow::scanCompleted()
if ( url.path( 1 ) == "/") {
goUp->setEnabled( false );
- setActionMenuTextOnly( goUp, QString() );
+ setActionMenuTextOnly( goUp, TQString() );
}
else
setActionMenuTextOnly( goUp, url.upURL().path( 1 ) );
@@ -247,7 +247,7 @@ void
MainWindow::readProperties( KConfig *config ) //virtual
{
m_histories->restore( config );
- slotScanPath( config->readEntry( "currentMap", QString::null ) );
+ slotScanPath( config->readEntry( "currentMap", TQString() ) );
}
} //namespace Filelight
@@ -256,23 +256,23 @@ MainWindow::readProperties( KConfig *config ) //virtual
/// declared in historyAction.h
-void setActionMenuTextOnly( KAction *a, QString const &suffix )
+void setActionMenuTextOnly( KAction *a, TQString const &suffix )
{
- QString const menu_text = suffix.isEmpty()
+ TQString const menu_text = suffix.isEmpty()
? a->text()
- : i18n( "&Up: /home/mxcl", "%1: %2" ).arg( a->text(), suffix );
+ : i18n( "&Up: /home/mxcl", "%1: %2" ).tqarg( a->text(), suffix );
for (int i = 0; i < a->containerCount(); ++i) {
- QWidget *w = a->container( i );
+ TQWidget *w = a->container( i );
int const id = a->itemId( i );
- if (w->inherits( "QPopupMenu" ))
- static_cast<QPopupMenu*>(w)->changeItem( id, menu_text );
+ if (w->inherits( TQPOPUPMENU_OBJECT_NAME_STRING ))
+ static_cast<TQPopupMenu*>(w)->changeItem( id, menu_text );
else if (w->inherits( "KToolBar" )) {
- QWidget *button = static_cast<KToolBar*>(w)->getWidget( id );
+ TQWidget *button = static_cast<KToolBar*>(w)->getWidget( id );
if (button->inherits( "KToolBarButton" ))
- QToolTip::add( button, suffix );
+ TQToolTip::add( button, suffix );
}
}
}