Browse Source

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
v3.5.13-sru
tpearson 11 years ago
parent
commit
f0296ef9e1
  1. 18
      src/app/historyAction.cpp
  2. 19
      src/app/historyAction.h
  3. 82
      src/app/mainWindow.cpp
  4. 3
      src/app/mainWindow.h
  5. 4
      src/part/Config.cpp
  6. 4
      src/part/Config.h
  7. 96
      src/part/dialog.ui
  8. 14
      src/part/fileTree.cpp
  9. 28
      src/part/fileTree.h
  10. 50
      src/part/localLister.cpp
  11. 14
      src/part/localLister.h
  12. 82
      src/part/part.cpp
  13. 5
      src/part/part.h
  14. 22
      src/part/progressBox.cpp
  15. 11
      src/part/progressBox.h
  16. 14
      src/part/radialMap/builder.cpp
  17. 36
      src/part/radialMap/labels.cpp
  18. 62
      src/part/radialMap/map.cpp
  19. 10
      src/part/radialMap/radialMap.h
  20. 76
      src/part/radialMap/segmentTip.cpp
  21. 12
      src/part/radialMap/segmentTip.h
  22. 42
      src/part/radialMap/widget.cpp
  23. 43
      src/part/radialMap/widget.h
  24. 62
      src/part/radialMap/widgetEvents.cpp
  25. 48
      src/part/remoteLister.cpp
  26. 3
      src/part/remoteLister.h
  27. 32
      src/part/scan.cpp
  28. 13
      src/part/scan.h
  29. 64
      src/part/settingsDialog.cpp
  30. 11
      src/part/settingsDialog.h
  31. 110
      src/part/summaryWidget.cpp
  32. 7
      src/part/summaryWidget.h

18
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;

19
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 );

82
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 );
}
}
}

3
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();

4
src/part/Config.cpp

@ -14,7 +14,7 @@ uint Config::antiAliasFactor;
uint Config::minFontPitch;
uint Config::defaultRingDepth;
Filelight::MapScheme Config::scheme;
QStringList Config::skipList;
TQStringList Config::skipList;
inline KConfig&
@ -37,7 +37,7 @@ Filelight::Config::read()
showSmallFiles = config.readBoolEntry( "showSmallFiles", false );
contrast = config.readNumEntry( "contrast", 75 );
antiAliasFactor = config.readNumEntry( "antiAliasFactor", 2 );
minFontPitch = config.readNumEntry( "minFontPitch", QFont().pointSize() - 3);
minFontPitch = config.readNumEntry( "minFontPitch", TQFont().pointSize() - 3);
scheme = (MapScheme) config.readNumEntry( "scheme", 0 );
skipList = config.readPathListEntry( "skipList" );

4
src/part/Config.h

@ -2,7 +2,7 @@
#ifndef Config_H
#define Config_H
#include <qstringlist.h>
#include <tqstringlist.h>
class KConfig;
@ -32,7 +32,7 @@ namespace Filelight
static uint defaultRingDepth;
static MapScheme scheme;
static QStringList skipList;
static TQStringList skipList;
};
}

96
src/part/dialog.ui

