summaryrefslogtreecommitdiffstats
path: root/libkdepim/kdateedit.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libkdepim/kdateedit.cpp')
-rw-r--r--libkdepim/kdateedit.cpp102
1 files changed, 51 insertions, 51 deletions
diff --git a/libkdepim/kdateedit.cpp b/libkdepim/kdateedit.cpp
index 29b65279d..1791d4dab 100644
--- a/libkdepim/kdateedit.cpp
+++ b/libkdepim/kdateedit.cpp
@@ -22,10 +22,10 @@
Boston, MA 02110-1301, USA.
*/
-#include <qapplication.h>
-#include <qlineedit.h>
-#include <qlistbox.h>
-#include <qvalidator.h>
+#include <tqapplication.h>
+#include <tqlineedit.h>
+#include <tqlistbox.h>
+#include <tqvalidator.h>
#include <kcalendarsystem.h>
#include <kglobal.h>
@@ -37,11 +37,11 @@
class DateValidator : public QValidator
{
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();
@@ -61,36 +61,36 @@ 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 );
changeItem( today, 0 );
setMinimumSize( sizeHint() );
- connect( lineEdit(), SIGNAL( returnPressed() ),
- this, SLOT( lineEnterPressed() ) );
- connect( this, SIGNAL( textChanged( const QString& ) ),
- SLOT( slotTextChanged( const QString& ) ) );
+ connect( lineEdit(), TQT_SIGNAL( returnPressed() ),
+ this, TQT_SLOT( lineEnterPressed() ) );
+ connect( this, TQT_SIGNAL( textChanged( const TQString& ) ),
+ TQT_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, TQT_SIGNAL( dateChanged( TQDate ) ),
+ TQT_SLOT( dateSelected( TQDate ) ) );
// handle keyword entry
setupKeywords();
@@ -107,13 +107,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;
}
@@ -134,9 +134,9 @@ void KDateEdit::popup()
if ( mReadOnly )
return;
- QRect desk = KGlobalSettings::desktopGeometry( this );
+ TQRect desk = KGlobalSettings::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() )
@@ -157,26 +157,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, Qt::Key_Enter, 0, 0);
+ TQApplication::postEvent(lb, keyEvent);
}
}
-void KDateEdit::dateSelected( QDate date )
+void KDateEdit::dateSelected( TQDate date )
{
if (assignDate( date ) ) {
updateView();
@@ -193,7 +193,7 @@ void KDateEdit::lineEnterPressed()
{
bool replaced = false;
- QDate date = parseDate( &replaced );
+ TQDate date = parseDate( &replaced );
if (assignDate( date ) ) {
if ( replaced )
@@ -204,18 +204,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.
@@ -244,17 +244,17 @@ 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 ) {
lineEnterPressed();
@@ -268,7 +268,7 @@ bool KDateEdit::eventFilter( QObject *object, QEvent *event )
step = -1;
// TODO: If it's not an input key, but something like Return, Enter, Tab, etc..., don't eat the keypress, but handle it through to the default eventfilter!
if ( step && !mReadOnly ) {
- QDate date = parseDate();
+ TQDate date = parseDate();
if ( date.isValid() ) {
date = date.addDays( step );
if ( assignDate( date ) ) {
@@ -283,12 +283,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;
@@ -305,19 +305,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 ) {
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 );
@@ -333,14 +333,14 @@ void KDateEdit::setupKeywords()
mKeywordMap.insert( i18n( "today" ), 0 );
mKeywordMap.insert( i18n( "yesterday" ), -1 );
- QString dayName;
+ TQString dayName;
for ( int i = 1; i <= 7; ++i ) {
dayName = KGlobal::locale()->calendar()->weekDayName( i ).lower();
mKeywordMap.insert( dayName, i + 100 );
}
}
-bool KDateEdit::assignDate( const QDate& date )
+bool KDateEdit::assignDate( const TQDate& date )
{
mDate = date;
mTextChanged = false;
@@ -349,7 +349,7 @@ bool KDateEdit::assignDate( const QDate& date )
void KDateEdit::updateView()
{
- QString dateString;
+ TQString dateString;
if ( mDate.isValid() )
dateString = KGlobal::locale()->formatDate( mDate, true );