-rw-r--r-- | core/pim/datebook/datebook.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/core/pim/datebook/datebook.cpp b/core/pim/datebook/datebook.cpp index 6ec6cc2..e8d808f 100644 --- a/core/pim/datebook/datebook.cpp +++ b/core/pim/datebook/datebook.cpp | |||
@@ -7,32 +7,34 @@ | |||
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 | ||
24 | |||
23 | #include "datebook.h" | 25 | #include "datebook.h" |
24 | #include "datebookday.h" | 26 | #include "datebookday.h" |
25 | #include "datebooksettings.h" | 27 | #include "datebooksettings.h" |
26 | #include "datebookweek.h" | 28 | #include "datebookweek.h" |
27 | #include "dateentryimpl.h" | 29 | #include "dateentryimpl.h" |
28 | 30 | ||
29 | #include <qpe/datebookmonth.h> | 31 | #include <qpe/datebookmonth.h> |
30 | #include <qpe/qpeapplication.h> | 32 | #include <qpe/qpeapplication.h> |
31 | #include <qpe/config.h> | 33 | #include <qpe/config.h> |
32 | #include <qpe/qpedebug.h> | 34 | #include <qpe/qpedebug.h> |
33 | #include <qpe/event.h> | 35 | #include <qpe/event.h> |
34 | #include <qpe/finddialog.h> | 36 | #include <qpe/finddialog.h> |
35 | #include <qpe/ir.h> | 37 | #include <qpe/ir.h> |
36 | #include <qpe/qpemenubar.h> | 38 | #include <qpe/qpemenubar.h> |
37 | #include <qpe/qpemessagebox.h> | 39 | #include <qpe/qpemessagebox.h> |
38 | #include <qpe/resource.h> | 40 | #include <qpe/resource.h> |
@@ -97,60 +99,61 @@ DateBook::DateBook( QWidget *parent, const char *, WFlags f ) | |||
97 | QPEToolBar *sub_bar = new QPEToolBar(this); | 99 | QPEToolBar *sub_bar = new QPEToolBar(this); |
98 | 100 | ||
99 | QPopupMenu *view = new QPopupMenu( this ); | 101 | QPopupMenu *view = new QPopupMenu( this ); |
100 | QPopupMenu *settings = new QPopupMenu( this ); | 102 | QPopupMenu *settings = new QPopupMenu( this ); |
101 | 103 | ||
102 | mb->insertItem( tr( "View" ), view ); | 104 | mb->insertItem( tr( "View" ), view ); |
103 | mb->insertItem( tr( "Settings" ), settings ); | 105 | mb->insertItem( tr( "Settings" ), settings ); |
104 | 106 | ||
105 | QActionGroup *g = new QActionGroup( this ); | 107 | QActionGroup *g = new QActionGroup( this ); |
106 | g->setExclusive( TRUE ); | 108 | g->setExclusive( TRUE ); |
107 | 109 | ||
108 | QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), | 110 | QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), |
109 | QString::null, 0, this, 0 ); | 111 | QString::null, 0, this, 0 ); |
110 | connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) ); | 112 | connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) ); |
111 | a->addTo( sub_bar ); | 113 | a->addTo( sub_bar ); |
112 | 114 | ||
115 | a = new QAction( tr( "Today" ), Resource::loadPixmap( "to_day" ), QString::null, 0, g, 0 ); | ||
116 | connect( a, SIGNAL( activated() ), this, SLOT( slotToday() ) ); | ||
117 | a->addTo( sub_bar ); | ||
118 | a->addTo( view ); | ||
119 | |||
113 | a = new QAction( tr( "Day" ), Resource::loadPixmap( "day" ), QString::null, 0, g, 0 ); | 120 | a = new QAction( tr( "Day" ), Resource::loadPixmap( "day" ), QString::null, 0, g, 0 ); |
114 | connect( a, SIGNAL( activated() ), this, SLOT( viewDay() ) ); | 121 | connect( a, SIGNAL( activated() ), this, SLOT( viewDay() ) ); |
115 | a->addTo( sub_bar ); | 122 | a->addTo( sub_bar ); |
116 | a->addTo( view ); | 123 | a->addTo( view ); |
117 | a->setToggleAction( TRUE ); | 124 | a->setToggleAction( TRUE ); |
118 | a->setOn( TRUE ); | 125 | a->setOn( TRUE ); |
119 | dayAction = a; | 126 | dayAction = a; |
120 | a = new QAction( tr( "Week" ), Resource::loadPixmap( "week" ), QString::null, 0, g, 0 ); | 127 | a = new QAction( tr( "Week" ), Resource::loadPixmap( "week" ), QString::null, 0, g, 0 ); |
121 | connect( a, SIGNAL( activated() ), this, SLOT( viewWeek() ) ); | 128 | connect( a, SIGNAL( activated() ), this, SLOT( viewWeek() ) ); |
122 | a->addTo( sub_bar ); | 129 | a->addTo( sub_bar ); |
123 | a->addTo( view ); | 130 | a->addTo( view ); |
124 | a->setToggleAction( TRUE ); | 131 | a->setToggleAction( TRUE ); |
125 | weekAction = a; | 132 | weekAction = a; |
126 | a = new QAction( tr( "Month" ), Resource::loadPixmap( "month" ), QString::null, 0, g, 0 ); | 133 | a = new QAction( tr( "Month" ), Resource::loadPixmap( "month" ), QString::null, 0, g, 0 ); |
127 | connect( a, SIGNAL( activated() ), this, SLOT( viewMonth() ) ); | 134 | connect( a, SIGNAL( activated() ), this, SLOT( viewMonth() ) ); |
128 | a->addTo( sub_bar ); | 135 | a->addTo( sub_bar ); |
129 | a->addTo( view ); | 136 | a->addTo( view ); |
130 | a->setToggleAction( TRUE ); | 137 | a->setToggleAction( TRUE ); |
131 | monthAction = a; | 138 | monthAction = a; |
132 | 139 | ||
133 | a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ), QString::null, 0, g, 0 ); | 140 | a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ), QString::null, 0, g, 0 ); |
134 | connect( a, SIGNAL(activated()), this, SLOT(slotFind()) ); | 141 | connect( a, SIGNAL(activated()), this, SLOT(slotFind()) ); |
135 | a->addTo( sub_bar ); | 142 | a->addTo( sub_bar ); |
136 | 143 | ||
137 | a = new QAction( tr( "Today" ), QString::null, 0, 0 ); | ||
138 | connect( a, SIGNAL( activated() ), this, SLOT( slotToday() ) ); | ||
139 | a->addTo( view ); | ||
140 | |||
141 | a = new QAction( tr( "Alarm and Start Time..." ), QString::null, 0, 0 ); | 144 | a = new QAction( tr( "Alarm and Start Time..." ), QString::null, 0, 0 ); |
142 | connect( a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); | 145 | connect( a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); |
143 | a->addTo( settings ); | 146 | a->addTo( settings ); |
144 | 147 | ||
145 | views = new QWidgetStack( this ); | 148 | views = new QWidgetStack( this ); |
146 | setCentralWidget( views ); | 149 | setCentralWidget( views ); |
147 | 150 | ||
148 | dayView = 0; | 151 | dayView = 0; |
149 | weekView = 0; | 152 | weekView = 0; |
150 | monthView = 0; | 153 | monthView = 0; |
151 | 154 | ||
152 | viewDay(); | 155 | viewDay(); |
153 | connect( qApp, SIGNAL(clockChanged(bool)), | 156 | connect( qApp, SIGNAL(clockChanged(bool)), |
154 | this, SLOT(changeClock(bool)) ); | 157 | this, SLOT(changeClock(bool)) ); |
155 | connect( qApp, SIGNAL(weekChanged(bool)), | 158 | connect( qApp, SIGNAL(weekChanged(bool)), |
156 | this, SLOT(changeWeek(bool)) ); | 159 | this, SLOT(changeWeek(bool)) ); |
@@ -243,33 +246,33 @@ QString DateBook::checkEvent(const Event &e) | |||
243 | checkFailed = TRUE; | 246 | checkFailed = TRUE; |
244 | break; | 247 | break; |
245 | } | 248 | } |
246 | current_date = next.date(); | 249 | current_date = next.date(); |
247 | } | 250 | } |
248 | 251 | ||
249 | if(checkFailed) | 252 | if(checkFailed) |
250 | return tr("Event duration is potentially longer\n" | 253 | return tr("Event duration is potentially longer\n" |
251 | "than interval between repeats."); | 254 | "than interval between repeats."); |
252 | 255 | ||
253 | return QString::null; | 256 | return QString::null; |
254 | } | 257 | } |
255 | 258 | ||
256 | QDate DateBook::currentDate() | 259 | QDate DateBook::currentDate() |
257 | { | 260 | { |
258 | QDate d = QDate::currentDate(); | 261 | QDate d = QDate::currentDate(); |
259 | 262 | ||
260 | if ( dayView && views->visibleWidget() == dayView ) { | 263 | if ( dayView && views->visibleWidget() == dayView ) { |
261 | d = dayView->date(); | 264 | d = dayView->date(); |
262 | } else if ( weekView && views->visibleWidget() == weekView ) { | 265 | } else if ( weekView && views->visibleWidget() == weekView ) { |
263 | d = weekView->date(); | 266 | d = weekView->date(); |
264 | } else if ( monthView && views->visibleWidget() == monthView ) { | 267 | } else if ( monthView && views->visibleWidget() == monthView ) { |
265 | d = monthView->selectedDate(); | 268 | d = monthView->selectedDate(); |
266 | } | 269 | } |
267 | 270 | ||
268 | return d; | 271 | return d; |
269 | } | 272 | } |
270 | 273 | ||
271 | void DateBook::viewDay() | 274 | void DateBook::viewDay() |
272 | { | 275 | { |
273 | initDay(); | 276 | initDay(); |
274 | dayAction->setOn( TRUE ); | 277 | dayAction->setOn( TRUE ); |
275 | QDate d = currentDate(); | 278 | QDate d = currentDate(); |