@ -1,10 +1,10 @@
<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
<class>Dialog</class>
<widget class="QDialog">
<widget class="TQDialog">
<property name="name">
<cstring>Dialog</cstring>
</property>
<property name="geometry">
<property name="tqgeometry">
<rect>
<x>0</x>
<y>0</y>
@ -19,14 +19,14 @@
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QTabWidget">
<widget class="TQTabWidget">
<property name="name">
<cstring>tabWidget</cstring>
</property>
<property name="acceptDrops">
<bool>false</bool>
</property>
<widget class="QWidget">
<widget class="TQWidget">
<property name="name">
<cstring>Widget2</cstring>
</property>
@ -37,7 +37,7 @@
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLabel">
<widget class="TQLabel">
<property name="name">
<cstring>textLabel1</cstring>
</property>
@ -59,7 +59,7 @@
<cstring>m_listBox</cstring>
</property>
</widget>
<widget class="QListBox">
<widget class="TQListBox">
<property name="name">
<cstring>m_listBox</cstring>
</property>
@ -70,9 +70,9 @@
<string>Filelight will not scan these directories unless you specifically request them.</string>
</property>
</widget>
<widget class="QLayoutWidget">
<widget class="TQLayoutWidget">
<property name="name">
<cstring>layout4</cstring>
<cstring>tqlayout4</cstring>
</property>
<hbox>
<property name="name">
@ -88,14 +88,14 @@
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="sizeHint">
<property name="tqsizeHint">
<size>
<width>180</width>
<height>21</height>
</size>
</property>
</spacer>
<widget class="QPushButton">
<widget class="TQPushButton">
<property name="name">
<cstring>m_removeButton</cstring>
</property>
@ -109,7 +109,7 @@
<bool>false</bool>
</property>
</widget>
<widget class="QPushButton">
<widget class="TQPushButton">
<property name="name">
<cstring>m_addButton</cstring>
</property>
@ -129,7 +129,7 @@
<property name="name">
<cstring>line1</cstring>
</property>
<property name="minimumSize">
<property name="tqminimumSize">
<size>
<width>0</width>
<height>15</height>
@ -151,9 +151,9 @@
<enum>Horizontal</enum>
</property>
</widget>
<widget class="QLayoutWidget">
<widget class="TQLayoutWidget">
<property name="name">
<cstring>layout7</cstring>
<cstring>tqlayout7</cstring>
</property>
<grid>
<property name="name">
@ -169,27 +169,27 @@
<property name="sizeType">
<enum>Fixed</enum>
</property>
<property name="sizeHint">
<property name="tqsizeHint">
<size>
<width>16</width>
<height>50</height>
</size>
</property>
</spacer>
<widget class="QCheckBox" row="1" column="1">
<widget class="TQCheckBox" row="1" column="1">
<property name="name">
<cstring>dontScanRemoteMounts</cstring>
</property>
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize">
<property name="tqminimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<property name="tqmaximumSize">
<size>
<width>32767</width>
<height>32767</height>
@ -208,7 +208,7 @@
<string>Prevents scanning of filesystems that are not on this computer, e.g. NFS or Samba mounts.</string>
</property>
</widget>
<widget class="QCheckBox" row="0" column="0" rowspan="1" colspan="2">
<widget class="TQCheckBox" row="0" column="0" rowspan="1" colspan="2">
<property name="name">
<cstring>scanAcrossMounts</cstring>
</property>
@ -219,7 +219,7 @@
<string>Allows scans to enter directories that are part of other filesystems. For example, when unchecked, this will usually prevent the contents of &lt;b&gt;/mnt&lt;/b&gt; from being scanned if you scan &lt;b&gt;/&lt;/b&gt;.</string>
</property>
</widget>
<widget class="QCheckBox" row="2" column="1">
<widget class="TQCheckBox" row="2" column="1">
<property name="name">
<cstring>dontScanRemovableMedia</cstring>
</property>
@ -240,7 +240,7 @@
</widget>
</vbox>
</widget>
<widget class="QWidget">
<widget class="TQWidget">
<property name="name">
<cstring>Widget3</cstring>
</property>
@ -251,7 +251,7 @@
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QGroupBox">
<widget class="TQGroupBox">
<property name="name">
<cstring>groupBox1</cstring>
</property>
@ -262,7 +262,7 @@
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QVButtonGroup">
<widget class="TQVButtonGroup">
<property name="name">
<cstring>colourSchemeGroup</cstring>
</property>
@ -275,15 +275,15 @@
</sizepolicy>
</property>
</widget>
<widget class="QLayoutWidget">
<widget class="TQLayoutWidget">
<property name="name">
<cstring>layout10</cstring>
<cstring>tqlayout10</cstring>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLabel">
<widget class="TQLabel">
<property name="name">
<cstring>textLabel3</cstring>
</property>
@ -297,7 +297,7 @@
<cstring>contrastSlider</cstring>
</property>
</widget>
<widget class="QSlider">
<widget class="TQSlider">
<property name="name">
<cstring>contrastSlider</cstring>
</property>
@ -318,7 +318,7 @@
</widget>
</vbox>
</widget>
<widget class="QCheckBox">
<widget class="TQCheckBox">
<property name="name">
<cstring>useAntialiasing</cstring>
</property>
@ -329,9 +329,9 @@
<string>Anti-aliasing the filemap makes it clearer and prettier, unfortunately it also makes rendering very slow.</string>
</property>
</widget>
<widget class="QLayoutWidget">
<widget class="TQLayoutWidget">
<property name="name">
<cstring>layout10</cstring>
<cstring>tqlayout10</cstring>
</property>
<vbox>
<property name="name">
@ -340,7 +340,7 @@
<property name="spacing">
<number>0</number>
</property>
<widget class="QCheckBox">
<widget class="TQCheckBox">
<property name="name">
<cstring>varyLabelFontSizes</cstring>
</property>
@ -354,9 +354,9 @@
<string>The font size of exploded labels can be varied relative to the depth of the directories they represent. This helps you spot the important labels more easily. Set a sensible minimum font size.</string>
</property>
</widget>
<widget class="QLayoutWidget">
<widget class="TQLayoutWidget">
<property name="name">
<cstring>layout9</cstring>
<cstring>tqlayout9</cstring>
</property>
<hbox>
<property name="name">
@ -372,14 +372,14 @@
<property name="sizeType">
<enum>Fixed</enum>
</property>
<property name="sizeHint">
<property name="tqsizeHint">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
<widget class="QLabel">
<widget class="TQLabel">
<property name="name">
<cstring>textLabel2</cstring>
</property>
@ -414,7 +414,7 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<property name="tqminimumSize">
<size>
<width>80</width>
<height>0</height>
@ -434,7 +434,7 @@
</widget>
</vbox>
</widget>
<widget class="QCheckBox">
<widget class="TQCheckBox">
<property name="name">
<cstring>showSmallFiles</cstring>
</property>
@ -448,15 +448,15 @@
</vbox>
</widget>
</widget>
<widget class="QLayoutWidget">
<widget class="TQLayoutWidget">
<property name="name">
<cstring>layout6</cstring>
<cstring>tqlayout6</cstring>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QPushButton">
<widget class="TQPushButton">
<property name="name">
<cstring>m_resetButton</cstring>
</property>
@ -480,14 +480,14 @@
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="sizeHint">
<property name="tqsizeHint">
<size>
<width>120</width>
<height>30</height>
</size>
</property>
</spacer>
<widget class="QPushButton">
<widget class="TQPushButton">
<property name="name">
<cstring>m_closeButton</cstring>
</property>
@ -504,8 +504,8 @@
</widget>
<customwidgets>
<customwidget>
<class>QVButtonGroup</class>
<header location="global">qvbuttongroup.h</header>
<class>TQVButtonGroup</class>
<header location="global">tqvbuttongroup.h</header>
<sizehint>
<width>-1</width>
<height>-1</height>
@ -561,14 +561,14 @@
<tabstop>dontScanRemoteMounts</tabstop>
<tabstop>dontScanRemovableMedia</tabstop>
</tabstops>
<slots>
<Q_SLOTS>
<slot>toggleDontScanRemovableMedia(bool)</slot>
<slot>toggleDontScanRemoteMounts(bool)</slot>
<slot>toggleScanAcrossMounts(bool)</slot>
</slots>
<layoutdefaults spacing="6" margin="11"/>
</Q_SLOTS>
<tqlayoutdefaults spacing="6" margin="11"/>
<includehints>
<includehint>qvbuttongroup.h</includehint>
<includehint>tqvbuttongroup.h</includehint>
<includehint>knuminput.h</includehint>
</includehints>
</UI>

