From 47c8a359c5276062c4bc17f0e82410f29081b502 Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 31 Jul 2010 19:48:06 +0000 Subject: Trinity Qt initial conversion git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1157648 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kdict/applet/kdictapplet.cpp | 120 +++++++++++++++++++++---------------------- 1 file changed, 60 insertions(+), 60 deletions(-) (limited to 'kdict/applet/kdictapplet.cpp') diff --git a/kdict/applet/kdictapplet.cpp b/kdict/applet/kdictapplet.cpp index ad907864..6e45de52 100644 --- a/kdict/applet/kdictapplet.cpp +++ b/kdict/applet/kdictapplet.cpp @@ -17,11 +17,11 @@ ------------------------------------------------------------- */ -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include @@ -36,7 +36,7 @@ //********* PopupBox ******************************************** PopupBox::PopupBox() - : QHBox(0, 0, WStyle_Customize | WType_Popup ), popupEnabled(true) + : TQHBox(0, 0, WStyle_Customize | WType_Popup ), popupEnabled(true) { } @@ -56,11 +56,11 @@ bool PopupBox::showBox() } -void PopupBox::hideEvent(QHideEvent *) +void PopupBox::hideEvent(TQHideEvent *) { emit(hidden()); popupEnabled = false; - QTimer::singleShot(100, this, SLOT(enablePopup())); + TQTimer::singleShot(100, this, TQT_SLOT(enablePopup())); } @@ -74,7 +74,7 @@ void PopupBox::enablePopup() extern "C" { - KDE_EXPORT KPanelApplet* init(QWidget *parent, const QString& configFile) + KDE_EXPORT KPanelApplet* init(TQWidget *parent, const TQString& configFile) { KGlobal::locale()->insertCatalogue("kdictapplet"); return new DictApplet(configFile, KPanelApplet::Stretch, 0, parent, "kdictapplet"); @@ -82,56 +82,56 @@ extern "C" } -DictApplet::DictApplet(const QString& configFile, Type type, int actions, QWidget *parent, const char *name) +DictApplet::DictApplet(const TQString& configFile, Type type, int actions, TQWidget *parent, const char *name) : KPanelApplet(configFile, type, actions, parent, name), waiting(0) { // first the widgets for a horizontal panel - baseWidget = new QWidget(this); - QGridLayout *baseLay = new QGridLayout(baseWidget,2,6,0,1); + baseWidget = new TQWidget(this); + TQGridLayout *baseLay = new TQGridLayout(baseWidget,2,6,0,1); - textLabel = new QLabel(i18n("Dictionary:"), baseWidget); + textLabel = new TQLabel(i18n("Dictionary:"), baseWidget); textLabel->setBackgroundOrigin(AncestorOrigin); - QFont f(textLabel->font()); + TQFont f(textLabel->font()); f.setPixelSize(12); textLabel->setFont(f); baseLay->addWidget(textLabel,0,1); - QToolTip::add(textLabel,i18n("Look up a word or phrase with Kdict")); + TQToolTip::add(textLabel,i18n("Look up a word or phrase with Kdict")); - iconLabel = new QLabel(baseWidget); + iconLabel = new TQLabel(baseWidget); iconLabel->setBackgroundOrigin(AncestorOrigin); - QPixmap pm = KGlobal::iconLoader()->loadIcon("kdict", KIcon::Panel, KIcon::SizeSmall, KIcon::DefaultState, 0L, true); + TQPixmap pm = KGlobal::iconLoader()->loadIcon("kdict", KIcon::Panel, KIcon::SizeSmall, KIcon::DefaultState, 0L, true); iconLabel->setPixmap(pm); baseLay->addWidget(iconLabel,1,0); iconLabel->setAlignment(Qt::AlignCenter | Qt::AlignVCenter); iconLabel->setFixedWidth(pm.width()+4); - QToolTip::add(iconLabel,i18n("Look up a word or phrase with Kdict")); + TQToolTip::add(iconLabel,i18n("Look up a word or phrase with Kdict")); f.setPixelSize(10); - clipboardBtn = new QPushButton(i18n("C"),baseWidget); + clipboardBtn = new TQPushButton(i18n("C"),baseWidget); clipboardBtn->setBackgroundOrigin(AncestorOrigin); clipboardBtn->setFont(f); clipboardBtn->setFixedSize(16,16); - connect(clipboardBtn, SIGNAL(clicked()), SLOT(queryClipboard())); + connect(clipboardBtn, TQT_SIGNAL(clicked()), TQT_SLOT(queryClipboard())); baseLay->addWidget(clipboardBtn,0,3); - QToolTip::add(clipboardBtn,i18n("Define selected text")); + TQToolTip::add(clipboardBtn,i18n("Define selected text")); - defineBtn = new QPushButton(i18n("D"),baseWidget); + defineBtn = new TQPushButton(i18n("D"),baseWidget); defineBtn->setBackgroundOrigin(AncestorOrigin); defineBtn->setFont(f); defineBtn->setFixedSize(16,16); defineBtn->setEnabled(false); - connect(defineBtn, SIGNAL(clicked()), SLOT(startDefine())); + connect(defineBtn, TQT_SIGNAL(clicked()), TQT_SLOT(startDefine())); baseLay->addWidget(defineBtn,0,4); - QToolTip::add(defineBtn,i18n("Define word/phrase")); + TQToolTip::add(defineBtn,i18n("Define word/phrase")); - matchBtn = new QPushButton(i18n("M"),baseWidget); + matchBtn = new TQPushButton(i18n("M"),baseWidget); matchBtn->setBackgroundOrigin(AncestorOrigin); matchBtn->setFont(f); matchBtn->setFixedSize(16,16); matchBtn->setEnabled(false); - connect(matchBtn, SIGNAL(clicked()), SLOT(startMatch())); + connect(matchBtn, TQT_SIGNAL(clicked()), TQT_SLOT(startMatch())); baseLay->addWidget(matchBtn,0,5); - QToolTip::add(matchBtn,i18n("Find matching definitions")); + TQToolTip::add(matchBtn,i18n("Find matching definitions")); completionObject = new KCompletion(); @@ -141,37 +141,37 @@ DictApplet::DictApplet(const QString& configFile, Type type, int actions, QWidge internalCombo->setFocus(); internalCombo->clearEdit(); internalCombo->lineEdit()->installEventFilter( this ); - connect(internalCombo, SIGNAL(returnPressed(const QString&)), SLOT(startQuery(const QString&))); - connect(internalCombo, SIGNAL(textChanged(const QString&)), SLOT(comboTextChanged(const QString&))); - QToolTip::add(internalCombo,i18n("Look up a word or phrase with Kdict")); + connect(internalCombo, TQT_SIGNAL(returnPressed(const TQString&)), TQT_SLOT(startQuery(const TQString&))); + connect(internalCombo, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(comboTextChanged(const TQString&))); + TQToolTip::add(internalCombo,i18n("Look up a word or phrase with Kdict")); baseLay->addMultiCellWidget(internalCombo,1,1,1,5); baseLay->setColStretch(2,1); // widgets for a vertical panel - verticalBtn = new QPushButton(this); - connect(verticalBtn, SIGNAL(pressed()), SLOT(showExternalCombo())); - QToolTip::add(verticalBtn,i18n("Look up a word or phrase with Kdict")); + verticalBtn = new TQPushButton(this); + connect(verticalBtn, TQT_SIGNAL(pressed()), TQT_SLOT(showExternalCombo())); + TQToolTip::add(verticalBtn,i18n("Look up a word or phrase with Kdict")); popupBox = new PopupBox(); popupBox->setFixedSize(160, 22); - connect(popupBox, SIGNAL(hidden()), SLOT(externalComboHidden())); + connect(popupBox, TQT_SIGNAL(hidden()), TQT_SLOT(externalComboHidden())); externalCombo = new KHistoryCombo(popupBox); externalCombo->setCompletionObject(completionObject); - connect(externalCombo, SIGNAL(returnPressed(const QString&)), SLOT(startQuery(const QString&))); + connect(externalCombo, TQT_SIGNAL(returnPressed(const TQString&)), TQT_SLOT(startQuery(const TQString&))); externalCombo->setFixedSize(160, externalCombo->sizeHint().height()); - connect(internalCombo, SIGNAL(completionModeChanged(KGlobalSettings::Completion)), - this, SLOT(updateCompletionMode(KGlobalSettings::Completion))); - connect(externalCombo, SIGNAL(completionModeChanged(KGlobalSettings::Completion)), - this, SLOT(updateCompletionMode(KGlobalSettings::Completion))); + connect(internalCombo, TQT_SIGNAL(completionModeChanged(KGlobalSettings::Completion)), + this, TQT_SLOT(updateCompletionMode(KGlobalSettings::Completion))); + connect(externalCombo, TQT_SIGNAL(completionModeChanged(KGlobalSettings::Completion)), + this, TQT_SLOT(updateCompletionMode(KGlobalSettings::Completion))); // restore history and completion list KConfig *c = config(); c->setGroup("General"); - QStringList list = c->readListEntry("Completion list"); + TQStringList list = c->readListEntry("Completion list"); completionObject->setItems(list); int mode = c->readNumEntry("Completion mode", KGlobalSettings::completionMode()); @@ -190,7 +190,7 @@ DictApplet::~DictApplet() KConfig *c = config(); c->setGroup("General"); - QStringList list = completionObject->items(); + TQStringList list = completionObject->items(); c->writeEntry("Completion list", list); c->writeEntry("Completion mode", (int) internalCombo->completionMode()); @@ -217,7 +217,7 @@ int DictApplet::heightForWidth(int width) const } -void DictApplet::resizeEvent(QResizeEvent*) +void DictApplet::resizeEvent(TQResizeEvent*) { if (orientation() == Horizontal) { verticalBtn->hide(); @@ -252,22 +252,22 @@ void DictApplet::resizeEvent(QResizeEvent*) verticalBtn->setFixedSize(width(),width()); KIcon::StdSizes sz = width() < 32 ? KIcon::SizeSmall : (width() < 48 ? KIcon::SizeMedium : KIcon::SizeLarge); - QPixmap pm = KGlobal::iconLoader()->loadIcon("kdict", KIcon::Panel, sz, KIcon::DefaultState, 0L, true); + TQPixmap pm = KGlobal::iconLoader()->loadIcon("kdict", KIcon::Panel, sz, KIcon::DefaultState, 0L, true); verticalBtn->setPixmap(pm); } } -bool DictApplet::eventFilter( QObject *o, QEvent * e) +bool DictApplet::eventFilter( TQObject *o, TQEvent * e) { - if (e->type() == QEvent::MouseButtonRelease) + if (e->type() == TQEvent::MouseButtonRelease) emit requestFocus(); return KPanelApplet::eventFilter(o, e); } -void DictApplet::sendCommand(const QCString &fun, const QString &data) +void DictApplet::sendCommand(const TQCString &fun, const TQString &data) { if (waiting > 0) { waiting = 1; @@ -282,7 +282,7 @@ void DictApplet::sendCommand(const QCString &fun, const QString &data) waiting = 1; delayedFunc = fun.copy(); delayedData = data; - QTimer::singleShot(100, this, SLOT(sendDelayedCommand())); + TQTimer::singleShot(100, this, TQT_SLOT(sendDelayedCommand())); return; } else { QCStringList list = client->remoteObjects("kdict"); @@ -290,7 +290,7 @@ void DictApplet::sendCommand(const QCString &fun, const QString &data) waiting = 1; delayedFunc = fun.copy(); delayedData = data; - QTimer::singleShot(100, this, SLOT(sendDelayedCommand())); + TQTimer::singleShot(100, this, TQT_SLOT(sendDelayedCommand())); return; } } @@ -309,13 +309,13 @@ void DictApplet::sendDelayedCommand() DCOPClient *client = kapp->dcopClient(); if (!client->isApplicationRegistered("kdict")) { waiting++; - QTimer::singleShot(100, this, SLOT(sendDelayedCommand())); + TQTimer::singleShot(100, this, TQT_SLOT(sendDelayedCommand())); return; } else { QCStringList list = client->remoteObjects("kdict"); if (list.findIndex("KDictIface")==-1) { waiting++; - QTimer::singleShot(100, this, SLOT(sendDelayedCommand())); + TQTimer::singleShot(100, this, TQT_SLOT(sendDelayedCommand())); return; } } @@ -325,9 +325,9 @@ void DictApplet::sendDelayedCommand() } -void DictApplet::startQuery(const QString &s) +void DictApplet::startQuery(const TQString &s) { - QString query = s.stripWhiteSpace(); + TQString query = s.stripWhiteSpace(); if (query.isEmpty()) return; @@ -336,14 +336,14 @@ void DictApplet::startQuery(const QString &s) internalCombo->clearEdit(); externalCombo->clearEdit(); - sendCommand("definePhrase(QString)",query); + sendCommand("definePhrase(TQString)",query); if (orientation() == Vertical) popupBox->hide(); } -void DictApplet::comboTextChanged(const QString &s) +void DictApplet::comboTextChanged(const TQString &s) { defineBtn->setEnabled(!s.isEmpty()); matchBtn->setEnabled(!s.isEmpty()); @@ -352,7 +352,7 @@ void DictApplet::comboTextChanged(const QString &s) void DictApplet::queryClipboard() { - sendCommand("defineClipboardContent()",QString::null); + sendCommand("defineClipboardContent()",TQString::null); } @@ -364,23 +364,23 @@ void DictApplet::startDefine() void DictApplet::startMatch() { - QString query = internalCombo->currentText().stripWhiteSpace(); + TQString query = internalCombo->currentText().stripWhiteSpace(); internalCombo->addToHistory(query); externalCombo->addToHistory(query); internalCombo->clearEdit(); externalCombo->clearEdit(); - sendCommand("matchPhrase(QString)",query); + sendCommand("matchPhrase(TQString)",query); } void DictApplet::showExternalCombo() { - QPoint p; + TQPoint p; if (position() == pLeft) - p = mapToGlobal(QPoint(-popupBox->width()-1, 0)); + p = mapToGlobal(TQPoint(-popupBox->width()-1, 0)); else - p = mapToGlobal(QPoint(width()+1, 0)); + p = mapToGlobal(TQPoint(width()+1, 0)); popupBox->move(p); if (popupBox->showBox()) externalCombo->setFocus(); -- cgit v1.2.1