summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-02-06 13:44:49 (UTC)
committer zautrix <zautrix>2005-02-06 13:44:49 (UTC)
commit26b0c69fb3b11c29475ec02b2cfe52e33eb24e5f (patch) (unidiff)
tree34c4f5e6b2d77dc1210822e1539d9516842b5691
parent118f5aab05c9ace5612d5c4fd69e7c5a59bed67b (diff)
downloadkdepimpi-26b0c69fb3b11c29475ec02b2cfe52e33eb24e5f.zip
kdepimpi-26b0c69fb3b11c29475ec02b2cfe52e33eb24e5f.tar.gz
kdepimpi-26b0c69fb3b11c29475ec02b2cfe52e33eb24e5f.tar.bz2
many small fixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/korganizer/germantranslation.txt4
-rw-r--r--korganizer/koeditorgeneraltodo.cpp7
-rw-r--r--korganizer/koeventviewer.cpp10
-rw-r--r--korganizer/komonthview.cpp61
-rw-r--r--korganizer/komonthview.h6
-rw-r--r--korganizer/koviewmanager.cpp5
6 files changed, 48 insertions, 45 deletions
diff --git a/bin/kdepim/korganizer/germantranslation.txt b/bin/kdepim/korganizer/germantranslation.txt
index e9ba8db..523c054 100644
--- a/bin/kdepim/korganizer/germantranslation.txt
+++ b/bin/kdepim/korganizer/germantranslation.txt
@@ -1177,54 +1177,54 @@
1177{ "Edit Selection...","Editiere Auswahl" }, 1177{ "Edit Selection...","Editiere Auswahl" },
1178{ "recurring events","wiederholende Termine" }, 1178{ "recurring events","wiederholende Termine" },
1179{ "recurr. events","wiederh.Termine" }, 1179{ "recurr. events","wiederh.Termine" },
1180{ "completed to-dos","erledigte Todos" }, 1180{ "completed to-dos","erledigte Todos" },
1181{ "events","Termine" }, 1181{ "events","Termine" },
1182{ "todos","Todos" }, 1182{ "todos","Todos" },
1183{ "journals","Journale" }, 1183{ "journals","Journale" },
1184{ "public","öffentl." }, 1184{ "public","öffentl." },
1185{ "private","privat" }, 1185{ "private","privat" },
1186{ "confidential","vertraul." }, 1186{ "confidential","vertraul." },
1187{ "\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!","\nhat Unter-Todos.\nAlle erledigten Unter-Todos\nwerden auch gelöscht!" }, 1187{ "\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!","\nhat Unter-Todos.\nAlle erledigten Unter-Todos\nwerden auch gelöscht!" },
1188{ "Yesterday","Gestern" }, 1188{ "Yesterday","Gestern" },
1189{ "Day after tomorrow","Übermorgen" }, 1189{ "Day after tomorrow","Übermorgen" },
1190{ "Tomorrow","Morgen" }, 1190{ "Tomorrow","Morgen" },
1191{ "Day before yesterday","Vorgestern" }, 1191{ "Day before yesterday","Vorgestern" },
1192{ "Size %1","Größe %1" }, 1192{ "Size %1","Größe %1" },
1193{ "New Agendasize: %1","Neue Agendagröße: %1" }, 1193{ "New Agendasize: %1","Neue Agendagröße: %1" },
1194{ " (%1 y.)"," (%1 J.)" }, 1194{ " (%1 y.)"," (%1 J.)" },
1195{ "Allday:","Ganztägig:" }, 1195{ "Allday:","Ganztägig:" },
1196{ "compl.todos","erled.Todos" }, 1196{ "compl.todos","erled.Todos" },
1197{ "Day view","Tagesansicht" }, 1197{ "Day view","Tagesansicht" },
1198{ "Next days","Nächste Tage" }, 1198{ "Next days","Nächste Tage" },
1199{ "Next week","Nächste Woche" }, 1199{ "Next week","Nächste Woche" },
1200{ "Next two weeks","Nächste zwei Wochen" }, 1200{ "Next two weeks","Nächste zwei Wochen" },
1201{ "Next month","Nächster Monat" }, 1201{ "Next month","Nächster Monat" },
1202{ "Journal view","Journal" }, 1202{ "Journal view","Journal" },
1203{ "Display all opened","Zeige alle geöffnet" }, 1203{ "Display all opened","Zeige alle geöffnet" },
1204{ "Display all closed","Zeige alle geschlossen" }, 1204{ "Display all closed","Zeige alle geschlossen" },
1205{ "Display all flat","Zeige alle flach" }, 1205{ "Display all flat","Zeige alle flach" },
1206{ "<p><i>Completed on %1</i></p>","<p><i>Erledigt am %1</i></p>" }, 1206{ "<p><i>Completed on %1</i></p>","<p><i>Erledigt am %1</i></p>" },
1207{ "Default todo done color:","Standard Todo erledigt Farbe" }, 1207{ "Default todo done color:","Standard Todo erledigt Farbe" },
1208{ "Select week %1-%2","Wähle Woche %1-%2" }, 1208{ "Select week %1-%2","Wähle Woche %1-%2" },
1209{ "Select Week","Wähle Woche" }, 1209{ "Select Week","Wähle Woche" },
1210{ "Set alarm for selected...","Setze Alarm für Selekt..." }, 1210{ "Set alarm for selected...","Setze Alarm für Selekt..." },
1211{ "Set Alarm!","Setze Alarm!" }, 1211{ "Set Alarm!","Setze Alarm!" },
1212{ "Canged alarm for %1 items","Alarm für %1 Items geändert" }, 1212{ "Canged alarm for %1 items","Alarm für %1 Items geändert" },
1213{ " and "," und " }, 1213{ " and "," und " },
1214{ "<IMG src="%1"> only )","nur <IMG src="%1"> )" }, 1214{ "<IMG src="%1"> only )","nur <IMG src="%1"> )" },
1215{ "Mail to selected","Mail an Ausgewählte" }, 1215{ "Mail to selected","Mail an Ausgewählte" },
1216{ "Mail to all","Mail an Alle" }, 1216{ "Mail to all","Mail an Alle" },
1217{ "Week view mode uses bigger font","Wochenansicht Modus nutzt größeren Font" }, 1217{ "Week view mode uses bigger font","Wochenansicht Modus nutzt größeren Font" },
1218{ "Set reminder ON with offset to:","Alarm AN mit Offset auf:" }, 1218{ "Set reminder ON with offset to:","Alarm AN mit Offset auf:" },
1219{ " on"," am" }, 1219{ " on"," am" },
1220{ " completed on "," erledigt am " }, 1220{ " completed on "," erledigt am " },
1221{ "Save as Event template","Speichere als Vorlage" }, 1221{ "Save as Event template","Speichere als Vorlage" },
1222{ "Load Event template","Lade Termin Vorlage" }, 1222{ "Load Event template","Lade Termin Vorlage" },
1223{ "Save as Journal template","Speichere als Journal Vorlage" }, 1223{ "Save as Journal template","Speichere als Journal Vorlage" },
1224{ "Insert Journal template","Füge Journal Vorlage ein" }, 1224{ "Insert Journal template","Füge Journal Vorlage ein" },
1225{ "","" }, 1225{ "Sub todos:<br>","Unter Todos:<br>" },
1226{ "","" }, 1226{ "Parent todo:<br>","Über Todo:<br>" },
1227{ "","" }, 1227{ "","" },
1228{ "","" }, 1228{ "","" },
1229{ "","" }, 1229{ "","" },
1230{ "","" }, 1230{ "","" },
diff --git a/korganizer/koeditorgeneraltodo.cpp b/korganizer/koeditorgeneraltodo.cpp
index cd78f54..ce66863 100644
--- a/korganizer/koeditorgeneraltodo.cpp
+++ b/korganizer/koeditorgeneraltodo.cpp
@@ -115,98 +115,101 @@ void KOEditorGeneralTodo::initTime(QWidget *parent,QBoxLayout *topLayout)
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() < 320 ) { 163 if ( QApplication::desktop()->width() <= 480 ) {
164 mCompleteDateEdit->setMaximumWidth( 85 ); 164 if ( QApplication::desktop()->width() < 320 )
165 mCompleteDateEdit->setMaximumWidth( 85 );
166 else
167 mCompleteDateEdit->setMaximumWidth( 130 );
165 topLayout->setSpacing( 0 ); 168 topLayout->setSpacing( 0 );
166 } 169 }
167} 170}
168 171
169void KOEditorGeneralTodo::initPriority(QWidget *parent, QBoxLayout *topLayout) 172void KOEditorGeneralTodo::initPriority(QWidget *parent, QBoxLayout *topLayout)
170{ 173{
171 174
172 QHBox* h = new QHBox ( parent ); 175 QHBox* h = new QHBox ( parent );
173 topLayout->addWidget( h ); 176 topLayout->addWidget( h );
174 QLabel *priorityLabel = new QLabel(i18n("Priority:"), h); 177 QLabel *priorityLabel = new QLabel(i18n("Priority:"), h);
175 // topLayout->addWidget(priorityLabel); 178 // topLayout->addWidget(priorityLabel);
176 mPriorityCombo = new QComboBox( h ); 179 mPriorityCombo = new QComboBox( h );
177 mPriorityCombo->insertItem(i18n("1 (high)")); 180 mPriorityCombo->insertItem(i18n("1 (high)"));
178 mPriorityCombo->insertItem(i18n("2")); 181 mPriorityCombo->insertItem(i18n("2"));
179 mPriorityCombo->insertItem(i18n("3")); 182 mPriorityCombo->insertItem(i18n("3"));
180 mPriorityCombo->insertItem(i18n("4")); 183 mPriorityCombo->insertItem(i18n("4"));
181 mPriorityCombo->insertItem(i18n("5 (low)")); 184 mPriorityCombo->insertItem(i18n("5 (low)"));
182 //topLayout->addWidget(mPriorityCombo); 185 //topLayout->addWidget(mPriorityCombo);
183} 186}
184 187
185void KOEditorGeneralTodo::initStatus(QWidget *parent,QBoxLayout *topLayout) 188void KOEditorGeneralTodo::initStatus(QWidget *parent,QBoxLayout *topLayout)
186{ 189{
187 QBoxLayout *statusLayout = new QHBoxLayout(topLayout); 190 QBoxLayout *statusLayout = new QHBoxLayout(topLayout);
188 191
189 initCompletion( parent, statusLayout ); 192 initCompletion( parent, statusLayout );
190 193
191 statusLayout->addStretch( 1 ); 194 statusLayout->addStretch( 1 );
192 195
193 initPriority( parent, statusLayout ); 196 initPriority( parent, statusLayout );
194} 197}
195 198
196void KOEditorGeneralTodo::setDefaults(QDateTime due,bool allDay) 199void KOEditorGeneralTodo::setDefaults(QDateTime due,bool allDay)
197{ 200{
198 201
199 mSummaryEdit->load(KOLocationBox::SUMMARYTODO); 202 mSummaryEdit->load(KOLocationBox::SUMMARYTODO);
200 mLocationEdit->load(KOLocationBox::LOCATION); 203 mLocationEdit->load(KOLocationBox::LOCATION);
201 KOEditorGeneral::setDefaults(allDay); 204 KOEditorGeneral::setDefaults(allDay);
202 205
203 mTimeButton->setChecked( !allDay ); 206 mTimeButton->setChecked( !allDay );
204 if(mTimeButton->isChecked()) { 207 if(mTimeButton->isChecked()) {
205 mTimeButton->setEnabled(true); 208 mTimeButton->setEnabled(true);
206 } 209 }
207 else { 210 else {
208 mTimeButton->setEnabled(false); 211 mTimeButton->setEnabled(false);
209 } 212 }
210 213
211 enableTimeEdits( !allDay ); 214 enableTimeEdits( !allDay );
212 if ( due.isValid() ) { 215 if ( due.isValid() ) {
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp
index 2faf18f..de11c13 100644
--- a/korganizer/koeventviewer.cpp
+++ b/korganizer/koeventviewer.cpp
@@ -376,97 +376,97 @@ void KOEventViewer::appendTodo(Todo *event, int mode )
376 mText += "</font>"; 376 mText += "</font>";
377 } 377 }
378 mMailSubject += i18n( "Todo " )+ event->summary(); 378 mMailSubject += i18n( "Todo " )+ event->summary();
379 379
380 if ( event->percentComplete() == 100 && event->hasCompletedDate() ) { 380 if ( event->percentComplete() == 100 && event->hasCompletedDate() ) {
381 mText +="<font color=\"#B00000\">"; 381 mText +="<font color=\"#B00000\">";
382 addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(KOPrefs::instance()->mShortDateInViewer) ) ); 382 addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(KOPrefs::instance()->mShortDateInViewer) ) );
383 mText += "</font>"; 383 mText += "</font>";
384 } else { 384 } else {
385 mText.append(i18n("<p><i>%1 % completed</i></p>") 385 mText.append(i18n("<p><i>%1 % completed</i></p>")
386 .arg(event->percentComplete())); 386 .arg(event->percentComplete()));
387 } 387 }
388 388
389 if (event->cancelled ()) { 389 if (event->cancelled ()) {
390 mText +="<font color=\"#B00000\">"; 390 mText +="<font color=\"#B00000\">";
391 addTag("i",i18n("This todo has been cancelled!")); 391 addTag("i",i18n("This todo has been cancelled!"));
392 mText.append("<br>"); 392 mText.append("<br>");
393 mText += "</font>"; 393 mText += "</font>";
394 mMailSubject += i18n("(cancelled)"); 394 mMailSubject += i18n("(cancelled)");
395 } 395 }
396 396
397 if (!event->location().isEmpty()) { 397 if (!event->location().isEmpty()) {
398 addTag("b",i18n("Location: ")); 398 addTag("b",i18n("Location: "));
399 mText.append(event->location()+"<br>"); 399 mText.append(event->location()+"<br>");
400 mMailSubject += i18n(" at ") + event->location(); 400 mMailSubject += i18n(" at ") + event->location();
401 } 401 }
402 if (event->hasStartDate()) { 402 if (event->hasStartDate()) {
403 mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(KOPrefs::instance()->mShortDateInViewer))); 403 mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(KOPrefs::instance()->mShortDateInViewer)));
404 } 404 }
405 if (event->hasDueDate()) { 405 if (event->hasDueDate()) {
406 mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer))); 406 mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer)));
407 mMailSubject += i18n(" - " )+event->dtDueStr( true ); 407 mMailSubject += i18n(" - " )+event->dtDueStr( true );
408 } 408 }
409 addTag("b",i18n("Access: ")); 409 addTag("b",i18n("Access: "));
410 mText.append(event->secrecyStr()+"<br>"); 410 mText.append(event->secrecyStr()+"<br>");
411 if (!event->description().isEmpty()) { 411 if (!event->description().isEmpty()) {
412 addTag("p",i18n("<b>Details: </b>")); 412 addTag("p",i18n("<b>Details: </b>"));
413 addTag("p",event->description()); 413 addTag("p",event->description());
414 } 414 }
415 415
416 formatCategories(event); 416 formatCategories(event);
417 417
418 mText.append(i18n("<p><b>Priority:</b> %2</p>") 418 mText.append(i18n("<p><b>Priority:</b> %2</p>")
419 .arg(QString::number(event->priority()))); 419 .arg(QString::number(event->priority())));
420 420
421 formatReadOnly(event); 421 formatReadOnly(event);
422 formatAttendees(event); 422 formatAttendees(event);
423 if ( event->relatedTo() ) { 423 if ( event->relatedTo() ) {
424 addTag("b",i18n("Parent todo: ")); 424 addTag("b",i18n("Parent todo:<br>"));
425 mText.append(event->relatedTo()->summary()+" [" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] <br>"); 425 mText.append(event->relatedTo()->summary()+" [" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] <br>");
426 } 426 }
427 QPtrList<Incidence> Relations = event->relations(); 427 QPtrList<Incidence> Relations = event->relations();
428 Incidence *to; 428 Incidence *to;
429 if ( Relations.first() ) 429 if ( Relations.first() )
430 addTag("b",i18n("Sub todos:<br>")); 430 addTag("b",i18n("Sub todos:<br>"));
431 for (to=Relations.first();to;to=Relations.next()) { 431 for (to=Relations.first();to;to=Relations.next()) {
432 mText.append( to->summary()+" [" +QString::number(to->priority()) + "/" + QString::number(((Todo*)to)->percentComplete())+"%]<br>"); 432 mText.append( to->summary()+" [" +QString::number(to->priority()) + "/" + QString::number(((Todo*)to)->percentComplete())+"%]<br>");
433 433
434 } 434 }
435 setText(mText); 435 setText(mText);
436} 436}
437 437
438void KOEventViewer::formatCategories(Incidence *event) 438void KOEventViewer::formatCategories(Incidence *event)
439{ 439{
440 if (!event->categoriesStr().isEmpty()) { 440 if (!event->categoriesStr().isEmpty()) {
441 if (event->categories().count() == 1) { 441 if (event->categories().count() == 1) {
442 addTag("h3",i18n("Category")); 442 addTag("h3",i18n("Category"));
443 } else { 443 } else {
444 addTag("h3",i18n("Categories")); 444 addTag("h3",i18n("Categories"));
445 } 445 }
446 addTag("p",event->categoriesStr()); 446 addTag("p",event->categoriesStr());
447 } 447 }
448} 448}
449void KOEventViewer::formatAttendees(Incidence *event) 449void KOEventViewer::formatAttendees(Incidence *event)
450{ 450{
451 QPtrList<Attendee> attendees = event->attendees(); 451 QPtrList<Attendee> attendees = event->attendees();
452 if (attendees.count()) { 452 if (attendees.count()) {
453 453
454 454
455 QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small); 455 QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small);
456 QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small); 456 QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small);
457 addTag("h3",i18n("Organizer")); 457 addTag("h3",i18n("Organizer"));
458 mText.append("<ul><li>"); 458 mText.append("<ul><li>");
459#ifndef KORG_NOKABC 459#ifndef KORG_NOKABC
460 460
461#ifdef DESKTOP_VERSION 461#ifdef DESKTOP_VERSION
462 KABC::AddressBook *add_book = KABC::StdAddressBook::self(); 462 KABC::AddressBook *add_book = KABC::StdAddressBook::self();
463 KABC::Addressee::List addressList; 463 KABC::Addressee::List addressList;
464 addressList = add_book->findByEmail(event->organizer()); 464 addressList = add_book->findByEmail(event->organizer());
465 KABC::Addressee o = addressList.first(); 465 KABC::Addressee o = addressList.first();
466 if (!o.isEmpty() && addressList.size()<2) { 466 if (!o.isEmpty() && addressList.size()<2) {
467 mText += "<a href=\"uid:" + o.uid() + "\">"; 467 mText += "<a href=\"uid:" + o.uid() + "\">";
468 mText += o.formattedName(); 468 mText += o.formattedName();
469 mText += "</a>\n"; 469 mText += "</a>\n";
470 } else { 470 } else {
471 mText.append(event->organizer()); 471 mText.append(event->organizer());
472 } 472 }
@@ -489,129 +489,129 @@ void KOEventViewer::formatAttendees(Incidence *event)
489 mText.append("</li></ul>"); 489 mText.append("</li></ul>");
490 490
491 addTag("h3",i18n("Attendees")); 491 addTag("h3",i18n("Attendees"));
492 Attendee *a; 492 Attendee *a;
493 mText.append("<ul>"); 493 mText.append("<ul>");
494 int a_count = 0; 494 int a_count = 0;
495 int a_count_nr = 0; 495 int a_count_nr = 0;
496 496
497 for(a=attendees.first();a;a=attendees.next()) { 497 for(a=attendees.first();a;a=attendees.next()) {
498#ifndef KORG_NOKABC 498#ifndef KORG_NOKABC
499#ifdef DESKTOP_VERSION 499#ifdef DESKTOP_VERSION
500 if (a->name().isEmpty()) { 500 if (a->name().isEmpty()) {
501 addressList = add_book->findByEmail(a->email()); 501 addressList = add_book->findByEmail(a->email());
502 KABC::Addressee o = addressList.first(); 502 KABC::Addressee o = addressList.first();
503 if (!o.isEmpty() && addressList.size()<2) { 503 if (!o.isEmpty() && addressList.size()<2) {
504 mText += "<a href=\"uid:" + o.uid() + "\">"; 504 mText += "<a href=\"uid:" + o.uid() + "\">";
505 mText += o.formattedName(); 505 mText += o.formattedName();
506 mText += "</a>\n"; 506 mText += "</a>\n";
507 } else { 507 } else {
508 mText += "<li>"; 508 mText += "<li>";
509 mText.append(a->email()); 509 mText.append(a->email());
510 mText += "\n"; 510 mText += "\n";
511 } 511 }
512 } else { 512 } else {
513 mText += "<li><a href=\"uid:" + a->uid() + "\">"; 513 mText += "<li><a href=\"uid:" + a->uid() + "\">";
514 if (!a->name().isEmpty()) mText += a->name(); 514 if (!a->name().isEmpty()) mText += a->name();
515 else mText += a->email(); 515 else mText += a->email();
516 mText += "</a>\n"; 516 mText += "</a>\n";
517 } 517 }
518#else //DESKTOP_VERSION 518#else //DESKTOP_VERSION
519 mText += "<li><a href=\"uid:" + a->uid() + "\">"; 519 mText += "<li><a href=\"uid:" + a->uid() + "\">";
520 if (!a->name().isEmpty()) mText += a->name(); 520 if (!a->name().isEmpty()) mText += a->name();
521 else mText += a->email(); 521 else mText += a->email();
522 mText += "</a>\n"; 522 mText += "</a>\n";
523#endif //DESKTOP_VERSION 523#endif //DESKTOP_VERSION
524#else 524#else
525 //qDebug("nokabc "); 525 //qDebug("nokabc ");
526 mText += "<li><a href=\"uid:" + a->uid() + "\">"; 526 mText += "<li><a href=\"uid:" + a->uid() + "\">";
527 if (!a->name().isEmpty()) mText += a->name(); 527 if (!a->name().isEmpty()) mText += a->name();
528 else mText += a->email(); 528 else mText += a->email();
529 mText += "</a>\n"; 529 mText += "</a>\n";
530#endif 530#endif
531 531
532 532
533 if (!a->email().isEmpty()) { 533 if (!a->email().isEmpty()) {
534 if (iconPath) { 534 if (iconPath) {
535 mText += "<a href=\"mailto:" + a->name() +" <" + a->email() + ">:" + mMailSubject + "\">"; 535 mText += "<a href=\"mailto:" + a->name() +" <" + a->email() + ">:" + mMailSubject + "\">";
536 if ( a->RSVP() ) { 536 if ( a->RSVP() ) {
537 ++a_count; 537 ++a_count_nr;
538 mText += "<IMG src=\"" + iconPath + "\">"; 538 mText += "<IMG src=\"" + iconPath + "\">";
539 } 539 }
540 else { 540 else {
541 ++a_count_nr; 541 ++a_count;
542 mText += "<IMG src=\"" + NOiconPath + "\">"; 542 mText += "<IMG src=\"" + NOiconPath + "\">";
543 } 543 }
544 mText += "</a>\n"; 544 mText += "</a>\n";
545 } 545 }
546 } 546 }
547 if (a->status() != Attendee::NeedsAction ) 547 if (a->status() != Attendee::NeedsAction )
548 mText +="[" + a->statusStr() + "] "; 548 mText +="[" + a->statusStr() + "] ";
549 if (a->role() == Attendee::Chair ) 549 if (a->role() == Attendee::Chair )
550 mText +="(" + a->roleStr().left(1) + ".)"; 550 mText +="(" + a->roleStr().left(1) + ".)";
551 } 551 }
552 mText.append("</li></ul>"); 552 mText.append("</li></ul>");
553 if ( a_count > 1 ) { 553 if ( (a_count+a_count_nr) > 1 ) {
554 mText += "<a href=\"mailto:ALL\">"; 554 mText += "<a href=\"mailto:ALL\">";
555 mText += i18n( "Mail to all" ); 555 mText += i18n( "Mail to all" );
556 mText += "</a> ( "; 556 mText += "</a> ( ";
557 mText += "<IMG src=\"" + iconPath + "\">"; 557 mText += "<IMG src=\"" + iconPath + "\">";
558 mText += i18n( " and " ); 558 mText += i18n( " and " );
559 mText += "<IMG src=\"" + NOiconPath + "\"> )"; 559 mText += "<IMG src=\"" + NOiconPath + "\"> )";
560 mText += "<br>\n"; 560 mText += "<br>\n";
561 561
562 562
563 } 563 }
564 if ( a_count_nr > 1 ) { 564 if ( a_count_nr > 1 ) {
565 mText += "<a href=\"mailto:RSVP\">"; 565 mText += "<a href=\"mailto:RSVP\">";
566 mText += i18n( "Mail to selected" ); 566 mText += i18n( "Mail to selected" );
567 mText += "</a> ( "; 567 mText += "</a> ( ";
568 mText += i18n( "<IMG src=\"%1\"> only )").arg ( iconPath ); 568 mText += i18n( "<IMG src=\"%1\"> only )").arg ( iconPath );
569 mText += "\n"; 569 mText += "<br>\n";
570 } 570 }
571 } 571 }
572 572
573} 573}
574void KOEventViewer::appendJournal(Journal *jour, int mode ) 574void KOEventViewer::appendJournal(Journal *jour, int mode )
575{ 575{
576 bool shortDate = KOPrefs::instance()->mShortDateInViewer; 576 bool shortDate = KOPrefs::instance()->mShortDateInViewer;
577 if (mode == 0 ) { 577 if (mode == 0 ) {
578 addTag("h2",i18n("Journal from: ")); 578 addTag("h2",i18n("Journal from: "));
579 } 579 }
580 else { 580 else {
581 if ( mode == 1 ) { 581 if ( mode == 1 ) {
582 addTag("h2",i18n( "Local: " ) +i18n("Journal from: ")); 582 addTag("h2",i18n( "Local: " ) +i18n("Journal from: "));
583 } else { 583 } else {
584 addTag("h2",i18n( "Remote: " ) +i18n("Journal from: ")); 584 addTag("h2",i18n( "Remote: " ) +i18n("Journal from: "));
585 } 585 }
586 } 586 }
587 topLevelWidget()->setCaption("Journal Viewer"); 587 topLevelWidget()->setCaption("Journal Viewer");
588 mText.append(i18n("<h3> %1 </h3> ").arg(jour->dtStartDateStr(KOPrefs::instance()->mShortDateInViewer))); 588 mText.append(i18n("<h3> %1 </h3> ").arg(jour->dtStartDateStr(KOPrefs::instance()->mShortDateInViewer)));
589 addTag("b",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(jour->lastModified(),shortDate ) ); 589 addTag("b",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(jour->lastModified(),shortDate ) );
590 if (!jour->description().isEmpty()) { 590 if (!jour->description().isEmpty()) {
591 addTag("p",jour->description()); 591 addTag("p",jour->description());
592 } 592 }
593 setText(mText); 593 setText(mText);
594} 594}
595 595
596void KOEventViewer::formatReadOnly(Incidence *event) 596void KOEventViewer::formatReadOnly(Incidence *event)
597{ 597{
598 if (event->isReadOnly()) { 598 if (event->isReadOnly()) {
599 addTag("p","<em>(" + i18n("read-only") + ")</em>"); 599 addTag("p","<em>(" + i18n("read-only") + ")</em>");
600 } 600 }
601} 601}
602void KOEventViewer::setSyncMode( bool b ) 602void KOEventViewer::setSyncMode( bool b )
603{ 603{
604 mSyncMode = b; 604 mSyncMode = b;
605} 605}
606 606
607 607
608void KOEventViewer::setTodo(Todo *event, bool clearV ) 608void KOEventViewer::setTodo(Todo *event, bool clearV )
609{ 609{
610 if ( clearV ) 610 if ( clearV )
611 clearEvents(); 611 clearEvents();
612 if ( mSyncMode ) { 612 if ( mSyncMode ) {
613 if ( clearV ) 613 if ( clearV )
614 appendTodo(event,1 ); 614 appendTodo(event,1 );
615 else 615 else
616 appendTodo(event,2); 616 appendTodo(event,2);
617 } else 617 } else
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 65accdc..5926abe 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -750,373 +750,367 @@ void MonthViewCell::newEvent()
750 emit newEventSignal( dt ); 750 emit newEventSignal( dt );
751} 751}
752void MonthViewCell::cellClicked( QListBoxItem *item ) 752void MonthViewCell::cellClicked( QListBoxItem *item )
753{ 753{
754 static QListBoxItem * lastClicked = 0; 754 static QListBoxItem * lastClicked = 0;
755 if ( item == 0 ) { 755 if ( item == 0 ) {
756 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); 756 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
757 emit newEventSignal( dt ); 757 emit newEventSignal( dt );
758 return; 758 return;
759 } 759 }
760 /* 760 /*
761 if ( lastClicked ) 761 if ( lastClicked )
762 if ( ! item ) { 762 if ( ! item ) {
763 if ( lastClicked->listBox() != item->listBox() ) 763 if ( lastClicked->listBox() != item->listBox() )
764 lastClicked->listBox()->clearSelection(); 764 lastClicked->listBox()->clearSelection();
765 } 765 }
766 */ 766 */
767 767
768 mMonthView->setSelectedCell( this ); 768 mMonthView->setSelectedCell( this );
769 if( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) enableScrollBars( true ); 769 if( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) enableScrollBars( true );
770 select(); 770 select();
771} 771}
772 772
773void MonthViewCell::contextMenu( QListBoxItem *item ) 773void MonthViewCell::contextMenu( QListBoxItem *item )
774{ 774{
775 if ( !item ) return; 775 if ( !item ) return;
776 776
777 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); 777 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item );
778 Incidence *incidence = eventItem->incidence(); 778 Incidence *incidence = eventItem->incidence();
779 if ( incidence ) mMonthView->showContextMenu( incidence ); 779 if ( incidence ) mMonthView->showContextMenu( incidence );
780} 780}
781 781
782void MonthViewCell::selection( QListBoxItem *item ) 782void MonthViewCell::selection( QListBoxItem *item )
783{ 783{
784 if ( !item ) return; 784 if ( !item ) return;
785 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 mShortDayLabels( false ), mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) 798 mWidthLongDayLabel( 0 ), mSelectedCell( 0 )
799{ 799{
800 800 ignoreResizeEvent = 0;
801 mShortDayLabelsW = false;
802 mShortDayLabelsM = false;
801 clPending = true; 803 clPending = true;
802 mWidStack = new QWidgetStack( this ); 804 mWidStack = new QWidgetStack( this );
803 QHBoxLayout* hb = new QHBoxLayout( this ); 805 QHBoxLayout* hb = new QHBoxLayout( this );
804 mMonthView = new QWidget( mWidStack ); 806 mMonthView = new QWidget( mWidStack );
805 mWeekView = new QWidget( mWidStack ); 807 mWeekView = new QWidget( mWidStack );
806#if QT_VERSION >= 0x030000 808#if QT_VERSION >= 0x030000
807 mWidStack->addWidget(mMonthView ); 809 mWidStack->addWidget(mMonthView );
808 mWidStack->addWidget(mWeekView ); 810 mWidStack->addWidget(mWeekView );
809#else 811#else
810 mWidStack->addWidget( mMonthView, 1 ); 812 mWidStack->addWidget( mMonthView, 1 );
811 mWidStack->addWidget( mWeekView , 1 ); 813 mWidStack->addWidget( mWeekView , 1 );
812#endif 814#endif
813 hb->addWidget( mWidStack ); 815 hb->addWidget( mWidStack );
814 mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); 816 mWeekStartsMonday = KGlobal::locale()->weekStartsMonday();
815 mShowWeekView = KOPrefs::instance()->mMonthViewWeek; 817 mShowWeekView = KOPrefs::instance()->mMonthViewWeek;
816 if ( mShowWeekView ) 818 if ( mShowWeekView )
817 mWeekStartsMonday = true; 819 mWeekStartsMonday = true;
818 updatePossible = false; 820 updatePossible = false;
819 mCells.setAutoDelete( true ); 821 mCells.setAutoDelete( true );
820 mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ;
821 mDayLabels.resize( mDaysPerWeek ); 822 mDayLabels.resize( mDaysPerWeek );
822 mDayLabelsW.resize( mDaysPerWeek ); 823 mDayLabelsW.resize( mDaysPerWeek );
823 QFont bfont = font(); 824 QFont bfont = font();
824 if ( QApplication::desktop()->width() < 650 ) { 825 if ( QApplication::desktop()->width() < 650 ) {
825 bfont.setPointSize( bfont.pointSize() - 2 ); 826 bfont.setPointSize( bfont.pointSize() - 2 );
826 } 827 }
827 bfont.setBold( true ); 828 bfont.setBold( true );
828 int i; 829 int i;
829 830
830 for( i = 0; i < mDaysPerWeek; i++ ) { 831 for( i = 0; i < mDaysPerWeek; i++ ) {
831 QLabel *label = new QLabel( mMonthView ); 832 QLabel *label = new QLabel( mMonthView );
832 label->setFont(bfont); 833 label->setFont(bfont);
833 label->setFrameStyle(QFrame::Panel|QFrame::Raised); 834 label->setFrameStyle(QFrame::Panel|QFrame::Raised);
834 label->setLineWidth(1); 835 label->setLineWidth(1);
835 label->setAlignment(AlignCenter); 836 label->setAlignment(AlignCenter);
836 mDayLabels.insert( i, label ); 837 mDayLabels.insert( i, label );
837 label = new QLabel( mWeekView ); 838 label = new QLabel( mWeekView );
838 label->setFont(bfont); 839 label->setFont(bfont);
839 label->setFrameStyle(QFrame::Panel|QFrame::Raised); 840 label->setFrameStyle(QFrame::Panel|QFrame::Raised);
840 label->setLineWidth(1); 841 label->setLineWidth(1);
841 label->setAlignment(AlignCenter); 842 label->setAlignment(AlignCenter);
842 mDayLabelsW.insert( i, label ); 843 mDayLabelsW.insert( i, label );
843 } 844 }
844 845
845 bfont.setBold( false ); 846 bfont.setBold( false );
846 mWeekLabels.resize( mNumWeeks+1 ); 847 mWeekLabels.resize( mNumWeeks+1 );
847 mWeekLabelsW.resize( 2 ); 848 mWeekLabelsW.resize( 2 );
848 for( i = 0; i < mNumWeeks+1; i++ ) { 849 for( i = 0; i < mNumWeeks+1; i++ ) {
849 KOWeekButton *label = new KOWeekButton( mMonthView ); 850 KOWeekButton *label = new KOWeekButton( mMonthView );
850 label->setFocusPolicy(NoFocus); 851 label->setFocusPolicy(NoFocus);
851 label->setFont(bfont); 852 label->setFont(bfont);
852 connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); 853 connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) );
853 label->setFlat(true); 854 label->setFlat(true);
854 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"));
855 //label->setFrameStyle(QFrame::Panel|QFrame::Raised); 856 //label->setFrameStyle(QFrame::Panel|QFrame::Raised);
856 //label->setLineWidth(1); 857 //label->setLineWidth(1);
857 //label->setAlignment(AlignCenter); 858 //label->setAlignment(AlignCenter);
858 mWeekLabels.insert( i, label ); 859 mWeekLabels.insert( i, label );
859 } 860 }
860 mWeekLabels[mNumWeeks]->setText( i18n("W")); 861 mWeekLabels[mNumWeeks]->setText( i18n("W"));
861 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"));
862 863
863 for( i = 0; i < 1+1; i++ ) { 864 for( i = 0; i < 1+1; i++ ) {
864 KOWeekButton *label = new KOWeekButton( mWeekView ); 865 KOWeekButton *label = new KOWeekButton( mWeekView );
865 label->setFocusPolicy(NoFocus); 866 label->setFocusPolicy(NoFocus);
866 label->setFont(bfont); 867 label->setFont(bfont);
867 connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); 868 connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) );
868 label->setFlat(true); 869 label->setFlat(true);
869 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"));
870 //label->setFrameStyle(QFrame::Panel|QFrame::Raised); 871 //label->setFrameStyle(QFrame::Panel|QFrame::Raised);
871 //label->setLineWidth(1); 872 //label->setLineWidth(1);
872 //label->setAlignment(AlignCenter); 873 //label->setAlignment(AlignCenter);
873 mWeekLabelsW.insert( i, label ); 874 mWeekLabelsW.insert( i, label );
874 } 875 }
875 mWeekLabelsW[1]->setText( i18n("W")); 876 mWeekLabelsW[1]->setText( i18n("W"));
876 877
877 878
878 int row, col; 879 int row, col;
879 mCells.resize( mNumCells ); 880 mCells.resize( mNumCells );
880 for( row = 0; row < mNumWeeks; ++row ) { 881 for( row = 0; row < mNumWeeks; ++row ) {
881 for( col = 0; col < mDaysPerWeek; ++col ) { 882 for( col = 0; col < mDaysPerWeek; ++col ) {
882 MonthViewCell *cell = new MonthViewCell( this, mMonthView ); 883 MonthViewCell *cell = new MonthViewCell( this, mMonthView );
883 mCells.insert( row * mDaysPerWeek + col, cell ); 884 mCells.insert( row * mDaysPerWeek + col, cell );
884 885
885 connect( cell, SIGNAL( defaultAction( Incidence * ) ), 886 connect( cell, SIGNAL( defaultAction( Incidence * ) ),
886 SLOT( defaultAction( Incidence * ) ) ); 887 SLOT( defaultAction( Incidence * ) ) );
887 connect( cell, SIGNAL( newEventSignal( QDateTime ) ), 888 connect( cell, SIGNAL( newEventSignal( QDateTime ) ),
888 SIGNAL( newEventSignal( QDateTime ) ) ); 889 SIGNAL( newEventSignal( QDateTime ) ) );
889 connect( cell, SIGNAL( showDaySignal( QDate ) ), 890 connect( cell, SIGNAL( showDaySignal( QDate ) ),
890 SIGNAL( showDaySignal( QDate ) ) ); 891 SIGNAL( showDaySignal( QDate ) ) );
891 } 892 }
892 } 893 }
893 mCellsW.resize( mDaysPerWeek ); 894 mCellsW.resize( mDaysPerWeek );
894 for( col = 0; col < mDaysPerWeek; ++col ) { 895 for( col = 0; col < mDaysPerWeek; ++col ) {
895 MonthViewCell *cell = new MonthViewCell( this, mWeekView ); 896 MonthViewCell *cell = new MonthViewCell( this, mWeekView );
896 mCellsW.insert( col, cell ); 897 mCellsW.insert( col, cell );
897 898
898 connect( cell, SIGNAL( defaultAction( Incidence * ) ), 899 connect( cell, SIGNAL( defaultAction( Incidence * ) ),
899 SLOT( defaultAction( Incidence * ) ) ); 900 SLOT( defaultAction( Incidence * ) ) );
900 connect( cell, SIGNAL( newEventSignal( QDateTime ) ), 901 connect( cell, SIGNAL( newEventSignal( QDateTime ) ),
901 SIGNAL( newEventSignal( QDateTime ) ) ); 902 SIGNAL( newEventSignal( QDateTime ) ) );
902 connect( cell, SIGNAL( showDaySignal( QDate ) ), 903 connect( cell, SIGNAL( showDaySignal( QDate ) ),
903 SIGNAL( showDaySignal( QDate ) ) ); 904 SIGNAL( showDaySignal( QDate ) ) );
904 cell->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont ); 905 cell->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont );
905 } 906 }
906 907
907 //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) ); 908 //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) );
908 mContextMenu = eventPopup(); 909 mContextMenu = eventPopup();
909 // updateConfig(); //useless here 910 updateConfig(); //useless here
910 911
911 //mWeekLabels[mNumWeeks]->setText( i18n("W")); 912 //mWeekLabels[mNumWeeks]->setText( i18n("W"));
912#if 0 913
913 mWidStack = new QWidgetStack( this );
914 mMonthView = new QWidget( mWidStack );
915 mWeekView = new QWidget( mWidStack );
916#endif
917 if ( mShowWeekView ) 914 if ( mShowWeekView )
918 mWidStack->raiseWidget( mWeekView ); 915 mWidStack->raiseWidget( mWeekView );
919 else 916 else
920 mWidStack->raiseWidget( mMonthView ); 917 mWidStack->raiseWidget( mMonthView );
921 918
922 emit incidenceSelected( 0 ); 919 emit incidenceSelected( 0 );
923} 920}
924 921
925KOMonthView::~KOMonthView() 922KOMonthView::~KOMonthView()
926{ 923{
927 delete mContextMenu; 924 delete mContextMenu;
928} 925}
929 926
930void KOMonthView::selectInternalWeekNum ( int n ) 927void KOMonthView::selectInternalWeekNum ( int n )
931{ 928{
932 switchView(); 929 switchView();
933 emit selectWeekNum ( n ); 930 emit selectWeekNum ( n );
934} 931}
935 932
936int KOMonthView::currentWeek() 933int KOMonthView::currentWeek()
937{ 934{
938 if ( mShowWeekView ) 935 if ( mShowWeekView )
939 return mWeekLabelsW[0]->getWeekNum(); 936 return mWeekLabelsW[0]->getWeekNum();
940 return mWeekLabels[0]->getWeekNum(); 937 return mWeekLabels[0]->getWeekNum();
941} 938}
942void KOMonthView::switchView() 939void KOMonthView::switchView()
943{ 940{
944 941
945 if ( selectedCell( ) ) 942 if ( selectedCell( ) )
946 selectedCell()->deselect(); 943 selectedCell()->deselect();
947 mShowWeekView = !mShowWeekView; 944 mShowWeekView = !mShowWeekView;
948 KOPrefs::instance()->mMonthViewWeek = mShowWeekView; 945 KOPrefs::instance()->mMonthViewWeek = mShowWeekView;
949 //emit showNavigator( !mShowWeekView ); 946 //emit showNavigator( !mShowWeekView );
950 if ( clPending ) { 947 if ( clPending ) {
951 computeLayout(); 948 computeLayout();
952 updateConfig(); 949 updateConfig();
953 } 950 }
954 if ( mShowWeekView ) 951 if ( mShowWeekView )
955 mWidStack->raiseWidget( mWeekView ); 952 mWidStack->raiseWidget( mWeekView );
956 else 953 else
957 mWidStack->raiseWidget( mMonthView ); 954 mWidStack->raiseWidget( mMonthView );
958 clPending = false; 955 clPending = false;
959} 956}
960 957
961int KOMonthView::maxDatesHint() 958int KOMonthView::maxDatesHint()
962{ 959{
963 return mNumCells; 960 return mNumCells;
964} 961}
965 962
966int KOMonthView::currentDateCount() 963int KOMonthView::currentDateCount()
967{ 964{
968 return mNumCells; 965 return mNumCells;
969} 966}
970 967
971QPtrList<Incidence> KOMonthView::selectedIncidences() 968QPtrList<Incidence> KOMonthView::selectedIncidences()
972{ 969{
973 QPtrList<Incidence> selected; 970 QPtrList<Incidence> selected;
974 971
975 if ( mSelectedCell ) { 972 if ( mSelectedCell ) {
976 Incidence *incidence = mSelectedCell->selectedIncidence(); 973 Incidence *incidence = mSelectedCell->selectedIncidence();
977 if ( incidence ) selected.append( incidence ); 974 if ( incidence ) selected.append( incidence );
978 } 975 }
979 976
980 return selected; 977 return selected;
981} 978}
982 979
983DateList KOMonthView::selectedDates() 980DateList KOMonthView::selectedDates()
984{ 981{
985 DateList selected; 982 DateList selected;
986 983
987 if ( mSelectedCell ) { 984 if ( mSelectedCell ) {
988 QDate qd = mSelectedCell->selectedIncidenceDate(); 985 QDate qd = mSelectedCell->selectedIncidenceDate();
989 if ( qd.isValid() ) selected.append( qd ); 986 if ( qd.isValid() ) selected.append( qd );
990 } 987 }
991 988
992 return selected; 989 return selected;
993} 990}
994 991
995void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd, 992void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd,
996 const QDate &td) 993 const QDate &td)
997{ 994{
998#ifndef KORG_NOPRINTER 995#ifndef KORG_NOPRINTER
999 calPrinter->preview(CalPrinter::Month, fd, td); 996 calPrinter->preview(CalPrinter::Month, fd, td);
1000#endif 997#endif
1001} 998}
1002 999
1003void KOMonthView::updateConfig() 1000void KOMonthView::updateConfig()
1004{ 1001{
1005 1002
1006 mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); 1003 mWeekStartsMonday = KGlobal::locale()->weekStartsMonday();
1007 1004
1008 if ( mShowWeekView ) { 1005 if ( mShowWeekView ) {
1009 mWeekStartsMonday = true; 1006 mWeekStartsMonday = true;
1010 } 1007 }
1011 QFontMetrics fontmetric(mDayLabels[0]->font()); 1008 QFontMetrics fontmetric(mDayLabels[0]->font());
1012 mWidthLongDayLabel = 0; 1009 mWidthLongDayLabel = 0;
1013 1010 qDebug("KOMonthView::updateConfig() ");
1014 for (int i = 0; i < 7; i++) { 1011 for (int i = 0; i < 7; i++) {
1015 int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); 1012 int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1));
1016 if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; 1013 if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width;
1017 } 1014 }
1018 bool temp = mShowSatSunComp ;
1019 mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ;
1020 if ( ! mShowWeekView ) { 1015 if ( ! mShowWeekView ) {
1021 if ( temp != KOPrefs::instance()->mMonthViewSatSunTog )
1022 computeLayout(); 1016 computeLayout();
1023 } 1017 }
1024 updateDayLabels(); 1018 updateDayLabels();
1025 //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks); 1019 //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks);
1026 //int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks; 1020 //int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks;
1027 //resizeEvent( 0 ); 1021 //resizeEvent( 0 );
1028 for (uint i = 0; i < mCells.count(); ++i) { 1022 for (uint i = 0; i < mCells.count(); ++i) {
1029 mCells[i]->updateConfig(); 1023 mCells[i]->updateConfig();
1030 } 1024 }
1031 1025
1032 for (uint i = 0; i < mCellsW.count(); ++i) { 1026 for (uint i = 0; i < mCellsW.count(); ++i) {
1033 mCellsW[i]->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont); 1027 mCellsW[i]->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont);
1034 } 1028 }
1035#ifdef DESKTOP_VERSION 1029#ifdef DESKTOP_VERSION
1036 MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips); 1030 MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips);
1037#endif 1031#endif
1038 updateView(); 1032 updateView();
1039} 1033}
1040 1034
1041void KOMonthView::updateDayLabels() 1035void KOMonthView::updateDayLabels()
1042{ 1036{
1043 1037
1044 QPtrVector<QLabel> *mDayLabelsT; 1038 QPtrVector<QLabel> *mDayLabelsT;
1045#if 0 1039#if 0
1046 if (mShowWeekView ) 1040 if (mShowWeekView )
1047 mDayLabelsT = &mDayLabelsW; 1041 mDayLabelsT = &mDayLabelsW;
1048 else 1042 else
1049 mDayLabelsT = &mDayLabels; 1043 mDayLabelsT = &mDayLabels;
1050#endif 1044#endif
1051 1045 qDebug("updateDayLabels W %d M %d ",mShortDayLabelsW ,mShortDayLabelsM);
1052 mDayLabelsT = &mDayLabelsW; 1046 mDayLabelsT = &mDayLabelsW;
1053 for (int i = 0; i < 7; i++) { 1047 for (int i = 0; i < 7; i++) {
1054 if (mWeekStartsMonday) { 1048 if (mWeekStartsMonday) {
1055 bool show = mShortDayLabels; 1049 bool show = mShortDayLabelsW;
1056 if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) 1050 if ( i > 4 && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() )
1057 show = true; 1051 show = true;
1058 (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); 1052 (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show));
1059 } else { 1053 } else {
1060 if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabels)); 1054 if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabelsW));
1061 else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabels)); 1055 else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabelsW));
1062 1056
1063 } 1057 }
1064 } 1058 }
1065 mDayLabelsT = &mDayLabels; 1059 mDayLabelsT = &mDayLabels;
1066 for (int i = 0; i < 7; i++) { 1060 for (int i = 0; i < 7; i++) {
1067 if (mWeekStartsMonday) { 1061 if (mWeekStartsMonday) {
1068 bool show = mShortDayLabels; 1062 bool show = mShortDayLabelsM;
1069 if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) 1063 if ( i > 4 && KOPrefs::instance()->mMonthViewSatSunTog && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() )
1070 show = true; 1064 show = true;
1071 (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); 1065 (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show));
1072 } else { 1066 } else {
1073 if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabels)); 1067 if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabelsM));
1074 else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabels)); 1068 else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabelsM));
1075 1069
1076 } 1070 }
1077 } 1071 }
1078 1072
1079} 1073}
1080 1074
1081void KOMonthView::showDates(const QDate &start, const QDate &) 1075void KOMonthView::showDates(const QDate &start, const QDate &)
1082{ 1076{
1083 // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl; 1077 // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl;
1084 1078
1085 QPtrVector<MonthViewCell> *cells; 1079 QPtrVector<MonthViewCell> *cells;
1086 QPtrVector<QLabel> *dayLabels; 1080 QPtrVector<QLabel> *dayLabels;
1087 QPtrVector<KOWeekButton> *weekLabels; 1081 QPtrVector<KOWeekButton> *weekLabels;
1088 int weekNum = 6; 1082 int weekNum = 6;
1089 if ( mShowWeekView ) { 1083 if ( mShowWeekView ) {
1090 weekNum = 1; 1084 weekNum = 1;
1091 cells = &mCellsW; 1085 cells = &mCellsW;
1092 dayLabels = &mDayLabelsW; 1086 dayLabels = &mDayLabelsW;
1093 weekLabels = &mWeekLabelsW; 1087 weekLabels = &mWeekLabelsW;
1094 } else { 1088 } else {
1095 cells = &mCells; 1089 cells = &mCells;
1096 dayLabels = &mDayLabels; 1090 dayLabels = &mDayLabels;
1097 weekLabels = &mWeekLabels; 1091 weekLabels = &mWeekLabels;
1098 } 1092 }
1099 1093
1100 mStartDate = start; 1094 mStartDate = start;
1101 1095
1102 int startWeekDay = mWeekStartsMonday ? 1 : 7; 1096 int startWeekDay = mWeekStartsMonday ? 1 : 7;
1103 1097
1104 while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) { 1098 while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) {
1105 mStartDate = mStartDate.addDays( -1 ); 1099 mStartDate = mStartDate.addDays( -1 );
1106 } 1100 }
1107 1101
1108 bool primary = false; 1102 bool primary = false;
1109 uint i; 1103 uint i;
1110 for( i = 0; i < (*cells).size(); ++i ) { 1104 for( i = 0; i < (*cells).size(); ++i ) {
1111 QDate date = mStartDate.addDays( i ); 1105 QDate date = mStartDate.addDays( i );
1112 (*cells)[i]->setDate( date ); 1106 (*cells)[i]->setDate( date );
1113 1107
1114#ifndef KORG_NOPLUGINS 1108#ifndef KORG_NOPLUGINS
1115 // add holiday, if present 1109 // add holiday, if present
1116 QString hstring(KOCore::self()->holiday(date)); 1110 QString hstring(KOCore::self()->holiday(date));
1117 (*cells)[i]->setHoliday( hstring ); 1111 (*cells)[i]->setHoliday( hstring );
1118#endif 1112#endif
1119 1113
1120 } 1114 }
1121 QDate date = mStartDate.addDays( mWeekStartsMonday ? 3 : 4 ); 1115 QDate date = mStartDate.addDays( mWeekStartsMonday ? 3 : 4 );
1122 for( i = 0; i < weekNum; ++i ) { 1116 for( i = 0; i < weekNum; ++i ) {
@@ -1224,315 +1218,318 @@ void KOMonthView::updateView()
1224 if ( st < 0 ) st = 0; 1218 if ( st < 0 ) st = 0;
1225 if ( end > timeSpan ) end = timeSpan; 1219 if ( end > timeSpan ) end = timeSpan;
1226 int iii; 1220 int iii;
1227 for ( iii = st;iii<= end;++iii) 1221 for ( iii = st;iii<= end;++iii)
1228 (*cells)[iii]->insertEvent( event ); 1222 (*cells)[iii]->insertEvent( event );
1229 } 1223 }
1230 } 1224 }
1231 } 1225 }
1232 } 1226 }
1233 // insert due todos 1227 // insert due todos
1234 QPtrList<Todo> todos = calendar()->todos( ); 1228 QPtrList<Todo> todos = calendar()->todos( );
1235 Todo *todo; 1229 Todo *todo;
1236 for(todo = todos.first(); todo; todo = todos.next()) { 1230 for(todo = todos.first(); todo; todo = todos.next()) {
1237 //insertTodo( todo ); 1231 //insertTodo( todo );
1238 if ( todo->hasDueDate() ) { 1232 if ( todo->hasDueDate() ) {
1239 int day = mStartDate.daysTo( todo->dtDue().date() ); 1233 int day = mStartDate.daysTo( todo->dtDue().date() );
1240 if ( day >= 0 && day < timeSpan + 1) { 1234 if ( day >= 0 && day < timeSpan + 1) {
1241 (*cells)[day]->insertTodo( todo ); 1235 (*cells)[day]->insertTodo( todo );
1242 } 1236 }
1243 } 1237 }
1244 } 1238 }
1245 1239
1246 for( i = 0; i < timeSpan+1; ++i ) { 1240 for( i = 0; i < timeSpan+1; ++i ) {
1247 (*cells)[i]->finishUpdateCell(); 1241 (*cells)[i]->finishUpdateCell();
1248 } 1242 }
1249 processSelectionChange(); 1243 processSelectionChange();
1250 (*cells)[0]->setFocus(); 1244 (*cells)[0]->setFocus();
1251 1245
1252 1246
1253#else 1247#else
1254 // old code 1248 // old code
1255 //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); 1249 //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ");
1256 int i; 1250 int i;
1257 for( i = 0; i < (*cells).count(); ++i ) { 1251 for( i = 0; i < (*cells).count(); ++i ) {
1258 (*cells)[i]->updateCell(); 1252 (*cells)[i]->updateCell();
1259 } 1253 }
1260 1254
1261 //qDebug("KOMonthView::updateView() "); 1255 //qDebug("KOMonthView::updateView() ");
1262 processSelectionChange(); 1256 processSelectionChange();
1263 // qDebug("---------------------------------------------------------------------+ "); 1257 // qDebug("---------------------------------------------------------------------+ ");
1264 (*cells)[0]->setFocus(); 1258 (*cells)[0]->setFocus();
1265#endif 1259#endif
1266 1260
1267 //qDebug("update time %d ", ti.elapsed()); 1261 //qDebug("update time %d ", ti.elapsed());
1268} 1262}
1269 1263
1270void KOMonthView::resizeEvent(QResizeEvent * e) 1264void KOMonthView::resizeEvent(QResizeEvent * e)
1271{ 1265{
1266 qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height());
1267 if ( ignoreResizeEvent ) {
1268 qDebug("KOMonthView::resizeEvent ignored ");
1269 --ignoreResizeEvent;
1270 return;
1271 }
1272 if ( e->size().width()+ e->size().height() < 240 )
1273 return;
1272 computeLayout(); 1274 computeLayout();
1273 clPending = true; 1275 clPending = true;
1274 if ( mShowWeekView ) 1276 if ( mShowWeekView )
1275 mCellsW[0]->setFocus(); 1277 mCellsW[0]->setFocus();
1276 else 1278 else
1277 mCells[0]->setFocus(); 1279 mCells[0]->setFocus();
1278} 1280}
1279void KOMonthView::computeLayoutWeek() 1281void KOMonthView::computeLayoutWeek()
1280{ 1282{
1281 1283
1282 int daysToShow; 1284 int daysToShow;
1283 bool combinedSatSun = false;
1284 if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) {
1285 daysToShow = 6;
1286 combinedSatSun = true;
1287 }
1288 int tWid = topLevelWidget()->size().width(); 1285 int tWid = topLevelWidget()->size().width();
1289 int tHei = topLevelWidget()->size().height(); 1286 int tHei = topLevelWidget()->size().height();
1290 1287
1291 int wid = size().width();//e 1288 int wid = size().width();//e
1292 int hei = size().height()-1; 1289 int hei = size().height()-1;
1293 1290
1294 if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) 1291 if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei )
1295 return; 1292 return;
1296 1293
1297 if ( wid < hei ) 1294 if ( wid < hei )
1298 daysToShow = 2; 1295 daysToShow = 2;
1299 else 1296 else
1300 daysToShow = 3; 1297 daysToShow = 3;
1301 mShowSatSunComp = true; 1298 bool combinedSatSun = true;
1302 combinedSatSun = true;
1303 1299
1304 //qDebug("KOMonthView::computeLayout()------------------------------------ "); 1300 //qDebug("KOMonthView::computeLayout()------------------------------------ ");
1305 QFontMetrics fm ( mWeekLabels[0]->font() ); 1301 QFontMetrics fm ( mWeekLabels[0]->font() );
1306 int weeklabelwid = fm.width( "888" ); 1302 int weeklabelwid = fm.width( "888" );
1307 wid -= weeklabelwid; 1303 wid -= weeklabelwid;
1308 1304
1309 int colWid = wid / daysToShow; 1305 int colWid = wid / daysToShow;
1310 int lastCol = wid - ( colWid*6 ); 1306 int lastCol = wid - ( colWid*6 );
1311 int dayLabelHei = mDayLabelsW[0]->sizeHint().height(); 1307 int dayLabelHei = mDayLabelsW[0]->sizeHint().height();
1312 int cellHei = (hei - (5- daysToShow )*dayLabelHei) /(5- daysToShow ); 1308 int cellHei = (hei - (5- daysToShow )*dayLabelHei) /(5- daysToShow );
1313 int colModulo = wid % daysToShow; 1309 int colModulo = wid % daysToShow;
1314 int rowModulo = (hei- (5- daysToShow )*dayLabelHei) % daysToShow-1; 1310 int rowModulo = (hei- (5- daysToShow )*dayLabelHei) % daysToShow-1;
1315 //qDebug("rowmod %d ", rowModulo); 1311 //qDebug("rowmod %d ", rowModulo);
1316 int i; 1312 int i;
1317 int x,y,w,h; 1313 int x,y,w,h;
1318 x= 0; 1314 x= 0;
1319 y= 0; 1315 y= 0;
1320 w = colWid; 1316 w = colWid;
1321 h = dayLabelHei ; 1317 h = dayLabelHei ;
1322 for ( i = 0; i < 7; i++) { 1318 for ( i = 0; i < 7; i++) {
1323 if ( i && !( i % daysToShow) && i < 6) { 1319 if ( i && !( i % daysToShow) && i < 6) {
1324 y += hei/(5-daysToShow); 1320 y += hei/(5-daysToShow);
1325 x = 0; 1321 x = 0;
1326 w = colWid; 1322 w = colWid;
1327 } 1323 }
1328 if ( ((i) % daysToShow) >= daysToShow-colModulo ) { 1324 if ( ((i) % daysToShow) >= daysToShow-colModulo ) {
1329 ++w; 1325 ++w;
1330 } 1326 }
1331 if ( i >= 5 ) { 1327 if ( i >= 5 ) {
1332 mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,w/2+w%2,h); 1328 mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,w/2+w%2,h);
1333 x -= (w/2 ); 1329 x -= (w/2 );
1334 } 1330 }
1335 else 1331 else
1336 mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,w,h); 1332 mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,w,h);
1337 x += w; 1333 x += w;
1338 } 1334 }
1339 x= 0; 1335 x= 0;
1340 y= dayLabelHei; 1336 y= dayLabelHei;
1341 w = colWid; 1337 w = colWid;
1342 h = cellHei; 1338 h = cellHei;
1343 for ( i = 0; i < mCellsW.count(); ++i) { 1339 for ( i = 0; i < mCellsW.count(); ++i) {
1344 if ( i > 6 ) { 1340 if ( i > 6 ) {
1345 mCellsW[i]->hide(); 1341 mCellsW[i]->hide();
1346 continue; 1342 continue;
1347 } 1343 }
1348 1344
1349 w = colWid; 1345 w = colWid;
1350 if ( ((i) % daysToShow) >= daysToShow-colModulo ) { 1346 if ( ((i) % daysToShow) >= daysToShow-colModulo ) {
1351 ++w; 1347 ++w;
1352 } 1348 }
1353 if ( i == (daysToShow-1-rowModulo)*7) 1349 if ( i == (daysToShow-1-rowModulo)*7)
1354 ++h; 1350 ++h;
1355 1351
1356 if ( i >= 5 ) { 1352 if ( i >= 5 ) {
1357 if ( i ==5 ) { 1353 if ( i ==5 ) {
1358 mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); 1354 mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h/2 );
1359 x -= w ;y += h/2; 1355 x -= w ;y += h/2;
1360 } else { 1356 } else {
1361 if ( ((i-1) % daysToShow) >= daysToShow-colModulo ) { 1357 if ( ((i-1) % daysToShow) >= daysToShow-colModulo ) {
1362 ++w; 1358 ++w;
1363 } 1359 }
1364 mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); 1360 mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 );
1365 y -= h/2; 1361 y -= h/2;
1366 } 1362 }
1367 } else 1363 } else
1368 mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h ); 1364 mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h );
1369 1365
1370 1366
1371 x += w; 1367 x += w;
1372 if ( x + w/2 > wid ) { 1368 if ( x + w/2 > wid ) {
1373 x = 0; 1369 x = 0;
1374 y += h+dayLabelHei ; 1370 y += h+dayLabelHei ;
1375 } 1371 }
1376 } 1372 }
1377 y= dayLabelHei; 1373 y= dayLabelHei;
1378 h = cellHei ; 1374 h = cellHei ;
1379 mWeekLabelsW[0]->setGeometry( 0,y,weeklabelwid,hei-dayLabelHei); 1375 mWeekLabelsW[0]->setGeometry( 0,y,weeklabelwid,hei-dayLabelHei);
1380 mWeekLabelsW[1]->setGeometry( 0,0,weeklabelwid,dayLabelHei); 1376 mWeekLabelsW[1]->setGeometry( 0,0,weeklabelwid,dayLabelHei);
1381 // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); 1377 // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height());
1382 //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); 1378 //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height());
1383 mShortDayLabels = mDayLabelsW[0]->width() < mWidthLongDayLabel ; 1379 mShortDayLabelsW = mDayLabelsW[0]->width() < mWidthLongDayLabel ;
1384 updateDayLabels(); 1380 updateDayLabels();
1385 bool forceUpdate = !updatePossible; 1381 bool forceUpdate = !updatePossible;
1386 updatePossible = true; 1382 updatePossible = true;
1387 //mWeekLabels[mNumWeeks]->setText( i18n("M")); 1383 //mWeekLabels[mNumWeeks]->setText( i18n("M"));
1388 if ( forceUpdate ) 1384 if ( forceUpdate )
1389 updateView(); 1385 updateView();
1390} 1386}
1391void KOMonthView::computeLayout() 1387void KOMonthView::computeLayout()
1392{ 1388{
1393 // select the appropriate heading string size. E.g. "Wednesday" or "Wed". 1389 // select the appropriate heading string size. E.g. "Wednesday" or "Wed".
1394 // note this only changes the text if the requested size crosses the 1390 // note this only changes the text if the requested size crosses the
1395 // threshold between big enough to support the full name and not big 1391 // threshold between big enough to support the full name and not big
1396 // enough. 1392 // enough.
1397 if ( mShowWeekView ){ 1393 if ( mShowWeekView ){
1398 computeLayoutWeek(); 1394 computeLayoutWeek();
1399 return; 1395 return;
1400 } 1396 }
1401 int daysToShow = 7; 1397 int daysToShow = 7;
1402 bool combinedSatSun = false; 1398 bool combinedSatSun = false;
1403 if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { 1399 if (KOPrefs::instance()->mMonthViewSatSunTog ) {
1404 daysToShow = 6; 1400 daysToShow = 6;
1405 combinedSatSun = true; 1401 combinedSatSun = true;
1406 } 1402 }
1407 int tWid = topLevelWidget()->size().width(); 1403 int tWid = topLevelWidget()->size().width();
1408 int tHei = topLevelWidget()->size().height(); 1404 int tHei = topLevelWidget()->size().height();
1409 1405
1410 int wid = size().width();//e 1406 int wid = size().width();//e
1411 int hei = size().height()-1; 1407 int hei = size().height()-1;
1412 1408
1413 if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) 1409 if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei )
1414 return; 1410 return;
1415 //qDebug("KOMonthView::computeLayout()------------------------------------ "); 1411 //qDebug("KOMonthView::computeLayout()------------------------------------ ");
1416 QFontMetrics fm ( mWeekLabels[0]->font() ); 1412 QFontMetrics fm ( mWeekLabels[0]->font() );
1417 int weeklabelwid = fm.width( "888" ); 1413 int weeklabelwid = fm.width( "888" );
1418 wid -= weeklabelwid; 1414 wid -= weeklabelwid;
1419 1415
1420 int colWid = wid / daysToShow; 1416 int colWid = wid / daysToShow;
1421 int lastCol = wid - ( colWid*6 ); 1417 int lastCol = wid - ( colWid*6 );
1422 int dayLabelHei = mDayLabels[0]->sizeHint().height(); 1418 int dayLabelHei = mDayLabels[0]->sizeHint().height();
1423 int cellHei = (hei - dayLabelHei) /6; 1419 int cellHei = (hei - dayLabelHei) /6;
1424 int colModulo = wid % daysToShow; 1420 int colModulo = wid % daysToShow;
1425 int rowModulo = (hei- dayLabelHei) % 6; 1421 int rowModulo = (hei- dayLabelHei) % 6;
1426 //qDebug("rowmod %d ", rowModulo); 1422 //qDebug("rowmod %d ", rowModulo);
1427 int i; 1423 int i;
1428 int x,y,w,h; 1424 int x,y,w,h;
1429 x= 0; 1425 x= 0;
1430 y= 0; 1426 y= 0;
1431 w = colWid; 1427 w = colWid;
1432 h = dayLabelHei ; 1428 h = dayLabelHei ;
1433 for ( i = 0; i < 7; i++) { 1429 for ( i = 0; i < 7; i++) {
1434 if ( i == daysToShow-colModulo ) 1430 if ( i == daysToShow-colModulo )
1435 ++w; 1431 ++w;
1436 if ( combinedSatSun ) { 1432 if ( combinedSatSun ) {
1437 if ( i >= daysToShow-1 ) { 1433 if ( i >= daysToShow-1 ) {
1438 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h); 1434 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h);
1439 x -= w/2 ; 1435 x -= w/2 ;
1440 } 1436 }
1441 else 1437 else
1442 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); 1438 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h);
1443 } else 1439 } else
1444 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); 1440 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h);
1445 x += w; 1441 x += w;
1446 } 1442 }
1447 x= 0; 1443 x= 0;
1448 y= dayLabelHei; 1444 y= dayLabelHei;
1449 w = colWid; 1445 w = colWid;
1450 h = cellHei ; 1446 h = cellHei ;
1451 for ( i = 0; i < mCells.count(); ++i) { 1447 for ( i = 0; i < mCells.count(); ++i) {
1452 w = colWid; 1448 w = colWid;
1453 if ( ((i) % 7) >= 7-colModulo ) { 1449 if ( ((i) % 7) >= 7-colModulo ) {
1454 ++w; 1450 ++w;
1455 } 1451 }
1456 if ( i == (6-rowModulo)*7) 1452 if ( i == (6-rowModulo)*7)
1457 ++h; 1453 ++h;
1458 if ( combinedSatSun ) { 1454 if ( combinedSatSun ) {
1459 if ( (i)%7 >= daysToShow-1 ) { 1455 if ( (i)%7 >= daysToShow-1 ) {
1460 if ( (i)%7 == daysToShow-1 ) { 1456 if ( (i)%7 == daysToShow-1 ) {
1461 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); 1457 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h/2 );
1462 x -= w ;y += h/2; 1458 x -= w ;y += h/2;
1463 } else { 1459 } else {
1464 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); 1460 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 );
1465 y -= h/2; 1461 y -= h/2;
1466 } 1462 }
1467 } else 1463 } else
1468 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); 1464 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h );
1469 1465
1470 } 1466 }
1471 else 1467 else
1472 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); 1468 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h );
1473 x += w; 1469 x += w;
1474 if ( x + w/2 > wid ) { 1470 if ( x + w/2 > wid ) {
1475 x = 0; 1471 x = 0;
1476 y += h; 1472 y += h;
1477 } 1473 }
1478 } 1474 }
1479 y= dayLabelHei; 1475 y= dayLabelHei;
1480 h = cellHei ; 1476 h = cellHei ;
1481 for ( i = 0; i < 6; i++) { 1477 for ( i = 0; i < 6; i++) {
1482 if ( i == (6-rowModulo)) 1478 if ( i == (6-rowModulo))
1483 ++h; 1479 ++h;
1484 mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h); 1480 mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h);
1485 y += h; 1481 y += h;
1486 } 1482 }
1487 mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); 1483 mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei);
1488 // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); 1484 // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height());
1489 //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); 1485 //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height());
1490 mShortDayLabels = mDayLabels[0]->width() < mWidthLongDayLabel ; 1486 mShortDayLabelsM = mDayLabels[0]->width() < mWidthLongDayLabel ;
1487 qDebug("dlwid %d %d ",mDayLabels[0]->width() , mWidthLongDayLabel);
1491 updateDayLabels(); 1488 updateDayLabels();
1492 bool forceUpdate = !updatePossible; 1489 bool forceUpdate = !updatePossible;
1493 updatePossible = true; 1490 updatePossible = true;
1494 //mWeekLabels[mNumWeeks]->setText( i18n("W")); 1491 //mWeekLabels[mNumWeeks]->setText( i18n("W"));
1495 if ( forceUpdate ) 1492 if ( forceUpdate )
1496 updateView(); 1493 updateView();
1497} 1494}
1498 1495
1499void KOMonthView::showContextMenu( Incidence *incidence ) 1496void KOMonthView::showContextMenu( Incidence *incidence )
1500{ 1497{
1501 mContextMenu->showIncidencePopup(incidence); 1498 mContextMenu->showIncidencePopup(incidence);
1502 /* 1499 /*
1503 if( incidence && incidence->type() == "Event" ) { 1500 if( incidence && incidence->type() == "Event" ) {
1504 Event *event = static_cast<Event *>(incidence); 1501 Event *event = static_cast<Event *>(incidence);
1505 mContextMenu->showEventPopup(event); 1502 mContextMenu->showEventPopup(event);
1506 } else { 1503 } else {
1507 kdDebug() << "MonthView::showContextMenu(): cast failed." << endl; 1504 kdDebug() << "MonthView::showContextMenu(): cast failed." << endl;
1508 } 1505 }
1509 */ 1506 */
1510} 1507}
1511MonthViewCell * KOMonthView::selectedCell( ) 1508MonthViewCell * KOMonthView::selectedCell( )
1512{ 1509{
1513 return mSelectedCell; 1510 return mSelectedCell;
1514} 1511}
1515void KOMonthView::setSelectedCell( MonthViewCell *cell ) 1512void KOMonthView::setSelectedCell( MonthViewCell *cell )
1516{ 1513{
1517 // qDebug("KOMonthView::setSelectedCell "); 1514 // qDebug("KOMonthView::setSelectedCell ");
1518 if ( mSelectedCell && mSelectedCell != cell ) { 1515 if ( mSelectedCell && mSelectedCell != cell ) {
1519 MonthViewCell * mvc = mSelectedCell; 1516 MonthViewCell * mvc = mSelectedCell;
1520 mSelectedCell = cell; 1517 mSelectedCell = cell;
1521 mvc->deselect(); 1518 mvc->deselect();
1522 } else 1519 } else
1523 mSelectedCell = cell; 1520 mSelectedCell = cell;
1524 // if ( mSelectedCell ) 1521 // if ( mSelectedCell )
1525 // mSelectedCell->select(); 1522 // mSelectedCell->select();
1526 if ( !mSelectedCell ) 1523 if ( !mSelectedCell )
1527 emit incidenceSelected( 0 ); 1524 emit incidenceSelected( 0 );
1528 else 1525 else
1529 emit incidenceSelected( mSelectedCell->selectedIncidence() ); 1526 emit incidenceSelected( mSelectedCell->selectedIncidence() );
1530} 1527}
1531 1528
1532void KOMonthView::processSelectionChange() 1529void KOMonthView::processSelectionChange()
1533{ 1530{
1534 QPtrList<Incidence> incidences = selectedIncidences(); 1531 QPtrList<Incidence> incidences = selectedIncidences();
1535 if (incidences.count() > 0) { 1532 if (incidences.count() > 0) {
1536 emit incidenceSelected( incidences.first() ); 1533 emit incidenceSelected( incidences.first() );
1537 } else { 1534 } else {
1538 emit incidenceSelected( 0 ); 1535 emit incidenceSelected( 0 );
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h
index 51eb9e6..9dbe319 100644
--- a/korganizer/komonthview.h
+++ b/korganizer/komonthview.h
@@ -181,115 +181,117 @@ class MonthViewCell : public QWidget
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 230
230 MonthViewCell * selectedCell(); 231 MonthViewCell * selectedCell();
231 public slots: 232 public slots:
232 virtual void updateView(); 233 virtual void updateView();
233 virtual void updateConfig(); 234 virtual void updateConfig();
234 virtual void showDates(const QDate &start, const QDate &end); 235 virtual void showDates(const QDate &start, const QDate &end);
235 virtual void showEvents(QPtrList<Event> eventList); 236 virtual void showEvents(QPtrList<Event> eventList);
236 237
237 void changeEventDisplay(Event *, int); 238 void changeEventDisplay(Event *, int);
238 239
239 void clearSelection(); 240 void clearSelection();
240 241
241 void showContextMenu( Incidence * ); 242 void showContextMenu( Incidence * );
242 243
243 void setSelectedCell( MonthViewCell * ); 244 void setSelectedCell( MonthViewCell * );
244 245
245 protected slots: 246 protected slots:
246 void selectInternalWeekNum ( int ); 247 void selectInternalWeekNum ( int );
247 void switchView(); 248 void switchView();
248 void processSelectionChange(); 249 void processSelectionChange();
249 signals: 250 signals:
250 void nextMonth(); 251 void nextMonth();
251 void prevMonth(); 252 void prevMonth();
252 void showNavigator( bool ); 253 void showNavigator( bool );
253 void selectWeekNum ( int ); 254 void selectWeekNum ( int );
254 void showDaySignal( QDate ); 255 void showDaySignal( QDate );
255 protected: 256 protected:
256 void resizeEvent(QResizeEvent *); 257 void resizeEvent(QResizeEvent *);
257 void viewChanged(); 258 void viewChanged();
258 void updateDayLabels(); 259 void updateDayLabels();
259 260
260 private: 261 private:
262 int ignoreResizeEvent;
261 int currentWeek(); 263 int currentWeek();
262 bool clPending; 264 bool clPending;
263 QWidgetStack * mWidStack; 265 QWidgetStack * mWidStack;
264 QWidget* mMonthView; 266 QWidget* mMonthView;
265 QWidget* mWeekView; 267 QWidget* mWeekView;
266 bool mShowWeekView; 268 bool mShowWeekView;
267 bool updatePossible; 269 bool updatePossible;
268 int mDaysPerWeek; 270 int mDaysPerWeek;
269 int mNumWeeks; 271 int mNumWeeks;
270 int mNumCells; 272 int mNumCells;
271 bool mWeekStartsMonday; 273 bool mWeekStartsMonday;
272 bool mShowSatSunComp;
273 void computeLayout(); 274 void computeLayout();
274 void computeLayoutWeek(); 275 void computeLayoutWeek();
275 276
276 QPtrVector<MonthViewCell> mCells; 277 QPtrVector<MonthViewCell> mCells;
277 QPtrVector<QLabel> mDayLabels; 278 QPtrVector<QLabel> mDayLabels;
278 QPtrVector<KOWeekButton> mWeekLabels; 279 QPtrVector<KOWeekButton> mWeekLabels;
279 QPtrVector<MonthViewCell> mCellsW; 280 QPtrVector<MonthViewCell> mCellsW;
280 QPtrVector<QLabel> mDayLabelsW; 281 QPtrVector<QLabel> mDayLabelsW;
281 QPtrVector<KOWeekButton> mWeekLabelsW; 282 QPtrVector<KOWeekButton> mWeekLabelsW;
282 283
283 bool mShortDayLabels; 284 bool mShortDayLabelsM;
285 bool mShortDayLabelsW;
284 int mWidthLongDayLabel; 286 int mWidthLongDayLabel;
285 287
286 QDate mStartDate; 288 QDate mStartDate;
287 289
288 MonthViewCell *mSelectedCell; 290 MonthViewCell *mSelectedCell;
289 291
290 KOEventPopupMenu *mContextMenu; 292 KOEventPopupMenu *mContextMenu;
291 void keyPressEvent ( QKeyEvent * ) ; 293 void keyPressEvent ( QKeyEvent * ) ;
292 294
293}; 295};
294 296
295#endif 297#endif
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index a74c5fe..dcb51dc 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -77,97 +77,97 @@ KOViewManager::~KOViewManager()
77{ 77{
78} 78}
79 79
80 80
81KOrg::BaseView *KOViewManager::currentView() 81KOrg::BaseView *KOViewManager::currentView()
82{ 82{
83 return mCurrentView; 83 return mCurrentView;
84} 84}
85 85
86void KOViewManager::readSettings(KConfig *config) 86void KOViewManager::readSettings(KConfig *config)
87{ 87{
88 config->setGroup("General"); 88 config->setGroup("General");
89 QString view = config->readEntry("Current View"); 89 QString view = config->readEntry("Current View");
90 if (view == "WhatsNext") showWhatsNextView(); 90 if (view == "WhatsNext") showWhatsNextView();
91 else if (view == "Month") showMonthView(); 91 else if (view == "Month") showMonthView();
92 else if (view == "List") showListView(); 92 else if (view == "List") showListView();
93 else if (view == "Journal") showJournalView(); 93 else if (view == "Journal") showJournalView();
94 else if (view == "TimeSpan") showTimeSpanView(); 94 else if (view == "TimeSpan") showTimeSpanView();
95 else if (view == "Todo") showTodoView(); 95 else if (view == "Todo") showTodoView();
96 else { 96 else {
97 showAgendaView(); 97 showAgendaView();
98 } 98 }
99} 99}
100 100
101void KOViewManager::showDateView( int view, QDate date) 101void KOViewManager::showDateView( int view, QDate date)
102{ 102{
103 static int lastMode = 0; 103 static int lastMode = 0;
104 static int lastCount = 0; 104 static int lastCount = 0;
105 static bool lastNDMode = false; 105 static bool lastNDMode = false;
106 static QDate lastDate; 106 static QDate lastDate;
107 //qDebug("date %d %s", view, date.toString().latin1()); 107 //qDebug("date %d %s", view, date.toString().latin1());
108 108
109 //qDebug("%d %d ", lastNDMode, mFlagShowNextxDays ); 109 //qDebug("%d %d ", lastNDMode, mFlagShowNextxDays );
110 bool savemFlagShowNextxDays = mFlagShowNextxDays; 110 bool savemFlagShowNextxDays = mFlagShowNextxDays;
111 mFlagShowNextxDays = false; 111 mFlagShowNextxDays = false;
112 if ( view == 3 ) { 112 if ( view == 3 ) {
113 //mCurrentAgendaView = 1 ; 113 //mCurrentAgendaView = 1 ;
114 lastDate = mMainView->dateNavigator()->selectedDates().first(); 114 lastDate = mMainView->dateNavigator()->selectedDates().first();
115 lastCount = mMainView->dateNavigator()->selectedDates().count(); 115 lastCount = mMainView->dateNavigator()->selectedDates().count();
116 lastNDMode = savemFlagShowNextxDays; 116 lastNDMode = savemFlagShowNextxDays;
117 mMainView->showDay( date ); 117 mMainView->showDay( date );
118 } else if (view == 4 ) { 118 } else if (view == 4 ) {
119 mCurrentAgendaView = 7 ; 119 mCurrentAgendaView = 7 ;
120 mMainView->dateNavigator()->selectDates( date, 7 ); 120 mMainView->dateNavigator()->selectDates( date, 7 );
121 } else if (view == 5 ) { 121 } else if (view == 5 ) {
122 mCurrentAgendaView = 14 ; 122 mCurrentAgendaView = 14 ;
123 mMainView->dateNavigator()->selectDates( date, 14); 123 mMainView->dateNavigator()->selectDates( date, 14);
124 } else if (view == 6 ) { 124 } else if (view == 6 ) {
125 mMainView->dateNavigator()->selectDates( date, 7 ); 125 //mMainView->dateNavigator()->selectDates( date, 7 );
126 showMonthView(); 126 showMonthView();
127 } else if (view == 7 ) { 127 } else if (view == 7 ) {
128 mMainView->dateNavigator()->selectDate( date ); 128 mMainView->dateNavigator()->selectDate( date );
129 showJournalView(); 129 showJournalView();
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) {
@@ -178,96 +178,97 @@ void KOViewManager::writeSettings(KConfig *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 mMainView->navigatorBar()->show(); 227 mMainView->navigatorBar()->show();
227 hei -= mMainView->navigatorBar()->sizeHint().height(); 228 hei -= mMainView->navigatorBar()->sizeHint().height();
228 } 229 }
229 //mMainView->navigatorBar()->hide(); 230 //mMainView->navigatorBar()->hide();
230 } else { 231 } else {
231 mMainView->navigatorBar()->hide(); 232 mMainView->navigatorBar()->hide();
232 } 233 }
233 if ( fullScreen ) { 234 if ( fullScreen ) {
234 mMainView->leftFrame()->hide(); 235 mMainView->leftFrame()->hide();
235 } else { 236 } else {
236 mMainView->leftFrame()->show(); 237 mMainView->leftFrame()->show();
237 if ( KOPrefs::instance()->mVerticalScreen ) 238 if ( KOPrefs::instance()->mVerticalScreen )
238 hei -= mMainView->leftFrame()->height(); 239 hei -= mMainView->leftFrame()->height();
239 else 240 else
240 wid -= mMainView->leftFrame()->width(); 241 wid -= mMainView->leftFrame()->width();
241 } 242 }
242 emit signalFullScreen( !fullScreen ); 243 emit signalFullScreen( !fullScreen );
243 if ( callUpdateView ) 244 if ( callUpdateView )
244 mMainView->updateView(); 245 mMainView->updateView();
245 246
246 if ( globalFlagBlockAgenda == 5 ) { 247 if ( globalFlagBlockAgenda == 5 ) {
247 globalFlagBlockAgenda = 4; 248 globalFlagBlockAgenda = 4;
248 globalFlagBlockAgendaItemPaint = 1; 249 globalFlagBlockAgendaItemPaint = 1;
249 } 250 }
250 mMainView->viewStack()->raiseWidget(mCurrentView); 251 mMainView->viewStack()->raiseWidget(mCurrentView);
251 if ( globalFlagBlockAgenda == 4 ) { 252 if ( globalFlagBlockAgenda == 4 ) {
252 if ( mCurrentView == mAgendaView ) { 253 if ( mCurrentView == mAgendaView ) {
253 //globalFlagBlockAgenda =1 ; 254 //globalFlagBlockAgenda =1 ;
254 if ( KOPrefs::instance()->mSetTimeToDayStartAt ) 255 if ( KOPrefs::instance()->mSetTimeToDayStartAt )
255 mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins ); 256 mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins );
256 else if ( KOPrefs::instance()->mCenterOnCurrentTime ) 257 else if ( KOPrefs::instance()->mCenterOnCurrentTime )
257 mAgendaView->setStartHour( QTime::currentTime ().hour() ); 258 mAgendaView->setStartHour( QTime::currentTime ().hour() );
258 qApp->processEvents(); 259 qApp->processEvents();
259 //qDebug("qApp->processEvents() "); 260 //qDebug("qApp->processEvents() ");
260 globalFlagBlockAgenda = 0; 261 globalFlagBlockAgenda = 0;
261 mAgendaView->repaintAgenda(); 262 mAgendaView->repaintAgenda();
262 263
263 } 264 }
264 globalFlagBlockAgenda = 0; 265 globalFlagBlockAgenda = 0;
265 } 266 }
266 emit signalAgendaView( mCurrentView == mAgendaView ); 267 emit signalAgendaView( mCurrentView == mAgendaView );
267 //qDebug("raiseCurrentView ende "); 268 //qDebug("raiseCurrentView ende ");
268 269
269} 270}
270 271
271void KOViewManager::updateView() 272void KOViewManager::updateView()
272{ 273{
273 // qDebug("KOViewManager::updateView() "); 274 // qDebug("KOViewManager::updateView() ");
@@ -446,97 +447,97 @@ void KOViewManager::showWorkWeekView()
446 globalFlagBlockLabel = 0; 447 globalFlagBlockLabel = 0;
447 mMainView->dateNavigator()->selectWorkWeek(); 448 mMainView->dateNavigator()->selectWorkWeek();
448 mCurrentAgendaView = 5 ; 449 mCurrentAgendaView = 5 ;
449 450
450} 451}
451 452
452void KOViewManager::showWeekView() 453void KOViewManager::showWeekView()
453{ 454{
454 /* 455 /*
455 globalFlagBlockAgenda = 2; 456 globalFlagBlockAgenda = 2;
456 qDebug("4globalFlagBlockAgenda = 2; "); 457 qDebug("4globalFlagBlockAgenda = 2; ");
457 //globalFlagBlockPainting = true; 458 //globalFlagBlockPainting = true;
458 mMainView->dateNavigator()->selectWeek(); 459 mMainView->dateNavigator()->selectWeek();
459 showAgendaView(); 460 showAgendaView();
460 */ 461 */
461 462
462 463
463 mFlagShowNextxDays = false; 464 mFlagShowNextxDays = false;
464 globalFlagBlockAgenda = 1; 465 globalFlagBlockAgenda = 1;
465 globalFlagBlockLabel = 1; 466 globalFlagBlockLabel = 1;
466 if ( mCurrentAgendaView != 7 ) 467 if ( mCurrentAgendaView != 7 )
467 mCurrentAgendaView = -1; 468 mCurrentAgendaView = -1;
468 showAgendaView(); 469 showAgendaView();
469 qApp->processEvents(); 470 qApp->processEvents();
470 globalFlagBlockAgenda = 2; 471 globalFlagBlockAgenda = 2;
471 globalFlagBlockLabel = 0; 472 globalFlagBlockLabel = 0;
472 mMainView->dateNavigator()->selectWeek(); 473 mMainView->dateNavigator()->selectWeek();
473 mCurrentAgendaView = 7 ; 474 mCurrentAgendaView = 7 ;
474} 475}
475 476
476void KOViewManager::showNextXView() 477void KOViewManager::showNextXView()
477{ 478{
478 479
479 globalFlagBlockAgenda = 1; 480 globalFlagBlockAgenda = 1;
480 if ( mCurrentAgendaView != 3 ) 481 if ( mCurrentAgendaView != 3 )
481 mCurrentAgendaView = -1; 482 mCurrentAgendaView = -1;
482 showAgendaView(KOPrefs::instance()->mFullViewMonth); 483 showAgendaView(KOPrefs::instance()->mFullViewMonth);
483 globalFlagBlockAgenda = 2; 484 globalFlagBlockAgenda = 2;
484 mMainView->dateNavigator()->selectDates( QDate::currentDate(), 485 mMainView->dateNavigator()->selectDates( QDate::currentDate(),
485 KOPrefs::instance()->mNextXDays ); 486 KOPrefs::instance()->mNextXDays );
486 mFlagShowNextxDays = true; 487 mFlagShowNextxDays = true;
487 mCurrentAgendaView = 3 ; 488 mCurrentAgendaView = 3 ;
488} 489}
489bool KOViewManager::showsNextDays() 490bool KOViewManager::showsNextDays()
490{ 491{
491 return mFlagShowNextxDays; 492 return mFlagShowNextxDays;
492} 493}
493void KOViewManager::showMonthView() 494void KOViewManager::showMonthView()
494{ 495 {
495 if (!mMonthView) { 496 if (!mMonthView) {
496 mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView"); 497 mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView");
497 498
498 addView(mMonthView); 499 addView(mMonthView);
499 // mMonthView->show(); 500 // mMonthView->show();
500 // SIGNALS/SLOTS FOR MONTH VIEW 501 // SIGNALS/SLOTS FOR MONTH VIEW
501 connect(mMonthView, SIGNAL(newEventSignal(QDateTime)), 502 connect(mMonthView, SIGNAL(newEventSignal(QDateTime)),
502 mMainView, SLOT(newEvent(QDateTime))); 503 mMainView, SLOT(newEvent(QDateTime)));
503 504
504 connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)), 505 connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)),
505 mMainView, SLOT(showIncidence(Incidence *))); 506 mMainView, SLOT(showIncidence(Incidence *)));
506 connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)), 507 connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)),
507 mMainView, SLOT(editIncidence(Incidence *))); 508 mMainView, SLOT(editIncidence(Incidence *)));
508 connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)), 509 connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)),
509 mMainView, SLOT(deleteIncidence(Incidence *))); 510 mMainView, SLOT(deleteIncidence(Incidence *)));
510 511
511 connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ), 512 connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ),
512 mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 513 mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
513 connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), 514 connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ),
514 mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); 515 mMainView, SLOT ( cloneIncidence( Incidence * ) ) );
515 connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), 516 connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ),
516 mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); 517 mMainView, SLOT ( cancelIncidence( Incidence * ) ) );
517 518
518 connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ), 519 connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ),
519 mMainView, SLOT ( moveIncidence( Incidence * ) ) ); 520 mMainView, SLOT ( moveIncidence( Incidence * ) ) );
520 connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ), 521 connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ),
521 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 522 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
522 connect( mMonthView, SIGNAL( selectWeekNum( int ) ), 523 connect( mMonthView, SIGNAL( selectWeekNum( int ) ),
523 mMainView->dateNavigator(), SLOT ( selectWeek( int ) ) ); 524 mMainView->dateNavigator(), SLOT ( selectWeek( int ) ) );
524 connect( mMonthView, SIGNAL( showDaySignal( QDate ) ), 525 connect( mMonthView, SIGNAL( showDaySignal( QDate ) ),
525 mMainView, SLOT ( showDay( QDate ) ) ); 526 mMainView, SLOT ( showDay( QDate ) ) );
526 connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig())); 527 connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig()));
527 connect( mMonthView, SIGNAL(nextMonth() ), 528 connect( mMonthView, SIGNAL(nextMonth() ),
528 mMainView->navigatorBar(), SIGNAL(goNextMonth() ) ); 529 mMainView->navigatorBar(), SIGNAL(goNextMonth() ) );
529 connect( mMonthView, SIGNAL(prevMonth() ), 530 connect( mMonthView, SIGNAL(prevMonth() ),
530 mMainView->navigatorBar(), SIGNAL(goPrevMonth() ) ); 531 mMainView->navigatorBar(), SIGNAL(goPrevMonth() ) );
531 connect( mMonthView, SIGNAL( showNavigator(bool) ), 532 connect( mMonthView, SIGNAL( showNavigator(bool) ),
532 mMainView, SLOT ( showNavigatorBar(bool) ) ); 533 mMainView, SLOT ( showNavigatorBar(bool) ) );
533 } 534 }
534 535
535 globalFlagBlockAgenda = 1; 536 globalFlagBlockAgenda = 1;
536 //mFlagShowNextxDays = false; 537 //mFlagShowNextxDays = false;
537 // if(mMonthView == mCurrentView) return; 538 // if(mMonthView == mCurrentView) return;
538 if ( KOPrefs::instance()->mMonthViewWeek ) 539 if ( KOPrefs::instance()->mMonthViewWeek )
539 mMainView->dateNavigator()->selectWeek(); 540 mMainView->dateNavigator()->selectWeek();
540 else 541 else
541 mMainView->dateNavigator()->selectMonth(); 542 mMainView->dateNavigator()->selectMonth();
542 543