summaryrefslogtreecommitdiffstats
path: root/src/app
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
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')
-rw-r--r--src/app/historyAction.cpp18
-rw-r--r--src/app/historyAction.h19
-rw-r--r--src/app/mainWindow.cpp82
-rw-r--r--src/app/mainWindow.h3
4 files changed, 62 insertions, 60 deletions
diff --git a/src/app/historyAction.cpp b/src/app/historyAction.cpp
index bf715cb..0013cfe 100644
--- a/src/app/historyAction.cpp
+++ b/src/app/historyAction.cpp
@@ -9,7 +9,7 @@
inline
-HistoryAction::HistoryAction( const QString &text, const char *icon, const KShortcut &cut, KActionCollection *ac, const char *name )
+HistoryAction::HistoryAction( const TQString &text, const char *icon, const KShortcut &cut, KActionCollection *ac, const char *name )
: KAction( text, icon, cut, 0, 0, ac, name )
, m_text( text )
{
@@ -18,7 +18,7 @@ HistoryAction::HistoryAction( const QString &text, const char *icon, const KShor
}
void
-HistoryAction::push( const QString &path )
+HistoryAction::push( const TQString &path )
{
if( !path.isEmpty() && m_list.last() != path )
{
@@ -28,10 +28,10 @@ HistoryAction::push( const QString &path )
}
}
-QString
+TQString
HistoryAction::pop()
{
- const QString s = m_list.last();
+ const TQString s = m_list.last();
m_list.pop_back();
setActionMenuTextOnly( this, m_list.last() );
setEnabled();
@@ -40,14 +40,14 @@ HistoryAction::pop()
-HistoryCollection::HistoryCollection( KActionCollection *ac, QObject *parent, const char *name )
- : QObject( parent, name )
+HistoryCollection::HistoryCollection( KActionCollection *ac, TQObject *tqparent, const char *name )
+ : TQObject( tqparent, name )
, m_b( new HistoryAction( i18n( "Back" ), "back", KStdAccel::back(), ac, "go_back" ) )
, m_f( new HistoryAction( i18n( "Forward" ), "forward", KStdAccel::forward(), ac, "go_forward" ) )
, m_receiver( 0 )
{
- connect( m_b, SIGNAL(activated()), SLOT(pop()) );
- connect( m_f, SIGNAL(activated()), SLOT(pop()) );
+ connect( m_b, TQT_SIGNAL(activated()), TQT_SLOT(pop()) );
+ connect( m_f, TQT_SIGNAL(activated()), TQT_SLOT(pop()) );
}
void
@@ -70,7 +70,7 @@ void
HistoryCollection::pop() //slot
{
KURL url;
- const QString path = ((HistoryAction*)sender())->pop(); //FIXME here we remove the constness
+ const TQString path = ((HistoryAction*)sender())->pop(); //FIXME here we remove the constness
url.setPath( path );
m_receiver = (sender() == m_b) ? m_f : m_b;
diff --git a/src/app/historyAction.h b/src/app/historyAction.h
index 773093c..dbbf19e 100644
--- a/src/app/historyAction.h
+++ b/src/app/historyAction.h
@@ -6,18 +6,18 @@
#include <kaction.h>
#include <kurl.h>
-#include <qstringlist.h>
+#include <tqstringlist.h>
class KConfig;
/// defined in mainWindow.cpp
-void setActionMenuTextOnly( KAction *a, QString const &suffix );
+void setActionMenuTextOnly( KAction *a, TQString const &suffix );
class HistoryAction : KAction
{
- HistoryAction( const QString &text, const char *icon, const KShortcut &cut, KActionCollection *ac, const char *name );
+ HistoryAction( const TQString &text, const char *icon, const KShortcut &cut, KActionCollection *ac, const char *name );
friend class HistoryCollection;
@@ -29,20 +29,21 @@ public:
private:
void setText();
- void push( const QString &path );
- QString pop();
+ void push( const TQString &path );
+ TQString pop();
- const QString m_text;
- QStringList m_list;
+ const TQString m_text;
+ TQStringList m_list;
};
-class HistoryCollection : public QObject
+class HistoryCollection : public TQObject
{
Q_OBJECT
+ TQ_OBJECT
public:
- HistoryCollection( KActionCollection *ac, QObject *parent, const char *name );
+ HistoryCollection( KActionCollection *ac, TQObject *tqparent, const char *name );
void save( KConfig *config );
void restore( KConfig *config );
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 );
}
}
}
diff --git a/src/app/mainWindow.h b/src/app/mainWindow.h
index 87001c8..bef82d1 100644
--- a/src/app/mainWindow.h
+++ b/src/app/mainWindow.h
@@ -36,6 +36,7 @@ class Part;
class MainWindow : public KParts::MainWindow
{
Q_OBJECT
+ TQ_OBJECT
public:
MainWindow();
@@ -49,7 +50,7 @@ class MainWindow : public KParts::MainWindow
void slotScanHomeDirectory();
void slotScanRootDirectory();
bool slotScanUrl( const KURL& );
- bool slotScanPath( const QString& );
+ bool slotScanPath( const TQString& );
void slotAbortScan();
void configToolbars();