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>
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.
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.
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.
21
#ifndef KexiDBTimeEdit_H
22
#define KexiDBTimeEdit_H
24
#include "kexiformdataiteminterface.h"
25
#include "kexidbtextwidgetinterface.h"
26
#include <qdatetimeedit.h>
28
class QDateTimeEditor;
30
//! A db-aware time editor
31
class KEXIFORMUTILS_EXPORT KexiDBTimeEdit : public QTimeEdit, public KexiFormDataItemInterface
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 )
39
KexiDBTimeEdit(const QTime &time, QWidget *parent, const char *name=0);
40
virtual ~KexiDBTimeEdit();
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 );
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();
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();
57
/*! \return 'readOnly' flag for this widget. */
58
virtual bool isReadOnly() const;
60
/*! \return the view widget of this item, e.g. line edit widget. */
61
virtual QWidget* widget();
63
virtual bool cursorAtStart();
64
virtual bool cursorAtEnd();
67
virtual void setEnabled(bool enabled);
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);
75
void slotValueChanged(const QTime&);
78
virtual void setValueInternal(const QVariant& add, bool removeOld);
81
QDateTimeEditor* m_dte_time;
82
bool m_invalidState : 1;