diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-25 05:28:35 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-25 05:28:35 +0000 |
commit | f008adb5a77e094eaf6abf3fc0f36958e66896a5 (patch) | |
tree | 8e9244c4d4957c36be81e15b566b4aa5ea26c982 /kexi/kexiutils | |
parent | 1210f27b660efb7b37ff43ec68763e85a403471f (diff) | |
download | koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.tar.gz koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.zip |
TQt4 port koffice
This should enable compilation under both Qt3 and Qt4; fixes for any missed components will be forthcoming
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1238284 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kexi/kexiutils')
-rw-r--r-- | kexi/kexiutils/debuggui.cpp | 58 | ||||
-rw-r--r-- | kexi/kexiutils/identifier.cpp | 58 | ||||
-rw-r--r-- | kexi/kexiutils/identifier.h | 20 | ||||
-rw-r--r-- | kexi/kexiutils/longlongvalidator.cpp | 42 | ||||
-rw-r--r-- | kexi/kexiutils/longlongvalidator.h | 28 | ||||
-rw-r--r-- | kexi/kexiutils/styleproxy.cpp | 12 | ||||
-rw-r--r-- | kexi/kexiutils/styleproxy.h | 134 | ||||
-rw-r--r-- | kexi/kexiutils/transliteration_table.h | 2 | ||||
-rw-r--r-- | kexi/kexiutils/tristate.h | 16 | ||||
-rw-r--r-- | kexi/kexiutils/utils.cpp | 210 | ||||
-rw-r--r-- | kexi/kexiutils/utils.h | 116 | ||||
-rw-r--r-- | kexi/kexiutils/utils_p.h | 19 | ||||
-rw-r--r-- | kexi/kexiutils/validator.cpp | 48 | ||||
-rw-r--r-- | kexi/kexiutils/validator.h | 62 |
14 files changed, 413 insertions, 412 deletions
diff --git a/kexi/kexiutils/debuggui.cpp b/kexi/kexiutils/debuggui.cpp index 72948fd2..f0a5146c 100644 --- a/kexi/kexiutils/debuggui.cpp +++ b/kexi/kexiutils/debuggui.cpp @@ -20,8 +20,8 @@ #include "utils.h" #include "utils_p.h" -#include <qheader.h> -#include <qlayout.h> +#include <tqheader.h> +#include <tqlayout.h> #include <ktabwidget.h> #include <klistview.h> @@ -37,12 +37,12 @@ static KTabWidget* debugWindowTab = 0; static KListView* kexiDBDebugPage = 0; static KListView* kexiAlterTableActionDebugPage = 0; -QWidget *KexiUtils::createDebugWindow(QWidget *parent) +TQWidget *KexiUtils::createDebugWindow(TQWidget *tqparent) { // (this is internal code - do not use i18n() here) - debugWindow = new DebugWindowDialog(parent); + debugWindow = new DebugWindowDialog(tqparent); debugWindow->setSizeGripEnabled( true ); - QBoxLayout *lyr = new QVBoxLayout(debugWindow, KDialogBase::marginHint()); + TQBoxLayout *lyr = new TQVBoxLayout(debugWindow, KDialogBase::marginHint()); debugWindowTab = new KTabWidget(debugWindow, "debugWindowTab"); lyr->addWidget( debugWindowTab ); debugWindow->resize(900, 600); @@ -52,49 +52,49 @@ QWidget *KexiUtils::createDebugWindow(QWidget *parent) return debugWindow; } -void KexiUtils::addKexiDBDebug(const QString& text) +void KexiUtils::addKexiDBDebug(const TQString& text) { // (this is internal code - do not use i18n() here) if (!debugWindowTab) return; if (!kexiDBDebugPage) { - QWidget *page = new QWidget(debugWindowTab); - QVBoxLayout *vbox = new QVBoxLayout(page); - QHBoxLayout *hbox = new QHBoxLayout(page); + TQWidget *page = new TQWidget(debugWindowTab); + TQVBoxLayout *vbox = new TQVBoxLayout(page); + TQHBoxLayout *hbox = new TQHBoxLayout(page); vbox->addLayout(hbox); hbox->addStretch(1); KPushButton *btn_clear = new KPushButton(KGuiItem("Clear", "clear_left"), page); hbox->addWidget(btn_clear); kexiDBDebugPage = new KListView(page, "kexiDbDebugPage"); - QObject::connect(btn_clear, SIGNAL(clicked()), kexiDBDebugPage, SLOT(clear())); + TQObject::connect(btn_clear, TQT_SIGNAL(clicked()), kexiDBDebugPage, TQT_SLOT(clear())); vbox->addWidget(kexiDBDebugPage); kexiDBDebugPage->addColumn(""); kexiDBDebugPage->header()->hide(); kexiDBDebugPage->setSorting(-1); kexiDBDebugPage->setAllColumnsShowFocus ( true ); - kexiDBDebugPage->setColumnWidthMode( 0, QListView::Maximum ); + kexiDBDebugPage->setColumnWidthMode( 0, TQListView::Maximum ); kexiDBDebugPage->setRootIsDecorated( true ); debugWindowTab->addTab( page, "KexiDB" ); debugWindowTab->showPage(page); kexiDBDebugPage->show(); } //add \n after (about) every 30 characters -//TODO QString realText +//TODO TQString realText KListViewItem * li = new KListViewItem( kexiDBDebugPage, kexiDBDebugPage->lastItem(), text ); li->setMultiLinesEnabled( true ); } -void KexiUtils::addAlterTableActionDebug(const QString& text, int nestingLevel) +void KexiUtils::addAlterTableActionDebug(const TQString& text, int nestingLevel) { // (this is internal code - do not use i18n() here) if (!debugWindowTab) return; if (!kexiAlterTableActionDebugPage) { - QWidget *page = new QWidget(debugWindowTab); - QVBoxLayout *vbox = new QVBoxLayout(page); - QHBoxLayout *hbox = new QHBoxLayout(page); + TQWidget *page = new TQWidget(debugWindowTab); + TQVBoxLayout *vbox = new TQVBoxLayout(page); + TQHBoxLayout *hbox = new TQHBoxLayout(page); vbox->addLayout(hbox); hbox->addStretch(1); KPushButton *btn_exec = new KPushButton(KGuiItem("Real Alter Table", "filesave"), page); @@ -107,13 +107,13 @@ void KexiUtils::addAlterTableActionDebug(const QString& text, int nestingLevel) hbox->addWidget(btn_sim); kexiAlterTableActionDebugPage = new KListView(page, "kexiAlterTableActionDebugPage"); - QObject::connect(btn_clear, SIGNAL(clicked()), kexiAlterTableActionDebugPage, SLOT(clear())); + TQObject::connect(btn_clear, TQT_SIGNAL(clicked()), kexiAlterTableActionDebugPage, TQT_SLOT(clear())); vbox->addWidget(kexiAlterTableActionDebugPage); kexiAlterTableActionDebugPage->addColumn(""); kexiAlterTableActionDebugPage->header()->hide(); kexiAlterTableActionDebugPage->setSorting(-1); kexiAlterTableActionDebugPage->setAllColumnsShowFocus ( true ); - kexiAlterTableActionDebugPage->setColumnWidthMode( 0, QListView::Maximum ); + kexiAlterTableActionDebugPage->setColumnWidthMode( 0, TQListView::Maximum ); kexiAlterTableActionDebugPage->setRootIsDecorated( true ); debugWindowTab->addTab( page, "AlterTable Actions" ); debugWindowTab->showPage(page); @@ -124,10 +124,10 @@ void KexiUtils::addAlterTableActionDebug(const QString& text, int nestingLevel) KListViewItem * li; int availableNestingLevels = 0; // compute availableNestingLevels - QListViewItem * lastItem = kexiAlterTableActionDebugPage->lastItem(); - //kdDebug() << "lastItem: " << (lastItem ? lastItem->text(0) : QString::null) << endl; + TQListViewItem * lastItem = kexiAlterTableActionDebugPage->lastItem(); + //kdDebug() << "lastItem: " << (lastItem ? lastItem->text(0) : TQString()) << endl; while (lastItem) { - lastItem = lastItem->parent(); + lastItem = lastItem->tqparent(); availableNestingLevels++; } //kdDebug() << "availableNestingLevels: " << availableNestingLevels << endl; @@ -135,12 +135,12 @@ void KexiUtils::addAlterTableActionDebug(const QString& text, int nestingLevel) lastItem = kexiAlterTableActionDebugPage->lastItem(); int levelsToGoUp = availableNestingLevels - nestingLevel; while (levelsToGoUp > 0 && lastItem) { - lastItem = lastItem->parent(); + lastItem = lastItem->tqparent(); levelsToGoUp--; } - //kdDebug() << "lastItem2: " << (lastItem ? lastItem->text(0) : QString::null) << endl; + //kdDebug() << "lastItem2: " << (lastItem ? lastItem->text(0) : TQString()) << endl; if (lastItem) { - QListViewItem *after = lastItem->firstChild(); //find last child so we can insert a new item after it + TQListViewItem *after = lastItem->firstChild(); //find last child so we can insert a new item after it while (after && after->nextSibling()) after = after->nextSibling(); if (after) @@ -150,9 +150,9 @@ void KexiUtils::addAlterTableActionDebug(const QString& text, int nestingLevel) } else { lastItem = kexiAlterTableActionDebugPage->lastItem(); - while (lastItem && lastItem->parent()) - lastItem = lastItem->parent(); - //kdDebug() << "lastItem2: " << (lastItem ? lastItem->text(0) : QString::null) << endl; + while (lastItem && lastItem->tqparent()) + lastItem = lastItem->tqparent(); + //kdDebug() << "lastItem2: " << (lastItem ? lastItem->text(0) : TQString()) << endl; li = new KListViewItem( kexiAlterTableActionDebugPage, lastItem, text ); //after } li->setOpen(true); @@ -160,12 +160,12 @@ void KexiUtils::addAlterTableActionDebug(const QString& text, int nestingLevel) } void KexiUtils::connectPushButtonActionForDebugWindow(const char* actionName, - const QObject *receiver, const char* slot) + const TQObject *receiver, const char* slot) { if (debugWindow) { KPushButton* btn = findFirstChild<KPushButton>(debugWindow, "KPushButton", actionName); if (btn) - QObject::connect(btn, SIGNAL(clicked()), receiver, slot); + TQObject::connect(btn, TQT_SIGNAL(clicked()), receiver, slot); } } diff --git a/kexi/kexiutils/identifier.cpp b/kexi/kexiutils/identifier.cpp index 12c5b4da..e09df22a 100644 --- a/kexi/kexiutils/identifier.cpp +++ b/kexi/kexiutils/identifier.cpp @@ -23,48 +23,48 @@ using namespace KexiUtils; -bool KexiUtils::isIdentifier(const QString& s) +bool KexiUtils::isIdentifier(const TQString& s) { uint i; for (i=0; i<s.length(); i++) { - QChar c = s.at(i).lower(); - if (!(c=='_' || c>='a' && c<='z' || i>0 && c>='0' && c<='9')) + TQChar c = s.tqat(i).lower(); + if (!((int)c=='_' || (int)c>='a' && (int)c<='z' || i>0 && (int)c>='0' && (int)c<='9')) break; } return i>0 && i==s.length(); } -QString KexiUtils::string2FileName(const QString &s) +TQString KexiUtils::string2FileName(const TQString &s) { - QString fn( s.simplifyWhiteSpace() ); - fn.replace(' ',"_"); fn.replace('$',"_"); - fn.replace('\\',"-"); fn.replace('/',"-"); - fn.replace(':',"-"); fn.replace('*',"-"); + TQString fn( s.simplifyWhiteSpace() ); + fn.tqreplace(' ',"_"); fn.tqreplace('$',"_"); + fn.tqreplace('\\',"-"); fn.tqreplace('/',"-"); + fn.tqreplace(':',"-"); fn.tqreplace('*',"-"); return fn; } -inline QString char2Identifier(const QChar& c) +inline TQString char2Identifier(const TQChar& c) { - if (c.unicode() >= TRANSLITERATION_TABLE_SIZE) - return QString(QChar('_')); - const char *const s = transliteration_table[c.unicode()]; - return s ? QString::fromLatin1(s) : QString(QChar('_')); + if (c.tqunicode() >= TRANSLITERATION_TABLE_SIZE) + return TQString(TQChar('_')); + const char *const s = transliteration_table[c.tqunicode()]; + return s ? TQString::tqfromLatin1(s) : TQString(TQChar('_')); } -QString KexiUtils::string2Identifier(const QString &s) +TQString KexiUtils::string2Identifier(const TQString &s) { if (s.isEmpty()) - return QString::null; - QString r, id = s.simplifyWhiteSpace(); + return TQString(); + TQString r, id = s.simplifyWhiteSpace(); if (id.isEmpty()) - return QString::null; + return TQString(); r.reserve(id.length()); - id.replace(' ',"_"); - QChar c = id[0]; - QString add; + id.tqreplace(' ',"_"); + TQChar c = id[0]; + TQString add; bool wasUnderscore = false; - if (c>='0' && c<='9') { + if ((int)c>='0' && (int)c<='9') { r+='_'; r+=c; } else { @@ -85,16 +85,16 @@ QString KexiUtils::string2Identifier(const QString &s) //-------------------------------------------------------------------------------- -QString KexiUtils::identifierExpectedMessage(const QString &valueName, const QVariant& v) +TQString KexiUtils::identifierExpectedMessage(const TQString &valueName, const TQVariant& v) { - return "<p>"+i18n("Value of \"%1\" column must be an identifier.").arg(valueName) - +"</p><p>"+i18n("\"%1\" is not a valid identifier.").arg(v.toString())+"</p>"; + return "<p>"+i18n("Value of \"%1\" column must be an identifier.").tqarg(valueName) + +"</p><p>"+i18n("\"%1\" is not a valid identifier.").tqarg(v.toString())+"</p>"; } //-------------------------------------------------------------------------------- -IdentifierValidator::IdentifierValidator(QObject * parent, const char * name) -: Validator(parent,name) +IdentifierValidator::IdentifierValidator(TQObject * tqparent, const char * name) +: Validator(tqparent,name) { } @@ -102,7 +102,7 @@ IdentifierValidator::~IdentifierValidator() { } -QValidator::State IdentifierValidator::validate( QString& input, int& pos ) const +TQValidator::State IdentifierValidator::validate( TQString& input, int& pos ) const { uint i; for (i=0; i<input.length() && input.at(i)==' '; i++) @@ -120,8 +120,8 @@ QValidator::State IdentifierValidator::validate( QString& input, int& pos ) cons } Validator::Result IdentifierValidator::internalCheck( - const QString &valueName, const QVariant& v, - QString &message, QString & /*details*/) + const TQString &valueName, const TQVariant& v, + TQString &message, TQString & /*details*/) { if (isIdentifier(v.toString())) return Validator::Ok; diff --git a/kexi/kexiutils/identifier.h b/kexi/kexiutils/identifier.h index a1d9f8ba..2987019b 100644 --- a/kexi/kexiutils/identifier.h +++ b/kexi/kexiutils/identifier.h @@ -22,39 +22,39 @@ #define KEXIUTILS_IDENTIFIER_H #include "validator.h" -#include <qstring.h> +#include <tqstring.h> namespace KexiUtils { /*! \return true if \a s is a valid identifier, ie. starts with a letter or '_' character and contains only letters, numbers and '_' character. */ - KEXIUTILS_EXPORT bool isIdentifier(const QString& s); + KEXIUTILS_EXPORT bool isIdentifier(const TQString& s); /*! \return valid identifier based on \a s. Non-alphanumeric characters (or spaces) are replaced with '_'. If a number is at the beginning, '_' is added at start. Empty strings are not changed. Case remains unchanged. */ - KEXIUTILS_EXPORT QString string2Identifier(const QString &s); + KEXIUTILS_EXPORT TQString string2Identifier(const TQString &s); /*! \return useful message "Value of "valueName" column must be an identifier. "v" is not a valid identifier.". It is also used by IdentifierValidator. */ - KEXIUTILS_EXPORT QString identifierExpectedMessage(const QString &valueName, - const QVariant& v); + KEXIUTILS_EXPORT TQString identifierExpectedMessage(const TQString &valueName, + const TQVariant& v); //! \return Valid filename based on \a s - KEXIUTILS_EXPORT QString string2FileName(const QString &s); + KEXIUTILS_EXPORT TQString string2FileName(const TQString &s); //! Validates input for identifier name. class KEXIUTILS_EXPORT IdentifierValidator : public Validator { public: - IdentifierValidator(QObject * parent = 0, const char * name = 0); + IdentifierValidator(TQObject * tqparent = 0, const char * name = 0); virtual ~IdentifierValidator(); - virtual State validate( QString & input, int & pos) const; + virtual State validate( TQString & input, int & pos) const; protected: - virtual Validator::Result internalCheck(const QString &valueName, const QVariant& v, - QString &message, QString &details); + virtual Validator::Result internalCheck(const TQString &valueName, const TQVariant& v, + TQString &message, TQString &details); }; } diff --git a/kexi/kexiutils/longlongvalidator.cpp b/kexi/kexiutils/longlongvalidator.cpp index 6e7c0f7e..7d985c32 100644 --- a/kexi/kexiutils/longlongvalidator.cpp +++ b/kexi/kexiutils/longlongvalidator.cpp @@ -21,19 +21,19 @@ #include "longlongvalidator.h" -#include <qwidget.h> +#include <tqwidget.h> using namespace KexiUtils; -LongLongValidator::LongLongValidator( QWidget * parent, int base, const char * name ) - : QValidator(parent, name) +LongLongValidator::LongLongValidator( TQWidget * tqparent, int base, const char * name ) + : TQValidator(TQT_TQOBJECT(tqparent), name) , m_min(0), m_max(0) { setBase(base); } -LongLongValidator::LongLongValidator( Q_LLONG bottom, Q_LLONG top, QWidget * parent, int base, const char * name ) - : QValidator(parent, name) +LongLongValidator::LongLongValidator( TQ_LLONG bottom, TQ_LLONG top, TQWidget * tqparent, int base, const char * name ) + : TQValidator(TQT_TQOBJECT(tqparent), name) { setBase(base); setRange( bottom, top ); @@ -43,21 +43,21 @@ LongLongValidator::~LongLongValidator() { } -QValidator::State LongLongValidator::validate( QString &str, int & ) const +TQValidator::State LongLongValidator::validate( TQString &str, int & ) const { bool ok; - Q_LLONG val = 0; - QString newStr; + TQ_LLONG val = 0; + TQString newStr; newStr = str.stripWhiteSpace(); if (m_base > 10) newStr = newStr.upper(); - if (newStr == QString::fromLatin1("-")) {// a special case + if (newStr == TQString::tqfromLatin1("-")) {// a special case if ((m_min || m_max) && m_min >= 0) ok = false; else - return QValidator::Acceptable; + return TQValidator::Acceptable; } else if (!newStr.isEmpty()) val = newStr.toLongLong(&ok, m_base); @@ -67,26 +67,26 @@ QValidator::State LongLongValidator::validate( QString &str, int & ) const } if (! ok) - return QValidator::Invalid; + return TQValidator::Invalid; if ((! m_min && ! m_max) || (val >= m_min && val <= m_max)) - return QValidator::Acceptable; + return TQValidator::Acceptable; if (m_max && m_min >= 0 && val < 0) - return QValidator::Invalid; + return TQValidator::Invalid; - return QValidator::Valid; + return TQValidator::Valid; } -void LongLongValidator::fixup( QString &str ) const +void LongLongValidator::fixup( TQString &str ) const { int dummy; - Q_LLONG val; - QValidator::State state; + TQ_LLONG val; + TQValidator::State state; state = validate(str, dummy); - if (state == QValidator::Invalid || state == QValidator::Acceptable) + if (state == TQValidator::Invalid || state == TQValidator::Acceptable) return; if (! m_min && ! m_max) @@ -102,7 +102,7 @@ void LongLongValidator::fixup( QString &str ) const str.setNum(val, m_base); } -void LongLongValidator::setRange( Q_LLONG bottom, Q_LLONG top ) +void LongLongValidator::setRange( TQ_LLONG bottom, TQ_LLONG top ) { m_min = bottom; m_max = top; @@ -120,12 +120,12 @@ void LongLongValidator::setBase( int base ) m_base = 36; } -Q_LLONG LongLongValidator::bottom() const +TQ_LLONG LongLongValidator::bottom() const { return m_min; } -Q_LLONG LongLongValidator::top() const +TQ_LLONG LongLongValidator::top() const { return m_max; } diff --git a/kexi/kexiutils/longlongvalidator.h b/kexi/kexiutils/longlongvalidator.h index e20d2f95..bd211feb 100644 --- a/kexi/kexiutils/longlongvalidator.h +++ b/kexi/kexiutils/longlongvalidator.h @@ -22,51 +22,51 @@ #include "kexiutils_export.h" -#include <qvalidator.h> -class QWidget; +#include <tqvalidator.h> +class TQWidget; namespace KexiUtils { //! @short A validator for longlong data type. /*! - This can be used by QLineEdit or subclass to provide validated + This can be used by TQLineEdit or subclass to provide validated text entry. Can be provided with a base value (default is 10), to allow the proper entry of hexadecimal, octal, or any other base numeric data. Based on KIntValidator code by Glen Parker <glenebob@nwlink.com> */ -class KEXIUTILS_EXPORT LongLongValidator : public QValidator +class KEXIUTILS_EXPORT LongLongValidator : public TQValidator { public: - LongLongValidator( QWidget * parent, int base = 10, const char * name = 0 ); - LongLongValidator( Q_LLONG bottom, Q_LLONG top, QWidget * parent, int base = 10, const char * name = 0 ); + LongLongValidator( TQWidget * tqparent, int base = 10, const char * name = 0 ); + LongLongValidator( TQ_LLONG bottom, TQ_LLONG top, TQWidget * tqparent, int base = 10, const char * name = 0 ); virtual ~LongLongValidator(); //! Validates the text, and returns the result. Does not modify the parameters. - virtual State validate( QString &, int & ) const; + virtual State validate( TQString &, int & ) const; //! Fixes the text if possible, providing a valid string. The parameter may be modified. - virtual void fixup( QString & ) const; + virtual void fixup( TQString & ) const; //! Sets the minimum and maximum values allowed. - virtual void setRange( Q_LLONG bottom, Q_LLONG top ); + virtual void setRange( TQ_LLONG bottom, TQ_LLONG top ); //! Sets the numeric base value. virtual void setBase( int base ); //! \return the current minimum value allowed - virtual Q_LLONG bottom() const; + virtual TQ_LLONG bottom() const; //! \return the current maximum value allowed - virtual Q_LLONG top() const; + virtual TQ_LLONG top() const; //! \return the current numeric base virtual int base () const; private: - Q_LLONG m_base; - Q_LLONG m_min; - Q_LLONG m_max; + TQ_LLONG m_base; + TQ_LLONG m_min; + TQ_LLONG m_max; }; } diff --git a/kexi/kexiutils/styleproxy.cpp b/kexi/kexiutils/styleproxy.cpp index e638cac7..56bf8391 100644 --- a/kexi/kexiutils/styleproxy.cpp +++ b/kexi/kexiutils/styleproxy.cpp @@ -21,10 +21,10 @@ using namespace KexiUtils; -StyleProxy::StyleProxy(QStyle* parentStyle) - : QStyle() +StyleProxy::StyleProxy(TQStyle* tqparentStyle) + : TQStyle() { - setParentStyle(parentStyle); + setParentStyle(tqparentStyle); } StyleProxy::~StyleProxy() @@ -32,12 +32,12 @@ StyleProxy::~StyleProxy() delete m_style; } -void StyleProxy::setParentStyle(QStyle* style) +void StyleProxy::setParentStyle(TQStyle* style) { - m_style = QStyleFactory::create(style->name()); + m_style = TQStyleFactory::create(style->name()); } -QStyle* StyleProxy::parentStyle() const +TQStyle* StyleProxy::tqparentStyle() const { return m_style; } diff --git a/kexi/kexiutils/styleproxy.h b/kexi/kexiutils/styleproxy.h index 667e20b1..779298ee 100644 --- a/kexi/kexiutils/styleproxy.h +++ b/kexi/kexiutils/styleproxy.h @@ -20,15 +20,15 @@ #ifndef KEXIUTILS_STYLEPROXY_H #define KEXIUTILS_STYLEPROXY_H -#include <qstyle.h> -#include <qstylefactory.h> -#include <qpixmap.h> +#include <tqstyle.h> +#include <tqstylefactory.h> +#include <tqpixmap.h> #include "kexiutils_export.h" namespace KexiUtils { -//! @short a QStyle proxy allowing to customizing the currently used style +//! @short a TQStyle proxy allowing to customizing the currently used style /*! All you need is to reimplement one or more of the methods. For example, you can reimpelmente drawPrimitive() and temporary change the color in color group. @@ -39,136 +39,136 @@ namespace KexiUtils { class MyStyle : public KexiUtils::StyleProxy { //reimplement method(s) here... }; - QWidget *w = ..... + TQWidget *w = ..... w->setStyle( new MyStyle(&w->style(), w) ); //this will alter w's style a bit \endcode More info at http://doc.trolltech.com/qq/qq09-q-and-a.html#style */ -class KEXIUTILS_EXPORT StyleProxy : public QStyle +class KEXIUTILS_EXPORT StyleProxy : public TQStyle { public: - /*! Creates a new style proxy object. \a parentStyle pointer will not be kept - (because it's most likely owned by the application: a new QStyle instance + /*! Creates a new style proxy object. \a tqparentStyle pointer will not be kept + (because it's most likely owned by the application: a new TQStyle instance for this name will be created internally. */ - StyleProxy(QStyle* parentStyle); + StyleProxy(TQStyle* tqparentStyle); virtual ~StyleProxy(); - QStyle* parentStyle() const; - void setParentStyle(QStyle* style); + TQStyle* tqparentStyle() const; + void setParentStyle(TQStyle* style); - virtual void polish( QWidget *w ) { m_style->polish(w); } - virtual void unPolish( QWidget *w ) { m_style->unPolish(w); } + virtual void polish( TQWidget *w ) { m_style->polish(w); } + virtual void unPolish( TQWidget *w ) { m_style->unPolish(w); } - virtual void polish( QApplication *a ) { m_style->polish(a); } - virtual void unPolish( QApplication *a ) { m_style->unPolish(a); } + virtual void polish( TQApplication *a ) { m_style->polish(a); } + virtual void unPolish( TQApplication *a ) { m_style->unPolish(a); } - virtual void polish( QPalette &p ) { m_style->polish(p); }; + virtual void polish( TQPalette &p ) { m_style->polish(p); }; - virtual void polishPopupMenu( QPopupMenu* p ) { m_style->polishPopupMenu(p); } + virtual void polishPopupMenu( TQPopupMenu* p ) { m_style->polishPopupMenu(p); } - virtual QRect itemRect( QPainter *p, const QRect &r, - int flags, bool enabled, const QPixmap *pixmap, const QString &text, int len = -1 ) const + virtual TQRect tqitemRect( TQPainter *p, const TQRect &r, + int flags, bool enabled, const TQPixmap *pixmap, const TQString &text, int len = -1 ) const { - return m_style->itemRect( p, r, flags, enabled, pixmap, text, len ); + return m_style->tqitemRect( p, r, flags, enabled, pixmap, text, len ); } - virtual void drawItem( QPainter *p, const QRect &r, - int flags, const QColorGroup &g, bool enabled, const QPixmap *pixmap, const QString &text, - int len = -1, const QColor *penColor = 0 ) const + virtual void drawItem( TQPainter *p, const TQRect &r, + int flags, const TQColorGroup &g, bool enabled, const TQPixmap *pixmap, const TQString &text, + int len = -1, const TQColor *penColor = 0 ) const { m_style->drawItem( p, r, flags, g, enabled, pixmap, text, len, penColor ); } - virtual void drawPrimitive( PrimitiveElement pe, - QPainter *p, const QRect &r, const QColorGroup &cg, SFlags flags = Style_Default, - const QStyleOption& option = QStyleOption::Default ) const + virtual void tqdrawPrimitive( TQ_PrimitiveElement pe, + TQPainter *p, const TQRect &r, const TQColorGroup &cg, SFlags flags = Style_Default, + const TQStyleOption& option = TQStyleOption::Default ) const { - m_style->drawPrimitive( pe, p, r, cg, flags, option ); + m_style->tqdrawPrimitive( pe, p, r, cg, flags, option ); } - virtual void drawControl( ControlElement element, - QPainter *p, const QWidget *widget, const QRect &r, const QColorGroup &cg, - SFlags how = Style_Default, const QStyleOption& option = QStyleOption::Default ) const + virtual void tqdrawControl( TQ_ControlElement element, + TQPainter *p, const TQWidget *widget, const TQRect &r, const TQColorGroup &cg, + SFlags how = Style_Default, const TQStyleOption& option = TQStyleOption::Default ) const { - m_style->drawControl( element, p, widget, r, cg, how, option ); + m_style->tqdrawControl( element, p, widget, r, cg, how, option ); } - virtual void drawControlMask( ControlElement element, - QPainter *p, const QWidget *widget, const QRect &r, - const QStyleOption& option = QStyleOption::Default ) const + virtual void tqdrawControlMask( TQ_ControlElement element, + TQPainter *p, const TQWidget *widget, const TQRect &r, + const TQStyleOption& option = TQStyleOption::Default ) const { - m_style->drawControlMask( element, p, widget, r, option ); + m_style->tqdrawControlMask( element, p, widget, r, option ); } - virtual QRect subRect( SubRect r, const QWidget *widget ) const + virtual TQRect subRect( SubRect r, const TQWidget *widget ) const { return m_style->subRect( r, widget ); } - virtual void drawComplexControl( ComplexControl control, - QPainter *p, const QWidget *widget, const QRect &r, - const QColorGroup &cg, SFlags how = Style_Default, -#ifdef Q_QDOC + virtual void tqdrawComplexControl( TQ_ComplexControl control, + TQPainter *p, const TQWidget *widget, const TQRect &r, + const TQColorGroup &cg, SFlags how = Style_Default, +#ifdef TQ_TQDOC SCFlags sub = SC_All, #else SCFlags sub = (uint)SC_All, #endif - SCFlags subActive = SC_None, const QStyleOption& option = QStyleOption::Default ) const + SCFlags subActive = SC_None, const TQStyleOption& option = TQStyleOption::Default ) const { - drawComplexControl( control, p, widget, r, cg, how, sub, subActive, option ); + tqdrawComplexControl( control, p, widget, r, cg, how, sub, subActive, option ); } - virtual void drawComplexControlMask( ComplexControl control, - QPainter *p, const QWidget *widget, const QRect &r, - const QStyleOption& option = QStyleOption::Default ) const + virtual void tqdrawComplexControlMask( TQ_ComplexControl control, + TQPainter *p, const TQWidget *widget, const TQRect &r, + const TQStyleOption& option = TQStyleOption::Default ) const { - m_style->drawComplexControlMask( control, p, widget, r, option ); + m_style->tqdrawComplexControlMask( control, p, widget, r, option ); } - virtual QRect querySubControlMetrics( ComplexControl control, - const QWidget *widget, SubControl sc, - const QStyleOption& option = QStyleOption::Default ) const + virtual TQRect querySubControlMetrics( TQ_ComplexControl control, + const TQWidget *widget, SubControl sc, + const TQStyleOption& option = TQStyleOption::Default ) const { return m_style->querySubControlMetrics( control, widget, sc, option ); } - virtual SubControl querySubControl( ComplexControl control, - const QWidget *widget, const QPoint &pos, - const QStyleOption& option = QStyleOption::Default ) const + virtual SubControl querySubControl( TQ_ComplexControl control, + const TQWidget *widget, const TQPoint &pos, + const TQStyleOption& option = TQStyleOption::Default ) const { return m_style->querySubControl( control, widget, pos, option ); } - virtual int pixelMetric( PixelMetric metric, - const QWidget *widget = 0 ) const + virtual int tqpixelMetric( PixelMetric metric, + const TQWidget *widget = 0 ) const { - return m_style->pixelMetric( metric, widget ); + return m_style->tqpixelMetric( metric, widget ); } - virtual QSize sizeFromContents( ContentsType contents, - const QWidget *widget, const QSize &contentsSize, - const QStyleOption& option = QStyleOption::Default ) const + virtual TQSize tqsizeFromContents( ContentsType contents, + const TQWidget *widget, const TQSize &contentsSize, + const TQStyleOption& option = TQStyleOption::Default ) const { - return m_style->sizeFromContents( contents, widget, contentsSize, option ); + return m_style->tqsizeFromContents( contents, widget, contentsSize, option ); } - virtual int styleHint( StyleHint stylehint, - const QWidget *widget = 0, const QStyleOption& option = QStyleOption::Default, - QStyleHintReturn* returnData = 0 ) const + virtual int tqstyleHint( TQ_StyleHint stylehint, + const TQWidget *widget = 0, const TQStyleOption& option = TQStyleOption::Default, + TQStyleHintReturn* returnData = 0 ) const { - return m_style->styleHint( stylehint, widget, option, returnData ); + return m_style->tqstyleHint( stylehint, widget, option, returnData ); } - virtual QPixmap stylePixmap( StylePixmap stylepixmap, - const QWidget *widget = 0, - const QStyleOption& option = QStyleOption::Default ) const + virtual TQPixmap stylePixmap( StylePixmap stylepixmap, + const TQWidget *widget = 0, + const TQStyleOption& option = TQStyleOption::Default ) const { return m_style->stylePixmap( stylepixmap, widget, option ); } protected: - QStyle *m_style; + TQStyle *m_style; }; } diff --git a/kexi/kexiutils/transliteration_table.h b/kexi/kexiutils/transliteration_table.h index 5be7dadc..0eece11c 100644 --- a/kexi/kexiutils/transliteration_table.h +++ b/kexi/kexiutils/transliteration_table.h @@ -1,4 +1,4 @@ -/* Transliteration table of 65535 unicode characters +/* Transliteration table of 65535 tqunicode characters Do not edit this file, it is generated by ./generate_transliteration_table.sh script. */ diff --git a/kexi/kexiutils/tristate.h b/kexi/kexiutils/tristate.h index a3de22bb..0a8df95c 100644 --- a/kexi/kexiutils/tristate.h +++ b/kexi/kexiutils/tristate.h @@ -20,7 +20,7 @@ #ifndef _TRISTATE_TYPE_H_ #define _TRISTATE_TYPE_H_ -#include <qstring.h> +#include <tqstring.h> /** * \e cancelled value, in most cases usable if there is a need for returning @@ -79,7 +79,7 @@ static const char dontKnow = cancelled; * is irrelevant to the current situation. * * Other use for tristate class could be to allow cancellation within - * a callback function or a Qt slot. Example: + * a callback function or a TQt slot. Example: * \code * public slots: * void validateData(tristate& result); @@ -87,10 +87,10 @@ static const char dontKnow = cancelled; * Having the single parameter, signals and slots have still simple look. * Developers can alter their code (by replacing 'bool& result' with 'tristate& result') * in case when a possibility of canceling of, say, data provessing needs to be implemented. - * Let's say \e validateData() function uses a QDialog to get some validation from a user. - * While QDialog::Rejected is returned after cancellation of the validation process, + * Let's say \e validateData() function uses a TQDialog to get some validation from a user. + * While TQDialog::Rejected is returned after cancellation of the validation process, * the information about cancellation needs to be transferred up to a higher level of the program. - * Storing values of type QDialog::DialogCode there could be found as unreadable, and + * Storing values of type TQDialog::DialogCode there could be found as unreadable, and * casting these to int is not typesafe. With tristate class it's easier to make it obvious that * cancellation should be taken into account. * @@ -163,10 +163,10 @@ public: /** * \return text representation of the value: "true", "false" or "cancelled". */ - QString toString() const { + TQString toString() const { if (m_value==False) - return QString::fromLatin1("false"); - return m_value==True ? QString::fromLatin1("true") : QString::fromLatin1("cancelled"); + return TQString::tqfromLatin1("false"); + return m_value==True ? TQString::tqfromLatin1("true") : TQString::tqfromLatin1("cancelled"); } private: diff --git a/kexi/kexiutils/utils.cpp b/kexi/kexiutils/utils.cpp index f96465a6..6b3e26dc 100644 --- a/kexi/kexiutils/utils.cpp +++ b/kexi/kexiutils/utils.cpp @@ -20,13 +20,13 @@ #include "utils.h" #include "utils_p.h" -#include <qregexp.h> -#include <qpainter.h> -#include <qimage.h> -#include <qwmatrix.h> -#include <qiconset.h> -#include <qbitmap.h> -#include <qfile.h> +#include <tqregexp.h> +#include <tqpainter.h> +#include <tqimage.h> +#include <tqwmatrix.h> +#include <tqiconset.h> +#include <tqbitmap.h> +#include <tqfile.h> #include <kdebug.h> #include <kcursor.h> @@ -36,7 +36,7 @@ #include <kpixmapeffect.h> #include <kiconloader.h> -#if defined(Q_WS_WIN) +#if defined(TQ_WS_WIN) # include <win32_utils.h> #endif @@ -45,7 +45,7 @@ using namespace KexiUtils; DelayedCursorHandler::DelayedCursorHandler() : startedOrActive(false) { - connect(&timer, SIGNAL(timeout()), this, SLOT(show())); + connect(&timer, TQT_SIGNAL(timeout()), this, TQT_SLOT(show())); } void DelayedCursorHandler::start(bool noDelay) { startedOrActive = true; @@ -54,10 +54,10 @@ void DelayedCursorHandler::start(bool noDelay) { void DelayedCursorHandler::stop() { startedOrActive = false; timer.stop(); - QApplication::restoreOverrideCursor(); + TQApplication::restoreOverrideCursor(); } void DelayedCursorHandler::show() { - QApplication::setOverrideCursor( KCursor::waitCursor() ); + TQApplication::setOverrideCursor( KCursor::waitCursor() ); } DelayedCursorHandler _delayedCursorHandler; @@ -94,12 +94,12 @@ WaitCursorRemover::~WaitCursorRemover() //-------------------------------------------------------------------------------- -QString KexiUtils::fileDialogFilterString(const KMimeType::Ptr& mime, bool kdeFormat) +TQString KexiUtils::fileDialogFilterString(const KMimeType::Ptr& mime, bool kdeFormat) { if (mime==0) - return QString::null; + return TQString(); - QString str; + TQString str; if (kdeFormat) { if (mime->patterns().isEmpty()) str = "*"; @@ -123,138 +123,138 @@ QString KexiUtils::fileDialogFilterString(const KMimeType::Ptr& mime, bool kdeFo return str; } -QString KexiUtils::fileDialogFilterString(const QString& mimeString, bool kdeFormat) +TQString KexiUtils::fileDialogFilterString(const TQString& mimeString, bool kdeFormat) { KMimeType::Ptr ptr = KMimeType::mimeType(mimeString); return fileDialogFilterString( ptr, kdeFormat ); } -QString KexiUtils::fileDialogFilterStrings(const QStringList& mimeStrings, bool kdeFormat) +TQString KexiUtils::fileDialogFilterStrings(const TQStringList& mimeStrings, bool kdeFormat) { - QString ret; - QStringList::ConstIterator endIt = mimeStrings.constEnd(); - for(QStringList::ConstIterator it = mimeStrings.constBegin(); it != endIt; ++it) + TQString ret; + TQStringList::ConstIterator endIt = mimeStrings.constEnd(); + for(TQStringList::ConstIterator it = mimeStrings.constBegin(); it != endIt; ++it) ret += fileDialogFilterString(*it, kdeFormat); return ret; } -QColor KexiUtils::blendedColors(const QColor& c1, const QColor& c2, int factor1, int factor2) +TQColor KexiUtils::blendedColors(const TQColor& c1, const TQColor& c2, int factor1, int factor2) { - return QColor( + return TQColor( int( (c1.red()*factor1+c2.red()*factor2)/(factor1+factor2) ), int( (c1.green()*factor1+c2.green()*factor2)/(factor1+factor2) ), int( (c1.blue()*factor1+c2.blue()*factor2)/(factor1+factor2) ) ); } -QColor KexiUtils::contrastColor(const QColor& c) +TQColor KexiUtils::contrastColor(const TQColor& c) { - int g = qGray( c.rgb() ); + int g = tqGray( c.rgb() ); if (g>110) return c.dark(200); else if (g>80) return c.light(150); else if (g>20) return c.light(300); - return Qt::gray; + return TQt::gray; } -QColor KexiUtils::bleachedColor(const QColor& c, int factor) +TQColor KexiUtils::bleachedColor(const TQColor& c, int factor) { int h, s, v; c.getHsv( &h, &s, &v ); - QColor c2; + TQColor c2; if (factor < 100) factor = 100; if (s>=250 && v>=250) //for colors like cyan or red, make the result more white - s = QMAX(0, s - factor - 50); + s = TQMAX(0, s - factor - 50); else if (s<=5 && s<=5) v += factor-50; - c2.setHsv(h, s, QMIN(255,v + factor-100)); + c2.setHsv(h, s, TQMIN(255,v + factor-100)); return c2; } -QIconSet KexiUtils::colorizeIconToTextColor(const QPixmap& icon, const QPalette& palette) +TQIconSet KexiUtils::colorizeIconToTextColor(const TQPixmap& icon, const TQPalette& palette) { - QPixmap pm( + TQPixmap pm( KIconEffect().apply( icon, KIconEffect::Colorize, 1.0f, palette.active().buttonText(), false ) ); KPixmap kpm(pm); - return QIconSet( + return TQIconSet( KPixmapEffect::fade( kpm, 0.33, palette.active().button() ) ); } -QPixmap KexiUtils::emptyIcon(KIcon::Group iconGroup) +TQPixmap KexiUtils::emptyIcon(KIcon::Group iconGroup) { - QPixmap noIcon( IconSize( iconGroup ), IconSize( iconGroup ) ); - QBitmap bmpNoIcon(noIcon.size()); - bmpNoIcon.fill(Qt::color0); + TQPixmap noIcon( IconSize( iconGroup ), IconSize( iconGroup ) ); + TQBitmap bmpNoIcon(noIcon.size()); + bmpNoIcon.fill(TQt::color0); noIcon.setMask(bmpNoIcon); return noIcon; } -void KexiUtils::serializeMap(const QMap<QString,QString>& map, const QByteArray& array) +void KexiUtils::serializeMap(const TQMap<TQString,TQString>& map, const TQByteArray& array) { - QDataStream ds(array, IO_WriteOnly); + TQDataStream ds(array, IO_WriteOnly); ds << map; } -void KexiUtils::serializeMap(const QMap<QString,QString>& map, QString& string) +void KexiUtils::serializeMap(const TQMap<TQString,TQString>& map, TQString& string) { - QByteArray array; - QDataStream ds(array, IO_WriteOnly); + TQByteArray array; + TQDataStream ds(array, IO_WriteOnly); ds << map; kdDebug() << array[3] << " " << array[4] << " " << array[5] << endl; const uint size = array.size(); - string = QString::null; + string = TQString(); string.reserve(size); for (uint i=0; i<size; i++) { - string[i]=QChar(ushort(array[i]+1)); + string[i]=TQChar(ushort(array[i]+1)); } } -QMap<QString,QString> KexiUtils::deserializeMap(const QByteArray& array) +TQMap<TQString,TQString> KexiUtils::deserializeMap(const TQByteArray& array) { - QMap<QString,QString> map; - QDataStream ds(array, IO_ReadOnly); + TQMap<TQString,TQString> map; + TQDataStream ds(array, IO_ReadOnly); ds >> map; return map; } -QMap<QString,QString> KexiUtils::deserializeMap(const QString& string) +TQMap<TQString,TQString> KexiUtils::deserializeMap(const TQString& string) { const uint size = string.length(); - QCString cstr(string.latin1()); - QByteArray array( size ); + TQCString cstr(string.latin1()); + TQByteArray array( size ); for (uint i=0; i<size; i++) { - array[i] = char(string[i].unicode()-1); + array[i] = char(string[i].tqunicode()-1); } - QMap<QString,QString> map; - QDataStream ds(array, IO_ReadOnly); + TQMap<TQString,TQString> map; + TQDataStream ds(array, IO_ReadOnly); ds >> map; return map; } -QString KexiUtils::stringToFileName(const QString& string) +TQString KexiUtils::stringToFileName(const TQString& string) { - QString _string(string); - _string.replace(QRegExp("[\\\\/:\\*?\"<>|]"), " "); + TQString _string(string); + _string.tqreplace(TQRegExp("[\\\\/:\\*?\"<>|]"), " "); return _string.simplifyWhiteSpace(); } -void KexiUtils::simpleCrypt(QString& string) +void KexiUtils::simpleCrypt(TQString& string) { for (uint i=0; i<string.length(); i++) - string[i] = QChar( string[i].unicode() + 47 + i ); + string[i] = TQChar( string[i].tqunicode() + 47 + i ); } -void KexiUtils::simpleDecrypt(QString& string) +void KexiUtils::simpleDecrypt(TQString& string) { for (uint i=0; i<string.length(); i++) - string[i] = QChar( string[i].unicode() - 47 - i ); + string[i] = TQChar( string[i].tqunicode() - 47 - i ); } -void KexiUtils::drawPixmap( QPainter& p, int lineWidth, const QRect& rect, - const QPixmap& pixmap, int alignment, bool scaledContents, bool keepAspectRatio) +void KexiUtils::drawPixmap( TQPainter& p, int lineWidth, const TQRect& rect, + const TQPixmap& pixmap, int tqalignment, bool scaledContents, bool keepAspectRatio) { if (pixmap.isNull()) return; @@ -263,69 +263,69 @@ void KexiUtils::drawPixmap( QPainter& p, int lineWidth, const QRect& rect, const int w = rect.width()-lineWidth-lineWidth; const int h = rect.height()-lineWidth-lineWidth; //! @todo we can optimize drawing by drawing rescaled pixmap here -//! and performing detailed painting later (using QTimer) - QPixmap pixmapBuffer; - QPainter p2; - QPainter *target; +//! and performing detailed painting later (using TQTimer) + TQPixmap pixmapBuffer; + TQPainter p2; + TQPainter *target; if (fast) { target = &p; } else { -//moved pixmapBuffer.resize(rect.size()-QSize(lineWidth, lineWidth)); +//moved pixmapBuffer.resize(rect.size()-TQSize(lineWidth, lineWidth)); //moved p2.begin(&pm, p.device()); target = &p2; } //! @todo only create buffered pixmap of the minimum size and then do not fillRect() // target->fillRect(0,0,rect.width(),rect.height(), backgroundColor); - QPoint pos; + TQPoint pos; if (scaledContents) { if (keepAspectRatio) { - QImage img(pixmap.convertToImage()); - img = img.smoothScale(w, h, QImage::ScaleMin); + TQImage img(pixmap.convertToImage()); + img = img.smoothScale(w, h, TQ_ScaleMin); pos = rect.topLeft(); //0, 0); if (img.width() < w) { - int hAlign = QApplication::horizontalAlignment( alignment ); - if ( hAlign & Qt::AlignRight ) + int hAlign = TQApplication::horizontalAlignment( tqalignment ); + if ( hAlign & TQt::AlignRight ) pos.setX(pos.x() + w-img.width()); - else if ( hAlign & Qt::AlignHCenter ) + else if ( hAlign & TQt::AlignHCenter ) pos.setX(pos.x() + w/2-img.width()/2); } else if (img.height() < h) { - if ( alignment & Qt::AlignBottom ) + if ( tqalignment & TQt::AlignBottom ) pos.setY(pos.y() + h-img.height()); - else if ( alignment & Qt::AlignVCenter ) + else if ( tqalignment & TQt::AlignVCenter ) pos.setY(pos.y() + h/2-img.height()/2); } pixmapBuffer.convertFromImage(img); if (!fast) { - p2.begin(&pixmapBuffer, p.device()); + p2.tqbegin(TQT_TQPAINTDEVICE(&pixmapBuffer), p.tqdevice()); } else target->drawPixmap(pos, pixmapBuffer); } else { if (!fast) { - pixmapBuffer.resize(rect.size()-QSize(lineWidth, lineWidth)); - p2.begin(&pixmapBuffer, p.device()); - p2.drawPixmap(QRect(rect.x(), rect.y(), w, h), pixmap); + pixmapBuffer.resize(rect.size()-TQSize(lineWidth, lineWidth)); + p2.tqbegin(TQT_TQPAINTDEVICE(&pixmapBuffer), p.tqdevice()); + p2.drawPixmap(TQRect(rect.x(), rect.y(), w, h), pixmap); } else - target->drawPixmap(QRect(rect.x() + lineWidth, rect.y() + lineWidth, w, h), pixmap); + target->drawPixmap(TQRect(rect.x() + lineWidth, rect.y() + lineWidth, w, h), pixmap); } } else { - int hAlign = QApplication::horizontalAlignment( alignment ); - if ( hAlign & Qt::AlignRight ) + int hAlign = TQApplication::horizontalAlignment( tqalignment ); + if ( hAlign & TQt::AlignRight ) pos.setX(pos.x() + w-pixmap.width()); - else if ( hAlign & Qt::AlignHCenter ) + else if ( hAlign & TQt::AlignHCenter ) pos.setX(pos.x() + w/2-pixmap.width()/2); else //left, etc. pos.setX(pos.x()); - if ( alignment & Qt::AlignBottom ) + if ( tqalignment & TQt::AlignBottom ) pos.setY(pos.y() + h-pixmap.height()); - else if ( alignment & Qt::AlignVCenter ) + else if ( tqalignment & TQt::AlignVCenter ) pos.setY(pos.y() + h/2-pixmap.height()/2); else //top, etc. pos.setY(pos.y()); @@ -339,27 +339,27 @@ void KexiUtils::drawPixmap( QPainter& p, int lineWidth, const QRect& rect, bitBlt( p.device(), // pos.x(), // pos.y(), - (int)p.worldMatrix().dx() + rect.x() + lineWidth + pos.x(), - (int)p.worldMatrix().dy() + rect.y() + lineWidth + pos.y(), + (int)p.tqworldMatrix().dx() + rect.x() + lineWidth + pos.x(), + (int)p.tqworldMatrix().dy() + rect.y() + lineWidth + pos.y(), &pixmapBuffer); } } -QString KexiUtils::ptrToStringInternal(void* ptr, uint size) +TQString KexiUtils::ptrToStringInternal(void* ptr, uint size) { - QString str; + TQString str; unsigned char* cstr_ptr = (unsigned char*)&ptr; for (uint i=0; i<size; i++) { - QString s; + TQString s; s.sprintf("%2.2x", cstr_ptr[i]); str.append( s ); } return str; } -void* KexiUtils::stringToPtrInternal(const QString& str, uint size) +void* KexiUtils::stringToPtrInternal(const TQString& str, uint size) { - QByteArray array(size); + TQByteArray array(size); if ((str.length()/2)<size) return 0; bool ok; @@ -371,26 +371,26 @@ void* KexiUtils::stringToPtrInternal(const QString& str, uint size) return *(void**)(array.data()); } -void KexiUtils::setFocusWithReason(QWidget* widget, QFocusEvent::Reason reason) +void KexiUtils::setFocusWithReason(TQWidget* widget, TQFocusEvent::Reason reason) { - QEvent fe( QEvent::FocusIn ); - QFocusEvent::setReason(reason); - QApplication::sendEvent( widget, &fe ); - QFocusEvent::resetReason(); + TQEvent fe( TQEvent::FocusIn ); + TQT_TQFOCUSEVENT(&fe)->setReason(reason); + TQApplication::sendEvent( widget, &fe ); + TQT_TQFOCUSEVENT(&fe)->resetReason(); } -void KexiUtils::unsetFocusWithReason(QWidget* widget, QFocusEvent::Reason reason) +void KexiUtils::unsetFocusWithReason(TQWidget* widget, TQFocusEvent::Reason reason) { - QEvent fe( QEvent::FocusOut ); - QFocusEvent::setReason(reason); - QApplication::sendEvent( widget, &fe ); - QFocusEvent::resetReason(); + TQEvent fe( TQEvent::FocusOut ); + TQT_TQFOCUSEVENT(&fe)->setReason(reason); + TQApplication::sendEvent( widget, &fe ); + TQT_TQFOCUSEVENT(&fe)->resetReason(); } -CopyFileResult KexiUtils::copyFile(const QString& src, const QString& dest) +CopyFileResult KexiUtils::copyFile(const TQString& src, const TQString& dest) { -#ifdef Q_WS_WIN - int res = fcopy( QFile::encodeName( src ), QFile::encodeName( dest ) ); +#ifdef TQ_WS_WIN + int res = fcopy( TQFile::encodeName( src ), TQFile::encodeName( dest ) ); if (res == fcopy_src_err) return CopyReadError; else if (res == fcopy_dest_err) @@ -404,10 +404,10 @@ CopyFileResult KexiUtils::copyFile(const QString& src, const QString& dest) int c_in=0, c_out=0; CopyFileResult res=CopySuccess; - in=fopen(QFile::encodeName( src ), "rb"); + in=fopen(TQFile::encodeName( src ), "rb"); if (!in) return CopyReadError; - out=fopen(QFile::encodeName( dest ), "wb"); + out=fopen(TQFile::encodeName( dest ), "wb"); if (!out) return CopyWriteError; while (!feof(in) && !ferror(in) && !ferror(out)) { diff --git a/kexi/kexiutils/utils.h b/kexi/kexiutils/utils.h index 03b775c7..118f2d64 100644 --- a/kexi/kexiutils/utils.h +++ b/kexi/kexiutils/utils.h @@ -22,43 +22,43 @@ #include "kexiutils_export.h" -#include <qguardedptr.h> -#include <qobjectlist.h> +#include <tqguardedptr.h> +#include <tqobjectlist.h> #include <kmimetype.h> -class QColor; +class TQColor; //! @short General Utils namespace KexiUtils { - //! \return true if \a o has parent \a par. - inline bool hasParent(QObject* par, QObject* o) + //! \return true if \a o has tqparent \a par. + inline bool hasParent(TQObject* par, TQObject* o) { if (!o || !par) return false; while (o && o!=par) - o = o->parent(); + o = o->tqparent(); return o==par; } - //! \return parent object of \a o that inherits \a className or NULL if no such parent + //! \return tqparent object of \a o that inherits \a className or NULL if no such tqparent template<class type> - inline type* findParent(QObject* o, const char* className) + inline type* findParent(TQT_BASE_OBJECT_NAME* o, const char* className) { if (!o || !className || className[0]=='\0') return 0; - while ( ((o=o->parent())) && !o->inherits(className) ) + while ( ((o=TQT_TQOBJECT(o)->tqparent())) && !TQT_TQOBJECT(o)->inherits(className) ) ; return static_cast<type*>(o); } //! Const version of findParent() template<class type> - inline const type* findParentConst(const QObject* const o, const char* className) + inline const type* findParentConst(const TQObject* const o, const char* className) { - const QObject * obj = o; + const TQObject * obj = o; if (!obj || !className || className[0]=='\0') return 0; - while ( ((obj=obj->parent())) && !obj->inherits(className) ) + while ( ((obj=obj->tqparent())) && !obj->inherits(className) ) ; return static_cast<const type*>(obj); } @@ -67,23 +67,23 @@ namespace KexiUtils If objName is 0 (the default), all object names match. Returned pointer type is casted. */ template<class type> - type* findFirstChild(QObject *o, const char* className, const char* objName = 0) + type* findFirstChild(TQT_BASE_OBJECT_NAME *o, const char* className, const char* objName = 0) { if (!o || !className || className[0]=='\0') return 0; - QObjectList *l = o->queryList( className, objName ); - QObject *result = l->first(); + TQObjectList *l = TQT_TQOBJECT(o)->queryList( className, objName ); + TQT_BASE_OBJECT_NAME *result = l->first(); delete l; return static_cast<type*>(result); } - //! QDateTime - a hack needed because QVariant(QTime) has broken isNull() - inline QDateTime stringToHackedQTime(const QString& s) + //! TQDateTime - a hack needed because TQVariant(TQTime) has broken isNull() + inline TQDateTime stringToHackedTQTime(const TQString& s) { if (s.isEmpty()) - return QDateTime(); - // kdDebug() << QDateTime( QDate(0,1,2), QTime::fromString( s, Qt::ISODate ) ).toString(Qt::ISODate) << endl;; - return QDateTime( QDate(0,1,2), QTime::fromString( s, Qt::ISODate ) ); + return TQDateTime(); + // kdDebug() << TQDateTime( TQDate(0,1,2), TQTime::fromString( s, Qt::ISODate ) ).toString(Qt::ISODate) << endl;; + return TQDateTime( TQDate(0,1,2), TQTime::fromString( s, Qt::ISODate ) ); } /*! Sets "wait" cursor with 1 second delay (or 0 seconds if noDelay is true). @@ -126,118 +126,118 @@ namespace KexiUtils bool m_reactivateCursor : 1; }; - /*! \return filter string in QFileDialog format for a mime type pointed by \a mime - If \a kdeFormat is true, QFileDialog-compatible filter string is generated, + /*! \return filter string in TQFileDialog format for a mime type pointed by \a mime + If \a kdeFormat is true, TQFileDialog-compatible filter string is generated, eg. "Image files (*.png *.xpm *.jpg)", otherwise KFileDialog -compatible filter string is generated, eg. "*.png *.xpm *.jpg|Image files (*.png *.xpm *.jpg)". "\\n" is appended if \a kdeFormat is true, otherwise ";;" is appended. */ - KEXIUTILS_EXPORT QString fileDialogFilterString(const KMimeType::Ptr& mime, bool kdeFormat = true); + KEXIUTILS_EXPORT TQString fileDialogFilterString(const KMimeType::Ptr& mime, bool kdeFormat = true); - /*! @overload QString fileDialogFilterString(const KMimeType::Ptr& mime, bool kdeFormat = true) */ - KEXIUTILS_EXPORT QString fileDialogFilterString(const QString& mimeString, bool kdeFormat = true); + /*! @overload TQString fileDialogFilterString(const KMimeType::Ptr& mime, bool kdeFormat = true) */ + KEXIUTILS_EXPORT TQString fileDialogFilterString(const TQString& mimeString, bool kdeFormat = true); - /*! Like QString fileDialogFilterString(const KMimeType::Ptr& mime, bool kdeFormat = true) + /*! Like TQString fileDialogFilterString(const KMimeType::Ptr& mime, bool kdeFormat = true) but returns a list of filter strings. */ - KEXIUTILS_EXPORT QString fileDialogFilterStrings(const QStringList& mimeStrings, bool kdeFormat); + KEXIUTILS_EXPORT TQString fileDialogFilterStrings(const TQStringList& mimeStrings, bool kdeFormat); /*! \return a color being a result of blending \a c1 with \a c2 with \a factor1 and \a factor1 factors: (c1*factor1+c2*factor2)/(factor1+factor2). */ - KEXIUTILS_EXPORT QColor blendedColors(const QColor& c1, const QColor& c2, int factor1 = 1, int factor2 = 1); + KEXIUTILS_EXPORT TQColor blendedColors(const TQColor& c1, const TQColor& c2, int factor1 = 1, int factor2 = 1); /*! \return a contrast color for a color \a c: If \a c is light color, darker color created using c.dark(200) is returned; otherwise lighter color created using c.light(200) is returned. */ - KEXIUTILS_EXPORT QColor contrastColor(const QColor& c); + KEXIUTILS_EXPORT TQColor contrastColor(const TQColor& c); /*! \return a lighter color for a color \a c and a factor \a factor. - For colors like Qt::red or Qt::green where hue and saturation are near to 255, + For colors like TQt::red or TQt::green where hue and saturation are near to 255, hue is decreased so the result will be more bleached. For black color the result is dark gray rather than black. */ - KEXIUTILS_EXPORT QColor bleachedColor(const QColor& c, int factor); + KEXIUTILS_EXPORT TQColor bleachedColor(const TQColor& c, int factor); /*! \return icon set computed as a result of colorizing \a icon pixmap with "buttonText" color of \a palette palette. This function is useful for displaying monochromed icons on the list view or table view header, to avoid bloat, but still have the color compatible with accessibility settings. */ - KEXIUTILS_EXPORT QIconSet colorizeIconToTextColor(const QPixmap& icon, const QPalette& palette); + KEXIUTILS_EXPORT TQIconSet colorizeIconToTextColor(const TQPixmap& icon, const TQPalette& palette); /*! \return empty (fully transparent) pixmap that can be used as a place for icon of size \a iconGroup */ - KEXIUTILS_EXPORT QPixmap emptyIcon(KIcon::Group iconGroup); + KEXIUTILS_EXPORT TQPixmap emptyIcon(KIcon::Group iconGroup); /*! Serializes \a map to \a array. KexiUtils::deserializeMap() can be used to deserialize this array back to map. */ - KEXIUTILS_EXPORT void serializeMap(const QMap<QString,QString>& map, const QByteArray& array); - KEXIUTILS_EXPORT void serializeMap(const QMap<QString,QString>& map, QString& string); + KEXIUTILS_EXPORT void serializeMap(const TQMap<TQString,TQString>& map, const TQByteArray& array); + KEXIUTILS_EXPORT void serializeMap(const TQMap<TQString,TQString>& map, TQString& string); /*! \return a map deserialized from a byte array \a array. \a array need to contain data previously serialized using KexiUtils::serializeMap(). */ - KEXIUTILS_EXPORT QMap<QString,QString> deserializeMap(const QByteArray& array); + KEXIUTILS_EXPORT TQMap<TQString,TQString> deserializeMap(const TQByteArray& array); /*! \return a map deserialized from \a string. \a string need to contain data previously serialized using KexiUtils::serializeMap(). */ - KEXIUTILS_EXPORT QMap<QString,QString> deserializeMap(const QString& string); + KEXIUTILS_EXPORT TQMap<TQString,TQString> deserializeMap(const TQString& string); /*! \return a valid filename converted from \a string by: - replacing \\, /, :, *, ?, ", <, >, |, \n \\t characters with a space - - simplifing whitespace by removing redundant space characters using QString::simplifyWhiteSpace() + - simplifing whitespace by removing redundant space characters using TQString::simplifyWhiteSpace() Do not pass full paths here, but only filename strings. */ - KEXIUTILS_EXPORT QString stringToFileName(const QString& string); + KEXIUTILS_EXPORT TQString stringToFileName(const TQString& string); /*! Performs a simple \a string encryption using rot47-like algorithm. - Each character's unicode value is increased by 47 + i (where i is index of the character). + Each character's tqunicode value is increased by 47 + i (where i is index of the character). The resulting string still contains redable characters. Do not use this for data that can be accessed by attackers! */ - KEXIUTILS_EXPORT void simpleCrypt(QString& string); + KEXIUTILS_EXPORT void simpleCrypt(TQString& string); /*! Performs a simple \a string decryption using rot47-like algorithm, using opposite operations to KexiUtils::simpleCrypt(). */ - KEXIUTILS_EXPORT void simpleDecrypt(QString& string); + KEXIUTILS_EXPORT void simpleDecrypt(TQString& string); #ifdef KEXI_DEBUG_GUI //! Creates debug window for convenient debugging output - KEXIUTILS_EXPORT QWidget *createDebugWindow(QWidget *parent); + KEXIUTILS_EXPORT TQWidget *createDebugWindow(TQWidget *tqparent); //! Adds debug line for for KexiDB database - KEXIUTILS_EXPORT void addKexiDBDebug(const QString& text); + KEXIUTILS_EXPORT void addKexiDBDebug(const TQString& text); //! Adds debug line for for Table Designer (Alter Table actions) - KEXIUTILS_EXPORT void addAlterTableActionDebug(const QString& text, int nestingLevel = 0); + KEXIUTILS_EXPORT void addAlterTableActionDebug(const TQString& text, int nestingLevel = 0); //! Connects push button action to \a receiver and its \a slot. This allows to execute debug-related actions //! using buttons displayed in the debug window. KEXIUTILS_EXPORT void connectPushButtonActionForDebugWindow(const char* actionName, - const QObject *receiver, const char* slot); + const TQObject *receiver, const char* slot); #endif //! Draws pixmap on painter \a p using predefined parameters. //! Used in KexiDBImageBox and KexiBlobTableEdit. - KEXIUTILS_EXPORT void drawPixmap( QPainter& p, int lineWidth, const QRect& rect, - const QPixmap& pixmap, int alignment, bool scaledContents, bool keepAspectRatio); + KEXIUTILS_EXPORT void drawPixmap( TQPainter& p, int lineWidth, const TQRect& rect, + const TQPixmap& pixmap, int tqalignment, bool scaledContents, bool keepAspectRatio); //! @internal - KEXIUTILS_EXPORT QString ptrToStringInternal(void* ptr, uint size); + KEXIUTILS_EXPORT TQString ptrToStringInternal(void* ptr, uint size); //! @internal - KEXIUTILS_EXPORT void* stringToPtrInternal(const QString& str, uint size); + KEXIUTILS_EXPORT void* stringToPtrInternal(const TQString& str, uint size); //! \return a pointer \a ptr safely serialized to string template<class type> - QString ptrToString(type *ptr) + TQString ptrToString(type *ptr) { return ptrToStringInternal(ptr, sizeof(type*)); } //! \return a pointer of type \a type safely deserialized from \a str template<class type> - type* stringToPtr(const QString& str) + type* stringToPtr(const TQString& str) { return static_cast<type*>( stringToPtrInternal(str, sizeof(type*)) ); } //! Sets focus for widget \a widget with reason \a reason. - KEXIUTILS_EXPORT void setFocusWithReason(QWidget* widget, QFocusEvent::Reason reason); + KEXIUTILS_EXPORT void setFocusWithReason(TQWidget* widget, TQFocusEvent::Reason reason); //! Unsets focus for widget \a widget with reason \a reason. - KEXIUTILS_EXPORT void unsetFocusWithReason(QWidget* widget, QFocusEvent::Reason reason); + KEXIUTILS_EXPORT void unsetFocusWithReason(TQWidget* widget, TQFocusEvent::Reason reason); //! Used by copyFile() enum CopyFileResult { @@ -250,17 +250,17 @@ namespace KexiUtils Copies @p src file to @p dest file. @return CopySuccess on success, CopyReadError on source file error, CopyWriteError on destination file error. - @todo remove: QFile in Qt4 provides this. + @todo remove: TQFile in TQt4 provides this. */ - KEXIUTILS_EXPORT CopyFileResult copyFile(const QString& src, const QString& dest); + KEXIUTILS_EXPORT CopyFileResult copyFile(const TQString& src, const TQString& dest); } -//! sometimes we leave a space in the form of empty QFrame and want to insert here +//! sometimes we leave a space in the form of empty TQFrame and want to insert here //! a widget that must be instantiated by hand. //! This macro inserts a widget \a what into a frame \a where. #define GLUE_WIDGET(what, where) \ - { QVBoxLayout *lyr = new QVBoxLayout(where); \ + { TQVBoxLayout *lyr = new TQVBoxLayout(where); \ lyr->addWidget(what); } diff --git a/kexi/kexiutils/utils_p.h b/kexi/kexiutils/utils_p.h index 821c22b1..b91f2237 100644 --- a/kexi/kexiutils/utils_p.h +++ b/kexi/kexiutils/utils_p.h @@ -20,14 +20,15 @@ #ifndef KEXIUTILS_P_H #define KEXIUTILS_P_H -#include <qtimer.h> -#include <qapplication.h> -#include <qdialog.h> +#include <tqtimer.h> +#include <tqapplication.h> +#include <tqdialog.h> /*! @internal */ -class DelayedCursorHandler : public QObject +class DelayedCursorHandler : public TQObject { Q_OBJECT + TQ_OBJECT public: DelayedCursorHandler(); void start(bool noDelay); @@ -36,17 +37,17 @@ class DelayedCursorHandler : public QObject protected slots: void show(); protected: - QTimer timer; + TQTimer timer; }; /*! @internal */ -class DebugWindowDialog : public QDialog +class DebugWindowDialog : public TQDialog { public: - explicit DebugWindowDialog( QWidget * parent ) - : QDialog(parent, 0, false, Qt::WType_Dialog|Qt::WStyle_MinMax|Qt::WStyle_StaysOnTop) + explicit DebugWindowDialog( TQWidget * tqparent ) + : TQDialog(tqparent, 0, false, TQt::WType_Dialog|TQt::WStyle_MinMax|TQt::WStyle_StaysOnTop) { - setWindowState( Qt::WindowMinimized ); + setWindowState( TQt::WindowMinimized ); } }; diff --git a/kexi/kexiutils/validator.cpp b/kexi/kexiutils/validator.cpp index e27077ec..54af4ccd 100644 --- a/kexi/kexiutils/validator.cpp +++ b/kexi/kexiutils/validator.cpp @@ -21,8 +21,8 @@ using namespace KexiUtils; -Validator::Validator(QObject * parent, const char * name) -: QValidator(parent,name) +Validator::Validator(TQObject * tqparent, const char * name) +: TQValidator(tqparent,name) , m_acceptsEmptyValue(false) { } @@ -31,12 +31,12 @@ Validator::~Validator() { } -Validator::Result Validator::check(const QString &valueName, const QVariant& v, - QString &message, QString &details) +Validator::Result Validator::check(const TQString &valueName, const TQVariant& v, + TQString &message, TQString &details) { - if (v.isNull() || v.type()==QVariant::String && v.toString().isEmpty()) { + if (v.isNull() || v.type()==TQVariant::String && v.toString().isEmpty()) { if (!m_acceptsEmptyValue) { - message = Validator::msgColumnNotEmpty().arg(valueName); + message = Validator::msgColumnNotEmpty().tqarg(valueName); return Error; } return Ok; @@ -44,46 +44,46 @@ Validator::Result Validator::check(const QString &valueName, const QVariant& v, return internalCheck(valueName, v, message, details); } -Validator::Result Validator::internalCheck(const QString & /*valueName*/, - const QVariant& /*v*/, QString & /*message*/, QString & /*details*/) +Validator::Result Validator::internalCheck(const TQString & /*valueName*/, + const TQVariant& /*v*/, TQString & /*message*/, TQString & /*details*/) { return Error; } -QValidator::State Validator::validate ( QString & , int & ) const +TQValidator::State Validator::validate ( TQString & , int & ) const { - return QValidator::Acceptable; + return TQValidator::Acceptable; } //----------------------------------------------------------- -MultiValidator::MultiValidator(QObject* parent, const char * name) - : Validator(parent, name) +MultiValidator::MultiValidator(TQObject* tqparent, const char * name) + : Validator(tqparent, name) { m_ownedSubValidators.setAutoDelete(true); } -MultiValidator::MultiValidator(QValidator *validator, - QObject * parent, const char * name) - : Validator(parent, name) +MultiValidator::MultiValidator(TQValidator *validator, + TQObject * tqparent, const char * name) + : Validator(tqparent, name) { addSubvalidator(validator); } -void MultiValidator::addSubvalidator( QValidator* validator, bool owned ) +void MultiValidator::addSubvalidator( TQValidator* validator, bool owned ) { if (!validator) return; m_subValidators.append(validator); - if (owned && !validator->parent()) + if (owned && !validator->tqparent()) m_ownedSubValidators.append(validator); } -QValidator::State MultiValidator::validate( QString & input, int & pos ) const +TQValidator::State MultiValidator::validate( TQString & input, int & pos ) const { State s; - foreach( QValueList<QValidator*>::ConstIterator, it, m_subValidators ) { + foreach( TQValueList<TQValidator*>::ConstIterator, it, m_subValidators ) { s = (*it)->validate(input, pos); if (s==Intermediate || s==Invalid) return s; @@ -91,19 +91,19 @@ QValidator::State MultiValidator::validate( QString & input, int & pos ) const return Acceptable; } -void MultiValidator::fixup ( QString & input ) const +void MultiValidator::fixup ( TQString & input ) const { - foreach( QValueList<QValidator*>::ConstIterator, it, m_subValidators ) + foreach( TQValueList<TQValidator*>::ConstIterator, it, m_subValidators ) (*it)->fixup(input); } Validator::Result MultiValidator::internalCheck( - const QString &valueName, const QVariant& v, - QString &message, QString &details) + const TQString &valueName, const TQVariant& v, + TQString &message, TQString &details) { Result r; bool warning = false; - foreach( QValueList<QValidator*>::ConstIterator, it, m_subValidators ) { + foreach( TQValueList<TQValidator*>::ConstIterator, it, m_subValidators ) { if (dynamic_cast<Validator*>(*it)) r = dynamic_cast<Validator*>(*it)->internalCheck(valueName, v, message, details); else diff --git a/kexi/kexiutils/validator.h b/kexi/kexiutils/validator.h index 5a33d4c6..b5c6e6cc 100644 --- a/kexi/kexiutils/validator.h +++ b/kexi/kexiutils/validator.h @@ -22,32 +22,32 @@ #include "kexiutils_export.h" -#include <qvalidator.h> -#include <qvariant.h> -#include <qstring.h> +#include <tqvalidator.h> +#include <tqvariant.h> +#include <tqstring.h> #include <klocale.h> namespace KexiUtils { -//! @short A validator extending QValidator with offline-checking for value's validity +//! @short A validator extending TQValidator with offline-checking for value's validity /*! The offline-checking for value's validity is provided by \ref Validator::check() method. The validator groups two purposes into one container: - string validator for line editors (online checking, "on typing"); - - offline-checking for QVariant values, reimplementing validate(). + - offline-checking for TQVariant values, reimplementing validate(). It also offers error and warning messages for check() method. You may need to reimplement: - - QValidator::State IdentifierValidator::validate( QString& input, int& pos ) const; - - Result check(const QString &valueName, QVariant v, QString &message, QString &details); + - TQValidator::State IdentifierValidator::validate( TQString& input, int& pos ) const; + - Result check(const TQString &valueName, TQVariant v, TQString &message, TQString &details); */ -class KEXIUTILS_EXPORT Validator : public QValidator +class KEXIUTILS_EXPORT Validator : public TQValidator { public: typedef enum Result { Error = 0, Ok = 1, Warning = 2 }; - Validator(QObject * parent = 0, const char * name = 0); + Validator(TQObject * tqparent = 0, const char * name = 0); virtual ~Validator(); /*! Sets accepting empty values on (true) or off (false). @@ -67,14 +67,14 @@ class KEXIUTILS_EXPORT Validator : public QValidator \a valueName can be used to contruct \a message as well, for example: "[valueName] is not a valid login name". Depending on acceptsEmptyValue(), immediately accepts empty values or not. */ - Result check(const QString &valueName, const QVariant& v, QString &message, - QString &details); + Result check(const TQString &valueName, const TQVariant& v, TQString &message, + TQString &details); - /*! This implementation always returns value QValidator::Acceptable. */ - virtual QValidator::State validate ( QString & input, int & pos ) const; + /*! This implementation always returns value TQValidator::Acceptable. */ + virtual TQValidator::State validate ( TQString & input, int & pos ) const; //! A generic error/warning message - static const QString msgColumnNotEmpty() { + static const TQString msgColumnNotEmpty() { return I18N_NOOP("\"%1\" value has to be entered."); } @@ -83,15 +83,15 @@ class KEXIUTILS_EXPORT Validator : public QValidator protected: /* Used by check(), for reimplementation, by default returns \a Error.*/ - virtual Result internalCheck(const QString &valueName, const QVariant& v, - QString &message, QString &details); + virtual Result internalCheck(const TQString &valueName, const TQVariant& v, + TQString &message, TQString &details); bool m_acceptsEmptyValue : 1; friend class MultiValidator; }; -//! @short A validator groupping multiple QValidators +//! @short A validator groupping multiple TQValidators /*! MultiValidator behaves like normal KexiUtils::Validator, but it allows to add define more than one different validator. Given validation is successful if every subvalidator accepted given value. @@ -105,10 +105,10 @@ class KEXIUTILS_EXPORT Validator : public QValidator no validator returned error; - Ok is returned only if exactly all subvalidators returned Ok. - If there is no subvalidators defined, Error is always returned. - - If a given subvalidator is not of class Validator but ust QValidator, + - If a given subvalidator is not of class Validator but ust TQValidator, it's assumed it's check() method returned Ok. - - result of calling validate() (a method implemented for QValidator) + - result of calling validate() (a method implemented for TQValidator) depends on value of validate() returned by subvalidators: - Invalid is returned if at least one subvalidator returned Invalid - Intermediate is returned if at least one subvalidator returned Intermediate @@ -122,35 +122,35 @@ class KEXIUTILS_EXPORT MultiValidator : public Validator public: /*! Constructs multivalidator with no subvalidators defined. You can add more validators with addSubvalidator(). */ - MultiValidator(QObject * parent = 0, const char * name = 0); + MultiValidator(TQObject * tqparent = 0, const char * name = 0); /*! Constructs multivalidator with one validator \a validator. - It will be owned if has no parent defined. + It will be owned if has no tqparent defined. You can add more validators with addSubvalidator(). */ - MultiValidator(QValidator *validator, QObject * parent = 0, const char * name = 0); + MultiValidator(TQValidator *validator, TQObject * tqparent = 0, const char * name = 0); /*! Adds validator \a validator as another subvalidator. Subvalidator will be owned by this multivalidator if \a owned is true - and its parent is NULL. */ - void addSubvalidator( QValidator* validator, bool owned = true ); + and its tqparent is NULL. */ + void addSubvalidator( TQValidator* validator, bool owned = true ); /*! Reimplemented to call validate() on subvalidators. */ - virtual QValidator::State validate ( QString & input, int & pos ) const; + virtual TQValidator::State validate ( TQString & input, int & pos ) const; - /*! Calls QValidator::fixup() on every subvalidator. + /*! Calls TQValidator::fixup() on every subvalidator. This may be senseless to use this methog in certain cases (can return weir results), so think twice before.. */ - virtual void fixup ( QString & input ) const; + virtual void fixup ( TQString & input ) const; private: virtual Validator::Result internalCheck( - const QString &valueName, const QVariant& v, - QString &message, QString &details); + const TQString &valueName, const TQVariant& v, + TQString &message, TQString &details); protected: - QPtrList<QValidator> m_ownedSubValidators; - QValueList<QValidator*> m_subValidators; + TQPtrList<TQValidator> m_ownedSubValidators; + TQValueList<TQValidator*> m_subValidators; }; } |