summaryrefslogtreecommitdiff
path: root/core/pim/datebook/datebookday.cpp
Unidiff
Diffstat (limited to 'core/pim/datebook/datebookday.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/datebook/datebookday.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/core/pim/datebook/datebookday.cpp b/core/pim/datebook/datebookday.cpp
index dfe39e5..00ddd05 100644
--- a/core/pim/datebook/datebookday.cpp
+++ b/core/pim/datebook/datebookday.cpp
@@ -1,45 +1,46 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include "datebookday.h" 21#include "datebookday.h"
22#include "datebooktypes.h"
22#include "datebookdayheaderimpl.h" 23#include "datebookdayheaderimpl.h"
23#include "datebookdayallday.h" 24#include "datebookdayallday.h"
24 25
25#include <opie2/oholidayplugin.h> 26#include <opie2/oholidayplugin.h>
26#include <qpe/resource.h> 27#include <qpe/resource.h>
27#include <qpe/qpeapplication.h> 28#include <qpe/qpeapplication.h>
28#include <qpe/ir.h> 29#include <qpe/ir.h>
29 30
30#include <qsimplerichtext.h> 31#include <qsimplerichtext.h>
31#include <qpopupmenu.h> 32#include <qpopupmenu.h>
32 33
33 34
34#include <qtimer.h> 35#include <qtimer.h>
35 36
36DateBookDayView::DateBookDayView( bool whichClock, QWidget *parent, const char *name ) 37DateBookDayView::DateBookDayView( bool whichClock, QWidget *parent, const char *name )
37 : QTable( 24, 1, parent, name ), ampm( whichClock ), currDate( QDate::currentDate() ) 38 : QTable( 24, 1, parent, name ), ampm( whichClock ), currDate( QDate::currentDate() )
38{ 39{
39 enableClipper(TRUE); 40 enableClipper(TRUE);
40 setTopMargin( 0 ); 41 setTopMargin( 0 );
41 horizontalHeader()->hide(); 42 horizontalHeader()->hide();
42 setLeftMargin(38); 43 setLeftMargin(38);
43 setColumnStretchable( 0, TRUE ); 44 setColumnStretchable( 0, TRUE );
44 setHScrollBarMode( QScrollView::AlwaysOff ); 45 setHScrollBarMode( QScrollView::AlwaysOff );
45 verticalHeader()->setPalette(white); 46 verticalHeader()->setPalette(white);
@@ -206,49 +207,49 @@ DateBookDayViewQuickLineEdit::DateBookDayViewQuickLineEdit(const QDateTime &star
206} 207}
207 208
208void DateBookDayViewQuickLineEdit::slotReturnPressed() 209void DateBookDayViewQuickLineEdit::slotReturnPressed()
209{ 210{
210 if(active && (!this->text().isEmpty())) { // Fix to avoid having this event beeing added multiple times. 211 if(active && (!this->text().isEmpty())) { // Fix to avoid having this event beeing added multiple times.
211 quickEvent.setDescription(this->text()); 212 quickEvent.setDescription(this->text());
212 connect(this,SIGNAL(insertEvent(const Event&)),this->topLevelWidget(),SLOT(insertEvent(const Event&))); 213 connect(this,SIGNAL(insertEvent(const Event&)),this->topLevelWidget(),SLOT(insertEvent(const Event&)));
213 emit(insertEvent(quickEvent)); 214 emit(insertEvent(quickEvent));
214 active=0; 215 active=0;
215 } 216 }
216 /* we need to return to this object.. */ 217 /* we need to return to this object.. */
217 QTimer::singleShot(500, this, SLOT(finallyCallClose()) ); // Close and also delete this widget 218 QTimer::singleShot(500, this, SLOT(finallyCallClose()) ); // Close and also delete this widget
218} 219}
219void DateBookDayViewQuickLineEdit::finallyCallClose() { 220void DateBookDayViewQuickLineEdit::finallyCallClose() {
220 close(true); // also deletes this widget... 221 close(true); // also deletes this widget...
221} 222}
222 223
223void DateBookDayViewQuickLineEdit::focusOutEvent ( QFocusEvent* /* e */) 224void DateBookDayViewQuickLineEdit::focusOutEvent ( QFocusEvent* /* e */)
224{ 225{
225 slotReturnPressed(); // Reuse code to add event and close this widget. 226 slotReturnPressed(); // Reuse code to add event and close this widget.
226} 227}
227 228
228//=========================================================================== 229//===========================================================================
229 230
230DateBookDay::DateBookDay( bool ampm, bool startOnMonday, DateBookDB *newDb, DateBookHoliday*newHdb, QWidget *parent, const char *name ) 231DateBookDay::DateBookDay( bool ampm, bool startOnMonday, DateBookDBHoliday *newDb, DateBookHoliday*newHdb, QWidget *parent, const char *name )
231 : QVBox( parent, name ), currDate( QDate::currentDate() ), db( newDb ), startTime( 0 ) 232 : QVBox( parent, name ), currDate( QDate::currentDate() ), db( newDb ), startTime( 0 )
232{ 233{
233 widgetList.setAutoDelete( true ); 234 widgetList.setAutoDelete( true );
234 _holiday_db = newHdb; 235 _holiday_db = newHdb;
235 header = new DateBookDayHeader( startOnMonday, this, "day header" ); 236 header = new DateBookDayHeader( startOnMonday, this, "day header" );
236 header->setDate( currDate.year(), currDate.month(), currDate.day() ); 237 header->setDate( currDate.year(), currDate.month(), currDate.day() );
237 238
238 m_allDays = new DatebookdayAllday(newDb, this, "all day event list" ); 239 m_allDays = new DatebookdayAllday(newDb, this, "all day event list" );
239 m_allDays->hide(); 240 m_allDays->hide();
240 241
241 view = new DateBookDayView( ampm, this, "day view" ); 242 view = new DateBookDayView( ampm, this, "day view" );
242 243
243 connect( header, SIGNAL( dateChanged(int,int,int) ), this, SLOT( dateChanged(int,int,int) ) ); 244 connect( header, SIGNAL( dateChanged(int,int,int) ), this, SLOT( dateChanged(int,int,int) ) );
244 connect( header, SIGNAL( dateChanged(int,int,int) ), view, SLOT( slotDateChanged(int,int,int) ) ); 245 connect( header, SIGNAL( dateChanged(int,int,int) ), view, SLOT( slotDateChanged(int,int,int) ) );
245 connect( view, SIGNAL( sigColWidthChanged() ), this, SLOT( slotColWidthChanged() ) ); 246 connect( view, SIGNAL( sigColWidthChanged() ), this, SLOT( slotColWidthChanged() ) );
246 connect( qApp, SIGNAL(weekChanged(bool)), this, SLOT(slotWeekChanged(bool)) ); 247 connect( qApp, SIGNAL(weekChanged(bool)), this, SLOT(slotWeekChanged(bool)) );
247 connect( view, SIGNAL(sigCapturedKey(const QString&)), this, SIGNAL(sigNewEvent(const QString&)) ); 248 connect( view, SIGNAL(sigCapturedKey(const QString&)), this, SIGNAL(sigNewEvent(const QString&)) );
248 249
249 QTimer *timer = new QTimer( this ); 250 QTimer *timer = new QTimer( this );
250 251
251 connect( timer, SIGNAL(timeout()), this, SLOT(updateView()) ); //connect timer for updating timeMarker & daywidgetcolors 252 connect( timer, SIGNAL(timeout()), this, SLOT(updateView()) ); //connect timer for updating timeMarker & daywidgetcolors
252 timer->start( 1000*60*5, FALSE ); //update every 5min 253 timer->start( 1000*60*5, FALSE ); //update every 5min
253 254
254 selectedWidget = 0; 255 selectedWidget = 0;
@@ -346,49 +347,49 @@ void DateBookDay::dateChanged( int y, int m, int d )
346} 347}
347 348
348void DateBookDay::redraw() 349void DateBookDay::redraw()
349{ 350{
350 if ( isUpdatesEnabled() ) 351 if ( isUpdatesEnabled() )
351 relayoutPage(); 352 relayoutPage();
352} 353}
353 354
354void DateBookDay::getEvents() 355void DateBookDay::getEvents()
355{ 356{
356 widgetList.clear(); 357 widgetList.clear();
357 358
358 /* clear the AllDay List */ 359 /* clear the AllDay List */
359 m_allDays->hide(); // just in case 360 m_allDays->hide(); // just in case
360 m_allDays->removeAllEvents(); 361 m_allDays->removeAllEvents();
361 362
362 QStringList hdays = _holiday_db->holidaylist(currDate); 363 QStringList hdays = _holiday_db->holidaylist(currDate);
363 QStringList::Iterator sit; 364 QStringList::Iterator sit;
364 QObject* object = 0; 365 QObject* object = 0;
365 for (sit=hdays.begin();sit!=hdays.end();++sit) { 366 for (sit=hdays.begin();sit!=hdays.end();++sit) {
366 object = m_allDays->addHoliday(*sit); 367 object = m_allDays->addHoliday(*sit);
367 if (!object) continue; 368 if (!object) continue;
368 /* not to do something with it */ 369 /* not to do something with it */
369 } 370 }
370 QValueList<EffectiveEvent> eventList = db->getEffectiveEvents( currDate, currDate ); 371 QValueList<EffectiveEvent> eventList = db->getEffectiveEventsNoHoliday( currDate, currDate );
371 QValueListIterator<EffectiveEvent> it; 372 QValueListIterator<EffectiveEvent> it;
372 373
373 for ( it = eventList.begin(); it != eventList.end(); ++it ) { 374 for ( it = eventList.begin(); it != eventList.end(); ++it ) {
374 EffectiveEvent ev=*it; 375 EffectiveEvent ev=*it;
375 if(!((ev.end().hour()==0) && (ev.end().minute()==0) && (ev.startDate()!=ev.date()))) { // Skip events ending at 00:00 starting at another day. 376 if(!((ev.end().hour()==0) && (ev.end().minute()==0) && (ev.startDate()!=ev.date()))) { // Skip events ending at 00:00 starting at another day.
376 if (ev.event().type() == Event::AllDay ) { 377 if (ev.event().type() == Event::AllDay ) {
377 object = m_allDays->addEvent( ev ); 378 object = m_allDays->addEvent( ev );
378 if (!object) 379 if (!object)
379 continue; 380 continue;
380 }else { 381 }else {
381 DateBookDayWidget* w = new DateBookDayWidget( *it, this ); 382 DateBookDayWidget* w = new DateBookDayWidget( *it, this );
382 widgetList.append( w ); 383 widgetList.append( w );
383 object = w; 384 object = w;
384 } 385 }
385 386
386 connect( object, SIGNAL( deleteMe(const Event&) ), this, SIGNAL( removeEvent(const Event&) ) ); 387 connect( object, SIGNAL( deleteMe(const Event&) ), this, SIGNAL( removeEvent(const Event&) ) );
387 connect( object, SIGNAL( duplicateMe(const Event&) ), this, SIGNAL( duplicateEvent(const Event&) ) ); 388 connect( object, SIGNAL( duplicateMe(const Event&) ), this, SIGNAL( duplicateEvent(const Event&) ) );
388 connect( object, SIGNAL( editMe(const Event&) ), this, SIGNAL( editEvent(const Event&) ) ); 389 connect( object, SIGNAL( editMe(const Event&) ), this, SIGNAL( editEvent(const Event&) ) );
389 connect( object, SIGNAL( beamMe(const Event&) ), this, SIGNAL( beamEvent(const Event&) ) ); 390 connect( object, SIGNAL( beamMe(const Event&) ), this, SIGNAL( beamEvent(const Event&) ) );
390 391
391 } 392 }
392 } 393 }
393} 394}
394 395