-rw-r--r-- | korganizer/kdatenavigator.cpp | 16 | ||||
-rw-r--r-- | korganizer/koviewmanager.cpp | 5 |
2 files changed, 20 insertions, 1 deletions
diff --git a/korganizer/kdatenavigator.cpp b/korganizer/kdatenavigator.cpp index 83a57ca..1474e4b 100644 --- a/korganizer/kdatenavigator.cpp +++ b/korganizer/kdatenavigator.cpp | |||
@@ -1,448 +1,464 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001,2002 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001,2002 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qstring.h> | 24 | #include <qstring.h> |
25 | #include <qkeycode.h> | 25 | #include <qkeycode.h> |
26 | #include <qlayout.h> | 26 | #include <qlayout.h> |
27 | #include <qtimer.h> | 27 | #include <qtimer.h> |
28 | #include <qframe.h> | 28 | #include <qframe.h> |
29 | #include <qlabel.h> | 29 | #include <qlabel.h> |
30 | #include <qapplication.h> | 30 | #include <qapplication.h> |
31 | 31 | ||
32 | #include <kdebug.h> | 32 | #include <kdebug.h> |
33 | #include <klocale.h> | 33 | #include <klocale.h> |
34 | #include <kglobal.h> | 34 | #include <kglobal.h> |
35 | 35 | ||
36 | #include "koglobals.h" | 36 | #include "koglobals.h" |
37 | #include "koprefs.h" | 37 | #include "koprefs.h" |
38 | #ifndef KORG_NOPLUGINS | 38 | #ifndef KORG_NOPLUGINS |
39 | #include "kocore.h" | 39 | #include "kocore.h" |
40 | #endif | 40 | #endif |
41 | 41 | ||
42 | #include <kcalendarsystem.h> | 42 | #include <kcalendarsystem.h> |
43 | 43 | ||
44 | #include "navigatorbar.h" | 44 | #include "navigatorbar.h" |
45 | 45 | ||
46 | #include "kdatenavigator.h" | 46 | #include "kdatenavigator.h" |
47 | 47 | ||
48 | KDateNavigator::KDateNavigator( QWidget *parent, const char *name ) | 48 | KDateNavigator::KDateNavigator( QWidget *parent, const char *name ) |
49 | : QFrame(parent, name), | 49 | : QFrame(parent, name), |
50 | updateTimer(0L) | 50 | updateTimer(0L) |
51 | { | 51 | { |
52 | setFrameStyle(QFrame::NoFrame); | 52 | setFrameStyle(QFrame::NoFrame); |
53 | QDate startDate = QDate::currentDate(); | 53 | QDate startDate = QDate::currentDate(); |
54 | QGridLayout *topLayout = new QGridLayout(this,8,8); | 54 | QGridLayout *topLayout = new QGridLayout(this,8,8); |
55 | 55 | ||
56 | if (! startDate.isValid()) { | 56 | if (! startDate.isValid()) { |
57 | qDebug("KDateNavigator::invalid startdate "); | 57 | qDebug("KDateNavigator::invalid startdate "); |
58 | startDate = QDate::currentDate(); | 58 | startDate = QDate::currentDate(); |
59 | } | 59 | } |
60 | mMonthSignalOffset = 0; | 60 | mMonthSignalOffset = 0; |
61 | mSelectedDates.append(startDate); | 61 | mSelectedDates.append(startDate); |
62 | m_MthYr = startDate; | 62 | m_MthYr = startDate; |
63 | m_bShowWeekNums = true; | 63 | m_bShowWeekNums = true; |
64 | 64 | ||
65 | setFont( KOPrefs::instance()->mDateNavigatorFont ); | 65 | setFont( KOPrefs::instance()->mDateNavigatorFont ); |
66 | mNavigatorBar = new NavigatorBar( startDate, this ); | 66 | mNavigatorBar = new NavigatorBar( startDate, this ); |
67 | topLayout->addMultiCellWidget( mNavigatorBar, 0, 0, 0, 7 ); | 67 | topLayout->addMultiCellWidget( mNavigatorBar, 0, 0, 0, 7 ); |
68 | //mNavigatorBar->resize( 1,1); | 68 | //mNavigatorBar->resize( 1,1); |
69 | connect( mNavigatorBar, SIGNAL( goPrevYear() ), SIGNAL( goPrevYear() ) ); | 69 | connect( mNavigatorBar, SIGNAL( goPrevYear() ), SIGNAL( goPrevYear() ) ); |
70 | connect( mNavigatorBar, SIGNAL( goPrevMonth() ), SIGNAL( goPrevMonth() ) ); | 70 | connect( mNavigatorBar, SIGNAL( goPrevMonth() ), SIGNAL( goPrevMonth() ) ); |
71 | connect( mNavigatorBar, SIGNAL( goNextMonth() ), SIGNAL( goNextMonth() ) ); | 71 | connect( mNavigatorBar, SIGNAL( goNextMonth() ), SIGNAL( goNextMonth() ) ); |
72 | connect( mNavigatorBar, SIGNAL( goNextYear() ), SIGNAL( goNextYear() ) ); | 72 | connect( mNavigatorBar, SIGNAL( goNextYear() ), SIGNAL( goNextYear() ) ); |
73 | connect( mNavigatorBar, SIGNAL( monthSelected( int ) ), SLOT( slotMonthSelected( int ) ) ); | 73 | connect( mNavigatorBar, SIGNAL( monthSelected( int ) ), SLOT( slotMonthSelected( int ) ) ); |
74 | 74 | ||
75 | // get the day of the week on the first day | 75 | // get the day of the week on the first day |
76 | QDate dayone(m_MthYr.year(), m_MthYr.month(), 1); | 76 | QDate dayone(m_MthYr.year(), m_MthYr.month(), 1); |
77 | m_fstDayOfWk = dayone.dayOfWeek(); | 77 | m_fstDayOfWk = dayone.dayOfWeek(); |
78 | 78 | ||
79 | int i; | 79 | int i; |
80 | 80 | ||
81 | // Set up the heading fields. | 81 | // Set up the heading fields. |
82 | for( i = 0; i < 7; i++ ) { | 82 | for( i = 0; i < 7; i++ ) { |
83 | headings[i] = new QLabel("",this); | 83 | headings[i] = new QLabel("",this); |
84 | //headings[i]->setFont(QFont("Arial", 10, QFont::Bold)); | 84 | //headings[i]->setFont(QFont("Arial", 10, QFont::Bold)); |
85 | headings[i]->setAlignment(AlignCenter); | 85 | headings[i]->setAlignment(AlignCenter); |
86 | headings[i]->installEventFilter(this); | ||
86 | 87 | ||
87 | topLayout->addWidget(headings[i],1,i+1); | 88 | topLayout->addWidget(headings[i],1,i+1); |
88 | } | 89 | } |
89 | 90 | ||
90 | // Create the weeknumber labels | 91 | // Create the weeknumber labels |
91 | for( i = 0; i < 6; i++ ) { | 92 | for( i = 0; i < 6; i++ ) { |
92 | weeknos[i] = new QLabel(this); | 93 | weeknos[i] = new QLabel(this); |
93 | weeknos[i]->setAlignment(AlignCenter); | 94 | weeknos[i]->setAlignment(AlignCenter); |
94 | //weeknos[i]->setFont(QFont("Arial", 10)); | 95 | //weeknos[i]->setFont(QFont("Arial", 10)); |
95 | if(!m_bShowWeekNums) { | 96 | if(!m_bShowWeekNums) { |
96 | weeknos[i]->hide(); | 97 | weeknos[i]->hide(); |
97 | } | 98 | } |
98 | weeknos[i]->installEventFilter(this); | 99 | weeknos[i]->installEventFilter(this); |
99 | 100 | ||
100 | topLayout->addWidget(weeknos[i],i+2,0); | 101 | topLayout->addWidget(weeknos[i],i+2,0); |
101 | } | 102 | } |
102 | 103 | ||
103 | daymatrix = new KODayMatrix( this, "KDateNavigator::DayMatrix"); | 104 | daymatrix = new KODayMatrix( this, "KDateNavigator::DayMatrix"); |
104 | daymatrix->setFrameStyle(QFrame::Panel|QFrame::Sunken); | 105 | daymatrix->setFrameStyle(QFrame::Panel|QFrame::Sunken); |
105 | daymatrix->setLineWidth(1); | 106 | daymatrix->setLineWidth(1); |
106 | 107 | ||
107 | connect( daymatrix, SIGNAL( selected( const KCal::DateList & ) ), | 108 | connect( daymatrix, SIGNAL( selected( const KCal::DateList & ) ), |
108 | SIGNAL( datesSelected( const KCal::DateList & ) ) ); | 109 | SIGNAL( datesSelected( const KCal::DateList & ) ) ); |
109 | 110 | ||
110 | connect( daymatrix, SIGNAL( eventDropped( Event * ) ), | 111 | connect( daymatrix, SIGNAL( eventDropped( Event * ) ), |
111 | SIGNAL( eventDropped( Event * ) ) ); | 112 | SIGNAL( eventDropped( Event * ) ) ); |
112 | 113 | ||
113 | topLayout->addMultiCellWidget(daymatrix,2,7,1,7); | 114 | topLayout->addMultiCellWidget(daymatrix,2,7,1,7); |
114 | 115 | ||
115 | // read settings from configuration file. | 116 | // read settings from configuration file. |
116 | updateConfig(); | 117 | updateConfig(); |
117 | enableRollover(FollowMonth); | 118 | enableRollover(FollowMonth); |
118 | mySizeHint = sizeHintTwoButtons(); | 119 | mySizeHint = sizeHintTwoButtons(); |
119 | myFullSizeHint = sizeHintTwoButtons( 4 ); | 120 | myFullSizeHint = sizeHintTwoButtons( 4 ); |
120 | mFontChanged = false; | 121 | mFontChanged = false; |
121 | } | 122 | } |
122 | void KDateNavigator::changeFont ( QFont fo ) | 123 | void KDateNavigator::changeFont ( QFont fo ) |
123 | { | 124 | { |
124 | setFont( fo ); | 125 | setFont( fo ); |
125 | mNavigatorBar->resetFont( fo ); | 126 | mNavigatorBar->resetFont( fo ); |
126 | } | 127 | } |
127 | QFont KDateNavigator::yourFontHint( QSize si , bool *b) | 128 | QFont KDateNavigator::yourFontHint( QSize si , bool *b) |
128 | { | 129 | { |
129 | QFont fo = KOPrefs::instance()->mDateNavigatorFont; | 130 | QFont fo = KOPrefs::instance()->mDateNavigatorFont; |
130 | *b = false; | 131 | *b = false; |
131 | int fontPoint = fo.pointSize(); | 132 | int fontPoint = fo.pointSize(); |
132 | while ( fontPoint > 5 ) { | 133 | while ( fontPoint > 5 ) { |
133 | --fontPoint; | 134 | --fontPoint; |
134 | fo.setPointSize( fontPoint ); | 135 | fo.setPointSize( fontPoint ); |
135 | setFont( fo ); | 136 | setFont( fo ); |
136 | mFontChanged = true; | 137 | mFontChanged = true; |
137 | mNavigatorBar->resetFont( fo ); | 138 | mNavigatorBar->resetFont( fo ); |
138 | QSize sh = sizeHintTwoButtons( 2 ); | 139 | QSize sh = sizeHintTwoButtons( 2 ); |
139 | //qDebug("fp %d %d %d %d %d", fontPoint, si.width() , sh.width() , si.height() , sh.height() ); | 140 | //qDebug("fp %d %d %d %d %d", fontPoint, si.width() , sh.width() , si.height() , sh.height() ); |
140 | if ( si.width() > sh.width() && si.height() > sh.height()) { | 141 | if ( si.width() > sh.width() && si.height() > sh.height()) { |
141 | if ( si.width() / sh.width() == 1 ) { | 142 | if ( si.width() / sh.width() == 1 ) { |
142 | if ( si.width() < sizeHintTwoButtons( 4 ).width()) | 143 | if ( si.width() < sizeHintTwoButtons( 4 ).width()) |
143 | continue; | 144 | continue; |
144 | } | 145 | } |
145 | *b = true; | 146 | *b = true; |
146 | //qDebug("fooooooooooooooooooooooouuuuund "); | 147 | //qDebug("fooooooooooooooooooooooouuuuund "); |
147 | break; | 148 | break; |
148 | } | 149 | } |
149 | } | 150 | } |
150 | //qDebug("returnnnnnnnnnnnnnnnnnnn %d", fo.pointSize() ); | 151 | //qDebug("returnnnnnnnnnnnnnnnnnnn %d", fo.pointSize() ); |
151 | return fo; | 152 | return fo; |
152 | } | 153 | } |
153 | QSize KDateNavigator::sizeHint() const | 154 | QSize KDateNavigator::sizeHint() const |
154 | { | 155 | { |
155 | QFontMetrics fm ( font() ); | 156 | QFontMetrics fm ( font() ); |
156 | QSize day = daymatrix->sizeHint(); | 157 | QSize day = daymatrix->sizeHint(); |
157 | QSize nav = mNavigatorBar->sizeHint(); | 158 | QSize nav = mNavigatorBar->sizeHint(); |
158 | int wid = fm.width( "30") + day.width()+3; | 159 | int wid = fm.width( "30") + day.width()+3; |
159 | int hei = fm.height() +day.height()+nav.height()+2; | 160 | int hei = fm.height() +day.height()+nav.height()+2; |
160 | if ( wid < nav.width() ) | 161 | if ( wid < nav.width() ) |
161 | wid = nav.width() ; | 162 | wid = nav.width() ; |
162 | //qDebug("KDateNavigator+++++++++++++ %d %d", wid , hei); | 163 | //qDebug("KDateNavigator+++++++++++++ %d %d", wid , hei); |
163 | return QSize ( wid, hei ); | 164 | return QSize ( wid, hei ); |
164 | } | 165 | } |
165 | QSize KDateNavigator::sizeHintTwoButtons( int butnum ) const | 166 | QSize KDateNavigator::sizeHintTwoButtons( int butnum ) const |
166 | { | 167 | { |
167 | QFontMetrics fm ( font() ); | 168 | QFontMetrics fm ( font() ); |
168 | QSize day = daymatrix->sizeHint(); | 169 | QSize day = daymatrix->sizeHint(); |
169 | QSize nav = mNavigatorBar->sizeHintTwoButtons( butnum ); | 170 | QSize nav = mNavigatorBar->sizeHintTwoButtons( butnum ); |
170 | int wid = fm.width( "30") + day.width()+3; | 171 | int wid = fm.width( "30") + day.width()+3; |
171 | int hei = fm.height() +day.height()+nav.height()+2; | 172 | int hei = fm.height() +day.height()+nav.height()+2; |
172 | if ( wid < nav.width() ) | 173 | if ( wid < nav.width() ) |
173 | wid = nav.width() ; | 174 | wid = nav.width() ; |
174 | //qDebug("KDateNavigator+++++++++++++ %d %d", wid , hei); | 175 | //qDebug("KDateNavigator+++++++++++++ %d %d", wid , hei); |
175 | return QSize ( wid, hei ); | 176 | return QSize ( wid, hei ); |
176 | } | 177 | } |
177 | void KDateNavigator::slotMonthSelected( int m ) | 178 | void KDateNavigator::slotMonthSelected( int m ) |
178 | { | 179 | { |
179 | if ( m_MthYr.month() <= mMonthSignalOffset) | 180 | if ( m_MthYr.month() <= mMonthSignalOffset) |
180 | m += 12; | 181 | m += 12; |
181 | //qDebug("%d mMonthSignalOffset %d emit %d", m, mMonthSignalOffset, m - mMonthSignalOffset); | 182 | //qDebug("%d mMonthSignalOffset %d emit %d", m, mMonthSignalOffset, m - mMonthSignalOffset); |
182 | emit monthSelected( m - mMonthSignalOffset ); | 183 | emit monthSelected( m - mMonthSignalOffset ); |
183 | 184 | ||
184 | } | 185 | } |
185 | void KDateNavigator::setCalendar( Calendar *cal ) | 186 | void KDateNavigator::setCalendar( Calendar *cal ) |
186 | { | 187 | { |
187 | daymatrix->setCalendar( cal ); | 188 | daymatrix->setCalendar( cal ); |
188 | } | 189 | } |
189 | 190 | ||
190 | void KDateNavigator::setBaseDate( const QDate &date , bool doRepaint ) // = true | 191 | void KDateNavigator::setBaseDate( const QDate &date , bool doRepaint ) // = true |
191 | { | 192 | { |
192 | m_MthYr = date; | 193 | m_MthYr = date; |
193 | //qDebug("KDateNavigator::setBaseDate %s ", date.toString().latin1()); | 194 | //qDebug("KDateNavigator::setBaseDate %s ", date.toString().latin1()); |
194 | 195 | ||
195 | updateDates(); | 196 | updateDates(); |
196 | updateView(); | 197 | updateView(); |
197 | 198 | ||
198 | KCal::DateList dates; | 199 | KCal::DateList dates; |
199 | dates.append( date ); | 200 | dates.append( date ); |
200 | mNavigatorBar->selectDates( dates ); | 201 | mNavigatorBar->selectDates( dates ); |
201 | 202 | ||
202 | daymatrix->clearSelection(); | 203 | daymatrix->clearSelection(); |
203 | if ( doRepaint ) | 204 | if ( doRepaint ) |
204 | daymatrix->repaint( false ); | 205 | daymatrix->repaint( false ); |
205 | } | 206 | } |
206 | 207 | ||
207 | void KDateNavigator::enableRollover(RolloverType r) | 208 | void KDateNavigator::enableRollover(RolloverType r) |
208 | { | 209 | { |
209 | switch(r) | 210 | switch(r) |
210 | { | 211 | { |
211 | case None : | 212 | case None : |
212 | if (updateTimer) | 213 | if (updateTimer) |
213 | { | 214 | { |
214 | updateTimer->stop(); | 215 | updateTimer->stop(); |
215 | delete updateTimer; | 216 | delete updateTimer; |
216 | updateTimer=0L; | 217 | updateTimer=0L; |
217 | } | 218 | } |
218 | break; | 219 | break; |
219 | case FollowDay : | 220 | case FollowDay : |
220 | case FollowMonth : | 221 | case FollowMonth : |
221 | if (!updateTimer) | 222 | if (!updateTimer) |
222 | { | 223 | { |
223 | updateTimer = new QTimer(this); | 224 | updateTimer = new QTimer(this); |
224 | QObject::connect(updateTimer,SIGNAL(timeout()), | 225 | QObject::connect(updateTimer,SIGNAL(timeout()), |
225 | this,SLOT(possiblyPastMidnight())); | 226 | this,SLOT(possiblyPastMidnight())); |
226 | } | 227 | } |
227 | updateTimer->start(0,true); | 228 | updateTimer->start(0,true); |
228 | lastDayChecked = QDate::currentDate(); | 229 | lastDayChecked = QDate::currentDate(); |
229 | } | 230 | } |
230 | updateRollover=r; | 231 | updateRollover=r; |
231 | } | 232 | } |
232 | 233 | ||
233 | 234 | ||
234 | KDateNavigator::~KDateNavigator() | 235 | KDateNavigator::~KDateNavigator() |
235 | { | 236 | { |
236 | } | 237 | } |
237 | 238 | ||
238 | 239 | ||
239 | void KDateNavigator::passedMidnight() | 240 | void KDateNavigator::passedMidnight() |
240 | { | 241 | { |
241 | QDate today = QDate::currentDate(); | 242 | QDate today = QDate::currentDate(); |
242 | bool emitMonth = false; | 243 | bool emitMonth = false; |
243 | 244 | ||
244 | if (today.month() != lastDayChecked.month()) | 245 | if (today.month() != lastDayChecked.month()) |
245 | { | 246 | { |
246 | if (updateRollover==FollowMonth && | 247 | if (updateRollover==FollowMonth && |
247 | daymatrix->isEndOfMonth()) { | 248 | daymatrix->isEndOfMonth()) { |
248 | goNextMonth(); | 249 | goNextMonth(); |
249 | emitMonth=true; | 250 | emitMonth=true; |
250 | } | 251 | } |
251 | } | 252 | } |
252 | daymatrix->recalculateToday(); | 253 | daymatrix->recalculateToday(); |
253 | daymatrix->repaint( false ); | 254 | daymatrix->repaint( false ); |
254 | emit dayPassed(today); | 255 | emit dayPassed(today); |
255 | if (emitMonth) { emit monthPassed(today); } | 256 | if (emitMonth) { emit monthPassed(today); } |
256 | } | 257 | } |
257 | 258 | ||
258 | /* slot */ void KDateNavigator::possiblyPastMidnight() | 259 | /* slot */ void KDateNavigator::possiblyPastMidnight() |
259 | { | 260 | { |
260 | if (lastDayChecked!=QDate::currentDate()) | 261 | if (lastDayChecked!=QDate::currentDate()) |
261 | { | 262 | { |
262 | passedMidnight(); | 263 | passedMidnight(); |
263 | lastDayChecked=QDate::currentDate(); | 264 | lastDayChecked=QDate::currentDate(); |
264 | } | 265 | } |
265 | // Set the timer to go off 1 second after midnight | 266 | // Set the timer to go off 1 second after midnight |
266 | // or after 8 minutes, whichever comes first. | 267 | // or after 8 minutes, whichever comes first. |
267 | if (updateTimer) | 268 | if (updateTimer) |
268 | { | 269 | { |
269 | QTime now = QTime::currentTime(); | 270 | QTime now = QTime::currentTime(); |
270 | QTime midnight = QTime(23,59,59); | 271 | QTime midnight = QTime(23,59,59); |
271 | int msecsWait = QMIN(480000,now.msecsTo(midnight)+2000); | 272 | int msecsWait = QMIN(480000,now.msecsTo(midnight)+2000); |
272 | 273 | ||
273 | // qDebug(QString("Waiting %1 msec from %2 to %3.").arg(msecsWait)) | 274 | // qDebug(QString("Waiting %1 msec from %2 to %3.").arg(msecsWait)) |
274 | //.arg(now.toString()).arg(midnight.toString())); | 275 | //.arg(now.toString()).arg(midnight.toString())); |
275 | 276 | ||
276 | updateTimer->stop(); | 277 | updateTimer->stop(); |
277 | updateTimer->start(msecsWait,true); | 278 | updateTimer->start(msecsWait,true); |
278 | } | 279 | } |
279 | } | 280 | } |
280 | 281 | ||
281 | void KDateNavigator::updateDates() | 282 | void KDateNavigator::updateDates() |
282 | { | 283 | { |
283 | // Find the first day of the week of the current month. | 284 | // Find the first day of the week of the current month. |
284 | //int d1 = KOGlobals::self()->calendarSystem()->day( m_MthYr ); | 285 | //int d1 = KOGlobals::self()->calendarSystem()->day( m_MthYr ); |
285 | QDate dayone( m_MthYr.year(), m_MthYr.month(), m_MthYr.day() ); | 286 | QDate dayone( m_MthYr.year(), m_MthYr.month(), m_MthYr.day() ); |
286 | int d2 = KOGlobals::self()->calendarSystem()->day( dayone ); | 287 | int d2 = KOGlobals::self()->calendarSystem()->day( dayone ); |
287 | //int di = d1 - d2 + 1; | 288 | //int di = d1 - d2 + 1; |
288 | dayone = dayone.addDays( -d2 + 1 ); | 289 | dayone = dayone.addDays( -d2 + 1 ); |
289 | 290 | ||
290 | int m_fstDayOfWkCalsys = KOGlobals::self()->calendarSystem()->dayOfWeek( dayone ); | 291 | int m_fstDayOfWkCalsys = KOGlobals::self()->calendarSystem()->dayOfWeek( dayone ); |
291 | 292 | ||
292 | // If month begins on Monday and Monday is first day of week, | 293 | // If month begins on Monday and Monday is first day of week, |
293 | // month should begin on second line. Sunday doesn't have this problem. | 294 | // month should begin on second line. Sunday doesn't have this problem. |
294 | int nextLine = ( ( m_fstDayOfWkCalsys == 1) && | 295 | int nextLine = ( ( m_fstDayOfWkCalsys == 1) && |
295 | ( KGlobal::locale()->weekStartsMonday() == 1 ) ) ? 7 : 0; | 296 | ( KGlobal::locale()->weekStartsMonday() == 1 ) ) ? 7 : 0; |
296 | 297 | ||
297 | // update the matrix dates | 298 | // update the matrix dates |
298 | int index = (KGlobal::locale()->weekStartsMonday() ? 1 : 0) - m_fstDayOfWkCalsys - nextLine; | 299 | int index = (KGlobal::locale()->weekStartsMonday() ? 1 : 0) - m_fstDayOfWkCalsys - nextLine; |
299 | 300 | ||
300 | 301 | ||
301 | daymatrix->updateView(dayone.addDays(index)); | 302 | daymatrix->updateView(dayone.addDays(index)); |
302 | //each updateDates is followed by an updateView -> repaint is issued there ! | 303 | //each updateDates is followed by an updateView -> repaint is issued there ! |
303 | // daymatrix->repaint(); | 304 | // daymatrix->repaint(); |
304 | } | 305 | } |
305 | 306 | ||
306 | void KDateNavigator::updateDayMatrix() | 307 | void KDateNavigator::updateDayMatrix() |
307 | { | 308 | { |
308 | daymatrix->updateView(); | 309 | daymatrix->updateView(); |
309 | //daymatrix->repaint(); | 310 | //daymatrix->repaint(); |
310 | } | 311 | } |
311 | 312 | ||
312 | 313 | ||
313 | void KDateNavigator::updateView() | 314 | void KDateNavigator::updateView() |
314 | { | 315 | { |
315 | 316 | ||
316 | setUpdatesEnabled( false ); | 317 | setUpdatesEnabled( false ); |
317 | 318 | ||
318 | int i; | 319 | int i; |
319 | 320 | ||
320 | // kdDebug() << "updateView() -> daymatrix->updateView()" << endl; | 321 | // kdDebug() << "updateView() -> daymatrix->updateView()" << endl; |
321 | daymatrix->updateView(); | 322 | daymatrix->updateView(); |
322 | 323 | ||
323 | // set the week numbers. | 324 | // set the week numbers. |
324 | for(i = 0; i < 6; i++) { | 325 | for(i = 0; i < 6; i++) { |
325 | QString weeknum; | 326 | QString weeknum; |
326 | // remember, according to ISO 8601, the first week of the year is the | 327 | // remember, according to ISO 8601, the first week of the year is the |
327 | // first week that contains a thursday. Thus we must subtract off 4, | 328 | // first week that contains a thursday. Thus we must subtract off 4, |
328 | // not just 1. | 329 | // not just 1. |
329 | 330 | ||
330 | //ET int dayOfYear = buttons[(i + 1) * 7 - 4]->date().dayOfYear(); | 331 | //ET int dayOfYear = buttons[(i + 1) * 7 - 4]->date().dayOfYear(); |
331 | int dayOfYear = KOGlobals::self()->calendarSystem()->dayOfYear((daymatrix->getDate((i+1)*7-4))); | 332 | int dayOfYear = KOGlobals::self()->calendarSystem()->dayOfYear((daymatrix->getDate((i+1)*7-4))); |
332 | 333 | ||
333 | int add = 0; | 334 | int add = 0; |
334 | if ( ! KGlobal::locale()->weekStartsMonday() ) | 335 | if ( ! KGlobal::locale()->weekStartsMonday() ) |
335 | ++add; | 336 | ++add; |
336 | if (dayOfYear % 7 != 0) | 337 | if (dayOfYear % 7 != 0) |
337 | weeknum.setNum(dayOfYear / 7 + 1+add); | 338 | weeknum.setNum(dayOfYear / 7 + 1+add); |
338 | else | 339 | else |
339 | weeknum.setNum(dayOfYear / 7 +add); | 340 | weeknum.setNum(dayOfYear / 7 +add); |
340 | weeknos[i]->setText(weeknum); | 341 | weeknos[i]->setText(weeknum); |
341 | } | 342 | } |
342 | 343 | ||
343 | setUpdatesEnabled( true ); | 344 | setUpdatesEnabled( true ); |
344 | // kdDebug() << "updateView() -> repaint()" << endl; | 345 | // kdDebug() << "updateView() -> repaint()" << endl; |
345 | repaint(); | 346 | repaint(); |
346 | // daymatrix->repaint(); | 347 | // daymatrix->repaint(); |
347 | } | 348 | } |
348 | 349 | ||
349 | void KDateNavigator::updateConfig() | 350 | void KDateNavigator::updateConfig() |
350 | { | 351 | { |
351 | int day; | 352 | int day; |
352 | for(int i=0; i<7; i++) { | 353 | for(int i=0; i<7; i++) { |
353 | // take the first letter of the day name to be the abbreviation | 354 | // take the first letter of the day name to be the abbreviation |
354 | if (KGlobal::locale()->weekStartsMonday()) { | 355 | if (KGlobal::locale()->weekStartsMonday()) { |
355 | day = i+1; | 356 | day = i+1; |
356 | } else { | 357 | } else { |
357 | if (i==0) day = 7; | 358 | if (i==0) day = 7; |
358 | else day = i; | 359 | else day = i; |
359 | } | 360 | } |
360 | QString dayName = KOGlobals::self()->calendarSystem()->weekDayName( day, | 361 | QString dayName = KOGlobals::self()->calendarSystem()->weekDayName( day, |
361 | true ); | 362 | true ); |
362 | if ( KOPrefs::instance()->mCompactDialogs ) dayName = dayName.left( 1 ); | 363 | if ( KOPrefs::instance()->mCompactDialogs ) dayName = dayName.left( 1 ); |
363 | headings[i]->setText( dayName ); | 364 | headings[i]->setText( dayName ); |
364 | } | 365 | } |
365 | updateDates(); | 366 | updateDates(); |
366 | updateView(); | 367 | updateView(); |
367 | } | 368 | } |
368 | 369 | ||
369 | void KDateNavigator::setShowWeekNums(bool enabled) | 370 | void KDateNavigator::setShowWeekNums(bool enabled) |
370 | { | 371 | { |
371 | m_bShowWeekNums = enabled; | 372 | m_bShowWeekNums = enabled; |
372 | for(int i=0; i<6; i++) { | 373 | for(int i=0; i<6; i++) { |
373 | if(enabled) | 374 | if(enabled) |
374 | weeknos[i]->show(); | 375 | weeknos[i]->show(); |
375 | else | 376 | else |
376 | weeknos[i]->hide(); | 377 | weeknos[i]->hide(); |
377 | } | 378 | } |
378 | resize(size()); | 379 | resize(size()); |
379 | } | 380 | } |
380 | 381 | ||
381 | void KDateNavigator::selectDates(const DateList& dateList) | 382 | void KDateNavigator::selectDates(const DateList& dateList) |
382 | { | 383 | { |
383 | 384 | ||
384 | if (dateList.count() > 0) { | 385 | if (dateList.count() > 0) { |
385 | mNavigatorBar->selectDates( dateList ); | 386 | mNavigatorBar->selectDates( dateList ); |
386 | mSelectedDates = dateList; | 387 | mSelectedDates = dateList; |
387 | 388 | ||
388 | // set our record of the month and year that this datetbl is | 389 | // set our record of the month and year that this datetbl is |
389 | // displaying. | 390 | // displaying. |
390 | m_MthYr = mSelectedDates.first(); | 391 | m_MthYr = mSelectedDates.first(); |
391 | 392 | ||
392 | 393 | ||
393 | // set our record of the first day of the week of the current | 394 | // set our record of the first day of the week of the current |
394 | // month. This needs to be done before calling dayToIndex, since it | 395 | // month. This needs to be done before calling dayToIndex, since it |
395 | // relies on this information being up to date. | 396 | // relies on this information being up to date. |
396 | QDate dayone(m_MthYr.year(), m_MthYr.month(), 1); | 397 | QDate dayone(m_MthYr.year(), m_MthYr.month(), 1); |
397 | m_fstDayOfWk = dayone.dayOfWeek(); | 398 | m_fstDayOfWk = dayone.dayOfWeek(); |
398 | 399 | ||
399 | updateDates(); | 400 | updateDates(); |
400 | 401 | ||
401 | daymatrix->setSelectedDaysFrom(*(dateList.begin()), *(--dateList.end())); | 402 | daymatrix->setSelectedDaysFrom(*(dateList.begin()), *(--dateList.end())); |
402 | 403 | ||
403 | updateView(); | 404 | updateView(); |
404 | } | 405 | } |
405 | } | 406 | } |
406 | 407 | ||
407 | int KDateNavigator::dayNum(int row, int col) | 408 | int KDateNavigator::dayNum(int row, int col) |
408 | { | 409 | { |
409 | return 7 * (row - 1) + (col + 1) - m_fstDayOfWk; | 410 | return 7 * (row - 1) + (col + 1) - m_fstDayOfWk; |
410 | } | 411 | } |
411 | 412 | ||
412 | int KDateNavigator::dayToIndex(int dayNum) | 413 | int KDateNavigator::dayToIndex(int dayNum) |
413 | { | 414 | { |
414 | int row, col; | 415 | int row, col; |
415 | 416 | ||
416 | row = (dayNum+m_fstDayOfWk-1-(KGlobal::locale()->weekStartsMonday() ? 1 : 0)) / 7; | 417 | row = (dayNum+m_fstDayOfWk-1-(KGlobal::locale()->weekStartsMonday() ? 1 : 0)) / 7; |
417 | if (KGlobal::locale()->weekStartsMonday() && (m_fstDayOfWk == 1)) | 418 | if (KGlobal::locale()->weekStartsMonday() && (m_fstDayOfWk == 1)) |
418 | row++; | 419 | row++; |
419 | col = (dayNum+m_fstDayOfWk-1-(KGlobal::locale()->weekStartsMonday() ? 1 : 0)) % 7; | 420 | col = (dayNum+m_fstDayOfWk-1-(KGlobal::locale()->weekStartsMonday() ? 1 : 0)) % 7; |
420 | return row * 7 + col; | 421 | return row * 7 + col; |
421 | } | 422 | } |
422 | 423 | ||
423 | void KDateNavigator::wheelEvent (QWheelEvent *e) | 424 | void KDateNavigator::wheelEvent (QWheelEvent *e) |
424 | { | 425 | { |
425 | if(e->delta()>0) emit goPrevious(); | 426 | if(e->delta()>0) emit goPrevious(); |
426 | else emit goNext(); | 427 | else emit goNext(); |
427 | 428 | ||
428 | e->accept(); | 429 | e->accept(); |
429 | } | 430 | } |
430 | 431 | ||
431 | bool KDateNavigator::eventFilter (QObject *o,QEvent *e) | 432 | bool KDateNavigator::eventFilter (QObject *o,QEvent *e) |
432 | { | 433 | { |
433 | if (e->type() == QEvent::MouseButtonPress) { | 434 | if (e->type() == QEvent::MouseButtonPress) { |
434 | int i; | 435 | int i; |
435 | for(i=0;i<6;++i) { | 436 | for(i=0;i<6;++i) { |
436 | if (o == weeknos[i]) { | 437 | if (o == weeknos[i]) { |
437 | QDate weekstart = daymatrix->getDate(i*7); | 438 | QDate weekstart = daymatrix->getDate(i*7); |
438 | emit weekClicked(weekstart); | 439 | emit weekClicked(weekstart); |
439 | break; | 440 | break; |
440 | } | 441 | } |
441 | } | 442 | } |
443 | for(i=0;i<7;++i) { | ||
444 | if (o == headings[i]) { | ||
445 | KCal::DateList selDays; | ||
446 | QDate date = daymatrix->getDate(14); | ||
447 | int dio = date.daysInMonth(); | ||
448 | int j; | ||
449 | int ye = date.year(); | ||
450 | int mo = date.month(); | ||
451 | for ( j = 1; j <= dio; ++j ) { | ||
452 | selDays.append( QDate( ye, mo, j ) ); | ||
453 | } | ||
454 | emit datesSelected( selDays ); | ||
455 | break; | ||
456 | } | ||
457 | } | ||
442 | return true; | 458 | return true; |
443 | } else { | 459 | } else { |
444 | return false; | 460 | return false; |
445 | } | 461 | } |
446 | } | 462 | } |
447 | 463 | ||
448 | //#include "kdatenavigator.moc" | 464 | //#include "kdatenavigator.moc" |
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp index a9f5a41..cc0ce9b 100644 --- a/korganizer/koviewmanager.cpp +++ b/korganizer/koviewmanager.cpp | |||
@@ -1,715 +1,718 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | 3 | ||
4 | Copyright (c) 2001 | 4 | Copyright (c) 2001 |
5 | Cornelius Schumacher <schumacher@kde.org> | 5 | Cornelius Schumacher <schumacher@kde.org> |
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 <qwidgetstack.h> | 26 | #include <qwidgetstack.h> |
27 | 27 | ||
28 | #include <kconfig.h> | 28 | #include <kconfig.h> |
29 | #include <kglobal.h> | 29 | #include <kglobal.h> |
30 | #ifndef DESKTOP_VERSION | 30 | #ifndef DESKTOP_VERSION |
31 | #include <qpe/qpeapplication.h> | 31 | #include <qpe/qpeapplication.h> |
32 | #else | 32 | #else |
33 | #include <qapplication.h> | 33 | #include <qapplication.h> |
34 | #endif | 34 | #endif |
35 | #include <qdatetime.h> | 35 | #include <qdatetime.h> |
36 | #include "calendarview.h" | 36 | #include "calendarview.h" |
37 | #include "datenavigator.h" | 37 | #include "datenavigator.h" |
38 | #include "kotodoview.h" | 38 | #include "kotodoview.h" |
39 | #include "koagendaview.h" | 39 | #include "koagendaview.h" |
40 | #include "kodialogmanager.h" | 40 | #include "kodialogmanager.h" |
41 | #include "komonthview.h" | 41 | #include "komonthview.h" |
42 | #include "kolistview.h" | 42 | #include "kolistview.h" |
43 | #include "kowhatsnextview.h" | 43 | #include "kowhatsnextview.h" |
44 | #include "kojournalview.h" | 44 | #include "kojournalview.h" |
45 | #include "kotimespanview.h" | 45 | #include "kotimespanview.h" |
46 | #include "koprefs.h" | 46 | #include "koprefs.h" |
47 | #include "navigatorbar.h" | 47 | #include "navigatorbar.h" |
48 | #include "kdatenavigator.h" | 48 | #include "kdatenavigator.h" |
49 | 49 | ||
50 | #include "koviewmanager.h" | 50 | #include "koviewmanager.h" |
51 | //extern bool externFlagMonthviewBlockPainting; | 51 | //extern bool externFlagMonthviewBlockPainting; |
52 | 52 | ||
53 | //bool globalFlagBlockPainting = false; | 53 | //bool globalFlagBlockPainting = false; |
54 | int globalFlagBlockAgenda = 0; | 54 | int globalFlagBlockAgenda = 0; |
55 | int globalFlagBlockLabel = 0; | 55 | int globalFlagBlockLabel = 0; |
56 | int globalFlagBlockAgendaItemPaint = 1; | 56 | int globalFlagBlockAgendaItemPaint = 1; |
57 | int globalFlagBlockAgendaItemUpdate = 1; | 57 | int globalFlagBlockAgendaItemUpdate = 1; |
58 | 58 | ||
59 | 59 | ||
60 | KOViewManager::KOViewManager( CalendarView *mainView ) : | 60 | KOViewManager::KOViewManager( CalendarView *mainView ) : |
61 | QObject(), mMainView( mainView ) | 61 | QObject(), mMainView( mainView ) |
62 | { | 62 | { |
63 | mCurrentView = 0; | 63 | mCurrentView = 0; |
64 | 64 | ||
65 | mWhatsNextView = 0; | 65 | mWhatsNextView = 0; |
66 | mTodoView = 0; | 66 | mTodoView = 0; |
67 | mAgendaView = 0; | 67 | mAgendaView = 0; |
68 | mMonthView = 0; | 68 | mMonthView = 0; |
69 | mListView = 0; | 69 | mListView = 0; |
70 | mJournalView = 0; | 70 | mJournalView = 0; |
71 | mTimeSpanView = 0; | 71 | mTimeSpanView = 0; |
72 | mCurrentAgendaView = 0 ; | 72 | mCurrentAgendaView = 0 ; |
73 | mFlagShowNextxDays = false; | 73 | mFlagShowNextxDays = false; |
74 | } | 74 | } |
75 | 75 | ||
76 | KOViewManager::~KOViewManager() | 76 | KOViewManager::~KOViewManager() |
77 | { | 77 | { |
78 | } | 78 | } |
79 | 79 | ||
80 | 80 | ||
81 | KOrg::BaseView *KOViewManager::currentView() | 81 | KOrg::BaseView *KOViewManager::currentView() |
82 | { | 82 | { |
83 | return mCurrentView; | 83 | return mCurrentView; |
84 | } | 84 | } |
85 | 85 | ||
86 | void KOViewManager::readSettings(KConfig *config) | 86 | void KOViewManager::readSettings(KConfig *config) |
87 | { | 87 | { |
88 | config->setGroup("General"); | 88 | config->setGroup("General"); |
89 | QString view = config->readEntry("Current View"); | 89 | QString view = config->readEntry("Current View"); |
90 | if (view == "WhatsNext") showWhatsNextView(); | 90 | if (view == "WhatsNext") showWhatsNextView(); |
91 | else if (view == "Month") { | 91 | else if (view == "Month") { |
92 | if ( !KOPrefs::instance()->mMonthViewWeek ) | 92 | if ( !KOPrefs::instance()->mMonthViewWeek ) |
93 | showMonthView(); | 93 | showMonthView(); |
94 | else | 94 | else |
95 | showMonthViewWeek(); | 95 | showMonthViewWeek(); |
96 | } | 96 | } |
97 | else if (view == "List") showListView(); | 97 | else if (view == "List") showListView(); |
98 | else if (view == "Journal") showJournalView(); | 98 | else if (view == "Journal") showJournalView(); |
99 | else if (view == "TimeSpan") showTimeSpanView(); | 99 | else if (view == "TimeSpan") showTimeSpanView(); |
100 | else if (view == "Todo") showTodoView(); | 100 | else if (view == "Todo") showTodoView(); |
101 | else { | 101 | else { |
102 | config->setGroup( "Views" ); | 102 | config->setGroup( "Views" ); |
103 | int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); | 103 | int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); |
104 | mCurrentAgendaView = dateCount; | 104 | mCurrentAgendaView = dateCount; |
105 | showAgendaView(); | 105 | showAgendaView(); |
106 | mCurrentAgendaView = dateCount; | 106 | mCurrentAgendaView = dateCount; |
107 | #ifdef DESKTOP_VERSION | 107 | #ifdef DESKTOP_VERSION |
108 | QTimer::singleShot( 1000, mAgendaView, SLOT ( setInitStartHour() ) ); | 108 | QTimer::singleShot( 1000, mAgendaView, SLOT ( setInitStartHour() ) ); |
109 | #endif | 109 | #endif |
110 | } | 110 | } |
111 | } | 111 | } |
112 | 112 | ||
113 | void KOViewManager::showDateView( int view, QDate date) | 113 | void KOViewManager::showDateView( int view, QDate date) |
114 | { | 114 | { |
115 | static int lastMode = 0; | 115 | static int lastMode = 0; |
116 | static int lastCount = 0; | 116 | static int lastCount = 0; |
117 | static bool lastNDMode = false; | 117 | static bool lastNDMode = false; |
118 | static QDate lastDate; | 118 | static QDate lastDate; |
119 | //qDebug("date %d %s", view, date.toString().latin1()); | 119 | //qDebug("date %d %s", view, date.toString().latin1()); |
120 | 120 | ||
121 | if (view != 9) | 121 | if (view != 9) |
122 | lastMode = 0; | 122 | lastMode = 0; |
123 | //qDebug("%d %d ", lastNDMode, mFlagShowNextxDays ); | 123 | //qDebug("%d %d ", lastNDMode, mFlagShowNextxDays ); |
124 | bool savemFlagShowNextxDays = mFlagShowNextxDays; | 124 | bool savemFlagShowNextxDays = mFlagShowNextxDays; |
125 | mFlagShowNextxDays = false; | 125 | mFlagShowNextxDays = false; |
126 | if ( view == 3 ) { | 126 | if ( view == 3 ) { |
127 | //mCurrentAgendaView = 1 ; | 127 | //mCurrentAgendaView = 1 ; |
128 | lastDate = mMainView->dateNavigator()->selectedDates().first(); | 128 | lastDate = mMainView->dateNavigator()->selectedDates().first(); |
129 | lastCount = mMainView->dateNavigator()->selectedDates().count(); | 129 | lastCount = mMainView->dateNavigator()->selectedDates().count(); |
130 | lastNDMode = savemFlagShowNextxDays; | 130 | lastNDMode = savemFlagShowNextxDays; |
131 | mMainView->showDay( date ); | 131 | mMainView->showDay( date ); |
132 | lastMode = 1; | 132 | lastMode = 1; |
133 | } else if (view == 4 ) { | 133 | } else if (view == 4 ) { |
134 | mCurrentAgendaView = 7 ; | 134 | mCurrentAgendaView = 7 ; |
135 | mMainView->dateNavigator()->selectDates( date, 7 ); | 135 | mMainView->dateNavigator()->selectDates( date, 7 ); |
136 | } else if (view == 5 ) { | 136 | } else if (view == 5 ) { |
137 | mCurrentAgendaView = 14 ; | 137 | mCurrentAgendaView = 14 ; |
138 | mMainView->dateNavigator()->selectDates( date, 14); | 138 | mMainView->dateNavigator()->selectDates( date, 14); |
139 | } else if (view == 6 ) { | 139 | } else if (view == 6 ) { |
140 | //mMainView->dateNavigator()->selectDates( date, 7 ); | 140 | //mMainView->dateNavigator()->selectDates( date, 7 ); |
141 | showMonthView(); | 141 | showMonthView(); |
142 | } else if (view == 7 ) { | 142 | } else if (view == 7 ) { |
143 | mMainView->dateNavigator()->selectDate( date ); | 143 | mMainView->dateNavigator()->selectDate( date ); |
144 | showJournalView(); | 144 | showJournalView(); |
145 | } else if (view == 8 ) { | 145 | } else if (view == 8 ) { |
146 | globalFlagBlockAgenda = 1; | 146 | globalFlagBlockAgenda = 1; |
147 | if ( mCurrentAgendaView != 3 ) | 147 | if ( mCurrentAgendaView != 3 ) |
148 | mCurrentAgendaView = -1; | 148 | mCurrentAgendaView = -1; |
149 | showAgendaView(KOPrefs::instance()->mFullViewMonth); | 149 | showAgendaView(KOPrefs::instance()->mFullViewMonth); |
150 | globalFlagBlockAgenda = 2; | 150 | globalFlagBlockAgenda = 2; |
151 | mMainView->dateNavigator()->selectDates( date , | 151 | mMainView->dateNavigator()->selectDates( date , |
152 | KOPrefs::instance()->mNextXDays ); | 152 | KOPrefs::instance()->mNextXDays ); |
153 | mFlagShowNextxDays = true; | 153 | mFlagShowNextxDays = true; |
154 | mCurrentAgendaView = 3 ; | 154 | mCurrentAgendaView = 3 ; |
155 | } if (view == 9) { // return behaviour, for getting back from mode == 3 (single day mode ) | 155 | } if (view == 9) { // return behaviour, for getting back from mode == 3 (single day mode ) |
156 | if ( lastMode ) { | 156 | if ( lastMode ) { |
157 | mCurrentAgendaView = lastCount ; | 157 | mCurrentAgendaView = lastCount ; |
158 | mMainView->dateNavigator()->selectDates( lastDate, lastCount); | 158 | mMainView->dateNavigator()->selectDates( lastDate, lastCount); |
159 | mFlagShowNextxDays = lastNDMode; | 159 | mFlagShowNextxDays = lastNDMode; |
160 | if ( mFlagShowNextxDays ) { | 160 | if ( mFlagShowNextxDays ) { |
161 | mCurrentAgendaView = 3 ; | 161 | mCurrentAgendaView = 3 ; |
162 | } | 162 | } |
163 | } else | 163 | } else |
164 | showWeekView(); | 164 | showWeekView(); |
165 | } else if (view == 10) { | 165 | } else if (view == 10) { |
166 | mMainView->dateNavigator()->selectDates( date,mMainView->dateNavigator()->selectedDates().count() ); | 166 | mMainView->dateNavigator()->selectDates( date,mMainView->dateNavigator()->selectedDates().count() ); |
167 | } | 167 | } |
168 | } | 168 | } |
169 | 169 | ||
170 | 170 | ||
171 | 171 | ||
172 | void KOViewManager::writeSettings(KConfig *config) | 172 | void KOViewManager::writeSettings(KConfig *config) |
173 | { | 173 | { |
174 | config->setGroup("General"); | 174 | config->setGroup("General"); |
175 | 175 | ||
176 | QString view; | 176 | QString view; |
177 | if (mCurrentView == mWhatsNextView) view = "WhatsNext"; | 177 | if (mCurrentView == mWhatsNextView) view = "WhatsNext"; |
178 | else if (mCurrentView == mMonthView) view = "Month"; | 178 | else if (mCurrentView == mMonthView) view = "Month"; |
179 | else if (mCurrentView == mListView) view = "List"; | 179 | else if (mCurrentView == mListView) view = "List"; |
180 | else if (mCurrentView == mJournalView) view = "Journal"; | 180 | else if (mCurrentView == mJournalView) view = "Journal"; |
181 | else if (mCurrentView == mTimeSpanView) view = "TimeSpan"; | 181 | else if (mCurrentView == mTimeSpanView) view = "TimeSpan"; |
182 | else if (mCurrentView == mTodoView) view = "Todo"; | 182 | else if (mCurrentView == mTodoView) view = "Todo"; |
183 | else view = "Agenda"; | 183 | else view = "Agenda"; |
184 | 184 | ||
185 | config->writeEntry("Current View",view); | 185 | config->writeEntry("Current View",view); |
186 | 186 | ||
187 | if (mAgendaView) { | 187 | if (mAgendaView) { |
188 | mAgendaView->writeSettings(config); | 188 | mAgendaView->writeSettings(config); |
189 | } | 189 | } |
190 | if (mTimeSpanView) { | 190 | if (mTimeSpanView) { |
191 | mTimeSpanView->writeSettings(config); | 191 | mTimeSpanView->writeSettings(config); |
192 | } | 192 | } |
193 | if (mListView) { | 193 | if (mListView) { |
194 | mListView->writeSettings(config); | 194 | mListView->writeSettings(config); |
195 | } | 195 | } |
196 | if (mTodoView) { | 196 | if (mTodoView) { |
197 | mTodoView->saveLayout(config,"Todo View"); | 197 | mTodoView->saveLayout(config,"Todo View"); |
198 | } | 198 | } |
199 | } | 199 | } |
200 | 200 | ||
201 | void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) | 201 | void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) |
202 | { | 202 | { |
203 | 203 | ||
204 | //mFlagShowNextxDays = false; | 204 | //mFlagShowNextxDays = false; |
205 | //if(view == mCurrentView) return; | 205 | //if(view == mCurrentView) return; |
206 | if ( view == 0 ) { | 206 | if ( view == 0 ) { |
207 | view = mCurrentView; | 207 | view = mCurrentView; |
208 | if ( view == 0 ) | 208 | if ( view == 0 ) |
209 | return; | 209 | return; |
210 | } | 210 | } |
211 | bool full = fullScreen; | 211 | bool full = fullScreen; |
212 | if(view == mCurrentView && view != mWhatsNextView ) { | 212 | if(view == mCurrentView && view != mWhatsNextView ) { |
213 | if ( mCurrentAgendaView < 0 ) | 213 | if ( mCurrentAgendaView < 0 ) |
214 | return; | 214 | return; |
215 | if ( view != mMonthView ) | 215 | if ( view != mMonthView ) |
216 | full = mMainView->leftFrame()->isVisible(); | 216 | full = mMainView->leftFrame()->isVisible(); |
217 | } else { | 217 | } else { |
218 | if ( view == mMonthView && mMonthView) | 218 | if ( view == mMonthView && mMonthView) |
219 | ;//mMonthView->skipResize = true ; | 219 | ;//mMonthView->skipResize = true ; |
220 | mCurrentView = view; | 220 | mCurrentView = view; |
221 | // bool full = fullScreen; | 221 | // bool full = fullScreen; |
222 | bool isFull = !mMainView->leftFrame()->isVisible(); | 222 | bool isFull = !mMainView->leftFrame()->isVisible(); |
223 | if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) | 223 | if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) |
224 | full = true; | 224 | full = true; |
225 | if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) | 225 | if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) |
226 | full = false; | 226 | full = false; |
227 | } | 227 | } |
228 | if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); | 228 | if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); |
229 | //raiseCurrentView( full ); | 229 | //raiseCurrentView( full ); |
230 | mMainView->processIncidenceSelection( 0 ); | 230 | mMainView->processIncidenceSelection( 0 ); |
231 | //mMainView->updateView(); | 231 | //mMainView->updateView(); |
232 | raiseCurrentView( full, true ); | 232 | raiseCurrentView( full, true ); |
233 | mMainView->adaptNavigationUnits(); | 233 | mMainView->adaptNavigationUnits(); |
234 | } | 234 | } |
235 | 235 | ||
236 | void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView ) | 236 | void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView ) |
237 | { | 237 | { |
238 | mCurrentAgendaView = 0; | 238 | mCurrentAgendaView = 0; |
239 | if ( fullScreen ) { | 239 | if ( fullScreen ) { |
240 | mMainView->leftFrame()->hide(); | 240 | mMainView->leftFrame()->hide(); |
241 | } else { | 241 | } else { |
242 | mMainView->leftFrame()->show(); | 242 | mMainView->leftFrame()->show(); |
243 | } | 243 | } |
244 | emit signalFullScreen( !fullScreen ); | 244 | emit signalFullScreen( !fullScreen ); |
245 | if ( callUpdateView ) | 245 | if ( callUpdateView ) |
246 | mMainView->updateView(); | 246 | mMainView->updateView(); |
247 | 247 | ||
248 | if ( globalFlagBlockAgenda == 5 ) { | 248 | if ( globalFlagBlockAgenda == 5 ) { |
249 | globalFlagBlockAgenda = 4; | 249 | globalFlagBlockAgenda = 4; |
250 | globalFlagBlockAgendaItemPaint = 1; | 250 | globalFlagBlockAgendaItemPaint = 1; |
251 | } | 251 | } |
252 | mMainView->viewStack()->raiseWidget(mCurrentView); | 252 | mMainView->viewStack()->raiseWidget(mCurrentView); |
253 | if ( globalFlagBlockAgenda == 4 ) { | 253 | if ( globalFlagBlockAgenda == 4 ) { |
254 | if ( mCurrentView == mAgendaView ) { | 254 | if ( mCurrentView == mAgendaView ) { |
255 | //globalFlagBlockAgenda =1 ; | 255 | //globalFlagBlockAgenda =1 ; |
256 | if ( KOPrefs::instance()->mSetTimeToDayStartAt ) | 256 | if ( KOPrefs::instance()->mSetTimeToDayStartAt ) |
257 | mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins ); | 257 | mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins ); |
258 | else if ( KOPrefs::instance()->mCenterOnCurrentTime ) | 258 | else if ( KOPrefs::instance()->mCenterOnCurrentTime ) |
259 | mAgendaView->setStartHour( QTime::currentTime ().hour() ); | 259 | mAgendaView->setStartHour( QTime::currentTime ().hour() ); |
260 | qApp->processEvents(); | 260 | qApp->processEvents(); |
261 | //qDebug("qApp->processEvents() "); | 261 | //qDebug("qApp->processEvents() "); |
262 | globalFlagBlockAgenda = 0; | 262 | globalFlagBlockAgenda = 0; |
263 | mAgendaView->repaintAgenda(); | 263 | mAgendaView->repaintAgenda(); |
264 | 264 | ||
265 | } | 265 | } |
266 | globalFlagBlockAgenda = 0; | 266 | globalFlagBlockAgenda = 0; |
267 | } | 267 | } |
268 | emit signalAgendaView( mCurrentView == mAgendaView ); | 268 | emit signalAgendaView( mCurrentView == mAgendaView ); |
269 | //qDebug("raiseCurrentView ende "); | 269 | //qDebug("raiseCurrentView ende "); |
270 | 270 | ||
271 | } | 271 | } |
272 | 272 | ||
273 | void KOViewManager::updateView() | 273 | void KOViewManager::updateView() |
274 | { | 274 | { |
275 | // qDebug("KOViewManager::updateView() "); | 275 | // qDebug("KOViewManager::updateView() "); |
276 | // if we are updating mTodoView, we get endless recursion | 276 | // if we are updating mTodoView, we get endless recursion |
277 | if ( mTodoView == mCurrentView ) | 277 | if ( mTodoView == mCurrentView ) |
278 | return; | 278 | return; |
279 | if ( mCurrentView ) mCurrentView->updateView(); | 279 | if ( mCurrentView ) mCurrentView->updateView(); |
280 | 280 | ||
281 | } | 281 | } |
282 | 282 | ||
283 | void KOViewManager::updateView(const QDate &start, const QDate &end) | 283 | void KOViewManager::updateView(const QDate &start, const QDate &end) |
284 | { | 284 | { |
285 | // kdDebug() << "KOViewManager::updateView()" << endl; | 285 | // kdDebug() << "KOViewManager::updateView()" << endl; |
286 | 286 | ||
287 | if (mCurrentView) mCurrentView->showDates(start, end); | 287 | if (mCurrentView) mCurrentView->showDates(start, end); |
288 | 288 | ||
289 | if (mTodoView && mTodoView == mCurrentView ) mTodoView->updateView(); | 289 | if (mTodoView && mTodoView == mCurrentView ) mTodoView->updateView(); |
290 | } | 290 | } |
291 | 291 | ||
292 | 292 | ||
293 | void KOViewManager::updateWNview() | 293 | void KOViewManager::updateWNview() |
294 | { | 294 | { |
295 | if ( mCurrentView == mWhatsNextView && mWhatsNextView ) | 295 | if ( mCurrentView == mWhatsNextView && mWhatsNextView ) |
296 | mWhatsNextView->updateView(); | 296 | mWhatsNextView->updateView(); |
297 | 297 | ||
298 | } | 298 | } |
299 | void KOViewManager::showWhatsNextView() | 299 | void KOViewManager::showWhatsNextView() |
300 | { | 300 | { |
301 | if (!mWhatsNextView) { | 301 | if (!mWhatsNextView) { |
302 | mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(), | 302 | mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(), |
303 | "KOViewManager::WhatsNextView"); | 303 | "KOViewManager::WhatsNextView"); |
304 | mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog()); | 304 | mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog()); |
305 | connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig())); | 305 | connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig())); |
306 | addView(mWhatsNextView); | 306 | addView(mWhatsNextView); |
307 | connect(this, SIGNAL( printWNV() ), | 307 | connect(this, SIGNAL( printWNV() ), |
308 | mWhatsNextView, SLOT( printMe() ) ); | 308 | mWhatsNextView, SLOT( printMe() ) ); |
309 | } | 309 | } |
310 | globalFlagBlockAgenda = 1; | 310 | globalFlagBlockAgenda = 1; |
311 | showView(mWhatsNextView, true ); | 311 | showView(mWhatsNextView, true ); |
312 | //mWhatsNextView->updateView(); | 312 | //mWhatsNextView->updateView(); |
313 | 313 | ||
314 | } | 314 | } |
315 | 315 | ||
316 | void KOViewManager::showListView() | 316 | void KOViewManager::showListView() |
317 | { | 317 | { |
318 | if (!mListView) { | 318 | if (!mListView) { |
319 | mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView"); | 319 | mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView"); |
320 | addView(mListView); | 320 | addView(mListView); |
321 | 321 | ||
322 | connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)), | 322 | connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)), |
323 | mMainView, SLOT(showIncidence(Incidence *))); | 323 | mMainView, SLOT(showIncidence(Incidence *))); |
324 | connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)), | 324 | connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)), |
325 | mMainView, SLOT(editIncidence(Incidence *))); | 325 | mMainView, SLOT(editIncidence(Incidence *))); |
326 | connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)), | 326 | connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)), |
327 | mMainView, SLOT(deleteIncidence(Incidence *))); | 327 | mMainView, SLOT(deleteIncidence(Incidence *))); |
328 | connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ), | 328 | connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ), |
329 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 329 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
330 | connect( mListView, SIGNAL( signalNewEvent() ), | 330 | connect( mListView, SIGNAL( signalNewEvent() ), |
331 | mMainView, SLOT( newEvent() ) ); | 331 | mMainView, SLOT( newEvent() ) ); |
332 | connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig())); | 332 | connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig())); |
333 | connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), | 333 | connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), |
334 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); | 334 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); |
335 | connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), | 335 | connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), |
336 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); | 336 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); |
337 | connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ), | 337 | connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ), |
338 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 338 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
339 | connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ), | 339 | connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ), |
340 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 340 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
341 | } | 341 | } |
342 | // bool temp = mFlagShowNextxDays; | 342 | // bool temp = mFlagShowNextxDays; |
343 | //globalFlagBlockPainting = true; | 343 | //globalFlagBlockPainting = true; |
344 | globalFlagBlockAgenda = 1; | 344 | globalFlagBlockAgenda = 1; |
345 | if ( KOPrefs::instance()->mListViewMonthTimespan ) { | 345 | if ( KOPrefs::instance()->mListViewMonthTimespan ) { |
346 | mMainView->setBlockShowDates( true ); | 346 | mMainView->setBlockShowDates( true ); |
347 | mMainView->dateNavigator()->selectMonth(); | 347 | mMainView->dateNavigator()->selectMonth(); |
348 | mMainView->setBlockShowDates( false ); | 348 | mMainView->setBlockShowDates( false ); |
349 | } | 349 | } |
350 | showView(mListView, KOPrefs::instance()->mFullViewTodo); | 350 | showView(mListView, KOPrefs::instance()->mFullViewTodo); |
351 | //mFlagShowNextxDays = temp; | 351 | //mFlagShowNextxDays = temp; |
352 | } | 352 | } |
353 | 353 | ||
354 | void KOViewManager::showAgendaView( bool fullScreen ) | 354 | void KOViewManager::showAgendaView( bool fullScreen ) |
355 | { | 355 | { |
356 | 356 | ||
357 | mMainView->dialogManager()->hideSearchDialog(); | 357 | mMainView->dialogManager()->hideSearchDialog(); |
358 | // qDebug("KOViewManager::showAgendaView "); | 358 | // qDebug("KOViewManager::showAgendaView "); |
359 | bool full; | 359 | bool full; |
360 | full = fullScreen; | 360 | full = fullScreen; |
361 | if (!mAgendaView) { | 361 | if (!mAgendaView) { |
362 | full = false; | 362 | full = false; |
363 | mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView"); | 363 | mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView"); |
364 | addView(mAgendaView); | 364 | addView(mAgendaView); |
365 | #ifndef DESKTOP_VERSION | 365 | #ifndef DESKTOP_VERSION |
366 | QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold ); | 366 | QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold ); |
367 | #endif | 367 | #endif |
368 | connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )), | 368 | connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )), |
369 | mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) )); | 369 | mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) )); |
370 | 370 | ||
371 | // SIGNALS/SLOTS FOR DAY/WEEK VIEW | 371 | // SIGNALS/SLOTS FOR DAY/WEEK VIEW |
372 | 372 | ||
373 | connect(mAgendaView,SIGNAL(showDateView( int, QDate )),SLOT(showDateView( int, QDate ))); | 373 | connect(mAgendaView,SIGNAL(showDateView( int, QDate )),SLOT(showDateView( int, QDate ))); |
374 | 374 | ||
375 | connect(mAgendaView,SIGNAL(newTodoSignal(QDateTime,bool)), | 375 | connect(mAgendaView,SIGNAL(newTodoSignal(QDateTime,bool)), |
376 | mMainView, SLOT(newTodoDateTime(QDateTime,bool))); | 376 | mMainView, SLOT(newTodoDateTime(QDateTime,bool))); |
377 | connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)), | 377 | connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)), |
378 | mMainView, SLOT(newEvent(QDateTime))); | 378 | mMainView, SLOT(newEvent(QDateTime))); |
379 | connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)), | 379 | connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)), |
380 | mMainView, SLOT(newEvent(QDateTime,QDateTime))); | 380 | mMainView, SLOT(newEvent(QDateTime,QDateTime))); |
381 | connect(mAgendaView,SIGNAL(newEventSignal(QDate)), | 381 | connect(mAgendaView,SIGNAL(newEventSignal(QDate)), |
382 | mMainView, SLOT(newEvent(QDate))); | 382 | mMainView, SLOT(newEvent(QDate))); |
383 | 383 | ||
384 | connect(mAgendaView, SIGNAL(editIncidenceSignal(Incidence *)), | 384 | connect(mAgendaView, SIGNAL(editIncidenceSignal(Incidence *)), |
385 | mMainView, SLOT(editIncidence(Incidence *))); | 385 | mMainView, SLOT(editIncidence(Incidence *))); |
386 | connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)), | 386 | connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)), |
387 | mMainView, SLOT(showIncidence(Incidence *))); | 387 | mMainView, SLOT(showIncidence(Incidence *))); |
388 | connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)), | 388 | connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)), |
389 | mMainView, SLOT(deleteIncidence(Incidence *))); | 389 | mMainView, SLOT(deleteIncidence(Incidence *))); |
390 | 390 | ||
391 | connect( mAgendaView, SIGNAL( incidenceSelected( Incidence * ) ), | 391 | connect( mAgendaView, SIGNAL( incidenceSelected( Incidence * ) ), |
392 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 392 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
393 | 393 | ||
394 | connect(mAgendaView, SIGNAL( toggleExpand() ), | 394 | connect(mAgendaView, SIGNAL( toggleExpand() ), |
395 | mMainView, SLOT( toggleExpand() ) ); | 395 | mMainView, SLOT( toggleExpand() ) ); |
396 | 396 | ||
397 | connect(mMainView, SIGNAL( calendarViewExpanded( bool ) ), | 397 | connect(mMainView, SIGNAL( calendarViewExpanded( bool ) ), |
398 | mAgendaView, SLOT( setExpandedButton( bool ) ) ); | 398 | mAgendaView, SLOT( setExpandedButton( bool ) ) ); |
399 | connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ), | 399 | connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ), |
400 | mMainView, SLOT(cloneIncidence(Incidence *) ) ) ; | 400 | mMainView, SLOT(cloneIncidence(Incidence *) ) ) ; |
401 | connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ), | 401 | connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ), |
402 | mMainView, SLOT(cancelIncidence(Incidence *) ) ) ; | 402 | mMainView, SLOT(cancelIncidence(Incidence *) ) ) ; |
403 | connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig())); | 403 | connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig())); |
404 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView, | 404 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView, |
405 | SLOT( updateTodo( Todo *, int ) ) ); | 405 | SLOT( updateTodo( Todo *, int ) ) ); |
406 | connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )), | 406 | connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )), |
407 | mMainView, SIGNAL( todoModified( Todo *, int ))); | 407 | mMainView, SIGNAL( todoModified( Todo *, int ))); |
408 | connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ), | 408 | connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ), |
409 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 409 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
410 | connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ), | 410 | connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ), |
411 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 411 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
412 | connect( mAgendaView, SIGNAL( selectWeekNum( int ) ), | 412 | connect( mAgendaView, SIGNAL( selectWeekNum( int ) ), |
413 | mMainView->dateNavigator(), SLOT ( selectWeek( int ) ) ); | 413 | mMainView->dateNavigator(), SLOT ( selectWeek( int ) ) ); |
414 | mAgendaView->readSettings(); | 414 | mAgendaView->readSettings(); |
415 | mAgendaView->updateConfig(); | 415 | mAgendaView->updateConfig(); |
416 | } | 416 | } |
417 | 417 | ||
418 | showView( mAgendaView, full); | 418 | showView( mAgendaView, full); |
419 | 419 | ||
420 | } | 420 | } |
421 | 421 | ||
422 | void KOViewManager::showDayView() | 422 | void KOViewManager::showDayView() |
423 | { | 423 | { |
424 | mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count(); | ||
424 | mFlagShowNextxDays = false; | 425 | mFlagShowNextxDays = false; |
425 | globalFlagBlockLabel = 1; | 426 | globalFlagBlockLabel = 1; |
426 | globalFlagBlockAgenda = 1; | 427 | globalFlagBlockAgenda = 1; |
427 | if ( mCurrentAgendaView != 1 ) | 428 | if ( mCurrentAgendaView != 1 ) |
428 | mCurrentAgendaView = -1; | 429 | mCurrentAgendaView = -1; |
429 | showAgendaView(); | 430 | showAgendaView(); |
430 | qApp->processEvents(); | 431 | qApp->processEvents(); |
431 | globalFlagBlockAgenda = 2; | 432 | globalFlagBlockAgenda = 2; |
432 | globalFlagBlockLabel = 0; | 433 | globalFlagBlockLabel = 0; |
433 | mMainView->dateNavigator()->selectDates( 1 ); | 434 | mMainView->dateNavigator()->selectDates( 1 ); |
434 | mCurrentAgendaView = 1 ; | 435 | mCurrentAgendaView = 1 ; |
435 | 436 | ||
436 | } | 437 | } |
437 | 438 | ||
438 | void KOViewManager::showWorkWeekView() | 439 | void KOViewManager::showWorkWeekView() |
439 | { | 440 | { |
441 | mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count(); | ||
440 | mFlagShowNextxDays = false; | 442 | mFlagShowNextxDays = false; |
441 | globalFlagBlockAgenda = 1; | 443 | globalFlagBlockAgenda = 1; |
442 | globalFlagBlockLabel = 1; | 444 | globalFlagBlockLabel = 1; |
443 | if ( mCurrentAgendaView != 5 ) | 445 | if ( mCurrentAgendaView != 5 ) |
444 | mCurrentAgendaView = -1; | 446 | mCurrentAgendaView = -1; |
445 | showAgendaView(); | 447 | showAgendaView(); |
446 | qApp->processEvents(); | 448 | qApp->processEvents(); |
447 | globalFlagBlockAgenda = 2; | 449 | globalFlagBlockAgenda = 2; |
448 | globalFlagBlockLabel = 0; | 450 | globalFlagBlockLabel = 0; |
449 | mMainView->dateNavigator()->selectWorkWeek(); | 451 | mMainView->dateNavigator()->selectWorkWeek(); |
450 | mCurrentAgendaView = 5 ; | 452 | mCurrentAgendaView = 5 ; |
451 | 453 | ||
452 | } | 454 | } |
453 | 455 | ||
454 | void KOViewManager::showWeekView() | 456 | void KOViewManager::showWeekView() |
455 | { | 457 | { |
456 | /* | 458 | /* |
457 | globalFlagBlockAgenda = 2; | 459 | globalFlagBlockAgenda = 2; |
458 | qDebug("4globalFlagBlockAgenda = 2; "); | 460 | qDebug("4globalFlagBlockAgenda = 2; "); |
459 | //globalFlagBlockPainting = true; | 461 | //globalFlagBlockPainting = true; |
460 | mMainView->dateNavigator()->selectWeek(); | 462 | mMainView->dateNavigator()->selectWeek(); |
461 | showAgendaView(); | 463 | showAgendaView(); |
462 | */ | 464 | */ |
463 | 465 | ||
464 | 466 | ||
467 | mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count(); | ||
465 | mFlagShowNextxDays = false; | 468 | mFlagShowNextxDays = false; |
466 | globalFlagBlockAgenda = 1; | 469 | globalFlagBlockAgenda = 1; |
467 | globalFlagBlockLabel = 1; | 470 | globalFlagBlockLabel = 1; |
468 | if ( mCurrentAgendaView != 7 ) | 471 | if ( mCurrentAgendaView != 7 ) |
469 | mCurrentAgendaView = -1; | 472 | mCurrentAgendaView = -1; |
470 | showAgendaView(); | 473 | showAgendaView(); |
471 | qApp->processEvents(); | 474 | qApp->processEvents(); |
472 | globalFlagBlockAgenda = 2; | 475 | globalFlagBlockAgenda = 2; |
473 | globalFlagBlockLabel = 0; | 476 | globalFlagBlockLabel = 0; |
474 | mMainView->dateNavigator()->selectWeek(); | 477 | mMainView->dateNavigator()->selectWeek(); |
475 | mCurrentAgendaView = 7 ; | 478 | mCurrentAgendaView = 7 ; |
476 | } | 479 | } |
477 | 480 | ||
478 | void KOViewManager::showNextXView() | 481 | void KOViewManager::showNextXView() |
479 | { | 482 | { |
480 | 483 | ||
481 | globalFlagBlockAgenda = 1; | 484 | globalFlagBlockAgenda = 1; |
482 | if ( mCurrentAgendaView != 3 ) | 485 | if ( mCurrentAgendaView != 3 ) |
483 | mCurrentAgendaView = -1; | 486 | mCurrentAgendaView = -1; |
484 | showAgendaView(KOPrefs::instance()->mFullViewMonth); | 487 | showAgendaView(KOPrefs::instance()->mFullViewMonth); |
485 | globalFlagBlockAgenda = 2; | 488 | globalFlagBlockAgenda = 2; |
486 | mMainView->dateNavigator()->selectDates( QDate::currentDate(), | 489 | mMainView->dateNavigator()->selectDates( QDate::currentDate(), |
487 | KOPrefs::instance()->mNextXDays ); | 490 | KOPrefs::instance()->mNextXDays ); |
488 | mFlagShowNextxDays = true; | 491 | mFlagShowNextxDays = true; |
489 | mCurrentAgendaView = 3 ; | 492 | mCurrentAgendaView = 3 ; |
490 | } | 493 | } |
491 | bool KOViewManager::showsNextDays() | 494 | bool KOViewManager::showsNextDays() |
492 | { | 495 | { |
493 | return mFlagShowNextxDays; | 496 | return mFlagShowNextxDays; |
494 | } | 497 | } |
495 | void KOViewManager::createMonthView() | 498 | void KOViewManager::createMonthView() |
496 | { | 499 | { |
497 | if (!mMonthView) { | 500 | if (!mMonthView) { |
498 | mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView"); | 501 | mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView"); |
499 | 502 | ||
500 | addView(mMonthView); | 503 | addView(mMonthView); |
501 | // mMonthView->show(); | 504 | // mMonthView->show(); |
502 | // SIGNALS/SLOTS FOR MONTH VIEW | 505 | // SIGNALS/SLOTS FOR MONTH VIEW |
503 | connect(mMonthView, SIGNAL(newEventSignal(QDateTime)), | 506 | connect(mMonthView, SIGNAL(newEventSignal(QDateTime)), |
504 | mMainView, SLOT(newEvent(QDateTime))); | 507 | mMainView, SLOT(newEvent(QDateTime))); |
505 | 508 | ||
506 | connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)), | 509 | connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)), |
507 | mMainView, SLOT(showIncidence(Incidence *))); | 510 | mMainView, SLOT(showIncidence(Incidence *))); |
508 | connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)), | 511 | connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)), |
509 | mMainView, SLOT(editIncidence(Incidence *))); | 512 | mMainView, SLOT(editIncidence(Incidence *))); |
510 | connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)), | 513 | connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)), |
511 | mMainView, SLOT(deleteIncidence(Incidence *))); | 514 | mMainView, SLOT(deleteIncidence(Incidence *))); |
512 | 515 | ||
513 | connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ), | 516 | connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ), |
514 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 517 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
515 | connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), | 518 | connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), |
516 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); | 519 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); |
517 | connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), | 520 | connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), |
518 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); | 521 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); |
519 | 522 | ||
520 | connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ), | 523 | connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ), |
521 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 524 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
522 | connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ), | 525 | connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ), |
523 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 526 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
524 | connect( mMonthView, SIGNAL( selectWeekNum( int ) ), | 527 | connect( mMonthView, SIGNAL( selectWeekNum( int ) ), |
525 | mMainView->dateNavigator(), SLOT ( selectWeekFromMonthView( int ) ) ); | 528 | mMainView->dateNavigator(), SLOT ( selectWeekFromMonthView( int ) ) ); |
526 | connect( mMonthView, SIGNAL( selectMonth() ), | 529 | connect( mMonthView, SIGNAL( selectMonth() ), |
527 | mMainView->dateNavigator(), SLOT ( selectMonthFromMonthview() ) ); | 530 | mMainView->dateNavigator(), SLOT ( selectMonthFromMonthview() ) ); |
528 | connect( mMonthView, SIGNAL( showDaySignal( QDate ) ), | 531 | connect( mMonthView, SIGNAL( showDaySignal( QDate ) ), |
529 | mMainView, SLOT ( showDay( QDate ) ) ); | 532 | mMainView, SLOT ( showDay( QDate ) ) ); |
530 | connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig())); | 533 | connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig())); |
531 | connect( mMonthView, SIGNAL(nextMonth() ), | 534 | connect( mMonthView, SIGNAL(nextMonth() ), |
532 | mMonthView->navigatorBar(), SIGNAL(goNextMonth() ) ); | 535 | mMonthView->navigatorBar(), SIGNAL(goNextMonth() ) ); |
533 | connect( mMonthView, SIGNAL(prevMonth() ), | 536 | connect( mMonthView, SIGNAL(prevMonth() ), |
534 | mMonthView->navigatorBar(), SIGNAL(goPrevMonth() ) ); | 537 | mMonthView->navigatorBar(), SIGNAL(goPrevMonth() ) ); |
535 | connect( mMonthView->navigatorBar(), SIGNAL( goPrevYear() ), | 538 | connect( mMonthView->navigatorBar(), SIGNAL( goPrevYear() ), |
536 | mMainView->dateNavigator(), SLOT( selectPreviousYear() ) ); | 539 | mMainView->dateNavigator(), SLOT( selectPreviousYear() ) ); |
537 | connect( mMonthView->navigatorBar(), SIGNAL( goNextYear() ), | 540 | connect( mMonthView->navigatorBar(), SIGNAL( goNextYear() ), |
538 | mMainView->dateNavigator(), SLOT( selectNextYear() ) ); | 541 | mMainView->dateNavigator(), SLOT( selectNextYear() ) ); |
539 | connect( mMonthView->navigatorBar(), SIGNAL( goPrevMonth() ), | 542 | connect( mMonthView->navigatorBar(), SIGNAL( goPrevMonth() ), |
540 | mMainView->dateNavigator(), SLOT( selectPreviousMonth() ) ); | 543 | mMainView->dateNavigator(), SLOT( selectPreviousMonth() ) ); |
541 | connect( mMonthView->navigatorBar(), SIGNAL( goNextMonth() ), | 544 | connect( mMonthView->navigatorBar(), SIGNAL( goNextMonth() ), |
542 | mMainView->dateNavigator(), SLOT( selectNextMonth() ) ); | 545 | mMainView->dateNavigator(), SLOT( selectNextMonth() ) ); |
543 | connect( mMonthView->navigatorBar(), SIGNAL( goPrevWeek() ), | 546 | connect( mMonthView->navigatorBar(), SIGNAL( goPrevWeek() ), |
544 | mMainView->dateNavigator(), SLOT( selectPreviousWeek() ) ); | 547 | mMainView->dateNavigator(), SLOT( selectPreviousWeek() ) ); |
545 | connect( mMonthView->navigatorBar(), SIGNAL( goNextWeek() ), | 548 | connect( mMonthView->navigatorBar(), SIGNAL( goNextWeek() ), |
546 | mMainView->dateNavigator(), SLOT( selectNextWeek() ) ); | 549 | mMainView->dateNavigator(), SLOT( selectNextWeek() ) ); |
547 | 550 | ||
548 | connect( mMainView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), | 551 | connect( mMainView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), |
549 | mMonthView->navigatorBar(), SLOT( selectDates( const KCal::DateList & ) ) ); | 552 | mMonthView->navigatorBar(), SLOT( selectDates( const KCal::DateList & ) ) ); |
550 | 553 | ||
551 | 554 | ||
552 | connect( mMonthView->navigatorBar(), SIGNAL( monthSelected ( int ) ), | 555 | connect( mMonthView->navigatorBar(), SIGNAL( monthSelected ( int ) ), |
553 | mMainView->dateNavigator(), SLOT( slotMonthSelect( int ) ) ); | 556 | mMainView->dateNavigator(), SLOT( slotMonthSelect( int ) ) ); |
554 | 557 | ||
555 | } | 558 | } |
556 | } | 559 | } |
557 | void KOViewManager::showMonthViewWeek() | 560 | void KOViewManager::showMonthViewWeek() |
558 | { | 561 | { |
559 | createMonthView(); | 562 | createMonthView(); |
560 | globalFlagBlockAgenda = 1; | 563 | globalFlagBlockAgenda = 1; |
561 | bool full = true; | 564 | bool full = true; |
562 | if ( mCurrentView == mMonthView) | 565 | if ( mCurrentView == mMonthView) |
563 | full = mMainView->leftFrame()->isVisible(); | 566 | full = mMainView->leftFrame()->isVisible(); |
564 | if ( !KOPrefs::instance()->mMonthViewWeek ) { | 567 | if ( !KOPrefs::instance()->mMonthViewWeek ) { |
565 | mMonthView->switchView(); | 568 | mMonthView->switchView(); |
566 | if ( KOPrefs::instance()->mViewChangeHoldNonFullscreen && mMainView->leftFrame()->isVisible() ) | 569 | if ( KOPrefs::instance()->mViewChangeHoldNonFullscreen && mMainView->leftFrame()->isVisible() ) |
567 | full = false; | 570 | full = false; |
568 | else | 571 | else |
569 | full = true; | 572 | full = true; |
570 | } | 573 | } |
571 | mMainView->dateNavigator()->selectWeek(); | 574 | mMainView->dateNavigator()->selectWeek(); |
572 | showView(mMonthView, full ); | 575 | showView(mMonthView, full ); |
573 | } | 576 | } |
574 | 577 | ||
575 | void KOViewManager::showMonthView() | 578 | void KOViewManager::showMonthView() |
576 | { | 579 | { |
577 | 580 | ||
578 | createMonthView(); | 581 | createMonthView(); |
579 | globalFlagBlockAgenda = 1; | 582 | globalFlagBlockAgenda = 1; |
580 | //mFlagShowNextxDays = false; | 583 | //mFlagShowNextxDays = false; |
581 | bool full = true; | 584 | bool full = true; |
582 | if ( mCurrentView == mMonthView) | 585 | if ( mCurrentView == mMonthView) |
583 | full = mMainView->leftFrame()->isVisible(); | 586 | full = mMainView->leftFrame()->isVisible(); |
584 | // if(mMonthView == mCurrentView) return; | 587 | // if(mMonthView == mCurrentView) return; |
585 | if ( KOPrefs::instance()->mMonthViewWeek ) { | 588 | if ( KOPrefs::instance()->mMonthViewWeek ) { |
586 | mMonthView->switchView(); | 589 | mMonthView->switchView(); |
587 | if ( KOPrefs::instance()->mViewChangeHoldNonFullscreen && mMainView->leftFrame()->isVisible() ) | 590 | if ( KOPrefs::instance()->mViewChangeHoldNonFullscreen && mMainView->leftFrame()->isVisible() ) |
588 | full = false; | 591 | full = false; |
589 | else | 592 | else |
590 | full = true; | 593 | full = true; |
591 | } | 594 | } |
592 | mMainView->dateNavigator()->selectMonth(); | 595 | mMainView->dateNavigator()->selectMonth(); |
593 | 596 | ||
594 | showView(mMonthView, full ); | 597 | showView(mMonthView, full ); |
595 | 598 | ||
596 | } | 599 | } |
597 | 600 | ||
598 | void KOViewManager::showTodoView() | 601 | void KOViewManager::showTodoView() |
599 | { | 602 | { |
600 | //mFlagShowNextxDays = false; | 603 | //mFlagShowNextxDays = false; |
601 | if ( !mTodoView ) { | 604 | if ( !mTodoView ) { |
602 | mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(), | 605 | mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(), |
603 | "KOViewManager::TodoView" ); | 606 | "KOViewManager::TodoView" ); |
604 | 607 | ||
605 | addView( mTodoView ); | 608 | addView( mTodoView ); |
606 | // QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold ); | 609 | // QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold ); |
607 | 610 | ||
608 | // SIGNALS/SLOTS FOR TODO VIEW | 611 | // SIGNALS/SLOTS FOR TODO VIEW |
609 | connect( mTodoView, SIGNAL( newTodoSignal() ), | 612 | connect( mTodoView, SIGNAL( newTodoSignal() ), |
610 | mMainView, SLOT( newTodo() ) ); | 613 | mMainView, SLOT( newTodo() ) ); |
611 | connect( mTodoView, SIGNAL( newSubTodoSignal( Todo * ) ), | 614 | connect( mTodoView, SIGNAL( newSubTodoSignal( Todo * ) ), |
612 | mMainView, SLOT( newSubTodo( Todo *) ) ); | 615 | mMainView, SLOT( newSubTodo( Todo *) ) ); |
613 | connect( mTodoView, SIGNAL( showTodoSignal( Todo *) ), | 616 | connect( mTodoView, SIGNAL( showTodoSignal( Todo *) ), |
614 | mMainView, SLOT( showTodo( Todo * ) ) ); | 617 | mMainView, SLOT( showTodo( Todo * ) ) ); |
615 | connect( mTodoView, SIGNAL( editTodoSignal( Todo * ) ), | 618 | connect( mTodoView, SIGNAL( editTodoSignal( Todo * ) ), |
616 | mMainView, SLOT( editTodo( Todo * ) ) ); | 619 | mMainView, SLOT( editTodo( Todo * ) ) ); |
617 | connect( mTodoView, SIGNAL( deleteTodoSignal( Todo * ) ), | 620 | connect( mTodoView, SIGNAL( deleteTodoSignal( Todo * ) ), |
618 | mMainView, SLOT( deleteTodo( Todo * ) ) ); | 621 | mMainView, SLOT( deleteTodo( Todo * ) ) ); |
619 | connect( mTodoView, SIGNAL( purgeCompletedSignal() ), | 622 | connect( mTodoView, SIGNAL( purgeCompletedSignal() ), |
620 | mMainView, SLOT( purgeCompleted() ) ); | 623 | mMainView, SLOT( purgeCompleted() ) ); |
621 | 624 | ||
622 | connect( mTodoView, SIGNAL( incidenceSelected( Incidence * ) ), | 625 | connect( mTodoView, SIGNAL( incidenceSelected( Incidence * ) ), |
623 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 626 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
624 | 627 | ||
625 | connect( mMainView, SIGNAL( configChanged() ), mTodoView, | 628 | connect( mMainView, SIGNAL( configChanged() ), mTodoView, |
626 | SLOT( updateConfig() ) ); | 629 | SLOT( updateConfig() ) ); |
627 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mTodoView, | 630 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mTodoView, |
628 | SLOT( updateTodo( Todo *, int ) ) ); | 631 | SLOT( updateTodo( Todo *, int ) ) ); |
629 | connect( mTodoView, SIGNAL( todoModifiedSignal( Todo *, int ) ), | 632 | connect( mTodoView, SIGNAL( todoModifiedSignal( Todo *, int ) ), |
630 | mMainView, SIGNAL ( todoModified( Todo *, int ) ) ); | 633 | mMainView, SIGNAL ( todoModified( Todo *, int ) ) ); |
631 | connect( mTodoView, SIGNAL( cloneTodoSignal( Incidence * ) ), | 634 | connect( mTodoView, SIGNAL( cloneTodoSignal( Incidence * ) ), |
632 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); | 635 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); |
633 | connect( mTodoView, SIGNAL( cancelTodoSignal( Incidence * ) ), | 636 | connect( mTodoView, SIGNAL( cancelTodoSignal( Incidence * ) ), |
634 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); | 637 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); |
635 | connect( mTodoView, SIGNAL( unparentTodoSignal( Todo * ) ), | 638 | connect( mTodoView, SIGNAL( unparentTodoSignal( Todo * ) ), |
636 | mMainView, SLOT ( todo_unsub( Todo * ) ) ); | 639 | mMainView, SLOT ( todo_unsub( Todo * ) ) ); |
637 | connect( mTodoView, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), | 640 | connect( mTodoView, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), |
638 | mMainView, SLOT ( todo_resub( Todo *, Todo *) ) ); | 641 | mMainView, SLOT ( todo_resub( Todo *, Todo *) ) ); |
639 | connect( mTodoView, SIGNAL( moveTodoSignal( Incidence * ) ), | 642 | connect( mTodoView, SIGNAL( moveTodoSignal( Incidence * ) ), |
640 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 643 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
641 | connect( mTodoView, SIGNAL( beamTodoSignal( Incidence * ) ), | 644 | connect( mTodoView, SIGNAL( beamTodoSignal( Incidence * ) ), |
642 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 645 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
643 | KConfig *config = KOGlobals::config(); | 646 | KConfig *config = KOGlobals::config(); |
644 | mTodoView->restoreLayout(config,"Todo View"); | 647 | mTodoView->restoreLayout(config,"Todo View"); |
645 | mTodoView->setNavigator( mMainView->dateNavigator() ); | 648 | mTodoView->setNavigator( mMainView->dateNavigator() ); |
646 | } | 649 | } |
647 | 650 | ||
648 | globalFlagBlockAgenda = 1; | 651 | globalFlagBlockAgenda = 1; |
649 | showView( mTodoView, true ); | 652 | showView( mTodoView, true ); |
650 | 653 | ||
651 | } | 654 | } |
652 | 655 | ||
653 | void KOViewManager::showJournalView() | 656 | void KOViewManager::showJournalView() |
654 | { | 657 | { |
655 | //mFlagShowNextxDays = false; | 658 | //mFlagShowNextxDays = false; |
656 | if (!mJournalView) { | 659 | if (!mJournalView) { |
657 | mJournalView = new KOJournalView(mMainView->calendar(),mMainView->viewStack(), | 660 | mJournalView = new KOJournalView(mMainView->calendar(),mMainView->viewStack(), |
658 | "KOViewManager::JournalView"); | 661 | "KOViewManager::JournalView"); |
659 | connect( mMainView, SIGNAL( configChanged() ), mJournalView, | 662 | connect( mMainView, SIGNAL( configChanged() ), mJournalView, |
660 | SLOT( updateConfig() ) ); | 663 | SLOT( updateConfig() ) ); |
661 | connect(mJournalView, SIGNAL(deleteJournal(Journal *) ), mMainView,SLOT(deleteJournal(Journal *)) ); | 664 | connect(mJournalView, SIGNAL(deleteJournal(Journal *) ), mMainView,SLOT(deleteJournal(Journal *)) ); |
662 | addView(mJournalView); | 665 | addView(mJournalView); |
663 | } | 666 | } |
664 | 667 | ||
665 | showView(mJournalView); | 668 | showView(mJournalView); |
666 | mMainView->dateNavigator()->selectDates( 1 ); | 669 | mMainView->dateNavigator()->selectDates( 1 ); |
667 | } | 670 | } |
668 | 671 | ||
669 | void KOViewManager::showTimeSpanView() | 672 | void KOViewManager::showTimeSpanView() |
670 | { | 673 | { |
671 | //mFlagShowNextxDays = false; | 674 | //mFlagShowNextxDays = false; |
672 | if (!mTimeSpanView) { | 675 | if (!mTimeSpanView) { |
673 | mTimeSpanView = new KOTimeSpanView(mMainView->calendar(),mMainView->viewStack(), | 676 | mTimeSpanView = new KOTimeSpanView(mMainView->calendar(),mMainView->viewStack(), |
674 | "KOViewManager::TimeSpanView"); | 677 | "KOViewManager::TimeSpanView"); |
675 | addView(mTimeSpanView); | 678 | addView(mTimeSpanView); |
676 | 679 | ||
677 | mTimeSpanView->readSettings(); | 680 | mTimeSpanView->readSettings(); |
678 | } | 681 | } |
679 | 682 | ||
680 | showView(mTimeSpanView); | 683 | showView(mTimeSpanView); |
681 | } | 684 | } |
682 | 685 | ||
683 | Incidence *KOViewManager::currentSelection() | 686 | Incidence *KOViewManager::currentSelection() |
684 | { | 687 | { |
685 | if (!mCurrentView) return 0; | 688 | if (!mCurrentView) return 0; |
686 | if ( mCurrentView == mListView ) { | 689 | if ( mCurrentView == mListView ) { |
687 | if ( mListView->currentItem() ) | 690 | if ( mListView->currentItem() ) |
688 | return mListView->currentItem(); | 691 | return mListView->currentItem(); |
689 | } | 692 | } |
690 | return mCurrentView->selectedIncidences().first(); | 693 | return mCurrentView->selectedIncidences().first(); |
691 | } | 694 | } |
692 | 695 | ||
693 | QDate KOViewManager::currentSelectionDate() | 696 | QDate KOViewManager::currentSelectionDate() |
694 | { | 697 | { |
695 | QDate qd; | 698 | QDate qd; |
696 | if (mCurrentView) { | 699 | if (mCurrentView) { |
697 | DateList qvl = mCurrentView->selectedDates(); | 700 | DateList qvl = mCurrentView->selectedDates(); |
698 | if (!qvl.isEmpty()) qd = qvl.first(); | 701 | if (!qvl.isEmpty()) qd = qvl.first(); |
699 | } | 702 | } |
700 | return qd; | 703 | return qd; |
701 | } | 704 | } |
702 | 705 | ||
703 | void KOViewManager::addView(KOrg::BaseView *view) | 706 | void KOViewManager::addView(KOrg::BaseView *view) |
704 | { | 707 | { |
705 | #if QT_VERSION >= 0x030000 | 708 | #if QT_VERSION >= 0x030000 |
706 | mMainView->viewStack()->addWidget( view ); | 709 | mMainView->viewStack()->addWidget( view ); |
707 | #else | 710 | #else |
708 | mMainView->viewStack()->addWidget( view, 1 ); | 711 | mMainView->viewStack()->addWidget( view, 1 ); |
709 | #endif | 712 | #endif |
710 | } | 713 | } |
711 | 714 | ||
712 | void KOViewManager::setDocumentId( const QString &id ) | 715 | void KOViewManager::setDocumentId( const QString &id ) |
713 | { | 716 | { |
714 | if (mTodoView) mTodoView->setDocumentId( id ); | 717 | if (mTodoView) mTodoView->setDocumentId( id ); |
715 | } | 718 | } |