[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdepim/libkdepim
From:       David Jarvie <djarvie () kde ! org>
Date:       2010-09-25 15:28:32
Message-ID: 20100925152832.9E447AC857 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1179473 by djarvie:

Add in setDateRange() suggested by John Layt.


 M  +11 -4     kdateedit.cpp  
 M  +26 -4     kdateedit.h  


--- trunk/KDE/kdepim/libkdepim/kdateedit.cpp #1179472:1179473
@@ -332,13 +332,13 @@
   return d->mDate;
 }
 
-void KDateEdit::setMinimumDate( const QDate& minDate, const QString& errorDate )
+void KDateEdit::setMinimumDate( const QDate& minDate, const QString& errorMsg )
 {
   d->mMinDate = minDate;
   if ( d->mMinDate.isValid()  &&  date().isValid()  &&  date() < d->mMinDate ) {
     setDate( d->mMinDate );
   }
-  d->mMinDateErrString = errorDate;
+  d->mMinDateErrString = errorMsg;
 }
 
 QDate KDateEdit::minimumDate() const
@@ -346,13 +346,13 @@
   return d->mMinDate;
 }
 
-void KDateEdit::setMaximumDate( const QDate& maxDate, const QString& errorDate )
+void KDateEdit::setMaximumDate( const QDate& maxDate, const QString& errorMsg )
 {
   d->mMaxDate = maxDate;
   if ( d->mMaxDate.isValid()  &&  date().isValid()  &&  date() > d->mMaxDate ) {
     setDate( d->mMaxDate );
   }
-  d->mMaxDateErrString = errorDate;
+  d->mMaxDateErrString = errorMsg;
 }
 
 QDate KDateEdit::maximumDate() const
@@ -360,6 +360,13 @@
   return d->mMaxDate;
 }
 
+void KDateEdit::setDateRange( const QDate& earliest, const QDate& latest,
+                              const QString& earlyErrorMsg, const QString& lateErrorMsg )
+{
+  setMinimumDate( earliest, earlyErrorMsg );
+  setMaximumDate( latest, lateErrorMsg );
+}
+
 void KDateEdit::setReadOnly( bool readOnly )
 {
   d->mReadOnly = readOnly;
--- trunk/KDE/kdepim/libkdepim/kdateedit.h #1179472:1179473
@@ -86,11 +86,13 @@
      * Sets the earliest date which can be entered.
      *
      * @param date Earliest date allowed, or invalid to remove the minimum limit.
-     * @param errorDate Error message to be displayed when a date earlier than
+     * @param errorMsg Error message to be displayed when a date earlier than
      *                  @p date is entered. Set to QString() to use the default
      *                  error message.
+     *
+     * @see setDateRange()
      */
-    void setMinimumDate( const QDate& date, const QString& errorDate = QString() );
+    void setMinimumDate( const QDate& date, const QString& errorMsg = QString() );
 
     /**
      * Returns the earliest date which can be entered.
@@ -102,11 +104,13 @@
      * Sets the latest date which can be entered.
      *
      * @param date Latest date allowed, or invalid to remove the maximum limit.
-     * @param errorDate Error message to be displayed when a date later than
+     * @param errorMsg Error message to be displayed when a date later than
      *                  @p date is entered. Set to QString() to use the default
      *                  error message.
+     *
+     * @see setDateRange()
      */
-    void setMaximumDate( const QDate& date, const QString& errorDate = QString() );
+    void setMaximumDate( const QDate& date, const QString& errorMsg = QString() );
 
     /**
      * Returns the latest date which can be entered.
@@ -115,6 +119,24 @@
     QDate maximumDate() const;
 
     /**
+     * Sets the range of dates which can be entered.
+     *
+     * @param earliest Earliest date allowed, or invalid to remove the minimum limit.
+     * @param latest   Latest date allowed, or invalid to remove the maximum limit.
+     * @param earlyErrorMsg Error message to be displayed when a date earlier than
+     *                  @p earliest is entered. Set to QString() to use the default
+     *                  error message.
+     * @param lateErrorMsg Error message to be displayed when a date later than
+     *                  @p latest is entered. Set to QString() to use the default
+     *                  error message.
+     *
+     * @see setMinimumDate(), setMaximumDate()
+     */
+    void setDateRange( const QDate& earliest, const QDate& latest,
+                       const QString& earlyErrorMsg = QString(),
+                       const QString& lateErrorMsg = QString() );
+
+    /**
      * Sets whether the widget is read-only for the user. If read-only, the
      * date pop-up is inactive, and the displayed date cannot be edited.
      *
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic