summaryrefslogtreecommitdiffstats
path: root/krename/ProgressDialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'krename/ProgressDialog.cpp')
-rw-r--r--krename/ProgressDialog.cpp102
1 files changed, 47 insertions, 55 deletions
diff --git a/krename/ProgressDialog.cpp b/krename/ProgressDialog.cpp
index 81723b5..91110e6 100644
--- a/krename/ProgressDialog.cpp
+++ b/krename/ProgressDialog.cpp
@@ -16,14 +16,10 @@
***************************************************************************/
// QT Includes
-#include <qlayout.h>
-#include <qprogressbar.h>
-#include <qtimer.h>
-#include <qtooltip.h>
-
-#if QT_VERSION < 0x030100
- #include <qregexp.h>
-#endif
+#include <tqlayout.h>
+#include <tqprogressbar.h>
+#include <tqtimer.h>
+#include <tqtooltip.h>
// KDE includes
#include <kapplication.h>
@@ -34,7 +30,7 @@
#include <kpushbutton.h>
#include <krun.h>
-#include <qfile.h>
+#include <tqfile.h>
// Own includes
#include "ProgressDialog.h"
@@ -48,8 +44,8 @@
// update user interface every 1/2 second
#define TIMER_INTERVAL 500
-ProgressDialog::ProgressDialog( QWidget* parent, const char* name, WFlags fl )
- : QWidget( parent, name, fl )
+ProgressDialog::ProgressDialog( TQWidget* tqparent, const char* name, WFlags fl )
+ : TQWidget( tqparent, name, fl )
{
renamedFiles = NULL;
@@ -57,11 +53,11 @@ ProgressDialog::ProgressDialog( QWidget* parent, const char* name, WFlags fl )
setCaption( i18n("Progress") );
setIcon( BarIcon( "krename" ) );
- ProgressDialogLayout = new QVBoxLayout( this, 11, 6 );
- Layout1 = new QHBoxLayout( 0, 0, 6 );
- QHBoxLayout* Layout2 = new QHBoxLayout( 0, 6, 6 );
+ ProgressDialogLayout = new TQVBoxLayout( this, 11, 6 );
+ Layout1 = new TQHBoxLayout( 0, 0, 6 );
+ TQHBoxLayout* Layout2 = new TQHBoxLayout( 0, 6, 6 );
- bar = new QProgressBar( this );
+ bar = new TQProgressBar( this );
bar->setProgress( 0 );
buttonCancel = new KPushButton( i18n("&Cancel"), this );
@@ -69,24 +65,24 @@ ProgressDialog::ProgressDialog( QWidget* parent, const char* name, WFlags fl )
display = new KListView( this );
display->addColumn( i18n("Messages") );
display->addColumn( "sort" );
- display->setColumnWidthMode( 0, QListView::Maximum );
- display->setColumnWidthMode( 1, QListView::Manual );
+ display->setColumnWidthMode( 0, TQListView::Maximum );
+ display->setColumnWidthMode( 1, TQListView::Manual );
display->setColumnWidth( 1, 0 );
display->setSorting( -1 );
display->setUpdatesEnabled( false );
- QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Minimum );
+ TQSpacerItem* spacer = new TQSpacerItem( 20, 20, TQSizePolicy::Minimum, TQSizePolicy::Minimum );
buttonUndo = new KPushButton( this );
buttonUndo->setText( i18n("&Undo") );
buttonUndo->setEnabled( false );
mnuButton = new KPopupMenu( this );
- mnuButton->insertItem( i18n("Restart KRename..."), this, SLOT( restart() ));
+ mnuButton->insertItem( i18n("Restart KRename..."), this, TQT_SLOT( restart() ));
mnuButton->insertSeparator();
- mnuButton->insertItem( i18n("Rename Processed Files &Again..."), this, SLOT( again() ), 0, MNU_DONE_ID );
- mnuButton->insertItem( i18n("Rename Unprocessed Files &Again..."), this, SLOT( unAgain() ), 0, MNU_ERROR_ID );
- mnuButton->insertItem( i18n("Rename All Files &Again..."), this, SLOT( allAgain() ));
+ mnuButton->insertItem( i18n("Rename Processed Files &Again..."), this, TQT_SLOT( again() ), 0, MNU_DONE_ID );
+ mnuButton->insertItem( i18n("Rename Unprocessed Files &Again..."), this, TQT_SLOT( unAgain() ), 0, MNU_ERROR_ID );
+ mnuButton->insertItem( i18n("Rename All Files &Again..."), this, TQT_SLOT( allAgain() ));
buttonRestart = new KPushButton( this );
buttonRestart->setText( i18n( "&Rename More..." ) );
buttonRestart->setPopup( mnuButton );
@@ -114,15 +110,15 @@ ProgressDialog::ProgressDialog( QWidget* parent, const char* name, WFlags fl )
ProgressDialogLayout->addWidget( display );
ProgressDialogLayout->addLayout( Layout1 );
- connect( buttonClose, SIGNAL(clicked()), this, SLOT(quitAll()));
- connect( buttonOpenDest, SIGNAL(clicked()), this, SLOT(openDest()));
- connect( buttonCancel, SIGNAL( clicked()), this, SLOT(canceled() ));
- connect( buttonUndo, SIGNAL( clicked() ), this, SLOT( undo() ) );
+ connect( buttonClose, TQT_SIGNAL(clicked()), this, TQT_SLOT(quitAll()));
+ connect( buttonOpenDest, TQT_SIGNAL(clicked()), this, TQT_SLOT(openDest()));
+ connect( buttonCancel, TQT_SIGNAL( clicked()), this, TQT_SLOT(canceled() ));
+ connect( buttonUndo, TQT_SIGNAL( clicked() ), this, TQT_SLOT( undo() ) );
m_count = 0;
m_canceled = false;
- m_timer = new QTimer( this, "m_timer" );
- connect( m_timer, SIGNAL( timeout() ), this, SLOT( slotTimer() ) );
+ m_timer = new TQTimer( this, "m_timer" );
+ connect( m_timer, TQT_SIGNAL( timeout() ), this, TQT_SLOT( slotTimer() ) );
hide();
}
@@ -135,11 +131,11 @@ ProgressDialog::~ProgressDialog()
delete [] renamedFiles;
}
-void ProgressDialog::print( QString text, QString pixmap )
+void ProgressDialog::print( TQString text, TQString pixmap )
{
if( !m_timer->isActive() )
{
- KApplication::setOverrideCursor( Qt::waitCursor );
+ KApplication::setOverrideCursor( TQt::waitCursor );
m_timer->start( TIMER_INTERVAL );
}
@@ -152,29 +148,29 @@ void ProgressDialog::print( QString text, QString pixmap )
display->insertItem( item );
}
-void ProgressDialog::error( QString text )
+void ProgressDialog::error( TQString text )
{
if( !m_timer->isActive() )
{
- KApplication::setOverrideCursor( Qt::waitCursor );
+ KApplication::setOverrideCursor( TQt::waitCursor );
m_timer->start( TIMER_INTERVAL );
}
//TODO: simplify this (breaks i18n)
- KListViewItem* item = new KListViewItem( display, QString( i18n("Error: %1") ).arg( QString::null ) + simplify( text ), count() );
+ KListViewItem* item = new KListViewItem( display, TQString( i18n("Error: %1") ).tqarg( TQString() ) + simplify( text ), count() );
item->setPixmap( 0, SmallIcon("cancel") );
display->insertItem( item );
}
-void ProgressDialog::warning( QString text )
+void ProgressDialog::warning( TQString text )
{
if( !m_timer->isActive() )
{
- KApplication::setOverrideCursor( Qt::waitCursor );
+ KApplication::setOverrideCursor( TQt::waitCursor );
m_timer->start( TIMER_INTERVAL );
}
- KListViewItem* item = new KListViewItem( display, QString( i18n("Warning: %1") ).arg( QString::null ) + simplify( text ), count() );
+ KListViewItem* item = new KListViewItem( display, TQString( i18n("Warning: %1") ).tqarg( TQString() ) + simplify( text ), count() );
item->setPixmap( 0, SmallIcon("idea") );
display->insertItem( item );
}
@@ -211,7 +207,7 @@ void ProgressDialog::done( int errors, int successfull, bool allowundo )
void ProgressDialog::show()
{
- QWidget::show();
+ TQWidget::show();
int w = kapp->desktop()->width();
int h = kapp->desktop()->height();
@@ -220,7 +216,7 @@ void ProgressDialog::show()
void ProgressDialog::restart()
{
- QWidget* krename = KRenameImpl::launch( QRect( 0, 0, 0, 0 ), KURL::List() );
+ TQWidget* krename = KRenameImpl::launch( TQRect( 0, 0, 0, 0 ), KURL::List() );
krename->show();
close();
}
@@ -232,7 +228,7 @@ void ProgressDialog::again()
if( !renamedFiles[i].error )
list.append( renamedFiles[i].dst );
- QWidget* krename = KRenameImpl::launch( QRect( 0, 0, 0, 0 ), list );
+ TQWidget* krename = KRenameImpl::launch( TQRect( 0, 0, 0, 0 ), list );
krename->show();
close();
}
@@ -244,7 +240,7 @@ void ProgressDialog::unAgain()
if( renamedFiles[i].error )
list.append( renamedFiles[i].src );
- QWidget* krename = KRenameImpl::launch( QRect( 0, 0, 0, 0 ), list );
+ TQWidget* krename = KRenameImpl::launch( TQRect( 0, 0, 0, 0 ), list );
krename->show();
close();
}
@@ -255,7 +251,7 @@ void ProgressDialog::allAgain()
for( unsigned int i = 0; i < m_size; i++ )
list.append( renamedFiles[i].error ? renamedFiles[i].src : renamedFiles[i].dst );
- QWidget* krename = KRenameImpl::launch( QRect( 0, 0, 0, 0 ), list );
+ TQWidget* krename = KRenameImpl::launch( TQRect( 0, 0, 0, 0 ), list );
krename->show();
close();
}
@@ -265,9 +261,9 @@ void ProgressDialog::openDest()
new KRun( m_dest );
}
-QString ProgressDialog::count()
+TQString ProgressDialog::count()
{
- QString s;
+ TQString s;
return s.sprintf( "%0*i", 7, ++m_count );
}
@@ -290,15 +286,11 @@ void ProgressDialog::canceled()
m_canceled = true;
}
-const QString ProgressDialog::simplify( const QString & text )
+const TQString ProgressDialog::simplify( const TQString & text )
{
// make error messages fit in one line!
- QString t( text );
-#if QT_VERSION >= 0x030100
+ TQString t( text );
t.remove( '\n' );
-#else
- t.replace( QRegExp("\n"), "" );
-#endif
return t;
}
@@ -309,7 +301,7 @@ void ProgressDialog::undo()
FileOperation fop;
m_timer->start( TIMER_INTERVAL );
- KApplication::setOverrideCursor( Qt::waitCursor );
+ KApplication::setOverrideCursor( TQt::waitCursor );
for( unsigned int i = 0; i < m_size; i++ )
{
setProgress( i );
@@ -319,11 +311,11 @@ void ProgressDialog::undo()
if( renamedFiles[i].dir ) {
/** handle renamed directories and their contents
*/
- QString ddir = renamedFiles[i].dst.path();
- QString sdir = renamedFiles[i].src.path();
+ TQString ddir = renamedFiles[i].dst.path();
+ TQString sdir = renamedFiles[i].src.path();
for( unsigned int c = i+1; c < m_size; c++ ) {
- QString dpath = renamedFiles[c].dst.path();
- QString spath = renamedFiles[c].src.path();
+ TQString dpath = renamedFiles[c].dst.path();
+ TQString spath = renamedFiles[c].src.path();
if( spath.startsWith( ddir ) )
{
@@ -349,7 +341,7 @@ void ProgressDialog::undo()
m_timer->stop();
KApplication::restoreOverrideCursor();
- QWidget* krename = KRenameImpl::launch( QRect( 0, 0, 0, 0 ), list );
+ TQWidget* krename = KRenameImpl::launch( TQRect( 0, 0, 0, 0 ), list );
krename->show();
close();
}