author | zautrix <zautrix> | 2005-03-19 12:41:09 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-03-19 12:41:09 (UTC) |
commit | 0aa5a7dce6ac1224395f7cb3fae488ba566f0e38 (patch) (unidiff) | |
tree | b0950df228b2d9d2486977f7906ce4f0d9284cba /korganizer | |
parent | ea9e00a1f70e9c3c855707213b51c6b6d43c330c (diff) | |
download | kdepimpi-0aa5a7dce6ac1224395f7cb3fae488ba566f0e38.zip kdepimpi-0aa5a7dce6ac1224395f7cb3fae488ba566f0e38.tar.gz kdepimpi-0aa5a7dce6ac1224395f7cb3fae488ba566f0e38.tar.bz2 |
agenda fixes
-rw-r--r-- | korganizer/koagendaview.cpp | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index d7ea4d4..e029fdb 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp | |||
@@ -174,348 +174,350 @@ int TimeLabels::minimumWidth() const | |||
174 | 174 | ||
175 | return width; | 175 | return width; |
176 | } | 176 | } |
177 | 177 | ||
178 | /** updates widget's internal state */ | 178 | /** updates widget's internal state */ |
179 | void TimeLabels::updateConfig() | 179 | void TimeLabels::updateConfig() |
180 | { | 180 | { |
181 | // set the font | 181 | // set the font |
182 | // config->setGroup("Fonts"); | 182 | // config->setGroup("Fonts"); |
183 | // QFont font = config->readFontEntry("TimeBar Font"); | 183 | // QFont font = config->readFontEntry("TimeBar Font"); |
184 | setFont(KOPrefs::instance()->mTimeBarFont); | 184 | setFont(KOPrefs::instance()->mTimeBarFont); |
185 | 185 | ||
186 | // update geometry restrictions based on new settings | 186 | // update geometry restrictions based on new settings |
187 | setFixedWidth(minimumWidth()); | 187 | setFixedWidth(minimumWidth()); |
188 | 188 | ||
189 | // update HourSize | 189 | // update HourSize |
190 | mCellHeight = KOPrefs::instance()->mHourSize*4; | 190 | mCellHeight = KOPrefs::instance()->mHourSize*4; |
191 | resizeContents(50,mRows * mCellHeight); | 191 | resizeContents(50,mRows * mCellHeight); |
192 | } | 192 | } |
193 | 193 | ||
194 | /** update time label positions */ | 194 | /** update time label positions */ |
195 | void TimeLabels::positionChanged() | 195 | void TimeLabels::positionChanged() |
196 | { | 196 | { |
197 | int adjustment = mAgenda->contentsY(); | 197 | int adjustment = mAgenda->contentsY(); |
198 | setContentsPos(0, adjustment); | 198 | setContentsPos(0, adjustment); |
199 | } | 199 | } |
200 | 200 | ||
201 | /** */ | 201 | /** */ |
202 | void TimeLabels::setAgenda(KOAgenda* agenda) | 202 | void TimeLabels::setAgenda(KOAgenda* agenda) |
203 | { | 203 | { |
204 | mAgenda = agenda; | 204 | mAgenda = agenda; |
205 | } | 205 | } |
206 | 206 | ||
207 | void TimeLabels::contentsMousePressEvent ( QMouseEvent * e) | 207 | void TimeLabels::contentsMousePressEvent ( QMouseEvent * e) |
208 | { | 208 | { |
209 | mMouseDownY = e->pos().y(); | 209 | mMouseDownY = e->pos().y(); |
210 | mOrgCap = topLevelWidget()->caption(); | 210 | mOrgCap = topLevelWidget()->caption(); |
211 | } | 211 | } |
212 | 212 | ||
213 | void TimeLabels::contentsMouseMoveEvent ( QMouseEvent * e ) | 213 | void TimeLabels::contentsMouseMoveEvent ( QMouseEvent * e ) |
214 | { | 214 | { |
215 | int diff = mMouseDownY - e->pos().y(); | 215 | int diff = mMouseDownY - e->pos().y(); |
216 | if ( diff < 10 && diff > -10 ) | 216 | if ( diff < 10 && diff > -10 ) |
217 | return; | 217 | return; |
218 | int tSize = KOPrefs::instance()->mHourSize + (diff/10) ; | 218 | int tSize = KOPrefs::instance()->mHourSize + (diff/10) ; |
219 | if ( tSize < 4 ) | 219 | if ( tSize < 4 ) |
220 | tSize = 4; | 220 | tSize = 4; |
221 | if ( tSize > 22 ) | 221 | if ( tSize > 22 ) |
222 | tSize = 22; | 222 | tSize = 22; |
223 | tSize = (tSize-2)/2; | 223 | tSize = (tSize-2)/2; |
224 | topLevelWidget()->setCaption(i18n("New Agendasize: %1").arg(tSize)); | 224 | topLevelWidget()->setCaption(i18n("New Agendasize: %1").arg(tSize)); |
225 | 225 | ||
226 | } | 226 | } |
227 | void TimeLabels::contentsMouseReleaseEvent ( QMouseEvent * e ) | 227 | void TimeLabels::contentsMouseReleaseEvent ( QMouseEvent * e ) |
228 | { | 228 | { |
229 | topLevelWidget()->setCaption( mOrgCap ); | 229 | topLevelWidget()->setCaption( mOrgCap ); |
230 | int diff = mMouseDownY - e->pos().y(); | 230 | int diff = mMouseDownY - e->pos().y(); |
231 | if ( diff < 10 && diff > -10 ) | 231 | if ( diff < 10 && diff > -10 ) |
232 | return; | 232 | return; |
233 | int tSize = KOPrefs::instance()->mHourSize + (diff/10); | 233 | int tSize = KOPrefs::instance()->mHourSize + (diff/10); |
234 | if ( tSize < 4 ) | 234 | if ( tSize < 4 ) |
235 | tSize = 4; | 235 | tSize = 4; |
236 | if ( tSize > 22 ) | 236 | if ( tSize > 22 ) |
237 | tSize = 22; | 237 | tSize = 22; |
238 | tSize = (tSize/2)*2; | 238 | tSize = (tSize/2)*2; |
239 | if ( tSize == KOPrefs::instance()->mHourSize ) | 239 | if ( tSize == KOPrefs::instance()->mHourSize ) |
240 | return; | 240 | return; |
241 | KOPrefs::instance()->mHourSize = tSize; | 241 | KOPrefs::instance()->mHourSize = tSize; |
242 | emit scaleChanged(); | 242 | emit scaleChanged(); |
243 | } | 243 | } |
244 | 244 | ||
245 | /** This is called in response to repaint() */ | 245 | /** This is called in response to repaint() */ |
246 | void TimeLabels::paintEvent(QPaintEvent*) | 246 | void TimeLabels::paintEvent(QPaintEvent*) |
247 | { | 247 | { |
248 | 248 | ||
249 | // kdDebug() << "paintevent..." << endl; | 249 | // kdDebug() << "paintevent..." << endl; |
250 | // this is another hack! | 250 | // this is another hack! |
251 | // QPainter painter(this); | 251 | // QPainter painter(this); |
252 | //QString c | 252 | //QString c |
253 | repaintContents(contentsX(), contentsY(), visibleWidth(), visibleHeight()); | 253 | repaintContents(contentsX(), contentsY(), visibleWidth(), visibleHeight()); |
254 | } | 254 | } |
255 | 255 | ||
256 | //////////////////////////////////////////////////////////////////////////// | 256 | //////////////////////////////////////////////////////////////////////////// |
257 | 257 | ||
258 | EventIndicator::EventIndicator(Location loc,QWidget *parent,const char *name) | 258 | EventIndicator::EventIndicator(Location loc,QWidget *parent,const char *name) |
259 | : QFrame(parent,name) | 259 | : QFrame(parent,name) |
260 | { | 260 | { |
261 | mColumns = 1; | 261 | mColumns = 1; |
262 | mTopBox = 0; | 262 | mTopBox = 0; |
263 | mLocation = loc; | 263 | mLocation = loc; |
264 | mTopLayout = 0; | 264 | mTopLayout = 0; |
265 | mPaintWidget = 0; | 265 | mPaintWidget = 0; |
266 | mXOffset = 0; | 266 | mXOffset = 0; |
267 | if (mLocation == Top) mPixmap = SmallIcon("1uparrow"); | 267 | if (mLocation == Top) mPixmap = SmallIcon("1uparrow"); |
268 | else mPixmap = SmallIcon("1downarrow"); | 268 | else mPixmap = SmallIcon("1downarrow"); |
269 | mEnabled.resize(mColumns); | 269 | mEnabled.resize(mColumns); |
270 | if (mLocation == Top) | 270 | setMinimumHeight(mPixmap.height()); |
271 | setMaximumHeight(0); | ||
272 | else | ||
273 | setMinimumHeight(mPixmap.height()); | ||
274 | } | 271 | } |
275 | 272 | ||
276 | EventIndicator::~EventIndicator() | 273 | EventIndicator::~EventIndicator() |
277 | { | 274 | { |
278 | } | 275 | } |
279 | 276 | ||
280 | void EventIndicator::drawContents(QPainter *p) | 277 | void EventIndicator::drawContents(QPainter *p) |
281 | { | 278 | { |
282 | 279 | ||
283 | // kdDebug() << "======== top: " << contentsRect().top() << " bottom " << // contentsRect().bottom() << " left " << contentsRect().left() << " right " << contentsRect().right() << endl; | 280 | // kdDebug() << "======== top: " << contentsRect().top() << " bottom " << // contentsRect().bottom() << " left " << contentsRect().left() << " right " << contentsRect().right() << endl; |
284 | KDGanttSplitterHandle* han = 0; | 281 | KDGanttSplitterHandle* han = 0; |
285 | if ( mPaintWidget ) | 282 | if ( mPaintWidget ) |
286 | han = mPaintWidget->firstHandle(); | 283 | han = mPaintWidget->firstHandle(); |
287 | if ( ! han ) { | 284 | if ( ! han ) { |
288 | int i; | 285 | int i; |
289 | for(i=0;i<mColumns;++i) { | 286 | for(i=0;i<mColumns;++i) { |
290 | if (mEnabled[i]) { | 287 | if (mEnabled[i]) { |
291 | int cellWidth = contentsRect().right()/mColumns; | 288 | int cellWidth = contentsRect().right()/mColumns; |
292 | int xOffset = KOGlobals::self()->reverseLayout() ? | 289 | int xOffset = KOGlobals::self()->reverseLayout() ? |
293 | (mColumns - 1 - i)*cellWidth + cellWidth/2 -mPixmap.width()/2 : | 290 | (mColumns - 1 - i)*cellWidth + (cellWidth -mPixmap.width())/2 : |
294 | i*cellWidth + cellWidth/2 -mPixmap.width()/2; | 291 | i*cellWidth + (cellWidth -mPixmap.width()) /2; |
295 | p->drawPixmap(QPoint(xOffset,0),mPixmap); | 292 | p->drawPixmap(QPoint(1+xOffset,0),mPixmap); |
296 | } | 293 | } |
297 | } | 294 | } |
298 | } else { | 295 | } else { |
299 | han->repaint(); | 296 | han->repaint(); |
300 | //mPaintWidget->setBackgroundColor( red ); | 297 | //mPaintWidget->setBackgroundColor( red ); |
301 | 298 | ||
302 | QPainter pa( han ); | 299 | QPainter pa( han ); |
303 | int i; | 300 | int i; |
304 | bool setColor = false; | 301 | bool setColor = false; |
305 | for(i=0;i<mColumns;++i) { | 302 | for(i=0;i<mColumns;++i) { |
306 | if (mEnabled[i]) { | 303 | if (mEnabled[i]) { |
307 | setColor = true; | 304 | setColor = true; |
308 | 305 | ||
309 | int cellWidth = contentsRect().right()/mColumns; | 306 | int cellWidth = contentsRect().right()/mColumns; |
310 | int xOffset = KOGlobals::self()->reverseLayout() ? | 307 | int xOffset = KOGlobals::self()->reverseLayout() ? |
311 | (mColumns - 1 - i)*cellWidth + cellWidth/2 -mPixmap.width()/2 : | 308 | (mColumns - 1 - i)*cellWidth + cellWidth/2 -mPixmap.width()/2 : |
312 | i*cellWidth + cellWidth/2 -mPixmap.width()/2; | 309 | i*cellWidth + cellWidth/2 -mPixmap.width()/2; |
313 | pa.drawPixmap(QPoint(mXOffset + xOffset,0),mPixmap); | 310 | pa.drawPixmap(QPoint(mXOffset + xOffset,0),mPixmap); |
314 | //qDebug("222draw pix %d ",xOffset ); | 311 | //qDebug("222draw pix %d ",xOffset ); |
315 | 312 | ||
316 | } | 313 | } |
317 | 314 | ||
318 | } | 315 | } |
319 | pa.end(); | 316 | pa.end(); |
320 | 317 | ||
321 | } | 318 | } |
322 | } | 319 | } |
323 | 320 | ||
324 | void EventIndicator::setXOffset( int x ) | 321 | void EventIndicator::setXOffset( int x ) |
325 | { | 322 | { |
326 | mXOffset = x; | 323 | mXOffset = x; |
327 | } | 324 | } |
328 | void EventIndicator::setPaintWidget( KDGanttMinimizeSplitter * w ) | 325 | void EventIndicator::setPaintWidget( KDGanttMinimizeSplitter * w ) |
329 | { | 326 | { |
330 | mPaintWidget = w; | 327 | mPaintWidget = w; |
328 | setMaximumHeight(0); | ||
329 | setMinimumHeight(0); | ||
331 | } | 330 | } |
332 | void EventIndicator::changeColumns(int columns) | 331 | void EventIndicator::changeColumns(int columns) |
333 | { | 332 | { |
334 | mColumns = columns; | 333 | mColumns = columns; |
335 | mEnabled.resize(mColumns); | 334 | mEnabled.resize(mColumns); |
336 | 335 | ||
337 | update(); | 336 | update(); |
338 | } | 337 | } |
339 | 338 | ||
340 | void EventIndicator::enableColumn(int column, bool enable) | 339 | void EventIndicator::enableColumn(int column, bool enable) |
341 | { | 340 | { |
342 | mEnabled[column] = enable; | 341 | mEnabled[column] = enable; |
343 | } | 342 | } |
344 | 343 | ||
345 | 344 | ||
346 | //////////////////////////////////////////////////////////////////////////// | 345 | //////////////////////////////////////////////////////////////////////////// |
347 | //////////////////////////////////////////////////////////////////////////// | 346 | //////////////////////////////////////////////////////////////////////////// |
348 | //////////////////////////////////////////////////////////////////////////// | 347 | //////////////////////////////////////////////////////////////////////////// |
349 | 348 | ||
350 | KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : | 349 | KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : |
351 | KOEventView (cal,parent,name) | 350 | KOEventView (cal,parent,name) |
352 | { | 351 | { |
353 | mBlockUpdating = true; | 352 | mBlockUpdating = true; |
354 | mStartHour = 8; | 353 | mStartHour = 8; |
355 | mSelectedDates.append(QDate::currentDate()); | 354 | mSelectedDates.append(QDate::currentDate()); |
356 | 355 | ||
357 | mLayoutDayLabels = 0; | 356 | mLayoutDayLabels = 0; |
358 | mDayLabelsFrame = 0; | 357 | mDayLabelsFrame = 0; |
359 | mDayLabels = 0; | 358 | mDayLabels = 0; |
360 | bool isRTL = KOGlobals::self()->reverseLayout(); | 359 | bool isRTL = KOGlobals::self()->reverseLayout(); |
361 | 360 | ||
362 | if ( KOPrefs::instance()->mVerticalScreen ) { | 361 | if ( KOPrefs::instance()->mVerticalScreen ) { |
363 | mExpandedPixmap = SmallIcon( "1downarrow" ); | 362 | mExpandedPixmap = SmallIcon( "1downarrow" ); |
364 | mNotExpandedPixmap = SmallIcon( "1uparrow" ); | 363 | mNotExpandedPixmap = SmallIcon( "1uparrow" ); |
365 | } else { | 364 | } else { |
366 | mExpandedPixmap = SmallIcon( isRTL ? "1leftarrow" : "1rightarrow" ); | 365 | mExpandedPixmap = SmallIcon( isRTL ? "1leftarrow" : "1rightarrow" ); |
367 | mNotExpandedPixmap = SmallIcon( isRTL ? "1rightarrow" : "1leftarrow" ); | 366 | mNotExpandedPixmap = SmallIcon( isRTL ? "1rightarrow" : "1leftarrow" ); |
368 | } | 367 | } |
369 | 368 | ||
370 | QBoxLayout *topLayout = new QVBoxLayout(this); | 369 | QBoxLayout *topLayout = new QVBoxLayout(this); |
371 | 370 | ||
372 | // Create day name labels for agenda columns | 371 | // Create day name labels for agenda columns |
373 | // Create agenda splitter | 372 | // Create agenda splitter |
374 | 373 | ||
375 | mSplitterAgenda = new KDGanttMinimizeSplitter( Qt::Vertical, this); | 374 | mSplitterAgenda = new KDGanttMinimizeSplitter( Qt::Vertical, this); |
376 | mSplitterAgenda->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); | 375 | mSplitterAgenda->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); |
377 | topLayout->addWidget( mSplitterAgenda ); | 376 | topLayout->addWidget( mSplitterAgenda ); |
378 | mAllDayFrame = new QHBox(mSplitterAgenda); | 377 | mAllDayFrame = new QHBox(mSplitterAgenda); |
379 | mAllDayFrame->setFocusPolicy(NoFocus); | 378 | mAllDayFrame->setFocusPolicy(NoFocus); |
380 | QWidget *agendaFrame = new QWidget(mSplitterAgenda); | 379 | QWidget *agendaFrame = new QWidget(mSplitterAgenda); |
381 | agendaFrame->setFocusPolicy(NoFocus); | 380 | agendaFrame->setFocusPolicy(NoFocus); |
382 | 381 | ||
383 | // Create all-day agenda widget | 382 | // Create all-day agenda widget |
384 | mDummyAllDayLeft = new QVBox( mAllDayFrame ); | 383 | mDummyAllDayLeft = new QVBox( mAllDayFrame ); |
385 | 384 | ||
386 | mExpandButton = new QPushButton(mDummyAllDayLeft); | 385 | mExpandButton = new QPushButton(mDummyAllDayLeft); |
387 | mExpandButton->setPixmap( mNotExpandedPixmap ); | 386 | mExpandButton->setPixmap( mNotExpandedPixmap ); |
388 | int widebut = mExpandButton->sizeHint().width(); | 387 | int widebut = mExpandButton->sizeHint().width(); |
389 | if ( QApplication::desktop()->width() < 480 ) | 388 | if ( QApplication::desktop()->width() < 480 ) |
390 | widebut = widebut*2; | 389 | widebut = widebut*2; |
391 | else | 390 | else |
392 | widebut = (widebut*3) / 2; | 391 | widebut = (widebut*3) / 2; |
393 | //mExpandButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, | 392 | //mExpandButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, |
394 | // QSizePolicy::Fixed ) ); | 393 | // QSizePolicy::Fixed ) ); |
395 | mExpandButton->setFixedSize( widebut, widebut); | 394 | mExpandButton->setFixedSize( widebut, widebut); |
396 | connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) ); | 395 | connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) ); |
397 | mExpandButton->setFocusPolicy(NoFocus); | 396 | mExpandButton->setFocusPolicy(NoFocus); |
398 | mAllDayAgenda = new KOAgenda(1,mAllDayFrame); | 397 | mAllDayAgenda = new KOAgenda(1,mAllDayFrame); |
399 | mAllDayAgenda->setFocusPolicy(NoFocus); | 398 | mAllDayAgenda->setFocusPolicy(NoFocus); |
400 | QLabel *dummyAllDayRight = new QLabel (mAllDayFrame); | 399 | QLabel *dummyAllDayRight = new QLabel (mAllDayFrame); |
401 | 400 | ||
402 | // Create event context menu for all day agenda | 401 | // Create event context menu for all day agenda |
403 | mAllDayAgendaPopup = eventPopup(); | 402 | mAllDayAgendaPopup = eventPopup(); |
404 | connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), | 403 | connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), |
405 | mAllDayAgendaPopup,SLOT(showIncidencePopup(Incidence *))); | 404 | mAllDayAgendaPopup,SLOT(showIncidencePopup(Incidence *))); |
406 | 405 | ||
407 | // Create agenda frame | 406 | // Create agenda frame |
408 | QGridLayout *agendaLayout = new QGridLayout(agendaFrame,4,3); | 407 | QGridLayout *agendaLayout = new QGridLayout(agendaFrame,4,3); |
409 | // QHBox *agendaFrame = new QHBox(splitterAgenda); | 408 | // QHBox *agendaFrame = new QHBox(splitterAgenda); |
410 | 409 | ||
411 | // create event indicator bars | 410 | // create event indicator bars |
412 | mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame); | 411 | mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame); |
413 | agendaLayout->addWidget(mEventIndicatorTop,0,1); | 412 | #ifndef DESKTOP_VERSION |
414 | 413 | // FIX | |
414 | mEventIndicatorTop->setPaintWidget( mSplitterAgenda ); | ||
415 | #endif | ||
415 | mDayLabelsFrame = new QHBox(agendaFrame); | 416 | mDayLabelsFrame = new QHBox(agendaFrame); |
416 | //topLayout->addWidget(mDayLabelsFrame); | 417 | //topLayout->addWidget(mDayLabelsFrame); |
417 | mDayLabels = new QFrame (mDayLabelsFrame); | 418 | mDayLabels = new QFrame (mDayLabelsFrame); |
418 | mLayoutDayLabels = new QHBoxLayout(mDayLabels); | 419 | mLayoutDayLabels = new QHBoxLayout(mDayLabels); |
419 | agendaLayout->addMultiCellWidget(mDayLabelsFrame ,1,1,0,2); | 420 | agendaLayout->addMultiCellWidget(mDayLabelsFrame ,0,0,0,2); |
420 | mEventIndicatorTop->setPaintWidget( mSplitterAgenda ); | 421 | agendaLayout->addWidget(mEventIndicatorTop,1,1); |
422 | |||
421 | mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom, | 423 | mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom, |
422 | agendaFrame); | 424 | agendaFrame); |
423 | agendaLayout->addWidget(mEventIndicatorBottom,3,1); | 425 | agendaLayout->addWidget(mEventIndicatorBottom,3,1); |
424 | QWidget *dummyAgendaRight = new QWidget(agendaFrame); | 426 | QWidget *dummyAgendaRight = new QWidget(agendaFrame); |
425 | agendaLayout->addWidget(dummyAgendaRight,0,2); | 427 | agendaLayout->addWidget(dummyAgendaRight,1,2); |
426 | 428 | ||
427 | // Create time labels | 429 | // Create time labels |
428 | mTimeLabels = new TimeLabels(24,agendaFrame); | 430 | mTimeLabels = new TimeLabels(24,agendaFrame); |
429 | agendaLayout->addWidget(mTimeLabels,2,0); | 431 | agendaLayout->addWidget(mTimeLabels,2,0); |
430 | connect(mTimeLabels,SIGNAL( scaleChanged()), | 432 | connect(mTimeLabels,SIGNAL( scaleChanged()), |
431 | this,SLOT(updateConfig())); | 433 | this,SLOT(updateConfig())); |
432 | 434 | ||
433 | // Create agenda | 435 | // Create agenda |
434 | mAgenda = new KOAgenda(1,96,KOPrefs::instance()->mHourSize,agendaFrame); | 436 | mAgenda = new KOAgenda(1,96,KOPrefs::instance()->mHourSize,agendaFrame); |
435 | agendaLayout->addMultiCellWidget(mAgenda,2,2,1,2); | 437 | agendaLayout->addMultiCellWidget(mAgenda,2,2,1,2); |
436 | agendaLayout->setColStretch(1,1); | 438 | agendaLayout->setColStretch(1,1); |
437 | mAgenda->setFocusPolicy(NoFocus); | 439 | mAgenda->setFocusPolicy(NoFocus); |
438 | // Create event context menu for agenda | 440 | // Create event context menu for agenda |
439 | mAgendaPopup = eventPopup(); | 441 | mAgendaPopup = eventPopup(); |
440 | 442 | ||
441 | mAgendaPopup->addAdditionalItem(QIconSet(SmallIcon("bell")), | 443 | mAgendaPopup->addAdditionalItem(QIconSet(SmallIcon("bell")), |
442 | i18n("Toggle Alarm"),mAgenda, | 444 | i18n("Toggle Alarm"),mAgenda, |
443 | SLOT(popupAlarm()),true); | 445 | SLOT(popupAlarm()),true); |
444 | 446 | ||
445 | 447 | ||
446 | connect(mAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), | 448 | connect(mAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), |
447 | mAgendaPopup,SLOT(showIncidencePopup(Incidence *))); | 449 | mAgendaPopup,SLOT(showIncidencePopup(Incidence *))); |
448 | 450 | ||
449 | // make connections between dependent widgets | 451 | // make connections between dependent widgets |
450 | mTimeLabels->setAgenda(mAgenda); | 452 | mTimeLabels->setAgenda(mAgenda); |
451 | 453 | ||
452 | // Update widgets to reflect user preferences | 454 | // Update widgets to reflect user preferences |
453 | // updateConfig(); | 455 | // updateConfig(); |
454 | 456 | ||
455 | // createDayLabels(); | 457 | // createDayLabels(); |
456 | 458 | ||
457 | // these blank widgets make the All Day Event box line up with the agenda | 459 | // these blank widgets make the All Day Event box line up with the agenda |
458 | dummyAllDayRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); | 460 | dummyAllDayRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); |
459 | dummyAgendaRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); | 461 | dummyAgendaRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); |
460 | mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); | 462 | mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); |
461 | 463 | ||
462 | // Scrolling | 464 | // Scrolling |
463 | connect(mAgenda->verticalScrollBar(),SIGNAL(valueChanged(int)), | 465 | connect(mAgenda->verticalScrollBar(),SIGNAL(valueChanged(int)), |
464 | mTimeLabels, SLOT(positionChanged())); | 466 | mTimeLabels, SLOT(positionChanged())); |
465 | connect(mTimeLabels->verticalScrollBar(),SIGNAL(valueChanged(int)), | 467 | connect(mTimeLabels->verticalScrollBar(),SIGNAL(valueChanged(int)), |
466 | SLOT(setContentsPos(int))); | 468 | SLOT(setContentsPos(int))); |
467 | 469 | ||
468 | connect(mAgenda,SIGNAL(showDateView( int, QDate )),SIGNAL(showDateView( int, QDate ))); | 470 | connect(mAgenda,SIGNAL(showDateView( int, QDate )),SIGNAL(showDateView( int, QDate ))); |
469 | connect(mAllDayAgenda,SIGNAL(showDateView( int, QDate )),SIGNAL(showDateView( int, QDate ))); | 471 | connect(mAllDayAgenda,SIGNAL(showDateView( int, QDate )),SIGNAL(showDateView( int, QDate ))); |
470 | 472 | ||
471 | // Create/Show/Edit/Delete Event | 473 | // Create/Show/Edit/Delete Event |
472 | connect(mAgenda,SIGNAL(newEventSignal(int,int)), | 474 | connect(mAgenda,SIGNAL(newEventSignal(int,int)), |
473 | SLOT(newEvent(int,int))); | 475 | SLOT(newEvent(int,int))); |
474 | connect(mAgenda,SIGNAL(newTodoSignal(int,int)), | 476 | connect(mAgenda,SIGNAL(newTodoSignal(int,int)), |
475 | SLOT(newTodo(int,int))); | 477 | SLOT(newTodo(int,int))); |
476 | connect(mAgenda,SIGNAL(newEventSignal(int,int,int,int)), | 478 | connect(mAgenda,SIGNAL(newEventSignal(int,int,int,int)), |
477 | SLOT(newEvent(int,int,int,int))); | 479 | SLOT(newEvent(int,int,int,int))); |
478 | connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int)), | 480 | connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int)), |
479 | SLOT(newEventAllDay(int,int))); | 481 | SLOT(newEventAllDay(int,int))); |
480 | connect(mAllDayAgenda,SIGNAL(newTodoSignal(int,int)), | 482 | connect(mAllDayAgenda,SIGNAL(newTodoSignal(int,int)), |
481 | SLOT(newTodoAllDay(int,int))); | 483 | SLOT(newTodoAllDay(int,int))); |
482 | connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int,int,int)), | 484 | connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int,int,int)), |
483 | SLOT(newEventAllDay(int,int))); | 485 | SLOT(newEventAllDay(int,int))); |
484 | connect(mAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), | 486 | connect(mAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), |
485 | SLOT(newTimeSpanSelected(int,int,int,int))); | 487 | SLOT(newTimeSpanSelected(int,int,int,int))); |
486 | connect(mAllDayAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), | 488 | connect(mAllDayAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), |
487 | SLOT(newTimeSpanSelectedAllDay(int,int,int,int))); | 489 | SLOT(newTimeSpanSelectedAllDay(int,int,int,int))); |
488 | connect(mAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); | 490 | connect(mAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); |
489 | connect(mAllDayAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); | 491 | connect(mAllDayAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); |
490 | 492 | ||
491 | connect(mAgenda,SIGNAL(editIncidenceSignal(Incidence *)), | 493 | connect(mAgenda,SIGNAL(editIncidenceSignal(Incidence *)), |
492 | SIGNAL(editIncidenceSignal(Incidence *))); | 494 | SIGNAL(editIncidenceSignal(Incidence *))); |
493 | connect(mAllDayAgenda,SIGNAL(editIncidenceSignal(Incidence *)), | 495 | connect(mAllDayAgenda,SIGNAL(editIncidenceSignal(Incidence *)), |
494 | SIGNAL(editIncidenceSignal(Incidence *))); | 496 | SIGNAL(editIncidenceSignal(Incidence *))); |
495 | connect(mAgenda,SIGNAL(showIncidenceSignal(Incidence *)), | 497 | connect(mAgenda,SIGNAL(showIncidenceSignal(Incidence *)), |
496 | SIGNAL(showIncidenceSignal(Incidence *))); | 498 | SIGNAL(showIncidenceSignal(Incidence *))); |
497 | connect(mAllDayAgenda,SIGNAL(showIncidenceSignal(Incidence *)), | 499 | connect(mAllDayAgenda,SIGNAL(showIncidenceSignal(Incidence *)), |
498 | SIGNAL(showIncidenceSignal(Incidence *))); | 500 | SIGNAL(showIncidenceSignal(Incidence *))); |
499 | connect(mAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), | 501 | connect(mAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), |
500 | SIGNAL(deleteIncidenceSignal(Incidence *))); | 502 | SIGNAL(deleteIncidenceSignal(Incidence *))); |
501 | connect(mAllDayAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), | 503 | connect(mAllDayAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), |
502 | SIGNAL(deleteIncidenceSignal(Incidence *))); | 504 | SIGNAL(deleteIncidenceSignal(Incidence *))); |
503 | 505 | ||
504 | connect(mAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), | 506 | connect(mAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), |
505 | SLOT(updateEventDates(KOAgendaItem *, int ))); | 507 | SLOT(updateEventDates(KOAgendaItem *, int ))); |
506 | connect(mAllDayAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), | 508 | connect(mAllDayAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), |
507 | SLOT(updateEventDates(KOAgendaItem *, int))); | 509 | SLOT(updateEventDates(KOAgendaItem *, int))); |
508 | 510 | ||
509 | // event indicator update | 511 | // event indicator update |
510 | connect(mAgenda,SIGNAL(lowerYChanged(int)), | 512 | connect(mAgenda,SIGNAL(lowerYChanged(int)), |
511 | SLOT(updateEventIndicatorTop(int))); | 513 | SLOT(updateEventIndicatorTop(int))); |
512 | connect(mAgenda,SIGNAL(upperYChanged(int)), | 514 | connect(mAgenda,SIGNAL(upperYChanged(int)), |
513 | SLOT(updateEventIndicatorBottom(int))); | 515 | SLOT(updateEventIndicatorBottom(int))); |
514 | // drag signals | 516 | // drag signals |
515 | /* | 517 | /* |
516 | connect(mAgenda,SIGNAL(startDragSignal(Event *)), | 518 | connect(mAgenda,SIGNAL(startDragSignal(Event *)), |
517 | SLOT(startDrag(Event *))); | 519 | SLOT(startDrag(Event *))); |
518 | connect(mAllDayAgenda,SIGNAL(startDragSignal(Event *)), | 520 | connect(mAllDayAgenda,SIGNAL(startDragSignal(Event *)), |
519 | SLOT(startDrag(Event *))); | 521 | SLOT(startDrag(Event *))); |
520 | */ | 522 | */ |
521 | // synchronize selections | 523 | // synchronize selections |