Added controlled conversions to char* instead of automatic ascii conversions.

The definition of -UTQT_NO_ASCII_CAST is no longer needed.

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
pull/1/head
Slávek Banko 5 years ago
parent 4c357c392d
commit 311f886aa7
No known key found for this signature in database
GPG Key ID: 608F5293A04BE668

@ -59,7 +59,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 "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined" )

@ -1385,7 +1385,7 @@ bool ConfigElem::writeToMailBox( const TQString & mail, const TQString & box )
if( !isMailDir( mailDir ) )
{
//show an error message
KMessageBox::error( NULL, i18n( TQString( "%1 is not a mailbox." ).arg( box ) ) );
KMessageBox::error( NULL, i18n( "%1 is not a mailbox." ).arg( box ) );
return false;
}
@ -1400,7 +1400,7 @@ bool ConfigElem::writeToMailBox( const TQString & mail, const TQString & box )
{
//the hostname is not readable
//show an error message and exit
KMessageBox::error( NULL, i18n( TQString( "Can't read the hostname of your computer. But KShowmail need it to write a mail into the mailbox." ) ) );
KMessageBox::error( NULL, i18n( "Can't read the hostname of your computer. But KShowmail need it to write a mail into the mailbox." ) );
return false;
}
@ -1424,7 +1424,7 @@ bool ConfigElem::writeToMailBox( const TQString & mail, const TQString & box )
}
else
{
KMessageBox::detailedError( NULL, i18n( TQString( "Could not file a mail to %1." ) ).arg( box ), i18n( file.errorString() ) );
KMessageBox::detailedError( NULL, i18n( "Could not file a mail to %1." ).arg( box ), i18n( file.errorString().utf8() ) );
return false;
}
@ -1435,7 +1435,7 @@ bool ConfigElem::writeToMailBox( const TQString & mail, const TQString & box )
if( rename( absFile.ascii(), absNewFile.ascii() ) == -1 )
{
KMessageBox::error( NULL, i18n( TQString( "Could not move a mail from %1 to %2." ) ).arg( absFile ).arg( absNewFile ) );
KMessageBox::error( NULL, i18n( "Could not move a mail from %1 to %2." ).arg( absFile ).arg( absNewFile ) );
return false;
}

@ -64,7 +64,7 @@ int ConfigList::compareItems( TQPtrCollection::Item item1, TQPtrCollection::Item
ConfigElem* p1 = (ConfigElem*)item1;
ConfigElem* p2 = (ConfigElem*)item2;
return strcmp( p1->getAccountName(), p2->getAccountName() );
return TQString::compare(p1->getAccountName(), p2->getAccountName());
}
TQPtrCollection::Item ConfigList::newItem( TQPtrCollection::Item item )
@ -174,7 +174,7 @@ void ConfigList::beep ()
void ConfigList::playSound ()
{
if (m_bSound)
playSound (m_strSoundFile);
playSound (m_strSoundFile.local8Bit());
}
void ConfigList::playSound (const char* file)

@ -31,34 +31,34 @@ const TQString Encryption::crypt( const KURL& url )
memset (result, 0, 50);
memset (scramble2, 0, 50);
int pos = url.pass().length () + 1;
int pos = url.pass().utf8().length() + 1;
unsigned int free = 50 - pos;
if( url.user().length() <= free )
if( url.user().utf8().length() <= free )
{
strcpy( &scramble2[pos], url.user() );
pos += url.user().length();
free -= url.user().length();
strcpy( &scramble2[pos], url.user().utf8() );
pos += url.user().utf8().length();
free -= url.user().utf8().length();
}
else
{
memcpy( &scramble2[pos], url.user().latin1(), free );
memcpy( &scramble2[pos], url.user().utf8(), free );
free = 0;
}
if( url.host().length() <= free )
if( url.host().utf8().length() <= free )
{
strcpy( &scramble2[pos], url.host() );
pos += url.host().length();
free -= url.host().length();
strcpy( &scramble2[pos], url.host().utf8() );
pos += url.host().utf8().length();
free -= url.host().utf8().length();
}
else
{
memcpy( &scramble2[pos], url.host().latin1(), free );
memcpy( &scramble2[pos], url.host().utf8(), free );
free = 0;
}
memcpy( result, url.pass().latin1(), url.pass().length() );
memcpy( result, url.pass().utf8(), url.pass().utf8().length() );
for (int i = 0; i <= 31; i++)
{
result[i] = (char)( result[i] ^ ( scramble1[i] ^ scramble2[i] ) );
@ -81,5 +81,5 @@ const TQString Encryption::decrypt( const TQString& pass )
result[i] = (char)( result[i] ^ scramble1[i] );
}
return result;
return TQString::fromUtf8(result);
}

