diff options
Diffstat (limited to 'kexi/widget/tableview/kexidatetableedit.cpp')
-rw-r--r-- | kexi/widget/tableview/kexidatetableedit.cpp | 116 |
1 files changed, 58 insertions, 58 deletions
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) |