libkdepim

kdateedit.h

00001 /*
00002     This file is part of libkdepim.
00003 
00004     Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org>
00005     Copyright (c) 2002 David Jarvie <software@astrojar.org.uk>
00006     Copyright (c) 2004 Tobias Koenig <tokoe@kde.org>
00007 
00008     This library is free software; you can redistribute it and/or
00009     modify it under the terms of the GNU Library General Public
00010     License as published by the Free Software Foundation; either
00011     version 2 of the License, or (at your option) any later version.
00012 
00013     This library is distributed in the hope that it will be useful,
00014     but WITHOUT ANY WARRANTY; without even the implied warranty of
00015     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016     Library General Public License for more details.
00017 
00018     You should have received a copy of the GNU Library General Public License
00019     along with this library; see the file COPYING.LIB.  If not, write to
00020     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00021     Boston, MA 02110-1301, USA.
00022 */
00023 
00024 #ifndef KDATEEDIT_H
00025 #define KDATEEDIT_H
00026 
00027 #include <tqcombobox.h>
00028 #include <tqdatetime.h>
00029 #include <tqmap.h>
00030 
00031 #include <kdepimmacros.h>
00032 
00033 #include "kdatepickerpopup.h"
00034 
00035 class TQEvent;
00036 
00054 class KDE_EXPORT KDateEdit : public QComboBox
00055 {
00056   Q_OBJECT
00057 
00058   public:
00059     KDateEdit( TQWidget *parent = 0, const char *name = 0 );
00060     virtual ~KDateEdit();
00061 
00066     TQDate date() const;
00067 
00074     void setReadOnly( bool readOnly );
00075 
00079     bool isReadOnly() const;
00080 
00081     virtual void popup();
00082 
00083   signals:
00090     void dateEntered( const TQDate &date );
00091 
00096     void dateChanged( const TQDate &date );
00097 
00098   public slots:
00105     void setDate( const TQDate &date );
00106 
00107   protected slots:
00108     void lineEnterPressed();
00109     void slotTextChanged( const TQString& );
00110     void dateSelected( TQDate );
00111 
00112   protected:
00113     virtual bool eventFilter( TQObject*, TQEvent* );
00114     virtual void mousePressEvent( TQMouseEvent* );
00115 
00127     virtual bool assignDate( const TQDate &date );
00128 
00133     void setupKeywords();
00134 
00135   private:
00136     TQDate parseDate( bool* = 0 ) const;
00137     void updateView();
00138 
00139     KDatePickerPopup *mPopup;
00140 
00141     TQDate mDate;
00142     bool mReadOnly;
00143     bool mTextChanged;
00144     bool mDiscardNextMousePress;
00145 
00146     TQMap<TQString, int> mKeywordMap;
00147 };
00148 
00149 #endif