diff options
Diffstat (limited to 'kexi/plugins/forms/widgets/kexidbdateedit.cpp')
-rw-r--r-- | kexi/plugins/forms/widgets/kexidbdateedit.cpp | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/kexi/plugins/forms/widgets/kexidbdateedit.cpp b/kexi/plugins/forms/widgets/kexidbdateedit.cpp index 32584fce..9638f93a 100644 --- a/kexi/plugins/forms/widgets/kexidbdateedit.cpp +++ b/kexi/plugins/forms/widgets/kexidbdateedit.cpp @@ -19,8 +19,8 @@ */ #include "kexidbdateedit.h" -#include <qlayout.h> -#include <qtoolbutton.h> +#include <tqlayout.h> +#include <tqtoolbutton.h> #include <kpopupmenu.h> #include <kdatepicker.h> #include <kdatetbl.h> @@ -28,45 +28,45 @@ #include <kexiutils/utils.h> #include <kexidb/queryschema.h> -KexiDBDateEdit::KexiDBDateEdit(const QDate &date, QWidget *parent, const char *name) - : QWidget(parent, name), KexiFormDataItemInterface() +KexiDBDateEdit::KexiDBDateEdit(const TQDate &date, TQWidget *tqparent, const char *name) + : TQWidget(tqparent, name), KexiFormDataItemInterface() { m_invalidState = false; m_cleared = false; m_readOnly = false; - m_edit = new QDateEdit(date, this); + m_edit = new TQDateEdit(date, this); m_edit->setAutoAdvance(true); - m_edit->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::MinimumExpanding); - connect( m_edit, SIGNAL(valueChanged(const QDate&)), this, SLOT(slotValueChanged(const QDate&)) ); - connect( m_edit, SIGNAL(valueChanged(const QDate&)), this, SIGNAL(dateChanged(const QDate&)) ); + m_edit->tqsetSizePolicy(TQSizePolicy::Minimum, TQSizePolicy::MinimumExpanding); + connect( m_edit, TQT_SIGNAL(valueChanged(const TQDate&)), this, TQT_SLOT(slotValueChanged(const TQDate&)) ); + connect( m_edit, TQT_SIGNAL(valueChanged(const TQDate&)), this, TQT_SIGNAL(dateChanged(const TQDate&)) ); - QToolButton* btn = new QToolButton(this); + TQToolButton* btn = new TQToolButton(this); btn->setText("..."); - btn->setFixedWidth( QFontMetrics(btn->font()).width(" ... ") ); + btn->setFixedWidth( TQFontMetrics(btn->font()).width(" ... ") ); btn->setPopupDelay(1); //1 ms -#ifdef QDateTimeEditor_HACK - m_dte_date = KexiUtils::findFirstChild<QDateTimeEditor>(m_edit, "QDateTimeEditor"); +#ifdef TQDateTimeEditor_HACK + m_dte_date = KexiUtils::findFirstChild<TQDateTimeEditor>(m_edit, "TQDateTimeEditor"); #else m_dte_date = 0; #endif m_datePickerPopupMenu = new KPopupMenu(0, "date_popup"); - connect(m_datePickerPopupMenu, SIGNAL(aboutToShow()), this, SLOT(slotShowDatePicker())); - m_datePicker = new KDatePicker(m_datePickerPopupMenu, QDate::currentDate(), 0); + connect(m_datePickerPopupMenu, TQT_SIGNAL(aboutToShow()), this, TQT_SLOT(slotShowDatePicker())); + m_datePicker = new KDatePicker(m_datePickerPopupMenu, TQDate::tqcurrentDate(), 0); KDateTable *dt = KexiUtils::findFirstChild<KDateTable>(m_datePicker, "KDateTable"); if (dt) - connect(dt, SIGNAL(tableClicked()), this, SLOT(acceptDate())); + connect(dt, TQT_SIGNAL(tableClicked()), this, TQT_SLOT(acceptDate())); m_datePicker->setCloseButton(true); m_datePicker->installEventFilter(this); m_datePickerPopupMenu->insertItem(m_datePicker); btn->setPopup(m_datePickerPopupMenu); - QHBoxLayout* layout = new QHBoxLayout(this); - layout->addWidget(m_edit, 1); - layout->addWidget(btn, 0); + TQHBoxLayout* tqlayout = new TQHBoxLayout(this); + tqlayout->addWidget(m_edit, 1); + tqlayout->addWidget(btn, 0); setFocusProxy(m_edit); } @@ -75,14 +75,14 @@ KexiDBDateEdit::~KexiDBDateEdit() { } -void KexiDBDateEdit::setInvalidState( const QString& ) +void KexiDBDateEdit::setInvalidState( const TQString& ) { setEnabled(false); setReadOnly(true); m_invalidState = true; //! @todo move this to KexiDataItemInterface::setInvalidStateInternal() ? if (focusPolicy() & TabFocus) - setFocusPolicy(QWidget::ClickFocus); + setFocusPolicy(TQ_ClickFocus); } void @@ -91,18 +91,18 @@ KexiDBDateEdit::setEnabled(bool enabled) // prevent the user from reenabling the widget when it is in invalid state if(enabled && m_invalidState) return; - QWidget::setEnabled(enabled); + TQWidget::setEnabled(enabled); } -void KexiDBDateEdit::setValueInternal(const QVariant &add, bool removeOld) +void KexiDBDateEdit::setValueInternal(const TQVariant &add, bool removeOld) { int setNumberOnFocus = -1; - QDate d; - QString addString(add.toString()); + TQDate d; + TQString addString(add.toString()); if (removeOld) { if (!addString.isEmpty() && addString[0].latin1()>='0' && addString[0].latin1() <='9') { setNumberOnFocus = addString[0].latin1()-'0'; - d = QDate(setNumberOnFocus*1000, 1, 1); + d = TQDate(setNumberOnFocus*1000, 1, 1); } } else @@ -111,10 +111,10 @@ void KexiDBDateEdit::setValueInternal(const QVariant &add, bool removeOld) m_edit->setDate(d); } -QVariant +TQVariant KexiDBDateEdit::value() { - return QVariant(m_edit->date()); + return TQVariant(m_edit->date()); } bool KexiDBDateEdit::valueIsNull() @@ -139,7 +139,7 @@ void KexiDBDateEdit::setReadOnly(bool set) m_readOnly = set; } -QWidget* +TQWidget* KexiDBDateEdit::widget() { return this; @@ -147,7 +147,7 @@ KexiDBDateEdit::widget() bool KexiDBDateEdit::cursorAtStart() { -#ifdef QDateTimeEditor_HACK +#ifdef TQDateTimeEditor_HACK return m_dte_date && m_edit->hasFocus() && m_dte_date->focusSection()==0; #else return false; @@ -156,7 +156,7 @@ bool KexiDBDateEdit::cursorAtStart() bool KexiDBDateEdit::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 @@ -166,12 +166,12 @@ bool KexiDBDateEdit::cursorAtEnd() void KexiDBDateEdit::clear() { - m_edit->setDate(QDate()); + m_edit->setDate(TQDate()); m_cleared = true; } void -KexiDBDateEdit::slotValueChanged(const QDate&) +KexiDBDateEdit::slotValueChanged(const TQDate&) { m_cleared = false; } @@ -179,7 +179,7 @@ KexiDBDateEdit::slotValueChanged(const QDate&) void KexiDBDateEdit::slotShowDatePicker() { - QDate date = m_edit->date(); + TQDate date = m_edit->date(); m_datePicker->setDate(date); m_datePicker->setFocus(); @@ -195,24 +195,24 @@ KexiDBDateEdit::acceptDate() } bool -KexiDBDateEdit::eventFilter(QObject *o, QEvent *e) +KexiDBDateEdit::eventFilter(TQObject *o, TQEvent *e) { if (o != m_datePicker) return false; switch (e->type()) { - case QEvent::Hide: + case TQEvent::Hide: m_datePickerPopupMenu->hide(); break; - case QEvent::KeyPress: - case QEvent::KeyRelease: { - QKeyEvent *ke = (QKeyEvent *)e; - if (ke->key()==Qt::Key_Enter || ke->key()==Qt::Key_Return) { + case TQEvent::KeyPress: + case TQEvent::KeyRelease: { + TQKeyEvent *ke = (TQKeyEvent *)e; + if (ke->key()==TQt::Key_Enter || ke->key()==TQt::Key_Return) { //accepting picker acceptDate(); return true; } - else if (ke->key()==Qt::Key_Escape) { + else if (ke->key()==TQt::Key_Escape) { //canceling picker m_datePickerPopupMenu->hide(); return true; |