~ubuntu-branches/ubuntu/precise/koffice/precise

« back to all changes in this revision

Viewing changes to kexi/plugins/forms/widgets/kexidbtimeedit.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2006-04-20 21:38:53 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20060420213853-j5lxluqvymxt2zny
Tags: 1:1.5.0-0ubuntu2
UbuntuĀ uploadĀ 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* This file is part of the KDE project
 
2
   Copyright (C) 2005 Cedric Pasteur <cedric.pasteur@free.fr>
 
3
   Copyright (C) 2004-2005 Jaroslaw Staniek <js@iidea.pl>
 
4
 
 
5
   This program is free software; you can redistribute it and/or
 
6
   modify it under the terms of the GNU Library General Public
 
7
   License as published by the Free Software Foundation; either
 
8
   version 2 of the License, or (at your option) any later version.
 
9
 
 
10
   This program is distributed in the hope that it will be useful,
 
11
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
13
   Library General Public License for more details.
 
14
 
 
15
   You should have received a copy of the GNU Library General Public License
 
16
   along with this program; see the file COPYING.  If not, write to
 
17
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 
18
 * Boston, MA 02110-1301, USA.
 
19
*/
 
20
 
 
21
#ifndef KexiDBTimeEdit_H
 
22
#define KexiDBTimeEdit_H
 
23
 
 
24
#include "kexiformdataiteminterface.h"
 
25
#include "kexidbtextwidgetinterface.h"
 
26
#include <qdatetimeedit.h>
 
27
 
 
28
class QDateTimeEditor;
 
29
 
 
30
//! A db-aware time editor
 
31
class KEXIFORMUTILS_EXPORT KexiDBTimeEdit : public QTimeEdit, public KexiFormDataItemInterface
 
32
{
 
33
        Q_OBJECT
 
34
        Q_PROPERTY(QString dataSource READ dataSource WRITE setDataSource DESIGNABLE true)
 
35
        Q_PROPERTY(QCString dataSourceMimeType READ dataSourceMimeType WRITE setDataSourceMimeType DESIGNABLE true)
 
36
        Q_PROPERTY( bool readOnly READ isReadOnly WRITE setReadOnly DESIGNABLE true )
 
37
 
 
38
        public:
 
39
                KexiDBTimeEdit(const QTime &time, QWidget *parent, const char *name=0);
 
40
                virtual ~KexiDBTimeEdit();
 
41
 
 
42
                inline QString dataSource() const { return KexiFormDataItemInterface::dataSource(); }
 
43
                inline QCString dataSourceMimeType() const { return KexiFormDataItemInterface::dataSourceMimeType(); }
 
44
                virtual QVariant value();
 
45
                virtual void setInvalidState( const QString& displayText );
 
46
 
 
47
                //! \return true if editor's value is null (not empty)
 
48
                //! Used for checking if a given constraint within table of form is met.
 
49
                virtual bool valueIsNull();
 
50
 
 
51
                //! \return true if editor's value is empty (not necessary null).
 
52
                //! Only few data types can accept "EMPTY" property
 
53
                //! (use KexiDB::Field::hasEmptyProperty() to check this).
 
54
                //! Used for checking if a given constraint within table or form is met.
 
55
                virtual bool valueIsEmpty();
 
56
 
 
57
                /*! \return 'readOnly' flag for this widget. */
 
58
                virtual bool isReadOnly() const;
 
59
 
 
60
                /*! \return the view widget of this item, e.g. line edit widget. */
 
61
                virtual QWidget* widget();
 
62
 
 
63
                virtual bool cursorAtStart();
 
64
                virtual bool cursorAtEnd();
 
65
                virtual void clear();
 
66
 
 
67
                virtual void  setEnabled(bool enabled);
 
68
 
 
69
        public slots:
 
70
                inline void setDataSource(const QString &ds) { KexiFormDataItemInterface::setDataSource(ds); }
 
71
                inline void setDataSourceMimeType(const QCString &ds) { KexiFormDataItemInterface::setDataSourceMimeType(ds); }
 
72
                virtual void setReadOnly(bool set);
 
73
 
 
74
        protected slots:
 
75
                void  slotValueChanged(const QTime&);
 
76
 
 
77
        protected:
 
78
                virtual void setValueInternal(const QVariant& add, bool removeOld);
 
79
 
 
80
        private:
 
81
                QDateTimeEditor* m_dte_time;
 
82
                bool m_invalidState : 1;
 
83
                bool m_cleared : 1;
 
84
                bool m_readOnly : 1;
 
85
};
 
86
 
 
87
#endif