summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-02-06 15:21:01 (UTC)
committer zautrix <zautrix>2005-02-06 15:21:01 (UTC)
commit38898c49275bf27fb8c2df96d145f2a5abb62331 (patch) (unidiff)
treeb96f0a336fccf4d6c67e6a4b5c1239b4d647b3b9
parent26b0c69fb3b11c29475ec02b2cfe52e33eb24e5f (diff)
downloadkdepimpi-38898c49275bf27fb8c2df96d145f2a5abb62331.zip
kdepimpi-38898c49275bf27fb8c2df96d145f2a5abb62331.tar.gz
kdepimpi-38898c49275bf27fb8c2df96d145f2a5abb62331.tar.bz2
fixxeess
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/WhatsNew.txt5
-rw-r--r--korganizer/koeditorgeneraltodo.cpp2
-rw-r--r--korganizer/komonthview.cpp96
-rw-r--r--korganizer/komonthview.h3
-rw-r--r--korganizer/koviewmanager.cpp3
5 files changed, 64 insertions, 45 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt
index 4251283..e21bb44 100644
--- a/bin/kdepim/WhatsNew.txt
+++ b/bin/kdepim/WhatsNew.txt
@@ -1,103 +1,108 @@
1Info about the changes in new versions of KDE-Pim/Pi 1Info about the changes in new versions of KDE-Pim/Pi
2 2
3********** VERSION 2.0.4 ************ 3********** VERSION 2.0.4 ************
4 4
5KO/Pi: 5KO/Pi:
6Fixed problem loading translations for summary/location edit boxes in event/todo editor. 6Fixed problem loading translations for summary/location edit boxes in event/todo editor.
7 7
8Added a general "select week number" to the toolbar.
9
10Fixed some small problem of the new features introduced in version 2.0.3.
11
12
8********** VERSION 2.0.3 ************ 13********** VERSION 2.0.3 ************
9 14
10KO/Pi: 15KO/Pi:
11Added feature for changing alarm settings for many items at once: 16Added feature for changing alarm settings for many items at once:
12Open list view (or search dialog), select the desired items and choose in 17Open list view (or search dialog), select the desired items and choose in
13the popup menu: Set alarm for selected... 18the popup menu: Set alarm for selected...
14 19
15Added to the event/todo viewer the option to send an email to 20Added to the event/todo viewer the option to send an email to
16all attendees or all selected (with RSVP) attendees. 21all attendees or all selected (with RSVP) attendees.
17 22
18Made the week-month mode changing in month view faster. 23Made the week-month mode changing in month view faster.
19 24
20Made month view better useable with keyboard. 25Made month view better useable with keyboard.
21Now TAB key jumps to next cell with an event/todo. 26Now TAB key jumps to next cell with an event/todo.
22Scroll in cell with coursor keys, scroll in time (next week) with 27Scroll in cell with coursor keys, scroll in time (next week) with
23Shift/Control + coursorkeys. 28Shift/Control + coursorkeys.
24 29
25Fixed bug that the todo view flat mode was reset after first view update. 30Fixed bug that the todo view flat mode was reset after first view update.
26 31
27If a todo is displayed closed in the todo view, 32If a todo is displayed closed in the todo view,
28it is now displayed in overdue/due today color depending on the subtodos overdue/due today properties. 33it is now displayed in overdue/due today color depending on the subtodos overdue/due today properties.
29 34
30Added info about the numbers of years to the caption (title) information about a birthday event. 35Added info about the numbers of years to the caption (title) information about a birthday event.
31 36
32Made completion date in todo editor editable. 37Made completion date in todo editor editable.
33 38
34Added possibility to save/load templates for journals. 39Added possibility to save/load templates for journals.
35(Which is just a simple "save text to file" or "insert text from file". 40(Which is just a simple "save text to file" or "insert text from file".
36 41
37********** VERSION 2.0.2 ************ 42********** VERSION 2.0.2 ************
38 43
39KO/Pi: 44KO/Pi:
40Fixed the layout problem of the day label buttons 45Fixed the layout problem of the day label buttons
41of the agenda view introduced in version 2.0.1. 46of the agenda view introduced in version 2.0.1.
42 47
43Added WhatsThis support for the todo view and the list view. 48Added WhatsThis support for the todo view and the list view.
44 49
45Added a quite useful feature to the montview. 50Added a quite useful feature to the montview.
46Just click on the week numbers on the left. 51Just click on the week numbers on the left.
47And in the top right corner of month view/agenda view 52And in the top right corner of month view/agenda view
48there is now a "week number quick selector". 53there is now a "week number quick selector".
49(Click on the black triangle). 54(Click on the black triangle).
50 55
51Made the quite difficult timezone change in KO/Pi easy. 56Made the quite difficult timezone change in KO/Pi easy.
52 57
53OM/Pi: 58OM/Pi:
54Fixed too small icons on desktop. 59Fixed too small icons on desktop.
55Fixed non visible icons in mainwindow on Z with fastload enabled. 60Fixed non visible icons in mainwindow on Z with fastload enabled.
56Added signature file setting to smtp account config. 61Added signature file setting to smtp account config.
57And the signature can be edited and saved in the edit mail dialog. 62And the signature can be edited and saved in the edit mail dialog.
58That does mean: 63That does mean:
59Simply edit the signature for the selected smtp account in the 64Simply edit the signature for the selected smtp account in the
60edit new mail dialog and press the "save signature" button there. 65edit new mail dialog and press the "save signature" button there.
61Then the signature is saved to the file specified in the smtp account settings. 66Then the signature is saved to the file specified in the smtp account settings.
62If there is no file specified, it is saved automatically to the file 67If there is no file specified, it is saved automatically to the file
63kdepim/apps/kopiemail/<accountname>.sig. 68kdepim/apps/kopiemail/<accountname>.sig.
64 69
65 70
66 71
67********** VERSION 2.0.1 ************ 72********** VERSION 2.0.1 ************
68 73
69Oooops ... I forgot to test on the Zaurus 5500 ... 74Oooops ... I forgot to test on the Zaurus 5500 ...
70 75
71Fixed many problems of new (english) strings (and german translations) 76Fixed many problems of new (english) strings (and german translations)
72introduced in the latest versions, where the text was not fitting on the 77introduced in the latest versions, where the text was not fitting on the
73240x320 display of the Zaurus 5500. 78240x320 display of the Zaurus 5500.
74 79
75KO/Pi: 80KO/Pi:
76Added a popup menu ( press pen and hold to get popup ) to the agenda view 81Added a popup menu ( press pen and hold to get popup ) to the agenda view
77with many useful items (add event/todo, show next week, two weeks, month, journal). 82with many useful items (add event/todo, show next week, two weeks, month, journal).
78 83
79Added items to the todolist popup menu for: 84Added items to the todolist popup menu for:
80Display all opened, all closed or all todos flat. 85Display all opened, all closed or all todos flat.
81The "flat" view makes is possible to sort all todos after ,e.g., prio or date. 86The "flat" view makes is possible to sort all todos after ,e.g., prio or date.
82Made the reparenting of todos on the desktop possible via Drag&Drop. 87Made the reparenting of todos on the desktop possible via Drag&Drop.
83Fixed several bugs in setting the completed datetime for todos. 88Fixed several bugs in setting the completed datetime for todos.
84Added info about completed datetime of todos to the todo viewer. 89Added info about completed datetime of todos to the todo viewer.
85Now displaying a completed todo (with completed datetime set) in the agenda view 90Now displaying a completed todo (with completed datetime set) in the agenda view
86at the time of the completion. Such that now it is possible to see in the agenda view 91at the time of the completion. Such that now it is possible to see in the agenda view
87when what todo was completed. 92when what todo was completed.
88Fixed behaviour of automatic setting completion of todos with sub-todos/parent todos. 93Fixed behaviour of automatic setting completion of todos with sub-todos/parent todos.
89Now the behaviour is: 94Now the behaviour is:
90Setting a parent to complete sets all (sub)childs to complete. 95Setting a parent to complete sets all (sub)childs to complete.
91Setting a parent to uncomplete does not change the childs. 96Setting a parent to uncomplete does not change the childs.
92Setting a child to uncomplete sets all parent to uncomplete. 97Setting a child to uncomplete sets all parent to uncomplete.
93Setting a child to complete does not change the parents. 98Setting a child to complete does not change the parents.
94 99
95Smart updating and double buffering of the daymatrix. 100Smart updating and double buffering of the daymatrix.
96Showing holidays in the day matrix. 101Showing holidays in the day matrix.
97Many other small performance updates. 102Many other small performance updates.
98 103
99Made day labels in agenda clickable. By clicking a label, the day is displayed in single day mode. 104Made day labels in agenda clickable. By clicking a label, the day is displayed in single day mode.
100 105
101Now the translation file usertranslation.txt is supposed to be in utf8 format. 106Now the translation file usertranslation.txt is supposed to be in utf8 format.
102If you want to translate a language from western europe, just change the germantranslation.txt file. Please read the updated Usertranslation HowTo in KO/Pi Help menu. 107If you want to translate a language from western europe, just change the germantranslation.txt file. Please read the updated Usertranslation HowTo in KO/Pi Help menu.
103 108
diff --git a/korganizer/koeditorgeneraltodo.cpp b/korganizer/koeditorgeneraltodo.cpp
index ce66863..da5ef07 100644
--- a/korganizer/koeditorgeneraltodo.cpp
+++ b/korganizer/koeditorgeneraltodo.cpp
@@ -71,193 +71,193 @@ void KOEditorGeneralTodo::finishSetup()
71// QWidget::setTabOrder(mStartCheck, mStartDateEdit); 71// QWidget::setTabOrder(mStartCheck, mStartDateEdit);
72// QWidget::setTabOrder(mStartDateEdit, mStartTimeEdit); 72// QWidget::setTabOrder(mStartDateEdit, mStartTimeEdit);
73// QWidget::setTabOrder(mStartTimeEdit, mTimeButton); 73// QWidget::setTabOrder(mStartTimeEdit, mTimeButton);
74// QWidget::setTabOrder(mTimeButton, mCompletedCombo); 74// QWidget::setTabOrder(mTimeButton, mCompletedCombo);
75// QWidget::setTabOrder(mCompletedCombo, mPriorityCombo); 75// QWidget::setTabOrder(mCompletedCombo, mPriorityCombo);
76// QWidget::setTabOrder(mPriorityCombo, mAlarmButton); 76// QWidget::setTabOrder(mPriorityCombo, mAlarmButton);
77// QWidget::setTabOrder(mAlarmButton, mCategoriesButton); 77// QWidget::setTabOrder(mAlarmButton, mCategoriesButton);
78// QWidget::setTabOrder(mCategoriesButton, mSecrecyCombo); 78// QWidget::setTabOrder(mCategoriesButton, mSecrecyCombo);
79// QWidget::setTabOrder(mSecrecyCombo, mDescriptionEdit); 79// QWidget::setTabOrder(mSecrecyCombo, mDescriptionEdit);
80 mSummaryEdit->load(KOLocationBox::SUMMARYTODO); 80 mSummaryEdit->load(KOLocationBox::SUMMARYTODO);
81 mSummaryEdit->setFocus(); 81 mSummaryEdit->setFocus();
82} 82}
83 83
84void KOEditorGeneralTodo::initTime(QWidget *parent,QBoxLayout *topLayout) 84void KOEditorGeneralTodo::initTime(QWidget *parent,QBoxLayout *topLayout)
85{ 85{
86 QBoxLayout *timeLayout = new QVBoxLayout(topLayout); 86 QBoxLayout *timeLayout = new QVBoxLayout(topLayout);
87 87
88 QGroupBox *timeGroupBox = new QGroupBox(1,QGroupBox::Horizontal, 88 QGroupBox *timeGroupBox = new QGroupBox(1,QGroupBox::Horizontal,
89 i18n("Date && Time"),parent); 89 i18n("Date && Time"),parent);
90 timeLayout->addWidget(timeGroupBox); 90 timeLayout->addWidget(timeGroupBox);
91 timeGroupBox->layout()->setSpacing( 0 ); 91 timeGroupBox->layout()->setSpacing( 0 );
92 timeGroupBox->layout()->setMargin( 5 ); 92 timeGroupBox->layout()->setMargin( 5 );
93 QFrame *timeBoxFrame = new QFrame(timeGroupBox); 93 QFrame *timeBoxFrame = new QFrame(timeGroupBox);
94 94
95 QGridLayout *layoutTimeBox = new QGridLayout(timeBoxFrame,3,3); 95 QGridLayout *layoutTimeBox = new QGridLayout(timeBoxFrame,3,3);
96 layoutTimeBox->setSpacing(topLayout->spacing()); 96 layoutTimeBox->setSpacing(topLayout->spacing());
97 layoutTimeBox->setColStretch( 1, 1 ); 97 layoutTimeBox->setColStretch( 1, 1 );
98 98
99 mDueCheck = new QCheckBox(i18n("Due:"),timeBoxFrame); 99 mDueCheck = new QCheckBox(i18n("Due:"),timeBoxFrame);
100 layoutTimeBox->addWidget(mDueCheck,0,0); 100 layoutTimeBox->addWidget(mDueCheck,0,0);
101 connect(mDueCheck,SIGNAL(toggled(bool)),SLOT(enableDueEdit(bool))); 101 connect(mDueCheck,SIGNAL(toggled(bool)),SLOT(enableDueEdit(bool)));
102 connect(mDueCheck,SIGNAL(toggled(bool)),SLOT(showAlarm())); 102 connect(mDueCheck,SIGNAL(toggled(bool)),SLOT(showAlarm()));
103 103
104 104
105 mDueDateEdit = new KDateEdit(timeBoxFrame); 105 mDueDateEdit = new KDateEdit(timeBoxFrame);
106 layoutTimeBox->addWidget(mDueDateEdit,0,1); 106 layoutTimeBox->addWidget(mDueDateEdit,0,1);
107 107
108 mDueTimeEdit = new KOTimeEdit(timeBoxFrame); 108 mDueTimeEdit = new KOTimeEdit(timeBoxFrame);
109 layoutTimeBox->addWidget(mDueTimeEdit,0,2); 109 layoutTimeBox->addWidget(mDueTimeEdit,0,2);
110 110
111 111
112 mStartCheck = new QCheckBox(i18n("Start:"),timeBoxFrame); 112 mStartCheck = new QCheckBox(i18n("Start:"),timeBoxFrame);
113 layoutTimeBox->addWidget(mStartCheck,1,0); 113 layoutTimeBox->addWidget(mStartCheck,1,0);
114 connect(mStartCheck,SIGNAL(toggled(bool)),SLOT(enableStartEdit(bool))); 114 connect(mStartCheck,SIGNAL(toggled(bool)),SLOT(enableStartEdit(bool)));
115 115
116 mStartDateEdit = new KDateEdit(timeBoxFrame); 116 mStartDateEdit = new KDateEdit(timeBoxFrame);
117 layoutTimeBox->addWidget(mStartDateEdit,1,1); 117 layoutTimeBox->addWidget(mStartDateEdit,1,1);
118 118
119 mStartTimeEdit = new KOTimeEdit(timeBoxFrame); 119 mStartTimeEdit = new KOTimeEdit(timeBoxFrame);
120 layoutTimeBox->addWidget(mStartTimeEdit,1,2); 120 layoutTimeBox->addWidget(mStartTimeEdit,1,2);
121 121
122 122
123 mTimeButton = new QCheckBox(i18n("Time associated"),timeBoxFrame); 123 mTimeButton = new QCheckBox(i18n("Time associated"),timeBoxFrame);
124 layoutTimeBox->addMultiCellWidget(mTimeButton,2,2,0,1); 124 layoutTimeBox->addMultiCellWidget(mTimeButton,2,2,0,1);
125 125
126 connect(mTimeButton,SIGNAL(toggled(bool)),SLOT(enableTimeEdits(bool))); 126 connect(mTimeButton,SIGNAL(toggled(bool)),SLOT(enableTimeEdits(bool)));
127 127
128 // some more layouting 128 // some more layouting
129 //layoutTimeBox->setColStretch(3,1); 129 //layoutTimeBox->setColStretch(3,1);
130} 130}
131 131
132 132
133void KOEditorGeneralTodo::initCompletion(QWidget *parent, QBoxLayout *topLayout) 133void KOEditorGeneralTodo::initCompletion(QWidget *parent, QBoxLayout *topLayout)
134{ 134{
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
172void KOEditorGeneralTodo::initPriority(QWidget *parent, QBoxLayout *topLayout) 172void 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
188void KOEditorGeneralTodo::initStatus(QWidget *parent,QBoxLayout *topLayout) 188void 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
199void KOEditorGeneralTodo::setDefaults(QDateTime due,bool allDay) 199void KOEditorGeneralTodo::setDefaults(QDateTime due,bool allDay)
200{ 200{
201 201
202 mSummaryEdit->load(KOLocationBox::SUMMARYTODO); 202 mSummaryEdit->load(KOLocationBox::SUMMARYTODO);
203 mLocationEdit->load(KOLocationBox::LOCATION); 203 mLocationEdit->load(KOLocationBox::LOCATION);
204 KOEditorGeneral::setDefaults(allDay); 204 KOEditorGeneral::setDefaults(allDay);
205 205
206 mTimeButton->setChecked( !allDay ); 206 mTimeButton->setChecked( !allDay );
207 if(mTimeButton->isChecked()) { 207 if(mTimeButton->isChecked()) {
208 mTimeButton->setEnabled(true); 208 mTimeButton->setEnabled(true);
209 } 209 }
210 else { 210 else {
211 mTimeButton->setEnabled(false); 211 mTimeButton->setEnabled(false);
212 } 212 }
213 213
214 enableTimeEdits( !allDay ); 214 enableTimeEdits( !allDay );
215 if ( due.isValid() ) { 215 if ( due.isValid() ) {
216 mDueCheck->setChecked(true); 216 mDueCheck->setChecked(true);
217 enableDueEdit(true); 217 enableDueEdit(true);
218 } else { 218 } else {
219 mDueCheck->setChecked(false); 219 mDueCheck->setChecked(false);
220 enableDueEdit(false); 220 enableDueEdit(false);
221 due = QDateTime::currentDateTime().addDays(7); 221 due = QDateTime::currentDateTime().addDays(7);
222 } 222 }
223 223
224 alarmDisable(true); 224 alarmDisable(true);
225 225
226 mStartCheck->setChecked(false); 226 mStartCheck->setChecked(false);
227 enableStartEdit(false); 227 enableStartEdit(false);
228 228
229 mDueDateEdit->setDate(due.date()); 229 mDueDateEdit->setDate(due.date());
230 mDueTimeEdit->setTime(due.time()); 230 mDueTimeEdit->setTime(due.time());
231 due = due.addDays(-7); 231 due = due.addDays(-7);
232 mStartDateEdit->setDate(due.date()); 232 mStartDateEdit->setDate(due.date());
233 mStartTimeEdit->setTime(due.time()); 233 mStartTimeEdit->setTime(due.time());
234 234
235 mPriorityCombo->setCurrentItem(2); 235 mPriorityCombo->setCurrentItem(2);
236 mCompletedLabel->setText(i18n("completed"));; 236 mCompletedLabel->setText(i18n("completed"));;
237 mCompletedCombo->setCurrentItem(0); 237 mCompletedCombo->setCurrentItem(0);
238} 238}
239 239
240void KOEditorGeneralTodo::readTodo(Todo *todo) 240void KOEditorGeneralTodo::readTodo(Todo *todo)
241{ 241{
242 242
243 mSummaryEdit->load(KOLocationBox::SUMMARYTODO); 243 mSummaryEdit->load(KOLocationBox::SUMMARYTODO);
244 mLocationEdit->load(KOLocationBox::LOCATION); 244 mLocationEdit->load(KOLocationBox::LOCATION);
245 KOEditorGeneral::readIncidence(todo); 245 KOEditorGeneral::readIncidence(todo);
246 246
247 QDateTime dueDT; 247 QDateTime dueDT;
248 248
249 if (todo->hasDueDate()) { 249 if (todo->hasDueDate()) {
250 enableAlarmEdit(true); 250 enableAlarmEdit(true);
251 dueDT = todo->dtDue(); 251 dueDT = todo->dtDue();
252 mDueDateEdit->setDate(todo->dtDue().date()); 252 mDueDateEdit->setDate(todo->dtDue().date());
253 mDueTimeEdit->setTime(todo->dtDue().time()); 253 mDueTimeEdit->setTime(todo->dtDue().time());
254 mDueCheck->setChecked(true); 254 mDueCheck->setChecked(true);
255 } else { 255 } else {
256 alarmDisable(true); 256 alarmDisable(true);
257 mDueDateEdit->setEnabled(false); 257 mDueDateEdit->setEnabled(false);
258 mDueTimeEdit->setEnabled(false); 258 mDueTimeEdit->setEnabled(false);
259 mDueDateEdit->setDate(QDate::currentDate()); 259 mDueDateEdit->setDate(QDate::currentDate());
260 mDueTimeEdit->setTime(QTime::currentTime()); 260 mDueTimeEdit->setTime(QTime::currentTime());
261 mDueCheck->setChecked(false); 261 mDueCheck->setChecked(false);
262 } 262 }
263 263
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 5926abe..ffb2e1e 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -1,191 +1,191 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000,2001 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 19
20#include <qpopupmenu.h> 20#include <qpopupmenu.h>
21#include <qfont.h> 21#include <qfont.h>
22#include <qfontmetrics.h> 22#include <qfontmetrics.h>
23#include <qkeycode.h> 23#include <qkeycode.h>
24#include <qhbox.h> 24#include <qhbox.h>
25#include <qtimer.h> 25#include <qtimer.h>
26#include <qvbox.h> 26#include <qvbox.h>
27#include <qwidgetstack.h> 27#include <qwidgetstack.h>
28#include <qpushbutton.h> 28#include <qpushbutton.h>
29#include <qtooltip.h> 29#include <qtooltip.h>
30#include <qpainter.h> 30#include <qpainter.h>
31#include <qwhatsthis.h> 31#include <qwhatsthis.h>
32#ifndef DESKTOP_VERSION 32#ifndef DESKTOP_VERSION
33#include <qpe/qpeapplication.h> 33#include <qpe/qpeapplication.h>
34#else 34#else
35#include <qapplication.h> 35#include <qapplication.h>
36#endif 36#endif
37 37
38#include <kdebug.h> 38#include <kdebug.h>
39#include <klocale.h> 39#include <klocale.h>
40#include <kglobal.h> 40#include <kglobal.h>
41#include <kconfig.h> 41#include <kconfig.h>
42#include <kiconloader.h> 42#include <kiconloader.h>
43 43
44#include <kcalendarsystem.h> 44#include <kcalendarsystem.h>
45 45
46#ifndef KORG_NOPRINTER 46#ifndef KORG_NOPRINTER
47#include "calprinter.h" 47#include "calprinter.h"
48#endif 48#endif
49#include "koprefs.h" 49#include "koprefs.h"
50#ifndef KORG_NOPLUGINS 50#ifndef KORG_NOPLUGINS
51#include "kocore.h" 51#include "kocore.h"
52#endif 52#endif
53#include "koglobals.h" 53#include "koglobals.h"
54#include <libkcal/kincidenceformatter.h> 54#include <libkcal/kincidenceformatter.h>
55 55
56#include "komonthview.h" 56#include "komonthview.h"
57 57
58#define PIXMAP_SIZE 5 58#define PIXMAP_SIZE 5
59#ifdef DESKTOP_VERSION 59#ifdef DESKTOP_VERSION
60QToolTipGroup *MonthViewCell::mToolTipGroup = 0; 60QToolTipGroup *MonthViewCell::mToolTipGroup = 0;
61#endif 61#endif
62class KNOWhatsThis :public QWhatsThis 62class KNOWhatsThis :public QWhatsThis
63{ 63{
64public: 64public:
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
68protected: 68protected:
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 };
73private: 73private:
74 KNoScrollListBox* _wid; 74 KNoScrollListBox* _wid;
75 75
76}; 76};
77 77
78 78
79KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name) 79KNoScrollListBox::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}
87KNoScrollListBox::~KNoScrollListBox() 87KNoScrollListBox::~KNoScrollListBox()
88{ 88{
89 89
90} 90}
91QString KNoScrollListBox::getWhatsThisText(QPoint p) 91QString 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}
99void KNoScrollListBox::keyPressEvent(QKeyEvent *e) 99void 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);
128 } else { 128 } else {
129 setTopItem(topItem()-1); 129 setTopItem(topItem()-1);
130 } 130 }
131 } 131 }
132 break; 132 break;
133 case Key_Down: 133 case Key_Down:
134 if(e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { 134 if(e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) {
135 e->ignore(); 135 e->ignore();
136 break; 136 break;
137 } 137 }
138 setCurrentItem((currentItem()+1)%count()); 138 setCurrentItem((currentItem()+1)%count());
139 if(!itemVisible(currentItem())) { 139 if(!itemVisible(currentItem())) {
140 if(currentItem() == 0) { 140 if(currentItem() == 0) {
141 setTopItem(0); 141 setTopItem(0);
142 } else { 142 } else {
143 setTopItem(topItem()+1); 143 setTopItem(topItem()+1);
144 } 144 }
145 } 145 }
146 break; 146 break;
147 case Key_I: 147 case Key_I:
148 QTimer::singleShot( 11, this, SLOT ( oneDown() ) ); 148 QTimer::singleShot( 11, this, SLOT ( oneDown() ) );
149 e->ignore(); 149 e->ignore();
150 break; 150 break;
151 case Key_Shift: 151 case Key_Shift:
152 emit shiftDown(); 152 emit shiftDown();
153 break; 153 break;
154 default: 154 default:
155 e->ignore(); 155 e->ignore();
156 break; 156 break;
157 } 157 }
158} 158}
159 159
160void KNoScrollListBox::oneDown() 160void KNoScrollListBox::oneDown()
161{ 161{
162 setCurrentItem((currentItem()+1)%count()); 162 setCurrentItem((currentItem()+1)%count());
163 if(!itemVisible(currentItem())) { 163 if(!itemVisible(currentItem())) {
164 if(currentItem() == 0) { 164 if(currentItem() == 0) {
165 setTopItem(0); 165 setTopItem(0);
166 } else { 166 } else {
167 setTopItem(topItem()+1); 167 setTopItem(topItem()+1);
168 } 168 }
169 } 169 }
170} 170}
171void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e) 171void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e)
172{ 172{
173 switch(e->key()) { 173 switch(e->key()) {
174 case Key_Shift: 174 case Key_Shift:
175 emit shiftUp(); 175 emit shiftUp();
176 break; 176 break;
177 default: 177 default:
178 break; 178 break;
179 } 179 }
180} 180}
181 181
182void KNoScrollListBox::mousePressEvent(QMouseEvent *e) 182void KNoScrollListBox::mousePressEvent(QMouseEvent *e)
183{ 183{
184 QListBox::mousePressEvent(e); 184 QListBox::mousePressEvent(e);
185 185
186 if(e->button() == RightButton) { 186 if(e->button() == RightButton) {
187 emit rightClick(); 187 emit rightClick();
188 } 188 }
189} 189}
190 190
191MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s) 191MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s)
@@ -226,193 +226,193 @@ void MonthViewItem::paint(QPainter *p)
226 if ( mInfo ) { 226 if ( mInfo ) {
227 p->fillRect ( x, y,size,size, Qt::darkGreen ); 227 p->fillRect ( x, y,size,size, Qt::darkGreen );
228 x += size + 1; 228 x += size + 1;
229 } 229 }
230 if ( mRecur ) { 230 if ( mRecur ) {
231 p->fillRect ( x, y,size,size, Qt::blue ); 231 p->fillRect ( x, y,size,size, Qt::blue );
232 x += size + 1; 232 x += size + 1;
233 } 233 }
234 if ( mAlarm ) { 234 if ( mAlarm ) {
235 p->fillRect ( x, y,size,size, Qt::red ); 235 p->fillRect ( x, y,size,size, Qt::red );
236 x += size + 1; 236 x += size + 1;
237 } 237 }
238 if ( mReply ) { 238 if ( mReply ) {
239 p->fillRect ( x, y,size,size, Qt::yellow ); 239 p->fillRect ( x, y,size,size, Qt::yellow );
240 x += size + 1; 240 x += size + 1;
241 } 241 }
242 } 242 }
243 QFontMetrics fm = p->fontMetrics(); 243 QFontMetrics fm = p->fontMetrics();
244 int yPos; 244 int yPos;
245 int pmheight = size; 245 int pmheight = size;
246 if( pmheight < fm.height() ) 246 if( pmheight < fm.height() )
247 yPos = fm.ascent() + fm.leading()/2; 247 yPos = fm.ascent() + fm.leading()/2;
248 else 248 else
249 yPos = pmheight/2 - fm.height()/2 + fm.ascent(); 249 yPos = pmheight/2 - fm.height()/2 + fm.ascent();
250 p->setPen( palette().color( QPalette::Normal, sel ? \ 250 p->setPen( palette().color( QPalette::Normal, sel ? \
251 QColorGroup::HighlightedText : QColorGroup::Foreground ) ); 251 QColorGroup::HighlightedText : QColorGroup::Foreground ) );
252 p->drawText( x, yPos, text() ); 252 p->drawText( x, yPos, text() );
253 if ( mIncidence->cancelled() ) { 253 if ( mIncidence->cancelled() ) {
254 int wid = fm.width( text() ); 254 int wid = fm.width( text() );
255 p->drawLine( x, yPos- fm.height()/2+3,x+wid, yPos- fm.height()/2 +3); 255 p->drawLine( x, yPos- fm.height()/2+3,x+wid, yPos- fm.height()/2 +3);
256 } 256 }
257 257
258} 258}
259 259
260int MonthViewItem::height(const QListBox *lb) const 260int MonthViewItem::height(const QListBox *lb) const
261{ 261{
262 return lb->fontMetrics().lineSpacing()+1; 262 return lb->fontMetrics().lineSpacing()+1;
263} 263}
264 264
265int MonthViewItem::width(const QListBox *lb) const 265int MonthViewItem::width(const QListBox *lb) const
266{ 266{
267 int size = PIXMAP_SIZE; 267 int size = PIXMAP_SIZE;
268 if ( QApplication::desktop()->width() < 300 ) 268 if ( QApplication::desktop()->width() < 300 )
269 size = 3; 269 size = 3;
270 int x = 1; 270 int x = 1;
271 if ( mInfo ) { 271 if ( mInfo ) {
272 x += size + 1; 272 x += size + 1;
273 } 273 }
274 if( mRecur ) { 274 if( mRecur ) {
275 x += size+1; 275 x += size+1;
276 } 276 }
277 if( mAlarm ) { 277 if( mAlarm ) {
278 x += size+1; 278 x += size+1;
279 } 279 }
280 if( mReply ) { 280 if( mReply ) {
281 x += size+1; 281 x += size+1;
282 } 282 }
283 283
284 return( x + lb->fontMetrics().width( text() ) + 1 ); 284 return( x + lb->fontMetrics().width( text() ) + 1 );
285} 285}
286 286
287 287
288MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par ) 288MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par )
289 : QWidget( par ), 289 : 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
329QToolTipGroup *MonthViewCell::toolTipGroup() 329QToolTipGroup *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
336void MonthViewCell::setDate( const QDate &date ) 336void 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
346QDate MonthViewCell::date() const 346QDate MonthViewCell::date() const
347{ 347{
348 return mDate; 348 return mDate;
349} 349}
350 350
351void MonthViewCell::setPrimary( bool primary ) 351void MonthViewCell::setPrimary( bool primary )
352{ 352{
353 mPrimary = primary; 353 mPrimary = primary;
354 //setMyPalette(); 354 //setMyPalette();
355} 355}
356void MonthViewCell::setMyPalette() 356void MonthViewCell::setMyPalette()
357{ 357{
358 358
359 if ( mHoliday) { 359 if ( mHoliday) {
360 setPalette( mHolidayPalette ); 360 setPalette( mHolidayPalette );
361 } else { 361 } else {
362 if ( mPrimary ) { 362 if ( mPrimary ) {
363 setPalette( mPrimaryPalette ); 363 setPalette( mPrimaryPalette );
364 } else { 364 } else {
365 setPalette( mNonPrimaryPalette ); 365 setPalette( mNonPrimaryPalette );
366 } 366 }
367 } 367 }
368 QPalette pal = palette(); 368 QPalette pal = palette();
369 369
370 mLabel->setPalette( QPalette ( pal.color( QPalette::Normal,QColorGroup::Base),pal.color(QPalette::Normal,QColorGroup::Base ) )); 370 mLabel->setPalette( QPalette ( pal.color( QPalette::Normal,QColorGroup::Base),pal.color(QPalette::Normal,QColorGroup::Base ) ));
371} 371}
372QPalette MonthViewCell::getPalette () 372QPalette MonthViewCell::getPalette ()
373{ 373{
374 if ( !KOPrefs::instance()->mMonthViewUsesDayColors ) 374 if ( !KOPrefs::instance()->mMonthViewUsesDayColors )
375 return mStandardPalette; 375 return mStandardPalette;
376 if ( mHoliday) { 376 if ( mHoliday) {
377 return mHolidayPalette ; 377 return mHolidayPalette ;
378 } else { 378 } else {
379 if ( mPrimary ) { 379 if ( mPrimary ) {
380 return mPrimaryPalette ; 380 return mPrimaryPalette ;
381 } 381 }
382 } 382 }
383 return mNonPrimaryPalette; 383 return mNonPrimaryPalette;
384} 384}
385bool MonthViewCell::isPrimary() const 385bool MonthViewCell::isPrimary() const
386{ 386{
387 return mPrimary; 387 return mPrimary;
388} 388}
389 389
390void MonthViewCell::setHoliday( bool holiday ) 390void MonthViewCell::setHoliday( bool holiday )
391{ 391{
392 mHoliday = holiday; 392 mHoliday = holiday;
393 //setMyPalette(); 393 //setMyPalette();
394} 394}
395 395
396void MonthViewCell::setHoliday( const QString &holiday ) 396void MonthViewCell::setHoliday( const QString &holiday )
397{ 397{
398 mHolidayString = holiday; 398 mHolidayString = holiday;
399 399
400 if ( !holiday.isEmpty() ) { 400 if ( !holiday.isEmpty() ) {
401 setHoliday( true ); 401 setHoliday( true );
402 } 402 }
403} 403}
404void MonthViewCell::keyPressEvent ( QKeyEvent * e ) 404void MonthViewCell::keyPressEvent ( QKeyEvent * e )
405{ 405{
406 406
407 e->ignore(); 407 e->ignore();
408 408
409} 409}
410void MonthViewCell::clear() 410void MonthViewCell::clear()
411{ 411{
412 mItemList->clear(); 412 mItemList->clear();
413 QApplication::removePostedEvents ( mItemList ); 413 QApplication::removePostedEvents ( mItemList );
414 QApplication::removePostedEvents ( mLabel ); 414 QApplication::removePostedEvents ( mLabel );
415 QApplication::removePostedEvents ( this ); 415 QApplication::removePostedEvents ( this );
416} 416}
417 417
418void MonthViewCell::startUpdateCell() 418void MonthViewCell::startUpdateCell()
@@ -459,229 +459,230 @@ void MonthViewCell::insertEvent(Event *event)
459 return; 459 return;
460 else 460 else
461 if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly ) 461 if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly )
462 return; 462 return;
463 } 463 }
464 464
465 if ( event->categories().contains("Holiday") || 465 if ( event->categories().contains("Holiday") ||
466 event->categories().contains(i18n("Holiday"))) { 466 event->categories().contains(i18n("Holiday"))) {
467 setHoliday( true ); 467 setHoliday( true );
468 if ( mDate.dayOfWeek() == 7 ) 468 if ( mDate.dayOfWeek() == 7 )
469 mItemList->setLineWidth( 3 ); 469 mItemList->setLineWidth( 3 );
470 } 470 }
471 QString text; 471 QString text;
472 if (event->isMultiDay()) { 472 if (event->isMultiDay()) {
473 QString prefix = "<->"; 473 QString prefix = "<->";
474 if ( event->doesRecur() ) { 474 if ( event->doesRecur() ) {
475 if ( event->recursOn( mDate) ) 475 if ( event->recursOn( mDate) )
476 prefix ="->" ; 476 prefix ="->" ;
477 else { 477 else {
478 int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); 478 int days = event->dtStart().date().daysTo ( event->dtEnd().date() );
479 if ( event->recursOn( mDate.addDays( -days)) ) 479 if ( event->recursOn( mDate.addDays( -days)) )
480 prefix ="<-" ; 480 prefix ="<-" ;
481 } 481 }
482 482
483 } else { 483 } else {
484 if (mDate == event->dtStart().date()) { 484 if (mDate == event->dtStart().date()) {
485 prefix ="->" ; 485 prefix ="->" ;
486 } else if (mDate == event->dtEnd().date()) { 486 } else if (mDate == event->dtEnd().date()) {
487 prefix ="<-" ; 487 prefix ="<-" ;
488 } 488 }
489 } 489 }
490 if ( !event->doesFloat() ) { 490 if ( !event->doesFloat() ) {
491 if ( mDate == event->dtStart().date () ) 491 if ( mDate == event->dtStart().date () )
492 prefix += KGlobal::locale()->formatTime(event->dtStart().time())+" "; 492 prefix += KGlobal::locale()->formatTime(event->dtStart().time())+" ";
493 else if ( mDate == event->dtEnd().date () ) 493 else if ( mDate == event->dtEnd().date () )
494 prefix += KGlobal::locale()->formatTime(event->dtEnd().time())+" "; 494 prefix += KGlobal::locale()->formatTime(event->dtEnd().time())+" ";
495 495
496 } 496 }
497 text = prefix + event->summary(); 497 text = prefix + event->summary();
498 mToolTip += text; 498 mToolTip += text;
499 } else { 499 } else {
500 if (event->doesFloat()) { 500 if (event->doesFloat()) {
501 text = event->summary(); 501 text = event->summary();
502 mToolTip += text; 502 mToolTip += text;
503 } 503 }
504 else { 504 else {
505 text = KGlobal::locale()->formatTime(event->dtStart().time()); 505 text = KGlobal::locale()->formatTime(event->dtStart().time());
506 text += " " + event->summary(); 506 text += " " + event->summary();
507 mToolTip += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); 507 mToolTip += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary();
508 } 508 }
509 } 509 }
510 510
511 MonthViewItem *item = new MonthViewItem( event, mDate, text ); 511 MonthViewItem *item = new MonthViewItem( event, mDate, text );
512 QPalette pal; 512 QPalette pal;
513 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { 513 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) {
514 QStringList categories = event->categories(); 514 QStringList categories = event->categories();
515 QString cat = categories.first(); 515 QString cat = categories.first();
516 if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { 516 if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) {
517 pal = getPalette(); 517 pal = getPalette();
518 if (cat.isEmpty()) { 518 if (cat.isEmpty()) {
519 pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); 519 pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor);
520 } else { 520 } else {
521 pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); 521 pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat)));
522 } 522 }
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}
553void MonthViewCell::insertTodo(Todo *todo) 553void 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}
593void MonthViewCell::finishUpdateCell() 594void 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}
616void MonthViewCell::updateCell() 617void 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;
624 for( event = events.first(); event; event = events.next() ) { // for event 625 for( event = events.first(); event; event = events.next() ) { // for event
625 insertEvent(event); 626 insertEvent(event);
626 } 627 }
627 // insert due todos 628 // insert due todos
628 QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); 629 QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate );
629 Todo *todo; 630 Todo *todo;
630 for(todo = todos.first(); todo; todo = todos.next()) { 631 for(todo = todos.first(); todo; todo = todos.next()) {
631 insertTodo( todo ); 632 insertTodo( todo );
632 } 633 }
633 finishUpdateCell(); 634 finishUpdateCell();
634 // if ( isVisible()) 635 // if ( isVisible())
635 //qApp->processEvents(); 636 //qApp->processEvents();
636} 637}
637 638
638void MonthViewCell::updateConfig( bool bigFont ) // = false 639void MonthViewCell::updateConfig( bool bigFont ) // = false
639{ 640{
640 641
641 if ( bigFont ) { 642 if ( bigFont ) {
642 QFont fo = KOPrefs::instance()->mMonthViewFont; 643 QFont fo = KOPrefs::instance()->mMonthViewFont;
643 int ps = fo.pointSize() + 2; 644 int ps = fo.pointSize() + 2;
644 if ( ps < 18 ) 645 if ( ps < 18 )
645 ps += 2; 646 ps += 2;
646 fo.setPointSize( ps ); 647 fo.setPointSize( ps );
647 setFont( fo ); 648 setFont( fo );
648 } else 649 } else
649 setFont( KOPrefs::instance()->mMonthViewFont ); 650 setFont( KOPrefs::instance()->mMonthViewFont );
650 651
651 QFontMetrics fm( font() ); 652 QFontMetrics fm( font() );
652 mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 ); 653 mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 );
653 mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 ); 654 mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 );
654 mHolidayPalette = mStandardPalette; 655 mHolidayPalette = mStandardPalette;
655 mPrimaryPalette = mStandardPalette; 656 mPrimaryPalette = mStandardPalette;
656 mNonPrimaryPalette = mStandardPalette; 657 mNonPrimaryPalette = mStandardPalette;
657 if ( KOPrefs::instance()->mMonthViewUsesDayColors ) { 658 if ( KOPrefs::instance()->mMonthViewUsesDayColors ) {
658 mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor ); 659 mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor );
659 mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor ); 660 mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor );
660 mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark()); 661 mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark());
661 mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark()); 662 mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark());
662 mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor); 663 mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor);
663 mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor); 664 mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor);
664 mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark()); 665 mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark());
665 mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor); 666 mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor);
666 mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor); 667 mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor);
667 } 668 }
668 //updateCell(); 669 //updateCell();
669} 670}
670 671
671void MonthViewCell::enableScrollBars( bool enabled ) 672void MonthViewCell::enableScrollBars( bool enabled )
672{ 673{
673 if ( enabled ) { 674 if ( enabled ) {
674 mItemList->setVScrollBarMode(QScrollView::Auto); 675 mItemList->setVScrollBarMode(QScrollView::Auto);
675 mItemList->setHScrollBarMode(QScrollView::Auto); 676 mItemList->setHScrollBarMode(QScrollView::Auto);
676 } else { 677 } else {
677 mItemList->setVScrollBarMode(QScrollView::AlwaysOff); 678 mItemList->setVScrollBarMode(QScrollView::AlwaysOff);
678 mItemList->setHScrollBarMode(QScrollView::AlwaysOff); 679 mItemList->setHScrollBarMode(QScrollView::AlwaysOff);
679 } 680 }
680} 681}
681 682
682Incidence *MonthViewCell::selectedIncidence() 683Incidence *MonthViewCell::selectedIncidence()
683{ 684{
684 int index = mItemList->currentItem(); 685 int index = mItemList->currentItem();
685 if ( index < 0 ) return 0; 686 if ( index < 0 ) return 0;
686 687
687 MonthViewItem *item = 688 MonthViewItem *item =
@@ -689,193 +690,192 @@ Incidence *MonthViewCell::selectedIncidence()
689 690
690 if ( !item ) return 0; 691 if ( !item ) return 0;
691 692
692 return item->incidence(); 693 return item->incidence();
693} 694}
694 695
695QDate MonthViewCell::selectedIncidenceDate() 696QDate MonthViewCell::selectedIncidenceDate()
696{ 697{
697 QDate qd; 698 QDate qd;
698 int index = mItemList->currentItem(); 699 int index = mItemList->currentItem();
699 if ( index < 0 ) return qd; 700 if ( index < 0 ) return qd;
700 701
701 MonthViewItem *item = 702 MonthViewItem *item =
702 static_cast<MonthViewItem *>( mItemList->item( index ) ); 703 static_cast<MonthViewItem *>( mItemList->item( index ) );
703 704
704 if ( !item ) return qd; 705 if ( !item ) return qd;
705 706
706 return item->incidenceDate(); 707 return item->incidenceDate();
707} 708}
708 709
709void MonthViewCell::deselect() 710void MonthViewCell::deselect()
710{ 711{
711 mItemList->clearSelection(); 712 mItemList->clearSelection();
712 enableScrollBars( false ); 713 enableScrollBars( false );
713 // updateCell(); 714 // updateCell();
714} 715}
715void MonthViewCell::select() 716void MonthViewCell::select()
716{ 717{
717 ;// updateCell(); 718 ;// updateCell();
718} 719}
719 720
720void MonthViewCell::resizeEvent ( QResizeEvent * ) 721void MonthViewCell::resizeEvent ( QResizeEvent * )
721{ 722{
722 if ( !mMonthView->isUpdatePossible() ) 723 if ( !mMonthView->isUpdatePossible() )
723 return; 724 return;
724 725
725 int size = height() - mLabel->height() - 2; 726 int size = height() - mLabel->height() - 2;
726 if ( size > 0 ) 727 if ( size > 0 )
727 mItemList->verticalScrollBar()->setMaximumHeight( size ); 728 mItemList->verticalScrollBar()->setMaximumHeight( size );
728 size = width() - mLabel->width() -2; 729 size = width() - mLabel->width() -2;
729 if ( size > 0 ) 730 if ( size > 0 )
730 mItemList->horizontalScrollBar()->setMaximumWidth( size ); 731 mItemList->horizontalScrollBar()->setMaximumWidth( size );
731 mLabel->move( width()-mItemList->lineWidth() - mLabel->width(), height()-mItemList->lineWidth() - mLabel->height() ); 732 mLabel->move( width()-mItemList->lineWidth() - mLabel->width(), height()-mItemList->lineWidth() - mLabel->height() );
732 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); 733 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2);
733} 734}
734 735
735void MonthViewCell::defaultAction( QListBoxItem *item ) 736void MonthViewCell::defaultAction( QListBoxItem *item )
736{ 737{
737 if ( !item ) return; 738 if ( !item ) return;
738 739
739 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); 740 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item );
740 Incidence *incidence = eventItem->incidence(); 741 Incidence *incidence = eventItem->incidence();
741 if ( incidence ) mMonthView->defaultAction( incidence ); 742 if ( incidence ) mMonthView->defaultAction( incidence );
742} 743}
743void MonthViewCell::showDay() 744void MonthViewCell::showDay()
744{ 745{
745 emit showDaySignal( date() ); 746 emit showDaySignal( date() );
746} 747}
747void MonthViewCell::newEvent() 748void MonthViewCell::newEvent()
748{ 749{
749 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); 750 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
750 emit newEventSignal( dt ); 751 emit newEventSignal( dt );
751} 752}
752void MonthViewCell::cellClicked( QListBoxItem *item ) 753void 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
773void MonthViewCell::contextMenu( QListBoxItem *item ) 774void 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
782void MonthViewCell::selection( QListBoxItem *item ) 783void 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
795KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) 795KOMonthView::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;
818 if ( mShowWeekView ) 818 if ( mShowWeekView )
819 mWeekStartsMonday = true; 819 mWeekStartsMonday = true;
820 updatePossible = false; 820 updatePossible = false;
821 mCells.setAutoDelete( true ); 821 mCells.setAutoDelete( true );
822 mDayLabels.resize( mDaysPerWeek ); 822 mDayLabels.resize( mDaysPerWeek );
823 mDayLabelsW.resize( mDaysPerWeek ); 823 mDayLabelsW.resize( mDaysPerWeek );
824 QFont bfont = font(); 824 QFont bfont = font();
825 if ( QApplication::desktop()->width() < 650 ) { 825 if ( QApplication::desktop()->width() < 650 ) {
826 bfont.setPointSize( bfont.pointSize() - 2 ); 826 bfont.setPointSize( bfont.pointSize() - 2 );
827 } 827 }
828 bfont.setBold( true ); 828 bfont.setBold( true );
829 int i; 829 int i;
830 830
831 for( i = 0; i < mDaysPerWeek; i++ ) { 831 for( i = 0; i < mDaysPerWeek; i++ ) {
832 QLabel *label = new QLabel( mMonthView ); 832 QLabel *label = new QLabel( mMonthView );
833 label->setFont(bfont); 833 label->setFont(bfont);
834 label->setFrameStyle(QFrame::Panel|QFrame::Raised); 834 label->setFrameStyle(QFrame::Panel|QFrame::Raised);
835 label->setLineWidth(1); 835 label->setLineWidth(1);
836 label->setAlignment(AlignCenter); 836 label->setAlignment(AlignCenter);
837 mDayLabels.insert( i, label ); 837 mDayLabels.insert( i, label );
838 label = new QLabel( mWeekView ); 838 label = new QLabel( mWeekView );
839 label->setFont(bfont); 839 label->setFont(bfont);
840 label->setFrameStyle(QFrame::Panel|QFrame::Raised); 840 label->setFrameStyle(QFrame::Panel|QFrame::Raised);
841 label->setLineWidth(1); 841 label->setLineWidth(1);
842 label->setAlignment(AlignCenter); 842 label->setAlignment(AlignCenter);
843 mDayLabelsW.insert( i, label ); 843 mDayLabelsW.insert( i, label );
844 } 844 }
845 845
846 bfont.setBold( false ); 846 bfont.setBold( false );
847 mWeekLabels.resize( mNumWeeks+1 ); 847 mWeekLabels.resize( mNumWeeks+1 );
848 mWeekLabelsW.resize( 2 ); 848 mWeekLabelsW.resize( 2 );
849 for( i = 0; i < mNumWeeks+1; i++ ) { 849 for( i = 0; i < mNumWeeks+1; i++ ) {
850 KOWeekButton *label = new KOWeekButton( mMonthView ); 850 KOWeekButton *label = new KOWeekButton( mMonthView );
851 label->setFocusPolicy(NoFocus); 851 label->setFocusPolicy(NoFocus);
852 label->setFont(bfont); 852 label->setFont(bfont);
853 connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); 853 connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) );
854 label->setFlat(true); 854 label->setFlat(true);
855 QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); 855 QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed"));
856 //label->setFrameStyle(QFrame::Panel|QFrame::Raised); 856 //label->setFrameStyle(QFrame::Panel|QFrame::Raised);
857 //label->setLineWidth(1); 857 //label->setLineWidth(1);
858 //label->setAlignment(AlignCenter); 858 //label->setAlignment(AlignCenter);
859 mWeekLabels.insert( i, label ); 859 mWeekLabels.insert( i, label );
860 } 860 }
861 mWeekLabels[mNumWeeks]->setText( i18n("W")); 861 mWeekLabels[mNumWeeks]->setText( i18n("W"));
862 QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number")); 862 QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number"));
863 863
864 for( i = 0; i < 1+1; i++ ) { 864 for( i = 0; i < 1+1; i++ ) {
865 KOWeekButton *label = new KOWeekButton( mWeekView ); 865 KOWeekButton *label = new KOWeekButton( mWeekView );
866 label->setFocusPolicy(NoFocus); 866 label->setFocusPolicy(NoFocus);
867 label->setFont(bfont); 867 label->setFont(bfont);
868 connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); 868 connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) );
869 label->setFlat(true); 869 label->setFlat(true);
870 QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); 870 QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed"));
871 //label->setFrameStyle(QFrame::Panel|QFrame::Raised); 871 //label->setFrameStyle(QFrame::Panel|QFrame::Raised);
872 //label->setLineWidth(1); 872 //label->setLineWidth(1);
873 //label->setAlignment(AlignCenter); 873 //label->setAlignment(AlignCenter);
874 mWeekLabelsW.insert( i, label ); 874 mWeekLabelsW.insert( i, label );
875 } 875 }
876 mWeekLabelsW[1]->setText( i18n("W")); 876 mWeekLabelsW[1]->setText( i18n("W"));
877 877
878 878
879 int row, col; 879 int row, col;
880 mCells.resize( mNumCells ); 880 mCells.resize( mNumCells );
881 for( row = 0; row < mNumWeeks; ++row ) { 881 for( row = 0; row < mNumWeeks; ++row ) {
@@ -1172,195 +1172,201 @@ void KOMonthView::updateView()
1172 if ( event->doesRecur() ) { 1172 if ( event->doesRecur() ) {
1173 bool last; 1173 bool last;
1174 QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last ); 1174 QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last );
1175 QDateTime incidenceEnd; 1175 QDateTime incidenceEnd;
1176 int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() ); 1176 int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() );
1177 bool invalid = false; 1177 bool invalid = false;
1178 while( true ) { 1178 while( true ) {
1179 if ( incidenceStart.isValid() ) { 1179 if ( incidenceStart.isValid() ) {
1180 incidenceEnd = incidenceStart.addDays( eventlen ); 1180 incidenceEnd = incidenceStart.addDays( eventlen );
1181 int st = incidenceStart.date().daysTo( endDate ); 1181 int st = incidenceStart.date().daysTo( endDate );
1182 if ( st >= 0 ) { // start before timeend 1182 if ( st >= 0 ) { // start before timeend
1183 int end = mStartDate.daysTo( incidenceEnd.date() ); 1183 int end = mStartDate.daysTo( incidenceEnd.date() );
1184 if ( end >= 0 ) { // end after timestart --- got one! 1184 if ( end >= 0 ) { // end after timestart --- got one!
1185 //normalize 1185 //normalize
1186 st = timeSpan - st; 1186 st = timeSpan - st;
1187 if ( st < 0 ) st = 0; 1187 if ( st < 0 ) st = 0;
1188 if ( end > timeSpan ) end = timeSpan; 1188 if ( end > timeSpan ) end = timeSpan;
1189 int iii; 1189 int iii;
1190 //qDebug("found %s %d %d ",event->summary().latin1(), st, end ); 1190 //qDebug("found %s %d %d ",event->summary().latin1(), st, end );
1191 for ( iii = st;iii<= end;++iii) 1191 for ( iii = st;iii<= end;++iii)
1192 (*cells)[iii]->insertEvent( event ); 1192 (*cells)[iii]->insertEvent( event );
1193 } 1193 }
1194 } 1194 }
1195 } else { 1195 } else {
1196 if ( invalid ) 1196 if ( invalid )
1197 break; 1197 break;
1198 invalid = true; 1198 invalid = true;
1199 //qDebug("invalid %s", event->summary().latin1()); 1199 //qDebug("invalid %s", event->summary().latin1());
1200 incidenceStart = QDateTime( mStartDate ).addSecs( -2 );; 1200 incidenceStart = QDateTime( mStartDate ).addSecs( -2 );;
1201 } 1201 }
1202 if ( last ) 1202 if ( last )
1203 break; 1203 break;
1204 bool ok; 1204 bool ok;
1205 incidenceStart = event->getNextOccurence( incidenceStart.addSecs( 1 ) ,&ok ); 1205 incidenceStart = event->getNextOccurence( incidenceStart.addSecs( 1 ) ,&ok );
1206 if ( ! ok ) 1206 if ( ! ok )
1207 break; 1207 break;
1208 if ( incidenceStart.date() > endDate ) 1208 if ( incidenceStart.date() > endDate )
1209 break; 1209 break;
1210 } 1210 }
1211 } else { // no recur 1211 } else { // no recur
1212 int st = event->dtStart().date().daysTo( endDate ); 1212 int st = event->dtStart().date().daysTo( endDate );
1213 if ( st >= 0 ) { // start before timeend 1213 if ( st >= 0 ) { // start before timeend
1214 int end = mStartDate.daysTo( event->dtEnd().date() ); 1214 int end = mStartDate.daysTo( event->dtEnd().date() );
1215 if ( end >= 0 ) { // end after timestart --- got one! 1215 if ( end >= 0 ) { // end after timestart --- got one!
1216 //normalize 1216 //normalize
1217 st = timeSpan - st; 1217 st = timeSpan - st;
1218 if ( st < 0 ) st = 0; 1218 if ( st < 0 ) st = 0;
1219 if ( end > timeSpan ) end = timeSpan; 1219 if ( end > timeSpan ) end = timeSpan;
1220 int iii; 1220 int iii;
1221 for ( iii = st;iii<= end;++iii) 1221 for ( iii = st;iii<= end;++iii)
1222 (*cells)[iii]->insertEvent( event ); 1222 (*cells)[iii]->insertEvent( event );
1223 } 1223 }
1224 } 1224 }
1225 } 1225 }
1226 } 1226 }
1227 // insert due todos 1227 // insert due todos
1228 QPtrList<Todo> todos = calendar()->todos( ); 1228 QPtrList<Todo> todos = calendar()->todos( );
1229 Todo *todo; 1229 Todo *todo;
1230 for(todo = todos.first(); todo; todo = todos.next()) { 1230 for(todo = todos.first(); todo; todo = todos.next()) {
1231 //insertTodo( todo ); 1231 //insertTodo( todo );
1232 if ( todo->hasDueDate() ) { 1232 if ( todo->hasDueDate() ) {
1233 int day = mStartDate.daysTo( todo->dtDue().date() ); 1233 int day = mStartDate.daysTo( todo->dtDue().date() );
1234 if ( day >= 0 && day < timeSpan + 1) { 1234 if ( day >= 0 && day < timeSpan + 1) {
1235 (*cells)[day]->insertTodo( todo ); 1235 (*cells)[day]->insertTodo( todo );
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
1264void KOMonthView::resizeEvent(QResizeEvent * e) 1264void 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}
1281void KOMonthView::computeLayoutWeek() 1287void 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" );
1303 wid -= weeklabelwid; 1309 wid -= weeklabelwid;
1304 1310
1305 int colWid = wid / daysToShow; 1311 int colWid = wid / daysToShow;
1306 int lastCol = wid - ( colWid*6 ); 1312 int lastCol = wid - ( colWid*6 );
1307 int dayLabelHei = mDayLabelsW[0]->sizeHint().height(); 1313 int dayLabelHei = mDayLabelsW[0]->sizeHint().height();
1308 int cellHei = (hei - (5- daysToShow )*dayLabelHei) /(5- daysToShow ); 1314 int cellHei = (hei - (5- daysToShow )*dayLabelHei) /(5- daysToShow );
1309 int colModulo = wid % daysToShow; 1315 int colModulo = wid % daysToShow;
1310 int rowModulo = (hei- (5- daysToShow )*dayLabelHei) % daysToShow-1; 1316 int rowModulo = (hei- (5- daysToShow )*dayLabelHei) % daysToShow-1;
1311 //qDebug("rowmod %d ", rowModulo); 1317 //qDebug("rowmod %d ", rowModulo);
1312 int i; 1318 int i;
1313 int x,y,w,h; 1319 int x,y,w,h;
1314 x= 0; 1320 x= 0;
1315 y= 0; 1321 y= 0;
1316 w = colWid; 1322 w = colWid;
1317 h = dayLabelHei ; 1323 h = dayLabelHei ;
1318 for ( i = 0; i < 7; i++) { 1324 for ( i = 0; i < 7; i++) {
1319 if ( i && !( i % daysToShow) && i < 6) { 1325 if ( i && !( i % daysToShow) && i < 6) {
1320 y += hei/(5-daysToShow); 1326 y += hei/(5-daysToShow);
1321 x = 0; 1327 x = 0;
1322 w = colWid; 1328 w = colWid;
1323 } 1329 }
1324 if ( ((i) % daysToShow) >= daysToShow-colModulo ) { 1330 if ( ((i) % daysToShow) >= daysToShow-colModulo ) {
1325 ++w; 1331 ++w;
1326 } 1332 }
1327 if ( i >= 5 ) { 1333 if ( i >= 5 ) {
1328 mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,w/2+w%2,h); 1334 mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,w/2+w%2,h);
1329 x -= (w/2 ); 1335 x -= (w/2 );
1330 } 1336 }
1331 else 1337 else
1332 mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,w,h); 1338 mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,w,h);
1333 x += w; 1339 x += w;
1334 } 1340 }
1335 x= 0; 1341 x= 0;
1336 y= dayLabelHei; 1342 y= dayLabelHei;
1337 w = colWid; 1343 w = colWid;
1338 h = cellHei; 1344 h = cellHei;
1339 for ( i = 0; i < mCellsW.count(); ++i) { 1345 for ( i = 0; i < mCellsW.count(); ++i) {
1340 if ( i > 6 ) { 1346 if ( i > 6 ) {
1341 mCellsW[i]->hide(); 1347 mCellsW[i]->hide();
1342 continue; 1348 continue;
1343 } 1349 }
1344 1350
1345 w = colWid; 1351 w = colWid;
1346 if ( ((i) % daysToShow) >= daysToShow-colModulo ) { 1352 if ( ((i) % daysToShow) >= daysToShow-colModulo ) {
1347 ++w; 1353 ++w;
1348 } 1354 }
1349 if ( i == (daysToShow-1-rowModulo)*7) 1355 if ( i == (daysToShow-1-rowModulo)*7)
1350 ++h; 1356 ++h;
1351 1357
1352 if ( i >= 5 ) { 1358 if ( i >= 5 ) {
1353 if ( i ==5 ) { 1359 if ( i ==5 ) {
1354 mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); 1360 mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h/2 );
1355 x -= w ;y += h/2; 1361 x -= w ;y += h/2;
1356 } else { 1362 } else {
1357 if ( ((i-1) % daysToShow) >= daysToShow-colModulo ) { 1363 if ( ((i-1) % daysToShow) >= daysToShow-colModulo ) {
1358 ++w; 1364 ++w;
1359 } 1365 }
1360 mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); 1366 mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 );
1361 y -= h/2; 1367 y -= h/2;
1362 } 1368 }
1363 } else 1369 } else
1364 mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h ); 1370 mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h );
1365 1371
1366 1372
@@ -1418,159 +1424,165 @@ void KOMonthView::computeLayout()
1418 int dayLabelHei = mDayLabels[0]->sizeHint().height(); 1424 int dayLabelHei = mDayLabels[0]->sizeHint().height();
1419 int cellHei = (hei - dayLabelHei) /6; 1425 int cellHei = (hei - dayLabelHei) /6;
1420 int colModulo = wid % daysToShow; 1426 int colModulo = wid % daysToShow;
1421 int rowModulo = (hei- dayLabelHei) % 6; 1427 int rowModulo = (hei- dayLabelHei) % 6;
1422 //qDebug("rowmod %d ", rowModulo); 1428 //qDebug("rowmod %d ", rowModulo);
1423 int i; 1429 int i;
1424 int x,y,w,h; 1430 int x,y,w,h;
1425 x= 0; 1431 x= 0;
1426 y= 0; 1432 y= 0;
1427 w = colWid; 1433 w = colWid;
1428 h = dayLabelHei ; 1434 h = dayLabelHei ;
1429 for ( i = 0; i < 7; i++) { 1435 for ( i = 0; i < 7; i++) {
1430 if ( i == daysToShow-colModulo ) 1436 if ( i == daysToShow-colModulo )
1431 ++w; 1437 ++w;
1432 if ( combinedSatSun ) { 1438 if ( combinedSatSun ) {
1433 if ( i >= daysToShow-1 ) { 1439 if ( i >= daysToShow-1 ) {
1434 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h); 1440 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h);
1435 x -= w/2 ; 1441 x -= w/2 ;
1436 } 1442 }
1437 else 1443 else
1438 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); 1444 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h);
1439 } else 1445 } else
1440 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); 1446 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h);
1441 x += w; 1447 x += w;
1442 } 1448 }
1443 x= 0; 1449 x= 0;
1444 y= dayLabelHei; 1450 y= dayLabelHei;
1445 w = colWid; 1451 w = colWid;
1446 h = cellHei ; 1452 h = cellHei ;
1447 for ( i = 0; i < mCells.count(); ++i) { 1453 for ( i = 0; i < mCells.count(); ++i) {
1448 w = colWid; 1454 w = colWid;
1449 if ( ((i) % 7) >= 7-colModulo ) { 1455 if ( ((i) % 7) >= 7-colModulo ) {
1450 ++w; 1456 ++w;
1451 } 1457 }
1452 if ( i == (6-rowModulo)*7) 1458 if ( i == (6-rowModulo)*7)
1453 ++h; 1459 ++h;
1454 if ( combinedSatSun ) { 1460 if ( combinedSatSun ) {
1455 if ( (i)%7 >= daysToShow-1 ) { 1461 if ( (i)%7 >= daysToShow-1 ) {
1456 if ( (i)%7 == daysToShow-1 ) { 1462 if ( (i)%7 == daysToShow-1 ) {
1457 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); 1463 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h/2 );
1458 x -= w ;y += h/2; 1464 x -= w ;y += h/2;
1459 } else { 1465 } else {
1460 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); 1466 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 );
1461 y -= h/2; 1467 y -= h/2;
1462 } 1468 }
1463 } else 1469 } else
1464 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); 1470 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h );
1465 1471
1466 } 1472 }
1467 else 1473 else
1468 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); 1474 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h );
1469 x += w; 1475 x += w;
1470 if ( x + w/2 > wid ) { 1476 if ( x + w/2 > wid ) {
1471 x = 0; 1477 x = 0;
1472 y += h; 1478 y += h;
1473 } 1479 }
1474 } 1480 }
1475 y= dayLabelHei; 1481 y= dayLabelHei;
1476 h = cellHei ; 1482 h = cellHei ;
1477 for ( i = 0; i < 6; i++) { 1483 for ( i = 0; i < 6; i++) {
1478 if ( i == (6-rowModulo)) 1484 if ( i == (6-rowModulo))
1479 ++h; 1485 ++h;
1480 mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h); 1486 mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h);
1481 y += h; 1487 y += h;
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
1496void KOMonthView::showContextMenu( Incidence *incidence ) 1502void 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}
1508MonthViewCell * KOMonthView::selectedCell( ) 1514MonthViewCell * KOMonthView::selectedCell( )
1509{ 1515{
1510 return mSelectedCell; 1516 return mSelectedCell;
1511} 1517}
1512void KOMonthView::setSelectedCell( MonthViewCell *cell ) 1518void 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
1529void KOMonthView::processSelectionChange() 1535void 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
1539void KOMonthView::clearSelection() 1545void 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}
1546void KOMonthView::keyPressEvent ( QKeyEvent * e ) 1552void 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
@@ -133,165 +133,166 @@ class MonthViewCell : public QWidget
133 void setDate( const QDate & ); 133 void setDate( const QDate & );
134 QDate date() const; 134 QDate date() const;
135 135
136 void setPrimary( bool ); 136 void setPrimary( bool );
137 bool isPrimary() const; 137 bool isPrimary() const;
138 138
139 void setHoliday( bool ); 139 void setHoliday( bool );
140 void setHoliday( const QString & ); 140 void setHoliday( const QString & );
141 141
142 void updateCell(); 142 void updateCell();
143 void startUpdateCell(); 143 void startUpdateCell();
144 void finishUpdateCell(); 144 void finishUpdateCell();
145 void insertEvent(Event *); 145 void insertEvent(Event *);
146 void insertTodo(Todo *); 146 void insertTodo(Todo *);
147 147
148 void updateConfig( bool bigFont = false ); 148 void updateConfig( bool bigFont = false );
149 149
150 void enableScrollBars( bool ); 150 void enableScrollBars( bool );
151 151
152 Incidence *selectedIncidence(); 152 Incidence *selectedIncidence();
153 QDate selectedIncidenceDate(); 153 QDate selectedIncidenceDate();
154 154
155 void deselect(); 155 void deselect();
156 void select(); 156 void select();
157 void clear(); 157 void clear();
158 158
159#ifdef DESKTOP_VERSION 159#ifdef DESKTOP_VERSION
160 static QToolTipGroup *toolTipGroup(); 160 static QToolTipGroup *toolTipGroup();
161#endif 161#endif
162 signals: 162 signals:
163 void defaultAction( Incidence * ); 163 void defaultAction( Incidence * );
164 void newEventSignal( QDateTime ); 164 void newEventSignal( QDateTime );
165 void showDaySignal( QDate ); 165 void showDaySignal( QDate );
166 166
167 protected: 167 protected:
168 QString mToolTip; 168 QString mToolTip;
169 void resizeEvent( QResizeEvent * ); 169 void resizeEvent( QResizeEvent * );
170 170
171 protected slots: 171 protected slots:
172 void defaultAction( QListBoxItem * ); 172 void defaultAction( QListBoxItem * );
173 void contextMenu( QListBoxItem * ); 173 void contextMenu( QListBoxItem * );
174 void selection( QListBoxItem * ); 174 void selection( QListBoxItem * );
175 void cellClicked( QListBoxItem * ); 175 void cellClicked( QListBoxItem * );
176 void newEvent(); 176 void newEvent();
177 void showDay(); 177 void showDay();
178 178
179 private: 179 private:
180 KOMonthView *mMonthView; 180 KOMonthView *mMonthView;
181 181
182 QDate mDate; 182 QDate mDate;
183 bool mPrimary; 183 bool mPrimary;
184 bool mHoliday; 184 bool mHoliday;
185 QString mHolidayString; 185 QString mHolidayString;
186 186
187 //QLabel *mLabel; 187 //QLabel *mLabel;
188 QPushButton *mLabel; 188 QPushButton *mLabel;
189 QListBox *mItemList; 189 QListBox *mItemList;
190#ifdef DESKTOP_VERSION 190#ifdef DESKTOP_VERSION
191 static QToolTipGroup *mToolTipGroup; 191 static QToolTipGroup *mToolTipGroup;
192#endif 192#endif
193 QSize mLabelSize; 193 QSize mLabelSize;
194 QSize mLabelBigSize; 194 QSize mLabelBigSize;
195 QPalette mHolidayPalette; 195 QPalette mHolidayPalette;
196 QPalette mStandardPalette; 196 QPalette mStandardPalette;
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
206class KOMonthView: public KOEventView 206class 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
295}; 296};
296 297
297#endif 298#endif
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index dcb51dc..c35de0a 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -130,193 +130,194 @@ void KOViewManager::showDateView( int view, QDate date)
130 } else if (view == 8 ) { 130 } else if (view == 8 ) {
131 globalFlagBlockAgenda = 1; 131 globalFlagBlockAgenda = 1;
132 if ( mCurrentAgendaView != 3 ) 132 if ( mCurrentAgendaView != 3 )
133 mCurrentAgendaView = -1; 133 mCurrentAgendaView = -1;
134 showAgendaView(KOPrefs::instance()->mFullViewMonth); 134 showAgendaView(KOPrefs::instance()->mFullViewMonth);
135 globalFlagBlockAgenda = 2; 135 globalFlagBlockAgenda = 2;
136 mMainView->dateNavigator()->selectDates( date , 136 mMainView->dateNavigator()->selectDates( date ,
137 KOPrefs::instance()->mNextXDays ); 137 KOPrefs::instance()->mNextXDays );
138 mFlagShowNextxDays = true; 138 mFlagShowNextxDays = true;
139 mCurrentAgendaView = 3 ; 139 mCurrentAgendaView = 3 ;
140 } if (view == 9) { // return behaviour, for getting back from mode == 3 (single day mode ) 140 } if (view == 9) { // return behaviour, for getting back from mode == 3 (single day mode )
141 if ( lastMode ) { 141 if ( lastMode ) {
142 mCurrentAgendaView = lastCount ; 142 mCurrentAgendaView = lastCount ;
143 mMainView->dateNavigator()->selectDates( lastDate, lastCount); 143 mMainView->dateNavigator()->selectDates( lastDate, lastCount);
144 mFlagShowNextxDays = lastNDMode; 144 mFlagShowNextxDays = lastNDMode;
145 if ( mFlagShowNextxDays ) { 145 if ( mFlagShowNextxDays ) {
146 mCurrentAgendaView = 3 ; 146 mCurrentAgendaView = 3 ;
147 } 147 }
148 } else 148 } else
149 showWeekView(); 149 showWeekView();
150 } else if (view == 10) { 150 } else if (view == 10) {
151 mMainView->dateNavigator()->selectDates( date,mMainView->dateNavigator()->selectedDates().count() ); 151 mMainView->dateNavigator()->selectDates( date,mMainView->dateNavigator()->selectedDates().count() );
152 } 152 }
153 lastMode = view; 153 lastMode = view;
154} 154}
155 155
156 156
157 157
158void KOViewManager::writeSettings(KConfig *config) 158void KOViewManager::writeSettings(KConfig *config)
159{ 159{
160 config->setGroup("General"); 160 config->setGroup("General");
161 161
162 QString view; 162 QString view;
163 if (mCurrentView == mWhatsNextView) view = "WhatsNext"; 163 if (mCurrentView == mWhatsNextView) view = "WhatsNext";
164 else if (mCurrentView == mMonthView) view = "Month"; 164 else if (mCurrentView == mMonthView) view = "Month";
165 else if (mCurrentView == mListView) view = "List"; 165 else if (mCurrentView == mListView) view = "List";
166 else if (mCurrentView == mJournalView) view = "Journal"; 166 else if (mCurrentView == mJournalView) view = "Journal";
167 else if (mCurrentView == mTimeSpanView) view = "TimeSpan"; 167 else if (mCurrentView == mTimeSpanView) view = "TimeSpan";
168 else if (mCurrentView == mTodoView) view = "Todo"; 168 else if (mCurrentView == mTodoView) view = "Todo";
169 else view = "Agenda"; 169 else view = "Agenda";
170 170
171 config->writeEntry("Current View",view); 171 config->writeEntry("Current View",view);
172 172
173 if (mAgendaView) { 173 if (mAgendaView) {
174 mAgendaView->writeSettings(config); 174 mAgendaView->writeSettings(config);
175 } 175 }
176 if (mTimeSpanView) { 176 if (mTimeSpanView) {
177 mTimeSpanView->writeSettings(config); 177 mTimeSpanView->writeSettings(config);
178 } 178 }
179 if (mListView) { 179 if (mListView) {
180 mListView->writeSettings(config); 180 mListView->writeSettings(config);
181 } 181 }
182 if (mTodoView) { 182 if (mTodoView) {
183 mTodoView->saveLayout(config,"Todo View"); 183 mTodoView->saveLayout(config,"Todo View");
184 } 184 }
185} 185}
186 186
187void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) 187void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen )
188{ 188{
189 189
190 //mFlagShowNextxDays = false; 190 //mFlagShowNextxDays = false;
191 //if(view == mCurrentView) return; 191 //if(view == mCurrentView) return;
192 if ( view == 0 ) { 192 if ( view == 0 ) {
193 view = mCurrentView; 193 view = mCurrentView;
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
219void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView ) 219void 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() );
259 qApp->processEvents(); 260 qApp->processEvents();
260 //qDebug("qApp->processEvents() "); 261 //qDebug("qApp->processEvents() ");
261 globalFlagBlockAgenda = 0; 262 globalFlagBlockAgenda = 0;
262 mAgendaView->repaintAgenda(); 263 mAgendaView->repaintAgenda();
263 264
264 } 265 }
265 globalFlagBlockAgenda = 0; 266 globalFlagBlockAgenda = 0;
266 } 267 }
267 emit signalAgendaView( mCurrentView == mAgendaView ); 268 emit signalAgendaView( mCurrentView == mAgendaView );
268 //qDebug("raiseCurrentView ende "); 269 //qDebug("raiseCurrentView ende ");
269 270
270} 271}
271 272
272void KOViewManager::updateView() 273void KOViewManager::updateView()
273{ 274{
274 // qDebug("KOViewManager::updateView() "); 275 // qDebug("KOViewManager::updateView() ");
275 // if we are updating mTodoView, we get endless recursion 276 // if we are updating mTodoView, we get endless recursion
276 if ( mTodoView == mCurrentView ) 277 if ( mTodoView == mCurrentView )
277 return; 278 return;
278 if ( mCurrentView ) mCurrentView->updateView(); 279 if ( mCurrentView ) mCurrentView->updateView();
279 280
280} 281}
281 282
282void KOViewManager::updateView(const QDate &start, const QDate &end) 283void KOViewManager::updateView(const QDate &start, const QDate &end)
283{ 284{
284 // kdDebug() << "KOViewManager::updateView()" << endl; 285 // kdDebug() << "KOViewManager::updateView()" << endl;
285 286
286 if (mCurrentView) mCurrentView->showDates(start, end); 287 if (mCurrentView) mCurrentView->showDates(start, end);
287 288
288 if (mTodoView && mTodoView == mCurrentView ) mTodoView->updateView(); 289 if (mTodoView && mTodoView == mCurrentView ) mTodoView->updateView();
289} 290}
290 291
291 292
292void KOViewManager::updateWNview() 293void KOViewManager::updateWNview()
293{ 294{
294 if ( mCurrentView == mWhatsNextView && mWhatsNextView ) 295 if ( mCurrentView == mWhatsNextView && mWhatsNextView )
295 mWhatsNextView->updateView(); 296 mWhatsNextView->updateView();
296 297
297} 298}
298void KOViewManager::showWhatsNextView() 299void KOViewManager::showWhatsNextView()
299{ 300{
300 if (!mWhatsNextView) { 301 if (!mWhatsNextView) {
301 mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(), 302 mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(),
302 "KOViewManager::WhatsNextView"); 303 "KOViewManager::WhatsNextView");
303 mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog()); 304 mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog());
304 connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig())); 305 connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig()));
305 addView(mWhatsNextView); 306 addView(mWhatsNextView);
306 connect(this, SIGNAL( printWNV() ), 307 connect(this, SIGNAL( printWNV() ),
307 mWhatsNextView, SLOT( printMe() ) ); 308 mWhatsNextView, SLOT( printMe() ) );
308 } 309 }
309 globalFlagBlockAgenda = 1; 310 globalFlagBlockAgenda = 1;
310 showView(mWhatsNextView, true ); 311 showView(mWhatsNextView, true );
311 //mWhatsNextView->updateView(); 312 //mWhatsNextView->updateView();
312 313
313} 314}
314 315
315void KOViewManager::showListView() 316void KOViewManager::showListView()
316{ 317{
317 if (!mListView) { 318 if (!mListView) {
318 mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView"); 319 mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView");
319 addView(mListView); 320 addView(mListView);
320 321
321 connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)), 322 connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)),
322 mMainView, SLOT(showIncidence(Incidence *))); 323 mMainView, SLOT(showIncidence(Incidence *)));