27 files changed, 795 insertions, 371 deletions
diff --git a/core/pim/datebook/datebook.cpp b/core/pim/datebook/datebook.cpp index cc7bf4b..68ab07a 100644 --- a/core/pim/datebook/datebook.cpp +++ b/core/pim/datebook/datebook.cpp | |||
@@ -1,228 +1,244 @@ | |||
1 | /********************************************************************** | 1 | /* |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | This file is part of the Opie Project |
3 | ** | 3 | |
4 | ** This file is part of Qtopia Environment. | 4 | Copyright (C) Opie Team <opie-devel@handhelds.org> |
5 | ** | 5 | =. |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | .=l. |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | .>+-= |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | _;:, .> :=|. This program is free software; you can |
9 | ** packaging of this file. | 9 | .> <`_, > . <= redistribute it and/or modify it under |
10 | ** | 10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | .="- .-=="i, .._ License as published by the Free Software |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | - . .-<_> .<> Foundation; either version 2 of the License, |
13 | ** | 13 | ._= =} : or (at your option) any later version. |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | .%`+i> _;_. |
15 | ** | 15 | .i_,=:_. -<s. This program is distributed in the hope that |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
17 | ** not clear to you. | 17 | : .. .:, . . . without even the implied warranty of |
18 | ** | 18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | ** $Id$ | 19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
20 | ** | 20 | ..}^=.= = ; Library General Public License for more |
21 | **********************************************************************/ | 21 | ++= -. .` .: details. |
22 | : = ...= . :.=- | ||
23 | -. .:....=;==+<; You should have received a copy of the GNU | ||
24 | -_. . . )=. = Library General Public License along with | ||
25 | -- :-=` this library; see the file COPYING.LIB. | ||
26 | If not, write to the Free Software Foundation, | ||
27 | Inc., 59 Temple Place - Suite 330, | ||
28 | Boston, MA 02111-1307, USA. | ||
29 | */ | ||
22 | 30 | ||
23 | #define QTOPIA_INTERNAL_FD | 31 | #define QTOPIA_INTERNAL_FD |
24 | 32 | ||
25 | #include "datebook.h" | 33 | #include "datebook.h" |
26 | #include "datebookday.h" | 34 | #include "datebookday.h" |
27 | #include "datebooksettings.h" | 35 | #include "datebooksettings.h" |
28 | #include "datebookweek.h" | 36 | #include "datebookweek.h" |
29 | #include "modules/weeklst/datebookweeklst.h" | 37 | #include "modules/weeklst/datebookweeklst.h" |
30 | #include "modules/monthview/odatebookmonth.h" | 38 | #include "modules/monthview/odatebookmonth.h" |
31 | #include "dateentryimpl.h" | 39 | #include "dateentryimpl.h" |
32 | 40 | ||
33 | #include <opie2/odebug.h> | 41 | #include <opie2/odebug.h> |
34 | #include <opie2/oholidaypluginif.h> | 42 | #include <opie2/oholidaypluginif.h> |
35 | #include <opie2/oholidayplugin.h> | 43 | #include <opie2/oholidayplugin.h> |
36 | #include <opie2/opluginloader.h> | 44 | #include <opie2/opluginloader.h> |
45 | #include <opie2/oresource.h> | ||
37 | #include <opie2/todayplugininterface.h> | 46 | #include <opie2/todayplugininterface.h> |
38 | 47 | ||
39 | //#include <qpe/datebookmonth.h> | 48 | //#include <qpe/datebookmonth.h> |
40 | #include <qpe/qpeapplication.h> | 49 | #include <qpe/qpeapplication.h> |
41 | #include <qpe/config.h> | 50 | #include <qpe/config.h> |
42 | #include <qpe/finddialog.h> | 51 | #include <qpe/finddialog.h> |
43 | #include <qpe/ir.h> | 52 | #include <qpe/ir.h> |
44 | #include <qpe/qpemessagebox.h> | 53 | #include <qpe/qpemessagebox.h> |
45 | #include <qpe/resource.h> | ||
46 | #include <qpe/sound.h> | 54 | #include <qpe/sound.h> |
47 | #include <qpe/tzselect.h> | 55 | #include <qpe/tzselect.h> |
48 | #include <qtopia/qlibrary.h> | 56 | #include <qtopia/qlibrary.h> |
49 | 57 | ||
50 | #include <qaction.h> | 58 | #include <qaction.h> |
51 | #include <qcopchannel_qws.h> | 59 | #include <qcopchannel_qws.h> |
52 | #include <qlayout.h> | 60 | #include <qlayout.h> |
53 | #include <qmessagebox.h> | 61 | #include <qmessagebox.h> |
54 | #include <qtimer.h> | 62 | #include <qtimer.h> |
55 | #include <qtl.h> | 63 | #include <qtl.h> |
56 | #include <qtoolbar.h> | 64 | #include <qtoolbar.h> |
57 | #include <qwidgetstack.h> | 65 | #include <qwidgetstack.h> |
58 | #include <qdir.h> | 66 | #include <qdir.h> |
59 | #include <qlabel.h> | 67 | #include <qlabel.h> |
60 | 68 | ||
61 | #include <sys/stat.h> | 69 | #include <sys/stat.h> |
62 | #include <sys/types.h> | 70 | #include <sys/types.h> |
63 | #include <fcntl.h> | 71 | #include <fcntl.h> |
64 | #include <unistd.h> | 72 | #include <unistd.h> |
65 | 73 | ||
66 | #include <stdlib.h> | 74 | #include <stdlib.h> |
67 | 75 | ||
68 | DateBook::DateBook( QWidget *parent, const char *, WFlags f ) | 76 | DateBook::DateBook( QWidget *parent, const char *, WFlags f ) |
69 | : QMainWindow( parent, "datebook", f ), | 77 | : QMainWindow( parent, "datebook", f ), |
70 | aPreset( FALSE ), | 78 | aPreset( FALSE ), |
71 | presetTime( -1 ), | 79 | presetTime( -1 ), |
72 | startTime( 8 ), // an acceptable default | 80 | startTime( 8 ), // an acceptable default |
73 | rowStyle( 0 ), | 81 | rowStyle( 0 ), |
74 | bJumpToCurTime(FALSE), | 82 | bJumpToCurTime(FALSE), |
75 | syncing(FALSE), | 83 | syncing(FALSE), |
76 | inSearch(FALSE), | 84 | inSearch(FALSE), |
77 | alarmCounter(0) | 85 | alarmCounter(0) |
78 | { | 86 | { |
79 | bool needEvilHack= false; // if we need an Evil Hack | 87 | bool needEvilHack= false; // if we need an Evil Hack |
80 | QTime t; | 88 | QTime t; |
81 | t.start(); | 89 | t.start(); |
82 | db = new DateBookDBHoliday; | 90 | db = new DateBookDBHoliday; |
83 | odebug << "loading db t=" << t.elapsed() << oendl; | 91 | odebug << "loading db t=" << t.elapsed() << oendl; |
84 | db_holiday = new DateBookHoliday(); | 92 | db_holiday = new DateBookHoliday(); |
85 | db->db_holiday=db_holiday; | 93 | db->db_holiday=db_holiday; |
86 | 94 | ||
87 | loadSettings(); | 95 | loadSettings(); |
88 | setCaption( tr("Calendar") ); | 96 | setCaption( tr("Calendar") ); |
89 | setIcon( Resource::loadPixmap( "datebook_icon" ) ); | 97 | setIcon( Opie::Core::OResource::loadPixmap( "datebook_icon" ) ); |
90 | 98 | ||
91 | setToolBarsMovable( FALSE ); | 99 | setToolBarsMovable( FALSE ); |
92 | 100 | ||
93 | views = new QWidgetStack( this ); | 101 | views = new QWidgetStack( this ); |
94 | setCentralWidget( views ); | 102 | setCentralWidget( views ); |
95 | 103 | ||
96 | dayView = 0; | 104 | dayView = 0; |
97 | weekView = 0; | 105 | weekView = 0; |
98 | weekLstView = 0; | 106 | weekLstView = 0; |
99 | monthView = 0; | 107 | monthView = 0; |
100 | 108 | ||
101 | // QToolBar *bar = new QToolBar( this ); | 109 | // QToolBar *bar = new QToolBar( this ); |
102 | // bar->setHorizontalStretchable( TRUE ); | 110 | // bar->setHorizontalStretchable( TRUE ); |
103 | 111 | ||
104 | // QMenuBar *mb = new QMenuBar( bar ); | 112 | // QMenuBar *mb = new QMenuBar( bar ); |
105 | // mb->setMargin( 0 ); | 113 | // mb->setMargin( 0 ); |
106 | 114 | ||
107 | // QPopupMenu *view = new QPopupMenu( this ); | 115 | // QPopupMenu *view = new QPopupMenu( this ); |
108 | // mb->insertItem( tr( "View" ), view ); | 116 | // mb->insertItem( tr( "View" ), view ); |
109 | 117 | ||
110 | QToolBar *sub_bar = new QToolBar(this); | 118 | QToolBar *sub_bar = new QToolBar(this); |
111 | sub_bar->setHorizontalStretchable(TRUE); | 119 | sub_bar->setHorizontalStretchable(TRUE); |
112 | 120 | ||
113 | QActionGroup *g = new QActionGroup( this ); | 121 | QActionGroup *g = new QActionGroup( this ); |
114 | g->setExclusive( TRUE ); | 122 | g->setExclusive( TRUE ); |
115 | 123 | ||
116 | QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); | 124 | QAction *a = new QAction( tr( "New" ), Opie::Core::OResource::loadPixmap( "new", Opie::Core::OResource::SmallIcon ), |
125 | QString::null, 0, this, 0 ); | ||
117 | connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) ); | 126 | connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) ); |
118 | a->addTo( sub_bar ); | 127 | a->addTo( sub_bar ); |
119 | 128 | ||
120 | sub_bar->addSeparator(); | 129 | sub_bar->addSeparator(); |
121 | 130 | ||
122 | a = new QAction( tr( "Today" ), Resource::loadPixmap( "datebook/to_day" ), QString::null, 0, g, 0 ); | 131 | a = new QAction( tr( "Today" ), Opie::Core::OResource::loadPixmap( "datebook/to_day", Opie::Core::OResource::SmallIcon ), |
132 | QString::null, 0, g, 0 ); | ||
123 | connect( a, SIGNAL( activated() ), this, SLOT( slotToday() ) ); | 133 | connect( a, SIGNAL( activated() ), this, SLOT( slotToday() ) ); |
124 | a->addTo( sub_bar ); | 134 | a->addTo( sub_bar ); |
125 | // a->addTo( view ); | 135 | // a->addTo( view ); |
126 | 136 | ||
127 | sub_bar->addSeparator(); | 137 | sub_bar->addSeparator(); |
128 | 138 | ||
129 | a = new QAction( tr( "Day" ), Resource::loadPixmap( "day" ), QString::null, 0, g, 0 ); | 139 | a = new QAction( tr( "Day" ), Opie::Core::OResource::loadPixmap( "day", Opie::Core::OResource::SmallIcon ), |
140 | QString::null, 0, g, 0 ); | ||
130 | connect( a, SIGNAL( activated() ), this, SLOT( viewDay() ) ); | 141 | connect( a, SIGNAL( activated() ), this, SLOT( viewDay() ) ); |
131 | a->addTo( sub_bar ); | 142 | a->addTo( sub_bar ); |
132 | // a->addTo( view ); | 143 | // a->addTo( view ); |
133 | a->setToggleAction( TRUE ); | 144 | a->setToggleAction( TRUE ); |
134 | a->setOn( TRUE ); | 145 | a->setOn( TRUE ); |
135 | dayAction = a; | 146 | dayAction = a; |
136 | 147 | ||
137 | a = new QAction( tr( "Week" ), Resource::loadPixmap( "week" ), QString::null, 0, g, 0 ); | 148 | a = new QAction( tr( "Week" ), Opie::Core::OResource::loadPixmap( "week", Opie::Core::OResource::SmallIcon ), |
149 | QString::null, 0, g, 0 ); | ||
138 | connect( a, SIGNAL( activated() ), this, SLOT( viewWeek() ) ); | 150 | connect( a, SIGNAL( activated() ), this, SLOT( viewWeek() ) ); |
139 | a->addTo( sub_bar ); | 151 | a->addTo( sub_bar ); |
140 | // a->addTo( view ); | 152 | // a->addTo( view ); |
141 | a->setToggleAction( TRUE ); | 153 | a->setToggleAction( TRUE ); |
142 | weekAction = a; | 154 | weekAction = a; |
143 | 155 | ||
144 | a = new QAction( tr( "WeekLst" ), Resource::loadPixmap( "datebook/weeklst" ), QString::null, 0, g, 0 ); | 156 | a = new QAction( tr( "WeekLst" ), Opie::Core::OResource::loadPixmap( "datebook/weeklst", Opie::Core::OResource::SmallIcon ), |
157 | QString::null, 0, g, 0 ); | ||
145 | connect( a, SIGNAL( activated() ), this, SLOT( viewWeekLst() ) ); | 158 | connect( a, SIGNAL( activated() ), this, SLOT( viewWeekLst() ) ); |
146 | a->addTo( sub_bar ); | 159 | a->addTo( sub_bar ); |
147 | // a->addTo( view ); | 160 | // a->addTo( view ); |
148 | a->setToggleAction( TRUE ); | 161 | a->setToggleAction( TRUE ); |
149 | weekLstAction = a; | 162 | weekLstAction = a; |
150 | 163 | ||
151 | a = new QAction( tr( "Month" ), Resource::loadPixmap( "month" ), QString::null, 0, g, 0 ); | 164 | a = new QAction( tr( "Month" ), Opie::Core::OResource::loadPixmap( "month", Opie::Core::OResource::SmallIcon ), |
165 | QString::null, 0, g, 0 ); | ||
152 | connect( a, SIGNAL( activated() ), this, SLOT( viewMonth() ) ); | 166 | connect( a, SIGNAL( activated() ), this, SLOT( viewMonth() ) ); |
153 | a->addTo( sub_bar ); | 167 | a->addTo( sub_bar ); |
154 | // a->addTo( view ); | 168 | // a->addTo( view ); |
155 | a->setToggleAction( TRUE ); | 169 | a->setToggleAction( TRUE ); |
156 | monthAction = a; | 170 | monthAction = a; |
157 | 171 | ||
158 | sub_bar->addSeparator(); | 172 | sub_bar->addSeparator(); |
159 | 173 | ||
160 | a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ), QString::null, 0, this, 0 ); | 174 | a = new QAction( tr( "Find" ), Opie::Core::OResource::loadPixmap( "mag", Opie::Core::OResource::SmallIcon ), |
175 | QString::null, 0, this, 0 ); | ||
161 | connect( a, SIGNAL(activated()), this, SLOT(slotFind()) ); | 176 | connect( a, SIGNAL(activated()), this, SLOT(slotFind()) ); |
162 | a->addTo( sub_bar ); | 177 | a->addTo( sub_bar ); |
163 | 178 | ||
164 | a = new QAction( tr( "Edit..." ), Resource::loadPixmap("SettingsIcon"), QString::null, 0, this, 0 ); | 179 | a = new QAction( tr( "Edit..." ), Opie::Core::OResource::loadPixmap( "SettingsIcon", Opie::Core::OResource::SmallIcon ), |
180 | QString::null, 0, this, 0 ); | ||
165 | connect( a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); | 181 | connect( a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); |
166 | a->addTo( sub_bar ); | 182 | a->addTo( sub_bar ); |
167 | 183 | ||
168 | if(defaultView==DAY) viewDay(); | 184 | if(defaultView==DAY) viewDay(); |
169 | if(defaultView==WEEK) needEvilHack=true; // viewWeek(); | 185 | if(defaultView==WEEK) needEvilHack=true; // viewWeek(); |
170 | if(defaultView==WEEKLST) viewWeekLst(); | 186 | if(defaultView==WEEKLST) viewWeekLst(); |
171 | if(defaultView==MONTH) viewMonth(); | 187 | if(defaultView==MONTH) viewMonth(); |
172 | 188 | ||
173 | connect( qApp, SIGNAL(clockChanged(bool)), this, SLOT(changeClock(bool)) ); | 189 | connect( qApp, SIGNAL(clockChanged(bool)), this, SLOT(changeClock(bool)) ); |
174 | connect( qApp, SIGNAL(weekChanged(bool)), this, SLOT(changeWeek(bool)) ); | 190 | connect( qApp, SIGNAL(weekChanged(bool)), this, SLOT(changeWeek(bool)) ); |
175 | 191 | ||
176 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 192 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
177 | connect( qApp, SIGNAL(appMessage(const QCString&,const QByteArray&)), this, SLOT(appMessage(const QCString&,const QByteArray&)) ); | 193 | connect( qApp, SIGNAL(appMessage(const QCString&,const QByteArray&)), this, SLOT(appMessage(const QCString&,const QByteArray&)) ); |
178 | #endif | 194 | #endif |
179 | 195 | ||
180 | // listen on QPE/System | 196 | // listen on QPE/System |
181 | #if defined(Q_WS_QWS) | 197 | #if defined(Q_WS_QWS) |
182 | #if !defined(QT_NO_COP) | 198 | #if !defined(QT_NO_COP) |
183 | QCopChannel *channel = new QCopChannel( "QPE/System", this ); | 199 | QCopChannel *channel = new QCopChannel( "QPE/System", this ); |
184 | connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), this, SLOT(receive(const QCString&,const QByteArray&)) ); | 200 | connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), this, SLOT(receive(const QCString&,const QByteArray&)) ); |
185 | channel = new QCopChannel( "QPE/Datebook", this ); | 201 | channel = new QCopChannel( "QPE/Datebook", this ); |
186 | connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), this, SLOT(receive(const QCString&,const QByteArray&)) ); | 202 | connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), this, SLOT(receive(const QCString&,const QByteArray&)) ); |
187 | #endif | 203 | #endif |
188 | #endif | 204 | #endif |
189 | 205 | ||
190 | odebug << "done t=" << t.elapsed() << oendl; | 206 | odebug << "done t=" << t.elapsed() << oendl; |
191 | 207 | ||
192 | connect( qApp, SIGNAL( flush() ), this, SLOT( flush() ) ); | 208 | connect( qApp, SIGNAL( flush() ), this, SLOT( flush() ) ); |
193 | connect( qApp, SIGNAL( reload()), this, SLOT( reload() ) ); | 209 | connect( qApp, SIGNAL( reload()), this, SLOT( reload() ) ); |
194 | /* | 210 | /* |
195 | * Here is a problem description: | 211 | * Here is a problem description: |
196 | * When Weekview is the default view | 212 | * When Weekview is the default view |
197 | * a DateBookWeekView get's created | 213 | * a DateBookWeekView get's created |
198 | * redraw() get's called. So what? | 214 | * redraw() get's called. So what? |
199 | * Remember that we're still in the c'tor | 215 | * Remember that we're still in the c'tor |
200 | * and no final layout has happened? Ok | 216 | * and no final layout has happened? Ok |
201 | * now all Events get arranged. Their x | 217 | * now all Events get arranged. Their x |
202 | * position get's determined by a QHeader | 218 | * position get's determined by a QHeader |
203 | * position. But the QHeader isn't layouted or | 219 | * position. But the QHeader isn't layouted or |
204 | * at the right position. redraw() is a slot | 220 | * at the right position. redraw() is a slot |
205 | * so we'll call it then via a singleShot | 221 | * so we'll call it then via a singleShot |
206 | * from view() | 222 | * from view() |
207 | */ | 223 | */ |
208 | if( needEvilHack ){ | 224 | if( needEvilHack ){ |
209 | QTimer::singleShot( 500, this, SLOT(viewWeek()) ); | 225 | QTimer::singleShot( 500, this, SLOT(viewWeek()) ); |
210 | } | 226 | } |
211 | } | 227 | } |
212 | 228 | ||
213 | void DateBook::receive( const QCString &msg, const QByteArray &data ) | 229 | void DateBook::receive( const QCString &msg, const QByteArray &data ) |
214 | { | 230 | { |
215 | QDataStream stream( data, IO_ReadOnly ); | 231 | QDataStream stream( data, IO_ReadOnly ); |
216 | if ( msg == "timeChange(QString)" ) { | 232 | if ( msg == "timeChange(QString)" ) { |
217 | // update active view! | 233 | // update active view! |
218 | if ( dayAction->isOn() ) | 234 | if ( dayAction->isOn() ) |
219 | viewDay(); | 235 | viewDay(); |
220 | else if ( weekAction->isOn() ) | 236 | else if ( weekAction->isOn() ) |
221 | viewWeek(); | 237 | viewWeek(); |
222 | else if ( monthAction->isOn() ) | 238 | else if ( monthAction->isOn() ) |
223 | viewMonth(); | 239 | viewMonth(); |
224 | } | 240 | } |
225 | else if (msg == "editEvent(int)") { | 241 | else if (msg == "editEvent(int)") { |
226 | int uid; | 242 | int uid; |
227 | stream >> uid; | 243 | stream >> uid; |
228 | Event e=db->eventByUID(uid); | 244 | Event e=db->eventByUID(uid); |
diff --git a/core/pim/datebook/datebook.h b/core/pim/datebook/datebook.h index 05ab781..c12f5c4 100644 --- a/core/pim/datebook/datebook.h +++ b/core/pim/datebook/datebook.h | |||
@@ -1,83 +1,94 @@ | |||
1 | /********************************************************************** | 1 | /* |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | This file is part of the Opie Project |
3 | ** | 3 | |
4 | ** This file is part of Qtopia Environment. | 4 | Copyright (C) Opie Team <opie-devel@handhelds.org> |
5 | ** | 5 | =. |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | .=l. |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | .>+-= |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | _;:, .> :=|. This program is free software; you can |
9 | ** packaging of this file. | 9 | .> <`_, > . <= redistribute it and/or modify it under |
10 | ** | 10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | .="- .-=="i, .._ License as published by the Free Software |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | - . .-<_> .<> Foundation; either version 2 of the License, |
13 | ** | 13 | ._= =} : or (at your option) any later version. |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | .%`+i> _;_. |
15 | ** | 15 | .i_,=:_. -<s. This program is distributed in the hope that |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
17 | ** not clear to you. | 17 | : .. .:, . . . without even the implied warranty of |
18 | ** | 18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | **********************************************************************/ | 19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= = ; Library General Public License for more | ||
21 | ++= -. .` .: details. | ||
22 | : = ...= . :.=- | ||
23 | -. .:....=;==+<; You should have received a copy of the GNU | ||
24 | -_. . . )=. = Library General Public License along with | ||
25 | -- :-=` this library; see the file COPYING.LIB. | ||
26 | If not, write to the Free Software Foundation, | ||
27 | Inc., 59 Temple Place - Suite 330, | ||
28 | Boston, MA 02111-1307, USA. | ||
29 | */ | ||
30 | |||
20 | #ifndef DATEBOOK_H | 31 | #ifndef DATEBOOK_H |
21 | #define DATEBOOK_H | 32 | #define DATEBOOK_H |
22 | 33 | ||
23 | #include "datebooktypes.h" | 34 | #include "datebooktypes.h" |
24 | 35 | ||
25 | #include <qpe/datebookdb.h> | 36 | #include <qpe/datebookdb.h> |
26 | 37 | ||
27 | #include <qmainwindow.h> | 38 | #include <qmainwindow.h> |
28 | 39 | ||
29 | class QAction; | 40 | class QAction; |
30 | class QWidgetStack; | 41 | class QWidgetStack; |
31 | class DateBookDay; | 42 | class DateBookDay; |
32 | class DateBookWeek; | 43 | class DateBookWeek; |
33 | class DateBookWeekLst; | 44 | class DateBookWeekLst; |
34 | class ODateBookMonth; | 45 | class ODateBookMonth; |
35 | class Event; | 46 | class Event; |
36 | class QDate; | 47 | class QDate; |
37 | class Ir; | 48 | class Ir; |
38 | 49 | ||
39 | class DateBook : public QMainWindow | 50 | class DateBook : public QMainWindow |
40 | { | 51 | { |
41 | Q_OBJECT | 52 | Q_OBJECT |
42 | 53 | ||
43 | public: | 54 | public: |
44 | static QString appName() { return QString::fromLatin1("datebook"); } | 55 | static QString appName() { return QString::fromLatin1("datebook"); } |
45 | DateBook( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); | 56 | DateBook( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); |
46 | ~DateBook(); | 57 | ~DateBook(); |
47 | 58 | ||
48 | signals: | 59 | signals: |
49 | void newEvent(); | 60 | void newEvent(); |
50 | void signalNotFound(); | 61 | void signalNotFound(); |
51 | void signalWrapAround(); | 62 | void signalWrapAround(); |
52 | 63 | ||
53 | protected: | 64 | protected: |
54 | QDate currentDate(); | 65 | QDate currentDate(); |
55 | void timerEvent( QTimerEvent *e ); | 66 | void timerEvent( QTimerEvent *e ); |
56 | void closeEvent( QCloseEvent *e ); | 67 | void closeEvent( QCloseEvent *e ); |
57 | 68 | ||
58 | void view(int v, const QDate &d); | 69 | void view(int v, const QDate &d); |
59 | 70 | ||
60 | public slots: | 71 | public slots: |
61 | void flush(); | 72 | void flush(); |
62 | void reload(); | 73 | void reload(); |
63 | 74 | ||
64 | private slots: | 75 | private slots: |
65 | void fileNew(); | 76 | void fileNew(); |
66 | void slotNewEntry(const QDateTime &start, const QDateTime &end, const QString &str, const QString &location=0); | 77 | void slotNewEntry(const QDateTime &start, const QDateTime &end, const QString &str, const QString &location=0); |
67 | void slotSettings(); | 78 | void slotSettings(); |
68 | void slotToday(); // view today | 79 | void slotToday(); // view today |
69 | void changeClock( bool newClock ); | 80 | void changeClock( bool newClock ); |
70 | void changeWeek( bool newDay ); | 81 | void changeWeek( bool newDay ); |
71 | void appMessage(const QCString& msg, const QByteArray& data); | 82 | void appMessage(const QCString& msg, const QByteArray& data); |
72 | // handle key events in the day view... | 83 | // handle key events in the day view... |
73 | void slotNewEventFromKey( const QString &str ); | 84 | void slotNewEventFromKey( const QString &str ); |
74 | void slotFind(); | 85 | void slotFind(); |
75 | void slotDoFind( const QString &, const QDate &, bool, bool, int ); | 86 | void slotDoFind( const QString &, const QDate &, bool, bool, int ); |
76 | 87 | ||
77 | void viewDefault(const QDate &d); | 88 | void viewDefault(const QDate &d); |
78 | 89 | ||
79 | void viewDay(); | 90 | void viewDay(); |
80 | void viewWeek(); | 91 | void viewWeek(); |
81 | void viewWeekLst(); | 92 | void viewWeekLst(); |
82 | void viewMonth(); | 93 | void viewMonth(); |
83 | 94 | ||
diff --git a/core/pim/datebook/datebookday.cpp b/core/pim/datebook/datebookday.cpp index 26f0303..b8385aa 100644 --- a/core/pim/datebook/datebookday.cpp +++ b/core/pim/datebook/datebookday.cpp | |||
@@ -1,93 +1,105 @@ | |||
1 | /********************************************************************** | 1 | /* |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | This file is part of the Opie Project |
3 | ** | 3 | |
4 | ** This file is part of Qtopia Environment. | 4 | Copyright (C) Opie Team <opie-devel@handhelds.org> |
5 | ** | 5 | =. |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | .=l. |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | .>+-= |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | _;:, .> :=|. This program is free software; you can |
9 | ** packaging of this file. | 9 | .> <`_, > . <= redistribute it and/or modify it under |
10 | ** | 10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | .="- .-=="i, .._ License as published by the Free Software |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | - . .-<_> .<> Foundation; either version 2 of the License, |
13 | ** | 13 | ._= =} : or (at your option) any later version. |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | .%`+i> _;_. |
15 | ** | 15 | .i_,=:_. -<s. This program is distributed in the hope that |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
17 | ** not clear to you. | 17 | : .. .:, . . . without even the implied warranty of |
18 | ** | 18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | **********************************************************************/ | 19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= = ; Library General Public License for more | ||
21 | ++= -. .` .: details. | ||
22 | : = ...= . :.=- | ||
23 | -. .:....=;==+<; You should have received a copy of the GNU | ||
24 | -_. . . )=. = Library General Public License along with | ||
25 | -- :-=` this library; see the file COPYING.LIB. | ||
26 | If not, write to the Free Software Foundation, | ||
27 | Inc., 59 Temple Place - Suite 330, | ||
28 | Boston, MA 02111-1307, USA. | ||
29 | */ | ||
20 | 30 | ||
21 | #include "datebookday.h" | 31 | #include "datebookday.h" |
22 | #include "datebooktypes.h" | 32 | #include "datebooktypes.h" |
23 | #include "datebookdayheaderimpl.h" | 33 | #include "datebookdayheaderimpl.h" |
24 | #include "datebookdayallday.h" | 34 | #include "datebookdayallday.h" |
25 | 35 | ||
26 | #include <opie2/oholidayplugin.h> | 36 | #include <opie2/oholidayplugin.h> |
27 | #include <qpe/resource.h> | 37 | #include <opie2/oresource.h> |
28 | #include <qpe/qpeapplication.h> | 38 | |
39 | #include <qpe/applnk.h> | ||
29 | #include <qpe/ir.h> | 40 | #include <qpe/ir.h> |
41 | #include <qpe/qpeapplication.h> | ||
30 | 42 | ||
31 | #include <qsimplerichtext.h> | 43 | #include <qsimplerichtext.h> |
32 | #include <qpopupmenu.h> | 44 | #include <qpopupmenu.h> |
33 | 45 | ||
34 | 46 | ||
35 | #include <qtimer.h> | 47 | #include <qtimer.h> |
36 | 48 | ||
37 | DateBookDayView::DateBookDayView( bool whichClock, QWidget *parent, const char *name ) | 49 | DateBookDayView::DateBookDayView( bool whichClock, QWidget *parent, const char *name ) |
38 | : QTable( 24, 1, parent, name ), ampm( whichClock ), currDate( QDate::currentDate() ) | 50 | : QTable( 24, 1, parent, name ), ampm( whichClock ), currDate( QDate::currentDate() ) |
39 | { | 51 | { |
40 | enableClipper(TRUE); | 52 | enableClipper(TRUE); |
41 | setTopMargin( 0 ); | 53 | setTopMargin( 0 ); |
42 | horizontalHeader()->hide(); | 54 | horizontalHeader()->hide(); |
43 | setLeftMargin(38); | 55 | setLeftMargin(38); |
44 | setColumnStretchable( 0, TRUE ); | 56 | setColumnStretchable( 0, TRUE ); |
45 | setHScrollBarMode( QScrollView::AlwaysOff ); | 57 | setHScrollBarMode( QScrollView::AlwaysOff ); |
46 | verticalHeader()->setPalette(white); | 58 | verticalHeader()->setPalette(white); |
47 | verticalHeader()->setResizeEnabled(FALSE); | 59 | verticalHeader()->setResizeEnabled(FALSE); |
48 | setSelectionMode( Single ); | 60 | setSelectionMode( Single ); |
49 | 61 | ||
50 | // get rid of being able to edit things... | 62 | // get rid of being able to edit things... |
51 | QTableItem *tmp; | 63 | QTableItem *tmp; |
52 | int row; | 64 | int row; |
53 | for ( row = 0; row < numRows(); row++ ) { | 65 | for ( row = 0; row < numRows(); row++ ) { |
54 | tmp = new QTableItem( this, QTableItem::Never, QString::null); | 66 | tmp = new QTableItem( this, QTableItem::Never, QString::null); |
55 | setItem( row, 0, tmp ); | 67 | setItem( row, 0, tmp ); |
56 | //setRowHeight( row, 40); | 68 | //setRowHeight( row, 40); |
57 | } | 69 | } |
58 | 70 | ||
59 | initHeader(); | 71 | initHeader(); |
60 | QObject::connect( qApp, SIGNAL(clockChanged(bool)), this, SLOT(slotChangeClock(bool)) ); | 72 | QObject::connect( qApp, SIGNAL(clockChanged(bool)), this, SLOT(slotChangeClock(bool)) ); |
61 | } | 73 | } |
62 | 74 | ||
63 | void DateBookDayView::initHeader() | 75 | void DateBookDayView::initHeader() |
64 | { | 76 | { |
65 | QString strTmp; | 77 | QString strTmp; |
66 | int preferredWidth = 0; | 78 | int preferredWidth = 0; |
67 | for ( int i = 0; i < 24; ++i ) { | 79 | for ( int i = 0; i < 24; ++i ) { |
68 | if ( ampm ) { | 80 | if ( ampm ) { |
69 | if ( i == 0 ) | 81 | if ( i == 0 ) |
70 | strTmp = QString::number(12) + ":00"; | 82 | strTmp = QString::number(12) + ":00"; |
71 | else if ( i == 12 ) | 83 | else if ( i == 12 ) |
72 | strTmp = QString::number(12) + tr(":00p"); | 84 | strTmp = QString::number(12) + tr(":00p"); |
73 | else if ( i > 12 ) | 85 | else if ( i > 12 ) |
74 | strTmp = QString::number( i - 12 ) + tr(":00p"); | 86 | strTmp = QString::number( i - 12 ) + tr(":00p"); |
75 | else | 87 | else |
76 | strTmp = QString::number(i) + ":00"; | 88 | strTmp = QString::number(i) + ":00"; |
77 | } else { | 89 | } else { |
78 | if ( i < 10 ) | 90 | if ( i < 10 ) |
79 | strTmp = "0" + QString::number(i) + ":00"; | 91 | strTmp = "0" + QString::number(i) + ":00"; |
80 | else | 92 | else |
81 | strTmp = QString::number(i) + ":00"; | 93 | strTmp = QString::number(i) + ":00"; |
82 | } | 94 | } |
83 | strTmp = strTmp.rightJustify( 6, ' ' ); | 95 | strTmp = strTmp.rightJustify( 6, ' ' ); |
84 | verticalHeader()->setLabel( i, strTmp ); | 96 | verticalHeader()->setLabel( i, strTmp ); |
85 | 97 | ||
86 | // Compute correct width for current Font (Add some space right) | 98 | // Compute correct width for current Font (Add some space right) |
87 | int actWidth = QFontMetrics( QFont::defaultFont() ).width( strTmp + QString(" ") ); | 99 | int actWidth = QFontMetrics( QFont::defaultFont() ).width( strTmp + QString(" ") ); |
88 | if ( preferredWidth < actWidth ) | 100 | if ( preferredWidth < actWidth ) |
89 | preferredWidth = actWidth; | 101 | preferredWidth = actWidth; |
90 | setRowStretchable( i, FALSE ); | 102 | setRowStretchable( i, FALSE ); |
91 | } | 103 | } |
92 | 104 | ||
93 | // It seems as if the header has a bug. It does not resize | 105 | // It seems as if the header has a bug. It does not resize |
@@ -696,137 +708,139 @@ DateBookDayWidget::DateBookDayWidget( const EffectiveEvent &e, DateBookDay *db ) | |||
696 | geom.setHeight( h ); | 708 | geom.setHeight( h ); |
697 | geom.setX( 0 ); | 709 | geom.setX( 0 ); |
698 | geom.setWidth(dateBook->dayView()->columnWidth(0)-1); | 710 | geom.setWidth(dateBook->dayView()->columnWidth(0)-1); |
699 | 711 | ||
700 | } | 712 | } |
701 | 713 | ||
702 | void DateBookDayWidget::setAllDayText( QString &text ) { | 714 | void DateBookDayWidget::setAllDayText( QString &text ) { |
703 | text += "<b>" + tr("This is an all day event.") + "</b>"; | 715 | text += "<b>" + tr("This is an all day event.") + "</b>"; |
704 | } | 716 | } |
705 | 717 | ||
706 | void DateBookDayWidget::setEventText( QString& text ) { | 718 | void DateBookDayWidget::setEventText( QString& text ) { |
707 | bool whichClock = dateBook->dayView()->whichClock(); | 719 | bool whichClock = dateBook->dayView()->whichClock(); |
708 | if ( ev.startDate() != ev.endDate() ) { | 720 | if ( ev.startDate() != ev.endDate() ) { |
709 | text += "<b>" + tr("Start") + "</b>: "; | 721 | text += "<b>" + tr("Start") + "</b>: "; |
710 | text += TimeString::timeString( ev.event().start().time(), whichClock, FALSE ); | 722 | text += TimeString::timeString( ev.event().start().time(), whichClock, FALSE ); |
711 | text += " - " + TimeString::longDateString( ev.startDate() ) + "<br>"; | 723 | text += " - " + TimeString::longDateString( ev.startDate() ) + "<br>"; |
712 | text += "<b>" + tr("End") + "</b>: "; | 724 | text += "<b>" + tr("End") + "</b>: "; |
713 | text += TimeString::timeString( ev.event().end().time(), whichClock, FALSE ); | 725 | text += TimeString::timeString( ev.event().end().time(), whichClock, FALSE ); |
714 | text += " - " + TimeString::longDateString( ev.endDate() ); | 726 | text += " - " + TimeString::longDateString( ev.endDate() ); |
715 | } else { | 727 | } else { |
716 | text += "<b>" + tr("Time") + "</b>: "; | 728 | text += "<b>" + tr("Time") + "</b>: "; |
717 | text += TimeString::timeString( ev.start(), whichClock, FALSE ); | 729 | text += TimeString::timeString( ev.start(), whichClock, FALSE ); |
718 | text += "<b>" + tr(" - ") + "</b>"; | 730 | text += "<b>" + tr(" - ") + "</b>"; |
719 | text += TimeString::timeString( ev.end(), whichClock, FALSE ); | 731 | text += TimeString::timeString( ev.end(), whichClock, FALSE ); |
720 | } | 732 | } |
721 | } | 733 | } |
722 | 734 | ||
723 | DateBookDayWidget::~DateBookDayWidget() | 735 | DateBookDayWidget::~DateBookDayWidget() |
724 | { | 736 | { |
725 | } | 737 | } |
726 | 738 | ||
727 | void DateBookDayWidget::paintEvent( QPaintEvent *e ) | 739 | void DateBookDayWidget::paintEvent( QPaintEvent *e ) |
728 | { | 740 | { |
729 | QPainter p( this ); | 741 | QPainter p( this ); |
730 | 742 | ||
731 | if (dateBook->getSelectedWidget() == this) { | 743 | if (dateBook->getSelectedWidget() == this) { |
732 | p.setBrush( QColor( 155, 240, 230 ) ); // selected item | 744 | p.setBrush( QColor( 155, 240, 230 ) ); // selected item |
733 | } else { | 745 | } else { |
734 | if (dateBook->date() == QDate::currentDate()) { | 746 | if (dateBook->date() == QDate::currentDate()) { |
735 | QTime curTime = QTime::currentTime(); | 747 | QTime curTime = QTime::currentTime(); |
736 | if (ev.end() < curTime) { | 748 | if (ev.end() < curTime) { |
737 | p.setBrush( QColor( 180, 180, 180 ) ); // grey, inactive | 749 | p.setBrush( QColor( 180, 180, 180 ) ); // grey, inactive |
738 | } else { | 750 | } else { |
739 | //change color in dependence of the time till the event starts | 751 | //change color in dependence of the time till the event starts |
740 | int duration = curTime.secsTo(ev.start()); | 752 | int duration = curTime.secsTo(ev.start()); |
741 | if (duration < 0) duration = 0; | 753 | if (duration < 0) duration = 0; |
742 | int colChange = duration*160/86400; //86400: secs per day, 160: max color shift | 754 | int colChange = duration*160/86400; //86400: secs per day, 160: max color shift |
743 | p.setBrush( QColor( 200-colChange, 200-colChange, 255 ) ); //blue | 755 | p.setBrush( QColor( 200-colChange, 200-colChange, 255 ) ); //blue |
744 | } | 756 | } |
745 | } else { | 757 | } else { |
746 | p.setBrush( QColor( 220, 220, 220 ) ); //light grey, inactive (not current date) | 758 | p.setBrush( QColor( 220, 220, 220 ) ); //light grey, inactive (not current date) |
747 | //perhaps make a distinction between future/past dates | 759 | //perhaps make a distinction between future/past dates |
748 | } | 760 | } |
749 | } | 761 | } |
750 | 762 | ||
751 | p.setPen( QColor(100, 100, 100) ); | 763 | p.setPen( QColor(100, 100, 100) ); |
752 | p.drawRect(rect()); | 764 | p.drawRect(rect()); |
753 | 765 | ||
754 | // p.drawRect(0,0, 5, height()); | 766 | // p.drawRect(0,0, 5, height()); |
755 | 767 | ||
756 | int y = 0; | 768 | int y = 0; |
757 | int d = 0; | 769 | int d = 0; |
758 | 770 | ||
759 | if ( ev.event().hasAlarm() ) { | 771 | if ( ev.event().hasAlarm() ) { |
760 | p.drawPixmap( width() - 16, 0, Resource::loadPixmap( "bell" ) ); | 772 | p.drawPixmap( width() - AppLnk::smallIconSize(), 0, |
761 | y = 20; | 773 | Opie::Core::OResource::loadPixmap( "bell", Opie::Core::OResource::SmallIcon ) ); |
774 | y = AppLnk::smallIconSize() + 2; | ||
762 | d = 20; | 775 | d = 20; |
763 | } | 776 | } |
764 | 777 | ||
765 | if ( ev.event().hasRepeat() ) { | 778 | if ( ev.event().hasRepeat() ) { |
766 | p.drawPixmap( width() - 16, y, Resource::loadPixmap( "repeat" ) ); | 779 | p.drawPixmap( width() - AppLnk::smallIconSize(), y, |
780 | Opie::Core::OResource::loadPixmap( "repeat", Opie::Core::OResource::SmallIcon ) ); | ||
767 | d = 20; | 781 | d = 20; |
768 | y += 20; | 782 | y += AppLnk::smallIconSize() + 2; |
769 | } | 783 | } |
770 | 784 | ||
771 | QSimpleRichText rt( text, font() ); | 785 | QSimpleRichText rt( text, font() ); |
772 | rt.setWidth( geom.width() - d - 6 ); | 786 | rt.setWidth( geom.width() - d - 6 ); |
773 | rt.draw( &p, 7, 0, e->region(), colorGroup() ); | 787 | rt.draw( &p, 7, 0, e->region(), colorGroup() ); |
774 | } | 788 | } |
775 | 789 | ||
776 | /* | 790 | /* |
777 | * we need to find the real start date for a uid | 791 | * we need to find the real start date for a uid |
778 | * we need to check from one day to another... | 792 | * we need to check from one day to another... |
779 | */ | 793 | */ |
780 | QDate DateBookDay::findRealStart( int uid, const QDate& isIncluded , DateBookDB* db) { | 794 | QDate DateBookDay::findRealStart( int uid, const QDate& isIncluded , DateBookDB* db) { |
781 | QDate dt( isIncluded ); | 795 | QDate dt( isIncluded ); |
782 | QDate fnd = dt; | 796 | QDate fnd = dt; |
783 | 797 | ||
784 | bool doAgain = true; | 798 | bool doAgain = true; |
785 | do{ | 799 | do{ |
786 | dt = dt.addDays( -1 ); | 800 | dt = dt.addDays( -1 ); |
787 | QValueList<EffectiveEvent> events = db->getEffectiveEvents( dt, dt ); | 801 | QValueList<EffectiveEvent> events = db->getEffectiveEvents( dt, dt ); |
788 | for (QValueList<EffectiveEvent>::Iterator it = events.begin(); it != events.end(); ++it ) { | 802 | for (QValueList<EffectiveEvent>::Iterator it = events.begin(); it != events.end(); ++it ) { |
789 | EffectiveEvent ev = (*it); | 803 | EffectiveEvent ev = (*it); |
790 | if ( uid == ev.event().uid() && ev.start() != QTime(0, 0, 0 ) ) | 804 | if ( uid == ev.event().uid() && ev.start() != QTime(0, 0, 0 ) ) |
791 | return ev.date(); | 805 | return ev.date(); |
792 | } | 806 | } |
793 | }while (doAgain ); | 807 | }while (doAgain ); |
794 | 808 | ||
795 | return fnd; | 809 | return fnd; |
796 | } | 810 | } |
797 | 811 | ||
798 | void DateBookDayWidget::mousePressEvent( QMouseEvent *e ) | 812 | void DateBookDayWidget::mousePressEvent( QMouseEvent *e ) |
799 | { | 813 | { |
800 | DateBookDayWidget *item; | 814 | DateBookDayWidget *item; |
801 | 815 | ||
802 | item = dateBook->getSelectedWidget(); | 816 | item = dateBook->getSelectedWidget(); |
803 | if (item) | 817 | if (item) |
804 | item->update(); | 818 | item->update(); |
805 | 819 | ||
806 | dateBook->setSelectedWidget(this); | 820 | dateBook->setSelectedWidget(this); |
807 | update(); | 821 | update(); |
808 | dateBook->repaint(); | 822 | dateBook->repaint(); |
809 | 823 | ||
810 | Event eve = ev.event(); | 824 | Event eve = ev.event(); |
811 | 825 | ||
812 | QPopupMenu m; | 826 | QPopupMenu m; |
813 | m.insertItem( tr( "Edit" ), 1 ); | 827 | m.insertItem( tr( "Edit" ), 1 ); |
814 | m.insertItem( tr( "Duplicate" ), 4 ); | 828 | m.insertItem( tr( "Duplicate" ), 4 ); |
815 | m.insertItem( tr( "Delete" ), 2 ); | 829 | m.insertItem( tr( "Delete" ), 2 ); |
816 | if(Ir::supported()) m.insertItem( tr( "Beam" ), 3 ); | 830 | if(Ir::supported()) m.insertItem( tr( "Beam" ), 3 ); |
817 | if(Ir::supported() && ev.event().doRepeat() ) m.insertItem( tr( "Beam this occurence"), 5 ); | 831 | if(Ir::supported() && ev.event().doRepeat() ) m.insertItem( tr( "Beam this occurence"), 5 ); |
818 | int r = m.exec( e->globalPos() ); | 832 | int r = m.exec( e->globalPos() ); |
819 | if ( r == 1 ) { | 833 | if ( r == 1 ) { |
820 | emit editMe( eve ); | 834 | emit editMe( eve ); |
821 | } else if ( r == 2 ) { | 835 | } else if ( r == 2 ) { |
822 | emit deleteMe( eve ); | 836 | emit deleteMe( eve ); |
823 | } else if ( r == 3 ) { | 837 | } else if ( r == 3 ) { |
824 | emit beamMe( eve ); | 838 | emit beamMe( eve ); |
825 | } else if ( r == 4 ) { | 839 | } else if ( r == 4 ) { |
826 | emit duplicateMe( eve ); | 840 | emit duplicateMe( eve ); |
827 | } else if ( r == 5 ) { | 841 | } else if ( r == 5 ) { |
828 | // create an Event and beam it... | 842 | // create an Event and beam it... |
829 | /* | 843 | /* |
830 | * Start with the easy stuff. If start and end date is the same we can just use | 844 | * Start with the easy stuff. If start and end date is the same we can just use |
831 | * the values of effective events | 845 | * the values of effective events |
832 | * If it is a multi day event we need to find the real start and end date... | 846 | * If it is a multi day event we need to find the real start and end date... |
diff --git a/core/pim/datebook/datebookday.h b/core/pim/datebook/datebookday.h index 3b75eba..82021af 100644 --- a/core/pim/datebook/datebookday.h +++ b/core/pim/datebook/datebookday.h | |||
@@ -1,83 +1,94 @@ | |||
1 | /********************************************************************** | 1 | /* |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | This file is part of the Opie Project |
3 | ** | 3 | |
4 | ** This file is part of Qtopia Environment. | 4 | Copyright (C) Opie Team <opie-devel@handhelds.org> |
5 | ** | 5 | =. |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | .=l. |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | .>+-= |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | _;:, .> :=|. This program is free software; you can |
9 | ** packaging of this file. | 9 | .> <`_, > . <= redistribute it and/or modify it under |
10 | ** | 10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | .="- .-=="i, .._ License as published by the Free Software |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | - . .-<_> .<> Foundation; either version 2 of the License, |
13 | ** | 13 | ._= =} : or (at your option) any later version. |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | .%`+i> _;_. |
15 | ** | 15 | .i_,=:_. -<s. This program is distributed in the hope that |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
17 | ** not clear to you. | 17 | : .. .:, . . . without even the implied warranty of |
18 | ** | 18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | **********************************************************************/ | 19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= = ; Library General Public License for more | ||
21 | ++= -. .` .: details. | ||
22 | : = ...= . :.=- | ||
23 | -. .:....=;==+<; You should have received a copy of the GNU | ||
24 | -_. . . )=. = Library General Public License along with | ||
25 | -- :-=` this library; see the file COPYING.LIB. | ||
26 | If not, write to the Free Software Foundation, | ||
27 | Inc., 59 Temple Place - Suite 330, | ||
28 | Boston, MA 02111-1307, USA. | ||
29 | */ | ||
30 | |||
20 | #ifndef DATEBOOKDAY_H | 31 | #ifndef DATEBOOKDAY_H |
21 | #define DATEBOOKDAY_H | 32 | #define DATEBOOKDAY_H |
22 | 33 | ||
23 | #include <qpe/event.h> | 34 | #include <qpe/event.h> |
24 | 35 | ||
25 | #include <qdatetime.h> | 36 | #include <qdatetime.h> |
26 | #include <qtable.h> | 37 | #include <qtable.h> |
27 | #include <qvbox.h> | 38 | #include <qvbox.h> |
28 | #include <qlist.h> | 39 | #include <qlist.h> |
29 | 40 | ||
30 | #include "datebook.h" | 41 | #include "datebook.h" |
31 | #include "datebooktypes.h" | 42 | #include "datebooktypes.h" |
32 | #include <qlineedit.h> | 43 | #include <qlineedit.h> |
33 | 44 | ||
34 | class DateBookDayHeader; | 45 | class DateBookDayHeader; |
35 | class DateBookDB; | 46 | class DateBookDB; |
36 | class DateBookDBHoliday; | 47 | class DateBookDBHoliday; |
37 | class DatebookdayAllday; | 48 | class DatebookdayAllday; |
38 | class QDateTime; | 49 | class QDateTime; |
39 | class QMouseEvent; | 50 | class QMouseEvent; |
40 | class QPaintEvent; | 51 | class QPaintEvent; |
41 | class QResizeEvent; | 52 | class QResizeEvent; |
42 | 53 | ||
43 | class DateBookDayViewQuickLineEdit : public QLineEdit | 54 | class DateBookDayViewQuickLineEdit : public QLineEdit |
44 | { | 55 | { |
45 | Q_OBJECT | 56 | Q_OBJECT |
46 | public: | 57 | public: |
47 | DateBookDayViewQuickLineEdit(const QDateTime &start, const QDateTime &end,QWidget * parent, const char *name=0); | 58 | DateBookDayViewQuickLineEdit(const QDateTime &start, const QDateTime &end,QWidget * parent, const char *name=0); |
48 | protected: | 59 | protected: |
49 | Event quickEvent; | 60 | Event quickEvent; |
50 | int active; | 61 | int active; |
51 | void focusOutEvent( QFocusEvent *e ); | 62 | void focusOutEvent( QFocusEvent *e ); |
52 | protected slots: | 63 | protected slots: |
53 | void slotReturnPressed(void); | 64 | void slotReturnPressed(void); |
54 | void finallyCallClose(); | 65 | void finallyCallClose(); |
55 | signals: | 66 | signals: |
56 | void insertEvent(const Event &e); | 67 | void insertEvent(const Event &e); |
57 | }; | 68 | }; |
58 | 69 | ||
59 | 70 | ||
60 | class DateBookDayView : public QTable | 71 | class DateBookDayView : public QTable |
61 | { | 72 | { |
62 | Q_OBJECT | 73 | Q_OBJECT |
63 | public: | 74 | public: |
64 | DateBookDayView( bool hourClock, QWidget *parent, const char *name ); | 75 | DateBookDayView( bool hourClock, QWidget *parent, const char *name ); |
65 | bool whichClock() const; | 76 | bool whichClock() const; |
66 | 77 | ||
67 | void setRowStyle( int style ); | 78 | void setRowStyle( int style ); |
68 | 79 | ||
69 | public slots: | 80 | public slots: |
70 | void moveUp(); | 81 | void moveUp(); |
71 | void moveDown(); | 82 | void moveDown(); |
72 | void slotDateChanged( int year, int month, int day ); | 83 | void slotDateChanged( int year, int month, int day ); |
73 | 84 | ||
74 | signals: | 85 | signals: |
75 | void sigColWidthChanged(); | 86 | void sigColWidthChanged(); |
76 | void sigCapturedKey( const QString &txt ); | 87 | void sigCapturedKey( const QString &txt ); |
77 | protected slots: | 88 | protected slots: |
78 | void slotChangeClock( bool ); | 89 | void slotChangeClock( bool ); |
79 | protected: | 90 | protected: |
80 | virtual void paintCell( QPainter *p, int row, int col, const QRect &cr, bool selected ); | 91 | virtual void paintCell( QPainter *p, int row, int col, const QRect &cr, bool selected ); |
81 | virtual void paintFocus( QPainter *p, const QRect &cr ); | 92 | virtual void paintFocus( QPainter *p, const QRect &cr ); |
82 | 93 | ||
83 | virtual void resizeEvent( QResizeEvent *e ); | 94 | virtual void resizeEvent( QResizeEvent *e ); |
diff --git a/core/pim/datebook/datebookdayallday.cpp b/core/pim/datebook/datebookdayallday.cpp index 27fce44..3807542 100644 --- a/core/pim/datebook/datebookdayallday.cpp +++ b/core/pim/datebook/datebookdayallday.cpp | |||
@@ -1,72 +1,95 @@ | |||
1 | /**************************************************************************** | 1 | /* |
2 | ** GPL by Rajko Albrecht | 2 | This file is part of the Opie Project |
3 | ** | 3 | |
4 | ** | 4 | Copyright (C) Rajko Albrecht <> |
5 | ** | 5 | Copyright (C) Opie Team <opie-devel@handhelds.org> |
6 | ** | 6 | =. |
7 | ** | 7 | .=l. |
8 | ****************************************************************************/ | 8 | .>+-= |
9 | _;:, .> :=|. This program is free software; you can | ||
10 | .> <`_, > . <= redistribute it and/or modify it under | ||
11 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | ||
12 | .="- .-=="i, .._ License as published by the Free Software | ||
13 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
14 | ._= =} : or (at your option) any later version. | ||
15 | .%`+i> _;_. | ||
16 | .i_,=:_. -<s. This program is distributed in the hope that | ||
17 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
18 | : .. .:, . . . without even the implied warranty of | ||
19 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
20 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
21 | ..}^=.= = ; Library General Public License for more | ||
22 | ++= -. .` .: details. | ||
23 | : = ...= . :.=- | ||
24 | -. .:....=;==+<; You should have received a copy of the GNU | ||
25 | -_. . . )=. = Library General Public License along with | ||
26 | -- :-=` this library; see the file COPYING.LIB. | ||
27 | If not, write to the Free Software Foundation, | ||
28 | Inc., 59 Temple Place - Suite 330, | ||
29 | Boston, MA 02111-1307, USA. | ||
30 | */ | ||
31 | |||
9 | #include "datebookdayallday.h" | 32 | #include "datebookdayallday.h" |
10 | 33 | ||
11 | #include <qlayout.h> | 34 | #include <qlayout.h> |
12 | #include <qpe/ir.h> | 35 | #include <qpe/ir.h> |
13 | #include <qpopupmenu.h> | 36 | #include <qpopupmenu.h> |
14 | #include <qtimer.h> | 37 | #include <qtimer.h> |
15 | 38 | ||
16 | #include "datebookday.h" | 39 | #include "datebookday.h" |
17 | 40 | ||
18 | /* | 41 | /* |
19 | * Constructs a DatebookdayAllday which is a child of 'parent', with the | 42 | * Constructs a DatebookdayAllday which is a child of 'parent', with the |
20 | * name 'name' and widget flags set to 'f' | 43 | * name 'name' and widget flags set to 'f' |
21 | */ | 44 | */ |
22 | DatebookdayAllday::DatebookdayAllday(DateBookDB* db, QWidget* parent, const char* name, WFlags ) | 45 | DatebookdayAllday::DatebookdayAllday(DateBookDB* db, QWidget* parent, const char* name, WFlags ) |
23 | : QScrollView( parent, name ),item_count(0),dateBook(db) | 46 | : QScrollView( parent, name ),item_count(0),dateBook(db) |
24 | { | 47 | { |
25 | if ( !name ) | 48 | if ( !name ) |
26 | setName( "DatebookdayAllday" ); | 49 | setName( "DatebookdayAllday" ); |
27 | setMinimumSize( QSize( 0, 0 ) ); | 50 | setMinimumSize( QSize( 0, 0 ) ); |
28 | setMaximumHeight(3* (QFontMetrics(font()).height()+4) ); | 51 | setMaximumHeight(3* (QFontMetrics(font()).height()+4) ); |
29 | 52 | ||
30 | m_MainFrame = new QFrame(viewport()); | 53 | m_MainFrame = new QFrame(viewport()); |
31 | m_MainFrame->setFrameStyle(QFrame::NoFrame|QFrame::Plain); | 54 | m_MainFrame->setFrameStyle(QFrame::NoFrame|QFrame::Plain); |
32 | setFrameStyle(QFrame::NoFrame|QFrame::Plain); | 55 | setFrameStyle(QFrame::NoFrame|QFrame::Plain); |
33 | //setResizePolicy( QScrollView::Default ); | 56 | //setResizePolicy( QScrollView::Default ); |
34 | setResizePolicy(QScrollView::AutoOneFit); | 57 | setResizePolicy(QScrollView::AutoOneFit); |
35 | setHScrollBarMode( AlwaysOff ); | 58 | setHScrollBarMode( AlwaysOff ); |
36 | addChild(m_MainFrame); | 59 | addChild(m_MainFrame); |
37 | 60 | ||
38 | datebookdayalldayLayout = new QVBoxLayout( m_MainFrame ); | 61 | datebookdayalldayLayout = new QVBoxLayout( m_MainFrame ); |
39 | datebookdayalldayLayout->setSpacing( 0 ); | 62 | datebookdayalldayLayout->setSpacing( 0 ); |
40 | datebookdayalldayLayout->setMargin( 0 ); | 63 | datebookdayalldayLayout->setMargin( 0 ); |
41 | 64 | ||
42 | lblDesc = new DatebookEventDesc(parent->parentWidget(),""); | 65 | lblDesc = new DatebookEventDesc(parent->parentWidget(),""); |
43 | lblDesc->setBackgroundColor(Qt::yellow); | 66 | lblDesc->setBackgroundColor(Qt::yellow); |
44 | lblDesc->hide(); | 67 | lblDesc->hide(); |
45 | subWidgets.setAutoDelete(true); | 68 | subWidgets.setAutoDelete(true); |
46 | } | 69 | } |
47 | 70 | ||
48 | /* | 71 | /* |
49 | * Destroys the object and frees any allocated resources | 72 | * Destroys the object and frees any allocated resources |
50 | */ | 73 | */ |
51 | DatebookdayAllday::~DatebookdayAllday() | 74 | DatebookdayAllday::~DatebookdayAllday() |
52 | { | 75 | { |
53 | // no need to delete child widgets, Qt does it all for us | 76 | // no need to delete child widgets, Qt does it all for us |
54 | } | 77 | } |
55 | 78 | ||
56 | DatebookAlldayDisp* DatebookdayAllday::addEvent(const EffectiveEvent&ev) | 79 | DatebookAlldayDisp* DatebookdayAllday::addEvent(const EffectiveEvent&ev) |
57 | { | 80 | { |
58 | DatebookAlldayDisp * lb; | 81 | DatebookAlldayDisp * lb; |
59 | lb = new DatebookAlldayDisp(dateBook,ev,m_MainFrame,NULL); | 82 | lb = new DatebookAlldayDisp(dateBook,ev,m_MainFrame,NULL); |
60 | lb->show(); | 83 | lb->show(); |
61 | datebookdayalldayLayout->addWidget(lb); | 84 | datebookdayalldayLayout->addWidget(lb); |
62 | subWidgets.append(lb); | 85 | subWidgets.append(lb); |
63 | 86 | ||
64 | connect(lb,SIGNAL(displayMe(const Event&)),lblDesc,SLOT(disp_event(const Event&))); | 87 | connect(lb,SIGNAL(displayMe(const Event&)),lblDesc,SLOT(disp_event(const Event&))); |
65 | ++item_count; | 88 | ++item_count; |
66 | 89 | ||
67 | return lb; | 90 | return lb; |
68 | } | 91 | } |
69 | 92 | ||
70 | DatebookAlldayDisp* DatebookdayAllday::addHoliday(const QString&e) | 93 | DatebookAlldayDisp* DatebookdayAllday::addHoliday(const QString&e) |
71 | { | 94 | { |
72 | DatebookAlldayDisp * lb; | 95 | DatebookAlldayDisp * lb; |
diff --git a/core/pim/datebook/datebookdayallday.h b/core/pim/datebook/datebookdayallday.h index 4f5cffa..5395dcf 100644 --- a/core/pim/datebook/datebookdayallday.h +++ b/core/pim/datebook/datebookdayallday.h | |||
@@ -1,64 +1,95 @@ | |||
1 | /* | ||
2 | This file is part of the Opie Project | ||
3 | |||
4 | Copyright (C) Rajko Albrecht <> | ||
5 | Copyright (C) Opie Team <opie-devel@handhelds.org> | ||
6 | =. | ||
7 | .=l. | ||
8 | .>+-= | ||
9 | _;:, .> :=|. This program is free software; you can | ||
10 | .> <`_, > . <= redistribute it and/or modify it under | ||
11 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | ||
12 | .="- .-=="i, .._ License as published by the Free Software | ||
13 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
14 | ._= =} : or (at your option) any later version. | ||
15 | .%`+i> _;_. | ||
16 | .i_,=:_. -<s. This program is distributed in the hope that | ||
17 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
18 | : .. .:, . . . without even the implied warranty of | ||
19 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
20 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
21 | ..}^=.= = ; Library General Public License for more | ||
22 | ++= -. .` .: details. | ||
23 | : = ...= . :.=- | ||
24 | -. .:....=;==+<; You should have received a copy of the GNU | ||
25 | -_. . . )=. = Library General Public License along with | ||
26 | -- :-=` this library; see the file COPYING.LIB. | ||
27 | If not, write to the Free Software Foundation, | ||
28 | Inc., 59 Temple Place - Suite 330, | ||
29 | Boston, MA 02111-1307, USA. | ||
30 | */ | ||
31 | |||
1 | #ifndef DATEBOOKDAYALLDAYBASE_H | 32 | #ifndef DATEBOOKDAYALLDAYBASE_H |
2 | #define DATEBOOKDAYALLDAYBASE_H | 33 | #define DATEBOOKDAYALLDAYBASE_H |
3 | 34 | ||
4 | #include <qvariant.h> | 35 | #include <qvariant.h> |
5 | #include <qframe.h> | 36 | #include <qframe.h> |
6 | #include <qscrollview.h> | 37 | #include <qscrollview.h> |
7 | #include <qlabel.h> | 38 | #include <qlabel.h> |
8 | #include <qlist.h> | 39 | #include <qlist.h> |
9 | #include <qpe/event.h> | 40 | #include <qpe/event.h> |
10 | 41 | ||
11 | class QVBoxLayout; | 42 | class QVBoxLayout; |
12 | class QHBoxLayout; | 43 | class QHBoxLayout; |
13 | class QGridLayout; | 44 | class QGridLayout; |
14 | class DatebookAlldayDisp; | 45 | class DatebookAlldayDisp; |
15 | class DatebookEventDesc; | 46 | class DatebookEventDesc; |
16 | class DateBookDB; | 47 | class DateBookDB; |
17 | 48 | ||
18 | class DatebookdayAllday : public QScrollView | 49 | class DatebookdayAllday : public QScrollView |
19 | { | 50 | { |
20 | Q_OBJECT | 51 | Q_OBJECT |
21 | 52 | ||
22 | public: | 53 | public: |
23 | DatebookdayAllday(DateBookDB* db, | 54 | DatebookdayAllday(DateBookDB* db, |
24 | QWidget* parent = 0, const char* name = 0, WFlags fl = 0); | 55 | QWidget* parent = 0, const char* name = 0, WFlags fl = 0); |
25 | ~DatebookdayAllday(); | 56 | ~DatebookdayAllday(); |
26 | DatebookAlldayDisp* addEvent(const EffectiveEvent&e); | 57 | DatebookAlldayDisp* addEvent(const EffectiveEvent&e); |
27 | DatebookAlldayDisp* addHoliday(const QString&e); | 58 | DatebookAlldayDisp* addHoliday(const QString&e); |
28 | const unsigned int items()const{return item_count;} | 59 | const unsigned int items()const{return item_count;} |
29 | 60 | ||
30 | public slots: | 61 | public slots: |
31 | void removeAllEvents(); | 62 | void removeAllEvents(); |
32 | 63 | ||
33 | protected: | 64 | protected: |
34 | QFrame * m_MainFrame; | 65 | QFrame * m_MainFrame; |
35 | QVBoxLayout* datebookdayalldayLayout; | 66 | QVBoxLayout* datebookdayalldayLayout; |
36 | DatebookEventDesc * lblDesc; | 67 | DatebookEventDesc * lblDesc; |
37 | unsigned int item_count; | 68 | unsigned int item_count; |
38 | QList<DatebookAlldayDisp> subWidgets; | 69 | QList<DatebookAlldayDisp> subWidgets; |
39 | DateBookDB *dateBook; | 70 | DateBookDB *dateBook; |
40 | }; | 71 | }; |
41 | 72 | ||
42 | class DatebookAlldayDisp : public QLabel | 73 | class DatebookAlldayDisp : public QLabel |
43 | { | 74 | { |
44 | Q_OBJECT | 75 | Q_OBJECT |
45 | 76 | ||
46 | public: | 77 | public: |
47 | DatebookAlldayDisp(DateBookDB* db,const EffectiveEvent& e, | 78 | DatebookAlldayDisp(DateBookDB* db,const EffectiveEvent& e, |
48 | QWidget* parent=0,const char* name = 0, WFlags fl=0); | 79 | QWidget* parent=0,const char* name = 0, WFlags fl=0); |
49 | DatebookAlldayDisp(const QString&aholiday, | 80 | DatebookAlldayDisp(const QString&aholiday, |
50 | QWidget* parent=0,const char* name = 0, WFlags fl=0); | 81 | QWidget* parent=0,const char* name = 0, WFlags fl=0); |
51 | virtual ~DatebookAlldayDisp(); | 82 | virtual ~DatebookAlldayDisp(); |
52 | 83 | ||
53 | signals: | 84 | signals: |
54 | void deleteMe( const Event &e ); | 85 | void deleteMe( const Event &e ); |
55 | void duplicateMe( const Event &e ); | 86 | void duplicateMe( const Event &e ); |
56 | void editMe( const Event &e ); | 87 | void editMe( const Event &e ); |
57 | void beamMe( const Event &e ); | 88 | void beamMe( const Event &e ); |
58 | void displayMe(const Event &e); | 89 | void displayMe(const Event &e); |
59 | 90 | ||
60 | public slots: | 91 | public slots: |
61 | 92 | ||
62 | protected: | 93 | protected: |
63 | EffectiveEvent m_Ev; | 94 | EffectiveEvent m_Ev; |
64 | DateBookDB* dateBook; | 95 | DateBookDB* dateBook; |
diff --git a/core/pim/datebook/datebookdayheaderimpl.cpp b/core/pim/datebook/datebookdayheaderimpl.cpp index 51b78ca..0df1bfe 100644 --- a/core/pim/datebook/datebookdayheaderimpl.cpp +++ b/core/pim/datebook/datebookdayheaderimpl.cpp | |||
@@ -1,112 +1,124 @@ | |||
1 | /********************************************************************** | 1 | /* |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | This file is part of the Opie Project |
3 | ** | 3 | |
4 | ** This file is part of Qtopia Environment. | 4 | Copyright (C) Opie Team <opie-devel@handhelds.org> |
5 | ** | 5 | =. |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | .=l. |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | .>+-= |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | _;:, .> :=|. This program is free software; you can |
9 | ** packaging of this file. | 9 | .> <`_, > . <= redistribute it and/or modify it under |
10 | ** | 10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | .="- .-=="i, .._ License as published by the Free Software |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | - . .-<_> .<> Foundation; either version 2 of the License, |
13 | ** | 13 | ._= =} : or (at your option) any later version. |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | .%`+i> _;_. |
15 | ** | 15 | .i_,=:_. -<s. This program is distributed in the hope that |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
17 | ** not clear to you. | 17 | : .. .:, . . . without even the implied warranty of |
18 | ** | 18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | **********************************************************************/ | 19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= = ; Library General Public License for more | ||
21 | ++= -. .` .: details. | ||
22 | : = ...= . :.=- | ||
23 | -. .:....=;==+<; You should have received a copy of the GNU | ||
24 | -_. . . )=. = Library General Public License along with | ||
25 | -- :-=` this library; see the file COPYING.LIB. | ||
26 | If not, write to the Free Software Foundation, | ||
27 | Inc., 59 Temple Place - Suite 330, | ||
28 | Boston, MA 02111-1307, USA. | ||
29 | */ | ||
30 | |||
20 | #include "datebookdayheaderimpl.h" | 31 | #include "datebookdayheaderimpl.h" |
21 | 32 | ||
33 | #include <opie2/oresource.h> | ||
34 | |||
22 | #include <qpe/datebookmonth.h> | 35 | #include <qpe/datebookmonth.h> |
23 | #include <qpe/resource.h> | ||
24 | 36 | ||
25 | #include <qbuttongroup.h> | 37 | #include <qbuttongroup.h> |
26 | #include <qtoolbutton.h> | 38 | #include <qtoolbutton.h> |
27 | 39 | ||
28 | 40 | ||
29 | /* | 41 | /* |
30 | * Constructs a DateBookDayHeader which is a child of 'parent', with the | 42 | * Constructs a DateBookDayHeader which is a child of 'parent', with the |
31 | * name 'name' and widget flags set to 'f' | 43 | * name 'name' and widget flags set to 'f' |
32 | * | 44 | * |
33 | * The dialog will by default be modeless, unless you set 'modal' to | 45 | * The dialog will by default be modeless, unless you set 'modal' to |
34 | * TRUE to construct a modal dialog. | 46 | * TRUE to construct a modal dialog. |
35 | */ | 47 | */ |
36 | DateBookDayHeader::DateBookDayHeader( bool useMonday, | 48 | DateBookDayHeader::DateBookDayHeader( bool useMonday, |
37 | QWidget* parent, const char* name ) | 49 | QWidget* parent, const char* name ) |
38 | : DateBookDayHeaderBase( parent, name ), | 50 | : DateBookDayHeaderBase( parent, name ), |
39 | bUseMonday( useMonday ) | 51 | bUseMonday( useMonday ) |
40 | { | 52 | { |
41 | connect(date,SIGNAL(pressed()),this,SLOT(pickDate())); | 53 | connect(date,SIGNAL(pressed()),this,SLOT(pickDate())); |
42 | 54 | ||
43 | setupNames(); | 55 | setupNames(); |
44 | 56 | ||
45 | forward->setPixmap( Resource::loadPixmap( "forward" ) ); | 57 | forward->setPixmap( Opie::Core::OResource::loadPixmap( "forward" ) ); |
46 | back->setPixmap( Resource::loadPixmap( "back" ) ); | 58 | back->setPixmap( Opie::Core::OResource::loadPixmap( "back" ) ); |
47 | forwardweek->setPixmap( Resource::loadPixmap( "fastforward" ) ); | 59 | forwardweek->setPixmap( Opie::Core::OResource::loadPixmap( "fastforward" ) ); |
48 | backweek->setPixmap( Resource::loadPixmap( "fastback" ) ); | 60 | backweek->setPixmap( Opie::Core::OResource::loadPixmap( "fastback" ) ); |
49 | 61 | ||
50 | setBackgroundMode( PaletteButton ); | 62 | setBackgroundMode( PaletteButton ); |
51 | grpDays->setBackgroundMode( PaletteButton ); | 63 | grpDays->setBackgroundMode( PaletteButton ); |
52 | } | 64 | } |
53 | 65 | ||
54 | /* | 66 | /* |
55 | * Destroys the object and frees any allocated resources | 67 | * Destroys the object and frees any allocated resources |
56 | */ | 68 | */ |
57 | DateBookDayHeader::~DateBookDayHeader() | 69 | DateBookDayHeader::~DateBookDayHeader() |
58 | { | 70 | { |
59 | // no need to delete child widgets, Qt does it all for us | 71 | // no need to delete child widgets, Qt does it all for us |
60 | } | 72 | } |
61 | 73 | ||
62 | void DateBookDayHeader::setStartOfWeek( bool onMonday ) | 74 | void DateBookDayHeader::setStartOfWeek( bool onMonday ) |
63 | { | 75 | { |
64 | bUseMonday = onMonday; | 76 | bUseMonday = onMonday; |
65 | setupNames(); | 77 | setupNames(); |
66 | setDate( currDate.year(), currDate.month(), currDate.day() ); | 78 | setDate( currDate.year(), currDate.month(), currDate.day() ); |
67 | } | 79 | } |
68 | 80 | ||
69 | void DateBookDayHeader::setupNames() | 81 | void DateBookDayHeader::setupNames() |
70 | { | 82 | { |
71 | if ( bUseMonday ) { | 83 | if ( bUseMonday ) { |
72 | cmdDay1->setText( DateBookDayHeaderBase::tr("Monday").left(1) ); | 84 | cmdDay1->setText( DateBookDayHeaderBase::tr("Monday").left(1) ); |
73 | cmdDay2->setText( DateBookDayHeaderBase::tr("Tuesday").left(1) ); | 85 | cmdDay2->setText( DateBookDayHeaderBase::tr("Tuesday").left(1) ); |
74 | cmdDay3->setText( DateBookDayHeaderBase::tr("Wednesday").left(1) ); | 86 | cmdDay3->setText( DateBookDayHeaderBase::tr("Wednesday").left(1) ); |
75 | cmdDay4->setText( DateBookDayHeaderBase::tr("Thursday").left(1) ); | 87 | cmdDay4->setText( DateBookDayHeaderBase::tr("Thursday").left(1) ); |
76 | cmdDay5->setText( DateBookDayHeaderBase::tr("Friday").left(1) ); | 88 | cmdDay5->setText( DateBookDayHeaderBase::tr("Friday").left(1) ); |
77 | cmdDay6->setText( DateBookDayHeaderBase::tr("Saturday").left(1) ); | 89 | cmdDay6->setText( DateBookDayHeaderBase::tr("Saturday").left(1) ); |
78 | cmdDay7->setText( DateBookDayHeaderBase::tr("Sunday").left(1) ); | 90 | cmdDay7->setText( DateBookDayHeaderBase::tr("Sunday").left(1) ); |
79 | } else { | 91 | } else { |
80 | cmdDay1->setText( DateBookDayHeaderBase::tr("Sunday").left(1) ); | 92 | cmdDay1->setText( DateBookDayHeaderBase::tr("Sunday").left(1) ); |
81 | cmdDay2->setText( DateBookDayHeaderBase::tr("Monday").left(1) ); | 93 | cmdDay2->setText( DateBookDayHeaderBase::tr("Monday").left(1) ); |
82 | cmdDay3->setText( DateBookDayHeaderBase::tr("Tuesday").left(1) ); | 94 | cmdDay3->setText( DateBookDayHeaderBase::tr("Tuesday").left(1) ); |
83 | cmdDay4->setText( DateBookDayHeaderBase::tr("Wednesday").left(1) ); | 95 | cmdDay4->setText( DateBookDayHeaderBase::tr("Wednesday").left(1) ); |
84 | cmdDay5->setText( DateBookDayHeaderBase::tr("Thursday").left(1) ); | 96 | cmdDay5->setText( DateBookDayHeaderBase::tr("Thursday").left(1) ); |
85 | cmdDay6->setText( DateBookDayHeaderBase::tr("Friday").left(1) ); | 97 | cmdDay6->setText( DateBookDayHeaderBase::tr("Friday").left(1) ); |
86 | cmdDay7->setText( DateBookDayHeaderBase::tr("Saturday").left(1) ); | 98 | cmdDay7->setText( DateBookDayHeaderBase::tr("Saturday").left(1) ); |
87 | } | 99 | } |
88 | } | 100 | } |
89 | 101 | ||
90 | 102 | ||
91 | void DateBookDayHeader::pickDate() | 103 | void DateBookDayHeader::pickDate() |
92 | { | 104 | { |
93 | static QPopupMenu *m1 = 0; | 105 | static QPopupMenu *m1 = 0; |
94 | static DateBookMonth *picker = 0; | 106 | static DateBookMonth *picker = 0; |
95 | if ( !m1 ) { | 107 | if ( !m1 ) { |
96 | m1 = new QPopupMenu( this ); | 108 | m1 = new QPopupMenu( this ); |
97 | picker = new DateBookMonth( m1, 0, TRUE ); | 109 | picker = new DateBookMonth( m1, 0, TRUE ); |
98 | m1->insertItem( picker ); | 110 | m1->insertItem( picker ); |
99 | connect( picker, SIGNAL( dateClicked(int,int,int) ), | 111 | connect( picker, SIGNAL( dateClicked(int,int,int) ), |
100 | this, SLOT( setDate(int,int,int) ) ); | 112 | this, SLOT( setDate(int,int,int) ) ); |
101 | connect( m1, SIGNAL( aboutToHide() ), | 113 | connect( m1, SIGNAL( aboutToHide() ), |
102 | this, SLOT( gotHide() ) ); | 114 | this, SLOT( gotHide() ) ); |
103 | } | 115 | } |
104 | picker->setDate( currDate.year(), currDate.month(), currDate.day() ); | 116 | picker->setDate( currDate.year(), currDate.month(), currDate.day() ); |
105 | m1->popup(mapToGlobal(date->pos()+QPoint(0,date->height()))); | 117 | m1->popup(mapToGlobal(date->pos()+QPoint(0,date->height()))); |
106 | picker->setFocus(); | 118 | picker->setFocus(); |
107 | } | 119 | } |
108 | 120 | ||
109 | void DateBookDayHeader::gotHide() | 121 | void DateBookDayHeader::gotHide() |
110 | { | 122 | { |
111 | // we have to redo the button... | 123 | // we have to redo the button... |
112 | date->setDown( false ); | 124 | date->setDown( false ); |
diff --git a/core/pim/datebook/datebookdayheaderimpl.h b/core/pim/datebook/datebookdayheaderimpl.h index a07bd67..ea9f917 100644 --- a/core/pim/datebook/datebookdayheaderimpl.h +++ b/core/pim/datebook/datebookdayheaderimpl.h | |||
@@ -1,59 +1,70 @@ | |||
1 | /********************************************************************** | 1 | /* |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | This file is part of the Opie Project |
3 | ** | 3 | |
4 | ** This file is part of Qtopia Environment. | 4 | Copyright (C) Opie Team <opie-devel@handhelds.org> |
5 | ** | 5 | =. |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | .=l. |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | .>+-= |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | _;:, .> :=|. This program is free software; you can |
9 | ** packaging of this file. | 9 | .> <`_, > . <= redistribute it and/or modify it under |
10 | ** | 10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | .="- .-=="i, .._ License as published by the Free Software |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | - . .-<_> .<> Foundation; either version 2 of the License, |
13 | ** | 13 | ._= =} : or (at your option) any later version. |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | .%`+i> _;_. |
15 | ** | 15 | .i_,=:_. -<s. This program is distributed in the hope that |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
17 | ** not clear to you. | 17 | : .. .:, . . . without even the implied warranty of |
18 | ** | 18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | **********************************************************************/ | 19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= = ; Library General Public License for more | ||
21 | ++= -. .` .: details. | ||
22 | : = ...= . :.=- | ||
23 | -. .:....=;==+<; You should have received a copy of the GNU | ||
24 | -_. . . )=. = Library General Public License along with | ||
25 | -- :-=` this library; see the file COPYING.LIB. | ||
26 | If not, write to the Free Software Foundation, | ||
27 | Inc., 59 Temple Place - Suite 330, | ||
28 | Boston, MA 02111-1307, USA. | ||
29 | */ | ||
30 | |||
20 | #ifndef DATEBOOKDAYHEADER_H | 31 | #ifndef DATEBOOKDAYHEADER_H |
21 | #define DATEBOOKDAYHEADER_H | 32 | #define DATEBOOKDAYHEADER_H |
22 | #include "datebookdayheader.h" | 33 | #include "datebookdayheader.h" |
23 | 34 | ||
24 | #include <qdatetime.h> | 35 | #include <qdatetime.h> |
25 | 36 | ||
26 | class DateBookDayHeader : public DateBookDayHeaderBase | 37 | class DateBookDayHeader : public DateBookDayHeaderBase |
27 | { | 38 | { |
28 | Q_OBJECT | 39 | Q_OBJECT |
29 | 40 | ||
30 | public: | 41 | public: |
31 | DateBookDayHeader( bool bUseMonday, QWidget* parent = 0, | 42 | DateBookDayHeader( bool bUseMonday, QWidget* parent = 0, |
32 | const char* name = 0 ); | 43 | const char* name = 0 ); |
33 | ~DateBookDayHeader(); | 44 | ~DateBookDayHeader(); |
34 | void setStartOfWeek( bool onMonday ); | 45 | void setStartOfWeek( bool onMonday ); |
35 | 46 | ||
36 | public slots: | 47 | public slots: |
37 | void goBack(); | 48 | void goBack(); |
38 | void goForward(); | 49 | void goForward(); |
39 | void goBackWeek(); | 50 | void goBackWeek(); |
40 | void goForwardWeek(); | 51 | void goForwardWeek(); |
41 | void setDate( int, int, int ); | 52 | void setDate( int, int, int ); |
42 | void setDay( int ); | 53 | void setDay( int ); |
43 | void gotHide(); | 54 | void gotHide(); |
44 | 55 | ||
45 | signals: | 56 | signals: |
46 | void dateChanged( int y, int m, int d ); | 57 | void dateChanged( int y, int m, int d ); |
47 | 58 | ||
48 | private slots: | 59 | private slots: |
49 | void pickDate(); | 60 | void pickDate(); |
50 | 61 | ||
51 | 62 | ||
52 | private: | 63 | private: |
53 | QDate currDate; | 64 | QDate currDate; |
54 | bool bUseMonday; | 65 | bool bUseMonday; |
55 | void setupNames(); | 66 | void setupNames(); |
56 | 67 | ||
57 | }; | 68 | }; |
58 | 69 | ||
59 | #endif // DATEBOOKDAYHEADER_H | 70 | #endif // DATEBOOKDAYHEADER_H |
diff --git a/core/pim/datebook/datebooksettings.cpp b/core/pim/datebook/datebooksettings.cpp index 561dc38..c72cd59 100644 --- a/core/pim/datebook/datebooksettings.cpp +++ b/core/pim/datebook/datebooksettings.cpp | |||
@@ -1,83 +1,93 @@ | |||
1 | /********************************************************************** | 1 | /* |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | This file is part of the Opie Project |
3 | ** | 3 | |
4 | ** This file is part of Qtopia Environment. | 4 | Copyright (C) Opie Team <opie-devel@handhelds.org> |
5 | ** | 5 | =. |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | .=l. |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | .>+-= |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | _;:, .> :=|. This program is free software; you can |
9 | ** packaging of this file. | 9 | .> <`_, > . <= redistribute it and/or modify it under |
10 | ** | 10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | .="- .-=="i, .._ License as published by the Free Software |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | - . .-<_> .<> Foundation; either version 2 of the License, |
13 | ** | 13 | ._= =} : or (at your option) any later version. |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | .%`+i> _;_. |
15 | ** | 15 | .i_,=:_. -<s. This program is distributed in the hope that |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
17 | ** not clear to you. | 17 | : .. .:, . . . without even the implied warranty of |
18 | ** | 18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | **********************************************************************/ | 19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= = ; Library General Public License for more | ||
21 | ++= -. .` .: details. | ||
22 | : = ...= . :.=- | ||
23 | -. .:....=;==+<; You should have received a copy of the GNU | ||
24 | -_. . . )=. = Library General Public License along with | ||
25 | -- :-=` this library; see the file COPYING.LIB. | ||
26 | If not, write to the Free Software Foundation, | ||
27 | Inc., 59 Temple Place - Suite 330, | ||
28 | Boston, MA 02111-1307, USA. | ||
29 | */ | ||
20 | 30 | ||
21 | #include "datebooksettings.h" | 31 | #include "datebooksettings.h" |
22 | 32 | ||
23 | #include <opie2/opluginloader.h> | 33 | #include <opie2/opluginloader.h> |
24 | #include <opie2/odebug.h> | 34 | #include <opie2/odebug.h> |
25 | #include <opie2/oholidaypluginif.h> | 35 | #include <opie2/oholidaypluginif.h> |
26 | #include <opie2/oholidayplugin.h> | 36 | #include <opie2/oholidayplugin.h> |
27 | #include <opie2/oholidayplugincfgwidget.h> | 37 | #include <opie2/oholidayplugincfgwidget.h> |
28 | 38 | ||
29 | #include <qpe/qpeapplication.h> | 39 | #include <qpe/qpeapplication.h> |
30 | 40 | ||
31 | #include <qspinbox.h> | 41 | #include <qspinbox.h> |
32 | #include <qcheckbox.h> | 42 | #include <qcheckbox.h> |
33 | #include <qlistview.h> | 43 | #include <qlistview.h> |
34 | #include <qheader.h> | 44 | #include <qheader.h> |
35 | #include <qtabwidget.h> | 45 | #include <qtabwidget.h> |
36 | #include <qlayout.h> | 46 | #include <qlayout.h> |
37 | 47 | ||
38 | DateBookSettings::DateBookSettings( bool whichClock, QWidget *parent, | 48 | DateBookSettings::DateBookSettings( bool whichClock, QWidget *parent, |
39 | const char *name, bool modal, WFlags fl ) | 49 | const char *name, bool modal, WFlags fl ) |
40 | : DateBookSettingsBase( parent, name, modal, fl ), | 50 | : DateBookSettingsBase( parent, name, modal, fl ), |
41 | ampm( whichClock ) | 51 | ampm( whichClock ) |
42 | { | 52 | { |
43 | init(); | 53 | init(); |
44 | QObject::connect( qApp, SIGNAL( clockChanged(bool) ), this, SLOT( slotChangeClock(bool) ) ); | 54 | QObject::connect( qApp, SIGNAL( clockChanged(bool) ), this, SLOT( slotChangeClock(bool) ) ); |
45 | QArray<int> categories; | 55 | QArray<int> categories; |
46 | comboCategory->setCategories( categories, "Calendar", tr("Calendar") ); | 56 | comboCategory->setCategories( categories, "Calendar", tr("Calendar") ); |
47 | m_loader = 0; | 57 | m_loader = 0; |
48 | m_manager = 0; | 58 | m_manager = 0; |
49 | m_PluginListView->header()->hide(); | 59 | m_PluginListView->header()->hide(); |
50 | m_PluginListView->setSorting(-1); | 60 | m_PluginListView->setSorting(-1); |
51 | } | 61 | } |
52 | 62 | ||
53 | DateBookSettings::~DateBookSettings() | 63 | DateBookSettings::~DateBookSettings() |
54 | { | 64 | { |
55 | } | 65 | } |
56 | 66 | ||
57 | void DateBookSettings::setStartTime( int newStartViewTime ) | 67 | void DateBookSettings::setStartTime( int newStartViewTime ) |
58 | { | 68 | { |
59 | if ( ampm ) { | 69 | if ( ampm ) { |
60 | if ( newStartViewTime >= 12 ) { | 70 | if ( newStartViewTime >= 12 ) { |
61 | newStartViewTime %= 12; | 71 | newStartViewTime %= 12; |
62 | if ( newStartViewTime == 0 ) | 72 | if ( newStartViewTime == 0 ) |
63 | newStartViewTime = 12; | 73 | newStartViewTime = 12; |
64 | spinStart->setSuffix( tr(":00 PM") ); | 74 | spinStart->setSuffix( tr(":00 PM") ); |
65 | } | 75 | } |
66 | else if ( newStartViewTime == 0 ) { | 76 | else if ( newStartViewTime == 0 ) { |
67 | newStartViewTime = 12; | 77 | newStartViewTime = 12; |
68 | spinStart->setSuffix( tr(":00 AM") ); | 78 | spinStart->setSuffix( tr(":00 AM") ); |
69 | } | 79 | } |
70 | oldtime = newStartViewTime; | 80 | oldtime = newStartViewTime; |
71 | } | 81 | } |
72 | spinStart->setValue( newStartViewTime ); | 82 | spinStart->setValue( newStartViewTime ); |
73 | } | 83 | } |
74 | 84 | ||
75 | int DateBookSettings::startTime() const | 85 | int DateBookSettings::startTime() const |
76 | { | 86 | { |
77 | int returnMe = spinStart->value(); | 87 | int returnMe = spinStart->value(); |
78 | if ( ampm ) { | 88 | if ( ampm ) { |
79 | if ( returnMe != 12 && spinStart->suffix().contains(tr("PM"), FALSE) ) | 89 | if ( returnMe != 12 && spinStart->suffix().contains(tr("PM"), FALSE) ) |
80 | returnMe += 12; | 90 | returnMe += 12; |
81 | else if (returnMe == 12 && spinStart->suffix().contains(tr("AM"), TRUE)) | 91 | else if (returnMe == 12 && spinStart->suffix().contains(tr("AM"), TRUE)) |
82 | returnMe = 0; | 92 | returnMe = 0; |
83 | } | 93 | } |
diff --git a/core/pim/datebook/datebooksettings.h b/core/pim/datebook/datebooksettings.h index 912088f..d3aca85 100644 --- a/core/pim/datebook/datebooksettings.h +++ b/core/pim/datebook/datebooksettings.h | |||
@@ -1,77 +1,87 @@ | |||
1 | /********************************************************************** | 1 | /* |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | This file is part of the Opie Project |
3 | ** | 3 | |
4 | ** This file is part of Qtopia Environment. | 4 | Copyright (C) Opie Team <opie-devel@handhelds.org> |
5 | ** | 5 | =. |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | .=l. |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | .>+-= |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | _;:, .> :=|. This program is free software; you can |
9 | ** packaging of this file. | 9 | .> <`_, > . <= redistribute it and/or modify it under |
10 | ** | 10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | .="- .-=="i, .._ License as published by the Free Software |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | - . .-<_> .<> Foundation; either version 2 of the License, |
13 | ** | 13 | ._= =} : or (at your option) any later version. |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | .%`+i> _;_. |
15 | ** | 15 | .i_,=:_. -<s. This program is distributed in the hope that |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
17 | ** not clear to you. | 17 | : .. .:, . . . without even the implied warranty of |
18 | ** | 18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | **********************************************************************/ | 19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= = ; Library General Public License for more | ||
21 | ++= -. .` .: details. | ||
22 | : = ...= . :.=- | ||
23 | -. .:....=;==+<; You should have received a copy of the GNU | ||
24 | -_. . . )=. = Library General Public License along with | ||
25 | -- :-=` this library; see the file COPYING.LIB. | ||
26 | If not, write to the Free Software Foundation, | ||
27 | Inc., 59 Temple Place - Suite 330, | ||
28 | Boston, MA 02111-1307, USA. | ||
29 | */ | ||
20 | 30 | ||
21 | #ifndef DATEBOOKSETTINGS_H | 31 | #ifndef DATEBOOKSETTINGS_H |
22 | #define DATEBOOKSETTINGS_H | 32 | #define DATEBOOKSETTINGS_H |
23 | #include "datebooksettingsbase.h" | 33 | #include "datebooksettingsbase.h" |
24 | #include <qpe/categoryselect.h> | 34 | #include <qpe/categoryselect.h> |
25 | #include <qvaluelist.h> | 35 | #include <qvaluelist.h> |
26 | 36 | ||
27 | namespace Opie { | 37 | namespace Opie { |
28 | namespace Core { | 38 | namespace Core { |
29 | class OPluginManager; | 39 | class OPluginManager; |
30 | class OGenericPluginLoader; | 40 | class OGenericPluginLoader; |
31 | class OPluginLoader; | 41 | class OPluginLoader; |
32 | } | 42 | } |
33 | namespace Ui { | 43 | namespace Ui { |
34 | class OPluginConfigWidget; | 44 | class OPluginConfigWidget; |
35 | } | 45 | } |
36 | namespace Datebook { | 46 | namespace Datebook { |
37 | class HolidayPluginConfigWidget; | 47 | class HolidayPluginConfigWidget; |
38 | } | 48 | } |
39 | } | 49 | } |
40 | 50 | ||
41 | class DateBookSettings : public DateBookSettingsBase | 51 | class DateBookSettings : public DateBookSettingsBase |
42 | { | 52 | { |
43 | Q_OBJECT | 53 | Q_OBJECT |
44 | public: | 54 | public: |
45 | DateBookSettings( bool whichClock, QWidget *parent = 0, | 55 | DateBookSettings( bool whichClock, QWidget *parent = 0, |
46 | const char *name = 0, bool modal = TRUE, WFlags = 0 ); | 56 | const char *name = 0, bool modal = TRUE, WFlags = 0 ); |
47 | ~DateBookSettings(); | 57 | ~DateBookSettings(); |
48 | void setStartTime( int newStartViewTime ); | 58 | void setStartTime( int newStartViewTime ); |
49 | int startTime() const; | 59 | int startTime() const; |
50 | void setAlarmPreset( bool bAlarm, int presetTime ); | 60 | void setAlarmPreset( bool bAlarm, int presetTime ); |
51 | bool alarmPreset() const; | 61 | bool alarmPreset() const; |
52 | int presetTime() const; | 62 | int presetTime() const; |
53 | void setAlarmType( int alarmType ); | 63 | void setAlarmType( int alarmType ); |
54 | int alarmType() const; | 64 | int alarmType() const; |
55 | 65 | ||
56 | void setJumpToCurTime( bool bJump ); | 66 | void setJumpToCurTime( bool bJump ); |
57 | bool jumpToCurTime() const; | 67 | bool jumpToCurTime() const; |
58 | void setRowStyle( int style ); | 68 | void setRowStyle( int style ); |
59 | int rowStyle() const; | 69 | int rowStyle() const; |
60 | 70 | ||
61 | void setPluginList(Opie::Core::OPluginManager*,Opie::Core::OPluginLoader*); | 71 | void setPluginList(Opie::Core::OPluginManager*,Opie::Core::OPluginLoader*); |
62 | void savePlugins(); | 72 | void savePlugins(); |
63 | private slots: | 73 | private slots: |
64 | void slot12Hour( int ); | 74 | void slot12Hour( int ); |
65 | void slotChangeClock( bool ); | 75 | void slotChangeClock( bool ); |
66 | protected slots: | 76 | protected slots: |
67 | virtual void pluginItemClicked(QListViewItem *); | 77 | virtual void pluginItemClicked(QListViewItem *); |
68 | 78 | ||
69 | protected: | 79 | protected: |
70 | void init(); | 80 | void init(); |
71 | bool ampm; | 81 | bool ampm; |
72 | int oldtime; | 82 | int oldtime; |
73 | Opie::Core::OPluginManager*m_manager; | 83 | Opie::Core::OPluginManager*m_manager; |
74 | Opie::Core::OPluginLoader*m_loader; | 84 | Opie::Core::OPluginLoader*m_loader; |
75 | QValueList<Opie::Datebook::HolidayPluginConfigWidget*> m_cfgWidgets; | 85 | QValueList<Opie::Datebook::HolidayPluginConfigWidget*> m_cfgWidgets; |
76 | }; | 86 | }; |
77 | #endif | 87 | #endif |
diff --git a/core/pim/datebook/datebooktypes.h b/core/pim/datebook/datebooktypes.h index 9453be8..bc94561 100644 --- a/core/pim/datebook/datebooktypes.h +++ b/core/pim/datebook/datebooktypes.h | |||
@@ -1,64 +1,94 @@ | |||
1 | /* | ||
2 | This file is part of the Opie Project | ||
3 | |||
4 | Copyright (C) Opie Team <opie-devel@handhelds.org> | ||
5 | =. | ||
6 | .=l. | ||
7 | .>+-= | ||
8 | _;:, .> :=|. This program is free software; you can | ||
9 | .> <`_, > . <= redistribute it and/or modify it under | ||
10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | ||
11 | .="- .-=="i, .._ License as published by the Free Software | ||
12 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
13 | ._= =} : or (at your option) any later version. | ||
14 | .%`+i> _;_. | ||
15 | .i_,=:_. -<s. This program is distributed in the hope that | ||
16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
17 | : .. .:, . . . without even the implied warranty of | ||
18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
20 | ..}^=.= = ; Library General Public License for more | ||
21 | ++= -. .` .: details. | ||
22 | : = ...= . :.=- | ||
23 | -. .:....=;==+<; You should have received a copy of the GNU | ||
24 | -_. . . )=. = Library General Public License along with | ||
25 | -- :-=` this library; see the file COPYING.LIB. | ||
26 | If not, write to the Free Software Foundation, | ||
27 | Inc., 59 Temple Place - Suite 330, | ||
28 | Boston, MA 02111-1307, USA. | ||
29 | */ | ||
30 | |||
1 | #ifndef _DATEBOOK_TYPES_H | 31 | #ifndef _DATEBOOK_TYPES_H |
2 | #define _DATEBOOK_TYPES_H | 32 | #define _DATEBOOK_TYPES_H |
3 | 33 | ||
4 | #include <qpe/datebookdb.h> | 34 | #include <qpe/datebookdb.h> |
5 | 35 | ||
6 | #include <qvaluelist.h> | 36 | #include <qvaluelist.h> |
7 | #include <qstringlist.h> | 37 | #include <qstringlist.h> |
8 | 38 | ||
9 | namespace Opie { | 39 | namespace Opie { |
10 | namespace Datebook { | 40 | namespace Datebook { |
11 | class HolidayPlugin; | 41 | class HolidayPlugin; |
12 | class HolidayPluginIf; | 42 | class HolidayPluginIf; |
13 | } | 43 | } |
14 | namespace Core { | 44 | namespace Core { |
15 | class OPluginLoader; | 45 | class OPluginLoader; |
16 | class OPluginManager; | 46 | class OPluginManager; |
17 | } | 47 | } |
18 | } | 48 | } |
19 | 49 | ||
20 | class QLibrary; | 50 | class QLibrary; |
21 | 51 | ||
22 | enum { DAY=1,WEEK,WEEKLST,MONTH }; // defaultView values | 52 | enum { DAY=1,WEEK,WEEKLST,MONTH }; // defaultView values |
23 | enum { NONE=0,NORMAL,EXTENDED }; // WeekLstView's modes. | 53 | enum { NONE=0,NORMAL,EXTENDED }; // WeekLstView's modes. |
24 | 54 | ||
25 | class DateBookDBHack : virtual public DateBookDB { | 55 | class DateBookDBHack : virtual public DateBookDB { |
26 | public: | 56 | public: |
27 | virtual ~DateBookDBHack(){} | 57 | virtual ~DateBookDBHack(){} |
28 | Event eventByUID(int id); | 58 | Event eventByUID(int id); |
29 | }; | 59 | }; |
30 | 60 | ||
31 | class DateBookHoliday | 61 | class DateBookHoliday |
32 | { | 62 | { |
33 | public: | 63 | public: |
34 | DateBookHoliday(); | 64 | DateBookHoliday(); |
35 | virtual ~DateBookHoliday(); | 65 | virtual ~DateBookHoliday(); |
36 | 66 | ||
37 | QStringList holidaylist(const QDate&); | 67 | QStringList holidaylist(const QDate&); |
38 | QStringList holidaylist(unsigned year, unsigned month, unsigned day); | 68 | QStringList holidaylist(unsigned year, unsigned month, unsigned day); |
39 | virtual QValueList<EffectiveEvent> getEffectiveEvents(const QDate &from,const QDate &to ); | 69 | virtual QValueList<EffectiveEvent> getEffectiveEvents(const QDate &from,const QDate &to ); |
40 | virtual QValueList<EffectiveEvent> getEffectiveEvents(const QDateTime &start); | 70 | virtual QValueList<EffectiveEvent> getEffectiveEvents(const QDateTime &start); |
41 | 71 | ||
42 | void reloadPlugins(); | 72 | void reloadPlugins(); |
43 | 73 | ||
44 | Opie::Core::OPluginLoader*pluginLoader(){return m_pluginLoader;} | 74 | Opie::Core::OPluginLoader*pluginLoader(){return m_pluginLoader;} |
45 | Opie::Core::OPluginManager*pluginManager(){return m_pluginManager;} | 75 | Opie::Core::OPluginManager*pluginManager(){return m_pluginManager;} |
46 | 76 | ||
47 | protected: | 77 | protected: |
48 | void init(); | 78 | void init(); |
49 | void deinit(); | 79 | void deinit(); |
50 | 80 | ||
51 | struct HPlugin { | 81 | struct HPlugin { |
52 | Opie::Datebook::HolidayPlugin*_plugin; | 82 | Opie::Datebook::HolidayPlugin*_plugin; |
53 | //QLibrary*_lib; | 83 | //QLibrary*_lib; |
54 | //Opie::Datebook::HolidayPluginIf*_if; | 84 | //Opie::Datebook::HolidayPluginIf*_if; |
55 | }; | 85 | }; |
56 | QValueList<HPlugin*>_pluginlist; | 86 | QValueList<HPlugin*>_pluginlist; |
57 | Opie::Core::OPluginLoader*m_pluginLoader; | 87 | Opie::Core::OPluginLoader*m_pluginLoader; |
58 | Opie::Core::OPluginManager*m_pluginManager; | 88 | Opie::Core::OPluginManager*m_pluginManager; |
59 | }; | 89 | }; |
60 | 90 | ||
61 | class DateBookDBHoliday:virtual public DateBookDBHack { | 91 | class DateBookDBHoliday:virtual public DateBookDBHack { |
62 | public: | 92 | public: |
63 | DateBookDBHoliday():DateBookDBHack(){db_holiday=0;} | 93 | DateBookDBHoliday():DateBookDBHack(){db_holiday=0;} |
64 | virtual ~DateBookDBHoliday(){} | 94 | virtual ~DateBookDBHoliday(){} |
diff --git a/core/pim/datebook/datebookweek.cpp b/core/pim/datebook/datebookweek.cpp index a509d89..ce0b10b 100644 --- a/core/pim/datebook/datebookweek.cpp +++ b/core/pim/datebook/datebookweek.cpp | |||
@@ -1,83 +1,94 @@ | |||
1 | /********************************************************************** | 1 | /* |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | This file is part of the Opie Project |
3 | ** | 3 | |
4 | ** This file is part of Qtopia Environment. | 4 | Copyright (C) Opie Team <opie-devel@handhelds.org> |
5 | ** | 5 | =. |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | .=l. |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | .>+-= |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | _;:, .> :=|. This program is free software; you can |
9 | ** packaging of this file. | 9 | .> <`_, > . <= redistribute it and/or modify it under |
10 | ** | 10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | .="- .-=="i, .._ License as published by the Free Software |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | - . .-<_> .<> Foundation; either version 2 of the License, |
13 | ** | 13 | ._= =} : or (at your option) any later version. |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | .%`+i> _;_. |
15 | ** | 15 | .i_,=:_. -<s. This program is distributed in the hope that |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
17 | ** not clear to you. | 17 | : .. .:, . . . without even the implied warranty of |
18 | ** | 18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | **********************************************************************/ | 19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= = ; Library General Public License for more | ||
21 | ++= -. .` .: details. | ||
22 | : = ...= . :.=- | ||
23 | -. .:....=;==+<; You should have received a copy of the GNU | ||
24 | -_. . . )=. = Library General Public License along with | ||
25 | -- :-=` this library; see the file COPYING.LIB. | ||
26 | If not, write to the Free Software Foundation, | ||
27 | Inc., 59 Temple Place - Suite 330, | ||
28 | Boston, MA 02111-1307, USA. | ||
29 | */ | ||
30 | |||
20 | #include "datebookweek.h" | 31 | #include "datebookweek.h" |
21 | #include "datebookweekheaderimpl.h" | 32 | #include "datebookweekheaderimpl.h" |
22 | #include "datebooktypes.h" | 33 | #include "datebooktypes.h" |
23 | 34 | ||
24 | #include <qpe/datebookdb.h> | 35 | #include <qpe/datebookdb.h> |
25 | #include <qpe/qpeapplication.h> | 36 | #include <qpe/qpeapplication.h> |
26 | #include <qpe/calendar.h> | 37 | #include <qpe/calendar.h> |
27 | 38 | ||
28 | #include <qheader.h> | 39 | #include <qheader.h> |
29 | #include <qlabel.h> | 40 | #include <qlabel.h> |
30 | #include <qlayout.h> | 41 | #include <qlayout.h> |
31 | #include <qtimer.h> | 42 | #include <qtimer.h> |
32 | 43 | ||
33 | //----------------------------------------------------------------- | 44 | //----------------------------------------------------------------- |
34 | 45 | ||
35 | 46 | ||
36 | DateBookWeekItem::DateBookWeekItem( const EffectiveEvent e ) | 47 | DateBookWeekItem::DateBookWeekItem( const EffectiveEvent e ) |
37 | : ev( e ) | 48 | : ev( e ) |
38 | { | 49 | { |
39 | // with the current implementation change the color for all day events | 50 | // with the current implementation change the color for all day events |
40 | if ( ev.event().type() == Event::AllDay && !ev.event().hasAlarm() ) { | 51 | if ( ev.event().type() == Event::AllDay && !ev.event().hasAlarm() ) { |
41 | c = Qt::green; | 52 | c = Qt::green; |
42 | } else { | 53 | } else { |
43 | c = ev.event().hasAlarm() ? Qt::red : Qt::blue; | 54 | c = ev.event().hasAlarm() ? Qt::red : Qt::blue; |
44 | } | 55 | } |
45 | } | 56 | } |
46 | 57 | ||
47 | void DateBookWeekItem::setGeometry( int x, int y, int w, int h ) | 58 | void DateBookWeekItem::setGeometry( int x, int y, int w, int h ) |
48 | { | 59 | { |
49 | r.setRect( x, y, w, h ); | 60 | r.setRect( x, y, w, h ); |
50 | } | 61 | } |
51 | 62 | ||
52 | 63 | ||
53 | //------------------=--------------------------------------------- | 64 | //------------------=--------------------------------------------- |
54 | 65 | ||
55 | DateBookWeekView::DateBookWeekView( bool ap, bool startOnMonday, | 66 | DateBookWeekView::DateBookWeekView( bool ap, bool startOnMonday, |
56 | QWidget *parent, const char *name ) | 67 | QWidget *parent, const char *name ) |
57 | : QScrollView( parent, name ), ampm( ap ), bOnMonday( startOnMonday ), | 68 | : QScrollView( parent, name ), ampm( ap ), bOnMonday( startOnMonday ), |
58 | showingEvent( false ) | 69 | showingEvent( false ) |
59 | { | 70 | { |
60 | items.setAutoDelete( true ); | 71 | items.setAutoDelete( true ); |
61 | 72 | ||
62 | viewport()->setBackgroundMode( PaletteBase ); | 73 | viewport()->setBackgroundMode( PaletteBase ); |
63 | 74 | ||
64 | header = new QHeader( this ); | 75 | header = new QHeader( this ); |
65 | header->addLabel( "" ); | 76 | header->addLabel( "" ); |
66 | 77 | ||
67 | header->setMovingEnabled( false ); | 78 | header->setMovingEnabled( false ); |
68 | header->setResizeEnabled( false ); | 79 | header->setResizeEnabled( false ); |
69 | header->setClickEnabled( false, 0 ); | 80 | header->setClickEnabled( false, 0 ); |
70 | initNames(); | 81 | initNames(); |
71 | 82 | ||
72 | 83 | ||
73 | connect( header, SIGNAL(clicked(int)), this, SIGNAL(showDay(int)) ); | 84 | connect( header, SIGNAL(clicked(int)), this, SIGNAL(showDay(int)) ); |
74 | 85 | ||
75 | QObject::connect(qApp, SIGNAL(clockChanged(bool)), | 86 | QObject::connect(qApp, SIGNAL(clockChanged(bool)), |
76 | this, SLOT(slotChangeClock(bool))); | 87 | this, SLOT(slotChangeClock(bool))); |
77 | 88 | ||
78 | QFontMetrics fm( font() ); | 89 | QFontMetrics fm( font() ); |
79 | rowHeight = fm.height()+2; | 90 | rowHeight = fm.height()+2; |
80 | 91 | ||
81 | resizeContents( width(), 24*rowHeight ); | 92 | resizeContents( width(), 24*rowHeight ); |
82 | } | 93 | } |
83 | 94 | ||
diff --git a/core/pim/datebook/datebookweek.h b/core/pim/datebook/datebookweek.h index ddf54ed..2d25f10 100644 --- a/core/pim/datebook/datebookweek.h +++ b/core/pim/datebook/datebookweek.h | |||
@@ -1,83 +1,94 @@ | |||
1 | /********************************************************************** | 1 | /* |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | This file is part of the Opie Project |
3 | ** | 3 | |
4 | ** This file is part of Qtopia Environment. | 4 | Copyright (C) Opie Team <opie-devel@handhelds.org> |
5 | ** | 5 | =. |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | .=l. |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | .>+-= |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | _;:, .> :=|. This program is free software; you can |
9 | ** packaging of this file. | 9 | .> <`_, > . <= redistribute it and/or modify it under |
10 | ** | 10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | .="- .-=="i, .._ License as published by the Free Software |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | - . .-<_> .<> Foundation; either version 2 of the License, |
13 | ** | 13 | ._= =} : or (at your option) any later version. |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | .%`+i> _;_. |
15 | ** | 15 | .i_,=:_. -<s. This program is distributed in the hope that |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
17 | ** not clear to you. | 17 | : .. .:, . . . without even the implied warranty of |
18 | ** | 18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | **********************************************************************/ | 19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= = ; Library General Public License for more | ||
21 | ++= -. .` .: details. | ||
22 | : = ...= . :.=- | ||
23 | -. .:....=;==+<; You should have received a copy of the GNU | ||
24 | -_. . . )=. = Library General Public License along with | ||
25 | -- :-=` this library; see the file COPYING.LIB. | ||
26 | If not, write to the Free Software Foundation, | ||
27 | Inc., 59 Temple Place - Suite 330, | ||
28 | Boston, MA 02111-1307, USA. | ||
29 | */ | ||
30 | |||
20 | #ifndef DATEBOOKWEEK | 31 | #ifndef DATEBOOKWEEK |
21 | #define DATEBOOKWEEK | 32 | #define DATEBOOKWEEK |
22 | 33 | ||
23 | #include <qpe/event.h> | 34 | #include <qpe/event.h> |
24 | 35 | ||
25 | #include <qlist.h> | 36 | #include <qlist.h> |
26 | #include <qscrollview.h> | 37 | #include <qscrollview.h> |
27 | #include <qstring.h> | 38 | #include <qstring.h> |
28 | #include <qvaluelist.h> | 39 | #include <qvaluelist.h> |
29 | 40 | ||
30 | class DateBookDB; | 41 | class DateBookDB; |
31 | class DateBookDBHoliday; | 42 | class DateBookDBHoliday; |
32 | class DateBookWeekHeader; | 43 | class DateBookWeekHeader; |
33 | class QDate; | 44 | class QDate; |
34 | class QLabel; | 45 | class QLabel; |
35 | class QResizeEvent; | 46 | class QResizeEvent; |
36 | class QSpinBox; | 47 | class QSpinBox; |
37 | class QTimer; | 48 | class QTimer; |
38 | class QHeader; | 49 | class QHeader; |
39 | 50 | ||
40 | class DateBookWeekItem | 51 | class DateBookWeekItem |
41 | { | 52 | { |
42 | public: | 53 | public: |
43 | DateBookWeekItem( const EffectiveEvent e ); | 54 | DateBookWeekItem( const EffectiveEvent e ); |
44 | 55 | ||
45 | void setGeometry( int x, int y, int w, int h ); | 56 | void setGeometry( int x, int y, int w, int h ); |
46 | QRect geometry() const { return r; } | 57 | QRect geometry() const { return r; } |
47 | 58 | ||
48 | const QColor &color() const { return c; } | 59 | const QColor &color() const { return c; } |
49 | const EffectiveEvent event() const { return ev; } | 60 | const EffectiveEvent event() const { return ev; } |
50 | 61 | ||
51 | private: | 62 | private: |
52 | const EffectiveEvent ev; | 63 | const EffectiveEvent ev; |
53 | QRect r; | 64 | QRect r; |
54 | QColor c; | 65 | QColor c; |
55 | }; | 66 | }; |
56 | 67 | ||
57 | class DateBookWeekView : public QScrollView | 68 | class DateBookWeekView : public QScrollView |
58 | { | 69 | { |
59 | Q_OBJECT | 70 | Q_OBJECT |
60 | public: | 71 | public: |
61 | DateBookWeekView( bool ampm, bool weekOnMonday, QWidget *parent = 0, | 72 | DateBookWeekView( bool ampm, bool weekOnMonday, QWidget *parent = 0, |
62 | const char *name = 0 ); | 73 | const char *name = 0 ); |
63 | 74 | ||
64 | bool whichClock() const; | 75 | bool whichClock() const; |
65 | void showEvents( QValueList<EffectiveEvent> &ev ); | 76 | void showEvents( QValueList<EffectiveEvent> &ev ); |
66 | void moveToHour( int h ); | 77 | void moveToHour( int h ); |
67 | void setStartOfWeek( bool bOnMonday ); | 78 | void setStartOfWeek( bool bOnMonday ); |
68 | 79 | ||
69 | signals: | 80 | signals: |
70 | void showDay( int d ); | 81 | void showDay( int d ); |
71 | void signalShowEvent( const EffectiveEvent & ); | 82 | void signalShowEvent( const EffectiveEvent & ); |
72 | void signalHideEvent(); | 83 | void signalHideEvent(); |
73 | 84 | ||
74 | protected slots: | 85 | protected slots: |
75 | void keyPressEvent(QKeyEvent *); | 86 | void keyPressEvent(QKeyEvent *); |
76 | 87 | ||
77 | private slots: | 88 | private slots: |
78 | void slotChangeClock( bool ); | 89 | void slotChangeClock( bool ); |
79 | void alterDay( int ); | 90 | void alterDay( int ); |
80 | 91 | ||
81 | private: | 92 | private: |
82 | void positionItem( DateBookWeekItem *i ); | 93 | void positionItem( DateBookWeekItem *i ); |
83 | DateBookWeekItem *intersects( const DateBookWeekItem * ); | 94 | DateBookWeekItem *intersects( const DateBookWeekItem * ); |
diff --git a/core/pim/datebook/datebookweekheaderimpl.cpp b/core/pim/datebook/datebookweekheaderimpl.cpp index 7462de7..9922778 100644 --- a/core/pim/datebook/datebookweekheaderimpl.cpp +++ b/core/pim/datebook/datebookweekheaderimpl.cpp | |||
@@ -1,107 +1,118 @@ | |||
1 | /********************************************************************** | 1 | /* |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | This file is part of the Opie Project |
3 | ** | 3 | |
4 | ** This file is part of Qtopia Environment. | 4 | Copyright (C) Opie Team <opie-devel@handhelds.org> |
5 | ** | 5 | =. |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | .=l. |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | .>+-= |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | _;:, .> :=|. This program is free software; you can |
9 | ** packaging of this file. | 9 | .> <`_, > . <= redistribute it and/or modify it under |
10 | ** | 10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | .="- .-=="i, .._ License as published by the Free Software |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | - . .-<_> .<> Foundation; either version 2 of the License, |
13 | ** | 13 | ._= =} : or (at your option) any later version. |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | .%`+i> _;_. |
15 | ** | 15 | .i_,=:_. -<s. This program is distributed in the hope that |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
17 | ** not clear to you. | 17 | : .. .:, . . . without even the implied warranty of |
18 | ** | 18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | **********************************************************************/ | 19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= = ; Library General Public License for more | ||
21 | ++= -. .` .: details. | ||
22 | : = ...= . :.=- | ||
23 | -. .:....=;==+<; You should have received a copy of the GNU | ||
24 | -_. . . )=. = Library General Public License along with | ||
25 | -- :-=` this library; see the file COPYING.LIB. | ||
26 | If not, write to the Free Software Foundation, | ||
27 | Inc., 59 Temple Place - Suite 330, | ||
28 | Boston, MA 02111-1307, USA. | ||
29 | */ | ||
30 | |||
20 | #include "datebookweekheaderimpl.h" | 31 | #include "datebookweekheaderimpl.h" |
21 | #include "datebookweek.h" | 32 | #include "datebookweek.h" |
22 | 33 | ||
23 | #include <opie2/odebug.h> | 34 | #include <opie2/odebug.h> |
35 | #include <opie2/oresource.h> | ||
24 | 36 | ||
25 | #include <qpe/resource.h> | ||
26 | #include <qpe/datebookmonth.h> | 37 | #include <qpe/datebookmonth.h> |
27 | 38 | ||
28 | #include <qtoolbutton.h> | 39 | #include <qtoolbutton.h> |
29 | 40 | ||
30 | /* | 41 | /* |
31 | * Constructs a DateBookWeekHeader which is a child of 'parent', with the | 42 | * Constructs a DateBookWeekHeader which is a child of 'parent', with the |
32 | * name 'name' and widget flags set to 'f' | 43 | * name 'name' and widget flags set to 'f' |
33 | */ | 44 | */ |
34 | DateBookWeekHeader::DateBookWeekHeader( bool startOnMonday, QWidget* parent, const char* name, WFlags fl ) | 45 | DateBookWeekHeader::DateBookWeekHeader( bool startOnMonday, QWidget* parent, const char* name, WFlags fl ) |
35 | : DateBookWeekHeaderBase( parent, name, fl ), | 46 | : DateBookWeekHeaderBase( parent, name, fl ), |
36 | bStartOnMonday( startOnMonday ) | 47 | bStartOnMonday( startOnMonday ) |
37 | { | 48 | { |
38 | setBackgroundMode( PaletteButton ); | 49 | setBackgroundMode( PaletteButton ); |
39 | labelDate->setBackgroundMode( PaletteButton ); | 50 | labelDate->setBackgroundMode( PaletteButton ); |
40 | backmonth->setPixmap( Resource::loadPixmap("fastback") ); | 51 | backmonth->setPixmap( Opie::Core::OResource::loadPixmap( "fastback", Opie::Core::OResource::SmallIcon ) ); |
41 | backweek->setPixmap( Resource::loadPixmap("back") ); | 52 | backweek->setPixmap( Opie::Core::OResource::loadPixmap( "back", Opie::Core::OResource::SmallIcon ) ); |
42 | forwardweek->setPixmap( Resource::loadPixmap("forward") ); | 53 | forwardweek->setPixmap( Opie::Core::OResource::loadPixmap( "forward", Opie::Core::OResource::SmallIcon ) ); |
43 | forwardmonth->setPixmap( Resource::loadPixmap("fastforward") ); | 54 | forwardmonth->setPixmap( Opie::Core::OResource::loadPixmap( "fastforward", Opie::Core::OResource::SmallIcon ) ); |
44 | } | 55 | } |
45 | 56 | ||
46 | /* | 57 | /* |
47 | * Destroys the object and frees any allocated resources | 58 | * Destroys the object and frees any allocated resources |
48 | */ | 59 | */ |
49 | DateBookWeekHeader::~DateBookWeekHeader() | 60 | DateBookWeekHeader::~DateBookWeekHeader() |
50 | { | 61 | { |
51 | // no need to delete child widgets, Qt does it all for us | 62 | // no need to delete child widgets, Qt does it all for us |
52 | } | 63 | } |
53 | 64 | ||
54 | void DateBookWeekHeader::pickDate() | 65 | void DateBookWeekHeader::pickDate() |
55 | { | 66 | { |
56 | static QPopupMenu *m1 = 0; | 67 | static QPopupMenu *m1 = 0; |
57 | static DateBookMonth *picker = 0; | 68 | static DateBookMonth *picker = 0; |
58 | if ( !m1 ) { | 69 | if ( !m1 ) { |
59 | m1 = new QPopupMenu( this ); | 70 | m1 = new QPopupMenu( this ); |
60 | picker = new DateBookMonth( m1, 0, TRUE ); | 71 | picker = new DateBookMonth( m1, 0, TRUE ); |
61 | m1->insertItem( picker ); | 72 | m1->insertItem( picker ); |
62 | connect( picker, SIGNAL( dateClicked(int,int,int) ), this, SLOT( setDate(int,int,int) ) ); | 73 | connect( picker, SIGNAL( dateClicked(int,int,int) ), this, SLOT( setDate(int,int,int) ) ); |
63 | // connect( m1, SIGNAL( aboutToHide() ), this, SLOT( gotHide() ) ); | 74 | // connect( m1, SIGNAL( aboutToHide() ), this, SLOT( gotHide() ) ); |
64 | } | 75 | } |
65 | picker->setDate( date.year(), date.month(), date.day() ); | 76 | picker->setDate( date.year(), date.month(), date.day() ); |
66 | m1->popup(mapToGlobal(labelDate->pos()+QPoint(0,labelDate->height()))); | 77 | m1->popup(mapToGlobal(labelDate->pos()+QPoint(0,labelDate->height()))); |
67 | picker->setFocus(); | 78 | picker->setFocus(); |
68 | } | 79 | } |
69 | 80 | ||
70 | void DateBookWeekHeader::nextMonth() | 81 | void DateBookWeekHeader::nextMonth() |
71 | { | 82 | { |
72 | owarn << "nextMonth()" << oendl; | 83 | owarn << "nextMonth()" << oendl; |
73 | setDate(date.addDays(28)); | 84 | setDate(date.addDays(28)); |
74 | } | 85 | } |
75 | void DateBookWeekHeader::prevMonth() | 86 | void DateBookWeekHeader::prevMonth() |
76 | { | 87 | { |
77 | owarn << "prevMonth()" << oendl; | 88 | owarn << "prevMonth()" << oendl; |
78 | setDate(date.addDays(-28)); | 89 | setDate(date.addDays(-28)); |
79 | } | 90 | } |
80 | void DateBookWeekHeader::nextWeek() | 91 | void DateBookWeekHeader::nextWeek() |
81 | { | 92 | { |
82 | owarn << "nextWeek()" << oendl; | 93 | owarn << "nextWeek()" << oendl; |
83 | setDate(date.addDays(7)); | 94 | setDate(date.addDays(7)); |
84 | } | 95 | } |
85 | void DateBookWeekHeader::prevWeek() | 96 | void DateBookWeekHeader::prevWeek() |
86 | { | 97 | { |
87 | owarn << "prevWeek()" << oendl; | 98 | owarn << "prevWeek()" << oendl; |
88 | setDate(date.addDays(-7)); | 99 | setDate(date.addDays(-7)); |
89 | } | 100 | } |
90 | 101 | ||
91 | void DateBookWeekHeader::setDate( int y, int m, int d ) | 102 | void DateBookWeekHeader::setDate( int y, int m, int d ) |
92 | { | 103 | { |
93 | setDate(QDate(y,m,d)); | 104 | setDate(QDate(y,m,d)); |
94 | } | 105 | } |
95 | 106 | ||
96 | void DateBookWeekHeader::setDate(const QDate &d) { | 107 | void DateBookWeekHeader::setDate(const QDate &d) { |
97 | int year,week,dayofweek; | 108 | int year,week,dayofweek; |
98 | date=d; | 109 | date=d; |
99 | dayofweek=d.dayOfWeek(); | 110 | dayofweek=d.dayOfWeek(); |
100 | if(bStartOnMonday) | 111 | if(bStartOnMonday) |
101 | dayofweek--; | 112 | dayofweek--; |
102 | else if( dayofweek == 7 ) | 113 | else if( dayofweek == 7 ) |
103 | // we already have the right day -7 would lead to the current week.. | 114 | // we already have the right day -7 would lead to the current week.. |
104 | dayofweek = 0; | 115 | dayofweek = 0; |
105 | 116 | ||
106 | date=date.addDays(-dayofweek); | 117 | date=date.addDays(-dayofweek); |
107 | calcWeek(date,week,year,bStartOnMonday); | 118 | calcWeek(date,week,year,bStartOnMonday); |
diff --git a/core/pim/datebook/datebookweekheaderimpl.h b/core/pim/datebook/datebookweekheaderimpl.h index d8dce90..0b388b4 100644 --- a/core/pim/datebook/datebookweekheaderimpl.h +++ b/core/pim/datebook/datebookweekheaderimpl.h | |||
@@ -1,57 +1,68 @@ | |||
1 | /********************************************************************** | 1 | /* |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | This file is part of the Opie Project |
3 | ** | 3 | |
4 | ** This file is part of Qtopia Environment. | 4 | Copyright (C) Opie Team <opie-devel@handhelds.org> |
5 | ** | 5 | =. |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | .=l. |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | .>+-= |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | _;:, .> :=|. This program is free software; you can |
9 | ** packaging of this file. | 9 | .> <`_, > . <= redistribute it and/or modify it under |
10 | ** | 10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | .="- .-=="i, .._ License as published by the Free Software |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | - . .-<_> .<> Foundation; either version 2 of the License, |
13 | ** | 13 | ._= =} : or (at your option) any later version. |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | .%`+i> _;_. |
15 | ** | 15 | .i_,=:_. -<s. This program is distributed in the hope that |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
17 | ** not clear to you. | 17 | : .. .:, . . . without even the implied warranty of |
18 | ** | 18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | **********************************************************************/ | 19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= = ; Library General Public License for more | ||
21 | ++= -. .` .: details. | ||
22 | : = ...= . :.=- | ||
23 | -. .:....=;==+<; You should have received a copy of the GNU | ||
24 | -_. . . )=. = Library General Public License along with | ||
25 | -- :-=` this library; see the file COPYING.LIB. | ||
26 | If not, write to the Free Software Foundation, | ||
27 | Inc., 59 Temple Place - Suite 330, | ||
28 | Boston, MA 02111-1307, USA. | ||
29 | */ | ||
30 | |||
20 | #ifndef DATEBOOKDAYHEADER_H | 31 | #ifndef DATEBOOKDAYHEADER_H |
21 | #define DATEBOOKDAYHEADER_H | 32 | #define DATEBOOKDAYHEADER_H |
22 | #include <qdatetime.h> | 33 | #include <qdatetime.h> |
23 | #include "datebookweekheader.h" | 34 | #include "datebookweekheader.h" |
24 | 35 | ||
25 | 36 | ||
26 | class DateBookWeekHeader : public DateBookWeekHeaderBase | 37 | class DateBookWeekHeader : public DateBookWeekHeaderBase |
27 | { | 38 | { |
28 | Q_OBJECT | 39 | Q_OBJECT |
29 | 40 | ||
30 | public: | 41 | public: |
31 | DateBookWeekHeader( bool startOnMonday, QWidget* parent = 0, | 42 | DateBookWeekHeader( bool startOnMonday, QWidget* parent = 0, |
32 | const char* name = 0, WFlags fl = 0 ); | 43 | const char* name = 0, WFlags fl = 0 ); |
33 | ~DateBookWeekHeader(); | 44 | ~DateBookWeekHeader(); |
34 | 45 | ||
35 | void setDate(const QDate &d); | 46 | void setDate(const QDate &d); |
36 | void setStartOfWeek( bool onMonday ); | 47 | void setStartOfWeek( bool onMonday ); |
37 | 48 | ||
38 | signals: | 49 | signals: |
39 | void dateChanged( QDate &date ); | 50 | void dateChanged( QDate &date ); |
40 | 51 | ||
41 | public slots: | 52 | public slots: |
42 | void pickDate(); | 53 | void pickDate(); |
43 | void nextMonth(); | 54 | void nextMonth(); |
44 | void prevMonth(); | 55 | void prevMonth(); |
45 | void nextWeek(); | 56 | void nextWeek(); |
46 | void prevWeek(); | 57 | void prevWeek(); |
47 | void setDate( int y, int m, int d); | 58 | void setDate( int y, int m, int d); |
48 | 59 | ||
49 | protected slots: | 60 | protected slots: |
50 | void keyPressEvent(QKeyEvent *e) { e->ignore(); } | 61 | void keyPressEvent(QKeyEvent *e) { e->ignore(); } |
51 | 62 | ||
52 | private: | 63 | private: |
53 | QDate date; | 64 | QDate date; |
54 | bool bStartOnMonday; | 65 | bool bStartOnMonday; |
55 | }; | 66 | }; |
56 | 67 | ||
57 | #endif // DATEBOOKDAYHEADER_H | 68 | #endif // DATEBOOKDAYHEADER_H |
diff --git a/core/pim/datebook/dateentryimpl.cpp b/core/pim/datebook/dateentryimpl.cpp index 297da94..adfa33f 100644 --- a/core/pim/datebook/dateentryimpl.cpp +++ b/core/pim/datebook/dateentryimpl.cpp | |||
@@ -1,83 +1,93 @@ | |||
1 | /********************************************************************** | 1 | /* |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | This file is part of the Opie Project |
3 | ** | 3 | |
4 | ** This file is part of Qtopia Environment. | 4 | Copyright (C) Opie Team <opie-devel@handhelds.org> |
5 | ** | 5 | =. |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | .=l. |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | .>+-= |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | _;:, .> :=|. This program is free software; you can |
9 | ** packaging of this file. | 9 | .> <`_, > . <= redistribute it and/or modify it under |
10 | ** | 10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | .="- .-=="i, .._ License as published by the Free Software |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | - . .-<_> .<> Foundation; either version 2 of the License, |
13 | ** | 13 | ._= =} : or (at your option) any later version. |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | .%`+i> _;_. |
15 | ** | 15 | .i_,=:_. -<s. This program is distributed in the hope that |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
17 | ** not clear to you. | 17 | : .. .:, . . . without even the implied warranty of |
18 | ** | 18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | **********************************************************************/ | 19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= = ; Library General Public License for more | ||
21 | ++= -. .` .: details. | ||
22 | : = ...= . :.=- | ||
23 | -. .:....=;==+<; You should have received a copy of the GNU | ||
24 | -_. . . )=. = Library General Public License along with | ||
25 | -- :-=` this library; see the file COPYING.LIB. | ||
26 | If not, write to the Free Software Foundation, | ||
27 | Inc., 59 Temple Place - Suite 330, | ||
28 | Boston, MA 02111-1307, USA. | ||
29 | */ | ||
20 | 30 | ||
21 | #include "namespace_hack.h" | 31 | #include "namespace_hack.h" |
22 | #include "dateentryimpl.h" | 32 | #include "dateentryimpl.h" |
23 | #include "repeatentry.h" | 33 | #include "repeatentry.h" |
24 | 34 | ||
25 | #include <opie2/odebug.h> | 35 | #include <opie2/odebug.h> |
26 | #include <opie2/otimepicker.h> | 36 | #include <opie2/otimepicker.h> |
27 | 37 | ||
28 | #include <qpe/qpeapplication.h> | 38 | #include <qpe/qpeapplication.h> |
29 | #include <qpe/categoryselect.h> | 39 | #include <qpe/categoryselect.h> |
30 | #include <qpe/datebookmonth.h> | 40 | #include <qpe/datebookmonth.h> |
31 | #include <qpe/tzselect.h> | 41 | #include <qpe/tzselect.h> |
32 | 42 | ||
33 | #include <qlineedit.h> | 43 | #include <qlineedit.h> |
34 | #include <qspinbox.h> | 44 | #include <qspinbox.h> |
35 | 45 | ||
36 | #include "onoteedit.h" | 46 | #include "onoteedit.h" |
37 | 47 | ||
38 | #include <stdlib.h> | 48 | #include <stdlib.h> |
39 | #include <stdio.h> | 49 | #include <stdio.h> |
40 | 50 | ||
41 | /* | 51 | /* |
42 | * Constructs a DateEntry which is a child of 'parent', with the | 52 | * Constructs a DateEntry which is a child of 'parent', with the |
43 | * name 'name' and widget flags set to 'f' | 53 | * name 'name' and widget flags set to 'f' |
44 | * | 54 | * |
45 | * The dialog will by default be modeless, unless you set 'modal' to | 55 | * The dialog will by default be modeless, unless you set 'modal' to |
46 | * TRUE to construct a modal dialog. | 56 | * TRUE to construct a modal dialog. |
47 | */ | 57 | */ |
48 | 58 | ||
49 | DateEntry::DateEntry( bool startOnMonday, const QDateTime &start, | 59 | DateEntry::DateEntry( bool startOnMonday, const QDateTime &start, |
50 | const QDateTime &end, bool whichClock, QWidget* parent, | 60 | const QDateTime &end, bool whichClock, QWidget* parent, |
51 | const char* name ) | 61 | const char* name ) |
52 | : DateEntryBase( parent, name ), | 62 | : DateEntryBase( parent, name ), |
53 | ampm( whichClock ), | 63 | ampm( whichClock ), |
54 | startWeekOnMonday( startOnMonday ), | 64 | startWeekOnMonday( startOnMonday ), |
55 | m_showStart(true) | 65 | m_showStart(true) |
56 | { | 66 | { |
57 | init(); | 67 | init(); |
58 | setDates(start,end); | 68 | setDates(start,end); |
59 | setFocusProxy(comboDescription); | 69 | setFocusProxy(comboDescription); |
60 | } | 70 | } |
61 | 71 | ||
62 | bool DateEntry::eventFilter(QObject *obj, QEvent *ev ) | 72 | bool DateEntry::eventFilter(QObject *obj, QEvent *ev ) |
63 | { | 73 | { |
64 | if( ev->type() == QEvent::FocusIn ){ | 74 | if( ev->type() == QEvent::FocusIn ){ |
65 | if( obj == comboStart ){ | 75 | if( obj == comboStart ){ |
66 | timePickerStart->setHour(startTime.hour()); | 76 | timePickerStart->setHour(startTime.hour()); |
67 | timePickerStart->setMinute(startTime.minute()); | 77 | timePickerStart->setMinute(startTime.minute()); |
68 | TimePickerLabel->setText( tr("Start Time" ) ); | 78 | TimePickerLabel->setText( tr("Start Time" ) ); |
69 | m_showStart= true; | 79 | m_showStart= true; |
70 | }else if( obj == comboEnd ){ | 80 | }else if( obj == comboEnd ){ |
71 | timePickerStart->setHour(endTime.hour()); | 81 | timePickerStart->setHour(endTime.hour()); |
72 | timePickerStart->setMinute(endTime.minute()); | 82 | timePickerStart->setMinute(endTime.minute()); |
73 | TimePickerLabel->setText( tr("End Time") ); | 83 | TimePickerLabel->setText( tr("End Time") ); |
74 | m_showStart = false; | 84 | m_showStart = false; |
75 | } | 85 | } |
76 | } else if( ev->type() == QEvent::FocusOut ){ | 86 | } else if( ev->type() == QEvent::FocusOut ){ |
77 | // if( obj == comboEnd ){ | 87 | // if( obj == comboEnd ){ |
78 | // QString s; | 88 | // QString s; |
79 | // s.sprintf("%.2d:%.2d",endTime.hour(), endTime.minute()); | 89 | // s.sprintf("%.2d:%.2d",endTime.hour(), endTime.minute()); |
80 | // comboEnd->setText(s); | 90 | // comboEnd->setText(s); |
81 | // } | 91 | // } |
82 | // else if( obj == comboStart ){ | 92 | // else if( obj == comboStart ){ |
83 | // QString s; | 93 | // QString s; |
diff --git a/core/pim/datebook/dateentryimpl.h b/core/pim/datebook/dateentryimpl.h index a3c4668..2d23ed1 100644 --- a/core/pim/datebook/dateentryimpl.h +++ b/core/pim/datebook/dateentryimpl.h | |||
@@ -1,79 +1,90 @@ | |||
1 | /********************************************************************** | 1 | /* |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | This file is part of the Opie Project |
3 | ** | 3 | |
4 | ** This file is part of Qtopia Environment. | 4 | Copyright (C) Opie Team <opie-devel@handhelds.org> |
5 | ** | 5 | =. |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | .=l. |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | .>+-= |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | _;:, .> :=|. This program is free software; you can |
9 | ** packaging of this file. | 9 | .> <`_, > . <= redistribute it and/or modify it under |
10 | ** | 10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | .="- .-=="i, .._ License as published by the Free Software |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | - . .-<_> .<> Foundation; either version 2 of the License, |
13 | ** | 13 | ._= =} : or (at your option) any later version. |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | .%`+i> _;_. |
15 | ** | 15 | .i_,=:_. -<s. This program is distributed in the hope that |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
17 | ** not clear to you. | 17 | : .. .:, . . . without even the implied warranty of |
18 | ** | 18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | **********************************************************************/ | 19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= = ; Library General Public License for more | ||
21 | ++= -. .` .: details. | ||
22 | : = ...= . :.=- | ||
23 | -. .:....=;==+<; You should have received a copy of the GNU | ||
24 | -_. . . )=. = Library General Public License along with | ||
25 | -- :-=` this library; see the file COPYING.LIB. | ||
26 | If not, write to the Free Software Foundation, | ||
27 | Inc., 59 Temple Place - Suite 330, | ||
28 | Boston, MA 02111-1307, USA. | ||
29 | */ | ||
30 | |||
20 | #ifndef DATEENTRY_H | 31 | #ifndef DATEENTRY_H |
21 | #define DATEENTRY_H | 32 | #define DATEENTRY_H |
22 | 33 | ||
23 | #include "dateentry.h" | 34 | #include "dateentry.h" |
24 | #include "noteentryimpl.h" | 35 | #include "noteentryimpl.h" |
25 | 36 | ||
26 | #include <qpe/event.h> | 37 | #include <qpe/event.h> |
27 | 38 | ||
28 | #include <qdatetime.h> | 39 | #include <qdatetime.h> |
29 | 40 | ||
30 | class DateBookMonth; | 41 | class DateBookMonth; |
31 | 42 | ||
32 | class DateEntry : public DateEntryBase | 43 | class DateEntry : public DateEntryBase |
33 | { | 44 | { |
34 | Q_OBJECT | 45 | Q_OBJECT |
35 | 46 | ||
36 | public: | 47 | public: |
37 | DateEntry( bool startOnMonday, const QDateTime &start, | 48 | DateEntry( bool startOnMonday, const QDateTime &start, |
38 | const QDateTime &end, bool whichClock = FALSE, | 49 | const QDateTime &end, bool whichClock = FALSE, |
39 | QWidget* parent = 0, const char* name = 0 ); | 50 | QWidget* parent = 0, const char* name = 0 ); |
40 | DateEntry( bool startOnMonday, const Event &event, bool whichCLock = FALSE, | 51 | DateEntry( bool startOnMonday, const Event &event, bool whichCLock = FALSE, |
41 | QWidget* parent = 0, const char* name = 0 ); | 52 | QWidget* parent = 0, const char* name = 0 ); |
42 | ~DateEntry(); | 53 | ~DateEntry(); |
43 | 54 | ||
44 | Event event(); | 55 | Event event(); |
45 | void setAlarmEnabled( bool alarmPreset, int presetTime, Event::SoundTypeChoice ); | 56 | void setAlarmEnabled( bool alarmPreset, int presetTime, Event::SoundTypeChoice ); |
46 | virtual bool eventFilter( QObject *, QEvent * ); | 57 | virtual bool eventFilter( QObject *, QEvent * ); |
47 | public slots: | 58 | public slots: |
48 | void endDateChanged( int, int, int ); | 59 | void endDateChanged( int, int, int ); |
49 | void endTimeChanged( const QString & ); | 60 | void endTimeChanged( const QString & ); |
50 | void endTimeChanged( const QTime & ); | 61 | void endTimeChanged( const QTime & ); |
51 | void startDateChanged(int, int, int); | 62 | void startDateChanged(int, int, int); |
52 | void startTimeEdited( const QString & ); | 63 | void startTimeEdited( const QString & ); |
53 | void startTimeChanged( const QTime & ); | 64 | void startTimeChanged( const QTime & ); |
54 | void startTimePicked( const QTime & ); | 65 | void startTimePicked( const QTime & ); |
55 | void typeChanged( const QString & ); | 66 | void typeChanged( const QString & ); |
56 | void slotRepeat(); | 67 | void slotRepeat(); |
57 | void slotChangeClock( bool ); | 68 | void slotChangeClock( bool ); |
58 | void slotChangeStartOfWeek( bool ); | 69 | void slotChangeStartOfWeek( bool ); |
59 | void slotEditNote(); | 70 | void slotEditNote(); |
60 | 71 | ||
61 | private: | 72 | private: |
62 | void init(); | 73 | void init(); |
63 | void initCombos(); | 74 | void initCombos(); |
64 | void setDates( const QDateTime& s, const QDateTime& e ); | 75 | void setDates( const QDateTime& s, const QDateTime& e ); |
65 | void setRepeatLabel(); | 76 | void setRepeatLabel(); |
66 | void updateTimeEdit(bool,bool); | 77 | void updateTimeEdit(bool,bool); |
67 | 78 | ||
68 | DateBookMonth *startPicker, *endPicker; | 79 | DateBookMonth *startPicker, *endPicker; |
69 | QDate startDate, endDate; | 80 | QDate startDate, endDate; |
70 | QTime startTime, endTime; | 81 | QTime startTime, endTime; |
71 | Event::RepeatPattern rp; | 82 | Event::RepeatPattern rp; |
72 | bool ampm:1; | 83 | bool ampm:1; |
73 | bool startWeekOnMonday:1; | 84 | bool startWeekOnMonday:1; |
74 | bool m_showStart:1; | 85 | bool m_showStart:1; |
75 | 86 | ||
76 | QString noteStr; | 87 | QString noteStr; |
77 | }; | 88 | }; |
78 | 89 | ||
79 | #endif // DATEENTRY_H | 90 | #endif // DATEENTRY_H |
diff --git a/core/pim/datebook/main.cpp b/core/pim/datebook/main.cpp index 3cb60af..e96e769 100644 --- a/core/pim/datebook/main.cpp +++ b/core/pim/datebook/main.cpp | |||
@@ -1,25 +1,35 @@ | |||
1 | /********************************************************************** | 1 | /* |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | This file is part of the Opie Project |
3 | ** | 3 | |
4 | ** This file is part of Qtopia Environment. | 4 | Copyright (C) Opie Team <opie-devel@handhelds.org> |
5 | ** | 5 | =. |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | .=l. |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | .>+-= |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | _;:, .> :=|. This program is free software; you can |
9 | ** packaging of this file. | 9 | .> <`_, > . <= redistribute it and/or modify it under |
10 | ** | 10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | .="- .-=="i, .._ License as published by the Free Software |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | - . .-<_> .<> Foundation; either version 2 of the License, |
13 | ** | 13 | ._= =} : or (at your option) any later version. |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | .%`+i> _;_. |
15 | ** | 15 | .i_,=:_. -<s. This program is distributed in the hope that |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
17 | ** not clear to you. | 17 | : .. .:, . . . without even the implied warranty of |
18 | ** | 18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | **********************************************************************/ | 19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= = ; Library General Public License for more | ||
21 | ++= -. .` .: details. | ||
22 | : = ...= . :.=- | ||
23 | -. .:....=;==+<; You should have received a copy of the GNU | ||
24 | -_. . . )=. = Library General Public License along with | ||
25 | -- :-=` this library; see the file COPYING.LIB. | ||
26 | If not, write to the Free Software Foundation, | ||
27 | Inc., 59 Temple Place - Suite 330, | ||
28 | Boston, MA 02111-1307, USA. | ||
29 | */ | ||
20 | 30 | ||
21 | #include "datebook.h" | 31 | #include "datebook.h" |
22 | #include <opie2/oapplicationfactory.h> | 32 | #include <opie2/oapplicationfactory.h> |
23 | 33 | ||
24 | using namespace Opie::Core; | 34 | using namespace Opie::Core; |
25 | OPIE_EXPORT_APP( OApplicationFactory<DateBook> ) | 35 | OPIE_EXPORT_APP( OApplicationFactory<DateBook> ) |
diff --git a/core/pim/datebook/modules/weeklst/datebookweeklst.cpp b/core/pim/datebook/modules/weeklst/datebookweeklst.cpp index 6556373..b36bf6d 100644 --- a/core/pim/datebook/modules/weeklst/datebookweeklst.cpp +++ b/core/pim/datebook/modules/weeklst/datebookweeklst.cpp | |||
@@ -1,77 +1,76 @@ | |||
1 | #include "namespace_hack.h" | 1 | #include "namespace_hack.h" |
2 | #include "datebookweeklst.h" | 2 | #include "datebookweeklst.h" |
3 | #include "datebookweeklstheader.h" | 3 | #include "datebookweeklstheader.h" |
4 | #include "datebookweeklstview.h" | 4 | #include "datebookweeklstview.h" |
5 | #include "datebookweeklstdblview.h" | 5 | #include "datebookweeklstdblview.h" |
6 | 6 | ||
7 | #include "datebook.h" | 7 | #include "datebook.h" |
8 | 8 | ||
9 | #include <opie2/odebug.h> | 9 | #include <opie2/odebug.h> |
10 | 10 | ||
11 | #include <qpe/datebookmonth.h> | 11 | #include <qpe/datebookmonth.h> |
12 | #include <qpe/config.h> | 12 | #include <qpe/config.h> |
13 | #include <qpe/resource.h> | ||
14 | 13 | ||
15 | #include <qlayout.h> | 14 | #include <qlayout.h> |
16 | #include <qtoolbutton.h> | 15 | #include <qtoolbutton.h> |
17 | 16 | ||
18 | using namespace Opie::Ui; | 17 | using namespace Opie::Ui; |
19 | 18 | ||
20 | DateBookWeekLst::DateBookWeekLst( bool ap, bool onM, DateBookDBHoliday *newDB, | 19 | DateBookWeekLst::DateBookWeekLst( bool ap, bool onM, DateBookDBHoliday *newDB, |
21 | QWidget *parent, | 20 | QWidget *parent, |
22 | const char *name ) | 21 | const char *name ) |
23 | : QWidget( parent, name ), | 22 | : QWidget( parent, name ), |
24 | db( newDB ), | 23 | db( newDB ), |
25 | startTime( 0 ), | 24 | startTime( 0 ), |
26 | ampm( ap ), | 25 | ampm( ap ), |
27 | bStartOnMonday(onM) | 26 | bStartOnMonday(onM) |
28 | { | 27 | { |
29 | setFocusPolicy(StrongFocus); | 28 | setFocusPolicy(StrongFocus); |
30 | dateset = false; | 29 | dateset = false; |
31 | layout = new QVBoxLayout( this ); | 30 | layout = new QVBoxLayout( this ); |
32 | layout->setMargin(0); | 31 | layout->setMargin(0); |
33 | 32 | ||
34 | header=new DateBookWeekLstHeader(onM, this); | 33 | header=new DateBookWeekLstHeader(onM, this); |
35 | layout->addWidget( header ); | 34 | layout->addWidget( header ); |
36 | connect(header, SIGNAL(dateChanged(QDate&)), this, SLOT(dateChanged(QDate&))); | 35 | connect(header, SIGNAL(dateChanged(QDate&)), this, SLOT(dateChanged(QDate&))); |
37 | connect(header, SIGNAL(setDbl(bool)), this, SLOT(setDbl(bool))); | 36 | connect(header, SIGNAL(setDbl(bool)), this, SLOT(setDbl(bool))); |
38 | 37 | ||
39 | scroll=new QScrollView(this); | 38 | scroll=new QScrollView(this); |
40 | scroll->setResizePolicy(QScrollView::AutoOneFit); | 39 | scroll->setResizePolicy(QScrollView::AutoOneFit); |
41 | layout->addWidget(scroll); | 40 | layout->addWidget(scroll); |
42 | 41 | ||
43 | m_CurrentView=NULL; | 42 | m_CurrentView=NULL; |
44 | Config config("DateBook"); | 43 | Config config("DateBook"); |
45 | config.setGroup("Main"); | 44 | config.setGroup("Main"); |
46 | dbl=config.readBoolEntry("weeklst_dbl", false); | 45 | dbl=config.readBoolEntry("weeklst_dbl", false); |
47 | header->dbl->setOn(dbl); | 46 | header->dbl->setOn(dbl); |
48 | } | 47 | } |
49 | 48 | ||
50 | DateBookWeekLst::~DateBookWeekLst(){ | 49 | DateBookWeekLst::~DateBookWeekLst(){ |
51 | Config config("DateBook"); | 50 | Config config("DateBook"); |
52 | config.setGroup("Main"); | 51 | config.setGroup("Main"); |
53 | config.writeEntry("weeklst_dbl", dbl); | 52 | config.writeEntry("weeklst_dbl", dbl); |
54 | } | 53 | } |
55 | 54 | ||
56 | void DateBookWeekLst::setDate(const QDate &d) { | 55 | void DateBookWeekLst::setDate(const QDate &d) { |
57 | bdate=d; | 56 | bdate=d; |
58 | header->setDate(d); | 57 | header->setDate(d); |
59 | } | 58 | } |
60 | 59 | ||
61 | void DateBookWeekLst::setDbl(bool on) { | 60 | void DateBookWeekLst::setDbl(bool on) { |
62 | dbl=on; | 61 | dbl=on; |
63 | bool displayed = false; | 62 | bool displayed = false; |
64 | if (m_CurrentView) { | 63 | if (m_CurrentView) { |
65 | displayed = m_CurrentView->toggleDoubleView(on); | 64 | displayed = m_CurrentView->toggleDoubleView(on); |
66 | } | 65 | } |
67 | if (!displayed||dbl) { | 66 | if (!displayed||dbl) { |
68 | getEvents(); | 67 | getEvents(); |
69 | } | 68 | } |
70 | } | 69 | } |
71 | 70 | ||
72 | void DateBookWeekLst::redraw() {getEvents();} | 71 | void DateBookWeekLst::redraw() {getEvents();} |
73 | 72 | ||
74 | QDate DateBookWeekLst::date() { | 73 | QDate DateBookWeekLst::date() { |
75 | return bdate; | 74 | return bdate; |
76 | } | 75 | } |
77 | 76 | ||
diff --git a/core/pim/datebook/modules/weeklst/datebookweeklstheader.cpp b/core/pim/datebook/modules/weeklst/datebookweeklstheader.cpp index 81e0c31..2da9c22 100644 --- a/core/pim/datebook/modules/weeklst/datebookweeklstheader.cpp +++ b/core/pim/datebook/modules/weeklst/datebookweeklstheader.cpp | |||
@@ -1,88 +1,89 @@ | |||
1 | #include "datebookweeklstheader.h" | 1 | #include "datebookweeklstheader.h" |
2 | 2 | ||
3 | #include <qpe/resource.h> | 3 | #include <opie2/oresource.h> |
4 | |||
4 | #include <qpe/datebookmonth.h> | 5 | #include <qpe/datebookmonth.h> |
5 | 6 | ||
6 | #include <qtoolbutton.h> | 7 | #include <qtoolbutton.h> |
7 | #include <qlayout.h> | 8 | #include <qlayout.h> |
8 | 9 | ||
9 | /* implenented in datebookweek.cpp - HELL */ | 10 | /* implenented in datebookweek.cpp - HELL */ |
10 | bool calcWeek(const QDate &d, int &week, int &year,bool startOnMonday = false); | 11 | bool calcWeek(const QDate &d, int &week, int &year,bool startOnMonday = false); |
11 | 12 | ||
12 | DateBookWeekLstHeader::DateBookWeekLstHeader(bool onM, QWidget* parent, const char* name, WFlags fl) | 13 | DateBookWeekLstHeader::DateBookWeekLstHeader(bool onM, QWidget* parent, const char* name, WFlags fl) |
13 | : DateBookWeekLstHeaderBase(parent, name, fl) | 14 | : DateBookWeekLstHeaderBase(parent, name, fl) |
14 | { | 15 | { |
15 | setBackgroundMode( PaletteButton ); | 16 | setBackgroundMode( PaletteButton ); |
16 | labelDate->setBackgroundMode( PaletteButton ); | 17 | labelDate->setBackgroundMode( PaletteButton ); |
17 | forwardweek->setBackgroundMode( PaletteButton ); | 18 | forwardweek->setBackgroundMode( PaletteButton ); |
18 | forwardweek->setPixmap( Resource::loadPixmap("forward") ); | 19 | forwardweek->setPixmap( Opie::Core::OResource::loadPixmap( "forward", Opie::Core::OResource::SmallIcon ) ); |
19 | forwardmonth->setBackgroundMode( PaletteButton ); | 20 | forwardmonth->setBackgroundMode( PaletteButton ); |
20 | forwardmonth->setPixmap( Resource::loadPixmap("fastforward") ); | 21 | forwardmonth->setPixmap( Opie::Core::OResource::loadPixmap( "fastforward", Opie::Core::OResource::SmallIcon ) ); |
21 | backweek->setBackgroundMode( PaletteButton ); | 22 | backweek->setBackgroundMode( PaletteButton ); |
22 | backweek->setPixmap( Resource::loadPixmap("back") ); | 23 | backweek->setPixmap( Opie::Core::OResource::loadPixmap( "back", Opie::Core::OResource::SmallIcon ) ); |
23 | backmonth->setBackgroundMode( PaletteButton ); | 24 | backmonth->setBackgroundMode( PaletteButton ); |
24 | backmonth->setPixmap( Resource::loadPixmap("fastback") ); | 25 | backmonth->setPixmap( Opie::Core::OResource::loadPixmap( "fastback", Opie::Core::OResource::SmallIcon ) ); |
25 | DateBookWeekLstHeaderBaseLayout->setSpacing(0); | 26 | DateBookWeekLstHeaderBaseLayout->setSpacing(0); |
26 | DateBookWeekLstHeaderBaseLayout->setMargin(0); | 27 | DateBookWeekLstHeaderBaseLayout->setMargin(0); |
27 | //setSizePolicy(QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Expanding)); | 28 | //setSizePolicy(QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Expanding)); |
28 | setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed)); | 29 | setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed)); |
29 | 30 | ||
30 | connect(backmonth, SIGNAL(clicked()), this, SLOT(prevMonth())); | 31 | connect(backmonth, SIGNAL(clicked()), this, SLOT(prevMonth())); |
31 | connect(backweek, SIGNAL(clicked()), this, SLOT(prevWeek())); | 32 | connect(backweek, SIGNAL(clicked()), this, SLOT(prevWeek())); |
32 | connect(forwardweek, SIGNAL(clicked()), this, SLOT(nextWeek())); | 33 | connect(forwardweek, SIGNAL(clicked()), this, SLOT(nextWeek())); |
33 | connect(forwardmonth, SIGNAL(clicked()), this, SLOT(nextMonth())); | 34 | connect(forwardmonth, SIGNAL(clicked()), this, SLOT(nextMonth())); |
34 | connect(labelDate, SIGNAL(clicked()), this, SLOT(pickDate())); | 35 | connect(labelDate, SIGNAL(clicked()), this, SLOT(pickDate())); |
35 | connect(dbl, SIGNAL(toggled(bool)), this, SIGNAL(setDbl(bool))); | 36 | connect(dbl, SIGNAL(toggled(bool)), this, SIGNAL(setDbl(bool))); |
36 | bStartOnMonday=onM; | 37 | bStartOnMonday=onM; |
37 | } | 38 | } |
38 | DateBookWeekLstHeader::~DateBookWeekLstHeader(){} | 39 | DateBookWeekLstHeader::~DateBookWeekLstHeader(){} |
39 | 40 | ||
40 | void DateBookWeekLstHeader::setDate(const QDate &d) { | 41 | void DateBookWeekLstHeader::setDate(const QDate &d) { |
41 | int year,week,dayofweek; | 42 | int year,week,dayofweek; |
42 | date=d; | 43 | date=d; |
43 | dayofweek=d.dayOfWeek(); | 44 | dayofweek=d.dayOfWeek(); |
44 | if(bStartOnMonday) | 45 | if(bStartOnMonday) |
45 | dayofweek--; | 46 | dayofweek--; |
46 | else if( dayofweek == 7 ) | 47 | else if( dayofweek == 7 ) |
47 | /* we already have the right day -7 would lead to the same week */ | 48 | /* we already have the right day -7 would lead to the same week */ |
48 | dayofweek = 0; | 49 | dayofweek = 0; |
49 | 50 | ||
50 | date=date.addDays(-dayofweek); | 51 | date=date.addDays(-dayofweek); |
51 | 52 | ||
52 | calcWeek(date,week,year,bStartOnMonday); | 53 | calcWeek(date,week,year,bStartOnMonday); |
53 | QDate start=date; | 54 | QDate start=date; |
54 | QDate stop=start.addDays(6); | 55 | QDate stop=start.addDays(6); |
55 | labelDate->setText( QString::number(start.day()) + "." + | 56 | labelDate->setText( QString::number(start.day()) + "." + |
56 | Calendar::nameOfMonth( start.month() ) + "-" + | 57 | Calendar::nameOfMonth( start.month() ) + "-" + |
57 | QString::number(stop.day()) + "." + | 58 | QString::number(stop.day()) + "." + |
58 | Calendar::nameOfMonth( stop.month()) +" ("+ | 59 | Calendar::nameOfMonth( stop.month()) +" ("+ |
59 | tr("w")+":"+QString::number( week ) +")"); | 60 | tr("w")+":"+QString::number( week ) +")"); |
60 | date = d; // bugfix: 0001126 - date has to be the selected date, not monday! | 61 | date = d; // bugfix: 0001126 - date has to be the selected date, not monday! |
61 | emit dateChanged(date); | 62 | emit dateChanged(date); |
62 | } | 63 | } |
63 | 64 | ||
64 | void DateBookWeekLstHeader::pickDate() { | 65 | void DateBookWeekLstHeader::pickDate() { |
65 | static QPopupMenu *m1 = 0; | 66 | static QPopupMenu *m1 = 0; |
66 | static DateBookMonth *picker = 0; | 67 | static DateBookMonth *picker = 0; |
67 | if ( !m1 ) { | 68 | if ( !m1 ) { |
68 | m1 = new QPopupMenu( this ); | 69 | m1 = new QPopupMenu( this ); |
69 | picker = new DateBookMonth( m1, 0, TRUE ); | 70 | picker = new DateBookMonth( m1, 0, TRUE ); |
70 | m1->insertItem( picker ); | 71 | m1->insertItem( picker ); |
71 | connect( picker, SIGNAL( dateClicked(int,int,int) ),this, SLOT( setDate(int,int,int) ) ); | 72 | connect( picker, SIGNAL( dateClicked(int,int,int) ),this, SLOT( setDate(int,int,int) ) ); |
72 | //connect( m1, SIGNAL( aboutToHide() ), | 73 | //connect( m1, SIGNAL( aboutToHide() ), |
73 | //this, SLOT( gotHide() ) ); | 74 | //this, SLOT( gotHide() ) ); |
74 | } | 75 | } |
75 | picker->setDate( date.year(), date.month(), date.day() ); | 76 | picker->setDate( date.year(), date.month(), date.day() ); |
76 | m1->popup(mapToGlobal(labelDate->pos()+QPoint(0,labelDate->height()))); | 77 | m1->popup(mapToGlobal(labelDate->pos()+QPoint(0,labelDate->height()))); |
77 | picker->setFocus(); | 78 | picker->setFocus(); |
78 | } | 79 | } |
79 | void DateBookWeekLstHeader::setDate(int y, int m, int d) { | 80 | void DateBookWeekLstHeader::setDate(int y, int m, int d) { |
80 | setDate(QDate(y,m,d)); | 81 | setDate(QDate(y,m,d)); |
81 | } | 82 | } |
82 | 83 | ||
83 | void DateBookWeekLstHeader::nextWeek() { | 84 | void DateBookWeekLstHeader::nextWeek() { |
84 | setDate(date.addDays(7)); | 85 | setDate(date.addDays(7)); |
85 | } | 86 | } |
86 | void DateBookWeekLstHeader::prevWeek() { | 87 | void DateBookWeekLstHeader::prevWeek() { |
87 | setDate(date.addDays(-7)); | 88 | setDate(date.addDays(-7)); |
88 | } | 89 | } |
diff --git a/core/pim/datebook/namespace_hack.h b/core/pim/datebook/namespace_hack.h index c15b5ed..2ed674c 100644 --- a/core/pim/datebook/namespace_hack.h +++ b/core/pim/datebook/namespace_hack.h | |||
@@ -1,20 +1,50 @@ | |||
1 | /* | ||
2 | This file is part of the Opie Project | ||
3 | |||
4 | Copyright (C) Opie Team <opie-devel@handhelds.org> | ||
5 | =. | ||
6 | .=l. | ||
7 | .>+-= | ||
8 | _;:, .> :=|. This program is free software; you can | ||
9 | .> <`_, > . <= redistribute it and/or modify it under | ||
10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | ||
11 | .="- .-=="i, .._ License as published by the Free Software | ||
12 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
13 | ._= =} : or (at your option) any later version. | ||
14 | .%`+i> _;_. | ||
15 | .i_,=:_. -<s. This program is distributed in the hope that | ||
16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
17 | : .. .:, . . . without even the implied warranty of | ||
18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
20 | ..}^=.= = ; Library General Public License for more | ||
21 | ++= -. .` .: details. | ||
22 | : = ...= . :.=- | ||
23 | -. .:....=;==+<; You should have received a copy of the GNU | ||
24 | -_. . . )=. = Library General Public License along with | ||
25 | -- :-=` this library; see the file COPYING.LIB. | ||
26 | If not, write to the Free Software Foundation, | ||
27 | Inc., 59 Temple Place - Suite 330, | ||
28 | Boston, MA 02111-1307, USA. | ||
29 | */ | ||
30 | |||
1 | #ifndef NAME_SPACE_HACK_H | 31 | #ifndef NAME_SPACE_HACK_H |
2 | #define NAME_SPACE_HACK_H | 32 | #define NAME_SPACE_HACK_H |
3 | 33 | ||
4 | #include <opie2/otimepicker.h> | 34 | #include <opie2/otimepicker.h> |
5 | #include <opie2/oclickablelabel.h> | 35 | #include <opie2/oclickablelabel.h> |
6 | 36 | ||
7 | class TimePicker : public Opie::Ui::OTimePicker { | 37 | class TimePicker : public Opie::Ui::OTimePicker { |
8 | public: | 38 | public: |
9 | TimePicker( QWidget* p = 0, const char* name = 0, WFlags fl = 0 ) | 39 | TimePicker( QWidget* p = 0, const char* name = 0, WFlags fl = 0 ) |
10 | : Opie::Ui::OTimePicker(p,name,fl){} | 40 | : Opie::Ui::OTimePicker(p,name,fl){} |
11 | 41 | ||
12 | }; | 42 | }; |
13 | class ClickableLabel : public Opie::Ui::OClickableLabel { | 43 | class ClickableLabel : public Opie::Ui::OClickableLabel { |
14 | public: | 44 | public: |
15 | ClickableLabel(QWidget *p=0,const char* name=0, WFlags fl = 0 ) | 45 | ClickableLabel(QWidget *p=0,const char* name=0, WFlags fl = 0 ) |
16 | : Opie::Ui::OClickableLabel(p,name,fl){} | 46 | : Opie::Ui::OClickableLabel(p,name,fl){} |
17 | }; | 47 | }; |
18 | 48 | ||
19 | 49 | ||
20 | #endif | 50 | #endif |
diff --git a/core/pim/datebook/noteentryimpl.cpp b/core/pim/datebook/noteentryimpl.cpp index 14fe98e..f967ab2 100644 --- a/core/pim/datebook/noteentryimpl.cpp +++ b/core/pim/datebook/noteentryimpl.cpp | |||
@@ -1,15 +1,45 @@ | |||
1 | /* | ||
2 | This file is part of the Opie Project | ||
3 | |||
4 | Copyright (C) Opie Team <opie-devel@handhelds.org> | ||
5 | =. | ||
6 | .=l. | ||
7 | .>+-= | ||
8 | _;:, .> :=|. This program is free software; you can | ||
9 | .> <`_, > . <= redistribute it and/or modify it under | ||
10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | ||
11 | .="- .-=="i, .._ License as published by the Free Software | ||
12 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
13 | ._= =} : or (at your option) any later version. | ||
14 | .%`+i> _;_. | ||
15 | .i_,=:_. -<s. This program is distributed in the hope that | ||
16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
17 | : .. .:, . . . without even the implied warranty of | ||
18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
20 | ..}^=.= = ; Library General Public License for more | ||
21 | ++= -. .` .: details. | ||
22 | : = ...= . :.=- | ||
23 | -. .:....=;==+<; You should have received a copy of the GNU | ||
24 | -_. . . )=. = Library General Public License along with | ||
25 | -- :-=` this library; see the file COPYING.LIB. | ||
26 | If not, write to the Free Software Foundation, | ||
27 | Inc., 59 Temple Place - Suite 330, | ||
28 | Boston, MA 02111-1307, USA. | ||
29 | */ | ||
30 | |||
1 | #include "noteentryimpl.h" | 31 | #include "noteentryimpl.h" |
2 | #include "qlabel.h" | 32 | #include "qlabel.h" |
3 | #include "onoteedit.h" | 33 | #include "onoteedit.h" |
4 | 34 | ||
5 | NoteEntry::NoteEntry(const QString &title, const QString ¬eStr, | 35 | NoteEntry::NoteEntry(const QString &title, const QString ¬eStr, |
6 | QWidget* parent, const char* name, bool modal, | 36 | QWidget* parent, const char* name, bool modal, |
7 | WFlags fl) : | 37 | WFlags fl) : |
8 | NoteEntryBase(parent, name, modal, fl) { | 38 | NoteEntryBase(parent, name, modal, fl) { |
9 | 39 | ||
10 | 40 | ||
11 | eventLabel->setText(title); | 41 | eventLabel->setText(title); |
12 | note->setText(noteStr); | 42 | note->setText(noteStr); |
13 | int l=note->length(); | 43 | int l=note->length(); |
14 | note->setCursorPosition(l,l,false); | 44 | note->setCursorPosition(l,l,false); |
15 | } | 45 | } |
diff --git a/core/pim/datebook/noteentryimpl.h b/core/pim/datebook/noteentryimpl.h index f3adfa6..86ea0ee 100644 --- a/core/pim/datebook/noteentryimpl.h +++ b/core/pim/datebook/noteentryimpl.h | |||
@@ -1,18 +1,48 @@ | |||
1 | /* | ||
2 | This file is part of the Opie Project | ||
3 | |||
4 | Copyright (C) Opie Team <opie-devel@handhelds.org> | ||
5 | =. | ||
6 | .=l. | ||
7 | .>+-= | ||
8 | _;:, .> :=|. This program is free software; you can | ||
9 | .> <`_, > . <= redistribute it and/or modify it under | ||
10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | ||
11 | .="- .-=="i, .._ License as published by the Free Software | ||
12 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
13 | ._= =} : or (at your option) any later version. | ||
14 | .%`+i> _;_. | ||
15 | .i_,=:_. -<s. This program is distributed in the hope that | ||
16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
17 | : .. .:, . . . without even the implied warranty of | ||
18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
20 | ..}^=.= = ; Library General Public License for more | ||
21 | ++= -. .` .: details. | ||
22 | : = ...= . :.=- | ||
23 | -. .:....=;==+<; You should have received a copy of the GNU | ||
24 | -_. . . )=. = Library General Public License along with | ||
25 | -- :-=` this library; see the file COPYING.LIB. | ||
26 | If not, write to the Free Software Foundation, | ||
27 | Inc., 59 Temple Place - Suite 330, | ||
28 | Boston, MA 02111-1307, USA. | ||
29 | */ | ||
30 | |||
1 | #ifndef noteentryimpl_h | 31 | #ifndef noteentryimpl_h |
2 | #define noteentryimpl_h | 32 | #define noteentryimpl_h |
3 | 33 | ||
4 | #include "noteentry.h" | 34 | #include "noteentry.h" |
5 | 35 | ||
6 | class QString; | 36 | class QString; |
7 | 37 | ||
8 | class NoteEntry : public NoteEntryBase | 38 | class NoteEntry : public NoteEntryBase |
9 | { | 39 | { |
10 | Q_OBJECT | 40 | Q_OBJECT |
11 | 41 | ||
12 | public: | 42 | public: |
13 | NoteEntry(const QString &title, const QString ¬eStr, | 43 | NoteEntry(const QString &title, const QString ¬eStr, |
14 | QWidget* parent = 0, const char* name = 0, | 44 | QWidget* parent = 0, const char* name = 0, |
15 | bool modal=TRUE, WFlags fl=0); | 45 | bool modal=TRUE, WFlags fl=0); |
16 | }; | 46 | }; |
17 | 47 | ||
18 | #endif | 48 | #endif |
diff --git a/core/pim/datebook/onoteedit.cpp b/core/pim/datebook/onoteedit.cpp index d66ad86..a5f468d 100644 --- a/core/pim/datebook/onoteedit.cpp +++ b/core/pim/datebook/onoteedit.cpp | |||
@@ -1,19 +1,49 @@ | |||
1 | /* | ||
2 | This file is part of the Opie Project | ||
3 | |||
4 | Copyright (C) Opie Team <opie-devel@handhelds.org> | ||
5 | =. | ||
6 | .=l. | ||
7 | .>+-= | ||
8 | _;:, .> :=|. This program is free software; you can | ||
9 | .> <`_, > . <= redistribute it and/or modify it under | ||
10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | ||
11 | .="- .-=="i, .._ License as published by the Free Software | ||
12 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
13 | ._= =} : or (at your option) any later version. | ||
14 | .%`+i> _;_. | ||
15 | .i_,=:_. -<s. This program is distributed in the hope that | ||
16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
17 | : .. .:, . . . without even the implied warranty of | ||
18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
20 | ..}^=.= = ; Library General Public License for more | ||
21 | ++= -. .` .: details. | ||
22 | : = ...= . :.=- | ||
23 | -. .:....=;==+<; You should have received a copy of the GNU | ||
24 | -_. . . )=. = Library General Public License along with | ||
25 | -- :-=` this library; see the file COPYING.LIB. | ||
26 | If not, write to the Free Software Foundation, | ||
27 | Inc., 59 Temple Place - Suite 330, | ||
28 | Boston, MA 02111-1307, USA. | ||
29 | */ | ||
30 | |||
1 | #include "onoteedit.h" | 31 | #include "onoteedit.h" |
2 | 32 | ||
3 | ONoteEdit::ONoteEdit (QWidget * parent, const char * name) : | 33 | ONoteEdit::ONoteEdit (QWidget * parent, const char * name) : |
4 | QMultiLineEdit(parent,name) { | 34 | QMultiLineEdit(parent,name) { |
5 | setDefaultTabStop(2); | 35 | setDefaultTabStop(2); |
6 | setWordWrap(WidgetWidth); | 36 | setWordWrap(WidgetWidth); |
7 | } | 37 | } |
8 | 38 | ||
9 | // Copy indentation from previous line | 39 | // Copy indentation from previous line |
10 | void ONoteEdit::newLine() { | 40 | void ONoteEdit::newLine() { |
11 | int l,c; | 41 | int l,c; |
12 | getCursorPosition(&l,&c); | 42 | getCursorPosition(&l,&c); |
13 | QString s=textLine(l); | 43 | QString s=textLine(l); |
14 | 44 | ||
15 | insert("\n"); | 45 | insert("\n"); |
16 | 46 | ||
17 | int i=0; | 47 | int i=0; |
18 | while (s[i]==' ' || s[i]=='\t') insert(QString(s[i])), i++; | 48 | while (s[i]==' ' || s[i]=='\t') insert(QString(s[i])), i++; |
19 | } | 49 | } |
diff --git a/core/pim/datebook/onoteedit.h b/core/pim/datebook/onoteedit.h index 2f71d0d..390b837 100644 --- a/core/pim/datebook/onoteedit.h +++ b/core/pim/datebook/onoteedit.h | |||
@@ -1,19 +1,49 @@ | |||
1 | /* | ||
2 | This file is part of the Opie Project | ||
3 | |||
4 | Copyright (C) Opie Team <opie-devel@handhelds.org> | ||
5 | =. | ||
6 | .=l. | ||
7 | .>+-= | ||
8 | _;:, .> :=|. This program is free software; you can | ||
9 | .> <`_, > . <= redistribute it and/or modify it under | ||
10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | ||
11 | .="- .-=="i, .._ License as published by the Free Software | ||
12 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
13 | ._= =} : or (at your option) any later version. | ||
14 | .%`+i> _;_. | ||
15 | .i_,=:_. -<s. This program is distributed in the hope that | ||
16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
17 | : .. .:, . . . without even the implied warranty of | ||
18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
20 | ..}^=.= = ; Library General Public License for more | ||
21 | ++= -. .` .: details. | ||
22 | : = ...= . :.=- | ||
23 | -. .:....=;==+<; You should have received a copy of the GNU | ||
24 | -_. . . )=. = Library General Public License along with | ||
25 | -- :-=` this library; see the file COPYING.LIB. | ||
26 | If not, write to the Free Software Foundation, | ||
27 | Inc., 59 Temple Place - Suite 330, | ||
28 | Boston, MA 02111-1307, USA. | ||
29 | */ | ||
30 | |||
1 | #ifndef ONOTEEDIT_H | 31 | #ifndef ONOTEEDIT_H |
2 | #define ONOTEEDIT_H | 32 | #define ONOTEEDIT_H |
3 | 33 | ||
4 | #include <qmultilineedit.h> | 34 | #include <qmultilineedit.h> |
5 | 35 | ||
6 | class ONoteEdit: public QMultiLineEdit { | 36 | class ONoteEdit: public QMultiLineEdit { |
7 | 37 | ||
8 | Q_OBJECT | 38 | Q_OBJECT |
9 | 39 | ||
10 | public: | 40 | public: |
11 | 41 | ||
12 | ONoteEdit (QWidget * parent=0, const char * name=0); | 42 | ONoteEdit (QWidget * parent=0, const char * name=0); |
13 | 43 | ||
14 | protected: | 44 | protected: |
15 | 45 | ||
16 | virtual void newLine (); | 46 | virtual void newLine (); |
17 | }; | 47 | }; |
18 | 48 | ||
19 | #endif | 49 | #endif |
diff --git a/core/pim/datebook/repeatentry.cpp b/core/pim/datebook/repeatentry.cpp index 04c3cf3..30e296c 100644 --- a/core/pim/datebook/repeatentry.cpp +++ b/core/pim/datebook/repeatentry.cpp | |||
@@ -1,83 +1,93 @@ | |||
1 | /********************************************************************** | 1 | /* |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | This file is part of the Opie Project |
3 | ** | 3 | |
4 | ** This file is part of Qtopia Environment. | 4 | Copyright (C) Opie Team <opie-devel@handhelds.org> |
5 | ** | 5 | =. |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | .=l. |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | .>+-= |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | _;:, .> :=|. This program is free software; you can |
9 | ** packaging of this file. | 9 | .> <`_, > . <= redistribute it and/or modify it under |
10 | ** | 10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | .="- .-=="i, .._ License as published by the Free Software |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | - . .-<_> .<> Foundation; either version 2 of the License, |
13 | ** | 13 | ._= =} : or (at your option) any later version. |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | .%`+i> _;_. |
15 | ** | 15 | .i_,=:_. -<s. This program is distributed in the hope that |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
17 | ** not clear to you. | 17 | : .. .:, . . . without even the implied warranty of |
18 | ** | 18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | **********************************************************************/ | 19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= = ; Library General Public License for more | ||
21 | ++= -. .` .: details. | ||
22 | : = ...= . :.=- | ||
23 | -. .:....=;==+<; You should have received a copy of the GNU | ||
24 | -_. . . )=. = Library General Public License along with | ||
25 | -- :-=` this library; see the file COPYING.LIB. | ||
26 | If not, write to the Free Software Foundation, | ||
27 | Inc., 59 Temple Place - Suite 330, | ||
28 | Boston, MA 02111-1307, USA. | ||
29 | */ | ||
20 | 30 | ||
21 | #include "repeatentry.h" | 31 | #include "repeatentry.h" |
22 | 32 | ||
23 | #include <qpe/datebookmonth.h> | 33 | #include <qpe/datebookmonth.h> |
24 | #include <qpe/qpeapplication.h> | 34 | #include <qpe/qpeapplication.h> |
25 | 35 | ||
26 | #include <qlabel.h> | 36 | #include <qlabel.h> |
27 | #include <qspinbox.h> | 37 | #include <qspinbox.h> |
28 | 38 | ||
29 | #include <time.h> | 39 | #include <time.h> |
30 | 40 | ||
31 | // Global Templates for use in setting up the repeat label... | 41 | // Global Templates for use in setting up the repeat label... |
32 | // the problem is these strings get initialized before QPEApplication can install the translator -zecke | 42 | // the problem is these strings get initialized before QPEApplication can install the translator -zecke |
33 | namespace { | 43 | namespace { |
34 | QString strDayTemplate; | 44 | QString strDayTemplate; |
35 | QString strYearTemplate; | 45 | QString strYearTemplate; |
36 | QString strMonthDateTemplate; | 46 | QString strMonthDateTemplate; |
37 | QString strMonthDayTemplate; | 47 | QString strMonthDayTemplate; |
38 | QString strWeekTemplate; | 48 | QString strWeekTemplate; |
39 | QString dayLabel[7]; | 49 | QString dayLabel[7]; |
40 | } | 50 | } |
41 | 51 | ||
42 | /* | 52 | /* |
43 | * static linkage to not polute the symbol table... | 53 | * static linkage to not polute the symbol table... |
44 | * The problem is that const and static linkage are resolved prior to installing a translator | 54 | * The problem is that const and static linkage are resolved prior to installing a translator |
45 | * leading to that the above strings are translted but to the original we delay the init of these strings... | 55 | * leading to that the above strings are translted but to the original we delay the init of these strings... |
46 | * -zecke | 56 | * -zecke |
47 | */ | 57 | */ |
48 | static void fillStrings() { | 58 | static void fillStrings() { |
49 | strDayTemplate = QObject::tr("Every"); | 59 | strDayTemplate = QObject::tr("Every"); |
50 | strYearTemplate = QObject::tr("%1 %2 every "); | 60 | strYearTemplate = QObject::tr("%1 %2 every "); |
51 | strMonthDateTemplate = QObject::tr("The %1 every "); | 61 | strMonthDateTemplate = QObject::tr("The %1 every "); |
52 | strMonthDayTemplate = QObject::tr("The %1 %1 of every"); | 62 | strMonthDayTemplate = QObject::tr("The %1 %1 of every"); |
53 | strWeekTemplate = QObject::tr("Every "); | 63 | strWeekTemplate = QObject::tr("Every "); |
54 | dayLabel[0] = QObject::tr("Monday"); | 64 | dayLabel[0] = QObject::tr("Monday"); |
55 | dayLabel[1] = QObject::tr("Tuesday"); | 65 | dayLabel[1] = QObject::tr("Tuesday"); |
56 | dayLabel[2] = QObject::tr("Wednesday"); | 66 | dayLabel[2] = QObject::tr("Wednesday"); |
57 | dayLabel[3] = QObject::tr("Thursday"); | 67 | dayLabel[3] = QObject::tr("Thursday"); |
58 | dayLabel[4] = QObject::tr("Friday"); | 68 | dayLabel[4] = QObject::tr("Friday"); |
59 | dayLabel[5] = QObject::tr("Saturday"); | 69 | dayLabel[5] = QObject::tr("Saturday"); |
60 | dayLabel[6] = QObject::tr("Sunday"); | 70 | dayLabel[6] = QObject::tr("Sunday"); |
61 | } | 71 | } |
62 | 72 | ||
63 | static QString numberPlacing( int x );// return the proper word format for | 73 | static QString numberPlacing( int x );// return the proper word format for |
64 | // x (1st, 2nd, etc) | 74 | // x (1st, 2nd, etc) |
65 | static int week( const QDate &dt ); // what week in the month is dt? | 75 | static int week( const QDate &dt ); // what week in the month is dt? |
66 | 76 | ||
67 | RepeatEntry::RepeatEntry( bool startOnMonday, | 77 | RepeatEntry::RepeatEntry( bool startOnMonday, |
68 | const QDate &newStart, QWidget *parent, | 78 | const QDate &newStart, QWidget *parent, |
69 | const char *name, bool modal, WFlags fl ) | 79 | const char *name, bool modal, WFlags fl ) |
70 | : RepeatEntryBase( parent, name, modal, fl ), | 80 | : RepeatEntryBase( parent, name, modal, fl ), |
71 | start( newStart ), | 81 | start( newStart ), |
72 | currInterval( NONE ), | 82 | currInterval( NONE ), |
73 | startWeekOnMonday( startOnMonday ) | 83 | startWeekOnMonday( startOnMonday ) |
74 | { | 84 | { |
75 | if (strDayTemplate.isEmpty() ) | 85 | if (strDayTemplate.isEmpty() ) |
76 | fillStrings(); | 86 | fillStrings(); |
77 | 87 | ||
78 | init(); | 88 | init(); |
79 | fraType->setButton( currInterval ); | 89 | fraType->setButton( currInterval ); |
80 | chkNoEnd->setChecked( TRUE ); | 90 | chkNoEnd->setChecked( TRUE ); |
81 | setupNone(); | 91 | setupNone(); |
82 | } | 92 | } |
83 | 93 | ||
diff --git a/core/pim/datebook/repeatentry.h b/core/pim/datebook/repeatentry.h index 949fecd..d75af3c 100644 --- a/core/pim/datebook/repeatentry.h +++ b/core/pim/datebook/repeatentry.h | |||
@@ -1,83 +1,93 @@ | |||
1 | /********************************************************************** | 1 | /* |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | This file is part of the Opie Project |
3 | ** | 3 | |
4 | ** This file is part of Qtopia Environment. | 4 | Copyright (C) Opie Team <opie-devel@handhelds.org> |
5 | ** | 5 | =. |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | .=l. |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | .>+-= |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | _;:, .> :=|. This program is free software; you can |
9 | ** packaging of this file. | 9 | .> <`_, > . <= redistribute it and/or modify it under |
10 | ** | 10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | .="- .-=="i, .._ License as published by the Free Software |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | - . .-<_> .<> Foundation; either version 2 of the License, |
13 | ** | 13 | ._= =} : or (at your option) any later version. |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | .%`+i> _;_. |
15 | ** | 15 | .i_,=:_. -<s. This program is distributed in the hope that |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
17 | ** not clear to you. | 17 | : .. .:, . . . without even the implied warranty of |
18 | ** | 18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | **********************************************************************/ | 19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= = ; Library General Public License for more | ||
21 | ++= -. .` .: details. | ||
22 | : = ...= . :.=- | ||
23 | -. .:....=;==+<; You should have received a copy of the GNU | ||
24 | -_. . . )=. = Library General Public License along with | ||
25 | -- :-=` this library; see the file COPYING.LIB. | ||
26 | If not, write to the Free Software Foundation, | ||
27 | Inc., 59 Temple Place - Suite 330, | ||
28 | Boston, MA 02111-1307, USA. | ||
29 | */ | ||
20 | 30 | ||
21 | #ifndef REPEATENTRY_H | 31 | #ifndef REPEATENTRY_H |
22 | #define REPEATENTRY_H | 32 | #define REPEATENTRY_H |
23 | 33 | ||
24 | #include "repeatentrybase.h" | 34 | #include "repeatentrybase.h" |
25 | 35 | ||
26 | #include <qpe/event.h> | 36 | #include <qpe/event.h> |
27 | 37 | ||
28 | #include <qcheckbox.h> | 38 | #include <qcheckbox.h> |
29 | #include <qbuttongroup.h> | 39 | #include <qbuttongroup.h> |
30 | #include <qdatetime.h> | 40 | #include <qdatetime.h> |
31 | #include <qlist.h> | 41 | #include <qlist.h> |
32 | #include <qtoolbutton.h> | 42 | #include <qtoolbutton.h> |
33 | 43 | ||
34 | class DateBookMonth; | 44 | class DateBookMonth; |
35 | 45 | ||
36 | class RepeatEntry : public RepeatEntryBase | 46 | class RepeatEntry : public RepeatEntryBase |
37 | { | 47 | { |
38 | Q_OBJECT | 48 | Q_OBJECT |
39 | public: | 49 | public: |
40 | RepeatEntry( bool startOnMonday, | 50 | RepeatEntry( bool startOnMonday, |
41 | const QDate &start, QWidget *parent = 0, const char *name = 0, | 51 | const QDate &start, QWidget *parent = 0, const char *name = 0, |
42 | bool modal = TRUE, WFlags fl = 0 ); | 52 | bool modal = TRUE, WFlags fl = 0 ); |
43 | RepeatEntry( bool startOnMonday, | 53 | RepeatEntry( bool startOnMonday, |
44 | const Event::RepeatPattern &rp, const QDate &start, | 54 | const Event::RepeatPattern &rp, const QDate &start, |
45 | QWidget *parent = 0, const char *name = 0, bool modal = TRUE, | 55 | QWidget *parent = 0, const char *name = 0, bool modal = TRUE, |
46 | WFlags fl = 0 ); | 56 | WFlags fl = 0 ); |
47 | ~RepeatEntry(); | 57 | ~RepeatEntry(); |
48 | 58 | ||
49 | Event::RepeatPattern repeatPattern(); | 59 | Event::RepeatPattern repeatPattern(); |
50 | QDate endDate() { return end; }; | 60 | QDate endDate() { return end; }; |
51 | 61 | ||
52 | public slots: | 62 | public slots: |
53 | void slotSetRType( int ); | 63 | void slotSetRType( int ); |
54 | void endDateChanged( int, int, int ); | 64 | void endDateChanged( int, int, int ); |
55 | void slotNoEnd( bool unused ); | 65 | void slotNoEnd( bool unused ); |
56 | 66 | ||
57 | private slots: | 67 | private slots: |
58 | void setupRepeatLabel( const QString& ); | 68 | void setupRepeatLabel( const QString& ); |
59 | void setupRepeatLabel( int ); | 69 | void setupRepeatLabel( int ); |
60 | void slotWeekLabel(); | 70 | void slotWeekLabel(); |
61 | void slotMonthLabel( int ); | 71 | void slotMonthLabel( int ); |
62 | void slotChangeStartOfWeek( bool onMonday ); | 72 | void slotChangeStartOfWeek( bool onMonday ); |
63 | 73 | ||
64 | private: | 74 | private: |
65 | void setupNone(); | 75 | void setupNone(); |
66 | void setupDaily(); | 76 | void setupDaily(); |
67 | void setupWeekly(); | 77 | void setupWeekly(); |
68 | void setupMonthly(); | 78 | void setupMonthly(); |
69 | void setupYearly(); | 79 | void setupYearly(); |
70 | 80 | ||
71 | enum repeatButtons { NONE, DAY, WEEK, MONTH, YEAR }; | 81 | enum repeatButtons { NONE, DAY, WEEK, MONTH, YEAR }; |
72 | void init(); | 82 | void init(); |
73 | inline void hideExtras(); | 83 | inline void hideExtras(); |
74 | void showRepeatStuff(); | 84 | void showRepeatStuff(); |
75 | 85 | ||
76 | QList<QToolButton> listRTypeButtons; | 86 | QList<QToolButton> listRTypeButtons; |
77 | QList<QToolButton> listExtra; | 87 | QList<QToolButton> listExtra; |
78 | QDate start; // only used in one spot... | 88 | QDate start; // only used in one spot... |
79 | QDate end; | 89 | QDate end; |
80 | repeatButtons currInterval; | 90 | repeatButtons currInterval; |
81 | bool startWeekOnMonday; | 91 | bool startWeekOnMonday; |
82 | DateBookMonth *repeatPicker; | 92 | DateBookMonth *repeatPicker; |
83 | }; | 93 | }; |