From 25fe483e16bfbee521731caa40ae2fea6f29af68 Mon Sep 17 00:00:00 2001
From: Slávek Banko <slavek.banko@axis.cz>
Date: Thu, 9 May 2019 15:19:44 +0200
Subject: Added controlled conversions to char* instead of automatic ascii
 conversions. The definition of -UTQT_NO_ASCII_CAST is no longer needed.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
---
 CMakeLists.txt                 | 2 +-
 kxmleditor/kxmleditorshell.cpp | 4 ++--
 part/kxedocument.cpp           | 8 ++++----
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 54b1b40..6bb6546 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -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" )
diff --git a/kxmleditor/kxmleditorshell.cpp b/kxmleditor/kxmleditorshell.cpp
index 5e6b2ba..91188d0 100644
--- a/kxmleditor/kxmleditorshell.cpp
+++ b/kxmleditor/kxmleditorshell.cpp
@@ -406,9 +406,9 @@ KParts::ReadWritePart* KXMLEditorShell::createXMLPart(TQObject *parent)
 KParts::ReadWritePart* KXMLEditorShell::createPart(TQObject *parent, const TQString& libName, const TQString& className)
 {
 	KParts::ReadWritePart* newPart = 0L;
-	KLibFactory * pFactory = KLibLoader::self()->factory(libName);
+	KLibFactory * pFactory = KLibLoader::self()->factory(libName.local8Bit());
 	if (pFactory)
-		newPart = static_cast <KParts::ReadWritePart*> ( pFactory->create( parent, "KXMLEditor view", className ) );
+		newPart = static_cast <KParts::ReadWritePart*> ( pFactory->create( parent, "KXMLEditor view", className.utf8() ) );
 	else
 		kdFatal() << "KXMLEditorShell::KXMLEditorShell no " << libName << " found" << endl;
 	return newPart;
diff --git a/part/kxedocument.cpp b/part/kxedocument.cpp
index c990d10..5bba469 100644
--- a/part/kxedocument.cpp
+++ b/part/kxedocument.cpp
@@ -106,7 +106,7 @@ bool KXEDocument::save(const TQString  &strFileName)
 	if(strEncoding.length() <= 0)
     pTextCodec = TQTextCodec::codecForLocale(); // default
   else
-    pTextCodec = TQTextCodec::codecForName(strEncoding);
+    pTextCodec = TQTextCodec::codecForName(strEncoding.latin1());
 
 	if(pTextCodec == 0)
 		{ if(KMessageBox::questionYesNo(0, i18n("Codec for encoding %1 not found ! Continue saving ?").arg(strEncoding)) != KMessageBox::Yes)
@@ -222,7 +222,7 @@ bool KXEDocument::open(const TQString &strFileName)
 							{
 									line = stream.readLine(); // line of text excluding '\n'
 									//printf( "%3d: %s\n", i++, line.latin1() );
-									fileTemporary.writeBlock(line, line.length());
+									fileTemporary.writeBlock(line.utf8(), line.utf8().length());
 							}
 							pIODevice->close();
 					}
@@ -244,7 +244,7 @@ bool KXEDocument::open(const TQString &strFileName)
 		
 					// For KOffice files let user to choose maindoc or documentinfo
 					if(strCompressedTarEntryName.length() == 0)
-					{ KXEChooseStringDialog dlgChooseString(0, 0, i18n("Choose file"), i18n("File:"));
+					{ KXEChooseStringDialog dlgChooseString(0, 0, i18n("Choose file").utf8(), i18n("File:").utf8());
 						dlgChooseString.m_pComboBox->insertItem("maindoc.xml");
 						dlgChooseString.m_pComboBox->insertItem("documentinfo.xml");
 	
@@ -321,7 +321,7 @@ bool KXEDocument::open(const TQString &strFileName)
       {
         strEncoding = strFirstLine.mid(iStart, iEnd - iStart);
 
-        TQTextCodec *pTextCodec = TQTextCodec::codecForName(strEncoding);
+        TQTextCodec *pTextCodec = TQTextCodec::codecForName(strEncoding.latin1());
         if(pTextCodec)
           txtStreamLocal.setCodec(pTextCodec);
         else
-- 
cgit v1.2.3

