Browse Source

TQt4 port krename

This enables compilation under both Qt3 and Qt4


git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/krename@1238984 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
tags/v3.5.13
tpearson 8 years ago
parent
commit
ce0c60d7b9
68 changed files with 1997 additions and 2052 deletions
  1. 47
    55
      krename/ProgressDialog.cpp
  2. 20
    19
      krename/ProgressDialog.h
  3. 128
    178
      krename/batchrenamer.cpp
  4. 55
    55
      krename/batchrenamer.h
  5. 25
    34
      krename/commandplugin.cpp
  6. 9
    8
      krename/commandplugin.h
  7. 32
    32
      krename/confdialog.cpp
  8. 9
    8
      krename/confdialog.h
  9. 33
    33
      krename/coorddialog.cpp
  10. 15
    13
      krename/coorddialog.h
  11. 20
    20
      krename/dateplugin.cpp
  12. 5
    5
      krename/dateplugin.h
  13. 37
    37
      krename/datetime.cpp
  14. 23
    22
      krename/datetime.h
  15. 24
    24
      krename/dsdirselectdialog.cpp
  16. 10
    9
      krename/dsdirselectdialog.h
  17. 29
    29
      krename/encodingplugin.cpp
  18. 12
    11
      krename/encodingplugin.h
  19. 9
    21
      krename/fileoperation.cpp
  20. 9
    8
      krename/fileoperation.h
  21. 30
    30
      krename/fileplugin.cpp
  22. 15
    14
      krename/fileplugin.h
  23. 2
    2
      krename/firststartdlg.cpp
  24. 3
    2
      krename/firststartdlg.h
  25. 17
    17
      krename/guimodeselector.cpp
  26. 7
    7
      krename/guimodeselector.h
  27. 32
    40
      krename/helpdialog.cpp
  28. 30
    28
      krename/helpdialog.h
  29. 19
    19
      krename/kmyhistorycombo.cpp
  30. 11
    10
      krename/kmyhistorycombo.h
  31. 73
    73
      krename/kmylistbox.cpp
  32. 37
    36
      krename/kmylistbox.h
  33. 45
    45
      krename/kmylistview.cpp
  34. 38
    37
      krename/kmylistview.h
  35. 5
    5
      krename/krecursivelister.cpp
  36. 10
    9
      krename/krecursivelister.h
  37. 9
    9
      krename/krenamedcop.h
  38. 311
    311
      krename/krenameimpl.cpp
  39. 91
    90
      krename/krenameimpl.h
  40. 5
    5
      krename/main.cpp
  41. 41
    41
      krename/mydirplugin.cpp
  42. 26
    25
      krename/mydirplugin.h
  43. 15
    15
      krename/myinputdialog.cpp
  44. 16
    15
      krename/myinputdialog.h
  45. 41
    41
      krename/numberdialog.cpp
  46. 11
    9
      krename/numberdialog.h
  47. 63
    63
      krename/permission.cpp
  48. 26
    25
      krename/permission.h
  49. 18
    18
      krename/pictureplugin.cpp
  50. 9
    8
      krename/pictureplugin.h
  51. 7
    7
      krename/plugin.cpp
  52. 15
    14
      krename/plugin.h
  53. 10
    10
      krename/pluginloader.cpp
  54. 11
    11
      krename/pluginloader.h
  55. 113
    113
      krename/profiledlg.cpp
  56. 11
    10
      krename/profiledlg.h
  57. 46
    46
      krename/replacedialog.cpp
  58. 19
    18
      krename/replacedialog.h
  59. 22
    22
      krename/tabs.cpp
  60. 12
    11
      krename/tabs.h
  61. 11
    11
      krename/threadedlister.cpp
  62. 17
    16
      krename/threadedlister.h
  63. 20
    20
      krename/translitplugin.cpp
  64. 15
    14
      krename/translitplugin.h
  65. 19
    19
      krename/undodialog.cpp
  66. 10
    9
      krename/undodialog.h
  67. 22
    22
      krename/wizard.cpp
  68. 10
    9
      krename/wizard.h

+ 47
- 55
krename/ProgressDialog.cpp View File

@@ -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();
}

+ 20
- 19
krename/ProgressDialog.h View File

@@ -18,7 +18,7 @@
#ifndef PROGRESSDIALOG_H
#define PROGRESSDIALOG_H

#include <qwidget.h>
#include <tqwidget.h>
#include <kurl.h>

typedef struct RenamedList
@@ -34,18 +34,19 @@ class KRenameImpl;
class KListView;
class KPopupMenu;
class KPushButton;
class QProgressBar;
class QStringList;
class QStrList;
class QString;
class QTimer;
class QHBoxLayout;
class QVBoxLayout;
class ProgressDialog : public QWidget
class TQProgressBar;
class TQStringList;
class TQStrList;
class TQString;
class TQTimer;
class TQHBoxLayout;
class TQVBoxLayout;
class ProgressDialog : public TQWidget
{
Q_OBJECT
TQ_OBJECT
public:
ProgressDialog( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
ProgressDialog( TQWidget* tqparent = 0, const char* name = 0, WFlags fl = 0 );
~ProgressDialog();

void setProgressTotalSteps( int t );
@@ -57,9 +58,9 @@ class ProgressDialog : public QWidget
inline void setCreatedDirectories( const KURL::List & list );

void done( int errors, int successfull, bool allowundo );
void print( QString text, QString pixmap = 0 );
void error( QString text );
void warning( QString text );
void print( TQString text, TQString pixmap = 0 );
void error( TQString text );
void warning( TQString text );
public slots:
void show();
@@ -76,8 +77,8 @@ class ProgressDialog : public QWidget
void slotTimer();
private:
QString count();
const QString simplify( const QString & text );
TQString count();
const TQString simplify( const TQString & text );
protected:
RenamedList* renamedFiles;
@@ -88,7 +89,7 @@ class ProgressDialog : public QWidget
bool m_canceled;
KURL::List m_created;
QTimer* m_timer;
TQTimer* m_timer;
KListView* display;
KPushButton* buttonClose;
@@ -98,10 +99,10 @@ class ProgressDialog : public QWidget
KPushButton* buttonCancel;
KPopupMenu* mnuButton;

QProgressBar* bar;
TQProgressBar* bar;

QVBoxLayout* ProgressDialogLayout;
QHBoxLayout* Layout1;
TQVBoxLayout* ProgressDialogLayout;
TQHBoxLayout* Layout1;
};



+ 128
- 178
krename/batchrenamer.cpp View File

@@ -33,8 +33,8 @@
#include <sys/stat.h>

// QT includes
#include <qdir.h>
#include <qregexp.h>
#include <tqdir.h>
#include <tqregexp.h>

// KDE includes
#include <kapplication.h>
@@ -62,7 +62,7 @@ BatchRenamer::~BatchRenamer()
{
}

void BatchRenamer::processFiles( ProgressDialog* p, QObject* object )
void BatchRenamer::processFiles( ProgressDialog* p, TQObject* object )
{
delete object;
t.start();
@@ -76,7 +76,7 @@ void BatchRenamer::processFiles( ProgressDialog* p, QObject* object )
if( m_mode == RENAME ) {// final Path = source Path
m_files[i].dst.directory = m_files[i].src.directory;
m_files[i].dst.url = m_files[i].src.url;
m_files[i].dst.url.setFileName( QString::null );
m_files[i].dst.url.setFileName( TQString() );
} else {
m_files[i].dst.directory = dirname.path();
m_files[i].dst.url = dirname;
@@ -118,19 +118,19 @@ void BatchRenamer::processFiles( ProgressDialog* p, QObject* object )
if( m_files[c].src.directory.left( m_files[i].src.name.length() + 1 )
== ( m_files[i].src.name + "/" ) ) {

m_files[c].src.directory.replace( 0, m_files[i].src.name.length(), m_files[i].dst.name );
m_files[c].src.directory.tqreplace( 0, m_files[i].src.name.length(), m_files[i].dst.name );
m_files[c].src.url.setPath( BatchRenamer::buildFilename( &m_files[c].src, true ) );
}
}
}
}

p->print( QString( i18n("Filenames Processed after %1 seconds.")).arg(t.elapsed()/1000) );
p->print( TQString( i18n("Filenames Processed after %1 seconds.")).tqarg(t.elapsed()/1000) );

work( p );
}

