diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-18 17:00:31 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-18 17:00:31 +0000 |
commit | 395a904bff7b4d6ead445c342f7ac0c5fbf29121 (patch) | |
tree | 9829cadb79d2cc7c29a940627fadb28b11e54150 /konq-plugins/searchbar | |
parent | 399f47c376fdf4d19192732a701ea9578d11619d (diff) | |
download | tdeaddons-395a904bff7b4d6ead445c342f7ac0c5fbf29121.tar.gz tdeaddons-395a904bff7b4d6ead445c342f7ac0c5fbf29121.zip |
TQt4 port kdeaddons
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeaddons@1237404 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'konq-plugins/searchbar')
-rw-r--r-- | konq-plugins/searchbar/searchbar.cpp | 62 | ||||
-rw-r--r-- | konq-plugins/searchbar/searchbar.h | 6 |
2 files changed, 37 insertions, 31 deletions
diff --git a/konq-plugins/searchbar/searchbar.cpp b/konq-plugins/searchbar/searchbar.cpp index b8cd24c..b4cf210 100644 --- a/konq-plugins/searchbar/searchbar.cpp +++ b/konq-plugins/searchbar/searchbar.cpp @@ -57,9 +57,9 @@ K_EXPORT_COMPONENT_FACTORY(libsearchbarplugin, SearchBarPluginFactory("searchbarplugin")) -SearchBarPlugin::SearchBarPlugin(TQObject *parent, const char *name, +SearchBarPlugin::SearchBarPlugin(TQObject *tqparent, const char *name, const TQStringList &) : - KParts::Plugin(parent, name), + KParts::Plugin(tqparent, name), m_searchCombo(0), m_searchMode(UseSearchProvider), m_urlEnterLock(false), @@ -94,7 +94,7 @@ SearchBarPlugin::SearchBarPlugin(TQObject *parent, const char *name, configurationChanged(); - KParts::MainWindow *mainWin = static_cast<KParts::MainWindow*>(parent); + KParts::MainWindow *mainWin = static_cast<KParts::MainWindow*>(TQT_TQWIDGET(tqparent)); //Grab the part manager. Don't know of any other way, and neither does Tronical, so.. KParts::PartManager *partMan = static_cast<KParts::PartManager*>(mainWin->child(0, "KParts::PartManager")); @@ -132,13 +132,13 @@ TQChar delimiter() bool SearchBarPlugin::eventFilter(TQObject *o, TQEvent *e) { - if( o==m_searchCombo->lineEdit() && e->type() == TQEvent::KeyPress ) + if( TQT_BASE_OBJECT(o)==TQT_BASE_OBJECT(m_searchCombo->lineEdit()) && e->type() == TQEvent::KeyPress ) { TQKeyEvent *k = (TQKeyEvent *)e; TQString text = k->text(); if(!text.isEmpty()) { - if(k->key() != Qt::Key_Return && k->key() != Key_Enter && k->key() != Key_Escape) + if(k->key() != TQt::Key_Return && k->key() != Key_Enter && k->key() != Key_Escape) { emit gsCompleteDelayed(); } @@ -162,7 +162,7 @@ bool SearchBarPlugin::eventFilter(TQObject *o, TQEvent *e) { if(m_searchCombo->listBox()->isVisible()) { - qApp->sendEvent(m_searchCombo->listBox(), e); + tqApp->sendEvent(m_searchCombo->listBox(), e); return true; } } @@ -174,7 +174,7 @@ bool SearchBarPlugin::eventFilter(TQObject *o, TQEvent *e) the listbox was visible. if(m_searchCombo->listBox()->isVisible()) { - qApp->sendEvent(m_searchCombo->listBox(),e); + tqApp->sendEvent(m_searchCombo->listBox(),e); }*/ } if (k->key() == Key_Escape) @@ -206,7 +206,7 @@ void SearchBarPlugin::nextSearchEntry() } else { - TQStringList::ConstIterator it = m_searchEngines.find(m_currentEngine); + TQStringList::ConstIterator it = m_searchEngines.tqfind(m_currentEngine); it++; if(it==m_searchEngines.end()) { @@ -236,7 +236,7 @@ void SearchBarPlugin::previousSearchEntry() } else { - TQStringList::ConstIterator it = m_searchEngines.find(m_currentEngine); + TQStringList::ConstIterator it = m_searchEngines.tqfind(m_currentEngine); if(it==m_searchEngines.begin()) { m_searchMode = FindInThisPage; @@ -273,7 +273,7 @@ void SearchBarPlugin::startSearch(const TQString &_search) TQStringList list; list << "kurisearchfilter" << "kuriikwsfilter"; - service = KService::serviceByDesktopPath(TQString("searchproviders/%1.desktop").arg(m_currentEngine)); + service = KService::serviceByDesktopPath(TQString("searchproviders/%1.desktop").tqarg(m_currentEngine)); if (service) { const TQString searchProviderPrefix = *(service->property("Keys").toStringList().begin()) + delimiter(); data.setData( searchProviderPrefix + search ); @@ -281,11 +281,11 @@ void SearchBarPlugin::startSearch(const TQString &_search) if(!service || !KURIFilter::self()->filterURI(data, list)) { - data.setData( TQString::fromLatin1( "google" ) + delimiter() + search ); + data.setData( TQString::tqfromLatin1( "google" ) + delimiter() + search ); KURIFilter::self()->filterURI( data, list ); } - if(KApplication::keyboardMouseState() & Qt::ControlButton) + if(KApplication::keyboardMouseState() & TQt::ControlButton) { KParts::URLArgs args; args.setNewTab(true); @@ -318,7 +318,7 @@ void SearchBarPlugin::setIcon() TQString hinttext; if(m_searchMode == FindInThisPage) { - m_searchIcon = SmallIcon("find"); + m_searchIcon = SmallIcon("tqfind"); hinttext = i18n("Find in This Page"); } else @@ -329,7 +329,7 @@ void SearchBarPlugin::setIcon() TQStringList list; list << "kurisearchfilter" << "kuriikwsfilter"; - service = KService::serviceByDesktopPath(TQString("searchproviders/%1.desktop").arg(m_currentEngine)); + service = KService::serviceByDesktopPath(TQString("searchproviders/%1.desktop").tqarg(m_currentEngine)); if (service) { const TQString searchProviderPrefix = *(service->property("Keys").toStringList().begin()) + delimiter(); data.setData( searchProviderPrefix + "some keyword" ); @@ -353,7 +353,7 @@ void SearchBarPlugin::setIcon() m_searchIcon = SmallIcon("google"); providername = "Google"; } - hinttext = i18n("%1 Search").arg(providername);; + hinttext = i18n("%1 Search").tqarg(providername);; } static_cast<KLineEdit*>(m_searchCombo->lineEdit())->setClickMessage(hinttext); @@ -363,8 +363,8 @@ void SearchBarPlugin::setIcon() TQPainter p( &arrowmap ); p.drawPixmap(0, 2, m_searchIcon); TQStyle::SFlags arrowFlags = TQStyle::Style_Default; - m_searchCombo->style().drawPrimitive(TQStyle::PE_ArrowDown, &p, TQRect(arrowmap.width()-6, - arrowmap.height()-6, 6, 5), m_searchCombo->colorGroup(), arrowFlags, TQStyleOption() ); + m_searchCombo->tqstyle().tqdrawPrimitive(TQStyle::PE_ArrowDown, &p, TQRect(arrowmap.width()-6, + arrowmap.height()-6, 6, 5), m_searchCombo->tqcolorGroup(), arrowFlags, TQStyleOption() ); p.end(); m_searchIcon = arrowmap; @@ -382,14 +382,14 @@ void SearchBarPlugin::showSelectionMenu() list << "kurisearchfilter" << "kuriikwsfilter"; m_popupMenu = new TQPopupMenu(m_searchCombo, "search selection menu"); - m_popupMenu->insertItem(SmallIcon("find"), i18n("Find in This Page"), this, TQT_SLOT(useFindInThisPage()), 0, 999); + m_popupMenu->insertItem(SmallIcon("tqfind"), i18n("Find in This Page"), this, TQT_SLOT(useFindInThisPage()), 0, 999); m_popupMenu->insertSeparator(); int i=-1; for (TQStringList::ConstIterator it = m_searchEngines.begin(); it != m_searchEngines.end(); ++it ) { i++; - service = KService::serviceByDesktopPath(TQString("searchproviders/%1.desktop").arg(*it)); + service = KService::serviceByDesktopPath(TQString("searchproviders/%1.desktop").tqarg(*it)); if(!service) { continue; @@ -413,7 +413,7 @@ void SearchBarPlugin::showSelectionMenu() } m_popupMenu->insertSeparator(); - m_googleMenu = new KSelectAction(i18n("Use Google Suggest"), SmallIconSet("ktip"), 0, this, TQT_SLOT(selectGoogleSuggestMode()), m_popupMenu); + m_googleMenu = new KSelectAction(i18n("Use Google Suggest"), SmallIconSet("ktip"), 0, TQT_TQOBJECT(this), TQT_SLOT(selectGoogleSuggestMode()), TQT_TQOBJECT(m_popupMenu)); TQStringList google_modes; google_modes << i18n("For Google Only") << i18n("For All Searches") << i18n("Never"); m_googleMenu->setItems(google_modes); @@ -515,7 +515,7 @@ void SearchBarPlugin::configurationChanged() void SearchBarPlugin::partChanged(KParts::Part *newPart) { - m_part = ::qt_cast<KHTMLPart*>(newPart); + m_part = ::tqqt_cast<KHTMLPart*>(newPart); //Delay since when destroying tabs part 0 gets activated for a bit, before the proper part TQTimer::singleShot(0, this, TQT_SLOT(updateComboVisibility())); @@ -537,13 +537,17 @@ void SearchBarPlugin::updateComboVisibility() void SearchBarPlugin::focusSearchbar() { +#ifdef USE_QT4 + m_searchCombo->setFocus(); +#else // USE_QT4 TQFocusEvent::setReason( TQFocusEvent::Shortcut ); m_searchCombo->setFocus(); TQFocusEvent::resetReason(); +#endif // USE_QT4 } -SearchBarCombo::SearchBarCombo(TQWidget *parent, const char *name) : - KHistoryCombo(parent, name), +SearchBarCombo::SearchBarCombo(TQWidget *tqparent, const char *name) : + KHistoryCombo(tqparent, name), m_pluginActive(true) { connect(this, TQT_SIGNAL(cleared()), TQT_SLOT(historyCleared())); @@ -586,7 +590,7 @@ int SearchBarCombo::findHistoryItem(const TQString &searchText) void SearchBarCombo::mousePressEvent(TQMouseEvent *e) { - int x0 = TQStyle::visualRect( style().querySubControlMetrics( TQStyle::CC_ComboBox, this, TQStyle::SC_ComboBoxEditField ), this ).x(); + int x0 = TQStyle::tqvisualRect( tqstyle().querySubControlMetrics( TQStyle::CC_ComboBox, this, TQStyle::SC_ComboBoxEditField ), this ).x(); if(e->x() > x0 + 2 && e->x() < lineEdit()->x()) { @@ -677,12 +681,12 @@ void SearchBarPlugin::gsJobFinished(KIO::Job* job) if (((KIO::TransferJob*)job)->error() == 0) { TQString temp; - temp = m_gsData.mid(m_gsData.find('(') + 1, m_gsData.findRev(')') - m_gsData.find('(') - 1); - temp = temp.mid(temp.find('(') + 1, temp.find(')') - temp.find('(') - 1); + temp = m_gsData.mid(m_gsData.tqfind('(') + 1, m_gsData.tqfindRev(')') - m_gsData.tqfind('(') - 1); + temp = temp.mid(temp.tqfind('(') + 1, temp.tqfind(')') - temp.tqfind('(') - 1); temp.remove('"'); TQStringList compList1 = TQStringList::split(',', temp); - temp = m_gsData.mid(m_gsData.find(')') + 1, m_gsData.findRev(')') - m_gsData.find('(') - 1); - temp = temp.mid(temp.find('(') + 1, temp.find(')') - temp.find('(') - 1); + temp = m_gsData.mid(m_gsData.tqfind(')') + 1, m_gsData.tqfindRev(')') - m_gsData.tqfind('(') - 1); + temp = temp.mid(temp.tqfind('(') + 1, temp.tqfind(')') - temp.tqfind('(') - 1); temp.remove('"'); temp.remove(','); temp.remove('s'); @@ -719,7 +723,7 @@ void SearchBarPlugin::gsSetCompletedText(const TQString& text) currentText = m_searchCombo->currentText(); if (currentText == text.left(currentText.length())) { - m_searchCombo->lineEdit()->setText(text.left(text.find('(') - 1)); + m_searchCombo->lineEdit()->setText(text.left(text.tqfind('(') - 1)); m_searchCombo->lineEdit()->setCursorPosition(currentText.length()); m_searchCombo->lineEdit()->setSelection(currentText.length(), m_searchCombo->currentText().length() - currentText.length()); } diff --git a/konq-plugins/searchbar/searchbar.h b/konq-plugins/searchbar/searchbar.h index b97f82c..3f032ed 100644 --- a/konq-plugins/searchbar/searchbar.h +++ b/konq-plugins/searchbar/searchbar.h @@ -42,12 +42,13 @@ class TQTimer; class SearchBarCombo : public KHistoryCombo { Q_OBJECT + TQ_OBJECT public: /** * Constructor. */ - SearchBarCombo(TQWidget *parent, const char *name); + SearchBarCombo(TQWidget *tqparent, const char *name); /** * Returns the icon currently displayed in the combo box. @@ -106,12 +107,13 @@ class SearchBarCombo : public KHistoryCombo class SearchBarPlugin : public KParts::Plugin { Q_OBJECT + TQ_OBJECT public: /** Possible search modes */ enum SearchModes { FindInThisPage = 0, UseSearchProvider }; - SearchBarPlugin(TQObject *parent, const char *name, + SearchBarPlugin(TQObject *tqparent, const char *name, const TQStringList &); virtual ~SearchBarPlugin(); |