summaryrefslogtreecommitdiffabout
path: root/korganizer/ktimeedit.h
Unidiff
Diffstat (limited to 'korganizer/ktimeedit.h') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/ktimeedit.h97
1 files changed, 97 insertions, 0 deletions
diff --git a/korganizer/ktimeedit.h b/korganizer/ktimeedit.h
new file mode 100644
index 0000000..7923070
--- a/dev/null
+++ b/korganizer/ktimeedit.h
@@ -0,0 +1,97 @@
1/*
2 This file is part of KOrganizer.
3 Copyright (c) 1999 Preston Brown, Ian Dawes
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 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
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution.
22*/
23#ifndef _KTIMEEDIT_H
24#define _KTIMEEDIT_H
25
26#include <qevent.h>
27#include <qkeycode.h>
28#include <qstring.h>
29#include <qdatetime.h>
30#include <qcombobox.h>
31
32#include <kapplication.h>
33
34/**
35 This is a class that provides an easy, user friendly way to edit times.
36 up/down/ increase or decrease time, respectively.
37
38 @short Provides a way to edit times in a user-friendly manner.
39 @author Preston Brown, Ian Dawes
40*/
41class KOTimeEdit : public QComboBox
42{
43 Q_OBJECT
44 public:
45 /** constructs a new time edit. */
46 KOTimeEdit(QWidget *parent=0, QTime qt=QTime(12,0), const char *name=0);
47
48 virtual ~KOTimeEdit();
49
50 /**
51 Returns, if a time is selected. Can not return false anymore....
52 */
53 bool hasTime() const;
54
55 /** returns the time that is currently set in the timeLineEdit. */
56 QTime getTime() const;
57
58 /** returns the prefered size policy of the KOTimeEdit */
59 //QSizePolicy sizePolicy() const;
60
61 /** return true if input is a valid time and false if not */
62 bool inputIsValid() const;
63
64 signals:
65 /**
66 Emitted every time the time displayed changes. "newt" is the new
67 time.
68 */
69 void timeChanged(QTime newt);
70
71 public slots:
72 /** used to set the time which is displayed to a specific value. */
73 void setTime(QTime qt);
74
75 protected slots:
76 void activ(int);
77 void hilit(int);
78 void changedText();
79
80 protected:
81 void keyPressEvent(QKeyEvent *qke);
82 void keyReleaseEvent(QKeyEvent *qke);
83 void setSelect ( int, int );
84 bool mFlagKeyPressed;
85 void addTime(QTime qt, bool update = true );
86 void subTime(QTime qt, bool update = true );
87 // Update the lineedit text from mTime
88 void updateText();
89 // void mouseReleaseEvent ( QMouseEvent * ) ;
90 //void focusInEvent ( QFocusEvent * ) ;
91
92private:
93 QTime mTime; // the widget's displayed time.
94 //QString mNoTimeString;
95};
96
97#endif