summaryrefslogtreecommitdiffstats
path: root/kexi/kexiutils/utils.h
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-25 05:28:35 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-25 05:28:35 +0000
commitf008adb5a77e094eaf6abf3fc0f36958e66896a5 (patch)
tree8e9244c4d4957c36be81e15b566b4aa5ea26c982 /kexi/kexiutils/utils.h
parent1210f27b660efb7b37ff43ec68763e85a403471f (diff)
downloadkoffice-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/utils.h')
-rw-r--r--kexi/kexiutils/utils.h116
1 files changed, 58 insertions, 58 deletions
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); }