@ -125,7 +125,7 @@ void BatchRenamer::processFiles( ProgressDialog* p, TQObject* object )
}
}
}
}
p - > print ( TQString ( i18n ( " Filenames Processed after %1 seconds. " ) ) .arg ( t . elapsed ( ) / 1000 ) ) ;
p - > print ( i18n ( " Filenames Processed after %1 seconds. " ) .arg ( t . elapsed ( ) / 1000 ) ) ;
work ( p ) ;
work ( p ) ;
}
}
@ -258,14 +258,14 @@ void BatchRenamer::work( ProgressDialog* p )
* Give the user some information . . .
* Give the user some information . . .
*/
*/
if ( m_mode = = COPY )
if ( m_mode = = COPY )
p - > print ( TQString ( i18n ( " Files will be copied to: %1 " ) ) . arg ( m_files [ 0 ] . dst . directory ) ) ;
p - > print ( i18n ( " Files will be copied to: %1 " ) . arg ( m_files [ 0 ] . dst . directory ) ) ;
else if ( m_mode = = MOVE )
else if ( m_mode = = MOVE )
p - > print ( TQString ( i18n ( " Files will be moved to: %1 " ) ) . arg ( m_files [ 0 ] . dst . directory ) ) ;
p - > print ( i18n ( " Files will be moved to: %1 " ) . arg ( m_files [ 0 ] . dst . directory ) ) ;
else if ( m_mode = = LINK )
else if ( m_mode = = LINK )
p - > print ( TQString ( i18n ( " Symbolic links will be created in: %1 " ) ) . arg ( m_files [ 0 ] . dst . directory ) ) ;
p - > print ( i18n ( " Symbolic links will be created in: %1 " ) . arg ( m_files [ 0 ] . dst . directory ) ) ;
else if ( m_mode = = RENAME )
else if ( m_mode = = RENAME )
p - > print ( i18n ( " Input files will be renamed. " ) ) ;
p - > print ( i18n ( " Input files will be renamed. " ) ) ;
unsigned int i ;
unsigned int i ;
for ( i = 0 ; i < m_files . count ( ) ; i + + ) {
for ( i = 0 ; i < m_files . count ( ) ; i + + ) {
p - > setProgress ( i + 1 ) ;
p - > setProgress ( i + 1 ) ;
@ -317,7 +317,7 @@ void BatchRenamer::work( ProgressDialog* p )
( * tundo ) < < " mv --force -b --suffix=.krename_ \" " < < m_files [ i ] . dst . name
( * tundo ) < < " mv --force -b --suffix=.krename_ \" " < < m_files [ i ] . dst . name
< < " \" \" " < < m_files [ i ] . src . name < < " \" " < < endl ;
< < " \" \" " < < m_files [ i ] . src . name < < " \" " < < endl ;
} else
} else
p - > warning ( TQString ( i18n ( " Undo is not possible for remote file: %1 " ) ) . arg ( dst . prettyURL ( ) ) ) ;
p - > warning ( i18n ( " Undo is not possible for remote file: %1 " ) . arg ( dst . prettyURL ( ) ) ) ;
}
}
@ -329,24 +329,24 @@ void BatchRenamer::work( ProgressDialog* p )
}
}
}
}
const TQString m = TQString( i18n( " Renamed %1 files successfully. " ) ) . arg ( i - error ) ;
const TQString m = i18n( " Renamed %1 files successfully. " ) . arg ( i - error ) ;
( i - error ) ? p - > print ( m ) : p - > warning ( m ) ;
( i - error ) ? p - > print ( m ) : p - > warning ( m ) ;
if ( error > 0 )
if ( error > 0 )
p - > warning ( TQString ( i18n ( " %2 errors occurred! " ) ) . arg ( error ) ) ;
p - > warning ( i18n ( " %2 errors occurred! " ) . arg ( error ) ) ;
p - > print ( TQString ( i18n ( " Elapsed time: %1 seconds " ) ) . arg ( t . elapsed ( ) / 1000 ) , " kalarm " ) ;
p - > print ( i18n ( " Elapsed time: %1 seconds " ) . arg ( t . elapsed ( ) / 1000 ) , " kalarm " ) ;
p - > print ( i18n ( " KRename finished the renaming process. " ) , " krename " ) ;
p - > print ( i18n ( " KRename finished the renaming process. " ) , " krename " ) ;
p - > print ( i18n ( " Press close to quit! " ) ) ;
p - > print ( i18n ( " Press close to quit! " ) ) ;
p - > setRenamedFiles ( renamedFiles , m_files . count ( ) ) ;
p - > setRenamedFiles ( renamedFiles , m_files . count ( ) ) ;
if ( undo ) {
if ( undo ) {
( * tundo ) < < endl < < " echo \" Finished undoing " < < m_files . count ( ) < < " actions. \" " < < endl ;
( * tundo ) < < endl < < " echo \" Finished undoing " < < m_files . count ( ) < < " actions. \" " < < endl ;
delete tundo ;
delete tundo ;
fundo - > close ( ) ;
fundo - > close ( ) ;
// Make fundo exuteable
// Make fundo exuteable
if ( chmod ( ( const char * ) m_undoScript , ( unsigned int ) S_IRUSR | S_IWUSR | S_IXUSR ) )
if ( chmod ( m_undoScript . local8Bit ( ) , ( unsigned int ) S_IRUSR | S_IWUSR | S_IXUSR ) )
p - > error ( i18n ( " Can't set executable bit on undo script. " ) ) ;
p - > error ( i18n ( " Can't set executable bit on undo script. " ) ) ;
delete fundo ;
delete fundo ;
}
}
@ -361,7 +361,7 @@ void BatchRenamer::escape( TQString & text, const TQString & token, const TQStri
text . replace ( token , sequence ) ;
text . replace ( token , sequence ) ;
}
}
TQString & BatchRenamer : : doEscape ( TQString text , bool filename )
TQString & BatchRenamer : : doEscape ( TQString & text , bool filename )
{
{
if ( filename ) {
if ( filename ) {
BatchRenamer : : escape ( text , " & " , TQChar ( 60000 ) ) ;
BatchRenamer : : escape ( text , " & " , TQChar ( 60000 ) ) ;
@ -840,13 +840,13 @@ void BatchRenamer::parseSubdirs( data* f )
// create the missing subdir now
// create the missing subdir now
int i = 0 ;
int i = 0 ;
TQString d = " " ;
TQString d = " " ;
while ( ( d = dirs . section ( " / " , i , i , TQString : : SectionSkipEmpty ) ) & & ! d . isEmpty ( ) ) { // asignment here!
while ( ! ( d = dirs . section ( " / " , i , i , TQString : : SectionSkipEmpty ) ) . isEmpty ( ) ) { // asignment here!
KURL url = f - > dst . url ;
KURL url = f - > dst . url ;
// it is important to unescape here
// it is important to unescape here
// to support dirnames containing "&" or
// to support dirnames containing "&" or
// similar tokens
// similar tokens
url . addPath ( unEscape ( d ) ) ;
url . addPath ( unEscape ( d ) ) ;
if ( ! NetAccess : : exists ( url ) & & ! NetAccess : : mkdir ( url ) )
if ( ! NetAccess : : exists ( url , false , 0 ) & & ! NetAccess : : mkdir ( url , 0 , - 1 ) )
// TODO: GUI bug report
// TODO: GUI bug report
tqDebug ( " Can't create %s " , url . prettyURL ( ) . latin1 ( ) ) ;
tqDebug ( " Can't create %s " , url . prettyURL ( ) . latin1 ( ) ) ;