diff options
Diffstat (limited to 'kexi/widget/tableview')
40 files changed, 1659 insertions, 1645 deletions
diff --git a/kexi/widget/tableview/kexiblobtableedit.cpp b/kexi/widget/tableview/kexiblobtableedit.cpp index db0799a4..0d19981a 100644 --- a/kexi/widget/tableview/kexiblobtableedit.cpp +++ b/kexi/widget/tableview/kexiblobtableedit.cpp @@ -22,20 +22,20 @@ #include <stdlib.h> -#include <qdatastream.h> -#include <qfile.h> -#include <qpopupmenu.h> -#include <qtextedit.h> -#include <qlayout.h> -#include <qstatusbar.h> -#include <qlabel.h> -#include <qpixmap.h> -#include <qimage.h> -#include <qpainter.h> -#include <qtooltip.h> -#include <qapplication.h> -#include <qclipboard.h> -#include <qbuffer.h> +#include <tqdatastream.h> +#include <tqfile.h> +#include <tqpopupmenu.h> +#include <tqtextedit.h> +#include <tqlayout.h> +#include <tqstatusbar.h> +#include <tqlabel.h> +#include <tqpixmap.h> +#include <tqimage.h> +#include <tqpainter.h> +#include <tqtooltip.h> +#include <tqapplication.h> +#include <tqclipboard.h> +#include <tqbuffer.h> #include <kdebug.h> #include <ktempfile.h> @@ -70,9 +70,9 @@ public: { } - QByteArray value; + TQByteArray value; KexiDropDownButton *button; - QSize totalSize; + TQSize totalSize; KexiImageContextMenu *popup; bool readOnly : 1; //!< cached for slotUpdateActionsAvailabilityRequested() bool setValueInternalEnabled : 1; //!< used to disable KexiBlobTableEdit::setValueInternal() @@ -80,17 +80,17 @@ public: //====================================================== -KexiBlobTableEdit::KexiBlobTableEdit(KexiTableViewColumn &column, QWidget *parent) - : KexiTableEdit(column, parent) +KexiBlobTableEdit::KexiBlobTableEdit(KexiTableViewColumn &column, TQWidget *tqparent) + : KexiTableEdit(column, tqparent) , d ( new Private() ) { setName("KexiBlobTableEdit"); // m_proc = 0; // m_content = 0; m_hasFocusableWidget = false; - d->button = new KexiDropDownButton( parentWidget() /*usually a viewport*/ ); + d->button = new KexiDropDownButton( tqparentWidget() /*usually a viewport*/ ); d->button->hide(); - QToolTip::add(d->button, i18n("Click to show available actions for this cell")); + TQToolTip::add(d->button, i18n("Click to show available actions for this cell")); d->popup = new KexiImageContextMenu(this); d->popup->installEventFilter(this); @@ -101,25 +101,25 @@ KexiBlobTableEdit::KexiBlobTableEdit(KexiTableViewColumn &column, QWidget *paren d->button->setPopup( d->popup ); //force edit requested to start editing... (this will call slotUpdateActionsAvailabilityRequested()) - //connect(d->popup, SIGNAL(aboutToShow()), this, SIGNAL(editRequested())); - - connect(d->popup, SIGNAL(updateActionsAvailabilityRequested(bool&, bool&)), - this, SLOT(slotUpdateActionsAvailabilityRequested(bool&, bool&))); - - connect(d->popup, SIGNAL(insertFromFileRequested(const KURL&)), - this, SLOT(handleInsertFromFileAction(const KURL&))); - connect(d->popup, SIGNAL(saveAsRequested(const QString&)), - this, SLOT(handleSaveAsAction(const QString&))); - connect(d->popup, SIGNAL(cutRequested()), - this, SLOT(handleCutAction())); - connect(d->popup, SIGNAL(copyRequested()), - this, SLOT(handleCopyAction())); - connect(d->popup, SIGNAL(pasteRequested()), - this, SLOT(handlePasteAction())); - connect(d->popup, SIGNAL(clearRequested()), - this, SLOT(clear())); - connect(d->popup, SIGNAL(showPropertiesRequested()), - this, SLOT(handleShowPropertiesAction())); + //connect(d->popup, TQT_SIGNAL(aboutToShow()), this, TQT_SIGNAL(editRequested())); + + connect(d->popup, TQT_SIGNAL(updateActionsAvailabilityRequested(bool&, bool&)), + this, TQT_SLOT(slotUpdateActionsAvailabilityRequested(bool&, bool&))); + + connect(d->popup, TQT_SIGNAL(insertFromFileRequested(const KURL&)), + this, TQT_SLOT(handleInsertFromFileAction(const KURL&))); + connect(d->popup, TQT_SIGNAL(saveAsRequested(const TQString&)), + this, TQT_SLOT(handleSaveAsAction(const TQString&))); + connect(d->popup, TQT_SIGNAL(cutRequested()), + this, TQT_SLOT(handleCutAction())); + connect(d->popup, TQT_SIGNAL(copyRequested()), + this, TQT_SLOT(handleCopyAction())); + connect(d->popup, TQT_SIGNAL(pasteRequested()), + this, TQT_SLOT(handlePasteAction())); + connect(d->popup, TQT_SIGNAL(clearRequested()), + this, TQT_SLOT(clear())); + connect(d->popup, TQT_SIGNAL(showPropertiesRequested()), + this, TQT_SLOT(handleShowPropertiesAction())); } KexiBlobTableEdit::~KexiBlobTableEdit() @@ -138,17 +138,17 @@ KexiBlobTableEdit::~KexiBlobTableEdit() } //! initializes this editor with \a add value -void KexiBlobTableEdit::setValueInternal(const QVariant& add, bool removeOld) +void KexiBlobTableEdit::setValueInternal(const TQVariant& add, bool removeOld) { if (!d->setValueInternalEnabled) return; if (removeOld) d->value = add.toByteArray(); - else //do not add "m_origValue" to "add" as this is QByteArray + else //do not add "m_origValue" to "add" as this is TQByteArray d->value = m_origValue.toByteArray(); #if 0 //todo? - QByteArray val = m_origValue.toByteArray(); + TQByteArray val = m_origValue.toByteArray(); kdDebug() << "KexiBlobTableEdit: Size of BLOB: " << val.size() << endl; m_tempFile = new KTempFile(); m_tempFile->setAutoDelete(true); @@ -161,7 +161,7 @@ void KexiBlobTableEdit::setValueInternal(const QVariant& add, bool removeOld) KMimeMagicResult* mmr = KMimeMagic::self()->findFileType(m_tempFile->name()); kdDebug() << "KexiBlobTableEdit: Mimetype = " << mmr->mimeType() << endl; - setViewWidget( new QWidget(this) ); + setViewWidget( new TQWidget(this) ); #endif } @@ -178,7 +178,7 @@ bool KexiBlobTableEdit::valueIsEmpty() return d->value.isEmpty(); } -QVariant +TQVariant KexiBlobTableEdit::value() { return d->value; @@ -188,23 +188,23 @@ KexiBlobTableEdit::value() if(m_content && m_content->isModified()) { - return QVariant(m_content->text()); + return TQVariant(m_content->text()); } - QByteArray value; - QFile f( m_tempFile->name() ); + TQByteArray value; + TQFile f( m_tempFile->name() ); f.open(IO_ReadOnly); - QDataStream stream(&f); + TQDataStream stream(&f); char* data = (char*) malloc(f.size()); value.resize(f.size()); stream.readRawBytes(data, f.size()); value.duplicate(data, f.size()); free(data); kdDebug() << "KexiBlobTableEdit: Size of BLOB: " << value.size() << endl; - return QVariant(value); + return TQVariant(value); #endif } -void KexiBlobTableEdit::paintFocusBorders( QPainter *p, QVariant &, int x, int y, int w, int h ) +void KexiBlobTableEdit::paintFocusBorders( TQPainter *p, TQVariant &, int x, int y, int w, int h ) { // d->currentEditorWidth = w; if (!d->readOnly && w > d->button->width()) @@ -213,21 +213,21 @@ void KexiBlobTableEdit::paintFocusBorders( QPainter *p, QVariant &, int x, int y } void -KexiBlobTableEdit::setupContents( QPainter *p, bool focused, const QVariant& val, - QString &txt, int &align, int &x, int &y_offset, int &w, int &h ) +KexiBlobTableEdit::setupContents( TQPainter *p, bool focused, const TQVariant& val, + TQString &txt, int &align, int &x, int &y_offset, int &w, int &h ) { Q_UNUSED(focused); Q_UNUSED(txt); Q_UNUSED(align); //! @todo optimize: load to m_pixmap, downsize - QPixmap pixmap; + TQPixmap pixmap; x = 0; w -= 1; //a place for border h -= 1; //a place for border - if (p && val.canCast(QVariant::ByteArray) && pixmap.loadFromData(val.toByteArray())) { - KexiUtils::drawPixmap( *p, 0/*lineWidth*/, QRect(x, y_offset, w, h), - pixmap, Qt::AlignCenter, true/*scaledContents*/, true/*keepAspectRatio*/); + if (p && val.canCast(TQVariant::ByteArray) && pixmap.loadFromData(val.toByteArray())) { + KexiUtils::drawPixmap( *p, 0/*lineWidth*/, TQRect(x, y_offset, w, h), + pixmap, TQt::AlignCenter, true/*scaledContents*/, true/*keepAspectRatio*/); } } @@ -246,15 +246,15 @@ void KexiBlobTableEdit::handleInsertFromFileAction(const KURL& url) if (isReadOnly()) return; - QString fileName( url.isLocalFile() ? url.path() : url.prettyURL() ); + TQString fileName( url.isLocalFile() ? url.path() : url.prettyURL() ); //! @todo download the file if remote, then set fileName properly - QFile f(fileName); + TQFile f(fileName); if (!f.open(IO_ReadOnly)) { //! @todo err msg return; } - QByteArray ba = f.readAll(); + TQByteArray ba = f.readAll(); if (f.status()!=IO_Ok) { //! @todo err msg f.close(); @@ -267,7 +267,7 @@ void KexiBlobTableEdit::handleInsertFromFileAction(const KURL& url) //emit acceptRequested(); } -void KexiBlobTableEdit::handleAboutToSaveAsAction(QString& origFilename, QString& fileExtension, bool& dataIsEmpty) +void KexiBlobTableEdit::handleAboutToSaveAsAction(TQString& origFilename, TQString& fileExtension, bool& dataIsEmpty) { Q_UNUSED(origFilename); Q_UNUSED(fileExtension); @@ -275,9 +275,9 @@ void KexiBlobTableEdit::handleAboutToSaveAsAction(QString& origFilename, QString //! @todo no fname stored for now } -void KexiBlobTableEdit::handleSaveAsAction(const QString& fileName) +void KexiBlobTableEdit::handleSaveAsAction(const TQString& fileName) { - QFile f(fileName); + TQFile f(fileName); if (!f.open(IO_WriteOnly)) { //! @todo err msg return; @@ -304,39 +304,39 @@ void KexiBlobTableEdit::handleCopyAction() executeCopyAction(d->value); } -void KexiBlobTableEdit::executeCopyAction(const QByteArray& data) +void KexiBlobTableEdit::executeCopyAction(const TQByteArray& data) { - QPixmap pixmap; + TQPixmap pixmap; if (!pixmap.loadFromData(data)) return; - qApp->clipboard()->setPixmap(pixmap, QClipboard::Clipboard); + tqApp->tqclipboard()->setPixmap(pixmap, TQClipboard::Clipboard); } void KexiBlobTableEdit::handlePasteAction() { if (isReadOnly()) return; - QPixmap pm( qApp->clipboard()->pixmap(QClipboard::Clipboard) ); - QByteArray ba; - QBuffer buffer( ba ); + TQPixmap pm( tqApp->tqclipboard()->pixmap(TQClipboard::Clipboard) ); + TQByteArray ba; + TQBuffer buffer( ba ); buffer.open( IO_WriteOnly ); if (pm.save( &buffer, "PNG" )) {// write pixmap into ba in PNG format setValueInternal( ba, true ); } else { - setValueInternal( QByteArray(), true ); + setValueInternal( TQByteArray(), true ); } signalEditRequested(); //emit acceptRequested(); - repaintRelatedCell(); + tqrepaintRelatedCell(); } void KexiBlobTableEdit::clear() { - setValueInternal( QByteArray(), true ); + setValueInternal( TQByteArray(), true ); signalEditRequested(); //emit acceptRequested(); - repaintRelatedCell(); + tqrepaintRelatedCell(); } void KexiBlobTableEdit::handleShowPropertiesAction() @@ -344,7 +344,7 @@ void KexiBlobTableEdit::handleShowPropertiesAction() //! @todo } -void KexiBlobTableEdit::showFocus( const QRect& r, bool readOnly ) +void KexiBlobTableEdit::showFocus( const TQRect& r, bool readOnly ) { d->readOnly = readOnly; //cache for slotUpdateActionsAvailabilityRequested() // d->button->move( pos().x()+ width(), pos().y() ); @@ -358,13 +358,13 @@ void KexiBlobTableEdit::showFocus( const QRect& r, bool readOnly ) void KexiBlobTableEdit::resize(int w, int h) { - d->totalSize = QSize(w,h); + d->totalSize = TQSize(w,h); const int addWidth = d->readOnly ? 0 : d->button->width(); - QWidget::resize(w - addWidth, h); + TQWidget::resize(w - addWidth, h); if (!d->readOnly) d->button->resize( h, h ); m_rightMarginWhenFocused = m_rightMargin + addWidth; - QRect r( pos().x(), pos().y(), w+1, h+1 ); + TQRect r( pos().x(), pos().y(), w+1, h+1 ); r.moveBy(m_scrollView->contentsX(),m_scrollView->contentsY()); updateFocus( r ); //todo if (d->popup) { @@ -372,7 +372,7 @@ void KexiBlobTableEdit::resize(int w, int h) //todo } } -void KexiBlobTableEdit::updateFocus( const QRect& r ) +void KexiBlobTableEdit::updateFocus( const TQRect& r ) { if (!d->readOnly) { if (d->button->width() > r.width()) @@ -387,7 +387,7 @@ void KexiBlobTableEdit::hideFocus() d->button->hide(); } -QSize KexiBlobTableEdit::totalSize() const +TQSize KexiBlobTableEdit::totalSize() const { return d->totalSize; } @@ -406,20 +406,20 @@ void KexiBlobTableEdit::signalEditRequested() d->setValueInternalEnabled = true; } -bool KexiBlobTableEdit::handleKeyPress( QKeyEvent* ke, bool editorActive ) +bool KexiBlobTableEdit::handleKeyPress( TQKeyEvent* ke, bool editorActive ) { Q_UNUSED(editorActive); const int k = ke->key(); KKey kkey(ke); if (!d->readOnly) { - if ((ke->state()==Qt::NoButton && k==Qt::Key_F4) - || (ke->state()==Qt::AltButton && k==Qt::Key_Down)) { + if ((ke->state()==Qt::NoButton && k==TQt::Key_F4) + || (ke->state()==TQt::AltButton && k==TQt::Key_Down)) { d->button->animateClick(); - QMouseEvent me( QEvent::MouseButtonPress, QPoint(2,2), Qt::LeftButton, Qt::NoButton ); - QApplication::sendEvent( d->button, &me ); + TQMouseEvent me( TQEvent::MouseButtonPress, TQPoint(2,2), Qt::LeftButton, Qt::NoButton ); + TQApplication::sendEvent( d->button, &me ); } - else if ((ke->state()==NoButton && (k==Qt::Key_F2 || k==Qt::Key_Space || k==Qt::Key_Enter || k==Qt::Key_Return))) { + else if ((ke->state()==Qt::NoButton && (k==TQt::Key_F2 || k==TQt::Key_Space || k==TQt::Key_Enter || k==TQt::Key_Return))) { d->popup->insertFromFile(); } else @@ -436,13 +436,13 @@ bool KexiBlobTableEdit::handleDoubleClick() return true; } -void KexiBlobTableEdit::handleCopyAction(const QVariant& value, const QVariant& visibleValue) +void KexiBlobTableEdit::handleCopyAction(const TQVariant& value, const TQVariant& visibleValue) { Q_UNUSED(visibleValue); executeCopyAction(value.toByteArray()); } -void KexiBlobTableEdit::handleAction(const QString& actionName) +void KexiBlobTableEdit::handleAction(const TQString& actionName) { if (actionName=="edit_paste") { d->popup->paste(); @@ -453,18 +453,18 @@ void KexiBlobTableEdit::handleAction(const QString& actionName) } } -bool KexiBlobTableEdit::eventFilter( QObject *o, QEvent *e ) +bool KexiBlobTableEdit::eventFilter( TQObject *o, TQEvent *e ) { - if (o == d->popup && e->type()==QEvent::KeyPress) { - QKeyEvent* ke = static_cast<QKeyEvent*>(e); + if (TQT_BASE_OBJECT(o) == TQT_BASE_OBJECT(d->popup) && e->type()==TQEvent::KeyPress) { + TQKeyEvent* ke = TQT_TQKEYEVENT(e); const int state = ke->state(); const int k = ke->key(); - if ( (state==Qt::NoButton && (k==Qt::Key_Tab || k==Qt::Key_Left || k==Qt::Key_Right)) - || (state==Qt::ShiftButton && k==Qt::Key_Backtab) + if ( (state==Qt::NoButton && (k==TQt::Key_Tab || k==TQt::Key_Left || k==TQt::Key_Right)) + || (state==TQt::ShiftButton && k==TQt::Key_Backtab) ) { d->popup->hide(); - QApplication::sendEvent( this, ke ); //re-send to move cursor + TQApplication::sendEvent( this, ke ); //re-send to move cursor return true; } } @@ -485,13 +485,13 @@ public: { } //! We've no editor widget that would store current value, so we do this here - QVariant currentValue; + TQVariant currentValue; - QCache<QPixmap> pixmapCache; + TQCache<TQPixmap> pixmapCache; }; -KexiKIconTableEdit::KexiKIconTableEdit(KexiTableViewColumn &column, QWidget *parent) - : KexiTableEdit(column, parent) +KexiKIconTableEdit::KexiKIconTableEdit(KexiTableViewColumn &column, TQWidget *tqparent) + : KexiTableEdit(column, tqparent) , d( new Private() ) { setName("KexiKIconTableEdit"); @@ -509,7 +509,7 @@ void KexiKIconTableEdit::init() d->pixmapCache.setAutoDelete(true); } -void KexiKIconTableEdit::setValueInternal(const QVariant& /*add*/, bool /*removeOld*/) +void KexiKIconTableEdit::setValueInternal(const TQVariant& /*add*/, bool /*removeOld*/) { d->currentValue = m_origValue; } @@ -524,14 +524,14 @@ bool KexiKIconTableEdit::valueIsEmpty() return d->currentValue.isNull(); } -QVariant KexiKIconTableEdit::value() +TQVariant KexiKIconTableEdit::value() { return d->currentValue; } void KexiKIconTableEdit::clear() { - d->currentValue = QVariant(); + d->currentValue = TQVariant(); } bool KexiKIconTableEdit::cursorAtStart() @@ -544,22 +544,22 @@ bool KexiKIconTableEdit::cursorAtEnd() return true; } -void KexiKIconTableEdit::setupContents( QPainter *p, bool /*focused*/, const QVariant& val, - QString &/*txt*/, int &/*align*/, int &/*x*/, int &y_offset, int &w, int &h ) +void KexiKIconTableEdit::setupContents( TQPainter *p, bool /*focused*/, const TQVariant& val, + TQString &/*txt*/, int &/*align*/, int &/*x*/, int &y_offset, int &w, int &h ) { Q_UNUSED( y_offset ); #if 0 -#ifdef Q_WS_WIN +#ifdef TQ_WS_WIN y_offset = -1; #else y_offset = 0; #endif - int s = QMAX(h - 5, 12); - s = QMIN( h-3, s ); - s = QMIN( w-3, s );//avoid too large box - QRect r( QMAX( w/2 - s/2, 0 ) , h/2 - s/2 /*- 1*/, s, s); - p->setPen(QPen(colorGroup().text(), 1)); + int s = TQMAX(h - 5, 12); + s = TQMIN( h-3, s ); + s = TQMIN( w-3, s );//avoid too large box + TQRect r( TQMAX( w/2 - s/2, 0 ) , h/2 - s/2 /*- 1*/, s, s); + p->setPen(TQPen(tqcolorGroup().text(), 1)); p->drawRect(r); if (val.asBool()) { p->drawLine(r.x(), r.y(), r.right(), r.bottom()); @@ -567,14 +567,14 @@ void KexiKIconTableEdit::setupContents( QPainter *p, bool /*focused*/, const QVa } #endif - QString key = val.toString(); - QPixmap *pix = 0; + TQString key = val.toString(); + TQPixmap *pix = 0; if (!key.isEmpty() && !(pix = d->pixmapCache[ key ])) { //cache pixmap - QPixmap pm = KGlobal::iconLoader()->loadIcon( key, KIcon::Small, + TQPixmap pm = KGlobal::iconLoader()->loadIcon( key, KIcon::Small, 0, KIcon::DefaultState, 0L, true/*canReturnNull*/ ); if (!pm.isNull()) { - pix = new QPixmap(pm); + pix = new TQPixmap(pm); d->pixmapCache.insert(key, pix); } } @@ -584,7 +584,7 @@ void KexiKIconTableEdit::setupContents( QPainter *p, bool /*focused*/, const QVa } } -void KexiKIconTableEdit::handleCopyAction(const QVariant& value, const QVariant& visibleValue) +void KexiKIconTableEdit::handleCopyAction(const TQVariant& value, const TQVariant& visibleValue) { Q_UNUSED(value); Q_UNUSED(visibleValue); diff --git a/kexi/widget/tableview/kexiblobtableedit.h b/kexi/widget/tableview/kexiblobtableedit.h index a44559be..fb64c21d 100644 --- a/kexi/widget/tableview/kexiblobtableedit.h +++ b/kexi/widget/tableview/kexiblobtableedit.h @@ -21,8 +21,8 @@ #ifndef _KEXIBLOBTABLEEDIT_H_ #define _KEXIBLOBTABLEEDIT_H_ -#include <qcstring.h> -#include <qcache.h> +#include <tqcstring.h> +#include <tqcache.h> #include <kurl.h> @@ -31,19 +31,20 @@ class KTempFile; class KProcess; -class QTextEdit; +class TQTextEdit; class KexiBlobTableEdit : public KexiTableEdit { Q_OBJECT + TQ_OBJECT public: - KexiBlobTableEdit(KexiTableViewColumn &column, QWidget *parent=0); + KexiBlobTableEdit(KexiTableViewColumn &column, TQWidget *tqparent=0); virtual ~KexiBlobTableEdit(); bool valueIsNull(); bool valueIsEmpty(); - virtual QVariant value(); + virtual TQVariant value(); virtual bool cursorAtStart(); virtual bool cursorAtEnd(); @@ -51,17 +52,17 @@ class KexiBlobTableEdit : public KexiTableEdit /*! Reimplemented: resizes a view(). */ virtual void resize(int w, int h); - virtual void showFocus( const QRect& r, bool readOnly ); + virtual void showFocus( const TQRect& r, bool readOnly ); virtual void hideFocus(); /*! \return total size of this editor, including popup button. */ - virtual QSize totalSize() const; + virtual TQSize totalSize() const; - virtual void paintFocusBorders( QPainter *p, QVariant &, int x, int y, int w, int h ); + virtual void paintFocusBorders( TQPainter *p, TQVariant &, int x, int y, int w, int h ); /*! Reimplemented to handle the key events. */ - virtual bool handleKeyPress( QKeyEvent* ke, bool editorActive ); + virtual bool handleKeyPress( TQKeyEvent* ke, bool editorActive ); /*! Handles double click request coming from the table view. \return true if it has been consumed. @@ -70,22 +71,22 @@ class KexiBlobTableEdit : public KexiTableEdit /*! Handles action having standard name \a actionName. Action could be: "edit_cut", "edit_paste", etc. */ - virtual void handleAction(const QString& actionName); + virtual void handleAction(const TQString& actionName); /*! Handles copy action for value. The \a value is copied to clipboard in format appropriate for the editor's impementation, e.g. for image cell it can be a pixmap. \a visibleValue is unused here. Reimplemented after KexiTableEdit. */ - virtual void handleCopyAction(const QVariant& value, const QVariant& visibleValue); + virtual void handleCopyAction(const TQVariant& value, const TQVariant& visibleValue); - virtual void setupContents( QPainter *p, bool focused, const QVariant& val, - QString &txt, int &align, int &x, int &y_offset, int &w, int &h ); + virtual void setupContents( TQPainter *p, bool focused, const TQVariant& val, + TQString &txt, int &align, int &x, int &y_offset, int &w, int &h ); protected slots: void slotUpdateActionsAvailabilityRequested(bool& valueIsNull, bool& valueIsReadOnly); void handleInsertFromFileAction(const KURL& url); - void handleAboutToSaveAsAction(QString& origFilename, QString& fileExtension, bool& dataIsEmpty); - void handleSaveAsAction(const QString& fileName); + void handleAboutToSaveAsAction(TQString& origFilename, TQString& fileExtension, bool& dataIsEmpty); + void handleSaveAsAction(const TQString& fileName); void handleCutAction(); void handleCopyAction(); void handlePasteAction(); @@ -94,26 +95,26 @@ class KexiBlobTableEdit : public KexiTableEdit protected: //! initializes this editor with \a add value - virtual void setValueInternal(const QVariant& add, bool removeOld); + virtual void setValueInternal(const TQVariant& add, bool removeOld); - //todo QString openWithDlg(const QString& file); - //todo void execute(const QString& app, const QString& file); + //todo TQString openWithDlg(const TQString& file); + //todo void execute(const TQString& app, const TQString& file); //! @internal - void updateFocus( const QRect& r ); + void updateFocus( const TQRect& r ); void signalEditRequested(); //! @internal - void executeCopyAction(const QByteArray& data); + void executeCopyAction(const TQByteArray& data); - virtual bool eventFilter( QObject *o, QEvent *e ); + virtual bool eventFilter( TQObject *o, TQEvent *e ); class Private; Private *d; //todo KTempFile* m_tempFile; //todo KProcess* m_proc; -//todo QTextEdit *m_content; +//todo TQTextEdit *m_content; }; KEXI_DECLARE_CELLEDITOR_FACTORY_ITEM(KexiBlobEditorFactoryItem) @@ -128,7 +129,7 @@ KEXI_DECLARE_CELLEDITOR_FACTORY_ITEM(KexiBlobEditorFactoryItem) class KexiKIconTableEdit : public KexiTableEdit { public: - KexiKIconTableEdit(KexiTableViewColumn &column, QWidget *parent=0); + KexiKIconTableEdit(KexiTableViewColumn &column, TQWidget *tqparent=0); virtual ~KexiKIconTableEdit(); @@ -140,23 +141,23 @@ class KexiKIconTableEdit : public KexiTableEdit //! (check this with KexiDB::Field::hasEmptyProperty()), virtual bool valueIsEmpty(); - virtual QVariant value(); + virtual TQVariant value(); virtual bool cursorAtStart(); virtual bool cursorAtEnd(); virtual void clear(); - virtual void setupContents( QPainter *p, bool focused, const QVariant& val, - QString &txt, int &align, int &x, int &y_offset, int &w, int &h ); + virtual void setupContents( TQPainter *p, bool focused, const TQVariant& val, + TQString &txt, int &align, int &x, int &y_offset, int &w, int &h ); /*! Handles copy action for value. Does nothing. \a visibleValue is unused here. Reimplemented after KexiTableEdit. */ - virtual void handleCopyAction(const QVariant& value, const QVariant& visibleValue); + virtual void handleCopyAction(const TQVariant& value, const TQVariant& visibleValue); protected: //! initializes this editor with \a add value - virtual void setValueInternal(const QVariant& add, bool removeOld); + virtual void setValueInternal(const TQVariant& add, bool removeOld); void showHintButton(); void init(); diff --git a/kexi/widget/tableview/kexibooltableedit.cpp b/kexi/widget/tableview/kexibooltableedit.cpp index 7b7bc0ac..e85d0c73 100644 --- a/kexi/widget/tableview/kexibooltableedit.cpp +++ b/kexi/widget/tableview/kexibooltableedit.cpp @@ -21,9 +21,9 @@ #include <kexidb/field.h> -#include <qpainter.h> -#include <qapplication.h> -#include <qclipboard.h> +#include <tqpainter.h> +#include <tqapplication.h> +#include <tqclipboard.h> #include <kglobal.h> #include <klocale.h> @@ -31,8 +31,8 @@ #include <kglobalsettings.h> -KexiBoolTableEdit::KexiBoolTableEdit(KexiTableViewColumn &column, QWidget *parent) - : KexiTableEdit(column, parent) +KexiBoolTableEdit::KexiBoolTableEdit(KexiTableViewColumn &column, TQWidget *tqparent) + : KexiTableEdit(column, tqparent) { setName("KexiBoolTableEdit"); kdDebug() << "KexiBoolTableEdit: m_origValue.typeName()==" << m_origValue.typeName() << endl; @@ -46,7 +46,7 @@ KexiBoolTableEdit::~KexiBoolTableEdit() { } -void KexiBoolTableEdit::setValueInternal(const QVariant& /*add*/, bool /*removeOld*/) +void KexiBoolTableEdit::setValueInternal(const TQVariant& /*add*/, bool /*removeOld*/) { m_currentValue = m_origValue; //nothing to do more... @@ -62,7 +62,7 @@ bool KexiBoolTableEdit::valueIsEmpty() return m_currentValue.isNull(); } -QVariant KexiBoolTableEdit::value() +TQVariant KexiBoolTableEdit::value() { // ok = true; return m_currentValue; @@ -71,9 +71,9 @@ QVariant KexiBoolTableEdit::value() void KexiBoolTableEdit::clear() { if (field()->isNotNull()) - m_currentValue = QVariant(false, 0); + m_currentValue = TQVariant(false, 0); else - m_currentValue = QVariant(); + m_currentValue = TQVariant(); } bool KexiBoolTableEdit::cursorAtStart() @@ -86,14 +86,14 @@ bool KexiBoolTableEdit::cursorAtEnd() return true; } -void KexiBoolTableEdit::setupContents( QPainter *p, bool focused, const QVariant& val, - QString &txt, int &align, int &x, int &y_offset, int &w, int &h ) +void KexiBoolTableEdit::setupContents( TQPainter *p, bool focused, const TQVariant& val, + TQString &txt, int &align, int &x, int &y_offset, int &w, int &h ) { Q_UNUSED(focused); Q_UNUSED(txt); Q_UNUSED(align); Q_UNUSED(x); -#ifdef Q_WS_WIN +#ifdef TQ_WS_WIN // x = 1; y_offset = -1; #else @@ -101,14 +101,14 @@ void KexiBoolTableEdit::setupContents( QPainter *p, bool focused, const QVariant y_offset = 0; #endif if (p) { - int s = QMAX(h - 5, 12); - s = QMIN( h-3, s ); - s = QMIN( w-3, s );//avoid too large box - QRect r( QMAX( w/2 - s/2, 0 ) , h/2 - s/2 /*- 1*/, s, s); -//already set ouotside: p->setPen(QPen(colorGroup().text(), 1)); + int s = TQMAX(h - 5, 12); + s = TQMIN( h-3, s ); + s = TQMIN( w-3, s );//avoid too large box + TQRect r( TQMAX( w/2 - s/2, 0 ) , h/2 - s/2 /*- 1*/, s, s); +//already set ouotside: p->setPen(TQPen(tqcolorGroup().text(), 1)); p->drawRect(r); if (val.isNull()) { // && !field()->isNotNull()) { - p->drawText( r, Qt::AlignCenter, "?" ); + p->drawText( r, TQt::AlignCenter, "?" ); } else if (val.toBool()) { p->drawLine(r.x(), r.y(), r.right(), r.bottom()); @@ -120,53 +120,53 @@ void KexiBoolTableEdit::setupContents( QPainter *p, bool focused, const QVariant void KexiBoolTableEdit::clickedOnContents() { if (field()->isNotNull()) - m_currentValue = QVariant( !m_currentValue.toBool(), 0 ); + m_currentValue = TQVariant( !m_currentValue.toBool(), 0 ); else { // null allowed: use the cycle: true -> false -> null if (m_currentValue.isNull()) - m_currentValue = QVariant( true, 1 ); + m_currentValue = TQVariant( true, 1 ); else - m_currentValue = m_currentValue.toBool() ? QVariant( false, 1 ) : QVariant(); + m_currentValue = m_currentValue.toBool() ? TQVariant( false, 1 ) : TQVariant(); } } -void KexiBoolTableEdit::handleAction(const QString& actionName) +void KexiBoolTableEdit::handleAction(const TQString& actionName) { if (actionName=="edit_paste") { emit editRequested(); bool ok; - const int value = qApp->clipboard()->text( QClipboard::Clipboard ).toInt(&ok); + const int value = tqApp->tqclipboard()->text( TQClipboard::Clipboard ).toInt(&ok); if (ok) { - m_currentValue = (value==0) ? QVariant(false, 0) : QVariant(true, 1); + m_currentValue = (value==0) ? TQVariant(false, 0) : TQVariant(true, 1); } else { m_currentValue = field()->isNotNull() - ? QVariant(0, false)/*0 instead of NULL - handle case when null is not allowed*/ - : QVariant(); + ? TQVariant(0, false)/*0 instead of NULL - handle case when null is not allowed*/ + : TQVariant(); } - repaintRelatedCell(); + tqrepaintRelatedCell(); } else if (actionName=="edit_cut") { emit editRequested(); //! @todo handle defaultValue... m_currentValue = field()->isNotNull() - ? QVariant(0, false)/*0 instead of NULL - handle case when null is not allowed*/ - : QVariant(); - handleCopyAction(m_origValue, QVariant()); - repaintRelatedCell(); + ? TQVariant(0, false)/*0 instead of NULL - handle case when null is not allowed*/ + : TQVariant(); + handleCopyAction(m_origValue, TQVariant()); + tqrepaintRelatedCell(); } } -void KexiBoolTableEdit::handleCopyAction(const QVariant& value, const QVariant& visibleValue) +void KexiBoolTableEdit::handleCopyAction(const TQVariant& value, const TQVariant& visibleValue) { Q_UNUSED(visibleValue); - if (value.type()==QVariant::Bool) - qApp->clipboard()->setText(value.toBool() ? "1" : "0"); + if (value.type()==TQVariant::Bool) + tqApp->clipboard()->setText(value.toBool() ? "1" : "0"); else - qApp->clipboard()->setText(QString::null); + tqApp->clipboard()->setText(TQString()); } -int KexiBoolTableEdit::widthForValue( QVariant &val, const QFontMetrics &fm ) +int KexiBoolTableEdit::widthForValue( TQVariant &val, const TQFontMetrics &fm ) { Q_UNUSED(fm); return val.toPixmap().width(); diff --git a/kexi/widget/tableview/kexibooltableedit.h b/kexi/widget/tableview/kexibooltableedit.h index 3320a573..3fc87d58 100644 --- a/kexi/widget/tableview/kexibooltableedit.h +++ b/kexi/widget/tableview/kexibooltableedit.h @@ -20,7 +20,7 @@ #ifndef KEXIBOOLTABLEEDIT_H #define KEXIBOOLTABLEEDIT_H -#include <qvariant.h> +#include <tqvariant.h> #include "kexitableedit.h" #include "kexicelleditorfactory.h" @@ -30,9 +30,10 @@ class KexiBoolTableEdit : public KexiTableEdit { Q_OBJECT + TQ_OBJECT public: - KexiBoolTableEdit(KexiTableViewColumn &column, QWidget *parent=0); + KexiBoolTableEdit(KexiTableViewColumn &column, TQWidget *tqparent=0); virtual ~KexiBoolTableEdit(); @@ -44,39 +45,39 @@ class KexiBoolTableEdit : public KexiTableEdit //! (check this with KexiDB::Field::hasEmptyProperty()), virtual bool valueIsEmpty(); - virtual QVariant value(); + virtual TQVariant value(); virtual bool cursorAtStart(); virtual bool cursorAtEnd(); virtual void clear(); - virtual void setupContents( QPainter *p, bool focused, const QVariant& val, - QString &txt, int &align, int &x, int &y_offset, int &w, int &h ); + virtual void setupContents( TQPainter *p, bool focused, const TQVariant& val, + TQString &txt, int &align, int &x, int &y_offset, int &w, int &h ); virtual void clickedOnContents(); /*! Handles action having standard name \a actionName. Action could be: "edit_cut", "edit_paste", etc. */ - virtual void handleAction(const QString& actionName); + virtual void handleAction(const TQString& actionName); /*! Handles copy action for value. Copies empty string for null, "1" for true, "0" for false. \a visibleValue is unused here. Reimplemented after KexiTableEdit. */ - virtual void handleCopyAction(const QVariant& value, const QVariant& visibleValue); + virtual void handleCopyAction(const TQVariant& value, const TQVariant& visibleValue); /*! \return width of \a value. Reimplemented after KexiTableEdit. */ - virtual int widthForValue( QVariant &val, const QFontMetrics &fm ); + virtual int widthForValue( TQVariant &val, const TQFontMetrics &fm ); protected slots: protected: //! initializes this editor with \a add value - virtual void setValueInternal(const QVariant& add, bool removeOld); + virtual void setValueInternal(const TQVariant& add, bool removeOld); void showHintButton(); //! We've no editor widget that would store current value, so we do this here - QVariant m_currentValue; + TQVariant m_currentValue; signals: void hintClicked(); diff --git a/kexi/widget/tableview/kexicelleditorfactory.cpp b/kexi/widget/tableview/kexicelleditorfactory.cpp index a20eac07..e0e9ec03 100644 --- a/kexi/widget/tableview/kexicelleditorfactory.cpp +++ b/kexi/widget/tableview/kexicelleditorfactory.cpp @@ -19,8 +19,8 @@ #include "kexicelleditorfactory.h" -#include <qptrdict.h> -#include <qintdict.h> +#include <tqptrdict.h> +#include <tqintdict.h> #include <kstaticdeleter.h> #include <kexidb/indexschema.h> @@ -60,15 +60,15 @@ class KexiCellEditorFactoryPrivate } ~KexiCellEditorFactoryPrivate() {} - QString key(uint type, const QString& subType) const + TQString key(uint type, const TQString& subType) const { - QString key = QString::number(type); + TQString key = TQString::number(type); if (!subType.isEmpty()) - key += (QString(" ") + subType); + key += (TQString(" ") + subType); return key; } - void registerItem( KexiCellEditorFactoryItem& item, uint type, const QString& subType = QString::null ) + void registerItem( KexiCellEditorFactoryItem& item, uint type, const TQString& subType = TQString() ) { if (!items[ &item ]) items.insert( &item, &item ); @@ -76,20 +76,20 @@ class KexiCellEditorFactoryPrivate items_by_type.insert( key(type, subType), &item ); } - KexiCellEditorFactoryItem *findItem(uint type, const QString& subType) + KexiCellEditorFactoryItem *findItem(uint type, const TQString& subType) { KexiCellEditorFactoryItem *item = items_by_type[ key(type, subType) ]; if (item) return item; - item = items_by_type[ key(type, QString::null) ]; + item = items_by_type[ key(type, TQString()) ]; if (item) return item; - return items_by_type[ key( KexiDB::Field::InvalidType, QString::null ) ]; + return items_by_type[ key( KexiDB::Field::InvalidType, TQString() ) ]; } - QPtrDict<KexiCellEditorFactoryItem> items; //!< list of editor factory items (for later destroy) + TQPtrDict<KexiCellEditorFactoryItem> items; //!< list of editor factory items (for later destroy) - QDict<KexiCellEditorFactoryItem> items_by_type; //!< editor factory items accessed by a key + TQDict<KexiCellEditorFactoryItem> items_by_type; //!< editor factory items accessed by a key }; static KStaticDeleter<KexiCellEditorFactoryPrivate> KexiCellEditorFactory_deleter; @@ -124,7 +124,7 @@ void KexiCellEditorFactory::init() KexiCellEditorFactory_static->registerItem( *new KexiInputEditorFactoryItem(), KexiDB::Field::InvalidType ); } -void KexiCellEditorFactory::registerItem( KexiCellEditorFactoryItem& item, uint type, const QString& subType ) +void KexiCellEditorFactory::registerItem( KexiCellEditorFactoryItem& item, uint type, const TQString& subType ) { init(); KexiCellEditorFactory_static->registerItem( item, type, subType ); @@ -146,7 +146,7 @@ static bool hasEnumType( const KexiTableViewColumn &column ) return true; } -KexiTableEdit* KexiCellEditorFactory::createEditor(KexiTableViewColumn &column, QWidget* parent) +KexiTableEdit* KexiCellEditorFactory::createEditor(KexiTableViewColumn &column, TQWidget* tqparent) { init(); KexiDB::Field *realField; @@ -176,7 +176,7 @@ KexiTableEdit* KexiCellEditorFactory::createEditor(KexiTableViewColumn &column, KexiDB::IndexSchema::ListIterator it = table->indicesIterator(); for (;it.current();++it) { KexiDB::IndexSchema *idx = it.current(); - if (idx->fields()->findRef(&f)!=-1) { + if (idx->fields()->tqfindRef(&f)!=-1) { //find details-side rel. for this index KexiDB::Relationship *rel = idx->detailsRelationships()->first(); if (rel) { @@ -187,10 +187,10 @@ KexiTableEdit* KexiCellEditorFactory::createEditor(KexiTableViewColumn &column, } #endif - return item->createEditor(column, parent); + return item->createEditor(column, tqparent); } -KexiCellEditorFactoryItem* KexiCellEditorFactory::item( uint type, const QString& subType ) +KexiCellEditorFactoryItem* KexiCellEditorFactory::item( uint type, const TQString& subType ) { init(); return KexiCellEditorFactory_static->findItem(type, subType); diff --git a/kexi/widget/tableview/kexicelleditorfactory.h b/kexi/widget/tableview/kexicelleditorfactory.h index 1b68cb8d..26b48bb6 100644 --- a/kexi/widget/tableview/kexicelleditorfactory.h +++ b/kexi/widget/tableview/kexicelleditorfactory.h @@ -20,8 +20,8 @@ #ifndef KEXICELLEDITORFACTORY_H #define KEXICELLEDITORFACTORY_H -#include <qvariant.h> -#include <qwidget.h> +#include <tqvariant.h> +#include <tqwidget.h> #include <kexidb/field.h> @@ -44,17 +44,17 @@ class KEXIDATATABLE_EXPORT KexiCellEditorFactory Once registered, \a item object will be owned by the factory, so you shouldn't care about deleting it. */ static void registerItem( KexiCellEditorFactoryItem& item, uint type, - const QString& subType = QString::null ); + const TQString& subType = TQString() ); /*! \return item for \a type and (optional) \a subType. If no item found, the one with empty subtype is tried. If still no item found, the default is tried. Eventually, may return NULL. */ - static KexiCellEditorFactoryItem* item( uint type, const QString& subType = QString::null ); + static KexiCellEditorFactoryItem* item( uint type, const TQString& subType = TQString() ); -// static KexiTableEdit* createEditor(KexiDB::Field &f, QScrollView* parent = 0); - /*! Creates a new editor for \a column. If \a parent is of QScrollView, the new editor - will be created inside parent->viewport() instead. */ - static KexiTableEdit* createEditor(KexiTableViewColumn &column, QWidget* parent = 0); +// static KexiTableEdit* createEditor(KexiDB::Field &f, TQScrollView* tqparent = 0); + /*! Creates a new editor for \a column. If \a tqparent is of TQScrollView, the new editor + will be created inside tqparent->viewport() instead. */ + static KexiTableEdit* createEditor(KexiTableViewColumn &column, TQWidget* tqparent = 0); protected: static void init(); @@ -66,13 +66,13 @@ class KEXIDATATABLE_EXPORT KexiCellEditorFactoryItem public: KexiCellEditorFactoryItem(); virtual ~KexiCellEditorFactoryItem(); - QString className() { return m_className; } + TQString className() { return m_className; } protected: -// virtual KexiTableEdit* createEditor(KexiDB::Field &f, QScrollView* parent = 0) = 0; - virtual KexiTableEdit* createEditor(KexiTableViewColumn &column, QWidget* parent = 0) = 0; +// virtual KexiTableEdit* createEditor(KexiDB::Field &f, TQScrollView* tqparent = 0) = 0; + virtual KexiTableEdit* createEditor(KexiTableViewColumn &column, TQWidget* tqparent = 0) = 0; - QString m_className; + TQString m_className; friend class KexiCellEditorFactory; }; diff --git a/kexi/widget/tableview/kexicomboboxbase.cpp b/kexi/widget/tableview/kexicomboboxbase.cpp index 2d6d52ac..19cf0b99 100644 --- a/kexi/widget/tableview/kexicomboboxbase.cpp +++ b/kexi/widget/tableview/kexicomboboxbase.cpp @@ -18,10 +18,10 @@ * Boston, MA 02110-1301, USA. */ -#include <qlayout.h> -#include <qstyle.h> -#include <qwindowsstyle.h> -#include <qpainter.h> +#include <tqlayout.h> +#include <tqstyle.h> +#include <tqwindowsstyle.h> +#include <tqpainter.h> #include "kexicomboboxbase.h" #include <widget/utils/kexicomboboxdropdownbutton.h> @@ -72,7 +72,7 @@ int KexiComboBoxBase::rowToHighlightForLookupTable() const bool ok; const int rowUid = origValue().toInt(); //! @todo for now we're assuming the id is INTEGER - KexiTableViewData *tvData = popup()->tableView()->data(); + KexiTableViewData *tvData = popup()->tableView()->KexiDataAwareObjectInterface::data(); const int boundColumn = lookupFieldSchema->boundColumn(); KexiTableViewData::Iterator it(tvData->iterator()); int row=0; @@ -86,15 +86,15 @@ int KexiComboBoxBase::rowToHighlightForLookupTable() const return row; } -void KexiComboBoxBase::setValueInternal(const QVariant& add_, bool removeOld) +void KexiComboBoxBase::setValueInternal(const TQVariant& add_, bool removeOld) { Q_UNUSED(removeOld); m_mouseBtnPressedWhenPopupVisible = false; m_updatePopupSelectionOnShow = true; - QString add(add_.toString()); + TQString add(add_.toString()); if (add.isEmpty()) { KexiTableViewData *relData = column() ? column()->relatedData() : 0; - QVariant valueToSet; + TQVariant valueToSet; bool hasValueToSet = true; int rowToHighlight = -1; KexiDB::LookupFieldSchema *lookupFieldSchema = this->lookupFieldSchema(); @@ -113,7 +113,7 @@ void KexiComboBoxBase::setValueInternal(const QVariant& add_, bool removeOld) const int rowToHighlight = rowToHighlightForLookupTable(); popup()->tableView()->setHighlightedRow(rowToHighlight); - const int visibleColumn = lookupFieldSchema->visibleColumn( popup()->tableView()->data()->columnsCount() ); + const int visibleColumn = lookupFieldSchema->visibleColumn( popup()->tableView()->KexiDataAwareObjectInterface::data()->columnsCount() ); if (m_setVisibleValueOnSetValueInternal && -1!=visibleColumn) { //only for table views KexiTableItem *it = popup()->tableView()->highlightedItem(); @@ -165,7 +165,7 @@ void KexiComboBoxBase::setValueInternal(const QVariant& add_, bool removeOld) } } -KexiTableItem* KexiComboBoxBase::selectItemForEnteredValueInLookupTable(const QVariant& v) +KexiTableItem* KexiComboBoxBase::selectItemForEnteredValueInLookupTable(const TQVariant& v) { KexiDB::LookupFieldSchema *lookupFieldSchema = this->lookupFieldSchema(); if (!popup() || !lookupFieldSchema) @@ -173,9 +173,9 @@ KexiTableItem* KexiComboBoxBase::selectItemForEnteredValueInLookupTable(const QV //-not effective for large sets: please cache it! //.stripWhiteSpace() is not generic! - const bool valueIsText = v.type()==QVariant::String || v.type()==QVariant::CString; //most common case - const QString txt( valueIsText ? v.toString().stripWhiteSpace().lower() : QString::null ); - KexiTableViewData *lookupData = popup()->tableView()->data(); + const bool valueIsText = v.type()==TQVariant::String || v.type()==TQVariant::CString; //most common case + const TQString txt( valueIsText ? v.toString().stripWhiteSpace().lower() : TQString() ); + KexiTableViewData *lookupData = popup()->tableView()->KexiDataAwareObjectInterface::data(); const int visibleColumn = lookupFieldSchema->visibleColumn( lookupData->columnsCount() ); if (-1 == visibleColumn) return 0; @@ -204,17 +204,17 @@ KexiTableItem* KexiComboBoxBase::selectItemForEnteredValueInLookupTable(const QV return it.current(); } -QString KexiComboBoxBase::valueForString(const QString& str, int* row, +TQString KexiComboBoxBase::valueForString(const TQString& str, int* row, uint lookInColumn, uint returnFromColumn, bool allowNulls) { KexiTableViewData *relData = column() ? column()->relatedData() : 0; if (!relData) - return QString::null; //safety + return TQString(); //safety //use 'related table data' model //-not effective for large sets: please cache it! //.stripWhiteSpace() is not generic! - const QString txt = str.stripWhiteSpace().lower(); + const TQString txt = str.stripWhiteSpace().lower(); KexiTableViewData::Iterator it( relData->iterator() ); for (*row = 0;it.current();++it, (*row)++) { if (it.current()->at(lookInColumn).toString().stripWhiteSpace().lower()==txt) @@ -230,11 +230,11 @@ QString KexiComboBoxBase::valueForString(const QString& str, int* row, kexiwarn << "KexiComboBoxBase::valueForString(): no related row found, ID will be painted!" << endl; if (allowNulls) - return QString::null; + return TQString(); return str; //for sanity but it's weird to show id to the user } -QVariant KexiComboBoxBase::value() +TQVariant KexiComboBoxBase::value() { KexiTableViewData *relData = column() ? column()->relatedData() : 0; KexiDB::LookupFieldSchema *lookupFieldSchema = 0; @@ -248,7 +248,7 @@ QVariant KexiComboBoxBase::value() else { //use 'related table data' model KexiTableItem *it = popup() ? popup()->tableView()->selectedItem() : 0; - return it ? it->at(0) : origValue();//QVariant(); + return it ? it->at(0) : origValue();//TQVariant(); } } else if ((lookupFieldSchema = this->lookupFieldSchema())) @@ -259,41 +259,41 @@ QVariant KexiComboBoxBase::value() if (/*!it &&*/ m_internalEditorValueChanged && !m_userEnteredValue.toString().isEmpty()) { // //try to select a row using the user-entered text if (!popup()) { - QVariant prevUserEnteredValue = m_userEnteredValue; + TQVariant prevUserEnteredValue = m_userEnteredValue; createPopup(false); m_userEnteredValue = prevUserEnteredValue; } it = selectItemForEnteredValueInLookupTable( m_userEnteredValue ); } - return it ? it->at( lookupFieldSchema->boundColumn() ) : QVariant(); + return it ? it->at( lookupFieldSchema->boundColumn() ) : TQVariant(); } else if (popup()) { //use 'enum hints' model const int row = popup()->tableView()->currentRow(); if (row>=0) - return QVariant( row ); + return TQVariant( row ); } if (valueFromInternalEditor().toString().isEmpty()) - return QVariant(); + return TQVariant(); /*! \todo don't return just 1st row, but use autocompletion feature and: show message box if entered text does not match! */ return origValue(); //unchanged } -QVariant KexiComboBoxBase::visibleValueForLookupField() +TQVariant KexiComboBoxBase::visibleValueForLookupField() { KexiDB::LookupFieldSchema *lookupFieldSchema = this->lookupFieldSchema(); if (!popup() || !lookupFieldSchema) - return QVariant(); - const int visibleColumn = lookupFieldSchema->visibleColumn( popup()->tableView()->data()->columnsCount() ); + return TQVariant(); + const int visibleColumn = lookupFieldSchema->visibleColumn( popup()->tableView()->KexiDataAwareObjectInterface::data()->columnsCount() ); if (-1 == visibleColumn) - return QVariant(); + return TQVariant(); KexiTableItem *it = popup()->tableView()->selectedItem(); - return it ? it->at( QMIN( (uint)visibleColumn, it->count()-1)/*sanity*/ ) : QVariant(); + return it ? it->at( TQMIN( (uint)visibleColumn, it->count()-1)/*sanity*/ ) : TQVariant(); } -QVariant KexiComboBoxBase::visibleValue() +TQVariant KexiComboBoxBase::visibleValue() { return m_visibleValue; } @@ -302,7 +302,7 @@ void KexiComboBoxBase::clear() { if (popup()) popup()->hide(); - slotInternalEditorValueChanged(QVariant()); + slotInternalEditorValueChanged(TQVariant()); } tristate KexiComboBoxBase::valueChangedInternal() @@ -332,7 +332,7 @@ tristate KexiComboBoxBase::valueChangedInternal() bool KexiComboBoxBase::valueIsNull() { // bool ok; - QVariant v( value() ); + TQVariant v( value() ); return v.isNull(); // return !ok || v.isNull(); } @@ -352,15 +352,15 @@ void KexiComboBoxBase::createPopup(bool show) if (!field()) return; m_insideCreatePopup = true; - QWidget* thisWidget = dynamic_cast<QWidget*>(this); - QWidget *widgetToFocus = internalEditor() ? internalEditor() : thisWidget; + TQWidget* thisWidget = dynamic_cast<TQWidget*>(this); + TQWidget *widgetToFocus = internalEditor() ? internalEditor() : thisWidget; if (!popup()) { setPopup( column() ? new KexiComboBoxPopup(thisWidget, *column()) : new KexiComboBoxPopup(thisWidget, *field()) ); - QObject::connect(popup(), SIGNAL(rowAccepted(KexiTableItem*,int)), - thisWidget, SLOT(slotRowAccepted(KexiTableItem*,int))); - QObject::connect(popup()->tableView(), SIGNAL(itemSelected(KexiTableItem*)), - thisWidget, SLOT(slotItemSelected(KexiTableItem*))); + TQObject::connect(popup(), TQT_SIGNAL(rowAccepted(KexiTableItem*,int)), + thisWidget, TQT_SLOT(slotRowAccepted(KexiTableItem*,int))); + TQObject::connect(popup()->tableView(), TQT_SIGNAL(itemSelected(KexiTableItem*)), + thisWidget, TQT_SLOT(slotItemSelected(KexiTableItem*))); popup()->setFocusProxy( widgetToFocus ); popup()->tableView()->setFocusProxy( widgetToFocus ); @@ -376,10 +376,10 @@ void KexiComboBoxBase::createPopup(bool show) if (show && internalEditor() && !internalEditor()->isVisible()) /*emit*/editRequested(); - QPoint posMappedToGlobal = mapFromParentToGlobal(thisWidget->pos()); - if (posMappedToGlobal != QPoint(-1,-1)) { + TQPoint posMappedToGlobal = mapFromParentToGlobal(thisWidget->pos()); + if (posMappedToGlobal != TQPoint(-1,-1)) { //! todo alter the position to fit the popup within screen boundaries - popup()->move( posMappedToGlobal + QPoint(0, thisWidget->height()) ); + popup()->move( posMappedToGlobal + TQPoint(0, thisWidget->height()) ); //to avoid flickering: first resize to 0-height, then show and resize back to prev. height const int w = popupWidthHint(); popup()->resize(w, 0); @@ -403,8 +403,8 @@ void KexiComboBoxBase::createPopup(bool show) m_selectAllInInternalEditor_enabled = show; m_setValueInInternalEditor_enabled = show; if (rowToHighlight==-1) { - rowToHighlight = QMAX( popup()->tableView()->highlightedRow(), 0); - setValueInInternalEditor(QVariant()); + rowToHighlight = TQMAX( popup()->tableView()->highlightedRow(), 0); + setValueInInternalEditor(TQVariant()); } popup()->tableView()->selectRow( rowToHighlight ); popup()->tableView()->setHighlightedRow( rowToHighlight ); @@ -457,11 +457,11 @@ void KexiComboBoxBase::slotItemSelected(KexiTableItem*) { kexidbg << "KexiComboBoxBase::slotItemSelected(): m_visibleValue = " << m_visibleValue << endl; - QVariant valueToSet; + TQVariant valueToSet; KexiTableViewData *relData = column() ? column()->relatedData() : 0; KexiDB::LookupFieldSchema *lookupFieldSchema = this->lookupFieldSchema(); - m_visibleValue = lookupFieldSchema ? visibleValueForLookupField() : QVariant(); + m_visibleValue = lookupFieldSchema ? visibleValueForLookupField() : TQVariant(); if (relData) { //use 'related table data' model @@ -471,9 +471,9 @@ void KexiComboBoxBase::slotItemSelected(KexiTableItem*) } else if (lookupFieldSchema) { KexiTableItem *item = popup()->tableView()->selectedItem(); - const int visibleColumn = lookupFieldSchema->visibleColumn( popup()->tableView()->data()->columnsCount() ); + const int visibleColumn = lookupFieldSchema->visibleColumn( popup()->tableView()->KexiDataAwareObjectInterface::data()->columnsCount() ); if (item && visibleColumn!=-1 /* && (int)item->size() >= visibleColumn --already checked*/) { - valueToSet = item->at( QMIN( (uint)visibleColumn, item->count()-1)/*sanity*/ ); + valueToSet = item->at( TQMIN( (uint)visibleColumn, item->count()-1)/*sanity*/ ); } } else { @@ -481,8 +481,8 @@ void KexiComboBoxBase::slotItemSelected(KexiTableItem*) valueToSet = field()->enumHint( popup()->tableView()->currentRow() ); if (valueToSet.toString().isEmpty() && !m_insideCreatePopup) { clear(); - QWidget* thisWidget = dynamic_cast<QWidget*>(this); - thisWidget->parentWidget()->setFocus(); + TQWidget* thisWidget = dynamic_cast<TQWidget*>(this); + thisWidget->tqparentWidget()->setFocus(); return; } } @@ -495,7 +495,7 @@ void KexiComboBoxBase::slotItemSelected(KexiTableItem*) m_updatePopupSelectionOnShow = false; } -void KexiComboBoxBase::slotInternalEditorValueChanged(const QVariant& v) +void KexiComboBoxBase::slotInternalEditorValueChanged(const TQVariant& v) { if (!m_slotInternalEditorValueChanged_enabled) return; @@ -509,24 +509,24 @@ void KexiComboBoxBase::slotInternalEditorValueChanged(const QVariant& v) } } -void KexiComboBoxBase::setValueOrTextInInternalEditor(const QVariant& value) +void KexiComboBoxBase::setValueOrTextInInternalEditor(const TQVariant& value) { if (!m_setValueOrTextInInternalEditor_enabled) return; setValueInInternalEditor( value ); //this text is not entered by hand: - m_userEnteredValue = QVariant(); + m_userEnteredValue = TQVariant(); m_internalEditorValueChanged = false; } -bool KexiComboBoxBase::handleKeyPressForPopup( QKeyEvent *ke ) +bool KexiComboBoxBase::handleKeyPressForPopup( TQKeyEvent *ke ) { const int k = ke->key(); int highlightedOrSelectedRow = popup() ? popup()->tableView()->highlightedRow() : -1; if (popup() && highlightedOrSelectedRow < 0) highlightedOrSelectedRow = popup()->tableView()->currentRow(); - const bool enterPressed = k==Qt::Key_Enter || k==Qt::Key_Return; + const bool enterPressed = k==TQt::Key_Enter || k==TQt::Key_Return; // The editor may be active but the pull down menu not existant/visible, // e.g. when the user has pressed a normal button to activate the editor @@ -536,37 +536,37 @@ bool KexiComboBoxBase::handleKeyPressForPopup( QKeyEvent *ke ) } switch (k) { - case Qt::Key_Up: + case TQt::Key_Up: popup()->tableView()->setHighlightedRow( - QMAX(highlightedOrSelectedRow-1, 0) ); + TQMAX(highlightedOrSelectedRow-1, 0) ); updateTextForHighlightedRow(); return true; - case Qt::Key_Down: + case TQt::Key_Down: popup()->tableView()->setHighlightedRow( - QMIN(highlightedOrSelectedRow+1, popup()->tableView()->rows()-1) ); + TQMIN(highlightedOrSelectedRow+1, popup()->tableView()->rows()-1) ); updateTextForHighlightedRow(); return true; - case Qt::Key_PageUp: + case TQt::Key_PageUp: popup()->tableView()->setHighlightedRow( - QMAX(highlightedOrSelectedRow-popup()->tableView()->rowsPerPage(), 0) ); + TQMAX(highlightedOrSelectedRow-popup()->tableView()->rowsPerPage(), 0) ); updateTextForHighlightedRow(); return true; - case Qt::Key_PageDown: + case TQt::Key_PageDown: popup()->tableView()->setHighlightedRow( - QMIN(highlightedOrSelectedRow+popup()->tableView()->rowsPerPage(), + TQMIN(highlightedOrSelectedRow+popup()->tableView()->rowsPerPage(), popup()->tableView()->rows()-1) ); updateTextForHighlightedRow(); return true; - case Qt::Key_Home: + case TQt::Key_Home: popup()->tableView()->setHighlightedRow( 0 ); updateTextForHighlightedRow(); return true; - case Qt::Key_End: + case TQt::Key_End: popup()->tableView()->setHighlightedRow( popup()->tableView()->rows()-1 ); updateTextForHighlightedRow(); return true; - case Qt::Key_Enter: - case Qt::Key_Return: //accept + case TQt::Key_Enter: + case TQt::Key_Return: //accept //select row that is highlighted if (popup()->tableView()->highlightedRow()>=0) popup()->tableView()->selectRow( popup()->tableView()->highlightedRow() ); diff --git a/kexi/widget/tableview/kexicomboboxbase.h b/kexi/widget/tableview/kexicomboboxbase.h index 1433ab0f..f36dd822 100644 --- a/kexi/widget/tableview/kexicomboboxbase.h +++ b/kexi/widget/tableview/kexicomboboxbase.h @@ -47,12 +47,12 @@ class KEXIDATATABLE_EXPORT KexiComboBoxBase virtual KexiDB::Field *field() const = 0; //! \return the original value - virtual QVariant origValue() const = 0; + virtual TQVariant origValue() const = 0; //! Note: Generally in current implementation this is integer > 0; may be null if no value is set - virtual QVariant value(); + virtual TQVariant value(); - virtual QVariant visibleValue(); + virtual TQVariant visibleValue(); //! Reimplement this and call this impl.: used to clear internal editor virtual void clear(); @@ -75,29 +75,29 @@ class KEXIDATATABLE_EXPORT KexiComboBoxBase virtual void slotItemSelected(KexiTableItem*); //! Call this from slot - void slotInternalEditorValueChanged(const QVariant &v); + void slotInternalEditorValueChanged(const TQVariant &v); //! Implement this to return the internal editor - virtual QWidget *internalEditor() const = 0; + virtual TQWidget *internalEditor() const = 0; protected: - virtual void setValueInternal(const QVariant& add, bool removeOld); + virtual void setValueInternal(const TQVariant& add, bool removeOld); //! Used to select row item for an user-entered value \a v. //! Only for "lookup table" mode. - KexiTableItem* selectItemForEnteredValueInLookupTable(const QVariant& v); + KexiTableItem* selectItemForEnteredValueInLookupTable(const TQVariant& v); /*! \return value from \a returnFromColumn related to \a str value from column \a lookInColumn. If \a allowNulls is true, NULL is returend if no matched column found, else: \a str is returned. Example: lookInColumn=0, returnFromColumn=1 --returns user-visible string for column #1 for id-column #0 */ - QString valueForString(const QString& str, int* row, uint lookInColumn, + TQString valueForString(const TQString& str, int* row, uint lookInColumn, uint returnFromColumn, bool allowNulls = false); //! sets \a value for the line edit without setting a flag (m_userEnteredValue) that indicates that //! the text has been entered by hand (by a user) - void setValueOrTextInInternalEditor(const QVariant& value); //QString& text); + void setValueOrTextInInternalEditor(const TQVariant& value); //TQString& text); //! \return lookup field schema for this combo box, if present and if is valid (i.e. has defined row source) KexiDB::LookupFieldSchema* lookupFieldSchema() const; @@ -111,10 +111,10 @@ class KEXIDATATABLE_EXPORT KexiComboBoxBase virtual void selectAllInInternalEditor() = 0; //! Implement this to perform "set value" in the internal editor - virtual void setValueInInternalEditor(const QVariant& value) = 0; + virtual void setValueInInternalEditor(const TQVariant& value) = 0; //! Implement this to return value from the internal editor - virtual QVariant valueFromInternalEditor() = 0; + virtual TQVariant valueFromInternalEditor() = 0; //! Implement this as signal virtual void editRequested() = 0; @@ -122,9 +122,9 @@ class KEXIDATATABLE_EXPORT KexiComboBoxBase //! Implement this as signal virtual void acceptRequested() = 0; - //! Implement this to return a position \a pos mapped from parent (e.g. viewport) - //! to global coordinates. QPoint(-1, -1) should be returned if this cannot be computed. - virtual QPoint mapFromParentToGlobal(const QPoint& pos) const = 0; + //! Implement this to return a position \a pos mapped from tqparent (e.g. viewport) + //! to global coordinates. TQPoint(-1, -1) should be returned if this cannot be computed. + virtual TQPoint mapFromParentToGlobal(const TQPoint& pos) const = 0; //! Implement this to return a hint for popup width. virtual int popupWidthHint() const = 0; @@ -136,20 +136,20 @@ class KEXIDATATABLE_EXPORT KexiComboBoxBase virtual KexiComboBoxPopup *popup() const = 0; virtual void setPopup(KexiComboBoxPopup *popup) = 0; - virtual QVariant visibleValueForLookupField(); + virtual TQVariant visibleValueForLookupField(); void updateTextForHighlightedRow(); - bool handleKeyPressForPopup( QKeyEvent *ke ); + bool handleKeyPressForPopup( TQKeyEvent *ke ); void acceptPopupSelection(); //! Used by KexiDBComboBox. void undoChanges(); - QVariant m_visibleValue; + TQVariant m_visibleValue; - QVariant m_userEnteredValue; //!< value (usually a text) entered by hand (by the user) + TQVariant m_userEnteredValue; //!< value (usually a text) entered by hand (by the user) bool m_internalEditorValueChanged : 1; //!< true if user has text or other value inside editor bool m_slotInternalEditorValueChanged_enabled : 1; //!< Used in slotInternalEditorValueChanged() diff --git a/kexi/widget/tableview/kexicomboboxpopup.cpp b/kexi/widget/tableview/kexicomboboxpopup.cpp index 5cd65d0d..65edd806 100644 --- a/kexi/widget/tableview/kexicomboboxpopup.cpp +++ b/kexi/widget/tableview/kexicomboboxpopup.cpp @@ -30,16 +30,16 @@ #include <kdebug.h> -#include <qlayout.h> -#include <qevent.h> +#include <tqlayout.h> +#include <tqevent.h> /*! @internal Helper for KexiComboBoxPopup. */ class KexiComboBoxPopup_KexiTableView : public KexiDataTableView { public: - KexiComboBoxPopup_KexiTableView(QWidget* parent=0) - : KexiDataTableView(parent, "KexiComboBoxPopup_tv") + KexiComboBoxPopup_KexiTableView(TQWidget* tqparent=0) + : KexiDataTableView(tqparent, "KexiComboBoxPopup_tv") { init(); } @@ -56,8 +56,8 @@ class KexiComboBoxPopup_KexiTableView : public KexiDataTableView a.rowHighlightingEnabled = true; a.rowMouseOverHighlightingEnabled = true; a.persistentSelections = false; - a.rowMouseOverHighlightingColor = colorGroup().highlight(); - a.rowMouseOverHighlightingTextColor = colorGroup().highlightedText(); + a.rowMouseOverHighlightingColor = tqcolorGroup().highlight(); + a.rowMouseOverHighlightingTextColor = tqcolorGroup().highlightedText(); a.rowHighlightingTextColor = a.rowMouseOverHighlightingTextColor; a.gridEnabled = false; setAppearance(a); @@ -68,7 +68,7 @@ class KexiComboBoxPopup_KexiTableView : public KexiDataTableView setContextMenuEnabled( false ); setScrollbarToolTipsEnabled( false ); installEventFilter(this); - setBottomMarginInternal( - horizontalScrollBar()->sizeHint().height() ); + setBottomMarginInternal( - horizontalScrollBar()->tqsizeHint().height() ); } virtual void setData( KexiTableViewData *data, bool owner = true ) { KexiTableView::setData( data, owner ); } @@ -103,16 +103,16 @@ class KexiComboBoxPopupPrivate const int KexiComboBoxPopup::defaultMaxRows = 8; -KexiComboBoxPopup::KexiComboBoxPopup(QWidget* parent, KexiTableViewColumn &column) - : QFrame( parent, "KexiComboBoxPopup", WType_Popup ) +KexiComboBoxPopup::KexiComboBoxPopup(TQWidget* tqparent, KexiTableViewColumn &column) + : TQFrame( tqparent, "KexiComboBoxPopup", WType_Popup ) { init(); //setup tv data setData(&column, 0); } -KexiComboBoxPopup::KexiComboBoxPopup(QWidget* parent, KexiDB::Field &field) - : QFrame( parent, "KexiComboBoxPopup", WType_Popup ) +KexiComboBoxPopup::KexiComboBoxPopup(TQWidget* tqparent, KexiDB::Field &field) + : TQFrame( tqparent, "KexiComboBoxPopup", WType_Popup ) { init(); //setup tv data @@ -127,21 +127,21 @@ KexiComboBoxPopup::~KexiComboBoxPopup() void KexiComboBoxPopup::init() { d = new KexiComboBoxPopupPrivate(); - setPaletteBackgroundColor(palette().color(QPalette::Active,QColorGroup::Base)); + setPaletteBackgroundColor(palette().color(TQPalette::Active,TQColorGroup::Base)); setLineWidth( 1 ); setFrameStyle( Box | Plain ); d->tv = new KexiComboBoxPopup_KexiTableView(this); installEventFilter(this); - connect(d->tv, SIGNAL(itemReturnPressed(KexiTableItem*,int,int)), - this, SLOT(slotTVItemAccepted(KexiTableItem*,int,int))); + connect(d->tv, TQT_SIGNAL(itemReturnPressed(KexiTableItem*,int,int)), + this, TQT_SLOT(slotTVItemAccepted(KexiTableItem*,int,int))); - connect(d->tv, SIGNAL(itemMouseReleased(KexiTableItem*,int,int)), - this, SLOT(slotTVItemAccepted(KexiTableItem*,int,int))); + connect(d->tv, TQT_SIGNAL(itemMouseReleased(KexiTableItem*,int,int)), + this, TQT_SLOT(slotTVItemAccepted(KexiTableItem*,int,int))); - connect(d->tv, SIGNAL(itemDblClicked(KexiTableItem*,int,int)), - this, SLOT(slotTVItemAccepted(KexiTableItem*,int,int))); + connect(d->tv, TQT_SIGNAL(itemDblClicked(KexiTableItem*,int,int)), + this, TQT_SLOT(slotTVItemAccepted(KexiTableItem*,int,int))); } void KexiComboBoxPopup::setData(KexiTableViewColumn *column, KexiDB::Field *field) @@ -166,7 +166,7 @@ void KexiComboBoxPopup::setData(KexiTableViewColumn *column, KexiDB::Field *fiel delete d->privateQuery; d->privateQuery = 0; if (lookupFieldSchema) { - const QValueList<uint> visibleColumns( lookupFieldSchema->visibleColumns() ); + const TQValueList<uint> visibleColumns( lookupFieldSchema->visibleColumns() ); const bool multipleLookupColumnJoined = visibleColumns.count() > 1; //! @todo support more RowSourceType's, not only table and query KexiDB::Cursor *cursor = 0; @@ -211,7 +211,7 @@ void KexiComboBoxPopup::setData(KexiTableViewColumn *column, KexiDB::Field *fiel uint fieldsExpandedSize( fieldsExpanded.size() ); KexiDB::BaseExpr *expr = 0; int count = visibleColumns.count(); - for (QValueList<uint>::ConstIterator it( visibleColumns.at(count-1) ); count>0; count--, --it) { + for (TQValueList<uint>::ConstIterator it( visibleColumns.at(count-1) ); count>0; count--, --it) { KexiDB::QueryColumnInfo *ci = ((*it) < fieldsExpandedSize) ? fieldsExpanded.at( *it ) : 0; if (!ci) { kdWarning() << "KexiComboBoxPopup::setData(): " << *it << " >= fieldsExpandedSize" << endl; @@ -254,11 +254,11 @@ void KexiComboBoxPopup::setData(KexiTableViewColumn *column, KexiDB::Field *fiel //! @todo errmsg return; - if (d->tv->data()) - d->tv->data()->disconnect( this ); + if (d->tv->KexiDataAwareObjectInterface::data()) + d->tv->KexiDataAwareObjectInterface::data()->disconnect( this ); d->tv->setData( cursor ); - connect( d->tv, SIGNAL(dataRefreshed()), this, SLOT(slotDataReloadRequested())); + connect( d->tv, TQT_SIGNAL(dataRefreshed()), this, TQT_SLOT(slotDataReloadRequested())); updateSize(); return; } @@ -272,10 +272,10 @@ void KexiComboBoxPopup::setData(KexiTableViewColumn *column, KexiDB::Field *fiel d->int_f = new KexiDB::Field(field->name(), KexiDB::Field::Text); KexiTableViewData *data = new KexiTableViewData(); data->addColumn( new KexiTableViewColumn( *d->int_f ) ); - QValueVector<QString> hints = field->enumHints(); + TQValueVector<TQString> hints = field->enumHints(); for(uint i=0; i < hints.size(); i++) { KexiTableItem *item = data->createItem();//new KexiTableItem(1); - (*item)[0]=QVariant(hints[i]); + (*item)[0]=TQVariant(hints[i]); kdDebug() << "added: '" << hints[i] <<"'"<<endl; data->append( item ); } @@ -284,25 +284,25 @@ void KexiComboBoxPopup::setData(KexiTableViewColumn *column, KexiDB::Field *fiel void KexiComboBoxPopup::setDataInternal( KexiTableViewData *data, bool owner ) { - if (d->tv->data()) - d->tv->data()->disconnect( this ); + if (d->tv->KexiDataAwareObjectInterface::data()) + d->tv->KexiDataAwareObjectInterface::data()->disconnect( this ); d->tv->setData( data, owner ); - connect( d->tv, SIGNAL(dataRefreshed()), this, SLOT(slotDataReloadRequested())); + connect( d->tv, TQT_SIGNAL(dataRefreshed()), this, TQT_SLOT(slotDataReloadRequested())); updateSize(); } void KexiComboBoxPopup::updateSize(int minWidth) { - const int rows = QMIN( d->max_rows, d->tv->rows() ); + const int rows = TQMIN( d->max_rows, d->tv->rows() ); d->tv->adjustColumnWidthToContents(-1); - KexiTableEdit *te = dynamic_cast<KexiTableEdit*>(parentWidget()); - const int width = QMAX( d->tv->tableSize().width(), - (te ? te->totalSize().width() : (parentWidget()?parentWidget()->width():0/*sanity*/)) ); + KexiTableEdit *te = dynamic_cast<KexiTableEdit*>(tqparentWidget()); + const int width = TQMAX( d->tv->tableSize().width(), + (te ? te->totalSize().width() : (tqparentWidget()?tqparentWidget()->width():0/*sanity*/)) ); kexidbg << "KexiComboBoxPopup::updateSize(): size=" << size() << endl; - resize( QMAX(minWidth, width)/*+(d->tv->columns()>1?2:0)*/ /*(d->updateSizeCalled?0:1)*/, d->tv->rowHeight() * rows +2 ); + resize( TQMAX(minWidth, width)/*+(d->tv->columns()>1?2:0)*/ /*(d->updateSizeCalled?0:1)*/, d->tv->rowHeight() * rows +2 ); kexidbg << "KexiComboBoxPopup::updateSize(): size after=" << size() << endl; //stretch the last column @@ -320,7 +320,7 @@ void KexiComboBoxPopup::resize( int w, int h ) d->tv->verticalScrollBar()->hide(); d->tv->move(1,1); d->tv->resize( w-2, h-2 ); - QFrame::resize(w,h); + TQFrame::resize(w,h); update(); updateGeometry(); } @@ -341,19 +341,19 @@ void KexiComboBoxPopup::slotTVItemAccepted(KexiTableItem *item, int row, int) emit rowAccepted(item, row); } -bool KexiComboBoxPopup::eventFilter( QObject *o, QEvent *e ) +bool KexiComboBoxPopup::eventFilter( TQObject *o, TQEvent *e ) { - if (o==this && e->type()==QEvent::Hide) { + if (TQT_BASE_OBJECT(o)==TQT_BASE_OBJECT(this) && e->type()==TQEvent::Hide) { emit hidden(); } - else if (e->type()==QEvent::MouseButtonPress) { - kdDebug() << "QEvent::MousePress" << endl; + else if (e->type()==TQEvent::MouseButtonPress) { + kdDebug() << "TQEvent::MousePress" << endl; } - else if (o==d->tv) { - if (e->type()==QEvent::KeyPress) { - QKeyEvent *ke = static_cast<QKeyEvent*>(e); + else if (TQT_BASE_OBJECT(o)==TQT_BASE_OBJECT(d->tv)) { + if (e->type()==TQEvent::KeyPress) { + TQKeyEvent *ke = TQT_TQKEYEVENT(e); const int k = ke->key(); - if ((ke->state()==NoButton && (k==Key_Escape || k==Key_F4)) + if ((ke->state()==Qt::NoButton && (k==Key_Escape || k==Key_F4)) || (ke->state()==AltButton && k==Key_Up)) { hide(); @@ -362,7 +362,7 @@ bool KexiComboBoxPopup::eventFilter( QObject *o, QEvent *e ) } } } - return QFrame::eventFilter( o, e ); + return TQFrame::eventFilter( o, e ); } void KexiComboBoxPopup::slotDataReloadRequested() diff --git a/kexi/widget/tableview/kexicomboboxpopup.h b/kexi/widget/tableview/kexicomboboxpopup.h index 42a15404..d78955b2 100644 --- a/kexi/widget/tableview/kexicomboboxpopup.h +++ b/kexi/widget/tableview/kexicomboboxpopup.h @@ -20,7 +20,7 @@ #ifndef KEXICOMBOBOXPOPUP_H #define KEXICOMBOBOXPOPUP_H -#include <qframe.h> +#include <tqframe.h> class KexiComboBoxPopupPrivate; class KexiTableView; @@ -32,19 +32,20 @@ namespace KexiDB { } //! Internal class for displaying popup table view -class KexiComboBoxPopup : public QFrame +class KexiComboBoxPopup : public TQFrame { Q_OBJECT + TQ_OBJECT public: //js TODO: more ctors! /*! Constructor for creating a popup using definition from \a column. If the column is lookup column, it's definition is used to display one or more column within the popup. Otherwise column.field() is used to display single-column data. */ - KexiComboBoxPopup(QWidget* parent, KexiTableViewColumn &column); + KexiComboBoxPopup(TQWidget* tqparent, KexiTableViewColumn &column); /*! Alternative constructor supporting lookup fields and enum hints. */ - KexiComboBoxPopup(QWidget* parent, KexiDB::Field &field); + KexiComboBoxPopup(TQWidget* tqparent, KexiDB::Field &field); virtual ~KexiComboBoxPopup(); @@ -59,7 +60,7 @@ class KexiComboBoxPopup : public QFrame /*! Default maximum number of rows for KexiComboBoxPopup objects. */ static const int defaultMaxRows; - virtual bool eventFilter( QObject *o, QEvent *e ); + virtual bool eventFilter( TQObject *o, TQEvent *e ); signals: void rowAccepted(KexiTableItem *item, int row); diff --git a/kexi/widget/tableview/kexicomboboxtableedit.cpp b/kexi/widget/tableview/kexicomboboxtableedit.cpp index 75815a8a..ba61e305 100644 --- a/kexi/widget/tableview/kexicomboboxtableedit.cpp +++ b/kexi/widget/tableview/kexicomboboxtableedit.cpp @@ -18,12 +18,12 @@ * Boston, MA 02110-1301, USA. */ -#include <qlayout.h> -#include <qstyle.h> -#include <qwindowsstyle.h> -#include <qpainter.h> -#include <qapplication.h> -#include <qclipboard.h> +#include <tqlayout.h> +#include <tqstyle.h> +#include <tqwindowsstyle.h> +#include <tqpainter.h> +#include <tqapplication.h> +#include <tqclipboard.h> #include "kexicomboboxtableedit.h" #include <widget/utils/kexicomboboxdropdownbutton.h> @@ -54,41 +54,41 @@ public: KPushButton *button; KexiComboBoxPopup *popup; int currentEditorWidth; - QSize totalSize; + TQSize totalSize; KexiTableViewColumn* visibleTableViewColumn; KexiTableEdit* internalEditor; }; //====================================================== -KexiComboBoxTableEdit::KexiComboBoxTableEdit(KexiTableViewColumn &column, QWidget *parent) - : KexiInputTableEdit(column, parent) +KexiComboBoxTableEdit::KexiComboBoxTableEdit(KexiTableViewColumn &column, TQWidget *tqparent) + : KexiInputTableEdit(column, tqparent) , KexiComboBoxBase() , d(new Private()) { setName("KexiComboBoxTableEdit"); m_setVisibleValueOnSetValueInternal = true; - d->button = new KexiComboBoxDropDownButton( parentWidget() /*usually a viewport*/ ); + d->button = new KexiComboBoxDropDownButton( tqparentWidget() /*usually a viewport*/ ); d->button->hide(); - d->button->setFocusPolicy( NoFocus ); - connect(d->button, SIGNAL(clicked()), this, SLOT(slotButtonClicked())); + d->button->setFocusPolicy( TQ_NoFocus ); + connect(d->button, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotButtonClicked())); - connect(m_lineedit, SIGNAL(textChanged(const QString&)), this, SLOT(slotLineEditTextChanged(const QString&))); + connect(m_lineedit, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(slotLineEditTextChanged(const TQString&))); // m_lineedit = new KLineEdit(this, "lineedit"); // m_lineedit->setFrame(false); -// m_lineedit->setFrameStyle( QFrame::Plain | QFrame::Box ); +// m_lineedit->setFrameStyle( TQFrame::Plain | TQFrame::Box ); // m_lineedit->setLineWidth( 1 ); // if (f.isNumericType()) { -// m_lineedit->setAlignment(AlignRight); +// m_lineedit->tqsetAlignment(AlignRight); // } // setView( m_lineedit ); -// layout->addWidget(m_view); +// tqlayout->addWidget(m_view); // m_combo->setEditable( true ); // m_combo->clear(); // m_combo->insertStringList(f.enumHints()); -// QStringList::ConstIterator it, end( f.enumHints().constEnd() ); +// TQStringList::ConstIterator it, end( f.enumHints().constEnd() ); // for ( it = f.enumHints().constBegin(); it != end; ++it) { // if(!hints.at(i).isEmpty()) // m_combo->insertItem(hints.at(i)); @@ -138,7 +138,7 @@ void KexiComboBoxTableEdit::setPopup(KexiComboBoxPopup *popup) d->popup = popup; } -void KexiComboBoxTableEdit::showFocus( const QRect& r, bool readOnly ) +void KexiComboBoxTableEdit::showFocus( const TQRect& r, bool readOnly ) { // d->button->move( pos().x()+ width(), pos().y() ); updateFocus( r ); @@ -151,13 +151,13 @@ void KexiComboBoxTableEdit::showFocus( const QRect& r, bool readOnly ) void KexiComboBoxTableEdit::resize(int w, int h) { - d->totalSize = QSize(w,h); + d->totalSize = TQSize(w,h); if (!column()->isReadOnly()) { d->button->resize( h, h ); - QWidget::resize(w - d->button->width(), h); + TQWidget::resize(w - d->button->width(), h); } m_rightMarginWhenFocused = m_rightMargin + (column()->isReadOnly() ? 0 : d->button->width()); - QRect r( pos().x(), pos().y(), w+1, h+1 ); + TQRect r( pos().x(), pos().y(), w+1, h+1 ); if (m_scrollView) r.moveBy(m_scrollView->contentsX(), m_scrollView->contentsY()); updateFocus( r ); @@ -167,7 +167,7 @@ void KexiComboBoxTableEdit::resize(int w, int h) } // internal -void KexiComboBoxTableEdit::updateFocus( const QRect& r ) +void KexiComboBoxTableEdit::updateFocus( const TQRect& r ) { if (!column()->isReadOnly()) { if (d->button->width() > r.width()) @@ -182,14 +182,14 @@ void KexiComboBoxTableEdit::hideFocus() d->button->hide(); } -QVariant KexiComboBoxTableEdit::visibleValue() +TQVariant KexiComboBoxTableEdit::visibleValue() { return KexiComboBoxBase::visibleValue(); /* KexiDB::LookupFieldSchema *lookupFieldSchema = this->lookupFieldSchema(); if (!popup() || !lookupFieldSchema) - return QVariant(); + return TQVariant(); KexiTableItem *it = popup()->tableView()->selectedItem(); - return it ? it->at( lookupFieldSchema->visibleColumn() ) : QVariant();*/ + return it ? it->at( lookupFieldSchema->visibleColumn() ) : TQVariant();*/ } void KexiComboBoxTableEdit::clear() @@ -206,7 +206,7 @@ bool KexiComboBoxTableEdit::valueChanged() return res == true; } -void KexiComboBoxTableEdit::paintFocusBorders( QPainter *p, QVariant &, int x, int y, int w, int h ) +void KexiComboBoxTableEdit::paintFocusBorders( TQPainter *p, TQVariant &, int x, int y, int w, int h ) { // d->currentEditorWidth = w; if (!column()->isReadOnly()) { @@ -216,8 +216,8 @@ void KexiComboBoxTableEdit::paintFocusBorders( QPainter *p, QVariant &, int x, i p->drawRect(x, y, w, h); } -void KexiComboBoxTableEdit::setupContents( QPainter *p, bool focused, const QVariant& val, - QString &txt, int &align, int &x, int &y_offset, int &w, int &h ) +void KexiComboBoxTableEdit::setupContents( TQPainter *p, bool focused, const TQVariant& val, + TQString &txt, int &align, int &x, int &y_offset, int &w, int &h ) { if (d->internalEditor) { d->internalEditor->setupContents( p, focused, val, txt, align, x, y_offset, w, h ); @@ -295,18 +295,18 @@ void KexiComboBoxTableEdit::show() } } -bool KexiComboBoxTableEdit::handleKeyPress( QKeyEvent *ke, bool editorActive ) +bool KexiComboBoxTableEdit::handleKeyPress( TQKeyEvent *ke, bool editorActive ) { const int k = ke->key(); - if ((ke->state()==NoButton && k==Qt::Key_F4) - || (ke->state()==AltButton && k==Qt::Key_Down)) + if ((ke->state()==Qt::NoButton && k==TQt::Key_F4) + || (ke->state()==AltButton && k==TQt::Key_Down)) { //show popup slotButtonClicked(); return true; } else if (editorActive) { - const bool enterPressed = k==Qt::Key_Enter || k==Qt::Key_Return; + const bool enterPressed = k==TQt::Key_Enter || k==TQt::Key_Return; if (enterPressed && m_internalEditorValueChanged) { createPopup(false); selectItemForEnteredValueInLookupTable( m_userEnteredValue ); @@ -319,52 +319,52 @@ bool KexiComboBoxTableEdit::handleKeyPress( QKeyEvent *ke, bool editorActive ) return false; } -void KexiComboBoxTableEdit::slotLineEditTextChanged(const QString& s) +void KexiComboBoxTableEdit::slotLineEditTextChanged(const TQString& s) { slotInternalEditorValueChanged(s); } -int KexiComboBoxTableEdit::widthForValue( QVariant &val, const QFontMetrics &fm ) +int KexiComboBoxTableEdit::widthForValue( TQVariant &val, const TQFontMetrics &fm ) { KexiTableViewData *relData = column() ? column()->relatedData() : 0; if (lookupFieldSchema() || relData) { // in 'lookupFieldSchema' or or 'related table data' model // we're assuming val is already the text, not the index //! @todo ok? - return QMAX(KEXITV_MINIMUM_COLUMN_WIDTH, fm.width(val.toString())); + return TQMAX(KEXITV_MINIMUM_COLUMN_WIDTH, fm.width(val.toString())); } //use 'enum hints' model - QValueVector<QString> hints = field()->enumHints(); + TQValueVector<TQString> hints = field()->enumHints(); bool ok; int idx = val.toInt(&ok); if (!ok || idx < 0 || idx > int(hints.size()-1)) return KEXITV_MINIMUM_COLUMN_WIDTH; - QString txt = hints.at( idx, &ok ); + TQString txt = hints.at( idx, &ok ); if (!ok) return KEXITV_MINIMUM_COLUMN_WIDTH; return fm.width( txt ); } -bool KexiComboBoxTableEdit::eventFilter( QObject *o, QEvent *e ) +bool KexiComboBoxTableEdit::eventFilter( TQObject *o, TQEvent *e ) { - if (!column()->isReadOnly() && e->type()==QEvent::MouseButtonPress && m_scrollView) { - QPoint gp = static_cast<QMouseEvent*>(e)->globalPos() - + QPoint(m_scrollView->childX(d->button), m_scrollView->childY(d->button)); - QRect r(d->button->mapToGlobal(d->button->geometry().topLeft()), - d->button->mapToGlobal(d->button->geometry().bottomRight())); - if (o==popup() && popup()->isVisible() && r.contains( gp )) { + if (!column()->isReadOnly() && e->type()==TQEvent::MouseButtonPress && m_scrollView) { + TQPoint gp = TQT_TQMOUSEEVENT(e)->globalPos() + + TQPoint(m_scrollView->childX(d->button), m_scrollView->childY(d->button)); + TQRect r(d->button->mapToGlobal(d->button->tqgeometry().topLeft()), + d->button->mapToGlobal(d->button->tqgeometry().bottomRight())); + if (TQT_BASE_OBJECT(o)==TQT_BASE_OBJECT(popup()) && popup()->isVisible() && r.tqcontains( gp )) { m_mouseBtnPressedWhenPopupVisible = true; } } return false; } -QSize KexiComboBoxTableEdit::totalSize() const +TQSize KexiComboBoxTableEdit::totalSize() const { return d->totalSize; } -QWidget *KexiComboBoxTableEdit::internalEditor() const +TQWidget *KexiComboBoxTableEdit::internalEditor() const { return m_lineedit; } @@ -394,37 +394,37 @@ void KexiComboBoxTableEdit::selectAll() m_lineedit->selectAll(); } -void KexiComboBoxTableEdit::setValueInInternalEditor(const QVariant& value) +void KexiComboBoxTableEdit::setValueInInternalEditor(const TQVariant& value) { m_lineedit->setText(value.toString()); } -QVariant KexiComboBoxTableEdit::valueFromInternalEditor() +TQVariant KexiComboBoxTableEdit::valueFromInternalEditor() { return m_lineedit->text(); } -QPoint KexiComboBoxTableEdit::mapFromParentToGlobal(const QPoint& pos) const +TQPoint KexiComboBoxTableEdit::mapFromParentToGlobal(const TQPoint& pos) const { KexiTableView *tv = dynamic_cast<KexiTableView*>(m_scrollView); if (!tv) - return QPoint(-1,-1); + return TQPoint(-1,-1); return tv->viewport()->mapToGlobal(pos); } int KexiComboBoxTableEdit::popupWidthHint() const { - return m_lineedit->width() + m_leftMargin + m_rightMarginWhenFocused; //QMAX(popup()->width(), d->currentEditorWidth); + return m_lineedit->width() + m_leftMargin + m_rightMarginWhenFocused; //TQMAX(popup()->width(), d->currentEditorWidth); } -void KexiComboBoxTableEdit::handleCopyAction(const QVariant& value, const QVariant& visibleValue) +void KexiComboBoxTableEdit::handleCopyAction(const TQVariant& value, const TQVariant& visibleValue) { Q_UNUSED(value); //! @todo does not work with BLOBs! - qApp->clipboard()->setText( visibleValue.toString() ); + tqApp->clipboard()->setText( visibleValue.toString() ); } -void KexiComboBoxTableEdit::handleAction(const QString& actionName) +void KexiComboBoxTableEdit::handleAction(const TQString& actionName) { const bool alreadyVisible = m_lineedit->isVisible(); @@ -434,7 +434,7 @@ void KexiComboBoxTableEdit::handleAction(const QString& actionName) m_lineedit->clear(); } //! @todo does not work with BLOBs! - setValueInInternalEditor( qApp->clipboard()->text() ); + setValueInInternalEditor( tqApp->tqclipboard()->text() ); } else KexiInputTableEdit::handleAction(actionName); diff --git a/kexi/widget/tableview/kexicomboboxtableedit.h b/kexi/widget/tableview/kexicomboboxtableedit.h index 713fa55e..7b8a7339 100644 --- a/kexi/widget/tableview/kexicomboboxtableedit.h +++ b/kexi/widget/tableview/kexicomboboxtableedit.h @@ -37,9 +37,10 @@ class KexiTableViewColumn; class KexiComboBoxTableEdit : public KexiInputTableEdit, public KexiComboBoxBase { Q_OBJECT + TQ_OBJECT public: - KexiComboBoxTableEdit(KexiTableViewColumn &column, QWidget *parent=0); + KexiComboBoxTableEdit(KexiTableViewColumn &column, TQWidget *tqparent=0); virtual ~KexiComboBoxTableEdit(); //! Implemented for KexiComboBoxBase @@ -49,55 +50,55 @@ class KexiComboBoxTableEdit : public KexiInputTableEdit, public KexiComboBoxBase virtual KexiDB::Field *field() const { return m_column->field(); } //! Implemented for KexiComboBoxBase - virtual QVariant origValue() const { return m_origValue; } + virtual TQVariant origValue() const { return m_origValue; } - virtual void setValueInternal(const QVariant& add, bool removeOld) + virtual void setValueInternal(const TQVariant& add, bool removeOld) { KexiComboBoxBase::setValueInternal(add, removeOld); } - virtual QVariant value() { return KexiComboBoxBase::value(); } + virtual TQVariant value() { return KexiComboBoxBase::value(); } virtual void clear(); virtual bool valueChanged(); - virtual QVariant visibleValue(); + virtual TQVariant visibleValue(); /*! Reimplemented: resizes a view(). */ virtual void resize(int w, int h); - virtual void showFocus( const QRect& r, bool readOnly ); + virtual void showFocus( const TQRect& r, bool readOnly ); virtual void hideFocus(); - virtual void paintFocusBorders( QPainter *p, QVariant &cal, int x, int y, int w, int h ); + virtual void paintFocusBorders( TQPainter *p, TQVariant &cal, int x, int y, int w, int h ); /*! Setups contents of the cell. As a special case, if there is lookup field schema defined, \a val already contains the visible value (usually the text) set by \ref KexiTableView::paintcell(), so there is noo need to lookup the value in the combo box's popup. */ - virtual void setupContents( QPainter *p, bool focused, const QVariant& val, - QString &txt, int &align, int &x, int &y_offset, int &w, int &h ); + virtual void setupContents( TQPainter *p, bool focused, const TQVariant& val, + TQString &txt, int &align, int &x, int &y_offset, int &w, int &h ); /*! Used to handle key press events for the item. */ - virtual bool handleKeyPress( QKeyEvent *ke, bool editorActive ); + virtual bool handleKeyPress( TQKeyEvent *ke, bool editorActive ); - virtual int widthForValue( QVariant &val, const QFontMetrics &fm ); + virtual int widthForValue( TQVariant &val, const TQFontMetrics &fm ); virtual void hide(); virtual void show(); /*! \return total size of this editor, including popup button. */ - virtual QSize totalSize() const; + virtual TQSize totalSize() const; virtual void createInternalEditor(KexiDB::QuerySchema& schema); /*! Reimplemented after KexiInputTableEdit. */ - virtual void handleAction(const QString& actionName); + virtual void handleAction(const TQString& actionName); /*! Reimplemented after KexiInputTableEdit. For a special case (combo box), \a visibleValue can be provided, so it can be copied to the clipboard instead of unreadable \a value. */ - virtual void handleCopyAction(const QVariant& value, const QVariant& visibleValue); + virtual void handleCopyAction(const TQVariant& value, const TQVariant& visibleValue); public slots: //! Implemented for KexiDataItemInterface @@ -113,19 +114,19 @@ class KexiComboBoxTableEdit : public KexiInputTableEdit, public KexiComboBoxBase void slotButtonClicked(); void slotRowAccepted(KexiTableItem *item, int row) { KexiComboBoxBase::slotRowAccepted(item, row); } void slotItemSelected(KexiTableItem* item) { KexiComboBoxBase::slotItemSelected(item); } - void slotInternalEditorValueChanged(const QVariant& v) + void slotInternalEditorValueChanged(const TQVariant& v) { KexiComboBoxBase::slotInternalEditorValueChanged(v); } - void slotLineEditTextChanged(const QString& s); + void slotLineEditTextChanged(const TQString& s); void slotPopupHidden(); protected: //! internal - void updateFocus( const QRect& r ); + void updateFocus( const TQRect& r ); - virtual bool eventFilter( QObject *o, QEvent *e ); + virtual bool eventFilter( TQObject *o, TQEvent *e ); //! Implemented for KexiComboBoxBase - virtual QWidget *internalEditor() const; + virtual TQWidget *internalEditor() const; //! Implemented for KexiComboBoxBase virtual void moveCursorToEndInInternalEditor(); @@ -134,10 +135,10 @@ class KexiComboBoxTableEdit : public KexiInputTableEdit, public KexiComboBoxBase virtual void selectAllInInternalEditor(); //! Implemented for KexiComboBoxBase - virtual void setValueInInternalEditor(const QVariant& value); + virtual void setValueInInternalEditor(const TQVariant& value); //! Implemented for KexiComboBoxBase - virtual QVariant valueFromInternalEditor(); + virtual TQVariant valueFromInternalEditor(); //! Implemented for KexiComboBoxBase virtual void editRequested() { KexiInputTableEdit::editRequested(); } @@ -146,7 +147,7 @@ class KexiComboBoxTableEdit : public KexiInputTableEdit, public KexiComboBoxBase virtual void acceptRequested() { KexiInputTableEdit::acceptRequested(); } //! Implemented for KexiComboBoxBase - virtual QPoint mapFromParentToGlobal(const QPoint& pos) const; + virtual TQPoint mapFromParentToGlobal(const TQPoint& pos) const; //! Implemented for KexiComboBoxBase virtual int popupWidthHint() const; diff --git a/kexi/widget/tableview/kexidataawareobjectiface.cpp b/kexi/widget/tableview/kexidataawareobjectiface.cpp index 59edbed3..5c90eb06 100644 --- a/kexi/widget/tableview/kexidataawareobjectiface.cpp +++ b/kexi/widget/tableview/kexidataawareobjectiface.cpp @@ -25,9 +25,9 @@ #include "kexidataawareobjectiface.h" -#include <qscrollview.h> -#include <qlabel.h> -#include <qtooltip.h> +#include <tqscrollview.h> +#include <tqlabel.h> +#include <tqtooltip.h> #include <kmessagebox.h> @@ -79,13 +79,13 @@ KexiDataAwareObjectInterface::KexiDataAwareObjectInterface() m_recentSearchDirection = KexiSearchAndReplaceViewInterface::Options::DefaultSearchDirection; // setup scrollbar tooltip and related members - m_scrollBarTip = new QLabel("",0, "vScrollBarToolTip", - Qt::WStyle_Customize |Qt::WStyle_NoBorder|Qt::WX11BypassWM|Qt::WStyle_StaysOnTop|Qt::WStyle_Tool); - m_scrollBarTip->setPalette(QToolTip::palette()); + m_scrollBarTip = new TQLabel("",0, "vScrollBarToolTip", + TQt::WStyle_Customize |TQt::WStyle_NoBorder|TQt::WX11BypassWM|TQt::WStyle_StaysOnTop|TQt::WStyle_Tool); + m_scrollBarTip->setPalette(TQToolTip::palette()); m_scrollBarTip->setMargin(2); m_scrollBarTip->setIndent(0); - m_scrollBarTip->setAlignment(Qt::AlignCenter); - m_scrollBarTip->setFrameStyle( QFrame::Plain | QFrame::Box ); + m_scrollBarTip->tqsetAlignment(TQt::AlignCenter); + m_scrollBarTip->setFrameStyle( TQFrame::Plain | TQFrame::Box ); m_scrollBarTip->setLineWidth(1); clearVariables(); @@ -142,7 +142,7 @@ void KexiDataAwareObjectInterface::setData( KexiTableViewData *data, bool owner wid=KEXI_DEFAULT_DATA_COLUMN_WIDTH;//default col width in pixels //! @todo add col width configuration and storage addHeaderColumn(it.current()->isHeaderTextVisible() - ? it.current()->captionAliasOrName() : QString::null, + ? it.current()->captionAliasOrName() : TQString(), f->description(), it.current()->icon(), wid); } } @@ -158,29 +158,29 @@ void KexiDataAwareObjectInterface::setData( KexiTableViewData *data, bool owner if (m_data && !theSameData) { //! @todo: store sorting settings? setSorting(-1); -// connect(m_data, SIGNAL(refreshRequested()), this, SLOT(slotRefreshRequested())); - connectToReloadDataSlot(m_data, SIGNAL(reloadRequested())); - QObject* thisObject = dynamic_cast<QObject*>(this); +// connect(m_data, TQT_SIGNAL(refreshRequested()), this, TQT_SLOT(slotRefreshRequested())); + connectToReloadDataSlot(m_data, TQT_SIGNAL(reloadRequested())); + TQObject* thisObject = dynamic_cast<TQObject*>(this); if (thisObject) { - QObject::connect(m_data, SIGNAL(destroying()), thisObject, SLOT(slotDataDestroying())); - QObject::connect(m_data, SIGNAL(rowsDeleted( const QValueList<int> & )), - thisObject, SLOT(slotRowsDeleted( const QValueList<int> & ))); - QObject::connect(m_data, SIGNAL(aboutToDeleteRow(KexiTableItem&,KexiDB::ResultInfo*,bool)), - thisObject, SLOT(slotAboutToDeleteRow(KexiTableItem&,KexiDB::ResultInfo*,bool))); - QObject::connect(m_data, SIGNAL(rowDeleted()), thisObject, SLOT(slotRowDeleted())); - QObject::connect(m_data, SIGNAL(rowInserted(KexiTableItem*,bool)), - thisObject, SLOT(slotRowInserted(KexiTableItem*,bool))); - QObject::connect(m_data, SIGNAL(rowInserted(KexiTableItem*,uint,bool)), - thisObject, SLOT(slotRowInserted(KexiTableItem*,uint,bool))); //not db-aware - QObject::connect(m_data, SIGNAL(rowRepaintRequested(KexiTableItem&)), - thisObject, SLOT(slotRowRepaintRequested(KexiTableItem&))); + TQObject::connect(m_data, TQT_SIGNAL(destroying()), thisObject, TQT_SLOT(slotDataDestroying())); + TQObject::connect(m_data, TQT_SIGNAL(rowsDeleted( const TQValueList<int> & )), + thisObject, TQT_SLOT(slotRowsDeleted( const TQValueList<int> & ))); + TQObject::connect(m_data, TQT_SIGNAL(aboutToDeleteRow(KexiTableItem&,KexiDB::ResultInfo*,bool)), + thisObject, TQT_SLOT(slotAboutToDeleteRow(KexiTableItem&,KexiDB::ResultInfo*,bool))); + TQObject::connect(m_data, TQT_SIGNAL(rowDeleted()), thisObject, TQT_SLOT(slotRowDeleted())); + TQObject::connect(m_data, TQT_SIGNAL(rowInserted(KexiTableItem*,bool)), + thisObject, TQT_SLOT(slotRowInserted(KexiTableItem*,bool))); + TQObject::connect(m_data, TQT_SIGNAL(rowInserted(KexiTableItem*,uint,bool)), + thisObject, TQT_SLOT(slotRowInserted(KexiTableItem*,uint,bool))); //not db-aware + TQObject::connect(m_data, TQT_SIGNAL(rowRepaintRequested(KexiTableItem&)), + thisObject, TQT_SLOT(slotRowRepaintRequested(KexiTableItem&))); // setup scrollbar's tooltip - QObject::connect(verticalScrollBar(),SIGNAL(sliderReleased()), - thisObject,SLOT(vScrollBarSliderReleased())); - QObject::connect(verticalScrollBar(),SIGNAL(valueChanged(int)), - thisObject,SLOT(vScrollBarValueChanged(int))); - QObject::connect(&m_scrollBarTipTimer,SIGNAL(timeout()), - thisObject,SLOT(scrollBarTipTimeout())); + TQObject::connect(verticalScrollBar(),TQT_SIGNAL(sliderReleased()), + thisObject,TQT_SLOT(vScrollBarSliderReleased())); + TQObject::connect(verticalScrollBar(),TQT_SIGNAL(valueChanged(int)), + thisObject,TQT_SLOT(vScrollBarValueChanged(int))); + TQObject::connect(&m_scrollBarTipTimer,TQT_SIGNAL(timeout()), + thisObject,TQT_SLOT(scrollBarTipTimeout())); } } @@ -214,7 +214,7 @@ void KexiDataAwareObjectInterface::setData( KexiTableViewData *data, bool owner void KexiDataAwareObjectInterface::initDataContents() { m_editor = 0; -// QSize s(tableSize()); +// TQSize s(tableSize()); // resizeContents(s.width(),s.height()); m_navPanel->setRecordCount(rows()); @@ -306,7 +306,7 @@ bool KexiDataAwareObjectInterface::sort() return true; } if (m_currentItem != m_insertItem) { - m_curRow = m_data->findRef(m_currentItem); + m_curRow = m_data->tqfindRef(m_currentItem); int jump = m_curRow - oldRow; if (jump<0) (*m_itemIterator) -= -jump; @@ -440,20 +440,20 @@ void KexiDataAwareObjectInterface::setSpreadSheetMode() void KexiDataAwareObjectInterface::selectNextRow() { - selectRow( QMIN( rows() - 1 +(isInsertingEnabled()?1:0), m_curRow + 1 ) ); + selectRow( TQMIN( rows() - 1 +(isInsertingEnabled()?1:0), m_curRow + 1 ) ); } void KexiDataAwareObjectInterface::selectPrevPage() { selectRow( - QMAX( 0, m_curRow - rowsPerPage() ) + TQMAX( 0, m_curRow - rowsPerPage() ) ); } void KexiDataAwareObjectInterface::selectNextPage() { selectRow( - QMIN( + TQMIN( rows() - 1 + (isInsertingEnabled()?1:0), m_curRow + rowsPerPage() ) @@ -480,7 +480,7 @@ void KexiDataAwareObjectInterface::selectRow(int row) void KexiDataAwareObjectInterface::selectPrevRow() { - selectRow( QMAX( 0, m_curRow - 1 ) ); + selectRow( TQMAX( 0, m_curRow - 1 ) ); } void KexiDataAwareObjectInterface::clearSelection() @@ -524,23 +524,23 @@ void KexiDataAwareObjectInterface::setCursorPosition(int row, int col/*=-1*/, bo if(col>=0) { - newcol = QMAX(0, col); - newcol = QMIN(columns() - 1, newcol); + newcol = TQMAX(0, col); + newcol = TQMIN(columns() - 1, newcol); } else { newcol = m_curCol; //no changes - newcol = QMAX(0, newcol); //may not be < 0 ! + newcol = TQMAX(0, newcol); //may not be < 0 ! } - newrow = QMAX(0, row); - newrow = QMIN(rows() - 1 + (isInsertingEnabled()?1:0), newrow); + newrow = TQMAX(0, row); + newrow = TQMIN(rows() - 1 + (isInsertingEnabled()?1:0), newrow); // d->pCurrentItem = itemAt(d->curRow); // kdDebug(44021) << "setCursorPosition(): d->curRow=" << d->curRow << " oldRow=" << oldRow << " d->curCol=" << d->curCol << " oldCol=" << oldCol << endl; if ( forceSet || m_curRow != newrow || m_curCol != newcol ) { - kexidbg << "setCursorPosition(): " <<QString("old:%1,%2 new:%3,%4").arg(m_curCol) - .arg(m_curRow).arg(newcol).arg(newrow) << endl; + kexidbg << "setCursorPosition(): " <<TQString("old:%1,%2 new:%3,%4").tqarg(m_curCol) + .tqarg(m_curRow).tqarg(newcol).tqarg(newrow) << endl; // cursor moved: get rid of editor if (m_editor) { @@ -549,7 +549,7 @@ void KexiDataAwareObjectInterface::setCursorPosition(int row, int col/*=-1*/, bo return; } //update row num. again - newrow = QMIN( rows() - 1 + (isInsertingEnabled()?1:0), newrow); + newrow = TQMIN( rows() - 1 + (isInsertingEnabled()?1:0), newrow); } } if (m_errorMessagePopup) { @@ -574,7 +574,7 @@ void KexiDataAwareObjectInterface::setCursorPosition(int row, int col/*=-1*/, bo return; } //update row number, because number of rows changed - newrow = QMIN( rows() - 1 + (isInsertingEnabled()?1:0), newrow); + newrow = TQMIN( rows() - 1 + (isInsertingEnabled()?1:0), newrow); m_navPanel->setCurrentRecordNumber(newrow+1); //refresh } @@ -621,7 +621,7 @@ void KexiDataAwareObjectInterface::setCursorPosition(int row, int col/*=-1*/, bo // //quite clever: ensure the cell is visible: // ensureCellVisible(m_curRow, m_curCol); -// QPoint pcenter = QRect( columnPos(d->curCol), rowPos(d->curRow), columnWidth(d->curCol), rh).center(); +// TQPoint pcenter = TQRect( columnPos(d->curCol), rowPos(d->curRow), columnWidth(d->curCol), rh).center(); // ensureVisible(pcenter.x(), pcenter.y(), columnWidth(d->curCol)/2, rh/2); // ensureVisible(columnPos(d->curCol), rowPos(d->curRow) - contentsY(), columnWidth(d->curCol), rh); @@ -644,8 +644,8 @@ void KexiDataAwareObjectInterface::setCursorPosition(int row, int col/*=-1*/, bo m_currentItem = m_insertItem; } else { - kdDebug(44021) << QString("NOW item at %1 (%2) is current") - .arg(m_curRow).arg((ulong)itemAt(m_curRow)) << endl; + kdDebug(44021) << TQString("NOW item at %1 (%2) is current") + .tqarg(m_curRow).tqarg((ulong)itemAt(m_curRow)) << endl; //NOT EFFECTIVE!!!!!!!!!!! //set item iterator if (!newRowInserted && isInsertingEnabled() && m_currentItem == m_insertItem && m_curRow == (rows()-1)) { @@ -710,7 +710,7 @@ bool KexiDataAwareObjectInterface::acceptRowEdit() // bool allow = true; // int faultyColumn = -1; // will be !=-1 if cursor has to be moved to that column const bool inserting = m_newRowEditing; -// QString msg, desc; +// TQString msg, desc; // bool inserting = d->pInsertItem && d->pInsertItem==d->pCurrentItem; if (m_data->rowEditBuffer()->isEmpty() && !m_newRowEditing) { @@ -838,8 +838,8 @@ bool KexiDataAwareObjectInterface::cancelRowEdit() // viewport()->width(), d->rowHeight*3 + (m_navPanel ? m_navPanel->height() : 0)*3 ); // updateContents(); //js: above did not work well so we do that dirty updateWidgetContents(); -//TODO: still doesn't repaint properly!! -// QSize s(tableSize()); +//TODO: still doesn't tqrepaint properly!! +// TQSize s(tableSize()); // resizeContents(s.width(), s.height()); updateWidgetContentsSize(); // m_verticalHeader->update(); @@ -890,17 +890,17 @@ bool KexiDataAwareObjectInterface::cancelEditor() } //! @internal -class KexiDataAwareObjectInterfaceToolTip : public QToolTip { +class KexiDataAwareObjectInterfaceToolTip : public TQToolTip { public: - KexiDataAwareObjectInterfaceToolTip( const QString & text, const QPoint & pos, QWidget * widget ) - : QToolTip(widget), m_text(text) + KexiDataAwareObjectInterfaceToolTip( const TQString & text, const TQPoint & pos, TQWidget * widget ) + : TQToolTip(widget), m_text(text) { - tip( QRect(pos, QSize(100, 100)), text ); + tip( TQRect(pos, TQSize(100, 100)), text ); } - virtual void maybeTip(const QPoint & p) { - tip( QRect(p, QSize(100, 100)), m_text); + virtual void maybeTip(const TQPoint & p) { + tip( TQRect(p, TQSize(100, 100)), m_text); } - QString m_text; + TQString m_text; }; bool KexiDataAwareObjectInterface::acceptEditor() @@ -912,12 +912,12 @@ bool KexiDataAwareObjectInterface::acceptEditor() m_inside_acceptEditor = true;//avoid recursion - QVariant newval; + TQVariant newval; Validator::Result res = Validator::Ok; - QString msg, desc; + TQString msg, desc; bool setNull = false; // bool allow = true; -// static const QString msg_NOT_NULL = i18n("\"%1\" column requires a value to be entered."); +// static const TQString msg_NOT_NULL = i18n("\"%1\" column requires a value to be entered."); //autoincremented field can be omitted (left as null or empty) if we're inserting a new row const bool autoIncColumnCanBeOmitted = m_newRowEditing && m_editor->field()->isAutoIncrement(); @@ -931,19 +931,19 @@ bool KexiDataAwareObjectInterface::acceptEditor() //used e.g. for date or time values - the value can be null but not necessary invalid res = Validator::Error; editCurrentCellAgain = true; - QWidget *par = dynamic_cast<QScrollView*>(this) ? dynamic_cast<QScrollView*>(this)->viewport() : - dynamic_cast<QWidget*>(this); - QWidget *edit = dynamic_cast<QWidget*>(m_editor); + TQWidget *par = dynamic_cast<TQScrollView*>(this) ? dynamic_cast<TQScrollView*>(this)->viewport() : + dynamic_cast<TQWidget*>(this); + TQWidget *edit = dynamic_cast<TQWidget*>(m_editor); if (par && edit) { //! @todo allow displaying user-defined warning //! @todo also use for other error messages if (!m_errorMessagePopup) { // m_errorMessagePopup->close(); m_errorMessagePopup = new KexiArrowTip( - i18n("Error: %1").arg(m_editor->columnInfo()->field->typeName())+"?", - dynamic_cast<QWidget*>(this)); + i18n("Error: %1").tqarg(m_editor->columnInfo()->field->typeName())+"?", + dynamic_cast<TQWidget*>(this)); m_errorMessagePopup->move( - par->mapToGlobal(edit->pos()) + QPoint(6, edit->height() + 0) ); + par->mapToGlobal(edit->pos()) + TQPoint(6, edit->height() + 0) ); m_errorMessagePopup->show(); } m_editor->setFocus(); @@ -954,8 +954,8 @@ bool KexiDataAwareObjectInterface::acceptEditor() if (m_editor->field()->isNotNull() && !autoIncColumnCanBeOmitted) { kdDebug() << "KexiDataAwareObjectInterface::acceptEditor(): NULL NOT ALLOWED!" << endl; res = Validator::Error; -// msg = Validator::msgColumnNotEmpty().arg(m_editor->columnInfo()->field->captionOrName()) - msg = Validator::msgColumnNotEmpty().arg(m_editor->field()->captionOrName()) +// msg = Validator::msgColumnNotEmpty().tqarg(m_editor->columnInfo()->field->captionOrName()) + msg = Validator::msgColumnNotEmpty().tqarg(m_editor->field()->captionOrName()) + "\n\n" + Kexi::msgYouCanImproveData(); desc = i18n("The column's constraint is declared as NOT NULL."); editCurrentCellAgain = true; @@ -976,8 +976,8 @@ bool KexiDataAwareObjectInterface::acceptEditor() if (m_editor->field()->isNotEmpty() && !autoIncColumnCanBeOmitted) { kdDebug() << "KexiDataAwareObjectInterface::acceptEditor(): EMPTY NOT ALLOWED!" << endl; res = Validator::Error; -// msg = Validator::msgColumnNotEmpty().arg(m_editor->columnInfo()->field->captionOrName()) - msg = Validator::msgColumnNotEmpty().arg(m_editor->field()->captionOrName()) +// msg = Validator::msgColumnNotEmpty().tqarg(m_editor->columnInfo()->field->captionOrName()) + msg = Validator::msgColumnNotEmpty().tqarg(m_editor->field()->captionOrName()) + "\n\n" + Kexi::msgYouCanImproveData(); desc = i18n("The column's constraint is declared as NOT EMPTY."); editCurrentCellAgain = true; @@ -994,8 +994,8 @@ bool KexiDataAwareObjectInterface::acceptEditor() if (m_editor->field()->isNotNull() && !autoIncColumnCanBeOmitted) { kdDebug() << "KexiDataAwareObjectInterface::acceptEditor(): NEITHER NULL NOR EMPTY VALUE CAN BE SET!" << endl; res = Validator::Error; -// msg = Validator::msgColumnNotEmpty().arg(m_editor->columnInfo()->field->captionOrName()) - msg = Validator::msgColumnNotEmpty().arg(m_editor->field()->captionOrName()) +// msg = Validator::msgColumnNotEmpty().tqarg(m_editor->columnInfo()->field->captionOrName()) + msg = Validator::msgColumnNotEmpty().tqarg(m_editor->field()->captionOrName()) + "\n\n" + Kexi::msgYouCanImproveData(); desc = i18n("The column's constraint is declared as NOT EMPTY and NOT NULL."); editCurrentCellAgain = true; @@ -1064,16 +1064,16 @@ bool KexiDataAwareObjectInterface::acceptEditor() if (res == Validator::Error) { if (!msg.isEmpty()) { if (desc.isEmpty()) - KMessageBox::sorry(dynamic_cast<QWidget*>(this), msg); + KMessageBox::sorry(dynamic_cast<TQWidget*>(this), msg); else - KMessageBox::detailedSorry(dynamic_cast<QWidget*>(this), msg, desc); + KMessageBox::detailedSorry(dynamic_cast<TQWidget*>(this), msg, desc); } editCurrentCellAgain = true; // allow = false; } else if (res == Validator::Warning) { //js: todo: message!!! - KMessageBox::messageBox(dynamic_cast<QWidget*>(this), KMessageBox::Sorry, msg + "\n" + desc); + KMessageBox::messageBox(dynamic_cast<TQWidget*>(this), KMessageBox::Sorry, msg + "\n" + desc); editCurrentCellAgain = true; } @@ -1083,7 +1083,7 @@ bool KexiDataAwareObjectInterface::acceptEditor() // emit aboutToChangeCell(d->pCurrentItem, newval, allow); // if (allow) { //send changes to the backend - QVariant visibleValue; + TQVariant visibleValue; if (!newval.isNull()/* visible value should be null if value is null */ && currentTVColumn->visibleLookupColumnInfo) { @@ -1139,13 +1139,13 @@ bool KexiDataAwareObjectInterface::acceptEditor() m_editor->showWidget(); m_editor->setFocus(); } -// startEditCurrentCell(newval.type()==QVariant::String ? newval.toString() : QString::null); +// startEditCurrentCell(newval.type()==TQVariant::String ? newval.toString() : TQString()); // m_editor->setFocus(); } return false; } -void KexiDataAwareObjectInterface::startEditCurrentCell(const QString &setText) +void KexiDataAwareObjectInterface::startEditCurrentCell(const TQString &setText) { kdDebug() << "** KexiDataAwareObjectInterface::startEditCurrentCell("<<setText<<")"<<endl; // if (columnType(d->curCol) == KexiDB::Field::Boolean) @@ -1180,7 +1180,7 @@ void KexiDataAwareObjectInterface::deleteAndStartEditCurrentCell() // columnWidth(m_curCol), rowHeight()); //OK? ensureCellVisible(m_curRow+1, m_curCol); - createEditor(m_curRow, m_curCol, QString::null, false/*removeOld*/); + createEditor(m_curRow, m_curCol, TQString(), false/*removeOld*/); if (!m_editor) return; m_editor->clear(); @@ -1208,7 +1208,7 @@ void KexiDataAwareObjectInterface::deleteCurrentRow() case ImmediateDelete: break; case AskDelete: - if (KMessageBox::Cancel == KMessageBox::warningContinueCancel(dynamic_cast<QWidget*>(this), + if (KMessageBox::Cancel == KMessageBox::warningContinueCancel(dynamic_cast<TQWidget*>(this), i18n("Do you want to delete selected row?"), 0, KGuiItem(i18n("&Delete Row"),"editdelete"), "dontAskBeforeDeleteRow"/*config entry*/, @@ -1251,7 +1251,7 @@ void KexiDataAwareObjectInterface::insertItem(KexiTableItem *newItem, int row) m_curRow++; } - m_data->insertRow(*newItem, row, true /*repaint*/); + m_data->insertRow(*newItem, row, true /*tqrepaint*/); if (changeCurrentRow) { //update iter... @@ -1259,7 +1259,7 @@ void KexiDataAwareObjectInterface::insertItem(KexiTableItem *newItem, int row) (*m_itemIterator)+=m_curRow; } /* - QSize s(tableSize()); + TQSize s(tableSize()); resizeContents(s.width(),s.height()); //redraw only this row and below: @@ -1281,15 +1281,15 @@ void KexiDataAwareObjectInterface::insertItem(KexiTableItem *newItem, int row) */ } -void KexiDataAwareObjectInterface::slotRowInserted(KexiTableItem *item, bool repaint) +void KexiDataAwareObjectInterface::slotRowInserted(KexiTableItem *item, bool tqrepaint) { - int row = m_data->findRef(item); - slotRowInserted( item, row, repaint ); + int row = m_data->tqfindRef(item); + slotRowInserted( item, row, tqrepaint ); } -void KexiDataAwareObjectInterface::slotRowInserted(KexiTableItem * /*item*/, uint row, bool repaint) +void KexiDataAwareObjectInterface::slotRowInserted(KexiTableItem * /*item*/, uint row, bool tqrepaint) { - if (repaint && (int)row<rows()) { + if (tqrepaint && (int)row<rows()) { updateWidgetContentsSize(); /* updateAllVisibleRowsBelow() used instead @@ -1317,7 +1317,7 @@ void KexiDataAwareObjectInterface::slotRowInserted(KexiTableItem * /*item*/, uin } } -tristate KexiDataAwareObjectInterface::deleteAllRows(bool ask, bool repaint) +tristate KexiDataAwareObjectInterface::deleteAllRows(bool ask, bool tqrepaint) { if (!hasData()) return true; @@ -1325,13 +1325,13 @@ tristate KexiDataAwareObjectInterface::deleteAllRows(bool ask, bool repaint) return true; if (ask) { - QString tableName = m_data->dbTableName(); + TQString tableName = m_data->dbTableName(); if (!tableName.isEmpty()) { tableName.prepend(" \""); tableName.append("\""); } - if (KMessageBox::Cancel == KMessageBox::warningContinueCancel(dynamic_cast<QWidget*>(this), - i18n("Do you want to clear the contents of table %1?").arg(tableName), + if (KMessageBox::Cancel == KMessageBox::warningContinueCancel(dynamic_cast<TQWidget*>(this), + i18n("Do you want to clear the contents of table %1?").tqarg(tableName), 0, KGuiItem(i18n("&Clear Contents")) )) return cancelled; } @@ -1339,10 +1339,10 @@ tristate KexiDataAwareObjectInterface::deleteAllRows(bool ask, bool repaint) cancelRowEdit(); // acceptRowEdit(); // m_verticalHeader->clear(); - const bool repaintLater = repaint && m_spreadSheetMode; + const bool tqrepaintLater = tqrepaint && m_spreadSheetMode; const int oldRows = rows(); - bool res = m_data->deleteAllRows(repaint && !repaintLater); + bool res = m_data->deleteAllRows(tqrepaint && !tqrepaintLater); if (res) { if (m_spreadSheetMode) { @@ -1352,28 +1352,28 @@ tristate KexiDataAwareObjectInterface::deleteAllRows(bool ask, bool repaint) } } } - if (repaintLater) + if (tqrepaintLater) m_data->reload(); // d->clearVariables(); // m_verticalHeader->setCurrentRow(-1); // d->pUpdateTimer->start(1,true); -// if (repaint) -// viewport()->repaint(); +// if (tqrepaint) +// viewport()->tqrepaint(); return res; } -void KexiDataAwareObjectInterface::clearColumns(bool repaint) +void KexiDataAwareObjectInterface::clearColumns(bool tqrepaint) { cancelRowEdit(); m_data->clearInternal(); - clearColumnsInternal(repaint); + clearColumnsInternal(tqrepaint); updateIndicesForVisibleValues(); - if (repaint) -// viewport()->repaint(); + if (tqrepaint) +// viewport()->tqrepaint(); //OK? updateWidgetContents(); @@ -1393,7 +1393,7 @@ void KexiDataAwareObjectInterface::clearColumns(bool repaint) m_verticalHeader->setCurrentRow(-1); - viewport()->repaint(); + viewport()->tqrepaint(); // d->pColumnTypes.resize(0); // d->pColumnModes.resize(0); @@ -1419,7 +1419,7 @@ void KexiDataAwareObjectInterface::reloadData() if (m_verticalHeader) m_verticalHeader->setCurrentRow(-1); - if (dynamic_cast<QWidget*>(this) && dynamic_cast<QWidget*>(this)->isVisible()) + if (dynamic_cast<TQWidget*>(this) && dynamic_cast<TQWidget*>(this)->isVisible()) initDataContents(); else m_initDataContentsOnShow = true; @@ -1456,9 +1456,9 @@ int KexiDataAwareObjectInterface::dataColumns() const return m_data->columns.count(); } -QVariant KexiDataAwareObjectInterface::columnDefaultValue(int /*col*/) const +TQVariant KexiDataAwareObjectInterface::columnDefaultValue(int /*col*/) const { - return QVariant(0); + return TQVariant(0); //TODO(js) // return m_data->columns[col].defaultValue; } @@ -1490,10 +1490,10 @@ void KexiDataAwareObjectInterface::setEmptyRowInsertingEnabled(bool set) } void KexiDataAwareObjectInterface::slotAboutToDeleteRow(KexiTableItem& item, - KexiDB::ResultInfo* /*result*/, bool repaint) + KexiDB::ResultInfo* /*result*/, bool tqrepaint) { - if (repaint) { - m_rowWillBeDeleted = m_data->findRef(&item); + if (tqrepaint) { + m_rowWillBeDeleted = m_data->tqfindRef(&item); } } @@ -1529,12 +1529,12 @@ bool KexiDataAwareObjectInterface::deleteItem(KexiTableItem *item)/*, bool moveC if (!item || !beforeDeleteItem(item)) return false; - QString msg, desc; + TQString msg, desc; // bool current = (item == d->pCurrentItem); const bool lastRowDeleted = m_spreadSheetMode && m_data->last() == item; //we need to know this so we //can return to the last row //after reinserting it - if (!m_data->deleteRow(*item, true /*repaint*/)) { + if (!m_data->deleteRow(*item, true /*tqrepaint*/)) { /*const int button =*/ showErrorMessageForResult( m_data->result() ); // if (KMessageBox::No == button) { @@ -1547,7 +1547,7 @@ bool KexiDataAwareObjectInterface::deleteItem(KexiTableItem *item)/*, bool moveC //d->pCurrentItem = m_data->current(); } -// repaintAfterDelete(); +// tqrepaintAfterDelete(); if (m_spreadSheetMode) { //append empty row for spreadsheet mode m_data->append(m_data->createItem());//new KexiTableItem(m_data->columns.count())); if (m_verticalHeader) @@ -1572,7 +1572,7 @@ bool KexiDataAwareObjectInterface::hasDefaultValueAt(const KexiTableViewColumn& return false; } -const QVariant* KexiDataAwareObjectInterface::bufferedValueAt(int col, bool useDefaultValueIfPossible) +const TQVariant* KexiDataAwareObjectInterface::bufferedValueAt(int col, bool useDefaultValueIfPossible) { if (m_rowEditing && m_data->rowEditBuffer()) { @@ -1585,17 +1585,17 @@ const QVariant* KexiDataAwareObjectInterface::bufferedValueAt(int col, bool useD "fieldNumberForColumn(m_curCol) < 0" << endl; return 0; } - QVariant *storedValue = &m_currentItem->at( realFieldNumber ); + TQVariant *storedValue = &m_currentItem->at( realFieldNumber ); //db-aware data: now, try to find a buffered value (or default one) - const QVariant *cv = m_data->rowEditBuffer()->at( *tvcol->columnInfo, + const TQVariant *cv = m_data->rowEditBuffer()->at( *tvcol->columnInfo, storedValue->isNull() && useDefaultValueIfPossible); if (cv) return cv; return storedValue; } //not db-aware data: - const QVariant *cv = m_data->rowEditBuffer()->at( tvcol->field()->name() ); + const TQVariant *cv = m_data->rowEditBuffer()->at( tvcol->field()->name() ); if (cv) return cv; } @@ -1632,8 +1632,8 @@ void KexiDataAwareObjectInterface::boolToggled() updateCell(m_curRow, m_curCol); /* int s = m_currentItem->at(m_curCol).toInt(); - QVariant oldValue=m_currentItem->at(m_curCol); - (*m_currentItem)[m_curCol] = QVariant(s ? 0 : 1); + TQVariant oldValue=m_currentItem->at(m_curCol); + (*m_currentItem)[m_curCol] = TQVariant(s ? 0 : 1); updateCell(m_curRow, m_curCol); // emit itemChanged(m_currentItem, m_curRow, m_curCol, oldValue); // emit itemChanged(m_currentItem, m_curRow, m_curCol);*/ @@ -1660,7 +1660,7 @@ void KexiDataAwareObjectInterface::addNewRecordRequested() m_editor->setFocus(); } -bool KexiDataAwareObjectInterface::handleKeyPress(QKeyEvent *e, int &curRow, int &curCol, +bool KexiDataAwareObjectInterface::handleKeyPress(TQKeyEvent *e, int &curRow, int &curCol, bool fullRowSelection, bool *moveToFirstField, bool *moveToLastField) { if (moveToFirstField) @@ -1672,23 +1672,23 @@ bool KexiDataAwareObjectInterface::handleKeyPress(QKeyEvent *e, int &curRow, int const int k = e->key(); //kdDebug() << "-----------" << e->state() << " " << k << endl; - if ((k == Qt::Key_Up && nobtn) || (k == Qt::Key_PageUp && e->state()==Qt::ControlButton)) { + if ((k == TQt::Key_Up && nobtn) || (k == TQt::Key_PageUp && e->state()==TQt::ControlButton)) { selectPrevRow(); e->accept(); } - else if ((k == Qt::Key_Down && nobtn) || (k == Qt::Key_PageDown && e->state()==Qt::ControlButton)) { + else if ((k == TQt::Key_Down && nobtn) || (k == TQt::Key_PageDown && e->state()==TQt::ControlButton)) { selectNextRow(); e->accept(); } - else if (k == Qt::Key_PageUp && nobtn) { + else if (k == TQt::Key_PageUp && nobtn) { selectPrevPage(); e->accept(); } - else if (k == Qt::Key_PageDown && nobtn) { + else if (k == TQt::Key_PageDown && nobtn) { selectNextPage(); e->accept(); } - else if (k == Qt::Key_Home) { + else if (k == TQt::Key_Home) { if (fullRowSelection) { //we're in row-selection mode: home key always moves to 1st row curRow = 0;//to 1st row @@ -1697,7 +1697,7 @@ bool KexiDataAwareObjectInterface::handleKeyPress(QKeyEvent *e, int &curRow, int if (nobtn) { curCol = 0;//to 1st col } - else if (e->state()==Qt::ControlButton) { + else if (e->state()==TQt::ControlButton) { curRow = 0;//to 1st row and col curCol = 0; } @@ -1709,7 +1709,7 @@ bool KexiDataAwareObjectInterface::handleKeyPress(QKeyEvent *e, int &curRow, int //do not accept yet e->ignore(); } - else if (k == Qt::Key_End) { + else if (k == TQt::Key_End) { if (fullRowSelection) { //we're in row-selection mode: home key always moves to last row curRow = m_data->count()-1+(isInsertingEnabled()?1:0);//to last row @@ -1718,7 +1718,7 @@ bool KexiDataAwareObjectInterface::handleKeyPress(QKeyEvent *e, int &curRow, int if (nobtn) { curCol = columns()-1;//to last col } - else if (e->state()==Qt::ControlButton) { + else if (e->state()==TQt::ControlButton) { curRow = m_data->count()-1 /*+(isInsertingEnabled()?1:0)*/; //to last row and col curCol = columns()-1;//to last col } @@ -1730,8 +1730,8 @@ bool KexiDataAwareObjectInterface::handleKeyPress(QKeyEvent *e, int &curRow, int //do not accept yet e->ignore(); } - else if (isInsertingEnabled() && (e->state()==Qt::ControlButton && k == Qt::Key_Equal - || e->state()==(Qt::ControlButton|Qt::ShiftButton) && k == Qt::Key_Equal)) { + else if (isInsertingEnabled() && (e->state()==TQt::ControlButton && k == TQt::Key_Equal + || e->state()==(TQt::ControlButton|TQt::ShiftButton) && k == TQt::Key_Equal)) { curRow = m_data->count(); //to the new row curCol = 0;//to first col if (moveToFirstField) @@ -1752,19 +1752,19 @@ void KexiDataAwareObjectInterface::vScrollBarValueChanged(int v) return; if (m_scrollbarToolTipsEnabled) { - const QRect r( verticalScrollBar()->sliderRect() ); + const TQRect r( verticalScrollBar()->sliderRect() ); const int row = lastVisibleRow()+1; if (row<=0) { m_scrollBarTipTimer.stop(); m_scrollBarTip->hide(); return; } - m_scrollBarTip->setText( i18n("Row: ") + QString::number(row) ); + m_scrollBarTip->setText( i18n("Row: ") + TQString::number(row) ); m_scrollBarTip->adjustSize(); - QWidget* thisWidget = dynamic_cast<QWidget*>(this); + TQWidget* thisWidget = dynamic_cast<TQWidget*>(this); m_scrollBarTip->move( thisWidget->mapToGlobal( r.topLeft() + verticalScrollBar()->pos() ) - + QPoint( - m_scrollBarTip->width()-5, + + TQPoint( - m_scrollBarTip->width()-5, r.height()/2 - m_scrollBarTip->height()/2) ); if (verticalScrollBar()->draggingSlider()) { kdDebug(44021) << " draggingSlider() " << endl; @@ -1783,7 +1783,7 @@ void KexiDataAwareObjectInterface::vScrollBarValueChanged(int v) } } //update bottom view region -/* if (m_navPanel && (contentsHeight() - contentsY() - clipper()->height()) <= QMAX(d->rowHeight,m_navPanel->height())) { +/* if (m_navPanel && (contentsHeight() - contentsY() - clipper()->height()) <= TQMAX(d->rowHeight,m_navPanel->height())) { slotUpdate(); triggerUpdate(); }*/ @@ -1819,7 +1819,7 @@ void KexiDataAwareObjectInterface::scrollBarTipTimeout() m_scrollBarTipTimerCnt=0; } -void KexiDataAwareObjectInterface::focusOutEvent(QFocusEvent* e) +void KexiDataAwareObjectInterface::focusOutEvent(TQFocusEvent* e) { Q_UNUSED(e); m_scrollBarTipTimer.stop(); @@ -1830,12 +1830,12 @@ void KexiDataAwareObjectInterface::focusOutEvent(QFocusEvent* e) int KexiDataAwareObjectInterface::showErrorMessageForResult(KexiDB::ResultInfo* resultInfo) { - QWidget *thisWidget = dynamic_cast<QWidget*>(this); + TQWidget *thisWidget = dynamic_cast<TQWidget*>(this); if (resultInfo->allowToDiscardChanges) { return KMessageBox::questionYesNo(thisWidget, resultInfo->msg - + (resultInfo->desc.isEmpty() ? QString::null : ("\n"+resultInfo->desc)), - QString::null, - KGuiItem(i18n("Correct Changes", "Correct"), QString::null, i18n("Correct changes")), + + (resultInfo->desc.isEmpty() ? TQString() : ("\n"+resultInfo->desc)), + TQString(), + KGuiItem(i18n("Correct Changes", "Correct"), TQString(), i18n("Correct changes")), KGuiItem(i18n("Discard Changes")) ); } @@ -1873,7 +1873,7 @@ void KexiDataAwareObjectInterface::updateIndicesForVisibleValues() means then the last character. \a firstCharacter == INT_MAX means "before first" place, so searching fails immediately. On success, true is returned and \a firstCharacter is set to position of the matched string. */ -static inline bool findInString(const QString& stringValue, int stringLength, const QString& where, +static inline bool findInString(const TQString& stringValue, int stringLength, const TQString& where, int& firstCharacter, bool matchAnyPartOfField, bool matchWholeField, bool caseSensitive, bool wholeWordsOnly, bool forward) { @@ -1888,7 +1888,7 @@ static inline bool findInString(const QString& stringValue, int stringLength, co if (wholeWordsOnly) { const int whereLength = where.length(); while (true) { - pos = where.find( stringValue, pos, caseSensitive ); + pos = where.tqfind( stringValue, pos, caseSensitive ); if (pos == -1) break; if ((pos > 0 && where.at(pos-1).isLetterOrNumber()) @@ -1902,7 +1902,7 @@ static inline bool findInString(const QString& stringValue, int stringLength, co firstCharacter = pos; } else {// !wholeWordsOnly - firstCharacter = where.find( stringValue, pos, caseSensitive ); + firstCharacter = where.tqfind( stringValue, pos, caseSensitive ); } return firstCharacter != -1; } @@ -1915,7 +1915,7 @@ static inline bool findInString(const QString& stringValue, int stringLength, co if (wholeWordsOnly) { const int whereLength = where.length(); while (true) { - pos = where.findRev( stringValue, pos, caseSensitive ); + pos = where.tqfindRev( stringValue, pos, caseSensitive ); if (pos == -1) break; if ((pos > 0 && where.at(pos-1).isLetterOrNumber()) @@ -1932,7 +1932,7 @@ static inline bool findInString(const QString& stringValue, int stringLength, co firstCharacter = pos; } else {// !wholeWordsOnly - firstCharacter = where.findRev( stringValue, pos, caseSensitive ); + firstCharacter = where.tqfindRev( stringValue, pos, caseSensitive ); } return firstCharacter != -1; } @@ -1950,7 +1950,7 @@ static inline bool findInString(const QString& stringValue, int stringLength, co if (firstCharacter != -1 && firstCharacter != 0) { //we're not at 0-th char firstCharacter = -1; } - else if (where.startsWith(stringValue, caseSensitive)) { + else if (where.tqstartsWith(stringValue, caseSensitive)) { if (wholeWordsOnly) { // If where.length() < stringValue.length(), true will be returned too - fine. return !where.at( stringValue.length() ).isLetterOrNumber(); @@ -1962,12 +1962,12 @@ static inline bool findInString(const QString& stringValue, int stringLength, co return false; } -tristate KexiDataAwareObjectInterface::find(const QVariant& valueToFind, +tristate KexiDataAwareObjectInterface::tqfind(const TQVariant& valueToFind, const KexiSearchAndReplaceViewInterface::Options& options, bool next) { if (!hasData()) return cancelled; - const QVariant prevSearchedValue( m_recentlySearchedValue ); + const TQVariant prevSearchedValue( m_recentlySearchedValue ); m_recentlySearchedValue = valueToFind; const KexiSearchAndReplaceViewInterface::Options::SearchDirection prevSearchDirection = m_recentSearchDirection; m_recentSearchDirection = options.searchDirection; @@ -2049,7 +2049,7 @@ tristate KexiDataAwareObjectInterface::find(const QVariant& valueToFind, firstColumn = columnNumber; lastColumn = columnNumber; } - const QString stringValue( caseSensitive ? valueToFind.toString() : valueToFind.toString().lower() ); + const TQString stringValue( caseSensitive ? valueToFind.toString() : valueToFind.toString().lower() ); const int stringLength = stringValue.length(); // search @@ -2059,7 +2059,7 @@ tristate KexiDataAwareObjectInterface::find(const QVariant& valueToFind, for (; forward ? col <= lastColumn : col >= lastColumn; col = forward ? (col+1) : (col-1)) { - const QVariant cell( item->at( m_indicesForVisibleValues[ col ] ) ); + const TQVariant cell( item->at( m_indicesForVisibleValues[ col ] ) ); if (findInString(stringValue, stringLength, cell.toString(), firstCharacter, matchAnyPartOfField, matchWholeField, caseSensitive, wholeWordsOnly, forward)) { @@ -2092,7 +2092,7 @@ tristate KexiDataAwareObjectInterface::find(const QVariant& valueToFind, } tristate KexiDataAwareObjectInterface::findNextAndReplace( - const QVariant& valueToFind, const QVariant& replacement, + const TQVariant& valueToFind, const TQVariant& replacement, const KexiSearchAndReplaceViewInterface::Options& options, bool replaceAll) { Q_UNUSED(replacement); diff --git a/kexi/widget/tableview/kexidataawareobjectiface.h b/kexi/widget/tableview/kexidataawareobjectiface.h index 4cf2aa6a..e6e9a357 100644 --- a/kexi/widget/tableview/kexidataawareobjectiface.h +++ b/kexi/widget/tableview/kexidataawareobjectiface.h @@ -26,16 +26,16 @@ #ifndef KEXIDATAAWAREOBJECTINTERFACE_H #define KEXIDATAAWAREOBJECTINTERFACE_H -#include <qguardedptr.h> +#include <tqguardedptr.h> -#include <qtimer.h> +#include <tqtimer.h> #include <kdebug.h> #include <widget/utils/kexiarrowtip.h> #include <kexisearchandreplaceiface.h> #include "kexitableviewdata.h" -class QObject; -class QScrollBar; +class TQObject; +class TQScrollBar; class KPopupMenu; class KexiTableItem; class KexiTableViewData; @@ -54,7 +54,7 @@ namespace KexiDB { //! \brief The KexiDataAwareObjectInterface is an interface for record-based data object. /** This interface is implemented by KexiTableView and KexiFormView and used by KexiDataAwareView. If yu're implementing this interface, - add KEXI_DATAAWAREOBJECTINTERFACE convenience macro just after Q_OBJECT. + add KEXI_DATAAWAREOBJECTINTERFACE convenience macro just after TQ_OBJECT. You should add following code to your destructor so data is deleted: \code @@ -267,14 +267,14 @@ class KEXIDATATABLE_EXPORT KexiDataAwareObjectInterface Does not clear columns information. Does not destroy KexiTableViewData object (if present) but only clears its contents. Displays confirmation dialog if \a ask is true (the default is false). - Repaints widget if \a repaint is true (the default). + Repaints widget if \a tqrepaint is true (the default). For empty tables, true is returned immediately. If isDeleteEnabled() is false, false is returned. For spreadsheet mode all current rows are just replaced by empty rows. \return true on success, false on failure, and cancelled if user cancelled deletion (only possible if \a ask is true). */ - tristate deleteAllRows(bool ask = false, bool repaint = true); + tristate deleteAllRows(bool ask = false, bool tqrepaint = true); /*! \return maximum number of rows that can be displayed per one "page" for current view's size. */ @@ -356,7 +356,7 @@ class KEXIDATATABLE_EXPORT KexiDataAwareObjectInterface virtual bool acceptEditor(); //! Creates editors and shows it, what usually means the beginning of a cell editing - virtual void createEditor(int row, int col, const QString& addText = QString::null, + virtual void createEditor(int row, int col, const TQString& addText = TQString(), bool removeOld = false) = 0; /*! Used when Return key is pressed on cell, the cell has been double clicked @@ -365,7 +365,7 @@ class KEXIDATATABLE_EXPORT KexiDataAwareObjectInterface was displayed (in this case, \a setText is usually not empty, what means that text will be set in the cell replacing previous value). */ - virtual void startEditCurrentCell(const QString& setText = QString::null); + virtual void startEditCurrentCell(const TQString& setText = TQString()); /*! Deletes currently selected cell's contents, if allowed. In most cases delete is not accepted immediately but "row editing" mode is just started. */ @@ -386,13 +386,13 @@ class KEXIDATATABLE_EXPORT KexiDataAwareObjectInterface bool hasDefaultValueAt(const KexiTableViewColumn& tvcol); - const QVariant* bufferedValueAt(int col, bool useDefaultValueIfPossible = true); + const TQVariant* bufferedValueAt(int col, bool useDefaultValueIfPossible = true); //! \return a type of column \a col - one of KexiDB::Field::Type int columnType(int col); //! \return default value for column \a col - QVariant columnDefaultValue(int col) const; + TQVariant columnDefaultValue(int col) const; /*! \return true is column \a col is editable. Default implementation takes information about 'readOnly' flag from data member. @@ -408,7 +408,7 @@ class KEXIDATATABLE_EXPORT KexiDataAwareObjectInterface //! signals virtual void itemChanged(KexiTableItem *, int row, int col) = 0; - virtual void itemChanged(KexiTableItem *, int row, int col, QVariant oldValue) = 0; + virtual void itemChanged(KexiTableItem *, int row, int col, TQVariant oldValue) = 0; virtual void itemDeleteRequest(KexiTableItem *, int row, int col) = 0; virtual void currentItemDeleteRequest() = 0; //! Emitted for spreadsheet mode when an item was deleted and a new item has been appended @@ -446,22 +446,22 @@ class KEXIDATATABLE_EXPORT KexiDataAwareObjectInterface we're starting to edit the cell and inverting it's state. */ virtual void boolToggled(); - virtual void connectCellSelectedSignal(const QObject* receiver, + virtual void connectCellSelectedSignal(const TQObject* receiver, const char* intIntMember) = 0; - virtual void connectRowEditStartedSignal(const QObject* receiver, + virtual void connectRowEditStartedSignal(const TQObject* receiver, const char* intMember) = 0; - virtual void connectRowEditTerminatedSignal(const QObject* receiver, + virtual void connectRowEditTerminatedSignal(const TQObject* receiver, const char* voidMember) = 0; - virtual void connectReloadActionsSignal(const QObject* receiver, + virtual void connectReloadActionsSignal(const TQObject* receiver, const char* voidMember) = 0; - virtual void connectDataSetSignal(const QObject* receiver, + virtual void connectDataSetSignal(const TQObject* receiver, const char* kexiTableViewDataMember) = 0; - virtual void connectToReloadDataSlot(const QObject* sender, + virtual void connectToReloadDataSlot(const TQObject* sender, const char* voidSignal) = 0; virtual void slotDataDestroying(); @@ -490,7 +490,7 @@ class KEXIDATATABLE_EXPORT KexiDataAwareObjectInterface \return true if value has been found, false if value has not been found, and cancelled if there is nothing to find or there is no data to search in. */ - virtual tristate find(const QVariant& valueToFind, + virtual tristate tqfind(const TQVariant& valueToFind, const KexiSearchAndReplaceViewInterface::Options& options, bool next); /*! Finds \a valueToFind within the data items and replaces with \a replacement @@ -499,12 +499,12 @@ class KEXIDATATABLE_EXPORT KexiDataAwareObjectInterface has not been found and replaced, and cancelled if there is nothing to find or there is no data to search in or the data is read only. If \a replaceAll is true, all found values are replaced. */ - virtual tristate findNextAndReplace(const QVariant& valueToFind, - const QVariant& replacement, + virtual tristate findNextAndReplace(const TQVariant& valueToFind, + const TQVariant& replacement, const KexiSearchAndReplaceViewInterface::Options& options, bool replaceAll); /*! \return vertical scrollbar */ - virtual QScrollBar* verticalScrollBar() const = 0; + virtual TQScrollBar* verticalScrollBar() const = 0; /*! Used in KexiTableView::keyPressEvent() (and in continuous forms). \return true when the key press event \e was consumed. @@ -523,7 +523,7 @@ class KEXIDATATABLE_EXPORT KexiDataAwareObjectInterface can be other than the very first field in the form. Used by KexiTableView::keyPressEvent() and KexiTableView::keyPressEvent(). */ - virtual bool handleKeyPress(QKeyEvent *e, int &curRow, int &curCol, bool fullRowSelection, + virtual bool handleKeyPress(TQKeyEvent *e, int &curRow, int &curCol, bool fullRowSelection, bool *moveToFirstField = 0, bool *moveToLastField = 0); protected: @@ -537,18 +537,18 @@ class KEXIDATATABLE_EXPORT KexiDataAwareObjectInterface virtual void initDataContents(); /*! Clears columns information and thus all internal table data - and its visible representation. Repaints widget if \a repaint is true. */ - virtual void clearColumns(bool repaint = true); + and its visible representation. Repaints widget if \a tqrepaint is true. */ + virtual void clearColumns(bool tqrepaint = true); /*! Called by clearColumns() to clear internals of the object. For example, KexiTableView removes contents of it's horizontal header. */ - virtual void clearColumnsInternal(bool repaint) = 0; + virtual void clearColumnsInternal(bool tqrepaint) = 0; /*! @internal for implementation This should append another section within horizontal header or any sort of caption for a field using provided names. \a width is a hint for new field's width. */ - virtual void addHeaderColumn(const QString& caption, const QString& description, - const QIconSet& icon, int size) = 0; + virtual void addHeaderColumn(const TQString& caption, const TQString& description, + const TQIconSet& icon, int size) = 0; /*! @internal for implementation \return sorting order (within GUI): -1: descending, 1: ascending, 0: no sorting. @@ -630,11 +630,11 @@ class KEXIDATATABLE_EXPORT KexiDataAwareObjectInterface /*! Updates contents of the widget. Just call update() here on your widget. */ virtual void updateWidgetContents() = 0; - /*! Updates widget's contents size e.g. using QScrollView::resizeContents(). */ + /*! Updates widget's contents size e.g. using TQScrollView::resizeContents(). */ virtual void updateWidgetContentsSize() = 0; /*! Updates scrollbars of the widget. - QScrollView::updateScrollbars() will be usually called here. */ + TQScrollView::updateScrollbars() will be usually called here. */ virtual void updateWidgetScrollBars() = 0; /*! @internal @@ -654,18 +654,18 @@ class KEXIDATATABLE_EXPORT KexiDataAwareObjectInterface //! Handles KexiTableViewData::aboutToDeleteRow() signal. Prepares info for slotRowDeleted(). virtual void slotAboutToDeleteRow(KexiTableItem& item, KexiDB::ResultInfo* result, - bool repaint); + bool tqrepaint); - //! Handles KexiTableViewData::rowDeleted() signal to repaint when needed. + //! Handles KexiTableViewData::rowDeleted() signal to tqrepaint when needed. virtual void slotRowDeleted(); - //! Handles KexiTableViewData::rowInserted() signal to repaint when needed. - virtual void slotRowInserted(KexiTableItem *item, bool repaint); + //! Handles KexiTableViewData::rowInserted() signal to tqrepaint when needed. + virtual void slotRowInserted(KexiTableItem *item, bool tqrepaint); //! Like above, not db-aware version - virtual void slotRowInserted(KexiTableItem *item, uint row, bool repaint); + virtual void slotRowInserted(KexiTableItem *item, uint row, bool tqrepaint); - virtual void slotRowsDeleted( const QValueList<int> & ) {} + virtual void slotRowsDeleted( const TQValueList<int> & ) {} //! for sanity checks (return true if m_data is present; else: outputs warning) inline bool hasData() const; @@ -675,12 +675,12 @@ class KEXIDATATABLE_EXPORT KexiDataAwareObjectInterface virtual void selectCellInternal() {} /*! Used in KexiDataAwareObjectInterface::slotRowDeleted() - to repaint tow \a row and all visible below. + to tqrepaint tow \a row and all visible below. Implemented if there is more than one row displayed, i.e. currently for KexiTableView. */ virtual void updateAllVisibleRowsBelow(int row) { Q_UNUSED( row ); } //! Call this from the subclass. */ - virtual void focusOutEvent(QFocusEvent* e); + virtual void focusOutEvent(TQFocusEvent* e); /*! Handles verticalScrollBar()'s valueChanged(int) signal. Called when vscrollbar's value has been changed. @@ -705,7 +705,7 @@ class KEXIDATATABLE_EXPORT KexiDataAwareObjectInterface This is per-interface global cache. Needed for faster lookup because there could be lookup values. Called whenever columns definition changes, i.e. in setData() and clearColumns(). - @see find() */ + @see tqfind() */ void updateIndicesForVisibleValues(); //! data structure displayed for this object @@ -833,7 +833,7 @@ class KEXIDATATABLE_EXPORT KexiDataAwareObjectInterface int m_rowWillBeDeleted; /*! Displays passive error popup label used when invalid data has been entered. */ - QGuardedPtr<KexiArrowTip> m_errorMessagePopup; + TQGuardedPtr<KexiArrowTip> m_errorMessagePopup; /*! Used to enable/disable execution of vScrollBarValueChanged() when users navigate through rows using keyboard, so vscrollbar tooltips are not visible. */ @@ -842,8 +842,8 @@ class KEXIDATATABLE_EXPORT KexiDataAwareObjectInterface /*! True, if vscrollbar tooltips are enabled (true by default). */ bool m_scrollbarToolTipsEnabled : 1; - QLabel* m_scrollBarTip; //!< scrollbar tooltip - QTimer m_scrollBarTipTimer; //!< scrollbar tooltip's timer + TQLabel* m_scrollBarTip; //!< scrollbar tooltip + TQTimer m_scrollBarTipTimer; //!< scrollbar tooltip's timer uint m_scrollBarTipTimerCnt; //!< helper for timeout counting (scrollbar tooltip) //! Used to mark recently found value @@ -856,19 +856,19 @@ class KEXIDATATABLE_EXPORT KexiDataAwareObjectInterface bool exists : 1; }; - /*! Used to mark recently found value. Updated on succesful execution of find(). + /*! Used to mark recently found value. Updated on succesful execution of tqfind(). If the current cursor's position changes, or data in the current cell changes, positionOfRecentlyFoundValue.exists is set to false. */ PositionOfValue m_positionOfRecentlyFoundValue; /*! Used to compare whether we're looking for new value. */ - QVariant m_recentlySearchedValue; + TQVariant m_recentlySearchedValue; /*! Used to compare whether the search direction has changed. */ KexiSearchAndReplaceViewInterface::Options::SearchDirection m_recentSearchDirection; - //! Setup by updateIndicesForVisibleValues() and used by find() - QValueVector<uint> m_indicesForVisibleValues; + //! Setup by updateIndicesForVisibleValues() and used by tqfind() + TQValueVector<uint> m_indicesForVisibleValues; }; inline bool KexiDataAwareObjectInterface::hasData() const @@ -895,24 +895,24 @@ inline KexiTableItem *KexiDataAwareObjectInterface::itemAt(int row) const //! Convenience macro used for KexiDataAwareObjectInterface implementations. #define KEXI_DATAAWAREOBJECTINTERFACE \ public: \ - void connectCellSelectedSignal(const QObject* receiver, const char* intIntMember) { \ - connect(this, SIGNAL(cellSelected(int,int)), receiver, intIntMember); \ + void connectCellSelectedSignal(const TQObject* receiver, const char* intIntMember) { \ + connect(this, TQT_SIGNAL(cellSelected(int,int)), receiver, intIntMember); \ } \ - void connectRowEditStartedSignal(const QObject* receiver, const char* intMember) { \ - connect(this, SIGNAL(rowEditStarted(int)), receiver, intMember); \ + void connectRowEditStartedSignal(const TQObject* receiver, const char* intMember) { \ + connect(this, TQT_SIGNAL(rowEditStarted(int)), receiver, intMember); \ } \ - void connectRowEditTerminatedSignal(const QObject* receiver, const char* voidMember) { \ - connect(this, SIGNAL(rowEditTerminated(int)), receiver, voidMember); \ + void connectRowEditTerminatedSignal(const TQObject* receiver, const char* voidMember) { \ + connect(this, TQT_SIGNAL(rowEditTerminated(int)), receiver, voidMember); \ } \ - void connectReloadActionsSignal(const QObject* receiver, const char* voidMember) { \ - connect(this, SIGNAL(reloadActions()), receiver, voidMember); \ + void connectReloadActionsSignal(const TQObject* receiver, const char* voidMember) { \ + connect(this, TQT_SIGNAL(reloadActions()), receiver, voidMember); \ } \ - void connectDataSetSignal(const QObject* receiver, \ + void connectDataSetSignal(const TQObject* receiver, \ const char* kexiTableViewDataMember) { \ - connect(this, SIGNAL(dataSet(KexiTableViewData*)), receiver, kexiTableViewDataMember); \ + connect(this, TQT_SIGNAL(dataSet(KexiTableViewData*)), receiver, kexiTableViewDataMember); \ } \ - void connectToReloadDataSlot(const QObject* sender, const char* voidSignal) { \ - connect(sender, voidSignal, this, SLOT(reloadData())); \ + void connectToReloadDataSlot(const TQObject* sender, const char* voidSignal) { \ + connect(sender, voidSignal, this, TQT_SLOT(reloadData())); \ } #endif diff --git a/kexi/widget/tableview/kexidataawarepropertyset.cpp b/kexi/widget/tableview/kexidataawarepropertyset.cpp index 92fda11e..7d49ec52 100644 --- a/kexi/widget/tableview/kexidataawarepropertyset.cpp +++ b/kexi/widget/tableview/kexidataawarepropertyset.cpp @@ -28,19 +28,19 @@ KexiDataAwarePropertySet::KexiDataAwarePropertySet(KexiViewBase *view, KexiDataAwareObjectInterface* dataObject) - : QObject( view, QCString(view->name())+"KexiDataAwarePropertySet" ) + : TQObject( view, TQCString(view->name())+"KexiDataAwarePropertySet" ) , m_view(view) , m_dataObject(dataObject) , m_row(-99) { m_sets.setAutoDelete(true); -// connect(m_dataObject, SIGNAL(dataSet(KexiTableViewData*)), -// this, SLOT(slotDataSet(KexiTableViewData*))); - m_dataObject->connectDataSetSignal(this, SLOT(slotDataSet(KexiTableViewData*))); -// connect(m_dataObject, SIGNAL(cellSelected(int,int)), -// this, SLOT(slotCellSelected(int,int))); - m_dataObject->connectCellSelectedSignal(this, SLOT(slotCellSelected(int,int))); +// connect(m_dataObject, TQT_SIGNAL(dataSet(KexiTableViewData*)), +// this, TQT_SLOT(slotDataSet(KexiTableViewData*))); + m_dataObject->connectDataSetSignal(this, TQT_SLOT(slotDataSet(KexiTableViewData*))); +// connect(m_dataObject, TQT_SIGNAL(cellSelected(int,int)), +// this, TQT_SLOT(slotCellSelected(int,int))); + m_dataObject->connectCellSelectedSignal(this, TQT_SLOT(slotCellSelected(int,int))); // slotDataSet( m_dataObject->data() ); const bool wasDirty = view->dirty(); @@ -61,13 +61,13 @@ void KexiDataAwarePropertySet::slotDataSet( KexiTableViewData *data ) } m_currentTVData = data; if (!m_currentTVData.isNull()) { - connect(m_currentTVData, SIGNAL(rowDeleted()), this, SLOT(slotRowDeleted())); - connect(m_currentTVData, SIGNAL(rowsDeleted( const QValueList<int> & )), - this, SLOT(slotRowsDeleted( const QValueList<int> & ))); - connect(m_currentTVData, SIGNAL(rowInserted(KexiTableItem*,uint,bool)), - this, SLOT(slotRowInserted(KexiTableItem*,uint,bool))); - connect(m_currentTVData, SIGNAL(reloadRequested()), - this, SLOT(slotReloadRequested())); + connect(m_currentTVData, TQT_SIGNAL(rowDeleted()), this, TQT_SLOT(slotRowDeleted())); + connect(m_currentTVData, TQT_SIGNAL(rowsDeleted( const TQValueList<int> & )), + this, TQT_SLOT(slotRowsDeleted( const TQValueList<int> & ))); + connect(m_currentTVData, TQT_SIGNAL(rowInserted(KexiTableItem*,uint,bool)), + this, TQT_SLOT(slotRowInserted(KexiTableItem*,uint,bool))); + connect(m_currentTVData, TQT_SIGNAL(reloadRequested()), + this, TQT_SLOT(slotReloadRequested())); } } @@ -92,10 +92,10 @@ uint KexiDataAwarePropertySet::size() const return m_sets.size(); } -void KexiDataAwarePropertySet::clear(uint minimumSize) +void KexiDataAwarePropertySet::clear(uint tqminimumSize) { m_sets.clear(); - m_sets.resize(QMAX(minimumSize, MAX_FIELDS)); + m_sets.resize(TQMAX(tqminimumSize, MAX_FIELDS)); m_view->setDirty(true); m_view->propertySetSwitched(); } @@ -111,14 +111,14 @@ void KexiDataAwarePropertySet::insert(uint row, KoProperty::Set* set, bool newOn kexiwarn << "KexiDataAwarePropertySet::insert() invalid args: rew="<< row<< " propertyset="<< set<< endl; return; } - if (set->parent() && set->parent()!=this) { - kexiwarn << "KexiDataAwarePropertySet::insert() propertyset's parent must be NULL or this KexiDataAwarePropertySet" << endl; + if (set->tqparent() && set->tqparent()!=this) { + kexiwarn << "KexiDataAwarePropertySet::insert() propertyset's tqparent must be NULL or this KexiDataAwarePropertySet" << endl; return; } m_sets.insert(row, set); - connect(set, SIGNAL(propertyChanged(KoProperty::Set&, KoProperty::Property&)), m_view, SLOT(setDirty())); + connect(set, TQT_SIGNAL(propertyChanged(KoProperty::Set&, KoProperty::Property&)), m_view, TQT_SLOT(setDirty())); if (newOne) { //add a special property indicating that this is brand new set, @@ -159,14 +159,14 @@ void KexiDataAwarePropertySet::slotRowDeleted() emit rowDeleted(); } -void KexiDataAwarePropertySet::slotRowsDeleted( const QValueList<int> &rows ) +void KexiDataAwarePropertySet::slotRowsDeleted( const TQValueList<int> &rows ) { //let's move most property sets up & delete unwanted m_sets.setAutoDelete(false);//to avoid auto deleting in insert() const int orig_size = size(); int prev_r = -1; int num_removed = 0, cur_r = -1; - for (QValueList<int>::ConstIterator r_it = rows.constBegin(); r_it!=rows.constEnd() && *r_it < orig_size; ++r_it) { + for (TQValueList<int>::ConstIterator r_it = rows.constBegin(); r_it!=rows.constEnd() && *r_it < orig_size; ++r_it) { cur_r = *r_it;// - num_removed; if (prev_r>=0) { // kdDebug() << "move " << prev_r+num_removed-1 << ".." << cur_r-1 << " to " << prev_r+num_removed-1 << ".." << cur_r-2 << endl; @@ -206,7 +206,7 @@ void KexiDataAwarePropertySet::slotRowsDeleted( const QValueList<int> &rows ) } //void KexiDataAwarePropertySet::slotEmptyRowInserted(KexiTableItem*, uint /*index*/) -void KexiDataAwarePropertySet::slotRowInserted(KexiTableItem*, uint row, bool /*repaint*/) +void KexiDataAwarePropertySet::slotRowInserted(KexiTableItem*, uint row, bool /*tqrepaint*/) { m_view->setDirty(); @@ -238,18 +238,18 @@ KoProperty::Set* KexiDataAwarePropertySet::findPropertySetForItem(KexiTableItem& { if (m_currentTVData.isNull()) return 0; - int idx = m_currentTVData->findRef(&item); + int idx = m_currentTVData->tqfindRef(&item); if (idx<0) return 0; return m_sets[idx]; } -int KexiDataAwarePropertySet::findRowForPropertyValue(const QCString& propertyName, const QVariant& value) +int KexiDataAwarePropertySet::findRowForPropertyValue(const TQCString& propertyName, const TQVariant& value) { const int size = m_sets.size(); for (int i=0; i<size; i++) { KoProperty::Set *set = m_sets[i]; - if (!set || !set->contains(propertyName)) + if (!set || !set->tqcontains(propertyName)) continue; if (set->property(propertyName).value() == value) return i; diff --git a/kexi/widget/tableview/kexidataawarepropertyset.h b/kexi/widget/tableview/kexidataawarepropertyset.h index cee55da0..8d6212c4 100644 --- a/kexi/widget/tableview/kexidataawarepropertyset.h +++ b/kexi/widget/tableview/kexidataawarepropertyset.h @@ -20,11 +20,11 @@ #ifndef KEXIDATAAWAREPROPERTYSET_H #define KEXIDATAAWAREPROPERTYSET_H -#include <qguardedptr.h> -#include <qptrvector.h> +#include <tqguardedptr.h> +#include <tqptrvector.h> #include <koproperty/set.h> -typedef QPtrVector<KoProperty::Set> SetVector; +typedef TQPtrVector<KoProperty::Set> SetVector; class KexiViewBase; class KexiTableItem; @@ -50,9 +50,10 @@ class KexiDataAwareObjectInterface; - signalling via KexiViewBase::propertySetSwitched() that current property set has changed (e.g. on moving to other row) */ -class KEXIDATATABLE_EXPORT KexiDataAwarePropertySet : public QObject +class KEXIDATATABLE_EXPORT KexiDataAwarePropertySet : public TQObject { Q_OBJECT + TQ_OBJECT public: /*! You can instantiate KexiDataAwarePropertySet object @@ -80,7 +81,7 @@ class KEXIDATATABLE_EXPORT KexiDataAwarePropertySet : public QObject /*! \return number of the first row containing \a propertyName property equal to \a value. This is used e.g. in the Table Designer to find a row by field name. If no such row has been found, -1 is returned. */ - int findRowForPropertyValue(const QCString& propertyName, const QVariant& value); + int findRowForPropertyValue(const TQCString& propertyName, const TQVariant& value); signals: /*! Emmited when row is deleted. @@ -96,7 +97,7 @@ class KEXIDATATABLE_EXPORT KexiDataAwarePropertySet : public QObject public slots: void removeCurrentPropertySet(); - void clear(uint minimumSize = 0); + void clear(uint tqminimumSize = 0); /*! Inserts \a set property set at \a row position. If there was a buffer at this position before, it will be destroyed. @@ -106,7 +107,7 @@ class KEXIDATATABLE_EXPORT KexiDataAwarePropertySet : public QObject The property set \a set will be owned by this object, so you should not delete this property set by hand but call removeCurrentPropertySet() or remove(uint) instead. - Note that property set's parent (QObject::parent()) must be null + Note that property set's tqparent (TQObject::tqparent()) must be null or qual to this KexiDataAwarePropertySet object, otherwise this method will fail with a warning. */ @@ -123,10 +124,10 @@ class KEXIDATATABLE_EXPORT KexiDataAwarePropertySet : public QObject void slotRowDeleted(); //! Called on multiple rows delete in a tableview. - void slotRowsDeleted( const QValueList<int> &rows ); + void slotRowsDeleted( const TQValueList<int> &rows ); //! Called on \a row insertion in a tableview. - void slotRowInserted(KexiTableItem* item, uint row, bool repaint); + void slotRowInserted(KexiTableItem* item, uint row, bool tqrepaint); //! Called on selecting another cell in a tableview. void slotCellSelected(int, int row); @@ -137,10 +138,10 @@ class KEXIDATATABLE_EXPORT KexiDataAwarePropertySet : public QObject protected: SetVector m_sets; //!< prop. sets vector - QGuardedPtr<KexiViewBase> m_view; + TQGuardedPtr<KexiViewBase> m_view; KexiDataAwareObjectInterface* m_dataObject; -// QGuardedPtr<KexiTableView> m_tableView; - QGuardedPtr<KexiTableViewData> m_currentTVData; +// TQGuardedPtr<KexiTableView> m_tableView; + TQGuardedPtr<KexiTableViewData> m_currentTVData; int m_row; //!< used to know if a new row is selected in slotCellSelected() }; diff --git a/kexi/widget/tableview/kexidatatableview.cpp b/kexi/widget/tableview/kexidatatableview.cpp index 9248e890..7d7dbde6 100644 --- a/kexi/widget/tableview/kexidatatableview.cpp +++ b/kexi/widget/tableview/kexidatatableview.cpp @@ -19,8 +19,8 @@ * Boston, MA 02110-1301, USA. */ -#include <qtimer.h> -#include <qapplication.h> +#include <tqtimer.h> +#include <tqapplication.h> #include <kmessagebox.h> #include <klocale.h> @@ -33,14 +33,14 @@ #include "kexidatatableview.h" -KexiDataTableView::KexiDataTableView(QWidget *parent, const char *name) - : KexiTableView(0, parent, name) +KexiDataTableView::KexiDataTableView(TQWidget *tqparent, const char *name) + : KexiTableView(0, tqparent, name) { init(); } -KexiDataTableView::KexiDataTableView(QWidget *parent, const char *name, KexiDB::Cursor *cursor) - : KexiTableView(0, parent, name) +KexiDataTableView::KexiDataTableView(TQWidget *tqparent, const char *name, KexiDB::Cursor *cursor) + : KexiTableView(0, tqparent, name) { init(); setData(cursor); @@ -59,14 +59,14 @@ KexiDataTableView::init() // m_records = 0; // m_first = false; -// connect(this, SIGNAL(contentsMoving(int, int)), this, SLOT(slotMoving(int))); -// connect(verticalScrollBar(), SIGNAL(sliderMoved(int)), this, SLOT(slotMoving(int))); +// connect(this, TQT_SIGNAL(contentsMoving(int, int)), this, TQT_SLOT(slotMoving(int))); +// connect(verticalScrollBar(), TQT_SIGNAL(sliderMoved(int)), this, TQT_SLOT(slotMoving(int))); } /*void KexiDataTableView::initActions(KActionCollection *col) { KexiTableView::initActions(col); - new KAction(i18n("Filter"), "filter", 0, this, SLOT(filter()), col, "tablepart_filter"); + new KAction(i18n("Filter"), "filter", 0, this, TQT_SLOT(filter()), col, "tablepart_filter"); }*/ bool KexiDataTableView::setData(KexiDB::Cursor *cursor) @@ -105,7 +105,7 @@ bool KexiDataTableView::setData(KexiDB::Cursor *cursor) KexiTableViewData *tv_data = new KexiTableViewData(m_cursor); - QString caption = m_cursor->query()->caption(); + TQString caption = m_cursor->query()->caption(); if (caption.isEmpty()) caption = m_cursor->query()->name(); diff --git a/kexi/widget/tableview/kexidatatableview.h b/kexi/widget/tableview/kexidatatableview.h index 6f421894..7835289f 100644 --- a/kexi/widget/tableview/kexidatatableview.h +++ b/kexi/widget/tableview/kexidatatableview.h @@ -25,7 +25,7 @@ #include "kexitableview.h" class KexiTableItem; -class QVariant; +class TQVariant; class KXMLGUIClient; namespace KexiDB { @@ -38,12 +38,13 @@ namespace KexiDB { class KEXIDATATABLE_EXPORT KexiDataTableView : public KexiTableView { Q_OBJECT + TQ_OBJECT public: /** * creates a blank widget */ - KexiDataTableView(QWidget *parent, const char *name =0); + KexiDataTableView(TQWidget *tqparent, const char *name =0); /*! Creates a table widget and fills it using data from \a cursor. Cursor will be opened (with open()) if it is not yet opened. @@ -51,7 +52,7 @@ class KEXIDATATABLE_EXPORT KexiDataTableView : public KexiTableView and Connection::executeQuery()), otherwise the table view remain not filled with data. Cursor \a cursor will not be owned by this object. */ - KexiDataTableView(QWidget *parent, const char *name, KexiDB::Cursor *cursor); + KexiDataTableView(TQWidget *tqparent, const char *name, KexiDB::Cursor *cursor); ~KexiDataTableView(); @@ -88,7 +89,7 @@ class KEXIDATATABLE_EXPORT KexiDataTableView : public KexiTableView //db stuff KexiDB::Cursor *m_cursor; -// QMap<KexiDBUpdateRecord*,KexiTableItem*> m_insertMapping; +// TQMap<KexiDBUpdateRecord*,KexiTableItem*> m_insertMapping; }; #endif diff --git a/kexi/widget/tableview/kexidatetableedit.cpp b/kexi/widget/tableview/kexidatetableedit.cpp index 8a1fbcae..af71ae4c 100644 --- a/kexi/widget/tableview/kexidatetableedit.cpp +++ b/kexi/widget/tableview/kexidatetableedit.cpp @@ -21,20 +21,20 @@ #include "kexidatetableedit.h" -#include <qapplication.h> -#include <qpainter.h> -#include <qvariant.h> -#include <qrect.h> -#include <qpalette.h> -#include <qcolor.h> -#include <qfontmetrics.h> -#include <qdatetime.h> -#include <qcursor.h> -#include <qpoint.h> -#include <qlayout.h> -#include <qtoolbutton.h> -#include <qdatetimeedit.h> -#include <qclipboard.h> +#include <tqapplication.h> +#include <tqpainter.h> +#include <tqvariant.h> +#include <tqrect.h> +#include <tqpalette.h> +#include <tqcolor.h> +#include <tqfontmetrics.h> +#include <tqdatetime.h> +#include <tqcursor.h> +#include <tqpoint.h> +#include <tqlayout.h> +#include <tqtoolbutton.h> +#include <tqdatetimeedit.h> +#include <tqclipboard.h> #include <kdebug.h> #include <klocale.h> @@ -48,12 +48,12 @@ #include <kexiutils/utils.h> -KexiDateTableEdit::KexiDateTableEdit(KexiTableViewColumn &column, QWidget *parent) - : KexiInputTableEdit(column, parent) +KexiDateTableEdit::KexiDateTableEdit(KexiTableViewColumn &column, TQWidget *tqparent) + : KexiInputTableEdit(column, tqparent) { setName("KexiDateTableEdit"); -//! @todo add QValidator so date like "2006-59-67" cannot be even entered +//! @todo add TQValidator so date like "2006-59-67" cannot be even entered m_lineedit->setInputMask( m_formatter.inputMask() ); } @@ -62,20 +62,20 @@ KexiDateTableEdit::~KexiDateTableEdit() { } -void KexiDateTableEdit::setValueInInternalEditor(const QVariant &value) +void KexiDateTableEdit::setValueInInternalEditor(const TQVariant &value) { if (value.isValid() && value.toDate().isValid()) m_lineedit->setText( m_formatter.dateToString( value.toDate() ) ); else - m_lineedit->setText( QString::null ); + m_lineedit->setText( TQString() ); } -void KexiDateTableEdit::setValueInternal(const QVariant& add_, bool removeOld) +void KexiDateTableEdit::setValueInternal(const TQVariant& add_, bool removeOld) { if (removeOld) { //new date entering... just fill the line edit //! @todo cut string if too long.. - QString add(add_.toString()); + TQString add(add_.toString()); m_lineedit->setText(add); m_lineedit->setCursorPosition(add.length()); return; @@ -84,15 +84,15 @@ void KexiDateTableEdit::setValueInternal(const QVariant& add_, bool removeOld) m_lineedit->setCursorPosition(0); //ok? } -void KexiDateTableEdit::setupContents( QPainter *p, bool focused, const QVariant& val, - QString &txt, int &align, int &x, int &y_offset, int &w, int &h ) +void KexiDateTableEdit::setupContents( TQPainter *p, bool focused, const TQVariant& val, + TQString &txt, int &align, int &x, int &y_offset, int &w, int &h ) { Q_UNUSED(p); Q_UNUSED(focused); Q_UNUSED(x); Q_UNUSED(w); Q_UNUSED(h); -#ifdef Q_WS_WIN +#ifdef TQ_WS_WIN y_offset = -1; #else y_offset = 0; @@ -105,7 +105,7 @@ void KexiDateTableEdit::setupContents( QPainter *p, bool focused, const QVariant bool KexiDateTableEdit::valueIsNull() { -// if (m_lineedit->text().replace(m_formatter.separator(),"").stripWhiteSpace().isEmpty()) +// if (m_lineedit->text().tqreplace(m_formatter.separator(),"").stripWhiteSpace().isEmpty()) if (m_formatter.isEmpty(m_lineedit->text())) //empty date is null return true; return dateValue().isNull(); @@ -116,12 +116,12 @@ bool KexiDateTableEdit::valueIsEmpty() return valueIsNull();//js OK? TODO (nonsense?) } -QDate KexiDateTableEdit::dateValue() const +TQDate KexiDateTableEdit::dateValue() const { return m_formatter.stringToDate( m_lineedit->text() ); } -QVariant KexiDateTableEdit::value() +TQVariant KexiDateTableEdit::value() { return m_formatter.stringToVariant( m_lineedit->text() ); } @@ -133,21 +133,21 @@ bool KexiDateTableEdit::valueIsValid() return m_formatter.stringToDate( m_lineedit->text() ).isValid(); } -void KexiDateTableEdit::handleCopyAction(const QVariant& value, const QVariant& visibleValue) +void KexiDateTableEdit::handleCopyAction(const TQVariant& value, const TQVariant& visibleValue) { Q_UNUSED(visibleValue); if (!value.isNull() && value.toDate().isValid()) - qApp->clipboard()->setText( m_formatter.dateToString(value.toDate()) ); + tqApp->clipboard()->setText( m_formatter.dateToString(value.toDate()) ); else - qApp->clipboard()->setText( QString::null ); + tqApp->clipboard()->setText( TQString() ); } -void KexiDateTableEdit::handleAction(const QString& actionName) +void KexiDateTableEdit::handleAction(const TQString& actionName) { const bool alreadyVisible = m_lineedit->isVisible(); if (actionName=="edit_paste") { - const QVariant newValue( m_formatter.stringToDate(qApp->clipboard()->text()) ); + const TQVariant newValue( m_formatter.stringToDate(tqApp->clipboard()->text()) ); if (!alreadyVisible) { //paste as the entire text if the cell was not in edit mode emit editRequested(); m_lineedit->clear(); @@ -160,16 +160,16 @@ void KexiDateTableEdit::handleAction(const QString& actionName) /* void -KexiDateTableEdit::slotDateChanged(QDate date) +KexiDateTableEdit::slotDateChanged(TQDate date) { m_edit->setDate(date); - repaint(); + tqrepaint(); } void KexiDateTableEdit::slotShowDatePicker() { - QDate date = m_edit->date(); + TQDate date = m_edit->date(); m_datePicker->setDate(date); m_datePicker->setFocus(); @@ -182,30 +182,30 @@ void KexiDateTableEdit::moveToFirstSection() { if (!m_dte_date_obj) return; -#ifdef QDateTimeEditor_HACK +#ifdef TQDateTimeEditor_HACK if (m_dte_date) m_dte_date->setFocusSection(0); #else -#ifdef Q_WS_WIN //tmp - QKeyEvent ke_left(QEvent::KeyPress, Qt::Key_Left, 0, 0); +#ifdef TQ_WS_WIN //tmp + TQKeyEvent ke_left(TQEvent::KeyPress, TQt::Key_Left, 0, 0); for (int i=0; i<8; i++) - QApplication::sendEvent( m_dte_date_obj, &ke_left ); + TQApplication::sendEvent( m_dte_date_obj, &ke_left ); #endif #endif } -bool KexiDateTableEdit::eventFilter( QObject *o, QEvent *e ) +bool KexiDateTableEdit::eventFilter( TQObject *o, TQEvent *e ) { if (o==m_datePicker) { kdDebug() << e->type() << endl; switch (e->type()) { - case QEvent::Hide: + case TQEvent::Hide: m_datePickerPopupMenu->hide(); break; - case QEvent::KeyPress: - case QEvent::KeyRelease: { + case TQEvent::KeyPress: + case TQEvent::KeyRelease: { kdDebug() << "ok!" << endl; - QKeyEvent *ke = (QKeyEvent *)e; + TQKeyEvent *ke = (TQKeyEvent *)e; if (ke->key()==Key_Enter || ke->key()==Key_Return) { //accepting picker acceptDate(); @@ -224,27 +224,27 @@ bool KexiDateTableEdit::eventFilter( QObject *o, QEvent *e ) break; } } -#ifdef Q_WS_WIN //tmp - else if (e->type()==QEvent::FocusIn && o->parent() && o->parent()->parent()==m_edit +#ifdef TQ_WS_WIN //tmp + else if (e->type()==TQEvent::FocusIn && o->tqparent() && o->tqparent()->tqparent()==m_edit && m_setNumberOnFocus >= 0 && m_dte_date_obj) { // there was a number character passed as 'add' parameter in init(): moveToFirstSection(); - QKeyEvent ke(QEvent::KeyPress, int(Qt::Key_0)+m_setNumberOnFocus, - '0'+m_setNumberOnFocus, 0, QString::number(m_setNumberOnFocus)); - QApplication::sendEvent( m_dte_date_obj, &ke ); + TQKeyEvent ke(TQEvent::KeyPress, int(TQt::Key_0)+m_setNumberOnFocus, + '0'+m_setNumberOnFocus, 0, TQString::number(m_setNumberOnFocus)); + TQApplication::sendEvent( m_dte_date_obj, &ke ); m_setNumberOnFocus = -1; } #endif -#ifdef QDateTimeEditor_HACK - else if (e->type()==QEvent::KeyPress && m_dte_date) { - QKeyEvent *ke = static_cast<QKeyEvent*>(e); - if ((ke->key()==Qt::Key_Right && !m_sentEvent && cursorAtEnd()) - || (ke->key()==Qt::Key_Left && !m_sentEvent && cursorAtStart())) +#ifdef TQDateTimeEditor_HACK + else if (e->type()==TQEvent::KeyPress && m_dte_date) { + TQKeyEvent *ke = static_cast<TQKeyEvent*>(e); + if ((ke->key()==TQt::Key_Right && !m_sentEvent && cursorAtEnd()) + || (ke->key()==TQt::Key_Left && !m_sentEvent && cursorAtStart())) { //the editor should send this key event: m_sentEvent = true; //avoid recursion - QApplication::sendEvent( this, ke ); + TQApplication::sendEvent( this, ke ); m_sentEvent = false; ke->ignore(); return true; @@ -263,7 +263,7 @@ void KexiDateTableEdit::acceptDate() bool KexiDateTableEdit::cursorAtStart() { -#ifdef QDateTimeEditor_HACK +#ifdef TQDateTimeEditor_HACK return m_dte_date && m_edit->hasFocus() && m_dte_date->focusSection()==0; #else return false; @@ -272,7 +272,7 @@ bool KexiDateTableEdit::cursorAtStart() bool KexiDateTableEdit::cursorAtEnd() { -#ifdef QDateTimeEditor_HACK +#ifdef TQDateTimeEditor_HACK return m_dte_date && m_edit->hasFocus() && m_dte_date->focusSection()==int(m_dte_date->sectionCount()-1); #else @@ -282,7 +282,7 @@ bool KexiDateTableEdit::cursorAtEnd() void KexiDateTableEdit::clear() { - m_edit->setDate(QDate()); + m_edit->setDate(TQDate()); }*/ KEXI_CELLEDITOR_FACTORY_ITEM_IMPL(KexiDateEditorFactoryItem, KexiDateTableEdit) diff --git a/kexi/widget/tableview/kexidatetableedit.h b/kexi/widget/tableview/kexidatetableedit.h index 4f2a4f59..aad46c4b 100644 --- a/kexi/widget/tableview/kexidatetableedit.h +++ b/kexi/widget/tableview/kexidatetableedit.h @@ -26,7 +26,7 @@ #include <widget/utils/kexidatetimeformatter.h> /*! @short Editor class for Date type. - It is a replacement QDateEdit due to usability problems: + It is a replacement TQDateEdit due to usability problems: people are accustomed to use single-character cursor. Date format is retrieved from the KDE global settings. and input/output is performed using KLineEdit (from KexiInputTableEdit). @@ -34,28 +34,29 @@ class KexiDateTableEdit : public KexiInputTableEdit { Q_OBJECT + TQ_OBJECT public: - KexiDateTableEdit(KexiTableViewColumn &column, QWidget *parent=0); + KexiDateTableEdit(KexiTableViewColumn &column, TQWidget *tqparent=0); virtual ~KexiDateTableEdit(); - virtual void setupContents( QPainter *p, bool focused, const QVariant& val, - QString &txt, int &align, int &x, int &y_offset, int &w, int &h ); - virtual QVariant value(); + virtual void setupContents( TQPainter *p, bool focused, const TQVariant& val, + TQString &txt, int &align, int &x, int &y_offset, int &w, int &h ); + virtual TQVariant value(); virtual bool valueIsNull(); virtual bool valueIsEmpty(); virtual bool valueIsValid(); /*! Reimplemented after KexiInputTableEdit. */ - virtual void handleAction(const QString& actionName); + virtual void handleAction(const TQString& actionName); /*! Reimplemented after KexiInputTableEdit. */ - virtual void handleCopyAction(const QVariant& value, const QVariant& visibleValue); + virtual void handleCopyAction(const TQVariant& value, const TQVariant& visibleValue); protected: //! helper - void setValueInInternalEditor(const QVariant &value); - virtual void setValueInternal(const QVariant& add, bool removeOld); - QDate dateValue() const; + void setValueInInternalEditor(const TQVariant &value); + virtual void setValueInternal(const TQVariant& add, bool removeOld); + TQDate dateValue() const; //! Used to format and convert date values KexiDateFormatter m_formatter; diff --git a/kexi/widget/tableview/kexidatetimetableedit.cpp b/kexi/widget/tableview/kexidatetimetableedit.cpp index fbca7cd6..46f687f0 100644 --- a/kexi/widget/tableview/kexidatetimetableedit.cpp +++ b/kexi/widget/tableview/kexidatetimetableedit.cpp @@ -21,20 +21,20 @@ #include "kexidatetimetableedit.h" -#include <qapplication.h> -#include <qpainter.h> -#include <qvariant.h> -#include <qrect.h> -#include <qpalette.h> -#include <qcolor.h> -#include <qfontmetrics.h> -#include <qdatetime.h> -#include <qcursor.h> -#include <qpoint.h> -#include <qlayout.h> -#include <qtoolbutton.h> -#include <qdatetimeedit.h> -#include <qclipboard.h> +#include <tqapplication.h> +#include <tqpainter.h> +#include <tqvariant.h> +#include <tqrect.h> +#include <tqpalette.h> +#include <tqcolor.h> +#include <tqfontmetrics.h> +#include <tqdatetime.h> +#include <tqcursor.h> +#include <tqpoint.h> +#include <tqlayout.h> +#include <tqtoolbutton.h> +#include <tqdatetimeedit.h> +#include <tqclipboard.h> #include <kdebug.h> #include <klocale.h> @@ -47,12 +47,12 @@ #include <kexiutils/utils.h> -KexiDateTimeTableEdit::KexiDateTimeTableEdit(KexiTableViewColumn &column, QWidget *parent) - : KexiInputTableEdit(column, parent) +KexiDateTimeTableEdit::KexiDateTimeTableEdit(KexiTableViewColumn &column, TQWidget *tqparent) + : KexiInputTableEdit(column, tqparent) { setName("KexiDateTimeTableEdit"); -//! @todo add QValidator so time like "99:88:77" cannot be even entered +//! @todo add TQValidator so time like "99:88:77" cannot be even entered m_lineedit->setInputMask( dateTimeInputMask( m_dateFormatter, m_timeFormatter ) ); @@ -62,22 +62,22 @@ KexiDateTimeTableEdit::~KexiDateTimeTableEdit() { } -void KexiDateTimeTableEdit::setValueInInternalEditor(const QVariant &value) +void KexiDateTimeTableEdit::setValueInInternalEditor(const TQVariant &value) { if (value.isValid() && value.toDateTime().isValid()) m_lineedit->setText( m_dateFormatter.dateToString( value.toDateTime().date() ) + " " + m_timeFormatter.timeToString( value.toDateTime().time() ) ); else - m_lineedit->setText( QString::null ); + m_lineedit->setText( TQString() ); } -void KexiDateTimeTableEdit::setValueInternal(const QVariant& add_, bool removeOld) +void KexiDateTimeTableEdit::setValueInternal(const TQVariant& add_, bool removeOld) { if (removeOld) { //new time entering... just fill the line edit //! @todo cut string if too long.. - QString add(add_.toString()); + TQString add(add_.toString()); m_lineedit->setText(add); m_lineedit->setCursorPosition(add.length()); return; @@ -86,15 +86,15 @@ void KexiDateTimeTableEdit::setValueInternal(const QVariant& add_, bool removeOl m_lineedit->setCursorPosition(0); //ok? } -void KexiDateTimeTableEdit::setupContents( QPainter *p, bool focused, const QVariant& val, - QString &txt, int &align, int &x, int &y_offset, int &w, int &h ) +void KexiDateTimeTableEdit::setupContents( TQPainter *p, bool focused, const TQVariant& val, + TQString &txt, int &align, int &x, int &y_offset, int &w, int &h ) { Q_UNUSED(p); Q_UNUSED(focused); Q_UNUSED(x); Q_UNUSED(w); Q_UNUSED(h); -#ifdef Q_WS_WIN +#ifdef TQ_WS_WIN y_offset = -1; #else y_offset = 0; @@ -117,10 +117,10 @@ bool KexiDateTimeTableEdit::valueIsEmpty() return valueIsNull();//js OK? TODO (nonsense?) } -QVariant KexiDateTimeTableEdit::value() +TQVariant KexiDateTimeTableEdit::value() { if (textIsEmpty()) - return QVariant(); + return TQVariant(); return stringToDateTime(m_dateFormatter, m_timeFormatter, m_lineedit->text()); } @@ -134,22 +134,22 @@ bool KexiDateTimeTableEdit::textIsEmpty() const return dateTimeIsEmpty( m_dateFormatter, m_timeFormatter, m_lineedit->text() ); } -void KexiDateTimeTableEdit::handleCopyAction(const QVariant& value, const QVariant& visibleValue) +void KexiDateTimeTableEdit::handleCopyAction(const TQVariant& value, const TQVariant& visibleValue) { Q_UNUSED(visibleValue); if (!value.isNull() && value.toDateTime().isValid()) - qApp->clipboard()->setText( m_dateFormatter.dateToString(value.toDateTime().date()) + " " + tqApp->clipboard()->setText( m_dateFormatter.dateToString(value.toDateTime().date()) + " " + m_timeFormatter.timeToString(value.toDateTime().time()) ); else - qApp->clipboard()->setText( QString::null ); + tqApp->clipboard()->setText( TQString() ); } -void KexiDateTimeTableEdit::handleAction(const QString& actionName) +void KexiDateTimeTableEdit::handleAction(const TQString& actionName) { const bool alreadyVisible = m_lineedit->isVisible(); if (actionName=="edit_paste") { - const QVariant newValue( stringToDateTime(m_dateFormatter, m_timeFormatter, qApp->clipboard()->text()) ); + const TQVariant newValue( stringToDateTime(m_dateFormatter, m_timeFormatter, tqApp->clipboard()->text()) ); if (!alreadyVisible) { //paste as the entire text if the cell was not in edit mode emit editRequested(); m_lineedit->clear(); diff --git a/kexi/widget/tableview/kexidatetimetableedit.h b/kexi/widget/tableview/kexidatetimetableedit.h index c2f9eba8..6fb88a67 100644 --- a/kexi/widget/tableview/kexidatetimetableedit.h +++ b/kexi/widget/tableview/kexidatetimetableedit.h @@ -26,7 +26,7 @@ #include "kexitimetableedit.h" /*! @short Editor class for Date/Time type. - It is a replacement QDateTimeEdit due to usability problems: + It is a replacement TQDateTimeEdit due to usability problems: people are accustomed to use single-character cursor. Date and Time format is retrieved from the KDE global settings and input/output is performed using KLineEdit (from KexiInputTableEdit). @@ -34,27 +34,28 @@ class KexiDateTimeTableEdit : public KexiInputTableEdit { Q_OBJECT + TQ_OBJECT public: - KexiDateTimeTableEdit(KexiTableViewColumn &column, QWidget *parent=0); + KexiDateTimeTableEdit(KexiTableViewColumn &column, TQWidget *tqparent=0); virtual ~KexiDateTimeTableEdit(); - virtual void setupContents( QPainter *p, bool focused, const QVariant& val, - QString &txt, int &align, int &x, int &y_offset, int &w, int &h ); - virtual QVariant value(); + virtual void setupContents( TQPainter *p, bool focused, const TQVariant& val, + TQString &txt, int &align, int &x, int &y_offset, int &w, int &h ); + virtual TQVariant value(); virtual bool valueIsNull(); virtual bool valueIsEmpty(); virtual bool valueIsValid(); /*! Reimplemented after KexiInputTableEdit. */ - virtual void handleAction(const QString& actionName); + virtual void handleAction(const TQString& actionName); /*! Reimplemented after KexiInputTableEdit. */ - virtual void handleCopyAction(const QVariant& value, const QVariant& visibleValue); + virtual void handleCopyAction(const TQVariant& value, const TQVariant& visibleValue); protected: //! helper - void setValueInInternalEditor(const QVariant &value); - virtual void setValueInternal(const QVariant& add, bool removeOld); + void setValueInInternalEditor(const TQVariant &value); + virtual void setValueInternal(const TQVariant& add, bool removeOld); bool textIsEmpty() const; //! Used to format and convert date values diff --git a/kexi/widget/tableview/kexiinputtableedit.cpp b/kexi/widget/tableview/kexiinputtableedit.cpp index 9af5c627..26a3ed7f 100644 --- a/kexi/widget/tableview/kexiinputtableedit.cpp +++ b/kexi/widget/tableview/kexiinputtableedit.cpp @@ -20,14 +20,14 @@ #include "kexiinputtableedit.h" -#include <qregexp.h> -#include <qevent.h> -#include <qlayout.h> -#include <qtimer.h> -#include <qpainter.h> -#include <qapplication.h> -#include <qclipboard.h> -#include <qtooltip.h> +#include <tqregexp.h> +#include <tqevent.h> +#include <tqlayout.h> +#include <tqtimer.h> +#include <tqpainter.h> +#include <tqapplication.h> +#include <tqclipboard.h> +#include <tqtooltip.h> #include <kglobal.h> #include <klocale.h> @@ -43,12 +43,12 @@ class MyLineEdit : public KLineEdit { public: - MyLineEdit(QWidget *parent, const char *name) : KLineEdit(parent,name) + MyLineEdit(TQWidget *tqparent, const char *name) : KLineEdit(tqparent,name) {} protected: - virtual void drawFrame ( QPainter * p ) { - p->setPen( QPen( colorGroup().text() ) ); - QRect r = rect(); + virtual void drawFrame ( TQPainter * p ) { + p->setPen( TQPen( tqcolorGroup().text() ) ); + TQRect r = rect(); p->moveTo( r.topLeft() ); p->lineTo( r.topRight() ); p->lineTo( r.bottomRight() ); @@ -60,8 +60,8 @@ class MyLineEdit : public KLineEdit //====================================================== -KexiInputTableEdit::KexiInputTableEdit(KexiTableViewColumn &column, QWidget *parent) - : KexiTableEdit(column, parent) +KexiInputTableEdit::KexiInputTableEdit(KexiTableViewColumn &column, TQWidget *tqparent) + : KexiTableEdit(column, tqparent) { setName("KexiInputTableEdit"); // m_type = f.type(); //copied because the rest of code uses m_type @@ -91,7 +91,7 @@ void KexiInputTableEdit::init() if (!align_right) { //create layer for internal editor - QHBoxLayout *lyr = new QHBoxLayout(this); + TQHBoxLayout *lyr = new TQHBoxLayout(this); lyr->addSpacing(4); lyr->setAutoAdd(true); } @@ -100,29 +100,29 @@ void KexiInputTableEdit::init() m_lineedit = new MyLineEdit(this, "KexiInputTableEdit-KLineEdit"); setViewWidget(m_lineedit); if (align_right) - m_lineedit->setAlignment(AlignRight); + m_lineedit->tqsetAlignment(AlignRight); // m_cview->setFrame(false); -// m_cview->setFrameStyle( QFrame::Plain | QFrame::Box ); +// m_cview->setFrameStyle( TQFrame::Plain | TQFrame::Box ); // m_cview->setLineWidth( 1 ); m_calculatedCell = false; #if 0 //js TODO - connect(m_cview->completionBox(), SIGNAL(activated(const QString &)), - this, SLOT(completed(const QString &))); - connect(m_cview->completionBox(), SIGNAL(highlighted(const QString &)), - this, SLOT(completed(const QString &))); + connect(m_cview->completionBox(), TQT_SIGNAL(activated(const TQString &)), + this, TQT_SLOT(completed(const TQString &))); + connect(m_cview->completionBox(), TQT_SIGNAL(highlighted(const TQString &)), + this, TQT_SLOT(completed(const TQString &))); m_cview->completionBox()->setTabHandling(true); #endif } -void KexiInputTableEdit::setValueInternal(const QVariant& add, bool removeOld) +void KexiInputTableEdit::setValueInternal(const TQVariant& add, bool removeOld) { - QString text( m_textFormatter.valueToText(removeOld ? QVariant() : m_origValue, add.toString()) ); + TQString text( m_textFormatter.valueToText(removeOld ? TQVariant() : m_origValue, add.toString()) ); if (text.isEmpty()) { if (m_origValue.toString().isEmpty()) { //we have to set NULL initial value: - m_lineedit->setText(QString::null); + m_lineedit->setText(TQString()); } } else { @@ -138,7 +138,7 @@ void KexiInputTableEdit::setValueInternal(const QVariant& add, bool removeOld) #endif if (!m_lineedit->validator()) { - QValidator *validator = new KexiDB::FieldValidator( + TQValidator *validator = new KexiDB::FieldValidator( *field(), m_lineedit, "KexiInputTableEdit-validator"); m_lineedit->setValidator( validator ); } @@ -146,28 +146,28 @@ void KexiInputTableEdit::setValueInternal(const QVariant& add, bool removeOld) #if 0 //moved to KexiTextFormatter -QString KexiInputTableEdit::valueToText(KexiDB::Field* field, const QVariant& value, const QString& add) +TQString KexiInputTableEdit::valueToText(KexiDB::Field* field, const TQVariant& value, const TQString& add) { - QString text; //result + TQString text; //result if (field->isFPNumericType()) { //! @todo precision! //! @todo support 'g' format - text = QString::number(value.toDouble(), 'f', - QMAX(field->visibleDecimalPlaces(), 10)); //<-- 10 is quite good maximum for fractional digits + text = TQString::number(value.toDouble(), 'f', + TQMAX(field->visibleDecimalPlaces(), 10)); //<-- 10 is quite good maximum for fractional digits //! @todo add command line settings? if (value.toDouble() == 0.0) { text = add.isEmpty() ? "0" : add; //eat 0 } else { //! @todo (js): get decimal places settings here... - QStringList sl = QStringList::split(".", text); + TQStringList sl = TQStringList::split(".", text); if (text.isEmpty()) { //nothing } else if (sl.count()==2) { // kdDebug() << "sl.count()=="<<sl.count()<< " " <<sl[0] << " | " << sl[1] << endl; - const QString sl1 = sl[1]; + const TQString sl1 = sl[1]; int pos = sl1.length()-1; if (pos>=1) { for (;pos>=0 && sl1[pos]=='0';pos--) @@ -183,7 +183,7 @@ QString KexiInputTableEdit::valueToText(KexiDB::Field* field, const QVariant& va } /*moved to KexiDB::FieldValidator if (setValidator && !m_lineedit->validator()) { - QValidator *validator = new KDoubleValidator(m_lineedit); + TQValidator *validator = new KDoubleValidator(m_lineedit); m_lineedit->setValidator( validator ); }*/ } @@ -199,7 +199,7 @@ QString KexiInputTableEdit::valueToText(KexiDB::Field* field, const QVariant& va /*moved to KexiDB::FieldValidator //! @todo implement ranges here! if (setValidator && !m_lineedit->validator()) { - QValidator *validator; + TQValidator *validator; if (KexiDB::Field::BigInteger == field()->type()) { //! @todo use field->isUnsigned() for KexiUtils::ULongLongValidator validator = new KexiUtils::LongLongValidator(m_lineedit); @@ -219,10 +219,10 @@ QString KexiInputTableEdit::valueToText(KexiDB::Field* field, const QVariant& va } #endif -void KexiInputTableEdit::paintEvent ( QPaintEvent * /*e*/ ) +void KexiInputTableEdit::paintEvent ( TQPaintEvent * /*e*/ ) { - QPainter p(this); - p.setPen( QPen( colorGroup().text() ) ); + TQPainter p(this); + p.setPen( TQPen( tqcolorGroup().text() ) ); p.drawRect( rect() ); } @@ -239,8 +239,8 @@ kdDebug() << "KexiInputTableEdit::setRestrictedCompletion()" << endl; m_cview->useGlobalKeyBindings(); - QStringList newC; - QStringList::ConstIterator it, end( m_comp.constEnd() ); + TQStringList newC; + TQStringList::ConstIterator it, end( m_comp.constEnd() ); for( it = m_comp.constBegin(); it != end; ++it) { if((*it).startsWith(m_cview->text())) @@ -251,7 +251,7 @@ kdDebug() << "KexiInputTableEdit::setRestrictedCompletion()" << endl; } void -KexiInputTableEdit::completed(const QString &s) +KexiInputTableEdit::completed(const TQString &s) { // kdDebug() << "KexiInputTableEdit::completed(): " << s << endl; m_lineedit->setText(s); @@ -274,39 +274,39 @@ bool KexiInputTableEdit::valueIsEmpty() return !m_lineedit->text().isNull() && m_lineedit->text().isEmpty(); } -QVariant KexiInputTableEdit::value() +TQVariant KexiInputTableEdit::value() { if (field()->isFPNumericType()) {//==KexiDB::Field::Double || m_type==KexiDB::Field::Float) { //! js @todo PRESERVE PRECISION! - QString txt = m_lineedit->text(); + TQString txt = m_lineedit->text(); if (m_decsym!=".") - txt = txt.replace(m_decsym,".");//convert back + txt = txt.tqreplace(m_decsym,".");//convert back bool ok; const double result = txt.toDouble(&ok); - return ok ? QVariant(result) : QVariant(); + return ok ? TQVariant(result) : TQVariant(); } else if (field()->isIntegerType()) { //! @todo check constraints bool ok; if (KexiDB::Field::BigInteger == field()->type()) { if (field()->isUnsigned()) { - const Q_ULLONG result = m_lineedit->text().toULongLong(&ok); - return ok ? QVariant(result) : QVariant(); + const TQ_ULLONG result = m_lineedit->text().toULongLong(&ok); + return ok ? TQVariant(result) : TQVariant(); } else { - const Q_LLONG result = m_lineedit->text().toLongLong(&ok); - return ok ? QVariant(result) : QVariant(); + const TQ_LLONG result = m_lineedit->text().toLongLong(&ok); + return ok ? TQVariant(result) : TQVariant(); } } if (KexiDB::Field::Integer == field()->type()) { if (field()->isUnsigned()) { const uint result = m_lineedit->text().toUInt(&ok); - return ok ? QVariant(result) : QVariant(); + return ok ? TQVariant(result) : TQVariant(); } } //default: signed int const int result = m_lineedit->text().toInt(&ok); - return ok ? QVariant(result) : QVariant(); + return ok ? TQVariant(result) : TQVariant(); } //default: text return m_lineedit->text(); @@ -328,21 +328,21 @@ bool KexiInputTableEdit::cursorAtEnd() return m_lineedit->cursorPosition()==(int)m_lineedit->text().length(); } -QSize KexiInputTableEdit::totalSize() +TQSize KexiInputTableEdit::totalSize() { if (!m_lineedit) return size(); return m_lineedit->size(); } -void KexiInputTableEdit::handleCopyAction(const QVariant& value, const QVariant& visibleValue) +void KexiInputTableEdit::handleCopyAction(const TQVariant& value, const TQVariant& visibleValue) { Q_UNUSED(visibleValue); //! @todo handle rich text? - qApp->clipboard()->setText( m_textFormatter.valueToText(value, QString::null) ); + tqApp->clipboard()->setText( m_textFormatter.valueToText(value, TQString()) ); } -void KexiInputTableEdit::handleAction(const QString& actionName) +void KexiInputTableEdit::handleAction(const TQString& actionName) { const bool alreadyVisible = m_lineedit->isVisible(); @@ -363,12 +363,12 @@ void KexiInputTableEdit::handleAction(const QString& actionName) } } -bool KexiInputTableEdit::showToolTipIfNeeded(const QVariant& value, const QRect& rect, - const QFontMetrics& fm, bool focused) +bool KexiInputTableEdit::showToolTipIfNeeded(const TQVariant& value, const TQRect& rect, + const TQFontMetrics& fm, bool focused) { - QString text( value.type()==QVariant::String ? value.toString() - : m_textFormatter.valueToText(value, QString::null) ); - QRect internalRect(rect); + TQString text( value.type()==TQVariant::String ? value.toString() + : m_textFormatter.valueToText(value, TQString()) ); + TQRect internalRect(rect); internalRect.setLeft(rect.x()+leftMargin()); internalRect.setWidth(internalRect.width()-rightMargin(focused)-2*3); kexidbg << rect << " " << internalRect << " " << fm.width(text) << endl; diff --git a/kexi/widget/tableview/kexiinputtableedit.h b/kexi/widget/tableview/kexiinputtableedit.h index df770287..3b4cf015 100644 --- a/kexi/widget/tableview/kexiinputtableedit.h +++ b/kexi/widget/tableview/kexiinputtableedit.h @@ -22,7 +22,7 @@ #define KEXIINPUTTABLEEDIT_H #include <klineedit.h> -#include <qvariant.h> +#include <tqvariant.h> #include "kexitableedit.h" #include "kexicelleditorfactory.h" @@ -33,9 +33,10 @@ class KEXIDATATABLE_EXPORT KexiInputTableEdit : public KexiTableEdit { Q_OBJECT + TQ_OBJECT public: - KexiInputTableEdit(KexiTableViewColumn &column, QWidget *parent=0); + KexiInputTableEdit(KexiTableViewColumn &column, TQWidget *tqparent=0); virtual ~KexiInputTableEdit(); @@ -44,7 +45,7 @@ class KEXIDATATABLE_EXPORT KexiInputTableEdit : public KexiTableEdit /*! \return text for \a value and \a field. \a add is a text that should be added to the value if possible. Used in setValueInternal(), by form widgets and for reporting/printing. */ - static QString valueToText(KexiDB::Field* field, const QVariant& value, const QString& add); + static TQString valueToText(KexiDB::Field* field, const TQVariant& value, const TQString& add); #endif virtual bool valueChanged(); @@ -57,36 +58,36 @@ class KEXIDATATABLE_EXPORT KexiInputTableEdit : public KexiTableEdit //! (check this with KexiDB::Field::hasEmptyProperty()), virtual bool valueIsEmpty(); - virtual QVariant value(); + virtual TQVariant value(); virtual bool cursorAtStart(); virtual bool cursorAtEnd(); -// virtual bool eventFilter(QObject* watched, QEvent* e); +// virtual bool eventFilter(TQObject* watched, TQEvent* e); //js void end(bool mark); //js void backspace(); virtual void clear(); /*! \return total size of this editor, including any buttons, etc. (if present). */ - virtual QSize totalSize(); + virtual TQSize totalSize(); /*! Handles action having standard name \a actionName. Action could be: "edit_cut", "edit_paste", etc. */ - virtual void handleAction(const QString& actionName); + virtual void handleAction(const TQString& actionName); /*! Handles copy action for value. The \a value is copied to clipboard in format appropriate for the editor's impementation, e.g. for image cell it can be a pixmap. \a visibleValue is unused here. Reimplemented after KexiTableEdit. */ - virtual void handleCopyAction(const QVariant& value, const QVariant& visibleValue); + virtual void handleCopyAction(const TQVariant& value, const TQVariant& visibleValue); /*! Shows a special tooltip for \a value if needed, i.e. if the value could not fit inside \a rect for a given font metrics \a fm. - \return true a normal tooltip should be displayed (using QToolTip,) and false if + \return true a normal tooltip should be displayed (using TQToolTip,) and false if no tooltip should be displayed or a custom tooltip was displayed internally (not yet supported). This implementation converts the value to text using valueToText() if \a calue is not string to see whether it can fit inside the cell's \a rect. If the cell is currentl focused (selected), \a focused is true. */ - virtual bool showToolTipIfNeeded(const QVariant& value, const QRect& rect, const QFontMetrics& fm, + virtual bool showToolTipIfNeeded(const TQVariant& value, const TQRect& rect, const TQFontMetrics& fm, bool focused); public slots: @@ -101,20 +102,20 @@ class KEXIDATATABLE_EXPORT KexiInputTableEdit : public KexiTableEdit protected slots: void setRestrictedCompletion(); - void completed(const QString &); + void completed(const TQString &); protected: //! initializes this editor with \a add value - virtual void setValueInternal(const QVariant& add, bool removeOld); + virtual void setValueInternal(const TQVariant& add, bool removeOld); void showHintButton(); void init(); - virtual void paintEvent( QPaintEvent *e ); + virtual void paintEvent( TQPaintEvent *e ); KexiTextFormatter m_textFormatter; bool m_calculatedCell; - QString m_decsym; //! decimal symbol - QString m_origText; //! orig. Line Edit's text after conversion - for easy comparing + TQString m_decsym; //! decimal symbol + TQString m_origText; //! orig. Line Edit's text after conversion - for easy comparing KLineEdit *m_lineedit; signals: diff --git a/kexi/widget/tableview/kexitableedit.cpp b/kexi/widget/tableview/kexitableedit.cpp index 8c3f5612..6a9008f1 100644 --- a/kexi/widget/tableview/kexitableedit.cpp +++ b/kexi/widget/tableview/kexitableedit.cpp @@ -23,44 +23,44 @@ #include <kexidb/field.h> #include <kexidb/utils.h> -#include <qpalette.h> -#include <qpainter.h> +#include <tqpalette.h> +#include <tqpainter.h> #include <kglobal.h> #include <klocale.h> #include <kdebug.h> -KexiTableEdit::KexiTableEdit(KexiTableViewColumn &column, QWidget* parent) -: QWidget(dynamic_cast<QScrollView*>(parent) ? dynamic_cast<QScrollView*>(parent)->viewport() : parent) +KexiTableEdit::KexiTableEdit(KexiTableViewColumn &column, TQWidget* tqparent) +: TQWidget(dynamic_cast<TQScrollView*>(tqparent) ? dynamic_cast<TQScrollView*>(tqparent)->viewport() : tqparent) ,m_column(&column) // ,m_field(&f) // ,m_type(f.type()) //copied because the rest of code uses m_type - ,m_scrollView(dynamic_cast<QScrollView*>(parent)) + ,m_scrollView(dynamic_cast<TQScrollView*>(tqparent)) ,m_usesSelectedTextColor(true) ,m_view(0) // ,m_hasFocusableWidget(true) // ,m_acceptEditorAfterDeleteContents(false) { - setPaletteBackgroundColor( palette().color(QPalette::Active, QColorGroup::Base) ); + setPaletteBackgroundColor( palette().color(TQPalette::Active, TQColorGroup::Base) ); installEventFilter(this); //margins if (displayedField()->isFPNumericType()) { -#ifdef Q_WS_WIN +#ifdef TQ_WS_WIN m_leftMargin = 0; #else m_leftMargin = 0; #endif } else if (displayedField()->isIntegerType()) { -#ifdef Q_WS_WIN +#ifdef TQ_WS_WIN m_leftMargin = 1; #else m_leftMargin = 0; #endif } else {//default -#ifdef Q_WS_WIN +#ifdef TQ_WS_WIN m_leftMargin = 5; #else m_leftMargin = 5; @@ -83,7 +83,7 @@ KexiDB::Field *KexiTableEdit::displayedField() const return m_column->field(); //typical case } -void KexiTableEdit::setViewWidget(QWidget *v) +void KexiTableEdit::setViewWidget(TQWidget *v) { m_view = v; m_view->move(0,0); @@ -91,7 +91,7 @@ void KexiTableEdit::setViewWidget(QWidget *v) setFocusProxy(m_view); } -void KexiTableEdit::moveChild( QWidget * child, int x, int y ) +void KexiTableEdit::moveChild( TQWidget * child, int x, int y ) { if (m_scrollView) m_scrollView->moveChild(child, x, y); @@ -99,9 +99,9 @@ void KexiTableEdit::moveChild( QWidget * child, int x, int y ) void KexiTableEdit::resize(int w, int h) { - QWidget::resize(w, h); + TQWidget::resize(w, h); if (m_view) { - if (!layout()) { //if there is layout (eg. KexiInputTableEdit), resize is automatic + if (!tqlayout()) { //if there is tqlayout (eg. KexiInputTableEdit), resize is automatic m_view->move(0,0); m_view->resize(w, h); } @@ -109,22 +109,22 @@ void KexiTableEdit::resize(int w, int h) } bool -KexiTableEdit::eventFilter(QObject* watched, QEvent* e) +KexiTableEdit::eventFilter(TQObject* watched, TQEvent* e) { /* if (watched == m_view) { - if(e->type() == QEvent::KeyPress) { - QKeyEvent* ev = static_cast<QKeyEvent*>(e); + if(e->type() == TQEvent::KeyPress) { + TQKeyEvent* ev = static_cast<TQKeyEvent*>(e); // if (ev->key()==Key_Tab) { // } } }*/ - if(watched == this) + if(TQT_BASE_OBJECT(watched) == TQT_BASE_OBJECT(this)) { - if(e->type() == QEvent::KeyPress) + if(e->type() == TQEvent::KeyPress) { - QKeyEvent* ev = static_cast<QKeyEvent*>(e); + TQKeyEvent* ev = TQT_TQKEYEVENT(e); if(ev->key() == Key_Escape) { @@ -137,23 +137,23 @@ KexiTableEdit::eventFilter(QObject* watched, QEvent* e) } } return false; -// return QWidget::eventFilter(watched, e); +// return TQWidget::eventFilter(watched, e); } -void KexiTableEdit::paintFocusBorders( QPainter *p, QVariant &, int x, int y, int w, int h ) +void KexiTableEdit::paintFocusBorders( TQPainter *p, TQVariant &, int x, int y, int w, int h ) { p->drawRect(x, y, w, h); } -void KexiTableEdit::setupContents( QPainter *p, bool focused, const QVariant& val, - QString &txt, int &align, int &/*x*/, int &y_offset, int &w, int &h ) +void KexiTableEdit::setupContents( TQPainter *p, bool focused, const TQVariant& val, + TQString &txt, int &align, int &/*x*/, int &y_offset, int &w, int &h ) { Q_UNUSED(p); Q_UNUSED(focused); Q_UNUSED(h); KexiDB::Field *realField = displayedField(); -#ifdef Q_WS_WIN +#ifdef TQ_WS_WIN // x = 1; y_offset = -1; #else @@ -171,11 +171,11 @@ void KexiTableEdit::setupContents( QPainter *p, bool focused, const QVariant& va align |= AlignRight; } else if (realField->isIntegerType()) { - Q_LLONG num = val.toLongLong(); + TQ_LLONG num = val.toLongLong(); w -= 6; align |= AlignRight; if (!val.isNull()) - txt = QString::number(num); + txt = TQString::number(num); } else {//default: if (!val.isNull()) { @@ -185,18 +185,18 @@ void KexiTableEdit::setupContents( QPainter *p, bool focused, const QVariant& va } } -void KexiTableEdit::paintSelectionBackground( QPainter *p, bool /*focused*/, - const QString& txt, int align, int x, int y_offset, int w, int h, const QColor& fillColor, - const QFontMetrics &fm, bool readOnly, bool fullRowSelection ) +void KexiTableEdit::paintSelectionBackground( TQPainter *p, bool /*focused*/, + const TQString& txt, int align, int x, int y_offset, int w, int h, const TQColor& fillColor, + const TQFontMetrics &fm, bool readOnly, bool fullRowSelection ) { if (!readOnly && !fullRowSelection && !txt.isEmpty()) { - QRect bound=fm.boundingRect(x, y_offset, w - (x+x), h, align, txt); + TQRect bound=fm.boundingRect(x, y_offset, w - (x+x), h, align, txt); bound.setY(0); - bound.setWidth( QMIN( bound.width()+2, w - (x+x)+1 ) ); - if (align & Qt::AlignLeft) { + bound.setWidth( TQMIN( bound.width()+2, w - (x+x)+1 ) ); + if (align & TQt::AlignLeft) { bound.setX(bound.x()-1); } - else if (align & Qt::AlignRight) { + else if (align & TQt::AlignRight) { bound.moveLeft( w - bound.width() ); //move to left, if too wide } //TODO align center @@ -208,18 +208,18 @@ void KexiTableEdit::paintSelectionBackground( QPainter *p, bool /*focused*/, } } -int KexiTableEdit::widthForValue( QVariant &val, const QFontMetrics &fm ) +int KexiTableEdit::widthForValue( TQVariant &val, const TQFontMetrics &fm ) { return fm.width( val.toString() ); } -void KexiTableEdit::repaintRelatedCell() +void KexiTableEdit::tqrepaintRelatedCell() { if (dynamic_cast<KexiDataAwareObjectInterface*>(m_scrollView)) dynamic_cast<KexiDataAwareObjectInterface*>(m_scrollView)->updateCurrentCell(); } -bool KexiTableEdit::showToolTipIfNeeded(const QVariant& value, const QRect& rect, const QFontMetrics& fm, +bool KexiTableEdit::showToolTipIfNeeded(const TQVariant& value, const TQRect& rect, const TQFontMetrics& fm, bool focused) { Q_UNUSED(value); diff --git a/kexi/widget/tableview/kexitableedit.h b/kexi/widget/tableview/kexitableedit.h index ef38a11f..d8ac7c86 100644 --- a/kexi/widget/tableview/kexitableedit.h +++ b/kexi/widget/tableview/kexitableedit.h @@ -23,8 +23,8 @@ #include <kexidataiteminterface.h> -#include <qvariant.h> -#include <qscrollview.h> +#include <tqvariant.h> +#include <tqscrollview.h> #include "kexitableviewdata.h" @@ -36,12 +36,13 @@ namespace KexiDB { /*! @short Abstract class for a cell editor. Handles cell painting and displaying the editor widget. */ -class KEXIDATATABLE_EXPORT KexiTableEdit : public QWidget, public KexiDataItemInterface +class KEXIDATATABLE_EXPORT KexiTableEdit : public TQWidget, public KexiDataItemInterface { Q_OBJECT + TQ_OBJECT public: - KexiTableEdit(KexiTableViewColumn &column, QWidget* parent = 0); + KexiTableEdit(KexiTableViewColumn &column, TQWidget* tqparent = 0); virtual ~KexiTableEdit(); @@ -72,7 +73,7 @@ class KEXIDATATABLE_EXPORT KexiTableEdit : public QWidget, public KexiDataItemIn virtual void resize(int w, int h); /*! \return the view widget of this editor, e.g. line edit widget. */ - virtual QWidget* widget() { return m_view; } + virtual TQWidget* widget() { return m_view; } /*! Hides item's widget, if available. */ inline virtual void hideWidget() { hide(); } @@ -83,11 +84,11 @@ class KEXIDATATABLE_EXPORT KexiTableEdit : public QWidget, public KexiDataItemIn /*! Paints a border for the cell described by \a x, \a y, \a w, \a h on \a p painter. The cell's value is \a val (may be useful if you want to reimplement this method). */ - virtual void paintFocusBorders( QPainter *p, QVariant &cal, int x, int y, int w, int h ); + virtual void paintFocusBorders( TQPainter *p, TQVariant &cal, int x, int y, int w, int h ); /*! For reimplementation. Sets up and paints cell's contents using context of \a val value. - \a focused is true if the cell is focused. \a align is set using Qt::AlignmentFlags. + \a focused is true if the cell is focused. \a align is set using TQt::AlignmentFlags. Some additional things may be painted using \a p, but it is not needed to paint the text (this is done automatically outside of this method). @@ -101,8 +102,8 @@ class KEXIDATATABLE_EXPORT KexiTableEdit : public QWidget, public KexiDataItemIn \a p painter's pen is set to foreground color (usually black) that should be used to paint foreground information, if needed. For example boolean editor widget paints a rectangle using this color. */ - virtual void setupContents( QPainter *p, bool focused, const QVariant& val, - QString &txt, int &align, int &x, int &y_offset, int &w, int &h ); + virtual void setupContents( TQPainter *p, bool focused, const TQVariant& val, + TQString &txt, int &align, int &x, int &y_offset, int &w, int &h ); /*! \return true if "selected text" color should be used to paint contents of the editor. True by default. It's false e.g. in boolean editor, where no selection is painted @@ -115,16 +116,16 @@ class KEXIDATATABLE_EXPORT KexiTableEdit : public QWidget, public KexiDataItemIn /*! For reimplementation. Paints selection's background using \a p. Most parameters are similar to these from setupContents(). */ - virtual void paintSelectionBackground( QPainter *p, bool focused, const QString& txt, - int align, int x, int y_offset, int w, int h, const QColor& fillColor, - const QFontMetrics &fm, bool readOnly, bool fullRowSelection ); + virtual void paintSelectionBackground( TQPainter *p, bool focused, const TQString& txt, + int align, int x, int y_offset, int w, int h, const TQColor& fillColor, + const TQFontMetrics &fm, bool readOnly, bool fullRowSelection ); - /*! Sometimes, editor can contain non-standard margin, for example combobox editor contains + /*! Sometimes, editor can contain non-standard margin, for example combobox editor tqcontains dropdown button at the right side. \return left margin's size; 0 by default. For reimplementation. */ int leftMargin() const { return m_leftMargin; } - /*! Sometimes, editor can contain non-standard margin, for example combobox editor contains + /*! Sometimes, editor can contain non-standard margin, for example combobox editor tqcontains dropdown button at the right side. THe dropdown button's width is counted only if \a focused is true. \return right margin's size; 0 by default. For reimplementation. */ int rightMargin(bool focused) const; @@ -133,7 +134,7 @@ class KEXIDATATABLE_EXPORT KexiTableEdit : public QWidget, public KexiDataItemIn For implementation: true should be returned if \a ke should be accepted. If \a editorActive is true, this editor is currently active, i.e. the table view is in edit mode. By default false is returned. */ - virtual bool handleKeyPress( QKeyEvent* ke, bool editorActive ) { + virtual bool handleKeyPress( TQKeyEvent* ke, bool editorActive ) { Q_UNUSED(ke); Q_UNUSED(editorActive); return false; } /*! Handles double click request coming from the table view. @@ -146,24 +147,24 @@ class KEXIDATATABLE_EXPORT KexiTableEdit : public QWidget, public KexiDataItemIn For a special case (combo box), \a visibleValue can be provided, so it can be copied to the clipboard instead of unreadable \a value. For reimplementation. */ - virtual void handleCopyAction(const QVariant& value, const QVariant& visibleValue) = 0; + virtual void handleCopyAction(const TQVariant& value, const TQVariant& visibleValue) = 0; /*! \return width of \a value. For the default implementation \a val is converted to a string and width of this string is returned. */ - virtual int widthForValue( QVariant &val, const QFontMetrics &fm ); + virtual int widthForValue( TQVariant &val, const TQFontMetrics &fm ); /*! \return total size of this editor, including any buttons, etc. (if present). Reimpelment this if you want to return more appropriate size. This impelmentation just - returns QWidget::size(). */ - virtual QSize totalSize() { return QWidget::size(); } + returns TQWidget::size(). */ + virtual TQSize totalSize() { return TQWidget::size(); } /*! Shows a special tooltip for \a value if needed, i.e. if the value could not fit inside \a rect for a given font metrics \a fm. - \return true a normal tooltip should be displayed (using QToolTip,) and false if + \return true a normal tooltip should be displayed (using TQToolTip,) and false if no tooltip should be displayed or a custom tooltip was displayed internally (not yet supported). Default implementation does nothing and returns false. If the cell is currentl focused (selected), \a focused is true. */ - virtual bool showToolTipIfNeeded(const QVariant& value, const QRect& rect, const QFontMetrics& fm, + virtual bool showToolTipIfNeeded(const TQVariant& value, const TQRect& rect, const TQFontMetrics& fm, bool focused); /*! Created internal editor for this editor is needed. This method is only implemented @@ -177,28 +178,28 @@ class KEXIDATATABLE_EXPORT KexiTableEdit : public QWidget, public KexiDataItemIn void acceptRequested(); protected: - virtual bool eventFilter(QObject* watched, QEvent* e); + virtual bool eventFilter(TQObject* watched, TQEvent* e); /*! Sets \a v as view widget for this editor. The view will be assigned as focus proxy for the editor, its events will be filtered, it will be resized when neede, and so on. */ - void setViewWidget(QWidget *v); + void setViewWidget(TQWidget *v); - /*! Moves child widget within the viewport if the parent is scrollview (otherwise does nothing). - Use this for child widgets that are outside of this editor widget, instead of calling QWidget::move(). */ - void moveChild( QWidget * child, int x, int y ); + /*! Moves child widget within the viewport if the tqparent is scrollview (otherwise does nothing). + Use this for child widgets that are outside of this editor widget, instead of calling TQWidget::move(). */ + void moveChild( TQWidget * child, int x, int y ); /*! Allows to force redrawing the related cell by the editor itself. Usable when the editor is not - displayed by a QWidget but rather by table view cell itself, for example KexiBlobTableEdit. */ - void repaintRelatedCell(); + displayed by a TQWidget but rather by table view cell itself, for example KexiBlobTableEdit. */ + void tqrepaintRelatedCell(); KexiTableViewColumn *m_column; int m_leftMargin; int m_rightMargin, m_rightMarginWhenFocused; - QScrollView* m_scrollView; //!< may be 0 if the parent is not a scrollview + TQScrollView* m_scrollView; //!< may be 0 if the tqparent is not a scrollview bool m_usesSelectedTextColor : 1; //!< set in ctor, @see usesSelectedTextColor() private: - QWidget* m_view; + TQWidget* m_view; }; //! Declaration of cell editor factory @@ -210,7 +211,7 @@ class KEXIDATATABLE_EXPORT KexiTableEdit : public QWidget, public KexiDataItemIn virtual ~factoryclassname(); \ \ protected: \ - virtual KexiTableEdit* createEditor(KexiTableViewColumn &column, QWidget* parent = 0); \ + virtual KexiTableEdit* createEditor(KexiTableViewColumn &column, TQWidget* tqparent = 0); \ }; //! Implementation of cell editor factory @@ -225,9 +226,9 @@ factoryclassname::~factoryclassname() \ {} \ \ KexiTableEdit* factoryclassname::createEditor( \ - KexiTableViewColumn &column, QWidget* parent) \ + KexiTableViewColumn &column, TQWidget* tqparent) \ { \ - return new itemclassname(column, parent); \ + return new itemclassname(column, tqparent); \ } #endif diff --git a/kexi/widget/tableview/kexitableitem.cpp b/kexi/widget/tableview/kexitableitem.cpp index e1669a35..659e341e 100644 --- a/kexi/widget/tableview/kexitableitem.cpp +++ b/kexi/widget/tableview/kexitableitem.cpp @@ -55,8 +55,8 @@ KexiTableItem::clearValues() void KexiTableItem::debug() const { - QString s = QString("KexiTableItem (%1 items)").arg(size()); + TQString s = TQString("KexiTableItem (%1 items)").tqarg(size()); for (uint i = 0; i < size(); i++) - s.append( QString::number(i)+":"+at(i).toString()+" " ); + s.append( TQString::number(i)+":"+at(i).toString()+" " ); kexidbg << s << endl; } diff --git a/kexi/widget/tableview/kexitableitem.h b/kexi/widget/tableview/kexitableitem.h index 00074e82..0216ee48 100644 --- a/kexi/widget/tableview/kexitableitem.h +++ b/kexi/widget/tableview/kexitableitem.h @@ -25,10 +25,10 @@ #ifndef KEXITABLEITEM_H #define KEXITABLEITEM_H -#include <qstring.h> -#include <qdatetime.h> -#include <qvaluevector.h> -#include <qvariant.h> +#include <tqstring.h> +#include <tqdatetime.h> +#include <tqvaluevector.h> +#include <tqvariant.h> #include <kexidb/connection.h> diff --git a/kexi/widget/tableview/kexitableview.cpp b/kexi/widget/tableview/kexitableview.cpp index 108b1696..229f909c 100644 --- a/kexi/widget/tableview/kexitableview.cpp +++ b/kexi/widget/tableview/kexitableview.cpp @@ -24,18 +24,18 @@ Original Project: buX (www.bux.at) */ -#include <qpainter.h> -#include <qkeycode.h> -#include <qlineedit.h> -#include <qcombobox.h> -#include <qwmatrix.h> -#include <qtimer.h> -#include <qpopupmenu.h> -#include <qcursor.h> -#include <qstyle.h> -#include <qlayout.h> -#include <qlabel.h> -#include <qwhatsthis.h> +#include <tqpainter.h> +#include <tqkeycode.h> +#include <tqlineedit.h> +#include <tqcombobox.h> +#include <tqwmatrix.h> +#include <tqtimer.h> +#include <tqpopupmenu.h> +#include <tqcursor.h> +#include <tqstyle.h> +#include <tqlayout.h> +#include <tqlabel.h> +#include <tqwhatsthis.h> #include <kglobal.h> #include <klocale.h> @@ -59,16 +59,16 @@ #include <widget/utils/kexidisplayutils.h> #include <kexidb/cursor.h> -KexiTableView::Appearance::Appearance(QWidget *widget) +KexiTableView::Appearance::Appearance(TQWidget *widget) : alternateBackgroundColor( KGlobalSettings::alternateBackgroundColor() ) { //set defaults - if (qApp) { - QPalette p = widget ? widget->palette() : qApp->palette(); + if (tqApp) { + TQPalette p = widget ? widget->palette() : tqApp->palette(); baseColor = p.active().base(); textColor = p.active().text(); - borderColor = QColor(200,200,200); - emptyAreaColor = p.active().color(QColorGroup::Base); + borderColor = TQColor(200,200,200); + emptyAreaColor = p.active().color(TQColorGroup::Base); rowHighlightingColor = KexiUtils::blendedColors(p.active().highlight(), baseColor, 33, 66); rowMouseOverHighlightingColor = KexiUtils::blendedColors(p.active().highlight(), baseColor, 10, 90); rowMouseOverAlternateHighlightingColor = KexiUtils::blendedColors(p.active().highlight(), alternateBackgroundColor, 10, 90); @@ -87,31 +87,31 @@ KexiTableView::Appearance::Appearance(QWidget *widget) //----------------------------------------- //! @internal A special What's This class displaying information about a given column -class KexiTableView::WhatsThis : public QWhatsThis +class KexiTableView::WhatsThis : public TQWhatsThis { public: - WhatsThis(KexiTableView* tv) : QWhatsThis(tv), m_tv(tv) + WhatsThis(KexiTableView* tv) : TQWhatsThis(tv), m_tv(tv) { Q_ASSERT(tv); } virtual ~WhatsThis() { } - virtual QString text( const QPoint & pos) + virtual TQString text( const TQPoint & pos) { const int leftMargin = m_tv->verticalHeaderVisible() ? m_tv->verticalHeader()->width() : 0; //const int topMargin = m_tv->horizontalHeaderVisible() ? m_tv->d->pTopHeader->height() : 0; //const int bottomMargin = m_tv->d->appearance.navigatorEnabled ? m_tv->m_navPanel->height() : 0; - if (KexiUtils::hasParent(m_tv->verticalHeader(), m_tv->childAt(pos))) { + if (KexiUtils::hasParent(TQT_TQOBJECT(m_tv->verticalHeader()), TQT_TQOBJECT(m_tv->tqchildAt(pos)))) { return i18n("Contains a pointer to the currently selected row"); } - else if (KexiUtils::hasParent(m_tv->m_navPanel, m_tv->childAt(pos))) { + else if (KexiUtils::hasParent(TQT_TQOBJECT(m_tv->m_navPanel), TQT_TQOBJECT(m_tv->tqchildAt(pos)))) { return i18n("Row navigator"); -// return QWhatsThis::textFor(m_tv->m_navPanel, QPoint( pos.x(), pos.y() - m_tv->height() + bottomMargin )); +// return TQWhatsThis::textFor(m_tv->m_navPanel, TQPoint( pos.x(), pos.y() - m_tv->height() + bottomMargin )); } KexiDB::Field *f = m_tv->field( m_tv->columnAt(pos.x()-leftMargin) ); if (!f) - return QString::null; + return TQString(); return f->description().isEmpty() ? f->captionOrName() : f->description(); } protected: @@ -121,19 +121,19 @@ class KexiTableView::WhatsThis : public QWhatsThis //----------------------------------------- KexiTableViewCellToolTip::KexiTableViewCellToolTip( KexiTableView * tableView ) - : QToolTip(tableView->viewport()) + : TQToolTip(tableView->viewport()) , m_tableView(tableView) { } KexiTableViewCellToolTip::~KexiTableViewCellToolTip() { - remove(parentWidget()); + remove(tqparentWidget()); } -void KexiTableViewCellToolTip::maybeTip( const QPoint & p ) +void KexiTableViewCellToolTip::maybeTip( const TQPoint & p ) { - const QPoint cp( m_tableView->viewportToContents( p ) ); + const TQPoint cp( m_tableView->viewportToContents( p ) ); const int row = m_tableView->rowAt( cp.y(), true/*ignoreEnd*/ ); const int col = m_tableView->columnAt( cp.x() ); @@ -147,21 +147,21 @@ void KexiTableViewCellToolTip::maybeTip( const QPoint & p ) int h = m_tableView->rowHeight(); int x = 0; int y_offset = 0; - int align = Qt::SingleLine | Qt::AlignVCenter; - QString txtValue; - QVariant cellValue; + int align = TQt::SingleLine | TQt::AlignVCenter; + TQString txtValue; + TQVariant cellValue; KexiTableViewColumn *tvcol = m_tableView->column(col); if (!m_tableView->getVisibleLookupValue(cellValue, editor, item, tvcol)) cellValue = insertRowSelected ? editor->displayedField()->defaultValue() : item->at(col); //display default value if available const bool focused = m_tableView->selectedItem() == item && col == m_tableView->currentColumn(); editor->setupContents( 0, focused, cellValue, txtValue, align, x, y_offset, w, h ); - QRect realRect(m_tableView->columnPos(col)-m_tableView->contentsX(), + TQRect realRect(m_tableView->columnPos(col)-m_tableView->contentsX(), m_tableView->rowPos(row)-m_tableView->contentsY(), w, h); //m_tableView->cellGeometry( row, col )); if (editor->showToolTipIfNeeded( - txtValue.isEmpty() ? item->at(col) : QVariant(txtValue), + txtValue.isEmpty() ? item->at(col) : TQVariant(txtValue), realRect, m_tableView->fontMetrics(), focused)) { - QString squeezedTxtValue; + TQString squeezedTxtValue; if (txtValue.length() > 50) squeezedTxtValue = txtValue.left(100) + "..."; else @@ -174,8 +174,8 @@ void KexiTableViewCellToolTip::maybeTip( const QPoint & p ) //----------------------------------------- -KexiTableView::KexiTableView(KexiTableViewData* data, QWidget* parent, const char* name) -: QScrollView(parent, name, /*Qt::WRepaintNoErase | */Qt::WStaticContents /*| Qt::WResizeNoErase*/) +KexiTableView::KexiTableView(KexiTableViewData* data, TQWidget* tqparent, const char* name) +: TQScrollView(tqparent, name, /*TQt::WRepaintNoErase | */TQt::WStaticContents /*| TQt::WResizeNoErase*/) , KexiRecordNavigatorHandler() , KexiSharedActionClient() , KexiDataAwareObjectInterface() @@ -184,32 +184,32 @@ KexiTableView::KexiTableView(KexiTableViewData* data, QWidget* parent, const cha d = new KexiTableViewPrivate(this); - connect( kapp, SIGNAL( settingsChanged(int) ), SLOT( slotSettingsChanged(int) ) ); + connect( kapp, TQT_SIGNAL( settingsChanged(int) ), TQT_SLOT( slotSettingsChanged(int) ) ); slotSettingsChanged(KApplication::SETTINGS_SHORTCUTS); m_data = new KexiTableViewData(); //to prevent crash because m_data==0 m_owner = true; //-this will be deleted if needed setResizePolicy(Manual); - viewport()->setBackgroundMode(Qt::NoBackground); -// viewport()->setFocusPolicy(StrongFocus); - viewport()->setFocusPolicy(WheelFocus); - setFocusPolicy(WheelFocus); //<--- !!!!! important (was NoFocus), - // otherwise QApplication::setActiveWindow() won't activate + viewport()->setBackgroundMode(TQt::NoBackground); +// viewport()->setFocusPolicy(TQ_StrongFocus); + viewport()->setFocusPolicy(TQ_WheelFocus); + setFocusPolicy(TQ_WheelFocus); //<--- !!!!! important (was NoFocus), + // otherwise TQApplication::setActiveWindow() won't activate // this widget when needed! // setFocusProxy(viewport()); viewport()->installEventFilter(this); //setup colors defaults - setBackgroundMode(Qt::PaletteBackground); -// setEmptyAreaColor(d->appearance.baseColor);//palette().active().color(QColorGroup::Base)); + setBackgroundMode(TQt::PaletteBackground); +// setEmptyAreaColor(d->appearance.baseColor);//palette().active().color(TQColorGroup::Base)); -// d->baseColor = colorGroup().base(); -// d->textColor = colorGroup().text(); +// d->baseColor = tqcolorGroup().base(); +// d->textColor = tqcolorGroup().text(); // d->altColor = KGlobalSettings::alternateBackgroundColor(); -// d->grayColor = QColor(200,200,200); - d->diagonalGrayPattern = QBrush(d->appearance.borderColor, Qt::BDiagPattern); +// d->grayColor = TQColor(200,200,200); + d->diagonalGrayPattern = TQBrush(d->appearance.borderColor, TQt::BDiagPattern); setLineWidth(1); horizontalScrollBar()->installEventFilter(this); @@ -219,13 +219,13 @@ KexiTableView::KexiTableView(KexiTableViewData* data, QWidget* parent, const cha //context menu m_popupMenu = new KPopupMenu(this, "contextMenu"); #if 0 //moved to mainwindow's actions - d->menu_id_addRecord = m_popupMenu->insertItem(i18n("Add Record"), this, SLOT(addRecord()), Qt::CTRL+Qt::Key_Insert); + d->menu_id_addRecord = m_popupMenu->insertItem(i18n("Add Record"), this, TQT_SLOT(addRecord()), TQt::CTRL+TQt::Key_Insert); d->menu_id_removeRecord = m_popupMenu->insertItem( kapp->iconLoader()->loadIcon("button_cancel", KIcon::Small), - i18n("Remove Record"), this, SLOT(removeRecord()), Qt::CTRL+Qt::Key_Delete); + i18n("Remove Record"), this, TQT_SLOT(removeRecord()), TQt::CTRL+TQt::Key_Delete); #endif -#ifdef Q_WS_WIN +#ifdef TQ_WS_WIN d->rowHeight = fontMetrics().lineSpacing() + 4; #else d->rowHeight = fontMetrics().lineSpacing() + 1; @@ -234,27 +234,27 @@ KexiTableView::KexiTableView(KexiTableViewData* data, QWidget* parent, const cha if(d->rowHeight < 17) d->rowHeight = 17; - d->pUpdateTimer = new QTimer(this); + d->pUpdateTimer = new TQTimer(this); // setMargins(14, fontMetrics().height() + 4, 0, 0); // Create headers m_horizontalHeader = new KexiTableViewHeader(this, "topHeader"); - m_horizontalHeader->setSelectionBackgroundColor( palette().active().highlight() ); + m_horizontalHeader->setSelectionBackgroundColor( tqpalette().active().highlight() ); m_horizontalHeader->setOrientation(Qt::Horizontal); m_horizontalHeader->setTracking(false); m_horizontalHeader->setMovingEnabled(false); - connect(m_horizontalHeader, SIGNAL(sizeChange(int,int,int)), this, SLOT(slotTopHeaderSizeChange(int,int,int))); + connect(m_horizontalHeader, TQT_SIGNAL(sizeChange(int,int,int)), this, TQT_SLOT(slotTopHeaderSizeChange(int,int,int))); m_verticalHeader = new KexiRecordMarker(this, "rm"); - m_verticalHeader->setSelectionBackgroundColor( palette().active().highlight() ); + m_verticalHeader->setSelectionBackgroundColor( tqpalette().active().highlight() ); m_verticalHeader->setCellHeight(d->rowHeight); // m_verticalHeader->setFixedWidth(d->rowHeight); m_verticalHeader->setCurrentRow(-1); setMargins( - QMIN(m_horizontalHeader->sizeHint().height(), d->rowHeight), - m_horizontalHeader->sizeHint().height(), 0, 0); + TQMIN(m_horizontalHeader->tqsizeHint().height(), d->rowHeight), + m_horizontalHeader->tqsizeHint().height(), 0, 0); setupNavigator(); @@ -267,8 +267,8 @@ KexiTableView::KexiTableView(KexiTableViewData* data, QWidget* parent, const cha setData( data ); #if 0//(js) doesn't work! - d->scrollTimer = new QTimer(this); - connect(d->scrollTimer, SIGNAL(timeout()), this, SLOT(slotAutoScroll())); + d->scrollTimer = new TQTimer(this); + connect(d->scrollTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(slotAutoScroll())); #endif // setBackgroundAltering(true); @@ -278,17 +278,17 @@ KexiTableView::KexiTableView(KexiTableViewData* data, QWidget* parent, const cha viewport()->setAcceptDrops(true); // Connect header, table and scrollbars - connect(horizontalScrollBar(), SIGNAL(valueChanged(int)), m_horizontalHeader, SLOT(setOffset(int))); - connect(verticalScrollBar(), SIGNAL(valueChanged(int)), m_verticalHeader, SLOT(setOffset(int))); - connect(m_horizontalHeader, SIGNAL(sizeChange(int, int, int)), this, SLOT(slotColumnWidthChanged(int, int, int))); - connect(m_horizontalHeader, SIGNAL(sectionHandleDoubleClicked(int)), this, SLOT(slotSectionHandleDoubleClicked(int))); - connect(m_horizontalHeader, SIGNAL(clicked(int)), this, SLOT(sortColumnInternal(int))); + connect(horizontalScrollBar(), TQT_SIGNAL(valueChanged(int)), m_horizontalHeader, TQT_SLOT(setOffset(int))); + connect(verticalScrollBar(), TQT_SIGNAL(valueChanged(int)), m_verticalHeader, TQT_SLOT(setOffset(int))); + connect(m_horizontalHeader, TQT_SIGNAL(sizeChange(int, int, int)), this, TQT_SLOT(slotColumnWidthChanged(int, int, int))); + connect(m_horizontalHeader, TQT_SIGNAL(sectionHandleDoubleClicked(int)), this, TQT_SLOT(slotSectionHandleDoubleClicked(int))); + connect(m_horizontalHeader, TQT_SIGNAL(clicked(int)), this, TQT_SLOT(sortColumnInternal(int))); - connect(d->pUpdateTimer, SIGNAL(timeout()), this, SLOT(slotUpdate())); + connect(d->pUpdateTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(slotUpdate())); // horizontalScrollBar()->show(); updateScrollBars(); -// resize(sizeHint()); +// resize(tqsizeHint()); // updateContents(); // setMinimumHeight(horizontalScrollBar()->height() + d->rowHeight + topMargin()); @@ -333,7 +333,7 @@ void KexiTableView::setupNavigator() m_navPanel = new KexiRecordNavigator(this, leftMargin(), "navPanel"); m_navPanel->setRecordHandler(this); - m_navPanel->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Preferred); + m_navPanel->tqsetSizePolicy(TQSizePolicy::Minimum,TQSizePolicy::Preferred); } void KexiTableView::initDataContents() @@ -345,8 +345,8 @@ void KexiTableView::initDataContents() m_navPanel->showEditingIndicator(false); } -void KexiTableView::addHeaderColumn(const QString& caption, const QString& description, - const QIconSet& icon, int width) +void KexiTableView::addHeaderColumn(const TQString& caption, const TQString& description, + const TQIconSet& icon, int width) { const int nr = m_horizontalHeader->count(); if (icon.isNull()) @@ -360,33 +360,33 @@ void KexiTableView::addHeaderColumn(const QString& caption, const QString& descr void KexiTableView::updateWidgetContentsSize() { - QSize s(tableSize()); + TQSize s(tableSize()); resizeContents(s.width(), s.height()); } -void KexiTableView::slotRowsDeleted( const QValueList<int> &rows ) +void KexiTableView::slotRowsDeleted( const TQValueList<int> &rows ) { - viewport()->repaint(); + viewport()->tqrepaint(); updateWidgetContentsSize(); - setCursorPosition(QMAX(0, (int)m_curRow - (int)rows.count()), -1, true); + setCursorPosition(TQMAX(0, (int)m_curRow - (int)rows.count()), -1, true); } -/*void KexiTableView::addDropFilter(const QString &filter) +/*void KexiTableView::addDropFilter(const TQString &filter) { d->dropFilters.append(filter); viewport()->setAcceptDrops(true); }*/ -void KexiTableView::setFont( const QFont &font ) +void KexiTableView::setFont( const TQFont &font ) { - QScrollView::setFont(font); + TQScrollView::setFont(font); updateFonts(true); } -void KexiTableView::updateFonts(bool repaint) +void KexiTableView::updateFonts(bool tqrepaint) { -#ifdef Q_WS_WIN +#ifdef TQ_WS_WIN d->rowHeight = fontMetrics().lineSpacing() + 4; #else d->rowHeight = fontMetrics().lineSpacing() + 1; @@ -399,15 +399,15 @@ void KexiTableView::updateFonts(bool repaint) // if(d->rowHeight < 22) // d->rowHeight = 22; setMargins( - QMIN(m_horizontalHeader->sizeHint().height(), d->rowHeight), - m_horizontalHeader->sizeHint().height(), 0, 0); + TQMIN(m_horizontalHeader->tqsizeHint().height(), d->rowHeight), + m_horizontalHeader->tqsizeHint().height(), 0, 0); // setMargins(14, d->rowHeight, 0, 0); m_verticalHeader->setCellHeight(d->rowHeight); KexiDisplayUtils::initDisplayForAutonumberSign(d->autonumberSignDisplayParameters, this); KexiDisplayUtils::initDisplayForDefaultValue(d->defaultValueDisplayParameters, this); - if (repaint) + if (tqrepaint) updateContents(); } @@ -425,7 +425,7 @@ void KexiTableView::updateAllVisibleRowsBelow(int row) clipper()->width(), clipper()->height() - (rowPos(row) - contentsY()) ); } -void KexiTableView::clearColumnsInternal(bool /*repaint*/) +void KexiTableView::clearColumnsInternal(bool /*tqrepaint*/) { while(m_horizontalHeader->count()>0) m_horizontalHeader->removeLabel(0); @@ -434,7 +434,7 @@ void KexiTableView::clearColumnsInternal(bool /*repaint*/) void KexiTableView::slotUpdate() { // kdDebug(44021) << " KexiTableView::slotUpdate() -- " << endl; -// QSize s(tableSize()); +// TQSize s(tableSize()); // viewport()->setUpdatesEnabled(false); /// resizeContents(s.width(), s.height()); // viewport()->setUpdatesEnabled(true); @@ -457,7 +457,7 @@ int KexiTableView::currentLocalSortingOrder() const { if (m_horizontalHeader->sortIndicatorSection()==-1) return 0; - return (m_horizontalHeader->sortIndicatorOrder() == Qt::Ascending) ? 1 : -1; + return (m_horizontalHeader->sortIndicatorOrder() == TQt::Ascending) ? 1 : -1; } void KexiTableView::setLocalSortingOrder(int col, int order) @@ -465,7 +465,7 @@ void KexiTableView::setLocalSortingOrder(int col, int order) if (order == 0) col = -1; if (col>=0) - m_horizontalHeader->setSortIndicator(col, (order==1) ? Qt::Ascending : Qt::Descending); + m_horizontalHeader->setSortIndicator(col, (order==1) ? TQt::Ascending : TQt::Descending); } int KexiTableView::currentLocalSortColumn() const @@ -488,37 +488,37 @@ void KexiTableView::updateGUIAfterSorting() // d->pUpdateTimer->start(1,true); } -QSizePolicy KexiTableView::sizePolicy() const +TQSizePolicy KexiTableView::sizePolicy() const { // this widget is expandable - return QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + return TQSizePolicy(TQSizePolicy::Expanding, TQSizePolicy::Expanding); } -QSize KexiTableView::sizeHint() const +TQSize KexiTableView::tqsizeHint() const { - const QSize &ts = tableSize(); - int w = QMAX( ts.width() + leftMargin()+ verticalScrollBar()->sizeHint().width() + 2*2, + const TQSize &ts = tableSize(); + int w = TQMAX( ts.width() + leftMargin()+ verticalScrollBar()->tqsizeHint().width() + 2*2, (m_navPanel->isVisible() ? m_navPanel->width() : 0) ); - int h = QMAX( ts.height()+topMargin()+horizontalScrollBar()->sizeHint().height(), - minimumSizeHint().height() ); - w = QMIN( w, qApp->desktop()->width()*3/4 ); //stretch - h = QMIN( h, qApp->desktop()->height()*3/4 ); //stretch - -// kexidbg << "KexiTableView::sizeHint()= " <<w <<", " <<h << endl; - - return QSize(w, h); - /*QSize( - QMAX( ts.width() + leftMargin() + 2*2, (m_navPanel ? m_navPanel->width() : 0) ), - //+ QMIN(m_verticalHeader->width(),d->rowHeight) + margin()*2, - QMAX( ts.height()+topMargin()+horizontalScrollBar()->sizeHint().height(), - minimumSizeHint().height() ) + int h = TQMAX( ts.height()+topMargin()+horizontalScrollBar()->tqsizeHint().height(), + tqminimumSizeHint().height() ); + w = TQMIN( w, tqApp->desktop()->width()*3/4 ); //stretch + h = TQMIN( h, tqApp->desktop()->height()*3/4 ); //stretch + +// kexidbg << "KexiTableView::tqsizeHint()= " <<w <<", " <<h << endl; + + return TQSize(w, h); + /*TQSize( + TQMAX( ts.width() + leftMargin() + 2*2, (m_navPanel ? m_navPanel->width() : 0) ), + //+ TQMIN(m_verticalHeader->width(),d->rowHeight) + margin()*2, + TQMAX( ts.height()+topMargin()+horizontalScrollBar()->tqsizeHint().height(), + tqminimumSizeHint().height() ) );*/ -// QMAX(ts.height() + topMargin(), minimumSizeHint().height()) ); +// TQMAX(ts.height() + topMargin(), tqminimumSizeHint().height()) ); } -QSize KexiTableView::minimumSizeHint() const +TQSize KexiTableView::tqminimumSizeHint() const { - return QSize( + return TQSize( leftMargin() + ((columns()>0)?columnWidth(0):KEXI_DEFAULT_DATA_COLUMN_WIDTH) + 2*2, d->rowHeight*5/2 + topMargin() + (m_navPanel && m_navPanel->isVisible() ? m_navPanel->height() : 0) ); @@ -527,7 +527,7 @@ QSize KexiTableView::minimumSizeHint() const void KexiTableView::createBuffer(int width, int height) { if(!d->pBufferPm) - d->pBufferPm = new QPixmap(width, height); + d->pBufferPm = new TQPixmap(width, height); else if(d->pBufferPm->width() < width || d->pBufferPm->height() < height) d->pBufferPm->resize(width, height); @@ -536,7 +536,7 @@ void KexiTableView::createBuffer(int width, int height) //internal inline void KexiTableView::paintRow(KexiTableItem *item, - QPainter *pb, int r, int rowp, int cx, int cy, + TQPainter *pb, int r, int rowp, int cx, int cy, int colfirst, int collast, int maxwc) { if (!item) @@ -579,7 +579,7 @@ inline void KexiTableView::paintRow(KexiTableItem *item, // Translate painter and draw the cell pb->saveWorldMatrix(); pb->translate(translx, transly); - paintCell( pb, item, c, r, QRect(colp, rowp, colw, d->rowHeight)); + paintCell( pb, item, c, r, TQRect(colp, rowp, colw, d->rowHeight)); pb->restoreWorldMatrix(); } @@ -594,14 +594,14 @@ inline void KexiTableView::paintRow(KexiTableItem *item, if (y_line>=0) { RasterOp op = pb->rasterOp(); pb->setRasterOp(XorROP); - pb->setPen( QPen(Qt::white, 3) ); + pb->setPen( TQPen(TQt::white, 3) ); pb->drawLine(0, y_line, maxwc, y_line); pb->setRasterOp(op); } } } -void KexiTableView::drawContents( QPainter *p, int cx, int cy, int cw, int ch) +void KexiTableView::drawContents( TQPainter *p, int cx, int cy, int cw, int ch) { if (d->disableDrawContents) return; @@ -613,8 +613,8 @@ void KexiTableView::drawContents( QPainter *p, int cx, int cy, int cw, int ch) bool plus1row = false; //true if we should show 'inserting' row at the end bool paintOnlyInsertRow = false; -/* kdDebug(44021) << QString(" KexiTableView::drawContents(cx:%1 cy:%2 cw:%3 ch:%4)") - .arg(cx).arg(cy).arg(cw).arg(ch) << endl;*/ +/* kdDebug(44021) << TQString(" KexiTableView::drawContents(cx:%1 cy:%2 cw:%3 ch:%4)") + .tqarg(cx).tqarg(cy).tqarg(cw).tqarg(ch) << endl;*/ if (rowlast == -1) { rowlast = rows() - 1; @@ -657,10 +657,10 @@ void KexiTableView::drawContents( QPainter *p, int cx, int cy, int cw, int ch) createBuffer(cw, ch); if(d->pBufferPm->isNull()) return; - QPainter *pb = new QPainter(d->pBufferPm, this); -// pb->fillRect(0, 0, cw, ch, colorGroup().base()); + TQPainter *pb = new TQPainter(d->pBufferPm, this); +// pb->fillRect(0, 0, cw, ch, tqcolorGroup().base()); -// int maxwc = QMIN(cw, (columnPos(d->numCols - 1) + columnWidth(d->numCols - 1))); +// int maxwc = TQMIN(cw, (columnPos(d->numCols - 1) + columnWidth(d->numCols - 1))); int maxwc = columnPos(columns() - 1) + columnWidth(columns() - 1); // kdDebug(44021) << "KexiTableView::drawContents(): maxwc: " << maxwc << endl; @@ -673,7 +673,7 @@ void KexiTableView::drawContents( QPainter *p, int cx, int cy, int cw, int ch) rowp = rowPos(r); // 'insert' row's position } else { - QPtrListIterator<KexiTableItem> it = m_data->iterator(); + TQPtrListIterator<KexiTableItem> it = m_data->iterator(); it += rowfirst;//move to 1st row rowp = rowPos(rowfirst); // row position for (r = rowfirst;r <= rowlast; r++, ++it, rowp+=d->rowHeight) { @@ -693,7 +693,7 @@ void KexiTableView::drawContents( QPainter *p, int cx, int cy, int cw, int ch) paintEmptyArea(p, cx, cy, cw, ch); } -bool KexiTableView::isDefaultValueDisplayed(KexiTableItem *item, int col, QVariant* value) +bool KexiTableView::isDefaultValueDisplayed(KexiTableItem *item, int col, TQVariant* value) { const bool cursorAtInsertRowOrEditingNewRow = (item == m_insertItem || (m_newRowEditing && m_currentItem == item)); KexiTableViewColumn *tvcol; @@ -709,7 +709,7 @@ bool KexiTableView::isDefaultValueDisplayed(KexiTableItem *item, int col, QVaria return false; } -void KexiTableView::paintCell(QPainter* p, KexiTableItem *item, int col, int row, const QRect &cr, bool print) +void KexiTableView::paintCell(TQPainter* p, KexiTableItem *item, int col, int row, const TQRect &cr, bool print) { p->save(); Q_UNUSED(print); @@ -718,12 +718,12 @@ void KexiTableView::paintCell(QPainter* p, KexiTableItem *item, int col, int row int x2 = w - 1; int y2 = h - 1; -/* if (0==qstrcmp("KexiComboBoxPopup",parentWidget()->className())) { - kexidbg << parentWidget()->className() << " >>>>>> KexiTableView::paintCell(col=" << col <<"row="<<row<<") w="<<w<<endl; +/* if (0==qstrcmp("KexiComboBoxPopup",tqparentWidget()->className())) { + kexidbg << tqparentWidget()->className() << " >>>>>> KexiTableView::paintCell(col=" << col <<"row="<<row<<") w="<<w<<endl; }*/ // Draw our lines - QPen pen(p->pen()); + TQPen pen(p->pen()); if (d->appearance.gridEnabled) { p->setPen(d->appearance.borderColor); @@ -746,12 +746,12 @@ void KexiTableView::paintCell(QPainter* p, KexiTableItem *item, int col, int row int x = edit ? edit->leftMargin() : 0; int y_offset=0; - int align = Qt::SingleLine | Qt::AlignVCenter; - QString txt; //text to draw + int align = TQt::SingleLine | TQt::AlignVCenter; + TQString txt; //text to draw KexiTableViewColumn *tvcol = m_data->column(col); - QVariant cellValue; + TQVariant cellValue; if (col < (int)item->count()) { if (m_currentItem == item) { if (m_editor && row == m_curRow && col == m_curCol @@ -790,44 +790,44 @@ void KexiTableView::paintCell(QPainter* p, KexiTableItem *item, int col, int row && m_curRow /*d->highlightedRow*/ >= 0 && row != m_curRow; //d->highlightedRow; // setup default pen - QPen defaultPen; + TQPen defaultPen; const bool usesSelectedTextColor = edit && edit->usesSelectedTextColor(); if (defaultValueDisplayed) { if (col == m_curCol && row == m_curRow && usesSelectedTextColor) - defaultPen = d->defaultValueDisplayParameters.selectedTextColor; + defaultPen = TQPen(d->defaultValueDisplayParameters.selectedTextColor); else - defaultPen = d->defaultValueDisplayParameters.textColor; + defaultPen = TQPen(d->defaultValueDisplayParameters.textColor); } else if (d->appearance.fullRowSelection && (row == d->highlightedRow || (row == m_curRow && d->highlightedRow==-1)) && usesSelectedTextColor ) { - defaultPen = d->appearance.rowHighlightingTextColor; //special case: highlighted row + defaultPen = TQPen(d->appearance.rowHighlightingTextColor); //special case: highlighted row } else if (d->appearance.fullRowSelection && row == m_curRow && usesSelectedTextColor) { - defaultPen = d->appearance.textColor; //special case for full row selection + defaultPen = TQPen(d->appearance.textColor); //special case for full row selection } else if (m_currentItem == item && col == m_curCol && !columnReadOnly && !dontPaintNonpersistentSelectionBecauseDifferentRowHasBeenHighlighted && usesSelectedTextColor) { - defaultPen = colorGroup().highlightedText(); //selected text + defaultPen = TQPen(tqcolorGroup().highlightedText()); //selected text } else if (d->appearance.rowHighlightingEnabled && row == m_curRow && !dontPaintNonpersistentSelectionBecauseDifferentRowHasBeenHighlighted && usesSelectedTextColor) { - defaultPen = d->appearance.rowHighlightingTextColor; + defaultPen = TQPen(d->appearance.rowHighlightingTextColor); } else if (d->appearance.rowMouseOverHighlightingEnabled && row == d->highlightedRow && !dontPaintNonpersistentSelectionBecauseDifferentRowHasBeenHighlighted && usesSelectedTextColor) { - defaultPen = d->appearance.rowMouseOverHighlightingTextColor; + defaultPen = TQPen(d->appearance.rowMouseOverHighlightingTextColor); } else - defaultPen = d->appearance.textColor; + defaultPen = TQPen(d->appearance.textColor); if (edit) { if (defaultValueDisplayed) @@ -849,7 +849,7 @@ void KexiTableView::paintCell(QPainter* p, KexiTableItem *item, int col, int row if (m_currentItem == item && (col == m_curCol || d->appearance.fullRowSelection)) { if (edit && ((d->appearance.rowHighlightingEnabled && !d->appearance.fullRowSelection) || (row == m_curRow && d->highlightedRow==-1 && d->appearance.fullRowSelection))) //!dontPaintNonpersistentSelectionBecauseDifferentRowHasBeenHighlighted) edit->paintSelectionBackground( p, isEnabled(), txt, align, x, y_offset, w, h, - isEnabled() ? colorGroup().highlight() : QColor(200,200,200),//d->grayColor, + isEnabled() ? tqcolorGroup().highlight() : TQColor(200,200,200),//d->grayColor, p->fontMetrics(), columnReadOnly, d->appearance.fullRowSelection ); } @@ -867,7 +867,7 @@ void KexiTableView::paintCell(QPainter* p, KexiTableItem *item, int col, int row p->setPen(d->appearance.textColor); } else { - QPen gray_pen(p->pen()); + TQPen gray_pen(p->pen()); gray_pen.setColor(d->appearance.borderColor); p->setPen(gray_pen); } @@ -887,7 +887,7 @@ void KexiTableView::paintCell(QPainter* p, KexiTableItem *item, int col, int row // autonumber = true; // if (autonumber) { KexiDisplayUtils::paintAutonumberSign(d->autonumberSignDisplayParameters, p, - x, y_offset, w - x - x - ((align & Qt::AlignLeft)?2:0), h, align); + x, y_offset, w - x - x - ((align & TQt::AlignLeft)?2:0), h, align); // } } } @@ -897,81 +897,81 @@ void KexiTableView::paintCell(QPainter* p, KexiTableItem *item, int col, int row if (defaultValueDisplayed) p->setFont( d->defaultValueDisplayParameters.font ); p->setPen( defaultPen ); - p->drawText(x, y_offset, w - (x + x)- ((align & Qt::AlignLeft)?2:0)/*right space*/, h, + p->drawText(x, y_offset, w - (x + x)- ((align & TQt::AlignLeft)?2:0)/*right space*/, h, align, txt); } p->restore(); } -QPoint KexiTableView::contentsToViewport2( const QPoint &p ) +TQPoint KexiTableView::contentsToViewport2( const TQPoint &p ) { - return QPoint( p.x() - contentsX(), p.y() - contentsY() ); + return TQPoint( p.x() - contentsX(), p.y() - contentsY() ); } void KexiTableView::contentsToViewport2( int x, int y, int& vx, int& vy ) { - const QPoint v = contentsToViewport2( QPoint( x, y ) ); + const TQPoint v = contentsToViewport2( TQPoint( x, y ) ); vx = v.x(); vy = v.y(); } -QPoint KexiTableView::viewportToContents2( const QPoint& vp ) +TQPoint KexiTableView::viewportToContents2( const TQPoint& vp ) { - return QPoint( vp.x() + contentsX(), + return TQPoint( vp.x() + contentsX(), vp.y() + contentsY() ); } -void KexiTableView::paintEmptyArea( QPainter *p, int cx, int cy, int cw, int ch ) +void KexiTableView::paintEmptyArea( TQPainter *p, int cx, int cy, int cw, int ch ) { -// qDebug("%s: paintEmptyArea(x:%d y:%d w:%d h:%d)", (const char*)parentWidget()->caption(),cx,cy,cw,ch); +// qDebug("%s: paintEmptyArea(x:%d y:%d w:%d h:%d)", (const char*)tqparentWidget()->caption(),cx,cy,cw,ch); // Regions work with shorts, so avoid an overflow and adjust the // table size to the visible size - QSize ts( tableSize() ); -// ts.setWidth( QMIN( ts.width(), visibleWidth() ) ); -// ts.setHeight( QMIN( ts.height() - (m_navPanel ? m_navPanel->height() : 0), visibleHeight()) ); -/* kdDebug(44021) << QString(" (cx:%1 cy:%2 cw:%3 ch:%4)") - .arg(cx).arg(cy).arg(cw).arg(ch) << endl; - kdDebug(44021) << QString(" (w:%3 h:%4)") - .arg(ts.width()).arg(ts.height()) << endl;*/ + TQSize ts( tableSize() ); +// ts.setWidth( TQMIN( ts.width(), visibleWidth() ) ); +// ts.setHeight( TQMIN( ts.height() - (m_navPanel ? m_navPanel->height() : 0), visibleHeight()) ); +/* kdDebug(44021) << TQString(" (cx:%1 cy:%2 cw:%3 ch:%4)") + .tqarg(cx).tqarg(cy).tqarg(cw).tqarg(ch) << endl; + kdDebug(44021) << TQString(" (w:%3 h:%4)") + .tqarg(ts.width()).tqarg(ts.height()) << endl;*/ // Region of the rect we should draw, calculated in viewport // coordinates, as a region can't handle bigger coordinates contentsToViewport2( cx, cy, cx, cy ); - QRegion reg( QRect( cx, cy, cw, ch ) ); + TQRegion reg( TQRect( cx, cy, cw, ch ) ); //kexidbg << "---cy-- " << contentsY() << endl; // Subtract the table from it -// reg = reg.subtract( QRect( QPoint( 0, 0 ), ts-QSize(0,m_navPanel->isVisible() ? m_navPanel->height() : 0) ) ); - reg = reg.subtract( QRect( QPoint( 0, 0 ), ts - -QSize(0,QMAX((m_navPanel ? m_navPanel->height() : 0), horizontalScrollBar()->sizeHint().height()) - - (horizontalScrollBar()->isVisible() ? horizontalScrollBar()->sizeHint().height()/2 : 0) +// reg = reg.subtract( TQRect( TQPoint( 0, 0 ), ts-TQSize(0,m_navPanel->isVisible() ? m_navPanel->height() : 0) ) ); + reg = reg.subtract( TQRect( TQPoint( 0, 0 ), ts + -TQSize(0,TQMAX((m_navPanel ? m_navPanel->height() : 0), horizontalScrollBar()->tqsizeHint().height()) + - (horizontalScrollBar()->isVisible() ? horizontalScrollBar()->tqsizeHint().height()/2 : 0) + (horizontalScrollBar()->isVisible() ? 0 : d->internal_bottomMargin -// horizontalScrollBar()->sizeHint().height()/2 +// horizontalScrollBar()->tqsizeHint().height()/2 ) -//- /*d->bottomMargin */ horizontalScrollBar()->sizeHint().height()*3/2 +//- /*d->bottomMargin */ horizontalScrollBar()->tqsizeHint().height()*3/2 + contentsY() -// - (verticalScrollBar()->isVisible() ? horizontalScrollBar()->sizeHint().height()/2 : 0) +// - (verticalScrollBar()->isVisible() ? horizontalScrollBar()->tqsizeHint().height()/2 : 0) ) ) ); -// reg = reg.subtract( QRect( QPoint( 0, 0 ), ts ) ); +// reg = reg.subtract( TQRect( TQPoint( 0, 0 ), ts ) ); // And draw the rectangles (transformed inc contents coordinates as needed) - QMemArray<QRect> r = reg.rects(); + TQMemArray<TQRect> r = reg.tqrects(); for ( int i = 0; i < (int)r.count(); i++ ) { - QRect rect( viewportToContents2(r[i].topLeft()), r[i].size() ); -/* kdDebug(44021) << QString("- pEA: p->fillRect(x:%1 y:%2 w:%3 h:%4)") - .arg(rect.x()).arg(rect.y()) - .arg(rect.width()).arg(rect.height()) << endl;*/ -// p->fillRect( QRect(viewportToContents2(r[i].topLeft()),r[i].size()), d->emptyAreaColor ); + TQRect rect( viewportToContents2(r[i].topLeft()), r[i].size() ); +/* kdDebug(44021) << TQString("- pEA: p->fillRect(x:%1 y:%2 w:%3 h:%4)") + .tqarg(rect.x()).tqarg(rect.y()) + .tqarg(rect.width()).tqarg(rect.height()) << endl;*/ +// p->fillRect( TQRect(viewportToContents2(r[i].topLeft()),r[i].size()), d->emptyAreaColor ); p->fillRect( rect, d->appearance.emptyAreaColor ); -// p->fillRect( QRect(viewportToContents2(r[i].topLeft()),r[i].size()), viewport()->backgroundBrush() ); +// p->fillRect( TQRect(viewportToContents2(r[i].topLeft()),r[i].size()), viewport()->backgroundBrush() ); } } -void KexiTableView::contentsMouseDoubleClickEvent(QMouseEvent *e) +void KexiTableView::contentsMouseDoubleClickEvent(TQMouseEvent *e) { // kdDebug(44021) << "KexiTableView::contentsMouseDoubleClickEvent()" << endl; m_contentsMousePressEvent_dblClick = true; @@ -987,7 +987,7 @@ void KexiTableView::contentsMouseDoubleClickEvent(QMouseEvent *e) } else { startEditCurrentCell(); - // createEditor(m_curRow, m_curCol, QString::null); + // createEditor(m_curRow, m_curCol, TQString()); } } @@ -995,22 +995,22 @@ void KexiTableView::contentsMouseDoubleClickEvent(QMouseEvent *e) } } -void KexiTableView::contentsMousePressEvent( QMouseEvent* e ) +void KexiTableView::contentsMousePressEvent( TQMouseEvent* e ) { // kdDebug(44021) << "KexiTableView::contentsMousePressEvent() ??" << endl; setFocus(); if(m_data->count()==0 && !isInsertingEnabled()) { - QScrollView::contentsMousePressEvent( e ); + TQScrollView::contentsMousePressEvent( e ); return; } if (columnAt(e->pos().x())==-1) { //outside a colums - QScrollView::contentsMousePressEvent( e ); + TQScrollView::contentsMousePressEvent( e ); return; } // d->contentsMousePressEvent_ev = *e; // d->contentsMousePressEvent_enabled = true; -// QTimer::singleShot(2000, this, SLOT( contentsMousePressEvent_Internal() )); +// TQTimer::singleShot(2000, this, TQT_SLOT( contentsMousePressEvent_Internal() )); // d->contentsMousePressEvent_timer.start(100,true); // if (!d->contentsMousePressEvent_enabled) @@ -1022,7 +1022,7 @@ void KexiTableView::contentsMousePressEvent( QMouseEvent* e ) return; } -// kdDebug(44021)<<"void KexiTableView::contentsMousePressEvent( QMouseEvent* e ) by now the current items should be set, if not -> error + crash"<<endl; +// kdDebug(44021)<<"void KexiTableView::contentsMousePressEvent( TQMouseEvent* e ) by now the current items should be set, if not -> error + crash"<<endl; if(e->button() == Qt::RightButton) { showContextMenu(e->globalPos()); @@ -1032,19 +1032,19 @@ void KexiTableView::contentsMousePressEvent( QMouseEvent* e ) if(columnType(m_curCol) == KexiDB::Field::Boolean && columnEditable(m_curCol)) { //only accept clicking on the [x] rect (copied from KexiBoolTableEdit::setupContents()) - int s = QMAX(d->rowHeight - 5, 12); - s = QMIN( d->rowHeight-3, s ); - s = QMIN( columnWidth(m_curCol)-3, s ); //avoid too large box - const QRect r( columnPos(m_curCol) + QMAX( columnWidth(m_curCol)/2 - s/2, 0 ), rowPos(m_curRow) +d->rowHeight/2 - s/2 /*- 1*/, s, s); + int s = TQMAX(d->rowHeight - 5, 12); + s = TQMIN( d->rowHeight-3, s ); + s = TQMIN( columnWidth(m_curCol)-3, s ); //avoid too large box + const TQRect r( columnPos(m_curCol) + TQMAX( columnWidth(m_curCol)/2 - s/2, 0 ), rowPos(m_curRow) +d->rowHeight/2 - s/2 /*- 1*/, s, s); //kexidbg << r << endl; - if (r.contains(e->pos())) { + if (r.tqcontains(e->pos())) { // kexidbg << "e->x:" << e->x() << " e->y:" << e->y() << " " << rowPos(m_curRow) << // " " << columnPos(m_curCol) << endl; boolToggled(); } } #if 0 //js: TODO - else if(columnType(m_curCol) == QVariant::StringList && columnEditable(m_curCol)) + else if(columnType(m_curCol) == TQVariant::StringList && columnEditable(m_curCol)) { createEditor(m_curRow, m_curCol); } @@ -1053,7 +1053,7 @@ void KexiTableView::contentsMousePressEvent( QMouseEvent* e ) //ScrollView::contentsMousePressEvent( e ); } -void KexiTableView::contentsMouseReleaseEvent( QMouseEvent* e ) +void KexiTableView::contentsMouseReleaseEvent( TQMouseEvent* e ) { // kdDebug(44021) << "KexiTableView::contentsMousePressEvent() ??" << endl; if(m_data->count()==0 && !isInsertingEnabled()) @@ -1068,12 +1068,12 @@ void KexiTableView::contentsMouseReleaseEvent( QMouseEvent* e ) if (!m_currentItem || col==-1 || row==-1 || col!=m_curCol || row!=m_curRow)//outside a current cell return; - QScrollView::contentsMouseReleaseEvent( e ); + TQScrollView::contentsMouseReleaseEvent( e ); emit itemMouseReleased(m_currentItem, m_curRow, m_curCol); } -bool KexiTableView::handleContentsMousePressOrRelease(QMouseEvent* e, bool release) +bool KexiTableView::handleContentsMousePressOrRelease(TQMouseEvent* e, bool release) { // remember old focus cell int oldRow = m_curRow; @@ -1088,9 +1088,9 @@ bool KexiTableView::handleContentsMousePressOrRelease(QMouseEvent* e, bool relea newrow = rowAt(e->pos().y() - d->rowHeight); if (newrow==-1 && m_data->count()>0) { if (release) - QScrollView::contentsMouseReleaseEvent( e ); + TQScrollView::contentsMouseReleaseEvent( e ); else - QScrollView::contentsMousePressEvent( e ); + TQScrollView::contentsMousePressEvent( e ); return false; } newrow++; @@ -1105,9 +1105,9 @@ bool KexiTableView::handleContentsMousePressOrRelease(QMouseEvent* e, bool relea else { if (rowAt(e->pos().y())==-1 || columnAt(e->pos().x())==-1) { if (release) - QScrollView::contentsMouseReleaseEvent( e ); + TQScrollView::contentsMouseReleaseEvent( e ); else - QScrollView::contentsMousePressEvent( e ); + TQScrollView::contentsMousePressEvent( e ); return false; //clicked outside a grid } // get new focus cell @@ -1121,13 +1121,13 @@ bool KexiTableView::handleContentsMousePressOrRelease(QMouseEvent* e, bool relea return true; } -void KexiTableView::showContextMenu(const QPoint& _pos) +void KexiTableView::showContextMenu(const TQPoint& _pos) { if (!d->contextMenuEnabled || m_popupMenu->count()<1) return; - QPoint pos(_pos); - if (pos==QPoint(-1,-1)) { - pos = viewport()->mapToGlobal( QPoint( columnPos(m_curCol), rowPos(m_curRow) + d->rowHeight ) ); + TQPoint pos(_pos); + if (pos==TQPoint(-1,-1)) { + pos = viewport()->mapToGlobal( TQPoint( columnPos(m_curCol), rowPos(m_curRow) + d->rowHeight ) ); } //show own context menu if configured // if (updateContextMenu()) { @@ -1140,7 +1140,7 @@ void KexiTableView::showContextMenu(const QPoint& _pos) }*/ } -void KexiTableView::contentsMouseMoveEvent( QMouseEvent *e ) +void KexiTableView::contentsMouseMoveEvent( TQMouseEvent *e ) { int row; const int col = columnAt(e->x()); @@ -1159,7 +1159,7 @@ void KexiTableView::contentsMouseMoveEvent( QMouseEvent *e ) d->highlightedRow = row; updateRow(oldRow); updateRow(d->highlightedRow); - //currently selected (not necessary highlighted) row needs to be repainted + //currently selected (not necessary highlighted) row needs to be tqrepainted updateRow(m_curRow); m_verticalHeader->setHighlightedRow(d->highlightedRow); } @@ -1202,11 +1202,11 @@ void KexiTableView::contentsMouseMoveEvent( QMouseEvent *e ) contentsMousePressEvent(e); } #endif - QScrollView::contentsMouseMoveEvent(e); + TQScrollView::contentsMouseMoveEvent(e); } #if 0//(js) doesn't work! -void KexiTableView::contentsMouseReleaseEvent(QMouseEvent *) +void KexiTableView::contentsMouseReleaseEvent(TQMouseEvent *) { if(d->needAutoScroll) { @@ -1215,13 +1215,13 @@ void KexiTableView::contentsMouseReleaseEvent(QMouseEvent *) } #endif -static bool overrideEditorShortcutNeeded(QKeyEvent *e) +static bool overrideEditorShortcutNeeded(TQKeyEvent *e) { //perhaps more to come... - return e->key() == Qt::Key_Delete && e->state()==Qt::ControlButton; + return e->key() == TQt::Key_Delete && e->state()==TQt::ControlButton; } -bool KexiTableView::shortCutPressed( QKeyEvent *e, const QCString &action_name ) +bool KexiTableView::shortCutPressed( TQKeyEvent *e, const TQCString &action_name ) { const int k = e->key(); KAction *action = m_sharedActions[action_name]; @@ -1240,20 +1240,20 @@ bool KexiTableView::shortCutPressed( QKeyEvent *e, const QCString &action_name ) //check default shortcut (when user app has no action shortcuts defined // but we want these shortcuts to still work) if (action_name=="data_save_row") - return (k == Qt::Key_Return || k == Qt::Key_Enter) && e->state()==Qt::ShiftButton; + return (k == TQt::Key_Return || k == TQt::Key_Enter) && e->state()==TQt::ShiftButton; if (action_name=="edit_delete_row") - return k == Qt::Key_Delete && e->state()==Qt::ControlButton; + return k == TQt::Key_Delete && e->state()==TQt::ControlButton; if (action_name=="edit_delete") - return k == Qt::Key_Delete && e->state()==Qt::NoButton; + return k == TQt::Key_Delete && e->state()==Qt::NoButton; if (action_name=="edit_edititem") - return k == Qt::Key_F2 && e->state()==Qt::NoButton; + return k == TQt::Key_F2 && e->state()==Qt::NoButton; if (action_name=="edit_insert_empty_row") - return k == Qt::Key_Insert && e->state()==(Qt::ShiftButton | Qt::ControlButton); + return k == TQt::Key_Insert && e->state()==(TQt::ShiftButton | TQt::ControlButton); return false; } -void KexiTableView::keyPressEvent(QKeyEvent* e) +void KexiTableView::keyPressEvent(TQKeyEvent* e) { if (!hasData()) return; @@ -1261,10 +1261,10 @@ void KexiTableView::keyPressEvent(QKeyEvent* e) const int k = e->key(); const bool ro = isReadOnly(); - QWidget *w = focusWidget(); + TQWidget *w = tqfocusWidget(); // if (!w || w!=viewport() && w!=this && (!m_editor || w!=m_editor->view() && w!=m_editor)) { // if (!w || w!=viewport() && w!=this && (!m_editor || w!=m_editor->view())) { - if (!w || w!=viewport() && w!=this && (!m_editor || !KexiUtils::hasParent(dynamic_cast<QObject*>(m_editor), w))) { + if (!w || TQT_BASE_OBJECT(w)!=TQT_BASE_OBJECT(viewport()) && TQT_TQOBJECT(w)!=TQT_TQOBJECT(this) && (!m_editor || !KexiUtils::hasParent(TQT_TQOBJECT(dynamic_cast<TQT_BASE_OBJECT_NAME*>(m_editor)), TQT_TQOBJECT(w)))) { //don't process stranger's events e->ignore(); return; @@ -1286,11 +1286,11 @@ void KexiTableView::keyPressEvent(QKeyEvent* e) } if(m_editor) {// if a cell is edited, do some special stuff - if (k == Qt::Key_Escape) { + if (k == TQt::Key_Escape) { cancelEditor(); e->accept(); return; - } else if (k == Qt::Key_Return || k == Qt::Key_Enter) { + } else if (k == TQt::Key_Return || k == TQt::Key_Enter) { if (columnType(m_curCol) == KexiDB::Field::Boolean) { boolToggled(); } @@ -1309,7 +1309,7 @@ void KexiTableView::keyPressEvent(QKeyEvent* e) } } - if(k == Qt::Key_Return || k == Qt::Key_Enter) + if(k == TQt::Key_Return || k == TQt::Key_Enter) { emit itemReturnPressed(m_currentItem, m_curRow, m_curCol); } @@ -1317,7 +1317,7 @@ void KexiTableView::keyPressEvent(QKeyEvent* e) int curRow = m_curRow; int curCol = m_curCol; - const bool nobtn = e->state()==NoButton; + const bool nobtn = e->state()==Qt::NoButton; bool printable = false; //check shared shortcuts @@ -1338,8 +1338,8 @@ void KexiTableView::keyPressEvent(QKeyEvent* e) } } -/* case Qt::Key_Delete: - if (e->state()==Qt::ControlButton) {//remove current row +/* case TQt::Key_Delete: + if (e->state()==TQt::ControlButton) {//remove current row deleteCurrentRow(); } else if (nobtn) {//remove contents of the current cell @@ -1348,18 +1348,18 @@ void KexiTableView::keyPressEvent(QKeyEvent* e) break;*/ // bool _return; - if (k == Qt::Key_Shift || k == Qt::Key_Alt || k == Qt::Key_Control || k == Qt::Key_Meta) { + if (k == TQt::Key_Shift || k == TQt::Key_Alt || k == TQt::Key_Control || k == TQt::Key_Meta) { e->ignore(); } else if (KexiDataAwareObjectInterface::handleKeyPress(e, curRow, curCol, d->appearance.fullRowSelection)) { if (e->isAccepted()) return; } - else if (k == Qt::Key_Backspace && nobtn) { + else if (k == TQt::Key_Backspace && nobtn) { if (!ro && columnType(curCol) != KexiDB::Field::Boolean && columnEditable(curCol)) - createEditor(curRow, curCol, QString::null, true); + createEditor(curRow, curCol, TQString(), true); } - else if (k == Qt::Key_Space) { + else if (k == TQt::Key_Space) { if (nobtn && !ro && columnEditable(curCol)) { if (columnType(curCol) == KexiDB::Field::Boolean) { boolToggled(); @@ -1368,7 +1368,7 @@ void KexiTableView::keyPressEvent(QKeyEvent* e) printable = true; //just space key } } - else if (k == Qt::Key_Escape) { + else if (k == TQt::Key_Escape) { if (nobtn && m_rowEditing) { cancelRowEdit(); return; @@ -1376,8 +1376,8 @@ void KexiTableView::keyPressEvent(QKeyEvent* e) } else { //others: - if (nobtn && (k==Qt::Key_Tab || k==Qt::Key_Right)) { -//! \todo add option for stopping at 1st column for Qt::Key_left + if (nobtn && (k==TQt::Key_Tab || k==TQt::Key_Right)) { +//! \todo add option for stopping at 1st column for TQt::Key_left //tab if (acceptEditor()) { if (curCol == (columns() - 1)) { @@ -1390,10 +1390,10 @@ void KexiTableView::keyPressEvent(QKeyEvent* e) curCol++; } } - else if ((e->state()==Qt::ShiftButton && k==Qt::Key_Tab) - || (nobtn && k==Qt::Key_Backtab) - || (e->state()==Qt::ShiftButton && k==Qt::Key_Backtab) - || (nobtn && k==Qt::Key_Left) + else if ((e->state()==TQt::ShiftButton && k==TQt::Key_Tab) + || (nobtn && k==TQt::Key_Backtab) + || (e->state()==TQt::ShiftButton && k==TQt::Key_Backtab) + || (nobtn && k==TQt::Key_Left) ) { //! \todo add option for stopping at last column //backward tab @@ -1408,7 +1408,7 @@ void KexiTableView::keyPressEvent(QKeyEvent* e) curCol--; } } - else if (nobtn && k==d->contextMenuKey) { //Qt::Key_Menu: + else if (nobtn && k==d->contextMenuKey) { //TQt::Key_Menu: showContextMenu(); } else { @@ -1418,16 +1418,16 @@ void KexiTableView::keyPressEvent(QKeyEvent* e) e->accept(); return; } - else if ( nobtn && (k==Qt::Key_Enter || k==Qt::Key_Return || shortCutPressed(e, "edit_edititem")) ) { + else if ( nobtn && (k==TQt::Key_Enter || k==TQt::Key_Return || shortCutPressed(e, "edit_edititem")) ) { //this condition is moved after handleKeyPress() to allow to everride enter key as well startEditOrToggleValue(); } else { kexidbg << "KexiTableView::KeyPressEvent(): default" << endl; if (e->text().isEmpty() || !e->text().isEmpty() && !e->text()[0].isPrint() ) { - kdDebug(44021) << "NOT PRINTABLE: 0x0" << QString("%1").arg(k,0,16) <<endl; + kdDebug(44021) << "NOT PRINTABLE: 0x0" << TQString("%1").tqarg(k,0,16) <<endl; // e->ignore(); - QScrollView::keyPressEvent(e); + TQScrollView::keyPressEvent(e); return; } printable = true; @@ -1437,7 +1437,7 @@ void KexiTableView::keyPressEvent(QKeyEvent* e) //finally: we've printable char: if (printable && !ro) { KexiTableViewColumn *tvcol = m_data->column(curCol); - if (tvcol->acceptsFirstChar(e->text()[0])) { + if (tvcol->acceptsFirstChar(TQString(e->text())[0])) { kdDebug(44021) << "KexiTableView::KeyPressEvent(): ev pressed: acceptsFirstChar()==true" << endl; // if (e->text()[0].isPrint()) createEditor(curRow, curCol, e->text(), true); @@ -1450,7 +1450,7 @@ void KexiTableView::keyPressEvent(QKeyEvent* e) m_vScrollBarValueChanged_enabled=false; - // if focus cell changes, repaint + // if focus cell changes, tqrepaint setCursorPosition(curRow, curCol); m_vScrollBarValueChanged_enabled=true; @@ -1495,9 +1495,9 @@ KexiDataItemInterface *KexiTableView::editor( int col, bool ignoreMissingEditor if (m_data->cursor() && m_data->cursor()->query()) editor->createInternalEditor(*m_data->cursor()->query()); - connect(editor,SIGNAL(editRequested()),this,SLOT(slotEditRequested())); - connect(editor,SIGNAL(cancelRequested()),this,SLOT(cancelEditor())); - connect(editor,SIGNAL(acceptRequested()),this,SLOT(acceptEditor())); + connect(editor,TQT_SIGNAL(editRequested()),this,TQT_SLOT(slotEditRequested())); + connect(editor,TQT_SIGNAL(cancelRequested()),this,TQT_SLOT(cancelEditor())); + connect(editor,TQT_SIGNAL(acceptRequested()),this,TQT_SLOT(acceptEditor())); editor->resize(columnWidth(col)-1, rowHeight()-1); editor->installEventFilter(this); @@ -1518,7 +1518,7 @@ void KexiTableView::editorShowFocus( int /*row*/, int col ) }*/ if (edit) { kexidbg<< "KexiTableView::editorShowFocus() : IN" << endl; - QRect rect = cellGeometry( m_curRow, m_curCol ); + TQRect rect = cellGeometry( m_curRow, m_curCol ); // rect.moveBy( -contentsX(), -contentsY() ); edit->showFocus( rect, isReadOnly() || m_data->column(col)->isReadOnly() ); } @@ -1534,7 +1534,7 @@ void KexiTableView::reloadData() { updateContents(); } -void KexiTableView::createEditor(int row, int col, const QString& addText, bool removeOld) +void KexiTableView::createEditor(int row, int col, const TQString& addText, bool removeOld) { kdDebug(44021) << "KexiTableView::createEditor('"<<addText<<"',"<<removeOld<<")"<<endl; if (isReadOnly()) { @@ -1569,7 +1569,7 @@ void KexiTableView::createEditor(int row, int col, const QString& addText, bool //refr. current and next row updateContents(columnPos(0), rowPos(row), viewport()->width(), d->rowHeight*2); // updateContents(columnPos(0), rowPos(row+1), viewport()->width(), d->rowHeight); -//js: warning this breaks behaviour (cursor is skipping, etc.): qApp->processEvents(500); +//js: warning this breaks behaviour (cursor is skipping, etc.): tqApp->processEvents(500); ensureVisible(columnPos(m_curCol), rowPos(row+1)+d->rowHeight-1, columnWidth(m_curCol), d->rowHeight); m_verticalHeader->setOffset(contentsY()); @@ -1598,13 +1598,13 @@ void KexiTableView::createEditor(int row, int col, const QString& addText, bool } } -void KexiTableView::focusInEvent(QFocusEvent* e) +void KexiTableView::focusInEvent(TQFocusEvent* e) { Q_UNUSED(e); updateCell(m_curRow, m_curCol); } -void KexiTableView::focusOutEvent(QFocusEvent* e) +void KexiTableView::focusOutEvent(TQFocusEvent* e) { KexiDataAwareObjectInterface::focusOutEvent(e); } @@ -1614,12 +1614,12 @@ bool KexiTableView::focusNextPrevChild(bool /*next*/) return false; //special Tab/BackTab meaning /* if (m_editor) return true; - return QScrollView::focusNextPrevChild(next);*/ + return TQScrollView::focusNextPrevChild(next);*/ } -void KexiTableView::resizeEvent(QResizeEvent *e) +void KexiTableView::resizeEvent(TQResizeEvent *e) { - QScrollView::resizeEvent(e); + TQScrollView::resizeEvent(e); //updateGeometries(); if (m_navPanel) @@ -1630,34 +1630,34 @@ void KexiTableView::resizeEvent(QResizeEvent *e) slotUpdate(); triggerUpdate(); } -// d->pTopHeader->repaint(); +// d->pTopHeader->tqrepaint(); /* m_navPanel->setGeometry( frameWidth(), viewport()->height() +d->pTopHeader->height() - -(horizontalScrollBar()->isVisible() ? 0 : horizontalScrollBar()->sizeHint().height()) + -(horizontalScrollBar()->isVisible() ? 0 : horizontalScrollBar()->tqsizeHint().height()) +frameWidth(), - m_navPanel->sizeHint().width(), // - verticalScrollBar()->sizeHint().width() - horizontalScrollBar()->sizeHint().width(), - horizontalScrollBar()->sizeHint().height() + m_navPanel->tqsizeHint().width(), // - verticalScrollBar()->tqsizeHint().width() - horizontalScrollBar()->tqsizeHint().width(), + horizontalScrollBar()->tqsizeHint().height() );*/ // updateContents(); // m_navPanel->setGeometry(1,horizontalScrollBar()->pos().y(), // m_navPanel->width(), horizontalScrollBar()->height()); // updateContents(0,0,2000,2000);//js -// erase(); repaint(); +// erase(); tqrepaint(); } -void KexiTableView::viewportResizeEvent( QResizeEvent *e ) +void KexiTableView::viewportResizeEvent( TQResizeEvent *e ) { - QScrollView::viewportResizeEvent( e ); + TQScrollView::viewportResizeEvent( e ); updateGeometries(); -// erase(); repaint(); +// erase(); tqrepaint(); } -void KexiTableView::showEvent(QShowEvent *e) +void KexiTableView::showEvent(TQShowEvent *e) { - QScrollView::showEvent(e); + TQScrollView::showEvent(e); if (!d->maximizeColumnsWidthOnShow.isEmpty()) { maximizeColumnsWidth(d->maximizeColumnsWidthOnShow); d->maximizeColumnsWidthOnShow.clear(); @@ -1670,29 +1670,29 @@ void KexiTableView::showEvent(QShowEvent *e) } else { //just update size - QSize s(tableSize()); -// QRect r(cellGeometry(rows() - 1 + (isInsertingEnabled()?1:0), columns() - 1 )); + TQSize s(tableSize()); +// TQRect r(cellGeometry(rows() - 1 + (isInsertingEnabled()?1:0), columns() - 1 )); // resizeContents(r.right() + 1, r.bottom() + 1); resizeContents(s.width(),s.height()); } updateGeometries(); //now we can ensure cell's visibility ( if there was such a call before show() ) - if (d->ensureCellVisibleOnShow!=QPoint(-1,-1)) { + if (d->ensureCellVisibleOnShow!=TQPoint(-1,-1)) { ensureCellVisible( d->ensureCellVisibleOnShow.x(), d->ensureCellVisibleOnShow.y() ); - d->ensureCellVisibleOnShow = QPoint(-1,-1); //reset the flag + d->ensureCellVisibleOnShow = TQPoint(-1,-1); //reset the flag } if (m_navPanel) m_navPanel->updateGeometry(leftMargin()); // updateNavPanelGeometry(); } -void KexiTableView::contentsDragMoveEvent(QDragMoveEvent *e) +void KexiTableView::contentsDragMoveEvent(TQDragMoveEvent *e) { if (!hasData()) return; if (m_dropsAtRowEnabled) { - QPoint p = e->pos(); + TQPoint p = e->pos(); int row = rowAt(p.y()); KexiTableItem *item = 0; // if (row==(rows()-1) && (p.y() % d->rowHeight) > (d->rowHeight*2/3) ) { @@ -1721,7 +1721,7 @@ void KexiTableView::contentsDragMoveEvent(QDragMoveEvent *e) } else e->acceptAction(false); -/* QStringList::ConstIterator it, end( d->dropFilters.constEnd() ); +/* TQStringList::ConstIterator it, end( d->dropFilters.constEnd() ); for( it = d->dropFilters.constBegin(); it != end; it++) { if(e->provides((*it).latin1())) @@ -1733,7 +1733,7 @@ void KexiTableView::contentsDragMoveEvent(QDragMoveEvent *e) // e->acceptAction(false); } -void KexiTableView::contentsDropEvent(QDropEvent *e) +void KexiTableView::contentsDropEvent(TQDropEvent *e) { if (!hasData()) return; @@ -1744,7 +1744,7 @@ void KexiTableView::contentsDropEvent(QDropEvent *e) m_dragIndicatorLine = -1; updateRow(row2update); } - QPoint p = e->pos(); + TQPoint p = e->pos(); int row = rowAt(p.y()); if ((p.y() % d->rowHeight) > (d->rowHeight*2/3) ) { row++; @@ -1761,7 +1761,7 @@ void KexiTableView::contentsDropEvent(QDropEvent *e) } } -void KexiTableView::viewportDragLeaveEvent( QDragLeaveEvent *e ) +void KexiTableView::viewportDragLeaveEvent( TQDragLeaveEvent *e ) { Q_UNUSED(e); if (!hasData()) @@ -1780,7 +1780,7 @@ void KexiTableView::updateCell(int row, int col) { // kdDebug(44021) << "updateCell("<<row<<", "<<col<<")"<<endl; updateContents(cellGeometry(row, col)); -/* QRect r = cellGeometry(row, col); +/* TQRect r = cellGeometry(row, col); r.setHeight(r.height()+6); r.setTop(r.top()-3); updateContents();*/ @@ -1799,30 +1799,30 @@ void KexiTableView::updateRow(int row) //int leftcol = d->pTopHeader->sectionAt( d->pTopHeader->offset() ); //kexidbg << contentsX() << " " << contentsY() << endl; - //kexidbg << QRect( columnPos( leftcol ), rowPos(row), clipper()->width(), rowHeight() ) << endl; - // updateContents( QRect( columnPos( leftcol ), rowPos(row), clipper()->width(), rowHeight() ) ); //columnPos(rightcol)+columnWidth(rightcol), rowHeight() ) ); - updateContents( QRect( contentsX(), rowPos(row), clipper()->width(), rowHeight() ) ); //columnPos(rightcol)+columnWidth(rightcol), rowHeight() ) ); + //kexidbg << TQRect( columnPos( leftcol ), rowPos(row), clipper()->width(), rowHeight() ) << endl; + // updateContents( TQRect( columnPos( leftcol ), rowPos(row), clipper()->width(), rowHeight() ) ); //columnPos(rightcol)+columnWidth(rightcol), rowHeight() ) ); + updateContents( TQRect( contentsX(), rowPos(row), clipper()->width(), rowHeight() ) ); //columnPos(rightcol)+columnWidth(rightcol), rowHeight() ) ); } void KexiTableView::slotColumnWidthChanged( int, int, int ) { - QSize s(tableSize()); + TQSize s(tableSize()); int w = contentsWidth(); viewport()->setUpdatesEnabled(false); resizeContents( s.width(), s.height() ); viewport()->setUpdatesEnabled(true); if (contentsWidth() < w) { updateContents(contentsX(), 0, viewport()->width(), contentsHeight()); -// repaintContents( s.width(), 0, w - s.width() + 1, contentsHeight(), true ); +// tqrepaintContents( s.width(), 0, w - s.width() + 1, contentsHeight(), true ); } else { // updateContents( columnPos(col), 0, contentsWidth(), contentsHeight() ); updateContents(contentsX(), 0, viewport()->width(), contentsHeight()); - // viewport()->repaint(); + // viewport()->tqrepaint(); } // updateContents(0, 0, d->pBufferPm->width(), d->pBufferPm->height()); - QWidget *editorWidget = dynamic_cast<QWidget*>(m_editor); + TQWidget *editorWidget = dynamic_cast<TQWidget*>(m_editor); if (editorWidget) { editorWidget->resize(columnWidth(m_curCol)-1, rowHeight()-1); @@ -1844,7 +1844,7 @@ void KexiTableView::slotSectionHandleDoubleClicked( int section ) void KexiTableView::updateGeometries() { - QSize ts = tableSize(); + TQSize ts = tableSize(); if (m_horizontalHeader->offset() && ts.width() < (m_horizontalHeader->offset() + m_horizontalHeader->width())) horizontalScrollBar()->setValue(ts.width() - m_horizontalHeader->width()); @@ -1871,7 +1871,7 @@ int KexiTableView::columnPos(int col) const if (!hasData()) return 0; //if this column is hidden, find first column before that is visible - int c = QMIN(col, (int)m_data->columnsCount()-1), vcID = 0; + int c = TQMIN(col, (int)m_data->columnsCount()-1), vcID = 0; while (c>=0 && (vcID=m_data->visibleColumnID( c ))==-1) c--; if (c<0) @@ -1912,67 +1912,67 @@ int KexiTableView::rowAt(int pos, bool ignoreEnd) const return pos; } -QRect KexiTableView::cellGeometry(int row, int col) const +TQRect KexiTableView::cellGeometry(int row, int col) const { - return QRect(columnPos(col), rowPos(row), + return TQRect(columnPos(col), rowPos(row), columnWidth(col), rowHeight()); } -QSize KexiTableView::tableSize() const +TQSize KexiTableView::tableSize() const { if ((rows()+ (isInsertingEnabled()?1:0) ) > 0 && columns() > 0) { /* kexidbg << "tableSize()= " << columnPos( columns() - 1 ) + columnWidth( columns() - 1 ) << ", " << rowPos( rows()-1+(isInsertingEnabled()?1:0)) + d->rowHeight -// + QMAX(m_navPanel ? m_navPanel->height() : 0, horizontalScrollBar()->sizeHint().height()) - + (m_navPanel->isVisible() ? QMAX( m_navPanel->height(), horizontalScrollBar()->sizeHint().height() ) :0 ) +// + TQMAX(m_navPanel ? m_navPanel->height() : 0, horizontalScrollBar()->tqsizeHint().height()) + + (m_navPanel->isVisible() ? TQMAX( m_navPanel->height(), horizontalScrollBar()->tqsizeHint().height() ) :0 ) + margin() << endl; */ // kexidbg<< m_navPanel->isVisible() <<" "<<m_navPanel->height()<<" " -// <<horizontalScrollBar()->sizeHint().height()<<" "<<rowPos( rows()-1+(isInsertingEnabled()?1:0))<<endl; +// <<horizontalScrollBar()->tqsizeHint().height()<<" "<<rowPos( rows()-1+(isInsertingEnabled()?1:0))<<endl; - //int xx = horizontalScrollBar()->sizeHint().height()/2; + //int xx = horizontalScrollBar()->tqsizeHint().height()/2; - QSize s( + TQSize s( columnPos( columns() - 1 ) + columnWidth( columns() - 1 ), -// + verticalScrollBar()->sizeHint().width(), +// + verticalScrollBar()->tqsizeHint().width(), rowPos( rows()-1+(isInsertingEnabled()?1:0) ) + d->rowHeight - + (horizontalScrollBar()->isVisible() ? 0 : horizontalScrollBar()->sizeHint().height()) + + (horizontalScrollBar()->isVisible() ? 0 : horizontalScrollBar()->tqsizeHint().height()) + d->internal_bottomMargin -// horizontalScrollBar()->sizeHint().height()/2 -// - /*d->bottomMargin */ horizontalScrollBar()->sizeHint().height()*3/2 +// horizontalScrollBar()->tqsizeHint().height()/2 +// - /*d->bottomMargin */ horizontalScrollBar()->tqsizeHint().height()*3/2 // + ( (m_navPanel && m_navPanel->isVisible() && verticalScrollBar()->isVisible() // && !horizontalScrollBar()->isVisible()) - // ? horizontalScrollBar()->sizeHint().height() : 0) + // ? horizontalScrollBar()->tqsizeHint().height() : 0) -// + QMAX( (m_navPanel && m_navPanel->isVisible()) ? m_navPanel->height() : 0, -// horizontalScrollBar()->isVisible() ? horizontalScrollBar()->sizeHint().height() : 0) +// + TQMAX( (m_navPanel && m_navPanel->isVisible()) ? m_navPanel->height() : 0, +// horizontalScrollBar()->isVisible() ? horizontalScrollBar()->tqsizeHint().height() : 0) // + (m_navPanel->isVisible() -// ? QMAX( m_navPanel->height(), horizontalScrollBar()->sizeHint().height() ) :0 ) +// ? TQMAX( m_navPanel->height(), horizontalScrollBar()->tqsizeHint().height() ) :0 ) -// - (horizontalScrollBar()->isVisible() ? horizontalScrollBar()->sizeHint().height() :0 ) +// - (horizontalScrollBar()->isVisible() ? horizontalScrollBar()->tqsizeHint().height() :0 ) + margin() //-2*d->rowHeight ); // kexidbg << rows()-1 <<" "<< (isInsertingEnabled()?1:0) <<" "<< (m_rowEditing?1:0) << " " << s << endl; return s; -// +horizontalScrollBar()->sizeHint().height() + margin() ); +// +horizontalScrollBar()->tqsizeHint().height() + margin() ); } - return QSize(0,0); + return TQSize(0,0); } void KexiTableView::ensureCellVisible(int row, int col/*=-1*/) { if (!isVisible()) { //the table is invisible: we can't ensure visibility now - d->ensureCellVisibleOnShow = QPoint(row,col); + d->ensureCellVisibleOnShow = TQPoint(row,col); return; } //quite clever: ensure the cell is visible: - QRect r( columnPos(col==-1 ? m_curCol : col), rowPos(row) +(d->appearance.fullRowSelection?1:0), + TQRect r( columnPos(col==-1 ? m_curCol : col), rowPos(row) +(d->appearance.fullRowSelection?1:0), columnWidth(col==-1 ? m_curCol : col), rowHeight()); /* if (m_navPanel && horizontalScrollBar()->isHidden() && row == rows()-1) { @@ -1988,7 +1988,7 @@ void KexiTableView::ensureCellVisible(int row, int col/*=-1*/) r.setBottom(r.bottom()+m_navPanel->height()); } - QPoint pcenter = r.center(); + TQPoint pcenter = r.center(); ensureVisible(pcenter.x(), pcenter.y(), r.width()/2, r.height()/2); // updateContents(); // updateNavPanelGeometry(); @@ -2007,13 +2007,13 @@ void KexiTableView::updateAfterAcceptRowEdit() m_navPanel->showEditingIndicator(false); } -bool KexiTableView::getVisibleLookupValue(QVariant& cellValue, KexiTableEdit *edit, +bool KexiTableView::getVisibleLookupValue(TQVariant& cellValue, KexiTableEdit *edit, KexiTableItem *item, KexiTableViewColumn *tvcol) const { if (edit->columnInfo() && edit->columnInfo()->indexForVisibleLookupValue()!=-1 && edit->columnInfo()->indexForVisibleLookupValue() < (int)item->count()) { - const QVariant *visibleFieldValue = 0; + const TQVariant *visibleFieldValue = 0; if (m_currentItem == item && m_data->rowEditBuffer()) { visibleFieldValue = m_data->rowEditBuffer()->at( *tvcol->visibleLookupColumnInfo, false/*!useDefaultValueIfPossible*/ ); @@ -2040,7 +2040,7 @@ void KexiTableView::removeEditor() void KexiTableView::slotRowRepaintRequested(KexiTableItem& item) { - updateRow( m_data->findRef(&item) ); + updateRow( m_data->tqfindRef(&item) ); } //(js) unused @@ -2081,15 +2081,15 @@ KexiTableView::print(KPrinter &/*printer*/) int bottomMargin = 0; kdDebug(44021) << "KexiTableView::print: bottom = " << bottomMargin << endl; - QPainter p(&printer); + TQPainter p(&printer); KexiTableItem *i; int width = leftMargin; for(int col=0; col < columns(); col++) { - p.fillRect(width, topMargin - d->rowHeight, columnWidth(col), d->rowHeight, QBrush(Qt::gray)); + p.fillRect(width, topMargin - d->rowHeight, columnWidth(col), d->rowHeight, TQBrush(TQt::gray)); p.drawRect(width, topMargin - d->rowHeight, columnWidth(col), d->rowHeight); - p.drawText(width, topMargin - d->rowHeight, columnWidth(col), d->rowHeight, Qt::AlignLeft | Qt::AlignVCenter, + p.drawText(width, topMargin - d->rowHeight, columnWidth(col), d->rowHeight, TQt::AlignLeft | TQt::AlignVCenter, m_horizontalHeader->label(col)); width = width + columnWidth(col); } @@ -2107,7 +2107,7 @@ KexiTableView::print(KPrinter &/*printer*/) kdDebug(44021) << "KexiTableView::print: col = " << col << " x = " << xOffset << endl; p.saveWorldMatrix(); p.translate(xOffset, yOffset); - paintCell(&p, i, col, QRect(0, 0, columnWidth(col) + 1, d->rowHeight), true); + paintCell(&p, i, col, TQRect(0, 0, columnWidth(col) + 1, d->rowHeight), true); p.restoreWorldMatrix(); // p.drawRect(xOffset, yOffset, columnWidth(col), d->rowHeight); xOffset = xOffset + columnWidth(col); @@ -2136,7 +2136,7 @@ KexiTableView::print(KPrinter &/*printer*/) } #endif -QString KexiTableView::columnCaption(int colNum) const +TQString KexiTableView::columnCaption(int colNum) const { return m_horizontalHeader->label(colNum); } @@ -2167,14 +2167,14 @@ void KexiTableView::adjustColumnWidthToContents(int colNum) if (indexOfVisibleColumn < 0) return; - QPtrListIterator<KexiTableItem> it = m_data->iterator(); + TQPtrListIterator<KexiTableItem> it = m_data->iterator(); if (it.current() && it.current()->count()<=(uint)indexOfVisibleColumn) return; KexiCellEditorFactoryItem *item = KexiCellEditorFactory::item( columnType(indexOfVisibleColumn) ); if (!item) return; - QFontMetrics fm(fontMetrics()); + TQFontMetrics fm(fontMetrics()); int maxw = horizontalHeaderVisible() ? fm.width( m_horizontalHeader->label( colNum/* not indexOfVisibleColumn*/ ) ) : 0; if (maxw == 0 && m_data->isEmpty()) @@ -2186,7 +2186,7 @@ void KexiTableView::adjustColumnWidthToContents(int colNum) if (ed) { for (it = m_data->iterator(); it.current(); ++it) { const int wfw = ed->widthForValue( it.current()->at( indexOfVisibleColumn ), fm ); - maxw = QMAX( maxw, wfw ); + maxw = TQMAX( maxw, wfw ); } const bool focused = currentColumn() == colNum; maxw += (fm.width(" ") + ed->leftMargin() + ed->rightMargin(focused)); @@ -2207,7 +2207,7 @@ void KexiTableView::setColumnWidth(int colNum, int width) slotTopHeaderSizeChange( colNum, oldWidth, m_horizontalHeader->sectionSize( colNum ) ); } -void KexiTableView::maximizeColumnsWidth( const QValueList<int> &columnList ) +void KexiTableView::maximizeColumnsWidth( const TQValueList<int> &columnList ) { if (!isVisible()) { d->maximizeColumnsWidthOnShow += columnList; @@ -2216,11 +2216,11 @@ void KexiTableView::maximizeColumnsWidth( const QValueList<int> &columnList ) if (width() <= m_horizontalHeader->headerWidth()) return; //sort the list and make it unique - QValueList<int> cl, sortedList = columnList; + TQValueList<int> cl, sortedList = columnList; qHeapSort(sortedList); int i=-999; - QValueList<int>::ConstIterator it, end( sortedList.constEnd() ); + TQValueList<int>::ConstIterator it, end( sortedList.constEnd() ); for ( it = sortedList.constBegin(); it != end; ++it) { if (i != (*it)) { cl += (*it); @@ -2271,13 +2271,13 @@ void KexiTableView::setVerticalHeaderVisible(bool set) int left_width; if (set) { m_verticalHeader->show(); - left_width = QMIN(m_horizontalHeader->sizeHint().height(), d->rowHeight); + left_width = TQMIN(m_horizontalHeader->tqsizeHint().height(), d->rowHeight); } else { m_verticalHeader->hide(); left_width = 0; } - setMargins( left_width, horizontalHeaderVisible() ? m_horizontalHeader->sizeHint().height() : 0, 0, 0); + setMargins( left_width, horizontalHeaderVisible() ? m_horizontalHeader->tqsizeHint().height() : 0, 0, 0); } bool KexiTableView::horizontalHeaderVisible() const @@ -2291,7 +2291,7 @@ void KexiTableView::setHorizontalHeaderVisible(bool set) d->horizontalHeaderVisible = set; //needed because isVisible() is not always accurate if (set) { m_horizontalHeader->show(); - top_height = m_horizontalHeader->sizeHint().height(); + top_height = m_horizontalHeader->tqsizeHint().height(); } else { m_horizontalHeader->hide(); @@ -2308,7 +2308,7 @@ void KexiTableView::triggerUpdate() // d->pUpdateTimer->start(200, true); } -void KexiTableView::setHBarGeometry( QScrollBar & hbar, int x, int y, int w, int h ) +void KexiTableView::setHBarGeometry( TQScrollBar & hbar, int x, int y, int w, int h ) { /*todo*/ kdDebug(44021)<<"KexiTableView::setHBarGeometry"<<endl; @@ -2329,7 +2329,7 @@ void KexiTableView::setSpreadSheetMode() setAppearance( a ); } -int KexiTableView::validRowNumber(const QString& text) +int KexiTableView::validRowNumber(const TQString& text) { bool ok=true; int r = text.toInt(&ok); @@ -2376,11 +2376,11 @@ void KexiTableView::copySelection() { if (m_currentItem && m_curCol!=-1) { KexiTableEdit *edit = tableEditorWidget( m_curCol ); - QVariant defaultValue; + TQVariant defaultValue; const bool defaultValueDisplayed = isDefaultValueDisplayed(m_currentItem, m_curCol, &defaultValue); if (edit) { - QVariant visibleValue; + TQVariant visibleValue; getVisibleLookupValue(visibleValue, edit, m_currentItem, m_data->column(m_curCol)); edit->handleCopyAction( defaultValueDisplayed ? defaultValue : m_currentItem->at( m_curCol ), @@ -2405,14 +2405,14 @@ void KexiTableView::paste() edit->handleAction("edit_paste"); } -bool KexiTableView::eventFilter( QObject *o, QEvent *e ) +bool KexiTableView::eventFilter( TQObject *o, TQEvent *e ) { //don't allow to stole key my events by others: // kexidbg << "spontaneous " << e->spontaneous() << " type=" << e->type() << endl; - if (e->type()==QEvent::KeyPress) { - if (e->spontaneous() /*|| e->type()==QEvent::AccelOverride*/) { - QKeyEvent *ke = static_cast<QKeyEvent*>(e); + if (e->type()==TQEvent::KeyPress) { + if (e->spontaneous() /*|| e->type()==TQEvent::AccelOverride*/) { + TQKeyEvent *ke = TQT_TQKEYEVENT(e); const int k = ke->key(); int s = ke->state(); //cell editor's events: @@ -2422,12 +2422,12 @@ bool KexiTableView::eventFilter( QObject *o, QEvent *e ) ke->accept(); return true; } - else if (m_editor && (o==dynamic_cast<QObject*>(m_editor) || o==m_editor->widget())) { - if ( (k==Qt::Key_Tab && (s==Qt::NoButton || s==Qt::ShiftButton)) + else if (m_editor && (o==dynamic_cast<TQT_BASE_OBJECT_NAME*>(m_editor) || TQT_BASE_OBJECT(o)==TQT_BASE_OBJECT(m_editor->widget()))) { + if ( (k==TQt::Key_Tab && (s==Qt::NoButton || s==TQt::ShiftButton)) || (overrideEditorShortcutNeeded(ke)) - || (k==Qt::Key_Enter || k==Qt::Key_Return || k==Qt::Key_Up || k==Qt::Key_Down) - || (k==Qt::Key_Left && m_editor->cursorAtStart()) - || (k==Qt::Key_Right && m_editor->cursorAtEnd()) + || (k==TQt::Key_Enter || k==TQt::Key_Return || k==TQt::Key_Up || k==TQt::Key_Down) + || (k==TQt::Key_Left && m_editor->cursorAtStart()) + || (k==TQt::Key_Right && m_editor->cursorAtEnd()) ) { //try to steal the key press from editor or it's internal widget... @@ -2437,12 +2437,12 @@ bool KexiTableView::eventFilter( QObject *o, QEvent *e ) } } /* - else if (e->type()==QEvent::KeyPress && (o==this || (m_editor && o==m_editor->widget()))){//|| o==viewport()) + else if (e->type()==TQEvent::KeyPress && (o==this || (m_editor && o==m_editor->widget()))){//|| o==viewport()) keyPressEvent(ke); if (ke->isAccepted()) return true; }*/ -/*todo else if ((k==Qt::Key_Tab || k==(Qt::SHIFT|Qt::Key_Tab)) && o==d->navRowNumber) { +/*todo else if ((k==TQt::Key_Tab || k==(TQt::SHIFT|TQt::Key_Tab)) && o==d->navRowNumber) { //tab key focuses tv ke->accept(); setFocus(); @@ -2450,14 +2450,14 @@ bool KexiTableView::eventFilter( QObject *o, QEvent *e ) }*/ } } - else if (o==horizontalScrollBar()) { - if ((e->type()==QEvent::Show && !horizontalScrollBar()->isVisible()) - || (e->type()==QEvent::Hide && horizontalScrollBar()->isVisible())) { + else if (TQT_BASE_OBJECT(o)==TQT_BASE_OBJECT(horizontalScrollBar())) { + if ((e->type()==TQEvent::Show && !horizontalScrollBar()->isVisible()) + || (e->type()==TQEvent::Hide && horizontalScrollBar()->isVisible())) { updateWidgetContentsSize(); } } - else if (e->type()==QEvent::Leave) { - if (o==viewport() && d->appearance.rowMouseOverHighlightingEnabled + else if (e->type()==TQEvent::Leave) { + if (TQT_BASE_OBJECT(o)==TQT_BASE_OBJECT(viewport()) && d->appearance.rowMouseOverHighlightingEnabled && d->appearance.persistentSelections) { if (d->highlightedRow!=-1) { @@ -2474,22 +2474,22 @@ bool KexiTableView::eventFilter( QObject *o, QEvent *e ) } } } - d->recentCellWithToolTip = QPoint(-1,-1); + d->recentCellWithToolTip = TQPoint(-1,-1); } -/* else if (e->type()==QEvent::FocusOut && o->inherits("QWidget")) { +/* else if (e->type()==TQEvent::FocusOut && o->inherits(TQWIDGET_OBJECT_NAME_STRING)) { //hp==true if currently focused widget is a child of this table view - const bool hp = KexiUtils::hasParent( static_cast<QWidget*>(o), focusWidget()); - if (!hp && KexiUtils::hasParent( this, static_cast<QWidget*>(o))) { + const bool hp = KexiUtils::hasParent( static_cast<TQWidget*>(o), tqfocusWidget()); + if (!hp && KexiUtils::hasParent( this, static_cast<TQWidget*>(o))) { //accept row editing if focus is moved to foreign widget - //(not a child, like eg. editor) from one of our table view's children + //(not a child, like eg. editor) from one of our table view's tqchildren //or from table view itself if (!acceptRowEdit()) { - static_cast<QWidget*>(o)->setFocus(); + static_cast<TQWidget*>(o)->setFocus(); return true; } } }*/ - return QScrollView::eventFilter(o,e); + return TQScrollView::eventFilter(o,e); } void KexiTableView::slotTopHeaderSizeChange( @@ -2503,14 +2503,14 @@ void KexiTableView::setBottomMarginInternal(int pixels) d->internal_bottomMargin = pixels; } -void KexiTableView::paletteChange( const QPalette &oldPalette ) +void KexiTableView::paletteChange( const TQPalette &oldPalette ) { Q_UNUSED(oldPalette); //update: if (m_verticalHeader) - m_verticalHeader->setSelectionBackgroundColor( palette().active().highlight() ); + m_verticalHeader->setSelectionBackgroundColor( tqpalette().active().highlight() ); if (m_horizontalHeader) - m_horizontalHeader->setSelectionBackgroundColor( palette().active().highlight() ); + m_horizontalHeader->setSelectionBackgroundColor( tqpalette().active().highlight() ); } const KexiTableView::Appearance& KexiTableView::appearance() const @@ -2531,8 +2531,8 @@ void KexiTableView::setAppearance(const Appearance& a) m_verticalHeader->setCellHeight(d->rowHeight); if (m_horizontalHeader) { setMargins( - QMIN(m_horizontalHeader->sizeHint().height(), d->rowHeight), - m_horizontalHeader->sizeHint().height(), 0, 0); + TQMIN(m_horizontalHeader->tqsizeHint().height(), d->rowHeight), + m_horizontalHeader->tqsizeHint().height(), 0, 0); } // } if (a.rowHighlightingEnabled) @@ -2561,8 +2561,8 @@ int KexiTableView::highlightedRow() const void KexiTableView::setHighlightedRow(int row) { if (row!=-1) { - row = QMIN(rows() - 1 + (isInsertingEnabled()?1:0), row); - row = QMAX(0, row); + row = TQMIN(rows() - 1 + (isInsertingEnabled()?1:0), row); + row = TQMAX(0, row); ensureCellVisible(row, -1); } const int previouslyHighlightedRow = d->highlightedRow; @@ -2581,7 +2581,7 @@ void KexiTableView::setHighlightedRow(int row) if (m_curRow>=0 && (previouslyHighlightedRow==-1 || previouslyHighlightedRow==m_curRow) && d->highlightedRow!=m_curRow && !d->appearance.persistentSelections) { - //currently selected row needs to be repainted + //currently selected row needs to be tqrepainted updateRow(m_curRow); } } diff --git a/kexi/widget/tableview/kexitableview.h b/kexi/widget/tableview/kexitableview.h index 9f9c632e..f06fce10 100644 --- a/kexi/widget/tableview/kexitableview.h +++ b/kexi/widget/tableview/kexitableview.h @@ -27,11 +27,11 @@ #ifndef KEXITABLEVIEW_H #define KEXITABLEVIEW_H -#include <qscrollview.h> -#include <qvariant.h> -#include <qptrlist.h> -#include <qheader.h> -#include <qtooltip.h> +#include <tqscrollview.h> +#include <tqvariant.h> +#include <tqptrlist.h> +#include <tqheader.h> +#include <tqtooltip.h> #include <kdebug.h> @@ -64,37 +64,38 @@ namespace KexiDB { /*! @see KexiFormScrollView */ class KEXIDATATABLE_EXPORT KexiTableView : - public QScrollView, + public TQScrollView, public KexiRecordNavigatorHandler, public KexiSharedActionClient, public KexiDataAwareObjectInterface { Q_OBJECT + TQ_OBJECT KEXI_DATAAWAREOBJECTINTERFACE public: /*! Defines table view's detailed appearance settings. */ class KEXIDATATABLE_EXPORT Appearance { public: - Appearance(QWidget *widget = 0); + Appearance(TQWidget *widget = 0); /*! base color for cells, default is "Base" color for application's current active palette */ - QColor baseColor; + TQColor baseColor; /*! text color for cells, default is "Text" color for application's current active palette */ - QColor textColor; + TQColor textColor; - /*! border color for cells, default is QColor(200,200,200) */ - QColor borderColor; + /*! border color for cells, default is TQColor(200,200,200) */ + TQColor borderColor; /*! empty area color, default is "Base" color for application's current active palette */ - QColor emptyAreaColor; + TQColor emptyAreaColor; /*! alternate background color, default is KGlobalSettings::alternateBackgroundColor() */ - QColor alternateBackgroundColor; + TQColor alternateBackgroundColor; /*! true if background altering should be enabled, true by default */ bool backgroundAltering : 1; @@ -129,26 +130,26 @@ public: /*! color for row highlight, default is intermediate (33%/60%) between active highlight and base color. */ - QColor rowHighlightingColor; + TQColor rowHighlightingColor; /*! color for text under row highlight, default is the same as textColor. Used when rowHighlightingEnabled is true; */ - QColor rowHighlightingTextColor; + TQColor rowHighlightingTextColor; /*! color for row highlight for mouseover, default is intermediate (20%/80%) between active highlight and base color. Used when rowMouseOverHighlightingEnabled is true. */ - QColor rowMouseOverHighlightingColor; + TQColor rowMouseOverHighlightingColor; /*! color for text under row highlight for mouseover, default is the same as textColor. Used when rowMouseOverHighlightingEnabled is true; */ - QColor rowMouseOverHighlightingTextColor; + TQColor rowMouseOverHighlightingTextColor; /*! Like rowMouseOverHighlightingColor but for areas painted with alternate color. This is computed using active highlight color and alternateBackgroundColor. */ - QColor rowMouseOverAlternateHighlightingColor; + TQColor rowMouseOverAlternateHighlightingColor; }; - KexiTableView(KexiTableViewData* data=0, QWidget* parent=0, const char* name=0); + KexiTableView(KexiTableViewData* data=0, TQWidget* tqparent=0, const char* name=0); virtual ~KexiTableView(); /*! \return current appearance settings */ @@ -158,7 +159,7 @@ public: void setAppearance(const Appearance& a); /*! \return string displayed for column's header \a colNum */ - QString columnCaption(int colNum) const; + TQString columnCaption(int colNum) const; /*! Convenience function. \return field object that define column \a colNum or NULL if there is no such column */ @@ -177,7 +178,7 @@ public: for current table view's size. */ virtual int rowsPerPage() const; - QRect cellGeometry(int row, int col) const; + TQRect cellGeometry(int row, int col) const; int columnWidth(int col) const; int rowHeight() const; int columnPos(int col) const; @@ -221,14 +222,14 @@ public: #endif // reimplemented for internal reasons - virtual QSizePolicy sizePolicy() const; - virtual QSize sizeHint() const; - virtual QSize minimumSizeHint() const; + virtual TQSizePolicy sizePolicy() const; + virtual TQSize tqsizeHint() const; + virtual TQSize tqminimumSizeHint() const; /*! Reimplemented to update cached fonts and row sizes for the painter. */ - void setFont(const QFont &f); + void setFont(const TQFont &f); - virtual QSize tableSize() const; + virtual TQSize tableSize() const; void emitSelected(); @@ -243,7 +244,7 @@ public: ScrollRight }; - virtual bool eventFilter( QObject *o, QEvent *e ); + virtual bool eventFilter( TQObject *o, TQEvent *e ); //! Initializes standard editor cell editor factories. This is called internally, once. static void initCellEditorFactories(); @@ -256,13 +257,13 @@ public: KexiTableItem *highlightedItem() const; /*! \return vertical scrollbar. Implemented for KexiDataAwareObjectInterface. */ - virtual QScrollBar* verticalScrollBar() const { return QScrollView::verticalScrollBar(); } + virtual TQScrollBar* verticalScrollBar() const { return TQScrollView::verticalScrollBar(); } public slots: virtual void setData( KexiTableViewData *data, bool owner = true ) { KexiDataAwareObjectInterface::setData( data, owner ); } - virtual void clearColumnsInternal(bool repaint); + virtual void clearColumnsInternal(bool tqrepaint); /*! Adjusts \a colNum column's width to its (current) contents. If \a colNum == -1, all columns' width is adjusted. */ @@ -274,18 +275,18 @@ public slots: /*! If \a set is true, \a colNum column is resized to take full possible width. If \a set is false, no automatic resize will be performed. If \a colNum is -1, all columns are equally resized, when needed, to take full possible width. - This method behaves like QHeader::setStretchEnabled ( bool b, int section ). */ + This method behaves like TQHeader::setStretchEnabled ( bool b, int section ). */ void setColumnStretchEnabled( bool set, int colNum ); /*! Maximizes widths of columns selected by \a columnList, so the horizontal header has maximum overall width. Each selected column's width will be increased by the same value. Does nothing if \a columnList is empty or there is no free space to resize columns. If this table view is not visible, resizing will be performed on showing. */ - void maximizeColumnsWidth( const QValueList<int> &columnList ); + void maximizeColumnsWidth( const TQValueList<int> &columnList ); /*! Adjusts the size of the sections to fit the size of the horizontal header as completely as possible. Only sections for which column stretch is enabled will be resized. - \sa setColumnStretchEnabled() QHeader::adjustHeaderSize() */ + \sa setColumnStretchEnabled() TQHeader::adjustHeaderSize() */ void adjustHorizontalHeaderSize(); /*! Sets highlighted row number or -1 if no row has to be highlighted. @@ -302,7 +303,7 @@ public slots: virtual void ensureCellVisible(int row, int col/*=-1*/); // void gotoNext(); -//js int findString(const QString &string); +//js int findString(const TQString &string); /*! Deletes currently selected record; does nothing if no record is currently selected. If record is in edit mode, editing @@ -325,7 +326,7 @@ public slots: was displayed (in this case, \a setText is usually not empty, what means that text will be set in the cell replacing previous value). */ - virtual void startEditCurrentCell(const QString& setText = QString::null) + virtual void startEditCurrentCell(const TQString& setText = TQString()) { KexiDataAwareObjectInterface::startEditCurrentCell(setText); } /*! Deletes currently selected cell's contents, if allowed. @@ -371,20 +372,20 @@ signals: void itemDblClicked(KexiTableItem *, int row, int col); void itemMouseReleased(KexiTableItem *, int row, int col); - void dragOverRow(KexiTableItem *item, int row, QDragMoveEvent* e); - void droppedAtRow(KexiTableItem *item, int row, QDropEvent *e, KexiTableItem*& newItem); + void dragOverRow(KexiTableItem *item, int row, TQDragMoveEvent* e); + void droppedAtRow(KexiTableItem *item, int row, TQDropEvent *e, KexiTableItem*& newItem); /*! Data has been refreshed on-screen - emitted from initDataContents(). */ virtual void dataRefreshed(); virtual void itemChanged(KexiTableItem *, int row, int col); - virtual void itemChanged(KexiTableItem *, int row, int col, QVariant oldValue); + virtual void itemChanged(KexiTableItem *, int row, int col, TQVariant oldValue); virtual void itemDeleteRequest(KexiTableItem *, int row, int col); virtual void currentItemDeleteRequest(); //! Emitted for spreadsheet mode when an item was deleted and a new item has been appended virtual void newItemAppendedForAfterDeletingInSpreadSheetMode(); // void addRecordRequest(); -// void contextMenuRequested(KexiTableItem *, int row, int col, const QPoint &); +// void contextMenuRequested(KexiTableItem *, int row, int col, const TQPoint &); void sortedColumnChanged(int col); //! emmited when row editing is started (for updating or inserting) @@ -403,7 +404,7 @@ protected slots: virtual void slotDataDestroying() { KexiDataAwareObjectInterface::slotDataDestroying(); } - virtual void slotRowsDeleted( const QValueList<int> & ); + virtual void slotRowsDeleted( const TQValueList<int> & ); //! updates display after many rows deletion void slotColumnWidthChanged( int col, int os, int ns ); @@ -431,19 +432,19 @@ protected slots: virtual void slotRowRepaintRequested(KexiTableItem& item); //! Handles KexiTableViewData::aboutToDeleteRow() signal. Prepares info for slotRowDeleted(). - virtual void slotAboutToDeleteRow(KexiTableItem& item, KexiDB::ResultInfo* result, bool repaint) - { KexiDataAwareObjectInterface::slotAboutToDeleteRow(item, result, repaint); } + virtual void slotAboutToDeleteRow(KexiTableItem& item, KexiDB::ResultInfo* result, bool tqrepaint) + { KexiDataAwareObjectInterface::slotAboutToDeleteRow(item, result, tqrepaint); } - //! Handles KexiTableViewData::rowDeleted() signal to repaint when needed. + //! Handles KexiTableViewData::rowDeleted() signal to tqrepaint when needed. virtual void slotRowDeleted() { KexiDataAwareObjectInterface::slotRowDeleted(); } - //! Handles KexiTableViewData::rowInserted() signal to repaint when needed. - virtual void slotRowInserted(KexiTableItem *item, bool repaint) - { KexiDataAwareObjectInterface::slotRowInserted(item, repaint); } + //! Handles KexiTableViewData::rowInserted() signal to tqrepaint when needed. + virtual void slotRowInserted(KexiTableItem *item, bool tqrepaint) + { KexiDataAwareObjectInterface::slotRowInserted(item, tqrepaint); } //! Like above, not db-aware version - virtual void slotRowInserted(KexiTableItem *item, uint row, bool repaint) - { KexiDataAwareObjectInterface::slotRowInserted(item, row, repaint); } + virtual void slotRowInserted(KexiTableItem *item, uint row, bool tqrepaint) + { KexiDataAwareObjectInterface::slotRowInserted(item, row, tqrepaint); } /*! Handles verticalScrollBar()'s valueChanged(int) signal. Called when vscrollbar's value has been changed. */ @@ -465,7 +466,7 @@ protected: virtual void initDataContents(); /*! Implementation for KexiDataAwareObjectInterface. - Updates widget's contents size using QScrollView::resizeContents() + Updates widget's contents size using TQScrollView::resizeContents() depending on tableSize(). */ virtual void updateWidgetContentsSize(); @@ -495,42 +496,42 @@ protected: /*! Implementation for KexiDataAwareObjectInterface. Adds another section within the horizontal header. */ - virtual void addHeaderColumn(const QString& caption, const QString& description, - const QIconSet& icon, int size); + virtual void addHeaderColumn(const TQString& caption, const TQString& description, + const TQIconSet& icon, int size); /*! @internal \return true if the row defined by \a item has default value at column \a col. If this is the case and \a value is not NULL, *value is set to the default value. */ - bool isDefaultValueDisplayed(KexiTableItem *item, int col, QVariant* value = 0); + bool isDefaultValueDisplayed(KexiTableItem *item, int col, TQVariant* value = 0); - //! painting and layout - void drawContents(QPainter *p, int cx, int cy, int cw, int ch); + //! painting and tqlayout + void drawContents(TQPainter *p, int cx, int cy, int cw, int ch); void createBuffer(int width, int height); - void paintCell(QPainter* p, KexiTableItem *item, int col, int row, const QRect &cr, bool print=false); - void paintEmptyArea(QPainter *p, int cx, int cy, int cw, int ch); + void paintCell(TQPainter* p, KexiTableItem *item, int col, int row, const TQRect &cr, bool print=false); + void paintEmptyArea(TQPainter *p, int cx, int cy, int cw, int ch); void updateGeometries(); - QPoint contentsToViewport2( const QPoint &p ); + TQPoint contentsToViewport2( const TQPoint &p ); void contentsToViewport2( int x, int y, int& vx, int& vy ); - QPoint viewportToContents2( const QPoint& vp ); + TQPoint viewportToContents2( const TQPoint& vp ); // event handling - virtual void contentsMousePressEvent(QMouseEvent* e); - virtual void contentsMouseReleaseEvent(QMouseEvent* e); + virtual void contentsMousePressEvent(TQMouseEvent* e); + virtual void contentsMouseReleaseEvent(TQMouseEvent* e); //! @internal called by contentsMouseOrEvent() contentsMouseReleaseEvent() to move cursor - bool handleContentsMousePressOrRelease(QMouseEvent* e, bool release); - virtual void contentsMouseMoveEvent(QMouseEvent* e); - virtual void contentsMouseDoubleClickEvent(QMouseEvent* e); - virtual void keyPressEvent(QKeyEvent* e); - virtual void focusInEvent(QFocusEvent* e); - virtual void focusOutEvent(QFocusEvent* e); - virtual void resizeEvent(QResizeEvent* e); - virtual void viewportResizeEvent(QResizeEvent *e); - virtual void showEvent(QShowEvent *e); - virtual void contentsDragMoveEvent(QDragMoveEvent *e); - virtual void contentsDropEvent(QDropEvent *e); - virtual void viewportDragLeaveEvent(QDragLeaveEvent *e); - virtual void paletteChange( const QPalette &oldPalette ); + bool handleContentsMousePressOrRelease(TQMouseEvent* e, bool release); + virtual void contentsMouseMoveEvent(TQMouseEvent* e); + virtual void contentsMouseDoubleClickEvent(TQMouseEvent* e); + virtual void keyPressEvent(TQKeyEvent* e); + virtual void focusInEvent(TQFocusEvent* e); + virtual void focusOutEvent(TQFocusEvent* e); + virtual void resizeEvent(TQResizeEvent* e); + virtual void viewportResizeEvent(TQResizeEvent *e); + virtual void showEvent(TQShowEvent *e); + virtual void contentsDragMoveEvent(TQDragMoveEvent *e); + virtual void contentsDropEvent(TQDropEvent *e); + virtual void viewportDragLeaveEvent(TQDragLeaveEvent *e); + virtual void paletteChange( const TQPalette &oldPalette ); /*! Implementation for KexiDataAwareObjectInterface */ virtual KexiDataItemInterface *editor( int col, bool ignoreMissingEditor = false ); @@ -542,7 +543,7 @@ protected: virtual void editorShowFocus( int row, int col ); //! Creates editors and shows it, what usually means the beginning of a cell editing - virtual void createEditor(int row, int col, const QString& addText = QString::null, + virtual void createEditor(int row, int col, const TQString& addText = TQString(), bool removeOld = false); bool focusNextPrevChild(bool next); @@ -552,7 +553,7 @@ protected: given action's shortcut - false is returned (beause action is already performed at main window's level). */ - bool shortCutPressed( QKeyEvent *e, const QCString &action_name ); + bool shortCutPressed( TQKeyEvent *e, const TQCString &action_name ); #if 0 //we have now KexiActionProxy /*! Updates visibility/accesibility of popup menu items, @@ -564,30 +565,30 @@ protected: if menu is configured, else: contextMenuRequested() signal is emmited. Method used in contentsMousePressEvent() (for right button) - and keyPressEvent() for Qt::Key_Menu key. - If \a pos is QPoint(-1,-1) (the default), menu is positioned below the current cell. + and keyPressEvent() for TQt::Key_Menu key. + If \a pos is TQPoint(-1,-1) (the default), menu is positioned below the current cell. */ - void showContextMenu( const QPoint& pos = QPoint(-1,-1) ); + void showContextMenu( const TQPoint& pos = TQPoint(-1,-1) ); /*! internal */ inline void paintRow(KexiTableItem *item, - QPainter *pb, int r, int rowp, int cx, int cy, + TQPainter *pb, int r, int rowp, int cx, int cy, int colfirst, int collast, int maxwc); - virtual void setHBarGeometry( QScrollBar & hbar, int x, int y, int w, int h ); + virtual void setHBarGeometry( TQScrollBar & hbar, int x, int y, int w, int h ); //! Setups navigator widget void setupNavigator(); //! internal, to determine valid row number when navigator text changed - int validRowNumber(const QString& text); + int validRowNumber(const TQString& text); /*! Reimplementation for KexiDataAwareObjectInterface (viewport()->setFocus() is just added) */ virtual void removeEditor(); //! Internal: updated sched fonts for painting. - void updateFonts(bool repaint = false); + void updateFonts(bool tqrepaint = false); /*! @internal Changes bottom margin settings, in pixels. At this time, it's used by KexiComboBoxPopup to decrease margin for popup's table. */ @@ -613,7 +614,7 @@ protected: virtual void paste(); /*! Used in KexiDataAwareObjectInterface::slotRowDeleted() - to repaint tow \a row and all visible below. */ + to tqrepaint tow \a row and all visible below. */ virtual void updateAllVisibleRowsBelow(int row); void updateAfterCancelRowEdit(); @@ -622,11 +623,11 @@ protected: /*! Sets \a cellValue if there is a lookup value for the cell \a item. Used in KexiTableView::paintCell() and KexiTableViewCellToolTip::maybeTip() \return true is \a cellValue has been found. */ - bool getVisibleLookupValue(QVariant& cellValue, KexiTableEdit *edit, + bool getVisibleLookupValue(TQVariant& cellValue, KexiTableEdit *edit, KexiTableItem *item, KexiTableViewColumn *tvcol) const; -// //! Called to repaint contents after a row is deleted. -// void repaintAfterDelete(); +// //! Called to tqrepaint contents after a row is deleted. +// void tqrepaintAfterDelete(); KexiTableViewPrivate *d; diff --git a/kexi/widget/tableview/kexitableview_p.cpp b/kexi/widget/tableview/kexitableview_p.cpp index 7cf774db..d5e1641a 100644 --- a/kexi/widget/tableview/kexitableview_p.cpp +++ b/kexi/widget/tableview/kexitableview_p.cpp @@ -27,7 +27,7 @@ #include "kexitableview_p.h" #include "kexitableedit.h" -#include <qlabel.h> +#include <tqlabel.h> #include <kglobalsettings.h> @@ -47,12 +47,12 @@ KexiTableViewPrivate::KexiTableViewPrivate(KexiTableView* t) //moved scrollbarToolTipsEnabled = true; //moved scrollBarTipTimerCnt = 0; //moved scrollBarTip = 0; - ensureCellVisibleOnShow = QPoint(-1,-1); - internal_bottomMargin = tv->horizontalScrollBar()->sizeHint().height()/2; + ensureCellVisibleOnShow = TQPoint(-1,-1); + internal_bottomMargin = tv->horizontalScrollBar()->tqsizeHint().height()/2; highlightedRow = -1; moveCursorOnMouseRelease = false; horizontalHeaderVisible = true; - recentCellWithToolTip = QPoint(-1,-1); + recentCellWithToolTip = TQPoint(-1,-1); } KexiTableViewPrivate::~KexiTableViewPrivate() diff --git a/kexi/widget/tableview/kexitableview_p.h b/kexi/widget/tableview/kexitableview_p.h index 58fe8574..b0679dfa 100644 --- a/kexi/widget/tableview/kexitableview_p.h +++ b/kexi/widget/tableview/kexitableview_p.h @@ -32,10 +32,10 @@ #include <kexidb/roweditbuffer.h> #include <widget/utils/kexidisplayutils.h> -#include <qevent.h> -#include <qtimer.h> -#include <qvalidator.h> -#include <qasciidict.h> +#include <tqevent.h> +#include <tqtimer.h> +#include <tqvalidator.h> +#include <tqasciidict.h> #include <kpushbutton.h> #include <ktoolbarbutton.h> @@ -46,18 +46,18 @@ class KexiTableItem; class KexiTableRM; class KexiTableEdit; -class QLabel; +class TQLabel; class KexiTableViewHeader; //! @short a dynamic tooltip for table view cells /*! @internal */ -class KexiTableViewCellToolTip : public QToolTip +class KexiTableViewCellToolTip : public TQToolTip { public: KexiTableViewCellToolTip( KexiTableView * tableView ); virtual ~KexiTableViewCellToolTip(); protected: - virtual void maybeTip( const QPoint & p ); + virtual void maybeTip( const TQPoint & p ); KexiTableView *m_tableView; }; @@ -76,17 +76,17 @@ class KexiTableViewPrivate KexiTableView *tv; //! editors: one for each column (indexed by KexiTableViewColumn) - QPtrDict<KexiTableEdit> editors; + TQPtrDict<KexiTableEdit> editors; int rowHeight; - QPixmap *pBufferPm; - QTimer *pUpdateTimer; + TQPixmap *pBufferPm; + TQTimer *pUpdateTimer; int menu_id_addRecord; int menu_id_removeRecord; #if 0//(js) doesn't work! - QTimer *scrollTimer; + TQTimer *scrollTimer; #endif KexiTableView::ScrollDirection scrollDirection; @@ -119,7 +119,7 @@ class KexiTableViewPrivate KexiTableView::Appearance appearance; //! brushes, fonts - QBrush diagonalGrayPattern; + TQBrush diagonalGrayPattern; //! Parameters for displaying autonumbers KexiDisplayUtils::DisplayParameters autonumberSignDisplayParameters; @@ -128,11 +128,11 @@ class KexiTableViewPrivate KexiDisplayUtils::DisplayParameters defaultValueDisplayParameters; //! Used by delayed mode of maximizeColumnsWidth() - QValueList<int> maximizeColumnsWidthOnShow; + TQValueList<int> maximizeColumnsWidthOnShow; /*! Used for delayed call of ensureCellVisible() after show(). It's equal to (-1,-1) if ensureCellVisible() shouldn't e called. */ - QPoint ensureCellVisibleOnShow; + TQPoint ensureCellVisibleOnShow; /*! @internal Changes bottom margin settings, in pixels. At this time, it's used by KexiComboBoxPopup to decrease margin for popup's table. */ @@ -145,8 +145,8 @@ class KexiTableViewPrivate int contextMenuKey; /*! Specifies currently displayed cell tooltip. - Value of QPoint(-1,-1) means "no tooltip". */ - QPoint recentCellWithToolTip; + Value of TQPoint(-1,-1) means "no tooltip". */ + TQPoint recentCellWithToolTip; /*! Table cell tooltip */ KexiTableViewCellToolTip *cellToolTip; diff --git a/kexi/widget/tableview/kexitableviewdata.cpp b/kexi/widget/tableview/kexitableviewdata.cpp index 62259db3..1fb65c6a 100644 --- a/kexi/widget/tableview/kexitableviewdata.cpp +++ b/kexi/widget/tableview/kexitableviewdata.cpp @@ -36,7 +36,7 @@ #include <kdebug.h> #include <klocale.h> -#include <qapplication.h> +#include <tqapplication.h> unsigned short KexiTableViewData::charTable[]= { @@ -54,12 +54,12 @@ KexiTableViewColumn::KexiTableViewColumn(KexiDB::Field& f, bool owner) init(); } -KexiTableViewColumn::KexiTableViewColumn(const QString& name, KexiDB::Field::Type ctype, +KexiTableViewColumn::KexiTableViewColumn(const TQString& name, KexiDB::Field::Type ctype, uint cconst, uint options, uint length, uint precision, - QVariant defaultValue, - const QString& caption, const QString& description, uint width + TQVariant defaultValue, + const TQString& caption, const TQString& description, uint width ) : columnInfo(0) , visibleLookupColumnInfo(0) @@ -78,8 +78,8 @@ KexiTableViewColumn::KexiTableViewColumn(const QString& name, KexiDB::Field::Typ init(); } -KexiTableViewColumn::KexiTableViewColumn(const QString& name, KexiDB::Field::Type ctype, - const QString& caption, const QString& description) +KexiTableViewColumn::KexiTableViewColumn(const TQString& name, KexiDB::Field::Type ctype, + const TQString& caption, const TQString& description) : columnInfo(0) , visibleLookupColumnInfo(0) { @@ -88,7 +88,7 @@ KexiTableViewColumn::KexiTableViewColumn(const QString& name, KexiDB::Field::Typ KexiDB::Field::NoConstraints, KexiDB::Field::NoOptions, 0, 0, - QVariant(), + TQVariant(), caption, description); isDBAware = false; @@ -122,7 +122,7 @@ KexiTableViewColumn::KexiTableViewColumn( } init(); //setup column's readonly flag: true, if - // - it's not from parent table's field, or + // - it's not from tqparent table's field, or // - if the query itself is coming from read-only connection, or // - if the query itself is stored (i.e. has connection) and lookup column is defined const bool columnFromMasterTable = query.masterTable()==columnInfo->field->table(); @@ -168,7 +168,7 @@ void KexiTableViewColumn::init() void KexiTableViewColumn::setValidator( KexiUtils::Validator* v ) { if (m_validator) {//remove old one - if (!m_validator->parent()) //destroy if has no parent + if (!m_validator->tqparent()) //destroy if has no tqparent delete m_validator; } m_validator = v; @@ -205,7 +205,7 @@ bool KexiTableViewColumn::isReadOnly() const return m_readOnly || (m_data && m_data->isReadOnly()); } -bool KexiTableViewColumn::acceptsFirstChar(const QChar& ch) const +bool KexiTableViewColumn::acceptsFirstChar(const TQChar& ch) const { // the field we're looking at can be related to "visible lookup column" // if lookup column is present @@ -216,7 +216,7 @@ bool KexiTableViewColumn::acceptsFirstChar(const QChar& ch) const return visibleField->isFPNumericType(); if (ch=='-') return !visibleField->isUnsigned(); - if (ch=='+' || (ch>='0' && ch<='9')) + if (ch=='+' || ((int)ch>='0' && (int)ch<='9')) return true; return false; } @@ -227,7 +227,7 @@ bool KexiTableViewColumn::acceptsFirstChar(const QChar& ch) const case KexiDB::Field::Date: case KexiDB::Field::DateTime: case KexiDB::Field::Time: - return ch>='0' && ch<='9'; + return (int)ch>='0' && (int)ch<='9'; default:; } return true; @@ -237,7 +237,7 @@ bool KexiTableViewColumn::acceptsFirstChar(const QChar& ch) const //------------------------------------------------------ KexiTableViewData::KexiTableViewData() - : QObject() + : TQObject() , KexiTableViewDataBase() { init(); @@ -245,7 +245,7 @@ KexiTableViewData::KexiTableViewData() // db-aware ctor KexiTableViewData::KexiTableViewData(KexiDB::Cursor *c) - : QObject() + : TQObject() , KexiTableViewDataBase() { init(); @@ -282,9 +282,9 @@ KexiTableViewData::KexiTableViewData(KexiDB::Cursor *c) } KexiTableViewData::KexiTableViewData( - const QValueList<QVariant> &keys, const QValueList<QVariant> &values, + const TQValueList<TQVariant> &keys, const TQValueList<TQVariant> &values, KexiDB::Field::Type keyType, KexiDB::Field::Type valueType) - : QObject() + : TQObject() , KexiTableViewDataBase() { init(keys, values, keyType, valueType); @@ -293,7 +293,7 @@ KexiTableViewData::KexiTableViewData( KexiTableViewData::KexiTableViewData( KexiDB::Field::Type keyType, KexiDB::Field::Type valueType) { - const QValueList<QVariant> empty; + const TQValueList<TQVariant> empty; init(empty, empty, keyType, valueType); } @@ -304,7 +304,7 @@ KexiTableViewData::~KexiTableViewData() } void KexiTableViewData::init( - const QValueList<QVariant> &keys, const QValueList<QVariant> &values, + const TQValueList<TQVariant> &keys, const TQValueList<TQVariant> &values, KexiDB::Field::Type keyType, KexiDB::Field::Type valueType) { init(); @@ -318,9 +318,9 @@ void KexiTableViewData::init( KexiTableViewColumn *valueColumn = new KexiTableViewColumn(*valueField, true); addColumn(valueColumn); - uint cnt = QMIN(keys.count(), values.count()); - QValueList<QVariant>::ConstIterator it_keys = keys.constBegin(); - QValueList<QVariant>::ConstIterator it_values = values.constBegin(); + uint cnt = TQMIN(keys.count(), values.count()); + TQValueList<TQVariant>::ConstIterator it_keys = keys.constBegin(); + TQValueList<TQVariant>::ConstIterator it_values = values.constBegin(); for (;cnt>0;++it_keys, ++it_values, cnt--) { KexiTableItem *item = new KexiTableItem(2); (*item)[0] = (*it_keys); @@ -355,14 +355,14 @@ void KexiTableViewData::init() void KexiTableViewData::deleteLater() { m_cursor = 0; - QObject::deleteLater(); + TQObject::deleteLater(); } void KexiTableViewData::addColumn( KexiTableViewColumn* col ) { // if (!col->isDBAware) { // if (!m_simpleColumnsByName) -// m_simpleColumnsByName = new QDict<KexiTableViewColumn>(101); +// m_simpleColumnsByName = new TQDict<KexiTableViewColumn>(101); // m_simpleColumnsByName->insert(col->caption,col);//for faster lookup // } columns.append( col ); @@ -386,11 +386,11 @@ void KexiTableViewData::addColumn( KexiTableViewColumn* col ) m_itemSize = columns.count()+(m_containsROWIDInfo?1:0); } -QString KexiTableViewData::dbTableName() const +TQString KexiTableViewData::dbTableName() const { if (m_cursor && m_cursor->query() && m_cursor->query()->masterTable()) return m_cursor->query()->masterTable()->name(); - return QString::null; + return TQString(); } void KexiTableViewData::setSorting(int column, bool ascending) @@ -506,11 +506,11 @@ int KexiTableViewData::cmpTime(Item item1, Item item2) int KexiTableViewData::cmpStr(Item item1, Item item2) { CMP_NULLS(item1, item2); - const QString &as = m_leftTmp.toString(); - const QString &bs = m_rightTmp.toString(); + const TQString &as = m_leftTmp.toString(); + const TQString &bs = m_rightTmp.toString(); - const QChar *a = as.unicode(); - const QChar *b = bs.unicode(); + const TQChar *a = as.tqunicode(); + const TQChar *b = bs.tqunicode(); if ( a == b ) return 0; @@ -522,18 +522,18 @@ int KexiTableViewData::cmpStr(Item item1, Item item2) unsigned short au; unsigned short bu; - int l=QMIN(as.length(),bs.length()); + int l=TQMIN(as.length(),bs.length()); - au = a->unicode(); - bu = b->unicode(); + au = a->tqunicode(); + bu = b->tqunicode(); au = (au <= 0x17e ? charTable[au] : 0xffff); bu = (bu <= 0x17e ? charTable[bu] : 0xffff); while (l-- && au == bu) { a++,b++; - au = a->unicode(); - bu = b->unicode(); + au = a->tqunicode(); + bu = b->tqunicode(); au = (au <= 0x17e ? charTable[au] : 0xffff); bu = (bu <= 0x17e ? charTable[bu] : 0xffff); } @@ -578,8 +578,8 @@ void KexiTableViewData::clearRowEditBuffer() } bool KexiTableViewData::updateRowEditBufferRef(KexiTableItem *item, - int colnum, KexiTableViewColumn* col, QVariant& newval, bool allowSignals, - QVariant *visibleValueForLookupField) + int colnum, KexiTableViewColumn* col, TQVariant& newval, bool allowSignals, + TQVariant *visibleValueForLookupField) { m_result.clear(); if (allowSignals) @@ -615,7 +615,7 @@ bool KexiTableViewData::updateRowEditBufferRef(KexiTableItem *item, return false; } //not db-aware: - const QString colname = col->field()->name(); + const TQString colname = col->field()->name(); if (colname.isEmpty()) { kdDebug() << "KexiTableViewData::updateRowEditBufferRef(): column #" << colnum<<" not found!" << endl; return false; @@ -635,7 +635,7 @@ bool KexiTableViewData::updateRowEditBufferRef(KexiTableItem *item, } //! @todo if there're multiple views for this data, we need multiple buffers! -bool KexiTableViewData::saveRow(KexiTableItem& item, bool insert, bool repaint) +bool KexiTableViewData::saveRow(KexiTableItem& item, bool insert, bool tqrepaint) { if (!m_pRowEditBuffer) return true; //nothing to do @@ -645,7 +645,7 @@ bool KexiTableViewData::saveRow(KexiTableItem& item, bool insert, bool repaint) KexiTableViewColumn::ListIterator it_f(columns); KexiDB::RowData::ConstIterator it_r = item.constBegin(); int col = 0; - const QVariant *val; + const TQVariant *val; for (;it_f.current() && it_r!=item.constEnd();++it_f,++it_r,col++) { KexiDB::Field *f = it_f.current()->field(); val = 0; @@ -655,7 +655,7 @@ bool KexiTableViewData::saveRow(KexiTableItem& item, bool insert, bool repaint) if (val->isNull() && !f->isAutoIncrement()) { //NOT NULL violated m_result.msg = i18n("\"%1\" column requires a value to be entered.") - .arg(f->captionOrName()) + "\n\n" + Kexi::msgYouCanImproveData(); + .tqarg(f->captionOrName()) + "\n\n" + Kexi::msgYouCanImproveData(); m_result.desc = i18n("The column's constraint is declared as NOT NULL."); m_result.column = col; return false; @@ -666,7 +666,7 @@ bool KexiTableViewData::saveRow(KexiTableItem& item, bool insert, bool repaint) if (!f->isAutoIncrement() && (val->isNull() || KexiDB::isEmptyValue( f, *val ))) { //NOT EMPTY violated m_result.msg = i18n("\"%1\" column requires a value to be entered.") - .arg(f->captionOrName()) + "\n\n" + Kexi::msgYouCanImproveData(); + .tqarg(f->captionOrName()) + "\n\n" + Kexi::msgYouCanImproveData(); m_result.desc = i18n("The column's constraint is declared as NOT EMPTY."); m_result.column = col; return false; @@ -685,7 +685,7 @@ bool KexiTableViewData::saveRow(KexiTableItem& item, bool insert, bool repaint) /* if (desc) *desc = -js: TODO: use KexiMainWindowImpl::showErrorMessage(const QString &title, KexiDB::Object *obj) +js: TODO: use KexiMainWindowImpl::showErrorMessage(const TQString &title, KexiDB::Object *obj) after it will be moved somewhere to kexidb (this will require moving other showErrorMessage() methods from KexiMainWindowImpl to libkexiutils....) then: just call: *desc = KexiDB::errorMessage(m_cursor); @@ -721,12 +721,12 @@ js: TODO: use KexiMainWindowImpl::showErrorMessage(const QString &title, KexiDB: m_pRowEditBuffer->clear(); - if (repaint) + if (tqrepaint) emit rowRepaintRequested(item); return true; } -bool KexiTableViewData::saveRowChanges(KexiTableItem& item, bool repaint) +bool KexiTableViewData::saveRowChanges(KexiTableItem& item, bool tqrepaint) { kdDebug() << "KexiTableViewData::saveRowChanges()..." << endl; m_result.clear(); @@ -734,32 +734,32 @@ bool KexiTableViewData::saveRowChanges(KexiTableItem& item, bool repaint) if (!m_result.success) return false; - if (saveRow(item, false /*update*/, repaint)) { + if (saveRow(item, false /*update*/, tqrepaint)) { emit rowUpdated(&item); return true; } return false; } -bool KexiTableViewData::saveNewRow(KexiTableItem& item, bool repaint) +bool KexiTableViewData::saveNewRow(KexiTableItem& item, bool tqrepaint) { kdDebug() << "KexiTableViewData::saveNewRow()..." << endl; m_result.clear(); - emit aboutToInsertRow(&item, &m_result, repaint); + emit aboutToInsertRow(&item, &m_result, tqrepaint); if (!m_result.success) return false; - if (saveRow(item, true /*insert*/, repaint)) { - emit rowInserted(&item, repaint); + if (saveRow(item, true /*insert*/, tqrepaint)) { + emit rowInserted(&item, tqrepaint); return true; } return false; } -bool KexiTableViewData::deleteRow(KexiTableItem& item, bool repaint) +bool KexiTableViewData::deleteRow(KexiTableItem& item, bool tqrepaint) { m_result.clear(); - emit aboutToDeleteRow(item, &m_result, repaint); + emit aboutToDeleteRow(item, &m_result, tqrepaint); if (!m_result.success) return false; @@ -784,15 +784,15 @@ bool KexiTableViewData::deleteRow(KexiTableItem& item, bool repaint) return true; } -void KexiTableViewData::deleteRows( const QValueList<int> &rowsToDelete, bool repaint ) +void KexiTableViewData::deleteRows( const TQValueList<int> &rowsToDelete, bool tqrepaint ) { - Q_UNUSED( repaint ); + Q_UNUSED( tqrepaint ); if (rowsToDelete.isEmpty()) return; int last_r=0; first(); - for (QValueList<int>::ConstIterator r_it = rowsToDelete.constBegin(); r_it!=rowsToDelete.constEnd(); ++r_it) { + for (TQValueList<int>::ConstIterator r_it = rowsToDelete.constBegin(); r_it!=rowsToDelete.constEnd(); ++r_it) { for (; last_r<(*r_it); last_r++) { next(); } @@ -804,17 +804,17 @@ void KexiTableViewData::deleteRows( const QValueList<int> &rowsToDelete, bool re emit rowsDeleted( rowsToDelete ); } -void KexiTableViewData::insertRow(KexiTableItem& item, uint index, bool repaint) +void KexiTableViewData::insertRow(KexiTableItem& item, uint index, bool tqrepaint) { - if (!insert( index = QMIN(index, count()), &item )) + if (!insert( index = TQMIN(index, count()), &item )) return; - emit rowInserted(&item, index, repaint); + emit rowInserted(&item, index, tqrepaint); } void KexiTableViewData::clearInternal() { clearRowEditBuffer(); -// qApp->processEvents( 1 ); +// tqApp->processEvents( 1 ); //TODO: this is time consuming: find better data model // KexiTableViewDataBase::clear(); const uint c = count(); @@ -822,12 +822,12 @@ void KexiTableViewData::clearInternal() removeLast(); #ifndef KEXI_NO_PROCESS_EVENTS if (i % 1000 == 0) - qApp->processEvents( 1 ); + tqApp->tqprocessEvents( 1 ); #endif } } -bool KexiTableViewData::deleteAllRows(bool repaint) +bool KexiTableViewData::deleteAllRows(bool tqrepaint) { clearInternal(); @@ -837,7 +837,7 @@ bool KexiTableViewData::deleteAllRows(bool repaint) res = m_cursor->deleteAllRows(); } - if (repaint) + if (tqrepaint) emit reloadRequested(); return res; } @@ -873,7 +873,7 @@ void KexiTableViewData::preloadAllRows() m_cursor->moveNext(); #ifndef KEXI_NO_PROCESS_EVENTS if ((i % 1000) == 0) - qApp->processEvents( 1 ); + tqApp->tqprocessEvents( 1 ); #endif } } diff --git a/kexi/widget/tableview/kexitableviewdata.h b/kexi/widget/tableview/kexitableviewdata.h index 970d1d23..56241fcb 100644 --- a/kexi/widget/tableview/kexitableviewdata.h +++ b/kexi/widget/tableview/kexitableviewdata.h @@ -25,11 +25,11 @@ #ifndef KEXITABLEVIEWDATA_H #define KEXITABLEVIEWDATA_H -#include <qptrlist.h> -#include <qvariant.h> -#include <qvaluevector.h> -#include <qstring.h> -#include <qobject.h> +#include <tqptrlist.h> +#include <tqvariant.h> +#include <tqvaluevector.h> +#include <tqstring.h> +#include <tqobject.h> #include "kexitableitem.h" @@ -51,8 +51,8 @@ class KexiTableViewData; /*! Single column definition. */ class KEXIDATATABLE_EXPORT KexiTableViewColumn { public: - typedef QPtrList<KexiTableViewColumn> List; - typedef QPtrListIterator<KexiTableViewColumn> ListIterator; + typedef TQPtrList<KexiTableViewColumn> List; + typedef TQPtrListIterator<KexiTableViewColumn> ListIterator; /*! Not db-aware ctor. if \a owner is true, the field \a will be owned by this column, so you shouldn't care about destroying this field. */ @@ -62,18 +62,18 @@ class KEXIDATATABLE_EXPORT KexiTableViewColumn { equal to these accepted by KexiDB::Field ctor. The column will be the owner of this automatically generated field. */ - KexiTableViewColumn(const QString& name, KexiDB::Field::Type ctype, + KexiTableViewColumn(const TQString& name, KexiDB::Field::Type ctype, uint cconst = KexiDB::Field::NoConstraints, uint options = KexiDB::Field::NoOptions, uint length=0, uint precision=0, - QVariant defaultValue=QVariant(), - const QString& caption = QString::null, - const QString& description = QString::null, + TQVariant defaultValue=TQVariant(), + const TQString& caption = TQString(), + const TQString& description = TQString(), uint width = 0); /*! Not db-aware, convenience ctor, simplified version of the above. */ - KexiTableViewColumn(const QString& name, KexiDB::Field::Type ctype, const QString& caption, - const QString& description = QString::null); + KexiTableViewColumn(const TQString& name, KexiDB::Field::Type ctype, const TQString& caption, + const TQString& description = TQString()); //! Db-aware version. KexiTableViewColumn(const KexiDB::QuerySchema &query, KexiDB::QueryColumnInfo& aColumnInfo, @@ -81,11 +81,11 @@ class KEXIDATATABLE_EXPORT KexiTableViewColumn { virtual ~KexiTableViewColumn(); - virtual bool acceptsFirstChar(const QChar& ch) const; + virtual bool acceptsFirstChar(const TQChar& ch) const; /*! \return true if the column is read-only For db-aware column this can depend on whether the column - is in parent table of this query. \sa setReadOnly() */ + is in tqparent table of this query. \sa setReadOnly() */ bool isReadOnly() const; //TODO: synchronize this with table view: @@ -103,10 +103,10 @@ class KEXIDATATABLE_EXPORT KexiTableViewColumn { } /*! Sets icon for displaying in the caption area (header). */ - void setIcon(const QIconSet& icon) { m_icon = icon; } + void setIcon(const TQIconSet& icon) { m_icon = icon; } /*! \return bame of icon displayed in the caption area (header). */ - QIconSet icon() const { return m_icon; } + TQIconSet icon() const { return m_icon; } /*! If \a visible is true, caption has to be displayed in the column's header, (or field's name if caption is empty. True by default. */ @@ -120,10 +120,10 @@ class KEXIDATATABLE_EXPORT KexiTableViewColumn { - field's caption - or field's alias (from query) - or finally - field's name */ - inline QString captionAliasOrName() const { return m_captionAliasOrName; } + inline TQString captionAliasOrName() const { return m_captionAliasOrName; } /*! Assigns validator \a v for this column. - If the validator has no parent object, it will be owned by the column, + If the validator has no tqparent object, it will be owned by the column, so you shouldn't care about destroying it. */ void setValidator( KexiUtils::Validator* v ); @@ -150,7 +150,7 @@ class KEXIDATATABLE_EXPORT KexiTableViewColumn { /*! Only usable if related data is set (ie. this is for combo boxes). Sets 'editable' flag for this column, what means a new value can be entered - by hand. This is similar to QComboBox::setEditable(). */ + by hand. This is similar to TQComboBox::setEditable(). */ void setRelatedDataEditable(bool set); /*! Only usable if related data is set (ie. this is for combo boxes). @@ -171,14 +171,14 @@ class KEXIDATATABLE_EXPORT KexiTableViewColumn { bool isDBAware : 1; //!< true if data is stored in DB, not only in memeory -/* QString caption; +/* TQString caption; int type; //!< one of KexiDB::Field::Type uint width; */ // bool isNull() const; -/* virtual QString caption() const; - virtual void setCaption(const QString& c); +/* virtual TQString caption() const; + virtual void setCaption(const TQString& c); */ protected: //! special ctor that do not allocate d member; @@ -186,9 +186,9 @@ class KEXIDATATABLE_EXPORT KexiTableViewColumn { void init(); - QString m_captionAliasOrName; + TQString m_captionAliasOrName; - QIconSet m_icon; + TQIconSet m_icon; KexiUtils::Validator* m_validator; @@ -211,20 +211,21 @@ class KEXIDATATABLE_EXPORT KexiTableViewColumn { /*! List of column definitions. */ -//typedef QValueVector<KexiTableViewColumn> KexiTableViewColumnList; +//typedef TQValueVector<KexiTableViewColumn> KexiTableViewColumnList; -typedef QPtrList<KexiTableItem> KexiTableViewDataBase; +typedef TQPtrList<KexiTableItem> KexiTableViewDataBase; -/*! Reimplements QPtrList to allow configurable sorting and more. +/*! Reimplements TQPtrList to allow configurable sorting and more. Original author: Till Busch. Reimplemented by Jaroslaw Staniek. */ -class KEXIDATATABLE_EXPORT KexiTableViewData : public QObject, protected KexiTableViewDataBase +class KEXIDATATABLE_EXPORT KexiTableViewData : public TQObject, protected KexiTableViewDataBase { Q_OBJECT + TQ_OBJECT public: - typedef QPtrListIterator<KexiTableItem> Iterator; + typedef TQPtrListIterator<KexiTableItem> Iterator; //! not db-aware version KexiTableViewData(); @@ -242,7 +243,7 @@ public: @param valueType a type for values */ KexiTableViewData( - const QValueList<QVariant> &keys, const QValueList<QVariant> &values, + const TQValueList<TQVariant> &keys, const TQValueList<TQVariant> &values, KexiDB::Field::Type keyType = KexiDB::Field::Text, KexiDB::Field::Type valueType = KexiDB::Field::Text); @@ -284,8 +285,8 @@ public: inline bool isDBAware() { return m_cursor; } /*! For db-aware data set only: table name is returned; - equivalent to cursor()->query()->parentTable()->name(). */ - QString dbTableName() const; + equivalent to cursor()->query()->tqparentTable()->name(). */ + TQString dbTableName() const; inline KexiDB::Cursor* cursor() const { return m_cursor; } @@ -333,21 +334,21 @@ public: Note that \a newval may be changed in aboutToChangeCell() signal handler. \sa KexiDB::RowEditBuffer */ bool updateRowEditBufferRef(KexiTableItem *item, - int colnum, KexiTableViewColumn* col, QVariant& newval, bool allowSignals = true, - QVariant *visibleValueForLookupField = 0); + int colnum, KexiTableViewColumn* col, TQVariant& newval, bool allowSignals = true, + TQVariant *visibleValueForLookupField = 0); /*! Added for convenience. Like above but \a newval is passed by value. */ inline bool updateRowEditBuffer(KexiTableItem *item, int colnum, KexiTableViewColumn* col, - QVariant newval, bool allowSignals = true) + TQVariant newval, bool allowSignals = true) { - QVariant newv(newval); + TQVariant newv(newval); return updateRowEditBufferRef(item, colnum, col, newv, allowSignals); } /*! Added for convenience. Like above but it's assumed that \a item item's columns are ordered like in table view, not like in form view. Don't use this with form views. */ inline bool updateRowEditBuffer(KexiTableItem *item, int colnum, - QVariant newval, bool allowSignals = true) + TQVariant newval, bool allowSignals = true) { KexiTableViewColumn* col = columns.at(colnum); return col ? updateRowEditBufferRef(item, colnum, col, newval, allowSignals) : false; @@ -358,27 +359,27 @@ public: /*! \return last operation's result information (always not null). */ inline KexiDB::ResultInfo* result() { return &m_result; } - bool saveRowChanges(KexiTableItem& item, bool repaint = false); + bool saveRowChanges(KexiTableItem& item, bool tqrepaint = false); - bool saveNewRow(KexiTableItem& item, bool repaint = false); + bool saveNewRow(KexiTableItem& item, bool tqrepaint = false); - bool deleteRow(KexiTableItem& item, bool repaint = false); + bool deleteRow(KexiTableItem& item, bool tqrepaint = false); /*! Deletes rows (by number) passed with \a rowsToDelete. Currently, this method is only for non data-aware tables. */ - void deleteRows( const QValueList<int> &rowsToDelete, bool repaint = false ); + void deleteRows( const TQValueList<int> &rowsToDelete, bool tqrepaint = false ); /*! Deletes all rows. Works either for db-aware and non db-aware tables. Column's definition is not changed. For db-aware version, all rows are removed from a database. Row-edit buffer is cleared. - If \a repaint is true, reloadRequested() signal + If \a tqrepaint is true, reloadRequested() signal is emitted after deleting (if at least one row was deleted), - so presenters can repaint their contents. + so presenters can tqrepaint their contents. \return true on success. */ - virtual bool deleteAllRows(bool repaint = false); + virtual bool deleteAllRows(bool tqrepaint = false); /*! @internal method, used mostly by specialized classes like KexiTableView. Clears internal row structures. Row-edit buffer is cleared. @@ -389,7 +390,7 @@ public: /*! Inserts new \a item at index \a index. \a item will be owned by this data object. Note: Reasonable only for not not-db-aware version. */ - void insertRow(KexiTableItem& item, uint index, bool repaint = false); + void insertRow(KexiTableItem& item, uint index, bool tqrepaint = false); /*TODO: add this as well? void insertRow(KexiTableItem& item, KexiTableItem& aboveItem); */ @@ -407,7 +408,7 @@ public: inline bool isEmpty () const { return KexiTableViewDataBase::isEmpty(); } inline KexiTableItem* first() { return KexiTableViewDataBase::first(); } inline KexiTableItem* last() { return KexiTableViewDataBase::last(); } - inline int findRef( const KexiTableItem* item ) { return KexiTableViewDataBase::findRef(item); } + inline int tqfindRef( const KexiTableItem* item ) { return KexiTableViewDataBase::tqfindRef(item); } inline void sort() { KexiTableViewDataBase::sort(); } inline bool removeFirst() { return KexiTableViewDataBase::removeFirst(); } inline bool removeLast() { return KexiTableViewDataBase::removeLast(); } @@ -428,7 +429,7 @@ public: { return new KexiTableItem(m_itemSize); } public slots: - //! @internal The same as QObject::deleteLater() but also sets smart pointer m_cursor to 0 to avoid crashes... + //! @internal The same as TQObject::deleteLater() but also sets smart pointer m_cursor to 0 to avoid crashes... void deleteLater(); signals: @@ -438,13 +439,13 @@ signals: Connect this signal to your slot and set \a result->success to false to disallow this change. You can also change \a newValue to other value, or change other columns in \a item row. */ - void aboutToChangeCell(KexiTableItem *item, int colnum, QVariant& newValue, + void aboutToChangeCell(KexiTableItem *item, int colnum, TQVariant& newValue, KexiDB::ResultInfo* result); /*! Emited before inserting of a new, current row. Connect this signal to your slot and set \a result->success to false to disallow this inserting. You can also change columns in \a item row. */ - void aboutToInsertRow(KexiTableItem *item, KexiDB::ResultInfo* result, bool repaint); + void aboutToInsertRow(KexiTableItem *item, KexiDB::ResultInfo* result, bool tqrepaint); /*! Emited before changing of an edited, current row. Connect this signal to your slot and set \a result->success to false @@ -454,21 +455,21 @@ signals: void rowUpdated(KexiTableItem*); //!< Current row has been updated - void rowInserted(KexiTableItem*, bool repaint); //!< A row has been inserted + void rowInserted(KexiTableItem*, bool tqrepaint); //!< A row has been inserted //! A row has been inserted at \a index position (not db-aware data only) - void rowInserted(KexiTableItem*, uint index, bool repaint); + void rowInserted(KexiTableItem*, uint index, bool tqrepaint); /*! Emited before deleting of a current row. Connect this signal to your slot and set \a result->success to false to disallow this deleting. */ - void aboutToDeleteRow(KexiTableItem& item, KexiDB::ResultInfo* result, bool repaint); + void aboutToDeleteRow(KexiTableItem& item, KexiDB::ResultInfo* result, bool tqrepaint); //! Current row has been deleted void rowDeleted(); //! Rows have been deleted - void rowsDeleted( const QValueList<int> &rowsToDelete ); + void rowsDeleted( const TQValueList<int> &rowsToDelete ); //! Displayed data needs to be reloaded in all presenters. void reloadRequested(); @@ -478,7 +479,7 @@ signals: protected: void init(); void init( - const QValueList<QVariant> &keys, const QValueList<QVariant> &values, + const TQValueList<TQVariant> &keys, const TQValueList<TQVariant> &values, KexiDB::Field::Type keyType, KexiDB::Field::Type valueType); virtual int compareItems(Item item1, Item item2); @@ -492,11 +493,11 @@ protected: int cmpDateTime(Item item1, Item item2); int cmpTime(Item item1, Item item2); - //! Compare function for BLOB data (QByteArray). Uses size as the weight. + //! Compare function for BLOB data (TQByteArray). Uses size as the weight. int cmpBLOB(Item item1, Item item2); //! internal: for saveRowChanges() and saveNewRow() - bool saveRow(KexiTableItem& item, bool insert, bool repaint); + bool saveRow(KexiTableItem& item, bool insert, bool tqrepaint); //! (logical) sorted column number, set by setSorting() //! can differ from m_realSortedColumn if there's lookup column used @@ -508,15 +509,15 @@ protected: int m_itemSize; static unsigned short charTable[]; KexiDB::RowEditBuffer *m_pRowEditBuffer; - QGuardedPtr<KexiDB::Cursor> m_cursor; + TQGuardedPtr<KexiDB::Cursor> m_cursor; //! used to faster lookup columns of simple type (not dbaware) -// QDict<KexiTableViewColumn> *m_simpleColumnsByName; +// TQDict<KexiTableViewColumn> *m_simpleColumnsByName; KexiDB::ResultInfo m_result; uint m_visibleColumnsCount; - QValueVector<int> m_visibleColumnsIDs, m_globalColumnsIDs; + TQValueVector<int> m_visibleColumnsIDs, m_globalColumnsIDs; bool m_readOnly : 1; bool m_insertingEnabled : 1; @@ -534,7 +535,7 @@ protected: //! Temporary, used in compare functions like cmpInt(), cmpString() //! to avoid memory allocations. - QVariant m_leftTmp, m_rightTmp; + TQVariant m_leftTmp, m_rightTmp; }; #endif diff --git a/kexi/widget/tableview/kexitableviewheader.cpp b/kexi/widget/tableview/kexitableviewheader.cpp index 3656a041..05212dd1 100644 --- a/kexi/widget/tableview/kexitableviewheader.cpp +++ b/kexi/widget/tableview/kexitableviewheader.cpp @@ -19,9 +19,9 @@ #include "kexitableviewheader.h" -#include <qapplication.h> -#include <qtooltip.h> -#include <qstyle.h> +#include <tqapplication.h> +#include <tqtooltip.h> +#include <tqstyle.h> #include <kexiutils/utils.h> #include <kexiutils/styleproxy.h> @@ -31,105 +31,105 @@ class KexiTableViewHeaderStyle : public KexiUtils::StyleProxy { public: - KexiTableViewHeaderStyle(QStyle *parentStyle, QWidget *widget) - : KexiUtils::StyleProxy(parentStyle) + KexiTableViewHeaderStyle(TQStyle *tqparentStyle, TQWidget *widget) + : KexiUtils::StyleProxy(tqparentStyle) { - setBackgroundColor( widget->palette().active().background() ); + setBackgroundColor( widget->tqpalette().active().background() ); } ~KexiTableViewHeaderStyle() {} - 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 { - if (pe==QStyle::PE_HeaderSection) { - QColorGroup newCg(cg); - newCg.setColor(QColorGroup::Button, m_backgroundColor); - newCg.setColor(QColorGroup::Background, m_backgroundColor); //set background color as well (e.g. for thinkeramik) - m_style->drawPrimitive( pe, p, r, newCg, flags, option ); + if (pe==TQStyle::PE_HeaderSection) { + TQColorGroup newCg(cg); + newCg.setColor(TQColorGroup::Button, m_backgroundColor); + newCg.setColor(TQColorGroup::Background, m_backgroundColor); //set background color as well (e.g. for thinkeramik) + m_style->tqdrawPrimitive( pe, p, r, newCg, flags, option ); return; } - m_style->drawPrimitive( pe, p, r, cg, flags, option ); + m_style->tqdrawPrimitive( pe, p, r, cg, flags, option ); } - void setBackgroundColor( const QColor& color ) { m_backgroundColor = color; } + void setBackgroundColor( const TQColor& color ) { m_backgroundColor = color; } protected: - QColor m_backgroundColor; + TQColor m_backgroundColor; }; -KexiTableViewHeader::KexiTableViewHeader(QWidget * parent, const char * name) - : QHeader(parent, name) +KexiTableViewHeader::KexiTableViewHeader(TQWidget * tqparent, const char * name) + : TQHeader(tqparent, name) , m_lastToolTipSection(-1) - , m_selectionBackgroundColor(qApp->palette().active().highlight()) + , m_selectionBackgroundColor(tqApp->tqpalette().active().highlight()) , m_selectedSection(-1) , m_styleChangeEnabled(true) { - styleChange( style() ); + styleChange( tqstyle() ); installEventFilter(this); - connect(this, SIGNAL(sizeChange(int,int,int)), - this, SLOT(slotSizeChange(int,int,int))); + connect(this, TQT_SIGNAL(sizeChange(int,int,int)), + this, TQT_SLOT(slotSizeChange(int,int,int))); } KexiTableViewHeader::~KexiTableViewHeader() { } -void KexiTableViewHeader::styleChange( QStyle& oldStyle ) +void KexiTableViewHeader::styleChange( TQStyle& oldStyle ) { - QHeader::styleChange( oldStyle ); + TQHeader::styleChange( oldStyle ); if (!m_styleChangeEnabled) return; m_styleChangeEnabled = false; - setStyle( new KexiTableViewHeaderStyle(&qApp->style(), this) ); + setStyle( new KexiTableViewHeaderStyle(&tqApp->tqstyle(), this) ); m_styleChangeEnabled = true; } -int KexiTableViewHeader::addLabel ( const QString & s, int size ) +int KexiTableViewHeader::addLabel ( const TQString & s, int size ) { m_toolTips += ""; slotSizeChange(0,0,0);//refresh - return QHeader::addLabel(s, size); + return TQHeader::addLabel(s, size); } -int KexiTableViewHeader::addLabel ( const QIconSet & iconset, const QString & s, int size ) +int KexiTableViewHeader::addLabel ( const TQIconSet & iconset, const TQString & s, int size ) { m_toolTips += ""; slotSizeChange(0,0,0);//refresh - return QHeader::addLabel(iconset, s, size); + return TQHeader::addLabel(iconset, s, size); } void KexiTableViewHeader::removeLabel( int section ) { if (section < 0 || section >= count()) return; - QStringList::Iterator it = m_toolTips.begin(); + TQStringList::Iterator it = m_toolTips.begin(); it += section; m_toolTips.remove(it); slotSizeChange(0,0,0);//refresh - QHeader::removeLabel(section); + TQHeader::removeLabel(section); } -void KexiTableViewHeader::setToolTip( int section, const QString & toolTip ) +void KexiTableViewHeader::setToolTip( int section, const TQString & toolTip ) { if (section < 0 || section >= (int)m_toolTips.count()) return; m_toolTips[ section ] = toolTip; } -bool KexiTableViewHeader::eventFilter(QObject * watched, QEvent * e) +bool KexiTableViewHeader::eventFilter(TQObject * watched, TQEvent * e) { - if (e->type()==QEvent::MouseMove) { - const int section = sectionAt( static_cast<QMouseEvent*>(e)->x() ); + if (e->type()==TQEvent::MouseMove) { + const int section = sectionAt( TQT_TQMOUSEEVENT(e)->x() ); if (section != m_lastToolTipSection && section >= 0 && section < (int)m_toolTips.count()) { - QToolTip::remove(this, m_toolTipRect); - QString tip = m_toolTips[ section ]; + TQToolTip::remove(this, m_toolTipRect); + TQString tip = m_toolTips[ section ]; if (tip.isEmpty()) { //try label - QFontMetrics fm(font()); - int minWidth = fm.width( label( section ) ) + style().pixelMetric( QStyle::PM_HeaderMargin ); - QIconSet *iset = iconSet( section ); + TQFontMetrics fm(font()); + int minWidth = fm.width( label( section ) ) + tqstyle().tqpixelMetric( TQStyle::PM_HeaderMargin ); + TQIconSet *iset = iconSet( section ); if (iset) - minWidth += (2+iset->pixmap( QIconSet::Small, QIconSet::Normal ).width()); //taken from QHeader::sectionSizeHint() + minWidth += (2+iset->pixmap( TQIconSet::Small, TQIconSet::Normal ).width()); //taken from TQHeader::sectionSizeHint() if (minWidth > sectionSize( section )) tip = label( section ); } @@ -137,30 +137,30 @@ bool KexiTableViewHeader::eventFilter(QObject * watched, QEvent * e) m_lastToolTipSection = -1; } else { - QToolTip::add(this, m_toolTipRect = sectionRect(section), tip); + TQToolTip::add(this, m_toolTipRect = sectionRect(section), tip); m_lastToolTipSection = section; } } } -// if (e->type()==QEvent::MouseButtonPress) { +// if (e->type()==TQEvent::MouseButtonPress) { // todo // } - return QHeader::eventFilter(watched, e); + return TQHeader::eventFilter(watched, e); } void KexiTableViewHeader::slotSizeChange(int /*section*/, int /*oldSize*/, int /*newSize*/ ) { if (m_lastToolTipSection>0) - QToolTip::remove(this, m_toolTipRect); + TQToolTip::remove(this, m_toolTipRect); m_lastToolTipSection = -1; //tooltip's rect is now invalid } -void KexiTableViewHeader::setSelectionBackgroundColor(const QColor &color) +void KexiTableViewHeader::setSelectionBackgroundColor(const TQColor &color) { m_selectionBackgroundColor = color; } -QColor KexiTableViewHeader::selectionBackgroundColor() const +TQColor KexiTableViewHeader::selectionBackgroundColor() const { return m_selectionBackgroundColor; } @@ -182,20 +182,20 @@ int KexiTableViewHeader::selectedSection() const return m_selectedSection; } -void KexiTableViewHeader::paintSection( QPainter * p, int index, const QRect & fr ) +void KexiTableViewHeader::paintSection( TQPainter * p, int index, const TQRect & fr ) { const bool paintSelection = index==m_selectedSection && index != -1; if (paintSelection) { - static_cast<KexiTableViewHeaderStyle&>(style()).setBackgroundColor( + static_cast<KexiTableViewHeaderStyle&>(tqstyle()).setBackgroundColor( KexiUtils::blendedColors( - palette().active().background(), m_selectionBackgroundColor, 2, 1) ); + tqpalette().active().background(), m_selectionBackgroundColor, 2, 1) ); } - QHeader::paintSection( p, index, fr ); + TQHeader::paintSection( p, index, fr ); if (paintSelection) { //revert the color for subsequent paints - static_cast<KexiTableViewHeaderStyle&>(style()).setBackgroundColor( - palette().active().background()); + static_cast<KexiTableViewHeaderStyle&>(tqstyle()).setBackgroundColor( + tqpalette().active().background()); } } diff --git a/kexi/widget/tableview/kexitableviewheader.h b/kexi/widget/tableview/kexitableviewheader.h index 5da3fa7b..efc35055 100644 --- a/kexi/widget/tableview/kexitableviewheader.h +++ b/kexi/widget/tableview/kexitableviewheader.h @@ -20,9 +20,9 @@ #ifndef KEXITABLEVIEWHEADER_H #define KEXITABLEVIEWHEADER_H -#include <qheader.h> +#include <tqheader.h> -class QStyle; +class TQStyle; //! @short A table view header with additional actions. /*! Displays field description (Field::description()) text as tool tip, if available. @@ -30,44 +30,45 @@ class QStyle; \todo react on indexChange ( int section, int fromIndex, int toIndex ) signal */ -class KEXIDATATABLE_EXPORT KexiTableViewHeader : public QHeader +class KEXIDATATABLE_EXPORT KexiTableViewHeader : public TQHeader { Q_OBJECT + TQ_OBJECT public: - KexiTableViewHeader(QWidget * parent = 0, const char * name = 0); + KexiTableViewHeader(TQWidget * tqparent = 0, const char * name = 0); virtual ~KexiTableViewHeader(); - int addLabel( const QString & s, int size = -1 ); + int addLabel( const TQString & s, int size = -1 ); - int addLabel( const QIconSet & iconset, const QString & s, int size = -1 ); + int addLabel( const TQIconSet & iconset, const TQString & s, int size = -1 ); void removeLabel( int section ); /*! Sets \a toolTip for \a section. */ - void setToolTip( int section, const QString & toolTip ); + void setToolTip( int section, const TQString & toolTip ); - virtual bool eventFilter(QObject * watched, QEvent * e); + virtual bool eventFilter(TQObject * watched, TQEvent * e); void setSelectedSection(int section); int selectedSection() const; - QColor selectionBackgroundColor() const; - void setSelectionBackgroundColor(const QColor &color); + TQColor selectionBackgroundColor() const; + void setSelectionBackgroundColor(const TQColor &color); protected slots: void slotSizeChange(int section, int oldSize, int newSize ); protected: - virtual void paintSection ( QPainter * p, int index, const QRect & fr ); - virtual void styleChange( QStyle& oldStyle ); + virtual void paintSection ( TQPainter * p, int index, const TQRect & fr ); + virtual void styleChange( TQStyle& oldStyle ); int m_lastToolTipSection; - QRect m_toolTipRect; + TQRect m_toolTipRect; - QStringList m_toolTips; - QColor m_selectionBackgroundColor; + TQStringList m_toolTips; + TQColor m_selectionBackgroundColor; int m_selectedSection; bool m_styleChangeEnabled : 1; }; diff --git a/kexi/widget/tableview/kexitextformatter.cpp b/kexi/widget/tableview/kexitextformatter.cpp index f4e0b89d..b7388138 100644 --- a/kexi/widget/tableview/kexitextformatter.cpp +++ b/kexi/widget/tableview/kexitextformatter.cpp @@ -71,7 +71,7 @@ void KexiTextFormatter::setField( KexiDB::Field* field ) } } -QString KexiTextFormatter::valueToText(const QVariant& value, const QString& add) const +TQString KexiTextFormatter::valueToText(const TQVariant& value, const TQString& add) const { //cases, in order of expected frequency if (!d->field || d->field->isTextType()) @@ -86,16 +86,16 @@ QString KexiTextFormatter::valueToText(const QVariant& value, const QString& add if (value.toDouble() == 0.0) return add.isEmpty() ? "0" : add; //eat 0 #if 0 //moved to KexiDB::formatNumberForVisibleDecimalPlaces() - QString text( QString::number(value.toDouble(), 'f', - QMAX(d->field->visibleDecimalPlaces(), 10)) ); //!<-- 10 is quite good maximum for fractional digits + TQString text( TQString::number(value.toDouble(), 'f', + TQMAX(d->field->visibleDecimalPlaces(), 10)) ); //!<-- 10 is quite good maximum for fractional digits //!< @todo add command line settings? //! @todo (js): get decimal places settings here... - QStringList sl = QStringList::split(".", text); + TQStringList sl = TQStringList::split(".", text); //nothing } else if (sl.count()==2) { // kdDebug() << "sl.count()=="<<sl.count()<< " " <<sl[0] << " | " << sl[1] << endl; - const QString sl1 = sl[1]; + const TQString sl1 = sl[1]; int pos = sl1.length()-1; if (pos>=1) { for (;pos>=0 && sl1[pos]=='0';pos--) @@ -113,16 +113,16 @@ QString KexiTextFormatter::valueToText(const QVariant& value, const QString& add } else if (d->field->type() == KexiDB::Field::Boolean) { //! @todo temporary solution for booleans! - const bool boolValue = value.isNull() ? QVariant(add).toBool() : value.toBool(); + const bool boolValue = value.isNull() ? TQVariant(add).toBool() : value.toBool(); return boolValue ? "1" : "0"; } else if (d->field->type() == KexiDB::Field::Date) { - return d->dateFormatter->dateToString( value.toString().isEmpty() ? QDate() : value.toDate() ); + return d->dateFormatter->dateToString( value.toString().isEmpty() ? TQDate() : value.toDate() ); } else if (d->field->type() == KexiDB::Field::Time) { return d->timeFormatter->timeToString( - //hack to avoid converting null variant to valid QTime(0,0,0) - value.toString().isEmpty() ? value.toTime() : QTime(99,0,0) ); + //hack to avoid converting null variant to valid TQTime(0,0,0) + value.toString().isEmpty() ? value.toTime() : TQTime(99,0,0) ); } else if (d->field->type() == KexiDB::Field::DateTime) { if (value.toString().isEmpty() ) @@ -138,10 +138,10 @@ QString KexiTextFormatter::valueToText(const QVariant& value, const QString& add return value.toString() + add; } -QVariant KexiTextFormatter::textToValue(const QString& text) const +TQVariant KexiTextFormatter::textToValue(const TQString& text) const { if (!d->field) - return QVariant(); + return TQVariant(); const KexiDB::Field::Type t = d->field->type(); switch (t) { case KexiDB::Field::Text: @@ -157,7 +157,7 @@ QVariant KexiTextFormatter::textToValue(const QString& text) const return text.toLongLong(); case KexiDB::Field::Boolean: //! @todo temporary solution for booleans! - return text == "1" ? QVariant(true,1) : QVariant(false,0); + return text == "1" ? TQVariant(true,1) : TQVariant(false,0); case KexiDB::Field::Date: return d->dateFormatter->stringToVariant( text ); case KexiDB::Field::Time: @@ -167,8 +167,8 @@ QVariant KexiTextFormatter::textToValue(const QString& text) const case KexiDB::Field::Float: case KexiDB::Field::Double: { // replace custom decimal symbol with '.' as required by to{Float|Double}() - QString fixedText( text ); - fixedText.replace(KGlobal::locale()->decimalSymbol(), "."); + TQString fixedText( text ); + fixedText.tqreplace(KGlobal::locale()->decimalSymbol(), "."); if (t == KexiDB::Field::Double) return fixedText.toDouble(); return fixedText.toFloat(); @@ -179,7 +179,7 @@ QVariant KexiTextFormatter::textToValue(const QString& text) const //! @todo more data types! } -bool KexiTextFormatter::valueIsEmpty(const QString& text) const +bool KexiTextFormatter::valueIsEmpty(const TQString& text) const { if (text.isEmpty()) return true; @@ -198,7 +198,7 @@ bool KexiTextFormatter::valueIsEmpty(const QString& text) const return text.isEmpty(); } -bool KexiTextFormatter::valueIsValid(const QString& text) const +bool KexiTextFormatter::valueIsValid(const TQString& text) const { if (!d->field) return true; @@ -218,7 +218,7 @@ bool KexiTextFormatter::valueIsValid(const QString& text) const return true; } -QString KexiTextFormatter::inputMask() const +TQString KexiTextFormatter::inputMask() const { const KexiDB::Field::Type t = d->field->type(); if (t==KexiDB::Field::Date) { @@ -232,6 +232,6 @@ QString KexiTextFormatter::inputMask() const else if (t==KexiDB::Field::DateTime) { dateTimeInputMask( *d->dateFormatter, *d->timeFormatter ); } - return QString::null; + return TQString(); } diff --git a/kexi/widget/tableview/kexitextformatter.h b/kexi/widget/tableview/kexitextformatter.h index 3ea611a4..12e67a37 100644 --- a/kexi/widget/tableview/kexitextformatter.h +++ b/kexi/widget/tableview/kexitextformatter.h @@ -22,7 +22,7 @@ #include <kexidb/field.h> -//! @short Text formatter used to format QVariant values to text for displaying and back to QVariant +//! @short Text formatter used to format TQVariant values to text for displaying and back to TQVariant /*! Used by KexiInputTableEdit, KexiDateTableEdit, KexiTimeTableEdit, KexiDateTimeTableEdit, KexiDBLineEdit (forms), etc. */ class KEXIDATATABLE_EXPORT KexiTextFormatter @@ -38,24 +38,24 @@ class KEXIDATATABLE_EXPORT KexiTextFormatter A field schema set using setField() is used to perform the formatting. \a add is a text that should be added to the value if possible. Used in KexiInputTableEdit::setValueInternal(), by form widgets and for reporting/printing. */ - QString valueToText(const QVariant& value, const QString& add) const; + TQString valueToText(const TQVariant& value, const TQString& add) const; /*! \return value cnverted from \a text A field schema set using setField() is used to perform the formatting. Used in KexiInputTableEdit::setValueInternal(), by form widgets and for reporting/printing. */ - QVariant textToValue(const QString& text) const; + TQVariant textToValue(const TQString& text) const; /*! \return true if value formatted as \a text is empty. A field schema set using setField() is used to perform the calculation. */ - bool valueIsEmpty(const QString& text) const; + bool valueIsEmpty(const TQString& text) const; /*! \return true if value formatted as \a text is valid. A field schema set using setField() is used to perform the calculation. */ - bool valueIsValid(const QString& text) const; + bool valueIsValid(const TQString& text) const; - /*! \return input mask for intering values related to a field schema + /*! \return input tqmask for intering values related to a field schema which has been set using setField(). */ - QString inputMask() const; + TQString inputMask() const; class Private; Private *d; diff --git a/kexi/widget/tableview/kexitimetableedit.cpp b/kexi/widget/tableview/kexitimetableedit.cpp index 3238c58e..5f3313f7 100644 --- a/kexi/widget/tableview/kexitimetableedit.cpp +++ b/kexi/widget/tableview/kexitimetableedit.cpp @@ -19,20 +19,20 @@ #include "kexitimetableedit.h" -#include <qapplication.h> -#include <qpainter.h> -#include <qvariant.h> -#include <qrect.h> -#include <qpalette.h> -#include <qcolor.h> -#include <qfontmetrics.h> -#include <qdatetime.h> -#include <qcursor.h> -#include <qpoint.h> -#include <qlayout.h> -#include <qtoolbutton.h> -#include <qdatetimeedit.h> -#include <qclipboard.h> +#include <tqapplication.h> +#include <tqpainter.h> +#include <tqvariant.h> +#include <tqrect.h> +#include <tqpalette.h> +#include <tqcolor.h> +#include <tqfontmetrics.h> +#include <tqdatetime.h> +#include <tqcursor.h> +#include <tqpoint.h> +#include <tqlayout.h> +#include <tqtoolbutton.h> +#include <tqdatetimeedit.h> +#include <tqclipboard.h> #include <kdebug.h> #include <klocale.h> @@ -45,12 +45,12 @@ #include <kexiutils/utils.h> -KexiTimeTableEdit::KexiTimeTableEdit(KexiTableViewColumn &column, QWidget *parent) - : KexiInputTableEdit(column, parent) +KexiTimeTableEdit::KexiTimeTableEdit(KexiTableViewColumn &column, TQWidget *tqparent) + : KexiInputTableEdit(column, tqparent) { setName("KexiTimeTableEdit"); -//! @todo add QValidator so time like "99:88:77" cannot be even entered +//! @todo add TQValidator so time like "99:88:77" cannot be even entered m_lineedit->setInputMask( m_formatter.inputMask() ); } @@ -59,20 +59,20 @@ KexiTimeTableEdit::~KexiTimeTableEdit() { } -void KexiTimeTableEdit::setValueInInternalEditor(const QVariant &value) +void KexiTimeTableEdit::setValueInInternalEditor(const TQVariant &value) { if (value.isValid() && value.toTime().isValid()) m_lineedit->setText( m_formatter.timeToString( value.toTime() ) ); else - m_lineedit->setText( QString::null ); + m_lineedit->setText( TQString() ); } -void KexiTimeTableEdit::setValueInternal(const QVariant& add_, bool removeOld) +void KexiTimeTableEdit::setValueInternal(const TQVariant& add_, bool removeOld) { if (removeOld) { //new time entering... just fill the line edit //! @todo cut string if too long.. - QString add(add_.toString()); + TQString add(add_.toString()); m_lineedit->setText(add); m_lineedit->setCursorPosition(add.length()); return; @@ -81,20 +81,20 @@ void KexiTimeTableEdit::setValueInternal(const QVariant& add_, bool removeOld) m_lineedit->setCursorPosition(0); //ok? } -void KexiTimeTableEdit::setupContents( QPainter *p, bool focused, const QVariant& val, - QString &txt, int &align, int &x, int &y_offset, int &w, int &h ) +void KexiTimeTableEdit::setupContents( TQPainter *p, bool focused, const TQVariant& val, + TQString &txt, int &align, int &x, int &y_offset, int &w, int &h ) { Q_UNUSED(p); Q_UNUSED(focused); Q_UNUSED(x); Q_UNUSED(w); Q_UNUSED(h); -#ifdef Q_WS_WIN +#ifdef TQ_WS_WIN y_offset = -1; #else y_offset = 0; #endif - if (!val.isNull() && val.canCast(QVariant::Time)) + if (!val.isNull() && val.canCast(TQVariant::Time)) txt = m_formatter.timeToString(val.toTime()); align |= AlignLeft; } @@ -111,12 +111,12 @@ bool KexiTimeTableEdit::valueIsEmpty() return valueIsNull();// OK? TODO (nonsense?) } -QTime KexiTimeTableEdit::timeValue() +TQTime KexiTimeTableEdit::timeValue() { return m_formatter.stringToTime( m_lineedit->text() ); } -QVariant KexiTimeTableEdit::value() +TQVariant KexiTimeTableEdit::value() { return m_formatter.stringToVariant( m_lineedit->text() ); } @@ -128,21 +128,21 @@ bool KexiTimeTableEdit::valueIsValid() return m_formatter.stringToTime( m_lineedit->text() ).isValid(); } -void KexiTimeTableEdit::handleCopyAction(const QVariant& value, const QVariant& visibleValue) +void KexiTimeTableEdit::handleCopyAction(const TQVariant& value, const TQVariant& visibleValue) { Q_UNUSED(visibleValue); if (!value.isNull() && value.toTime().isValid()) - qApp->clipboard()->setText( m_formatter.timeToString(value.toTime()) ); + tqApp->clipboard()->setText( m_formatter.timeToString(value.toTime()) ); else - qApp->clipboard()->setText( QString::null ); + tqApp->clipboard()->setText( TQString() ); } -void KexiTimeTableEdit::handleAction(const QString& actionName) +void KexiTimeTableEdit::handleAction(const TQString& actionName) { const bool alreadyVisible = m_lineedit->isVisible(); if (actionName=="edit_paste") { - const QVariant newValue( m_formatter.stringToTime( qApp->clipboard()->text() ) ); + const TQVariant newValue( m_formatter.stringToTime( tqApp->clipboard()->text() ) ); if (!alreadyVisible) { //paste as the entire text if the cell was not in edit mode emit editRequested(); m_lineedit->clear(); diff --git a/kexi/widget/tableview/kexitimetableedit.h b/kexi/widget/tableview/kexitimetableedit.h index 4daa68ec..6c427bbd 100644 --- a/kexi/widget/tableview/kexitimetableedit.h +++ b/kexi/widget/tableview/kexitimetableedit.h @@ -24,7 +24,7 @@ #include <widget/utils/kexidatetimeformatter.h> /*! @short Editor class for Time type. - It is a replacement QTimeEdit due to usability problems: + It is a replacement TQTimeEdit due to usability problems: people are accustomed to use single-character cursor. Time format is retrieved from the KDE global settings and input/output is performed using KLineEdit (from KexiInputTableEdit). @@ -32,28 +32,29 @@ class KexiTimeTableEdit : public KexiInputTableEdit { Q_OBJECT + TQ_OBJECT public: - KexiTimeTableEdit(KexiTableViewColumn &column, QWidget *parent=0); + KexiTimeTableEdit(KexiTableViewColumn &column, TQWidget *tqparent=0); virtual ~KexiTimeTableEdit(); - virtual void setupContents( QPainter *p, bool focused, const QVariant& val, - QString &txt, int &align, int &x, int &y_offset, int &w, int &h ); - virtual QVariant value(); + virtual void setupContents( TQPainter *p, bool focused, const TQVariant& val, + TQString &txt, int &align, int &x, int &y_offset, int &w, int &h ); + virtual TQVariant value(); virtual bool valueIsNull(); virtual bool valueIsEmpty(); virtual bool valueIsValid(); /*! Reimplemented after KexiInputTableEdit. */ - virtual void handleAction(const QString& actionName); + virtual void handleAction(const TQString& actionName); /*! Reimplemented after KexiInputTableEdit. */ - virtual void handleCopyAction(const QVariant& value, const QVariant& visibleValue); + virtual void handleCopyAction(const TQVariant& value, const TQVariant& visibleValue); protected: //! helper - void setValueInInternalEditor(const QVariant &value); - virtual void setValueInternal(const QVariant& add, bool removeOld); - QTime timeValue(); + void setValueInInternalEditor(const TQVariant &value); + virtual void setValueInternal(const TQVariant& add, bool removeOld); + TQTime timeValue(); //! Used to format and convert time values KexiTimeFormatter m_formatter; |