summaryrefslogtreecommitdiffabout
path: root/korganizer/datenavigatorcontainer.cpp
Unidiff
Diffstat (limited to 'korganizer/datenavigatorcontainer.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/datenavigatorcontainer.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/korganizer/datenavigatorcontainer.cpp b/korganizer/datenavigatorcontainer.cpp
index ea510f1..53507d3 100644
--- a/korganizer/datenavigatorcontainer.cpp
+++ b/korganizer/datenavigatorcontainer.cpp
@@ -1,132 +1,134 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 3
4 Copyright (c) 2001,2002,2003 Cornelius Schumacher <schumacher@kde.org> 4 Copyright (c) 2001,2002,2003 Cornelius Schumacher <schumacher@kde.org>
5 Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com> 5 Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
6 6
7 This program is free software; you can redistribute it and/or modify 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 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 9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version. 10 (at your option) any later version.
11 11
12 This program is distributed in the hope that it will be useful, 12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details. 15 GNU General Public License for more details.
16 16
17 You should have received a copy of the GNU General Public License 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 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. 19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 20
21 As a special exception, permission is given to link this program 21 As a special exception, permission is given to link this program
22 with any edition of Qt, and distribute the resulting executable, 22 with any edition of Qt, and distribute the resulting executable,
23 without including the source code for Qt in the source distribution. 23 without including the source code for Qt in the source distribution.
24*/ 24*/
25 25
26#include <kdebug.h> 26#include <kdebug.h>
27#include <klocale.h> 27#include <klocale.h>
28 28
29//#include "koglobals.h" 29//#include "koglobals.h"
30#include "navigatorbar.h" 30#include "navigatorbar.h"
31#include "kdatenavigator.h" 31#include "kdatenavigator.h"
32 32
33#include <kcalendarsystem.h> 33#include <kcalendarsystem.h>
34 34
35#include "datenavigatorcontainer.h" 35#include "datenavigatorcontainer.h"
36#include "koprefs.h" 36#include "koprefs.h"
37//Added by qt3to4:
38#include <QResizeEvent>
37 39
38DateNavigatorContainer::DateNavigatorContainer( QWidget *parent, 40DateNavigatorContainer::DateNavigatorContainer( QWidget *parent,
39 const char *name ) 41 const char *name )
40 : QWidget( parent, name ), mCalendar( 0 ), 42 : QWidget( parent, name ), mCalendar( 0 ),
41 mHorizontalCount( 1 ), mVerticalCount( 1 ) 43 mHorizontalCount( 1 ), mVerticalCount( 1 )
42{ 44{
43 mResizeEnabled = false; 45 mResizeEnabled = false;
44 mExtraViews.setAutoDelete( true ); 46 mExtraViews.setAutoDelete( true );
45 47
46 mNavigatorView = new KDateNavigator( this, name ); 48 mNavigatorView = new KDateNavigator( this, name );
47 mNavigatorView->hide(); 49 mNavigatorView->hide();
48 connectNavigatorView( mNavigatorView ); 50 connectNavigatorView( mNavigatorView );
49 //setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) ); 51 //setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) );
50 mLastDisplayedDN = 0; 52 mLastDisplayedDN = 0;
51 mUpdateTimer = new QTimer( this ); 53 mUpdateTimer = new QTimer( this );
52 connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( checkUpdateDayMatrixDates() )); 54 connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( checkUpdateDayMatrixDates() ));
53 mFirstSelectedDate = QDate::currentDate(); 55 mFirstSelectedDate = QDate::currentDate();
54 mSelectedDateCount = 1; 56 mSelectedDateCount = 1;
55} 57}
56 58
57DateNavigatorContainer::~DateNavigatorContainer() 59DateNavigatorContainer::~DateNavigatorContainer()
58{ 60{
59} 61}
60 62
61void DateNavigatorContainer::connectNavigatorView( KDateNavigator *v ) 63void DateNavigatorContainer::connectNavigatorView( KDateNavigator *v )
62{ 64{
63 connect( v, SIGNAL( datesSelected( const KCal::DateList & ) ), 65 connect( v, SIGNAL( datesSelected( const KCal::DateList & ) ),
64 SIGNAL( datesSelected( const KCal::DateList & ) ) ); 66 SIGNAL( datesSelected( const KCal::DateList & ) ) );
65#if 0 67#if 0
66 connect( v, SIGNAL( incidenceDropped( Incidence *, const QDate & ) ), 68 connect( v, SIGNAL( incidenceDropped( Incidence *, const QDate & ) ),
67 SIGNAL( incidenceDropped( Incidence *, const QDate & ) ) ); 69 SIGNAL( incidenceDropped( Incidence *, const QDate & ) ) );
68 connect( v, SIGNAL( incidenceDroppedMove( Incidence *, const QDate & ) ), 70 connect( v, SIGNAL( incidenceDroppedMove( Incidence *, const QDate & ) ),
69 SIGNAL( incidenceDroppedMove( Incidence *, const QDate & ) ) ); 71 SIGNAL( incidenceDroppedMove( Incidence *, const QDate & ) ) );
70#endif 72#endif
71 connect( v, SIGNAL( weekClicked( const QDate & ) ), 73 connect( v, SIGNAL( weekClicked( const QDate & ) ),
72 SIGNAL( weekClicked( const QDate & ) ) ); 74 SIGNAL( weekClicked( const QDate & ) ) );
73 connect( v, SIGNAL( showMonth( const QDate & ) ), 75 connect( v, SIGNAL( showMonth( const QDate & ) ),
74 SIGNAL( showMonth( const QDate & ) ) ); 76 SIGNAL( showMonth( const QDate & ) ) );
75 77
76 connect( v, SIGNAL( goPrevious() ), SIGNAL( goPrevious() ) ); 78 connect( v, SIGNAL( goPrevious() ), SIGNAL( goPrevious() ) );
77 connect( v, SIGNAL( goNext() ), SIGNAL( goNext() ) ); 79 connect( v, SIGNAL( goNext() ), SIGNAL( goNext() ) );
78 80
79 connect( v, SIGNAL( goNextMonth() ), SLOT( slotgoNextMonth() ) ); 81 connect( v, SIGNAL( goNextMonth() ), SLOT( slotgoNextMonth() ) );
80 connect( v, SIGNAL( goPrevMonth() ), SLOT( slotgoPrevMonth() ) ); 82 connect( v, SIGNAL( goPrevMonth() ), SLOT( slotgoPrevMonth() ) );
81 connect( v, SIGNAL( goNextYear() ), SLOT( slotgoNextYear() ) ); 83 connect( v, SIGNAL( goNextYear() ), SLOT( slotgoNextYear() ) );
82 connect( v, SIGNAL( goPrevYear() ), SLOT( slotgoPrevYear() ) ); 84 connect( v, SIGNAL( goPrevYear() ), SLOT( slotgoPrevYear() ) );
83 85
84 connect( v, SIGNAL( monthSelected( int ) ), SLOT( slotMonthSelected( int ) ) ); 86 connect( v, SIGNAL( monthSelected( int ) ), SLOT( slotMonthSelected( int ) ) );
85} 87}
86void DateNavigatorContainer::slotgoNextYear() 88void DateNavigatorContainer::slotgoNextYear()
87{ 89{
88 jumpMonth( 12 ); 90 jumpMonth( 12 );
89 emit goNextYear(); 91 emit goNextYear();
90 92
91} 93}
92void DateNavigatorContainer::slotgoPrevYear() 94void DateNavigatorContainer::slotgoPrevYear()
93{ 95{
94 jumpMonth( -12 ); 96 jumpMonth( -12 );
95 emit goPrevYear(); 97 emit goPrevYear();
96 98
97} 99}
98void DateNavigatorContainer::slotgoPrevMonth() 100void DateNavigatorContainer::slotgoPrevMonth()
99{ 101{
100 jumpMonth( -1 ); 102 jumpMonth( -1 );
101 emit goPrevMonth(); 103 emit goPrevMonth();
102 104
103} 105}
104void DateNavigatorContainer::slotgoNextMonth() 106void DateNavigatorContainer::slotgoNextMonth()
105{ 107{
106 jumpMonth( 1 ); 108 jumpMonth( 1 );
107 emit goNextMonth(); 109 emit goNextMonth();
108} 110}
109void DateNavigatorContainer::jumpMonth( int month ) 111void DateNavigatorContainer::jumpMonth( int month )
110{ 112{
111 113
112 QDate baseDate = mNavigatorView->baseDate(); 114 QDate baseDate = mNavigatorView->baseDate();
113 computeMonthSelected( baseDate.month() + month, false ); 115 computeMonthSelected( baseDate.month() + month, false );
114} 116}
115void DateNavigatorContainer::slotMonthSelected( int month ) 117void DateNavigatorContainer::slotMonthSelected( int month )
116{ 118{
117 computeMonthSelected( month, true ); 119 computeMonthSelected( month, true );
118} 120}
119void DateNavigatorContainer::computeMonthSelected( int month , bool forceEmit ) 121void DateNavigatorContainer::computeMonthSelected( int month , bool forceEmit )
120{ 122{
121 //qDebug("slotMonthSelected %d ", month); 123 //qDebug("slotMonthSelected %d ", month);
122 QDate baseDate = mNavigatorView->baseDate(); 124 QDate baseDate = mNavigatorView->baseDate();
123 if ( baseDate.month() == month ) 125 if ( baseDate.month() == month )
124 return; 126 return;
125 //qDebug("month %d %d ",baseDate.month(),month); 127 //qDebug("month %d %d ",baseDate.month(),month);
126 QDate date = QDate ( baseDate.year(), baseDate.month() , 15 ); 128 QDate date = QDate ( baseDate.year(), baseDate.month() , 15 );
127 date = date.addDays( -(baseDate.month()-month ) *30 ); 129 date = date.addDays( -(baseDate.month()-month ) *30 );
128 QDate newBase = QDate ( date.year(), date.month() ,1 ); 130 QDate newBase = QDate ( date.year(), date.month() ,1 );
129 131
130 //qDebug("NEW BASE %s", newBase.toString().latin1()); 132 //qDebug("NEW BASE %s", newBase.toString().latin1());
131 mNavigatorView->setBaseDate( newBase ); 133 mNavigatorView->setBaseDate( newBase );
132 QDate last = lastAvailableDate(); 134 QDate last = lastAvailableDate();