QString BatchRenamer::processString( QString text, QString oldname, int i )
TQString BatchRenamer::processString( TQString text, TQString oldname, int i )
{
/*
* Come on! Grep for this text and help me!
@@ -140,7 +140,7 @@ QString BatchRenamer::processString( QString text, QString oldname, int i )
*
* Krename will have problems with files
* which contain one of the following
* unicode characters: 60000, 60001, 60002
* tqunicode characters: 60000, 60001, 60002
* 60003, 60004, 60005, 60006.
*
* This is not a good solution, if you have a
@@ -180,10 +180,10 @@ QString BatchRenamer::processString( QString text, QString oldname, int i )
return text;
}

QString BatchRenamer::parsePlugins( int i, const QString& text, int type )
TQString BatchRenamer::parsePlugins( int i, const TQString& text, int type )
{
QPtrListIterator<PluginLoader::PluginLibrary> it( plug->libs );
QString ret = text;
TQPtrListIterator<PluginLoader::PluginLibrary> it( plug->libs );
TQString ret = text;

if( type == TYPE_FINAL_FILE )
ret = "";
@@ -198,10 +198,10 @@ QString BatchRenamer::parsePlugins( int i, const QString& text, int type )
return ret;
}

void BatchRenamer::createPreview( QListView* list )
void BatchRenamer::createPreview( TQListView* list )
{
KMyListViewItem* item1 = NULL;
QString tmp;
TQString tmp;

m_counters.clear();
for( unsigned int i = 0; i < m_files.count(); i++)
@@ -218,12 +218,12 @@ void BatchRenamer::createPreview( QListView* list )
bool modified = applyManualChanges( i );


QString sname = BatchRenamer::buildFilename( &m_files[i].src, false );
TQString sname = BatchRenamer::buildFilename( &m_files[i].src, false );

// Let's run the plugins that change the final filename,
// i.e the encodingsplugin
m_files[i].dst.name = parsePlugins( i, m_files[i].dst.name, TYPE_FINAL_FILENAME );
QString dname = BatchRenamer::buildFilename( &m_files[i].dst, false );
TQString dname = BatchRenamer::buildFilename( &m_files[i].dst, false );
item1 = new KMyListViewItem( modified, list, item1, sname, dname );
}
@@ -234,14 +234,14 @@ void BatchRenamer::work( ProgressDialog* p )
// TODO: use CopyJob here

FileOperation fop;
QFile* fundo ( NULL );
QTextStream* tundo ( NULL );
TQFile* fundo ( NULL );
TQTextStream* tundo ( NULL );

if( undo ) {
// Create header for undo script
fundo = new QFile( m_undoScript );
fundo = new TQFile( m_undoScript );
if( fundo->open( IO_WriteOnly ) ) {
tundo = new QTextStream( fundo );
tundo = new TQTextStream( fundo );
writeUndoScript( tundo );
} else {
undo = false;
@@ -258,11 +258,11 @@ void BatchRenamer::work( ProgressDialog* p )
* Give the user some information...
*/
if( m_mode == COPY)
p->print( QString( i18n("Files will be copied to: %1") ).arg(m_files[0].dst.directory) );
p->print( TQString( i18n("Files will be copied to: %1") ).tqarg(m_files[0].dst.directory) );
else if( m_mode == MOVE )
p->print( QString( i18n("Files will be moved to: %1") ).arg(m_files[0].dst.directory) );
p->print( TQString( i18n("Files will be moved to: %1") ).tqarg(m_files[0].dst.directory) );
else if( m_mode == LINK )
p->print( QString( i18n("Symbolic links will be created in: %1") ).arg(m_files[0].dst.directory) );
p->print( TQString( i18n("Symbolic links will be created in: %1") ).tqarg(m_files[0].dst.directory) );
else if( m_mode == RENAME )
p->print( i18n("Input files will be renamed.") );
@@ -302,7 +302,7 @@ void BatchRenamer::work( ProgressDialog* p )
* The plugin should return an error message in this case!
*/

QString eplug = parsePlugins( i, QString::null, TYPE_FINAL_FILE );
TQString eplug = parsePlugins( i, TQString(), TYPE_FINAL_FILE );
if( !eplug.isEmpty() ) {
p->error( eplug );
error++;
@@ -317,25 +317,25 @@ void BatchRenamer::work( ProgressDialog* p )
(*tundo) << "mv --force -b --suffix=.krename_ \"" << m_files[i].dst.name
<< "\" \"" << m_files[i].src.name << "\"" << endl;
} else
p->warning( QString( i18n("Undo is not possible for remote file: %1") ).arg( dst.prettyURL() ) );
p->warning( TQString( i18n("Undo is not possible for remote file: %1") ).tqarg( dst.prettyURL() ) );

}

if( !p->wasCancelled() ) {
QPtrListIterator<PluginLoader::PluginLibrary> it( plug->libs );
TQPtrListIterator<PluginLoader::PluginLibrary> it( plug->libs );
for( ; it.current(); ++it ) {
if( (*it)->usePlugin )
(*it)->plugin->finished();
}
}

const QString m = QString( i18n("Renamed %1 files successfully.") ).arg(i-error);
const TQString m = TQString( i18n("Renamed %1 files successfully.") ).tqarg(i-error);
( i - error ) ? p->print( m ) : p->warning( m );

if( error > 0 )
p->warning( QString( i18n("%2 errors occurred!") ).arg(error));
p->warning( TQString( i18n("%2 errors occurred!") ).tqarg(error));

p->print( QString( i18n("Elapsed time: %1 seconds") ).arg( t.elapsed()/1000 ), "kalarm" );
p->print( TQString( i18n("Elapsed time: %1 seconds") ).tqarg( t.elapsed()/1000 ), "kalarm" );
p->print( i18n("KRename finished the renaming process."), "krename" );
p->print( i18n("Press close to quit!") );
p->setRenamedFiles( renamedFiles, m_files.count() );
@@ -356,105 +356,81 @@ void BatchRenamer::work( ProgressDialog* p )
delete this;
}

void BatchRenamer::escape( QString & text, const QString & token, const QString & sequence )
void BatchRenamer::escape( TQString & text, const TQString & token, const TQString & sequence )
{
/*
* NEVER, ABSOLUTELY NEVER change pos = 0
* to pos = -1, it won't work !
* This bug took hours to find and was
* a serious bug in 1.7.
*/
#if QT_VERSION >= 0x030100
text.replace( token, sequence );
#else
int pos = 0;
do {
pos = text.find( token, pos );
if( pos >= 0 )
text.replace( pos, token.length(), sequence );
} while ( pos >= 0 );
#endif
text.tqreplace( token, sequence );
}

QString & BatchRenamer::doEscape( QString & text, bool filename )
TQString & BatchRenamer::doEscape( TQString text, bool filename )
{
if( filename ) {
BatchRenamer::escape( text, "&", QChar( 60000 ) );
BatchRenamer::escape( text, "$", QChar( 60001 ) );
BatchRenamer::escape( text, "%", QChar( 60002 ) );
BatchRenamer::escape( text, "#", QChar( 60004 ) );
BatchRenamer::escape( text, "[", QChar( 60005 ) );
BatchRenamer::escape( text, "]", QChar( 60006 ) );
BatchRenamer::escape( text, "\\", QChar( 60007 ) );
BatchRenamer::escape( text, "/", QChar( 60008 ) );
BatchRenamer::escape( text, "{", QChar( 60009 ) );
BatchRenamer::escape( text, "}", QChar( 60010 ) );
BatchRenamer::escape( text, "*", QChar( 60011 ) );
BatchRenamer::escape( text, "&", TQChar( 60000 ) );
BatchRenamer::escape( text, "$", TQChar( 60001 ) );
BatchRenamer::escape( text, "%", TQChar( 60002 ) );
BatchRenamer::escape( text, "#", TQChar( 60004 ) );
BatchRenamer::escape( text, "[", TQChar( 60005 ) );
BatchRenamer::escape( text, "]", TQChar( 60006 ) );
BatchRenamer::escape( text, "\\", TQChar( 60007 ) );
BatchRenamer::escape( text, "/", TQChar( 60008 ) );
BatchRenamer::escape( text, "{", TQChar( 60009 ) );
BatchRenamer::escape( text, "}", TQChar( 60010 ) );
BatchRenamer::escape( text, "*", TQChar( 60011 ) );
} else {
BatchRenamer::escape( text, "\\&", QChar( 60000 ) );
BatchRenamer::escape( text, "\\$", QChar( 60001 ) );
BatchRenamer::escape( text, "\\%", QChar( 60002 ) );
BatchRenamer::escape( text, "\\#", QChar( 60004 ) );
BatchRenamer::escape( text, "\\[", QChar( 60005 ) );
BatchRenamer::escape( text, "\\]", QChar( 60006 ) );
BatchRenamer::escape( text, "\\\\", QChar( 60007 ) );
BatchRenamer::escape( text, "\\/", QChar( 60008 ) );
BatchRenamer::escape( text, "\\{", QChar( 60009 ) );
BatchRenamer::escape( text, "\\}", QChar( 60010 ) );
BatchRenamer::escape( text, "\\*", QChar( 60011 ) );
BatchRenamer::escape( text, "\\&", TQChar( 60000 ) );
BatchRenamer::escape( text, "\\$", TQChar( 60001 ) );
BatchRenamer::escape( text, "\\%", TQChar( 60002 ) );
BatchRenamer::escape( text, "\\#", TQChar( 60004 ) );
BatchRenamer::escape( text, "\\[", TQChar( 60005 ) );
BatchRenamer::escape( text, "\\]", TQChar( 60006 ) );
BatchRenamer::escape( text, "\\\\", TQChar( 60007 ) );
BatchRenamer::escape( text, "\\/", TQChar( 60008 ) );
BatchRenamer::escape( text, "\\{", TQChar( 60009 ) );
BatchRenamer::escape( text, "\\}", TQChar( 60010 ) );
BatchRenamer::escape( text, "\\*", TQChar( 60011 ) );
}

return text;
}

