author | zautrix <zautrix> | 2005-02-06 15:21:01 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-02-06 15:21:01 (UTC) |
commit | 38898c49275bf27fb8c2df96d145f2a5abb62331 (patch) (unidiff) | |
tree | b96f0a336fccf4d6c67e6a4b5c1239b4d647b3b9 /korganizer | |
parent | 26b0c69fb3b11c29475ec02b2cfe52e33eb24e5f (diff) | |
download | kdepimpi-38898c49275bf27fb8c2df96d145f2a5abb62331.zip kdepimpi-38898c49275bf27fb8c2df96d145f2a5abb62331.tar.gz kdepimpi-38898c49275bf27fb8c2df96d145f2a5abb62331.tar.bz2 |
fixxeess
-rw-r--r-- | korganizer/koeditorgeneraltodo.cpp | 2 | ||||
-rw-r--r-- | korganizer/komonthview.cpp | 96 | ||||
-rw-r--r-- | korganizer/komonthview.h | 3 | ||||
-rw-r--r-- | korganizer/koviewmanager.cpp | 3 |
4 files changed, 59 insertions, 45 deletions
diff --git a/korganizer/koeditorgeneraltodo.cpp b/korganizer/koeditorgeneraltodo.cpp index ce66863..da5ef07 100644 --- a/korganizer/koeditorgeneraltodo.cpp +++ b/korganizer/koeditorgeneraltodo.cpp | |||
@@ -135,65 +135,65 @@ void KOEditorGeneralTodo::initCompletion(QWidget *parent, QBoxLayout *topLayout) | |||
135 | mCompletedCombo = new QComboBox(parent); | 135 | mCompletedCombo = new QComboBox(parent); |
136 | // xgettext:no-c-format | 136 | // xgettext:no-c-format |
137 | mCompletedCombo->insertItem(i18n(" 0 %")); | 137 | mCompletedCombo->insertItem(i18n(" 0 %")); |
138 | // xgettext:no-c-format | 138 | // xgettext:no-c-format |
139 | mCompletedCombo->insertItem(i18n(" 20 %")); | 139 | mCompletedCombo->insertItem(i18n(" 20 %")); |
140 | // xgettext:no-c-format | 140 | // xgettext:no-c-format |
141 | mCompletedCombo->insertItem(i18n(" 40 %")); | 141 | mCompletedCombo->insertItem(i18n(" 40 %")); |
142 | // xgettext:no-c-format | 142 | // xgettext:no-c-format |
143 | mCompletedCombo->insertItem(i18n(" 60 %")); | 143 | mCompletedCombo->insertItem(i18n(" 60 %")); |
144 | // xgettext:no-c-format | 144 | // xgettext:no-c-format |
145 | mCompletedCombo->insertItem(i18n(" 80 %")); | 145 | mCompletedCombo->insertItem(i18n(" 80 %")); |
146 | // xgettext:no-c-format | 146 | // xgettext:no-c-format |
147 | mCompletedCombo->insertItem(i18n("100 %")); | 147 | mCompletedCombo->insertItem(i18n("100 %")); |
148 | connect(mCompletedCombo,SIGNAL(activated(int)),SLOT(completedChanged(int))); | 148 | connect(mCompletedCombo,SIGNAL(activated(int)),SLOT(completedChanged(int))); |
149 | topLayout->addWidget(mCompletedCombo); | 149 | topLayout->addWidget(mCompletedCombo); |
150 | 150 | ||
151 | mCompletedLabel = new QLabel(i18n("completed"),parent); | 151 | mCompletedLabel = new QLabel(i18n("completed"),parent); |
152 | topLayout->addWidget(mCompletedLabel); | 152 | topLayout->addWidget(mCompletedLabel); |
153 | 153 | ||
154 | mCompleteDateEdit = new KDateEdit(parent); | 154 | mCompleteDateEdit = new KDateEdit(parent); |
155 | topLayout->addWidget(mCompleteDateEdit ); | 155 | topLayout->addWidget(mCompleteDateEdit ); |
156 | 156 | ||
157 | mCompleteTimeEdit = new KOTimeEdit(parent); | 157 | mCompleteTimeEdit = new KOTimeEdit(parent); |
158 | topLayout->addWidget( mCompleteTimeEdit); | 158 | topLayout->addWidget( mCompleteTimeEdit); |
159 | 159 | ||
160 | mCompletedCombo->setSizePolicy( QSizePolicy( QSizePolicy::Preferred,QSizePolicy::Preferred) ); | 160 | mCompletedCombo->setSizePolicy( QSizePolicy( QSizePolicy::Preferred,QSizePolicy::Preferred) ); |
161 | mCompletedLabel->setSizePolicy( QSizePolicy( QSizePolicy::Expanding,QSizePolicy::Preferred) ); | 161 | mCompletedLabel->setSizePolicy( QSizePolicy( QSizePolicy::Expanding,QSizePolicy::Preferred) ); |
162 | 162 | ||
163 | if ( QApplication::desktop()->width() <= 480 ) { | 163 | if ( QApplication::desktop()->width() <= 480 ) { |
164 | if ( QApplication::desktop()->width() < 320 ) | 164 | if ( QApplication::desktop()->width() < 320 ) |
165 | mCompleteDateEdit->setMaximumWidth( 85 ); | 165 | mCompleteDateEdit->setMaximumWidth( 85 ); |
166 | else | 166 | else |
167 | mCompleteDateEdit->setMaximumWidth( 130 ); | 167 | mCompleteDateEdit->setMaximumWidth( 140 ); |
168 | topLayout->setSpacing( 0 ); | 168 | topLayout->setSpacing( 0 ); |
169 | } | 169 | } |
170 | } | 170 | } |
171 | 171 | ||
172 | void KOEditorGeneralTodo::initPriority(QWidget *parent, QBoxLayout *topLayout) | 172 | void KOEditorGeneralTodo::initPriority(QWidget *parent, QBoxLayout *topLayout) |
173 | { | 173 | { |
174 | 174 | ||
175 | QHBox* h = new QHBox ( parent ); | 175 | QHBox* h = new QHBox ( parent ); |
176 | topLayout->addWidget( h ); | 176 | topLayout->addWidget( h ); |
177 | QLabel *priorityLabel = new QLabel(i18n("Priority:"), h); | 177 | QLabel *priorityLabel = new QLabel(i18n("Priority:"), h); |
178 | // topLayout->addWidget(priorityLabel); | 178 | // topLayout->addWidget(priorityLabel); |
179 | mPriorityCombo = new QComboBox( h ); | 179 | mPriorityCombo = new QComboBox( h ); |
180 | mPriorityCombo->insertItem(i18n("1 (high)")); | 180 | mPriorityCombo->insertItem(i18n("1 (high)")); |
181 | mPriorityCombo->insertItem(i18n("2")); | 181 | mPriorityCombo->insertItem(i18n("2")); |
182 | mPriorityCombo->insertItem(i18n("3")); | 182 | mPriorityCombo->insertItem(i18n("3")); |
183 | mPriorityCombo->insertItem(i18n("4")); | 183 | mPriorityCombo->insertItem(i18n("4")); |
184 | mPriorityCombo->insertItem(i18n("5 (low)")); | 184 | mPriorityCombo->insertItem(i18n("5 (low)")); |
185 | //topLayout->addWidget(mPriorityCombo); | 185 | //topLayout->addWidget(mPriorityCombo); |
186 | } | 186 | } |
187 | 187 | ||
188 | void KOEditorGeneralTodo::initStatus(QWidget *parent,QBoxLayout *topLayout) | 188 | void KOEditorGeneralTodo::initStatus(QWidget *parent,QBoxLayout *topLayout) |
189 | { | 189 | { |
190 | QBoxLayout *statusLayout = new QHBoxLayout(topLayout); | 190 | QBoxLayout *statusLayout = new QHBoxLayout(topLayout); |
191 | 191 | ||
192 | initCompletion( parent, statusLayout ); | 192 | initCompletion( parent, statusLayout ); |
193 | 193 | ||
194 | statusLayout->addStretch( 1 ); | 194 | statusLayout->addStretch( 1 ); |
195 | 195 | ||
196 | initPriority( parent, statusLayout ); | 196 | initPriority( parent, statusLayout ); |
197 | } | 197 | } |
198 | 198 | ||
199 | void KOEditorGeneralTodo::setDefaults(QDateTime due,bool allDay) | 199 | void KOEditorGeneralTodo::setDefaults(QDateTime due,bool allDay) |
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 5926abe..ffb2e1e 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -63,65 +63,65 @@ class KNOWhatsThis :public QWhatsThis | |||
63 | { | 63 | { |
64 | public: | 64 | public: |
65 | KNOWhatsThis( KNoScrollListBox* sbox ) : QWhatsThis( sbox ), _wid( sbox) { }; | 65 | KNOWhatsThis( KNoScrollListBox* sbox ) : QWhatsThis( sbox ), _wid( sbox) { }; |
66 | //~KNOWhatsThis( ) {qDebug("~KNOWhatsThis( ) "); }; | 66 | //~KNOWhatsThis( ) {qDebug("~KNOWhatsThis( ) "); }; |
67 | 67 | ||
68 | protected: | 68 | protected: |
69 | virtual QString text( const QPoint& p) | 69 | virtual QString text( const QPoint& p) |
70 | { | 70 | { |
71 | return _wid->getWhatsThisText(p) ; | 71 | return _wid->getWhatsThisText(p) ; |
72 | }; | 72 | }; |
73 | private: | 73 | private: |
74 | KNoScrollListBox* _wid; | 74 | KNoScrollListBox* _wid; |
75 | 75 | ||
76 | }; | 76 | }; |
77 | 77 | ||
78 | 78 | ||
79 | KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name) | 79 | KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name) |
80 | : QListBox(parent, name, WRepaintNoErase) | 80 | : QListBox(parent, name, WRepaintNoErase) |
81 | { | 81 | { |
82 | #ifndef DESKTOP_VERSION | 82 | #ifndef DESKTOP_VERSION |
83 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); | 83 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); |
84 | #endif | 84 | #endif |
85 | mWT = new KNOWhatsThis(this); | 85 | mWT = new KNOWhatsThis(this); |
86 | } | 86 | } |
87 | KNoScrollListBox::~KNoScrollListBox() | 87 | KNoScrollListBox::~KNoScrollListBox() |
88 | { | 88 | { |
89 | 89 | ||
90 | } | 90 | } |
91 | QString KNoScrollListBox::getWhatsThisText(QPoint p) | 91 | QString KNoScrollListBox::getWhatsThisText(QPoint p) |
92 | { | 92 | { |
93 | QListBoxItem* item = itemAt ( p ); | 93 | QListBoxItem* item = itemAt ( p ); |
94 | if ( ! item ) { | 94 | if ( ! item ) { |
95 | return i18n("Click in the cell\nto add an event!"); | 95 | return i18n("Click in the cell\nto add an event!"); |
96 | } | 96 | } |
97 | return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence()); | 97 | return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence()); |
98 | } | 98 | } |
99 | void KNoScrollListBox::keyPressEvent(QKeyEvent *e) | 99 | void KNoScrollListBox::keyPressEvent(QKeyEvent *e) |
100 | { | 100 | { |
101 | 101 | ||
102 | switch(e->key()) { | 102 | switch(e->key()) { |
103 | case Key_Right: | 103 | case Key_Right: |
104 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 104 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
105 | { | 105 | { |
106 | e->ignore(); | 106 | e->ignore(); |
107 | return; | 107 | return; |
108 | } | 108 | } |
109 | scrollBy(10,0); | 109 | scrollBy(10,0); |
110 | break; | 110 | break; |
111 | case Key_Left: | 111 | case Key_Left: |
112 | if (e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 112 | if (e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
113 | { | 113 | { |
114 | e->ignore(); | 114 | e->ignore(); |
115 | return; | 115 | return; |
116 | } | 116 | } |
117 | scrollBy(-10,0); | 117 | scrollBy(-10,0); |
118 | break; | 118 | break; |
119 | case Key_Up: | 119 | case Key_Up: |
120 | if( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { | 120 | if( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { |
121 | e->ignore(); | 121 | e->ignore(); |
122 | break; | 122 | break; |
123 | } | 123 | } |
124 | setCurrentItem((currentItem()+count()-1)%count()); | 124 | setCurrentItem((currentItem()+count()-1)%count()); |
125 | if(!itemVisible(currentItem())) { | 125 | if(!itemVisible(currentItem())) { |
126 | if((unsigned int) currentItem() == (count()-1)) { | 126 | if((unsigned int) currentItem() == (count()-1)) { |
127 | setTopItem(currentItem()-numItemsVisible()+1); | 127 | setTopItem(currentItem()-numItemsVisible()+1); |
@@ -290,65 +290,65 @@ MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par ) | |||
290 | mMonthView( parent ) | 290 | mMonthView( parent ) |
291 | { | 291 | { |
292 | 292 | ||
293 | QVBoxLayout *topLayout = new QVBoxLayout( this ); | 293 | QVBoxLayout *topLayout = new QVBoxLayout( this ); |
294 | 294 | ||
295 | // mLabel = new QLabel( this );QPushButton | 295 | // mLabel = new QLabel( this );QPushButton |
296 | mLabel = new QPushButton( this ); | 296 | mLabel = new QPushButton( this ); |
297 | //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain ); | 297 | //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain ); |
298 | //mLabel->setLineWidth( 1 ); | 298 | //mLabel->setLineWidth( 1 ); |
299 | //mLabel->setAlignment( AlignCenter ); | 299 | //mLabel->setAlignment( AlignCenter ); |
300 | mLabel->setFlat( true ); | 300 | mLabel->setFlat( true ); |
301 | mLabel->setFocusPolicy(NoFocus); | 301 | mLabel->setFocusPolicy(NoFocus); |
302 | mItemList = new KNoScrollListBox( this ); | 302 | mItemList = new KNoScrollListBox( this ); |
303 | mItemList->setMinimumSize( 10, 10 ); | 303 | mItemList->setMinimumSize( 10, 10 ); |
304 | mItemList->setFrameStyle( QFrame::Panel | QFrame::Plain ); | 304 | mItemList->setFrameStyle( QFrame::Panel | QFrame::Plain ); |
305 | mItemList->setLineWidth( 1 ); | 305 | mItemList->setLineWidth( 1 ); |
306 | topLayout->addWidget( mItemList ); | 306 | topLayout->addWidget( mItemList ); |
307 | mLabel->raise(); | 307 | mLabel->raise(); |
308 | // QColor( 0,0,255 ) QColor( 160,1600,255 ) | 308 | // QColor( 0,0,255 ) QColor( 160,1600,255 ) |
309 | mStandardPalette = palette(); | 309 | mStandardPalette = palette(); |
310 | mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) ); | 310 | mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) ); |
311 | 311 | ||
312 | enableScrollBars( false ); | 312 | enableScrollBars( false ); |
313 | updateConfig(); | 313 | updateConfig(); |
314 | //connect( mLabel, SIGNAL( clicked( )), SLOT( newEvent() )); | 314 | //connect( mLabel, SIGNAL( clicked( )), SLOT( newEvent() )); |
315 | connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() )); | 315 | connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() )); |
316 | connect( mItemList, SIGNAL( doubleClicked( QListBoxItem *) ), | 316 | connect( mItemList, SIGNAL( doubleClicked( QListBoxItem *) ), |
317 | SLOT( defaultAction( QListBoxItem * ) ) ); | 317 | SLOT( defaultAction( QListBoxItem * ) ) ); |
318 | connect( mItemList, SIGNAL( rightButtonPressed( QListBoxItem *, | 318 | connect( mItemList, SIGNAL( rightButtonPressed( QListBoxItem *, |
319 | const QPoint &) ), | 319 | const QPoint &) ), |
320 | SLOT( contextMenu( QListBoxItem * ) ) ); | 320 | SLOT( contextMenu( QListBoxItem * ) ) ); |
321 | connect( mItemList, SIGNAL( highlighted( QListBoxItem *) ), | 321 | connect( mItemList, SIGNAL( highlighted( QListBoxItem *) ), |
322 | SLOT( selection( QListBoxItem * ) ) ); | 322 | SLOT( selection( QListBoxItem * ) ) ); |
323 | connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), | 323 | connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), |
324 | SLOT( cellClicked( QListBoxItem * ) ) ); | 324 | SLOT( cellClicked( QListBoxItem * ) ) ); |
325 | connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), | 325 | connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), |
326 | SLOT( selection( QListBoxItem * ) ) ); | 326 | SLOT( selection( QListBoxItem * ) ) ); |
327 | } | 327 | } |
328 | #ifdef DESKTOP_VERSION | 328 | #ifdef DESKTOP_VERSION |
329 | QToolTipGroup *MonthViewCell::toolTipGroup() | 329 | QToolTipGroup *MonthViewCell::toolTipGroup() |
330 | { | 330 | { |
331 | if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); | 331 | if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); |
332 | return mToolTipGroup; | 332 | return mToolTipGroup; |
333 | } | 333 | } |
334 | #endif | 334 | #endif |
335 | 335 | ||
336 | void MonthViewCell::setDate( const QDate &date ) | 336 | void MonthViewCell::setDate( const QDate &date ) |
337 | { | 337 | { |
338 | // kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl; | 338 | // kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl; |
339 | mDate = date; | 339 | mDate = date; |
340 | 340 | ||
341 | 341 | ||
342 | 342 | ||
343 | //resizeEvent( 0 ); | 343 | //resizeEvent( 0 ); |
344 | } | 344 | } |
345 | 345 | ||
346 | QDate MonthViewCell::date() const | 346 | QDate MonthViewCell::date() const |
347 | { | 347 | { |
348 | return mDate; | 348 | return mDate; |
349 | } | 349 | } |
350 | 350 | ||
351 | void MonthViewCell::setPrimary( bool primary ) | 351 | void MonthViewCell::setPrimary( bool primary ) |
352 | { | 352 | { |
353 | mPrimary = primary; | 353 | mPrimary = primary; |
354 | //setMyPalette(); | 354 | //setMyPalette(); |
@@ -523,101 +523,102 @@ void MonthViewCell::insertEvent(Event *event) | |||
523 | 523 | ||
524 | } else { | 524 | } else { |
525 | if (cat.isEmpty()) { | 525 | if (cat.isEmpty()) { |
526 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); | 526 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); |
527 | } else { | 527 | } else { |
528 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); | 528 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); |
529 | } | 529 | } |
530 | } | 530 | } |
531 | 531 | ||
532 | } else { | 532 | } else { |
533 | pal = mStandardPalette ; | 533 | pal = mStandardPalette ; |
534 | } | 534 | } |
535 | item->setPalette( pal ); | 535 | item->setPalette( pal ); |
536 | item->setRecur( event->recurrence()->doesRecur() ); | 536 | item->setRecur( event->recurrence()->doesRecur() ); |
537 | item->setAlarm( event->isAlarmEnabled() ); | 537 | item->setAlarm( event->isAlarmEnabled() ); |
538 | item->setMoreInfo( event->description().length() > 0 ); | 538 | item->setMoreInfo( event->description().length() > 0 ); |
539 | #ifdef DESKTOP_VERSION | 539 | #ifdef DESKTOP_VERSION |
540 | Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, | 540 | Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, |
541 | KOPrefs::instance()->email()); | 541 | KOPrefs::instance()->email()); |
542 | if ( me != 0 ) { | 542 | if ( me != 0 ) { |
543 | if ( me->status() == Attendee::NeedsAction && me->RSVP()) | 543 | if ( me->status() == Attendee::NeedsAction && me->RSVP()) |
544 | item->setReply(true); | 544 | item->setReply(true); |
545 | else | 545 | else |
546 | item->setReply(false); | 546 | item->setReply(false); |
547 | } else | 547 | } else |
548 | item->setReply(false); | 548 | item->setReply(false); |
549 | #endif | 549 | #endif |
550 | mItemList->insertItem( item ); | 550 | mItemList->insertItem( item ); |
551 | mToolTip += "\n"; | 551 | mToolTip += "\n"; |
552 | } | 552 | } |
553 | void MonthViewCell::insertTodo(Todo *todo) | 553 | void MonthViewCell::insertTodo(Todo *todo) |
554 | { | 554 | { |
555 | QString text; | 555 | QString text; |
556 | if (todo->hasDueDate()) { | 556 | mItemList->setFocusPolicy(WheelFocus); |
557 | if (!todo->doesFloat()) { | 557 | if (todo->hasDueDate()) { |
558 | text += KGlobal::locale()->formatTime(todo->dtDue().time()); | 558 | if (!todo->doesFloat()) { |
559 | text += " "; | 559 | text += KGlobal::locale()->formatTime(todo->dtDue().time()); |
560 | } | 560 | text += " "; |
561 | } | 561 | } |
562 | text += i18n("Td: %1").arg(todo->summary()); | 562 | } |
563 | 563 | text += i18n("T: %1").arg(todo->summary()); | |
564 | MonthViewItem *item = new MonthViewItem( todo, mDate, text ); | 564 | |
565 | //item->setPalette( mStandardPalette ); | 565 | MonthViewItem *item = new MonthViewItem( todo, mDate, text ); |
566 | QPalette pal; | 566 | //item->setPalette( mStandardPalette ); |
567 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { | 567 | QPalette pal; |
568 | QStringList categories = todo->categories(); | 568 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { |
569 | QString cat = categories.first(); | 569 | QStringList categories = todo->categories(); |
570 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { | 570 | QString cat = categories.first(); |
571 | pal = getPalette(); | 571 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { |
572 | if (cat.isEmpty()) { | 572 | pal = getPalette(); |
573 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); | 573 | if (cat.isEmpty()) { |
574 | } else { | 574 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); |
575 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); | ||
576 | } | ||
577 | |||
578 | } else { | 575 | } else { |
579 | if (cat.isEmpty()) { | 576 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); |
580 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); | ||
581 | } else { | ||
582 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); | ||
583 | } | ||
584 | } | 577 | } |
585 | 578 | ||
586 | } else { | 579 | } else { |
587 | pal = mStandardPalette ; | 580 | if (cat.isEmpty()) { |
581 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); | ||
582 | } else { | ||
583 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); | ||
584 | } | ||
588 | } | 585 | } |
589 | item->setPalette( pal ); | 586 | |
590 | mItemList->insertItem( item ); | 587 | } else { |
591 | mToolTip += text+"\n"; | 588 | pal = mStandardPalette ; |
589 | } | ||
590 | item->setPalette( pal ); | ||
591 | mItemList->insertItem( item ); | ||
592 | mToolTip += text+"\n"; | ||
592 | } | 593 | } |
593 | void MonthViewCell::finishUpdateCell() | 594 | void MonthViewCell::finishUpdateCell() |
594 | { | 595 | { |
595 | #ifdef DESKTOP_VERSION | 596 | #ifdef DESKTOP_VERSION |
596 | if (mToolTip != "") | 597 | if (mToolTip != "") |
597 | QToolTip::add(this,mToolTip,toolTipGroup(),""); | 598 | QToolTip::add(this,mToolTip,toolTipGroup(),""); |
598 | #endif | 599 | #endif |
599 | mItemList->sort(); | 600 | mItemList->sort(); |
600 | //setMyPalette(); | 601 | //setMyPalette(); |
601 | setMyPalette(); | 602 | setMyPalette(); |
602 | QString text; | 603 | QString text; |
603 | bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; | 604 | bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; |
604 | if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { | 605 | if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { |
605 | text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " "; | 606 | text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " "; |
606 | mLabel->resize( mLabelBigSize ); | 607 | mLabel->resize( mLabelBigSize ); |
607 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); | 608 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); |
608 | } else { | 609 | } else { |
609 | mLabel->resize( mLabelSize ); | 610 | mLabel->resize( mLabelSize ); |
610 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); | 611 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); |
611 | } | 612 | } |
612 | 613 | ||
613 | mLabel->setText( text ); | 614 | mLabel->setText( text ); |
614 | resizeEvent( 0 ); | 615 | resizeEvent( 0 ); |
615 | } | 616 | } |
616 | void MonthViewCell::updateCell() | 617 | void MonthViewCell::updateCell() |
617 | { | 618 | { |
618 | if ( !mMonthView->isUpdatePossible() ) | 619 | if ( !mMonthView->isUpdatePossible() ) |
619 | return; | 620 | return; |
620 | startUpdateCell(); | 621 | startUpdateCell(); |
621 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); | 622 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); |
622 | QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); | 623 | QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); |
623 | Event *event; | 624 | Event *event; |
@@ -753,65 +754,64 @@ void MonthViewCell::cellClicked( QListBoxItem *item ) | |||
753 | { | 754 | { |
754 | static QListBoxItem * lastClicked = 0; | 755 | static QListBoxItem * lastClicked = 0; |
755 | if ( item == 0 ) { | 756 | if ( item == 0 ) { |
756 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); | 757 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); |
757 | emit newEventSignal( dt ); | 758 | emit newEventSignal( dt ); |
758 | return; | 759 | return; |
759 | } | 760 | } |
760 | /* | 761 | /* |
761 | if ( lastClicked ) | 762 | if ( lastClicked ) |
762 | if ( ! item ) { | 763 | if ( ! item ) { |
763 | if ( lastClicked->listBox() != item->listBox() ) | 764 | if ( lastClicked->listBox() != item->listBox() ) |
764 | lastClicked->listBox()->clearSelection(); | 765 | lastClicked->listBox()->clearSelection(); |
765 | } | 766 | } |
766 | */ | 767 | */ |
767 | 768 | ||
768 | mMonthView->setSelectedCell( this ); | 769 | mMonthView->setSelectedCell( this ); |
769 | if( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) enableScrollBars( true ); | 770 | if( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) enableScrollBars( true ); |
770 | select(); | 771 | select(); |
771 | } | 772 | } |
772 | 773 | ||
773 | void MonthViewCell::contextMenu( QListBoxItem *item ) | 774 | void MonthViewCell::contextMenu( QListBoxItem *item ) |
774 | { | 775 | { |
775 | if ( !item ) return; | 776 | if ( !item ) return; |
776 | 777 | ||
777 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); | 778 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); |
778 | Incidence *incidence = eventItem->incidence(); | 779 | Incidence *incidence = eventItem->incidence(); |
779 | if ( incidence ) mMonthView->showContextMenu( incidence ); | 780 | if ( incidence ) mMonthView->showContextMenu( incidence ); |
780 | } | 781 | } |
781 | 782 | ||
782 | void MonthViewCell::selection( QListBoxItem *item ) | 783 | void MonthViewCell::selection( QListBoxItem *item ) |
783 | { | 784 | { |
784 | if ( !item ) return; | 785 | if ( !item ) return; |
785 | |||
786 | mMonthView->setSelectedCell( this ); | 786 | mMonthView->setSelectedCell( this ); |
787 | } | 787 | } |
788 | 788 | ||
789 | 789 | ||
790 | // ******************************************************************************* | 790 | // ******************************************************************************* |
791 | // ******************************************************************************* | 791 | // ******************************************************************************* |
792 | // ******************************************************************************* | 792 | // ******************************************************************************* |
793 | 793 | ||
794 | 794 | ||
795 | KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) | 795 | KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) |
796 | : KOEventView( calendar, parent, name ), | 796 | : KOEventView( calendar, parent, name ), |
797 | mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), | 797 | mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), |
798 | mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) | 798 | mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) |
799 | { | 799 | { |
800 | ignoreResizeEvent = 0; | 800 | ignoreResizeEvent = 0; |
801 | mShortDayLabelsW = false; | 801 | mShortDayLabelsW = false; |
802 | mShortDayLabelsM = false; | 802 | mShortDayLabelsM = false; |
803 | clPending = true; | 803 | clPending = true; |
804 | mWidStack = new QWidgetStack( this ); | 804 | mWidStack = new QWidgetStack( this ); |
805 | QHBoxLayout* hb = new QHBoxLayout( this ); | 805 | QHBoxLayout* hb = new QHBoxLayout( this ); |
806 | mMonthView = new QWidget( mWidStack ); | 806 | mMonthView = new QWidget( mWidStack ); |
807 | mWeekView = new QWidget( mWidStack ); | 807 | mWeekView = new QWidget( mWidStack ); |
808 | #if QT_VERSION >= 0x030000 | 808 | #if QT_VERSION >= 0x030000 |
809 | mWidStack->addWidget(mMonthView ); | 809 | mWidStack->addWidget(mMonthView ); |
810 | mWidStack->addWidget(mWeekView ); | 810 | mWidStack->addWidget(mWeekView ); |
811 | #else | 811 | #else |
812 | mWidStack->addWidget( mMonthView, 1 ); | 812 | mWidStack->addWidget( mMonthView, 1 ); |
813 | mWidStack->addWidget( mWeekView , 1 ); | 813 | mWidStack->addWidget( mWeekView , 1 ); |
814 | #endif | 814 | #endif |
815 | hb->addWidget( mWidStack ); | 815 | hb->addWidget( mWidStack ); |
816 | mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); | 816 | mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); |
817 | mShowWeekView = KOPrefs::instance()->mMonthViewWeek; | 817 | mShowWeekView = KOPrefs::instance()->mMonthViewWeek; |
@@ -1236,67 +1236,73 @@ void KOMonthView::updateView() | |||
1236 | } | 1236 | } |
1237 | } | 1237 | } |
1238 | } | 1238 | } |
1239 | 1239 | ||
1240 | for( i = 0; i < timeSpan+1; ++i ) { | 1240 | for( i = 0; i < timeSpan+1; ++i ) { |
1241 | (*cells)[i]->finishUpdateCell(); | 1241 | (*cells)[i]->finishUpdateCell(); |
1242 | } | 1242 | } |
1243 | processSelectionChange(); | 1243 | processSelectionChange(); |
1244 | (*cells)[0]->setFocus(); | 1244 | (*cells)[0]->setFocus(); |
1245 | 1245 | ||
1246 | 1246 | ||
1247 | #else | 1247 | #else |
1248 | // old code | 1248 | // old code |
1249 | //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); | 1249 | //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); |
1250 | int i; | 1250 | int i; |
1251 | for( i = 0; i < (*cells).count(); ++i ) { | 1251 | for( i = 0; i < (*cells).count(); ++i ) { |
1252 | (*cells)[i]->updateCell(); | 1252 | (*cells)[i]->updateCell(); |
1253 | } | 1253 | } |
1254 | 1254 | ||
1255 | //qDebug("KOMonthView::updateView() "); | 1255 | //qDebug("KOMonthView::updateView() "); |
1256 | processSelectionChange(); | 1256 | processSelectionChange(); |
1257 | // qDebug("---------------------------------------------------------------------+ "); | 1257 | // qDebug("---------------------------------------------------------------------+ "); |
1258 | (*cells)[0]->setFocus(); | 1258 | (*cells)[0]->setFocus(); |
1259 | #endif | 1259 | #endif |
1260 | 1260 | ||
1261 | //qDebug("update time %d ", ti.elapsed()); | 1261 | //qDebug("update time %d ", ti.elapsed()); |
1262 | } | 1262 | } |
1263 | 1263 | ||
1264 | void KOMonthView::resizeEvent(QResizeEvent * e) | 1264 | void KOMonthView::resizeEvent(QResizeEvent * e) |
1265 | { | 1265 | { |
1266 | qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height()); | 1266 | qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height()); |
1267 | if ( ignoreResizeEvent ) { | 1267 | if ( ignoreResizeEvent ) { |
1268 | qDebug("KOMonthView::resizeEvent ignored "); | 1268 | int diff = e->size().height() - e->oldSize().height(); |
1269 | --ignoreResizeEvent; | 1269 | if ( diff < 0 ) |
1270 | return; | 1270 | diff = diff * (-1); |
1271 | if ( diff == ignoreResizeEventHeight ) { | ||
1272 | qDebug("KOMonthView::resizeEvent ignored "); | ||
1273 | --ignoreResizeEvent; | ||
1274 | return; | ||
1275 | } | ||
1276 | ignoreResizeEvent = 0; | ||
1271 | } | 1277 | } |
1272 | if ( e->size().width()+ e->size().height() < 240 ) | 1278 | if ( e->size().width()+ e->size().height() < 240 ) |
1273 | return; | 1279 | return; |
1274 | computeLayout(); | 1280 | computeLayout(); |
1275 | clPending = true; | 1281 | clPending = true; |
1276 | if ( mShowWeekView ) | 1282 | if ( mShowWeekView ) |
1277 | mCellsW[0]->setFocus(); | 1283 | mCellsW[0]->setFocus(); |
1278 | else | 1284 | else |
1279 | mCells[0]->setFocus(); | 1285 | mCells[0]->setFocus(); |
1280 | } | 1286 | } |
1281 | void KOMonthView::computeLayoutWeek() | 1287 | void KOMonthView::computeLayoutWeek() |
1282 | { | 1288 | { |
1283 | 1289 | ||
1284 | int daysToShow; | 1290 | int daysToShow; |
1285 | int tWid = topLevelWidget()->size().width(); | 1291 | int tWid = topLevelWidget()->size().width(); |
1286 | int tHei = topLevelWidget()->size().height(); | 1292 | int tHei = topLevelWidget()->size().height(); |
1287 | 1293 | ||
1288 | int wid = size().width();//e | 1294 | int wid = size().width();//e |
1289 | int hei = size().height()-1; | 1295 | int hei = size().height()-1; |
1290 | 1296 | ||
1291 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) | 1297 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) |
1292 | return; | 1298 | return; |
1293 | 1299 | ||
1294 | if ( wid < hei ) | 1300 | if ( wid < hei ) |
1295 | daysToShow = 2; | 1301 | daysToShow = 2; |
1296 | else | 1302 | else |
1297 | daysToShow = 3; | 1303 | daysToShow = 3; |
1298 | bool combinedSatSun = true; | 1304 | bool combinedSatSun = true; |
1299 | 1305 | ||
1300 | //qDebug("KOMonthView::computeLayout()------------------------------------ "); | 1306 | //qDebug("KOMonthView::computeLayout()------------------------------------ "); |
1301 | QFontMetrics fm ( mWeekLabels[0]->font() ); | 1307 | QFontMetrics fm ( mWeekLabels[0]->font() ); |
1302 | int weeklabelwid = fm.width( "888" ); | 1308 | int weeklabelwid = fm.width( "888" ); |
@@ -1482,95 +1488,101 @@ void KOMonthView::computeLayout() | |||
1482 | } | 1488 | } |
1483 | mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); | 1489 | mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); |
1484 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); | 1490 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); |
1485 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); | 1491 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); |
1486 | mShortDayLabelsM = mDayLabels[0]->width() < mWidthLongDayLabel ; | 1492 | mShortDayLabelsM = mDayLabels[0]->width() < mWidthLongDayLabel ; |
1487 | qDebug("dlwid %d %d ",mDayLabels[0]->width() , mWidthLongDayLabel); | 1493 | qDebug("dlwid %d %d ",mDayLabels[0]->width() , mWidthLongDayLabel); |
1488 | updateDayLabels(); | 1494 | updateDayLabels(); |
1489 | bool forceUpdate = !updatePossible; | 1495 | bool forceUpdate = !updatePossible; |
1490 | updatePossible = true; | 1496 | updatePossible = true; |
1491 | //mWeekLabels[mNumWeeks]->setText( i18n("W")); | 1497 | //mWeekLabels[mNumWeeks]->setText( i18n("W")); |
1492 | if ( forceUpdate ) | 1498 | if ( forceUpdate ) |
1493 | updateView(); | 1499 | updateView(); |
1494 | } | 1500 | } |
1495 | 1501 | ||
1496 | void KOMonthView::showContextMenu( Incidence *incidence ) | 1502 | void KOMonthView::showContextMenu( Incidence *incidence ) |
1497 | { | 1503 | { |
1498 | mContextMenu->showIncidencePopup(incidence); | 1504 | mContextMenu->showIncidencePopup(incidence); |
1499 | /* | 1505 | /* |
1500 | if( incidence && incidence->type() == "Event" ) { | 1506 | if( incidence && incidence->type() == "Event" ) { |
1501 | Event *event = static_cast<Event *>(incidence); | 1507 | Event *event = static_cast<Event *>(incidence); |
1502 | mContextMenu->showEventPopup(event); | 1508 | mContextMenu->showEventPopup(event); |
1503 | } else { | 1509 | } else { |
1504 | kdDebug() << "MonthView::showContextMenu(): cast failed." << endl; | 1510 | kdDebug() << "MonthView::showContextMenu(): cast failed." << endl; |
1505 | } | 1511 | } |
1506 | */ | 1512 | */ |
1507 | } | 1513 | } |
1508 | MonthViewCell * KOMonthView::selectedCell( ) | 1514 | MonthViewCell * KOMonthView::selectedCell( ) |
1509 | { | 1515 | { |
1510 | return mSelectedCell; | 1516 | return mSelectedCell; |
1511 | } | 1517 | } |
1512 | void KOMonthView::setSelectedCell( MonthViewCell *cell ) | 1518 | void KOMonthView::setSelectedCell( MonthViewCell *cell ) |
1513 | { | 1519 | { |
1514 | // qDebug("KOMonthView::setSelectedCell "); | 1520 | //qDebug("KOMonthView::setSelectedCell %x ", cell); |
1515 | if ( mSelectedCell && mSelectedCell != cell ) { | 1521 | if ( mSelectedCell && mSelectedCell != cell ) { |
1516 | MonthViewCell * mvc = mSelectedCell; | 1522 | MonthViewCell * mvc = mSelectedCell; |
1517 | mSelectedCell = cell; | 1523 | mSelectedCell = cell; |
1518 | mvc->deselect(); | 1524 | mvc->deselect(); |
1519 | } else | 1525 | } else |
1520 | mSelectedCell = cell; | 1526 | mSelectedCell = cell; |
1521 | // if ( mSelectedCell ) | 1527 | // if ( mSelectedCell ) |
1522 | // mSelectedCell->select(); | 1528 | // mSelectedCell->select(); |
1523 | if ( !mSelectedCell ) | 1529 | if ( !mSelectedCell ) |
1524 | emit incidenceSelected( 0 ); | 1530 | emit incidenceSelected( 0 ); |
1525 | else | 1531 | else |
1526 | emit incidenceSelected( mSelectedCell->selectedIncidence() ); | 1532 | emit incidenceSelected( mSelectedCell->selectedIncidence() ); |
1527 | } | 1533 | } |
1528 | 1534 | ||
1529 | void KOMonthView::processSelectionChange() | 1535 | void KOMonthView::processSelectionChange() |
1530 | { | 1536 | { |
1531 | QPtrList<Incidence> incidences = selectedIncidences(); | 1537 | QPtrList<Incidence> incidences = selectedIncidences(); |
1532 | if (incidences.count() > 0) { | 1538 | if (incidences.count() > 0) { |
1533 | emit incidenceSelected( incidences.first() ); | 1539 | emit incidenceSelected( incidences.first() ); |
1534 | } else { | 1540 | } else { |
1535 | emit incidenceSelected( 0 ); | 1541 | emit incidenceSelected( 0 ); |
1536 | } | 1542 | } |
1537 | } | 1543 | } |
1538 | 1544 | ||
1539 | void KOMonthView::clearSelection() | 1545 | void KOMonthView::clearSelection() |
1540 | { | 1546 | { |
1541 | if ( mSelectedCell ) { | 1547 | if ( mSelectedCell ) { |
1542 | mSelectedCell->deselect(); | 1548 | mSelectedCell->deselect(); |
1543 | mSelectedCell = 0; | 1549 | mSelectedCell = 0; |
1544 | } | 1550 | } |
1545 | } | 1551 | } |
1546 | void KOMonthView::keyPressEvent ( QKeyEvent * e ) | 1552 | void KOMonthView::keyPressEvent ( QKeyEvent * e ) |
1547 | { | 1553 | { |
1548 | //qDebug("KOMonthView::keyPressEvent "); | 1554 | //qDebug("KOMonthView::keyPressEvent "); |
1549 | switch(e->key()) { | 1555 | switch(e->key()) { |
1550 | case Key_Up: | 1556 | case Key_Up: |
1551 | { | 1557 | { |
1552 | emit prevMonth(); | 1558 | emit prevMonth(); |
1553 | mCells[0]->setFocus(); | 1559 | if ( mShowWeekView ) |
1560 | mCellsW[0]->setFocus(); | ||
1561 | else | ||
1562 | mCells[0]->setFocus(); | ||
1554 | } | 1563 | } |
1555 | e->accept(); | 1564 | e->accept(); |
1556 | break; | 1565 | break; |
1557 | case Key_Down: | 1566 | case Key_Down: |
1558 | { | 1567 | { |
1559 | emit nextMonth(); | 1568 | emit nextMonth(); |
1560 | mCells[0]->setFocus(); | 1569 | if ( mShowWeekView ) |
1561 | 1570 | mCellsW[0]->setFocus(); | |
1571 | else | ||
1572 | mCells[0]->setFocus(); | ||
1573 | |||
1562 | } | 1574 | } |
1563 | e->accept(); | 1575 | e->accept(); |
1564 | break; | 1576 | break; |
1565 | case Key_Return: | 1577 | case Key_Return: |
1566 | case Key_Enter: | 1578 | case Key_Enter: |
1567 | { | 1579 | { |
1568 | selectInternalWeekNum ( currentWeek() ); | 1580 | selectInternalWeekNum ( currentWeek() ); |
1569 | } | 1581 | } |
1570 | e->accept(); | 1582 | e->accept(); |
1571 | break; | 1583 | break; |
1572 | default: | 1584 | default: |
1573 | e->ignore(); | 1585 | e->ignore(); |
1574 | break; | 1586 | break; |
1575 | } | 1587 | } |
1576 | } | 1588 | } |
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h index 9dbe319..d70cda1 100644 --- a/korganizer/komonthview.h +++ b/korganizer/komonthview.h | |||
@@ -197,98 +197,99 @@ class MonthViewCell : public QWidget | |||
197 | QPalette mPrimaryPalette; | 197 | QPalette mPrimaryPalette; |
198 | QPalette mNonPrimaryPalette; | 198 | QPalette mNonPrimaryPalette; |
199 | void setMyPalette(); | 199 | void setMyPalette(); |
200 | QPalette getPalette (); | 200 | QPalette getPalette (); |
201 | void keyPressEvent ( QKeyEvent * ) ; | 201 | void keyPressEvent ( QKeyEvent * ) ; |
202 | 202 | ||
203 | }; | 203 | }; |
204 | 204 | ||
205 | 205 | ||
206 | class KOMonthView: public KOEventView | 206 | class KOMonthView: public KOEventView |
207 | { | 207 | { |
208 | Q_OBJECT | 208 | Q_OBJECT |
209 | public: | 209 | public: |
210 | KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 ); | 210 | KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 ); |
211 | ~KOMonthView(); | 211 | ~KOMonthView(); |
212 | 212 | ||
213 | /** Returns maximum number of days supported by the komonthview */ | 213 | /** Returns maximum number of days supported by the komonthview */ |
214 | virtual int maxDatesHint(); | 214 | virtual int maxDatesHint(); |
215 | 215 | ||
216 | /** Returns number of currently shown dates. */ | 216 | /** Returns number of currently shown dates. */ |
217 | virtual int currentDateCount(); | 217 | virtual int currentDateCount(); |
218 | 218 | ||
219 | /** returns the currently selected events */ | 219 | /** returns the currently selected events */ |
220 | virtual QPtrList<Incidence> selectedIncidences(); | 220 | virtual QPtrList<Incidence> selectedIncidences(); |
221 | 221 | ||
222 | /** returns dates of the currently selected events */ | 222 | /** returns dates of the currently selected events */ |
223 | virtual DateList selectedDates(); | 223 | virtual DateList selectedDates(); |
224 | 224 | ||
225 | virtual void printPreview(CalPrinter *calPrinter, | 225 | virtual void printPreview(CalPrinter *calPrinter, |
226 | const QDate &, const QDate &); | 226 | const QDate &, const QDate &); |
227 | bool isMonthView() { return true; } | 227 | bool isMonthView() { return true; } |
228 | bool isUpdatePossible() { return updatePossible; } | 228 | bool isUpdatePossible() { return updatePossible; } |
229 | void setIgnoreResizeEvent( int c ) { ignoreResizeEvent = c ;} | 229 | void setIgnoreResizeEvent( int c, int h ) { ignoreResizeEvent = c ;ignoreResizeEventHeight = h;} |
230 | 230 | ||
231 | MonthViewCell * selectedCell(); | 231 | MonthViewCell * selectedCell(); |
232 | public slots: | 232 | public slots: |
233 | virtual void updateView(); | 233 | virtual void updateView(); |
234 | virtual void updateConfig(); | 234 | virtual void updateConfig(); |
235 | virtual void showDates(const QDate &start, const QDate &end); | 235 | virtual void showDates(const QDate &start, const QDate &end); |
236 | virtual void showEvents(QPtrList<Event> eventList); | 236 | virtual void showEvents(QPtrList<Event> eventList); |
237 | 237 | ||
238 | void changeEventDisplay(Event *, int); | 238 | void changeEventDisplay(Event *, int); |
239 | 239 | ||
240 | void clearSelection(); | 240 | void clearSelection(); |
241 | 241 | ||
242 | void showContextMenu( Incidence * ); | 242 | void showContextMenu( Incidence * ); |
243 | 243 | ||
244 | void setSelectedCell( MonthViewCell * ); | 244 | void setSelectedCell( MonthViewCell * ); |
245 | 245 | ||
246 | protected slots: | 246 | protected slots: |
247 | void selectInternalWeekNum ( int ); | 247 | void selectInternalWeekNum ( int ); |
248 | void switchView(); | 248 | void switchView(); |
249 | void processSelectionChange(); | 249 | void processSelectionChange(); |
250 | signals: | 250 | signals: |
251 | void nextMonth(); | 251 | void nextMonth(); |
252 | void prevMonth(); | 252 | void prevMonth(); |
253 | void showNavigator( bool ); | 253 | void showNavigator( bool ); |
254 | void selectWeekNum ( int ); | 254 | void selectWeekNum ( int ); |
255 | void showDaySignal( QDate ); | 255 | void showDaySignal( QDate ); |
256 | protected: | 256 | protected: |
257 | void resizeEvent(QResizeEvent *); | 257 | void resizeEvent(QResizeEvent *); |
258 | void viewChanged(); | 258 | void viewChanged(); |
259 | void updateDayLabels(); | 259 | void updateDayLabels(); |
260 | 260 | ||
261 | private: | 261 | private: |
262 | int ignoreResizeEvent; | 262 | int ignoreResizeEvent; |
263 | int ignoreResizeEventHeight; | ||
263 | int currentWeek(); | 264 | int currentWeek(); |
264 | bool clPending; | 265 | bool clPending; |
265 | QWidgetStack * mWidStack; | 266 | QWidgetStack * mWidStack; |
266 | QWidget* mMonthView; | 267 | QWidget* mMonthView; |
267 | QWidget* mWeekView; | 268 | QWidget* mWeekView; |
268 | bool mShowWeekView; | 269 | bool mShowWeekView; |
269 | bool updatePossible; | 270 | bool updatePossible; |
270 | int mDaysPerWeek; | 271 | int mDaysPerWeek; |
271 | int mNumWeeks; | 272 | int mNumWeeks; |
272 | int mNumCells; | 273 | int mNumCells; |
273 | bool mWeekStartsMonday; | 274 | bool mWeekStartsMonday; |
274 | void computeLayout(); | 275 | void computeLayout(); |
275 | void computeLayoutWeek(); | 276 | void computeLayoutWeek(); |
276 | 277 | ||
277 | QPtrVector<MonthViewCell> mCells; | 278 | QPtrVector<MonthViewCell> mCells; |
278 | QPtrVector<QLabel> mDayLabels; | 279 | QPtrVector<QLabel> mDayLabels; |
279 | QPtrVector<KOWeekButton> mWeekLabels; | 280 | QPtrVector<KOWeekButton> mWeekLabels; |
280 | QPtrVector<MonthViewCell> mCellsW; | 281 | QPtrVector<MonthViewCell> mCellsW; |
281 | QPtrVector<QLabel> mDayLabelsW; | 282 | QPtrVector<QLabel> mDayLabelsW; |
282 | QPtrVector<KOWeekButton> mWeekLabelsW; | 283 | QPtrVector<KOWeekButton> mWeekLabelsW; |
283 | 284 | ||
284 | bool mShortDayLabelsM; | 285 | bool mShortDayLabelsM; |
285 | bool mShortDayLabelsW; | 286 | bool mShortDayLabelsW; |
286 | int mWidthLongDayLabel; | 287 | int mWidthLongDayLabel; |
287 | 288 | ||
288 | QDate mStartDate; | 289 | QDate mStartDate; |
289 | 290 | ||
290 | MonthViewCell *mSelectedCell; | 291 | MonthViewCell *mSelectedCell; |
291 | 292 | ||
292 | KOEventPopupMenu *mContextMenu; | 293 | KOEventPopupMenu *mContextMenu; |
293 | void keyPressEvent ( QKeyEvent * ) ; | 294 | void keyPressEvent ( QKeyEvent * ) ; |
294 | 295 | ||
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp index dcb51dc..c35de0a 100644 --- a/korganizer/koviewmanager.cpp +++ b/korganizer/koviewmanager.cpp | |||
@@ -194,65 +194,66 @@ void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) | |||
194 | if ( view == 0 ) | 194 | if ( view == 0 ) |
195 | return; | 195 | return; |
196 | } | 196 | } |
197 | bool full = fullScreen; | 197 | bool full = fullScreen; |
198 | if(view == mCurrentView && view != mWhatsNextView ) { | 198 | if(view == mCurrentView && view != mWhatsNextView ) { |
199 | if ( mCurrentAgendaView < 0 ) | 199 | if ( mCurrentAgendaView < 0 ) |
200 | return; | 200 | return; |
201 | full = mMainView->leftFrame()->isVisible(); | 201 | full = mMainView->leftFrame()->isVisible(); |
202 | } else { | 202 | } else { |
203 | mCurrentView = view; | 203 | mCurrentView = view; |
204 | // bool full = fullScreen; | 204 | // bool full = fullScreen; |
205 | bool isFull = !mMainView->leftFrame()->isVisible(); | 205 | bool isFull = !mMainView->leftFrame()->isVisible(); |
206 | if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) | 206 | if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) |
207 | full = true; | 207 | full = true; |
208 | if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) | 208 | if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) |
209 | full = false; | 209 | full = false; |
210 | } | 210 | } |
211 | if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); | 211 | if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); |
212 | //raiseCurrentView( full ); | 212 | //raiseCurrentView( full ); |
213 | mMainView->processIncidenceSelection( 0 ); | 213 | mMainView->processIncidenceSelection( 0 ); |
214 | //mMainView->updateView(); | 214 | //mMainView->updateView(); |
215 | raiseCurrentView( full, true ); | 215 | raiseCurrentView( full, true ); |
216 | mMainView->adaptNavigationUnits(); | 216 | mMainView->adaptNavigationUnits(); |
217 | } | 217 | } |
218 | 218 | ||
219 | void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView ) | 219 | void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView ) |
220 | { | 220 | { |
221 | mCurrentAgendaView = 0; | 221 | mCurrentAgendaView = 0; |
222 | int wid = mMainView->width() ; | 222 | int wid = mMainView->width() ; |
223 | int hei = mMainView->height(); | 223 | int hei = mMainView->height(); |
224 | if ( mCurrentView == mMonthView ) { | 224 | if ( mCurrentView == mMonthView ) { |
225 | if ( true /* !KOPrefs::instance()->mMonthViewWeek*/ ) { | 225 | if ( true /* !KOPrefs::instance()->mMonthViewWeek*/ ) { |
226 | mMonthView->setIgnoreResizeEvent( 2 ); | 226 | |
227 | mMonthView->setIgnoreResizeEvent( 2 ,mMainView->navigatorBar()->height()); | ||
227 | mMainView->navigatorBar()->show(); | 228 | mMainView->navigatorBar()->show(); |
228 | hei -= mMainView->navigatorBar()->sizeHint().height(); | 229 | hei -= mMainView->navigatorBar()->sizeHint().height(); |
229 | } | 230 | } |
230 | //mMainView->navigatorBar()->hide(); | 231 | //mMainView->navigatorBar()->hide(); |
231 | } else { | 232 | } else { |
232 | mMainView->navigatorBar()->hide(); | 233 | mMainView->navigatorBar()->hide(); |
233 | } | 234 | } |
234 | if ( fullScreen ) { | 235 | if ( fullScreen ) { |
235 | mMainView->leftFrame()->hide(); | 236 | mMainView->leftFrame()->hide(); |
236 | } else { | 237 | } else { |
237 | mMainView->leftFrame()->show(); | 238 | mMainView->leftFrame()->show(); |
238 | if ( KOPrefs::instance()->mVerticalScreen ) | 239 | if ( KOPrefs::instance()->mVerticalScreen ) |
239 | hei -= mMainView->leftFrame()->height(); | 240 | hei -= mMainView->leftFrame()->height(); |
240 | else | 241 | else |
241 | wid -= mMainView->leftFrame()->width(); | 242 | wid -= mMainView->leftFrame()->width(); |
242 | } | 243 | } |
243 | emit signalFullScreen( !fullScreen ); | 244 | emit signalFullScreen( !fullScreen ); |
244 | if ( callUpdateView ) | 245 | if ( callUpdateView ) |
245 | mMainView->updateView(); | 246 | mMainView->updateView(); |
246 | 247 | ||
247 | if ( globalFlagBlockAgenda == 5 ) { | 248 | if ( globalFlagBlockAgenda == 5 ) { |
248 | globalFlagBlockAgenda = 4; | 249 | globalFlagBlockAgenda = 4; |
249 | globalFlagBlockAgendaItemPaint = 1; | 250 | globalFlagBlockAgendaItemPaint = 1; |
250 | } | 251 | } |
251 | mMainView->viewStack()->raiseWidget(mCurrentView); | 252 | mMainView->viewStack()->raiseWidget(mCurrentView); |
252 | if ( globalFlagBlockAgenda == 4 ) { | 253 | if ( globalFlagBlockAgenda == 4 ) { |
253 | if ( mCurrentView == mAgendaView ) { | 254 | if ( mCurrentView == mAgendaView ) { |
254 | //globalFlagBlockAgenda =1 ; | 255 | //globalFlagBlockAgenda =1 ; |
255 | if ( KOPrefs::instance()->mSetTimeToDayStartAt ) | 256 | if ( KOPrefs::instance()->mSetTimeToDayStartAt ) |
256 | mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins ); | 257 | mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins ); |
257 | else if ( KOPrefs::instance()->mCenterOnCurrentTime ) | 258 | else if ( KOPrefs::instance()->mCenterOnCurrentTime ) |
258 | mAgendaView->setStartHour( QTime::currentTime ().hour() ); | 259 | mAgendaView->setStartHour( QTime::currentTime ().hour() ); |