-rw-r--r-- | core/pim/datebook/clickablelabel.cpp | 31 | ||||
-rw-r--r-- | core/pim/datebook/clickablelabel.h | 20 | ||||
-rw-r--r-- | core/pim/datebook/datebook.cpp | 122 | ||||
-rw-r--r-- | core/pim/datebook/datebook.h | 8 | ||||
-rw-r--r-- | core/pim/datebook/datebook.pro | 38 | ||||
-rw-r--r-- | core/pim/datebook/datebookweeklst.cpp | 314 | ||||
-rw-r--r-- | core/pim/datebook/datebookweeklst.h | 131 | ||||
-rw-r--r-- | core/pim/datebook/datebookweeklstdayhdr.ui | 149 | ||||
-rw-r--r-- | core/pim/datebook/datebookweeklstheader.ui | 238 | ||||
-rw-r--r-- | core/pim/datebook/dateentry.ui | 4 | ||||
-rw-r--r-- | core/pim/datebook/dateentryimpl.cpp | 8 |
11 files changed, 1028 insertions, 35 deletions
diff --git a/core/pim/datebook/clickablelabel.cpp b/core/pim/datebook/clickablelabel.cpp new file mode 100644 index 0000000..6912c34 --- a/dev/null +++ b/core/pim/datebook/clickablelabel.cpp | |||
@@ -0,0 +1,31 @@ | |||
1 | #include "clickablelabel.h" | ||
2 | |||
3 | ClickableLabel::ClickableLabel(QWidget* parent = 0, | ||
4 | const char* name = 0, | ||
5 | WFlags fl = 0) : | ||
6 | QLabel(parent,name,fl) | ||
7 | { | ||
8 | setFrameShape(NoFrame); | ||
9 | setFrameShadow(Sunken); | ||
10 | } | ||
11 | |||
12 | void ClickableLabel::mousePressEvent( QMouseEvent *e ) { | ||
13 | setFrameShape(Panel); | ||
14 | repaint(); | ||
15 | } | ||
16 | |||
17 | void ClickableLabel::mouseReleaseEvent( QMouseEvent *e ) { | ||
18 | setFrameShape(NoFrame); | ||
19 | repaint(); | ||
20 | if (rect().contains(e->pos())) { | ||
21 | emit clicked(); | ||
22 | } | ||
23 | } | ||
24 | |||
25 | void ClickableLabel::mouseMoveEvent( QMouseEvent *e ) { | ||
26 | if (rect().contains(e->pos())) { | ||
27 | setFrameShape(Panel); | ||
28 | } else { | ||
29 | setFrameShape(NoFrame); | ||
30 | } | ||
31 | } | ||
diff --git a/core/pim/datebook/clickablelabel.h b/core/pim/datebook/clickablelabel.h new file mode 100644 index 0000000..b6d33ad --- a/dev/null +++ b/core/pim/datebook/clickablelabel.h | |||
@@ -0,0 +1,20 @@ | |||
1 | #ifndef CLICKABLELABEL | ||
2 | #define CLICKABLELABEL | ||
3 | |||
4 | #include <qlabel.h> | ||
5 | |||
6 | class ClickableLabel: public QLabel | ||
7 | { | ||
8 | Q_OBJECT | ||
9 | public: | ||
10 | ClickableLabel(QWidget* parent = 0, const char* name = 0, | ||
11 | WFlags fl = 0); | ||
12 | protected: | ||
13 | void mousePressEvent( QMouseEvent *e ); | ||
14 | void mouseReleaseEvent( QMouseEvent *e ); | ||
15 | void mouseMoveEvent( QMouseEvent *e ); | ||
16 | signals: | ||
17 | void clicked(); | ||
18 | }; | ||
19 | |||
20 | #endif | ||
diff --git a/core/pim/datebook/datebook.cpp b/core/pim/datebook/datebook.cpp index e8d808f..9880e2d 100644 --- a/core/pim/datebook/datebook.cpp +++ b/core/pim/datebook/datebook.cpp | |||
@@ -5,194 +5,233 @@ | |||
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | ** $Id$ | 19 | ** $Id$ |
20 | ** | 20 | ** |
21 | **********************************************************************/ | 21 | **********************************************************************/ |
22 | 22 | ||
23 | #define QTOPIA_INTERNAL_FD | 23 | #define QTOPIA_INTERNAL_FD |
24 | 24 | ||
25 | #include "datebook.h" | 25 | #include "datebook.h" |
26 | #include "datebookday.h" | 26 | #include "datebookday.h" |
27 | #include "datebooksettings.h" | 27 | #include "datebooksettings.h" |
28 | #include "datebookweek.h" | 28 | #include "datebookweek.h" |
29 | #include "datebookweeklst.h" | ||
29 | #include "dateentryimpl.h" | 30 | #include "dateentryimpl.h" |
30 | 31 | ||
31 | #include <qpe/datebookmonth.h> | 32 | #include <qpe/datebookmonth.h> |
32 | #include <qpe/qpeapplication.h> | 33 | #include <qpe/qpeapplication.h> |
33 | #include <qpe/config.h> | 34 | #include <qpe/config.h> |
34 | #include <qpe/qpedebug.h> | 35 | #include <qpe/qpedebug.h> |
35 | #include <qpe/event.h> | 36 | #include <qpe/event.h> |
36 | #include <qpe/finddialog.h> | 37 | #include <qpe/finddialog.h> |
37 | #include <qpe/ir.h> | 38 | #include <qpe/ir.h> |
38 | #include <qpe/qpemenubar.h> | 39 | #include <qpe/qpemenubar.h> |
39 | #include <qpe/qpemessagebox.h> | 40 | #include <qpe/qpemessagebox.h> |
40 | #include <qpe/resource.h> | 41 | #include <qpe/resource.h> |
41 | #include <qpe/sound.h> | 42 | #include <qpe/sound.h> |
42 | #include <qpe/timestring.h> | 43 | #include <qpe/timestring.h> |
43 | #include <qpe/qpetoolbar.h> | 44 | #include <qpe/qpetoolbar.h> |
44 | #include <qpe/tzselect.h> | 45 | #include <qpe/tzselect.h> |
45 | #include <qpe/xmlreader.h> | 46 | #include <qpe/xmlreader.h> |
46 | 47 | ||
47 | #include <qaction.h> | 48 | #include <qaction.h> |
48 | #include <qcopchannel_qws.h> | 49 | #include <qcopchannel_qws.h> |
49 | #include <qdatetime.h> | 50 | #include <qdatetime.h> |
50 | #include <qdialog.h> | 51 | #include <qdialog.h> |
51 | #include <qfile.h> | 52 | #include <qfile.h> |
52 | #include <qlabel.h> | 53 | #include <qlabel.h> |
53 | #include <qlayout.h> | 54 | #include <qlayout.h> |
54 | #include <qmessagebox.h> | 55 | #include <qmessagebox.h> |
55 | #include <qpopupmenu.h> | 56 | #include <qpopupmenu.h> |
56 | #include <qpushbutton.h> | 57 | #include <qpushbutton.h> |
57 | #include <qtextcodec.h> | 58 | #include <qtextcodec.h> |
58 | #include <qtextstream.h> | 59 | #include <qtextstream.h> |
59 | #include <qtl.h> | 60 | #include <qtl.h> |
60 | #include <qwidgetstack.h> | 61 | #include <qwidgetstack.h> |
61 | #include <qwindowsystem_qws.h> | 62 | #include <qwindowsystem_qws.h> |
62 | 63 | ||
63 | #include <sys/stat.h> | 64 | #include <sys/stat.h> |
64 | #include <sys/types.h> | 65 | #include <sys/types.h> |
65 | #include <fcntl.h> | 66 | #include <fcntl.h> |
66 | #include <unistd.h> | 67 | #include <unistd.h> |
67 | 68 | ||
68 | #include <stdlib.h> | 69 | #include <stdlib.h> |
69 | 70 | ||
70 | #define DAY 1 | 71 | #define DAY 1 |
71 | #define WEEK 2 | 72 | #define WEEK 2 |
73 | #define WEEKLST 4 | ||
72 | #define MONTH 3 | 74 | #define MONTH 3 |
73 | 75 | ||
74 | 76 | ||
75 | DateBook::DateBook( QWidget *parent, const char *, WFlags f ) | 77 | DateBook::DateBook( QWidget *parent, const char *, WFlags f ) |
76 | : QMainWindow( parent, "datebook", f ), | 78 | : QMainWindow( parent, "datebook", f ), |
77 | aPreset( FALSE ), | 79 | aPreset( FALSE ), |
78 | presetTime( -1 ), | 80 | presetTime( -1 ), |
79 | startTime( 8 ), // an acceptable default | 81 | startTime( 8 ), // an acceptable default |
80 | syncing(FALSE), | 82 | syncing(FALSE), |
81 | inSearch(FALSE) | 83 | inSearch(FALSE) |
82 | { | 84 | { |
83 | QTime t; | 85 | QTime t; |
84 | t.start(); | 86 | t.start(); |
85 | db = new DateBookDB; | 87 | db = new DateBookDB; |
86 | qDebug("loading db t=%d", t.elapsed() ); | 88 | qDebug("loading db t=%d", t.elapsed() ); |
87 | loadSettings(); | 89 | loadSettings(); |
88 | setCaption( tr("Calendar") ); | 90 | setCaption( tr("Calendar") ); |
89 | setIcon( Resource::loadPixmap( "datebook_icon" ) ); | 91 | setIcon( Resource::loadPixmap( "datebook_icon" ) ); |
90 | 92 | ||
91 | setToolBarsMovable( FALSE ); | 93 | setToolBarsMovable( FALSE ); |
92 | 94 | ||
95 | views = new QWidgetStack( this ); | ||
96 | setCentralWidget( views ); | ||
97 | |||
98 | dayView = 0; | ||
99 | weekView = 0; | ||
100 | weekLstView = 0; | ||
101 | monthView = 0; | ||
102 | |||
93 | QPEToolBar *bar = new QPEToolBar( this ); | 103 | QPEToolBar *bar = new QPEToolBar( this ); |
94 | bar->setHorizontalStretchable( TRUE ); | 104 | bar->setHorizontalStretchable( TRUE ); |
95 | 105 | ||
96 | QPEMenuBar *mb = new QPEMenuBar( bar ); | 106 | QPEMenuBar *mb = new QPEMenuBar( bar ); |
97 | mb->setMargin( 0 ); | 107 | mb->setMargin( 0 ); |
98 | 108 | ||
99 | QPEToolBar *sub_bar = new QPEToolBar(this); | 109 | QPEToolBar *sub_bar = new QPEToolBar(this); |
100 | 110 | ||
101 | QPopupMenu *view = new QPopupMenu( this ); | 111 | QPopupMenu *view = new QPopupMenu( this ); |
102 | QPopupMenu *settings = new QPopupMenu( this ); | 112 | QPopupMenu *settings = new QPopupMenu( this ); |
103 | 113 | ||
104 | mb->insertItem( tr( "View" ), view ); | 114 | mb->insertItem( tr( "View" ), view ); |
105 | mb->insertItem( tr( "Settings" ), settings ); | 115 | mb->insertItem( tr( "Settings" ), settings ); |
106 | 116 | ||
107 | QActionGroup *g = new QActionGroup( this ); | 117 | QActionGroup *g = new QActionGroup( this ); |
108 | g->setExclusive( TRUE ); | 118 | g->setExclusive( TRUE ); |
109 | 119 | ||
110 | QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), | 120 | QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), |
111 | QString::null, 0, this, 0 ); | 121 | QString::null, 0, this, 0 ); |
112 | connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) ); | 122 | connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) ); |
113 | a->addTo( sub_bar ); | 123 | a->addTo( sub_bar ); |
114 | 124 | ||
115 | a = new QAction( tr( "Today" ), Resource::loadPixmap( "to_day" ), QString::null, 0, g, 0 ); | 125 | a = new QAction( tr( "Today" ), Resource::loadPixmap( "to_day" ), QString::null, 0, g, 0 ); |
116 | connect( a, SIGNAL( activated() ), this, SLOT( slotToday() ) ); | 126 | connect( a, SIGNAL( activated() ), this, SLOT( slotToday() ) ); |
117 | a->addTo( sub_bar ); | 127 | a->addTo( sub_bar ); |
118 | a->addTo( view ); | 128 | a->addTo( view ); |
119 | 129 | ||
120 | a = new QAction( tr( "Day" ), Resource::loadPixmap( "day" ), QString::null, 0, g, 0 ); | 130 | a = new QAction( tr( "Day" ), Resource::loadPixmap( "day" ), QString::null, 0, g, 0 ); |
121 | connect( a, SIGNAL( activated() ), this, SLOT( viewDay() ) ); | 131 | connect( a, SIGNAL( activated() ), this, SLOT( viewDay() ) ); |
122 | a->addTo( sub_bar ); | 132 | a->addTo( sub_bar ); |
123 | a->addTo( view ); | 133 | a->addTo( view ); |
124 | a->setToggleAction( TRUE ); | 134 | a->setToggleAction( TRUE ); |
125 | a->setOn( TRUE ); | 135 | a->setOn( TRUE ); |
126 | dayAction = a; | 136 | dayAction = a; |
137 | |||
127 | a = new QAction( tr( "Week" ), Resource::loadPixmap( "week" ), QString::null, 0, g, 0 ); | 138 | a = new QAction( tr( "Week" ), Resource::loadPixmap( "week" ), QString::null, 0, g, 0 ); |
128 | connect( a, SIGNAL( activated() ), this, SLOT( viewWeek() ) ); | 139 | connect( a, SIGNAL( activated() ), this, SLOT( viewWeek() ) ); |
129 | a->addTo( sub_bar ); | 140 | a->addTo( sub_bar ); |
130 | a->addTo( view ); | 141 | a->addTo( view ); |
131 | a->setToggleAction( TRUE ); | 142 | a->setToggleAction( TRUE ); |
132 | weekAction = a; | 143 | weekAction = a; |
144 | |||
145 | a = new QAction( tr( "WeekLst" ), Resource::loadPixmap( "weeklst" ), QString::null, 0, g, 0 ); | ||
146 | connect( a, SIGNAL( activated() ), this, SLOT( viewWeekLst() ) ); | ||
147 | a->addTo( sub_bar ); | ||
148 | a->addTo( view ); | ||
149 | a->setToggleAction( TRUE ); | ||
150 | weekLstAction = a; | ||
151 | |||
133 | a = new QAction( tr( "Month" ), Resource::loadPixmap( "month" ), QString::null, 0, g, 0 ); | 152 | a = new QAction( tr( "Month" ), Resource::loadPixmap( "month" ), QString::null, 0, g, 0 ); |
134 | connect( a, SIGNAL( activated() ), this, SLOT( viewMonth() ) ); | 153 | connect( a, SIGNAL( activated() ), this, SLOT( viewMonth() ) ); |
135 | a->addTo( sub_bar ); | 154 | a->addTo( sub_bar ); |
136 | a->addTo( view ); | 155 | a->addTo( view ); |
137 | a->setToggleAction( TRUE ); | 156 | a->setToggleAction( TRUE ); |
138 | monthAction = a; | 157 | monthAction = a; |
139 | 158 | ||
140 | a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ), QString::null, 0, g, 0 ); | 159 | a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ), QString::null, 0, g, 0 ); |
141 | connect( a, SIGNAL(activated()), this, SLOT(slotFind()) ); | 160 | connect( a, SIGNAL(activated()), this, SLOT(slotFind()) ); |
142 | a->addTo( sub_bar ); | 161 | a->addTo( sub_bar ); |
143 | 162 | ||
144 | a = new QAction( tr( "Alarm and Start Time..." ), QString::null, 0, 0 ); | 163 | a = new QAction( tr( "Alarm and Start Time..." ), QString::null, 0, 0 ); |
145 | connect( a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); | 164 | connect( a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); |
146 | a->addTo( settings ); | 165 | a->addTo( settings ); |
147 | 166 | ||
148 | views = new QWidgetStack( this ); | 167 | QPopupMenu *default_view = new QPopupMenu(this); |
149 | setCentralWidget( views ); | 168 | settings->insertItem( tr( "Default View" ),default_view ); |
150 | 169 | default_view->setCheckable(TRUE); | |
151 | dayView = 0; | ||
152 | weekView = 0; | ||
153 | monthView = 0; | ||
154 | 170 | ||
155 | viewDay(); | 171 | |
172 | Config config("DateBook"); | ||
173 | config.setGroup("Main"); | ||
174 | int current=config.readNumEntry("defaultview", DAY); | ||
175 | |||
176 | QActionGroup *ag = new QActionGroup(this); | ||
177 | a = new QAction( tr( "Day" ), QString::null, 0, 0, 0, true ); | ||
178 | if (current==DAY) a->setOn(true), viewDay(); | ||
179 | ag->insert(a); | ||
180 | a = new QAction( tr( "Week" ), QString::null, 0, 0, 0, true ); | ||
181 | if (current==WEEK) a->setOn(true), viewWeek(); | ||
182 | ag->insert(a); | ||
183 | a = new QAction( tr( "WeekLst" ), QString::null, 0, 0, 0, true ); | ||
184 | if (current==WEEKLST) a->setOn(true), viewWeekLst(); | ||
185 | ag->insert(a); | ||
186 | a = new QAction( tr( "Month" ), QString::null, 0, 0, 0, true ); | ||
187 | if (current==MONTH) a->setOn(true), viewMonth(); | ||
188 | ag->insert(a); | ||
189 | |||
190 | ag->addTo(default_view); | ||
191 | connect(ag, SIGNAL( selected ( QAction * ) ), | ||
192 | this, SLOT( newDefaultView(QAction *) ) | ||
193 | ); | ||
194 | |||
156 | connect( qApp, SIGNAL(clockChanged(bool)), | 195 | connect( qApp, SIGNAL(clockChanged(bool)), |
157 | this, SLOT(changeClock(bool)) ); | 196 | this, SLOT(changeClock(bool)) ); |
158 | connect( qApp, SIGNAL(weekChanged(bool)), | 197 | connect( qApp, SIGNAL(weekChanged(bool)), |
159 | this, SLOT(changeWeek(bool)) ); | 198 | this, SLOT(changeWeek(bool)) ); |
160 | 199 | ||
161 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 200 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
162 | connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)), | 201 | connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)), |
163 | this, SLOT(appMessage(const QCString&, const QByteArray&)) ); | 202 | this, SLOT(appMessage(const QCString&, const QByteArray&)) ); |
164 | #endif | 203 | #endif |
165 | 204 | ||
166 | // listen on QPE/System | 205 | // listen on QPE/System |
167 | #if defined(Q_WS_QWS) | 206 | #if defined(Q_WS_QWS) |
168 | #if !defined(QT_NO_COP) | 207 | #if !defined(QT_NO_COP) |
169 | QCopChannel *channel = new QCopChannel( "QPE/System", this ); | 208 | QCopChannel *channel = new QCopChannel( "QPE/System", this ); |
170 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), | 209 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), |
171 | this, SLOT(receive(const QCString&, const QByteArray&)) ); | 210 | this, SLOT(receive(const QCString&, const QByteArray&)) ); |
172 | #endif | 211 | #endif |
173 | #endif | 212 | #endif |
174 | 213 | ||
175 | qDebug("done t=%d", t.elapsed() ); | 214 | qDebug("done t=%d", t.elapsed() ); |
176 | 215 | ||
177 | } | 216 | } |
178 | 217 | ||
179 | void DateBook::receive( const QCString &msg, const QByteArray &data ) | 218 | void DateBook::receive( const QCString &msg, const QByteArray &data ) |
180 | { | 219 | { |
181 | QDataStream stream( data, IO_ReadOnly ); | 220 | QDataStream stream( data, IO_ReadOnly ); |
182 | if ( msg == "timeChange(QString)" ) { | 221 | if ( msg == "timeChange(QString)" ) { |
183 | // update active view! | 222 | // update active view! |
184 | if ( dayAction->isOn() ) | 223 | if ( dayAction->isOn() ) |
185 | viewDay(); | 224 | viewDay(); |
186 | else if ( weekAction->isOn() ) | 225 | else if ( weekAction->isOn() ) |
187 | viewWeek(); | 226 | viewWeek(); |
188 | else if ( monthAction->isOn() ) | 227 | else if ( monthAction->isOn() ) |
189 | viewMonth(); | 228 | viewMonth(); |
190 | } | 229 | } |
191 | } | 230 | } |
192 | 231 | ||
193 | DateBook::~DateBook() | 232 | DateBook::~DateBook() |
194 | { | 233 | { |
195 | } | 234 | } |
196 | 235 | ||
197 | void DateBook::slotSettings() | 236 | void DateBook::slotSettings() |
198 | { | 237 | { |
@@ -243,116 +282,128 @@ QString DateBook::checkEvent(const Event &e) | |||
243 | break; // no more repeats | 282 | break; // no more repeats |
244 | } | 283 | } |
245 | if(next < previous.end()) { | 284 | if(next < previous.end()) { |
246 | checkFailed = TRUE; | 285 | checkFailed = TRUE; |
247 | break; | 286 | break; |
248 | } | 287 | } |
249 | current_date = next.date(); | 288 | current_date = next.date(); |
250 | } | 289 | } |
251 | 290 | ||
252 | if(checkFailed) | 291 | if(checkFailed) |
253 | return tr("Event duration is potentially longer\n" | 292 | return tr("Event duration is potentially longer\n" |
254 | "than interval between repeats."); | 293 | "than interval between repeats."); |
255 | 294 | ||
256 | return QString::null; | 295 | return QString::null; |
257 | } | 296 | } |
258 | 297 | ||
259 | QDate DateBook::currentDate() | 298 | QDate DateBook::currentDate() |
260 | { | 299 | { |
261 | QDate d = QDate::currentDate(); | 300 | QDate d = QDate::currentDate(); |
262 | 301 | ||
263 | if ( dayView && views->visibleWidget() == dayView ) { | 302 | if ( dayView && views->visibleWidget() == dayView ) { |
264 | d = dayView->date(); | 303 | d = dayView->date(); |
265 | } else if ( weekView && views->visibleWidget() == weekView ) { | 304 | } else if ( weekView && views->visibleWidget() == weekView ) { |
266 | d = weekView->date(); | 305 | d = weekView->date(); |
306 | } else if ( weekLstView && views->visibleWidget() == weekLstView ) { | ||
307 | d = weekLstView->date(); | ||
267 | } else if ( monthView && views->visibleWidget() == monthView ) { | 308 | } else if ( monthView && views->visibleWidget() == monthView ) { |
268 | d = monthView->selectedDate(); | 309 | d = monthView->selectedDate(); |
269 | } | 310 | } |
270 | 311 | ||
271 | return d; | 312 | return d; |
272 | } | 313 | } |
273 | 314 | ||
274 | void DateBook::viewDay() | 315 | void DateBook::viewDay() |
275 | { | 316 | { |
276 | initDay(); | 317 | initDay(); |
277 | dayAction->setOn( TRUE ); | 318 | dayAction->setOn( TRUE ); |
278 | QDate d = currentDate(); | 319 | QDate d = currentDate(); |
279 | dayView->setDate( d ); | 320 | dayView->setDate( d ); |
280 | views->raiseWidget( dayView ); | 321 | views->raiseWidget( dayView ); |
281 | dayView->redraw(); | 322 | dayView->redraw(); |
282 | } | 323 | } |
283 | 324 | ||
284 | void DateBook::viewWeek() | 325 | void DateBook::viewWeek() |
285 | { | 326 | { |
286 | initWeek(); | 327 | initWeek(); |
287 | weekAction->setOn( TRUE ); | 328 | weekAction->setOn( TRUE ); |
288 | QDate d = currentDate(); | 329 | QDate d = currentDate(); |
289 | weekView->setDate( d ); | 330 | weekView->setDate( d ); |
290 | views->raiseWidget( weekView ); | 331 | views->raiseWidget( weekView ); |
291 | weekView->redraw(); | 332 | weekView->redraw(); |
292 | } | 333 | } |
293 | 334 | ||
335 | void DateBook::viewWeekLst() { | ||
336 | initWeekLst(); | ||
337 | weekLstAction->setOn( TRUE ); | ||
338 | QDate d=currentDate(); | ||
339 | weekLstView->setDate(d); | ||
340 | views->raiseWidget( weekLstView ); | ||
341 | weekLstView->redraw(); | ||
342 | } | ||
343 | |||
294 | void DateBook::viewMonth() | 344 | void DateBook::viewMonth() |
295 | { | 345 | { |
296 | initMonth(); | 346 | initMonth(); |
297 | monthAction->setOn( TRUE ); | 347 | monthAction->setOn( TRUE ); |
298 | QDate d = currentDate(); | 348 | QDate d = currentDate(); |
299 | monthView->setDate( d.year(), d.month(), d.day() ); | 349 | monthView->setDate( d.year(), d.month(), d.day() ); |
300 | views->raiseWidget( monthView ); | 350 | views->raiseWidget( monthView ); |
301 | monthView->redraw(); | 351 | monthView->redraw(); |
302 | } | 352 | } |
303 | 353 | ||
304 | void DateBook::editEvent( const Event &e ) | 354 | void DateBook::editEvent( const Event &e ) |
305 | { | 355 | { |
306 | if (syncing) { | 356 | if (syncing) { |
307 | QMessageBox::warning( this, tr("Calendar"), | 357 | QMessageBox::warning( this, tr("Calendar"), |
308 | tr( "Can not edit data, currently syncing") ); | 358 | tr( "Can not edit data, currently syncing") ); |
309 | return; | 359 | return; |
310 | } | 360 | } |
311 | 361 | ||
312 | // workaround added for text input. | 362 | // workaround added for text input. |
313 | QDialog editDlg( this, 0, TRUE ); | 363 | QDialog editDlg( this, 0, TRUE ); |
314 | DateEntry *entry; | 364 | DateEntry *entry; |
315 | editDlg.setCaption( tr("Edit Event") ); | 365 | editDlg.setCaption( tr("Edit Event") ); |
316 | QVBoxLayout *vb = new QVBoxLayout( &editDlg ); | 366 | QVBoxLayout *vb = new QVBoxLayout( &editDlg ); |
317 | QScrollView *sv = new QScrollView( &editDlg, "scrollview" ); | 367 | QScrollView *sv = new QScrollView( &editDlg, "scrollview" ); |
318 | sv->setResizePolicy( QScrollView::AutoOneFit ); | 368 | sv->setResizePolicy( QScrollView::AutoOneFit ); |
319 | // KLUDGE!!! | 369 | // KLUDGE!!! |
320 | sv->setHScrollBarMode( QScrollView::AlwaysOff ); | 370 | sv->setHScrollBarMode( QScrollView::AlwaysOff ); |
321 | vb->addWidget( sv ); | 371 | vb->addWidget( sv ); |
322 | entry = new DateEntry( onMonday, e, ampm, &editDlg, "editor" ); | 372 | entry = new DateEntry( onMonday, e, ampm, &editDlg, "editor" ); |
323 | entry->timezone->setEnabled( FALSE ); | 373 | entry->timezone->setEnabled( FALSE ); |
324 | sv->addChild( entry ); | 374 | sv->addChild( entry ); |
325 | 375 | ||
326 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) | 376 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) |
327 | editDlg.showMaximized(); | 377 | editDlg.showMaximized(); |
328 | #endif | 378 | #endif |
329 | while (editDlg.exec() ) { | 379 | while (editDlg.exec() ) { |
330 | Event newEv = entry->event(); | 380 | Event newEv = entry->event(); |
331 | QString error = checkEvent(newEv); | 381 | QString error = checkEvent(newEv); |
332 | if (!error.isNull()) { | 382 | if (!error.isNull()) { |
333 | if (QMessageBox::warning(this, "error box", | 383 | if (QMessageBox::warning(this, "error box", |
334 | error, "Fix it", "Continue", 0, 0, 1) == 0) | 384 | error, "Fix it", "Continue", |
385 | 0, 0, 1) == 0) | ||
335 | continue; | 386 | continue; |
336 | } | 387 | } |
337 | db->editEvent(e, newEv); | 388 | db->editEvent(e, newEv); |
338 | emit newEvent(); | 389 | emit newEvent(); |
339 | break; | 390 | break; |
340 | } | 391 | } |
341 | } | 392 | } |
342 | 393 | ||
343 | void DateBook::removeEvent( const Event &e ) | 394 | void DateBook::removeEvent( const Event &e ) |
344 | { | 395 | { |
345 | if (syncing) { | 396 | if (syncing) { |
346 | QMessageBox::warning( this, tr("Calendar"), | 397 | QMessageBox::warning( this, tr("Calendar"), |
347 | tr( "Can not edit data, currently syncing") ); | 398 | tr( "Can not edit data, currently syncing") ); |
348 | return; | 399 | return; |
349 | } | 400 | } |
350 | 401 | ||
351 | QString strName = e.description(); | 402 | QString strName = e.description(); |
352 | 403 | ||
353 | if ( !QPEMessageBox::confirmDelete( this, tr( "Calendar" ),strName ) ) | 404 | if ( !QPEMessageBox::confirmDelete( this, tr( "Calendar" ),strName ) ) |
354 | return; | 405 | return; |
355 | 406 | ||
356 | db->removeEvent( e ); | 407 | db->removeEvent( e ); |
357 | if ( views->visibleWidget() == dayView && dayView ) | 408 | if ( views->visibleWidget() == dayView && dayView ) |
358 | dayView->redraw(); | 409 | dayView->redraw(); |
@@ -380,111 +431,145 @@ void DateBook::initDay() | |||
380 | views->addWidget( dayView, DAY ); | 431 | views->addWidget( dayView, DAY ); |
381 | dayView->setStartViewTime( startTime ); | 432 | dayView->setStartViewTime( startTime ); |
382 | connect( this, SIGNAL( newEvent() ), | 433 | connect( this, SIGNAL( newEvent() ), |
383 | dayView, SLOT( redraw() ) ); | 434 | dayView, SLOT( redraw() ) ); |
384 | connect( dayView, SIGNAL( newEvent() ), | 435 | connect( dayView, SIGNAL( newEvent() ), |
385 | this, SLOT( fileNew() ) ); | 436 | this, SLOT( fileNew() ) ); |
386 | connect( dayView, SIGNAL( removeEvent( const Event & ) ), | 437 | connect( dayView, SIGNAL( removeEvent( const Event & ) ), |
387 | this, SLOT( removeEvent( const Event & ) ) ); | 438 | this, SLOT( removeEvent( const Event & ) ) ); |
388 | connect( dayView, SIGNAL( editEvent( const Event & ) ), | 439 | connect( dayView, SIGNAL( editEvent( const Event & ) ), |
389 | this, SLOT( editEvent( const Event & ) ) ); | 440 | this, SLOT( editEvent( const Event & ) ) ); |
390 | connect( dayView, SIGNAL( beamEvent( const Event & ) ), | 441 | connect( dayView, SIGNAL( beamEvent( const Event & ) ), |
391 | this, SLOT( beamEvent( const Event & ) ) ); | 442 | this, SLOT( beamEvent( const Event & ) ) ); |
392 | connect( dayView, SIGNAL(sigNewEvent(const QString &)), | 443 | connect( dayView, SIGNAL(sigNewEvent(const QString &)), |
393 | this, SLOT(slotNewEventFromKey(const QString &)) ); | 444 | this, SLOT(slotNewEventFromKey(const QString &)) ); |
394 | } | 445 | } |
395 | } | 446 | } |
396 | 447 | ||
397 | void DateBook::initWeek() | 448 | void DateBook::initWeek() |
398 | { | 449 | { |
399 | if ( !weekView ) { | 450 | if ( !weekView ) { |
400 | weekView = new DateBookWeek( ampm, onMonday, db, views, "week view" ); | 451 | weekView = new DateBookWeek( ampm, onMonday, db, views, "week view" ); |
401 | weekView->setStartViewTime( startTime ); | 452 | weekView->setStartViewTime( startTime ); |
402 | views->addWidget( weekView, WEEK ); | 453 | views->addWidget( weekView, WEEK ); |
403 | connect( weekView, SIGNAL( showDate( int, int, int ) ), | 454 | connect( weekView, SIGNAL( showDate( int, int, int ) ), |
404 | this, SLOT( showDay( int, int, int ) ) ); | 455 | this, SLOT( showDay( int, int, int ) ) ); |
405 | connect( this, SIGNAL( newEvent() ), | 456 | connect( this, SIGNAL( newEvent() ), |
406 | weekView, SLOT( redraw() ) ); | 457 | weekView, SLOT( redraw() ) ); |
407 | } | 458 | } |
408 | //But also get it right: the year that we display can be different | 459 | //But also get it right: the year that we display can be different |
409 | //from the year of the current date. So, first find the year | 460 | //from the year of the current date. So, first find the year |
410 | //number of the current week. | 461 | //number of the current week. |
411 | 462 | ||
412 | int yearNumber, totWeeks; | 463 | int yearNumber, totWeeks; |
413 | calcWeek( currentDate(), totWeeks, yearNumber, onMonday ); | 464 | calcWeek( currentDate(), totWeeks, yearNumber, onMonday ); |
414 | 465 | ||
415 | QDate d = QDate( yearNumber, 12, 31 ); | 466 | QDate d = QDate( yearNumber, 12, 31 ); |
416 | calcWeek( d, totWeeks, yearNumber, onMonday ); | 467 | calcWeek( d, totWeeks, yearNumber, onMonday ); |
417 | 468 | ||
418 | while ( totWeeks == 1 ) { | 469 | while ( totWeeks == 1 ) { |
419 | d = d.addDays( -1 ); | 470 | d = d.addDays( -1 ); |
420 | calcWeek( d, totWeeks, yearNumber, onMonday ); | 471 | calcWeek( d, totWeeks, yearNumber, onMonday ); |
421 | } | 472 | } |
422 | if ( totWeeks != weekView->totalWeeks() ) | 473 | if ( totWeeks != weekView->totalWeeks() ) |
423 | weekView->setTotalWeeks( totWeeks ); | 474 | weekView->setTotalWeeks( totWeeks ); |
424 | } | 475 | } |
476 | void DateBook::initWeekLst() { | ||
477 | if ( !weekLstView ) { | ||
478 | weekLstView = new DateBookWeekLst( ampm, onMonday, db, | ||
479 | views, "weeklst view" ); | ||
480 | views->addWidget( weekLstView, WEEKLST ); | ||
481 | |||
482 | //weekLstView->setStartViewTime( startTime ); | ||
483 | connect( weekLstView, SIGNAL( showDate( int, int, int ) ), | ||
484 | this, SLOT( showDay( int, int, int ) ) ); | ||
485 | connect( weekLstView, SIGNAL( addEvent( const QDateTime &, | ||
486 | const QDateTime &, | ||
487 | const QString & ) ), | ||
488 | this, SLOT( slotNewEntry( const QDateTime &, | ||
489 | const QDateTime &, | ||
490 | const QString & ) ) ); | ||
491 | connect( this, SIGNAL( newEvent() ), | ||
492 | weekLstView, SLOT( redraw() ) ); | ||
493 | connect( weekLstView, SIGNAL( editEvent( const Event & ) ), | ||
494 | this, SLOT( editEvent( const Event & ) ) ); | ||
495 | } | ||
496 | } | ||
497 | |||
425 | 498 | ||
426 | void DateBook::initMonth() | 499 | void DateBook::initMonth() |
427 | { | 500 | { |
428 | if ( !monthView ) { | 501 | if ( !monthView ) { |
429 | monthView = new DateBookMonth( views, "month view", FALSE, db ); | 502 | monthView = new DateBookMonth( views, "month view", FALSE, db ); |
430 | views->addWidget( monthView, MONTH ); | 503 | views->addWidget( monthView, MONTH ); |
431 | connect( monthView, SIGNAL( dateClicked( int, int, int ) ), | 504 | connect( monthView, SIGNAL( dateClicked( int, int, int ) ), |
432 | this, SLOT( showDay( int, int, int ) ) ); | 505 | this, SLOT( showDay( int, int, int ) ) ); |
433 | connect( this, SIGNAL( newEvent() ), | 506 | connect( this, SIGNAL( newEvent() ), |
434 | monthView, SLOT( redraw() ) ); | 507 | monthView, SLOT( redraw() ) ); |
435 | qApp->processEvents(); | 508 | qApp->processEvents(); |
436 | } | 509 | } |
437 | } | 510 | } |
438 | 511 | ||
439 | void DateBook::loadSettings() | 512 | void DateBook::loadSettings() |
440 | { | 513 | { |
441 | { | 514 | { |
442 | Config config( "qpe" ); | 515 | Config config( "qpe" ); |
443 | config.setGroup("Time"); | 516 | config.setGroup("Time"); |
444 | ampm = config.readBoolEntry( "AMPM", TRUE ); | 517 | ampm = config.readBoolEntry( "AMPM", TRUE ); |
445 | onMonday = config.readBoolEntry( "MONDAY" ); | 518 | onMonday = config.readBoolEntry( "MONDAY" ); |
446 | } | 519 | } |
447 | 520 | ||
448 | { | 521 | { |
449 | Config config("DateBook"); | 522 | Config config("DateBook"); |
450 | config.setGroup("Main"); | 523 | config.setGroup("Main"); |
451 | startTime = config.readNumEntry("startviewtime", 8); | 524 | startTime = config.readNumEntry("startviewtime", 8); |
452 | aPreset = config.readBoolEntry("alarmpreset"); | 525 | aPreset = config.readBoolEntry("alarmpreset"); |
453 | presetTime = config.readNumEntry("presettime"); | 526 | presetTime = config.readNumEntry("presettime"); |
454 | } | 527 | } |
455 | } | 528 | } |
456 | 529 | ||
457 | void DateBook::saveSettings() | 530 | void DateBook::saveSettings() |
458 | { | 531 | { |
459 | Config config( "qpe" ); | 532 | Config config( "qpe" ); |
460 | Config configDB( "DateBook" ); | 533 | Config configDB( "DateBook" ); |
461 | configDB.setGroup( "Main" ); | 534 | configDB.setGroup( "Main" ); |
462 | configDB.writeEntry("startviewtime",startTime); | 535 | configDB.writeEntry("startviewtime",startTime); |
463 | configDB.writeEntry("alarmpreset",aPreset); | 536 | configDB.writeEntry("alarmpreset",aPreset); |
464 | configDB.writeEntry("presettime",presetTime); | 537 | configDB.writeEntry("presettime",presetTime); |
465 | } | 538 | } |
466 | 539 | ||
540 | void DateBook::newDefaultView(QAction *a) { | ||
541 | int val=DAY; | ||
542 | if (a->text() == "Day") val=DAY; | ||
543 | if (a->text() == "Week") val=WEEK; | ||
544 | if (a->text() == "WeekLst") val=WEEKLST; | ||
545 | if (a->text() == "Month") val=MONTH; | ||
546 | |||
547 | Config configDB( "DateBook" ); | ||
548 | configDB.setGroup( "Main" ); | ||
549 | configDB.writeEntry("defaultview",val); | ||
550 | } | ||
551 | |||
467 | void DateBook::appMessage(const QCString& msg, const QByteArray& data) | 552 | void DateBook::appMessage(const QCString& msg, const QByteArray& data) |
468 | { | 553 | { |
469 | bool needShow = FALSE; | 554 | bool needShow = FALSE; |
470 | if ( msg == "alarm(QDateTime,int)" ) { | 555 | if ( msg == "alarm(QDateTime,int)" ) { |
471 | QDataStream ds(data,IO_ReadOnly); | 556 | QDataStream ds(data,IO_ReadOnly); |
472 | QDateTime when; int warn; | 557 | QDateTime when; int warn; |
473 | ds >> when >> warn; | 558 | ds >> when >> warn; |
474 | 559 | ||
475 | // check to make it's okay to continue, | 560 | // check to make it's okay to continue, |
476 | // this is the case that the time was set ahead, and | 561 | // this is the case that the time was set ahead, and |
477 | // we are forced given a stale alarm... | 562 | // we are forced given a stale alarm... |
478 | QDateTime current = QDateTime::currentDateTime(); | 563 | QDateTime current = QDateTime::currentDateTime(); |
479 | if ( current.time().hour() != when.time().hour() | 564 | if ( current.time().hour() != when.time().hour() |
480 | && current.time().minute() != when.time().minute() ) | 565 | && current.time().minute() != when.time().minute() ) |
481 | return; | 566 | return; |
482 | 567 | ||
483 | QValueList<EffectiveEvent> list = db->getEffectiveEvents(when.addSecs(warn*60)); | 568 | QValueList<EffectiveEvent> list = db->getEffectiveEvents(when.addSecs(warn*60)); |
484 | if ( list.count() > 0 ) { | 569 | if ( list.count() > 0 ) { |
485 | QString msg; | 570 | QString msg; |
486 | bool bSound = FALSE; | 571 | bool bSound = FALSE; |
487 | int stopTimer = 0; | 572 | int stopTimer = 0; |
488 | bool found = FALSE; | 573 | bool found = FALSE; |
489 | for ( QValueList<EffectiveEvent>::ConstIterator it=list.begin(); | 574 | for ( QValueList<EffectiveEvent>::ConstIterator it=list.begin(); |
490 | it!=list.end(); ++it ) { | 575 | it!=list.end(); ++it ) { |
@@ -515,48 +600,50 @@ void DateBook::appMessage(const QCString& msg, const QByteArray& data) | |||
515 | QScrollView *view = new QScrollView( &dlg, "scrollView"); | 600 | QScrollView *view = new QScrollView( &dlg, "scrollView"); |
516 | view->setResizePolicy( QScrollView::AutoOneFit ); | 601 | view->setResizePolicy( QScrollView::AutoOneFit ); |
517 | vb->addWidget( view ); | 602 | vb->addWidget( view ); |
518 | QLabel *lblMsg = new QLabel( msg, &dlg ); | 603 | QLabel *lblMsg = new QLabel( msg, &dlg ); |
519 | view->addChild( lblMsg ); | 604 | view->addChild( lblMsg ); |
520 | QPushButton *cmdOk = new QPushButton( tr("OK"), &dlg ); | 605 | QPushButton *cmdOk = new QPushButton( tr("OK"), &dlg ); |
521 | connect( cmdOk, SIGNAL(clicked()), &dlg, SLOT(accept()) ); | 606 | connect( cmdOk, SIGNAL(clicked()), &dlg, SLOT(accept()) ); |
522 | vb->addWidget( cmdOk ); | 607 | vb->addWidget( cmdOk ); |
523 | 608 | ||
524 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) | 609 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) |
525 | dlg.showMaximized(); | 610 | dlg.showMaximized(); |
526 | #endif | 611 | #endif |
527 | needShow = dlg.exec(); | 612 | needShow = dlg.exec(); |
528 | 613 | ||
529 | if ( bSound ) | 614 | if ( bSound ) |
530 | killTimer( stopTimer ); | 615 | killTimer( stopTimer ); |
531 | } | 616 | } |
532 | } | 617 | } |
533 | } else if ( msg == "nextView()" ) { | 618 | } else if ( msg == "nextView()" ) { |
534 | QWidget* cur = views->visibleWidget(); | 619 | QWidget* cur = views->visibleWidget(); |
535 | if ( cur ) { | 620 | if ( cur ) { |
536 | if ( cur == dayView ) | 621 | if ( cur == dayView ) |
537 | viewWeek(); | 622 | viewWeek(); |
538 | else if ( cur == weekView ) | 623 | else if ( cur == weekView ) |
624 | viewWeekLst(); | ||
625 | else if ( cur == weekLstView ) | ||
539 | viewMonth(); | 626 | viewMonth(); |
540 | else if ( cur == monthView ) | 627 | else if ( cur == monthView ) |
541 | viewDay(); | 628 | viewDay(); |
542 | needShow = TRUE; | 629 | needShow = TRUE; |
543 | } | 630 | } |
544 | } | 631 | } |
545 | if ( needShow ) { | 632 | if ( needShow ) { |
546 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) | 633 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) |
547 | showMaximized(); | 634 | showMaximized(); |
548 | #else | 635 | #else |
549 | show(); | 636 | show(); |
550 | #endif | 637 | #endif |
551 | raise(); | 638 | raise(); |
552 | QPEApplication::setKeepRunning(); | 639 | QPEApplication::setKeepRunning(); |
553 | setActiveWindow(); | 640 | setActiveWindow(); |
554 | } | 641 | } |
555 | } | 642 | } |
556 | 643 | ||
557 | void DateBook::reload() | 644 | void DateBook::reload() |
558 | { | 645 | { |
559 | db->reload(); | 646 | db->reload(); |
560 | if ( dayAction->isOn() ) | 647 | if ( dayAction->isOn() ) |
561 | viewDay(); | 648 | viewDay(); |
562 | else if ( weekAction->isOn() ) | 649 | else if ( weekAction->isOn() ) |
@@ -569,48 +656,49 @@ void DateBook::reload() | |||
569 | void DateBook::flush() | 656 | void DateBook::flush() |
570 | { | 657 | { |
571 | syncing = TRUE; | 658 | syncing = TRUE; |
572 | db->save(); | 659 | db->save(); |
573 | } | 660 | } |
574 | 661 | ||
575 | void DateBook::timerEvent( QTimerEvent *e ) | 662 | void DateBook::timerEvent( QTimerEvent *e ) |
576 | { | 663 | { |
577 | static int stop = 0; | 664 | static int stop = 0; |
578 | if ( stop < 10 ) { | 665 | if ( stop < 10 ) { |
579 | Sound::soundAlarm(); | 666 | Sound::soundAlarm(); |
580 | stop++; | 667 | stop++; |
581 | } else { | 668 | } else { |
582 | stop = 0; | 669 | stop = 0; |
583 | killTimer( e->timerId() ); | 670 | killTimer( e->timerId() ); |
584 | } | 671 | } |
585 | } | 672 | } |
586 | 673 | ||
587 | void DateBook::changeClock( bool newClock ) | 674 | void DateBook::changeClock( bool newClock ) |
588 | { | 675 | { |
589 | ampm = newClock; | 676 | ampm = newClock; |
590 | // repaint the affected objects... | 677 | // repaint the affected objects... |
591 | if (dayView) dayView->redraw(); | 678 | if (dayView) dayView->redraw(); |
592 | if (weekView) weekView->redraw(); | 679 | if (weekView) weekView->redraw(); |
680 | if (weekLstView) weekLstView->redraw(); | ||
593 | } | 681 | } |
594 | 682 | ||
595 | void DateBook::changeWeek( bool m ) | 683 | void DateBook::changeWeek( bool m ) |
596 | { | 684 | { |
597 | /* no need to redraw, each widget catches. Do need to | 685 | /* no need to redraw, each widget catches. Do need to |
598 | store though for widgets we haven't made yet */ | 686 | store though for widgets we haven't made yet */ |
599 | onMonday = m; | 687 | onMonday = m; |
600 | } | 688 | } |
601 | 689 | ||
602 | void DateBook::slotToday() | 690 | void DateBook::slotToday() |
603 | { | 691 | { |
604 | // we need to view today | 692 | // we need to view today |
605 | QDate dt = QDate::currentDate(); | 693 | QDate dt = QDate::currentDate(); |
606 | showDay( dt.year(), dt.month(), dt.day() ); | 694 | showDay( dt.year(), dt.month(), dt.day() ); |
607 | } | 695 | } |
608 | 696 | ||
609 | void DateBook::closeEvent( QCloseEvent *e ) | 697 | void DateBook::closeEvent( QCloseEvent *e ) |
610 | { | 698 | { |
611 | if(syncing) { | 699 | if(syncing) { |
612 | /* no need to save, did that at flush */ | 700 | /* no need to save, did that at flush */ |
613 | e->accept(); | 701 | e->accept(); |
614 | return; | 702 | return; |
615 | } | 703 | } |
616 | 704 | ||
@@ -639,49 +727,51 @@ void DateBook::slotNewEventFromKey( const QString &str ) | |||
639 | { | 727 | { |
640 | if (syncing) { | 728 | if (syncing) { |
641 | QMessageBox::warning( this, tr("Calendar"), | 729 | QMessageBox::warning( this, tr("Calendar"), |
642 | tr( "Can not edit data, currently syncing") ); | 730 | tr( "Can not edit data, currently syncing") ); |
643 | return; | 731 | return; |
644 | } | 732 | } |
645 | 733 | ||
646 | // We get to here from a key pressed in the Day View | 734 | // We get to here from a key pressed in the Day View |
647 | // So we can assume some things. We want the string | 735 | // So we can assume some things. We want the string |
648 | // passed in to be part of the description. | 736 | // passed in to be part of the description. |
649 | QDateTime start, end; | 737 | QDateTime start, end; |
650 | if ( views->visibleWidget() == dayView ) { | 738 | if ( views->visibleWidget() == dayView ) { |
651 | dayView->selectedDates( start, end ); | 739 | dayView->selectedDates( start, end ); |
652 | } else if ( views->visibleWidget() == monthView ) { | 740 | } else if ( views->visibleWidget() == monthView ) { |
653 | QDate d = monthView->selectedDate(); | 741 | QDate d = monthView->selectedDate(); |
654 | start = end = d; | 742 | start = end = d; |
655 | start.setTime( QTime( 10, 0 ) ); | 743 | start.setTime( QTime( 10, 0 ) ); |
656 | end.setTime( QTime( 12, 0 ) ); | 744 | end.setTime( QTime( 12, 0 ) ); |
657 | } else if ( views->visibleWidget() == weekView ) { | 745 | } else if ( views->visibleWidget() == weekView ) { |
658 | QDate d = weekView->date(); | 746 | QDate d = weekView->date(); |
659 | start = end = d; | 747 | start = end = d; |
660 | start.setTime( QTime( 10, 0 ) ); | 748 | start.setTime( QTime( 10, 0 ) ); |
661 | end.setTime( QTime( 12, 0 ) ); | 749 | end.setTime( QTime( 12, 0 ) ); |
662 | } | 750 | } |
663 | 751 | slotNewEntry(start, end, str); | |
752 | } | ||
753 | void DateBook::slotNewEntry(const QDateTime &start, const QDateTime &end, const QString &str) { | ||
664 | // argh! This really needs to be encapsulated in a class | 754 | // argh! This really needs to be encapsulated in a class |
665 | // or function. | 755 | // or function. |
666 | QDialog newDlg( this, 0, TRUE ); | 756 | QDialog newDlg( this, 0, TRUE ); |
667 | newDlg.setCaption( DateEntryBase::tr("New Event") ); | 757 | newDlg.setCaption( DateEntryBase::tr("New Event") ); |
668 | DateEntry *e; | 758 | DateEntry *e; |
669 | QVBoxLayout *vb = new QVBoxLayout( &newDlg ); | 759 | QVBoxLayout *vb = new QVBoxLayout( &newDlg ); |
670 | QScrollView *sv = new QScrollView( &newDlg ); | 760 | QScrollView *sv = new QScrollView( &newDlg ); |
671 | sv->setResizePolicy( QScrollView::AutoOneFit ); | 761 | sv->setResizePolicy( QScrollView::AutoOneFit ); |
672 | sv->setFrameStyle( QFrame::NoFrame ); | 762 | sv->setFrameStyle( QFrame::NoFrame ); |
673 | sv->setHScrollBarMode( QScrollView::AlwaysOff ); | 763 | sv->setHScrollBarMode( QScrollView::AlwaysOff ); |
674 | vb->addWidget( sv ); | 764 | vb->addWidget( sv ); |
675 | 765 | ||
676 | Event ev; | 766 | Event ev; |
677 | ev.setDescription( str ); | 767 | ev.setDescription( str ); |
678 | // When the new gui comes in, change this... | 768 | // When the new gui comes in, change this... |
679 | ev.setLocation( tr("(Unknown)") ); | 769 | ev.setLocation( tr("(Unknown)") ); |
680 | ev.setStart( start ); | 770 | ev.setStart( start ); |
681 | ev.setEnd( end ); | 771 | ev.setEnd( end ); |
682 | 772 | ||
683 | e = new DateEntry( onMonday, ev, ampm, &newDlg ); | 773 | e = new DateEntry( onMonday, ev, ampm, &newDlg ); |
684 | e->setAlarmEnabled( aPreset, presetTime, Event::Loud ); | 774 | e->setAlarmEnabled( aPreset, presetTime, Event::Loud ); |
685 | sv->addChild( e ); | 775 | sv->addChild( e ); |
686 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) | 776 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) |
687 | newDlg.showMaximized(); | 777 | newDlg.showMaximized(); |
diff --git a/core/pim/datebook/datebook.h b/core/pim/datebook/datebook.h index 44627bb..fcdbfec 100644 --- a/core/pim/datebook/datebook.h +++ b/core/pim/datebook/datebook.h | |||
@@ -7,105 +7,111 @@ | |||
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #ifndef DATEBOOK_H | 20 | #ifndef DATEBOOK_H |
21 | #define DATEBOOK_H | 21 | #define DATEBOOK_H |
22 | 22 | ||
23 | #include <qpe/datebookdb.h> | 23 | #include <qpe/datebookdb.h> |
24 | 24 | ||
25 | #include <qmainwindow.h> | 25 | #include <qmainwindow.h> |
26 | 26 | ||
27 | class QAction; | 27 | class QAction; |
28 | class QWidgetStack; | 28 | class QWidgetStack; |
29 | class DateBookDay; | 29 | class DateBookDay; |
30 | class DateBookWeek; | 30 | class DateBookWeek; |
31 | class DateBookWeekLst; | ||
31 | class DateBookMonth; | 32 | class DateBookMonth; |
32 | class Event; | 33 | class Event; |
33 | class QDate; | 34 | class QDate; |
34 | class Ir; | 35 | class Ir; |
35 | 36 | ||
36 | class DateBook : public QMainWindow | 37 | class DateBook : public QMainWindow |
37 | { | 38 | { |
38 | Q_OBJECT | 39 | Q_OBJECT |
39 | 40 | ||
40 | public: | 41 | public: |
41 | DateBook( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); | 42 | DateBook( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); |
42 | ~DateBook(); | 43 | ~DateBook(); |
43 | 44 | ||
44 | signals: | 45 | signals: |
45 | void newEvent(); | 46 | void newEvent(); |
46 | void signalNotFound(); | 47 | void signalNotFound(); |
47 | void signalWrapAround(); | 48 | void signalWrapAround(); |
48 | 49 | ||
49 | protected: | 50 | protected: |
50 | QDate currentDate(); | 51 | QDate currentDate(); |
51 | void timerEvent( QTimerEvent *e ); | 52 | void timerEvent( QTimerEvent *e ); |
52 | void closeEvent( QCloseEvent *e ); | 53 | void closeEvent( QCloseEvent *e ); |
53 | 54 | ||
54 | public slots: | 55 | public slots: |
55 | void flush(); | 56 | void flush(); |
56 | void reload(); | 57 | void reload(); |
57 | 58 | ||
58 | private slots: | 59 | private slots: |
59 | void fileNew(); | 60 | void fileNew(); |
61 | void slotNewEntry(const QDateTime &start, const QDateTime &end, const QString &str); | ||
60 | void slotSettings(); | 62 | void slotSettings(); |
63 | void newDefaultView(QAction *a); | ||
61 | void slotToday();// view today | 64 | void slotToday();// view today |
62 | void changeClock( bool newClock ); | 65 | void changeClock( bool newClock ); |
63 | void changeWeek( bool newDay ); | 66 | void changeWeek( bool newDay ); |
64 | void appMessage(const QCString& msg, const QByteArray& data); | 67 | void appMessage(const QCString& msg, const QByteArray& data); |
65 | // handle key events in the day view... | 68 | // handle key events in the day view... |
66 | void slotNewEventFromKey( const QString &str ); | 69 | void slotNewEventFromKey( const QString &str ); |
67 | void slotFind(); | 70 | void slotFind(); |
68 | void slotDoFind( const QString &, const QDate &, bool, bool, int ); | 71 | void slotDoFind( const QString &, const QDate &, bool, bool, int ); |
69 | 72 | ||
70 | void viewDay(); | 73 | void viewDay(); |
71 | void viewWeek(); | 74 | void viewWeek(); |
75 | void viewWeekLst(); | ||
72 | void viewMonth(); | 76 | void viewMonth(); |
73 | 77 | ||
74 | void showDay( int y, int m, int d ); | 78 | void showDay( int y, int m, int d ); |
75 | 79 | ||
76 | void editEvent( const Event &e ); | 80 | void editEvent( const Event &e ); |
77 | void removeEvent( const Event &e ); | 81 | void removeEvent( const Event &e ); |
78 | 82 | ||
79 | void receive( const QCString &msg, const QByteArray &data ); | 83 | void receive( const QCString &msg, const QByteArray &data ); |
80 | void setDocument( const QString & ); | 84 | void setDocument( const QString & ); |
81 | void beamEvent( const Event &e ); | 85 | void beamEvent( const Event &e ); |
82 | void beamDone( Ir *ir ); | 86 | void beamDone( Ir *ir ); |
83 | 87 | ||
84 | private: | 88 | private: |
85 | void addEvent( const Event &e ); | 89 | void addEvent( const Event &e ); |
86 | void initDay(); | 90 | void initDay(); |
87 | void initWeek(); | 91 | void initWeek(); |
92 | void initWeekLst(); | ||
88 | void initMonth(); | 93 | void initMonth(); |
89 | void loadSettings(); | 94 | void loadSettings(); |
90 | void saveSettings(); | 95 | void saveSettings(); |
91 | 96 | ||
92 | private: | 97 | private: |
93 | DateBookDB *db; | 98 | DateBookDB *db; |
94 | QWidgetStack *views; | 99 | QWidgetStack *views; |
95 | DateBookDay *dayView; | 100 | DateBookDay *dayView; |
96 | DateBookWeek *weekView; | 101 | DateBookWeek *weekView; |
97 | DateBookMonth *monthView; | 102 | DateBookMonth *monthView; |
98 | QAction *dayAction, *weekAction, *monthAction; | 103 | DateBookWeekLst *weekLstView; |
104 | QAction *dayAction, *weekAction, *weekLstAction, *monthAction; | ||
99 | bool aPreset; // have everything set to alarm? | 105 | bool aPreset; // have everything set to alarm? |
100 | int presetTime; // the standard time for the alarm | 106 | int presetTime; // the standard time for the alarm |
101 | int startTime; | 107 | int startTime; |
102 | bool ampm; | 108 | bool ampm; |
103 | bool onMonday; | 109 | bool onMonday; |
104 | 110 | ||
105 | bool syncing; | 111 | bool syncing; |
106 | bool inSearch; | 112 | bool inSearch; |
107 | 113 | ||
108 | QString checkEvent(const Event &); | 114 | QString checkEvent(const Event &); |
109 | }; | 115 | }; |
110 | 116 | ||
111 | #endif | 117 | #endif |
diff --git a/core/pim/datebook/datebook.pro b/core/pim/datebook/datebook.pro index fae5d2b..bbe07af 100644 --- a/core/pim/datebook/datebook.pro +++ b/core/pim/datebook/datebook.pro | |||
@@ -1,36 +1,42 @@ | |||
1 | TEMPLATE= app | 1 | TEMPLATE= app |
2 | CONFIG += qt warn_on release | 2 | CONFIG += qt warn_on release |
3 | DESTDIR = $(OPIEDIR)/bin | 3 | DESTDIR = $(OPIEDIR)/bin |
4 | 4 | ||
5 | HEADERS= datebookday.h \ | 5 | HEADERS= datebookday.h \ |
6 | datebook.h \ | 6 | datebook.h \ |
7 | dateentryimpl.h \ | 7 | dateentryimpl.h \ |
8 | datebookdayheaderimpl.h \ | 8 | datebookdayheaderimpl.h \ |
9 | datebooksettings.h \ | 9 | datebooksettings.h \ |
10 | datebookweek.h \ | 10 | datebookweek.h \ |
11 | datebookweekheaderimpl.h \ | 11 | datebookweeklst.h \ |
12 | repeatentry.h | 12 | datebookweekheaderimpl.h \ |
13 | repeatentry.h \ | ||
14 | clickablelabel.h | ||
13 | 15 | ||
14 | SOURCES= main.cpp \ | 16 | SOURCES= main.cpp \ |
15 | datebookday.cpp \ | 17 | datebookday.cpp \ |
16 | datebook.cpp \ | 18 | datebook.cpp \ |
17 | dateentryimpl.cpp \ | 19 | dateentryimpl.cpp \ |
18 | datebookdayheaderimpl.cpp \ | 20 | datebookdayheaderimpl.cpp \ |
19 | datebooksettings.cpp \ | 21 | datebooksettings.cpp \ |
20 | datebookweek.cpp \ | 22 | datebookweek.cpp \ |
21 | datebookweekheaderimpl.cpp \ | 23 | datebookweeklst.cpp \ |
22 | repeatentry.cpp | 24 | datebookweekheaderimpl.cpp \ |
25 | repeatentry.cpp \ | ||
26 | clickablelabel.cpp | ||
23 | 27 | ||
24 | INTERFACES= dateentry.ui \ | 28 | INTERFACES= dateentry.ui \ |
25 | datebookdayheader.ui \ | 29 | datebookdayheader.ui \ |
26 | datebooksettingsbase.ui \ | 30 | datebooksettingsbase.ui \ |
27 | datebookweekheader.ui \ | 31 | datebookweekheader.ui \ |
28 | repeatentrybase.ui | 32 | datebookweeklstheader.ui \ |
33 | datebookweeklstdayhdr.ui \ | ||
34 | repeatentrybase.ui | ||
29 | 35 | ||
30 | INCLUDEPATH += $(OPIEDIR)/include | 36 | INCLUDEPATH += $(OPIEDIR)/include |
31 | DEPENDPATH+= $(OPIEDIR)/include | 37 | DEPENDPATH+= $(OPIEDIR)/include |
32 | LIBS += -lqpe | 38 | LIBS += -lqpe |
33 | 39 | ||
34 | TARGET = datebook | 40 | TARGET = datebook |
35 | 41 | ||
36 | TRANSLATIONS = ../i18n/de/datebook.ts | 42 | TRANSLATIONS = ../i18n/de/datebook.ts |
diff --git a/core/pim/datebook/datebookweeklst.cpp b/core/pim/datebook/datebookweeklst.cpp new file mode 100644 index 0000000..05e36be --- a/dev/null +++ b/core/pim/datebook/datebookweeklst.cpp | |||
@@ -0,0 +1,314 @@ | |||
1 | #include "datebookweeklst.h" | ||
2 | |||
3 | #include "datebookweekheaderimpl.h" | ||
4 | |||
5 | #include <qpe/calendar.h> | ||
6 | #include <qpe/datebookdb.h> | ||
7 | #include <qpe/event.h> | ||
8 | #include <qpe/qpeapplication.h> | ||
9 | #include <qpe/timestring.h> | ||
10 | #include <qpe/datebookmonth.h> | ||
11 | |||
12 | #include <qdatetime.h> | ||
13 | #include <qheader.h> | ||
14 | #include <qlabel.h> | ||
15 | #include <qlayout.h> | ||
16 | #include <qpainter.h> | ||
17 | #include <qpopupmenu.h> | ||
18 | #include <qtimer.h> | ||
19 | #include <qstyle.h> | ||
20 | #include <qtoolbutton.h> | ||
21 | #include <qvbox.h> | ||
22 | #include <qsizepolicy.h> | ||
23 | #include <qabstractlayout.h> | ||
24 | #include <qtl.h> | ||
25 | |||
26 | bool calcWeek(const QDate &d, int &week, int &year, | ||
27 | bool startOnMonday = false); | ||
28 | |||
29 | DateBookWeekLstHeader::DateBookWeekLstHeader(bool onM, QWidget* parent, | ||
30 | const char* name, WFlags fl) | ||
31 | : DateBookWeekLstHeaderBase(parent, name, fl) | ||
32 | { | ||
33 | setBackgroundMode( PaletteButton ); | ||
34 | labelDate->setBackgroundMode( PaletteButton ); | ||
35 | labelWeek->setBackgroundMode( PaletteButton ); | ||
36 | forward->setBackgroundMode( PaletteButton ); | ||
37 | back->setBackgroundMode( PaletteButton ); | ||
38 | DateBookWeekLstHeaderBaseLayout->setSpacing(0); | ||
39 | DateBookWeekLstHeaderBaseLayout->setMargin(0); | ||
40 | //setSizePolicy(QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Expanding)); | ||
41 | setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed)); | ||
42 | |||
43 | connect(back, SIGNAL(clicked()), this, SLOT(prevWeek())); | ||
44 | connect(forward, SIGNAL(clicked()), this, SLOT(nextWeek())); | ||
45 | connect(labelWeek, SIGNAL(clicked()), this, SLOT(pickDate())); | ||
46 | onMonday=onM; | ||
47 | } | ||
48 | DateBookWeekLstHeader::~DateBookWeekLstHeader(){} | ||
49 | void DateBookWeekLstHeader::setDate(QDate d) { | ||
50 | date=d; | ||
51 | |||
52 | int year,week; | ||
53 | calcWeek(d,week,year,onMonday); | ||
54 | labelWeek->setText("W: " + QString::number(week)); | ||
55 | |||
56 | QDate start=date; | ||
57 | QDate stop=start.addDays(6); | ||
58 | labelDate->setText( QString::number(start.day()) + " " + | ||
59 | start.monthName(start.month()) + " - " + | ||
60 | QString::number(stop.day()) + " " + | ||
61 | start.monthName(stop.month()) ); | ||
62 | emit dateChanged(year,week); | ||
63 | } | ||
64 | void DateBookWeekLstHeader::pickDate() { | ||
65 | static QPopupMenu *m1 = 0; | ||
66 | static DateBookMonth *picker = 0; | ||
67 | if ( !m1 ) { | ||
68 | m1 = new QPopupMenu( this ); | ||
69 | picker = new DateBookMonth( m1, 0, TRUE ); | ||
70 | m1->insertItem( picker ); | ||
71 | connect( picker, SIGNAL( dateClicked( int, int, int ) ), | ||
72 | this, SLOT( setDate( int, int, int ) ) ); | ||
73 | //connect( m1, SIGNAL( aboutToHide() ), | ||
74 | //this, SLOT( gotHide() ) ); | ||
75 | } | ||
76 | picker->setDate( date.year(), date.month(), date.day() ); | ||
77 | m1->popup(mapToGlobal(labelWeek->pos()+QPoint(0,labelWeek->height()))); | ||
78 | picker->setFocus(); | ||
79 | } | ||
80 | void DateBookWeekLstHeader::setDate(int y, int m, int d) { | ||
81 | QDate new_date(y,m,d); | ||
82 | setDate(new_date); | ||
83 | } | ||
84 | |||
85 | void DateBookWeekLstHeader::nextWeek() { | ||
86 | setDate(date.addDays(7)); | ||
87 | } | ||
88 | void DateBookWeekLstHeader::prevWeek() { | ||
89 | setDate(date.addDays(-7)); | ||
90 | } | ||
91 | |||
92 | DateBookWeekLstDayHdr::DateBookWeekLstDayHdr(const QDate &d, bool onM, | ||
93 | QWidget* parent = 0, | ||
94 | const char* name = 0, | ||
95 | WFlags fl = 0 ) | ||
96 | : DateBookWeekLstDayHdrBase(parent, name, fl) { | ||
97 | |||
98 | date=d; | ||
99 | |||
100 | static const char *wdays="MTWTFSS"; | ||
101 | char day=wdays[d.dayOfWeek()-1]; | ||
102 | |||
103 | label->setText( QString(QChar(day)) + " " + | ||
104 | QString::number(d.day()) ); | ||
105 | add->setText("+"); | ||
106 | |||
107 | if (d == QDate::currentDate()) { | ||
108 | QPalette pal=label->palette(); | ||
109 | pal.setColor(QColorGroup::Foreground, QColor(0,0,255)); | ||
110 | label->setPalette(pal); | ||
111 | |||
112 | /* | ||
113 | QFont f=label->font(); | ||
114 | f.setItalic(true); | ||
115 | label->setFont(f); | ||
116 | label->setPalette(QPalette(QColor(0,0,255),label->backgroundColor())); | ||
117 | */ | ||
118 | } else if (d.dayOfWeek() == 7) { // FIXME: Match any holiday | ||
119 | QPalette pal=label->palette(); | ||
120 | pal.setColor(QColorGroup::Foreground, QColor(255,0,0)); | ||
121 | label->setPalette(pal); | ||
122 | } | ||
123 | |||
124 | |||
125 | connect (label, SIGNAL(clicked()), this, SLOT(showDay())); | ||
126 | connect (add, SIGNAL(clicked()), this, SLOT(newEvent())); | ||
127 | } | ||
128 | |||
129 | void DateBookWeekLstDayHdr::showDay() { | ||
130 | emit showDate(date.year(), date.month(), date.day()); | ||
131 | } | ||
132 | void DateBookWeekLstDayHdr::newEvent() { | ||
133 | QDateTime start, stop; | ||
134 | start=stop=date; | ||
135 | start.setTime(QTime(10,0)); | ||
136 | stop.setTime(QTime(12,0)); | ||
137 | |||
138 | emit addEvent(start,stop,""); | ||
139 | } | ||
140 | DateBookWeekLstEvent::DateBookWeekLstEvent(const EffectiveEvent &ev, | ||
141 | QWidget* parent = 0, | ||
142 | const char* name = 0, | ||
143 | WFlags fl = 0) : | ||
144 | ClickableLabel(parent,name,fl), | ||
145 | event(ev) | ||
146 | { | ||
147 | char s[10]; | ||
148 | if ( ev.startDate() != ev.date() ) { // multiday event (not first day) | ||
149 | if ( ev.endDate() == ev.date() ) { // last day | ||
150 | strcpy(s, "__|__"); | ||
151 | } else { | ||
152 | strcpy(s, " |---"); | ||
153 | } | ||
154 | } else { | ||
155 | sprintf(s,"%.2d:%.2d",ev.start().hour(),ev.start().minute()); | ||
156 | } | ||
157 | setText(QString(s) + " " + ev.description()); | ||
158 | connect(this, SIGNAL(clicked()), this, SLOT(editMe())); | ||
159 | } | ||
160 | void DateBookWeekLstEvent::editMe() { | ||
161 | emit editEvent(event.event()); | ||
162 | } | ||
163 | |||
164 | |||
165 | DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev, | ||
166 | QDate &d, bool onM, | ||
167 | QWidget* parent, | ||
168 | const char* name, WFlags fl) | ||
169 | : QWidget( parent, name, fl ) | ||
170 | { | ||
171 | onMonday=onM; | ||
172 | setPalette(white); | ||
173 | setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding)); | ||
174 | |||
175 | QVBoxLayout *layout = new QVBoxLayout( this ); | ||
176 | |||
177 | qBubbleSort(ev); | ||
178 | QValueListIterator<EffectiveEvent> it; | ||
179 | it=ev.begin(); | ||
180 | |||
181 | int dayOrder[7]; | ||
182 | if (onMonday) | ||
183 | for (int d=0; d<7; d++) dayOrder[d]=d+1; | ||
184 | else { | ||
185 | for (int d=0; d<7; d++) dayOrder[d]=d; | ||
186 | dayOrder[0]=7; | ||
187 | } | ||
188 | |||
189 | for (int i=0; i<7; i++) { | ||
190 | // Header | ||
191 | DateBookWeekLstDayHdr *hdr=new DateBookWeekLstDayHdr(d.addDays(i), | ||
192 | onMonday,this); | ||
193 | connect(hdr, SIGNAL(showDate(int,int,int)), | ||
194 | this, SIGNAL(showDate(int,int,int))); | ||
195 | connect(hdr, SIGNAL(addEvent(const QDateTime &, | ||
196 | const QDateTime &, | ||
197 | const QString &)), | ||
198 | this, SIGNAL(addEvent(const QDateTime &, | ||
199 | const QDateTime &, | ||
200 | const QString &))); | ||
201 | layout->addWidget(hdr); | ||
202 | |||
203 | // Events | ||
204 | while ( (*it).date().dayOfWeek() == dayOrder[i] && it!=ev.end() ) { | ||
205 | DateBookWeekLstEvent *l=new DateBookWeekLstEvent(*it,this); | ||
206 | layout->addWidget(l); | ||
207 | connect (l, SIGNAL(editEvent(const Event &)), | ||
208 | this, SIGNAL(editEvent(const Event &))); | ||
209 | it++; | ||
210 | } | ||
211 | |||
212 | layout->addItem(new QSpacerItem(1,1, QSizePolicy::Minimum, QSizePolicy::Expanding)); | ||
213 | } | ||
214 | } | ||
215 | DateBookWeekLstView::~DateBookWeekLstView(){} | ||
216 | void DateBookWeekLstView::keyPressEvent(QKeyEvent *e) {e->ignore();} | ||
217 | |||
218 | DateBookWeekLst::DateBookWeekLst( bool ap, bool onM, DateBookDB *newDB, | ||
219 | QWidget *parent, | ||
220 | const char *name ) | ||
221 | : QWidget( parent, name ), | ||
222 | db( newDB ), | ||
223 | startTime( 0 ), | ||
224 | ampm( ap ), | ||
225 | onMonday(onM) | ||
226 | { | ||
227 | setFocusPolicy(StrongFocus); | ||
228 | layout = new QVBoxLayout( this ); | ||
229 | layout->setMargin(0); | ||
230 | |||
231 | header=new DateBookWeekLstHeader(onM, this); | ||
232 | layout->addWidget( header ); | ||
233 | connect(header, SIGNAL(dateChanged(int,int)), this, SLOT(dateChanged(int,int))); | ||
234 | |||
235 | scroll=new QScrollView(this); | ||
236 | //scroll->setVScrollBarMode(QScrollView::AlwaysOn); | ||
237 | //scroll->setHScrollBarMode(QScrollView::AlwaysOff); | ||
238 | scroll->setResizePolicy(QScrollView::AutoOneFit); | ||
239 | layout->addWidget(scroll); | ||
240 | |||
241 | view=NULL; | ||
242 | } | ||
243 | |||
244 | |||
245 | void DateBookWeekLst::setDate( QDate &d ) { | ||
246 | int w,y; | ||
247 | calcWeek(d,w,y,onMonday); | ||
248 | year=y; | ||
249 | _week=w; | ||
250 | header->setDate(date()); | ||
251 | } | ||
252 | void DateBookWeekLst::redraw() {getEvents();} | ||
253 | |||
254 | QDate DateBookWeekLst::date() const { | ||
255 | QDate d; | ||
256 | d.setYMD(year,1,1); | ||
257 | |||
258 | int dow= d.dayOfWeek(); | ||
259 | if (!onMonday) | ||
260 | if (dow==7) dow=1; | ||
261 | else dow++; | ||
262 | |||
263 | d=d.addDays( (_week-1)*7 - dow + 1 ); | ||
264 | return d; | ||
265 | } | ||
266 | |||
267 | void DateBookWeekLst::getEvents() { | ||
268 | QDate start = date(); | ||
269 | QDate stop = start.addDays(6); | ||
270 | QValueList<EffectiveEvent> el = db->getEffectiveEvents(start, stop); | ||
271 | |||
272 | if (view) delete view; | ||
273 | view=new DateBookWeekLstView(el,start,onMonday,scroll); | ||
274 | |||
275 | connect (view, SIGNAL(editEvent(const Event &)), | ||
276 | this, SIGNAL(editEvent(const Event &))); | ||
277 | connect (view, SIGNAL(showDate(int,int,int)), | ||
278 | this, SIGNAL(showDate(int,int,int))); | ||
279 | connect (view, SIGNAL(addEvent(const QDateTime &, const QDateTime &, | ||
280 | const QString &)), | ||
281 | this, SIGNAL(addEvent(const QDateTime &, const QDateTime &, | ||
282 | const QString &))); | ||
283 | |||
284 | scroll->addChild(view); | ||
285 | view->show(); | ||
286 | scroll->updateScrollBars(); | ||
287 | } | ||
288 | |||
289 | void DateBookWeekLst::dateChanged(int y, int w) { | ||
290 | year=y; | ||
291 | _week=w; | ||
292 | getEvents(); | ||
293 | } | ||
294 | |||
295 | void DateBookWeekLst::keyPressEvent(QKeyEvent *e) | ||
296 | { | ||
297 | switch(e->key()) { | ||
298 | case Key_Up: | ||
299 | scroll->scrollBy(0, -20); | ||
300 | break; | ||
301 | case Key_Down: | ||
302 | scroll->scrollBy(0, 20); | ||
303 | break; | ||
304 | case Key_Left: | ||
305 | header->prevWeek(); | ||
306 | break; | ||
307 | case Key_Right: | ||
308 | header->nextWeek(); | ||
309 | break; | ||
310 | default: | ||
311 | e->ignore(); | ||
312 | } | ||
313 | } | ||
314 | |||
diff --git a/core/pim/datebook/datebookweeklst.h b/core/pim/datebook/datebookweeklst.h new file mode 100644 index 0000000..d2a07cc --- a/dev/null +++ b/core/pim/datebook/datebookweeklst.h | |||
@@ -0,0 +1,131 @@ | |||
1 | #ifndef DATEBOOKWEEKLST | ||
2 | #define DATEBOOKWEEKLST | ||
3 | |||
4 | #include <qwidget.h> | ||
5 | #include <qdatetime.h> | ||
6 | #include <qpe/event.h> | ||
7 | #include <qlabel.h> | ||
8 | #include <qscrollview.h> | ||
9 | |||
10 | #include "datebookweeklstheader.h" | ||
11 | #include "datebookweeklstdayhdr.h" | ||
12 | |||
13 | #include "clickablelabel.h" | ||
14 | |||
15 | class QDateTime; | ||
16 | class DateBookDB; | ||
17 | |||
18 | class DateBookWeekLstHeader: public DateBookWeekLstHeaderBase | ||
19 | { | ||
20 | Q_OBJECT | ||
21 | public: | ||
22 | DateBookWeekLstHeader(bool onM, QWidget* parent = 0, const char* name = 0, | ||
23 | WFlags fl = 0 ); | ||
24 | ~DateBookWeekLstHeader(); | ||
25 | void setDate(QDate d); | ||
26 | |||
27 | public slots: | ||
28 | void nextWeek(); | ||
29 | void prevWeek(); | ||
30 | void pickDate(); | ||
31 | void setDate(int y, int m, int d); | ||
32 | signals: | ||
33 | void dateChanged(int y, int w); | ||
34 | private: | ||
35 | QDate date; | ||
36 | bool onMonday; | ||
37 | }; | ||
38 | |||
39 | class DateBookWeekLstDayHdr: public DateBookWeekLstDayHdrBase | ||
40 | { | ||
41 | Q_OBJECT | ||
42 | public: | ||
43 | DateBookWeekLstDayHdr(const QDate &d, bool onM, | ||
44 | QWidget* parent = 0, const char* name = 0, | ||
45 | WFlags fl = 0 ); | ||
46 | public slots: | ||
47 | void showDay(); | ||
48 | void newEvent(); | ||
49 | signals: | ||
50 | void showDate(int y, int m, int d); | ||
51 | void addEvent(const QDateTime &start, const QDateTime &stop, | ||
52 | const QString &str); | ||
53 | private: | ||
54 | QDate date; | ||
55 | }; | ||
56 | |||
57 | class DateBookWeekLstEvent: public ClickableLabel | ||
58 | { | ||
59 | Q_OBJECT | ||
60 | public: | ||
61 | DateBookWeekLstEvent(const EffectiveEvent &ev, | ||
62 | QWidget* parent = 0, const char* name = 0, | ||
63 | WFlags fl = 0); | ||
64 | signals: | ||
65 | void editEvent(const Event &e); | ||
66 | private slots: | ||
67 | void editMe(); | ||
68 | private: | ||
69 | const EffectiveEvent event; | ||
70 | }; | ||
71 | |||
72 | class DateBookWeekLstView: public QWidget | ||
73 | { | ||
74 | Q_OBJECT | ||
75 | public: | ||
76 | DateBookWeekLstView(QValueList<EffectiveEvent> &ev, QDate &d, bool onM, | ||
77 | QWidget* parent = 0, const char* name = 0, | ||
78 | WFlags fl = 0 ); | ||
79 | ~DateBookWeekLstView(); | ||
80 | signals: | ||
81 | void editEvent(const Event &e); | ||
82 | void showDate(int y, int m, int d); | ||
83 | void addEvent(const QDateTime &start, const QDateTime &stop, | ||
84 | const QString &str); | ||
85 | private: | ||
86 | bool onMonday; | ||
87 | protected slots: | ||
88 | void keyPressEvent(QKeyEvent *); | ||
89 | }; | ||
90 | |||
91 | class DateBookWeekLst : public QWidget | ||
92 | { | ||
93 | Q_OBJECT | ||
94 | |||
95 | public: | ||
96 | DateBookWeekLst( bool ampm, bool onM, DateBookDB *newDB, | ||
97 | QWidget *parent = 0, | ||
98 | const char *name = 0 ); | ||
99 | void setDate( int y, int w ); | ||
100 | void setDate( QDate &d ); | ||
101 | int week() const { return _week; }; | ||
102 | QDate date() const; | ||
103 | |||
104 | public slots: | ||
105 | void redraw(); | ||
106 | void dateChanged(int y, int w); | ||
107 | protected slots: | ||
108 | void keyPressEvent(QKeyEvent *); | ||
109 | |||
110 | signals: | ||
111 | void showDate(int y, int m, int d); | ||
112 | void addEvent(const QDateTime &start, const QDateTime &stop, | ||
113 | const QString &str); | ||
114 | void editEvent(const Event &e); | ||
115 | |||
116 | private: | ||
117 | DateBookDB *db; | ||
118 | int startTime; | ||
119 | bool ampm; | ||
120 | bool onMonday; | ||
121 | int year, _week; | ||
122 | DateBookWeekLstHeader *header; | ||
123 | DateBookWeekLstView *view; | ||
124 | QVBoxLayout *layout; | ||
125 | QScrollView *scroll; | ||
126 | |||
127 | void getEvents(); | ||
128 | }; | ||
129 | |||
130 | #endif | ||
131 | |||
diff --git a/core/pim/datebook/datebookweeklstdayhdr.ui b/core/pim/datebook/datebookweeklstdayhdr.ui new file mode 100644 index 0000000..3b88495 --- a/dev/null +++ b/core/pim/datebook/datebookweeklstdayhdr.ui | |||
@@ -0,0 +1,149 @@ | |||
1 | <!DOCTYPE UI><UI> | ||
2 | <class>DateBookWeekLstDayHdrBase</class> | ||
3 | <widget> | ||
4 | <class>QWidget</class> | ||
5 | <property stdset="1"> | ||
6 | <name>name</name> | ||
7 | <cstring>DateBookWeekLstDayHdrBase</cstring> | ||
8 | </property> | ||
9 | <property stdset="1"> | ||
10 | <name>geometry</name> | ||
11 | <rect> | ||
12 | <x>0</x> | ||
13 | <y>106</y> | ||
14 | <width>621</width> | ||
15 | <height>5</height> | ||
16 | </rect> | ||
17 | </property> | ||
18 | <property stdset="1"> | ||
19 | <name>sizePolicy</name> | ||
20 | <sizepolicy> | ||
21 | <hsizetype>7</hsizetype> | ||
22 | <vsizetype>0</vsizetype> | ||
23 | </sizepolicy> | ||
24 | </property> | ||
25 | <property stdset="1"> | ||
26 | <name>caption</name> | ||
27 | <string>Form1</string> | ||
28 | </property> | ||
29 | <property> | ||
30 | <name>layoutMargin</name> | ||
31 | </property> | ||
32 | <hbox> | ||
33 | <property stdset="1"> | ||
34 | <name>margin</name> | ||
35 | <number>0</number> | ||
36 | </property> | ||
37 | <property stdset="1"> | ||
38 | <name>spacing</name> | ||
39 | <number>6</number> | ||
40 | </property> | ||
41 | <widget> | ||
42 | <class>Line</class> | ||
43 | <property stdset="1"> | ||
44 | <name>name</name> | ||
45 | <cstring>Line1</cstring> | ||
46 | </property> | ||
47 | <property stdset="1"> | ||
48 | <name>minimumSize</name> | ||
49 | <size> | ||
50 | <width>0</width> | ||
51 | <height>0</height> | ||
52 | </size> | ||
53 | </property> | ||
54 | <property stdset="1"> | ||
55 | <name>maximumSize</name> | ||
56 | <size> | ||
57 | <width>32767</width> | ||
58 | <height>32767</height> | ||
59 | </size> | ||
60 | </property> | ||
61 | <property stdset="1"> | ||
62 | <name>orientation</name> | ||
63 | <enum>Horizontal</enum> | ||
64 | </property> | ||
65 | </widget> | ||
66 | <widget> | ||
67 | <class>ClickableLabel</class> | ||
68 | <property stdset="1"> | ||
69 | <name>name</name> | ||
70 | <cstring>label</cstring> | ||
71 | </property> | ||
72 | <property stdset="1"> | ||
73 | <name>sizePolicy</name> | ||
74 | <sizepolicy> | ||
75 | <hsizetype>0</hsizetype> | ||
76 | <vsizetype>0</vsizetype> | ||
77 | </sizepolicy> | ||
78 | </property> | ||
79 | <property stdset="1"> | ||
80 | <name>font</name> | ||
81 | <font> | ||
82 | <bold>1</bold> | ||
83 | </font> | ||
84 | </property> | ||
85 | </widget> | ||
86 | <widget> | ||
87 | <class>Line</class> | ||
88 | <property stdset="1"> | ||
89 | <name>name</name> | ||
90 | <cstring>Line1_2</cstring> | ||
91 | </property> | ||
92 | <property stdset="1"> | ||
93 | <name>minimumSize</name> | ||
94 | <size> | ||
95 | <width>0</width> | ||
96 | <height>0</height> | ||
97 | </size> | ||
98 | </property> | ||
99 | <property stdset="1"> | ||
100 | <name>maximumSize</name> | ||
101 | <size> | ||
102 | <width>32767</width> | ||
103 | <height>32767</height> | ||
104 | </size> | ||
105 | </property> | ||
106 | <property stdset="1"> | ||
107 | <name>orientation</name> | ||
108 | <enum>Horizontal</enum> | ||
109 | </property> | ||
110 | </widget> | ||
111 | <widget> | ||
112 | <class>ClickableLabel</class> | ||
113 | <property stdset="1"> | ||
114 | <name>name</name> | ||
115 | <cstring>add</cstring> | ||
116 | </property> | ||
117 | <property stdset="1"> | ||
118 | <name>sizePolicy</name> | ||
119 | <sizepolicy> | ||
120 | <hsizetype>0</hsizetype> | ||
121 | <vsizetype>0</vsizetype> | ||
122 | </sizepolicy> | ||
123 | </property> | ||
124 | </widget> | ||
125 | </hbox> | ||
126 | </widget> | ||
127 | <customwidgets> | ||
128 | <customwidget> | ||
129 | <class>ClickableLabel</class> | ||
130 | <header location="local">clickablelabel.h</header> | ||
131 | <sizehint> | ||
132 | <width>-1</width> | ||
133 | <height>-1</height> | ||
134 | </sizehint> | ||
135 | <container>0</container> | ||
136 | <sizepolicy> | ||
137 | <hordata>5</hordata> | ||
138 | <verdata>5</verdata> | ||
139 | </sizepolicy> | ||
140 | <pixmap>image0</pixmap> | ||
141 | </customwidget> | ||
142 | </customwidgets> | ||
143 | <images> | ||
144 | <image> | ||
145 | <name>image0</name> | ||
146 | <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1ddec44f503c0ae2a154410f53d0ed20e2bf6bdb656dd6861dd23d9a66591b0587fd1654235ebded6f0edcd53e419d87ae7b1f4f9b8f906d0bfe012317426a70b07bdc2f3ec77f8ed6b89559061a0343d06a124cc105596482585094bc0ae599b04646c9018926491b2205e140c485cace25755c175d0a967b622ff900b8cc9c7d29af594ea722d589167f813aa852ba07d94b9dce296e883fe7bb163f23896753</data> | ||
147 | </image> | ||
148 | </images> | ||
149 | </UI> | ||
diff --git a/core/pim/datebook/datebookweeklstheader.ui b/core/pim/datebook/datebookweeklstheader.ui new file mode 100644 index 0000000..666e896 --- a/dev/null +++ b/core/pim/datebook/datebookweeklstheader.ui | |||
@@ -0,0 +1,238 @@ | |||
1 | <!DOCTYPE UI><UI> | ||
2 | <class>DateBookWeekLstHeaderBase</class> | ||
3 | <widget> | ||
4 | <class>QWidget</class> | ||
5 | <property stdset="1"> | ||
6 | <name>name</name> | ||
7 | <cstring>DateBookWeekLstHeaderBase</cstring> | ||
8 | </property> | ||
9 | <property stdset="1"> | ||
10 | <name>geometry</name> | ||
11 | <rect> | ||
12 | <x>0</x> | ||
13 | <y>51</y> | ||
14 | <width>535</width> | ||
15 | <height>25</height> | ||
16 | </rect> | ||
17 | </property> | ||
18 | <property stdset="1"> | ||
19 | <name>sizePolicy</name> | ||
20 | <sizepolicy> | ||
21 | <hsizetype>7</hsizetype> | ||
22 | <vsizetype>0</vsizetype> | ||
23 | </sizepolicy> | ||
24 | </property> | ||
25 | <property stdset="1"> | ||
26 | <name>caption</name> | ||
27 | <string>Form2</string> | ||
28 | </property> | ||
29 | <property> | ||
30 | <name>layoutMargin</name> | ||
31 | </property> | ||
32 | <property> | ||
33 | <name>layoutSpacing</name> | ||
34 | </property> | ||
35 | <hbox> | ||
36 | <property stdset="1"> | ||
37 | <name>margin</name> | ||
38 | <number>0</number> | ||
39 | </property> | ||
40 | <property stdset="1"> | ||
41 | <name>spacing</name> | ||
42 | <number>6</number> | ||
43 | </property> | ||
44 | <widget> | ||
45 | <class>QToolButton</class> | ||
46 | <property stdset="1"> | ||
47 | <name>name</name> | ||
48 | <cstring>back</cstring> | ||
49 | </property> | ||
50 | <property stdset="1"> | ||
51 | <name>sizePolicy</name> | ||
52 | <sizepolicy> | ||
53 | <hsizetype>1</hsizetype> | ||
54 | <vsizetype>0</vsizetype> | ||
55 | </sizepolicy> | ||
56 | </property> | ||
57 | <property stdset="1"> | ||
58 | <name>text</name> | ||
59 | <string></string> | ||
60 | </property> | ||
61 | <property stdset="1"> | ||
62 | <name>pixmap</name> | ||
63 | <pixmap>image0</pixmap> | ||
64 | </property> | ||
65 | <property stdset="1"> | ||
66 | <name>autoRepeat</name> | ||
67 | <bool>true</bool> | ||
68 | </property> | ||
69 | <property stdset="1"> | ||
70 | <name>autoRaise</name> | ||
71 | <bool>true</bool> | ||
72 | </property> | ||
73 | </widget> | ||
74 | <spacer> | ||
75 | <property> | ||
76 | <name>name</name> | ||
77 | <cstring>Spacer1_3</cstring> | ||
78 | </property> | ||
79 | <property stdset="1"> | ||
80 | <name>orientation</name> | ||
81 | <enum>Horizontal</enum> | ||
82 | </property> | ||
83 | <property stdset="1"> | ||
84 | <name>sizeType</name> | ||
85 | <enum>Expanding</enum> | ||
86 | </property> | ||
87 | <property> | ||
88 | <name>sizeHint</name> | ||
89 | <size> | ||
90 | <width>20</width> | ||
91 | <height>20</height> | ||
92 | </size> | ||
93 | </property> | ||
94 | </spacer> | ||
95 | <widget> | ||
96 | <class>QToolButton</class> | ||
97 | <property stdset="1"> | ||
98 | <name>name</name> | ||
99 | <cstring>labelWeek</cstring> | ||
100 | </property> | ||
101 | <property stdset="1"> | ||
102 | <name>sizePolicy</name> | ||
103 | <sizepolicy> | ||
104 | <hsizetype>7</hsizetype> | ||
105 | <vsizetype>0</vsizetype> | ||
106 | </sizepolicy> | ||
107 | </property> | ||
108 | <property stdset="1"> | ||
109 | <name>font</name> | ||
110 | <font> | ||
111 | <bold>1</bold> | ||
112 | </font> | ||
113 | </property> | ||
114 | <property stdset="1"> | ||
115 | <name>text</name> | ||
116 | <string>W: 00,00</string> | ||
117 | </property> | ||
118 | <property stdset="1"> | ||
119 | <name>autoRaise</name> | ||
120 | <bool>false</bool> | ||
121 | </property> | ||
122 | </widget> | ||
123 | <spacer> | ||
124 | <property> | ||
125 | <name>name</name> | ||
126 | <cstring>Spacer1</cstring> | ||
127 | </property> | ||
128 | <property stdset="1"> | ||
129 | <name>orientation</name> | ||
130 | <enum>Horizontal</enum> | ||
131 | </property> | ||
132 | <property stdset="1"> | ||
133 | <name>sizeType</name> | ||
134 | <enum>Expanding</enum> | ||
135 | </property> | ||
136 | <property> | ||
137 | <name>sizeHint</name> | ||
138 | <size> | ||
139 | <width>20</width> | ||
140 | <height>20</height> | ||
141 | </size> | ||
142 | </property> | ||
143 | </spacer> | ||
144 | <widget> | ||
145 | <class>QLabel</class> | ||
146 | <property stdset="1"> | ||
147 | <name>name</name> | ||
148 | <cstring>labelDate</cstring> | ||
149 | </property> | ||
150 | <property stdset="1"> | ||
151 | <name>sizePolicy</name> | ||
152 | <sizepolicy> | ||
153 | <hsizetype>3</hsizetype> | ||
154 | <vsizetype>7</vsizetype> | ||
155 | </sizepolicy> | ||
156 | </property> | ||
157 | <property stdset="1"> | ||
158 | <name>font</name> | ||
159 | <font> | ||
160 | <bold>1</bold> | ||
161 | </font> | ||
162 | </property> | ||
163 | <property stdset="1"> | ||
164 | <name>text</name> | ||
165 | <string>00 Jan-00 Jan</string> | ||
166 | </property> | ||
167 | <property stdset="1"> | ||
168 | <name>alignment</name> | ||
169 | <set>AlignCenter</set> | ||
170 | </property> | ||
171 | <property> | ||
172 | <name>hAlign</name> | ||
173 | </property> | ||
174 | </widget> | ||
175 | <spacer> | ||
176 | <property> | ||
177 | <name>name</name> | ||
178 | <cstring>Spacer1_2</cstring> | ||
179 | </property> | ||
180 | <property stdset="1"> | ||
181 | <name>orientation</name> | ||
182 | <enum>Horizontal</enum> | ||
183 | </property> | ||
184 | <property stdset="1"> | ||
185 | <name>sizeType</name> | ||
186 | <enum>Expanding</enum> | ||
187 | </property> | ||
188 | <property> | ||
189 | <name>sizeHint</name> | ||
190 | <size> | ||
191 | <width>20</width> | ||
192 | <height>20</height> | ||
193 | </size> | ||
194 | </property> | ||
195 | </spacer> | ||
196 | <widget> | ||
197 | <class>QToolButton</class> | ||
198 | <property stdset="1"> | ||
199 | <name>name</name> | ||
200 | <cstring>forward</cstring> | ||
201 | </property> | ||
202 | <property stdset="1"> | ||
203 | <name>sizePolicy</name> | ||
204 | <sizepolicy> | ||
205 | <hsizetype>1</hsizetype> | ||
206 | <vsizetype>0</vsizetype> | ||
207 | </sizepolicy> | ||
208 | </property> | ||
209 | <property stdset="1"> | ||
210 | <name>text</name> | ||
211 | <string></string> | ||
212 | </property> | ||
213 | <property stdset="1"> | ||
214 | <name>pixmap</name> | ||
215 | <pixmap>image1</pixmap> | ||
216 | </property> | ||
217 | <property stdset="1"> | ||
218 | <name>autoRepeat</name> | ||
219 | <bool>true</bool> | ||
220 | </property> | ||
221 | <property stdset="1"> | ||
222 | <name>autoRaise</name> | ||
223 | <bool>true</bool> | ||
224 | </property> | ||
225 | </widget> | ||
226 | </hbox> | ||
227 | </widget> | ||
228 | <images> | ||
229 | <image> | ||
230 | <name>image0</name> | ||
231 | <data format="XPM.GZ" length="582">789c6dcfcd4e843010c0f13b4fd1d01b31bb6cb325211b1f41e3d1c4789876a60bcbd7aeae07637c773b6d5985d870e0f7ef50605b88e7a707516cb3f72b5c5b2b6c036fa2c08f61f87c79bdffcaf2dd5ef0558b5d7e97e51b61c5e33412df4b7f2fcbb09896a94ab557817063cd744cad74a915734aac35308740d018d9332d5ab0c8ec1229f2c2448d156a661b489ee1ab4e4cf2a08a790e24020abb0dd355442eec8e914e45526215790c749e8e89891069125de466b1fe14295705ccaa5863e2d05cc01894925b2a7e8217dd8a631eb169fd509af10fd1a9ebfbdf32008d9d0c07cd274f70ee162773ba2cdfee935c977ffe6b2edf87ec07796f81cd</data> | ||
232 | </image> | ||
233 | <image> | ||
234 | <name>image1</name> | ||
235 | <data format="XPM.GZ" length="627">789c7dcfc94ec3301006e07b9ec28a6f114a13cbb1a8108f00e28884387819676993340b07847877329ea8697a60ec83bfdf232f8784bdbfbdb0e4104db39e6bcb6ca54796b8afb6fdfef87cfe89e25cb2650ac1f2f8218a5366d96bdf01aef9b2e65928a4458a0c07b25c29890352e63293e19c53a0968f52230159e8c22981744495133552097554a1f982b4ce6aeb9013d215165c81ec894e109b4070ca85378f2b35f18c04050214b20d04d010762ba457003eecd6442f88f34a45f4817ea147762b35d1acf4c47457d784737d9f18ebee1363614bf852c6f812b6c460f90abb6e93ba694ed7c49fdbaeee2f76b83da71ba772e0db5d9ccf4b07dfdd5e858edd9b2948fff9d796fc3e457f660e8d47</data> | ||
236 | </image> | ||
237 | </images> | ||
238 | </UI> | ||
diff --git a/core/pim/datebook/dateentry.ui b/core/pim/datebook/dateentry.ui index 0c363a4..eac4e23 100644 --- a/core/pim/datebook/dateentry.ui +++ b/core/pim/datebook/dateentry.ui | |||
@@ -73,49 +73,49 @@ | |||
73 | <name>text</name> | 73 | <name>text</name> |
74 | <string>Location</string> | 74 | <string>Location</string> |
75 | </property> | 75 | </property> |
76 | </widget> | 76 | </widget> |
77 | <widget row="2" column="0" > | 77 | <widget row="2" column="0" > |
78 | <class>QLabel</class> | 78 | <class>QLabel</class> |
79 | <property stdset="1"> | 79 | <property stdset="1"> |
80 | <name>name</name> | 80 | <name>name</name> |
81 | <cstring>TextLabel2_2</cstring> | 81 | <cstring>TextLabel2_2</cstring> |
82 | </property> | 82 | </property> |
83 | <property stdset="1"> | 83 | <property stdset="1"> |
84 | <name>text</name> | 84 | <name>text</name> |
85 | <string>Category</string> | 85 | <string>Category</string> |
86 | </property> | 86 | </property> |
87 | <property> | 87 | <property> |
88 | <name>buddy</name> | 88 | <name>buddy</name> |
89 | <cstring>comboPriority</cstring> | 89 | <cstring>comboPriority</cstring> |
90 | </property> | 90 | </property> |
91 | </widget> | 91 | </widget> |
92 | <widget row="0" column="1" rowspan="1" colspan="3" > | 92 | <widget row="0" column="1" rowspan="1" colspan="3" > |
93 | <class>QComboBox</class> | 93 | <class>QComboBox</class> |
94 | <item> | 94 | <item> |
95 | <property> | 95 | <property> |
96 | <name>text</name> | 96 | <name>text</name> |
97 | <string>(None)</string> | 97 | <string></string> |
98 | </property> | 98 | </property> |
99 | </item> | 99 | </item> |
100 | <item> | 100 | <item> |
101 | <property> | 101 | <property> |
102 | <name>text</name> | 102 | <name>text</name> |
103 | <string>Meeting</string> | 103 | <string>Meeting</string> |
104 | </property> | 104 | </property> |
105 | </item> | 105 | </item> |
106 | <item> | 106 | <item> |
107 | <property> | 107 | <property> |
108 | <name>text</name> | 108 | <name>text</name> |
109 | <string>Lunch</string> | 109 | <string>Lunch</string> |
110 | </property> | 110 | </property> |
111 | </item> | 111 | </item> |
112 | <item> | 112 | <item> |
113 | <property> | 113 | <property> |
114 | <name>text</name> | 114 | <name>text</name> |
115 | <string>Dinner</string> | 115 | <string>Dinner</string> |
116 | </property> | 116 | </property> |
117 | </item> | 117 | </item> |
118 | <item> | 118 | <item> |
119 | <property> | 119 | <property> |
120 | <name>text</name> | 120 | <name>text</name> |
121 | <string>Travel</string> | 121 | <string>Travel</string> |
@@ -140,49 +140,49 @@ | |||
140 | <name>currentItem</name> | 140 | <name>currentItem</name> |
141 | <number>0</number> | 141 | <number>0</number> |
142 | </property> | 142 | </property> |
143 | <property stdset="1"> | 143 | <property stdset="1"> |
144 | <name>duplicatesEnabled</name> | 144 | <name>duplicatesEnabled</name> |
145 | <bool>false</bool> | 145 | <bool>false</bool> |
146 | </property> | 146 | </property> |
147 | </widget> | 147 | </widget> |
148 | <widget row="0" column="0" > | 148 | <widget row="0" column="0" > |
149 | <class>QLabel</class> | 149 | <class>QLabel</class> |
150 | <property stdset="1"> | 150 | <property stdset="1"> |
151 | <name>name</name> | 151 | <name>name</name> |
152 | <cstring>TextLabel1</cstring> | 152 | <cstring>TextLabel1</cstring> |
153 | </property> | 153 | </property> |
154 | <property stdset="1"> | 154 | <property stdset="1"> |
155 | <name>text</name> | 155 | <name>text</name> |
156 | <string>Description:</string> | 156 | <string>Description:</string> |
157 | </property> | 157 | </property> |
158 | </widget> | 158 | </widget> |
159 | <widget row="1" column="1" rowspan="1" colspan="3" > | 159 | <widget row="1" column="1" rowspan="1" colspan="3" > |
160 | <class>QComboBox</class> | 160 | <class>QComboBox</class> |
161 | <item> | 161 | <item> |
162 | <property> | 162 | <property> |
163 | <name>text</name> | 163 | <name>text</name> |
164 | <string>(Unknown)</string> | 164 | <string></string> |
165 | </property> | 165 | </property> |
166 | </item> | 166 | </item> |
167 | <item> | 167 | <item> |
168 | <property> | 168 | <property> |
169 | <name>text</name> | 169 | <name>text</name> |
170 | <string>Office</string> | 170 | <string>Office</string> |
171 | </property> | 171 | </property> |
172 | </item> | 172 | </item> |
173 | <item> | 173 | <item> |
174 | <property> | 174 | <property> |
175 | <name>text</name> | 175 | <name>text</name> |
176 | <string>Home</string> | 176 | <string>Home</string> |
177 | </property> | 177 | </property> |
178 | </item> | 178 | </item> |
179 | <property stdset="1"> | 179 | <property stdset="1"> |
180 | <name>name</name> | 180 | <name>name</name> |
181 | <cstring>comboLocation</cstring> | 181 | <cstring>comboLocation</cstring> |
182 | </property> | 182 | </property> |
183 | <property stdset="1"> | 183 | <property stdset="1"> |
184 | <name>sizePolicy</name> | 184 | <name>sizePolicy</name> |
185 | <sizepolicy> | 185 | <sizepolicy> |
186 | <hsizetype>7</hsizetype> | 186 | <hsizetype>7</hsizetype> |
187 | <vsizetype>0</vsizetype> | 187 | <vsizetype>0</vsizetype> |
188 | </sizepolicy> | 188 | </sizepolicy> |
diff --git a/core/pim/datebook/dateentryimpl.cpp b/core/pim/datebook/dateentryimpl.cpp index 1122f79..b2e3e3a 100644 --- a/core/pim/datebook/dateentryimpl.cpp +++ b/core/pim/datebook/dateentryimpl.cpp | |||
@@ -20,65 +20,68 @@ | |||
20 | 20 | ||
21 | #include "dateentryimpl.h" | 21 | #include "dateentryimpl.h" |
22 | #include "repeatentry.h" | 22 | #include "repeatentry.h" |
23 | 23 | ||
24 | #include <qpe/qpeapplication.h> | 24 | #include <qpe/qpeapplication.h> |
25 | #include <qpe/categoryselect.h> | 25 | #include <qpe/categoryselect.h> |
26 | #include <qpe/datebookmonth.h> | 26 | #include <qpe/datebookmonth.h> |
27 | #include <qpe/global.h> | 27 | #include <qpe/global.h> |
28 | #include <qpe/timeconversion.h> | 28 | #include <qpe/timeconversion.h> |
29 | #include <qpe/timestring.h> | 29 | #include <qpe/timestring.h> |
30 | #include <qpe/tzselect.h> | 30 | #include <qpe/tzselect.h> |
31 | 31 | ||
32 | #include <qcheckbox.h> | 32 | #include <qcheckbox.h> |
33 | #include <qcombobox.h> | 33 | #include <qcombobox.h> |
34 | #include <qlayout.h> | 34 | #include <qlayout.h> |
35 | #include <qlineedit.h> | 35 | #include <qlineedit.h> |
36 | #include <qmultilineedit.h> | 36 | #include <qmultilineedit.h> |
37 | #include <qpopupmenu.h> | 37 | #include <qpopupmenu.h> |
38 | #include <qscrollview.h> | 38 | #include <qscrollview.h> |
39 | #include <qspinbox.h> | 39 | #include <qspinbox.h> |
40 | #include <qtoolbutton.h> | 40 | #include <qtoolbutton.h> |
41 | 41 | ||
42 | #include <stdlib.h> | 42 | #include <stdlib.h> |
43 | 43 | ||
44 | #include <stdiostream.h> | ||
45 | |||
44 | /* | 46 | /* |
45 | * Constructs a DateEntry which is a child of 'parent', with the | 47 | * Constructs a DateEntry which is a child of 'parent', with the |
46 | * name 'name' and widget flags set to 'f' | 48 | * name 'name' and widget flags set to 'f' |
47 | * | 49 | * |
48 | * The dialog will by default be modeless, unless you set 'modal' to | 50 | * The dialog will by default be modeless, unless you set 'modal' to |
49 | * TRUE to construct a modal dialog. | 51 | * TRUE to construct a modal dialog. |
50 | */ | 52 | */ |
51 | 53 | ||
52 | DateEntry::DateEntry( bool startOnMonday, const QDateTime &start, | 54 | DateEntry::DateEntry( bool startOnMonday, const QDateTime &start, |
53 | const QDateTime &end, bool whichClock, QWidget* parent, | 55 | const QDateTime &end, bool whichClock, QWidget* parent, |
54 | const char* name ) | 56 | const char* name ) |
55 | : DateEntryBase( parent, name ), | 57 | : DateEntryBase( parent, name ), |
56 | ampm( whichClock ), | 58 | ampm( whichClock ), |
57 | startWeekOnMonday( startOnMonday ) | 59 | startWeekOnMonday( startOnMonday ) |
58 | { | 60 | { |
59 | init(); | 61 | init(); |
60 | setDates(start,end); | 62 | setDates(start,end); |
63 | setFocusProxy(comboDescription); | ||
61 | } | 64 | } |
62 | 65 | ||
63 | static void addOrPick( QComboBox* combo, const QString& t ) | 66 | static void addOrPick( QComboBox* combo, const QString& t ) |
64 | { | 67 | { |
65 | for (int i=0; i<combo->count(); i++) { | 68 | for (int i=0; i<combo->count(); i++) { |
66 | if ( combo->text(i) == t ) { | 69 | if ( combo->text(i) == t ) { |
67 | combo->setCurrentItem(i); | 70 | combo->setCurrentItem(i); |
68 | return; | 71 | return; |
69 | } | 72 | } |
70 | } | 73 | } |
71 | combo->setEditText(t); | 74 | combo->setEditText(t); |
72 | } | 75 | } |
73 | 76 | ||
74 | DateEntry::DateEntry( bool startOnMonday, const Event &event, bool whichClock, | 77 | DateEntry::DateEntry( bool startOnMonday, const Event &event, bool whichClock, |
75 | QWidget* parent, const char* name ) | 78 | QWidget* parent, const char* name ) |
76 | : DateEntryBase( parent, name ), | 79 | : DateEntryBase( parent, name ), |
77 | ampm( whichClock ), | 80 | ampm( whichClock ), |
78 | startWeekOnMonday( startOnMonday ) | 81 | startWeekOnMonday( startOnMonday ) |
79 | { | 82 | { |
80 | init(); | 83 | init(); |
81 | setDates(event.start(),event.end()); | 84 | setDates(event.start(),event.end()); |
82 | comboCategory->setCategories( event.categories(), "Calendar", tr("Calendar") ); | 85 | comboCategory->setCategories( event.categories(), "Calendar", tr("Calendar") ); |
83 | if(!event.description().isEmpty()) | 86 | if(!event.description().isEmpty()) |
84 | addOrPick( comboDescription, event.description() ); | 87 | addOrPick( comboDescription, event.description() ); |
@@ -155,48 +158,49 @@ void DateEntry::init() | |||
155 | this, SLOT( startDateChanged( int, int, int ) ) ); | 158 | this, SLOT( startDateChanged( int, int, int ) ) ); |
156 | 159 | ||
157 | //Let start button change both start and end dates | 160 | //Let start button change both start and end dates |
158 | connect( startPicker, SIGNAL( dateClicked( int, int, int ) ), | 161 | connect( startPicker, SIGNAL( dateClicked( int, int, int ) ), |
159 | this, SLOT( endDateChanged( int, int, int ) ) ); | 162 | this, SLOT( endDateChanged( int, int, int ) ) ); |
160 | connect( qApp, SIGNAL( clockChanged( bool ) ), | 163 | connect( qApp, SIGNAL( clockChanged( bool ) ), |
161 | this, SLOT( slotChangeClock( bool ) ) ); | 164 | this, SLOT( slotChangeClock( bool ) ) ); |
162 | connect( qApp, SIGNAL(weekChanged(bool)), | 165 | connect( qApp, SIGNAL(weekChanged(bool)), |
163 | this, SLOT(slotChangeStartOfWeek(bool)) ); | 166 | this, SLOT(slotChangeStartOfWeek(bool)) ); |
164 | 167 | ||
165 | QPopupMenu *m2 = new QPopupMenu( this ); | 168 | QPopupMenu *m2 = new QPopupMenu( this ); |
166 | endPicker = new DateBookMonth( m2, 0, TRUE ); | 169 | endPicker = new DateBookMonth( m2, 0, TRUE ); |
167 | m2->insertItem( endPicker ); | 170 | m2->insertItem( endPicker ); |
168 | buttonEnd->setPopup( m2 ); | 171 | buttonEnd->setPopup( m2 ); |
169 | connect( endPicker, SIGNAL( dateClicked( int, int, int ) ), | 172 | connect( endPicker, SIGNAL( dateClicked( int, int, int ) ), |
170 | this, SLOT( endDateChanged( int, int, int ) ) ); | 173 | this, SLOT( endDateChanged( int, int, int ) ) ); |
171 | } | 174 | } |
172 | 175 | ||
173 | /* | 176 | /* |
174 | * Destroys the object and frees any allocated resources | 177 | * Destroys the object and frees any allocated resources |
175 | */ | 178 | */ |
176 | DateEntry::~DateEntry() | 179 | DateEntry::~DateEntry() |
177 | { | 180 | { |
178 | // no need to delete child widgets, Qt does it all for us | 181 | // no need to delete child widgets, Qt does it all for us |
182 | //cout << "Del: " << comboStart->currentText() << endl; | ||
179 | } | 183 | } |
180 | 184 | ||
181 | /* | 185 | /* |
182 | * public slot | 186 | * public slot |
183 | */ | 187 | */ |
184 | void DateEntry::endDateChanged( int y, int m, int d ) | 188 | void DateEntry::endDateChanged( int y, int m, int d ) |
185 | { | 189 | { |
186 | endDate.setYMD( y, m, d ); | 190 | endDate.setYMD( y, m, d ); |
187 | if ( endDate < startDate ) { | 191 | if ( endDate < startDate ) { |
188 | endDate = startDate; | 192 | endDate = startDate; |
189 | } | 193 | } |
190 | 194 | ||
191 | buttonEnd->setText( TimeString::shortDate( endDate ) ); | 195 | buttonEnd->setText( TimeString::shortDate( endDate ) ); |
192 | 196 | ||
193 | endPicker->setDate( endDate.year(), endDate.month(), endDate.day() ); | 197 | endPicker->setDate( endDate.year(), endDate.month(), endDate.day() ); |
194 | } | 198 | } |
195 | 199 | ||
196 | static QTime parseTime( const QString& s, bool ampm ) | 200 | static QTime parseTime( const QString& s, bool ampm ) |
197 | { | 201 | { |
198 | QTime tmpTime; | 202 | QTime tmpTime; |
199 | QStringList l = QStringList::split( ':', s ); | 203 | QStringList l = QStringList::split( ':', s ); |
200 | int hour = l[0].toInt(); | 204 | int hour = l[0].toInt(); |
201 | if ( ampm ) { | 205 | if ( ampm ) { |
202 | int i=0; | 206 | int i=0; |
@@ -249,48 +253,49 @@ void DateEntry::startDateChanged( int y, int m, int d ) | |||
249 | startDate.setYMD( y, m, d ); | 253 | startDate.setYMD( y, m, d ); |
250 | if ( rp.type == Event::Weekly && | 254 | if ( rp.type == Event::Weekly && |
251 | startDate.dayOfWeek() != prev.dayOfWeek() ) { | 255 | startDate.dayOfWeek() != prev.dayOfWeek() ) { |
252 | // if we change the start of a weekly repeating event | 256 | // if we change the start of a weekly repeating event |
253 | // set the repeating day appropriately | 257 | // set the repeating day appropriately |
254 | char mask = 1 << (prev.dayOfWeek()-1); | 258 | char mask = 1 << (prev.dayOfWeek()-1); |
255 | rp.days &= (~mask); | 259 | rp.days &= (~mask); |
256 | rp.days |= 1 << (startDate.dayOfWeek()-1); | 260 | rp.days |= 1 << (startDate.dayOfWeek()-1); |
257 | } | 261 | } |
258 | 262 | ||
259 | buttonStart->setText( TimeString::shortDate( startDate ) ); | 263 | buttonStart->setText( TimeString::shortDate( startDate ) ); |
260 | 264 | ||
261 | // our pickers must be reset... | 265 | // our pickers must be reset... |
262 | startPicker->setDate( y, m, d ); | 266 | startPicker->setDate( y, m, d ); |
263 | endPicker->setDate( y, m, d ); | 267 | endPicker->setDate( y, m, d ); |
264 | } | 268 | } |
265 | 269 | ||
266 | /* | 270 | /* |
267 | * public slot | 271 | * public slot |
268 | */ | 272 | */ |
269 | void DateEntry::startTimeChanged( int index ) | 273 | void DateEntry::startTimeChanged( int index ) |
270 | { | 274 | { |
271 | startTime = parseTime(comboStart->text(index),ampm); | 275 | startTime = parseTime(comboStart->text(index),ampm); |
272 | changeEndCombo( index ); | 276 | changeEndCombo( index ); |
277 | //cout << "Start: " << comboStart->currentText() << endl; | ||
273 | } | 278 | } |
274 | /* | 279 | /* |
275 | * public slot | 280 | * public slot |
276 | */ | 281 | */ |
277 | void DateEntry::typeChanged( const QString &s ) | 282 | void DateEntry::typeChanged( const QString &s ) |
278 | { | 283 | { |
279 | bool b = s != "All Day"; | 284 | bool b = s != "All Day"; |
280 | buttonStart->setEnabled( b ); | 285 | buttonStart->setEnabled( b ); |
281 | comboStart->setEnabled( b ); | 286 | comboStart->setEnabled( b ); |
282 | comboEnd->setEnabled( b ); | 287 | comboEnd->setEnabled( b ); |
283 | } | 288 | } |
284 | /* | 289 | /* |
285 | * public slot | 290 | * public slot |
286 | */ | 291 | */ |
287 | void DateEntry::changeEndCombo( int change ) | 292 | void DateEntry::changeEndCombo( int change ) |
288 | { | 293 | { |
289 | if ( change + 2 < comboEnd->count() ) | 294 | if ( change + 2 < comboEnd->count() ) |
290 | change += 2; | 295 | change += 2; |
291 | comboEnd->setCurrentItem( change ); | 296 | comboEnd->setCurrentItem( change ); |
292 | endTimeChanged( comboEnd->currentText() ); | 297 | endTimeChanged( comboEnd->currentText() ); |
293 | } | 298 | } |
294 | 299 | ||
295 | void DateEntry::slotRepeat() | 300 | void DateEntry::slotRepeat() |
296 | { | 301 | { |
@@ -361,48 +366,51 @@ Event DateEntry::event() | |||
361 | 366 | ||
362 | // convert to UTC based on selected TZ (calling tzset internally) | 367 | // convert to UTC based on selected TZ (calling tzset internally) |
363 | start_utc = TimeConversion::toUTC( start ); | 368 | start_utc = TimeConversion::toUTC( start ); |
364 | end_utc = TimeConversion::toUTC( end ); | 369 | end_utc = TimeConversion::toUTC( end ); |
365 | 370 | ||
366 | // done playing around... put it all back | 371 | // done playing around... put it all back |
367 | unsetenv( "TZ" ); | 372 | unsetenv( "TZ" ); |
368 | if ( !realTZ.isNull() ) | 373 | if ( !realTZ.isNull() ) |
369 | if ( setenv( "TZ", realTZ, true ) != 0 ) | 374 | if ( setenv( "TZ", realTZ, true ) != 0 ) |
370 | qWarning( "There was a problem setting the timezone." ); | 375 | qWarning( "There was a problem setting the timezone." ); |
371 | 376 | ||
372 | // convert UTC to local time (calling tzset internally) | 377 | // convert UTC to local time (calling tzset internally) |
373 | ev.setStart( TimeConversion::fromUTC( start_utc ) ); | 378 | ev.setStart( TimeConversion::fromUTC( start_utc ) ); |
374 | ev.setEnd( TimeConversion::fromUTC( end_utc ) ); | 379 | ev.setEnd( TimeConversion::fromUTC( end_utc ) ); |
375 | 380 | ||
376 | // we only have one type of sound at the moment... LOUD!!! | 381 | // we only have one type of sound at the moment... LOUD!!! |
377 | if ( comboSound->currentItem() != 0 ) | 382 | if ( comboSound->currentItem() != 0 ) |
378 | st = Event::Loud; | 383 | st = Event::Loud; |
379 | else | 384 | else |
380 | st = Event::Silent; | 385 | st = Event::Silent; |
381 | ev.setAlarm( checkAlarm->isChecked(), spinAlarm->value(), st ); | 386 | ev.setAlarm( checkAlarm->isChecked(), spinAlarm->value(), st ); |
382 | if ( rp.type != Event::NoRepeat ) | 387 | if ( rp.type != Event::NoRepeat ) |
383 | ev.setRepeat( TRUE, rp ); | 388 | ev.setRepeat( TRUE, rp ); |
384 | ev.setNotes( editNote->text() ); | 389 | ev.setNotes( editNote->text() ); |
390 | |||
391 | //cout << "Start: " << comboStart->currentText() << endl; | ||
392 | |||
385 | return ev; | 393 | return ev; |
386 | } | 394 | } |
387 | 395 | ||
388 | void DateEntry::setRepeatLabel() | 396 | void DateEntry::setRepeatLabel() |
389 | { | 397 | { |
390 | 398 | ||
391 | switch( rp.type ) { | 399 | switch( rp.type ) { |
392 | case Event::Daily: | 400 | case Event::Daily: |
393 | cmdRepeat->setText( tr("Daily...") ); | 401 | cmdRepeat->setText( tr("Daily...") ); |
394 | break; | 402 | break; |
395 | case Event::Weekly: | 403 | case Event::Weekly: |
396 | cmdRepeat->setText( tr("Weekly...") ); | 404 | cmdRepeat->setText( tr("Weekly...") ); |
397 | break; | 405 | break; |
398 | case Event::MonthlyDay: | 406 | case Event::MonthlyDay: |
399 | case Event::MonthlyDate: | 407 | case Event::MonthlyDate: |
400 | cmdRepeat->setText( tr("Monthly...") ); | 408 | cmdRepeat->setText( tr("Monthly...") ); |
401 | break; | 409 | break; |
402 | case Event::Yearly: | 410 | case Event::Yearly: |
403 | cmdRepeat->setText( tr("Yearly...") ); | 411 | cmdRepeat->setText( tr("Yearly...") ); |
404 | break; | 412 | break; |
405 | default: | 413 | default: |
406 | cmdRepeat->setText( tr("No Repeat...") ); | 414 | cmdRepeat->setText( tr("No Repeat...") ); |
407 | } | 415 | } |
408 | } | 416 | } |