QString & BatchRenamer::unEscape( QString & text )
TQString & BatchRenamer::unEscape( TQString & text )
{
BatchRenamer::escape( text, QChar( 60000 ), "&" );
BatchRenamer::escape( text, QChar( 60001 ), "$" );
BatchRenamer::escape( text, QChar( 60002 ), "%" );
BatchRenamer::escape( text, QChar( 60004 ), "#" );
BatchRenamer::escape( text, QChar( 60005 ), "[" );
BatchRenamer::escape( text, QChar( 60006 ), "]" );
BatchRenamer::escape( text, QChar( 60007 ), "\\" );
BatchRenamer::escape( text, TQChar( 60000 ), "&" );
BatchRenamer::escape( text, TQChar( 60001 ), "$" );
BatchRenamer::escape( text, TQChar( 60002 ), "%" );
BatchRenamer::escape( text, TQChar( 60004 ), "#" );
BatchRenamer::escape( text, TQChar( 60005 ), "[" );
BatchRenamer::escape( text, TQChar( 60006 ), "]" );
BatchRenamer::escape( text, TQChar( 60007 ), "\\" );
// %252f == /, it seems that filenames on unix cannot contain
// a /. So I use %252f, at least konqui displays it correctly
// this was needed, so that plugins that return a slash do not cause errors
BatchRenamer::escape( text, QChar( 60008 ), "%2f" );
BatchRenamer::escape( text, QChar( 60009 ), "{" );
BatchRenamer::escape( text, QChar( 60010 ), "}" );
BatchRenamer::escape( text, QChar( 60011 ), "*" );
BatchRenamer::escape( text, TQChar( 60008 ), "%2f" );
BatchRenamer::escape( text, TQChar( 60009 ), "{" );
BatchRenamer::escape( text, TQChar( 60010 ), "}" );
BatchRenamer::escape( text, TQChar( 60011 ), "*" );

return text;
}

int BatchRenamer::getCharacters( int n )
{
QString s;
TQString s;
s.sprintf( "%i", n );
return s.length();
}

QString BatchRenamer::findAndProcess( const QString & token, QString text, const QString & replace )
TQString BatchRenamer::findAndProcess( const TQString & token, TQString text, const TQString & tqreplace )
{
/*
* pos can here be -1 because
* findRev is called with it as a
* tqfindRev is called with it as a
* value !
*/
#if QT_VERSION >= 0x030100
text.replace( token, replace );
#else
int pos = -1;
do {
pos = text.findRev( token, pos );
if( pos >= 0 )
text.replace( pos, token.length(), replace );
} while( pos >= 0 );
#endif
text.tqreplace( token, tqreplace );
return text;
}

