~ubuntu-branches/ubuntu/maverick/datakiosk/maverick

« back to all changes in this revision

Viewing changes to src/datakiosk/src/dateedit.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2005-06-27 22:48:06 UTC
  • Revision ID: james.westby@ubuntu.com-20050627224806-8farkci1dc2onhbs
Tags: upstream-0.7
ImportĀ upstreamĀ versionĀ 0.7

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
*   Copyright (C) 2005 by Adam Treat                                      *
 
3
*   treat@kde.org                                                         *
 
4
*                                                                         *
 
5
*   This program is free software; you can redistribute it and/or modify  *
 
6
*   it under the terms of the GNU General Public License as published by  *
 
7
*   the Free Software Foundation; either version 2 of the License, or     *
 
8
*   (at your option) any later version.                                   *
 
9
*                                                                         *
 
10
***************************************************************************/
 
11
 
 
12
/***************************************************************************
 
13
*   This file adapted from libkdepim kdateedit.h
 
14
*                                                                         *
 
15
*   Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org>          *
 
16
*   Copyright (c) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>   *
 
17
*   Copyright (c) 2004 Tobias Koenig <tokoe@kde.org>                      *
 
18
*                                                                         *
 
19
***************************************************************************/
 
20
 
 
21
#ifndef DATEEDIT_H
 
22
#define DATEEDIT_H
 
23
 
 
24
#include <qdatetime.h>
 
25
#include <qmap.h>
 
26
 
 
27
#include "datatableeditorfactory.h"
 
28
 
 
29
class QEvent;
 
30
class QVBox;
 
31
 
 
32
class KDatePicker;
 
33
 
 
34
class DateEdit : public DataComboBox
 
35
{
 
36
    Q_OBJECT
 
37
    Q_PROPERTY( QDate date READ date WRITE setDate )
 
38
public:
 
39
    DateEdit( DataField* field, DataTable *dataTable,
 
40
              QWidget *parent = 0, const char *name = 0 );
 
41
    virtual ~DateEdit();
 
42
 
 
43
    QDate date() const;
 
44
 
 
45
    void setReadOnly( bool readOnly );
 
46
    bool isReadOnly() const;
 
47
 
 
48
    virtual void popup();
 
49
 
 
50
signals:
 
51
    void dateChanged( const QDate &date );
 
52
 
 
53
public slots:
 
54
    void setDate( const QDate &date );
 
55
 
 
56
protected slots:
 
57
    void lineEnterPressed();
 
58
    void slotTextChanged( const QString& );
 
59
    void dateEntered( QDate );
 
60
    void dateSelected( QDate );
 
61
 
 
62
protected:
 
63
    virtual bool eventFilter( QObject*, QEvent* );
 
64
    virtual void mousePressEvent( QMouseEvent* );
 
65
 
 
66
    void setupKeywords();
 
67
 
 
68
private:
 
69
    QDate parseDate( bool* = 0 ) const;
 
70
    void updateView();
 
71
    void assignDate( const QDate& );
 
72
 
 
73
    KDatePicker *mDatePicker;
 
74
    QVBox *mDateFrame;
 
75
 
 
76
    QDate mDate;
 
77
    bool mReadOnly;
 
78
    bool mTextChanged;
 
79
    bool mDiscardNextMousePress;
 
80
 
 
81
    QMap<QString, int> mKeywordMap;
 
82
};
 
83
 
 
84
#endif