Source: calenderedit.h


Annotated List
Files
Globals
Hierarchy
Index
/***************************************************************************
                          calenderedit.h  -  description
                             -------------------
    begin                : Sat Jan 5 2002
    copyright            : (C) 2002 by Werner Schulte
    email                : werner@schulte-ac.de
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/
#ifndef CALENDEREDIT_H
#define CALENDEREDIT_H

#include 
#include 
#include 
#include 
#include 

/**
  * This Class provides a CalenderEditView like used in QTopia.
    In fact it is copied from  qpe/library/calender.h for use
    under X11.

    It is a subclass of calenderEdit.

    calenderEdit creates and destroys the instances. Dont use it directly.

    @author Werner Schulte (email : werner@schulte-ac.de, homepage : www.uv-ac.de)
    @version 0.2.0 - sc - 27.07.2002

  */
class Calendar1
{
public:
    struct Day
    {
      enum Type { PrevMonth, ThisMonth, NextMonth };

      Day() : date( 0 ), type( ThisMonth ), holiday( FALSE ) {}
      Day( int d, Type t, bool h ) : date( d ), type( t ), holiday( h ) {}

      int date;
      Type type;
      bool holiday;
    };

    static QString nameOfMonth( int m );
    static QString nameOfDay( int d );
    static QValueList daysOfMonth( int year, int month, bool startWithMonday = FALSE );

    Calendar1();
    ~Calendar1();
};

/**
  * This Class provides a CalenderEdit like used in QTopia.

    @author Werner Schulte (email : werner@schulte-ac.de, homepage : www.uv-ac.de)
    @version 0.2.0 - sc - 27.07.2002

    calenderEdit opens a QTable which is filled with the
    actual date info or with the provided date string date.

    After calling the constructor, the user has to prepare some things calling
    prepare(). The following paragraph shows an example call.

    

      // call the constructor somewhere in your program
      // and hide the result.
      calEdit = new calenderEdit ( (QDialog *)this, tr("Calendar"), true );
      calEdit->hide();


      // call prepare short before exec()
      // to feed the calender with the date you want
      // and to init all variables.
      calEdit->prepare ( somedatestr );

      calEdit->exec( );
      calEdit->hide( );

      if ( calEdit->result() == QDialog::Accepted )
      {
        tmpdatestr = calEdit->date();
        LineEdit->setText( tmpdatestr );
        slotTextChanged( tmpdatestr );
      }
    
*/ class calenderEdit : public CalenderDlg { Q_OBJECT public: /** call this method, after the editor is hided, to get the selected date (as string). @return : the datestring **/ QString date(); /** calcs the diffence between two days @p : from the first day @p : to the second day (must be newer than from) @return : the difference in days **/ int diffDays( const QString &from="", const QString &to="" ); /** prepares the new view. Call this before calling exec(). **/ void prepare( const QString &dstr="" ); /** constructor **/ calenderEdit(QDialog *parent=0, const char *name="", bool modal=FALSE ); /** destructor **/ ~calenderEdit(); private slots: void slotOK(); void slotCancel(); void slotComboChanged( int item ); void slotSpinBoxChanged( int cont ); void slotTableCurrentChanged( int row, int col ); private: virtual void accept( ); virtual void reject( ); virtual void closeEvent( QCloseEvent *e ); QString datestr; int year, month, day; void setupTable(); void fillComboBox(); void setSpinBox( int val ); }; /** * This Class provides a DateTimeEdit to select a date and a time. @author Werner Schulte (email : werner@schulte-ac.de, homepage : www.uv-ac.de) @version 0.2.1 - sc - 04.10.2003 dateTimeEdit opens a QTable which is filled with the actual date info or with the provided date string date. Additionaly a TimePicker is provided. After calling the constructor, the user has to prepare some things calling prepare(). The following paragraph shows an example call.

      // call the constructor somewhere in your program
      // and hide the result.
      dtEdit = new dateTimeEdit ( (QDialog *)this, tr("Date and Time"), true );
      dtEdit->hide();


      // call prepare short before exec()
      // to feed the calender with the date you want
      // and to init all variables.
      dtEdit->prepare ( const QDateTime &somedatetime );

      dtEdit->exec( );
      dtEdit->hide( );

      if ( dtEdit->result() == QDialog::Accepted )
      {
        tmpdatetime = dtEdit->datetime();
      }
    
*/ class dateTimeEdit : public DateTimeDlg { Q_OBJECT public: /** call this method, after the editor is hided, to get the selected date (as string). @return : the datestring **/ QString date(); /** call this method, after the editor is hided, to get the selected time (as string). @return : the timestring **/ QString time(); /** call this method, after the editor is hided, to get the selected QDateTime. @return : the selected QDateTime **/ QDateTime datetime(); /** prepares the new view. Call this before calling exec(). **/ void prepare( const QDateTime &dt=QDateTime::currentDateTime() ); /** constructor **/ dateTimeEdit(QDialog *parent=0, const char *name="", bool modal=FALSE ); /** destructor **/ ~dateTimeEdit(); private slots: void slotOK(); void slotCancel(); void slotComboChanged( int item ); void slotSpinBoxChanged( int cont ); void slotDateTableCurrentChanged( int row, int col ); void slotTimeTableCurrentChanged( int row, int col ); private: void setTextLabel( const QDateTime &dt ); void setDateTime( ); virtual void accept( ); virtual void reject( ); virtual void closeEvent( QCloseEvent *e ); QString datestr, timestr; QDateTime dattime; int year, month, day, hour, minute; void setupDateTable(); void setupTimeTable(); void fillComboBox(); void setSpinBox( int val ); }; #endif

Generated by: sc on schomep4 on Sun Nov 23 16:54:26 2003, using kdoc 2.0a54.