Browse Source

Rename a number of classes to enhance compatibility with KDE4

pull/1/head
Timothy Pearson 9 years ago
parent
commit
1d88613b6b
  1. 14
      src/app/historyAction.cpp
  2. 12
      src/app/historyAction.h
  3. 32
      src/app/mainWindow.cpp
  4. 6
      src/app/mainWindow.h
  5. 2
      src/part/radialMap/widgetEvents.cpp

14
src/app/historyAction.cpp

@ -9,12 +9,12 @@
inline
HistoryAction::HistoryAction( const TQString &text, const char *icon, const KShortcut &cut, KActionCollection *ac, const char *name )
: KAction( text, icon, cut, 0, 0, ac, name )
HistoryAction::HistoryAction( const TQString &text, const char *icon, const TDEShortcut &cut, TDEActionCollection *ac, const char *name )
: TDEAction( text, icon, cut, 0, 0, ac, name )
, m_text( text )
{
// ui files make this false, but we can't rely on UI file as it isn't compiled in :(
KAction::setEnabled( false );
TDEAction::setEnabled( false );
}
void
@ -24,7 +24,7 @@ HistoryAction::push( const TQString &path )
{
m_list.append( path );
setActionMenuTextOnly( this, path );
KAction::setEnabled( true );
TDEAction::setEnabled( true );
}
}
@ -40,10 +40,10 @@ HistoryAction::pop()
HistoryCollection::HistoryCollection( KActionCollection *ac, TQObject *parent, const char *name )
HistoryCollection::HistoryCollection( TDEActionCollection *ac, TQObject *parent, const char *name )
: TQObject( parent, 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_b( new HistoryAction( i18n( "Back" ), "back", TDEStdAccel::back(), ac, "go_back" ) )
, m_f( new HistoryAction( i18n( "Forward" ), "forward", TDEStdAccel::forward(), ac, "go_forward" ) )
, m_receiver( 0 )
{
connect( m_b, TQT_SIGNAL(activated()), TQT_SLOT(pop()) );

12
src/app/historyAction.h

@ -12,19 +12,19 @@ class TDEConfig;
/// defined in mainWindow.cpp
void setActionMenuTextOnly( KAction *a, TQString const &suffix );
void setActionMenuTextOnly( TDEAction *a, TQString const &suffix );
class HistoryAction : KAction
class HistoryAction : TDEAction
{
HistoryAction( const TQString &text, const char *icon, const KShortcut &cut, KActionCollection *ac, const char *name );
HistoryAction( const TQString &text, const char *icon, const TDEShortcut &cut, TDEActionCollection *ac, const char *name );
friend class HistoryCollection;
public:
virtual void setEnabled( bool b = true ) { KAction::setEnabled( b ? !m_list.isEmpty() : false ); }
virtual void setEnabled( bool b = true ) { TDEAction::setEnabled( b ? !m_list.isEmpty() : false ); }
void clear() { m_list.clear(); KAction::setText( m_text ); }
void clear() { m_list.clear(); TDEAction::setText( m_text ); }
private:
void setText();
@ -43,7 +43,7 @@ Q_OBJECT
public:
HistoryCollection( KActionCollection *ac, TQObject *parent, const char *name );
HistoryCollection( TDEActionCollection *ac, TQObject *parent, const char *name );
void save( TDEConfig *config );
void restore( TDEConfig *config );

32
src/app/mainWindow.cpp

@ -6,7 +6,7 @@
#include "historyAction.h"
#include <cstdlib> //std::exit()
#include <kaccel.h> //KStdAccel namespace
#include <kaccel.h> //TDEStdAccel namespace
#include <kaction.h>
#include <kapplication.h> //setupActions()
#include <kcombobox.h> //locationbar
@ -52,7 +52,7 @@ MainWindow::MainWindow()
stateChanged( "scan_failed" ); //bah! doesn't affect the parts' actions, should I add them to the actionCollection here?
TQObjectList *buttons = toolBar()->queryList( "KToolBarButton" );
TQObjectList *buttons = toolBar()->queryList( "TDEToolBarButton" );
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;
@ -74,7 +74,7 @@ MainWindow::MainWindow()
inline void
MainWindow::setupActions() //singleton function
{
KActionCollection *const ac = actionCollection();
TDEActionCollection *const ac = actionCollection();
m_combo = new KHistoryCombo( this, "history_combo" );
m_combo->setCompletionObject( new KURLCompletion( KURLCompletion::DirCompletion ) );
@ -88,15 +88,15 @@ MainWindow::setupActions() //singleton function
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, 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" ), TDEApplication::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" );
new TDEAction( i18n( "Scan &Home Directory" ), "folder_home", CTRL+Key_Home, TQT_TQOBJECT(this), TQT_SLOT(slotScanHomeDirectory()), ac, "scan_home" );
new TDEAction( i18n( "Scan &Root Directory" ), "folder_red", 0, TQT_TQOBJECT(this), TQT_SLOT(slotScanRootDirectory()), ac, "scan_root" );
new TDEAction( i18n( "Rescan" ), "reload", TDEStdAccel::reload(), TQT_TQOBJECT(m_part), TQT_SLOT(rescan()), ac, "scan_rescan" );
new TDEAction( i18n( "Stop" ), "stop", TQt::Key_Escape, TQT_TQOBJECT(this), TQT_SLOT(slotAbortScan()), ac, "scan_stop" );
new TDEAction( i18n( "Clear Location Bar" ), TDEApplication::reverseLayout() ? "clear_left" : "locationbar_erase", 0, TQT_TQOBJECT(m_combo), TQT_SLOT(clearEdit()), ac, "clear_location" );
new TDEAction( 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_recentScans = new TDERecentFilesAction( i18n( "&Recent Scans" ), 0, ac, "scan_recent", 8 );
m_histories = new HistoryCollection( ac, TQT_TQOBJECT(this), "history_collection" );
ac->action( "scan_directory" )->setText( i18n( "&Scan Directory..." ) );
@ -176,7 +176,7 @@ MainWindow::slotScanUrl( const KURL &url )
if (b) {
m_histories->push( oldUrl );
action( "go_back" )->KAction::setEnabled( false ); } //FIXME
action( "go_back" )->TDEAction::setEnabled( false ); } //FIXME
return b;
}
@ -205,7 +205,7 @@ MainWindow::scanFailed()
void
MainWindow::scanCompleted()
{
KAction *goUp = action( "go_up" );
TDEAction *goUp = action( "go_up" );
const KURL url = m_part->url();
stateChanged( "scan_complete" );
@ -256,7 +256,7 @@ MainWindow::readProperties( TDEConfig *config ) //virtual
/// declared in historyAction.h
void setActionMenuTextOnly( KAction *a, TQString const &suffix )
void setActionMenuTextOnly( TDEAction *a, TQString const &suffix )
{
TQString const menu_text = suffix.isEmpty()
? a->text()
@ -269,9 +269,9 @@ void setActionMenuTextOnly( KAction *a, TQString const &suffix )
if (w->inherits( TQPOPUPMENU_OBJECT_NAME_STRING ))
static_cast<TQPopupMenu*>(w)->changeItem( id, menu_text );
else if (w->inherits( "KToolBar" )) {
TQWidget *button = static_cast<KToolBar*>(w)->getWidget( id );
if (button->inherits( "KToolBarButton" ))
else if (w->inherits( "TDEToolBar" )) {
TQWidget *button = static_cast<TDEToolBar*>(w)->getWidget( id );
if (button->inherits( "TDEToolBarButton" ))
TQToolTip::add( button, suffix );
}
}

6
src/app/mainWindow.h

@ -22,8 +22,8 @@
class KSqueezedTextLabel;
class KHistoryCombo;
class KAction;
class KRecentFilesAction;
class TDEAction;
class TDERecentFilesAction;
class ScanProgressBox;
class HistoryCollection;
@ -73,7 +73,7 @@ class MainWindow : public KParts::MainWindow
KSqueezedTextLabel *m_status[2];
KHistoryCombo *m_combo;
HistoryCollection *m_histories;
KRecentFilesAction *m_recentScans;
TDERecentFilesAction *m_recentScans;
void setupStatusBar();
void setupActions();

2
src/part/radialMap/widgetEvents.cpp

@ -158,7 +158,7 @@ RadialMap::Widget::mousePressEvent( TQMouseEvent *e )
if( e->button() == Qt::RightButton )
{
KPopupMenu popup;
TDEPopupMenu popup;
popup.insertTitle( m_focus->file()->fullPath( m_tree ) );
if (isDir) {

Loading…
Cancel
Save