summaryrefslogtreecommitdiffstats
path: root/kdict/queryview.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:48:06 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:48:06 +0000
commit47c8a359c5276062c4bc17f0e82410f29081b502 (patch)
tree2d54a5f60a5b74067632f9ef6df58c2bc38155e6 /kdict/queryview.cpp
parent6f82532777a35e0e60bbd2b290b2e93e646f349b (diff)
downloadtdenetwork-47c8a359c5276062c4bc17f0e82410f29081b502.tar.gz
tdenetwork-47c8a359c5276062c4bc17f0e82410f29081b502.zip
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1157648 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kdict/queryview.cpp')
-rw-r--r--kdict/queryview.cpp142
1 files changed, 71 insertions, 71 deletions
diff --git a/kdict/queryview.cpp b/kdict/queryview.cpp
index a2674d68..045b4e49 100644
--- a/kdict/queryview.cpp
+++ b/kdict/queryview.cpp
@@ -15,8 +15,8 @@
------------------------------------------------------------- */
-#include <qclipboard.h>
-#include <qtimer.h>
+#include <tqclipboard.h>
+#include <tqtimer.h>
#include <kfiledialog.h>
#include <ktempfile.h>
@@ -38,9 +38,9 @@
//******** SaveHelper *******************************************
-QString SaveHelper::lastPath;
+TQString SaveHelper::lastPath;
-SaveHelper::SaveHelper(const QString &saveName, const QString &filter, QWidget *parent)
+SaveHelper::SaveHelper(const TQString &saveName, const TQString &filter, TQWidget *parent)
: p_arent(parent), s_aveName(saveName), f_ilter(filter), file(0), tmpFile(0)
{
}
@@ -61,7 +61,7 @@ SaveHelper::~SaveHelper()
}
-QFile* SaveHelper::getFile(const QString &dialogTitle)
+TQFile* SaveHelper::getFile(const TQString &dialogTitle)
{
url = KFileDialog::getSaveURL(lastPath+s_aveName,f_ilter,p_arent,dialogTitle);
@@ -72,14 +72,14 @@ QFile* SaveHelper::getFile(const QString &dialogTitle)
lastPath.truncate(lastPath.length()-url.fileName().length());
if (url.isLocalFile()) {
- if (QFileInfo(url.path()).exists() &&
+ if (TQFileInfo(url.path()).exists() &&
(KMessageBox::warningContinueCancel(global->topLevel,
i18n("A file named %1 already exists.\nDo you want to replace it?").arg(url.path()),
dialogTitle, i18n("&Replace")) != KMessageBox::Continue)) {
return 0;
}
- file = new QFile(url.path());
+ file = new TQFile(url.path());
if(!file->open(IO_WriteOnly)) {
KMessageBox::error(global->topLevel, i18n("Unable to save file."));
delete file;
@@ -102,14 +102,14 @@ QFile* SaveHelper::getFile(const QString &dialogTitle)
//**** BrowseData ****************************************************
-BrowseData::BrowseData(const QString &Nhtml, const QString &NqueryText)
+BrowseData::BrowseData(const TQString &Nhtml, const TQString &NqueryText)
: html(Nhtml),queryText(NqueryText),xPos(0),yPos(0)
{}
//********* DictHTMLPart ******************************************
-DictHTMLPart::DictHTMLPart(QWidget *parentWidget, const char *widgetname)
+DictHTMLPart::DictHTMLPart(TQWidget *parentWidget, const char *widgetname)
: KHTMLPart(parentWidget,widgetname)
{}
@@ -130,8 +130,8 @@ void DictHTMLPart::khtmlMouseReleaseEvent(khtml::MouseReleaseEvent *event)
//********* QueryView ******************************************
-QueryView::QueryView(QWidget *_parent)
-: QVBox( _parent), actBack(0L), actForward(0L), actQueryCombo(0L), browsePos(0), isRendering(false)
+QueryView::QueryView(TQWidget *_parent)
+: TQVBox( _parent), actBack(0L), actForward(0L), actQueryCombo(0L), browsePos(0), isRendering(false)
{
browseList.setAutoDelete(true);
@@ -140,16 +140,16 @@ QueryView::QueryView(QWidget *_parent)
part->setJScriptEnabled(false);
part->setJavaEnabled(false);
part->setURLCursor(KCursor::handCursor());
- setFocusPolicy(QWidget::NoFocus);
- connect(part, SIGNAL(completed()), SLOT(partCompleted()));
- connect(part, SIGNAL(middleButtonClicked()), SLOT(middleButtonClicked()));
+ setFocusPolicy(TQWidget::NoFocus);
+ connect(part, TQT_SIGNAL(completed()), TQT_SLOT(partCompleted()));
+ connect(part, TQT_SIGNAL(middleButtonClicked()), TQT_SLOT(middleButtonClicked()));
rightBtnMenu = new KPopupMenu(this);
- connect(part,SIGNAL(popupMenu(const QString &, const QPoint &)),this,SLOT(buildPopupMenu(const QString &, const QPoint &)));
- connect(part->browserExtension(),SIGNAL(openURLRequest(const KURL &,const KParts::URLArgs &)),
- this,SLOT(slotURLRequest(const KURL &,const KParts::URLArgs &)));
- connect(part->browserExtension(),SIGNAL(enableAction(const char *,bool)),this,SLOT(enableAction(const char *,bool)));
- QTimer::singleShot( 0, this, SLOT(optionsChanged()) );
- connect(interface,SIGNAL(resultReady(const QString &, const QString &)), SLOT(resultReady(const QString &, const QString &)));
+ connect(part,TQT_SIGNAL(popupMenu(const TQString &, const TQPoint &)),this,TQT_SLOT(buildPopupMenu(const TQString &, const TQPoint &)));
+ connect(part->browserExtension(),TQT_SIGNAL(openURLRequest(const KURL &,const KParts::URLArgs &)),
+ this,TQT_SLOT(slotURLRequest(const KURL &,const KParts::URLArgs &)));
+ connect(part->browserExtension(),TQT_SIGNAL(enableAction(const char *,bool)),this,TQT_SLOT(enableAction(const char *,bool)));
+ TQTimer::singleShot( 0, this, TQT_SLOT(optionsChanged()) );
+ connect(interface,TQT_SIGNAL(resultReady(const TQString &, const TQString &)), TQT_SLOT(resultReady(const TQString &, const TQString &)));
}
@@ -160,9 +160,9 @@ QueryView::~QueryView()
void QueryView::setActions(KToolBarPopupAction* NactBack, KToolBarPopupAction* NactForward, DictComboAction* NactQueryCombo)
{
actBack = NactBack;
- connect(actBack->popupMenu(),SIGNAL(activated(int)),SLOT(browseBack(int)));
+ connect(actBack->popupMenu(),TQT_SIGNAL(activated(int)),TQT_SLOT(browseBack(int)));
actForward = NactForward;
- connect(actForward->popupMenu(),SIGNAL(activated(int)),SLOT(browseForward(int)));
+ connect(actForward->popupMenu(),TQT_SIGNAL(activated(int)),TQT_SLOT(browseForward(int)));
actQueryCombo = NactQueryCombo;
}
@@ -183,26 +183,26 @@ void QueryView::optionsChanged()
{
saveCurrentResultPos();
- currentHTMLHeader = QString("<html><head><style type=\"text/css\">\n");
- currentHTMLHeader += QString("body { background-color:%1; color:%2; }\n").arg(global->backgroundColor().name()).arg(global->textColor().name());
- currentHTMLHeader += QString("a:link, a:active { color:%1; text-decoration:none; }\n").arg(global->linksColor().name());
- currentHTMLHeader += QString("a:visited { color:%1; text-decoration:none; }\n").arg(global->visitedLinksColor().name());
- currentHTMLHeader += QString("a:hover { color:%1; text-decoration:underline; }\n").arg(global->linksColor().name());
- currentHTMLHeader += QString("p.heading { margin-left:0mm; margin-top:2mm; margin-bottom:2mm; padding:1mm; background-color:%1; color:%2; font-family:%3; font-size:%4pt; ").arg(global->headingsBackgroundColor().name()).arg(global->headingsTextColor().name()).arg(global->headingsFont().family()).arg(global->headingsFont().pointSize());
+ currentHTMLHeader = TQString("<html><head><style type=\"text/css\">\n");
+ currentHTMLHeader += TQString("body { background-color:%1; color:%2; }\n").arg(global->backgroundColor().name()).arg(global->textColor().name());
+ currentHTMLHeader += TQString("a:link, a:active { color:%1; text-decoration:none; }\n").arg(global->linksColor().name());
+ currentHTMLHeader += TQString("a:visited { color:%1; text-decoration:none; }\n").arg(global->visitedLinksColor().name());
+ currentHTMLHeader += TQString("a:hover { color:%1; text-decoration:underline; }\n").arg(global->linksColor().name());
+ currentHTMLHeader += TQString("p.heading { margin-left:0mm; margin-top:2mm; margin-bottom:2mm; padding:1mm; background-color:%1; color:%2; font-family:%3; font-size:%4pt; ").arg(global->headingsBackgroundColor().name()).arg(global->headingsTextColor().name()).arg(global->headingsFont().family()).arg(global->headingsFont().pointSize());
if (global->headingsFont().italic())
- currentHTMLHeader += QString("font-style:italic; ");
+ currentHTMLHeader += TQString("font-style:italic; ");
if (global->headingsFont().bold())
- currentHTMLHeader += QString("font-weight:bold; ");
- currentHTMLHeader += QString("}\n");
- currentHTMLHeader += QString("p.definition { margin-left:1.5mm; margin-top:2mm; margin-bottom:2mm;}\n");
- currentHTMLHeader += QString("table { margin-left:1.5mm; margin-top:2mm; margin-bottom:2mm;}\n");
- currentHTMLHeader += QString("pre { font-family:%1; font-size:%2pt; ").arg(global->textFont().family()).arg(global->textFont().pointSize());
+ currentHTMLHeader += TQString("font-weight:bold; ");
+ currentHTMLHeader += TQString("}\n");
+ currentHTMLHeader += TQString("p.definition { margin-left:1.5mm; margin-top:2mm; margin-bottom:2mm;}\n");
+ currentHTMLHeader += TQString("table { margin-left:1.5mm; margin-top:2mm; margin-bottom:2mm;}\n");
+ currentHTMLHeader += TQString("pre { font-family:%1; font-size:%2pt; ").arg(global->textFont().family()).arg(global->textFont().pointSize());
if (global->textFont().italic())
- currentHTMLHeader += QString("font-style:italic; ");
+ currentHTMLHeader += TQString("font-style:italic; ");
if (global->textFont().bold())
- currentHTMLHeader += QString("font-weight:bold; ");
- currentHTMLHeader += QString("}\n");
- currentHTMLHeader += QString("</style></head>\n");
+ currentHTMLHeader += TQString("font-weight:bold; ");
+ currentHTMLHeader += TQString("}\n");
+ currentHTMLHeader += TQString("</style></head>\n");
showResult(); // apply changes directly
}
@@ -230,14 +230,14 @@ void QueryView::saveQuery()
{
if (!browseList.isEmpty()) {
BrowseData* brw = browseList.at(browsePos);
- QString fName = brw->queryText+".html";
- fName.replace(QRegExp("[\\s/]"),"_");
+ TQString fName = brw->queryText+".html";
+ fName.replace(TQRegExp("[\\s/]"),"_");
SaveHelper helper(fName,"*.html",global->topLevel);
- QFile *file = helper.getFile(QString::null);
+ TQFile *file = helper.getFile(TQString::null);
if (file) {
- QTextStream stream(file);
- stream.setEncoding(QTextStream::Locale);
+ TQTextStream stream(file);
+ stream.setEncoding(TQTextStream::Locale);
stream << currentHTMLHeader+brw->html;
}
}
@@ -288,14 +288,14 @@ void QueryView::showFindDialog()
}
-void QueryView::paletteChange ( const QPalette & )
+void QueryView::paletteChange ( const TQPalette & )
{
optionsChanged();
}
-void QueryView::fontChange ( const QFont & )
+void QueryView::fontChange ( const TQFont & )
{
optionsChanged();
}
@@ -331,7 +331,7 @@ void QueryView::showResult()
}
-void QueryView::resultReady(const QString &result, const QString &query)
+void QueryView::resultReady(const TQString &result, const TQString &query)
{
BrowseData* brw = new BrowseData(result,query);
@@ -370,8 +370,8 @@ void QueryView::partCompleted()
void QueryView::slotURLRequest (const KURL &url, const KParts::URLArgs &)
{
- QString type = url.host();
- QString urlText = url.prettyURL();
+ TQString type = url.host();
+ TQString urlText = url.prettyURL();
urlText.remove(0,8+type.length());
if (type.length()) { // valid url
@@ -394,40 +394,40 @@ void QueryView::middleButtonClicked()
// construct the right-mouse-button-popup-menu on demand
-void QueryView::buildPopupMenu(const QString &url, const QPoint &point)
+void QueryView::buildPopupMenu(const TQString &url, const TQPoint &point)
{
rightBtnMenu->clear();
if (!url.isEmpty()) { // menuitem if mouse is over link
KURL u(url);
- QString type = u.host();
+ TQString type = u.host();
popupLink = u.prettyURL();
popupLink.remove(0,8+type.length());
if (type.length()) { // valid url
if(type=="define") {
rightBtnMenu->insertItem(i18n("Define &Synonym"),
- this,SLOT(popupDefineLink()));
+ this,TQT_SLOT(popupDefineLink()));
rightBtnMenu->insertItem(i18n("M&atch Synonym"),
- this,SLOT(popupMatchLink()));
+ this,TQT_SLOT(popupMatchLink()));
rightBtnMenu->insertSeparator();
}
if(type=="dbinfo") {
- rightBtnMenu->insertItem(i18n("D&atabase Information"),this,SLOT(popupDbInfo()));
+ rightBtnMenu->insertItem(i18n("D&atabase Information"),this,TQT_SLOT(popupDbInfo()));
rightBtnMenu->insertSeparator();
}
if(type=="realhttp") {
popupLink.prepend("http://");
rightBtnMenu->insertItem(SmallIcon("fileopen"),
i18n("&Open Link"),
- this,SLOT(popupOpenLink()));
+ this,TQT_SLOT(popupOpenLink()));
rightBtnMenu->insertSeparator();
}
if(type=="realftp") {
popupLink.prepend("ftp://");
rightBtnMenu->insertItem(SmallIcon("fileopen"),
i18n("&Open Link"),
- this,SLOT(popupOpenLink()));
+ this,TQT_SLOT(popupOpenLink()));
rightBtnMenu->insertSeparator();
}
}
@@ -436,24 +436,24 @@ void QueryView::buildPopupMenu(const QString &url, const QPoint &point)
if (part->hasSelection()) {
popupSelect = part->selectedText();
rightBtnMenu->insertItem(i18n("&Define Selection"),
- this,SLOT(popupDefineSelect()));
+ this,TQT_SLOT(popupDefineSelect()));
rightBtnMenu->insertItem(i18n("&Match Selection"),
- this,SLOT(popupMatchSelect()));
+ this,TQT_SLOT(popupMatchSelect()));
rightBtnMenu->insertSeparator();
} else {
kapp->clipboard()->setSelectionMode(false);
- QString text = kapp->clipboard()->text();
+ TQString text = kapp->clipboard()->text();
if (text.isEmpty()) {
kapp->clipboard()->setSelectionMode(true);
text = kapp->clipboard()->text();
}
if (!text.isEmpty()) {
- popupSelect = QApplication::clipboard()->text();
+ popupSelect = TQApplication::clipboard()->text();
rightBtnMenu->insertItem(SmallIcon("define_clip"),
i18n("&Define Clipboard Content"),
- this,SLOT(popupDefineSelect()));
+ this,TQT_SLOT(popupDefineSelect()));
rightBtnMenu->insertItem(i18n("&Match Clipboard Content"),
- this,SLOT(popupMatchSelect()));
+ this,TQT_SLOT(popupMatchSelect()));
rightBtnMenu->insertSeparator();
}
}
@@ -464,13 +464,13 @@ void QueryView::buildPopupMenu(const QString &url, const QPoint &point)
if (browseList.at(browsePos-1)->queryText.isEmpty())
rightBtnMenu->insertItem(SmallIcon("back"),
i18n("&Back: Information"),
- this,SLOT(browseBack()));
+ this,TQT_SLOT(browseBack()));
else
rightBtnMenu->insertItem(SmallIcon("back"),
i18n("&Back: '%1'").arg(getShortString(browseList.at(browsePos-1)->queryText,25)),
- this,SLOT(browseBack()));
+ this,TQT_SLOT(browseBack()));
} else {
- ID = rightBtnMenu->insertItem(SmallIcon("back"), i18n("&Back"), this, SLOT(browseBack()));
+ ID = rightBtnMenu->insertItem(SmallIcon("back"), i18n("&Back"), this, TQT_SLOT(browseBack()));
rightBtnMenu->setItemEnabled(ID,false);
}
@@ -478,13 +478,13 @@ void QueryView::buildPopupMenu(const QString &url, const QPoint &point)
if (browseList.at(browsePos+1)->queryText.isEmpty())
rightBtnMenu->insertItem(SmallIcon("forward"),
i18n("&Forward: Information"),
- this,SLOT(browseForward()));
+ this,TQT_SLOT(browseForward()));
else
rightBtnMenu->insertItem(SmallIcon("forward"),
i18n("&Forward: '%1'").arg(getShortString(browseList.at(browsePos+1)->queryText,25)),
- this,SLOT(browseForward()));
+ this,TQT_SLOT(browseForward()));
} else {
- ID = rightBtnMenu->insertItem(SmallIcon("forward"),i18n("&Forward"),this,SLOT(browseForward()));
+ ID = rightBtnMenu->insertItem(SmallIcon("forward"),i18n("&Forward"),this,TQT_SLOT(browseForward()));
rightBtnMenu->setItemEnabled(ID,false);
}
@@ -544,7 +544,7 @@ void QueryView::browseBack(int index)
browsePos = x;
actQueryCombo->setEditText(browseList.at(browsePos)->queryText);
showResult();
- QTimer::singleShot(0, this, SLOT(updateBrowseActions())); // don't clear the menu in this slot
+ TQTimer::singleShot(0, this, TQT_SLOT(updateBrowseActions())); // don't clear the menu in this slot
}
}
@@ -557,7 +557,7 @@ void QueryView::browseForward(int index)
browsePos = x;
actQueryCombo->setEditText(browseList.at(browsePos)->queryText);
showResult();
- QTimer::singleShot(0, this, SLOT(updateBrowseActions())); // don't clear the menu in this slot
+ TQTimer::singleShot(0, this, TQT_SLOT(updateBrowseActions())); // don't clear the menu in this slot
}
}
@@ -574,7 +574,7 @@ void QueryView::updateBrowseActions()
actBack->popupMenu()->clear();
int i = browsePos-1;
int num = 1;
- QString s;
+ TQString s;
while ((i>=0)&&(num<=10)) {
s = browseList.at(i)->queryText;
if (s.isEmpty()) s = i18n("Information");
@@ -598,7 +598,7 @@ void QueryView::updateBrowseActions()
actForward->popupMenu()->clear();
int i = browsePos+1;
int num = 1;
- QString s;
+ TQString s;
while ((i<(int)(browseList.count()))&&(num<=10)) {
s = browseList.at(i)->queryText;
if (s.isEmpty()) s = i18n("Information");