Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

datebook.cpp

Go to the documentation of this file.
00001 /*
00002                              This file is part of the Opie Project
00003 
00004                              Copyright (C) Opie Team <opie-devel@handhelds.org>
00005               =.
00006             .=l.
00007            .>+-=
00008  _;:,     .>    :=|.         This program is free software; you can
00009 .> <`_,   >  .   <=          redistribute it and/or  modify it under
00010 :`=1 )Y*s>-.--   :           the terms of the GNU Library General Public
00011 .="- .-=="i,     .._         License as published by the Free Software
00012  - .   .-<_>     .<>         Foundation; either version 2 of the License,
00013      ._= =}       :          or (at your option) any later version.
00014     .%`+i>       _;_.
00015     .i_,=:_.      -<s.       This program is distributed in the hope that
00016      +  .  -:.       =       it will be useful,  but WITHOUT ANY WARRANTY;
00017     : ..    .:,     . . .    without even the implied warranty of
00018     =_        +     =;=|`    MERCHANTABILITY or FITNESS FOR A
00019   _.=:.       :    :=>`:     PARTICULAR PURPOSE. See the GNU
00020 ..}^=.=       =       ;      Library General Public License for more
00021 ++=   -.     .`     .:       details.
00022 :     =  ...= . :.=-
00023  -.   .:....=;==+<;          You should have received a copy of the GNU
00024   -_. . .   )=.  =           Library General Public License along with
00025     --        :-=`           this library; see the file COPYING.LIB.
00026                              If not, write to the Free Software Foundation,
00027                              Inc., 59 Temple Place - Suite 330,
00028                              Boston, MA 02111-1307, USA.
00029 */
00030 
00031 #define QTOPIA_INTERNAL_FD
00032 
00033 #include "datebook.h"
00034 #include "datebookday.h"
00035 #include "datebooksettings.h"
00036 #include "datebookweek.h"
00037 #include "modules/weeklst/datebookweeklst.h"
00038 #include "modules/monthview/odatebookmonth.h"
00039 #include "dateentryimpl.h"
00040 
00041 #include <opie2/odebug.h>
00042 #include <opie2/oholidaypluginif.h>
00043 #include <opie2/oholidayplugin.h>
00044 #include <opie2/opluginloader.h>
00045 #include <opie2/oresource.h>
00046 #include <opie2/todayplugininterface.h>
00047 
00048 //#include <qpe/datebookmonth.h>
00049 #include <qpe/qpeapplication.h>
00050 #include <qpe/config.h>
00051 #include <qpe/finddialog.h>
00052 #include <qpe/ir.h>
00053 #include <qpe/qpemessagebox.h>
00054 #include <qpe/sound.h>
00055 #include <qpe/tzselect.h>
00056 #include <qtopia/qlibrary.h>
00057 
00058 #include <qaction.h>
00059 #include <qcopchannel_qws.h>
00060 #include <qlayout.h>
00061 #include <qmessagebox.h>
00062 #include <qtimer.h>
00063 #include <qtl.h>
00064 #include <qtoolbar.h>
00065 #include <qwidgetstack.h>
00066 #include <qdir.h>
00067 #include <qlabel.h>
00068 
00069 #include <sys/stat.h>
00070 #include <sys/types.h>
00071 #include <fcntl.h>
00072 #include <unistd.h>
00073 
00074 #include <stdlib.h>
00075 
00076 DateBook::DateBook( QWidget *parent, const char *, WFlags f )
00077     : QMainWindow( parent, "datebook", f ),
00078       aPreset( FALSE ),
00079       presetTime( -1 ),
00080       startTime( 8 ), // an acceptable default
00081       rowStyle( 0 ),
00082       bJumpToCurTime(FALSE),
00083       syncing(FALSE),
00084       inSearch(FALSE),
00085       alarmCounter(0)
00086 {
00087     bool needEvilHack= false; // if we need an Evil Hack
00088     QTime t;
00089     t.start();
00090     db = new DateBookDBHoliday;
00091     odebug << "loading db t=" << t.elapsed() << oendl;
00092     db_holiday = new DateBookHoliday();
00093     db->db_holiday=db_holiday;
00094 
00095     loadSettings();
00096     setCaption( tr("Calendar") );
00097     setIcon( Opie::Core::OResource::loadPixmap( "datebook_icon" ) );
00098 
00099     setToolBarsMovable( FALSE );
00100 
00101     views = new QWidgetStack( this );
00102     setCentralWidget( views );
00103 
00104     dayView = 0;
00105     weekView = 0;
00106     weekLstView = 0;
00107     monthView = 0;
00108 
00109 //    QToolBar *bar = new QToolBar( this );
00110 //    bar->setHorizontalStretchable( TRUE );
00111 
00112 //    QMenuBar *mb = new QMenuBar( bar );
00113 //    mb->setMargin( 0 );
00114 
00115 //    QPopupMenu *view = new QPopupMenu( this );
00116 //    mb->insertItem( tr( "View" ), view );
00117 
00118     QToolBar *sub_bar = new QToolBar(this);
00119     sub_bar->setHorizontalStretchable(TRUE);
00120 
00121     QActionGroup *g = new QActionGroup( this );
00122     g->setExclusive( TRUE );
00123 
00124     QAction *a = new QAction( tr( "New" ), Opie::Core::OResource::loadPixmap( "new", Opie::Core::OResource::SmallIcon ),
00125                               QString::null, 0, this, 0 );
00126     connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) );
00127     a->addTo( sub_bar );
00128 
00129     sub_bar->addSeparator();
00130 
00131     a = new QAction( tr( "Today" ), Opie::Core::OResource::loadPixmap( "datebook/to_day", Opie::Core::OResource::SmallIcon ),
00132                      QString::null, 0, g, 0 );
00133     connect( a, SIGNAL( activated() ), this, SLOT( slotToday() ) );
00134     a->addTo( sub_bar );
00135 //  a->addTo( view );
00136 
00137     sub_bar->addSeparator();
00138 
00139     a = new QAction( tr( "Day" ), Opie::Core::OResource::loadPixmap( "day", Opie::Core::OResource::SmallIcon ),
00140                      QString::null, 0, g, 0 );
00141     connect( a, SIGNAL( activated() ), this, SLOT( viewDay() ) );
00142     a->addTo( sub_bar );
00143 //    a->addTo( view );
00144     a->setToggleAction( TRUE );
00145     a->setOn( TRUE );
00146     dayAction = a;
00147 
00148     a = new QAction( tr( "Week" ), Opie::Core::OResource::loadPixmap( "week", Opie::Core::OResource::SmallIcon ),
00149                      QString::null, 0, g, 0 );
00150     connect( a, SIGNAL( activated() ), this, SLOT( viewWeek() ) );
00151     a->addTo( sub_bar );
00152 //    a->addTo( view );
00153     a->setToggleAction( TRUE );
00154     weekAction = a;
00155 
00156     a = new QAction( tr( "WeekLst" ), Opie::Core::OResource::loadPixmap( "datebook/weeklst", Opie::Core::OResource::SmallIcon ),
00157                      QString::null, 0, g, 0 );
00158     connect( a, SIGNAL( activated() ), this, SLOT( viewWeekLst() ) );
00159     a->addTo( sub_bar );
00160 //    a->addTo( view );
00161     a->setToggleAction( TRUE );
00162     weekLstAction = a;
00163 
00164     a = new QAction( tr( "Month" ), Opie::Core::OResource::loadPixmap( "month", Opie::Core::OResource::SmallIcon ),
00165                      QString::null, 0, g, 0 );
00166     connect( a, SIGNAL( activated() ), this, SLOT( viewMonth() ) );
00167     a->addTo( sub_bar );
00168 //    a->addTo( view );
00169     a->setToggleAction( TRUE );
00170     monthAction = a;
00171 
00172     sub_bar->addSeparator();
00173 
00174     a = new QAction( tr( "Find" ), Opie::Core::OResource::loadPixmap( "mag", Opie::Core::OResource::SmallIcon ),
00175                      QString::null, 0, this, 0 );
00176     connect( a, SIGNAL(activated()), this, SLOT(slotFind()) );
00177     a->addTo( sub_bar );
00178 
00179     a = new QAction( tr( "Edit..." ), Opie::Core::OResource::loadPixmap( "SettingsIcon", Opie::Core::OResource::SmallIcon ),
00180                      QString::null, 0, this, 0 );
00181     connect( a, SIGNAL( activated() ), this, SLOT( slotSettings() ) );
00182     a->addTo( sub_bar );
00183 
00184     if(defaultView==DAY) viewDay();
00185     if(defaultView==WEEK) needEvilHack=true;    // viewWeek();
00186     if(defaultView==WEEKLST) viewWeekLst();
00187     if(defaultView==MONTH) viewMonth();
00188 
00189     connect( qApp, SIGNAL(clockChanged(bool)), this, SLOT(changeClock(bool)) );
00190     connect( qApp, SIGNAL(weekChanged(bool)), this, SLOT(changeWeek(bool)) );
00191 
00192 #if defined(Q_WS_QWS) && !defined(QT_NO_COP)
00193     connect( qApp, SIGNAL(appMessage(const QCString&,const QByteArray&)), this, SLOT(appMessage(const QCString&,const QByteArray&)) );
00194 #endif
00195 
00196     // listen on QPE/System
00197 #if defined(Q_WS_QWS)
00198 #if !defined(QT_NO_COP)
00199     QCopChannel *channel = new QCopChannel( "QPE/System", this );
00200     connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), this, SLOT(receive(const QCString&,const QByteArray&)) );
00201     channel = new QCopChannel( "QPE/Datebook", this );
00202     connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), this, SLOT(receive(const QCString&,const QByteArray&)) );
00203 #endif
00204 #endif
00205 
00206     odebug << "done t=" << t.elapsed() << oendl;
00207 
00208         connect( qApp, SIGNAL( flush() ), this, SLOT( flush() ) );
00209         connect( qApp, SIGNAL( reload()), this, SLOT( reload() ) );
00210     /*
00211      *  Here is a problem description:
00212      *  When Weekview is the default view
00213      *  a DateBookWeekView get's created
00214      *  redraw() get's called. So what?
00215      *  Remember that we're still in the c'tor
00216      *  and no final layout has happened? Ok
00217      *  now all Events get arranged. Their x
00218      *  position get's determined by a QHeader
00219      *  position. But the QHeader isn't layouted or
00220      *  at the right position. redraw() is a slot
00221      *  so we'll call it then via a singleShot
00222      *  from view()
00223      */
00224     if( needEvilHack ){
00225         QTimer::singleShot( 500, this, SLOT(viewWeek()) );
00226     }
00227 }
00228 
00229 void DateBook::receive( const QCString &msg, const QByteArray &data )
00230 {
00231     QDataStream stream( data, IO_ReadOnly );
00232     if ( msg == "timeChange(QString)" ) {
00233     // update active view!
00234     if ( dayAction->isOn() )
00235         viewDay();
00236     else if ( weekAction->isOn() )
00237         viewWeek();
00238     else if ( monthAction->isOn() )
00239         viewMonth();
00240     }
00241     else if (msg == "editEvent(int)") {
00242     int uid;
00243     stream >> uid;
00244     Event e=db->eventByUID(uid);
00245     editEvent(e);
00246     }else if (msg == "viewDefault(QDate)"){
00247          QDate day;
00248          stream >> day;
00249          viewDefault(day);
00250      }
00251 }
00252 
00253 DateBook::~DateBook()
00254 {
00255     delete db_holiday;
00256 }
00257 
00258 void DateBook::slotSettings()
00259 {
00260     DateBookSettings frmSettings( ampm, this );
00261     frmSettings.setStartTime( startTime );
00262     frmSettings.setAlarmPreset( aPreset, presetTime );
00263     frmSettings.setJumpToCurTime( bJumpToCurTime );
00264     frmSettings.setRowStyle( rowStyle );
00265     frmSettings.comboDefaultView->setCurrentItem(defaultView-1);
00266     frmSettings.comboWeekListView->setCurrentItem(weeklistviewconfig);
00267     frmSettings.setPluginList(db_holiday->pluginManager(),db_holiday->pluginLoader());
00268 
00269     bool found=false;
00270     for (int i=0; i<(frmSettings.comboLocation->count()); i++) {
00271         if ( frmSettings.comboLocation->text(i) == defaultLocation ) {
00272             frmSettings.comboLocation->setCurrentItem(i);
00273             found=true;
00274             break;
00275         }
00276     }
00277     if(!found) {
00278         frmSettings.comboLocation->insertItem(defaultLocation);
00279         frmSettings.comboLocation->setCurrentItem(frmSettings.comboLocation->count()-1);
00280     }
00281     frmSettings.comboCategory->setCategories(defaultCategories,"Calendar", tr("Calendar"));
00282 
00283     if ( QPEApplication::execDialog( &frmSettings ) ) {
00284         frmSettings.savePlugins();
00285         db_holiday->pluginManager()->save();
00286         db_holiday->reloadPlugins();
00287 
00288         aPreset = frmSettings.alarmPreset();
00289         presetTime = frmSettings.presetTime();
00290         startTime = frmSettings.startTime();
00291         bJumpToCurTime = frmSettings.jumpToCurTime();
00292         rowStyle = frmSettings.rowStyle();
00293         defaultView=frmSettings.comboDefaultView->currentItem()+1;
00294         weeklistviewconfig=frmSettings.comboWeekListView->currentItem();
00295         defaultLocation=frmSettings.comboLocation->currentText();
00296         defaultCategories=frmSettings.comboCategory->currentCategories();
00297 
00298         if ( dayView ) {
00299             dayView->setStartViewTime( startTime );
00300             dayView->setJumpToCurTime( bJumpToCurTime );
00301             dayView->setRowStyle( rowStyle );
00302         }
00303         if ( weekView ) {
00304             weekView->setStartViewTime( startTime );
00305         }
00306         saveSettings();
00307 
00308         // make the change obvious
00309         if ( views->visibleWidget() ) {
00310             if ( views->visibleWidget() == dayView )
00311                 dayView->redraw();
00312             else if ( views->visibleWidget() == weekView )
00313                 weekView->redraw();
00314             else if ( views->visibleWidget() == weekLstView )
00315                 weekLstView->redraw();
00316         }
00317     }
00318 }
00319 
00320 void DateBook::fileNew()
00321 {
00322     slotNewEventFromKey("");
00323 }
00324 
00325 QString DateBook::checkEvent(const Event &e)
00326 {
00327     /* check if overlaps with itself */
00328     bool checkFailed = FALSE;
00329 
00330     /* check the next 12 repeats. should catch most problems */
00331     QDate current_date = e.start().date();
00332     Event previous = e;
00333     for(int i = 0; i < 12; i++)
00334     {
00335     QDateTime next;
00336     if (!nextOccurance(previous, current_date.addDays(1), next)) {
00337         break;  // no more repeats
00338     }
00339     if(next < previous.end()) {
00340         checkFailed = TRUE;
00341         break;
00342     }
00343     current_date = next.date();
00344     }
00345 
00346     if(checkFailed)
00347     return tr("Event duration is potentially longer\n"
00348           "than interval between repeats.");
00349 
00350     return QString::null;
00351 }
00352 
00353 QDate DateBook::currentDate()
00354 {
00355     QDate d = QDate::currentDate();
00356 
00357     if ( dayView && views->visibleWidget() == dayView ) {
00358     d = dayView->date();
00359     } else if ( weekView && views->visibleWidget() == weekView ) {
00360         d = weekView->date();
00361     } else if ( weekLstView && views->visibleWidget() == weekLstView ) {
00362         d = weekLstView->date();
00363     } else if ( monthView && views->visibleWidget() == monthView ) {
00364     d = monthView->selectedDate();
00365     }
00366 
00367     return d;
00368 }
00369 
00370 void DateBook::view(int v, const QDate &d) {
00371     if (v==DAY) {
00372         initDay();
00373         dayAction->setOn( TRUE );
00374         dayView->setDate( d );
00375         views->raiseWidget( dayView );
00376         dayView->redraw();
00377     } else if (v==WEEK) {
00378         initWeek();
00379         weekAction->setOn( TRUE );
00380         weekView->setDate( d );
00381         views->raiseWidget( weekView );
00382         weekView->redraw();
00383     } else if (v==WEEKLST) {
00384         initWeekLst();
00385         weekLstAction->setOn( TRUE );
00386         weekLstView->setDate(d);
00387         views->raiseWidget( weekLstView );
00388         weekLstView->redraw();
00389     } else if (v==MONTH) {
00390         initMonth();
00391         monthAction->setOn( TRUE );
00392         monthView->setDate( d.year(), d.month(), d.day() );
00393         views->raiseWidget( monthView );
00394         monthView->redraw();
00395     }
00396 }
00397 
00398 void DateBook::viewDefault(const QDate &d) {
00399     view(defaultView,d);
00400 }
00401 
00402 void DateBook::viewDay() {
00403     view(DAY,currentDate());
00404 }
00405 
00406 void DateBook::viewWeek() {
00407     view(WEEK,currentDate());
00408 }
00409 
00410 void DateBook::viewWeekLst() {
00411     view(WEEKLST,currentDate());
00412 }
00413 
00414 void DateBook::viewMonth() {
00415     view(MONTH,currentDate());
00416 }
00417 
00418 void DateBook::insertEvent( const Event &e )
00419 {
00420     Event dupEvent=e;
00421     if(!dupEvent.isValidUid() ) // tkcRom seems to be different
00422         dupEvent.assignUid();
00423     dupEvent.setLocation(defaultLocation);
00424     dupEvent.setCategories(defaultCategories);
00425     db->addEvent(dupEvent);
00426     emit newEvent();
00427 }
00428 
00429 void DateBook::duplicateEvent( const Event &e )
00430 {
00431     // Alot of code duplication, as this is almost like editEvent();
00432     if (syncing) {
00433         QMessageBox::warning( this, tr("Calendar"), tr( "Can not edit data, currently syncing") );
00434         return;
00435     }
00436 
00437     Event dupevent(e);  // Make a duplicate.
00438 
00439     // workaround added for text input.
00440     QDialog editDlg( this, 0, TRUE );
00441     DateEntry *entry;
00442     editDlg.setCaption( tr("Duplicate Event") );
00443     QVBoxLayout *vb = new QVBoxLayout( &editDlg );
00444     QScrollView *sv = new QScrollView( &editDlg, "scrollview" );
00445     sv->setResizePolicy( QScrollView::AutoOneFit );
00446     // KLUDGE!!!
00447     sv->setHScrollBarMode( QScrollView::AlwaysOff );
00448     vb->addWidget( sv );
00449     entry = new DateEntry( onMonday, dupevent, ampm, &editDlg, "editor" );
00450     entry->timezone->setEnabled( FALSE );
00451     sv->addChild( entry );
00452 
00453     while ( QPEApplication::execDialog( &editDlg ) ) {
00454         Event newEv = entry->event();
00455         QString error = checkEvent(newEv);
00456         if (!error.isNull()) {
00457             if (QMessageBox::warning(this, tr("error box"), error, tr("Fix it"), tr("Continue"), 0, 0, 1) == 0)
00458                 continue;
00459         }
00460         /*
00461         * The problem:
00462         * DateBookDB does remove repeating events not by uid but by the time
00463         * the recurrence was created
00464         * so we need to update that time as well
00465         */
00466         Event::RepeatPattern rp = newEv.repeatPattern();
00467         rp.createTime = ::time( NULL );
00468         newEv.setRepeat( TRUE, rp ); // has repeat and repeatPattern...
00469         if( newEv.uid() == e.uid() || !newEv.isValidUid() )
00470             newEv.assignUid();
00471 
00472         db->addEvent(newEv);
00473         emit newEvent();
00474         break;
00475     }
00476 }
00477 
00478 void DateBook::editEvent( const Event &e )
00479 {
00480     if (syncing) {
00481         QMessageBox::warning( this, tr("Calendar"), tr( "Can not edit data, currently syncing") );
00482         return;
00483     }
00484 
00485     // workaround added for text input.
00486     QDialog editDlg( this, 0, TRUE );
00487     DateEntry *entry;
00488     editDlg.setCaption( tr("Edit Event") );
00489     QVBoxLayout *vb = new QVBoxLayout( &editDlg );
00490     QScrollView *sv = new QScrollView( &editDlg, "scrollview" );
00491     sv->setResizePolicy( QScrollView::AutoOneFit );
00492     // KLUDGE!!!
00493     sv->setHScrollBarMode( QScrollView::AlwaysOff );
00494     vb->addWidget( sv );
00495     entry = new DateEntry( onMonday, e, ampm, &editDlg, "editor" );
00496     entry->timezone->setEnabled( FALSE );
00497     sv->addChild( entry );
00498 
00499     while ( QPEApplication::execDialog( &editDlg ) ) {
00500         Event newEv = entry->event();
00501         if(newEv.description().isEmpty() && newEv.notes().isEmpty() )
00502             break;
00503         newEv.setUid(e.uid()); // FIXME: Hack not to clear uid
00504         QString error = checkEvent(newEv);
00505         if (!error.isNull()) {
00506             if (QMessageBox::warning(this, tr("error box"), error, tr("Fix it"), tr("Continue"), 0, 0, 1) == 0) continue;
00507     }
00508     db->editEvent(e, newEv);
00509     emit newEvent();
00510     break;
00511     }
00512 }
00513 
00514 void DateBook::removeEvent( const Event &e )
00515 {
00516     if (syncing) {
00517         QMessageBox::warning( this, tr("Calendar"), tr( "Can not edit data, currently syncing") );
00518         return;
00519     }
00520 
00521     QString strName = e.description();
00522 
00523     if ( !QPEMessageBox::confirmDelete( this, tr( "Calendar" ),strName ) )
00524     return;
00525 
00526     db->removeEvent( e );
00527     if ( views->visibleWidget() == dayView && dayView )
00528         dayView->redraw();
00529 
00530 }
00531 
00532 void DateBook::addEvent( const Event &e )
00533 {
00534     QDate d = e.start().date();
00535     initDay();
00536     dayView->setDate( d );
00537 }
00538 
00539 void DateBook::showDay( int year, int month, int day )
00540 {
00541     QDate d(year, month, day);
00542     view(DAY,d);
00543 }
00544 
00545 void DateBook::initDay()
00546 {
00547     if ( !dayView ) {
00548         dayView = new DateBookDay( ampm, onMonday, db, db_holiday, views, "day view" );
00549         views->addWidget( dayView, DAY );
00550                 dayView->setJumpToCurTime( bJumpToCurTime );
00551         dayView->setStartViewTime( startTime );
00552         dayView->setRowStyle( rowStyle );
00553         connect( this, SIGNAL( newEvent() ), dayView, SLOT( redraw() ) );
00554         connect( dayView, SIGNAL( newEvent() ),     this, SLOT( fileNew() ) );
00555         connect( dayView, SIGNAL( removeEvent(const Event&) ), this, SLOT( removeEvent(const Event&) ) );
00556         connect( dayView, SIGNAL( editEvent(const Event&) ), this, SLOT( editEvent(const Event&) ) );
00557         connect( dayView, SIGNAL( duplicateEvent(const Event&) ), this, SLOT( duplicateEvent(const Event&) ) );
00558         connect( dayView, SIGNAL( beamEvent(const Event&) ), this, SLOT( beamEvent(const Event&) ) );
00559         connect( dayView, SIGNAL(sigNewEvent(const QString&)), this, SLOT(slotNewEventFromKey(const QString&)) );
00560     }
00561 }
00562 
00563 void DateBook::initWeek()
00564 {
00565     if ( !weekView ) {
00566         weekView = new DateBookWeek( ampm, onMonday, db, views, "week view" );
00567         weekView->setStartViewTime( startTime );
00568         views->addWidget( weekView, WEEK );
00569         connect( weekView, SIGNAL( showDate(int,int,int) ), this, SLOT( showDay(int,int,int) ) );
00570         connect( this, SIGNAL( newEvent() ), weekView, SLOT( redraw() ) );
00571     }
00572 
00573     //But also get it right: the year that we display can be different
00574     //from the year of the current date. So, first find the year
00575     //number of the current week.
00576     int yearNumber, totWeeks;
00577     calcWeek( currentDate(), totWeeks, yearNumber, onMonday );
00578 
00579     QDate d = QDate( yearNumber, 12, 31 );
00580     calcWeek( d, totWeeks, yearNumber, onMonday );
00581 
00582     while ( totWeeks == 1 ) {
00583         d = d.addDays( -1 );
00584         calcWeek( d, totWeeks, yearNumber, onMonday );
00585     }
00586 }
00587 
00588 void DateBook::initWeekLst() {
00589     if ( !weekLstView ) {
00590         weekLstView = new DateBookWeekLst( ampm, onMonday, db, views, "weeklst view" );
00591         views->addWidget( weekLstView, WEEKLST );
00592 
00593         //weekLstView->setStartViewTime( startTime );
00594         connect( weekLstView, SIGNAL( showDate(int,int,int) ), this, SLOT( showDay(int,int,int) ) );
00595         connect( weekLstView, SIGNAL( addEvent(const QDateTime&,const QDateTime&,const QString&, const QString&) ),
00596             this, SLOT( slotNewEntry(const QDateTime&,const QDateTime&,const QString&, const QString&) ) );
00597         connect( this, SIGNAL( newEvent() ), weekLstView, SLOT( redraw() ) );
00598         connect( weekLstView, SIGNAL( editEvent(const Event&) ), this, SLOT( editEvent(const Event&) ) );
00599         connect( weekLstView, SIGNAL( duplicateEvent( const Event & ) ), this, SLOT( duplicateEvent( const Event & ) ) );
00600         connect( weekLstView, SIGNAL( beamEvent(const Event&) ), this, SLOT( beamEvent(const Event&) ) );
00601         connect( weekLstView, SIGNAL( removeEvent( const Event & ) ), this, SLOT( removeEvent( const Event & ) ) );
00602     }
00603 }
00604 
00605 
00606 void DateBook::initMonth()
00607 {
00608     if ( !monthView ) {
00609         monthView = new ODateBookMonth( views, "month view", FALSE, db );
00610         views->addWidget( monthView, MONTH );
00611         connect( monthView, SIGNAL( dateClicked(int,int,int) ), this, SLOT( showDay(int,int,int) ) );
00612         connect( this, SIGNAL( newEvent() ), monthView, SLOT( redraw() ) );
00613         qApp->processEvents();
00614     }
00615 }
00616 
00617 void DateBook::loadSettings()
00618 {
00619     Config qpeconfig( "qpe" );
00620     qpeconfig.setGroup("Time");
00621     ampm = qpeconfig.readBoolEntry( "AMPM", TRUE );
00622     onMonday = qpeconfig.readBoolEntry( "MONDAY" );
00623 
00624     Config config("DateBook");
00625     config.setGroup("Main");
00626     startTime = config.readNumEntry("startviewtime", 8);
00627     aPreset = config.readBoolEntry("alarmpreset");
00628     presetTime = config.readNumEntry("presettime");
00629     bJumpToCurTime = config.readBoolEntry("jumptocurtime");
00630     rowStyle = config.readNumEntry("rowstyle");
00631     defaultView = config.readNumEntry("defaultview",DAY);
00632     weeklistviewconfig = config.readNumEntry("weeklistviewconfig",NORMAL);
00633 
00634     defaultLocation=config.readEntry("defaultLocation");
00635     QString tmpString=config.readEntry("defaultCategories");
00636     QStringList tmpStringList=QStringList::split(",",tmpString);
00637     defaultCategories.truncate(0);
00638 
00639     for( QStringList::Iterator i=tmpStringList.begin(); i!=tmpStringList.end(); i++) {
00640         defaultCategories.resize(defaultCategories.count()+1);
00641         defaultCategories[defaultCategories.count()-1]=(*i).toInt();
00642     }
00643 }
00644 
00645 void DateBook::saveSettings()
00646 {
00647     Config config( "qpe" );
00648     Config configDB( "DateBook" );
00649     configDB.setGroup( "Main" );
00650     configDB.writeEntry("startviewtime",startTime);
00651     configDB.writeEntry("alarmpreset",aPreset);
00652     configDB.writeEntry("presettime",presetTime);
00653     configDB.writeEntry("jumptocurtime", bJumpToCurTime);
00654     configDB.writeEntry("rowstyle", rowStyle);
00655     configDB.writeEntry("defaultview",defaultView);
00656     configDB.writeEntry("weeklistviewconfig",weeklistviewconfig);
00657 
00658     configDB.writeEntry("defaultLocation",defaultLocation);
00659     QStringList tmpStringList;
00660     for( uint i=0; i<defaultCategories.count(); i++) {
00661         tmpStringList << QString::number(defaultCategories[i]);
00662     }
00663     configDB.writeEntry("defaultCategories",tmpStringList.join(","));
00664 }
00665 
00666 void DateBook::appMessage(const QCString& msg, const QByteArray& data)
00667 {
00668     bool needShow = FALSE;
00669     if ( msg == "alarm(QDateTime,int)" ) {
00670         QDataStream ds(data,IO_ReadOnly);
00671         QDateTime when; int warn;
00672         ds >> when >> warn;
00673 
00674         // check to make it's okay to continue,
00675         // this is the case that the time was set ahead, and
00676         // we are forced given a stale alarm...
00677         QDateTime current = QDateTime::currentDateTime();
00678         if ( current.time().hour() != when.time().hour() && current.time().minute() != when.time().minute() )
00679             return;
00680 
00681         QValueList<EffectiveEvent> list = db->getEffectiveEvents(when.addSecs(warn*60));
00682         if ( list.count() > 0 ) {
00683             QString msg;
00684             bool bSound = FALSE;
00685             int stopTimer = 0;
00686             bool found = FALSE;
00687             for ( QValueList<EffectiveEvent>::ConstIterator it=list.begin(); it!=list.end(); ++it ) {
00688                 if ( (*it).event().hasAlarm() ) {
00689                     found = TRUE;
00690                     msg += "<CENTER><B>" + (*it).description() + "</B>"
00691                     + "<BR>" + (*it).location() + "<BR>"
00692                     + TimeString::dateString((*it).event().start(),ampm)
00693                     + (warn
00694                         ? tr(" (in " + QString::number(warn)
00695                         + tr(" minutes)"))
00696                         : QString(""))
00697                     + "<BR>"
00698                     + (*it).notes() + "</CENTER>";
00699                     if ( (*it).event().alarmSound() != Event::Silent ) {
00700                         bSound = TRUE;
00701                     }
00702                 }
00703             }
00704             if ( found ) {
00705                 if ( bSound ) {
00706                     Sound::soundAlarm();
00707                     alarmCounter = 0;
00708                     stopTimer = startTimer( 5000 );
00709                 }
00710                 QDialog dlg( this, 0, TRUE );
00711                 QVBoxLayout *vb = new QVBoxLayout( &dlg );
00712                 QScrollView *view = new QScrollView( &dlg, "scrollView");
00713                 view->setResizePolicy( QScrollView::AutoOneFit );
00714                 vb->addWidget( view );
00715                 QLabel *lblMsg = new QLabel( msg, &dlg );
00716                 view->addChild( lblMsg );
00717                 QPushButton *cmdOk = new QPushButton( tr("OK"), &dlg );
00718                 connect( cmdOk, SIGNAL(clicked()), &dlg, SLOT(accept()) );
00719                 vb->addWidget( cmdOk );
00720 
00721                 needShow = QPEApplication::execDialog( &dlg );
00722 
00723                 if ( bSound )
00724                     killTimer( stopTimer );
00725                 }
00726             }
00727         } else if ( msg == "nextView()" ) {
00728                     needShow = true;
00729             if ( !qApp-> activeWindow ( )) {
00730                 needShow = TRUE;
00731             } else {
00732                 QWidget* cur = views->visibleWidget();
00733                 if ( cur ) {
00734                 if ( cur == dayView )
00735                     viewWeek();
00736                 else if ( cur == weekView )
00737                     viewWeekLst();
00738                 else if ( cur == weekLstView )
00739                     viewMonth();
00740                 else if ( cur == monthView )
00741                     viewDay();
00742                 needShow = TRUE;
00743             }
00744         }
00745     }   else if (msg == "editEvent(int)") {
00746         /* simple copy from receive */
00747         QDataStream stream(data,IO_ReadOnly);
00748     int uid;
00749     stream >> uid;
00750     Event e=db->eventByUID(uid);
00751     editEvent(e);
00752     } else if (msg == "viewDefault(QDate)"){
00753         /* simple copy from receive */
00754         QDataStream stream(data,IO_ReadOnly);
00755         QDate day;
00756         stream >> day;
00757         viewDefault(day);
00758         needShow = true;
00759      }
00760 
00761     if ( needShow ) {
00762 #if defined(Q_WS_QWS) || defined(_WS_QWS_)
00763 //      showMaximized();
00764 #else
00765 //      show();
00766 #endif
00767 //      raise();
00768         QPEApplication::setKeepRunning();
00769 //      setActiveWindow();
00770     }
00771 }
00772 
00773 void DateBook::reload()
00774 {
00775     db->reload();
00776     if ( dayAction->isOn() ) viewDay();
00777     else if ( weekAction->isOn() ) viewWeek();
00778     else if ( monthAction->isOn() ) viewMonth();
00779     syncing = FALSE;
00780 }
00781 
00782 void DateBook::flush()
00783 {
00784     syncing = TRUE;
00785     db->save();
00786 }
00787 
00788 void DateBook::timerEvent( QTimerEvent *e )
00789 {
00790     if ( alarmCounter < 10 ) {
00791         alarmCounter++;
00792         Sound::soundAlarm();
00793     } else {
00794         killTimer( e->timerId() );
00795     }
00796 }
00797 
00798 void DateBook::changeClock( bool newClock )
00799 {
00800     ampm = newClock;
00801     // repaint the affected objects...
00802     if (dayView) dayView->redraw();
00803     if (weekView) weekView->redraw();
00804     if (weekLstView) weekLstView->redraw();
00805 }
00806 
00807 void DateBook::changeWeek( bool m )
00808 {
00809     /* no need to redraw, each widget catches.  Do need to
00810     store though for widgets we haven't made yet */
00811     onMonday = m;
00812 }
00813 
00814 void DateBook::slotToday()
00815 {
00816     // we need to view today using default view
00817     view(defaultView,QDate::currentDate());
00818 }
00819 
00820 void DateBook::closeEvent( QCloseEvent *e )
00821 {
00822     if(syncing) {
00823         /* no need to save, did that at flush */
00824         e->accept();
00825         return;
00826     }
00827 
00828     // save settings will generate it's own error messages, no
00829     // need to do checking ourselves.
00830     saveSettings();
00831     if ( db->save() ) {
00832         e->accept();
00833     } else {
00834         if ( QMessageBox::critical( this, tr( "Out of space" ),
00835                         tr("Calendar was unable to save\n"
00836                         "your changes.\n"
00837                         "Free up some space and try again.\n"
00838                         "\nQuit anyway?"),
00839                         QMessageBox::Yes|QMessageBox::Escape,
00840                         QMessageBox::No|QMessageBox::Default )
00841             != QMessageBox::No )
00842             e->accept();
00843         else
00844             e->ignore();
00845     }
00846 }
00847 
00848 // Entering directly from the "keyboard"
00849 void DateBook::slotNewEventFromKey( const QString &str )
00850 {
00851     if (syncing) {
00852     QMessageBox::warning( this, tr("Calendar"),
00853                           tr( "Can not edit data, currently syncing") );
00854     return;
00855     }
00856 
00857     // We get to here from a key pressed in the Day View
00858     // So we can assume some things.  We want the string
00859     // passed in to be part of the description.
00860     QDateTime start, end;
00861     if ( views->visibleWidget() == dayView ) {
00862     dayView->selectedDates( start, end );
00863     } else if ( views->visibleWidget() == monthView ) {
00864     QDate d = monthView->selectedDate();
00865     start = end = d;
00866     start.setTime( QTime( 10, 0 ) );
00867     end.setTime( QTime( 12, 0 ) );
00868     } else if ( views->visibleWidget() == weekView ) {
00869     QDate d = weekView->date();
00870     start = end = d;
00871     start.setTime( QTime( 10, 0 ) );
00872     end.setTime( QTime( 12, 0 ) );
00873     } else if ( views->visibleWidget() == weekLstView ) {
00874     QDate d = weekLstView->date();
00875     start = end = d;
00876     start.setTime( QTime( 10, 0 ) );
00877     end.setTime( QTime( 12, 0 ) );
00878     }
00879     slotNewEntry(start, end, str);
00880 }
00881 void DateBook::slotNewEntry(const QDateTime &start, const QDateTime &end, const QString &str, const QString &location) {
00882     // argh!  This really needs to be encapsulated in a class
00883     // or function.
00884     QDialog newDlg( this, 0, TRUE );
00885     newDlg.setCaption( DateEntryBase::tr("New Event") );
00886     DateEntry *e;
00887     QVBoxLayout *vb = new QVBoxLayout( &newDlg );
00888     QScrollView *sv = new QScrollView( &newDlg );
00889     sv->setResizePolicy( QScrollView::AutoOneFit );
00890     sv->setFrameStyle( QFrame::NoFrame );
00891     sv->setHScrollBarMode( QScrollView::AlwaysOff );
00892     vb->addWidget( sv );
00893 
00894     Event ev;
00895     ev.setDescription(  str );
00896     // When the new gui comes in, change this...
00897     if(location==0) {
00898         if(defaultLocation.isEmpty()) {
00899             ev.setLocation(tr("(Unknown)"));
00900         } else {
00901             ev.setLocation( defaultLocation );
00902         }
00903     } else {
00904         ev.setLocation(location);
00905     }
00906     ev.setCategories(defaultCategories);
00907     ev.setStart( start );
00908     ev.setEnd( end );
00909 
00910     e = new DateEntry( onMonday, ev, ampm, &newDlg );
00911     e->setAlarmEnabled( aPreset, presetTime, Event::Loud );
00912     sv->addChild( e );
00913     while ( QPEApplication::execDialog( &newDlg ) ) {
00914         ev = e->event();
00915         ev.assignUid();
00916         QString error = checkEvent( ev );
00917         if ( !error.isNull() ) {
00918         if ( QMessageBox::warning( this, tr("Error!"), error, tr("Fix it"), tr("Continue"), 0, 0, 1 ) == 0 )
00919             continue;
00920         }
00921         db->addEvent( ev );
00922         emit newEvent();
00923         break;
00924     }
00925 }
00926 
00927 void DateBook::setDocument( const QString &filename )
00928 {
00929     if ( filename.find(".vcs") != int(filename.length()) - 4 ) return;
00930 
00931     QValueList<Event> tl = Event::readVCalendar( filename );
00932     for( QValueList<Event>::Iterator it = tl.begin(); it != tl.end(); ++it ) {
00933     db->addEvent( *it );
00934     }
00935 }
00936 
00937 static const char * beamfile = "/tmp/obex/event.vcs";
00938 
00939 void DateBook::beamEvent( const Event &e )
00940 {
00941     odebug << "trying to beam" << oendl;
00942     unlink( beamfile ); // delete if exists
00943     mkdir("/tmp/obex/", 0755);
00944     Event::writeVCalendar( beamfile, e );
00945     Ir *ir = new Ir( this );
00946     connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) );
00947     QString description = e.description();
00948     ir->send( beamfile, description, "text/x-vCalendar" );
00949 }
00950 
00951 void DateBook::beamDone( Ir *ir )
00952 {
00953     delete ir;
00954     unlink( beamfile );
00955 }
00956 
00957 void DateBook::slotFind()
00958 {
00959     // move it to the day view...
00960     viewDay();
00961     FindDialog frmFind( "Calendar", this ); // no tr needed
00962     frmFind.setUseDate( true );
00963     frmFind.setDate( currentDate() );
00964     QObject::connect( &frmFind,
00965                       SIGNAL(signalFindClicked(const QString&,const QDate&,bool,bool,int)),
00966               this,
00967               SLOT(slotDoFind(const QString&,const QDate&,bool,bool,int)) );
00968     QObject::connect( this,
00969               SIGNAL(signalNotFound()),
00970               &frmFind,
00971               SLOT(slotNotFound()) );
00972     QObject::connect( this,
00973               SIGNAL(signalWrapAround()),
00974               &frmFind,
00975               SLOT(slotWrapAround()) );
00976     frmFind.move(0,0);
00977     frmFind.exec();
00978     inSearch = false;
00979 }
00980 
00981 bool catComp( QArray<int> cats, int category )
00982 {
00983     bool returnMe;
00984     int i,
00985     count;
00986 
00987     count = int(cats.count());
00988     returnMe = false;
00989     if ( (category == -1 && count == 0) || category == -2 )
00990     returnMe = true;
00991     else {
00992     for ( i = 0; i < count; i++ ) {
00993         if ( category == cats[i] ) {
00994         returnMe = true;
00995         break;
00996         }
00997     }
00998     }
00999     return returnMe;
01000 }
01001 
01002 
01003 void DateBook::slotDoFind( const QString& txt, const QDate &dt,
01004                bool caseSensitive, bool /*backwards*/,
01005                int category )
01006 {
01007     QDateTime dtEnd( QDate(3001, 1, 1), QTime(0, 0, 0) ),
01008     next;
01009 
01010     QRegExp r( txt );
01011     r.setCaseSensitive( caseSensitive );
01012 
01013 
01014     static Event rev, nonrev;
01015     if ( !inSearch ) {
01016     rev.setStart( QDateTime(QDate(1960, 1, 1), QTime(0, 0, 0)) );
01017     nonrev.setStart( rev.start() );
01018     inSearch = true;
01019     }
01020     static QDate searchDate = dt;
01021     // if true at the end we will start at the begin again and afterwards
01022     // we will emit string not found
01023     static bool wrapAround = true;
01024     bool candidtate;
01025     candidtate = false;
01026 
01027     QValueList<Event> repeats = db->getRawRepeats();
01028 
01029     // find the candidate for the first repeat that matches...
01030     // first check if there can ever be a match and then compute
01031     // the next occurence from start. See if this event is  closer
01032     // to the beginning (start. next < dtEnd) and not smaller then the last
01033     // result. If we find a canditate we set the dtEnd to the time
01034     // of the ocurrence and rev to this occurence.
01035     // set wrap around to true because there might be more events coming
01036     // and we're not at the end.
01037     QValueListConstIterator<Event> it;
01038     QDate start = dt;
01039     for ( it = repeats.begin(); it != repeats.end(); ++it ) {
01040     if ( catComp( (*it).categories(), category ) ) {
01041             if ( (*it).match( r ) ) {
01042                 if ( nextOccurance( *it, start, next ) ) {
01043                     if ( next < dtEnd && !(next <= rev.start() ) ) {
01044                         rev = *it;
01045                         dtEnd = next;
01046                         rev.setStart( next );
01047                         candidtate = true;
01048                         wrapAround = true;
01049                     }
01050                 }
01051             }
01052         }
01053     }
01054 
01055     // now the for first non repeat...
01056     // dtEnd is set by the previous iteration of repeatingEvents
01057     // check if we find a closer item. Also set dtEnd to find even
01058     // more close occurrence
01059     QValueList<Event> nonRepeats = db->getNonRepeatingEvents( dt, dtEnd.date() );
01060     qHeapSort( nonRepeats.begin(), nonRepeats.end() );
01061     for ( it = nonRepeats.begin(); it != nonRepeats.end(); ++it ) {
01062     if ( catComp( (*it).categories(), category ) ) {
01063         if ( (*it).start() < dtEnd ) {
01064         if ( (*it).match( r ) && !(*it <= nonrev) ) {
01065             nonrev = *it;
01066             dtEnd = nonrev.start();
01067             candidtate = true;
01068             wrapAround = true;
01069             break;
01070         }
01071         }
01072     }
01073     }
01074     if ( candidtate ) {
01075     dayView->setStartViewTime( dtEnd.time().hour() );
01076     dayView->setDate( dtEnd.date().year(), dtEnd.date().month(),
01077               dtEnd.date().day() );
01078     } else {
01079     if ( wrapAround ) {
01080         emit signalWrapAround();
01081         rev.setStart( QDateTime(QDate(1960, 1, 1), QTime(0, 0, 0)) );
01082         nonrev.setStart( rev.start() );
01083     } else
01084         emit signalNotFound();
01085     wrapAround = !wrapAround;
01086     }
01087 }
01088 
01089 Event DateBookDBHack::eventByUID(int uid) {
01090 
01091     // FIXME: Dirty Hacks to get hold of the private event lists
01092     QDate start;
01093     QDate end=start.addDays(-1);
01094     QValueList<Event> myEventList=getNonRepeatingEvents(start,end);
01095     QValueList<Event> myRepeatEvents=getRawRepeats();
01096 
01097     QValueList<Event>::ConstIterator it;
01098 
01099     for (it = myEventList.begin(); it != myEventList.end(); it++) {
01100     if ((*it).uid() == uid) return *it;
01101     }
01102     for (it = myRepeatEvents.begin(); it != myRepeatEvents.end(); it++) {
01103     if ((*it).uid() == uid) return *it;
01104     }
01105 
01106     Event ev;
01107     return ev; // return at least
01108 }
01109 
01110 DateBookHoliday::DateBookHoliday()
01111 {
01112     _pluginlist.clear();
01113     m_pluginLoader = new Opie::Core::OPluginLoader("holidays",false);
01114     m_pluginLoader->setAutoDelete(true);
01115     m_pluginManager = new Opie::Core::OPluginManager(m_pluginLoader);
01116     m_pluginManager->load();
01117 
01118     init();
01119 }
01120 
01121 void DateBookHoliday::reloadPlugins()
01122 {
01123     deinit();
01124     init();
01125 }
01126 
01127 DateBookHoliday::~DateBookHoliday()
01128 {
01129     deinit();
01130     delete m_pluginLoader;
01131     delete m_pluginManager;
01132 }
01133 
01134 void DateBookHoliday::deinit()
01135 {
01136     QValueList<HPlugin*>::Iterator it;
01137     for (it=_pluginlist.begin();it!=_pluginlist.end();++it) {
01138         HPlugin*_pl = *it;
01139         *it = 0;
01140         delete _pl;
01141     }
01142     _pluginlist.clear();
01143 }
01144 
01145 #if 0
01146 void debugLst( const Opie::Core::OPluginItem::List& lst ) {
01147     for ( Opie::Core::OPluginItem::List::ConstIterator it = lst.begin(); it != lst.end(); ++it )
01148         odebug << "Name " << (*it).name() << " " << (*it).path() << " " << (*it).position() << oendl;
01149 }
01150 #endif
01151 
01152 void DateBookHoliday::init()
01153 {
01154     deinit();
01155 
01156     Opie::Core::OPluginItem::List  lst = m_pluginLoader->filtered(true);
01157 //    debugLst( lst );
01158     for( Opie::Core::OPluginItem::List::Iterator it = lst.begin(); it != lst.end(); ++it ){
01159         Opie::Datebook::HolidayPluginIf*hif = m_pluginLoader->load<Opie::Datebook::HolidayPluginIf>(*it,IID_HOLIDAY_PLUGIN);
01160         if (hif) {
01161             Opie::Datebook::HolidayPlugin*pl = hif->plugin();
01162             if (pl) {
01163                 HPlugin*_pl=new HPlugin;
01164                 _pl->_plugin = pl;
01165                 odebug << "Found holiday " << pl->description()<<oendl;
01166                 _pluginlist.append(_pl);
01167                 //_pl->_if = hif;
01168             }
01169         }
01170     }
01171 }
01172 
01173 QStringList DateBookHoliday::holidaylist(const QDate&aDate)
01174 {
01175     QStringList ret;
01176     QValueList<HPlugin*>::Iterator it;
01177     for (it=_pluginlist.begin();it!=_pluginlist.end();++it) {
01178         HPlugin*_pl = *it;
01179         ret+=_pl->_plugin->entries(aDate);
01180     }
01181     return ret;
01182 }
01183 
01184 QStringList DateBookHoliday::holidaylist(unsigned year, unsigned month, unsigned day)
01185 {
01186     return holidaylist(QDate(year,month,day));
01187 }
01188 
01189 QValueList<EffectiveEvent> DateBookHoliday::getEffectiveEvents(const QDate &from,const QDate &to )
01190 {
01191     QValueList<EffectiveEvent> ret;
01192     QValueList<HPlugin*>::Iterator it;
01193     for (it=_pluginlist.begin();it!=_pluginlist.end();++it) {
01194         HPlugin*_pl = *it;
01195         ret+=_pl->_plugin->events(from,to);
01196     }
01197     return ret;
01198 }
01199 
01200 QValueList<EffectiveEvent> DateBookDBHoliday::getEffectiveEventsNoHoliday(const QDate &from,const QDate &to )
01201 {
01202     return DateBookDBHack::getEffectiveEvents(from,to);
01203 }
01204 
01205 QValueList<EffectiveEvent> DateBookDBHoliday::getEffectiveEventsNoHoliday(const QDateTime &start)
01206 {
01207     return DateBookDBHack::getEffectiveEvents(start);
01208 }
01209 
01210 QValueList<EffectiveEvent> DateBookHoliday::getEffectiveEvents(const QDateTime &start)
01211 {
01212     return getEffectiveEvents(start.date(),start.date());
01213 }
01214 
01215 QValueList<EffectiveEvent> DateBookDBHoliday::getEffectiveEvents(const QDate &from,const QDate &to )
01216 {
01217     QValueList<EffectiveEvent> ret;
01218     odebug << "Ueberlagert 1" << oendl;
01219     if (db_holiday) {
01220         ret+=db_holiday->getEffectiveEvents(from,to);
01221     }
01222     ret+=getEffectiveEventsNoHoliday(from,to);
01223     return ret;
01224 }
01225 
01226 QValueList<EffectiveEvent> DateBookDBHoliday::getEffectiveEvents( const QDateTime &start)
01227 {
01228     odebug << "Ueberlagert 2" << oendl;
01229     return DateBookDBHack::getEffectiveEvents(start);
01230 }

Generated on Sat Nov 5 16:15:47 2005 for OPIE by  doxygen 1.4.2