From 98d15d90b6a83e2df32d678013847e18b8a8c7e8 Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 28 May 2011 18:03:09 +0000 Subject: TQt4 port Katapult This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/katapult@1233929 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- .../catalogs/spellcatalog/actioncopyspelling.cpp | 6 ++-- .../catalogs/spellcatalog/actioncopyspelling.h | 4 +-- katapult/plugins/catalogs/spellcatalog/settings.ui | 14 ++++----- .../plugins/catalogs/spellcatalog/spellcatalog.cpp | 30 +++++++++---------- .../plugins/catalogs/spellcatalog/spellcatalog.h | 15 +++++----- .../plugins/catalogs/spellcatalog/spelling.cpp | 34 +++++++++++----------- katapult/plugins/catalogs/spellcatalog/spelling.h | 21 ++++++------- 7 files changed, 63 insertions(+), 61 deletions(-) (limited to 'katapult/plugins/catalogs/spellcatalog') diff --git a/katapult/plugins/catalogs/spellcatalog/actioncopyspelling.cpp b/katapult/plugins/catalogs/spellcatalog/actioncopyspelling.cpp index 87857d3..51f2068 100644 --- a/katapult/plugins/catalogs/spellcatalog/actioncopyspelling.cpp +++ b/katapult/plugins/catalogs/spellcatalog/actioncopyspelling.cpp @@ -26,7 +26,7 @@ #include #include -#include +#include #include "spellcatalog.h" #include "spelling.h" @@ -42,7 +42,7 @@ ActionCopySpelling::~ActionCopySpelling() { } -QString ActionCopySpelling::text() const +TQString ActionCopySpelling::text() const { if (_spelling->parseError()) { return i18n("Parse Error"); @@ -51,7 +51,7 @@ QString ActionCopySpelling::text() const } } -QPixmap ActionCopySpelling::icon(int size) const +TQPixmap ActionCopySpelling::icon(int size) const { return KGlobal::iconLoader()->loadIcon("katapultspellcheck", KIcon::NoGroup, size); } diff --git a/katapult/plugins/catalogs/spellcatalog/actioncopyspelling.h b/katapult/plugins/catalogs/spellcatalog/actioncopyspelling.h index e15c3d9..669ba49 100644 --- a/katapult/plugins/catalogs/spellcatalog/actioncopyspelling.h +++ b/katapult/plugins/catalogs/spellcatalog/actioncopyspelling.h @@ -39,8 +39,8 @@ class ActionCopySpelling : public KatapultAction virtual void execute(const KatapultItem*) const; virtual bool accepts(const KatapultItem*) const; - virtual QString text() const; - virtual QPixmap icon(int) const; + virtual TQString text() const; + virtual TQPixmap icon(int) const; private: //_expr needs to be mutable because accepts() is const. diff --git a/katapult/plugins/catalogs/spellcatalog/settings.ui b/katapult/plugins/catalogs/spellcatalog/settings.ui index 402b416..055491d 100644 --- a/katapult/plugins/catalogs/spellcatalog/settings.ui +++ b/katapult/plugins/catalogs/spellcatalog/settings.ui @@ -1,10 +1,10 @@ SpellCatalogSettings - + SpellCatalogSettings - + 0 0 @@ -19,12 +19,12 @@ unnamed - + triggerWordLE - + triggerWordLabel @@ -32,7 +32,7 @@ Trigger Word: - + introLabel @@ -50,7 +50,7 @@ Expanding - + 20 150 @@ -61,5 +61,5 @@ - + diff --git a/katapult/plugins/catalogs/spellcatalog/spellcatalog.cpp b/katapult/plugins/catalogs/spellcatalog/spellcatalog.cpp index 5cbdbed..cbc3b8b 100644 --- a/katapult/plugins/catalogs/spellcatalog/spellcatalog.cpp +++ b/katapult/plugins/catalogs/spellcatalog/spellcatalog.cpp @@ -29,8 +29,8 @@ #include #include -#include -#include +#include +#include #include "settings.h" #include "spellcatalog.h" @@ -41,7 +41,7 @@ K_EXPORT_COMPONENT_FACTORY( katapult_spellcatalog, KGenericFactory( "katapult_spellcatalog" ) ) -SpellCatalog::SpellCatalog(QObject*, const char*, const QStringList&): _result(this, QString::null) +SpellCatalog::SpellCatalog(TQObject*, const char*, const TQStringList&): _result(this, TQString()) { ActionRegistry::self()->registerAction(new ActionCopySpelling()); } @@ -52,8 +52,8 @@ SpellCatalog::~SpellCatalog() void SpellCatalog::queryChanged() { - int newStatus = 0; - QString cmd = query(); + int newtqStatus = 0; + TQString cmd = query(); int origLength = cmd.length(); if (cmd.isEmpty()) { @@ -67,15 +67,15 @@ void SpellCatalog::queryChanged() //set status. //add S_Multiple to make sure katapult doesn't auto-exec and close the window //add S_Active to make sure katapult doesn't start the hideTimer or clearTimer - newStatus = S_HasResults | S_Multiple | S_Active; + newtqStatus = S_HasResults | S_Multiple | S_Active; } else { - newStatus = 0; + newtqStatus = 0; } } - setStatus(newStatus); + settqStatus(newtqStatus); } -bool SpellCatalog::accepts(const QString& str) const +bool SpellCatalog::accepts(const TQString& str) const { //accept if we begin with the triggerWord int length = _triggerWord.length(); @@ -92,21 +92,21 @@ void SpellCatalog::writeSettings(KConfigBase* config) config->writeEntry("TriggerWord", _triggerWord); } -QWidget * SpellCatalog::configure() +TQWidget * SpellCatalog::configure() { SpellCatalogSettings* settings = new SpellCatalogSettings(); settings->triggerWordLE->setText(_triggerWord); - connect(settings->triggerWordLE, SIGNAL(textChanged(const QString&)), this, SLOT(triggerWordChanged(const QString&))); + connect(settings->triggerWordLE, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(triggerWordChanged(const TQString&))); - settings->introLabel->setText(i18n("Use with \"%1 myword\"").arg(_triggerWord)); + settings->introLabel->setText(i18n("Use with \"%1 myword\"").tqarg(_triggerWord)); return settings; } -void SpellCatalog::triggerWordChanged(const QString& triggerWord) +void SpellCatalog::triggerWordChanged(const TQString& triggerWord) { - _triggerWord = QString(triggerWord); + _triggerWord = TQString(triggerWord); } int SpellCatalog::triggerWordLength() @@ -116,7 +116,7 @@ int SpellCatalog::triggerWordLength() void SpellCatalog::reset() { - _result.setText(QString::null); + _result.setText(TQString()); } #include "spellcatalog.moc" diff --git a/katapult/plugins/catalogs/spellcatalog/spellcatalog.h b/katapult/plugins/catalogs/spellcatalog/spellcatalog.h index 86181dc..cfd0e36 100644 --- a/katapult/plugins/catalogs/spellcatalog/spellcatalog.h +++ b/katapult/plugins/catalogs/spellcatalog/spellcatalog.h @@ -28,12 +28,12 @@ #include -#include +#include #include "spelling.h" #include "katapultcatalog.h" -class QWidget; +class TQWidget; /** @author Jonathan Riddell @@ -41,15 +41,16 @@ class QWidget; class SpellCatalog : public KatapultCatalog { Q_OBJECT + TQ_OBJECT public: - SpellCatalog(QObject*, const char*, const QStringList&); + SpellCatalog(TQObject*, const char*, const TQStringList&); virtual ~SpellCatalog(); virtual void readSettings(KConfigBase*); virtual void writeSettings(KConfigBase*); - virtual QWidget* configure(); + virtual TQWidget* configure(); int triggerWordLength(); protected: @@ -57,16 +58,16 @@ class SpellCatalog : public KatapultCatalog virtual void queryChanged(); private: - bool accepts(const QString&) const; + bool accepts(const TQString&) const; - QString _triggerWord; + TQString _triggerWord; Spelling _result; // The one result (there's always one). void reset(); protected slots: - void triggerWordChanged(const QString& triggerWord); + void triggerWordChanged(const TQString& triggerWord); }; diff --git a/katapult/plugins/catalogs/spellcatalog/spelling.cpp b/katapult/plugins/catalogs/spellcatalog/spelling.cpp index fe08355..edadc18 100644 --- a/katapult/plugins/catalogs/spellcatalog/spelling.cpp +++ b/katapult/plugins/catalogs/spellcatalog/spelling.cpp @@ -26,21 +26,21 @@ #include #include -#include +#include #include "spellcatalog.h" #include "spelling.h" -Spelling::Spelling(SpellCatalog* catalog, const QString& text): KatapultItem(), _catalog(catalog), _text(text) +Spelling::Spelling(SpellCatalog* catalog, const TQString& text): KatapultItem(), _catalog(catalog), _text(text) { - spellChecker = new KSpell( 0, "caption", this, SLOT(spellCheckerReady()) ); + spellChecker = new KSpell( 0, "caption", this, TQT_SLOT(spellCheckerReady()) ); - connect( spellChecker, SIGNAL(misspelling(const QString&, const QStringList&, unsigned int)), - this, SLOT(spellCheckerMisspelling(const QString&, const QStringList&, unsigned int)) ); + connect( spellChecker, TQT_SIGNAL(misspelling(const TQString&, const TQStringList&, unsigned int)), + this, TQT_SLOT(spellCheckerMisspelling(const TQString&, const TQStringList&, unsigned int)) ); - connect( spellChecker, SIGNAL(corrected(const QString&, const QString&, unsigned int)), - this, SLOT(spellCheckerCorrected(const QString&, const QString&, unsigned int)) ); + connect( spellChecker, TQT_SIGNAL(corrected(const TQString&, const TQString&, unsigned int)), + this, TQT_SLOT(spellCheckerCorrected(const TQString&, const TQString&, unsigned int)) ); evaluate(); } @@ -52,16 +52,16 @@ Spelling::~Spelling() { void Spelling::spellCheckerReady() { } -void Spelling::spellCheckerCorrected(const QString& /*originalword*/, const QString& /*newword*/, unsigned int /*pos*/) { +void Spelling::spellCheckerCorrected(const TQString& /*originalword*/, const TQString& /*newword*/, unsigned int /*pos*/) { corrected = true; } -void Spelling::spellCheckerMisspelling(const QString& /*originalword*/, const QStringList& suggestions, unsigned int /*pos*/) { +void Spelling::spellCheckerMisspelling(const TQString& /*originalword*/, const TQStringList& suggestions, unsigned int /*pos*/) { misspelt = true; suggestedWords = suggestions.join(","); } -QPixmap Spelling::icon(int size) const +TQPixmap Spelling::icon(int size) const { const char* icon = "checkmark"; if (_parseError || misspelt) { @@ -70,18 +70,18 @@ QPixmap Spelling::icon(int size) const return KGlobal::iconLoader()->loadIcon(icon, KIcon::NoGroup, size); } -QString Spelling::text() const +TQString Spelling::text() const { return _text; } -void Spelling::setText(const QString& text) +void Spelling::setText(const TQString& text) { _text = text; evaluate(); } -QString Spelling::result() const +TQString Spelling::result() const { return _result; } @@ -100,7 +100,7 @@ void Spelling::evaluate() const { int length = catalog()->triggerWordLength(); - QString text = _text.mid(length + 1); // + 1 for space + TQString text = _text.mid(length + 1); // + 1 for space misspelt = false; corrected = false; @@ -125,9 +125,9 @@ void Spelling::evaluate() const } void Spelling::copyToClipboard() const { - QClipboard* clipBoard = QApplication::clipboard(); - clipBoard->setText(suggestedWords, QClipboard::Clipboard); - clipBoard->setText(suggestedWords, QClipboard::Selection); + TQClipboard* clipBoard = TQApplication::tqclipboard(); + clipBoard->setText(suggestedWords, TQClipboard::Clipboard); + clipBoard->setText(suggestedWords, TQClipboard::Selection); } #include "spelling.moc" diff --git a/katapult/plugins/catalogs/spellcatalog/spelling.h b/katapult/plugins/catalogs/spellcatalog/spelling.h index ea4b846..1f8dc97 100644 --- a/katapult/plugins/catalogs/spellcatalog/spelling.h +++ b/katapult/plugins/catalogs/spellcatalog/spelling.h @@ -35,15 +35,16 @@ class SpellCatalog; class Spelling : public KatapultItem { Q_OBJECT + TQ_OBJECT public: - Spelling(SpellCatalog*, const QString&); + Spelling(SpellCatalog*, const TQString&); ~Spelling(); - virtual QPixmap icon(int) const; - virtual QString text() const; + virtual TQPixmap icon(int) const; + virtual TQString text() const; - void setText(const QString&); - QString result() const; + void setText(const TQString&); + TQString result() const; bool parseError() const; //evaluate() must be const, or ActionEvaluateSpelling::execute() can't call it. @@ -57,18 +58,18 @@ class Spelling : public KatapultItem private: SpellCatalog* const _catalog; - QString _text; - mutable QString _result; + TQString _text; + mutable TQString _result; mutable bool _parseError; KSpell* spellChecker; mutable bool misspelt; mutable bool corrected; - QString suggestedWords; + TQString suggestedWords; protected slots: void spellCheckerReady(); - void spellCheckerCorrected(const QString& originalword, const QString& newword, unsigned int pos); - void spellCheckerMisspelling(const QString& originalword, const QStringList& suggestions, unsigned int pos); + void spellCheckerCorrected(const TQString& originalword, const TQString& newword, unsigned int pos); + void spellCheckerMisspelling(const TQString& originalword, const TQStringList& suggestions, unsigned int pos); }; #endif -- cgit v1.2.1