@ -31,34 +31,34 @@ const TQString Encryption::crypt( const KURL& url )
memset (result, 0, 50);
memset (scramble2, 0, 50);
int pos = url.pass().length () + 1;
int pos = url.pass().utf8().length() + 1;
unsigned int free = 50 - pos;
if( url.user().length() <= free )
if( url.user().utf8().length() <= free )
{
strcpy( &scramble2[pos], url.user() );
pos += url.user().length();
free -= url.user().length();
strcpy( &scramble2[pos], url.user().utf8() );
pos += url.user().utf8().length();
free -= url.user().utf8().length();
}
else
{
memcpy( &scramble2[pos], url.user().latin1(), free );
memcpy( &scramble2[pos], url.user().utf8(), free );
free = 0;
}
if( url.host().length() <= free )
if( url.host().utf8().length() <= free )
{
strcpy( &scramble2[pos], url.host() );
pos += url.host().length();
free -= url.host().length();
strcpy( &scramble2[pos], url.host().utf8() );
pos += url.host().utf8().length();
free -= url.host().utf8().length();
}
else
{
memcpy( &scramble2[pos], url.host().latin1(), free );
memcpy( &scramble2[pos], url.host().utf8(), free );
free = 0;
}
memcpy( result, url.pass().latin1(), url.pass().length() );
memcpy( result, url.pass().utf8(), url.pass().utf8().length() );
for (int i = 0; i <= 31; i++)
{
result[i] = (char)( result[i] ^ ( scramble1[i] ^ scramble2[i] ) );
@ -81,5 +81,5 @@ const TQString Encryption::decrypt( const TQString& pass )
result[i] = (char)( result[i] ^ scramble1[i] );
}
return result;
return TQString::fromUtf8(result);
}

@ -99,7 +99,7 @@ void KShowMailApp::timerEvent (TQTimerEvent *)
{
TQTime time;
time = time.addSecs (m_nSecondsToGo--);
TQCString msg (i18n("Autorefresh: %1").arg (time.toString()));
TQCString msg (i18n("Autorefresh: %1").arg(time.toString()).utf8());
statusBar()->changeItem( msg, STATUSBAR_FIELD_NEXT_REFRESH );
}
else

@ -307,7 +307,7 @@ void ShowRecord::printMailList( )
++it;
//print mail
cout << mail->number() << " - UID: " << mail->uidl() << "; Size: " << mail->size() << "; Subject: " << mail->subject() << "; New: " << mail->isNew() << endl;
cout << mail->number() << " - UID: " << mail->uidl().local8Bit() << "; Size: " << mail->size() << "; Subject: " << mail->subject().local8Bit() << "; New: " << mail->isNew() << endl;
}
}

@ -58,7 +58,7 @@ TQCString ShowRecordElem::scanHeader( const TQString& item ) const
//with a carriage return
//build the search string
TQString searchstring( TQString( "\r\n%1:" ).arg( item ) );
TQCString searchstring( TQString( "\r\n%1:" ).arg( item ).utf8() );
//searching...
int pos1 = m_header.find( searchstring, 0, FALSE );

Loading…
Cancel
Save