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 <slavek.banko@axis.cz>
(cherry picked from commit e023691c15)
r14.0.x
Slávek Banko 6 years ago
parent 4c277df8cb
commit 5c80f2d307
No known key found for this signature in database
GPG Key ID: 608F5293A04BE668

@ -58,7 +58,7 @@ include( ConfigureChecks.cmake )
###### global compiler settings ###### global compiler settings
add_definitions( -DHAVE_CONFIG_H -UQT_NO_ASCII_CAST ) add_definitions( -DHAVE_CONFIG_H )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TQT_CXX_FLAGS}" ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TQT_CXX_FLAGS}" )
set( CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined" ) set( CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined" )

@ -157,7 +157,7 @@ void ProgressDialog::error( TQString text )
} }
//TODO: simplify this (breaks i18n) //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") ); item->setPixmap( 0, SmallIcon("cancel") );
display->insertItem( item ); display->insertItem( item );
} }
@ -170,7 +170,7 @@ void ProgressDialog::warning( TQString text )
m_timer->start( TIMER_INTERVAL ); 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") ); item->setPixmap( 0, SmallIcon("idea") );
display->insertItem( item ); display->insertItem( item );
} }

@ -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,11 +258,11 @@ 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."));
@ -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,13 +329,13 @@ 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() );
@ -346,7 +346,7 @@ void BatchRenamer::work( ProgressDialog* p )
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() );

@ -131,7 +131,7 @@ class BatchRenamer {
TQString processString( TQString text, TQString oldname, int i ); 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 TQString & unEscape( TQString & text );
static void escape( TQString & text, const TQString & token, const TQString & sequence ); static void escape( TQString & text, const TQString & token, const TQString & sequence );

@ -137,7 +137,7 @@ TQString CommandPlugin::processFile( BatchRenamer* b, int i, TQString, int )
proc.resume(); proc.resume();
if( !noblock && proc.exitStatus() ) 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(); return TQString();
} }

