diff options
Diffstat (limited to 'kexi/plugins/forms/widgets/kexidbdatetimeedit.cpp')
-rw-r--r-- | kexi/plugins/forms/widgets/kexidbdatetimeedit.cpp | 96 |
1 files changed, 48 insertions, 48 deletions
diff --git a/kexi/plugins/forms/widgets/kexidbdatetimeedit.cpp b/kexi/plugins/forms/widgets/kexidbdatetimeedit.cpp index faaeca66..e99e4651 100644 --- a/kexi/plugins/forms/widgets/kexidbdatetimeedit.cpp +++ b/kexi/plugins/forms/widgets/kexidbdatetimeedit.cpp @@ -20,62 +20,62 @@ #include "kexidbdatetimeedit.h" -#include <qtoolbutton.h> -#include <qlayout.h> +#include <tqtoolbutton.h> +#include <tqlayout.h> #include <kpopupmenu.h> #include <kdatepicker.h> #include <kdatetbl.h> #include <kexiutils/utils.h> -KexiDBDateTimeEdit::KexiDBDateTimeEdit(const QDateTime &datetime, QWidget *parent, const char *name) - : QWidget(parent, name), KexiFormDataItemInterface() +KexiDBDateTimeEdit::KexiDBDateTimeEdit(const TQDateTime &datetime, TQWidget *tqparent, const char *name) + : TQWidget(tqparent, name), KexiFormDataItemInterface() { m_invalidState = false; m_cleared = false; m_readOnly = false; - m_dateEdit = new QDateEdit(datetime.date(), this); + m_dateEdit = new TQDateEdit(datetime.date(), this); m_dateEdit->setAutoAdvance(true); - m_dateEdit->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::MinimumExpanding); -// m_dateEdit->setFixedWidth( QFontMetrics(m_dateEdit->font()).width("8888-88-88___") ); - connect(m_dateEdit, SIGNAL(valueChanged(const QDate&)), this, SLOT(slotValueChanged())); - connect(m_dateEdit, SIGNAL(valueChanged(const QDate&)), this, SIGNAL(dateTimeChanged())); + m_dateEdit->tqsetSizePolicy(TQSizePolicy::Minimum, TQSizePolicy::MinimumExpanding); +// m_dateEdit->setFixedWidth( TQFontMetrics(m_dateEdit->font()).width("8888-88-88___") ); + connect(m_dateEdit, TQT_SIGNAL(valueChanged(const TQDate&)), this, TQT_SLOT(slotValueChanged())); + connect(m_dateEdit, TQT_SIGNAL(valueChanged(const TQDate&)), this, TQT_SIGNAL(dateTimeChanged())); - 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 - m_timeEdit = new QTimeEdit(datetime.time(), this);; + m_timeEdit = new TQTimeEdit(datetime.time(), this);; m_timeEdit->setAutoAdvance(true); - m_timeEdit->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::MinimumExpanding); - connect(m_timeEdit, SIGNAL(valueChanged(const QTime&)), this, SLOT(slotValueChanged())); - connect(m_timeEdit, SIGNAL(valueChanged(const QTime&)), this, SIGNAL(dateTimeChanged())); + m_timeEdit->tqsetSizePolicy(TQSizePolicy::Minimum, TQSizePolicy::MinimumExpanding); + connect(m_timeEdit, TQT_SIGNAL(valueChanged(const TQTime&)), this, TQT_SLOT(slotValueChanged())); + connect(m_timeEdit, TQT_SIGNAL(valueChanged(const TQTime&)), this, TQT_SIGNAL(dateTimeChanged())); -#ifdef QDateTimeEditor_HACK - m_dte_date = KexiUtils::findFirstChild<QDateTimeEditor>(m_dateEdit, "QDateTimeEditor"); - m_dte_time = KexiUtils::findFirstChild<QDateTimeEditor>(m_timeEdit, "QDateTimeEditor"); +#ifdef TQDateTimeEditor_HACK + m_dte_date = KexiUtils::findFirstChild<TQDateTimeEditor>(m_dateEdit, "TQDateTimeEditor"); + m_dte_time = KexiUtils::findFirstChild<TQDateTimeEditor>(m_timeEdit, "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_dateEdit, 0); - layout->addWidget(btn, 0); - layout->addWidget(m_timeEdit, 0); - //layout->addStretch(1); + TQHBoxLayout* tqlayout = new TQHBoxLayout(this); + tqlayout->addWidget(m_dateEdit, 0); + tqlayout->addWidget(btn, 0); + tqlayout->addWidget(m_timeEdit, 0); + //tqlayout->addStretch(1); setFocusProxy(m_dateEdit); } @@ -84,14 +84,14 @@ KexiDBDateTimeEdit::~KexiDBDateTimeEdit() { } -void KexiDBDateTimeEdit::setInvalidState(const QString & /*! @todo paint this text: text*/) +void KexiDBDateTimeEdit::setInvalidState(const TQString & /*! @todo paint this text: text*/) { setEnabled(false); setReadOnly(true); m_invalidState = true; //! @todo move this to KexiDataItemInterface::setInvalidStateInternal() ? if (focusPolicy() & TabFocus) - setFocusPolicy(QWidget::ClickFocus); + setFocusPolicy(TQ_ClickFocus); } void @@ -100,19 +100,19 @@ KexiDBDateTimeEdit::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 KexiDBDateTimeEdit::setValueInternal(const QVariant &, bool ) +void KexiDBDateTimeEdit::setValueInternal(const TQVariant &, bool ) { m_dateEdit->setDate(m_origValue.toDate()); m_timeEdit->setTime(m_origValue.toTime()); } -QVariant +TQVariant KexiDBDateTimeEdit::value() { - return QDateTime(m_dateEdit->date(), m_timeEdit->time()); + return TQDateTime(m_dateEdit->date(), m_timeEdit->time()); } bool KexiDBDateTimeEdit::valueIsNull() @@ -138,7 +138,7 @@ void KexiDBDateTimeEdit::setReadOnly(bool set) m_readOnly = set; } -QWidget* +TQWidget* KexiDBDateTimeEdit::widget() { return m_dateEdit; @@ -146,7 +146,7 @@ KexiDBDateTimeEdit::widget() bool KexiDBDateTimeEdit::cursorAtStart() { -#ifdef QDateTimeEditor_HACK +#ifdef TQDateTimeEditor_HACK return m_dte_date && m_dateEdit->hasFocus() && m_dte_date->focusSection()==0; #else return false; @@ -155,7 +155,7 @@ bool KexiDBDateTimeEdit::cursorAtStart() bool KexiDBDateTimeEdit::cursorAtEnd() { -#ifdef QDateTimeEditor_HACK +#ifdef TQDateTimeEditor_HACK return m_dte_time && m_timeEdit->hasFocus() && m_dte_time->focusSection()==int(m_dte_time->sectionCount()-1); #else @@ -165,8 +165,8 @@ bool KexiDBDateTimeEdit::cursorAtEnd() void KexiDBDateTimeEdit::clear() { - m_dateEdit->setDate(QDate()); - m_timeEdit->setTime(QTime()); + m_dateEdit->setDate(TQDate()); + m_timeEdit->setTime(TQTime()); m_cleared = true; } @@ -179,7 +179,7 @@ KexiDBDateTimeEdit::slotValueChanged() void KexiDBDateTimeEdit::slotShowDatePicker() { - QDate date = m_dateEdit->date(); + TQDate date = m_dateEdit->date(); m_datePicker->setDate(date); m_datePicker->setFocus(); @@ -195,24 +195,24 @@ KexiDBDateTimeEdit::acceptDate() } bool -KexiDBDateTimeEdit::eventFilter(QObject *o, QEvent *e) +KexiDBDateTimeEdit::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; @@ -227,14 +227,14 @@ KexiDBDateTimeEdit::eventFilter(QObject *o, QEvent *e) return false; } -QDateTime +TQDateTime KexiDBDateTimeEdit::dateTime() const { - return QDateTime(m_dateEdit->date(), m_timeEdit->time()); + return TQDateTime(m_dateEdit->date(), m_timeEdit->time()); } void -KexiDBDateTimeEdit::setDateTime(const QDateTime &dt) +KexiDBDateTimeEdit::setDateTime(const TQDateTime &dt) { m_dateEdit->setDate(dt.date()); m_timeEdit->setTime(dt.time()); |