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/kchmviewwindow.cpp | 98 +++++++++++++++++++++++++------------------------- 1 file changed, 49 insertions(+), 49 deletions(-) (limited to 'src/kchmviewwindow.cpp') diff --git a/src/kchmviewwindow.cpp b/src/kchmviewwindow.cpp index 3eea6ca..b125d44 100644 --- a/src/kchmviewwindow.cpp +++ b/src/kchmviewwindow.cpp @@ -19,11 +19,11 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ -// Do not use tr() or i18n() in this file - this class is not derived from QObject. +// Do not use tr() or i18n() in this file - this class is not derived from TQObject. -#include -#include -#include +#include +#include +#include #include "libchmfile.h" #include "libchmurlfactory.h" @@ -35,25 +35,25 @@ #include "kchmnavtoolbar.h" -KCHMViewWindow::KCHMViewWindow( QTabWidget * parent ) +KCHMViewWindow::KCHMViewWindow( TQTabWidget * tqparent ) { - invalidate(); + tqinvalidate(); m_contextMenu = 0; m_contextMenuLink = 0; m_historyMaxSize = 25; - m_parentTabWidget = parent; + m_parentTabWidget = tqparent; } KCHMViewWindow::~KCHMViewWindow() { } -void KCHMViewWindow::invalidate( ) +void KCHMViewWindow::tqinvalidate( ) { m_base_url = "/"; - m_openedPage = QString::null; - m_newTabLinkKeeper = QString::null; + m_openedPage = TQString(); + m_newTabLinkKeeper = TQString(); m_historyCurrentPos = 0; m_history.clear(); @@ -63,30 +63,30 @@ void KCHMViewWindow::invalidate( ) -QString KCHMViewWindow::makeURLabsolute ( const QString & url, bool set_as_base ) +TQString KCHMViewWindow::makeURLabsolute ( const TQString & url, bool set_as_base ) { - QString p1, p2, newurl = url; + TQString p1, p2, newurl = url; if ( !LCHMUrlFactory::isRemoteURL (url, p1) && !LCHMUrlFactory::isJavascriptURL (url) && !LCHMUrlFactory::isNewChmURL (url, p1, p2) ) { - newurl = QDir::cleanDirPath (url); + newurl = TQDir::cleanDirPath (url); // Normalize url, so it becomes absolute if ( newurl[0] != '/' ) newurl = m_base_url + "/" + newurl; - newurl = QDir::cleanDirPath (newurl); + newurl = TQDir::cleanDirPath (newurl); if ( set_as_base ) { m_base_url = newurl; // and set up new baseurl - int i = newurl.findRev('/'); + int i = newurl.tqfindRev('/'); if ( i != -1 ) - m_base_url = QDir::cleanDirPath (newurl.left (i + 1)); + m_base_url = TQDir::cleanDirPath (newurl.left (i + 1)); } } @@ -94,19 +94,19 @@ QString KCHMViewWindow::makeURLabsolute ( const QString & url, bool set_as_base return newurl; } -bool KCHMViewWindow::openUrl ( const QString& origurl ) +bool KCHMViewWindow::openUrl ( const TQString& origurl ) { - QString chmfile, page, newurl = origurl; + TQString chmfile, page, newurl = origurl; if ( !origurl ) return true; - // URL could be a complete ms-its link. The file should be already loaded (for QTextBrowser), + // URL could be a complete ms-its link. The file should be already loaded (for TQTextBrowser), // or will be loaded (for kio slave). We care only about the path component. if ( LCHMUrlFactory::isNewChmURL( newurl, chmfile, page ) ) { // If a new chm file is opened here, and we do not use KCHMLPart, we better abort - if ( chmfile != ::mainWindow->getOpenedFileName() && appConfig.m_kdeUseQTextBrowser ) + if ( chmfile != ::mainWindow->getOpenedFileName() && appConfig.m_kdeUseTQTextBrowser ) qFatal("KCHMViewWindow::openUrl(): opened new chm file %s while current is %s", chmfile.ascii(), ::mainWindow->getOpenedFileName().ascii() ); @@ -119,7 +119,7 @@ bool KCHMViewWindow::openUrl ( const QString& origurl ) if ( openPage (newurl) ) { - m_newTabLinkKeeper = QString::null; + m_newTabLinkKeeper = TQString(); m_openedPage = newurl; mainWindow->viewWindowMgr()->setTabName( this ); @@ -129,36 +129,36 @@ bool KCHMViewWindow::openUrl ( const QString& origurl ) return false; } -void KCHMViewWindow::handleStartPageAsImage( QString & link ) +void KCHMViewWindow::handleStartPageAsImage( TQString & link ) { // Handle pics - if ( link.endsWith( ".jpg", false ) - || link.endsWith( ".jpeg", false ) - || link.endsWith( ".gif", false ) - || link.endsWith( ".png", false ) - || link.endsWith( ".bmp", false ) ) + if ( link.tqendsWith( ".jpg", false ) + || link.tqendsWith( ".jpeg", false ) + || link.tqendsWith( ".gif", false ) + || link.tqendsWith( ".png", false ) + || link.tqendsWith( ".bmp", false ) ) link += LCHMUrlFactory::getInternalUriExtension(); } -KQPopupMenu * KCHMViewWindow::createStandardContextMenu( QWidget * parent ) +KTQPopupMenu * KCHMViewWindow::createStandardContextMenu( TQWidget * tqparent ) { - KQPopupMenu * contextMenu = new KQPopupMenu( parent ); + KTQPopupMenu * contextMenu = new KTQPopupMenu( tqparent ); - contextMenu->insertItem ( "&Copy", ::mainWindow, SLOT(slotBrowserCopy()) ); - contextMenu->insertItem ( "&Select all", ::mainWindow, SLOT(slotBrowserSelectAll()) ); + contextMenu->insertItem ( "&Copy", ::mainWindow, TQT_SLOT(slotBrowserCopy()) ); + contextMenu->insertItem ( "&Select all", ::mainWindow, TQT_SLOT(slotBrowserSelectAll()) ); return contextMenu; } -KQPopupMenu * KCHMViewWindow::getContextMenu( const QString & link, QWidget * parent ) +KTQPopupMenu * KCHMViewWindow::getContextMenu( const TQString & link, TQWidget * tqparent ) { if ( link.isNull() ) { // standard context menu if ( !m_contextMenu ) - m_contextMenu = createStandardContextMenu( parent ); + m_contextMenu = createStandardContextMenu( tqparent ); return m_contextMenu; } @@ -168,12 +168,12 @@ KQPopupMenu * KCHMViewWindow::getContextMenu( const QString & link, QWidget * pa // standard context menu if ( !m_contextMenuLink ) { - m_contextMenuLink = createStandardContextMenu( parent ); + m_contextMenuLink = createStandardContextMenu( tqparent ); m_contextMenuLink->insertSeparator(); - m_contextMenuLink->insertItem ( "&Open this link in a new tab", ::mainWindow, SLOT(slotOpenPageInNewTab()), QKeySequence("Shift+Enter") ); + m_contextMenuLink->insertItem ( "&Open this link in a new tab", ::mainWindow, TQT_SLOT(slotOpenPageInNewTab()), TQKeySequence("Shift+Enter") ); - m_contextMenuLink->insertItem ( "&Open this link in a new background tab", ::mainWindow, SLOT(slotOpenPageInNewBackgroundTab()), QKeySequence("Ctrl+Enter") ); + m_contextMenuLink->insertItem ( "&Open this link in a new background tab", ::mainWindow, TQT_SLOT(slotOpenPageInNewBackgroundTab()), TQKeySequence("Ctrl+Enter") ); } setTabKeeper( link ); @@ -181,9 +181,9 @@ KQPopupMenu * KCHMViewWindow::getContextMenu( const QString & link, QWidget * pa } } -QString KCHMViewWindow::getTitle() const +TQString KCHMViewWindow::getTitle() const { - QString title = ::mainWindow->chmFile()->getTopicByUrl( m_openedPage ); + TQString title = ::mainWindow->chmFile()->getTopicByUrl( m_openedPage ); if ( title.isEmpty() ) title = m_openedPage; @@ -247,7 +247,7 @@ void KCHMViewWindow::navigateHome( ) ::mainWindow->openPage( ::mainWindow->chmFile()->homeUrl() ); } -void KCHMViewWindow::addNavigationHistory( const QString & url, int scrollpos ) +void KCHMViewWindow::addNavigationHistory( const TQString & url, int scrollpos ) { // shred the 'forward' history if ( m_historyCurrentPos < m_history.size() ) @@ -274,30 +274,30 @@ void KCHMViewWindow::updateNavigationToolbar( ) if ( mainWindow ) { - mainWindow->navigationToolbar()->updateIconStatus( + mainWindow->navigationToolbar()->updateIcontqStatus( m_historyCurrentPos > 0, m_historyCurrentPos < (m_history.size() - 1) ); } } -KQPopupMenu * KCHMViewWindow::createListItemContextMenu( QWidget * w ) +KTQPopupMenu * KCHMViewWindow::createListItemContextMenu( TQWidget * w ) { - KQPopupMenu * contextMenu = new KQPopupMenu( w ); + KTQPopupMenu * contextMenu = new KTQPopupMenu( w ); contextMenu->insertItem ( "&Open this link in a new tab", ::mainWindow, - SLOT( slotOpenPageInNewTab() ), - QKeySequence( "Shift+Enter" ) ); + TQT_SLOT( slotOpenPageInNewTab() ), + TQKeySequence( "Shift+Enter" ) ); contextMenu->insertItem ( "&Open this link in a new background tab", ::mainWindow, - SLOT( slotOpenPageInNewBackgroundTab() ), - QKeySequence( "Ctrl+Enter" ) ); + TQT_SLOT( slotOpenPageInNewBackgroundTab() ), + TQKeySequence( "Ctrl+Enter" ) ); return contextMenu; } -void KCHMViewWindow::setTabKeeper( const QString & link ) +void KCHMViewWindow::setTabKeeper( const TQString & link ) { // If we clicked on relative link, make sure we convert it to absolute right now, // because later we will not have access to this view window variables @@ -305,8 +305,8 @@ void KCHMViewWindow::setTabKeeper( const QString & link ) if ( m_newTabLinkKeeper[0] == '#' && !m_openedPage.isEmpty() ) { // Clean up opened page URL - int pos = m_openedPage.find ('#'); - QString fixedpath = pos == -1 ? m_openedPage : m_openedPage.left (pos); + int pos = m_openedPage.tqfind ('#'); + TQString fixedpath = pos == -1 ? m_openedPage : m_openedPage.left (pos); m_newTabLinkKeeper = fixedpath + m_newTabLinkKeeper; } -- cgit v1.2.3