QString BatchRenamer::findNumbers( QString text, int count, int i )
TQString BatchRenamer::findNumbers( TQString text, int count, int i )
{
// Rewritten in Version 0.8
// Added numbers skipping in 1.3
@@ -464,10 +440,10 @@ QString BatchRenamer::findNumbers( QString text, int count, int i )
countervalues.start = m_index;
countervalues.step = m_step;

if( text.contains( "#", FALSE ) <= 0 )
if( text.tqcontains( "#", FALSE ) <= 0 )
return text;

pos = text.find("#", pos);
pos = text.tqfind("#", pos);
pos++;
while( text[pos] == '#' ) {
text.remove(pos, 1);
@@ -476,7 +452,7 @@ QString BatchRenamer::findNumbers( QString text, int count, int i )

findNumberAppendix( text, pos, &countervalues.start, &countervalues.step );

pos = text.find("#", 0);
pos = text.tqfind("#", 0);

if( (signed int)m_counters.count() <= m_counter_index )
{
@@ -488,7 +464,7 @@ QString BatchRenamer::findNumbers( QString text, int count, int i )

do {
m_counters[m_counter_index].value += m_counters[m_counter_index].step;
} while( m_skip.contains( m_counters[m_counter_index].value ) );
} while( m_skip.tqcontains( m_counters[m_counter_index].value ) );
/*
int v = start + (i*step) + m_skip_add[m_counter_index];
@@ -500,22 +476,22 @@ QString BatchRenamer::findNumbers( QString text, int count, int i )
}
*/

QString temp;
TQString temp;
temp.sprintf("%0*i", counter, m_counters[m_counter_index].value );
text.replace( pos, 1, temp);
text.tqreplace( pos, 1, temp);

++m_counter_index;
return findNumbers( text, count, i );
}

void BatchRenamer::findNumberAppendix( QString & text, int pos, int* start, int* step )
void BatchRenamer::findNumberAppendix( TQString & text, int pos, int* start, int* step )
{
QString appendix = QString::null;
TQString appendix = TQString();
int tmp = 0;
int end = 0;
bool ok = false;
if( text[pos] == '{' && (end = text.find( "}", pos )) > -1)
if( text[pos] == '{' && (end = text.tqfind( "}", pos )) > -1)
{
//qDebug("Found an appendix:" + appendix );
appendix = text.mid( pos + 1, end - pos - 1);
@@ -531,13 +507,13 @@ void BatchRenamer::findNumberAppendix( QString & text, int pos, int* start, int*
}
}

QString BatchRenamer::findStar( const QString & oldname, QString text )
TQString BatchRenamer::findStar( const TQString & oldname, TQString text )
{
int pos = -1;
do {
pos = text.findRev("*", pos);
pos = text.tqfindRev("*", pos);
if( pos >= 0 ) {
QString tmp = oldname.lower();
TQString tmp = oldname.lower();
if( tmp[0].isLetter() )
tmp[0] = tmp[0].upper();

@@ -546,13 +522,13 @@ QString BatchRenamer::findStar( const QString & oldname, QString text )
tmp[i] != '\'' && tmp[i] != '?' && tmp[i] != '`' )
tmp[i+1] = tmp[i+1].upper();

text.replace( pos, 1, tmp);
text.tqreplace( pos, 1, tmp);
}
} while( pos >= 0 );
return text;
}

QString BatchRenamer::findBrackets( QString oldname, QString text, int i )
TQString BatchRenamer::findBrackets( TQString oldname, TQString text, int i )
{
/*
* looks for a statement in brackets [ ]
@@ -560,17 +536,17 @@ QString BatchRenamer::findBrackets( QString oldname, QString text, int i )
*/

int num, pos = -1, a;
QString token;
TQString token;

if( text.contains("]", FALSE) <= 0 || text.isEmpty() )
if( text.tqcontains("]", FALSE) <= 0 || text.isEmpty() )
return text;

num = text.contains("[", FALSE);
num = text.tqcontains("[", FALSE);
if(num <= 0 )
return text;

pos = text.findRev("[", pos);
a = text.find("]", pos );
pos = text.tqfindRev("[", pos);
a = text.tqfind("]", pos );
if( a < 0 && pos >= 0 )
return text;

@@ -589,9 +565,9 @@ QString BatchRenamer::findBrackets( QString oldname, QString text, int i )
return findBrackets( oldname, text, i );
}

QString BatchRenamer::processToken( QString token, QString oldname, int i )
TQString BatchRenamer::processToken( TQString token, TQString oldname, int i )
{
QString tmp;
TQString tmp;

/*
* Call here all functions that handle
@@ -625,10 +601,10 @@ QString BatchRenamer::processToken( QString token, QString oldname, int i )
* Krename simply ignores unknown tokens!
* Usefull for the MP3 Plugin!
*/
return QString::null;
return TQString();
}

QString BatchRenamer::findToken( QString oldname, QString token, int i )
TQString BatchRenamer::findToken( TQString oldname, TQString token, int i )
{
enum conversion { LOWER, UPPER, MIXED, STAR, STRIP, NONE, EMPTY, NUMBER };
unsigned int numwidth = 0;
@@ -658,7 +634,7 @@ QString BatchRenamer::findToken( QString oldname, QString token, int i )
if( c != EMPTY && c != NUMBER )
token.remove( 0, 1 );
QString save = token;
TQString save = token;
token = processToken( token, oldname, i );

switch( c ) {
@@ -670,7 +646,7 @@ QString BatchRenamer::findToken( QString oldname, QString token, int i )
break;
case MIXED:
token = token.lower();
token.replace( 0, 1, token[0].upper());
token.tqreplace( 0, 1, token[0].upper());
break;
case STAR:
token = findStar( token, "*" );
@@ -694,20 +670,20 @@ QString BatchRenamer::findToken( QString oldname, QString token, int i )
return token;
}

QString BatchRenamer::findPartStrings( QString oldname, QString token )
TQString BatchRenamer::findPartStrings( TQString oldname, TQString token )
{
QString first, second;
TQString first, second;
int pos = -1;
// parse things like [2;4{[dirname]}]
if( token.contains( "{" ) >= 1 && token.contains( "}" ) >= 1 ) {
int pos = token.find( "{" );
oldname = token.mid( pos + 1, token.findRev( "}" ) - pos - 1 );
if( token.tqcontains( "{" ) >= 1 && token.tqcontains( "}" ) >= 1 ) {
int pos = token.tqfind( "{" );
oldname = token.mid( pos + 1, token.tqfindRev( "}" ) - pos - 1 );
token = token.left( pos );
}

if( token.contains("-") ) {
pos = token.find( "-", 0 );
if( token.tqcontains("-") ) {
pos = token.tqfind( "-", 0 );
first = token.left( pos );
// ------- Code OK ^ !

@@ -741,8 +717,8 @@ QString BatchRenamer::findPartStrings( QString oldname, QString token )
x++;

return oldname.mid( first.toInt()-1, x );
} else if( token.contains(";") ) {
pos = token.find( ";", 0 );
} else if( token.tqcontains(";") ) {
pos = token.tqfind( ";", 0 );

first = token.left( pos );
second = token.mid( pos+1, token.length() );
@@ -753,13 +729,13 @@ QString BatchRenamer::findPartStrings( QString oldname, QString token )
int number = token.toInt( &ok );

if( ok && (number <= (signed int)oldname.length() && number > 0 ) )
return QString(oldname[ number -1 ]);
return TQString(oldname[ number -1 ]);
else
return QString::null;
return TQString();
}
}

QString BatchRenamer::findDirName( QString token, QString path )
TQString BatchRenamer::findDirName( TQString token, TQString path )
{
if( token.left( 7 ).lower() == "dirname" ) {
if( path.right( 1 ) == "/" )
@@ -768,9 +744,9 @@ QString BatchRenamer::findDirName( QString token, QString path )
int recursion = 1;
if( token.length() > 7 ) {
token = token.right( token.length() - 7 );
recursion = token.contains( "." );
recursion = token.tqcontains( "." );
if( recursion != (signed int)token.length() )
return QString::null;
return TQString();

recursion++;
}
@@ -778,10 +754,10 @@ QString BatchRenamer::findDirName( QString token, QString path )
return path.section( "/", recursion * -1, recursion * -1);
}
return QString::null;
return TQString();
}

QString BatchRenamer::findLength( const QString & token, const QString & name )
TQString BatchRenamer::findLength( const TQString & token, const TQString & name )
{
if( token.lower().startsWith( "length" ) ) {
int minus = 0;
@@ -792,67 +768,41 @@ QString BatchRenamer::findLength( const QString & token, const QString & name )
minus = 0;
}
return QString::number( name.length() - minus );
return TQString::number( name.length() - minus );
}
return QString::null;
return TQString();
}

QString BatchRenamer::findReplace( QString text )
TQString BatchRenamer::findReplace( TQString text )
{
// Call for each element in replace strings doReplace with correct values
for( unsigned int i = 0; i < m_replace.count(); i++ ) {
replacestrings s = m_replace[i];
text = doReplace( text, unEscape( s.find ), s.replace, s.reg );
for( unsigned int i = 0; i < m_tqreplace.count(); i++ ) {
replacestrings s = m_tqreplace[i];
text = doReplace( text, unEscape( s.tqfind ), s.tqreplace, s.reg );
}

return text;
}

QString BatchRenamer::doReplace( QString text, QString find, QString replace, bool reg )
TQString BatchRenamer::doReplace( TQString text, TQString tqfind, TQString tqreplace, bool reg )
{
if( !reg )
{
#if QT_VERSION >= 0x030100
// we use the escaped text here because the user might want
// to find a "&" and replace it
text.replace( doEscape( find ), replace );
#else
int pos = 0;
QString f = doEscape( find );
do {
pos = text.find( f, pos );
if( pos >= 0 ) {
text.replace( pos, f.length(), replace );
pos += replace.length();
}
} while( pos >= 0 );
#endif
text.tqreplace( doEscape( tqfind ), tqreplace );
}
else
{
#if QT_VERSION >= 0x030100
// no doEscape() here for the regexp, because it would destroy our regular expression
// other wise we will not find stuff like $, [ in the text
text = doEscape( unEscape( text ).replace( QRegExp( find ), replace ) );
#else
// Test this code more!
pos = 0;
do {
QRegExp exp( find );
pos = exp.search( text, pos );
if( pos >= 0 ) {
text = doEscape( unEscape( text ).replace( pos, exp.matchedLength(), replace ) );
pos += replace.length();
}
} while( pos >= 0 );
#endif
text = doEscape( unEscape( text ).tqreplace( TQRegExp( tqfind ), tqreplace ) );
}
return text;
}

void BatchRenamer::writeUndoScript( QTextStream* t )
void BatchRenamer::writeUndoScript( TQTextStream* t )
{
// write header comments
(*t) << "#!/bin/bash" << endl
@@ -882,15 +832,15 @@ void BatchRenamer::writeUndoScript( QTextStream* t )
void BatchRenamer::parseSubdirs( data* f )
{
int pos = 0;
if( (pos = f->dst.name.findRev( "/", -1 ) ) > 0 ) {
QString dirs = f->dst.name.left( pos );
if( (pos = f->dst.name.tqfindRev( "/", -1 ) ) > 0 ) {
TQString dirs = f->dst.name.left( pos );
f->dst.name = f->dst.name.right( f->dst.name.length() - pos - 1 );
f->dst.directory += ( f->dst.directory.right( 1 ) == "/" ) ? "" : "/";

// create the missing subdir now
int i = 0;
QString d = "";
while( (d = dirs.section( "/", i, i, QString::SectionSkipEmpty )) && ! d.isEmpty() ) { // asignment here!
TQString d = "";
while( (d = dirs.section( "/", i, i, TQString::SectionSkipEmpty )) && ! d.isEmpty() ) { // asignment here!
KURL url = f->dst.url;
// it is important to unescape here
// to support dirnames containing "&" or
@@ -907,9 +857,9 @@ void BatchRenamer::parseSubdirs( data* f )
}
}

QString BatchRenamer::buildFilename( fileentry* entry, bool dir )
TQString BatchRenamer::buildFilename( fileentry* entry, bool dir )
{
QString filename = ( dir ? entry->directory : QString::null ) + entry->name + ( entry->extension.isEmpty() ? QString::null : QString(".") ) + entry->extension;
TQString filename = ( dir ? entry->directory : TQString() ) + entry->name + ( entry->extension.isEmpty() ? TQString() : TQString(".") ) + entry->extension;
// unescape here as filename is still escaped
unEscape( filename );
return filename;
@@ -929,7 +879,7 @@ bool BatchRenamer::applyManualChanges( int i )
m_files[i].dst.name = m_changes[z].user;
// the file extension is already included
// in the users name
m_files[i].dst.extension = QString::null;
m_files[i].dst.extension = TQString();
return true;
}
}

+ 55
- 55
krename/batchrenamer.h View File

@@ -18,13 +18,13 @@
#ifndef BATCHRENAMER_H
#define BATCHRENAMER_H

#include <qdatetime.h>
#include <qvaluelist.h>
#include <tqdatetime.h>
#include <tqvaluelist.h>
#include <kurl.h>

class QFile;
class QProgressDialog;
class QString;
class TQFile;
class TQProgressDialog;
class TQString;

/* How many diferrent users and groups
* KRename supports. Values over 1000
@@ -45,9 +45,9 @@ enum {
};

typedef struct fileentry {
QString name; // filename
QString directory; // directory
QString extension; // extension
TQString name; // filename
TQString directory; // directory
TQString extension; // extension

KURL url;
};
@@ -66,12 +66,12 @@ typedef struct data {
*/
typedef struct manualchanges {
KURL url; // input filename
QString user; // name the user wants
TQString user; // name the user wants
};

typedef struct replacestrings {
QString find; // Text to replace
QString replace; // Replace with
TQString tqfind; // Text to tqreplace
TQString tqreplace; // Replace with
bool reg; // is it a reg expression ?
};

@@ -85,57 +85,57 @@ typedef struct tCounterValues {
*@author Dominik Seichter
*/

class QObject;
class QListView;
class TQObject;
class TQListView;
class ProgressDialog;
class PluginLoader;
class BatchRenamer {
public:
BatchRenamer();
~BatchRenamer();
void processFiles( ProgressDialog* p, QObject* object );
void createPreview( QListView* list );
void processFiles( ProgressDialog* p, TQObject* object );
void createPreview( TQListView* list );

inline void setText( const QString & t ) { text = t; doEscape( text, false ); }
inline void setExText( const QString & t ) { extext = t; }
inline void setText( const TQString & t ) { text = t; doEscape( text, false ); }
inline void setExText( const TQString & t ) { extext = t; }
inline void setDirname( const KURL & url ) { dirname = url; }
inline void setUndoScript( const QString & t ) { m_undoScript = t; }
inline void setUndoScript( const TQString & t ) { m_undoScript = t; }
inline void setUndo( bool b ) { undo = b; }
inline void setOverwrite( bool b ) { overwrite = b; }
inline void setIndex( int i ) { m_index = i; }
inline void setStep( int s ) { m_step = s; }
inline void setResetCounter( bool r ) { m_reset = r; }
inline void setSkipList( const QValueList<int> & s ) { m_skip = s; }
inline void setReplaceList( const QValueList<replacestrings> & r ) { m_replace = r; }
inline void setSkipList( const TQValueList<int> & s ) { m_skip = s; }
inline void setReplaceList( const TQValueList<replacestrings> & r ) { m_tqreplace = r; }
inline void setFiles( const QValueList<data> & f ) { m_files = f; } //TODO: use a pointer for more speed
inline QValueList<data> files() const { return m_files; }
inline void setChanges( const QValueList<manualchanges> & m ) { m_changes = m; }
inline void setFiles( const TQValueList<data> & f ) { m_files = f; } //TODO: use a pointer for more speed
inline TQValueList<data> files() const { return m_files; }
inline void setChanges( const TQValueList<manualchanges> & m ) { m_changes = m; }

inline void setMode( int m) { m_mode = m; }
inline int mode() const { return m_mode; }

// Since 2.1 public, because plugins may want to access them to:
QString findAndProcess( const QString & token, QString text, const QString & replace );
QString findNumbers( QString text, int count, int i );
QString findStar( const QString & oldname, QString text );
QString findBrackets( QString oldname, QString text, int i );
QString findToken( QString oldname, QString token, int i );
QString processToken( QString token, QString oldname, int i );
QString findPartStrings( QString oldname, QString token );
static QString findDirName( QString token, QString path );
QString findLength( const QString & token, const QString & name );
QString findReplace( QString text ); // text is here already the new filename !
QString doReplace( QString text, QString find, QString replace, bool reg ); // text is here already the new filename !
QString processString( QString text, QString oldname, int i );
TQString findAndProcess( const TQString & token, TQString text, const TQString & tqreplace );
TQString findNumbers( TQString text, int count, int i );
TQString findStar( const TQString & oldname, TQString text );
TQString findBrackets( TQString oldname, TQString text, int i );
TQString findToken( TQString oldname, TQString token, int i );
TQString processToken( TQString token, TQString oldname, int i );
TQString findPartStrings( TQString oldname, TQString token );
static TQString findDirName( TQString token, TQString path );
TQString findLength( const TQString & token, const TQString & name );
TQString findReplace( TQString text ); // text is here already the new filename !
TQString doReplace( TQString text, TQString tqfind, TQString tqreplace, bool reg ); // text is here already the new filename !
TQString processString( TQString text, TQString oldname, int i );
static QString & doEscape( QString & text, bool filename = true );
static QString & unEscape( QString & text );
static void escape( QString & text, const QString & token, const QString & sequence );
static TQString & doEscape( TQString text, bool filename = true );
static TQString & unEscape( TQString & text );
static void escape( TQString & text, const TQString & token, const TQString & sequence );

static QString buildFilename( fileentry* entry, bool dir = true );
static TQString buildFilename( fileentry* entry, bool dir = true );

private:
/**
@@ -147,42 +147,42 @@ class BatchRenamer {
int getCharacters( int n ) ;

void work( ProgressDialog* p );
void writeUndoScript( QTextStream* t );
void writeUndoScript( TQTextStream* t );
void parseSubdirs( data* f );
void findNumberAppendix( QString & text, int pos, int* start, int* step );
void findNumberAppendix( TQString & text, int pos, int* start, int* step );
/** resets all counters to there start value if the directory name at @p i
* in m_files changes.
* The caller has to check m_reset before calling this function.
*/
void findCounterReset( int i );
QString parsePlugins( int i, const QString & text, int type );
TQString parsePlugins( int i, const TQString & text, int type );
bool applyManualChanges( int i );

QString text; // template
TQString text; // template
KURL dirname; // destination dir
QString extext; // Extension template
QString m_undoScript; // Filename of undoscript
TQString extext; // Extension template
TQString m_undoScript; // Filename of undoscript
bool undo; // create an undo script
int m_index; // index for numbers
int m_step; // step for numbers
bool m_reset; // reset counter on new directories
bool overwrite; // overwrite existing files
int m_mode; // renaming mode
QValueList<int> m_skip; // Numbers to skip
QValueList<replacestrings> m_replace; // Replace strings
QValueList<data> m_files;
QValueList<manualchanges> m_changes; // User made changes
TQValueList<int> m_skip; // Numbers to skip
TQValueList<replacestrings> m_tqreplace; // Replace strings
TQValueList<data> m_files;
TQValueList<manualchanges> m_changes; // User made changes
PluginLoader* plug;

// a is used in find number and
// required for skipping.
int m_counter_index;
QValueList<tCounterValues> m_counters;
TQValueList<tCounterValues> m_counters;
protected:
QFile* f;
QTime t;
QProgressDialog* progress;
TQFile* f;
TQTime t;
TQProgressDialog* progress;
};

#endif

+ 25
- 34
krename/commandplugin.cpp View File

@@ -18,9 +18,9 @@
#include "commandplugin.h"

// QT includes
#include <qcheckbox.h>
#include <qlabel.h>
#include <qlayout.h>
#include <tqcheckbox.h>
#include <tqlabel.h>
#include <tqlayout.h>

// KDE includes
#include <kapplication.h>
@@ -33,12 +33,12 @@
#include <kpushbutton.h>
#include <kprocess.h>

const QString CommandPlugin::getName() const
const TQString CommandPlugin::getName() const
{
return i18n("Command Plugin");
}

const QString CommandPlugin::getAccelName() const
const TQString CommandPlugin::getAccelName() const
{
return i18n("&Command Plugin");
}
@@ -58,27 +58,27 @@ bool CommandPlugin::checkError()
return true;
}

void CommandPlugin::drawInterface( QWidget* w, QVBoxLayout* l )
void CommandPlugin::drawInterface( TQWidget* w, TQVBoxLayout* l )
{
m_widget = w;

QHBoxLayout* hb = new QHBoxLayout( 0, 0, 6 );
QVBoxLayout* vb = new QVBoxLayout( 0, 0, 6 );
TQHBoxLayout* hb = new TQHBoxLayout( 0, 0, 6 );
TQVBoxLayout* vb = new TQVBoxLayout( 0, 0, 6 );

QLabel* la = new QLabel( w );
TQLabel* la = new TQLabel( w );
la->setText( i18n("<b>Command Plugin</b>") );
l->addWidget( la );

la = new QLabel( w );
la = new TQLabel( w );
la->setText( i18n( "<qt>Executes a shell command on every file after it has been renamed. "
"Add %1 to the command line arguments to get the filename of the renamed file.</qt>") );
l->addWidget( la );
l->addWidget( new QLabel( i18n("Command:"), w ) );
l->addWidget( new TQLabel( i18n("Command:"), w ) );

commandline = new KLineEdit( w );
l->addWidget( commandline );

checkNoBlock = new QCheckBox( i18n("&Execute without blocking (not recommended)"), w );
checkNoBlock = new TQCheckBox( i18n("&Execute without blocking (not recommended)"), w );
l->addWidget( checkNoBlock );

buttonAdd = new KPushButton( i18n("&Add"), w );
@@ -93,21 +93,21 @@ void CommandPlugin::drawInterface( QWidget* w, QVBoxLayout* l )
vb->setStretchFactor( list, 2 );
l->addLayout( vb );

connect( buttonAdd, SIGNAL( clicked() ), this, SLOT( add() ) );
connect( buttonRemove, SIGNAL( clicked() ), this, SLOT( remove() ) );
connect( list, SIGNAL( executed( QListBoxItem* ) ), this, SLOT( exec() ) );
connect( buttonAdd, TQT_SIGNAL( clicked() ), this, TQT_SLOT( add() ) );
connect( buttonRemove, TQT_SIGNAL( clicked() ), this, TQT_SLOT( remove() ) );
connect( list, TQT_SIGNAL( executed( TQListBoxItem* ) ), this, TQT_SLOT( exec() ) );

KConfig* conf = kapp->config();
conf->setGroup("CommandPlugin");
list->insertStringList( conf->readListEntry("commandlines" ) );
QStringList examples;
TQStringList examples;
examples.append( "chmod 0444 %1" );
examples.append( "convert %1 %1.png" );
examples.append( "echo %1 >> $HOME/file.list" );
// examples.append( ")
for( unsigned int i = 0; i < examples.count(); i++ )
if( !list->findItem( examples[i] ) )
if( !list->tqfindItem( examples[i] ) )
list->insertItem( examples[i] );
}

@@ -117,24 +117,15 @@ void CommandPlugin::fillStructure()
noblock = checkNoBlock->isChecked();
}

QString CommandPlugin::processFile( BatchRenamer* b, int i, QString, int )
TQString CommandPlugin::processFile( BatchRenamer* b, int i, TQString, int )
{
QString filename = b->files()[i].dst.name;
TQString filename = b->files()[i].dst.name;

QString c = command;
TQString c = command;
KShellProcess proc;
#if QT_VERSION >= 0x030100
c = c.replace( "%1", KShellProcess::quote( filename ) );
#else
int pos = 0;
do {
pos = c.find( "%1", pos );
if( pos >= 0 )
c.replace( pos, 2, KShellProcess::quote( filename ) );
} while ( pos >= 0 );
#endif
c = c.tqreplace( "%1", KShellProcess::quote( filename ) );

proc << c;
@@ -146,16 +137,16 @@ QString CommandPlugin::processFile( BatchRenamer* b, int i, QString, int )
proc.resume();

if( !noblock && proc.exitStatus() )
return command.arg( filename ) + QString( i18n(" exited with error: %1") ).arg( proc.exitStatus() );
return command.tqarg( filename ) + TQString( i18n(" exited with error: %1") ).tqarg( proc.exitStatus() );

return QString::null;
return TQString();
}

void CommandPlugin::finished()
{
KConfig* conf = kapp->config();
conf->setGroup("CommandPlugin");
QStringList slist;
TQStringList slist;
for( unsigned int i = 0; i < list->count(); i++ )
slist.append( list->text( i ) );

@@ -193,7 +184,7 @@ void CommandPlugin::exec()
commandline->setText( list->text( i ) );
}

const QPixmap CommandPlugin::getIcon() const
const TQPixmap CommandPlugin::getIcon() const
{
return kapp->iconLoader()->loadIcon( "konsole", KIcon::Small );
}

+ 9
- 8
krename/commandplugin.h View File

@@ -23,25 +23,26 @@
#include "plugin.h"
#include "helpdialog.h"

class QCheckBox;
class TQCheckBox;
class KLineEdit;
class KListBox;
class KPushButton;
class CommandPlugin : public Plugin {
Q_OBJECT
TQ_OBJECT
public:
const QString getName() const;
const QString getAccelName() const;
const TQString getName() const;
const TQString getAccelName() const;
const int type() const;

bool checkError();
void drawInterface( QWidget* w, QVBoxLayout* l );
void drawInterface( TQWidget* w, TQVBoxLayout* l );
void fillStructure();
QString processFile( BatchRenamer*, int, QString token, int );
TQString processFile( BatchRenamer*, int, TQString token, int );
void finished();

bool alwaysUsed() const { return false; }
const QPixmap getIcon() const;
const TQPixmap getIcon() const;
private slots:
void add();
@@ -50,12 +51,12 @@ class CommandPlugin : public Plugin {

private:
KLineEdit* commandline;
QCheckBox* checkNoBlock;
TQCheckBox* checkNoBlock;
KListBox* list;
KPushButton* buttonAdd;
KPushButton* buttonRemove;

QString command;
TQString command;
bool noblock;
};


+ 32
- 32
krename/confdialog.cpp View File

@@ -19,25 +19,25 @@
#include "confdialog.h"

// QT includes
#include <qbuttongroup.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qradiobutton.h>
#include <qtooltip.h>
#include <tqbuttongroup.h>
#include <tqlabel.h>
#include <tqlayout.h>
#include <tqradiobutton.h>
#include <tqtooltip.h>

// KDE includes
#include <kiconloader.h>
#include <klocale.h>

ConfDialog::ConfDialog( QWidget* parent, const char* name )
ConfDialog::ConfDialog( TQWidget* tqparent, const char* name )
: KDialogBase( KDialogBase::IconList, "KRename",
KDialogBase::Ok | KDialogBase::Cancel | KDialogBase::Default, KDialogBase::Ok, parent, name, true, true ),
KDialogBase::Ok | KDialogBase::Cancel | KDialogBase::Default, KDialogBase::Ok, tqparent, name, true, true ),
GUIModeSelector()
{
setupTab1();
setupTab2();

connect( this, SIGNAL( defaultClicked() ), this, SLOT( defaults() ) );
connect( this, TQT_SIGNAL( defaultClicked() ), this, TQT_SLOT( defaults() ) );
}

ConfDialog::~ConfDialog()
@@ -46,38 +46,38 @@ ConfDialog::~ConfDialog()

void ConfDialog::setupTab1()
{
const QString caption = i18n("Look and Feel");
QFrame* box = addPage( caption, caption, BarIcon("looknfeel") );
QVBoxLayout* layout = new QVBoxLayout( box );
QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
const TQString caption = i18n("Look and Feel");
TQFrame* box = addPage( caption, caption, BarIcon("looknfeel") );
TQVBoxLayout* tqlayout = new TQVBoxLayout( box );
TQSpacerItem* spacer = new TQSpacerItem( 20, 20, TQSizePolicy::Minimum, TQSizePolicy::Expanding );

QButtonGroup* group = new QButtonGroup( box );
TQButtonGroup* group = new TQButtonGroup( box );
group->setColumnLayout(0, Qt::Vertical );
QVBoxLayout* lgroup = new QVBoxLayout( group->layout() );
TQVBoxLayout* lgroup = new TQVBoxLayout( group->tqlayout() );

optionWizard = new QRadioButton( group );
optionWizard = new TQRadioButton( group );
optionWizard->setText( i18n("Use &wizard style GUI (beginners)") );
optionTabs = new QRadioButton( group );
optionTabs = new TQRadioButton( group );
optionTabs->setText( i18n("Use &tabbed GUI (advanced users)") );

lgroup->addWidget( new QLabel( i18n("Configure the look and feel of the KRename GUI:<br>"), group ) );
lgroup->addWidget( new TQLabel( i18n("Configure the look and feel of the KRename GUI:<br>"), group ) );
lgroup->addWidget( optionWizard );
lgroup->addWidget( optionTabs );
lgroup->addItem( spacer );
layout->addWidget( group );
layout->addItem( spacer );
tqlayout->addWidget( group );
tqlayout->addItem( spacer );
}

void ConfDialog::setupTab2()
{
const QString caption = i18n("KRename");
QFrame* box = addPage( caption, caption, BarIcon("krename") );
QVBoxLayout* layout = new QVBoxLayout( box );
QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
const TQString caption = i18n("KRename");
TQFrame* box = addPage( caption, caption, BarIcon("krename") );
TQVBoxLayout* tqlayout = new TQVBoxLayout( box );
TQSpacerItem* spacer = new TQSpacerItem( 20, 20, TQSizePolicy::Minimum, TQSizePolicy::Expanding );

checkPlugins = new QCheckBox( i18n("&Load file plugins on start"), box );
checkAutosize = new QCheckBox( i18n("Auto &resize columns in preview"), box );
checkPlugins = new TQCheckBox( i18n("&Load file plugins on start"), box );
checkAutosize = new TQCheckBox( i18n("Auto &resize columns in preview"), box );

spinSize = new KIntNumInput( box );
spinSize->setRange( 20, 500, 1, false );
@@ -87,14 +87,14 @@ void ConfDialog::setupTab2()
spinHistory->setRange( 2, 500, 1, false );
spinHistory->setLabel( i18n( "&Number of template history items:" ), AlignLeft | AlignVCenter );

layout->addWidget( checkPlugins );
layout->addWidget( checkAutosize );
layout->addItem( spacer );
layout->addWidget( spinSize );
layout->addWidget( spinHistory );
layout->addItem( spacer );
tqlayout->addWidget( checkPlugins );
tqlayout->addWidget( checkAutosize );
tqlayout->addItem( spacer );
tqlayout->addWidget( spinSize );
tqlayout->addWidget( spinHistory );
tqlayout->addItem( spacer );

QToolTip::add( checkPlugins, i18n("Disabling this option decreases KRename's startup time, because no KFilePlugins are loaded.") );
TQToolTip::add( checkPlugins, i18n("Disabling this option decreases KRename's startup time, because no KFilePlugins are loaded.") );
}

void ConfDialog::defaults()

+ 9
- 8
krename/confdialog.h View File

@@ -19,7 +19,7 @@
#define CONFDIALOG_H

// QT includes
#include <qcheckbox.h>
#include <tqcheckbox.h>

// KDE includes
#include <kdialogbase.h>
@@ -27,14 +27,15 @@

#include "guimodeselector.h"

class QHBoxLayout;
class QVBoxLayout;
class QWidget;
class TQHBoxLayout;
class TQVBoxLayout;
class TQWidget;
class KIntNumInput;
class ConfDialog : public KDialogBase, public GUIModeSelector {
Q_OBJECT
TQ_OBJECT
public:
ConfDialog( QWidget* parent = 0, const char* name = 0 );
ConfDialog( TQWidget* tqparent = 0, const char* name = 0 );
~ConfDialog();

inline bool loadplugins() const { return checkPlugins->isChecked(); }
@@ -55,9 +56,9 @@ class ConfDialog : public KDialogBase, public GUIModeSelector {
void setupTab2();
protected:
QCheckBox* checkAsk;
QCheckBox* checkPlugins;
QCheckBox* checkAutosize;
TQCheckBox* checkAsk;
TQCheckBox* checkPlugins;
TQCheckBox* checkAutosize;

KIntNumInput* spinSize;
KIntNumInput* spinHistory;

+ 33
- 33
krename/coorddialog.cpp View File

@@ -17,29 +17,29 @@

#include "coorddialog.h"

// Qt includes
#include <qcheckbox.h>
#include <qfontmetrics.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qvalidator.h>
// TQt includes
#include <tqcheckbox.h>
#include <tqfontmetrics.h>
#include <tqlabel.h>
#include <tqlayout.h>
#include <tqvalidator.h>

// KDE includes
#include <kapplication.h>
#include <klocale.h>

DSLineEdit::DSLineEdit( QWidget* parent, const char* name )
: KLineEdit( parent, name )
DSLineEdit::DSLineEdit( TQWidget* tqparent, const char* name )
: KLineEdit( tqparent, name )
{
}

void DSLineEdit::keyPressEvent( QKeyEvent* e )
void DSLineEdit::keyPressEvent( TQKeyEvent* e )
{
KLineEdit::keyPressEvent( e );
emit changed();
}

void DSLineEdit::mousePressEvent( QMouseEvent* e )
void DSLineEdit::mousePressEvent( TQMouseEvent* e )
{
KLineEdit::mousePressEvent( e );
emit changed();
@@ -47,36 +47,36 @@ void DSLineEdit::mousePressEvent( QMouseEvent* e )

bool CoordDialog::m_inversion = false;

CoordDialog::CoordDialog( const QString & file, QWidget *_parent, const char *name )
CoordDialog::CoordDialog( const TQString & file, TQWidget *_parent, const char *name )
: KDialogBase( KDialogBase::Plain, "KRename",
KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok, _parent, name, true, true ), m_file( file )
{
QFrame* parent = plainPage();
QVBoxLayout* layout = new QVBoxLayout( parent );
TQFrame* tqparent = plainPage();
TQVBoxLayout* tqlayout = new TQVBoxLayout( tqparent );

filename = new DSLineEdit( parent );
filename = new DSLineEdit( tqparent );
filename->setText( file );
filename->setValidator( new QRegExpValidator( QRegExp( file ), this ) );
filename->setValidator( new TQRegExpValidator( TQRegExp( file ), TQT_TQOBJECT(this) ) );
preview = new QLabel( parent );
preview = new TQLabel( tqparent );

checkInvert = new QCheckBox( i18n("&Invert selection"), plainPage() );
checkInvert = new TQCheckBox( i18n("&Invert selection"), plainPage() );
checkInvert->setChecked( m_inversion );
layout->addWidget( new QLabel( i18n("Please select the text you want to insert:"), plainPage() ) );
layout->addWidget( filename );
layout->addWidget( checkInvert );
layout->addWidget( preview );
tqlayout->addWidget( new TQLabel( i18n("Please select the text you want to insert:"), plainPage() ) );
tqlayout->addWidget( filename );
tqlayout->addWidget( checkInvert );
tqlayout->addWidget( preview );

updateCommand();
connect( filename, SIGNAL( selectionChanged() ), this, SLOT( updateCommand() ) );
connect( checkInvert, SIGNAL( clicked() ), this, SLOT( updateCommand() ) );
connect( filename, SIGNAL( textChanged( const QString & ) ), this, SLOT( resetText() ) );
connect( filename, SIGNAL( changed() ), this, SLOT( updateCommand() ) );
connect( filename, TQT_SIGNAL( selectionChanged() ), this, TQT_SLOT( updateCommand() ) );
connect( checkInvert, TQT_SIGNAL( clicked() ), this, TQT_SLOT( updateCommand() ) );
connect( filename, TQT_SIGNAL( textChanged( const TQString & ) ), this, TQT_SLOT( resetText() ) );
connect( filename, TQT_SIGNAL( changed() ), this, TQT_SLOT( updateCommand() ) );

show();
QFontMetrics fm( filename->font() );
TQFontMetrics fm( filename->font() );
int w = fm.width( file );
if( w > width() )
resize(
@@ -102,26 +102,26 @@ void CoordDialog::updateCommand()
start++;
end++;
if( start > 1 )
m_command = QString("[$1;%1]").arg(start-1);
m_command = TQString("[$1;%1]").tqarg(start-1);

if( end <= (signed int)filename->text().length() )
m_command.append( QString("[$%1-[length]]").arg(end) );
m_command.append( TQString("[$%1-[length]]").tqarg(end) );
}
} else if( checkInvert->isChecked() && !filename->hasSelectedText() ) {
int p = filename->cursorPosition();
m_command = QString("[$1;%1][$%2-[length]]").arg(p).arg(p+1);
m_command = TQString("[$1;%1][$%2-[length]]").tqarg(p).tqarg(p+1);
} else if( !checkInvert->isChecked() && filename->hasSelectedText() ){
if( end ) {
start++;
end++;
if( end <= (signed int)filename->text().length() )
m_command = QString("[$%1;%2]").arg(start).arg(end-start);
m_command = TQString("[$%1;%2]").tqarg(start).tqarg(end-start);
else
m_command = QString("[$%1-[length]]").arg(start);
m_command = TQString("[$%1-[length]]").tqarg(start);
}
} else if( !checkInvert->isChecked() && !filename->hasSelectedText() ) {
int p = filename->cursorPosition();
m_command = QString("[$%1-[length]]").arg( p );
m_command = TQString("[$%1-[length]]").tqarg( p );
}

}
@@ -135,7 +135,7 @@ void CoordDialog::resetText()
updateCommand();
}

QString CoordDialog::coords()
TQString CoordDialog::coords()
{
m_inversion = checkInvert->isChecked();
return m_command;

+ 15
- 13
krename/coorddialog.h View File

@@ -21,23 +21,24 @@
#include <kdialogbase.h>
#include <klineedit.h>

class QKeyEvent;
class TQKeyEvent;
class DSLineEdit : public KLineEdit {
Q_OBJECT
TQ_OBJECT
public:
DSLineEdit( QWidget* parent = 0, const char* name = 0 );
DSLineEdit( TQWidget* tqparent = 0, const char* name = 0 );

signals:
void changed();
protected:
void keyPressEvent( QKeyEvent* e );
void mousePressEvent( QMouseEvent* e );
void keyPressEvent( TQKeyEvent* e );
void mousePressEvent( TQMouseEvent* e );
};

class QCheckBox;
class QLabel;
class QString;
class TQCheckBox;
class TQLabel;
class TQString;

/* The name of this class was a very bad choice.
* CoordDialog is an abreviation vor Coordinate Dialog,
@@ -46,11 +47,12 @@ class QString;
*/
class CoordDialog : public KDialogBase {
Q_OBJECT
TQ_OBJECT
public:
CoordDialog( const QString & file, QWidget *_parent=0, const char *name=0);
CoordDialog( const TQString & file, TQWidget *_parent=0, const char *name=0);
~CoordDialog();

QString coords();
TQString coords();

static bool m_inversion;
@@ -59,12 +61,12 @@ class CoordDialog : public KDialogBase {
void resetText();
private:
QString m_file;
QString m_command;
TQString m_file;
TQString m_command;

DSLineEdit* filename;
QCheckBox* checkInvert;
QLabel* preview;
TQCheckBox* checkInvert;
TQLabel* preview;
};

#endif

+ 20
- 20
krename/dateplugin.cpp View File

@@ -16,8 +16,8 @@
***************************************************************************/
#include "dateplugin.h"

// Qt includes
#include <qdatetime.h>
// TQt includes
#include <tqdatetime.h>

// KDE includes
#include <kfileitem.h>
@@ -50,20 +50,20 @@ DatePlugin::DatePlugin()
}


QString DatePlugin::processFile(BatchRenamer* b, int i, QString token, int )
TQString DatePlugin::processFile(BatchRenamer* b, int i, TQString token, int )
{
if( !supports( token ) )
return QString::null;
return TQString();
if( token.lower().startsWith( getPattern() ) )
token = token.mid( getPattern().length(), token.length() - getPattern().length() );
QDate d = QDate::currentDate();
QTime t = QTime::currentTime();
QString tmp, text;
QString format = "dd-MM-yyyy";
if( token.contains( ";" ) )
TQDate d = TQDate::tqcurrentDate();
TQTime t = TQTime::currentTime();
TQString tmp, text;
TQString format = "dd-MM-yyyy";
if( token.tqcontains( ";" ) )
{
format = token.section( ';', 1, 1 );
token = token.section( ';', 0, 0 ).lower();
@@ -71,15 +71,15 @@ QString DatePlugin::processFile(BatchRenamer* b, int i, QString token, int )
token = token.lower();

if( token == "date" ) {
return QDateTime::currentDateTime().toString( format );
return TQDateTime::tqcurrentDateTime().toString( format );
} else if( token == "year" )
return QString( "%1" ).arg( d.year() );
return TQString( "%1" ).tqarg( d.year() );
else if( token == "month" )
return tmp.sprintf("%0*i", 2, d.month() );
else if( token == "day" )
return tmp.sprintf("%0*i", 2, d.day() );
else if( token == "time" )
return QString( "%1-%2-%3" ).arg( t.hour() ).arg( QString().sprintf("%0*i", 2, t.minute() ) ).arg( QString().sprintf("%0*i", 2, t.second() ) );
return TQString( "%1-%2-%3" ).tqarg( t.hour() ).tqarg( TQString().sprintf("%0*i", 2, t.minute() ) ).tqarg( TQString().sprintf("%0*i", 2, t.second() ) );
else if( token == "hour" )
return tmp.sprintf("%0*i", 2, t.hour() );
else if( token == "minute" )
@@ -103,34 +103,34 @@ QString DatePlugin::processFile(BatchRenamer* b, int i, QString token, int )
}
return QString::null;
return TQString();
}

const QString DatePlugin::getAccelName() const
const TQString DatePlugin::getAccelName() const
{
return i18n("&System Functions");
}

const QString DatePlugin::getName() const
const TQString DatePlugin::getName() const
{
return i18n("System Functions");
}

const QString DatePlugin::getPattern() const
const TQString DatePlugin::getPattern() const
{
return QString::null;
return TQString();
}

const QString DatePlugin::time( time_t time, const QString & format )
const TQString DatePlugin::time( time_t time, const TQString & format )
{
QDateTime dt;
TQDateTime dt;
dt.setTime_t( time );
return dt.toString( format );
}

void DatePlugin::addHelp( HelpDialogData* data )
{
QStringList list;
TQStringList list;
list.append( "[date];;" + i18n("Insert the current date") );
list.append( "[date;yyyy-MM-dd];;" + i18n("Insert the current date using the formatting string yyyy-MM-dd") );
list.append( "[year];;" + i18n("Insert the current year") );

+ 5
- 5
krename/dateplugin.h View File

@@ -29,15 +29,15 @@ class DatePlugin : public FilePlugin
public:
DatePlugin();

QString processFile(BatchRenamer* b, int i, QString token, int mode);
const QString getAccelName() const;
const QString getName() const;
const QString getPattern() const;
TQString processFile(BatchRenamer* b, int i, TQString token, int mode);
const TQString getAccelName() const;
const TQString getName() const;
const TQString getPattern() const;
void addHelp( HelpDialogData* data );
private:
const QString time( time_t time, const QString & format );
const TQString time( time_t time, const TQString & format );

};


+ 37
- 37
krename/datetime.cpp View File

@@ -18,11 +18,11 @@
#include "datetime.h"

// QT includes
#include <qcheckbox.h>
#include <qfileinfo.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qpushbutton.h>
#include <tqcheckbox.h>
#include <tqfileinfo.h>
#include <tqlabel.h>
#include <tqlayout.h>
#include <tqpushbutton.h>

// KDE includes
#include <kapplication.h>
@@ -39,12 +39,12 @@
#include <sys/types.h>
#include <sys/stat.h>

const QString MyDatePlugin::getName() const
const TQString MyDatePlugin::getName() const
{
return i18n("Date & Time");
}

const QString MyDatePlugin::getAccelName() const
const TQString MyDatePlugin::getAccelName() const
{
return i18n("Date && &Time");
}
@@ -59,31 +59,31 @@ bool MyDatePlugin::checkError()
return true;
}

const QPixmap MyDatePlugin::getIcon() const
const TQPixmap MyDatePlugin::getIcon() const
{
return kapp->iconLoader()->loadIcon( "kalarm", KIcon::Small );
}

void MyDatePlugin::drawInterface( QWidget* w, QVBoxLayout* l )
void MyDatePlugin::drawInterface( TQWidget* w, TQVBoxLayout* l )
{
m_widget = w;

#ifdef BENNY
l->addWidget( new QLabel("Setze Modifiaction Time um eine Stunde zurück", w) );
l->addWidget( new TQLabel("Setze Modifiaction Time um eine Stunde zurück", w) );
#else
Layout0 = new QHBoxLayout( 0, 0, 6, "Layout0");
Layout1 = new QVBoxLayout( 0, 0, 6, "Layout1");
Layout2 = new QHBoxLayout( 0, 0, 6, "Layout2");
Layout0 = new TQHBoxLayout( 0, 0, 6, "Layout0");
Layout1 = new TQVBoxLayout( 0, 0, 6, "Layout1");
Layout2 = new TQHBoxLayout( 0, 0, 6, "Layout2");

kDate = new KDatePicker( w );

checkAccess = new QCheckBox( w, "checkAccess" );