kalarm/lib
dateedit.h
Go to the documentation of this file.00001 /* 00002 * dateedit.h - date entry widget 00003 * Program: kalarm 00004 * Copyright © 2002-2007 by David Jarvie <software@astrojar.org.uk> 00005 * 00006 * This program is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License as published by 00008 * the Free Software Foundation; either version 2 of the License, or 00009 * (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License along 00017 * with this program; if not, write to the Free Software Foundation, Inc., 00018 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00019 */ 00020 #ifndef DATEEDIT_H 00021 #define DATEEDIT_H 00022 00023 #include <libkdepim/kdateedit.h> 00024 00025 class QMouseEvent; 00026 class QKeyEvent; 00027 00028 00041 class DateEdit : public KPIM::KDateEdit 00042 { 00043 Q_OBJECT 00044 public: 00048 explicit DateEdit(QWidget* parent = 0); 00050 bool isValid() const { return date().isValid(); } 00054 const QDate& minDate() const { return mMinDate; } 00058 const QDate& maxDate() const { return mMaxDate; } 00064 void setMinDate(const QDate& date, const QString& errorDate = QString()); 00070 void setMaxDate(const QDate& date, const QString& errorDate = QString()); 00072 void setInvalid(); 00073 00074 protected: 00075 virtual void mousePressEvent(QMouseEvent*); 00076 virtual void mouseReleaseEvent(QMouseEvent*); 00077 virtual void mouseMoveEvent(QMouseEvent*); 00078 virtual void keyPressEvent(QKeyEvent*); 00079 virtual void keyReleaseEvent(QKeyEvent*); 00080 00081 private slots: 00082 void newDateEntered(const QDate&); 00083 00084 private: 00085 void pastLimitMessage(const QDate& limit, const QString& error, const KLocalizedString& defaultError); 00086 00087 QDate mMinDate; // minimum allowed date, or invalid for no minimum 00088 QDate mMaxDate; // maximum allowed date, or invalid for no maximum 00089 QString mMinDateErrString; // error message when entered date < mMinDate 00090 QString mMaxDateErrString; // error message when entered date > mMaxDate 00091 }; 00092 00093 #endif // DATEEDIT_H
KDE 4.2 API Reference