summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSlávek Banko <[email protected]>2018-10-27 16:49:13 +0200
committerSlávek Banko <[email protected]>2018-10-27 16:49:25 +0200
commite023691c157597570525a90ecb650e080c662fcb (patch)
treefdfe8911541f2cd398c75e19e24c8b04f663f1de
parentededcc28b46bb4a33cddae207b95ccb8722885a4 (diff)
downloadkrename-e023691c157597570525a90ecb650e080c662fcb.tar.gz
krename-e023691c157597570525a90ecb650e080c662fcb.zip
Added controlled conversions to char* instead of automatic ascii conversions.
The definition of -UTQT_NO_ASCII_CAST is no longer needed. Fix unnecessary use of TQString() over i18n(). Resolved use of deprecated NetAccess methods. Signed-off-by: Slávek Banko <[email protected]>
-rw-r--r--CMakeLists.txt2
-rw-r--r--krename/ProgressDialog.cpp10
-rw-r--r--krename/batchrenamer.cpp34
-rw-r--r--krename/batchrenamer.h4
-rw-r--r--krename/commandplugin.cpp2
-rw-r--r--krename/dateplugin.cpp2
-rw-r--r--krename/datetime.cpp24
-rw-r--r--krename/encodingplugin.cpp8
-rw-r--r--krename/fileoperation.cpp2
-rw-r--r--krename/kmylistbox.cpp4
-rw-r--r--krename/krenameimpl.cpp18
-rw-r--r--krename/permission.cpp12
-rw-r--r--krename/profiledlg.cpp8
-rw-r--r--krename/translitplugin.cpp4
14 files changed, 67 insertions, 67 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 76f3a66..365dc48 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -58,7 +58,7 @@ include( ConfigureChecks.cmake )
###### global compiler settings
-add_definitions( -DHAVE_CONFIG_H -UTQT_NO_ASCII_CAST )
+add_definitions( -DHAVE_CONFIG_H )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TQT_CXX_FLAGS}" )
set( CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined" )
diff --git a/krename/ProgressDialog.cpp b/krename/ProgressDialog.cpp
index d7b4eed..a7812aa 100644
--- a/krename/ProgressDialog.cpp
+++ b/krename/ProgressDialog.cpp
@@ -155,9 +155,9 @@ void ProgressDialog::error( TQString text )
TDEApplication::setOverrideCursor( TQt::waitCursor );
m_timer->start( TIMER_INTERVAL );
}
-
+
//TODO: simplify this (breaks i18n)
- TDEListViewItem* item = new TDEListViewItem( display, TQString( i18n("Error: %1") ).arg( TQString() ) + simplify( text ), count() );
+ TDEListViewItem* item = new TDEListViewItem( display, i18n("Error: %1").arg( TQString() ) + simplify( text ), count() );
item->setPixmap( 0, SmallIcon("cancel") );
display->insertItem( item );
}
@@ -169,10 +169,10 @@ void ProgressDialog::warning( TQString text )
TDEApplication::setOverrideCursor( TQt::waitCursor );
m_timer->start( TIMER_INTERVAL );
}
-
- TDEListViewItem* item = new TDEListViewItem( display, TQString( i18n("Warning: %1") ).arg( TQString() ) + simplify( text ), count() );
+
+ TDEListViewItem* item = new TDEListViewItem( display, i18n("Warning: %1").arg( TQString() ) + simplify( text ), count() );
item->setPixmap( 0, SmallIcon("idea") );
- display->insertItem( item );
+ display->insertItem( item );
}
void ProgressDialog::quitAll()
diff --git a/krename/batchrenamer.cpp b/krename/batchrenamer.cpp
index 8069f63..371a0da 100644
--- a/krename/batchrenamer.cpp
+++ b/krename/batchrenamer.cpp
@@ -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 );
}
@@ -258,14 +258,14 @@ void BatchRenamer::work( ProgressDialog* p )
* Give the user some information...
*/
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 )
- 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 )
- 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 )
- p->print( i18n("Input files will be renamed.") );
-
+ p->print(i18n("Input files will be renamed."));
+
unsigned int i;
for( i = 0; i < m_files.count(); i++) {
p->setProgress( i+1 );
@@ -317,7 +317,7 @@ 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( 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 );
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("KRename finished the renaming process."), "krename" );
- p->print( i18n("Press close to quit!") );
+ p->print(i18n("Elapsed time: %1 seconds").arg( 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() );
-
+
if( undo ) {
(*tundo) << endl << "echo \"Finished undoing " << m_files.count() << " actions.\"" << endl;
delete tundo;
fundo->close();
// 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.") );
delete fundo;
}
@@ -361,7 +361,7 @@ void BatchRenamer::escape( TQString & text, const TQString & token, const TQStri
text.replace( token, sequence );
}
-TQString & BatchRenamer::doEscape( TQString text, bool filename )
+TQString & BatchRenamer::doEscape( TQString& text, bool filename )
{
if( filename ) {
BatchRenamer::escape( text, "&", TQChar( 60000 ) );
@@ -840,13 +840,13 @@ void BatchRenamer::parseSubdirs( data* f )
// create the missing subdir now
int i = 0;
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;
// it is important to unescape here
// to support dirnames containing "&" or
// similar tokens
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
tqDebug("Can't create %s", url.prettyURL().latin1() );
diff --git a/krename/batchrenamer.h b/krename/batchrenamer.h
index d024edf..d188b51 100644
--- a/krename/batchrenamer.h
+++ b/krename/batchrenamer.h
@@ -130,8 +130,8 @@ class BatchRenamer {
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 );
-
- static TQString & doEscape( TQString text, bool filename = true );
+
+ static TQString & doEscape( TQString & text, bool filename = true );
static TQString & unEscape( TQString & text );
static void escape( TQString & text, const TQString & token, const TQString & sequence );
diff --git a/krename/commandplugin.cpp b/krename/commandplugin.cpp
index 9f8d6a1..3c79028 100644
--- a/krename/commandplugin.cpp
+++ b/krename/commandplugin.cpp
@@ -137,7 +137,7 @@ TQString CommandPlugin::processFile( BatchRenamer* b, int i, TQString, int )
proc.resume();
if( !noblock && proc.exitStatus() )
- return command.arg( filename ) + TQString( i18n(" exited with error: %1") ).arg( proc.exitStatus() );
+ return command.arg( filename ) + i18n(" exited with error: %1").arg( proc.exitStatus() );
return TQString();
}
diff --git a/krename/dateplugin.cpp b/krename/dateplugin.cpp
index e41cce5..01fd048 100644
--- a/krename/dateplugin.cpp
+++ b/krename/dateplugin.cpp
@@ -88,7 +88,7 @@ TQString DatePlugin::processFile(BatchRenamer* b, int i, TQString token, int )
return tmp.sprintf("%0*i", 2, t.second() );
else {
TDEIO::UDSEntry entry;
- TDEIO::NetAccess::stat( b->files()[i].src.url, entry );
+ TDEIO::NetAccess::stat(b->files()[i].src.url, entry, 0);
KFileItem item( entry, b->files()[i].src.url );
if( token == "user" )
return item.user();
diff --git a/krename/datetime.cpp b/krename/datetime.cpp
index 46f8aa3..83476de 100644
--- a/krename/datetime.cpp
+++ b/krename/datetime.cpp
@@ -126,7 +126,7 @@ void MyDatePlugin::drawInterface( TQWidget* w, TQVBoxLayout* l )
void MyDatePlugin::fillStructure()
{
#ifndef BENNY
- dvals.date = kDate->getDate();
+ dvals.date = kDate->date();
dvals.changeModification = checkModification->isChecked();
dvals.changeAccess = checkAccess->isChecked();
dvals.hour = spinHour->value();
@@ -149,7 +149,7 @@ TQString MyDatePlugin::processFile( BatchRenamer* b, int i, TQString, int )
f = fopen((const char *)filename, "r");
if( f == NULL )
- return TQString( i18n("Can't change date of file %1.") ).arg(filename);
+ return i18n("Can't change date of file %1.").arg(filename);
fclose( f );
@@ -165,16 +165,16 @@ TQString MyDatePlugin::processFile( BatchRenamer* b, int i, TQString, int )
ti = mktime( &tmp );
if( ti == -1 )
- return TQString( i18n("Can't change date of file %1.") ).arg(filename);
+ return i18n("Can't change date of file %1.").arg(filename);
if( stat( (const char *)filename, &st ) == -1 )
- return TQString( i18n("Can't change date of file %1.") ).arg(filename);
+ return i18n("Can't change date of file %1.").arg(filename);
t->actime = st.st_atime;
t->modtime = ti;
if(utime( (const char *)filename, t ) != 0)
- return TQString( i18n("Can't change date of file %1.") ).arg(filename);
+ return i18n("Can't change date of file %1.").arg(filename);
return TQString();
#else
@@ -187,9 +187,9 @@ TQString MyDatePlugin::processFile( BatchRenamer* b, int i, TQString, int )
time_t ti;
- f = fopen((const char *)filename, "r");
+ f = fopen(filename.local8Bit(), "r");
if( f == NULL )
- return TQString( i18n("Can't change date of file %1.") ).arg(filename);
+ return i18n("Can't change date of file %1.").arg(filename);
fclose( f );
@@ -204,10 +204,10 @@ TQString MyDatePlugin::processFile( BatchRenamer* b, int i, TQString, int )
ti = mktime( &tmp );
if( ti == -1 )
- return TQString( i18n("Can't change date of file %1.") ).arg(filename);
+ return i18n("Can't change date of file %1.").arg(filename);
- if( stat( (const char *)filename, &st ) == -1 )
- return TQString( i18n("Can't change date of file %1.") ).arg(filename);
+ if (stat(filename.local8Bit(), &st) == -1)
+ return i18n("Can't change date of file %1.").arg(filename);
if(dvals.changeAccess)
t->actime = ti;
@@ -219,8 +219,8 @@ TQString MyDatePlugin::processFile( BatchRenamer* b, int i, TQString, int )
else
t->modtime = st.st_mtime;
- if(utime( (const char *)filename, t ) != 0)
- return TQString( i18n("Can't change date of file %1.") ).arg(filename);
+ if (utime(filename.local8Bit(), t) != 0)
+ return i18n("Can't change date of file %1.").arg(filename);
return TQString();
#endif
diff --git a/krename/encodingplugin.cpp b/krename/encodingplugin.cpp
index 4c3018a..75888a0 100644
--- a/krename/encodingplugin.cpp
+++ b/krename/encodingplugin.cpp
@@ -108,11 +108,11 @@ TQString EncodingPlugin::processFile( BatchRenamer*, int, TQString token, int )
TQString input = token;
TQString unicode = TQString();
- TQTextCodec* toUnicode = TQTextCodec::codecForName(m_input_codec); // get the codec for KOI8-R
- TQTextCodec* fromUnicode = TQTextCodec::codecForName(m_output_codec);
+ TQTextCodec* toUnicode = TQTextCodec::codecForName(m_input_codec.ascii()); // get the codec for KOI8-R
+ TQTextCodec* fromUnicode = TQTextCodec::codecForName(m_output_codec.ascii());
- unicode = toUnicode->toUnicode( input );
- return fromUnicode->fromUnicode( unicode );
+ unicode = toUnicode->toUnicode( input.ascii() );
+ return fromUnicode->fromUnicode( unicode.ascii() );
}
void EncodingPlugin::finished()
diff --git a/krename/fileoperation.cpp b/krename/fileoperation.cpp
index 18d2813..813ee46 100644
--- a/krename/fileoperation.cpp
+++ b/krename/fileoperation.cpp
@@ -50,7 +50,7 @@ bool FileOperation::start( const KURL & src, const KURL & dest, int mode, bool o
result = 0;
if( src == dest && !overwrite ) {
- m_error = TQString( i18n( "File %1 exists already!") ).arg( dest.prettyURL() );
+ m_error = i18n( "File %1 exists already!").arg( dest.prettyURL() );
return false;
}
diff --git a/krename/kmylistbox.cpp b/krename/kmylistbox.cpp
index 77bf6a7..fece90e 100644
--- a/krename/kmylistbox.cpp
+++ b/krename/kmylistbox.cpp
@@ -116,8 +116,8 @@ void KMyListBox::addDirName( const KURL & dirname )
bool KMyListBox::isFile( const KURL & f, bool autoadd )
{
UDSEntry entry;
-
- NetAccess::stat( f, entry );
+
+ NetAccess::stat(f, entry, 0);
KFileItem file( entry, f );
if( !file.isReadable() )
return false;
diff --git a/krename/krenameimpl.cpp b/krename/krenameimpl.cpp
index d9aa3ed..1835fd1 100644
--- a/krename/krenameimpl.cpp
+++ b/krename/krenameimpl.cpp
@@ -76,7 +76,7 @@
#define ID_WIZARD 2905
#define ID_TAB 2904
-TQString pageTitle[] = {
+TQCString pageTitle[] = {
I18N_NOOP( "F&iles" ),
I18N_NOOP( "Des&tination" ),
I18N_NOOP( "P&lugins" ),
@@ -1004,7 +1004,7 @@ void KRenameImpl::start()
}
ProgressDialog* p = new ProgressDialog( 0, "p" );
- p->print(TQString( i18n("Starting conversion of %1 files.") ).arg(fileList->count()));
+ p->print(i18n("Starting conversion of %1 files.").arg(fileList->count()));
// Save History
dirname->saveSettings();
@@ -1065,7 +1065,7 @@ bool KRenameImpl::checkErrors()
void KRenameImpl::updateCount()
{
- labelCount->setText( TQString( i18n("Files: <b>%1</b>") ).arg(fileList->count()));
+ labelCount->setText(i18n("Files: <b>%1</b>").arg(fileList->count()));
buttonCoord->setEnabled( (bool)fileList->count() );
buttonReplace->setEnabled( (bool)fileList->count() );
@@ -1161,18 +1161,18 @@ bool KRenameImpl::setupBatchRenamer( BatchRenamer* b, bool preview )
TQString url = urlrequester->url();
if( url.right(1) != "/" )
url.append( "/" );
-
- if( !TDEIO::NetAccess::exists( KURL( url ) ) )
+
+ if (!TDEIO::NetAccess::exists(KURL(url), true, parent))
{
int m = KMessageBox::warningContinueCancel( parent, i18n("The directory %1 does not exist. "
"KRename will create it for you.").arg( url ) );
if( m == KMessageBox::Cancel )
return false;
-
+
int i = 0;
TQString d = "/";
- while( (d += url.section( "/", i, i, TQString::SectionSkipEmpty )) && ! d.isEmpty() ) { // asignment here!
- if( !TDEIO::NetAccess::exists( d ) && !TDEIO::NetAccess::mkdir( d ) )
+ while (!(d += url.section( "/", i, i, TQString::SectionSkipEmpty)).isEmpty()) { // asignment here!
+ if (!TDEIO::NetAccess::exists(d, false, parent) && !TDEIO::NetAccess::mkdir(d, parent, -1))
{
tqDebug( "Can't create %s", d.latin1() );
break;
@@ -1181,7 +1181,7 @@ bool KRenameImpl::setupBatchRenamer( BatchRenamer* b, bool preview )
i++;
}
}
-
+
b->setDirname( url );
b->setOverwrite( checkOverwrite->isChecked() );
b->setUndo( checkUndoScript->isChecked() && !optionCopy->isChecked() );
diff --git a/krename/permission.cpp b/krename/permission.cpp
index c56900d..8bb3a8c 100644
--- a/krename/permission.cpp
+++ b/krename/permission.cpp
@@ -244,12 +244,12 @@ TQString MyPermPlugin::processFile( BatchRenamer* b, int i, TQString, int )
{
TQString filename = b->files()[i].dst.name;
if( perm.changePermissions )
- if( chmod( (const char *)filename, (mode_t)perm.newPermission ) == -1 )
- return TQString( i18n("Can't chmod %1.") ).arg(filename);
+ if (chmod(filename.local8Bit(), (mode_t)perm.newPermission) == -1)
+ return i18n("Can't chmod %1.").arg(filename);
if( perm.changeOwner )
- if( chown( (const char*)filename, getUid( perm.owner), getGid( perm.group )))
- return TQString( i18n("Can't chown %1.") ).arg(filename);
+ if (chown(filename.local8Bit(), getUid(perm.owner), getGid(perm.group)))
+ return i18n("Can't chown %1.").arg(filename);
return TQString();
}
@@ -295,7 +295,7 @@ int MyPermPlugin::getGid( TQString group )
struct group *ge;
setgrent();
for (i=0; ((ge = getgrent()) != 0L) && (i < MAXENTRIES); i++)
- if( !strcmp( ge->gr_name, (const char *)group ) )
+ if (!strcmp(ge->gr_name, group.local8Bit()))
break;
r = ge->gr_gid;
endgrent();
@@ -308,7 +308,7 @@ int MyPermPlugin::getUid( TQString owner )
struct passwd *user;
setpwent();
for (i=0; ((user = getpwent()) != 0L) && (i < MAXENTRIES); i++)
- if( !strcmp(user->pw_name, (const char *)owner) )
+ if (!strcmp(user->pw_name, owner.local8Bit()))
break;
r = user->pw_uid;
endpwent();
diff --git a/krename/profiledlg.cpp b/krename/profiledlg.cpp
index d0b5741..b92e985 100644
--- a/krename/profiledlg.cpp
+++ b/krename/profiledlg.cpp
@@ -500,7 +500,7 @@ void ProfileDlg::slotSetDefault()
void ProfileDlg::slotLoadProfile()
{
TQString profile = profiles->currentText();
- TQString msg = TQString( i18n("Do you really want to load the profile and overwrite the current settings: %1") ).arg( profile );
+ TQString msg = i18n("Do you really want to load the profile and overwrite the current settings: %1").arg( profile );
TQString path = getProfilePath( profile );
@@ -552,10 +552,10 @@ void ProfileDlg::slotDeleteProfile()
KMessageBox::error( this, i18n("You cannot delete default profiles!") );
return;
}
-
+
TQString profile = profiles->currentText();
- TQString msg = TQString( i18n("Do you really want to delete the profile: %1") ).arg( profile );
-
+ TQString msg = i18n("Do you really want to delete the profile: %1").arg( profile );
+
if( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes )
{
TQString path = readProfilePath( profile );
diff --git a/krename/translitplugin.cpp b/krename/translitplugin.cpp
index ce11013..aed2b9c 100644
--- a/krename/translitplugin.cpp
+++ b/krename/translitplugin.cpp
@@ -82,10 +82,10 @@ TQString TranslitPlugin::translit(const TQString & unicoded)
{
int i;
TQString transed = "";
-
+
for (i=0; i<(int)unicoded.length(); i++) {
TQString charIn = unicoded.mid(i, 1);
- if (m_mapFromUTF8[charIn.utf8()]) {
+ if (!(m_mapFromUTF8[charIn.utf8()].isNull())) {
TQString charTrans = m_mapFromUTF8[charIn.utf8()];
transed.append(charTrans);
} else {