rename the following methods:

tqfind find
tqreplace replace
tqcontains contains


git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/krename@1246075 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
v3.5.13-sru
tpearson pirms 13 gadiem
vecāks fb6f03ff75
revīzija 23a5fcb7bc

@ -118,7 +118,7 @@ void BatchRenamer::processFiles( ProgressDialog* p, TQObject* 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.tqreplace( 0, m_files[i].src.name.length(), m_files[i].dst.name );
m_files[c].src.directory.replace( 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 ) );
}
}
@ -358,7 +358,7 @@ void BatchRenamer::work( ProgressDialog* p )
void BatchRenamer::escape( TQString & text, const TQString & token, const TQString & sequence )
{
text.tqreplace( token, sequence );
text.replace( token, sequence );
}
TQString & BatchRenamer::doEscape( TQString text, bool filename )
@ -419,14 +419,14 @@ int BatchRenamer::getCharacters( int n )
return s.length();
}
TQString BatchRenamer::findAndProcess( const TQString & token, TQString text, const TQString & tqreplace )
TQString BatchRenamer::findAndProcess( const TQString & token, TQString text, const TQString & replace )
{
/*
* pos can here be -1 because
* tqfindRev is called with it as a
* findRev is called with it as a
* value !
*/
text.tqreplace( token, tqreplace );
text.replace( token, replace );
return text;
}
@ -440,10 +440,10 @@ TQString BatchRenamer::findNumbers( TQString text, int count, int i )
countervalues.start = m_index;
countervalues.step = m_step;
if( text.tqcontains( "#", FALSE ) <= 0 )
if( text.contains( "#", FALSE ) <= 0 )
return text;
pos = text.tqfind("#", pos);
pos = text.find("#", pos);
pos++;
while( text[pos] == '#' ) {
text.remove(pos, 1);
@ -452,7 +452,7 @@ TQString BatchRenamer::findNumbers( TQString text, int count, int i )
findNumberAppendix( text, pos, &countervalues.start, &countervalues.step );
pos = text.tqfind("#", 0);
pos = text.find("#", 0);
if( (signed int)m_counters.count() <= m_counter_index )
{
@ -464,7 +464,7 @@ TQString BatchRenamer::findNumbers( TQString text, int count, int i )
do {
m_counters[m_counter_index].value += m_counters[m_counter_index].step;
} while( m_skip.tqcontains( m_counters[m_counter_index].value ) );
} while( m_skip.contains( m_counters[m_counter_index].value ) );
/*
int v = start + (i*step) + m_skip_add[m_counter_index];
@ -478,7 +478,7 @@ TQString BatchRenamer::findNumbers( TQString text, int count, int i )
TQString temp;
temp.sprintf("%0*i", counter, m_counters[m_counter_index].value );
text.tqreplace( pos, 1, temp);
text.replace( pos, 1, temp);
++m_counter_index;
return findNumbers( text, count, i );
@ -491,7 +491,7 @@ void BatchRenamer::findNumberAppendix( TQString & text, int pos, int* start, int
int end = 0;
bool ok = false;
if( text[pos] == '{' && (end = text.tqfind( "}", pos )) > -1)
if( text[pos] == '{' && (end = text.find( "}", pos )) > -1)
{
//qDebug("Found an appendix:" + appendix );
appendix = text.mid( pos + 1, end - pos - 1);
@ -511,7 +511,7 @@ TQString BatchRenamer::findStar( const TQString & oldname, TQString text )
{
int pos = -1;
do {
pos = text.tqfindRev("*", pos);
pos = text.findRev("*", pos);
if( pos >= 0 ) {
TQString tmp = oldname.lower();
if( tmp[0].isLetter() )
@ -522,7 +522,7 @@ TQString BatchRenamer::findStar( const TQString & oldname, TQString text )
tmp[i] != '\'' && tmp[i] != '?' && tmp[i] != '`' )
tmp[i+1] = tmp[i+1].upper();
text.tqreplace( pos, 1, tmp);
text.replace( pos, 1, tmp);
}
} while( pos >= 0 );
return text;
@ -538,15 +538,15 @@ TQString BatchRenamer::findBrackets( TQString oldname, TQString text, int i )
int num, pos = -1, a;
TQString token;
if( text.tqcontains("]", FALSE) <= 0 || text.isEmpty() )
if( text.contains("]", FALSE) <= 0 || text.isEmpty() )
return text;
num = text.tqcontains("[", FALSE);
num = text.contains("[", FALSE);
if(num <= 0 )
return text;
pos = text.tqfindRev("[", pos);
a = text.tqfind("]", pos );
pos = text.findRev("[", pos);
a = text.find("]", pos );
if( a < 0 && pos >= 0 )
return text;
@ -646,7 +646,7 @@ TQString BatchRenamer::findToken( TQString oldname, TQString token, int i )
break;
case MIXED:
token = token.lower();
token.tqreplace( 0, 1, token[0].upper());
token.replace( 0, 1, token[0].upper());
break;
case STAR:
token = findStar( token, "*" );
@ -676,14 +676,14 @@ TQString BatchRenamer::findPartStrings( TQString oldname, TQString token )
int pos = -1;
// parse things like [2;4{[dirname]}]
if( token.tqcontains( "{" ) >= 1 && token.tqcontains( "}" ) >= 1 ) {
int pos = token.tqfind( "{" );
oldname = token.mid( pos + 1, token.tqfindRev( "}" ) - pos - 1 );
if( token.contains( "{" ) >= 1 && token.contains( "}" ) >= 1 ) {
int pos = token.find( "{" );
oldname = token.mid( pos + 1, token.findRev( "}" ) - pos - 1 );
token = token.left( pos );
}
if( token.tqcontains("-") ) {
pos = token.tqfind( "-", 0 );
if( token.contains("-") ) {
pos = token.find( "-", 0 );
first = token.left( pos );
// ------- Code OK ^ !
@ -717,8 +717,8 @@ TQString BatchRenamer::findPartStrings( TQString oldname, TQString token )
x++;
return oldname.mid( first.toInt()-1, x );
} else if( token.tqcontains(";") ) {
pos = token.tqfind( ";", 0 );
} else if( token.contains(";") ) {
pos = token.find( ";", 0 );
first = token.left( pos );
second = token.mid( pos+1, token.length() );
@ -744,7 +744,7 @@ TQString BatchRenamer::findDirName( TQString token, TQString path )
int recursion = 1;
if( token.length() > 7 ) {
token = token.right( token.length() - 7 );
recursion = token.tqcontains( "." );
recursion = token.contains( "." );
if( recursion != (signed int)token.length() )
return TQString();
@ -777,27 +777,27 @@ TQString BatchRenamer::findLength( const TQString & token, const TQString & name
TQString BatchRenamer::findReplace( TQString text )
{
// Call for each element in replace strings doReplace with correct values
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 );
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 );
}
return text;
}
TQString BatchRenamer::doReplace( TQString text, TQString tqfind, TQString tqreplace, bool reg )
TQString BatchRenamer::doReplace( TQString text, TQString find, TQString replace, bool reg )
{
if( !reg )
{
// we use the escaped text here because the user might want
// to find a "&" and replace it
text.tqreplace( doEscape( tqfind ), tqreplace );
text.replace( doEscape( find ), replace );
}
else
{
// 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 ).tqreplace( TQRegExp( tqfind ), tqreplace ) );
text = doEscape( unEscape( text ).replace( TQRegExp( find ), replace ) );
}
return text;
}
@ -832,7 +832,7 @@ void BatchRenamer::writeUndoScript( TQTextStream* t )
void BatchRenamer::parseSubdirs( data* f )
{
int pos = 0;
if( (pos = f->dst.name.tqfindRev( "/", -1 ) ) > 0 ) {
if( (pos = f->dst.name.findRev( "/", -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 ) == "/" ) ? "" : "/";

@ -70,8 +70,8 @@ typedef struct manualchanges {
};
typedef struct replacestrings {
TQString tqfind; // Text to tqreplace
TQString tqreplace; // Replace with
TQString find; // Text to replace
TQString replace; // Replace with
bool reg; // is it a reg expression ?
};
@ -106,7 +106,7 @@ class BatchRenamer {
inline void setStep( int s ) { m_step = s; }
inline void setResetCounter( bool r ) { m_reset = r; }
inline void setSkipList( const TQValueList<int> & s ) { m_skip = s; }
inline void setReplaceList( const TQValueList<replacestrings> & r ) { m_tqreplace = r; }
inline void setReplaceList( const TQValueList<replacestrings> & r ) { m_replace = r; }
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; }
@ -116,7 +116,7 @@ class BatchRenamer {
inline int mode() const { return m_mode; }
// Since 2.1 public, because plugins may want to access them to:
TQString findAndProcess( const TQString & token, TQString text, const TQString & tqreplace );
TQString findAndProcess( const TQString & token, TQString text, const TQString & replace );
TQString findNumbers( TQString text, int count, int i );
TQString findStar( const TQString & oldname, TQString text );
@ -127,7 +127,7 @@ class BatchRenamer {
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 doReplace( TQString text, TQString find, TQString replace, bool reg ); // text is here already the new filename !
TQString processString( TQString text, TQString oldname, int i );
@ -169,7 +169,7 @@ class BatchRenamer {
bool overwrite; // overwrite existing files
int m_mode; // renaming mode
TQValueList<int> m_skip; // Numbers to skip
TQValueList<replacestrings> m_tqreplace; // Replace strings
TQValueList<replacestrings> m_replace; // Replace strings
TQValueList<data> m_files;
TQValueList<manualchanges> m_changes; // User made changes
PluginLoader* plug;

@ -107,7 +107,7 @@ void CommandPlugin::drawInterface( TQWidget* w, TQVBoxLayout* l )
examples.append( "echo %1 >> $HOME/file.list" );
// examples.append( ")
for( unsigned int i = 0; i < examples.count(); i++ )
if( !list->tqfindItem( examples[i] ) )
if( !list->findItem( examples[i] ) )
list->insertItem( examples[i] );
}
@ -125,7 +125,7 @@ TQString CommandPlugin::processFile( BatchRenamer* b, int i, TQString, int )
TQString c = command;
KShellProcess proc;
c = c.tqreplace( "%1", KShellProcess::quote( filename ) );
c = c.replace( "%1", KShellProcess::quote( filename ) );
proc << c;

@ -63,7 +63,7 @@ TQString DatePlugin::processFile(BatchRenamer* b, int i, TQString token, int )
TQTime t = TQTime::currentTime();
TQString tmp, text;
TQString format = "dd-MM-yyyy";
if( token.tqcontains( ";" ) )
if( token.contains( ";" ) )
{
format = token.section( ';', 1, 1 );
token = token.section( ';', 0, 0 ).lower();

@ -76,11 +76,11 @@ void FilePlugin::setPattern( KMimeType::Ptr mime )
// We need a pattern
if( m_pattern.isEmpty() ) {
int a = 0;
a = m_name.tqfind( "-" );
a = m_name.find( "-" );
if( a > -1 )
m_pattern = m_name.left( a ).lower();
else {
a = m_pattern.tqfind( " " );
a = m_pattern.find( " " );
if( a > -1 )
m_pattern = m_name.left( a ).lower();
else
@ -158,7 +158,7 @@ TQString FilePlugin::processFile( BatchRenamer* b, int i, TQString token, int )
/*
* Check if we have something cached for this file
*/
if( cache.tqcontains( filename + "::" + token ) )
if( cache.contains( filename + "::" + token ) )
return cache[filename + "::" + token ];
for( unsigned int i = 0; i < keys.count(); i++ ) {

@ -30,7 +30,7 @@
void HelpDialogData::remove( const TQString & headline )
{
if( m_map.tqcontains( headline ) ) {
if( m_map.contains( headline ) ) {
m_map.remove( headline );
m_icons.remove( headline );

@ -143,8 +143,8 @@ void KRenameImpl::setup( bool wizardmode )
connect( buttonDown, TQT_SIGNAL( clicked()), this, TQT_SLOT( updatePreview() ));
connect( buttonUp2, TQT_SIGNAL( clicked()), this, TQT_SLOT( moveUp() ));
connect( buttonDown2, TQT_SIGNAL( clicked()), this, TQT_SLOT( moveDown() ));
connect( buttonReplace, TQT_SIGNAL( clicked()), this, TQT_SLOT( tqreplace() ));
connect( buttonEasyReplace, TQT_SIGNAL( clicked()), this, TQT_SLOT( tqreplace() ));
connect( buttonReplace, TQT_SIGNAL( clicked()), this, TQT_SLOT( replace() ));
connect( buttonEasyReplace, TQT_SIGNAL( clicked()), this, TQT_SLOT( replace() ));
connect( buttonCoord, TQT_SIGNAL( clicked()), this, TQT_SLOT( getCoordinates() ));
connect( comboSort, TQT_SIGNAL( activated(int)), fileList, TQT_SLOT( setSorting(int) ));
@ -250,7 +250,7 @@ void KRenameImpl::parseCommandline()
TQPtrListIterator<PluginLoader::PluginLibrary> it( plugin->libs );
while ( it.current() )
{
if( uselist.tqcontains( (*it)->plugin->getName().lower().utf8() ) )
if( uselist.contains( (*it)->plugin->getName().lower().utf8() ) )
(*it)->check->setChecked( true );
++it;
@ -567,7 +567,7 @@ void KRenameImpl::setupFileTab1()
comboExtension = new KComboBox( false, tab );
buttonReplace = new KPushButton( i18n("Find &and Replace..."), tab );
buttonReplace->setIconSet( SmallIconSet("tqfind") );
buttonReplace->setIconSet( SmallIconSet("find") );
buttonNumber = new KPushButton( i18n("&Numbering..."), tab );
buttonCoord = new KPushButton( i18n("&Insert Part of Filename..."), tab );
@ -706,7 +706,7 @@ void KRenameImpl::setupFileTab2()
spinNull->setRange( 1, 100, 1, false );
buttonEasyReplace = new KPushButton( i18n("&Find and Replace..."), rightBox );
buttonEasyReplace->setIconSet( SmallIconSet("tqfind") );
buttonEasyReplace->setIconSet( SmallIconSet("find") );
tqlayout->addWidget( vgroup1 );
tqlayout->addWidget( rightBox );
@ -818,7 +818,7 @@ void KRenameImpl::parseWizardMode()
*/
TQString t = filename->text();
spinNull->setValue( t.tqcontains( "#" ) );
spinNull->setValue( t.contains( "#" ) );
if( t.startsWith( "[date]") )
{
@ -846,13 +846,13 @@ void KRenameImpl::parseWizardMode()
}
int pos = -1;
if( (pos = t.tqfind( "$" )) > -1 )
if( (pos = t.find( "$" )) > -1 )
comboKRenameFilename->setCurrentItem( 0 );
else if( (pos = t.tqfind( "%" )) > -1 )
else if( (pos = t.find( "%" )) > -1 )
comboKRenameFilename->setCurrentItem( 1 );
else if( (pos = t.tqfind( "&" )) > -1 )
else if( (pos = t.find( "&" )) > -1 )
comboKRenameFilename->setCurrentItem( 2 );
else if( (pos = t.tqfind( "*" )) > -1 )
else if( (pos = t.find( "*" )) > -1 )
comboKRenameFilename->setCurrentItem( 3 );
else
{
@ -1225,7 +1225,7 @@ void KRenameImpl::updatePluginPreview( Plugin* p )
void KRenameImpl::updatePreview()
{
// is there a number in the filename or extension
if( filename->text().tqcontains( "#" ) || extemplate->text().tqcontains( "#" ) )
if( filename->text().contains( "#" ) || extemplate->text().contains( "#" ) )
buttonNumber->setEnabled( true );
else
buttonNumber->setEnabled( false );
@ -1347,7 +1347,7 @@ void KRenameImpl::saveConfig()
config->sync();
}
void KRenameImpl::tqreplace()
void KRenameImpl::replace()
{
ReplaceDialog* r = new ReplaceDialog( rep, tqparent );
if( r->exec() == TQDialog::Accepted )
@ -1554,14 +1554,14 @@ void KRenameImpl::splitFilename( TQFileInfo* fi, TQString* base, TQString* exten
TQString file = FileOperation::getName( fi->filePath() );
int p = 0;
if( !file.tqcontains( "." ) || !dot || dot > file.tqcontains( "." ) ) {
if( !file.contains( "." ) || !dot || dot > file.contains( "." ) ) {
*base = file;
*extension = "";
return;
}
for( int i = 0; i < dot; i++ )
p = file.tqfind( ".", p + 1 );
p = file.find( ".", p + 1 );
*base = file.left( p );
*extension = file.right( file.length() - p - 1 );
@ -1716,7 +1716,7 @@ void KRenameImpl::updateDots()
unsigned int max = 0;
for( unsigned int i = 0; i < fileList->count(); i++ ) {
TQString name = fileList->url( i ).fileName();
int c = name.tqcontains( "." );
int c = name.contains( "." );
max = ( c > (int)max ? c : (int)max);
}

@ -131,7 +131,7 @@ class KRenameImpl : public TQObject, public KRenameDCOP {
void removeFile();
void removeFile( int index );
void preferences();
void tqreplace();
void replace();
void saveConfig();
void start();
void updateCount();

@ -65,7 +65,7 @@ TQString PicturePlugin::processFile( BatchRenamer* b, int i, TQString token, int
/*
* Check if we have something cached for this file
*/
if( cache.tqcontains( filename + "::" + token ) )
if( cache.contains( filename + "::" + token ) )
return cache[filename + "::" + token ];
TQImage img( filename );

@ -124,7 +124,7 @@ Plugin* PluginLoader::findPlugin( const TQString & token )
// Optimize a little bit for speed and convert only once to lower()
TQString lower = token.lower();
if( m_bracket_cache.tqcontains( lower ) )
if( m_bracket_cache.contains( lower ) )
return m_bracket_cache[lower];
/* The new version is slower than the old one :-(

@ -119,7 +119,7 @@ const TQString ProfileManager::getProfilePath( const TQString & name )
conf->setGroup( "ProfilesHeader" );
list = conf->readListEntry( "list" );
if( !list.tqcontains( name ) )
if( !list.contains( name ) )
list.append( name );
conf->writeEntry( "list", list );
@ -168,15 +168,15 @@ void ProfileManager::writeXML( const TQString & name )
numbering.setAttribute( "skip", listToString( m_krename->skip ) );
numbering.setAttribute( "reset", m_krename->m_reset );
TQDomElement tqreplace = doc.createElement( "tqreplace" );
TQDomElement replace = doc.createElement( "replace" );
for( unsigned int i=0;i<m_krename->rep.count();i++)
{
TQDomElement r = doc.createElement( "item" );
r.setAttribute( "tqfind", m_krename->rep[i].tqfind );
r.setAttribute( "tqreplace", m_krename->rep[i].tqreplace );
r.setAttribute( "find", m_krename->rep[i].find );
r.setAttribute( "replace", m_krename->rep[i].replace );
r.setAttribute( "reg", m_krename->rep[i].reg );
tqreplace.appendChild( r );
replace.appendChild( r );
}
// destination settings
@ -193,7 +193,7 @@ void ProfileManager::writeXML( const TQString & name )
files.setAttribute( "preview", TQString::number( m_krename->checkPreview->isChecked() ) );
files.setAttribute( "names", TQString::number( m_krename->checkName->isChecked() ) );
filename.appendChild( tqreplace );
filename.appendChild( replace );
filename.appendChild( numbering );
root.appendChild( settings );
root.appendChild( filename );
@ -270,7 +270,7 @@ bool ProfileManager::loadXML( const TQString & path )
m_krename->skip = stringToList( e.attribute("skip", listToString( m_krename->skip ) ) );
m_krename->m_reset = (bool)e.attribute( "reset", TQString::number( (int)m_krename->m_reset ) ).toInt();
}
else if( e.tagName() == "tqreplace" )
else if( e.tagName() == "replace" )
{
m_krename->rep.clear();
TQDomNode n = e.firstChild();
@ -280,8 +280,8 @@ bool ProfileManager::loadXML( const TQString & path )
if( !e.isNull() && e.tagName() == "item" )
{
replacestrings r;
r.tqfind = e.attribute( "tqfind", TQString() );
r.tqreplace = e.attribute( "tqreplace", TQString() );
r.find = e.attribute( "find", TQString() );
r.replace = e.attribute( "replace", TQString() );
r.reg = (bool)e.attribute( "reg", "0" ).toInt();
m_krename->rep.append( r );
}
@ -352,7 +352,7 @@ const TQString ProfileManager::listToString( TQValueList<int> & list )
const TQValueList<int> ProfileManager::stringToList( const TQString & data )
{
TQValueList<int> list;
int c = data.tqcontains( ";" );
int c = data.contains( ";" );
if( c > 0 )
{
for( int i = 0;i<c;i++)
@ -532,7 +532,7 @@ void ProfileDlg::slotCreateProfile()
if( !ok )
return;
if( profiles->tqfindItem( name, TQt::ExactMatch ) )
if( profiles->findItem( name, TQt::ExactMatch ) )
{
KMessageBox::error( this, i18n("This profile does already exist. Please choose another name.") );
slotCreateProfile();
@ -561,7 +561,7 @@ void ProfileDlg::slotDeleteProfile()
TQString path = readProfilePath( profile );
TQFile::remove( path );
TQListBoxItem* item = profiles->tqfindItem( profile, TQt::ExactMatch );
TQListBoxItem* item = profiles->findItem( profile, TQt::ExactMatch );
if( item )
delete item;

@ -109,11 +109,11 @@ ReplaceDialog::ReplaceDialog( TQValueList<replacestrings> & r, TQWidget* tqparen
for( unsigned int i = 0; i < r.count(); i++ ) {
replacestrings rs = r[i];
BatchRenamer::unEscape( rs.tqfind );
BatchRenamer::unEscape( rs.find );
KListViewItem* item = new KListViewItem( list );
item->setText( 0, encode( rs.tqfind ) );
item->setText( 1, encode( rs.tqreplace ) );
item->setText( 0, encode( rs.find ) );
item->setText( 1, encode( rs.replace ) );
item->setText( 2, rs.reg ? i18n("yes") : i18n("no") );
item->setText( 3, TQString::number( rs.reg ) );
list->insertItem( item );
@ -170,11 +170,11 @@ TQValueList<replacestrings> ReplaceDialog::getList()
TQListViewItem* item = list->firstChild();
while( item ) {
replacestrings n;
n.tqfind = decode( item->text( 0 ) );
n.tqreplace = decode( item->text( 1 ) );
n.find = decode( item->text( 0 ) );
n.replace = decode( item->text( 1 ) );
n.reg = item->text( 3 ).toInt();
BatchRenamer::doEscape( n.tqfind );
BatchRenamer::doEscape( n.find );
r.append( n );

@ -79,7 +79,7 @@ void wizard::slotAddPage( TQWidget* page, const TQString & title )
TQVBox* tqlayout = new TQVBox( this );
new TQLabel( TQString( t ).remove( title.tqfind( "&" ), 1 ), tqlayout );
new TQLabel( TQString( t ).remove( title.find( "&" ), 1 ), tqlayout );
TQFrame* hbar1 = new TQFrame( tqlayout, "<hr>", 0 );
hbar1->setFrameStyle( TQFrame::Sunken + TQFrame::HLine );

Notiek ielāde…
Atcelt
Saglabāt