summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2018-12-16 05:16:48 +0100
committerSlávek Banko <slavek.banko@axis.cz>2018-12-16 11:28:29 +0100
commit6284823847949bb94a9974bc49befb14d9513b47 (patch)
treec0edff6a7f82c84531fdf8ed1b89fe3eab336e56
parentedd94929b6f5cec0621460553c6d5c704cc13691 (diff)
downloadkvpnc-6284823847949bb94a9974bc49befb14d9513b47.tar.gz
kvpnc-6284823847949bb94a9974bc49befb14d9513b47.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 e543ebc9363bb746a042577f314240af305e07b5)
-rw-r--r--CMakeLists.txt2
-rw-r--r--src/ciscocertificateenrollment.cpp5
-rw-r--r--src/displaycertdialog.cpp6
-rw-r--r--src/displaycertdialog.h2
-rw-r--r--src/importipsecprofiledialog.cpp10
-rw-r--r--src/kvpnc.cpp4
-rw-r--r--src/kvpncconfig.cpp22
-rw-r--r--src/manageciscocert.cpp6
-rw-r--r--src/networkinterface.cpp4
-rw-r--r--src/preferencesdialog.cpp8
-rw-r--r--src/toolsinfodialog.cpp2
-rw-r--r--src/utils.cpp12
12 files changed, 42 insertions, 41 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6bdb518..89cbff1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -58,7 +58,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 "-Wl,--no-undefined" )
diff --git a/src/ciscocertificateenrollment.cpp b/src/ciscocertificateenrollment.cpp
index 69b3fd3..a3da6fb 100644
--- a/src/ciscocertificateenrollment.cpp
+++ b/src/ciscocertificateenrollment.cpp
@@ -121,8 +121,9 @@ void CiscoCertificateEnrollment::setupPages()
for ( TQStringList::Iterator it = CiscoCaCerts.begin(); it != CiscoCaCerts.end(); ++it )
{
- if ( GlobalConfig->KvpncDebugLevel > 2 )
- std::cout << "insert item (cisco ca certs): " << TQString ( *it ) << std::endl;
+ if ( GlobalConfig->KvpncDebugLevel > 2 ) {
+ std::cout << "insert item (cisco ca certs): " << TQString ( *it ).local8Bit() << std::endl;
+ }
selectionpage->CAComboBox->insertItem ( *it );
}
diff --git a/src/displaycertdialog.cpp b/src/displaycertdialog.cpp
index 57e06c5..d1eefd8 100644
--- a/src/displaycertdialog.cpp
+++ b/src/displaycertdialog.cpp
@@ -23,8 +23,8 @@
#include <tqstringlist.h>
#include <iostream>
-DisplayCertDialog::DisplayCertDialog(TQWidget *parent, const char* caption, KVpncConfig *GlobalConfig)
- : KDialogBase ( parent, i18n ( "Certificate data" ).ascii(), true, caption,
+DisplayCertDialog::DisplayCertDialog(TQWidget *parent, const TQString& caption, KVpncConfig *GlobalConfig)
+ : KDialogBase ( parent, i18n ( "Certificate data" ).utf8(), true, caption,
KDialogBase::Ok|KDialogBase::Cancel, KDialogBase::Ok, true )
{
main = new DisplayCertDialogBase ( this );
@@ -41,7 +41,7 @@ DisplayCertDialog::~DisplayCertDialog()
void DisplayCertDialog::parseCertData()
{
- std::cout << "certdatalist" << CertDataList.join (" ") << std::endl;
+ std::cout << "certdatalist" << CertDataList.join (" ").local8Bit() << std::endl;
for ( TQStringList::Iterator it = CertDataList.begin(); it != CertDataList.end(); ++it ) {
if (GlobalConfig->KvpncDebugLevel > 2)
GlobalConfig->appendLogEntry("[cert data]: "+*it,GlobalConfig->debug);
diff --git a/src/displaycertdialog.h b/src/displaycertdialog.h
index 4a7799c..816ea95 100644
--- a/src/displaycertdialog.h
+++ b/src/displaycertdialog.h
@@ -33,7 +33,7 @@
class DisplayCertDialog : public KDialogBase
{
public:
- DisplayCertDialog ( TQWidget *parent, const char* caption, KVpncConfig *GlobalConfig );
+ DisplayCertDialog ( TQWidget *parent, const TQString& caption, KVpncConfig *GlobalConfig );
~DisplayCertDialog();
diff --git a/src/importipsecprofiledialog.cpp b/src/importipsecprofiledialog.cpp
index ea9830c..de64f36 100644
--- a/src/importipsecprofiledialog.cpp
+++ b/src/importipsecprofiledialog.cpp
@@ -562,12 +562,12 @@ void ImportIpsecProfileDialog::canAccept()
{
validLineFound=true;
TQString LeftNextHop=line2.section ( "leftnexthop=",1,-1 );
- std::cout << "left next hop (local) found: " << LeftNextHop << std::endl;
+ std::cout << "left next hop (local) found: " << LeftNextHop.local8Bit() << std::endl;
if (GlobalConfig->KvpncDebugLevel > 2)
GlobalConfig->appendLogEntry("import ipsec config: left next hop (local) found: " +LeftNextHop ,GlobalConfig->debug);
profiledata->setLeftNextHop(LeftNextHop);
profiledata->setUseLeftNextHop(true);
- std::cout << " => set it for profile " << IpsecConfigSection << " ." << std::endl;
+ std::cout << " => set it for profile " << IpsecConfigSection.local8Bit() << " ." << std::endl;
if (GlobalConfig->KvpncDebugLevel > 2)
GlobalConfig->appendLogEntry("import ipsec config: => set it for profile " + IpsecConfigSection + " ." ,GlobalConfig->debug);
}
@@ -763,7 +763,7 @@ void ImportIpsecProfileDialog::canAccept()
{
validLineFound=true;
TQString leftsourceip=line2.section ( "leftsourceip=",1,-1 );
- std::cout << "left (local) have to use IP address " << leftsourceip << std::endl;
+ std::cout << "left (local) have to use IP address " << leftsourceip.local8Bit() << std::endl;
if (GlobalConfig->KvpncDebugLevel > 2)
GlobalConfig->appendLogEntry("import ipsec config: left (local) have to use IP address " + leftsourceip ,GlobalConfig->debug);
profiledata->setLocalVirtualIP(leftsourceip);
@@ -775,7 +775,7 @@ void ImportIpsecProfileDialog::canAccept()
{
validLineFound=true;
TQString virtualprivate=line2.section ( "virtual_private=",1,-1 );
- std::cout << "virtual private networks " << virtualprivate << std::endl;
+ std::cout << "virtual private networks " << virtualprivate.local8Bit() << std::endl;
if (GlobalConfig->KvpncDebugLevel > 2)
GlobalConfig->appendLogEntry("import ipsec config: virtual private networks " +virtualprivate ,GlobalConfig->debug);
profiledata->setLocalVirtualIP(virtualprivate);
@@ -788,7 +788,7 @@ void ImportIpsecProfileDialog::canAccept()
{
validLineFound=true;
TQString rightsourceip=line2.section ( "rightsourceip=",1,-1 );
- std::cout << "right (remote) have to use IP address " << rightsourceip << std::endl;
+ std::cout << "right (remote) have to use IP address " << rightsourceip.local8Bit() << std::endl;
if (GlobalConfig->KvpncDebugLevel > 2)
GlobalConfig->appendLogEntry("import ipsec config: right (remote) have to use IP address " + rightsourceip ,GlobalConfig->debug);
profiledata->setRightSourceIp(rightsourceip);
diff --git a/src/kvpnc.cpp b/src/kvpnc.cpp
index 84d1541..21bf2b9 100644
--- a/src/kvpnc.cpp
+++ b/src/kvpnc.cpp
@@ -20000,7 +20000,7 @@ void KVpnc::setGuiStatus ( int status )
ConnectMsg = i18n("Connected: %2@%1, %3").arg(GlobalConfig->currentProfile->getGateway()).arg(Username).arg(durationString);
- TQString TypeString2 = " [" + i18n("%1" , PrettyTypeString) + TQString("]");
+ TQString TypeString2 = " [" + PrettyTypeString + TQString("]");
LogMsg = i18n("Successful connected to server \"%1\"\nuser: \"%2\" at %3").arg(GlobalConfig->currentProfile->getGateway()).arg(Username).arg(TQString(TQDateTime::currentDateTime().toString(Qt::TextDate)) + TypeString2);
}
else if (GlobalConfig->currentProfile->getConnectionType() == VpnAccountData::racoon || GlobalConfig->currentProfile->getConnectionType() == VpnAccountData::l2tpd_racoon || GlobalConfig->currentProfile->getConnectionType() == VpnAccountData::freeswan || GlobalConfig->currentProfile->getConnectionType() == VpnAccountData::l2tpd_freeswan)
@@ -22881,7 +22881,7 @@ void KVpnc::doQuickConnect ( int id )
if ( itemtext != GlobalConfig->currentProfile->getName() )
{
if ( GlobalConfig->KvpncDebugLevel > 3 )
- GlobalConfig->appendLogEntry ( i18n ( "Switching to %1" , TQString ( itemtext ) ), GlobalConfig->debug );
+ GlobalConfig->appendLogEntry ( i18n("Switching to %1").arg(itemtext), GlobalConfig->debug );
bool profileInList = false;
for ( uint i = 0; i < GlobalConfig->AccountList->count();i++ )
{
diff --git a/src/kvpncconfig.cpp b/src/kvpncconfig.cpp
index 34fef45..a4af3fe 100644
--- a/src/kvpncconfig.cpp
+++ b/src/kvpncconfig.cpp
@@ -2160,13 +2160,13 @@ bool KVpncConfig::importKvpncConfig(TQString filename, TQString& RetName, bool&
if (n1.toElement().tagName() == "app")
{
if (KvpncDebugLevel > 5)
- std::cout << " doc was created from kvpnc ver " << n1.toElement().text() << std::endl;
+ std::cout << " doc was created from kvpnc ver " << n1.toElement().text().local8Bit() << std::endl;
}
if (n1.toElement().tagName() == "exportversion")
{
kvpncexportversion = n1.toElement().text();
if (KvpncDebugLevel > 5)
- std::cout << " doc was created from kvpnc with exportver " << n1.toElement().text() << std::endl;
+ std::cout << " doc was created from kvpnc with exportver " << n1.toElement().text().local8Bit() << std::endl;
}
}
}
@@ -2182,7 +2182,7 @@ bool KVpncConfig::importKvpncConfig(TQString filename, TQString& RetName, bool&
if (n1.toElement().tagName() != "")
{
if (KvpncDebugLevel > 5)
- std::cout << " => option: " << ", value: " << n1.toElement().text() << std::endl;
+ std::cout << " => option: " << ", value: " << n1.toElement().text().local8Bit() << std::endl;
}
if ( n1.toElement().tagName() == "Minimize after connect" ) { minimizeAfterConnect = n1.toElement().text().toInt(); }
else if ( n1.toElement().tagName() == "Hide on startup" ) { hideMainWindow = n1.toElement().text().toInt(); }
@@ -2287,7 +2287,7 @@ bool KVpncConfig::importKvpncConfig(TQString filename, TQString& RetName, bool&
if (n1.toElement().attribute("name") != "")
{
if (KvpncDebugLevel > 5)
- std::cout << "profile: " << n1.toElement().attribute("name") << std::endl;
+ std::cout << "profile: " << n1.toElement().attribute("name").local8Bit() << std::endl;
TQString name = n1.toElement().attribute("name");
VpnAccountData *data = new VpnAccountData( VpnAccountData::cisco, name); // cisco is a dummy here, it will be set later
data->setDescription(i18n("import from ")+filename);
@@ -2301,7 +2301,7 @@ bool KVpncConfig::importKvpncConfig(TQString filename, TQString& RetName, bool&
TQString elementname= n2.toElement().attribute("name");
TQString elementvalue = n2.toElement().text();
if (KvpncDebugLevel > 5)
- std::cout << " => option: " << elementname << ", value: " << elementvalue << std::endl;
+ std::cout << " => option: " << elementname.local8Bit() << ", value: " << elementvalue.local8Bit() << std::endl;
// normal config
if (elementname == "Connection type")
{
@@ -2664,7 +2664,7 @@ bool KVpncConfig::importKvpncConfig(TQString filename, TQString& RetName, bool&
TQDomElement e = n.toElement(); // try to convert the node to an element.
if( !e.isNull() ) {
- std::cout << e.tagName() << std::endl; // the node really is an element.
+ std::cout << e.tagName().local8Bit() << std::endl; // the node really is an element.
}
n = n.nextSibling();
}
@@ -3226,12 +3226,12 @@ bool KVpncConfig::importIpsecConfig(TQString filename, TQString& RetName, bool&
{
validLineFound=true;
TQString LeftNextHop=line2.section ( "leftnexthop=",1,-1 );
- std::cout << "left next hop (local) found: " << LeftNextHop << std::endl;
+ std::cout << "left next hop (local) found: " << LeftNextHop.local8Bit() << std::endl;
if (KvpncDebugLevel > 2)
appendLogEntry("import ipsec config: left next hop (local) found: " +LeftNextHop ,debug);
profiledata->setLeftNextHop(LeftNextHop);
profiledata->setUseLeftNextHop(true);
- std::cout << " => set it for profile " << IpsecConfigSection << " ." << std::endl;
+ std::cout << " => set it for profile " << IpsecConfigSection.local8Bit() << " ." << std::endl;
if (KvpncDebugLevel > 2)
appendLogEntry("import ipsec config: => set it for profile " + IpsecConfigSection + " ." ,debug);
}
@@ -3428,7 +3428,7 @@ bool KVpncConfig::importIpsecConfig(TQString filename, TQString& RetName, bool&
{
validLineFound=true;
TQString leftsourceip=line2.section ( "leftsourceip=",1,-1 );
- std::cout << "left (local) have to use IP address " << leftsourceip << std::endl;
+ std::cout << "left (local) have to use IP address " << leftsourceip.local8Bit() << std::endl;
if (KvpncDebugLevel > 2)
appendLogEntry("import ipsec config: left (local) have to use IP address " + leftsourceip ,debug);
profiledata->setLocalVirtualIP(leftsourceip);
@@ -3440,7 +3440,7 @@ bool KVpncConfig::importIpsecConfig(TQString filename, TQString& RetName, bool&
{
validLineFound=true;
TQString virtualprivate=line2.section ( "virtual_private=",1,-1 );
- std::cout << "virtual private networks " << virtualprivate << std::endl;
+ std::cout << "virtual private networks " << virtualprivate.local8Bit() << std::endl;
if (KvpncDebugLevel > 2)
appendLogEntry("import ipsec config: virtual private networks " +virtualprivate ,debug);
profiledata->setLocalVirtualIP(virtualprivate);
@@ -3453,7 +3453,7 @@ bool KVpncConfig::importIpsecConfig(TQString filename, TQString& RetName, bool&
{
validLineFound=true;
TQString rightsourceip=line2.section ( "rightsourceip=",1,-1 );
- std::cout << "right (remote) have to use IP address " << rightsourceip << std::endl;
+ std::cout << "right (remote) have to use IP address " << rightsourceip.local8Bit() << std::endl;
if (KvpncDebugLevel > 2)
appendLogEntry("import ipsec config: right (remote) have to use IP address " + rightsourceip ,debug);
profiledata->setRightSourceIp(rightsourceip);
diff --git a/src/manageciscocert.cpp b/src/manageciscocert.cpp
index 242d137..95557ac 100644
--- a/src/manageciscocert.cpp
+++ b/src/manageciscocert.cpp
@@ -230,7 +230,7 @@ void ManageCiscoCert::showProcessFinished()
delete ShowProcess;
ShowProcess=0L;
- std::cout << "certdatalist" << CertDataList.join (" ") << std::endl;
+ std::cout << "certdatalist" << CertDataList.join (" ").local8Bit() << std::endl;
DisplayCertDialog dlg(0,i18n("Certificate data"),GlobalConfig);
dlg.main->CertNameTextLabel->setText(CertDataName);
dlg.main->CertTypeTextLabel->setText(CertType);
@@ -272,14 +272,14 @@ void ManageCiscoCert::checkList()
for ( TQStringList::Iterator it = CiscoCerts.begin(); it != CiscoCerts.end(); ++it )
{
if (GlobalConfig->KvpncDebugLevel > 2)
- std::cout << "insert item (cisco certs): " << TQString(*it) << std::endl;
+ std::cout << "insert item (cisco certs): " << TQString(*it).local8Bit() << std::endl;
main->CertListView->insertItem( new TQListViewItem(main->CertListView, TQString().setNum(current_user_idx),TQString(*it),i18n("User")));
current_user_idx++;
}
for ( TQStringList::Iterator it = CiscoCaCerts.begin(); it != CiscoCaCerts.end(); ++it )
{
if (GlobalConfig->KvpncDebugLevel > 2)
- std::cout << "insert item (cisco certs): " << TQString(*it) << std::endl;
+ std::cout << "insert item (cisco certs): " << TQString(*it).local8Bit() << std::endl;
main->CertListView->insertItem( new TQListViewItem(main->CertListView, TQString().setNum(current_ca_idx),TQString(*it),i18n("CA")));
current_ca_idx++;
}
diff --git a/src/networkinterface.cpp b/src/networkinterface.cpp
index 25d01eb..b3fae36 100644
--- a/src/networkinterface.cpp
+++ b/src/networkinterface.cpp
@@ -379,7 +379,7 @@ TQString NetworkInterface::getGatewayOfDefaultInterface()
while ( !stream.atEnd() )
{
line = stream.readLine(); // line of text excluding '\n' and replace all white chars with one blank
- std::cout << "line: \"" << line << "\"" << "\n";
+ std::cout << "line: \"" << line.local8Bit() << "\"" << "\n";
if (line.simplifyWhiteSpace().section( ' ', 1, 1 ) == "00000000" )
{
struct sockaddr_in name;
@@ -436,7 +436,7 @@ bool NetworkInterface::inSameNetwork(TQString ip1,TQString Netmask1,TQString ip2
}
else
{
- std::cout << "ip1: " << ip1.section( '.', 0, 2 ) << " , ip2: " << ip2.section( '.', 0, 2 ) << std::endl;
+ std::cout << "ip1: " << ip1.section( '.', 0, 2 ).local8Bit() << " , ip2: " << ip2.section( '.', 0, 2 ).local8Bit() << std::endl;
if (ip1.section( '.', 0, 2 ) == ip2.section( '.', 0, 2 ))
{
if (Netmask1 == Netmask2)
diff --git a/src/preferencesdialog.cpp b/src/preferencesdialog.cpp
index 137557d..8c2f514 100644
--- a/src/preferencesdialog.cpp
+++ b/src/preferencesdialog.cpp
@@ -3205,7 +3205,7 @@ void PreferencesDialog::profileChanged( const TQString& itemtext )
for ( TQStringList::Iterator ikeit = IkeList.begin(); ikeit != IkeList.end(); ++ikeit )
{
- std::cout << "ike: " << *ikeit << ":" << std::endl;
+ std::cout << "ike: " << (*ikeit).local8Bit() << ":" << std::endl;
if (*ikeit == "aes256-sha1")
ProfileIpsecOptionsWidget->IkeAes256Sha1CheckBox->setChecked(true);
@@ -3229,7 +3229,7 @@ void PreferencesDialog::profileChanged( const TQString& itemtext )
for ( TQStringList::Iterator espit = EspList.begin(); espit != EspList.end(); ++espit )
{
- std::cout << "esp: " << *espit << ":" << std::endl;
+ std::cout << "esp: " << (*espit).local8Bit() << ":" << std::endl;
if (*espit == "3des-md5")
ProfileIpsecOptionsWidget->Esp3desMd5CheckBox->setChecked(true);
@@ -4923,10 +4923,10 @@ void PreferencesDialog::saveSessionClicked()
profile->setIpsecIke(IkeList.join(","));
for ( TQStringList::Iterator ikeit = IkeList.begin(); ikeit != IkeList.end(); ++ikeit )
- std::cout << "ike: " << *ikeit << ":" << std::endl;
+ std::cout << "ike: " << (*ikeit).local8Bit() << ":" << std::endl;
for ( TQStringList::Iterator espit = EspList.begin(); espit != EspList.end(); ++espit )
- std::cout << "esp: " << *espit << ":" << std::endl;
+ std::cout << "esp: " << (*espit).local8Bit() << ":" << std::endl;
if(ProfileIpsecOptionsWidget->UseCustomEspCheckBox->isChecked() && !EspList.isEmpty())
profile->setUseCustomEsp(true);
diff --git a/src/toolsinfodialog.cpp b/src/toolsinfodialog.cpp
index a3795c7..ee88aa6 100644
--- a/src/toolsinfodialog.cpp
+++ b/src/toolsinfodialog.cpp
@@ -344,7 +344,7 @@ ToolsInfoDialog::ToolsInfoDialog(KVpncConfig *GlobalConfig, TQWidget *parent, co
if ( major < 4 )
//else
usability=i18n("unuseable");
- comment=+i18n("no vpn support");
+ comment+=i18n("no vpn support");
}
}
diff --git a/src/utils.cpp b/src/utils.cpp
index 4409ac3..a132f03 100644
--- a/src/utils.cpp
+++ b/src/utils.cpp
@@ -1471,7 +1471,7 @@ void Utils::readStdOutRetriveIpsecAlgos()
TQString Algo = msg.stripWhiteSpace().section(":",1,1).section(",",1,1).section("=",1,1);
TQString MinKeySize = msg.stripWhiteSpace().section(":",1,1).section(",",3,3).section("=",1,1);
TQString MaxKeySize = msg.stripWhiteSpace().section(":",1,1).section(",",4,4).section("=",1,1);
- std::cout << "IKE encryption algo found: \"" << Algo << "\", Min: " << MinKeySize << ", Max: " << MaxKeySize << std::endl;
+ std::cout << "IKE encryption algo found: \"" << Algo.local8Bit() << "\", Min: " << MinKeySize.local8Bit() << ", Max: " << MaxKeySize.local8Bit() << std::endl;
// TQStringList AlgoOptList = TQStringList::split("-",AlgoOpt);
// for (TQStringList::Iterator it = AlgoOptList.begin(); it != AlgoOptList.end(); ++it)
// {
@@ -1896,12 +1896,12 @@ int Utils::dottedIpv4Netmask2NetmaskBytes(TQString dottedIpv4Netmask)
TQString block2 = dec2bin(part2);
TQString block3 = dec2bin(part3);
- std::cout << "block0: " << block0 << std::endl;
- std::cout << "block1: " << block1 << std::endl;
- std::cout << "block2: " << block2 << std::endl;
- std::cout << "block3: " << block3 << std::endl;
+ std::cout << "block0: " << block0.local8Bit() << std::endl;
+ std::cout << "block1: " << block1.local8Bit() << std::endl;
+ std::cout << "block2: " << block2.local8Bit() << std::endl;
+ std::cout << "block3: " << block3.local8Bit() << std::endl;
block = block0 + block1 +block2 + block3;
- std::cout << "block: " << block.ascii() << std::endl;
+ std::cout << "block: " << block.local8Bit() << std::endl;
for (int i=0; i< 31;i++)
{