author | zecke <zecke> | 2004-03-14 18:58:59 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-03-14 18:58:59 (UTC) |
commit | d91c046d1faaf9fb039bda5cc186c96d4ff2c227 (patch) (unidiff) | |
tree | c196f20c933d46cc913c9460f02ce3274bd21fc9 | |
parent | ddfee0836adbd62be48888fbe05e7a79481e81c9 (diff) | |
download | opie-d91c046d1faaf9fb039bda5cc186c96d4ff2c227.zip opie-d91c046d1faaf9fb039bda5cc186c96d4ff2c227.tar.gz opie-d91c046d1faaf9fb039bda5cc186c96d4ff2c227.tar.bz2 |
Opie DP changes
-rw-r--r-- | core/pim/datebook/config.in | 2 | ||||
-rw-r--r-- | core/pim/datebook/datebook.pro | 2 | ||||
-rw-r--r-- | core/pim/datebook/datebookweeklst.cpp | 1 | ||||
-rw-r--r-- | core/pim/datebook/datebookweeklst.h | 4 | ||||
-rw-r--r-- | core/pim/datebook/dateentryimpl.cpp | 2 | ||||
-rw-r--r-- | core/pim/datebook/main.cpp | 3 |
6 files changed, 8 insertions, 6 deletions
diff --git a/core/pim/datebook/config.in b/core/pim/datebook/config.in index aa3e8fc..dd9c798 100644 --- a/core/pim/datebook/config.in +++ b/core/pim/datebook/config.in | |||
@@ -1,4 +1,4 @@ | |||
1 | config DATEBOOK | 1 | config DATEBOOK |
2 | boolean "opie-datebook (a datebook/appointment manager)" | 2 | boolean "opie-datebook (a datebook/appointment manager)" |
3 | default "y" | 3 | default "y" |
4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE | 4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIEUI2 |
diff --git a/core/pim/datebook/datebook.pro b/core/pim/datebook/datebook.pro index f3b5a59..2b2efaa 100644 --- a/core/pim/datebook/datebook.pro +++ b/core/pim/datebook/datebook.pro | |||
@@ -1,40 +1,40 @@ | |||
1 | CONFIG += qt warn_on release quick-app | 1 | CONFIG += qt warn_on release quick-app |
2 | HEADERS= datebookday.h \ | 2 | HEADERS= datebookday.h \ |
3 | datebook.h \ | 3 | datebook.h \ |
4 | dateentryimpl.h \ | 4 | dateentryimpl.h \ |
5 | datebookdayheaderimpl.h \ | 5 | datebookdayheaderimpl.h \ |
6 | datebooksettings.h \ | 6 | datebooksettings.h \ |
7 | datebookweek.h \ | 7 | datebookweek.h \ |
8 | datebookweeklst.h \ | 8 | datebookweeklst.h \ |
9 | datebookweekheaderimpl.h \ | 9 | datebookweekheaderimpl.h \ |
10 | repeatentry.h \ | 10 | repeatentry.h \ |
11 | noteentryimpl.h \ | 11 | noteentryimpl.h \ |
12 | onoteedit.h \ | 12 | onoteedit.h \ |
13 | datebookdayallday.h | 13 | datebookdayallday.h |
14 | SOURCES= main.cpp \ | 14 | SOURCES= main.cpp \ |
15 | datebookday.cpp \ | 15 | datebookday.cpp \ |
16 | datebook.cpp \ | 16 | datebook.cpp \ |
17 | dateentryimpl.cpp \ | 17 | dateentryimpl.cpp \ |
18 | datebookdayheaderimpl.cpp \ | 18 | datebookdayheaderimpl.cpp \ |
19 | datebooksettings.cpp \ | 19 | datebooksettings.cpp \ |
20 | datebookweek.cpp \ | 20 | datebookweek.cpp \ |
21 | datebookweeklst.cpp \ | 21 | datebookweeklst.cpp \ |
22 | datebookweekheaderimpl.cpp \ | 22 | datebookweekheaderimpl.cpp \ |
23 | repeatentry.cpp \ | 23 | repeatentry.cpp \ |
24 | noteentryimpl.cpp \ | 24 | noteentryimpl.cpp \ |
25 | onoteedit.cpp \ | 25 | onoteedit.cpp \ |
26 | datebookdayallday.cpp | 26 | datebookdayallday.cpp |
27 | INTERFACES= dateentry.ui \ | 27 | INTERFACES= dateentry.ui \ |
28 | datebookdayheader.ui \ | 28 | datebookdayheader.ui \ |
29 | datebookweekheader.ui \ | 29 | datebookweekheader.ui \ |
30 | datebookweeklstheader.ui \ | 30 | datebookweeklstheader.ui \ |
31 | datebookweeklstdayhdr.ui \ | 31 | datebookweeklstdayhdr.ui \ |
32 | repeatentrybase.ui \ | 32 | repeatentrybase.ui \ |
33 | datebooksettingsbase.ui \ | 33 | datebooksettingsbase.ui \ |
34 | noteentry.ui | 34 | noteentry.ui |
35 | INCLUDEPATH += $(OPIEDIR)/include | 35 | INCLUDEPATH += $(OPIEDIR)/include |
36 | DEPENDPATH+= $(OPIEDIR)/include | 36 | DEPENDPATH+= $(OPIEDIR)/include |
37 | LIBS += -lqpe -lopie | 37 | LIBS += -lqpe -lopieui2 |
38 | TARGET = datebook | 38 | TARGET = datebook |
39 | 39 | ||
40 | include ( $(OPIEDIR)/include.pro ) | 40 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/core/pim/datebook/datebookweeklst.cpp b/core/pim/datebook/datebookweeklst.cpp index af40143..30c925d 100644 --- a/core/pim/datebook/datebookweeklst.cpp +++ b/core/pim/datebook/datebookweeklst.cpp | |||
@@ -1,207 +1,208 @@ | |||
1 | #include "datebookweeklst.h" | 1 | #include "datebookweeklst.h" |
2 | 2 | ||
3 | 3 | ||
4 | #include "datebook.h" | 4 | #include "datebook.h" |
5 | 5 | ||
6 | #include <qpe/datebookmonth.h> | 6 | #include <qpe/datebookmonth.h> |
7 | #include <qpe/config.h> | 7 | #include <qpe/config.h> |
8 | #include <qpe/resource.h> | 8 | #include <qpe/resource.h> |
9 | 9 | ||
10 | #include <qlayout.h> | 10 | #include <qlayout.h> |
11 | #include <qtoolbutton.h> | 11 | #include <qtoolbutton.h> |
12 | #include <qtl.h> | 12 | #include <qtl.h> |
13 | 13 | ||
14 | bool calcWeek(const QDate &d, int &week, int &year,bool startOnMonday = false); | 14 | bool calcWeek(const QDate &d, int &week, int &year,bool startOnMonday = false); |
15 | 15 | ||
16 | using namespace Opie::Ui; | ||
16 | DateBookWeekLstHeader::DateBookWeekLstHeader(bool onM, QWidget* parent, const char* name, WFlags fl) | 17 | DateBookWeekLstHeader::DateBookWeekLstHeader(bool onM, QWidget* parent, const char* name, WFlags fl) |
17 | : DateBookWeekLstHeaderBase(parent, name, fl) | 18 | : DateBookWeekLstHeaderBase(parent, name, fl) |
18 | { | 19 | { |
19 | setBackgroundMode( PaletteButton ); | 20 | setBackgroundMode( PaletteButton ); |
20 | labelDate->setBackgroundMode( PaletteButton ); | 21 | labelDate->setBackgroundMode( PaletteButton ); |
21 | forwardweek->setBackgroundMode( PaletteButton ); | 22 | forwardweek->setBackgroundMode( PaletteButton ); |
22 | forwardweek->setPixmap( Resource::loadPixmap("forward") ); | 23 | forwardweek->setPixmap( Resource::loadPixmap("forward") ); |
23 | forwardmonth->setBackgroundMode( PaletteButton ); | 24 | forwardmonth->setBackgroundMode( PaletteButton ); |
24 | forwardmonth->setPixmap( Resource::loadPixmap("fastforward") ); | 25 | forwardmonth->setPixmap( Resource::loadPixmap("fastforward") ); |
25 | backweek->setBackgroundMode( PaletteButton ); | 26 | backweek->setBackgroundMode( PaletteButton ); |
26 | backweek->setPixmap( Resource::loadPixmap("back") ); | 27 | backweek->setPixmap( Resource::loadPixmap("back") ); |
27 | backmonth->setBackgroundMode( PaletteButton ); | 28 | backmonth->setBackgroundMode( PaletteButton ); |
28 | backmonth->setPixmap( Resource::loadPixmap("fastback") ); | 29 | backmonth->setPixmap( Resource::loadPixmap("fastback") ); |
29 | DateBookWeekLstHeaderBaseLayout->setSpacing(0); | 30 | DateBookWeekLstHeaderBaseLayout->setSpacing(0); |
30 | DateBookWeekLstHeaderBaseLayout->setMargin(0); | 31 | DateBookWeekLstHeaderBaseLayout->setMargin(0); |
31 | //setSizePolicy(QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Expanding)); | 32 | //setSizePolicy(QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Expanding)); |
32 | setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed)); | 33 | setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed)); |
33 | 34 | ||
34 | connect(backmonth, SIGNAL(clicked()), this, SLOT(prevMonth())); | 35 | connect(backmonth, SIGNAL(clicked()), this, SLOT(prevMonth())); |
35 | connect(backweek, SIGNAL(clicked()), this, SLOT(prevWeek())); | 36 | connect(backweek, SIGNAL(clicked()), this, SLOT(prevWeek())); |
36 | connect(forwardweek, SIGNAL(clicked()), this, SLOT(nextWeek())); | 37 | connect(forwardweek, SIGNAL(clicked()), this, SLOT(nextWeek())); |
37 | connect(forwardmonth, SIGNAL(clicked()), this, SLOT(nextMonth())); | 38 | connect(forwardmonth, SIGNAL(clicked()), this, SLOT(nextMonth())); |
38 | connect(labelDate, SIGNAL(clicked()), this, SLOT(pickDate())); | 39 | connect(labelDate, SIGNAL(clicked()), this, SLOT(pickDate())); |
39 | connect(dbl, SIGNAL(toggled(bool)), this, SIGNAL(setDbl(bool))); | 40 | connect(dbl, SIGNAL(toggled(bool)), this, SIGNAL(setDbl(bool))); |
40 | bStartOnMonday=onM; | 41 | bStartOnMonday=onM; |
41 | } | 42 | } |
42 | DateBookWeekLstHeader::~DateBookWeekLstHeader(){} | 43 | DateBookWeekLstHeader::~DateBookWeekLstHeader(){} |
43 | 44 | ||
44 | void DateBookWeekLstHeader::setDate(const QDate &d) { | 45 | void DateBookWeekLstHeader::setDate(const QDate &d) { |
45 | int year,week,dayofweek; | 46 | int year,week,dayofweek; |
46 | date=d; | 47 | date=d; |
47 | dayofweek=d.dayOfWeek(); | 48 | dayofweek=d.dayOfWeek(); |
48 | if(bStartOnMonday) | 49 | if(bStartOnMonday) |
49 | dayofweek--; | 50 | dayofweek--; |
50 | else if( dayofweek == 7 ) | 51 | else if( dayofweek == 7 ) |
51 | /* we already have the right day -7 would lead to the same week */ | 52 | /* we already have the right day -7 would lead to the same week */ |
52 | dayofweek = 0; | 53 | dayofweek = 0; |
53 | 54 | ||
54 | date=date.addDays(-dayofweek); | 55 | date=date.addDays(-dayofweek); |
55 | 56 | ||
56 | calcWeek(date,week,year,bStartOnMonday); | 57 | calcWeek(date,week,year,bStartOnMonday); |
57 | QDate start=date; | 58 | QDate start=date; |
58 | QDate stop=start.addDays(6); | 59 | QDate stop=start.addDays(6); |
59 | labelDate->setText( QString::number(start.day()) + "." + | 60 | labelDate->setText( QString::number(start.day()) + "." + |
60 | Calendar::nameOfMonth( start.month() ) + "-" + | 61 | Calendar::nameOfMonth( start.month() ) + "-" + |
61 | QString::number(stop.day()) + "." + | 62 | QString::number(stop.day()) + "." + |
62 | Calendar::nameOfMonth( stop.month()) +" ("+ | 63 | Calendar::nameOfMonth( stop.month()) +" ("+ |
63 | tr("w")+":"+QString::number( week ) +")"); | 64 | tr("w")+":"+QString::number( week ) +")"); |
64 | date = d; // bugfix: 0001126 - date has to be the selected date, not monday! | 65 | date = d; // bugfix: 0001126 - date has to be the selected date, not monday! |
65 | emit dateChanged(date); | 66 | emit dateChanged(date); |
66 | } | 67 | } |
67 | 68 | ||
68 | void DateBookWeekLstHeader::pickDate() { | 69 | void DateBookWeekLstHeader::pickDate() { |
69 | static QPopupMenu *m1 = 0; | 70 | static QPopupMenu *m1 = 0; |
70 | static DateBookMonth *picker = 0; | 71 | static DateBookMonth *picker = 0; |
71 | if ( !m1 ) { | 72 | if ( !m1 ) { |
72 | m1 = new QPopupMenu( this ); | 73 | m1 = new QPopupMenu( this ); |
73 | picker = new DateBookMonth( m1, 0, TRUE ); | 74 | picker = new DateBookMonth( m1, 0, TRUE ); |
74 | m1->insertItem( picker ); | 75 | m1->insertItem( picker ); |
75 | connect( picker, SIGNAL( dateClicked(int,int,int) ),this, SLOT( setDate(int,int,int) ) ); | 76 | connect( picker, SIGNAL( dateClicked(int,int,int) ),this, SLOT( setDate(int,int,int) ) ); |
76 | //connect( m1, SIGNAL( aboutToHide() ), | 77 | //connect( m1, SIGNAL( aboutToHide() ), |
77 | //this, SLOT( gotHide() ) ); | 78 | //this, SLOT( gotHide() ) ); |
78 | } | 79 | } |
79 | picker->setDate( date.year(), date.month(), date.day() ); | 80 | picker->setDate( date.year(), date.month(), date.day() ); |
80 | m1->popup(mapToGlobal(labelDate->pos()+QPoint(0,labelDate->height()))); | 81 | m1->popup(mapToGlobal(labelDate->pos()+QPoint(0,labelDate->height()))); |
81 | picker->setFocus(); | 82 | picker->setFocus(); |
82 | } | 83 | } |
83 | void DateBookWeekLstHeader::setDate(int y, int m, int d) { | 84 | void DateBookWeekLstHeader::setDate(int y, int m, int d) { |
84 | setDate(QDate(y,m,d)); | 85 | setDate(QDate(y,m,d)); |
85 | } | 86 | } |
86 | 87 | ||
87 | void DateBookWeekLstHeader::nextWeek() { | 88 | void DateBookWeekLstHeader::nextWeek() { |
88 | setDate(date.addDays(7)); | 89 | setDate(date.addDays(7)); |
89 | } | 90 | } |
90 | void DateBookWeekLstHeader::prevWeek() { | 91 | void DateBookWeekLstHeader::prevWeek() { |
91 | setDate(date.addDays(-7)); | 92 | setDate(date.addDays(-7)); |
92 | } | 93 | } |
93 | void DateBookWeekLstHeader::nextMonth() | 94 | void DateBookWeekLstHeader::nextMonth() |
94 | { | 95 | { |
95 | setDate(date.addDays(28)); | 96 | setDate(date.addDays(28)); |
96 | } | 97 | } |
97 | void DateBookWeekLstHeader::prevMonth() | 98 | void DateBookWeekLstHeader::prevMonth() |
98 | { | 99 | { |
99 | setDate(date.addDays(-28)); | 100 | setDate(date.addDays(-28)); |
100 | } | 101 | } |
101 | 102 | ||
102 | DateBookWeekLstDayHdr::DateBookWeekLstDayHdr(const QDate &d, bool /* onM */, | 103 | DateBookWeekLstDayHdr::DateBookWeekLstDayHdr(const QDate &d, bool /* onM */, |
103 | QWidget* parent, | 104 | QWidget* parent, |
104 | const char* name, | 105 | const char* name, |
105 | WFlags fl ) | 106 | WFlags fl ) |
106 | : DateBookWeekLstDayHdrBase(parent, name, fl) { | 107 | : DateBookWeekLstDayHdrBase(parent, name, fl) { |
107 | 108 | ||
108 | date=d; | 109 | date=d; |
109 | 110 | ||
110 | static const QString wdays=tr("MTWTFSSM", "Week days"); | 111 | static const QString wdays=tr("MTWTFSSM", "Week days"); |
111 | char day=wdays[d.dayOfWeek()-1]; | 112 | char day=wdays[d.dayOfWeek()-1]; |
112 | 113 | ||
113 | //dont use dayOfWeek() to save space ! | 114 | //dont use dayOfWeek() to save space ! |
114 | label->setText( QString(QObject::tr(QString(QChar(day)))) + " " +QString::number(d.day()) ); | 115 | label->setText( QString(QObject::tr(QString(QChar(day)))) + " " +QString::number(d.day()) ); |
115 | 116 | ||
116 | add->setText("+"); | 117 | add->setText("+"); |
117 | 118 | ||
118 | if (d == QDate::currentDate()) { | 119 | if (d == QDate::currentDate()) { |
119 | QPalette pal=label->palette(); | 120 | QPalette pal=label->palette(); |
120 | pal.setColor(QColorGroup::Foreground, QColor(0,0,255)); | 121 | pal.setColor(QColorGroup::Foreground, QColor(0,0,255)); |
121 | label->setPalette(pal); | 122 | label->setPalette(pal); |
122 | 123 | ||
123 | /* | 124 | /* |
124 | QFont f=label->font(); | 125 | QFont f=label->font(); |
125 | f.setItalic(true); | 126 | f.setItalic(true); |
126 | label->setFont(f); | 127 | label->setFont(f); |
127 | label->setPalette(QPalette(QColor(0,0,255),label->backgroundColor())); | 128 | label->setPalette(QPalette(QColor(0,0,255),label->backgroundColor())); |
128 | */ | 129 | */ |
129 | } else if (d.dayOfWeek() == 7) { // FIXME: Match any holiday | 130 | } else if (d.dayOfWeek() == 7) { // FIXME: Match any holiday |
130 | QPalette pal=label->palette(); | 131 | QPalette pal=label->palette(); |
131 | pal.setColor(QColorGroup::Foreground, QColor(255,0,0)); | 132 | pal.setColor(QColorGroup::Foreground, QColor(255,0,0)); |
132 | label->setPalette(pal); | 133 | label->setPalette(pal); |
133 | } | 134 | } |
134 | 135 | ||
135 | connect (label, SIGNAL(clicked()), this, SLOT(showDay())); | 136 | connect (label, SIGNAL(clicked()), this, SLOT(showDay())); |
136 | connect (add, SIGNAL(clicked()), this, SLOT(newEvent())); | 137 | connect (add, SIGNAL(clicked()), this, SLOT(newEvent())); |
137 | } | 138 | } |
138 | 139 | ||
139 | void DateBookWeekLstDayHdr::showDay() { | 140 | void DateBookWeekLstDayHdr::showDay() { |
140 | emit showDate(date.year(), date.month(), date.day()); | 141 | emit showDate(date.year(), date.month(), date.day()); |
141 | } | 142 | } |
142 | 143 | ||
143 | void DateBookWeekLstDayHdr::newEvent() { | 144 | void DateBookWeekLstDayHdr::newEvent() { |
144 | QDateTime start, stop; | 145 | QDateTime start, stop; |
145 | start=stop=date; | 146 | start=stop=date; |
146 | start.setTime(QTime(10,0)); | 147 | start.setTime(QTime(10,0)); |
147 | stop.setTime(QTime(12,0)); | 148 | stop.setTime(QTime(12,0)); |
148 | 149 | ||
149 | emit addEvent(start,stop,"",0); | 150 | emit addEvent(start,stop,"",0); |
150 | } | 151 | } |
151 | DateBookWeekLstEvent::DateBookWeekLstEvent(const EffectiveEvent &ev, | 152 | DateBookWeekLstEvent::DateBookWeekLstEvent(const EffectiveEvent &ev, |
152 | int weeklistviewconfig, | 153 | int weeklistviewconfig, |
153 | QWidget* parent, | 154 | QWidget* parent, |
154 | const char* name, | 155 | const char* name, |
155 | WFlags fl ) : OClickableLabel(parent,name,fl), event(ev) | 156 | WFlags fl ) : OClickableLabel(parent,name,fl), event(ev) |
156 | { | 157 | { |
157 | // old values... lastday = "__|__", middle=" |---", Firstday="00:00", | 158 | // old values... lastday = "__|__", middle=" |---", Firstday="00:00", |
158 | QString s,start,middle,end,day; | 159 | QString s,start,middle,end,day; |
159 | 160 | ||
160 | qDebug("weeklistviewconfig=%d",weeklistviewconfig); | 161 | qDebug("weeklistviewconfig=%d",weeklistviewconfig); |
161 | if(weeklistviewconfig==NONE) {// No times displayed. | 162 | if(weeklistviewconfig==NONE) {// No times displayed. |
162 | // start.sprintf("%.2d:%.2d-",ev.start().hour(),ev.start().minute()); | 163 | // start.sprintf("%.2d:%.2d-",ev.start().hour(),ev.start().minute()); |
163 | // middle.sprintf("<--->"); | 164 | // middle.sprintf("<--->"); |
164 | // end.sprintf("-%.2d:%.2d",ev.end().hour(),ev.end().minute()); | 165 | // end.sprintf("-%.2d:%.2d",ev.end().hour(),ev.end().minute()); |
165 | // day.sprintf("%.2d:%.2d-%.2d:%.2d",ev.start().hour(),ev.start().minute(),ev.end().hour(),ev.end().minute()); | 166 | // day.sprintf("%.2d:%.2d-%.2d:%.2d",ev.start().hour(),ev.start().minute(),ev.end().hour(),ev.end().minute()); |
166 | } else if(weeklistviewconfig==NORMAL) {// "Normal", only display start time. | 167 | } else if(weeklistviewconfig==NORMAL) {// "Normal", only display start time. |
167 | start.sprintf("%.2d:%.2d",ev.start().hour(),ev.start().minute()); | 168 | start.sprintf("%.2d:%.2d",ev.start().hour(),ev.start().minute()); |
168 | middle.sprintf(" |---"); | 169 | middle.sprintf(" |---"); |
169 | end.sprintf("__|__"); | 170 | end.sprintf("__|__"); |
170 | day.sprintf("%.2d:%.2d",ev.start().hour(),ev.start().minute()); | 171 | day.sprintf("%.2d:%.2d",ev.start().hour(),ev.start().minute()); |
171 | } else if(weeklistviewconfig==EXTENDED) { // Extended mode, display start and end times. | 172 | } else if(weeklistviewconfig==EXTENDED) { // Extended mode, display start and end times. |
172 | start.sprintf("%.2d:%.2d-",ev.start().hour(),ev.start().minute()); | 173 | start.sprintf("%.2d:%.2d-",ev.start().hour(),ev.start().minute()); |
173 | middle.sprintf("<--->"); | 174 | middle.sprintf("<--->"); |
174 | end.sprintf("-%.2d:%.2d",ev.end().hour(),ev.end().minute()); | 175 | end.sprintf("-%.2d:%.2d",ev.end().hour(),ev.end().minute()); |
175 | day.sprintf("%.2d:%.2d-%.2d:%.2d",ev.start().hour(),ev.start().minute(),ev.end().hour(),ev.end().minute()); | 176 | day.sprintf("%.2d:%.2d-%.2d:%.2d",ev.start().hour(),ev.start().minute(),ev.end().hour(),ev.end().minute()); |
176 | } | 177 | } |
177 | 178 | ||
178 | if(ev.event().type() == Event::Normal) { | 179 | if(ev.event().type() == Event::Normal) { |
179 | if(ev.startDate()==ev.date() && ev.endDate()==ev.date()) {// day event. | 180 | if(ev.startDate()==ev.date() && ev.endDate()==ev.date()) {// day event. |
180 | s=day; | 181 | s=day; |
181 | } else if(ev.startDate()==ev.date()) {// start event. | 182 | } else if(ev.startDate()==ev.date()) {// start event. |
182 | s=start; | 183 | s=start; |
183 | } else if(ev.endDate()==ev.date()) { // end event. | 184 | } else if(ev.endDate()==ev.date()) { // end event. |
184 | s=end; | 185 | s=end; |
185 | } else {// middle day. | 186 | } else {// middle day. |
186 | s=middle; | 187 | s=middle; |
187 | } | 188 | } |
188 | } else { | 189 | } else { |
189 | s=""; | 190 | s=""; |
190 | } | 191 | } |
191 | setText(QString(s) + " " + ev.description()); | 192 | setText(QString(s) + " " + ev.description()); |
192 | connect(this, SIGNAL(clicked()), this, SLOT(editMe())); | 193 | connect(this, SIGNAL(clicked()), this, SLOT(editMe())); |
193 | setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) ); | 194 | setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) ); |
194 | } | 195 | } |
195 | void DateBookWeekLstEvent::editMe() { | 196 | void DateBookWeekLstEvent::editMe() { |
196 | emit editEvent(event.event()); | 197 | emit editEvent(event.event()); |
197 | } | 198 | } |
198 | 199 | ||
199 | 200 | ||
200 | DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev, | 201 | DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev, |
201 | const QDate &d, bool onM, | 202 | const QDate &d, bool onM, |
202 | QWidget* parent, | 203 | QWidget* parent, |
203 | const char* name, WFlags fl) | 204 | const char* name, WFlags fl) |
204 | : QWidget( parent, name, fl ) | 205 | : QWidget( parent, name, fl ) |
205 | { | 206 | { |
206 | Config config("DateBook"); | 207 | Config config("DateBook"); |
207 | config.setGroup("Main"); | 208 | config.setGroup("Main"); |
diff --git a/core/pim/datebook/datebookweeklst.h b/core/pim/datebook/datebookweeklst.h index f683ce7..32fa23f 100644 --- a/core/pim/datebook/datebookweeklst.h +++ b/core/pim/datebook/datebookweeklst.h | |||
@@ -1,156 +1,156 @@ | |||
1 | #ifndef DATEBOOKWEEKLST | 1 | #ifndef DATEBOOKWEEKLST |
2 | #define DATEBOOKWEEKLST | 2 | #define DATEBOOKWEEKLST |
3 | 3 | ||
4 | #include <qwidget.h> | 4 | #include <qwidget.h> |
5 | #include <qdatetime.h> | 5 | #include <qdatetime.h> |
6 | #include <qpe/event.h> | 6 | #include <qpe/event.h> |
7 | #include <qlabel.h> | 7 | #include <qlabel.h> |
8 | #include <qscrollview.h> | 8 | #include <qscrollview.h> |
9 | 9 | ||
10 | #include "datebookweeklstheader.h" | 10 | #include "datebookweeklstheader.h" |
11 | #include "datebookweeklstdayhdr.h" | 11 | #include "datebookweeklstdayhdr.h" |
12 | 12 | ||
13 | #include <opie/oclickablelabel.h> | 13 | #include <opie2/oclickablelabel.h> |
14 | 14 | ||
15 | class QDateTime; | 15 | class QDateTime; |
16 | class DateBookDB; | 16 | class DateBookDB; |
17 | 17 | ||
18 | class DateBookWeekLstHeader: public DateBookWeekLstHeaderBase | 18 | class DateBookWeekLstHeader: public DateBookWeekLstHeaderBase |
19 | { | 19 | { |
20 | Q_OBJECT | 20 | Q_OBJECT |
21 | public: | 21 | public: |
22 | DateBookWeekLstHeader(bool onM, QWidget* parent = 0, const char* name = 0, | 22 | DateBookWeekLstHeader(bool onM, QWidget* parent = 0, const char* name = 0, |
23 | WFlags fl = 0 ); | 23 | WFlags fl = 0 ); |
24 | ~DateBookWeekLstHeader(); | 24 | ~DateBookWeekLstHeader(); |
25 | void setDate(const QDate &d); | 25 | void setDate(const QDate &d); |
26 | 26 | ||
27 | public slots: | 27 | public slots: |
28 | void nextWeek(); | 28 | void nextWeek(); |
29 | void prevWeek(); | 29 | void prevWeek(); |
30 | void nextMonth(); | 30 | void nextMonth(); |
31 | void prevMonth(); | 31 | void prevMonth(); |
32 | void pickDate(); | 32 | void pickDate(); |
33 | void setDate(int y, int m, int d); | 33 | void setDate(int y, int m, int d); |
34 | signals: | 34 | signals: |
35 | void dateChanged(QDate &newdate); | 35 | void dateChanged(QDate &newdate); |
36 | void setDbl(bool on); | 36 | void setDbl(bool on); |
37 | private: | 37 | private: |
38 | QDate date; | 38 | QDate date; |
39 | //bool onMonday; | 39 | //bool onMonday; |
40 | bool bStartOnMonday; | 40 | bool bStartOnMonday; |
41 | }; | 41 | }; |
42 | 42 | ||
43 | class DateBookWeekLstDayHdr: public DateBookWeekLstDayHdrBase | 43 | class DateBookWeekLstDayHdr: public DateBookWeekLstDayHdrBase |
44 | { | 44 | { |
45 | Q_OBJECT | 45 | Q_OBJECT |
46 | public: | 46 | public: |
47 | DateBookWeekLstDayHdr(const QDate &d, bool onM, | 47 | DateBookWeekLstDayHdr(const QDate &d, bool onM, |
48 | QWidget* parent = 0, const char* name = 0, | 48 | QWidget* parent = 0, const char* name = 0, |
49 | WFlags fl = 0 ); | 49 | WFlags fl = 0 ); |
50 | public slots: | 50 | public slots: |
51 | void showDay(); | 51 | void showDay(); |
52 | void newEvent(); | 52 | void newEvent(); |
53 | signals: | 53 | signals: |
54 | void showDate(int y, int m, int d); | 54 | void showDate(int y, int m, int d); |
55 | void addEvent(const QDateTime &start, const QDateTime &stop, | 55 | void addEvent(const QDateTime &start, const QDateTime &stop, |
56 | const QString &str, const QString &location); | 56 | const QString &str, const QString &location); |
57 | private: | 57 | private: |
58 | QDate date; | 58 | QDate date; |
59 | }; | 59 | }; |
60 | 60 | ||
61 | class DateBookWeekLstEvent: public OClickableLabel | 61 | class DateBookWeekLstEvent: public Opie::Ui::OClickableLabel |
62 | { | 62 | { |
63 | Q_OBJECT | 63 | Q_OBJECT |
64 | public: | 64 | public: |
65 | DateBookWeekLstEvent(const EffectiveEvent &ev, int weeklistviewconfig =1, | 65 | DateBookWeekLstEvent(const EffectiveEvent &ev, int weeklistviewconfig =1, |
66 | QWidget* parent = 0, const char* name = 0, | 66 | QWidget* parent = 0, const char* name = 0, |
67 | WFlags fl = 0); | 67 | WFlags fl = 0); |
68 | signals: | 68 | signals: |
69 | void editEvent(const Event &e); | 69 | void editEvent(const Event &e); |
70 | private slots: | 70 | private slots: |
71 | void editMe(); | 71 | void editMe(); |
72 | private: | 72 | private: |
73 | const EffectiveEvent event; | 73 | const EffectiveEvent event; |
74 | }; | 74 | }; |
75 | 75 | ||
76 | class DateBookWeekLstView: public QWidget | 76 | class DateBookWeekLstView: public QWidget |
77 | { | 77 | { |
78 | Q_OBJECT | 78 | Q_OBJECT |
79 | public: | 79 | public: |
80 | DateBookWeekLstView(QValueList<EffectiveEvent> &ev, const QDate &d, bool onM, | 80 | DateBookWeekLstView(QValueList<EffectiveEvent> &ev, const QDate &d, bool onM, |
81 | QWidget* parent = 0, const char* name = 0, | 81 | QWidget* parent = 0, const char* name = 0, |
82 | WFlags fl = 0 ); | 82 | WFlags fl = 0 ); |
83 | ~DateBookWeekLstView(); | 83 | ~DateBookWeekLstView(); |
84 | signals: | 84 | signals: |
85 | void editEvent(const Event &e); | 85 | void editEvent(const Event &e); |
86 | void showDate(int y, int m, int d); | 86 | void showDate(int y, int m, int d); |
87 | void addEvent(const QDateTime &start, const QDateTime &stop, | 87 | void addEvent(const QDateTime &start, const QDateTime &stop, |
88 | const QString &str, const QString &location); | 88 | const QString &str, const QString &location); |
89 | private: | 89 | private: |
90 | bool bStartOnMonday; | 90 | bool bStartOnMonday; |
91 | protected slots: | 91 | protected slots: |
92 | void keyPressEvent(QKeyEvent *); | 92 | void keyPressEvent(QKeyEvent *); |
93 | }; | 93 | }; |
94 | 94 | ||
95 | class DateBookWeekLstDblView: public QWidget { | 95 | class DateBookWeekLstDblView: public QWidget { |
96 | Q_OBJECT | 96 | Q_OBJECT |
97 | public: | 97 | public: |
98 | DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1, | 98 | DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1, |
99 | QValueList<EffectiveEvent> &ev2, | 99 | QValueList<EffectiveEvent> &ev2, |
100 | QDate &d, bool onM, | 100 | QDate &d, bool onM, |
101 | QWidget* parent = 0, const char* name = 0, | 101 | QWidget* parent = 0, const char* name = 0, |
102 | WFlags fl = 0 ); | 102 | WFlags fl = 0 ); |
103 | signals: | 103 | signals: |
104 | void editEvent(const Event &e); | 104 | void editEvent(const Event &e); |
105 | void showDate(int y, int m, int d); | 105 | void showDate(int y, int m, int d); |
106 | void addEvent(const QDateTime &start, const QDateTime &stop, | 106 | void addEvent(const QDateTime &start, const QDateTime &stop, |
107 | const QString &str, const QString &location); | 107 | const QString &str, const QString &location); |
108 | }; | 108 | }; |
109 | 109 | ||
110 | class DateBookWeekLst : public QWidget | 110 | class DateBookWeekLst : public QWidget |
111 | { | 111 | { |
112 | Q_OBJECT | 112 | Q_OBJECT |
113 | 113 | ||
114 | public: | 114 | public: |
115 | DateBookWeekLst( bool ampm, bool onM, DateBookDB *newDB, | 115 | DateBookWeekLst( bool ampm, bool onM, DateBookDB *newDB, |
116 | QWidget *parent = 0, | 116 | QWidget *parent = 0, |
117 | const char *name = 0 ); | 117 | const char *name = 0 ); |
118 | ~DateBookWeekLst(); | 118 | ~DateBookWeekLst(); |
119 | void setDate( int y, int w ); | 119 | void setDate( int y, int w ); |
120 | void setDate(const QDate &d ); | 120 | void setDate(const QDate &d ); |
121 | int week() const { return _week; }; | 121 | int week() const { return _week; }; |
122 | QDate date(); | 122 | QDate date(); |
123 | QDate weekDate() const; | 123 | QDate weekDate() const; |
124 | 124 | ||
125 | public slots: | 125 | public slots: |
126 | void redraw(); | 126 | void redraw(); |
127 | void dateChanged(QDate &date); | 127 | void dateChanged(QDate &date); |
128 | 128 | ||
129 | protected slots: | 129 | protected slots: |
130 | void keyPressEvent(QKeyEvent *); | 130 | void keyPressEvent(QKeyEvent *); |
131 | void setDbl(bool on); | 131 | void setDbl(bool on); |
132 | 132 | ||
133 | signals: | 133 | signals: |
134 | void showDate(int y, int m, int d); | 134 | void showDate(int y, int m, int d); |
135 | void addEvent(const QDateTime &start, const QDateTime &stop, | 135 | void addEvent(const QDateTime &start, const QDateTime &stop, |
136 | const QString &str, const QString &location); | 136 | const QString &str, const QString &location); |
137 | void editEvent(const Event &e); | 137 | void editEvent(const Event &e); |
138 | 138 | ||
139 | private: | 139 | private: |
140 | DateBookDB *db; | 140 | DateBookDB *db; |
141 | int startTime; | 141 | int startTime; |
142 | bool ampm; | 142 | bool ampm; |
143 | bool bStartOnMonday; | 143 | bool bStartOnMonday; |
144 | bool dbl; | 144 | bool dbl; |
145 | QDate bdate; | 145 | QDate bdate; |
146 | int year, _week,dow; | 146 | int year, _week,dow; |
147 | DateBookWeekLstHeader *header; | 147 | DateBookWeekLstHeader *header; |
148 | QWidget *view; | 148 | QWidget *view; |
149 | QVBoxLayout *layout; | 149 | QVBoxLayout *layout; |
150 | QScrollView *scroll; | 150 | QScrollView *scroll; |
151 | 151 | ||
152 | void getEvents(); | 152 | void getEvents(); |
153 | }; | 153 | }; |
154 | 154 | ||
155 | #endif | 155 | #endif |
156 | 156 | ||
diff --git a/core/pim/datebook/dateentryimpl.cpp b/core/pim/datebook/dateentryimpl.cpp index 57bcd89..dbff18f 100644 --- a/core/pim/datebook/dateentryimpl.cpp +++ b/core/pim/datebook/dateentryimpl.cpp | |||
@@ -1,224 +1,224 @@ | |||
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 "dateentryimpl.h" | 21 | #include "dateentryimpl.h" |
22 | #include "repeatentry.h" | 22 | #include "repeatentry.h" |
23 | 23 | ||
24 | #include <qpe/qpeapplication.h> | 24 | #include <qpe/qpeapplication.h> |
25 | #include <qpe/categoryselect.h> | 25 | #include <qpe/categoryselect.h> |
26 | #include <qpe/datebookmonth.h> | 26 | #include <qpe/datebookmonth.h> |
27 | #include <qpe/tzselect.h> | 27 | #include <qpe/tzselect.h> |
28 | 28 | ||
29 | #include <qlineedit.h> | 29 | #include <qlineedit.h> |
30 | #include <qspinbox.h> | 30 | #include <qspinbox.h> |
31 | 31 | ||
32 | #include <opie/otimepicker.h> | 32 | #include <opie2/otimepicker.h> |
33 | #include "onoteedit.h" | 33 | #include "onoteedit.h" |
34 | 34 | ||
35 | #include <stdlib.h> | 35 | #include <stdlib.h> |
36 | #include <stdio.h> | 36 | #include <stdio.h> |
37 | 37 | ||
38 | /* | 38 | /* |
39 | * Constructs a DateEntry which is a child of 'parent', with the | 39 | * Constructs a DateEntry which is a child of 'parent', with the |
40 | * name 'name' and widget flags set to 'f' | 40 | * name 'name' and widget flags set to 'f' |
41 | * | 41 | * |
42 | * The dialog will by default be modeless, unless you set 'modal' to | 42 | * The dialog will by default be modeless, unless you set 'modal' to |
43 | * TRUE to construct a modal dialog. | 43 | * TRUE to construct a modal dialog. |
44 | */ | 44 | */ |
45 | 45 | ||
46 | DateEntry::DateEntry( bool startOnMonday, const QDateTime &start, | 46 | DateEntry::DateEntry( bool startOnMonday, const QDateTime &start, |
47 | const QDateTime &end, bool whichClock, QWidget* parent, | 47 | const QDateTime &end, bool whichClock, QWidget* parent, |
48 | const char* name ) | 48 | const char* name ) |
49 | : DateEntryBase( parent, name ), | 49 | : DateEntryBase( parent, name ), |
50 | ampm( whichClock ), | 50 | ampm( whichClock ), |
51 | startWeekOnMonday( startOnMonday ), | 51 | startWeekOnMonday( startOnMonday ), |
52 | m_showStart(true) | 52 | m_showStart(true) |
53 | { | 53 | { |
54 | init(); | 54 | init(); |
55 | setDates(start,end); | 55 | setDates(start,end); |
56 | setFocusProxy(comboDescription); | 56 | setFocusProxy(comboDescription); |
57 | } | 57 | } |
58 | 58 | ||
59 | bool DateEntry::eventFilter(QObject *obj, QEvent *ev ) | 59 | bool DateEntry::eventFilter(QObject *obj, QEvent *ev ) |
60 | { | 60 | { |
61 | if( ev->type() == QEvent::FocusIn ){ | 61 | if( ev->type() == QEvent::FocusIn ){ |
62 | if( obj == comboStart ){ | 62 | if( obj == comboStart ){ |
63 | timePickerStart->setHour(startTime.hour()); | 63 | timePickerStart->setHour(startTime.hour()); |
64 | timePickerStart->setMinute(startTime.minute()); | 64 | timePickerStart->setMinute(startTime.minute()); |
65 | TimePickerLabel->setText( tr("Start Time" ) ); | 65 | TimePickerLabel->setText( tr("Start Time" ) ); |
66 | m_showStart= true; | 66 | m_showStart= true; |
67 | }else if( obj == comboEnd ){ | 67 | }else if( obj == comboEnd ){ |
68 | timePickerStart->setHour(endTime.hour()); | 68 | timePickerStart->setHour(endTime.hour()); |
69 | timePickerStart->setMinute(endTime.minute()); | 69 | timePickerStart->setMinute(endTime.minute()); |
70 | TimePickerLabel->setText( tr("End Time") ); | 70 | TimePickerLabel->setText( tr("End Time") ); |
71 | m_showStart = false; | 71 | m_showStart = false; |
72 | } | 72 | } |
73 | } else if( ev->type() == QEvent::FocusOut ){ | 73 | } else if( ev->type() == QEvent::FocusOut ){ |
74 | // if( obj == comboEnd ){ | 74 | // if( obj == comboEnd ){ |
75 | // QString s; | 75 | // QString s; |
76 | // s.sprintf("%.2d:%.2d",endTime.hour(), endTime.minute()); | 76 | // s.sprintf("%.2d:%.2d",endTime.hour(), endTime.minute()); |
77 | // comboEnd->setText(s); | 77 | // comboEnd->setText(s); |
78 | // } | 78 | // } |
79 | // else if( obj == comboStart ){ | 79 | // else if( obj == comboStart ){ |
80 | // QString s; | 80 | // QString s; |
81 | // s.sprintf("%.2d:%.2d",startTime.hour(), startTime.minute()); | 81 | // s.sprintf("%.2d:%.2d",startTime.hour(), startTime.minute()); |
82 | // comboStart->setText(s); | 82 | // comboStart->setText(s); |
83 | // } | 83 | // } |
84 | } | 84 | } |
85 | 85 | ||
86 | return false; | 86 | return false; |
87 | } | 87 | } |
88 | 88 | ||
89 | static void addOrPick( QComboBox* combo, const QString& t ) | 89 | static void addOrPick( QComboBox* combo, const QString& t ) |
90 | { | 90 | { |
91 | // Pick an item if one excists | 91 | // Pick an item if one excists |
92 | for (int i=0; i<combo->count(); i++) { | 92 | for (int i=0; i<combo->count(); i++) { |
93 | if ( combo->text(i) == t ) { | 93 | if ( combo->text(i) == t ) { |
94 | combo->setCurrentItem(i); | 94 | combo->setCurrentItem(i); |
95 | return; | 95 | return; |
96 | } | 96 | } |
97 | } | 97 | } |
98 | 98 | ||
99 | // Else add one | 99 | // Else add one |
100 | combo->insertItem(t); | 100 | combo->insertItem(t); |
101 | combo->setCurrentItem(combo->count()-1); | 101 | combo->setCurrentItem(combo->count()-1); |
102 | } | 102 | } |
103 | 103 | ||
104 | DateEntry::DateEntry( bool startOnMonday, const Event &event, bool whichClock, | 104 | DateEntry::DateEntry( bool startOnMonday, const Event &event, bool whichClock, |
105 | QWidget* parent, const char* name ) | 105 | QWidget* parent, const char* name ) |
106 | : DateEntryBase( parent, name ), | 106 | : DateEntryBase( parent, name ), |
107 | ampm( whichClock ), | 107 | ampm( whichClock ), |
108 | startWeekOnMonday( startOnMonday ), | 108 | startWeekOnMonday( startOnMonday ), |
109 | m_showStart(true) | 109 | m_showStart(true) |
110 | 110 | ||
111 | { | 111 | { |
112 | init(); | 112 | init(); |
113 | setDates(event.start(),event.end()); | 113 | setDates(event.start(),event.end()); |
114 | comboCategory->setCategories( event.categories(), "Calendar", tr("Calendar") ); | 114 | comboCategory->setCategories( event.categories(), "Calendar", tr("Calendar") ); |
115 | if(!event.description().isEmpty()) | 115 | if(!event.description().isEmpty()) |
116 | addOrPick( comboDescription, event.description() ); | 116 | addOrPick( comboDescription, event.description() ); |
117 | if(!event.location().isEmpty()) | 117 | if(!event.location().isEmpty()) |
118 | addOrPick( comboLocation, event.location() ); | 118 | addOrPick( comboLocation, event.location() ); |
119 | checkAlarm->setChecked( event.hasAlarm() ); | 119 | checkAlarm->setChecked( event.hasAlarm() ); |
120 | checkAllDay->setChecked( event.type() == Event::AllDay ); | 120 | checkAllDay->setChecked( event.type() == Event::AllDay ); |
121 | if(!event.notes().isEmpty()) noteStr=event.notes(); | 121 | if(!event.notes().isEmpty()) noteStr=event.notes(); |
122 | else noteStr=""; | 122 | else noteStr=""; |
123 | spinAlarm->setValue(event.alarmTime()); | 123 | spinAlarm->setValue(event.alarmTime()); |
124 | if ( event.alarmSound() != Event::Silent ) | 124 | if ( event.alarmSound() != Event::Silent ) |
125 | comboSound->setCurrentItem( 1 ); | 125 | comboSound->setCurrentItem( 1 ); |
126 | if ( event.hasRepeat() ) { | 126 | if ( event.hasRepeat() ) { |
127 | rp = event.repeatPattern(); | 127 | rp = event.repeatPattern(); |
128 | cmdRepeat->setText( tr("Repeat...") ); | 128 | cmdRepeat->setText( tr("Repeat...") ); |
129 | } | 129 | } |
130 | setRepeatLabel(); | 130 | setRepeatLabel(); |
131 | } | 131 | } |
132 | 132 | ||
133 | void DateEntry::setDates( const QDateTime& s, const QDateTime& e ) | 133 | void DateEntry::setDates( const QDateTime& s, const QDateTime& e ) |
134 | { | 134 | { |
135 | startDate = s.date(); | 135 | startDate = s.date(); |
136 | endDate = e.date(); | 136 | endDate = e.date(); |
137 | startTime = s.time(); | 137 | startTime = s.time(); |
138 | endTime = e.time(); | 138 | endTime = e.time(); |
139 | 139 | ||
140 | startDateChanged( s.date().year(), s.date().month(), s.date().day() ); | 140 | startDateChanged( s.date().year(), s.date().month(), s.date().day() ); |
141 | endDateChanged( e.date().year(), e.date().month(), e.date().day() ); | 141 | endDateChanged( e.date().year(), e.date().month(), e.date().day() ); |
142 | 142 | ||
143 | updateTimeEdit(true,true); | 143 | updateTimeEdit(true,true); |
144 | } | 144 | } |
145 | 145 | ||
146 | void DateEntry::updateTimeEdit(bool s, bool e) { | 146 | void DateEntry::updateTimeEdit(bool s, bool e) { |
147 | 147 | ||
148 | // Comboboxes | 148 | // Comboboxes |
149 | QString strStart, strEnd; | 149 | QString strStart, strEnd; |
150 | int shour, ehour; | 150 | int shour, ehour; |
151 | if ( ampm ) { | 151 | if ( ampm ) { |
152 | shour = startTime.hour(); | 152 | shour = startTime.hour(); |
153 | ehour = endTime.hour(); | 153 | ehour = endTime.hour(); |
154 | if ( shour >= 12 ) { | 154 | if ( shour >= 12 ) { |
155 | if ( shour > 12 ) | 155 | if ( shour > 12 ) |
156 | shour -= 12; | 156 | shour -= 12; |
157 | strStart.sprintf( "%d:%02d PM", shour, startTime.minute() ); | 157 | strStart.sprintf( "%d:%02d PM", shour, startTime.minute() ); |
158 | } else { | 158 | } else { |
159 | if ( shour == 0 ) | 159 | if ( shour == 0 ) |
160 | shour = 12; | 160 | shour = 12; |
161 | strStart.sprintf( "%d:%02d AM", shour, startTime.minute() ); | 161 | strStart.sprintf( "%d:%02d AM", shour, startTime.minute() ); |
162 | } | 162 | } |
163 | if ( ehour == 24 && endTime.minute() == 0 ) { | 163 | if ( ehour == 24 && endTime.minute() == 0 ) { |
164 | strEnd = "11:59 PM"; // or "midnight" | 164 | strEnd = "11:59 PM"; // or "midnight" |
165 | } else if ( ehour >= 12 ) { | 165 | } else if ( ehour >= 12 ) { |
166 | if ( ehour > 12 ) | 166 | if ( ehour > 12 ) |
167 | ehour -= 12; | 167 | ehour -= 12; |
168 | strEnd.sprintf( "%d:%02d PM", ehour, endTime.minute() ); | 168 | strEnd.sprintf( "%d:%02d PM", ehour, endTime.minute() ); |
169 | } else { | 169 | } else { |
170 | if ( ehour == 0 ) | 170 | if ( ehour == 0 ) |
171 | ehour = 12; | 171 | ehour = 12; |
172 | strEnd.sprintf( "%d:%02d AM", ehour, endTime.minute() ); | 172 | strEnd.sprintf( "%d:%02d AM", ehour, endTime.minute() ); |
173 | } | 173 | } |
174 | } else { | 174 | } else { |
175 | strStart.sprintf( "%02d:%02d", startTime.hour(), startTime.minute() ); | 175 | strStart.sprintf( "%02d:%02d", startTime.hour(), startTime.minute() ); |
176 | strEnd.sprintf( "%02d:%02d", endTime.hour(), endTime.minute() ); | 176 | strEnd.sprintf( "%02d:%02d", endTime.hour(), endTime.minute() ); |
177 | } | 177 | } |
178 | 178 | ||
179 | if (s) comboStart->setText(strStart); | 179 | if (s) comboStart->setText(strStart); |
180 | if (e) comboEnd->setText(strEnd); | 180 | if (e) comboEnd->setText(strEnd); |
181 | } | 181 | } |
182 | 182 | ||
183 | void DateEntry::init() | 183 | void DateEntry::init() |
184 | { | 184 | { |
185 | comboDescription->setInsertionPolicy(QComboBox::AtCurrent); | 185 | comboDescription->setInsertionPolicy(QComboBox::AtCurrent); |
186 | comboLocation->setInsertionPolicy(QComboBox::AtCurrent); | 186 | comboLocation->setInsertionPolicy(QComboBox::AtCurrent); |
187 | 187 | ||
188 | initCombos(); | 188 | initCombos(); |
189 | QPopupMenu *m1 = new QPopupMenu( this ); | 189 | QPopupMenu *m1 = new QPopupMenu( this ); |
190 | startPicker = new DateBookMonth( m1, 0, TRUE ); | 190 | startPicker = new DateBookMonth( m1, 0, TRUE ); |
191 | m1->insertItem( startPicker ); | 191 | m1->insertItem( startPicker ); |
192 | buttonStart->setPopup( m1 ); | 192 | buttonStart->setPopup( m1 ); |
193 | connect( startPicker, SIGNAL( dateClicked(int,int,int) ), | 193 | connect( startPicker, SIGNAL( dateClicked(int,int,int) ), |
194 | this, SLOT( startDateChanged(int,int,int) ) ); | 194 | this, SLOT( startDateChanged(int,int,int) ) ); |
195 | 195 | ||
196 | //Let start button change both start and end dates | 196 | //Let start button change both start and end dates |
197 | connect( startPicker, SIGNAL( dateClicked(int,int,int) ), | 197 | connect( startPicker, SIGNAL( dateClicked(int,int,int) ), |
198 | this, SLOT( endDateChanged(int,int,int) ) ); | 198 | this, SLOT( endDateChanged(int,int,int) ) ); |
199 | connect( qApp, SIGNAL( clockChanged(bool) ), | 199 | connect( qApp, SIGNAL( clockChanged(bool) ), |
200 | this, SLOT( slotChangeClock(bool) ) ); | 200 | this, SLOT( slotChangeClock(bool) ) ); |
201 | connect( qApp, SIGNAL(weekChanged(bool)), | 201 | connect( qApp, SIGNAL(weekChanged(bool)), |
202 | this, SLOT(slotChangeStartOfWeek(bool)) ); | 202 | this, SLOT(slotChangeStartOfWeek(bool)) ); |
203 | 203 | ||
204 | connect( editNote, SIGNAL(clicked()), | 204 | connect( editNote, SIGNAL(clicked()), |
205 | this, SLOT(slotEditNote()) ); | 205 | this, SLOT(slotEditNote()) ); |
206 | 206 | ||
207 | QPopupMenu *m2 = new QPopupMenu( this ); | 207 | QPopupMenu *m2 = new QPopupMenu( this ); |
208 | endPicker = new DateBookMonth( m2, 0, TRUE ); | 208 | endPicker = new DateBookMonth( m2, 0, TRUE ); |
209 | m2->insertItem( endPicker ); | 209 | m2->insertItem( endPicker ); |
210 | buttonEnd->setPopup( m2 ); | 210 | buttonEnd->setPopup( m2 ); |
211 | connect( endPicker, SIGNAL( dateClicked(int,int,int) ), | 211 | connect( endPicker, SIGNAL( dateClicked(int,int,int) ), |
212 | this, SLOT( endDateChanged(int,int,int) ) ); | 212 | this, SLOT( endDateChanged(int,int,int) ) ); |
213 | 213 | ||
214 | connect(timePickerStart, SIGNAL( timeChanged(const QTime&) ), | 214 | connect(timePickerStart, SIGNAL( timeChanged(const QTime&) ), |
215 | this, SLOT( startTimePicked(const QTime&) )); | 215 | this, SLOT( startTimePicked(const QTime&) )); |
216 | // install eventFilters | 216 | // install eventFilters |
217 | comboEnd->installEventFilter( this ); | 217 | comboEnd->installEventFilter( this ); |
218 | comboStart->installEventFilter( this ); | 218 | comboStart->installEventFilter( this ); |
219 | } | 219 | } |
220 | 220 | ||
221 | /* | 221 | /* |
222 | * Destroys the object and frees any allocated resources | 222 | * Destroys the object and frees any allocated resources |
223 | */ | 223 | */ |
224 | DateEntry::~DateEntry() | 224 | DateEntry::~DateEntry() |
diff --git a/core/pim/datebook/main.cpp b/core/pim/datebook/main.cpp index 421e457..3cb60af 100644 --- a/core/pim/datebook/main.cpp +++ b/core/pim/datebook/main.cpp | |||
@@ -1,24 +1,25 @@ | |||
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 "datebook.h" | 21 | #include "datebook.h" |
22 | #include <opie/oapplicationfactory.h> | 22 | #include <opie2/oapplicationfactory.h> |
23 | 23 | ||
24 | using namespace Opie::Core; | ||
24 | OPIE_EXPORT_APP( OApplicationFactory<DateBook> ) | 25 | OPIE_EXPORT_APP( OApplicationFactory<DateBook> ) |