14
src/part/fileTree.cpp

@ -4,7 +4,7 @@
#include "fileTree.h"
#include <kglobal.h>
#include <klocale.h>
#include <qfile.h>
#include <tqfile.h>
//static definitions
@ -12,33 +12,33 @@ const uint File::DENOMINATOR[4] = { 1<<0, 1<<10, 1<<20, 1<<30 };
static const char PREFIX[4] = { 'K', 'M', 'G', 'T' };
QString
TQString
File::fullPath( const Directory *root /*= 0*/ ) const
{
QString path;
TQString path;
if( root == this )
root = 0; //prevent returning empty string when there is something we could return
for( const Directory *d = (Directory*)this; d != root && d; d = d->parent() )
for( const Directory *d = (Directory*)this; d != root && d; d = d->tqparent() )
path.prepend( d->name() );
return path;
}
QString
TQString
File::humanReadableSize( UnitPrefix key /*= mega*/ ) const //FIXME inline
{
return humanReadableSize( m_size, key );
}
QString
TQString
File::humanReadableSize( uint size, UnitPrefix key /*= mega*/ ) //static
{
if( size == 0 )
return "0 B";
QString s;
TQString s;
double prettySize = (double)size / (double)DENOMINATOR[key];
const KLocale &locale = *KGlobal::locale();

28
src/part/fileTree.h

@ -4,8 +4,8 @@
#ifndef FILETREE_H
#define FILETREE_H
#include <qcstring.h> //qstrdup
#include <qfile.h> //decodeName()
#include <tqcstring.h> //qstrdup
#include <tqfile.h> //decodeName()
#include <stdlib.h>
@ -153,7 +153,7 @@ private:
class Directory;
class QString;
class TQString;
class File
{
@ -168,21 +168,21 @@ public:
File( const char *name, FileSize size ) : m_parent( 0 ), m_name( qstrdup( name ) ), m_size( size ) {}
virtual ~File() { delete [] m_name; }
const Directory *parent() const { return m_parent; }
const Directory *tqparent() const { return m_parent; }
const char *name8Bit() const { return m_name; }
const FileSize size() const { return m_size; }
QString name() const { return QFile::decodeName( m_name ); }
TQString name() const { return TQFile::decodeName( m_name ); }
virtual bool isDirectory() const { return false; }
QString fullPath( const Directory* = 0 ) const;
QString humanReadableSize( UnitPrefix key = mega ) const;
TQString fullPath( const Directory* = 0 ) const;
TQString humanReadableSize( UnitPrefix key = mega ) const;
public:
static QString humanReadableSize( uint size, UnitPrefix Key = mega );
static TQString humanReadableSize( uint size, UnitPrefix Key = mega );
protected:
File( const char *name, FileSize size, Directory *parent ) : m_parent( parent ), m_name( qstrdup( name ) ), m_size( size ) {}
File( const char *name, FileSize size, Directory *tqparent ) : m_parent( tqparent ), m_name( qstrdup( name ) ), m_size( size ) {}
Directory *m_parent; //0 if this is treeRoot
char *m_name;
@ -197,9 +197,9 @@ private:
class Directory : public Chain<File>, public File
{
public:
Directory( const char *name ) : File( name, 0 ), m_children( 0 ) {} //DON'T pass the full path!
Directory( const char *name ) : File( name, 0 ), m_tqchildren( 0 ) {} //DON'T pass the full path!
uint children() const { return m_children; }
uint tqchildren() const { return m_tqchildren; }
virtual bool isDirectory() const { return true; }
///appends a Directory
@ -209,7 +209,7 @@ public:
delete [] d->m_name;
d->m_name = qstrdup( name ); } //directories that had a fullpath copy just their names this way
m_children += d->children(); //doesn't include the dir itself
m_tqchildren += d->tqchildren(); //doesn't include the dir itself
d->m_parent = this;
append( (File*)d ); //will add 1 to filecount for the dir itself
}
@ -223,12 +223,12 @@ public:
private:
void append( File *p )
{
m_children++;
m_tqchildren++;
m_size += p->size();
Chain<File>::append( p );
}
uint m_children;
uint m_tqchildren;
private:
Directory( const Directory& ); //undefined

50
src/part/localLister.cpp

@ -10,8 +10,8 @@
#ifdef HAVE_MNTENT_H
#include <mntent.h>
#endif
#include <qapplication.h> //postEvent()
#include <qfile.h>
#include <tqapplication.h> //postEvent()
#include <tqfile.h>
#include "scan.h"
#include <sys/stat.h>
#include <sys/types.h>
@ -19,23 +19,23 @@
namespace Filelight
{
QStringList LocalLister::s_remoteMounts;
QStringList LocalLister::s_localMounts;
TQStringList LocalLister::s_remoteMounts;
TQStringList LocalLister::s_localMounts;
LocalLister::LocalLister( const QString &path, Chain<Directory> *cachedTrees, QObject *parent )
: QThread()
LocalLister::LocalLister( const TQString &path, Chain<Directory> *cachedTrees, TQObject *tqparent )
: TQThread()
, m_path( path )
, m_trees( cachedTrees )
, m_parent( parent )
, m_parent( tqparent )
{
//add empty directories for any mount points that are in the path
//TODO empty directories is not ideal as adds to fileCount incorrectly
QStringList list( Config::skipList );
TQStringList list( Config::skipList );
if( !Config::scanAcrossMounts ) list += s_localMounts;
if( !Config::scanRemoteMounts ) list += s_remoteMounts;
for( QStringList::ConstIterator it = list.constBegin(); it != list.constEnd(); ++it )
for( TQStringList::ConstIterator it = list.constBegin(); it != list.constEnd(); ++it )
if( (*it).startsWith( path ) )
//prevent scanning of these directories
m_trees->append( new Directory( (*it).local8Bit() ) );
@ -47,7 +47,7 @@ namespace Filelight
LocalLister::run()
{
//recursively scan the requested path
const QCString path = QFile::encodeName( m_path );
const TQCString path = TQFile::encodeName( m_path );
Directory *tree = scan( path, path );
//delete the list of trees useful for this scan,
@ -61,9 +61,9 @@ namespace Filelight
tree = 0;
}
QCustomEvent *e = new QCustomEvent( 1000 );
TQCustomEvent *e = new TQCustomEvent( 1000 );
e->setData( tree );
QApplication::postEvent( m_parent, e );
TQApplication::postEvent( m_parent, e );
}
// from system.h in GNU coreutils package
@ -127,7 +127,7 @@ namespace Filelight
#include <errno.h>
static void
outputError( QCString path )
outputError( TQCString path )
{
///show error message that stat or opendir may give
@ -160,7 +160,7 @@ namespace Filelight
}
Directory*
LocalLister::scan( const QCString &path, const QCString &dirname )
LocalLister::scan( const TQCString &path, const TQCString &dirname )
{
Directory *cwd = new Directory( dirname );
DIR *dir = opendir( path );
@ -180,7 +180,7 @@ namespace Filelight
if( qstrcmp( ent->d_name, "." ) == 0 || qstrcmp( ent->d_name, ".." ) == 0 )
continue;
QCString new_path = path; new_path += ent->d_name;
TQCString new_path = path; new_path += ent->d_name;
//get file information
if( lstat( new_path, &statbuf ) == -1 ) {
@ -204,7 +204,7 @@ namespace Filelight
else if( S_ISDIR( statbuf.st_mode ) ) //directory
{
Directory *d = 0;
QCString new_dirname = ent->d_name;
TQCString new_dirname = ent->d_name;
new_dirname += '/';
new_path += '/';
@ -216,7 +216,7 @@ namespace Filelight
{
debug() << "Tree pre-completed: " << (*it)->name() << "\n";
d = it.remove();
ScanManager::s_files += d->children();
ScanManager::s_files += d->tqchildren();
//**** ideally don't have this redundant extra somehow
cwd->append( d, new_dirname );
}
@ -251,7 +251,7 @@ namespace Filelight
#ifdef HAVE_MNTENT_H
struct mntent *mnt_ent;
#endif
QString str;
TQString str;
#ifdef HAVE_MNTENT_H
@ -267,7 +267,7 @@ namespace Filelight
#define FS_TYPE fstab_ent->fs_vfstype // fs-type
#define FS_MNTOPS fstab_ent->fs_mntops // mount-options
QStringList remoteFsTypes;
TQStringList remoteFsTypes;
remoteFsTypes << "smbfs" ;
#ifdef MNTTYPE_NFS
remoteFsTypes << MNTTYPE_NFS;
@ -278,11 +278,11 @@ namespace Filelight
while( (fstab_ent = getfsent()) != NULL )
{
str = QString( FS_FILE );
str = TQString( FS_FILE );
if( str == "/" ) continue;
str += '/';
if( remoteFsTypes.contains( FS_TYPE ) )
if( remoteFsTypes.tqcontains( FS_TYPE ) )
s_remoteMounts.append( str ); //**** NO! can't be sure won't have trailing slash, need to do a check first dummy!!
else
@ -310,15 +310,15 @@ namespace Filelight
{
bool b = false;
str = QString( FS_FILE );
str = TQString( FS_FILE );
if( str == "/" ) continue;
str += "/";
if( remoteFsTypes.contains( FS_TYPE ) )
if( b = !s_remoteMounts.contains( str ) )
if( remoteFsTypes.tqcontains( FS_TYPE ) )
if( b = !s_remoteMounts.tqcontains( str ) )
s_remoteMounts.append( str ); //**** NO! can't be sure won't have trailing slash, need to do a check first dummy!!
else if( b = !s_localMounts.contains( str ) )
else if( b = !s_localMounts.tqcontains( str ) )
s_localMounts.append( str ); //**** NO! can't be sure won't have trailing slash, need to do a check first dummy!!
if( b ) kdDebug() << "MTAB: " << FS_TYPE << "\n";

14
src/part/localLister.h

@ -4,31 +4,31 @@
#ifndef LOCALLISTER_H
#define LOCALLISTER_H
#include <qthread.h>
#include <tqthread.h>
class Directory;
template<class T> class Chain;
namespace Filelight
{
class LocalLister : public QThread
class LocalLister : public TQThread
{
public:
LocalLister( const QString &path, Chain<Directory> *cachedTrees, QObject *parent );
LocalLister( const TQString &path, Chain<Directory> *cachedTrees, TQObject *tqparent );
static bool readMounts();
private:
QString m_path;
TQString m_path;
Chain<Directory> *m_trees;
QObject *m_parent;
TQObject *m_parent;
private:
virtual void run();
Directory *scan( const QCString&, const QCString& );
Directory *scan( const TQCString&, const TQCString& );
private:
static QStringList s_localMounts, s_remoteMounts; //TODO namespace
static TQStringList s_localMounts, s_remoteMounts; //TODO namespace
};
}

82
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