@ -88,7 +88,7 @@ TQString DatePlugin::processFile(BatchRenamer* b, int i, TQString token, int )
return tmp.sprintf("%0*i", 2, t.second() ); return tmp.sprintf("%0*i", 2, t.second() );
else { else {
TDEIO::UDSEntry entry; 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 ); KFileItem item( entry, b->files()[i].src.url );
if( token == "user" ) if( token == "user" )
return item.user(); return item.user();

@ -126,7 +126,7 @@ void MyDatePlugin::drawInterface( TQWidget* w, TQVBoxLayout* l )
void MyDatePlugin::fillStructure() void MyDatePlugin::fillStructure()
{ {
#ifndef BENNY #ifndef BENNY
dvals.date = kDate->getDate(); dvals.date = kDate->date();
dvals.changeModification = checkModification->isChecked(); dvals.changeModification = checkModification->isChecked();
dvals.changeAccess = checkAccess->isChecked(); dvals.changeAccess = checkAccess->isChecked();
dvals.hour = spinHour->value(); dvals.hour = spinHour->value();
@ -149,7 +149,7 @@ TQString MyDatePlugin::processFile( BatchRenamer* b, int i, TQString, int )
f = fopen((const char *)filename, "r"); f = fopen((const char *)filename, "r");
if( f == NULL ) 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 ); fclose( f );
@ -165,16 +165,16 @@ TQString MyDatePlugin::processFile( BatchRenamer* b, int i, TQString, int )
ti = mktime( &tmp ); ti = mktime( &tmp );
if( ti == -1 ) 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 ) 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->actime = st.st_atime;
t->modtime = ti; t->modtime = ti;
if(utime( (const char *)filename, t ) != 0) 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(); return TQString();
#else #else
@ -187,9 +187,9 @@ TQString MyDatePlugin::processFile( BatchRenamer* b, int i, TQString, int )
time_t ti; time_t ti;
f = fopen((const char *)filename, "r"); f = fopen(filename.local8Bit(), "r");
if( f == NULL ) 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 ); fclose( f );
@ -204,10 +204,10 @@ TQString MyDatePlugin::processFile( BatchRenamer* b, int i, TQString, int )
ti = mktime( &tmp ); ti = mktime( &tmp );
if( ti == -1 ) 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 ) if (stat(filename.local8Bit(), &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);
if(dvals.changeAccess) if(dvals.changeAccess)
t->actime = ti; t->actime = ti;
@ -219,8 +219,8 @@ TQString MyDatePlugin::processFile( BatchRenamer* b, int i, TQString, int )
else else
t->modtime = st.st_mtime; t->modtime = st.st_mtime;
if(utime( (const char *)filename, t ) != 0) if (utime(filename.local8Bit(), 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(); return TQString();
#endif #endif

@ -108,11 +108,11 @@ TQString EncodingPlugin::processFile( BatchRenamer*, int, TQString token, int )
TQString input = token; TQString input = token;
TQString unicode = TQString(); TQString unicode = TQString();
TQTextCodec* toUnicode = TQTextCodec::codecForName(m_input_codec); // get the codec for KOI8-R TQTextCodec* toUnicode = TQTextCodec::codecForName(m_input_codec.ascii()); // get the codec for KOI8-R
TQTextCodec* fromUnicode = TQTextCodec::codecForName(m_output_codec); TQTextCodec* fromUnicode = TQTextCodec::codecForName(m_output_codec.ascii());
unicode = toUnicode->toUnicode( input ); unicode = toUnicode->toUnicode( input.ascii() );
return fromUnicode->fromUnicode( unicode ); return fromUnicode->fromUnicode( unicode.ascii() );
} }
void EncodingPlugin::finished() void EncodingPlugin::finished()

@ -50,7 +50,7 @@ bool FileOperation::start( const KURL & src, const KURL & dest, int mode, bool o
result = 0; result = 0;
if( src == dest && !overwrite ) { 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; return false;
} }

@ -117,7 +117,7 @@ bool KMyListBox::isFile( const KURL & f, bool autoadd )
{ {
UDSEntry entry; UDSEntry entry;
NetAccess::stat( f, entry ); NetAccess::stat(f, entry, 0);
KFileItem file( entry, f ); KFileItem file( entry, f );
if( !file.isReadable() ) if( !file.isReadable() )
return false; return false;

@ -76,7 +76,7 @@
#define ID_WIZARD 2905 #define ID_WIZARD 2905
#define ID_TAB 2904 #define ID_TAB 2904
TQString pageTitle[] = { TQCString pageTitle[] = {
I18N_NOOP( "F&iles" ), I18N_NOOP( "F&iles" ),
I18N_NOOP( "Des&tination" ), I18N_NOOP( "Des&tination" ),
I18N_NOOP( "P&lugins" ), I18N_NOOP( "P&lugins" ),
@ -1004,7 +1004,7 @@ void KRenameImpl::start()
} }
ProgressDialog* p = new ProgressDialog( 0, "p" ); 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 // Save History
dirname->saveSettings(); dirname->saveSettings();
@ -1065,7 +1065,7 @@ bool KRenameImpl::checkErrors()
void KRenameImpl::updateCount() 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() ); buttonCoord->setEnabled( (bool)fileList->count() );
buttonReplace->setEnabled( (bool)fileList->count() ); buttonReplace->setEnabled( (bool)fileList->count() );
@ -1162,7 +1162,7 @@ bool KRenameImpl::setupBatchRenamer( BatchRenamer* b, bool preview )
if( url.right(1) != "/" ) if( url.right(1) != "/" )
url.append( "/" ); 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. " int m = KMessageBox::warningContinueCancel( parent, i18n("The directory %1 does not exist. "
"KRename will create it for you.").arg( url ) ); "KRename will create it for you.").arg( url ) );
@ -1171,8 +1171,8 @@ bool KRenameImpl::setupBatchRenamer( BatchRenamer* b, bool preview )
int i = 0; int i = 0;
TQString d = "/"; TQString d = "/";
while( (d += url.section( "/", i, i, TQString::SectionSkipEmpty )) && ! d.isEmpty() ) { // asignment here! while (!(d += url.section( "/", i, i, TQString::SectionSkipEmpty)).isEmpty()) { // asignment here!
if( !TDEIO::NetAccess::exists( d ) && !TDEIO::NetAccess::mkdir( d ) ) if (!TDEIO::NetAccess::exists(d, false, parent) && !TDEIO::NetAccess::mkdir(d, parent, -1))
{ {
tqDebug( "Can't create %s", d.latin1() ); tqDebug( "Can't create %s", d.latin1() );
break; break;

@ -244,12 +244,12 @@ TQString MyPermPlugin::processFile( BatchRenamer* b, int i, TQString, int )
{ {
TQString filename = b->files()[i].dst.name; TQString filename = b->files()[i].dst.name;
if( perm.changePermissions ) if( perm.changePermissions )
if( chmod( (const char *)filename, (mode_t)perm.newPermission ) == -1 ) if (chmod(filename.local8Bit(), (mode_t)perm.newPermission) == -1)
return TQString( i18n("Can't chmod %1.") ).arg(filename); return i18n("Can't chmod %1.").arg(filename);
if( perm.changeOwner ) if( perm.changeOwner )
if( chown( (const char*)filename, getUid( perm.owner), getGid( perm.group ))) if (chown(filename.local8Bit(), getUid(perm.owner), getGid(perm.group)))
return TQString( i18n("Can't chown %1.") ).arg(filename); return i18n("Can't chown %1.").arg(filename);
return TQString(); return TQString();
} }
@ -295,7 +295,7 @@ int MyPermPlugin::getGid( TQString group )
struct group *ge; struct group *ge;
setgrent(); setgrent();
for (i=0; ((ge = getgrent()) != 0L) && (i < MAXENTRIES); i++) 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; break;
r = ge->gr_gid; r = ge->gr_gid;
endgrent(); endgrent();
@ -308,7 +308,7 @@ int MyPermPlugin::getUid( TQString owner )
struct passwd *user; struct passwd *user;
setpwent(); setpwent();
for (i=0; ((user = getpwent()) != 0L) && (i < MAXENTRIES); i++) 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; break;
r = user->pw_uid; r = user->pw_uid;
endpwent(); endpwent();

@ -500,7 +500,7 @@ void ProfileDlg::slotSetDefault()
void ProfileDlg::slotLoadProfile() void ProfileDlg::slotLoadProfile()
{ {
TQString profile = profiles->currentText(); 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 ); TQString path = getProfilePath( profile );
@ -554,7 +554,7 @@ void ProfileDlg::slotDeleteProfile()
} }
TQString profile = profiles->currentText(); 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 ) if( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes )
{ {

@ -85,7 +85,7 @@ TQString TranslitPlugin::translit(const TQString & unicoded)
for (i=0; i<(int)unicoded.length(); i++) { for (i=0; i<(int)unicoded.length(); i++) {
TQString charIn = unicoded.mid(i, 1); TQString charIn = unicoded.mid(i, 1);
if (m_mapFromUTF8[charIn.utf8()]) { if (!(m_mapFromUTF8[charIn.utf8()].isNull())) {
TQString charTrans = m_mapFromUTF8[charIn.utf8()]; TQString charTrans = m_mapFromUTF8[charIn.utf8()];
transed.append(charTrans); transed.append(charTrans);
} else { } else {

Loading…
Cancel
Save