summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-03-19 19:11:16 (UTC)
committer zautrix <zautrix>2005-03-19 19:11:16 (UTC)
commit414b033f0c39b5122fd4899408a7045a6c29d7c9 (patch) (unidiff)
tree802d40e62d1b55e9b3a2daca2ba74fc47af15137 /korganizer
parent0aa5a7dce6ac1224395f7cb3fae488ba566f0e38 (diff)
downloadkdepimpi-414b033f0c39b5122fd4899408a7045a6c29d7c9.zip
kdepimpi-414b033f0c39b5122fd4899408a7045a6c29d7c9.tar.gz
kdepimpi-414b033f0c39b5122fd4899408a7045a6c29d7c9.tar.bz2
dnc
Diffstat (limited to 'korganizer') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/calendarview.cpp72
-rw-r--r--korganizer/calendarview.h6
-rw-r--r--korganizer/datenavigatorcontainer.cpp218
-rw-r--r--korganizer/datenavigatorcontainer.h90
-rw-r--r--korganizer/kdatenavigator.cpp36
-rw-r--r--korganizer/kdatenavigator.h8
-rw-r--r--korganizer/kodaymatrix.cpp49
-rw-r--r--korganizer/kodaymatrix.h8
-rw-r--r--korganizer/korganizerE.pro4
-rw-r--r--korganizer/navigatorbar.cpp22
-rw-r--r--korganizer/navigatorbar.h1
11 files changed, 463 insertions, 51 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 6eaac1c..00285a5 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -109,2 +109,3 @@
109#include "incomingdialog.h" 109#include "incomingdialog.h"
110#include "datenavigatorcontainer.h"
110#include "statusdialog.h" 111#include "statusdialog.h"
@@ -269,4 +270,5 @@ void CalendarView::init()
269 270
270 mDateNavigator = new KDateNavigator(mLeftSplitter, mCalendar, TRUE, 271 mDateNavigator = new DateNavigatorContainer( mLeftSplitter,
271 "CalendarView::DateNavigator", QDate::currentDate() ); 272 "CalendarView::DateNavigator" );
273
272 mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); 274 mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize);
@@ -297,23 +299,31 @@ void CalendarView::init()
297 QWidget *mainBox = new QWidget( this ); 299 QWidget *mainBox = new QWidget( this );
298 QWidget *leftFrame = new QWidget( mainBox ); 300 //QWidget *leftFrame = new QWidget( mainBox );
299
300 QBoxLayout * mainBoxLayout; 301 QBoxLayout * mainBoxLayout;
301 QBoxLayout * leftFrameLayout;
302 if ( KOPrefs::instance()->mVerticalScreen ) { 302 if ( KOPrefs::instance()->mVerticalScreen ) {
303 mainBoxLayout = new QVBoxLayout(mainBox); 303 mainBoxLayout = new QVBoxLayout(mainBox);
304 leftFrameLayout = new QHBoxLayout(leftFrame ); 304 //leftFrameLayout = new QHBoxLayout(leftFrame );
305 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mainBox);;
306 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left );
305 } else { 307 } else {
306 mainBoxLayout = new QHBoxLayout(mainBox); 308 mainBoxLayout = new QHBoxLayout(mainBox);
307 leftFrameLayout = new QVBoxLayout(leftFrame ); 309 //leftFrameLayout = new QVBoxLayout(leftFrame );
310 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mainBox);;
311 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up );
308 } 312 }
313 //QBoxLayout * leftFrameLayout;
309 topLayout->addWidget( mainBox ); 314 topLayout->addWidget( mainBox );
310 mainBoxLayout->addWidget (leftFrame); 315 mainBoxLayout->addWidget (mLeftFrame);
311 mDateNavigator = new KDateNavigator(leftFrame, mCalendar, TRUE, 316 mDateNavigator = new DateNavigatorContainer( mLeftFrame,
317 "CalendarView::DateNavigator" );
318#if 0
319 // FIXME
320 mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE,
312 "CalendarView::DateNavigator", QDate::currentDate()); 321 "CalendarView::DateNavigator", QDate::currentDate());
322#endif
313 // mDateNavigator->blockSignals( true ); 323 // mDateNavigator->blockSignals( true );
314 leftFrameLayout->addWidget( mDateNavigator ); 324 //leftFrameLayout->addWidget( mDateNavigator );
315 mFilterView = new KOFilterView(&mFilters,leftFrame,"CalendarView::FilterView"); 325 mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall");
316 mTodoList = new KOTodoView(mCalendar, leftFrame, "todolistsmall"); 326 mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView");
317 mTodoList->setNavigator( mNavigator ); 327 mTodoList->setNavigator( mNavigator );
318 328#if 0
319 if ( QApplication::desktop()->width() < 480 ) { 329 if ( QApplication::desktop()->width() < 480 ) {
@@ -326,2 +336,3 @@ void CalendarView::init()
326 } 336 }
337#endif
327 mFilterView->hide(); 338 mFilterView->hide();
@@ -333,12 +344,15 @@ void CalendarView::init()
333 344
334 mLeftFrame = leftFrame; 345 //mLeftFrame = (QWidget *)leftFrame;
335 if ( KOPrefs::instance()->mVerticalScreen ) { 346 if ( KOPrefs::instance()->mVerticalScreen ) {
336 mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); 347 mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() );
337 leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); 348 //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() );
349 //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() );
350 //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() );
338 } else { 351 } else {
339 mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); 352 mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() );
340 leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); 353 //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() );
354 //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() );
341 } 355 }
342 if ( !KOPrefs::instance()->mShowDateNavigator) 356 if ( !KOPrefs::instance()->mShowDateNavigator)
343 mDateNavigator->hide(); 357 mLeftFrame->toggle();
344 //qDebug("Calendarview Size %d %d ", width(), height()); 358 //qDebug("Calendarview Size %d %d ", width(), height());
@@ -374,7 +388,7 @@ void CalendarView::init()
374 mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); 388 mNavigator, SLOT( selectDates( const KCal::DateList & ) ) );
375 389#if 0
376 connect( mDateNavigator, SIGNAL( eventDropped( Event * ) ), 390 connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ),
377 SLOT( eventAdded( Event *) ) ); 391 SLOT( incidenceAdded( Incidence *) ) );
378 392#endif
379 connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); 393 // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView()));
380 394
@@ -469,3 +483,3 @@ void CalendarView::init()
469#endif 483#endif
470 484 mDateNavigator->setCalendar( mCalendar );
471} 485}
@@ -3687,3 +3701,3 @@ QWidget *CalendarView::leftFrame()
3687{ 3701{
3688 return mLeftFrame; 3702 return ( QWidget *)mLeftFrame;
3689} 3703}
@@ -3697,3 +3711,3 @@ KDateNavigator* CalendarView::dateNavigatorWidget()
3697{ 3711{
3698 return mDateNavigator; 3712 return mDateNavigator->navigatorView();
3699} 3713}
@@ -3702,2 +3716,5 @@ void CalendarView::toggleDateNavigatorWidget()
3702 KOPrefs::instance()->mShowDateNavigator = !KOPrefs::instance()->mShowDateNavigator ; 3716 KOPrefs::instance()->mShowDateNavigator = !KOPrefs::instance()->mShowDateNavigator ;
3717 mLeftFrame->toggle();
3718 // FIXME mShowDateNavigator is not the toggle state of mLeftFrame
3719#if 0
3703 if (!KOPrefs::instance()->mShowDateNavigator ) 3720 if (!KOPrefs::instance()->mShowDateNavigator )
@@ -3706,2 +3723,3 @@ void CalendarView::toggleDateNavigatorWidget()
3706 mDateNavigator->show(); 3723 mDateNavigator->show();
3724#endif
3707} 3725}
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index 664d700..fac9a9e 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -41,2 +41,3 @@
41#include <libkcal/resourcecalendar.h> 41#include <libkcal/resourcecalendar.h>
42#include <KDGanttMinimizeSplitter.h>
42 43
@@ -55,2 +56,3 @@ class KOTodoView;
55class KDateNavigator; 56class KDateNavigator;
57class DateNavigatorContainer;
56class DateNavigator; 58class DateNavigator;
@@ -531,3 +533,3 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
531 QSplitter *mLeftSplitter; 533 QSplitter *mLeftSplitter;
532 QWidget *mLeftFrame; 534 KDGanttMinimizeSplitter *mLeftFrame;
533 QWidgetStack *mRightFrame; 535 QWidgetStack *mRightFrame;
@@ -537,3 +539,3 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
537 539
538 KDateNavigator *mDateNavigator; // widget showing small month view. 540 DateNavigatorContainer *mDateNavigator; // widget showing small month view.
539 541
diff --git a/korganizer/datenavigatorcontainer.cpp b/korganizer/datenavigatorcontainer.cpp
new file mode 100644
index 0000000..cbfc5b2
--- a/dev/null
+++ b/korganizer/datenavigatorcontainer.cpp
@@ -0,0 +1,218 @@
1/*
2 This file is part of KOrganizer.
3
4 Copyright (c) 2001,2002,2003 Cornelius Schumacher <schumacher@kde.org>
5 Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20
21 As a special exception, permission is given to link this program
22 with any edition of Qt, and distribute the resulting executable,
23 without including the source code for Qt in the source distribution.
24*/
25
26#include <kdebug.h>
27#include <klocale.h>
28
29//#include "koglobals.h"
30#include "navigatorbar.h"
31#include "kdatenavigator.h"
32
33#include <kcalendarsystem.h>
34
35#include "datenavigatorcontainer.h"
36
37DateNavigatorContainer::DateNavigatorContainer( QWidget *parent,
38 const char *name )
39 : QWidget( parent, name ), mCalendar( 0 ),
40 mHorizontalCount( 1 ), mVerticalCount( 1 )
41{
42 mExtraViews.setAutoDelete( true );
43
44 mNavigatorView = new KDateNavigator( this, name );
45
46 connectNavigatorView( mNavigatorView );
47}
48
49DateNavigatorContainer::~DateNavigatorContainer()
50{
51}
52
53void DateNavigatorContainer::connectNavigatorView( KDateNavigator *v )
54{
55 connect( v, SIGNAL( datesSelected( const KCal::DateList & ) ),
56 SIGNAL( datesSelected( const KCal::DateList & ) ) );
57#if 0
58 connect( v, SIGNAL( incidenceDropped( Incidence *, const QDate & ) ),
59 SIGNAL( incidenceDropped( Incidence *, const QDate & ) ) );
60 connect( v, SIGNAL( incidenceDroppedMove( Incidence *, const QDate & ) ),
61 SIGNAL( incidenceDroppedMove( Incidence *, const QDate & ) ) );
62#endif
63 connect( v, SIGNAL( weekClicked( const QDate & ) ),
64 SIGNAL( weekClicked( const QDate & ) ) );
65
66 connect( v, SIGNAL( goPrevious() ), SIGNAL( goPrevious() ) );
67 connect( v, SIGNAL( goNext() ), SIGNAL( goNext() ) );
68
69 connect( v, SIGNAL( goNextMonth() ), SIGNAL( goNextMonth() ) );
70 connect( v, SIGNAL( goPrevMonth() ), SIGNAL( goPrevMonth() ) );
71 connect( v, SIGNAL( goNextYear() ), SIGNAL( goNextYear() ) );
72 connect( v, SIGNAL( goPrevYear() ), SIGNAL( goPrevYear() ) );
73
74 connect( v, SIGNAL( monthSelected( int ) ), SIGNAL( monthSelected( int ) ) );
75}
76
77void DateNavigatorContainer::setCalendar( Calendar *cal )
78{
79 mCalendar = cal;
80 mNavigatorView->setCalendar( cal );
81 KDateNavigator *n;
82 for( n = mExtraViews.first(); n; n = mExtraViews.next() ) {
83 n->setCalendar( cal );
84 }
85}
86
87void DateNavigatorContainer::updateDayMatrix()
88{
89 mNavigatorView->updateDayMatrix();
90 KDateNavigator *n;
91 for( n = mExtraViews.first(); n; n = mExtraViews.next() ) {
92 n->updateDayMatrix();
93 }
94}
95
96void DateNavigatorContainer::updateToday()
97{
98 qDebug("DateNavigatorContainer::updateToday() NOT IMPL ");
99#if 0
100 mNavigatorView->updateToday();
101 KDateNavigator *n;
102 for( n = mExtraViews.first(); n; n = mExtraViews.next() ) {
103 n->updateToday();
104 }
105#endif
106}
107
108void DateNavigatorContainer::updateView()
109{
110 mNavigatorView->updateView();
111 KDateNavigator *n;
112 for( n = mExtraViews.first(); n; n = mExtraViews.next() ) {
113 n->updateView();
114 }
115}
116
117void DateNavigatorContainer::updateConfig()
118{
119 mNavigatorView->updateConfig();
120 KDateNavigator *n;
121 for( n = mExtraViews.first(); n; n = mExtraViews.next() ) {
122 n->updateConfig();
123 }
124}
125
126void DateNavigatorContainer::selectDates( const DateList &dateList )
127{
128 mNavigatorView->selectDates( dateList );
129 setBaseDates();
130}
131
132void DateNavigatorContainer::setBaseDates()
133{
134 KCal::DateList dateList = mNavigatorView->selectedDates();
135 if ( dateList.isEmpty() ) {
136 kdError() << "DateNavigatorContainer::selectDates() empty list." << endl;
137 }
138 QDate baseDate = dateList.first();
139 KDateNavigator *n;
140 for( n = mExtraViews.first(); n; n = mExtraViews.next() ) {
141 baseDate = baseDate.addDays( baseDate.daysInMonth () );
142 n->setBaseDate( baseDate );
143 }
144}
145
146void DateNavigatorContainer::resizeEvent( QResizeEvent * )
147{
148#if 0
149 kdDebug(5850) << "DateNavigatorContainer::resizeEvent()" << endl;
150 kdDebug(5850) << " CURRENT SIZE: " << size() << endl;
151 kdDebug(5850) << " MINIMUM SIZEHINT: " << minimumSizeHint() << endl;
152 kdDebug(5850) << " SIZEHINT: " << sizeHint() << endl;
153 kdDebug(5850) << " MINIMUM SIZE: " << minimumSize() << endl;
154#endif
155
156 QSize minSize = mNavigatorView->minimumSizeHint();
157
158// kdDebug(5850) << " NAVIGATORVIEW minimumSizeHint: " << minSize << endl;
159
160 int verticalCount = size().height() / minSize.height();
161 int horizontalCount = size().width() / minSize.width();
162 //qDebug("COUNT %d %d %d %d ", verticalCount, horizontalCount , mVerticalCount, mHorizontalCount );
163 if ( horizontalCount != mHorizontalCount ||
164 verticalCount != mVerticalCount ) {
165 uint count = horizontalCount * verticalCount;
166 if ( count == 0 ) return;
167
168 while ( count > ( mExtraViews.count() + 1 ) ) {
169 KDateNavigator *n = new KDateNavigator( this );
170 mExtraViews.append( n );
171 n->setCalendar( mCalendar );
172 setBaseDates();
173 connectNavigatorView( n );
174 n->show();
175 }
176
177 while ( count < ( mExtraViews.count() + 1 ) ) {
178 mExtraViews.removeLast();
179 }
180
181 mHorizontalCount = horizontalCount;
182 mVerticalCount = verticalCount;
183 }
184
185 int height = size().height() / verticalCount;
186 int width = size().width() / horizontalCount;
187
188 NavigatorBar *bar = mNavigatorView->navigatorBar();
189 if ( horizontalCount > 1 ) bar->showButtons( true, false );
190 else bar->showButtons( true, true );
191
192 mNavigatorView->setGeometry(0,
193 0, width, height );
194 for( uint i = 0; i < mExtraViews.count(); ++i ) {
195 int x = ( i + 1 ) % horizontalCount;
196 int y = ( i + 1 ) / horizontalCount;
197
198 KDateNavigator *view = mExtraViews.at( i );
199 bar = view->navigatorBar();
200 if ( y > 0 ) bar->showButtons( false, false );
201 else {
202 if ( x + 1 == horizontalCount ) bar->showButtons( false, true );
203 else bar->showButtons( false, false );
204 }
205 view->setGeometry( x * width,
206 y * height, width, height );
207 }
208}
209
210QSize DateNavigatorContainer::minimumSizeHint() const
211{
212 return mNavigatorView->minimumSizeHint();
213}
214
215QSize DateNavigatorContainer::sizeHint() const
216{
217 return mNavigatorView->sizeHint();
218}
diff --git a/korganizer/datenavigatorcontainer.h b/korganizer/datenavigatorcontainer.h
new file mode 100644
index 0000000..affa8e1
--- a/dev/null
+++ b/korganizer/datenavigatorcontainer.h
@@ -0,0 +1,90 @@
1/*
2 This file is part of KOrganizer.
3
4 Copyright (c) 2004 Cornelius Schumacher <schumacher@kde.org>
5 Copyright (C) 2004 Reinhold Kainhofer <reinhold@kainhofer.com>
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20
21 As a special exception, permission is given to link this program
22 with any edition of Qt, and distribute the resulting executable,
23 without including the source code for Qt in the source distribution.
24*/
25#ifndef DATENAVIGATORCONTAINER_H
26#define DATENAVIGATORCONTAINER_H
27
28class KDateNavigator;
29
30#include <qwidget.h>
31#include <libkcal/calendar.h>
32using namespace KCal;
33
34class DateNavigatorContainer: public QWidget
35{
36 Q_OBJECT
37 public:
38 DateNavigatorContainer( QWidget *parent = 0, const char *name = 0 );
39 ~DateNavigatorContainer();
40
41 /**
42 Associate date navigator with a calendar. It is used by KODayMatrix.
43 */
44 void setCalendar( Calendar * );
45
46 QSize minimumSizeHint() const;
47 QSize sizeHint() const;
48 KDateNavigator * navigatorView() { return mNavigatorView;}
49
50 public slots:
51 void selectDates( const KCal::DateList & );
52 void updateView();
53 void updateConfig();
54 void updateDayMatrix();
55 void updateToday();
56
57 signals:
58 void datesSelected( const KCal::DateList & );
59 void incidenceDropped( Incidence *, const QDate & );
60 void incidenceDroppedMove( Incidence *, const QDate & );
61 void weekClicked( const QDate &);
62
63 void goPrevious();
64 void goNext();
65
66 void goNextMonth();
67 void goPrevMonth();
68 void goNextYear();
69 void goPrevYear();
70
71 void monthSelected( int month );
72
73 protected:
74 void resizeEvent( QResizeEvent * );
75
76 void setBaseDates();
77 void connectNavigatorView( KDateNavigator *v );
78
79 private:
80 KDateNavigator *mNavigatorView;
81
82 KCal::Calendar *mCalendar;
83
84 QPtrList<KDateNavigator> mExtraViews;
85
86 int mHorizontalCount;
87 int mVerticalCount;
88};
89
90#endif
diff --git a/korganizer/kdatenavigator.cpp b/korganizer/kdatenavigator.cpp
index c08f44f..e76a85a 100644
--- a/korganizer/kdatenavigator.cpp
+++ b/korganizer/kdatenavigator.cpp
@@ -47,5 +47,3 @@
47 47
48KDateNavigator::KDateNavigator( QWidget *parent, Calendar *calendar, 48KDateNavigator::KDateNavigator( QWidget *parent, const char *name )
49 bool show_week_nums, const char *name,
50 QDate startDate )
51 : QFrame(parent, name), 49 : QFrame(parent, name),
@@ -53,6 +51,4 @@ KDateNavigator::KDateNavigator( QWidget *parent, Calendar *calendar,
53{ 51{
54 mCalendar = calendar;
55
56 setFrameStyle(QFrame::NoFrame); 52 setFrameStyle(QFrame::NoFrame);
57 53 QDate startDate = QDate::currentDate();
58 QGridLayout *topLayout = new QGridLayout(this,8,8); 54 QGridLayout *topLayout = new QGridLayout(this,8,8);
@@ -66,3 +62,3 @@ KDateNavigator::KDateNavigator( QWidget *parent, Calendar *calendar,
66 m_MthYr = startDate; 62 m_MthYr = startDate;
67 m_bShowWeekNums = show_week_nums; 63 m_bShowWeekNums = true;
68 64
@@ -98,3 +94,3 @@ KDateNavigator::KDateNavigator( QWidget *parent, Calendar *calendar,
98 //weeknos[i]->setFont(QFont("Arial", 10)); 94 //weeknos[i]->setFont(QFont("Arial", 10));
99 if(!show_week_nums) { 95 if(!m_bShowWeekNums) {
100 weeknos[i]->hide(); 96 weeknos[i]->hide();
@@ -106,4 +102,3 @@ KDateNavigator::KDateNavigator( QWidget *parent, Calendar *calendar,
106 102
107 daymatrix = new KODayMatrix( this, mCalendar, dayone, 103 daymatrix = new KODayMatrix( this, "KDateNavigator::DayMatrix");
108 "KDateNavigator::DayMatrix");
109 daymatrix->setFrameStyle(QFrame::Panel|QFrame::Sunken); 104 daymatrix->setFrameStyle(QFrame::Panel|QFrame::Sunken);
@@ -122,3 +117,22 @@ KDateNavigator::KDateNavigator( QWidget *parent, Calendar *calendar,
122 enableRollover(FollowMonth); 117 enableRollover(FollowMonth);
123 setFixedSize ( sizeHint() ); 118 //setFixedSize ( sizeHint() );
119}
120void KDateNavigator::setCalendar( Calendar *cal )
121{
122 daymatrix->setCalendar( cal );
123}
124
125void KDateNavigator::setBaseDate( const QDate &date )
126{
127 m_MthYr = date;
128
129 updateDates();
130 updateView();
131
132 KCal::DateList dates;
133 dates.append( date );
134 mNavigatorBar->selectDates( dates );
135
136 daymatrix->clearSelection();
137 daymatrix->repaint();
124} 138}
diff --git a/korganizer/kdatenavigator.h b/korganizer/kdatenavigator.h
index 3ae1648..0aeb77a 100644
--- a/korganizer/kdatenavigator.h
+++ b/korganizer/kdatenavigator.h
@@ -44,5 +44,3 @@ class KDateNavigator: public QFrame
44 public: 44 public:
45 KDateNavigator( QWidget *parent = 0, Calendar *calendar = 0, 45 KDateNavigator( QWidget *parent = 0,const char *name = 0 );
46 bool show_week_numbers = false, const char *name = 0,
47 QDate date = QDate::currentDate() );
48 ~KDateNavigator(); 46 ~KDateNavigator();
@@ -63,2 +61,6 @@ class KDateNavigator: public QFrame
63 void setShowWeekNums( bool enabled ); 61 void setShowWeekNums( bool enabled );
62 void setCalendar( Calendar * );
63 void setBaseDate( const QDate & );
64 KCal::DateList selectedDates() const { return mSelectedDates; }
65 NavigatorBar *navigatorBar() const { return mNavigatorBar; }
64 66
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp
index 989f758..a886f4a 100644
--- a/korganizer/kodaymatrix.cpp
+++ b/korganizer/kodaymatrix.cpp
@@ -89,6 +89,11 @@ const int KODayMatrix::NUMDAYS = 42;
89 89
90KODayMatrix::KODayMatrix( QWidget *parent, const char *name )
91 : QFrame( parent, name ), mCalendar( 0 )
92
93#if 0
90KODayMatrix::KODayMatrix(QWidget *parent, Calendar* calendar, QDate date, const char *name) : 94KODayMatrix::KODayMatrix(QWidget *parent, Calendar* calendar, QDate date, const char *name) :
91 QFrame(parent, name) 95 QFrame(parent, name)
96#endif
92{ 97{
93 mCalendar = calendar; 98
94 mPendingUpdateBeforeRepaint = false; 99 mPendingUpdateBeforeRepaint = false;
@@ -120,2 +125,10 @@ KODayMatrix::KODayMatrix(QWidget *parent, Calendar* calendar, QDate date, const
120} 125}
126void KODayMatrix::setCalendar( Calendar *cal )
127{
128 mCalendar = cal;
129
130 setAcceptDrops( mCalendar );
131
132 updateEvents();
133}
121 134
@@ -188,2 +201,6 @@ void KODayMatrix::setSelectedDaysFrom(const QDate& start, const QDate& end)
188} 201}
202void KODayMatrix::clearSelection()
203{
204 mSelEnd = mSelStart = NOSELECTION;
205}
189 206
@@ -219,4 +236,8 @@ void KODayMatrix::updateViewTimed()
219{ 236{
220
221 mUpdateTimer->stop(); 237 mUpdateTimer->stop();
238 if ( !mCalendar ) {
239 qDebug("NOT CAL ");
240 return;
241 }
242 //qDebug("KODayMatrix::updateViewTimed ");
222 for(int i = 0; i < NUMDAYS; i++) { 243 for(int i = 0; i < NUMDAYS; i++) {
@@ -296,2 +317,24 @@ void KODayMatrix::updateView(QDate actdate)
296} 317}
318void KODayMatrix::updateEvents()
319{
320 if ( !mCalendar ) return;
321
322 for( int i = 0; i < NUMDAYS; i++ ) {
323 // if events are set for the day then remember to draw it bold
324 QPtrList<Event> eventlist = mCalendar->events( days[ i ] );
325 int numEvents = eventlist.count();
326 Event *event;
327 for( event = eventlist.first(); event != 0;event=eventlist.next()) {
328 ushort recurType = event->doesRecur();
329
330 if ( ( recurType == Recurrence::rDaily &&
331 !KOPrefs::instance()->mDailyRecur ) ||
332 ( recurType == Recurrence::rWeekly &&
333 !KOPrefs::instance()->mWeeklyRecur ) ) {
334 numEvents--;
335 }
336 }
337 events[ i ] = numEvents;
338 }
339}
297 340
@@ -430,3 +473,3 @@ void KODayMatrix::dropEvent(QDropEvent *e)
430 473
431 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) ) { 474 if (!mCalendar || !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) ) {
432 e->ignore(); 475 e->ignore();
diff --git a/korganizer/kodaymatrix.h b/korganizer/kodaymatrix.h
index 2dd112a..ba4853f 100644
--- a/korganizer/kodaymatrix.h
+++ b/korganizer/kodaymatrix.h
@@ -119,3 +119,4 @@ public:
119 */ 119 */
120 KODayMatrix(QWidget *parent, Calendar* calendar, QDate date, const char *name ); 120 KODayMatrix( QWidget *parent, const char *name );
121 //KODayMatrix(QWidget *parent, Calendar* calendar, QDate date, const char *name );
121 122
@@ -133,2 +134,3 @@ public:
133 void updateView(QDate actdate); 134 void updateView(QDate actdate);
135 void updateEvents();
134 136
@@ -138,3 +140,3 @@ public:
138 const QDate& getDate(int offset); 140 const QDate& getDate(int offset);
139 141 void setCalendar( Calendar * );
140 /** returns the official name of this holy day or 0 if there is no label 142 /** returns the official name of this holy day or 0 if there is no label
@@ -154,3 +156,3 @@ public:
154 void setSelectedDaysFrom(const QDate& start, const QDate& end); 156 void setSelectedDaysFrom(const QDate& start, const QDate& end);
155 157 void clearSelection();
156 158
diff --git a/korganizer/korganizerE.pro b/korganizer/korganizerE.pro
index e6c3f8d..91b5a01 100644
--- a/korganizer/korganizerE.pro
+++ b/korganizer/korganizerE.pro
@@ -30,3 +30,3 @@ INTERFACES = kofilterview_base.ui
30 30
31HEADERS = \ 31HEADERS = datenavigatorcontainer.h \
32 wordsgerman.h \ 32 wordsgerman.h \
@@ -94,3 +94,3 @@ HEADERS = \
94 94
95SOURCES = \ 95SOURCES = datenavigatorcontainer.cpp \
96 filteredit_base.cpp \ 96 filteredit_base.cpp \
diff --git a/korganizer/navigatorbar.cpp b/korganizer/navigatorbar.cpp
index 934e153..27d4d17 100644
--- a/korganizer/navigatorbar.cpp
+++ b/korganizer/navigatorbar.cpp
@@ -186,2 +186,24 @@ NavigatorBar::~NavigatorBar()
186} 186}
187void NavigatorBar::showButtons( bool left, bool right )
188{
189 if ( left ) {
190 mPrevYear->show();
191 mPrevMonth->show();
192 } else {
193 mPrevYear->hide();
194 mPrevMonth->hide();
195 }
196
197 if ( right ) {
198 mNextYear->show();
199 mNextMonth->show();
200 } else {
201 mNextYear->hide();
202 mNextMonth->hide();
203 }
204 if ( !left && !right ) {
205 mSelectMonth->setMaximumWidth( 1024 );
206 mSelectMonth->setSizePolicy( QSizePolicy ( QSizePolicy::Expanding ,QSizePolicy::Fixed ) );
207 }
208}
187 209
diff --git a/korganizer/navigatorbar.h b/korganizer/navigatorbar.h
index 803c817..4442caa 100644
--- a/korganizer/navigatorbar.h
+++ b/korganizer/navigatorbar.h
@@ -40,2 +40,3 @@ class NavigatorBar: public QWidget
40 ~NavigatorBar(); 40 ~NavigatorBar();
41 void showButtons( bool left, bool right );
41 42