summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2019-05-05 02:22:40 +0200
committerSlávek Banko <slavek.banko@axis.cz>2019-05-05 02:39:55 +0200
commit949efb3687d7174f892b6928f151fd10ba0a3544 (patch)
tree1b58a4a75fa076ed95cfda3ea11c006be8eb2e9a
parent665005a338622ebe06c1e54133d4e8eb5dbe2d7d (diff)
downloadkshowmail-949efb3687d7174f892b6928f151fd10ba0a3544.tar.gz
kshowmail-949efb3687d7174f892b6928f151fd10ba0a3544.zip
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> (cherry picked from commit 311f886aa79e4a7f722a4e14e36207cb3d609e57)
-rw-r--r--CMakeLists.txt2
-rw-r--r--kshowmail/configelem.cpp8
-rw-r--r--kshowmail/configlist.cpp4
-rw-r--r--kshowmail/encryption.cpp26
-rw-r--r--kshowmail/kcmconfigs/encryption.cpp26
-rw-r--r--kshowmail/kshowmail.cpp2
-rw-r--r--kshowmail/showrecord.cpp2
-rw-r--r--kshowmail/showrecordelem.cpp2
8 files changed, 36 insertions, 36 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5d36b56..04cb396 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -59,7 +59,7 @@ include( ConfigureChecks.cmake )
###### 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_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined" )
diff --git a/kshowmail/configelem.cpp b/kshowmail/configelem.cpp
index 985f583..a3886af 100644
--- a/kshowmail/configelem.cpp
+++ b/kshowmail/configelem.cpp
@@ -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;
}
diff --git a/kshowmail/configlist.cpp b/kshowmail/configlist.cpp
index 4ba01c6..ae0d311 100644
--- a/kshowmail/configlist.cpp
+++ b/kshowmail/configlist.cpp
@@ -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)
diff --git a/kshowmail/encryption.cpp b/kshowmail/encryption.cpp
index 0bc1efe..5565699 100644
--- a/kshowmail/encryption.cpp
+++ b/kshowmail/encryption.cpp
@@ -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);
}
diff --git a/kshowmail/kcmconfigs/encryption.cpp b/kshowmail/kcmconfigs/encryption.cpp
index 0bc1efe..5565699 100644
--- a/kshowmail/kcmconfigs/encryption.cpp
+++ b/kshowmail/kcmconfigs/encryption.cpp
@@ -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);
}
diff --git a/kshowmail/kshowmail.cpp b/kshowmail/kshowmail.cpp
index 104f2c9..780f7f4 100644
--- a/kshowmail/kshowmail.cpp
+++ b/kshowmail/kshowmail.cpp
@@ -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
diff --git a/kshowmail/showrecord.cpp b/kshowmail/showrecord.cpp
index ca3087f..e39e2ee 100644
--- a/kshowmail/showrecord.cpp
+++ b/kshowmail/showrecord.cpp
@@ -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;
}
}
diff --git a/kshowmail/showrecordelem.cpp b/kshowmail/showrecordelem.cpp
index 9edc834..19af8ae 100644
--- a/kshowmail/showrecordelem.cpp
+++ b/kshowmail/showrecordelem.cpp
@@ -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 );