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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00019 00020 As a special exception, permission is given to link this program 00021 with any edition of TQt, and distribute the resulting executable, 00022 without including the source code for TQt in the source distribution. 00023 */ 00024 00025 #include <tqlayout.h> 00026 00027 #include <tdeconfig.h> 00028 #include <kstandarddirs.h> 00029 #include <tdeconfig.h> 00030 #include <libkcal/calendar.h> 00031 00032 #include "timespanwidget.h" 00033 #include "koglobals.h" 00034 00035 #include "kotimespanview.h" 00036 #include "kotimespanview.moc" 00037 00038 KOTimeSpanView::KOTimeSpanView(Calendar *calendar, TQWidget *parent, 00039 const char *name) : 00040 KOEventView( calendar, parent, name ) 00041 { 00042 TQBoxLayout *topLayout = new TQVBoxLayout( this ); 00043 00044 mTimeSpanWidget = new TimeSpanWidget( this ); 00045 topLayout->addWidget( mTimeSpanWidget ); 00046 00047 connect( mTimeSpanWidget, TQT_SIGNAL( dateRangeChanged() ), TQT_SLOT( updateView() ) ); 00048 } 00049 00050 KOTimeSpanView::~KOTimeSpanView() 00051 { 00052 } 00053 00054 void KOTimeSpanView::readSettings() 00055 { 00056 kdDebug(5850) << "KOTimeSpanView::readSettings()" << endl; 00057 00058 TDEConfig config( "korganizerrc", true, false); // Open read-only, no kdeglobals 00059 config.setGroup("Views"); 00060 00061 TQValueList<int> sizes = config.readIntListEntry("Separator TimeSpanView"); 00062 if (sizes.count() == 2) { 00063 mTimeSpanWidget->setSplitterSizes(sizes); 00064 } 00065 } 00066 00067 void KOTimeSpanView::writeSettings(TDEConfig *config) 00068 { 00069 // kdDebug(5850) << "KOTimeSpanView::writeSettings()" << endl; 00070 00071 config->setGroup("Views"); 00072 00073 TQValueList<int> list = mTimeSpanWidget->splitterSizes(); 00074 config->writeEntry("Separator TimeSpanView",list); 00075 } 00076 00077 int KOTimeSpanView::maxDatesHint() 00078 { 00079 return 0; 00080 } 00081 00082 int KOTimeSpanView::currentDateCount() 00083 { 00084 return 0; 00085 } 00086 00087 Incidence::List KOTimeSpanView::selectedIncidences() 00088 { 00089 Incidence::List selected; 00090 00091 return selected; 00092 } 00093 00094 void KOTimeSpanView::updateView() 00095 { 00096 insertItems( mTimeSpanWidget->startDateTime().date(), 00097 mTimeSpanWidget->endDateTime().date() ); 00098 } 00099 00100 void KOTimeSpanView::showDates(const TQDate &start, const TQDate &end) 00101 { 00102 TQDate s = start.addDays( -2 ); 00103 TQDate e = end.addDays( 2 ); 00104 00105 insertItems( s, e ); 00106 } 00107 00108 void KOTimeSpanView::insertItems(const TQDate &start, const TQDate &end) 00109 { 00110 mTimeSpanWidget->clear(); 00111 mTimeSpanWidget->setDateRange( start, end ); 00112 00113 Event::List events = calendar()->events( start, end ); 00114 Event::List::ConstIterator it; 00115 for( it = events.begin(); it != events.end(); ++it ) { 00116 mTimeSpanWidget->addItem( *it ); 00117 } 00118 00119 mTimeSpanWidget->updateView(); 00120 } 00121 00122 void KOTimeSpanView::showIncidences( const Incidence::List & ) 00123 { 00124 } 00125 00126 void KOTimeSpanView::changeIncidenceDisplay(Incidence *, int) 00127 { 00128 }