summaryrefslogtreecommitdiff
path: root/noncore/apps/tableviewer/ui/commonwidgets.cpp
Unidiff
Diffstat (limited to 'noncore/apps/tableviewer/ui/commonwidgets.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/tableviewer/ui/commonwidgets.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/apps/tableviewer/ui/commonwidgets.cpp b/noncore/apps/tableviewer/ui/commonwidgets.cpp
index 4c47951..e82018c 100644
--- a/noncore/apps/tableviewer/ui/commonwidgets.cpp
+++ b/noncore/apps/tableviewer/ui/commonwidgets.cpp
@@ -1,136 +1,136 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include <qlineedit.h> 21#include <qlineedit.h>
22#include <qlayout.h> 22#include <qlayout.h>
23#include <qlabel.h> 23#include <qlabel.h>
24#include <qcombobox.h> 24#include <qcombobox.h>
25 25
26#include <qpe/datebookmonth.h> 26#include <qpe/datebookmonth.h>
27#include <qpopupmenu.h> 27#include <qpopupmenu.h>
28#include <qspinbox.h> 28#include <qspinbox.h>
29#include "commonwidgets.h" 29#include "commonwidgets.h"
30 30
31DateEdit::DateEdit( QWidget *parent, const char *name, WFlags f ) 31DateEdit::DateEdit( QWidget *parent, const char *name, WFlags f )
32 : QToolButton(parent, name) 32 : QToolButton(parent, name)
33{ 33{
34 QPopupMenu *m1 = new QPopupMenu(this); 34 QPopupMenu *m1 = new QPopupMenu(this);
35 dateSelector = new DateBookMonth(m1, 0, TRUE); 35 dateSelector = new DateBookMonth(m1, 0, TRUE);
36 m1->insertItem(dateSelector); 36 m1->insertItem(dateSelector);
37 setPopup(m1); 37 setPopup(m1);
38 setPopupDelay(0); 38 setPopupDelay(0);
39 39
40 connect(dateSelector, SIGNAL(dateClicked(int, int, int)), 40 connect(dateSelector, SIGNAL(dateClicked(int,int,int)),
41 this, SLOT(subValueChanged())); 41 this, SLOT(subValueChanged()));
42 42
43 setText(dateSelector->selectedDate().toString()); 43 setText(dateSelector->selectedDate().toString());
44} 44}
45 45
46 46
47DateEdit::~DateEdit() {} 47DateEdit::~DateEdit() {}
48 48
49QDate DateEdit::date() const 49QDate DateEdit::date() const
50{ 50{
51 return dateSelector->selectedDate(); 51 return dateSelector->selectedDate();
52} 52}
53 53
54void DateEdit::setDate(QDate d) 54void DateEdit::setDate(QDate d)
55{ 55{
56 dateSelector->setDate(d.year(), d.month(), d.day()); 56 dateSelector->setDate(d.year(), d.month(), d.day());
57 setText(d.toString()); 57 setText(d.toString());
58} 58}
59 59
60QSizePolicy DateEdit::sizePolicy() const 60QSizePolicy DateEdit::sizePolicy() const
61{ 61{
62 QSizePolicy sp; 62 QSizePolicy sp;
63 sp.setHorData(QToolButton::sizePolicy().horData()); 63 sp.setHorData(QToolButton::sizePolicy().horData());
64 sp.setVerData(QSizePolicy::Fixed); 64 sp.setVerData(QSizePolicy::Fixed);
65 65
66 return sp; 66 return sp;
67} 67}
68 68
69void DateEdit::clear() 69void DateEdit::clear()
70{ 70{
71 QDate today = QDate::currentDate(); 71 QDate today = QDate::currentDate();
72 72
73 dateSelector->setDate(today.year(), today.month(), today.day()); 73 dateSelector->setDate(today.year(), today.month(), today.day());
74 setText(today.toString()); 74 setText(today.toString());
75} 75}
76 76
77void DateEdit::subValueChanged() 77void DateEdit::subValueChanged()
78{ 78{
79 QDate current = dateSelector->selectedDate(); 79 QDate current = dateSelector->selectedDate();
80 80
81 setText(current.toString()); 81 setText(current.toString());
82 emit valueChanged(current); 82 emit valueChanged(current);
83} 83}
84 84
85TimeEdit::TimeEdit( QWidget *parent, const char *name, WFlags f ) 85TimeEdit::TimeEdit( QWidget *parent, const char *name, WFlags f )
86 : QWidget(parent, name, f) 86 : QWidget(parent, name, f)
87{ 87{
88 QHBoxLayout *layout = new QHBoxLayout(this, 0); 88 QHBoxLayout *layout = new QHBoxLayout(this, 0);
89 89
90 layout->addWidget(hourKey = new QSpinBox(1, 12, 1, this)); 90 layout->addWidget(hourKey = new QSpinBox(1, 12, 1, this));
91 hourKey->setWrapping(true); 91 hourKey->setWrapping(true);
92 hourKey->setMinimumWidth(30); 92 hourKey->setMinimumWidth(30);
93 hourKey->setMaximumWidth(35); 93 hourKey->setMaximumWidth(35);
94 94
95 layout->addWidget(new QLabel(" : ", this)); 95 layout->addWidget(new QLabel(" : ", this));
96 layout->addWidget(minuteKey = new QSpinBox(0, 59, 1, this)); 96 layout->addWidget(minuteKey = new QSpinBox(0, 59, 1, this));
97 minuteKey->setWrapping(true); 97 minuteKey->setWrapping(true);
98 minuteKey->setMinimumWidth(30); 98 minuteKey->setMinimumWidth(30);
99 minuteKey->setMaximumWidth(35); 99 minuteKey->setMaximumWidth(35);
100 100
101 layout->addWidget(new QLabel(" : ", this)); 101 layout->addWidget(new QLabel(" : ", this));
102 layout->addWidget(secondKey = new QSpinBox(0, 59, 1, this, 0)); 102 layout->addWidget(secondKey = new QSpinBox(0, 59, 1, this, 0));
103 secondKey->setWrapping(true); 103 secondKey->setWrapping(true);
104 secondKey->setMinimumWidth(30); 104 secondKey->setMinimumWidth(30);
105 secondKey->setMaximumWidth(35); 105 secondKey->setMaximumWidth(35);
106 106
107 layout->addWidget(ampm = new QComboBox(this)); 107 layout->addWidget(ampm = new QComboBox(this));
108 ampm->insertItem("AM"); 108 ampm->insertItem("AM");
109 ampm->insertItem("PM"); 109 ampm->insertItem("PM");
110 110
111 layout->addStretch(-1); 111 layout->addStretch(-1);
112 112
113 clear(); 113 clear();
114 114
115 connect(secondKey, SIGNAL(valueChanged(const QString&)), 115 connect(secondKey, SIGNAL(valueChanged(const QString&)),
116 this, SLOT(subValueChanged())); 116 this, SLOT(subValueChanged()));
117 connect(minuteKey, SIGNAL(valueChanged(const QString&)), 117 connect(minuteKey, SIGNAL(valueChanged(const QString&)),
118 this, SLOT(subValueChanged())); 118 this, SLOT(subValueChanged()));
119 connect(hourKey, SIGNAL(valueChanged(const QString&)), 119 connect(hourKey, SIGNAL(valueChanged(const QString&)),
120 this, SLOT(subValueChanged())); 120 this, SLOT(subValueChanged()));
121 connect(ampm, SIGNAL(activated(int)), 121 connect(ampm, SIGNAL(activated(int)),
122 this, SLOT(subValueChanged())); 122 this, SLOT(subValueChanged()));
123} 123}
124 124
125 125
126TimeEdit::~TimeEdit() {} 126TimeEdit::~TimeEdit() {}
127 127
128QTime TimeEdit::time() const 128QTime TimeEdit::time() const
129{ 129{
130 int s,m,h; 130 int s,m,h;
131 131
132 s = secondKey->text().toInt(); 132 s = secondKey->text().toInt();
133 m = minuteKey->text().toInt(); 133 m = minuteKey->text().toInt();
134 h = hourKey->text().toInt(); 134 h = hourKey->text().toInt();
135 135
136 if(ampm->currentItem() == 1) { 136 if(ampm->currentItem() == 1) {