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/kchmsearchtoolbar.cpp | 174 +++++++++++++++++++++++----------------------- 1 file changed, 87 insertions(+), 87 deletions(-) (limited to 'src/kchmsearchtoolbar.cpp') diff --git a/src/kchmsearchtoolbar.cpp b/src/kchmsearchtoolbar.cpp index 617cf7b..f87bf50 100644 --- a/src/kchmsearchtoolbar.cpp +++ b/src/kchmsearchtoolbar.cpp @@ -19,13 +19,13 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include "libchmfile.h" #include "libchmfileimpl.h" @@ -41,143 +41,143 @@ #include "kchmsearchtoolbar.moc" -static KQPopupMenu *menu_langlist, *menu_enclist; +static KTQPopupMenu *menu_langlist, *menu_enclist; -KCHMSearchAndViewToolbar::KCHMSearchAndViewToolbar( KCHMMainWindow * parent ) - : QToolBar (parent) +KCHMSearchAndViewToolbar::KCHMSearchAndViewToolbar( KCHMMainWindow * tqparent ) + : TQToolBar (tqparent) { // Toolbar label setLabel( i18n( "Find in page") ); // Load the pixmaps - QPixmap iconPrev (*gIconStorage.getToolbarPixmap(KCHMIconStorage::findprev)); - QPixmap iconNext (*gIconStorage.getToolbarPixmap(KCHMIconStorage::findnext)); - QPixmap iconFontInc (*gIconStorage.getToolbarPixmap(KCHMIconStorage::view_increase)); - QPixmap iconFontDec (*gIconStorage.getToolbarPixmap(KCHMIconStorage::view_decrease)); - QPixmap iconViewSource (*gIconStorage.getToolbarPixmap(KCHMIconStorage::viewsource)); - QPixmap iconAddBookmark (*gIconStorage.getToolbarPixmap(KCHMIconStorage::bookmark_add)); - QPixmap iconNextPage (*gIconStorage.getToolbarPixmap(KCHMIconStorage::next_page)); - QPixmap iconPrevPage (*gIconStorage.getToolbarPixmap(KCHMIconStorage::prev_page)); - QPixmap iconLocateInContent (*gIconStorage.getToolbarPixmap(KCHMIconStorage::locate_in_content)); + TQPixmap iconPrev (*gIconStorage.getToolbarPixmap(KCHMIconStorage::findprev)); + TQPixmap iconNext (*gIconStorage.getToolbarPixmap(KCHMIconStorage::findnext)); + TQPixmap iconFontInc (*gIconStorage.getToolbarPixmap(KCHMIconStorage::view_increase)); + TQPixmap iconFontDec (*gIconStorage.getToolbarPixmap(KCHMIconStorage::view_decrease)); + TQPixmap iconViewSource (*gIconStorage.getToolbarPixmap(KCHMIconStorage::viewsource)); + TQPixmap iconAddBookmark (*gIconStorage.getToolbarPixmap(KCHMIconStorage::bookmark_add)); + TQPixmap iconNextPage (*gIconStorage.getToolbarPixmap(KCHMIconStorage::next_page)); + TQPixmap iconPrevPage (*gIconStorage.getToolbarPixmap(KCHMIconStorage::prev_page)); + TQPixmap iconLocateInContent (*gIconStorage.getToolbarPixmap(KCHMIconStorage::locate_in_content)); // Create the combobox to enter the find text - m_findBox = new QComboBox (TRUE, this); + m_findBox = new TQComboBox (TRUE, this); m_findBox->setMinimumWidth (200); - connect( m_findBox->lineEdit(), SIGNAL( returnPressed() ), this, SLOT( onReturnPressed() ) ); - QWhatsThis::add( m_findBox, i18n( "Enter here the text to search in the current page.") ); + connect( m_findBox->lineEdit(), TQT_SIGNAL( returnPressed() ), this, TQT_SLOT( onReturnPressed() ) ); + TQWhatsThis::add( m_findBox, i18n( "Enter here the text to search in the current page.") ); - QAccel *acc = new QAccel( this ); - acc->connectItem( acc->insertItem(Key_F+CTRL), this, SLOT( onAccelFocusSearchField() ) ); + TQAccel *acc = new TQAccel( this ); + acc->connectItem( acc->insertItem(Key_F+CTRL), this, TQT_SLOT( onAccelFocusSearchField() ) ); // Button 'prevous search result' - m_buttonPrev = new QToolButton (iconPrev, + m_buttonPrev = new TQToolButton (iconPrev, i18n( "Previous search result"), - QString::null, + TQString(), this, - SLOT(onBtnPrevSearchResult()), + TQT_SLOT(onBtnPrevSearchResult()), this); - QWhatsThis::add( m_buttonPrev, i18n( "Click this button to find previous search result.") ); + TQWhatsThis::add( m_buttonPrev, i18n( "Click this button to find previous search result.") ); // Button 'next search result' - m_buttonNext = new QToolButton (iconNext, + m_buttonNext = new TQToolButton (iconNext, i18n( "Next search result"), - QString::null, + TQString(), this, - SLOT(onBtnNextSearchResult()), + TQT_SLOT(onBtnNextSearchResult()), this); - QWhatsThis::add( m_buttonNext, i18n( "Click this button to find next search result.") ); + TQWhatsThis::add( m_buttonNext, i18n( "Click this button to find next search result.") ); // Button 'locate in content' - m_buttonLocateInContent = new QToolButton( iconLocateInContent, + m_buttonLocateInContent = new TQToolButton( iconLocateInContent, i18n( "Locate this topic in content window"), - QString::null, + TQString(), this, - SLOT( onBtnLocateInContentWindow() ), + TQT_SLOT( onBtnLocateInContentWindow() ), this ); - QWhatsThis::add( m_buttonLocateInContent, i18n( "Click this button to find current topic in the content window, and open it.") ); + TQWhatsThis::add( m_buttonLocateInContent, i18n( "Click this button to find current topic in the content window, and open it.") ); // Button 'increase font size' - m_buttonFontInc = new QToolButton (iconFontInc, + m_buttonFontInc = new TQToolButton (iconFontInc, i18n( "Increase font size"), - QString::null, + TQString(), this, - SLOT(onBtnFontInc()), + TQT_SLOT(onBtnFontInc()), this); - QWhatsThis::add( m_buttonFontInc, i18n( "Click this button to increase the font size.") ); + TQWhatsThis::add( m_buttonFontInc, i18n( "Click this button to increase the font size.") ); // Button 'decrease font size' - m_buttonFontDec = new QToolButton (iconFontDec, + m_buttonFontDec = new TQToolButton (iconFontDec, i18n( "Decrease font size"), - QString::null, + TQString(), this, - SLOT(onBtnFontDec()), + TQT_SLOT(onBtnFontDec()), this); - QWhatsThis::add( m_buttonFontDec, i18n( "Click this button to decrease the font size.") ); + TQWhatsThis::add( m_buttonFontDec, i18n( "Click this button to decrease the font size.") ); // Button 'view HTML source' - m_buttonViewSource = new QToolButton (iconViewSource, + m_buttonViewSource = new TQToolButton (iconViewSource, i18n( "View HTML source"), - QString::null, + TQString(), this, - SLOT(onBtnViewSource()), + TQT_SLOT(onBtnViewSource()), this); - QWhatsThis::add( m_buttonViewSource, i18n( "Click this button to open a separate window with the page HTML source.") ); + TQWhatsThis::add( m_buttonViewSource, i18n( "Click this button to open a separate window with the page HTML source.") ); // Button 'add a bookmark' - m_buttonAddBookmark = new QToolButton (iconAddBookmark, + m_buttonAddBookmark = new TQToolButton (iconAddBookmark, i18n( "Add to bookmarks"), - QString::null, + TQString(), this, - SLOT(onBtnAddBookmark()), + TQT_SLOT(onBtnAddBookmark()), this); - QWhatsThis::add( m_buttonAddBookmark, i18n( "Click this button to add the current page to the bookmarks list.") ); + TQWhatsThis::add( m_buttonAddBookmark, i18n( "Click this button to add the current page to the bookmarks list.") ); - m_buttonPrevPageInTOC = new QToolButton( iconPrevPage, + m_buttonPrevPageInTOC = new TQToolButton( iconPrevPage, i18n( "Prev page in TOC"), - QString::null, + TQString(), this, - SLOT(onBtnPrevPageInToc()), + TQT_SLOT(onBtnPrevPageInToc()), this); - QWhatsThis::add( m_buttonAddBookmark, i18n( "Click this button to go to previous page in Table Of Content.") ); + TQWhatsThis::add( m_buttonAddBookmark, i18n( "Click this button to go to previous page in Table Of Content.") ); - m_buttonNextPageInTOC = new QToolButton (iconNextPage, + m_buttonNextPageInTOC = new TQToolButton (iconNextPage, i18n( "Next page in TOC"), - QString::null, + TQString(), this, - SLOT(onBtnNextPageInToc()), + TQT_SLOT(onBtnNextPageInToc()), this); - QWhatsThis::add( m_buttonAddBookmark, i18n( "Click this button to go to next page in Table of Content.") ); + TQWhatsThis::add( m_buttonAddBookmark, i18n( "Click this button to go to next page in Table of Content.") ); // Create the approptiate menu entries in 'View' main menu - m_MenuView = new KQPopupMenu( parent ); - parent->menuBar()->insertItem( i18n( "&View"), m_MenuView ); + m_MenuView = new KTQPopupMenu( tqparent ); + tqparent->menuBar()->insertItem( i18n( "&View"), m_MenuView ); - m_MenuView->insertItem( i18n( "&Increase font"), this, SLOT(onBtnFontInc()), CTRL+Key_Plus ); - m_MenuView->insertItem( i18n( "&Decrease font"), this, SLOT(onBtnFontDec()), CTRL+Key_Minus ); - m_MenuView->insertItem( i18n( "&View HTML source"), this, SLOT(onBtnViewSource()), CTRL+Key_U ); + m_MenuView->insertItem( i18n( "&Increase font"), this, TQT_SLOT(onBtnFontInc()), CTRL+Key_Plus ); + m_MenuView->insertItem( i18n( "&Decrease font"), this, TQT_SLOT(onBtnFontDec()), CTRL+Key_Minus ); + m_MenuView->insertItem( i18n( "&View HTML source"), this, TQT_SLOT(onBtnViewSource()), CTRL+Key_U ); m_MenuView->insertSeparator(); - m_MenuView->insertItem( i18n( "&Bookmark this page"), this, SLOT(onBtnAddBookmark()), CTRL+Key_T ); + m_MenuView->insertItem( i18n( "&Bookmark this page"), this, TQT_SLOT(onBtnAddBookmark()), CTRL+Key_T ); m_MenuView->insertSeparator(); m_menuShowFullscreenMenuID = m_MenuView->insertItem( i18n( "&Full screen"), this, - SLOT(onBtnFullScreen()), Key_F11 ); + TQT_SLOT(onBtnFullScreen()), Key_F11 ); m_menuShowContentWindowMenuID = m_MenuView->insertItem( i18n( "&Show contents window"), this, - SLOT(onBtnToggleContentWindow()), Key_F9 ); + TQT_SLOT(onBtnToggleContentWindow()), Key_F9 ); m_MenuView->insertItem( i18n( "&Locate in contents window"), this, - SLOT(onBtnLocateInContentWindow()), CTRL+Key_L ); + TQT_SLOT(onBtnLocateInContentWindow()), CTRL+Key_L ); m_MenuView->setItemChecked( m_menuShowFullscreenMenuID, false ); m_MenuView->setItemChecked( m_menuShowContentWindowMenuID, true ); m_MenuView->insertSeparator(); // Create the language selection menu. - menu_langlist = new KQPopupMenu( parent ); - KQPopupMenu * menu_sublang = 0; + menu_langlist = new KTQPopupMenu( tqparent ); + KTQPopupMenu * menu_sublang = 0; // Because the encoding menu is very large, it is not reasonable to have a slot for every item. // It is simplier just to use a single slot for any menu item of this submenu. - connect (menu_langlist, SIGNAL( activated(int) ), this, SLOT ( onMenuActivated(int) )); + connect (menu_langlist, TQT_SIGNAL( activated(int) ), this, TQT_SLOT ( onMenuActivated(int) )); // Add the language entries const LCHMTextEncoding * enctable = LCHMFileImpl::getTextEncodingTable(); @@ -196,8 +196,8 @@ KCHMSearchAndViewToolbar::KCHMSearchAndViewToolbar( KCHMMainWindow * parent ) // If the menu is already created, add to it if ( !menu_sublang ) { - menu_sublang = new KQPopupMenu( menu_langlist ); - connect (menu_sublang, SIGNAL( activated(int) ), this, SLOT ( onMenuActivated(int) )); + menu_sublang = new KTQPopupMenu( menu_langlist ); + connect (menu_sublang, TQT_SIGNAL( activated(int) ), this, TQT_SLOT ( onMenuActivated(int) )); } menu_sublang->insertItem( item->sublanguage, idx ); @@ -222,10 +222,10 @@ KCHMSearchAndViewToolbar::KCHMSearchAndViewToolbar( KCHMMainWindow * parent ) m_checkedLanguageInMenu = -1; // Special menu for very smart people just to select codepage - QMap addedCharsets; - menu_enclist = new KQPopupMenu( parent ); + TQMap addedCharsets; + menu_enclist = new KTQPopupMenu( tqparent ); - connect (menu_enclist, SIGNAL( activated(int) ), this, SLOT ( onMenuActivated(int) )); + connect (menu_enclist, TQT_SIGNAL( activated(int) ), this, TQT_SLOT ( onMenuActivated(int) )); // Add the codepage entries for ( idx = 0; (enctable + idx)->language; idx++ ) @@ -233,7 +233,7 @@ KCHMSearchAndViewToolbar::KCHMSearchAndViewToolbar( KCHMMainWindow * parent ) const LCHMTextEncoding * item = enctable + idx; // This menu is only for charsets, so we won't add duplicate charset twice - if ( addedCharsets.find( item->qtcodec ) != addedCharsets.end() ) + if ( addedCharsets.tqfind( item->qtcodec ) != addedCharsets.end() ) continue; addedCharsets[ item->qtcodec ] = true; @@ -242,7 +242,7 @@ KCHMSearchAndViewToolbar::KCHMSearchAndViewToolbar( KCHMMainWindow * parent ) m_MenuView->insertItem( i18n( "&Set codepage"), menu_enclist ); - QWhatsThis::whatsThisButton( this ); + TQWhatsThis::whatsThisButton( this ); } void KCHMSearchAndViewToolbar::setEnabled( bool enable ) @@ -277,7 +277,7 @@ void KCHMSearchAndViewToolbar::onBtnNextSearchResult( ) void KCHMSearchAndViewToolbar::search( bool search_forward ) { - QString searchexpr = m_findBox->lineEdit()->text(); + TQString searchexpr = m_findBox->lineEdit()->text(); if ( searchexpr.isEmpty() ) return; @@ -297,23 +297,23 @@ void KCHMSearchAndViewToolbar::onBtnFontDec( ) void KCHMSearchAndViewToolbar::onBtnViewSource( ) { - QString text; + TQString text; if ( !::mainWindow->chmFile()->getFileContentAsString( &text, ::mainWindow->currentBrowser()->getOpenedPage() ) ) return; if ( appConfig.m_advUseInternalEditor ) { - QTextEdit * editor = new QTextEdit ( 0 ); - editor->setTextFormat ( Qt::PlainText ); + TQTextEdit * editor = new TQTextEdit ( 0 ); + editor->setTextFormat ( TQt::PlainText ); editor->setText (text); - editor->setCaption ( QString(APP_NAME) + " - view HTML source of " + ::mainWindow->currentBrowser()->getOpenedPage() ); + editor->setCaption ( TQString(APP_NAME) + " - view HTML source of " + ::mainWindow->currentBrowser()->getOpenedPage() ); editor->resize (800, 600); editor->show(); } else { - QFile file; + TQFile file; m_tempFileKeeper.generateTempFile( file ); file.writeBlock( text.utf8() ); @@ -377,7 +377,7 @@ void KCHMSearchAndViewToolbar::onBtnNextPageInToc() if ( !current ) return; - QListViewItemIterator lit( current ); + TQListViewItemIterator lit( current ); lit++; if ( lit.current() ) @@ -397,7 +397,7 @@ void KCHMSearchAndViewToolbar::onBtnPrevPageInToc() if ( !current ) return; - QListViewItemIterator lit( current ); + TQListViewItemIterator lit( current ); lit--; if ( lit.current() ) -- cgit v1.2.3