diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-07-01 05:51:05 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-07-01 05:51:05 +0000 |
commit | ce0c60d7b9a0be4dd17c25bf627d807d9432d953 (patch) | |
tree | f04fe60da1d1207732afec16a35d8d32323f20c4 /krename/commandplugin.cpp | |
parent | f8b5e2400a066271276cf2712aaf9788f5ac5ac1 (diff) | |
download | krename-ce0c60d7b9a0be4dd17c25bf627d807d9432d953.tar.gz krename-ce0c60d7b9a0be4dd17c25bf627d807d9432d953.zip |
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
Diffstat (limited to 'krename/commandplugin.cpp')
-rw-r--r-- | krename/commandplugin.cpp | 59 |
1 files changed, 25 insertions, 34 deletions
diff --git a/krename/commandplugin.cpp b/krename/commandplugin.cpp index d413cec..752002e 100644 --- a/krename/commandplugin.cpp +++ b/krename/commandplugin.cpp @@ -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 ); } |