libkdepim

kdateedit.h

00001 /*
00002     This file is part of libkdepim.
00003 
00004     Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org>
00005     Copyright (c) 2004 Tobias Koenig <tokoe@kde.org>
00006 
00007     This library is free software; you can redistribute it and/or
00008     modify it under the terms of the GNU Library General Public
00009     License as published by the Free Software Foundation; either
00010     version 2 of the License, or (at your option) any later version.
00011 
00012     This library is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015     Library General Public License for more details.
00016 
00017     You should have received a copy of the GNU Library General Public License
00018     along with this library; see the file COPYING.LIB.  If not, write to
00019     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00020     Boston, MA 02110-1301, USA.
00021 */
00022 
00023 #ifndef KDATEEDIT_H
00024 #define KDATEEDIT_H
00025 
00026 #include <qcombobox.h>
00027 #include <qdatetime.h>
00028 #include <qmap.h>
00029 
00030 #include <kdepimmacros.h>
00031 
00032 #include "kdatepickerpopup.h"
00033 
00034 class QEvent;
00035 
00053 class KDE_EXPORT KDateEdit : public QComboBox
00054 {
00055   Q_OBJECT
00056 
00057   public:
00058     KDateEdit( QWidget *parent = 0, const char *name = 0 );
00059     virtual ~KDateEdit();
00060 
00065     QDate date() const;
00066 
00073     void setReadOnly( bool readOnly );
00074 
00078     bool isReadOnly() const;
00079 
00080     virtual void popup();
00081 
00082   signals:
00087     void dateChanged( const QDate &date );
00088 
00089   public slots:
00096     void setDate( const QDate &date );
00097 
00098   protected slots:
00099     void lineEnterPressed();
00100     void slotTextChanged( const QString& );
00101     void dateEntered( QDate );
00102     void dateSelected( QDate );
00103 
00104   protected:
00105     virtual bool eventFilter( QObject*, QEvent* );
00106     virtual void mousePressEvent( QMouseEvent* );
00107 
00119     virtual bool assignDate( const QDate &date );
00120 
00125     void setupKeywords();
00126 
00127   private:
00128     QDate parseDate( bool* = 0 ) const;
00129     void updateView();
00130 
00131     KDatePickerPopup *mPopup;
00132 
00133     QDate mDate;
00134     bool mReadOnly;
00135     bool mTextChanged;
00136     bool mDiscardNextMousePress;
00137 
00138     QMap<QString, int> mKeywordMap;
00139 };
00140 
00141 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys