summaryrefslogtreecommitdiffstats
path: root/krecipes/src/widgets/kdateedit.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'krecipes/src/widgets/kdateedit.cpp')
-rw-r--r--krecipes/src/widgets/kdateedit.cpp114
1 files changed, 57 insertions, 57 deletions
diff --git a/krecipes/src/widgets/kdateedit.cpp b/krecipes/src/widgets/kdateedit.cpp
index 7bab504..e29fa1a 100644
--- a/krecipes/src/widgets/kdateedit.cpp
+++ b/krecipes/src/widgets/kdateedit.cpp
@@ -21,10 +21,10 @@
Boston, MA 02110-1301 USA
*/
-#include <qapplication.h>
-#include <qlineedit.h>
-#include <qlistbox.h>
-#include <qvalidator.h>
+#include <ntqapplication.h>
+#include <ntqlineedit.h>
+#include <ntqlistbox.h>
+#include <ntqvalidator.h>
//#include <kcalendarsystem.h>
#include <kglobal.h>
@@ -34,9 +34,9 @@
#include "kdateedit.h"
-QRect desktopGeometry(QWidget* w)
+TQRect desktopGeometry(TQWidget* w)
{
- QDesktopWidget *dw = QApplication::desktop();
+ TQDesktopWidget *dw = TQApplication::desktop();
if (dw->isVirtualDesktop()) {
KConfigGroup group(KGlobal::config(), "Windows");
if (group.readBoolEntry("XineramaEnabled", true) &&
@@ -52,14 +52,14 @@ QRect desktopGeometry(QWidget* w)
}
}
-class DateValidator : public QValidator
+class DateValidator : public TQValidator
{
public:
- DateValidator( const QStringList &keywords, QWidget* parent, const char* name = 0 )
- : QValidator( parent, name ), mKeywords( keywords )
+ DateValidator( const TQStringList &keywords, TQWidget* parent, const char* name = 0 )
+ : TQValidator( parent, name ), mKeywords( keywords )
{}
- virtual State validate( QString &str, int& ) const
+ virtual State validate( TQString &str, int& ) const
{
int length = str.length();
@@ -79,19 +79,19 @@ class DateValidator : public QValidator
}
private:
- QStringList mKeywords;
+ TQStringList mKeywords;
};
-KDateEdit::KDateEdit( QWidget *parent, const char *name )
- : QComboBox( true, parent, name ),
+KDateEdit::KDateEdit( TQWidget *parent, const char *name )
+ : TQComboBox( true, parent, name ),
mReadOnly( false ),
mDiscardNextMousePress( false )
{
// need at least one entry for popup to work
setMaxCount( 1 );
- mDate = QDate::currentDate();
- QString today = KGlobal::locale()->formatDate( mDate, true );
+ mDate = TQDate::currentDate();
+ TQString today = KGlobal::locale()->formatDate( mDate, true );
insertItem( today );
setCurrentItem( 0 );
@@ -100,15 +100,15 @@ KDateEdit::KDateEdit( QWidget *parent, const char *name )
connect( lineEdit(), SIGNAL( returnPressed() ),
this, SLOT( lineEnterPressed() ) );
- connect( this, SIGNAL( textChanged( const QString& ) ),
- SLOT( slotTextChanged( const QString& ) ) );
+ connect( this, SIGNAL( textChanged( const TQString& ) ),
+ SLOT( slotTextChanged( const TQString& ) ) );
mPopup = new KDatePickerPopup( KDatePickerPopup::DatePicker | KDatePickerPopup::Words );
mPopup->hide();
mPopup->installEventFilter( this );
- connect( mPopup, SIGNAL( dateChanged( QDate ) ),
- SLOT( dateSelected( QDate ) ) );
+ connect( mPopup, SIGNAL( dateChanged( TQDate ) ),
+ SLOT( dateSelected( TQDate ) ) );
// handle keyword entry
setupKeywords();
@@ -125,13 +125,13 @@ KDateEdit::~KDateEdit()
mPopup = 0;
}
-void KDateEdit::setDate( const QDate& date )
+void KDateEdit::setDate( const TQDate& date )
{
assignDate( date );
updateView();
}
-QDate KDateEdit::date() const
+TQDate KDateEdit::date() const
{
return mDate;
}
@@ -152,9 +152,9 @@ void KDateEdit::popup()
if ( mReadOnly )
return;
- QRect desk = desktopGeometry( this );
+ TQRect desk = desktopGeometry( this );
- QPoint popupPoint = mapToGlobal( QPoint( 0,0 ) );
+ TQPoint popupPoint = mapToGlobal( TQPoint( 0,0 ) );
int dateFrameHeight = mPopup->sizeHint().height();
if ( popupPoint.y() + height() + dateFrameHeight > desk.bottom() )
@@ -175,26 +175,26 @@ void KDateEdit::popup()
if ( mDate.isValid() )
mPopup->setDate( mDate );
else
- mPopup->setDate( QDate::currentDate() );
+ mPopup->setDate( TQDate::currentDate() );
mPopup->popup( popupPoint );
// The combo box is now shown pressed. Make it show not pressed again
// by causing its (invisible) list box to emit a 'selected' signal.
// First, ensure that the list box contains the date currently displayed.
- QDate date = parseDate();
+ TQDate date = parseDate();
assignDate( date );
updateView();
// Now, simulate an Enter to unpress it
- QListBox *lb = listBox();
+ TQListBox *lb = listBox();
if (lb) {
lb->setCurrentItem(0);
- QKeyEvent* keyEvent = new QKeyEvent(QEvent::KeyPress, Qt::Key_Enter, 0, 0);
- QApplication::postEvent(lb, keyEvent);
+ TQKeyEvent* keyEvent = new TQKeyEvent(TQEvent::KeyPress, TQt::Key_Enter, 0, 0);
+ TQApplication::postEvent(lb, keyEvent);
}
}
-void KDateEdit::dateSelected( QDate date )
+void KDateEdit::dateSelected( TQDate date )
{
if (assignDate( date ) ) {
updateView();
@@ -206,7 +206,7 @@ void KDateEdit::dateSelected( QDate date )
}
}
-void KDateEdit::dateEntered( QDate date )
+void KDateEdit::dateEntered( TQDate date )
{
if (assignDate( date ) ) {
updateView();
@@ -218,7 +218,7 @@ void KDateEdit::lineEnterPressed()
{
bool replaced = false;
- QDate date = parseDate( &replaced );
+ TQDate date = parseDate( &replaced );
if (assignDate( date ) ) {
if ( replaced )
@@ -228,18 +228,18 @@ void KDateEdit::lineEnterPressed()
}
}
-QDate KDateEdit::parseDate( bool *replaced ) const
+TQDate KDateEdit::parseDate( bool *replaced ) const
{
- QString text = currentText();
- QDate result;
+ TQString text = currentText();
+ TQDate result;
if ( replaced )
(*replaced) = false;
if ( text.isEmpty() )
- result = QDate();
+ result = TQDate();
else if ( mKeywordMap.contains( text.lower() ) ) {
- QDate today = QDate::currentDate();
+ TQDate today = TQDate::currentDate();
int i = mKeywordMap[ text.lower() ];
if ( i >= 100 ) {
/* A day name has been entered. Convert to offset from today.
@@ -268,30 +268,30 @@ QDate KDateEdit::parseDate( bool *replaced ) const
return result;
}
-bool KDateEdit::eventFilter( QObject *object, QEvent *event )
+bool KDateEdit::eventFilter( TQObject *object, TQEvent *event )
{
if ( object == lineEdit() ) {
// We only process the focus out event if the text has changed
// since we got focus
- if ( (event->type() == QEvent::FocusOut) && mTextChanged ) {
+ if ( (event->type() == TQEvent::FocusOut) && mTextChanged ) {
lineEnterPressed();
mTextChanged = false;
- } else if ( event->type() == QEvent::KeyPress ) {
+ } else if ( event->type() == TQEvent::KeyPress ) {
// Up and down arrow keys step the date
- QKeyEvent* keyEvent = (QKeyEvent*)event;
+ TQKeyEvent* keyEvent = (TQKeyEvent*)event;
- if ( keyEvent->key() == Qt::Key_Return ) {
+ if ( keyEvent->key() == TQt::Key_Return ) {
lineEnterPressed();
return true;
}
int step = 0;
- if ( keyEvent->key() == Qt::Key_Up )
+ if ( keyEvent->key() == TQt::Key_Up )
step = 1;
- else if ( keyEvent->key() == Qt::Key_Down )
+ else if ( keyEvent->key() == TQt::Key_Down )
step = -1;
if ( step && !mReadOnly ) {
- QDate date = parseDate();
+ TQDate date = parseDate();
if ( date.isValid() ) {
date = date.addDays( step );
if ( assignDate( date ) ) {
@@ -305,12 +305,12 @@ bool KDateEdit::eventFilter( QObject *object, QEvent *event )
} else {
// It's a date picker event
switch ( event->type() ) {
- case QEvent::MouseButtonDblClick:
- case QEvent::MouseButtonPress: {
- QMouseEvent *mouseEvent = (QMouseEvent*)event;
+ case TQEvent::MouseButtonDblClick:
+ case TQEvent::MouseButtonPress: {
+ TQMouseEvent *mouseEvent = (TQMouseEvent*)event;
if ( !mPopup->rect().contains( mouseEvent->pos() ) ) {
- QPoint globalPos = mPopup->mapToGlobal( mouseEvent->pos() );
- if ( QApplication::widgetAt( globalPos, true ) == this ) {
+ TQPoint globalPos = mPopup->mapToGlobal( mouseEvent->pos() );
+ if ( TQApplication::widgetAt( globalPos, true ) == this ) {
// The date picker is being closed by a click on the
// KDateEdit widget. Avoid popping it up again immediately.
mDiscardNextMousePress = true;
@@ -327,19 +327,19 @@ bool KDateEdit::eventFilter( QObject *object, QEvent *event )
return false;
}
-void KDateEdit::mousePressEvent( QMouseEvent *event )
+void KDateEdit::mousePressEvent( TQMouseEvent *event )
{
- if ( event->button() == Qt::LeftButton && mDiscardNextMousePress ) {
+ if ( event->button() == TQt::LeftButton && mDiscardNextMousePress ) {
mDiscardNextMousePress = false;
return;
}
- QComboBox::mousePressEvent( event );
+ TQComboBox::mousePressEvent( event );
}
-void KDateEdit::slotTextChanged( const QString& )
+void KDateEdit::slotTextChanged( const TQString& )
{
- QDate date = parseDate();
+ TQDate date = parseDate();
if ( assignDate( date ) )
emit dateChanged( date );
@@ -356,7 +356,7 @@ void KDateEdit::setupKeywords()
mKeywordMap.insert( i18n( "yesterday" ), -1 );
#if 0 //depends on KDE 3.2
- QString dayName;
+ TQString dayName;
for ( int i = 1; i <= 7; ++i ) {
dayName = KGlobal::locale()->calendar()->weekDayName( i ).lower();
mKeywordMap.insert( dayName, i + 100 );
@@ -364,7 +364,7 @@ void KDateEdit::setupKeywords()
#endif
}
-bool KDateEdit::assignDate( const QDate& date )
+bool KDateEdit::assignDate( const TQDate& date )
{
mDate = date;
mTextChanged = false;
@@ -373,7 +373,7 @@ bool KDateEdit::assignDate( const QDate& date )
void KDateEdit::updateView()
{
- QString dateString;
+ TQString dateString;
if ( mDate.isValid() )
dateString = KGlobal::locale()->formatDate( mDate, true );