summaryrefslogtreecommitdiffstats
path: root/parts/documentation/searchview.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:56:07 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:56:07 +0000
commitd6f8bbb45b267065a6907e71ff9c98bb6d161241 (patch)
treed109539636691d7b03036ca1c0ed29dbae6577cf /parts/documentation/searchview.cpp
parent3331a47a9cad24795c7440ee8107143ce444ef34 (diff)
downloadtdevelop-d6f8bbb45b267065a6907e71ff9c98bb6d161241.tar.gz
tdevelop-d6f8bbb45b267065a6907e71ff9c98bb6d161241.zip
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1157658 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'parts/documentation/searchview.cpp')
-rw-r--r--parts/documentation/searchview.cpp128
1 files changed, 64 insertions, 64 deletions
diff --git a/parts/documentation/searchview.cpp b/parts/documentation/searchview.cpp
index 66ac48f7..c7b2305a 100644
--- a/parts/documentation/searchview.cpp
+++ b/parts/documentation/searchview.cpp
@@ -23,12 +23,12 @@
***************************************************************************/
#include "searchview.h"
-#include <qlayout.h>
-#include <qlabel.h>
-#include <qfile.h>
-#include <qtextstream.h>
-#include <qdir.h>
-#include <qregexp.h>
+#include <tqlayout.h>
+#include <tqlabel.h>
+#include <tqfile.h>
+#include <tqtextstream.h>
+#include <tqdir.h>
+#include <tqregexp.h>
#include <kpushbutton.h>
#include <klistview.h>
@@ -49,66 +49,66 @@
#include "documentation_part.h"
#include "docutils.h"
-SearchView::SearchView(DocumentationPart *part, QWidget *parent, const char *name)
- :QWidget(parent, name), m_part(part)
+SearchView::SearchView(DocumentationPart *part, TQWidget *parent, const char *name)
+ :TQWidget(parent, name), m_part(part)
{
- QVBoxLayout *l = new QVBoxLayout(this, 0, KDialog::spacingHint());
+ TQVBoxLayout *l = new TQVBoxLayout(this, 0, KDialog::spacingHint());
- QVBoxLayout *l2 = new QVBoxLayout(l, 0);
- QLabel *editLabel = new QLabel(i18n("Wor&ds to search:"), this);
+ TQVBoxLayout *l2 = new TQVBoxLayout(l, 0);
+ TQLabel *editLabel = new TQLabel(i18n("Wor&ds to search:"), this);
l2->addWidget(editLabel);
- QHBoxLayout *l21 = new QHBoxLayout(l2, 0);
+ TQHBoxLayout *l21 = new TQHBoxLayout(l2, 0);
m_edit = new KLineEdit(this);
editLabel->setBuddy(m_edit);
m_goSearchButton = new KPushButton(i18n("Se&arch"), this);
l21->addWidget(m_edit);
l21->addWidget(m_goSearchButton);
- QGridLayout *l3 = new QGridLayout(l, 2, 2, 0);
+ TQGridLayout *l3 = new TQGridLayout(l, 2, 2, 0);
m_searchMethodBox = new KComboBox(this);
m_searchMethodBox->insertItem(i18n("and"));
m_searchMethodBox->insertItem(i18n("or"));
- QLabel *smLabel = new QLabel(m_searchMethodBox, i18n("&Method:"), this);
+ TQLabel *smLabel = new TQLabel(m_searchMethodBox, i18n("&Method:"), this);
m_sortMethodBox = new KComboBox(this);
m_sortMethodBox->insertItem(i18n("Score"));
m_sortMethodBox->insertItem(i18n("Title"));
m_sortMethodBox->insertItem(i18n("Date"));
- QLabel *rmLabel = new QLabel(m_sortMethodBox, i18n("S&ort by:"), this);
+ TQLabel *rmLabel = new TQLabel(m_sortMethodBox, i18n("S&ort by:"), this);
l3->addWidget(smLabel, 0, 0);
l3->addWidget(m_searchMethodBox, 0, 1);
l3->addWidget(rmLabel, 1, 0);
l3->addWidget(m_sortMethodBox, 1, 1);
- QVBoxLayout *l4 = new QVBoxLayout(l, 0);
+ TQVBoxLayout *l4 = new TQVBoxLayout(l, 0);
m_view = new KListView(this);
- QLabel *vLabel = new QLabel(m_view, i18n("Search &results:"), this);
+ TQLabel *vLabel = new TQLabel(m_view, i18n("Search &results:"), this);
l4->addWidget(vLabel);
l4->addWidget(m_view);
- QHBoxLayout *l5 = new QHBoxLayout(l, KDialog::spacingHint());
+ TQHBoxLayout *l5 = new TQHBoxLayout(l, KDialog::spacingHint());
m_configButton = new KPushButton(i18n("Update Config"), this);
m_indexButton = new KPushButton(i18n("Update Index"), this);
l5->addWidget(m_configButton);
l5->addWidget(m_indexButton);
- l5->addItem(new QSpacerItem(1, 1, QSizePolicy::Expanding, QSizePolicy::Fixed));
+ l5->addItem(new TQSpacerItem(1, 1, TQSizePolicy::Expanding, TQSizePolicy::Fixed));
l->addSpacing(2);
m_view->setSorting(-1);
m_view->addColumn(i18n("Relevance"));
m_view->addColumn(i18n("Title"));
- m_view->setColumnWidthMode(0, QListView::Maximum);
- m_view->setColumnWidthMode(1, QListView::Maximum);
+ m_view->setColumnWidthMode(0, TQListView::Maximum);
+ m_view->setColumnWidthMode(1, TQListView::Maximum);
m_view->setAllColumnsShowFocus(true);
- m_view->setResizeMode( QListView::LastColumn );
-
- connect(m_configButton, SIGNAL(clicked()), this, SLOT(updateConfig()));
- connect(m_indexButton, SIGNAL(clicked()), this, SLOT(updateIndex()));
- connect(m_edit, SIGNAL(returnPressed()), this, SLOT(search()));
- connect(m_goSearchButton, SIGNAL(clicked()), this, SLOT(search()));
- connect(m_view, SIGNAL(executed(QListViewItem*)), this, SLOT(executed(QListViewItem*)));
- connect(m_view, SIGNAL(mouseButtonPressed(int, QListViewItem*, const QPoint&, int )),
- this, SLOT(itemMouseButtonPressed(int, QListViewItem*, const QPoint&, int )));
+ m_view->setResizeMode( TQListView::LastColumn );
+
+ connect(m_configButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(updateConfig()));
+ connect(m_indexButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(updateIndex()));
+ connect(m_edit, TQT_SIGNAL(returnPressed()), this, TQT_SLOT(search()));
+ connect(m_goSearchButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(search()));
+ connect(m_view, TQT_SIGNAL(executed(TQListViewItem*)), this, TQT_SLOT(executed(TQListViewItem*)));
+ connect(m_view, TQT_SIGNAL(mouseButtonPressed(int, TQListViewItem*, const TQPoint&, int )),
+ this, TQT_SLOT(itemMouseButtonPressed(int, TQListViewItem*, const TQPoint&, int )));
}
SearchView::~SearchView()
@@ -129,15 +129,15 @@ void SearchView::updateIndex()
config->sync();
}
-void SearchView::runHtdig(const QString &arg)
+void SearchView::runHtdig(const TQString &arg)
{
KProcess proc;
proc << "kdevelop-htdig" << arg;
proc.start(KProcess::DontCare);
}
-void qt_enter_modal(QWidget *widget);
-void qt_leave_modal(QWidget *widget);
+void qt_enter_modal(TQWidget *widget);
+void qt_leave_modal(TQWidget *widget);
void SearchView::search()
{
@@ -152,7 +152,7 @@ void SearchView::search()
updateIndex();
return;
}
- QString exe = config->readPathEntry("htsearchbin", kapp->dirs()->findExe("htsearch"));
+ TQString exe = config->readPathEntry("htsearchbin", kapp->dirs()->findExe("htsearch"));
if (exe.isEmpty())
{
KMessageBox::error(this, i18n("Cannot find the htsearch executable.\nIt is part of the ht://Dig package that is used by KDevelop to perform full text search. Please install ht://Dig and use Documentation page in Configure KDevelop dialog to set the htsearch location."));
@@ -160,16 +160,16 @@ void SearchView::search()
return;
}
- QString indexdir = kapp->dirs()->saveLocation("data", "kdevdocumentation/search");
- QDir d;
- if (indexdir.isEmpty() || !QFile::exists(indexdir + "/htdig.conf"))
+ TQString indexdir = kapp->dirs()->saveLocation("data", "kdevdocumentation/search");
+ TQDir d;
+ if (indexdir.isEmpty() || !TQFile::exists(indexdir + "/htdig.conf"))
{
- if (QFile::exists("/var/lib/kdevelop3/helpindex/htdig.conf"))
+ if (TQFile::exists("/var/lib/kdevelop3/helpindex/htdig.conf"))
indexdir = "/var/lib/kdevelop3/helpindex";
- else if (QFile::exists("/var/lib/kdevelop/helpindex/htdig.conf"))
+ else if (TQFile::exists("/var/lib/kdevelop/helpindex/htdig.conf"))
indexdir = "/var/lib/kdevelop/helpindex";
- if (!QFile::exists(indexdir + "/htdig.conf"))
+ if (!TQFile::exists(indexdir + "/htdig.conf"))
{
KMessageBox::error(this, i18n("Cannot find the htdig configuration file."));
kdDebug() << "Cannot find the htdig configuration file" << endl;
@@ -177,11 +177,11 @@ void SearchView::search()
}
}
- QString savedir = kapp->dirs()->saveLocation("data", "kdevdocumentation/search");
+ TQString savedir = kapp->dirs()->saveLocation("data", "kdevdocumentation/search");
if (!d.exists(savedir))
d.mkdir(savedir);
- QString query = QString("words=%1;method=%2;matchesperpage=%3;format=%4;sort=%5")
+ TQString query = TQString("words=%1;method=%2;matchesperpage=%3;format=%4;sort=%5")
.arg(m_edit->text())
.arg(m_searchMethodBox->currentItem()==1? "or" : "and")
.arg(50)
@@ -191,14 +191,14 @@ void SearchView::search()
kdDebug(9002) << "starting kprocess" << endl;
kdDebug(9002) << "htdig line:" << exe << " -c " << (indexdir + "/htdig.conf ") << query << endl;
KProcess *proc = new KProcess;
- QString picdir = kapp->dirs()->findResourceDir("data", "kdevdocumentation/pics/htdig.png");
+ TQString picdir = kapp->dirs()->findResourceDir("data", "kdevdocumentation/pics/htdig.png");
proc->setEnvironment("PICDIR", picdir);
*proc << exe << "-c" << (indexdir + "/htdig.conf") << query;
- connect( proc, SIGNAL(receivedStdout(KProcess *,char*,int)),
- this, SLOT(htsearchStdout(KProcess *,char*,int)) );
- connect( proc, SIGNAL(processExited(KProcess *)),
- this, SLOT(htsearchExited(KProcess *)) );
+ connect( proc, TQT_SIGNAL(receivedStdout(KProcess *,char*,int)),
+ this, TQT_SLOT(htsearchStdout(KProcess *,char*,int)) );
+ connect( proc, TQT_SIGNAL(processExited(KProcess *)),
+ this, TQT_SLOT(htsearchExited(KProcess *)) );
searchResult = "";
@@ -214,7 +214,7 @@ void SearchView::search()
// to block the user interface, but still get repaint
// events. Hack taken from NetAccess...
kapp->setOverrideCursor(waitCursor);
- QWidget blocker(0, 0, WType_Dialog | WShowModal);
+ TQWidget blocker(0, 0, WType_Dialog | WShowModal);
qt_enter_modal(&blocker);
kapp->enter_loop();
qt_leave_modal(&blocker);
@@ -230,14 +230,14 @@ void SearchView::search()
delete proc;
// modify the search result
- searchResult = searchResult.replace(QRegExp("http://localhost/"), "file:/");
- searchResult = searchResult.replace(QRegExp("Content-type: text/html"), "");
+ searchResult = searchResult.replace(TQRegExp("http://localhost/"), "file:/");
+ searchResult = searchResult.replace(TQRegExp("Content-type: text/html"), "");
// dump the search result
- QFile f(savedir + "/results.html");
+ TQFile f(savedir + "/results.html");
if (f.open(IO_WriteOnly))
{
- QTextStream ts(&f);
+ TQTextStream ts(&f);
ts << searchResult << endl;
f.close();
}
@@ -249,7 +249,7 @@ void SearchView::search()
void SearchView::htsearchStdout(KProcess *, char *buffer, int len)
{
- searchResult += QString::fromLocal8Bit(buffer, len);
+ searchResult += TQString::fromLocal8Bit(buffer, len);
}
void SearchView::htsearchExited(KProcess *)
@@ -260,23 +260,23 @@ void SearchView::htsearchExited(KProcess *)
void SearchView::analyseSearchResults()
{
m_view->clear();
- QTextStream str(searchResult, IO_ReadOnly);
+ TQTextStream str(searchResult, IO_ReadOnly);
DocumentationItem *former = 0;
while (!str.eof())
{
- QString line = str.readLine();
+ TQString line = str.readLine();
- QRegExp starsExp("alt=\"\\*\"");
+ TQRegExp starsExp("alt=\"\\*\"");
starsExp.setMinimal(true);
int stars = line.contains(starsExp);
- QRegExp urlExp("<strong><a href=\"(.*)\">(.*)</a></strong>");
+ TQRegExp urlExp("<strong><a href=\"(.*)\">(.*)</a></strong>");
if (urlExp.search(line)==-1)
continue;
- QString url = urlExp.cap(1);
- QString title = urlExp.cap(2);
+ TQString url = urlExp.cap(1);
+ TQString title = urlExp.cap(2);
- QString starsStr;
+ TQString starsStr;
for (int i = 0; i < stars; ++i)
starsStr += "*";
@@ -291,7 +291,7 @@ void SearchView::analyseSearchResults()
executed( m_view->firstChild() );
}
-void SearchView::executed(QListViewItem *item)
+void SearchView::executed(TQListViewItem *item)
{
DocumentationItem *d = dynamic_cast<DocumentationItem*>(item);
if (!d)
@@ -300,7 +300,7 @@ void SearchView::executed(QListViewItem *item)
m_part->partController()->showDocument(d->url());
}
-void SearchView::itemMouseButtonPressed(int button, QListViewItem *item, const QPoint &pos, int // c
+void SearchView::itemMouseButtonPressed(int button, TQListViewItem *item, const TQPoint &pos, int // c
)
{
if ((button != Qt::RightButton) || (!item))
@@ -312,7 +312,7 @@ void SearchView::itemMouseButtonPressed(int button, QListViewItem *item, const Q
DocUtils::docItemPopup(m_part, docItem, pos, true, false, 1);
}
-void SearchView::setSearchTerm(const QString &term)
+void SearchView::setSearchTerm(const TQString &term)
{
m_edit->setText(term);
}
@@ -322,7 +322,7 @@ void SearchView::askSearchTerm()
m_edit->setFocus();
}
-void SearchView::focusInEvent(QFocusEvent */*e*/)
+void SearchView::focusInEvent(TQFocusEvent */*e*/)
{
m_edit->setFocus();
}