From 25794f504692e5a36c490438814e9dfda8aaa2dd Mon Sep 17 00:00:00 2001 From: tpearson Date: Sun, 29 May 2011 19:00:37 +0000 Subject: TQt4 port kchmviewer This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kchmviewer@1234150 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- src/kchmconfig.cpp | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) (limited to 'src/kchmconfig.cpp') diff --git a/src/kchmconfig.cpp b/src/kchmconfig.cpp index f5058f3..2e3df0b 100644 --- a/src/kchmconfig.cpp +++ b/src/kchmconfig.cpp @@ -32,8 +32,8 @@ const char * APP_PATHINUSERDIR = ".kchmviewer"; KCHMConfig::KCHMConfig() { - QDir dir; - m_datapath = QDir::homeDirPath() + "/" + APP_PATHINUSERDIR; + TQDir dir; + m_datapath = TQDir::homeDirPath() + "/" + APP_PATHINUSERDIR; dir.setPath (m_datapath); @@ -47,8 +47,8 @@ KCHMConfig::KCHMConfig() m_HistoryStoreExtra = true; m_useSearchEngine = SEARCH_USE_MINE; - m_QtBrowserPath = "viewurl-netscape.sh '%s'"; - m_kdeUseQTextBrowser = false; + m_TQtBrowserPath = "viewurl-netscape.sh '%s'"; + m_kdeUseTQTextBrowser = false; m_kdeEnableJS = false; m_kdeEnableJava = false; m_kdeEnablePlugins = true; @@ -67,24 +67,24 @@ KCHMConfig::~KCHMConfig() bool KCHMConfig::load() { - QFile file (m_datapath + "/config"); + TQFile file (m_datapath + "/config"); if ( !file.open (IO_ReadOnly) ) return false; // no error message - not actually a problem - QString line; + TQString line; char readbuf[4096]; bool getting_history = false; m_History.clear(); while ( file.readLine( readbuf, sizeof(readbuf) - 1 ) > 0 ) { - line = QString::fromUtf8( readbuf ).stripWhiteSpace(); + line = TQString::fromUtf8( readbuf ).stripWhiteSpace(); // skip empty lines and comments if ( line.isEmpty() || line[0] == '#' ) continue; - QRegExp rxsection ("^\\[(\\w+)\\]$"), rxkeypair ("^(\\w+)\\s*=\\s*(.*)$"); + TQRegExp rxsection ("^\\[(\\w+)\\]$"), rxkeypair ("^(\\w+)\\s*=\\s*(.*)$"); if ( rxsection.search ( line ) != -1 ) { @@ -93,13 +93,13 @@ bool KCHMConfig::load() else if ( rxsection.cap (1) == "history" ) getting_history = true; else - qWarning ("Unknown configuration section: %s", rxsection.cap (1).ascii()); + qWarning ("Unknown configuration section: %s", TQString(rxsection.cap(1)).ascii()); continue; } else if ( !getting_history && rxkeypair.search ( line ) != -1 ) { - QString key (rxkeypair.cap (1)), value (rxkeypair.cap(2)); + TQString key (rxkeypair.cap (1)), value (rxkeypair.cap(2)); if ( key == "LoadLatestFileOnStartup" ) m_LoadLatestFileOnStartup = value.toInt() ? true : false; @@ -111,10 +111,10 @@ bool KCHMConfig::load() m_HistorySize = value.toInt(); else if ( key == "HistoryStoreExtra" ) m_HistoryStoreExtra = value.toInt() ? true : false; - else if ( key == "QtBrowserPath" ) - m_QtBrowserPath = value; - else if ( key == "kdeUseQTextBrowser" ) - m_kdeUseQTextBrowser = value.toInt() ? true : false; + else if ( key == "TQtBrowserPath" ) + m_TQtBrowserPath = value; + else if ( key == "kdeUseTQTextBrowser" ) + m_kdeUseTQTextBrowser = value.toInt() ? true : false; else if ( key == "kdeEnableJS" ) m_kdeEnableJS = value.toInt() ? true : false; else if ( key == "kdeEnableJava" ) @@ -148,15 +148,15 @@ bool KCHMConfig::load() bool KCHMConfig::save( ) { - QFile file (m_datapath + "/config"); + TQFile file (m_datapath + "/config"); if ( !file.open (IO_WriteOnly) ) { - qWarning ("Could not write settings into file %s: %s", file.name().ascii(), file.errorString().ascii()); + qWarning ("Could not write settings into file %s: %s", TQString(file.name()).ascii(), TQString(file.errorString()).ascii()); return false; } - QTextStream stream( &file ); - stream.setEncoding( QTextStream::UnicodeUTF8 ); + TQTextStream stream( &file ); + stream.setEncoding( TQTextStream::UnicodeUTF8 ); stream << "[settings]\n"; stream << "LoadLatestFileOnStartup=" << m_LoadLatestFileOnStartup << "\n"; @@ -165,8 +165,8 @@ bool KCHMConfig::save( ) stream << "HistorySize=" << m_HistorySize << "\n"; stream << "HistoryStoreExtra=" << m_HistoryStoreExtra << "\n"; - stream << "QtBrowserPath=" << m_QtBrowserPath << "\n"; - stream << "kdeUseQTextBrowser=" << m_kdeUseQTextBrowser << "\n"; + stream << "TQtBrowserPath=" << m_TQtBrowserPath << "\n"; + stream << "kdeUseTQTextBrowser=" << m_kdeUseTQTextBrowser << "\n"; stream << "kdeEnableJS=" << m_kdeEnableJS << "\n"; stream << "kdeEnableJava=" << m_kdeEnableJava << "\n"; stream << "kdeEnablePlugins=" << m_kdeEnablePlugins << "\n"; @@ -187,9 +187,9 @@ bool KCHMConfig::save( ) return true; } -void KCHMConfig::addFileToHistory( const QString & file ) +void KCHMConfig::addFileToHistory( const TQString & file ) { - QStringList::Iterator itr = m_History.find( file ); + TQStringList::Iterator itr = m_History.tqfind( file ); // check whether file already exists in history - more it forward if ( itr != m_History.end() ) @@ -206,7 +206,7 @@ void KCHMConfig::addFileToHistory( const QString & file ) } // Remove a file from the front - QString filetoremove = m_History[0]; + TQString filetoremove = m_History[0]; m_History.erase( m_History.begin() ); m_History.push_back( file ); -- cgit v1.2.3