korganizer Library API Documentation

kotimespanview.cpp

00001 /*
00002     This file is part of KOrganizer.
00003 
00004     Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
00005 
00006     This program is free software; you can redistribute it and/or modify
00007     it under the terms of the GNU General Public License as published by
00008     the Free Software Foundation; either version 2 of the License, or
00009     (at your option) any later version.
00010 
00011     This program is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00014     GNU General Public License for more details.
00015 
00016     You should have received a copy of the GNU General Public License
00017     along with this program; if not, write to the Free Software
00018     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00019 
00020     As a special exception, permission is given to link this program
00021     with any edition of Qt, and distribute the resulting executable,
00022     without including the source code for Qt in the source distribution.
00023 */
00024 
00025 #include <qlayout.h>
00026 
00027 #include <kconfig.h>
00028 
00029 #include "timespanview.h"
00030 #include "koglobals.h"
00031 
00032 #include "kotimespanview.h"
00033 #include "kotimespanview.moc"
00034 
00035 KOTimeSpanView::KOTimeSpanView(Calendar *calendar, QWidget *parent, 
00036                const char *name) :
00037   KOEventView( calendar, parent, name )
00038 {
00039   QBoxLayout *topLayout = new QVBoxLayout( this );
00040   
00041   mTimeSpanView = new TimeSpanView( this );
00042   topLayout->addWidget( mTimeSpanView );
00043 
00044   connect( mTimeSpanView, SIGNAL( dateRangeChanged() ), SLOT( updateView() ) );
00045 }
00046 
00047 KOTimeSpanView::~KOTimeSpanView()
00048 {
00049 }
00050 
00051 void KOTimeSpanView::readSettings()
00052 {
00053   readSettings(KOGlobals::self()->config());
00054 }
00055 
00056 void KOTimeSpanView::readSettings(KConfig *config)
00057 {
00058 //  kdDebug(5850) << "KOTimeSpanView::readSettings()" << endl;
00059 
00060   config->setGroup("Views");
00061 
00062   QValueList<int> sizes = config->readIntListEntry("Separator TimeSpanView");
00063   if (sizes.count() == 2) {
00064     mTimeSpanView->setSplitterSizes(sizes);
00065   }
00066 }
00067 
00068 void KOTimeSpanView::writeSettings(KConfig *config)
00069 {
00070 //  kdDebug(5850) << "KOTimeSpanView::writeSettings()" << endl;
00071 
00072   config->setGroup("Views");
00073 
00074   QValueList<int> list = mTimeSpanView->splitterSizes();
00075   config->writeEntry("Separator TimeSpanView",list);
00076 }
00077 
00078 int KOTimeSpanView::maxDatesHint()
00079 {
00080   return 0;
00081 }
00082 
00083 int KOTimeSpanView::currentDateCount()
00084 {
00085   return 0;
00086 }
00087 
00088 Incidence::List KOTimeSpanView::selectedIncidences()
00089 {
00090   Incidence::List selected;
00091   
00092   return selected;
00093 }
00094 
00095 void KOTimeSpanView::updateView()
00096 {
00097   insertItems( mTimeSpanView->startDateTime().date(),
00098                mTimeSpanView->endDateTime().date() );
00099 }
00100 
00101 void KOTimeSpanView::showDates(const QDate &start, const QDate &end)
00102 {
00103   QDate s = start.addDays( -2 );
00104   QDate e = end.addDays( 2 );
00105 
00106   insertItems( s, e );
00107 }
00108 
00109 void KOTimeSpanView::insertItems(const QDate &start, const QDate &end)
00110 {
00111   mTimeSpanView->clear();
00112   mTimeSpanView->setDateRange( start, end );
00113 
00114   Event::List events = calendar()->events( start, end );
00115   Event::List::ConstIterator it;
00116   for( it = events.begin(); it != events.end(); ++it ) {
00117     mTimeSpanView->addItem( *it );
00118   }
00119   
00120   mTimeSpanView->updateView();
00121 }
00122 
00123 void KOTimeSpanView::showEvents( const Event::List & )
00124 {
00125 }
00126 
00127 void KOTimeSpanView::changeEventDisplay(Event *, int)
00128 {
00129 }
KDE Logo
This file is part of the documentation for korganizer Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat May 1 11:38:30 2004 by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2003