summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/korganizer/germantranslation.txt5
-rw-r--r--korganizer/journalentry.cpp53
-rw-r--r--korganizer/journalentry.h4
-rw-r--r--korganizer/kodaymatrix.cpp27
-rw-r--r--korganizer/koeventviewer.cpp3
-rw-r--r--korganizer/kojournalview.cpp22
-rw-r--r--korganizer/kojournalview.h2
-rw-r--r--korganizer/kolistview.cpp14
-rw-r--r--korganizer/searchdialog.cpp37
9 files changed, 113 insertions, 54 deletions
diff --git a/bin/kdepim/korganizer/germantranslation.txt b/bin/kdepim/korganizer/germantranslation.txt
index 4df2005..510f4bf 100644
--- a/bin/kdepim/korganizer/germantranslation.txt
+++ b/bin/kdepim/korganizer/germantranslation.txt
@@ -1369,99 +1369,104 @@
1369{ "Comment for todo:","Kommentar zum Todo:" }, 1369{ "Comment for todo:","Kommentar zum Todo:" },
1370{ "Stop+note","Stop+Notiz" }, 1370{ "Stop+note","Stop+Notiz" },
1371{ "Agenda view shows completed todos","Agenda Ansicht zeigt erledigte Todos" }, 1371{ "Agenda view shows completed todos","Agenda Ansicht zeigt erledigte Todos" },
1372{ "KO/Pi: Missing alarms!","KO/Pi: Verpasste Alarme!" }, 1372{ "KO/Pi: Missing alarms!","KO/Pi: Verpasste Alarme!" },
1373{ "You missed the alarms for the following events or todos:","Sie verpassten die Alarme für folgende Termine oder Todos:" }, 1373{ "You missed the alarms for the following events or todos:","Sie verpassten die Alarme für folgende Termine oder Todos:" },
1374{ "Print complete list","Drucke komplette Liste" }, 1374{ "Print complete list","Drucke komplette Liste" },
1375{ "Hide all selected","Verstecke Selektierte" }, 1375{ "Hide all selected","Verstecke Selektierte" },
1376{ "Add items","hinzufügen" }, 1376{ "Add items","hinzufügen" },
1377{ "One (or more) selected\ntodo has subtodos!\nDo you want to select\nall subtodos of all\nselected todos as well?","Ein (oder mehrere) ausgewähltes\nTodo hat Untertodos!\nMöchten Sie der Auswahlliste\nalle Untertodos von allen\nausgewählten Todos hinzufügen?" }, 1377{ "One (or more) selected\ntodo has subtodos!\nDo you want to select\nall subtodos of all\nselected todos as well?","Ein (oder mehrere) ausgewähltes\nTodo hat Untertodos!\nMöchten Sie der Auswahlliste\nalle Untertodos von allen\nausgewählten Todos hinzufügen?" },
1378{ "Print List View...","Drucke Listenansicht..." }, 1378{ "Print List View...","Drucke Listenansicht..." },
1379{ "You can make a printout of the <b>List View</b> and the list view in the <b>Search Dialog</b>! To do this, please go to the <b>List View/Search Dialog</b>. Right click on the list. Select in the popup menu the entry <b>Print complete list</b>. That prints the list as you see it. You can remove items from the list before printing without deleting the corresponding event/todo! Simply select all items you do not want to print out. Then right click on one of the items and choose <b>Hide selected items</b>. After that you can print the list without these items.","Sie können die <b>Listenansicht</b> und die Listenansicht im <b>Suchdialog</b> ausdrucken! Um das zu machen gehen Sie bitte zur <b>Listenansicht</b> oder zum <b>Suchdialog</b>. Rechtsklicken Sie auf die Liste. Wählen Sie im Popupmenu den Eintrag <b>Drucke komplette Liste</b>. Das druckt die Liste so, wie man sie sieht. Sie können Listeneinträge entfernen ohne die korrespondierenden Ereignisse/Todos zu löschen! Selektieren sie einfach alle Einträge, die sie nicht ausdrucken möchten. Dann Rechtsklicken Sie auf einen Eintrag und wählen <b>Verstecke Selektierte</b>. Danach können Sie die Liste ohne diese Einträge ausdrucken." }, 1379{ "You can make a printout of the <b>List View</b> and the list view in the <b>Search Dialog</b>! To do this, please go to the <b>List View/Search Dialog</b>. Right click on the list. Select in the popup menu the entry <b>Print complete list</b>. That prints the list as you see it. You can remove items from the list before printing without deleting the corresponding event/todo! Simply select all items you do not want to print out. Then right click on one of the items and choose <b>Hide selected items</b>. After that you can print the list without these items.","Sie können die <b>Listenansicht</b> und die Listenansicht im <b>Suchdialog</b> ausdrucken! Um das zu machen gehen Sie bitte zur <b>Listenansicht</b> oder zum <b>Suchdialog</b>. Rechtsklicken Sie auf die Liste. Wählen Sie im Popupmenu den Eintrag <b>Drucke komplette Liste</b>. Das druckt die Liste so, wie man sie sieht. Sie können Listeneinträge entfernen ohne die korrespondierenden Ereignisse/Todos zu löschen! Selektieren sie einfach alle Einträge, die sie nicht ausdrucken möchten. Dann Rechtsklicken Sie auf einen Eintrag und wählen <b>Verstecke Selektierte</b>. Danach können Sie die Liste ohne diese Einträge ausdrucken." },
1380{ "Configure KO/Pi...","Konfiguriere KO/Pi..." }, 1380{ "Configure KO/Pi...","Konfiguriere KO/Pi..." },
1381{ "Global Settings...","Globale Einstellungen..." }, 1381{ "Global Settings...","Globale Einstellungen..." },
1382{ "<p><b>R</b>: Toggle Resource View |<b>F</b>: Edit filter </p>\n","<p><b>R</b>: Zeige Resource Ansicht | <b>F</b>: Editiere Filter </p>\n" }, 1382{ "<p><b>R</b>: Toggle Resource View |<b>F</b>: Edit filter </p>\n","<p><b>R</b>: Zeige Resource Ansicht | <b>F</b>: Editiere Filter </p>\n" },
1383{ "(disabled)","(abgeschaltet)" }, 1383{ "(disabled)","(abgeschaltet)" },
1384{ "New Calendar","Neuer Kalender" }, 1384{ "New Calendar","Neuer Kalender" },
1385{ "Calendar","Kalender" }, 1385{ "Calendar","Kalender" },
1386{ "Filter selector","Filterauswahl" }, 1386{ "Filter selector","Filterauswahl" },
1387{ "Filtermenu","Filtermenu" }, 1387{ "Filtermenu","Filtermenu" },
1388{ "Toggle Fullscreen","Vollbild umschalten" }, 1388{ "Toggle Fullscreen","Vollbild umschalten" },
1389{ "Toggle Resource View","Resourcenansicht umschalten" }, 1389{ "Toggle Resource View","Resourcenansicht umschalten" },
1390{ "Storage HowTo...","Speicherort HowTo..." }, 1390{ "Storage HowTo...","Speicherort HowTo..." },
1391{ "Timetracking HowTo...","Timetracking HowTo..." }, 1391{ "Timetracking HowTo...","Timetracking HowTo..." },
1392{ "Juni","Juni" }, 1392{ "Juni","Juni" },
1393{ "Juli","Juli" }, 1393{ "Juli","Juli" },
1394{ "ToDo:","ToDo:" }, 1394{ "ToDo:","ToDo:" },
1395{ "Set Calendar","Setze Kalender" }, 1395{ "Set Calendar","Setze Kalender" },
1396{ "Todo: %1","Todo: %1" }, 1396{ "Todo: %1","Todo: %1" },
1397{ ": (Prio ",": (Prio " }, 1397{ ": (Prio ",": (Prio " },
1398{ "Todos","Todos" }, 1398{ "Todos","Todos" },
1399{ "Todo Viewer","Todo Viewer" }, 1399{ "Todo Viewer","Todo Viewer" },
1400{ "Todo ","Todo " }, 1400{ "Todo ","Todo " },
1401{ " Calendar \n Resource "," Kalender \n Resource " }, 1401{ " Calendar \n Resource "," Kalender \n Resource " },
1402{ " Color "," Farbe " }, 1402{ " Color "," Farbe " },
1403{ "The calendar <b>%1</b> is displaying file <b>%2</b>. Do you want to remove this calendar from KO/Pi? (The file is not removed!)","Der Kalender <b>%1</b> zeigt die Datei <b>%2</b>. Möchten Sie diesen Kalender aus KO/Pi entfernen? (Die Datei wird dabei nicht gelöscht!)" }, 1403{ "The calendar <b>%1</b> is displaying file <b>%2</b>. Do you want to remove this calendar from KO/Pi? (The file is not removed!)","Der Kalender <b>%1</b> zeigt die Datei <b>%2</b>. Möchten Sie diesen Kalender aus KO/Pi entfernen? (Die Datei wird dabei nicht gelöscht!)" },
1404{ "The calendar <b>%1</b> is displaying file <b>%2</b>","Der Kalender <b>%1</b> zeigt die Datei <b>%2</b>" }, 1404{ "The calendar <b>%1</b> is displaying file <b>%2</b>","Der Kalender <b>%1</b> zeigt die Datei <b>%2</b>" },
1405{ "Add new Calendar","Füge Kalender hinzu" }, 1405{ "Add new Calendar","Füge Kalender hinzu" },
1406{ "<b>Name of new calendar:</b>","<b>Name des Kalenders:</b>" }, 1406{ "<b>Name of new calendar:</b>","<b>Name des Kalenders:</b>" },
1407{ "<b>Local ical (*.ics) file:</b>","<b>Lokale ical (*.ics) Datei:</b>" }, 1407{ "<b>Local ical (*.ics) file:</b>","<b>Lokale ical (*.ics) Datei:</b>" },
1408{ "Sorry, the calendar name is empty!","Sorry, der Kalendername ist leer!" }, 1408{ "Sorry, the calendar name is empty!","Sorry, der Kalendername ist leer!" },
1409{ "Sorry, the file name is empty!","Sorry, der Dateiname ist leer!" }, 1409{ "Sorry, the file name is empty!","Sorry, der Dateiname ist leer!" },
1410{ "Error loading calendar file\n%1.","Fehler beim Laden der Kalenderdatei\n%1." }, 1410{ "Error loading calendar file\n%1.","Fehler beim Laden der Kalenderdatei\n%1." },
1411{ "The calendar <b>%1</b> is not loaded! Loading of file <b>%2</b> failed! <b>Try again to load the calendar?</b>","Der Kalender <b>%1</b> ist nicht geladen! Das Laden der Datei <b>%2</b> schlug fehl! <b>Soll erneut versucht werden den Kalender zu laden?</b>" }, 1411{ "The calendar <b>%1</b> is not loaded! Loading of file <b>%2</b> failed! <b>Try again to load the calendar?</b>","Der Kalender <b>%1</b> ist nicht geladen! Das Laden der Datei <b>%2</b> schlug fehl! <b>Soll erneut versucht werden den Kalender zu laden?</b>" },
1412{ "Global application font for all apps:","Globale Schriftart:" }, 1412{ "Global application font for all apps:","Globale Schriftart:" },
1413{ "Application Font","Applikationsschriftart" }, 1413{ "Application Font","Applikationsschriftart" },
1414{ "Kx/Pi","Kx/Pi" }, 1414{ "Kx/Pi","Kx/Pi" },
1415{ "Backup","Backup" }, 1415{ "Backup","Backup" },
1416{ "KDE-Pim Global Settings","KDE-Pim Globale Einstellungen" }, 1416{ "KDE-Pim Global Settings","KDE-Pim Globale Einstellungen" },
1417{ "Sorry, the calendar name \n%1\nalready exists!\nPlease choose another name!","Sorry, der Kalendername \n%1\nist schon in Benutzung!\nBitte wählen Sie einen anderen!" }, 1417{ "Sorry, the calendar name \n%1\nalready exists!\nPlease choose another name!","Sorry, der Kalendername \n%1\nist schon in Benutzung!\nBitte wählen Sie einen anderen!" },
1418{ "Sorry, the file \n%1\nis already loaded!\nPlease choose another file!","Sorry, die Datei \n%1\nist schon geladen!\nBitte wählen Sie eine andere!" }, 1418{ "Sorry, the file \n%1\nis already loaded!\nPlease choose another file!","Sorry, die Datei \n%1\nist schon geladen!\nBitte wählen Sie eine andere!" },
1419{ "Choose Color","Wähle Farbe" }, 1419{ "Choose Color","Wähle Farbe" },
1420{ " OK "," OK " }, 1420{ " OK "," OK " },
1421{ " Cancel "," Abbrechen " }, 1421{ " Cancel "," Abbrechen " },
1422{ "Matching items will be added to list","Passende werden zur Liste hinzugefügt" }, 1422{ "Matching items will be added to list","Passende werden zur Liste hinzugefügt" },
1423{ "Matching items will be removed from list","Passende werden von der Liste entfernt" }, 1423{ "Matching items will be removed from list","Passende werden von der Liste entfernt" },
1424{ "Search on displayed list only","Suche auf der dargestellten Liste" }, 1424{ "Search on displayed list only","Suche auf der dargestellten Liste" },
1425{ "List will be cleared before search","Liste wird vor der Suche gelöscht" }, 1425{ "List will be cleared before search","Liste wird vor der Suche gelöscht" },
1426{ "<center>%1</center> <center>is not running. Do you want to set\nthe state to running?</center>","<center>%1</center> <center>ist nicht am Laufen. Möchten Sie den Zustand auf "laufend" setzen?</center>" }, 1426{ "<center>%1</center> <center>is not running. Do you want to set\nthe state to running?</center>","<center>%1</center> <center>ist nicht am Laufen. Möchten Sie den Zustand auf "laufend" setzen?</center>" },
1427{ "%1\nis running!","%1\nist am Laufen!" }, 1427{ "%1\nis running!","%1\nist am Laufen!" },
1428{ "Additional Comment:","Zusätzlicher Kommentar:" }, 1428{ "Additional Comment:","Zusätzlicher Kommentar:" },
1429{ "Stop and save","Stopp und Speichern" }, 1429{ "Stop and save","Stopp und Speichern" },
1430{ "Continue running","Weiter laufen lassen" }, 1430{ "Continue running","Weiter laufen lassen" },
1431{ "Stop - do not save","Stopp - nicht Speichern" }, 1431{ "Stop - do not save","Stopp - nicht Speichern" },
1432{ "Do you really want to set\nthe state to stopped\nwithout saving the data?","Möchten sie den Zustand\nwirklich auf gestoppt setzen\nohne die Daten abzuspeichern?" }, 1432{ "Do you really want to set\nthe state to stopped\nwithout saving the data?","Möchten sie den Zustand\nwirklich auf gestoppt setzen\nohne die Daten abzuspeichern?" },
1433{ "Time mismatch!","Zeiten stimmen nicht!" }, 1433{ "Time mismatch!","Zeiten stimmen nicht!" },
1434{ "The start time is\nafter the end time!","Die Startzeit ist\nhinter der Endzeit!" }, 1434{ "The start time is\nafter the end time!","Die Startzeit ist\nhinter der Endzeit!" },
1435{ "Yes, stop todo","Ja, stoppe Todo" }, 1435{ "Yes, stop todo","Ja, stoppe Todo" },
1436{ "Todo stopped - no data saved because runtime was < 15 sec!","Todo gestoppt - nichts gespeichert da Laufzeit < 15 sec!" }, 1436{ "Todo stopped - no data saved because runtime was < 15 sec!","Todo gestoppt - nichts gespeichert da Laufzeit < 15 sec!" },
1437{ "Todo started! Double click again to stop!","Todo gestartet! Doppelklicke um es zu stoppen!" }, 1437{ "Todo started! Double click again to stop!","Todo gestartet! Doppelklicke um es zu stoppen!" },
1438{ "Please choose the <b>default calendar</b> in this column. Newly created or imported items are added to the default calendar.","Bitte wählen Sie den <b>Default-Kalender</b> in dieser Spalte. Neu angelegte oder importierte Einträge werden dem Default-Kalender hinzugefügt." }, 1438{ "Please choose the <b>default calendar</b> in this column. Newly created or imported items are added to the default calendar.","Bitte wählen Sie den <b>Default-Kalender</b> in dieser Spalte. Neu angelegte oder importierte Einträge werden dem Default-Kalender hinzugefügt." },
1439{ "Spouse","Ehegatte" }, 1439{ "Spouse","Ehegatte" },
1440{ "Notes","Notizen" }, 1440{ "Notes","Notizen" },
1441{ "Messanger","Messanger" }, 1441{ "Messanger","Messanger" },
1442{ "Assistant","Assistent" }, 1442{ "Assistant","Assistent" },
1443{ "Manager","Manager" }, 1443{ "Manager","Manager" },
1444{ "Secrecy","Sichtbar" }, 1444{ "Secrecy","Sichtbar" },
1445{ "male","männlich" }, 1445{ "male","männlich" },
1446{ "female","weiblich" }, 1446{ "female","weiblich" },
1447{ "Hide!","Verbergen!" }, 1447{ "Hide!","Verbergen!" },
1448{ "Show!","Anzeigen!" }, 1448{ "Show!","Anzeigen!" },
1449{ "Details","Details" }, 1449{ "Details","Details" },
1450{ "Profession","Beruf" }, 1450{ "Profession","Beruf" },
1451{ "Children","Kinder" }, 1451{ "Children","Kinder" },
1452{ "Department","Abteilung" }, 1452{ "Department","Abteilung" },
1453{ "Backup cancelled","Backup abgebrochen" }, 1453{ "Backup cancelled","Backup abgebrochen" },
1454{ "Backup globally disabled","Backup global abgeschaltet" }, 1454{ "Backup globally disabled","Backup global abgeschaltet" },
1455{ "Backup succesfully finished","Backup erfolgreich beendet" }, 1455{ "Backup succesfully finished","Backup erfolgreich beendet" },
1456{ "(Hint: You can enable automatic backup in the global settings!)","(Hinweis: Sie können ein automatisches Backup in den globalen Einstellungen konfigurieren!)" }, 1456{ "(Hint: You can enable automatic backup in the global settings!)","(Hinweis: Sie können ein automatisches Backup in den globalen Einstellungen konfigurieren!)" },
1457{ "This will <b>backup all calendar files</b> to the directory %1 %2","Das schreibt ein <b>Backup aller Kalenderdateien</b> in das Verzeichnis %1 %2" }, 1457{ "This will <b>backup all calendar files</b> to the directory %1 %2","Das schreibt ein <b>Backup aller Kalenderdateien</b> in das Verzeichnis %1 %2" },
1458{ "Birthdays","Geburtstage" }, 1458{ "Birthdays","Geburtstage" },
1459{ "KO/Pi import information!","KO/Pi Import Information!" }, 1459{ "KO/Pi import information!","KO/Pi Import Information!" },
1460{ "Start this todo\nand stop all running","Starte dieses Todo\nund stoppe alle Laufenden" }, 1460{ "Start this todo\nand stop all running","Starte dieses Todo\nund stoppe alle Laufenden" },
1461{ "Cancel - do not start"," Abbrechen - Todo nicht starten" }, 1461{ "Cancel - do not start"," Abbrechen - Todo nicht starten" },
1462{ "The timezone has changed!\nShould the calendar be reloaded\nto shift the time of the events?\nPlease read Menu: Help->FAQ:\n"How do I change the timezone?"\nas well!","Die Zeitzone wurde geändert!\nSollen die Kalender neu geladen\nwerden num die Zeiten\nder Termine zu ändern?\nBitte lesen Sie auch\nMenu: Help->FAQ:\n"How do I change the timezone?"" }, 1462{ "The timezone has changed!\nShould the calendar be reloaded\nto shift the time of the events?\nPlease read Menu: Help->FAQ:\n"How do I change the timezone?"\nas well!","Die Zeitzone wurde geändert!\nSollen die Kalender neu geladen\nwerden num die Zeiten\nder Termine zu ändern?\nBitte lesen Sie auch\nMenu: Help->FAQ:\n"How do I change the timezone?"" },
1463{ "Reload","Neu laden" }, 1463{ "Reload","Neu laden" },
1464{ "Timezone settings","Zeitzoneneinstellung" }, 1464{ "Timezone settings","Zeitzoneneinstellung" },
1465{ " Title: "," Titel: " },
1466{ "","" },
1467{ "","" },
1468{ "","" },
1469{ "","" },
1465{ "","" }, 1470{ "","" },
1466{ "","" }, 1471{ "","" },
1467{ "","" }, \ No newline at end of file 1472{ "","" }, \ No newline at end of file
diff --git a/korganizer/journalentry.cpp b/korganizer/journalentry.cpp
index 0b923ad..05bfd31 100644
--- a/korganizer/journalentry.cpp
+++ b/korganizer/journalentry.cpp
@@ -1,292 +1,281 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24// 24//
25// Journal Entry 25// Journal Entry
26 26
27#include <qlabel.h> 27#include <qlabel.h>
28#include <qlayout.h> 28#include <qlayout.h>
29#include <qvbox.h> 29#include <qvbox.h>
30#include <qfile.h> 30#include <qfile.h>
31#include <qdir.h> 31#include <qdir.h>
32#include <qtextstream.h> 32#include <qtextstream.h>
33#include <qtextcodec.h> 33#include <qtextcodec.h>
34#include <qpixmap.h> 34#include <qpixmap.h>
35#include <qpushbutton.h> 35#include <qpushbutton.h>
36#include <qapplication.h> 36#include <qapplication.h>
37 37
38#include <kdebug.h> 38#include <kdebug.h>
39#include <kglobal.h> 39#include <kglobal.h>
40#include <klocale.h> 40#include <klocale.h>
41#include <ktextedit.h> 41#include <ktextedit.h>
42#include <kfiledialog.h> 42#include <kfiledialog.h>
43#include <kmessagebox.h> 43#include <kmessagebox.h>
44#include "koprefs.h" 44#include "koprefs.h"
45#include <klineedit.h>
45 46
46#include <libkcal/journal.h> 47#include <libkcal/journal.h>
47#include <libkcal/calendarresources.h> 48#include <libkcal/calendarresources.h>
48#include <libkcal/resourcecalendar.h> 49#include <libkcal/resourcecalendar.h>
49#include <kresources/resourceselectdialog.h> 50#include <kresources/resourceselectdialog.h>
50 51
51#include "journalentry.h" 52#include "journalentry.h"
52//#include "journalentry.moc" 53//#include "journalentry.moc"
53#ifndef DESKTOP_VERSION 54#ifndef DESKTOP_VERSION
54#include <qpe/qpeapplication.h> 55#include <qpe/qpeapplication.h>
55#endif 56#endif
56JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) : 57JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) :
57 QFrame(parent) 58 QFrame(parent)
58{ 59{
59 heiHint = QApplication::desktop()->height() / 5 ; 60 heiHint = QApplication::desktop()->height() / 5 ;
60 showOnlyMode = false; 61 showOnlyMode = false;
61 mCalendar = calendar; 62 mCalendar = calendar;
62 mJournal = 0; 63 mJournal = 0;
63 mDirty = false; 64 mDirty = false;
64 65
65 QHBox * vb = new QHBox ( this ); 66 QHBox * vb = new QHBox ( this );
66 QPushButton * newJournal = new QPushButton( vb );
67 QIconSet icon; 67 QIconSet icon;
68 if ( QApplication::desktop()->width() < 321 )
69 icon = SmallIcon("ko16old");
70 else
71 icon = SmallIcon("ko24old");
72 newJournal->setIconSet (icon ) ;
73 int size = newJournal->sizeHint().height();
74 newJournal->setFixedSize( size, size );
75
76 68
77 QPushButton * toggleJournal = new QPushButton( vb ); 69 QPushButton * toggleJournal = new QPushButton( vb );
78 icon = SmallIcon("1updownarrow"); 70 icon = SmallIcon("1updownarrow");
79 toggleJournal->setIconSet (icon ) ; 71 toggleJournal->setIconSet (icon ) ;
80 //int size = toggleJournal->sizeHint().height(); 72 int size = toggleJournal->sizeHint().height();
81 toggleJournal->setFixedSize( size * 2 /3 , size ); 73 toggleJournal->setFixedSize( size * 2 /3 , size );
82 74 new QLabel(i18n(" Title: "),vb);
83 75 mTitle = new KLineEdit ( vb );
84
85 mTitleLabel = new QLabel(i18n("Title"),vb); 76 mTitleLabel = new QLabel(i18n("Title"),vb);
86 mTitleLabel->setMargin(2); 77 mTitleLabel->setMargin(0);
87 mTitleLabel->setAlignment(AlignCenter); 78 mTitleLabel->setAlignment(AlignCenter);
88 QPushButton * loadTemplate = new QPushButton( vb ); 79 QPushButton * loadTemplate = new QPushButton( vb );
89 QPushButton * saveTemplate = new QPushButton( vb ); 80 QPushButton * saveTemplate = new QPushButton( vb );
90 if ( QApplication::desktop()->width() < 321 ) 81 if ( QApplication::desktop()->width() < 321 )
91 icon = SmallIcon("fileexport16"); 82 icon = SmallIcon("fileexport16");
92 else 83 else
93 icon = SmallIcon("fileexport"); 84 icon = SmallIcon("fileexport");
94 saveTemplate->setIconSet (icon ) ; 85 saveTemplate->setIconSet (icon ) ;
95 //size = saveTemplate->sizeHint().height(); 86 //size = saveTemplate->sizeHint().height();
96 saveTemplate->setFixedSize( size, size ); 87 saveTemplate->setFixedSize( size, size );
97 if ( QApplication::desktop()->width() < 321 ) 88 if ( QApplication::desktop()->width() < 321 )
98 icon = SmallIcon("fileimport16"); 89 icon = SmallIcon("fileimport16");
99 else 90 else
100 icon = SmallIcon("fileimport"); 91 icon = SmallIcon("fileimport");
101 loadTemplate->setIconSet (icon ) ; 92 loadTemplate->setIconSet (icon ) ;
102 loadTemplate->setFixedSize( size, size ); 93 loadTemplate->setFixedSize( size, size );
103 mEditor = new KTextEdit(this); 94 mEditor = new KTextEdit(this);
104 connect(mEditor,SIGNAL(textChanged()),SLOT(setDirty())); 95 connect(mEditor,SIGNAL(textChanged()),SLOT(setDirty()));
105#ifndef DESKTOP_VERSION 96#ifndef DESKTOP_VERSION
106 QPEApplication::setStylusOperation( mEditor, QPEApplication::RightOnHold ); 97 QPEApplication::setStylusOperation( mEditor, QPEApplication::RightOnHold );
107#endif 98#endif
108 mEditor->setWordWrap( KTextEdit::WidgetWidth ); 99 mEditor->setWordWrap( KTextEdit::WidgetWidth );
109 QBoxLayout *topLayout = new QVBoxLayout(this); 100 QBoxLayout *topLayout = new QVBoxLayout(this);
110 topLayout->addWidget(vb); 101 topLayout->addWidget(vb);
111 topLayout->addWidget(mEditor); 102 topLayout->addWidget(mEditor);
112 mEditor->installEventFilter(this); 103 mEditor->installEventFilter(this);
113 connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) ); 104 connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) );
105 connect( mTitle, SIGNAL( textChanged ( const QString & ) ), this , SLOT( setDirty() ) );
114 connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) ); 106 connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) );
115 connect( newJournal, SIGNAL( clicked() ), this , SIGNAL( newJournal() ) );
116 connect( toggleJournal, SIGNAL( clicked() ), this , SLOT( toggleShowJournal() ) ); 107 connect( toggleJournal, SIGNAL( clicked() ), this , SLOT( toggleShowJournal() ) );
117} 108}
118 109
119JournalEntry::~JournalEntry() 110JournalEntry::~JournalEntry()
120{ 111{
121 qDebug("JournalEntry::~JournalEntry() "); 112 //qDebug("JournalEntry::~JournalEntry() ");
122} 113}
123QSize JournalEntry::sizeHint() const 114QSize JournalEntry::sizeHint() const
124{ 115{
125 return QSize ( 240, heiHint ); 116 return QSize ( 240, heiHint );
126} 117}
127void JournalEntry::slotSaveTemplate() 118void JournalEntry::slotSaveTemplate()
128{ 119{
129 QString fileName =locateLocal( "templates", "journals" ); 120 QString fileName =locateLocal( "templates", "journals" );
130 QDir t_dir; 121 QDir t_dir;
131 if ( !t_dir.exists(fileName) ) 122 if ( !t_dir.exists(fileName) )
132 t_dir.mkdir ( fileName ); 123 t_dir.mkdir ( fileName );
133 fileName += "/journal"; 124 fileName += "/journal";
134 fileName = KFileDialog::getSaveFileName( fileName , i18n("Save as Journal template"), this ); 125 fileName = KFileDialog::getSaveFileName( fileName , i18n("Save as Journal template"), this );
135 if ( fileName.length() == 0 ) 126 if ( fileName.length() == 0 )
136 return; 127 return;
137 128
138 QFile fileIn( fileName ); 129 QFile fileIn( fileName );
139 if (!fileIn.open( IO_WriteOnly ) ) { 130 if (!fileIn.open( IO_WriteOnly ) ) {
140 KMessageBox::error( this, i18n("Error saving template file\n '%1'.") 131 KMessageBox::error( this, i18n("Error saving template file\n '%1'.")
141 .arg( fileName ) ); 132 .arg( fileName ) );
142 return; 133 return;
143 } 134 }
144 // QString text; 135 // QString text;
145 QTextStream tsIn( &fileIn ); 136 QTextStream tsIn( &fileIn );
146 tsIn.setCodec( QTextCodec::codecForName("utf8") ); 137 tsIn.setCodec( QTextCodec::codecForName("utf8") );
147 tsIn << mEditor->text(); 138 tsIn << mEditor->text();
148 fileIn.close(); 139 fileIn.close();
149} 140}
150void JournalEntry::slotLoadTemplate() 141void JournalEntry::slotLoadTemplate()
151{ 142{
152 QString fileName =locateLocal( "templates", "journals" ); 143 QString fileName =locateLocal( "templates", "journals" );
153 QDir t_dir; 144 QDir t_dir;
154 if ( !t_dir.exists(fileName) ) 145 if ( !t_dir.exists(fileName) )
155 t_dir.mkdir ( fileName ); 146 t_dir.mkdir ( fileName );
156 fileName += "/journal"; 147 fileName += "/journal";
157 fileName = KFileDialog::getOpenFileName( fileName , i18n("Insert Journal template"), this ); 148 fileName = KFileDialog::getOpenFileName( fileName , i18n("Insert Journal template"), this );
158 if ( fileName.length() == 0 ) 149 if ( fileName.length() == 0 )
159 return; 150 return;
160 QFile fileIn( fileName ); 151 QFile fileIn( fileName );
161 if (!fileIn.open( IO_ReadOnly ) ) { 152 if (!fileIn.open( IO_ReadOnly ) ) {
162 KMessageBox::error( this, i18n("Error loading template file\n '%1'.") 153 KMessageBox::error( this, i18n("Error loading template file\n '%1'.")
163 .arg( fileName ) ); 154 .arg( fileName ) );
164 return; 155 return;
165 } 156 }
166 QTextStream tsIn( &fileIn ); 157 QTextStream tsIn( &fileIn );
167 tsIn.setCodec( QTextCodec::codecForName("utf8") ); 158 tsIn.setCodec( QTextCodec::codecForName("utf8") );
168 QString text = tsIn.read(); 159 QString text = tsIn.read();
169 fileIn.close(); 160 fileIn.close();
170 int line, col; 161 int line, col;
171 mEditor->getCursorPosition (& line, & col ); 162 mEditor->getCursorPosition (& line, & col );
172 mEditor-> insertAt ( text, line, col, true ); 163 mEditor-> insertAt ( text, line, col, true );
173 //mEditor->setIgnoreMark( true ); 164 //mEditor->setIgnoreMark( true );
174 setDirty(); 165 setDirty();
175} 166}
176void JournalEntry::setDate(const QDate &date) 167void JournalEntry::setDate(const QDate &date)
177{ 168{
178 showOnlyMode = false; 169 showOnlyMode = false;
179 mDate = date; 170 mDate = date;
180 writeJournal(); 171 writeJournal();
181 int id = mCalendar->defaultCalendar(); 172 int id = mCalendar->defaultCalendar();
182 if ( id == 1 ) { 173 QString calname = KOPrefs::instance()->getCalendar( id )->mName;
183 mTitleLabel->setText(KGlobal::locale()->formatDate(date)); 174 mTitleLabel->setText( " (" + calname +")");
184 } else {
185 QString calname = KOPrefs::instance()->getCalendar( id )->mName;
186 mTitleLabel->setText( KGlobal::locale()->formatDate(mDate,true) + " (" + calname +")");
187 }
188} 175}
189 176
190void JournalEntry::toggleShowJournal() 177void JournalEntry::toggleShowJournal()
191{ 178{
179 flushEntry();
192 if ( showOnlyMode ) 180 if ( showOnlyMode )
193 emit showJournalOnly( 0 ); 181 emit showJournalOnly( 0 );
194 else 182 else
195 emit showJournalOnly( mJournal ); 183 emit showJournalOnly( mJournal );
196} 184}
197 185void JournalEntry::setShowOnly()
186{
187 showOnlyMode = true;
188 mEditor->setFocus();
189}
198void JournalEntry::setJournal(Journal *journal) 190void JournalEntry::setJournal(Journal *journal)
199{ 191{
200 writeJournal(); 192 writeJournal();
201 193
202 mJournal = journal; 194 mJournal = journal;
203 195 mTitle->setText(mJournal->summary());
204 mEditor->setText(mJournal->description()); 196 mEditor->setText(mJournal->description());
205 int id = mJournal->calID(); 197 int id = mJournal->calID();
206 if ( id > 1 ) { 198
207 QString calname = KOPrefs::instance()->getCalendar( id )->mName; 199 QString calname = KOPrefs::instance()->getCalendar( id )->mName;
208 mTitleLabel->setText( KGlobal::locale()->formatDate(mDate,true) + " (" + calname +")"); 200 mTitleLabel->setText( " (" + calname +")");
209 } else { 201
210 mTitleLabel->setText(KGlobal::locale()->formatDate(mDate));
211 }
212 mDirty = false; 202 mDirty = false;
213} 203}
214 204
215Journal *JournalEntry::journal() const 205Journal *JournalEntry::journal() const
216{ 206{
217 return mJournal; 207 return mJournal;
218} 208}
219 209
220void JournalEntry::setDirty() 210void JournalEntry::setDirty()
221{ 211{
222 mDirty = true; 212 mDirty = true;
223 213
224// kdDebug() << "JournalEntry::setDirty()" << endl; 214// kdDebug() << "JournalEntry::setDirty()" << endl;
225} 215}
226 216
227void JournalEntry::clear() 217void JournalEntry::clear()
228{ 218{
229 mJournal = 0; 219 mJournal = 0;
230 mEditor->setText(""); 220 mEditor->setText("");
231} 221}
232 222
233bool JournalEntry::eventFilter( QObject *o, QEvent *e ) 223bool JournalEntry::eventFilter( QObject *o, QEvent *e )
234{ 224{
235// kdDebug() << "JournalEntry::event received " << e->type() << endl; 225// kdDebug() << "JournalEntry::event received " << e->type() << endl;
236 226
237 if ( e->type() == QEvent::FocusOut ) { 227 if ( e->type() == QEvent::FocusOut ) {
238 writeJournal(); 228 writeJournal();
239 } 229 }
240 if ( e->type() == QEvent::KeyPress ) { 230 if ( e->type() == QEvent::KeyPress ) {
241 QKeyEvent * k = (QKeyEvent *) e; 231 QKeyEvent * k = (QKeyEvent *) e;
242 if ( k->state() == Qt::ControlButton ) { 232 if ( k->state() == Qt::ControlButton ) {
243 k->ignore(); 233 k->ignore();
244 //return true; 234 //return true;
245 } 235 }
246 } 236 }
247 237
248 return QFrame::eventFilter( o, e ); // standard event processing 238 return QFrame::eventFilter( o, e ); // standard event processing
249} 239}
250 240
251void JournalEntry::writeJournal() 241void JournalEntry::writeJournal()
252{ 242{
253// kdDebug() << "JournalEntry::writeJournal()" << endl; 243// kdDebug() << "JournalEntry::writeJournal()" << endl;
254 if (!mDirty) return; 244 if (!mDirty) return;
255 245
256 if (mEditor->text().isEmpty()) { 246 if (mEditor->text().isEmpty()) {
257 if ( mJournal ) { 247 if ( mJournal ) {
258 mDirty = false; 248 mDirty = false;
259 bool conf = KOPrefs::instance()->mConfirm; 249 bool conf = KOPrefs::instance()->mConfirm;
260 KOPrefs::instance()->mConfirm = false; 250 KOPrefs::instance()->mConfirm = false;
261 emit deleteJournal(mJournal); 251 emit deleteJournal(mJournal);
262 KOPrefs::instance()->mConfirm = conf; 252 KOPrefs::instance()->mConfirm = conf;
263 mJournal = 0; 253 mJournal = 0;
264 } 254 }
265 return; 255 return;
266 } 256 }
267 257
268// kdDebug() << "JournalEntry::writeJournal()..." << endl; 258// kdDebug() << "JournalEntry::writeJournal()..." << endl;
269 259
270 if (!mJournal) { 260 if (!mJournal) {
271 mJournal = new Journal; 261 mJournal = new Journal;
272 mJournal->setDtStart(QDateTime(mDate,QTime(0,0,0))); 262 mJournal->setDtStart(QDateTime(mDate,QTime(0,0,0)));
273 mCalendar->addJournal(mJournal); 263 mCalendar->addJournal(mJournal);
274 } 264 }
275 265
276 mJournal->setDescription(mEditor->text()); 266 mJournal->setDescription(mEditor->text());
277 //qDebug("tttt%s ", mEditor->text().latin1()); 267 mJournal->setSummary(mTitle->text());
278
279 mDirty = false; 268 mDirty = false;
280} 269}
281 270
282void JournalEntry::flushEntry() 271void JournalEntry::flushEntry()
283{ 272{
284 if (!mDirty) return; 273 if (!mDirty) return;
285 274
286 writeJournal(); 275 writeJournal();
287} 276}
288void JournalEntry::keyPressEvent ( QKeyEvent * e ) 277void JournalEntry::keyPressEvent ( QKeyEvent * e )
289{ 278{
290 e->ignore(); 279 e->ignore();
291 280
292} 281}
diff --git a/korganizer/journalentry.h b/korganizer/journalentry.h
index b0e9cc7..b37cabd 100644
--- a/korganizer/journalentry.h
+++ b/korganizer/journalentry.h
@@ -1,82 +1,84 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23#ifndef JOURNALENTRY_H 23#ifndef JOURNALENTRY_H
24#define JOURNALENTRY_H 24#define JOURNALENTRY_H
25// 25//
26// Widget showing one Journal entry 26// Widget showing one Journal entry
27 27
28#include <qframe.h> 28#include <qframe.h>
29 29
30#include <libkcal/calendar.h> 30#include <libkcal/calendar.h>
31 31
32class QLabel; 32class QLabel;
33class KTextEdit; 33class KTextEdit;
34class KLineEdit;
34 35
35using namespace KCal; 36using namespace KCal;
36 37
37class JournalEntry : public QFrame { 38class JournalEntry : public QFrame {
38 Q_OBJECT 39 Q_OBJECT
39 public: 40 public:
40 JournalEntry(Calendar *,QWidget *parent); 41 JournalEntry(Calendar *,QWidget *parent);
41 virtual ~JournalEntry(); 42 virtual ~JournalEntry();
42 43
43 void setJournal(Journal *); 44 void setJournal(Journal *);
44 Journal *journal() const; 45 Journal *journal() const;
45 46
46 void setDate(const QDate &); 47 void setDate(const QDate &);
47 48
48 void clear(); 49 void clear();
49 50
50 void flushEntry(); 51 void flushEntry();
51 void setShowOnly() {showOnlyMode = true;} 52 void setShowOnly();
52 QSize sizeHint() const; 53 QSize sizeHint() const;
53 54
54 protected slots: 55 protected slots:
55 void slotSaveTemplate(); 56 void slotSaveTemplate();
56 void slotLoadTemplate(); 57 void slotLoadTemplate();
57 void setDirty(); 58 void setDirty();
58 void toggleShowJournal(); 59 void toggleShowJournal();
59 signals: 60 signals:
60 void deleteJournal(Journal *); 61 void deleteJournal(Journal *);
61 void newJournal(); 62 void newJournal();
62 void showJournalOnly( Journal * ); 63 void showJournalOnly( Journal * );
63 64
64 protected: 65 protected:
65 bool eventFilter( QObject *o, QEvent *e ); 66 bool eventFilter( QObject *o, QEvent *e );
66 67
67 void writeJournal(); 68 void writeJournal();
68 69
69 private: 70 private:
70 bool showOnlyMode; 71 bool showOnlyMode;
71 Calendar *mCalendar; 72 Calendar *mCalendar;
72 Journal *mJournal; 73 Journal *mJournal;
73 QDate mDate; 74 QDate mDate;
74 void keyPressEvent ( QKeyEvent * ) ; 75 void keyPressEvent ( QKeyEvent * ) ;
75 QLabel *mTitleLabel; 76 QLabel *mTitleLabel;
77 KLineEdit * mTitle;
76 KTextEdit *mEditor; 78 KTextEdit *mEditor;
77 int heiHint; 79 int heiHint;
78 80
79 bool mDirty; 81 bool mDirty;
80}; 82};
81 83
82#endif 84#endif
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp
index 3468657..067c34c 100644
--- a/korganizer/kodaymatrix.cpp
+++ b/korganizer/kodaymatrix.cpp
@@ -127,200 +127,209 @@ KODayMatrix::KODayMatrix( QWidget *parent, const char *name )
127 127
128 // set default values used for drawing the matrix 128 // set default values used for drawing the matrix
129 mDefaultBackColor = palette().active().base(); 129 mDefaultBackColor = palette().active().base();
130 mDefaultTextColor = palette().active().foreground(); 130 mDefaultTextColor = palette().active().foreground();
131 mDefaultTextColorShaded = getShadedColor(mDefaultTextColor); 131 mDefaultTextColorShaded = getShadedColor(mDefaultTextColor);
132 mHolidayColorShaded = getShadedColor(KOPrefs::instance()->mHolidayColor); 132 mHolidayColorShaded = getShadedColor(KOPrefs::instance()->mHolidayColor);
133 mSelectedDaysColor = QColor("white"); 133 mSelectedDaysColor = QColor("white");
134 mTodayMarginWidth = 2; 134 mTodayMarginWidth = 2;
135 mSelEnd = mSelStart = NOSELECTION; 135 mSelEnd = mSelStart = NOSELECTION;
136 136
137 setAcceptDrops(true); 137 setAcceptDrops(true);
138 //setFont( QFont("Arial", 10) ); 138 //setFont( QFont("Arial", 10) );
139 139
140 mUpdateTimer = new QTimer( this ); 140 mUpdateTimer = new QTimer( this );
141 connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( updateViewTimed() )); 141 connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( updateViewTimed() ));
142 mRepaintTimer = new QTimer( this ); 142 mRepaintTimer = new QTimer( this );
143 connect (mRepaintTimer ,SIGNAL(timeout()), this, SLOT ( repaintViewTimed() )); 143 connect (mRepaintTimer ,SIGNAL(timeout()), this, SLOT ( repaintViewTimed() ));
144 mDayChanged = false; 144 mDayChanged = false;
145 updateView(); 145 updateView();
146} 146}
147QString KODayMatrix::getWhatsThisText( QPoint p ) 147QString KODayMatrix::getWhatsThisText( QPoint p )
148{ 148{
149 149
150 int tmp = getDayIndexFrom(p.x(), p.y()); 150 int tmp = getDayIndexFrom(p.x(), p.y());
151 if ( tmp < 0 || tmp > NUMDAYS-1 || !mCalendar ) 151 if ( tmp < 0 || tmp > NUMDAYS-1 || !mCalendar )
152 return QString(); 152 return QString();
153 QDate mDate = days[tmp]; 153 QDate mDate = days[tmp];
154 QPtrList<Event> eventlist = mCalendar->events(mDate); 154 QPtrList<Event> eventlist = mCalendar->events(mDate);
155 Event *event; 155 Event *event;
156 QStringList mToolTip; 156 QStringList mToolTip;
157 for(event=eventlist.first();event != 0;event=eventlist.next()) { 157 for(event=eventlist.first();event != 0;event=eventlist.next()) {
158 QString mToolTipText; 158 QString mToolTipText;
159 QString text; 159 QString text;
160 int multiday = 0;// 1 = start, 2 = midddle, 3 = end day 160 int multiday = 0;// 1 = start, 2 = midddle, 3 = end day
161 if (event->isMultiDay()) { 161 if (event->isMultiDay()) {
162 QString prefix = "<->";multiday = 2; 162 QString prefix = "<->";multiday = 2;
163 QString time; 163 QString time;
164 if ( event->doesRecur() ) { 164 if ( event->doesRecur() ) {
165 if ( event->recursOn( mDate) ) { 165 if ( event->recursOn( mDate) ) {
166 prefix ="->" ;multiday = 1; 166 prefix ="->" ;multiday = 1;
167 } 167 }
168 else { 168 else {
169 int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); 169 int days = event->dtStart().date().daysTo ( event->dtEnd().date() );
170 if ( event->recursOn( mDate.addDays( -days)) ) { 170 if ( event->recursOn( mDate.addDays( -days)) ) {
171 prefix ="<-" ;multiday = 3; 171 prefix ="<-" ;multiday = 3;
172 } 172 }
173 } 173 }
174 } else { 174 } else {
175 if (mDate == event->dtStart().date()) { 175 if (mDate == event->dtStart().date()) {
176 prefix ="->" ;multiday = 1; 176 prefix ="->" ;multiday = 1;
177 } else if (mDate == event->dtEnd().date()) { 177 } else if (mDate == event->dtEnd().date()) {
178 prefix ="<-" ;multiday = 3; 178 prefix ="<-" ;multiday = 3;
179 } 179 }
180 } 180 }
181 if ( !event->doesFloat() ) { 181 if ( !event->doesFloat() ) {
182 if ( mDate == event->dtStart().date () ) 182 if ( mDate == event->dtStart().date () )
183 time = KGlobal::locale()->formatTime(event->dtStart().time())+" "; 183 time = KGlobal::locale()->formatTime(event->dtStart().time())+" ";
184 else if ( mDate == event->dtEnd().date () ) 184 else if ( mDate == event->dtEnd().date () )
185 time = KGlobal::locale()->formatTime(event->dtEnd().time())+" "; 185 time = KGlobal::locale()->formatTime(event->dtEnd().time())+" ";
186 186
187 } 187 }
188 text = time + event->summary(); 188 text = time + event->summary();
189 mToolTipText += prefix + text; 189 mToolTipText += prefix + text;
190 } else { 190 } else {
191 if (event->doesFloat()) { 191 if (event->doesFloat()) {
192 text = event->summary(); 192 text = event->summary();
193 mToolTipText += text; 193 mToolTipText += text;
194 } 194 }
195 else { 195 else {
196 text = KGlobal::locale()->formatTime(event->dtStart().time()); 196 text = KGlobal::locale()->formatTime(event->dtStart().time());
197 text += " " + event->summary(); 197 text += " " + event->summary();
198 mToolTipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); 198 mToolTipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary();
199 } 199 }
200 } 200 }
201 if ( !event->location().isEmpty() ) 201 if ( !event->location().isEmpty() )
202 mToolTipText += " (" + event->location() + ")"; 202 mToolTipText += " (" + event->location() + ")";
203 //qDebug("TTT: %s ", mToolTipText.latin1()); 203 //qDebug("TTT: %s ", mToolTipText.latin1());
204 mToolTip.append( deTag( mToolTipText ) ); 204 mToolTip.append( deTag( mToolTipText ) );
205 } 205 }
206 mToolTip.sort(); 206 mToolTip.sort();
207 if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) { 207 if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) {
208 QPtrList<Todo> todolist = mCalendar->todos(mDate); 208 QPtrList<Todo> todolist = mCalendar->todos(mDate);
209 Todo *todo; 209 Todo *todo;
210 for(todo=todolist.first();todo != 0;todo=todolist.next()) { 210 for(todo=todolist.first();todo != 0;todo=todolist.next()) {
211 QString mToolTipText; 211 QString mToolTipText;
212 if ( !todo->doesFloat() ) 212 if ( !todo->doesFloat() )
213 mToolTipText += KGlobal::locale()->formatTime(todo->dtDue().time())+" "; 213 mToolTipText += KGlobal::locale()->formatTime(todo->dtDue().time())+" ";
214 mToolTipText += todo->summary(); 214 mToolTipText += todo->summary();
215 if ( !todo->location().isEmpty() ) 215 if ( !todo->location().isEmpty() )
216 mToolTipText += " (" + todo->location() + ")"; 216 mToolTipText += " (" + todo->location() + ")";
217 mToolTipText = deTag( mToolTipText); 217 mToolTipText = deTag( mToolTipText);
218 mToolTipText = "<b>" + i18n("Todo: ") + "</b>"+ mToolTipText; 218 mToolTipText = "<b>" + i18n("Todo: ") + "</b>"+ mToolTipText;
219 mToolTip.append( mToolTipText ); 219 mToolTip.append( mToolTipText );
220 } 220 }
221 } 221 }
222 if (KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) { 222 if (KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) {
223 Journal *j = mCalendar->journal( mDate ); 223 QPtrList<Journal> j_list = mCalendar->journals4Date( mDate );
224 if ( j ) { 224 Journal *j = j_list.first();
225 QString mToolTipText = j->description().left(100); 225 while ( j ) {
226 if ( j->description().length() > 100 ) 226 QString mToolTipText;
227 mToolTipText += " ..."; 227 if ( !j->summary().isEmpty() ) {
228 mToolTipText = deTag( mToolTipText); 228 mToolTipText = j->summary().left(30);
229 if ( j->summary().length() > 30 )
230 mToolTipText += " ...";
231 } else {
232 mToolTipText = j->description().left(25);
233 if ( j->description().length() > 25 )
234 mToolTipText += " ...";
235 mToolTipText = deTag( mToolTipText);
236 }
229 mToolTipText = "<b>" + i18n("Journal: ") + "</b>"+ mToolTipText; 237 mToolTipText = "<b>" + i18n("Journal: ") + "</b>"+ mToolTipText;
230 mToolTip.append( mToolTipText ); 238 mToolTip.append( mToolTipText );
239 j = j_list.next();
231 } 240 }
232 } 241 }
233 return "<b>"+KGlobal::locale()->formatDate(days[tmp]) + "</b><br>" + mToolTip.join("<br>"); 242 return "<b>"+KGlobal::locale()->formatDate(days[tmp]) + "</b><br>" + mToolTip.join("<br>");
234} 243}
235 244
236 245
237QString KODayMatrix::deTag( QString mToolTipText ) 246QString KODayMatrix::deTag( QString mToolTipText )
238{ 247{
239 248
240#if QT_VERSION >= 0x030000 249#if QT_VERSION >= 0x030000
241 mToolTipText.replace( '<' , "&lt;" ); 250 mToolTipText.replace( '<' , "&lt;" );
242 mToolTipText.replace( '>' , "&gt;" ); 251 mToolTipText.replace( '>' , "&gt;" );
243#else 252#else
244 if ( mToolTipText.find ('<') >= 0 ) { 253 if ( mToolTipText.find ('<') >= 0 ) {
245 mToolTipText.replace( QRegExp("<") , "&lt;" ); 254 mToolTipText.replace( QRegExp("<") , "&lt;" );
246 } 255 }
247 if ( mToolTipText.find ('>') >= 0 ) { 256 if ( mToolTipText.find ('>') >= 0 ) {
248 mToolTipText.replace( QRegExp(">") , "&gt;" ); 257 mToolTipText.replace( QRegExp(">") , "&gt;" );
249 } 258 }
250#endif 259#endif
251 return mToolTipText; 260 return mToolTipText;
252} 261}
253void KODayMatrix::setCalendar( Calendar *cal ) 262void KODayMatrix::setCalendar( Calendar *cal )
254{ 263{
255 mCalendar = cal; 264 mCalendar = cal;
256 265
257 setAcceptDrops( mCalendar ); 266 setAcceptDrops( mCalendar );
258 267
259 updateEvents(); 268 updateEvents();
260} 269}
261 270
262QColor KODayMatrix::getShadedColor(QColor color) 271QColor KODayMatrix::getShadedColor(QColor color)
263{ 272{
264 QColor shaded; 273 QColor shaded;
265 int h=0; 274 int h=0;
266 int s=0; 275 int s=0;
267 int v=0; 276 int v=0;
268 color.hsv(&h,&s,&v); 277 color.hsv(&h,&s,&v);
269 s = s/4; 278 s = s/4;
270 v = 192+v/4; 279 v = 192+v/4;
271 shaded.setHsv(h,s,v); 280 shaded.setHsv(h,s,v);
272 281
273 return shaded; 282 return shaded;
274} 283}
275 284
276KODayMatrix::~KODayMatrix() 285KODayMatrix::~KODayMatrix()
277{ 286{
278#if QT_VERSION >= 0x030000 287#if QT_VERSION >= 0x030000
279 288
280#else 289#else
281 delete mKODaymatrixWhatsThis; 290 delete mKODaymatrixWhatsThis;
282#endif 291#endif
283 292
284 // delete mKODaymatrixWhatsThis; 293 // delete mKODaymatrixWhatsThis;
285 delete [] days; 294 delete [] days;
286 delete [] daylbls; 295 delete [] daylbls;
287 //delete [] events; 296 //delete [] events;
288 delete mToolTip; 297 delete mToolTip;
289} 298}
290 299
291/* 300/*
292void KODayMatrix::setStartDate(QDate start) 301void KODayMatrix::setStartDate(QDate start)
293{ 302{
294 updateView(start); 303 updateView(start);
295} 304}
296*/ 305*/
297 306
298void KODayMatrix::addSelectedDaysTo(DateList& selDays) 307void KODayMatrix::addSelectedDaysTo(DateList& selDays)
299{ 308{
300 309
301 if (mSelStart == NOSELECTION) { 310 if (mSelStart == NOSELECTION) {
302 return; 311 return;
303 } 312 }
304 313
305 //cope with selection being out of matrix limits at top (< 0) 314 //cope with selection being out of matrix limits at top (< 0)
306 int i0 = mSelStart; 315 int i0 = mSelStart;
307 if (i0 < 0) { 316 if (i0 < 0) {
308 for (int i = i0; i < 0; i++) { 317 for (int i = i0; i < 0; i++) {
309 selDays.append(days[0].addDays(i)); 318 selDays.append(days[0].addDays(i));
310 } 319 }
311 i0 = 0; 320 i0 = 0;
312 } 321 }
313 322
314 //cope with selection being out of matrix limits at bottom (> NUMDAYS-1) 323 //cope with selection being out of matrix limits at bottom (> NUMDAYS-1)
315 if (mSelEnd > NUMDAYS-1) { 324 if (mSelEnd > NUMDAYS-1) {
316 for (int i = i0; i <= NUMDAYS-1; i++) { 325 for (int i = i0; i <= NUMDAYS-1; i++) {
317 selDays.append(days[i]); 326 selDays.append(days[i]);
318 } 327 }
319 for (int i = NUMDAYS; i < mSelEnd; i++) { 328 for (int i = NUMDAYS; i < mSelEnd; i++) {
320 selDays.append(days[0].addDays(i)); 329 selDays.append(days[0].addDays(i));
321 } 330 }
322 331
323 // apply normal routine to selection being entirely within matrix limits 332 // apply normal routine to selection being entirely within matrix limits
324 } else { 333 } else {
325 for (int i = i0; i <= mSelEnd; i++) { 334 for (int i = i0; i <= mSelEnd; i++) {
326 selDays.append(days[i]); 335 selDays.append(days[i]);
@@ -456,193 +465,195 @@ void KODayMatrix::updateViewTimed()
456 int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() ); 465 int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() );
457 bool invalid = false; 466 bool invalid = false;
458 while( true ) { 467 while( true ) {
459 if ( incidenceStart.isValid() ) { 468 if ( incidenceStart.isValid() ) {
460 incidenceEnd = incidenceStart.addDays( eventlen ); 469 incidenceEnd = incidenceStart.addDays( eventlen );
461 int st = incidenceStart.date().daysTo( endDate ); 470 int st = incidenceStart.date().daysTo( endDate );
462 if ( st >= 0 ) { // start before timeend 471 if ( st >= 0 ) { // start before timeend
463 int end = mStartDate.daysTo( incidenceEnd.date() ); 472 int end = mStartDate.daysTo( incidenceEnd.date() );
464 if ( end >= 0 ) { // end after timestart --- got one! 473 if ( end >= 0 ) { // end after timestart --- got one!
465 //normalize 474 //normalize
466 st = timeSpan - st; 475 st = timeSpan - st;
467 if ( st < 0 ) st = 0; 476 if ( st < 0 ) st = 0;
468 if ( end > timeSpan ) end = timeSpan; 477 if ( end > timeSpan ) end = timeSpan;
469 int iii; 478 int iii;
470 //qDebug("found %s %d %d ",event->summary().latin1(), st, end ); 479 //qDebug("found %s %d %d ",event->summary().latin1(), st, end );
471 for ( iii = st;iii<= end;++iii) { 480 for ( iii = st;iii<= end;++iii) {
472 computeEvent( event, iii ); 481 computeEvent( event, iii );
473 } 482 }
474 } 483 }
475 } 484 }
476 } else { 485 } else {
477 if ( invalid ) 486 if ( invalid )
478 break; 487 break;
479 invalid = true; 488 invalid = true;
480 //qDebug("invalid %s", event->summary().latin1()); 489 //qDebug("invalid %s", event->summary().latin1());
481 incidenceStart = QDateTime( mStartDate ).addSecs( -2 );; 490 incidenceStart = QDateTime( mStartDate ).addSecs( -2 );;
482 } 491 }
483 if ( last ) 492 if ( last )
484 break; 493 break;
485 bool ok; 494 bool ok;
486 incidenceStart = event->getNextOccurence( incidenceStart.addSecs( 1 ) ,&ok ); 495 incidenceStart = event->getNextOccurence( incidenceStart.addSecs( 1 ) ,&ok );
487 if ( ! ok ) 496 if ( ! ok )
488 break; 497 break;
489 if ( incidenceStart.date() > endDate ) 498 if ( incidenceStart.date() > endDate )
490 break; 499 break;
491 } 500 }
492 } else { // no recur 501 } else { // no recur
493 int st = event->dtStart().date().daysTo( endDate ); 502 int st = event->dtStart().date().daysTo( endDate );
494 if ( st >= 0 ) { // start before timeend 503 if ( st >= 0 ) { // start before timeend
495 int end = mStartDate.daysTo( event->dtEnd().date() ); 504 int end = mStartDate.daysTo( event->dtEnd().date() );
496 if ( end >= 0 ) { // end after timestart --- got one! 505 if ( end >= 0 ) { // end after timestart --- got one!
497 //normalize 506 //normalize
498 st = timeSpan - st; 507 st = timeSpan - st;
499 if ( st < 0 ) st = 0; 508 if ( st < 0 ) st = 0;
500 if ( end > timeSpan ) end = timeSpan; 509 if ( end > timeSpan ) end = timeSpan;
501 int iii; 510 int iii;
502 for ( iii = st;iii<= end;++iii) 511 for ( iii = st;iii<= end;++iii)
503 computeEvent( event, iii ); 512 computeEvent( event, iii );
504 } 513 }
505 } 514 }
506 } 515 }
507 } 516 }
508 int startDay = days[0].dayOfWeek(); // 1...7 7 = sunday 517 int startDay = days[0].dayOfWeek(); // 1...7 7 = sunday
509 for(i = 0; i < NUMDAYS; i++) { 518 for(i = 0; i < NUMDAYS; i++) {
510 if ( ( (i+startDay) % 7 == 0 ) ) { 519 if ( ( (i+startDay) % 7 == 0 ) ) {
511 pDays.setBit(i); 520 pDays.setBit(i);
512 } 521 }
513 } 522 }
514 if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) { 523 if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) {
515 bDays.fill( false); 524 bDays.fill( false);
516 // insert due todos 525 // insert due todos
517 QPtrList<Todo> todos = mCalendar->todos( ); 526 QPtrList<Todo> todos = mCalendar->todos( );
518 Todo *todo; 527 Todo *todo;
519 for(todo = todos.first(); todo; todo = todos.next()) { 528 for(todo = todos.first(); todo; todo = todos.next()) {
520 //insertTodo( todo ); 529 //insertTodo( todo );
521 if ( todo->hasDueDate() ) { 530 if ( todo->hasDueDate() ) {
522 int day = mStartDate.daysTo( todo->dtDue().date() ); 531 int day = mStartDate.daysTo( todo->dtDue().date() );
523 if ( day >= 0 && day < timeSpan + 1) { 532 if ( day >= 0 && day < timeSpan + 1) {
524 int i = day; 533 int i = day;
525 QString holiStr = mHolidays[i]; 534 QString holiStr = mHolidays[i];
526 pDays.setBit(i); 535 pDays.setBit(i);
527 if ( !holiStr.isEmpty() ) 536 if ( !holiStr.isEmpty() )
528 holiStr += "\n"; 537 holiStr += "\n";
529 holiStr += i18n("Todo") + ": "+todo->summary(); 538 holiStr += i18n("Todo") + ": "+todo->summary();
530 if ( !todo->location().isEmpty() ) 539 if ( !todo->location().isEmpty() )
531 holiStr += " (" + todo->location() + ")"; 540 holiStr += " (" + todo->location() + ")";
532 bDays.setBit(i); 541 bDays.setBit(i);
533 mHolidays[i] =holiStr ; 542 mHolidays[i] =holiStr ;
534 eDays.setBit(i); 543 eDays.setBit(i);
535 } 544 }
536 } 545 }
537 } 546 }
538 } 547 }
539 if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) { 548 if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) {
540 bDays.fill( false); 549 bDays.fill( false);
541 // insert due todos 550 // insert due todos
542 QPtrList<Journal> todos = mCalendar->journals( ); 551 QPtrList<Journal> todos = mCalendar->journals( );
543 Journal *todo; 552 Journal *todo;
544 for(todo = todos.first(); todo; todo = todos.next()) { 553 for(todo = todos.first(); todo; todo = todos.next()) {
545 int day = mStartDate.daysTo( todo->dtStart().date() ); 554 int day = mStartDate.daysTo( todo->dtStart().date() );
546 if ( day >= 0 && day < timeSpan + 1) { 555 if ( day >= 0 && day < timeSpan + 1) {
547 int i = day; 556 int i = day;
548 QString holiStr = mHolidays[i]; 557 QString holiStr = mHolidays[i];
549 pDays.setBit(i); 558 pDays.setBit(i);
550 if ( !holiStr.isEmpty() ) 559 if ( !holiStr.isEmpty() )
551 holiStr += "\n"; 560 holiStr += "\n";
552 holiStr += i18n("Journal"); 561 holiStr += i18n("Journal: ")+todo->summary().left(25);
562 if ( todo->summary().length() > 25 )
563 holiStr +="...";
553 bDays.setBit(i); 564 bDays.setBit(i);
554 mHolidays[i] =holiStr ; 565 mHolidays[i] =holiStr ;
555 eDays.setBit(i); 566 eDays.setBit(i);
556 567
557 } 568 }
558 } 569 }
559 } 570 }
560#else 571#else
561 //qDebug("KODayMatrix::updateViewTimed "); 572 //qDebug("KODayMatrix::updateViewTimed ");
562 for(int i = 0; i < NUMDAYS; i++) { 573 for(int i = 0; i < NUMDAYS; i++) {
563 // if events are set for the day then remember to draw it bold 574 // if events are set for the day then remember to draw it bold
564 QPtrList<Event> eventlist = mCalendar->events(days[i]); 575 QPtrList<Event> eventlist = mCalendar->events(days[i]);
565 Event *event; 576 Event *event;
566 int numEvents = eventlist.count(); 577 int numEvents = eventlist.count();
567 QString holiStr = ""; 578 QString holiStr = "";
568 bDays.clearBit(i); 579 bDays.clearBit(i);
569 hDays.clearBit(i); 580 hDays.clearBit(i);
570 eDays.clearBit(i); 581 eDays.clearBit(i);
571 for(event=eventlist.first();event != 0;event=eventlist.next()) { 582 for(event=eventlist.first();event != 0;event=eventlist.next()) {
572 ushort recurType = event->recurrence()->doesRecur(); 583 ushort recurType = event->recurrence()->doesRecur();
573 if ((recurType == Recurrence::rDaily && !KOPrefs::instance()->mDailyRecur) || 584 if ((recurType == Recurrence::rDaily && !KOPrefs::instance()->mDailyRecur) ||
574 (recurType == Recurrence::rWeekly && !KOPrefs::instance()->mWeeklyRecur)) { 585 (recurType == Recurrence::rWeekly && !KOPrefs::instance()->mWeeklyRecur)) {
575 numEvents--; 586 numEvents--;
576 } 587 }
577 if ( event->isHoliday()) { 588 if ( event->isHoliday()) {
578 hDays.setBit(i); 589 hDays.setBit(i);
579 if ( !holiStr.isEmpty() ) 590 if ( !holiStr.isEmpty() )
580 holiStr += "\n"; 591 holiStr += "\n";
581 holiStr += event->summary(); 592 holiStr += event->summary();
582 if ( !event->location().isEmpty() ) 593 if ( !event->location().isEmpty() )
583 holiStr += " (" + event->location() + ")"; 594 holiStr += " (" + event->location() + ")";
584 } 595 }
585 if ( event->isBirthday()) { 596 if ( event->isBirthday()) {
586 if ( !holiStr.isEmpty() ) 597 if ( !holiStr.isEmpty() )
587 holiStr += "\n"; 598 holiStr += "\n";
588 holiStr += i18n("Birthday") + ": "+event->summary(); 599 holiStr += i18n("Birthday") + ": "+event->summary();
589 if ( !event->location().isEmpty() ) 600 if ( !event->location().isEmpty() )
590 holiStr += " (" + event->location() + ")"; 601 holiStr += " (" + event->location() + ")";
591 bDays.setBit(i); 602 bDays.setBit(i);
592 } 603 }
593 } 604 }
594 if ( numEvents ) 605 if ( numEvents )
595 eDays.setBit(i); 606 eDays.setBit(i);
596 //if it is a holy day then draw it red. Sundays are consider holidays, too 607 //if it is a holy day then draw it red. Sundays are consider holidays, too
597 if ( (KOGlobals::self()->calendarSystem()->dayOfWeek(days[i]) == KOGlobals::self()->calendarSystem()->weekDayOfPray()) || 608 if ( (KOGlobals::self()->calendarSystem()->dayOfWeek(days[i]) == KOGlobals::self()->calendarSystem()->weekDayOfPray()) ||
598 !holiStr.isEmpty()) { 609 !holiStr.isEmpty()) {
599 mHolidays[i] = holiStr; 610 mHolidays[i] = holiStr;
600 } else { 611 } else {
601 mHolidays[i] = QString::null; 612 mHolidays[i] = QString::null;
602 } 613 }
603 } 614 }
604#endif 615#endif
605 mRedrawNeeded = true; 616 mRedrawNeeded = true;
606 if ( ! mPendingUpdateBeforeRepaint ) 617 if ( ! mPendingUpdateBeforeRepaint )
607 repaint(false); 618 repaint(false);
608} 619}
609void KODayMatrix::updateView(QDate actdate) 620void KODayMatrix::updateView(QDate actdate)
610{ 621{
611 if ( mLastView != KOPrefs::instance()->mCurrentDisplayedView ) 622 if ( mLastView != KOPrefs::instance()->mCurrentDisplayedView )
612 mRedrawNeeded = true; 623 mRedrawNeeded = true;
613 mLastView = KOPrefs::instance()->mCurrentDisplayedView; 624 mLastView = KOPrefs::instance()->mCurrentDisplayedView;
614 if ( ! actdate.isValid() ) { 625 if ( ! actdate.isValid() ) {
615 //qDebug("date not valid "); 626 //qDebug("date not valid ");
616 return; 627 return;
617 } 628 }
618 mDayChanged = false; 629 mDayChanged = false;
619 //flag to indicate if the starting day of the matrix has changed by this call 630 //flag to indicate if the starting day of the matrix has changed by this call
620 //mDayChanged = false; 631 //mDayChanged = false;
621 // if a new startdate is to be set then apply Cornelius's calculation 632 // if a new startdate is to be set then apply Cornelius's calculation
622 // of the first day to be shown 633 // of the first day to be shown
623 if (actdate != startdate) { 634 if (actdate != startdate) {
624 // reset index of selection according to shift of starting date from startdate to actdate 635 // reset index of selection according to shift of starting date from startdate to actdate
625 if (mSelStart != NOSELECTION) { 636 if (mSelStart != NOSELECTION) {
626 int tmp = actdate.daysTo(startdate); 637 int tmp = actdate.daysTo(startdate);
627 //kdDebug() << "Shift of Selection1: " << mSelStart << " - " << mSelEnd << " -> " << tmp << "(" << offset << ")" << endl; 638 //kdDebug() << "Shift of Selection1: " << mSelStart << " - " << mSelEnd << " -> " << tmp << "(" << offset << ")" << endl;
628 // shift selection if new one would be visible at least partly ! 639 // shift selection if new one would be visible at least partly !
629 640
630 if (mSelStart+tmp < NUMDAYS && mSelEnd+tmp >= 0) { 641 if (mSelStart+tmp < NUMDAYS && mSelEnd+tmp >= 0) {
631 // nested if is required for next X display pushed from a different month - correction required 642 // nested if is required for next X display pushed from a different month - correction required
632 // otherwise, for month forward and backward, it must be avoided 643 // otherwise, for month forward and backward, it must be avoided
633 if( mSelStart > NUMDAYS || mSelStart < 0 ) 644 if( mSelStart > NUMDAYS || mSelStart < 0 )
634 mSelStart = mSelStart + tmp; 645 mSelStart = mSelStart + tmp;
635 if( mSelEnd > NUMDAYS || mSelEnd < 0 ) 646 if( mSelEnd > NUMDAYS || mSelEnd < 0 )
636 mSelEnd = mSelEnd + tmp; 647 mSelEnd = mSelEnd + tmp;
637 } 648 }
638 } 649 }
639 startdate = actdate; 650 startdate = actdate;
640 mDayChanged = true; 651 mDayChanged = true;
641 recalculateToday(); 652 recalculateToday();
642 mRedrawNeeded = true; 653 mRedrawNeeded = true;
643 } 654 }
644 //qDebug("restart Timer %d vis: %d", mDayChanged, isVisible() ); 655 //qDebug("restart Timer %d vis: %d", mDayChanged, isVisible() );
645 if ( !isVisible() ) { 656 if ( !isVisible() ) {
646 mPendingUpdateBeforeRepaint = true; 657 mPendingUpdateBeforeRepaint = true;
647 } else { 658 } else {
648#ifdef DESKTOP_VERSION 659#ifdef DESKTOP_VERSION
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp
index 6315827..dcbb99f 100644
--- a/korganizer/koeventviewer.cpp
+++ b/korganizer/koeventviewer.cpp
@@ -608,192 +608,195 @@ void KOEventViewer::formatAttendees(Incidence *event)
608 int a_count = 0; 608 int a_count = 0;
609 int a_count_nr = 0; 609 int a_count_nr = 0;
610 610
611 for(a=attendees.first();a;a=attendees.next()) { 611 for(a=attendees.first();a;a=attendees.next()) {
612#ifndef KORG_NOKABC 612#ifndef KORG_NOKABC
613#ifdef DESKTOP_VERSION 613#ifdef DESKTOP_VERSION
614 if (a->name().isEmpty()) { 614 if (a->name().isEmpty()) {
615 addressList = add_book->findByEmail(a->email()); 615 addressList = add_book->findByEmail(a->email());
616 KABC::Addressee o = addressList.first(); 616 KABC::Addressee o = addressList.first();
617 if (!o.isEmpty() && addressList.size()<2) { 617 if (!o.isEmpty() && addressList.size()<2) {
618 mText += "<a href=\"uid:" + o.uid() + "\">"; 618 mText += "<a href=\"uid:" + o.uid() + "\">";
619 mText += o.formattedName(); 619 mText += o.formattedName();
620 mText += "</a>\n"; 620 mText += "</a>\n";
621 } else { 621 } else {
622 mText += "<li>"; 622 mText += "<li>";
623 mText.append(a->email()); 623 mText.append(a->email());
624 mText += "\n"; 624 mText += "\n";
625 } 625 }
626 } else { 626 } else {
627 mText += "<li><a href=\"uid:" + a->uid() + "\">"; 627 mText += "<li><a href=\"uid:" + a->uid() + "\">";
628 if (!a->name().isEmpty()) mText += a->name(); 628 if (!a->name().isEmpty()) mText += a->name();
629 else mText += a->email(); 629 else mText += a->email();
630 mText += "</a>\n"; 630 mText += "</a>\n";
631 } 631 }
632#else //DESKTOP_VERSION 632#else //DESKTOP_VERSION
633 mText += "<li><a href=\"uid:" + a->uid() + "\">"; 633 mText += "<li><a href=\"uid:" + a->uid() + "\">";
634 if (!a->name().isEmpty()) mText += a->name(); 634 if (!a->name().isEmpty()) mText += a->name();
635 else mText += a->email(); 635 else mText += a->email();
636 mText += "</a>\n"; 636 mText += "</a>\n";
637#endif //DESKTOP_VERSION 637#endif //DESKTOP_VERSION
638#else 638#else
639 //qDebug("nokabc "); 639 //qDebug("nokabc ");
640 mText += "<li><a href=\"uid:" + a->uid() + "\">"; 640 mText += "<li><a href=\"uid:" + a->uid() + "\">";
641 if (!a->name().isEmpty()) mText += a->name(); 641 if (!a->name().isEmpty()) mText += a->name();
642 else mText += a->email(); 642 else mText += a->email();
643 mText += "</a>\n"; 643 mText += "</a>\n";
644#endif 644#endif
645 645
646 646
647 if (!a->email().isEmpty()) { 647 if (!a->email().isEmpty()) {
648 if (iconPath) { 648 if (iconPath) {
649 mText += "<a href=\"mailto:" + a->name() +" <" + a->email() + ">:" + mMailSubject + "\">"; 649 mText += "<a href=\"mailto:" + a->name() +" <" + a->email() + ">:" + mMailSubject + "\">";
650 if ( a->RSVP() ) { 650 if ( a->RSVP() ) {
651 ++a_count_nr; 651 ++a_count_nr;
652 mText += "<IMG src=\"" + iconPath + "\">"; 652 mText += "<IMG src=\"" + iconPath + "\">";
653 } 653 }
654 else { 654 else {
655 ++a_count; 655 ++a_count;
656 mText += "<IMG src=\"" + NOiconPath + "\">"; 656 mText += "<IMG src=\"" + NOiconPath + "\">";
657 } 657 }
658 mText += "</a>\n"; 658 mText += "</a>\n";
659 } 659 }
660 } 660 }
661 if (a->status() != Attendee::NeedsAction ) 661 if (a->status() != Attendee::NeedsAction )
662 mText +="[" + a->statusStr() + "] "; 662 mText +="[" + a->statusStr() + "] ";
663 if (a->role() == Attendee::Chair ) 663 if (a->role() == Attendee::Chair )
664 mText +="(" + a->roleStr().left(1) + ".)"; 664 mText +="(" + a->roleStr().left(1) + ".)";
665 } 665 }
666 mText.append("</li></ul>"); 666 mText.append("</li></ul>");
667 if ( (a_count+a_count_nr) > 1 ) { 667 if ( (a_count+a_count_nr) > 1 ) {
668 mText += "<a href=\"mailto:ALL\">"; 668 mText += "<a href=\"mailto:ALL\">";
669 mText += i18n( "Mail to all" ); 669 mText += i18n( "Mail to all" );
670 mText += "</a> ( "; 670 mText += "</a> ( ";
671 mText += "<IMG src=\"" + iconPath + "\">"; 671 mText += "<IMG src=\"" + iconPath + "\">";
672 mText += i18n( " and " ); 672 mText += i18n( " and " );
673 mText += "<IMG src=\"" + NOiconPath + "\"> )"; 673 mText += "<IMG src=\"" + NOiconPath + "\"> )";
674 mText += "<br>\n"; 674 mText += "<br>\n";
675 675
676 676
677 } 677 }
678 if ( a_count_nr > 1 ) { 678 if ( a_count_nr > 1 ) {
679 mText += "<a href=\"mailto:RSVP\">"; 679 mText += "<a href=\"mailto:RSVP\">";
680 mText += i18n( "Mail to selected" ); 680 mText += i18n( "Mail to selected" );
681 mText += "</a> ( "; 681 mText += "</a> ( ";
682 mText += i18n( "<IMG src=\"%1\"> only )").arg ( iconPath ); 682 mText += i18n( "<IMG src=\"%1\"> only )").arg ( iconPath );
683 mText += "<br>\n"; 683 mText += "<br>\n";
684 } 684 }
685 } 685 }
686 686
687} 687}
688void KOEventViewer::appendJournal(Journal *jour, int mode ) 688void KOEventViewer::appendJournal(Journal *jour, int mode )
689{ 689{
690 bool shortDate = KOPrefs::instance()->mShortDateInViewer; 690 bool shortDate = KOPrefs::instance()->mShortDateInViewer;
691 if (mode == 0 ) { 691 if (mode == 0 ) {
692 addTag("h2",i18n("Journal from: ")); 692 addTag("h2",i18n("Journal from: "));
693 } 693 }
694 else { 694 else {
695 if ( mode == 1 ) { 695 if ( mode == 1 ) {
696 addTag("h2",i18n( "Local: " ) +i18n("Journal from: ")); 696 addTag("h2",i18n( "Local: " ) +i18n("Journal from: "));
697 } else { 697 } else {
698 addTag("h2",i18n( "Remote: " ) +i18n("Journal from: ")); 698 addTag("h2",i18n( "Remote: " ) +i18n("Journal from: "));
699 } 699 }
700 } 700 }
701 topLevelWidget()->setCaption("Journal Viewer"); 701 topLevelWidget()->setCaption("Journal Viewer");
702 mText.append(i18n("<h3> %1 </h3> ").arg(jour->dtStartDateStr(KOPrefs::instance()->mShortDateInViewer))); 702 mText.append(i18n("<h3> %1 </h3> ").arg(jour->dtStartDateStr(KOPrefs::instance()->mShortDateInViewer)));
703 addTag("b",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(jour->lastModified(),shortDate ) ); 703 addTag("b",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(jour->lastModified(),shortDate ) );
704 if (!jour->summary().isEmpty()) {
705 addTag("p",i18n(" Title: ") + deTag(jour->summary()));
706 }
704 if (!jour->description().isEmpty()) { 707 if (!jour->description().isEmpty()) {
705 addTag("p",deTag(jour->description())); 708 addTag("p",deTag(jour->description()));
706 } 709 }
707 setText(mText); 710 setText(mText);
708} 711}
709 712
710void KOEventViewer::formatReadOnly(Incidence *event) 713void KOEventViewer::formatReadOnly(Incidence *event)
711{ 714{
712 if (event->isReadOnly()) { 715 if (event->isReadOnly()) {
713 addTag("p","<em>(" + i18n("read-only") + ")</em>"); 716 addTag("p","<em>(" + i18n("read-only") + ")</em>");
714 } 717 }
715} 718}
716void KOEventViewer::setSyncMode( bool b ) 719void KOEventViewer::setSyncMode( bool b )
717{ 720{
718 mSyncMode = b; 721 mSyncMode = b;
719} 722}
720 723
721void KOEventViewer::setTodo(Todo *event, bool clearV ) 724void KOEventViewer::setTodo(Todo *event, bool clearV )
722{ 725{
723 if ( clearV ) 726 if ( clearV )
724 clearEvents(); 727 clearEvents();
725 if ( mSyncMode ) { 728 if ( mSyncMode ) {
726 if ( clearV ) 729 if ( clearV )
727 appendTodo(event,1 ); 730 appendTodo(event,1 );
728 else 731 else
729 appendTodo(event,2); 732 appendTodo(event,2);
730 } else 733 } else
731 appendTodo(event); 734 appendTodo(event);
732} 735}
733void KOEventViewer::setJournal(Journal *event, bool clearV ) 736void KOEventViewer::setJournal(Journal *event, bool clearV )
734{ 737{
735 if ( clearV ) 738 if ( clearV )
736 clearEvents(); 739 clearEvents();
737 if ( mSyncMode ) { 740 if ( mSyncMode ) {
738 if ( clearV ) 741 if ( clearV )
739 appendJournal(event, 1); 742 appendJournal(event, 1);
740 else 743 else
741 appendJournal(event, 2); 744 appendJournal(event, 2);
742 } else 745 } else
743 appendJournal(event); 746 appendJournal(event);
744} 747}
745 748
746void KOEventViewer::setEvent(Event *event) 749void KOEventViewer::setEvent(Event *event)
747{ 750{
748 clearEvents(); 751 clearEvents();
749 if ( mSyncMode ) 752 if ( mSyncMode )
750 appendEvent(event, 1); 753 appendEvent(event, 1);
751 else 754 else
752 appendEvent(event); 755 appendEvent(event);
753} 756}
754 757
755void KOEventViewer::addEvent(Event *event) 758void KOEventViewer::addEvent(Event *event)
756{ 759{
757 if ( mSyncMode ) 760 if ( mSyncMode )
758 appendEvent(event, 2); 761 appendEvent(event, 2);
759 else 762 else
760 appendEvent(event); 763 appendEvent(event);
761} 764}
762 765
763void KOEventViewer::clearEvents(bool now) 766void KOEventViewer::clearEvents(bool now)
764{ 767{
765 mText = ""; 768 mText = "";
766 if (now) setText(mText); 769 if (now) setText(mText);
767} 770}
768 771
769void KOEventViewer::addText(QString text) 772void KOEventViewer::addText(QString text)
770{ 773{
771 mText.append(text); 774 mText.append(text);
772 setText(mText); 775 setText(mText);
773} 776}
774QString KOEventViewer::deTag(QString text) 777QString KOEventViewer::deTag(QString text)
775{ 778{
776#if QT_VERSION >= 0x030000 779#if QT_VERSION >= 0x030000
777 text.replace( '<' , "&lt;" ); 780 text.replace( '<' , "&lt;" );
778 text.replace( '>' , "&gt;" ); 781 text.replace( '>' , "&gt;" );
779#else 782#else
780 if ( text.find ('<') >= 0 ) { 783 if ( text.find ('<') >= 0 ) {
781 text.replace( QRegExp("<") , "&lt;" ); 784 text.replace( QRegExp("<") , "&lt;" );
782 } 785 }
783 if ( text.find ('>') >= 0 ) { 786 if ( text.find ('>') >= 0 ) {
784 text.replace( QRegExp(">") , "&gt;" ); 787 text.replace( QRegExp(">") , "&gt;" );
785 } 788 }
786#endif 789#endif
787 return text; 790 return text;
788} 791}
789void KOEventViewer::keyPressEvent ( QKeyEvent * e ) 792void KOEventViewer::keyPressEvent ( QKeyEvent * e )
790{ 793{
791 switch ( e->key() ) { 794 switch ( e->key() ) {
792 case Qt::Key_Return: 795 case Qt::Key_Return:
793 case Qt::Key_Enter : 796 case Qt::Key_Enter :
794 e->ignore(); 797 e->ignore();
795 break; 798 break;
796 default: 799 default:
797 QTextBrowser::keyPressEvent ( e ); 800 QTextBrowser::keyPressEvent ( e );
798 break; 801 break;
799 } 802 }
diff --git a/korganizer/kojournalview.cpp b/korganizer/kojournalview.cpp
index 9e354d3..4fc9013 100644
--- a/korganizer/kojournalview.cpp
+++ b/korganizer/kojournalview.cpp
@@ -1,195 +1,217 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24// 24//
25// View of Journal entries 25// View of Journal entries
26 26
27#include <qlayout.h> 27#include <qlayout.h>
28#include <qscrollview.h> 28#include <qscrollview.h>
29#include <qpopupmenu.h> 29#include <qpopupmenu.h>
30#include <qhbox.h>
31#include <qpushbutton.h>
32#include <qlabel.h>
33#include <qpushbutton.h>
34#include <qapplication.h>
30 35
31#include <klocale.h> 36#include <klocale.h>
32#include <kdebug.h> 37#include <kdebug.h>
33#include "koprefs.h" 38#include "koprefs.h"
39#include <kglobal.h>
34 40
35#include <libkcal/calendar.h> 41#include <libkcal/calendar.h>
36 42
37#include "journalentry.h" 43#include "journalentry.h"
38 44
39#include "kojournalview.h" 45#include "kojournalview.h"
40using namespace KOrg; 46using namespace KOrg;
41 47
42KOJournalView::KOJournalView(Calendar *calendar, QWidget *parent, 48KOJournalView::KOJournalView(Calendar *calendar, QWidget *parent,
43 const char *name) 49 const char *name)
44 : KOrg::BaseView(calendar, parent, name) 50 : KOrg::BaseView(calendar, parent, name)
45{ 51{
46 mCalendar = calendar; 52 mCalendar = calendar;
47 QScrollView * sv = new QScrollView( this ); 53 QScrollView * sv = new QScrollView( this );
48 QHBoxLayout * hbl = new QHBoxLayout( this ); 54 QHBoxLayout * hbl = new QHBoxLayout( this );
49 hbl->addWidget( sv ); 55 hbl->addWidget( sv );
50 parWid = new QWidget( sv->viewport() ); 56 parWid = new QWidget( sv->viewport() );
51 sv->addChild(parWid); 57 sv->addChild(parWid);
52 sv->setResizePolicy( QScrollView:: AutoOneFit ); 58 sv->setResizePolicy( QScrollView:: AutoOneFit );
53 mTopLayout = new QVBoxLayout(parWid); 59 mTopLayout = new QVBoxLayout(parWid);
60 QHBox * vb = new QHBox ( parWid );
61 QPushButton * newJournal = new QPushButton( vb );
62 QIconSet icon;
63 if ( QApplication::desktop()->width() < 321 )
64 icon = SmallIcon("ko16old");
65 else
66 icon = SmallIcon("ko24old");
67 newJournal->setIconSet (icon ) ;
68 int size = newJournal->sizeHint().height();
69 newJournal->setFixedSize( size, size );
70 mDateLabel = new QLabel ( vb );
71 mTopLayout->addWidget( vb );
72 mDateLabel->setMargin(2);
73 mDateLabel->setAlignment(AlignCenter);
74 connect( newJournal, SIGNAL( clicked() ), this , SLOT( newJournal() ) );
54 getNewEntry(); 75 getNewEntry();
55} 76}
56 77
57KOJournalView::~KOJournalView() 78KOJournalView::~KOJournalView()
58{ 79{
59} 80}
60 81
61int KOJournalView::currentDateCount() 82int KOJournalView::currentDateCount()
62{ 83{
63 return 0; 84 return 0;
64} 85}
65JournalEntry* KOJournalView::getNewEntry() 86JournalEntry* KOJournalView::getNewEntry()
66{ 87{
67 JournalEntry* Entry = new JournalEntry(mCalendar,parWid); 88 JournalEntry* Entry = new JournalEntry(mCalendar,parWid);
68 jEntries.append( Entry ); 89 jEntries.append( Entry );
69 mTopLayout->addWidget(Entry); 90 mTopLayout->addWidget(Entry);
70 Entry->setFont ( KOPrefs::instance()->mJornalViewFont ); 91 Entry->setFont ( KOPrefs::instance()->mJornalViewFont );
71 connect ( Entry,SIGNAL(deleteJournal(Journal *) ),this ,SIGNAL(deleteJournal(Journal *) ) ) ; 92 connect ( Entry,SIGNAL(deleteJournal(Journal *) ),this ,SIGNAL(deleteJournal(Journal *) ) ) ;
72 connect ( Entry,SIGNAL(newJournal() ),this ,SLOT(newJournal() ) ) ; 93 connect ( Entry,SIGNAL(newJournal() ),this ,SLOT(newJournal() ) ) ;
73 connect ( Entry,SIGNAL(showJournalOnly( Journal * ) ),this ,SLOT(showOnly ( Journal* ) ) ) ; 94 connect ( Entry,SIGNAL(showJournalOnly( Journal * ) ),this ,SLOT(showOnly ( Journal* ) ) ) ;
74 return Entry; 95 return Entry;
75} 96}
76 97
77QPtrList<Incidence> KOJournalView::selectedIncidences() 98QPtrList<Incidence> KOJournalView::selectedIncidences()
78{ 99{
79 QPtrList<Incidence> eventList; 100 QPtrList<Incidence> eventList;
80 101
81 return eventList; 102 return eventList;
82} 103}
83void KOJournalView::updateConfig() 104void KOJournalView::updateConfig()
84{ 105{
85 JournalEntry* mEntry = jEntries.first(); 106 JournalEntry* mEntry = jEntries.first();
86 while ( mEntry ) { 107 while ( mEntry ) {
87 mEntry->setFont ( KOPrefs::instance()->mJornalViewFont ); 108 mEntry->setFont ( KOPrefs::instance()->mJornalViewFont );
88 mEntry = jEntries.next(); 109 mEntry = jEntries.next();
89 } 110 }
90} 111}
91void KOJournalView::updateView() 112void KOJournalView::updateView()
92{ 113{
93 JournalEntry* mEntry = jEntries.first(); 114 JournalEntry* mEntry = jEntries.first();
94 while ( mEntry ) { 115 while ( mEntry ) {
95 mEntry->setFont ( KOPrefs::instance()->mJornalViewFont ); 116 mEntry->setFont ( KOPrefs::instance()->mJornalViewFont );
96 mEntry = jEntries.next(); 117 mEntry = jEntries.next();
97 } 118 }
98 showDates( mDate, QDate() ); 119 showDates( mDate, QDate() );
99} 120}
100 121
101void KOJournalView::flushView() 122void KOJournalView::flushView()
102{ 123{
103 JournalEntry* mEntry = jEntries.first(); 124 JournalEntry* mEntry = jEntries.first();
104 while ( mEntry ) { 125 while ( mEntry ) {
105 mEntry->flushEntry(); 126 mEntry->flushEntry();
106 mEntry = jEntries.next(); 127 mEntry = jEntries.next();
107 } 128 }
108} 129}
109 130
110void KOJournalView::clearList() 131void KOJournalView::clearList()
111{ 132{
112 JournalEntry* mEntry = jEntries.first(); 133 JournalEntry* mEntry = jEntries.first();
113 while ( mEntry ) { 134 while ( mEntry ) {
114 mEntry->clear(); 135 mEntry->clear();
115 mEntry = jEntries.next(); 136 mEntry = jEntries.next();
116 } 137 }
117} 138}
118void KOJournalView::newJournal() 139void KOJournalView::newJournal()
119{ 140{
120 Journal* mJournal = new Journal; 141 Journal* mJournal = new Journal;
121 mJournal->setDtStart(QDateTime(mDate,QTime(0,0,0))); 142 mJournal->setDtStart(QDateTime(mDate,QTime(0,0,0)));
122 mCalendar->addJournal(mJournal); 143 mCalendar->addJournal(mJournal);
123 showDates( mDate, QDate() ); 144 showDates( mDate, QDate() );
124} 145}
125 146
126void KOJournalView::showOnly ( Journal* j ) 147void KOJournalView::showOnly ( Journal* j )
127{ 148{
128 if ( j == 0 ) { 149 if ( j == 0 ) {
129 showDates( mDate, QDate() ); 150 showDates( mDate, QDate() );
130 return; 151 return;
131 } 152 }
132 QPtrList<Journal> jl; 153 QPtrList<Journal> jl;
133 jl.append ( j ); 154 jl.append ( j );
134 showList( jl ); 155 showList( jl );
135 JournalEntry* mEntry = jEntries.first(); 156 JournalEntry* mEntry = jEntries.first();
136 mEntry->setShowOnly(); 157 mEntry->setShowOnly();
137} 158}
138void KOJournalView::showList(QPtrList<Journal> jl) 159void KOJournalView::showList(QPtrList<Journal> jl)
139{ 160{
140 JournalEntry* mEntry = jEntries.first(); 161 JournalEntry* mEntry = jEntries.first();
141 JournalEntry* firstEntry = mEntry; 162 JournalEntry* firstEntry = mEntry;
142 int count = jl.count(); 163 int count = jl.count();
143 int iii = 0; 164 int iii = 0;
144 while ( iii < count ) { 165 while ( iii < count ) {
145 if ( !mEntry ) { 166 if ( !mEntry ) {
146 mEntry = getNewEntry(); 167 mEntry = getNewEntry();
147 mEntry->show(); 168 mEntry->show();
148 mEntry->setDate(mDate); 169 mEntry->setDate(mDate);
149 mEntry->setJournal(jl.at(iii)); 170 mEntry->setJournal(jl.at(iii));
150 mEntry = 0; 171 mEntry = 0;
151 } else { 172 } else {
152 mEntry->setDate(mDate); 173 mEntry->setDate(mDate);
153 mEntry->setJournal(jl.at(iii)); 174 mEntry->setJournal(jl.at(iii));
154 mEntry->show(); 175 mEntry->show();
155 mEntry = jEntries.next(); 176 mEntry = jEntries.next();
156 } 177 }
157 ++iii; 178 ++iii;
158 } 179 }
159 while ( mEntry ) { 180 while ( mEntry ) {
160 mEntry->setDate(mDate); 181 mEntry->setDate(mDate);
161 mEntry->clear(); 182 mEntry->clear();
162 if ( mEntry != firstEntry ) 183 if ( mEntry != firstEntry )
163 mEntry->hide(); 184 mEntry->hide();
164 else 185 else
165 mEntry->show(); 186 mEntry->show();
166 mEntry = jEntries.next(); 187 mEntry = jEntries.next();
167 } 188 }
168} 189}
169 190
170void KOJournalView::showDates(const QDate &start, const QDate &) 191void KOJournalView::showDates(const QDate &start, const QDate &)
171{ 192{
172 mDate = start; 193 mDate = start;
194 mDateLabel-> setText(KGlobal::locale()->formatDate(mDate));
173 QPtrList<Journal> jl = calendar()->journals4Date( start ); 195 QPtrList<Journal> jl = calendar()->journals4Date( start );
174 showList( jl ); 196 showList( jl );
175} 197}
176 198
177void KOJournalView::showEvents(QPtrList<Event>) 199void KOJournalView::showEvents(QPtrList<Event>)
178{ 200{
179 // After new creation of list view no events are selected. 201 // After new creation of list view no events are selected.
180// emit incidenceSelected( 0 ); 202// emit incidenceSelected( 0 );
181} 203}
182 204
183void KOJournalView::changeEventDisplay(Event *, int /*action*/) 205void KOJournalView::changeEventDisplay(Event *, int /*action*/)
184{ 206{
185 updateView(); 207 updateView();
186} 208}
187 209
188void KOJournalView::keyPressEvent ( QKeyEvent * e ) 210void KOJournalView::keyPressEvent ( QKeyEvent * e )
189{ 211{
190 //qDebug("keyPressEven "); 212 //qDebug("keyPressEven ");
191 if ( e->state() == Qt::ControlButton ) { 213 if ( e->state() == Qt::ControlButton ) {
192 if ( e->key () == Qt::Key_Right || e->key () == Qt::Key_Left ) 214 if ( e->key () == Qt::Key_Right || e->key () == Qt::Key_Left )
193 e->ignore(); 215 e->ignore();
194 } 216 }
195} 217}
diff --git a/korganizer/kojournalview.h b/korganizer/kojournalview.h
index 0437d95..331bdfa 100644
--- a/korganizer/kojournalview.h
+++ b/korganizer/kojournalview.h
@@ -1,77 +1,79 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23#ifndef _KOJOURNALVIEW_H 23#ifndef _KOJOURNALVIEW_H
24#define _KOJOURNALVIEW_H 24#define _KOJOURNALVIEW_H
25 25
26#include <korganizer/baseview.h> 26#include <korganizer/baseview.h>
27#include <qlayout.h> 27#include <qlayout.h>
28 28
29class JournalEntry; 29class JournalEntry;
30class QLabel;
30 31
31/** 32/**
32 * This class provides a journal view. 33 * This class provides a journal view.
33 34
34 * @short View for Journal components. 35 * @short View for Journal components.
35 * @author Cornelius Schumacher <schumacher@kde.org> 36 * @author Cornelius Schumacher <schumacher@kde.org>
36 * @see KOBaseView 37 * @see KOBaseView
37 */ 38 */
38class KOJournalView : public KOrg::BaseView 39class KOJournalView : public KOrg::BaseView
39{ 40{
40 Q_OBJECT 41 Q_OBJECT
41 public: 42 public:
42 KOJournalView(Calendar *calendar, QWidget *parent = 0, 43 KOJournalView(Calendar *calendar, QWidget *parent = 0,
43 const char *name = 0); 44 const char *name = 0);
44 ~KOJournalView(); 45 ~KOJournalView();
45 46
46 virtual int currentDateCount(); 47 virtual int currentDateCount();
47 void clearList(); 48 void clearList();
48 virtual QPtrList<Incidence> selectedIncidences(); 49 virtual QPtrList<Incidence> selectedIncidences();
49 DateList selectedDates() 50 DateList selectedDates()
50 {DateList q; 51 {DateList q;
51 return q;}; 52 return q;};
52 signals: 53 signals:
53 void deleteJournal(Journal *); 54 void deleteJournal(Journal *);
54 public slots: 55 public slots:
55 void showOnly ( Journal* ); 56 void showOnly ( Journal* );
56 void newJournal(); 57 void newJournal();
57 void updateView(); 58 void updateView();
58 void flushView(); 59 void flushView();
59 void updateConfig(); 60 void updateConfig();
60 void showDates( const QDate &start, const QDate &end ); 61 void showDates( const QDate &start, const QDate &end );
61 void showEvents(QPtrList<Event> eventList); 62 void showEvents(QPtrList<Event> eventList);
62 63
63 void changeEventDisplay(Event *, int); 64 void changeEventDisplay(Event *, int);
64 65
65 private: 66 private:
66 void showList(QPtrList<Journal> jl); 67 void showList(QPtrList<Journal> jl);
67 Calendar *mCalendar; 68 Calendar *mCalendar;
68 JournalEntry* getNewEntry(); 69 JournalEntry* getNewEntry();
69 QPtrList<JournalEntry> jEntries; 70 QPtrList<JournalEntry> jEntries;
70 void keyPressEvent ( QKeyEvent * ) ; 71 void keyPressEvent ( QKeyEvent * ) ;
71 QBoxLayout *mTopLayout; 72 QBoxLayout *mTopLayout;
72 QWidget *parWid; 73 QWidget *parWid;
74 QLabel * mDateLabel;
73 QDate mDate; 75 QDate mDate;
74 76
75}; 77};
76 78
77#endif 79#endif
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index 22d9ac0..0c1ac7a 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -122,196 +122,202 @@ bool ListItemVisitor::visit(Event *e)
122 mItem->setText(2,"---"); 122 mItem->setText(2,"---");
123 else 123 else
124 mItem->setText(2,e->dtStartTimeStr()); 124 mItem->setText(2,e->dtStartTimeStr());
125 mItem->setText(3,end); 125 mItem->setText(3,end);
126 if ( e->doesFloat() ) 126 if ( e->doesFloat() )
127 mItem->setText(4,"---"); 127 mItem->setText(4,"---");
128 else 128 else
129 mItem->setText(4,e->dtEndTimeStr()); 129 mItem->setText(4,e->dtEndTimeStr());
130 if ( e->isAlarmEnabled() ) { 130 if ( e->isAlarmEnabled() ) {
131 mItem->setText(5,e->alarms().first()->offsetText() ); 131 mItem->setText(5,e->alarms().first()->offsetText() );
132 } else { 132 } else {
133 mItem->setText(5, i18n("No")); 133 mItem->setText(5, i18n("No"));
134 } 134 }
135 mItem->setText(6, e->recurrence()->recurrenceText()); 135 mItem->setText(6, e->recurrence()->recurrenceText());
136 if( ! e->doesRecur() ) 136 if( ! e->doesRecur() )
137 mItem->setSortKey( 6, "-" ); 137 mItem->setSortKey( 6, "-" );
138 mItem->setText(7,"---"); 138 mItem->setText(7,"---");
139 mItem->setText(8,"---"); 139 mItem->setText(8,"---");
140 mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No")); 140 mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No"));
141 mItem->setText(10,e->categoriesStr()); 141 mItem->setText(10,e->categoriesStr());
142 mItem->setText(11, KOPrefs::instance()->calName( e->calID() )); 142 mItem->setText(11, KOPrefs::instance()->calName( e->calID() ));
143 143
144 QString key; 144 QString key;
145 QTime t = e->doesFloat() ? QTime(0,0) : e->dtStart().time(); 145 QTime t = e->doesFloat() ? QTime(0,0) : e->dtStart().time();
146 key.sprintf("%04d%02d%02d%02d%02d",ds.year(),ds.month(),ds.day(),t.hour(),t.minute()); 146 key.sprintf("%04d%02d%02d%02d%02d",ds.year(),ds.month(),ds.day(),t.hour(),t.minute());
147 mItem->setSortKey(1,key); 147 mItem->setSortKey(1,key);
148 148
149 t = e->doesFloat() ? QTime(0,0) : e->dtEnd().time(); 149 t = e->doesFloat() ? QTime(0,0) : e->dtEnd().time();
150 key.sprintf("%04d%02d%02d%02d%02d",de.year(),de.month(),de.day(),t.hour(),t.minute()); 150 key.sprintf("%04d%02d%02d%02d%02d",de.year(),de.month(),de.day(),t.hour(),t.minute());
151 mItem->setSortKey(3,key); 151 mItem->setSortKey(3,key);
152 return true; 152 return true;
153} 153}
154 154
155bool ListItemVisitor::visit(Todo *t) 155bool ListItemVisitor::visit(Todo *t)
156{ 156{
157 mItem->setText(0,t->summary()); 157 mItem->setText(0,t->summary());
158 if ( t->isCompleted() ) { 158 if ( t->isCompleted() ) {
159 mItem->setSortKey(0,"99"+ t->summary().left(10)); 159 mItem->setSortKey(0,"99"+ t->summary().left(10));
160 } else 160 } else
161 mItem->setSortKey(0,QString::number( t->percentComplete() )+ t->summary().left(10)); 161 mItem->setSortKey(0,QString::number( t->percentComplete() )+ t->summary().left(10));
162 mItem->setPixmap( 0, *(sgListViewCompletedPix[t->percentComplete()/20])); 162 mItem->setPixmap( 0, *(sgListViewCompletedPix[t->percentComplete()/20]));
163 if (t->hasStartDate()) { 163 if (t->hasStartDate()) {
164 mItem->setText(1,t->dtStartDateStr()); 164 mItem->setText(1,t->dtStartDateStr());
165 if (t->doesFloat()) { 165 if (t->doesFloat()) {
166 mItem->setText(2,"---"); 166 mItem->setText(2,"---");
167 } else { 167 } else {
168 mItem->setText(2,t->dtStartTimeStr()); 168 mItem->setText(2,t->dtStartTimeStr());
169 } 169 }
170 } else { 170 } else {
171 mItem->setText(1,"---"); 171 mItem->setText(1,"---");
172 mItem->setText(2,"---"); 172 mItem->setText(2,"---");
173 } 173 }
174 mItem->setText(3,"---"); 174 mItem->setText(3,"---");
175 mItem->setText(4,"---"); 175 mItem->setText(4,"---");
176 if ( t->isAlarmEnabled() ) { 176 if ( t->isAlarmEnabled() ) {
177 mItem->setText(5,t->alarms().first()->offsetText() ); 177 mItem->setText(5,t->alarms().first()->offsetText() );
178 } else { 178 } else {
179 mItem->setText(5, i18n("No")); 179 mItem->setText(5, i18n("No"));
180 } 180 }
181 mItem->setText(6, t->recurrence()->recurrenceText()); 181 mItem->setText(6, t->recurrence()->recurrenceText());
182 if( ! t->doesRecur() ) 182 if( ! t->doesRecur() )
183 mItem->setSortKey( 6, "-" ); 183 mItem->setSortKey( 6, "-" );
184 if (t->hasDueDate()) { 184 if (t->hasDueDate()) {
185 mItem->setText(7,t->dtDueDateStr()); 185 mItem->setText(7,t->dtDueDateStr());
186 if (t->doesFloat()) { 186 if (t->doesFloat()) {
187 mItem->setText(8,"---"); 187 mItem->setText(8,"---");
188 } else { 188 } else {
189 mItem->setText(8,t->dtDueTimeStr()); 189 mItem->setText(8,t->dtDueTimeStr());
190 } 190 }
191 } else { 191 } else {
192 mItem->setText(7,"---"); 192 mItem->setText(7,"---");
193 mItem->setText(8,"---"); 193 mItem->setText(8,"---");
194 } 194 }
195 mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No")); 195 mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No"));
196 mItem->setText(10,t->categoriesStr()); 196 mItem->setText(10,t->categoriesStr());
197 mItem->setText(11, KOPrefs::instance()->calName( t->calID() )); 197 mItem->setText(11, KOPrefs::instance()->calName( t->calID() ));
198 198
199 QString key; 199 QString key;
200 QDate d; 200 QDate d;
201 if (t->hasDueDate()) { 201 if (t->hasDueDate()) {
202 d = t->dtDue().date(); 202 d = t->dtDue().date();
203 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time(); 203 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time();
204 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); 204 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute());
205 mItem->setSortKey(7,key); 205 mItem->setSortKey(7,key);
206 } 206 }
207 if ( t->hasStartDate() ) { 207 if ( t->hasStartDate() ) {
208 d = t->dtStart().date(); 208 d = t->dtStart().date();
209 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time(); 209 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time();
210 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); 210 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute());
211 mItem->setSortKey(1,key); 211 mItem->setSortKey(1,key);
212 } 212 }
213 return true; 213 return true;
214} 214}
215 215
216bool ListItemVisitor::visit(Journal * j) 216bool ListItemVisitor::visit(Journal * j)
217{ 217{
218 QString des = j->description().left(30); 218
219 des = des.simplifyWhiteSpace (); 219 QString des;
220 des.replace (QRegExp ("\\n"),"" ); 220 if ( !j->summary().isEmpty() ) {
221 des.replace (QRegExp ("\\r"),"" ); 221 des = j->summary();
222 } else {
223 des = j->description().left(30);
224 des = des.simplifyWhiteSpace ();
225 des.replace (QRegExp ("\\n"),"" );
226 des.replace (QRegExp ("\\r"),"" );
227 }
222 mItem->setText(0,i18n("Journal: ")+des.left(25)); 228 mItem->setText(0,i18n("Journal: ")+des.left(25));
223 mItem->setText(1,j->dtStartDateStr()); 229 mItem->setText(1,j->dtStartDateStr());
224 mItem->setText(2,"---"); 230 mItem->setText(2,"---");
225 mItem->setText(3,"---"); 231 mItem->setText(3,"---");
226 mItem->setText(4,"---"); 232 mItem->setText(4,"---");
227 mItem->setText(5,"---"); 233 mItem->setText(5,"---");
228 mItem->setText(6,"---"); 234 mItem->setText(6,"---");
229 mItem->setText(7,j->dtStartDateStr()); 235 mItem->setText(7,j->dtStartDateStr());
230 mItem->setText(8,"---"); 236 mItem->setText(8,"---");
231 mItem->setText(9,"---"); 237 mItem->setText(9,"---");
232 mItem->setText(10,i18n("Last Modified: ")+ KGlobal::locale()->formatDateTime( j->lastModified() , true) ); 238 mItem->setText(10,i18n("Last Modified: ")+ KGlobal::locale()->formatDateTime( j->lastModified() , true) );
233 mItem->setText(11, KOPrefs::instance()->calName( j->calID() )); 239 mItem->setText(11, KOPrefs::instance()->calName( j->calID() ));
234 240
235 QString key; 241 QString key;
236 QDate d = j->dtStart().date(); 242 QDate d = j->dtStart().date();
237 key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); 243 key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day());
238 mItem->setSortKey(1,key); 244 mItem->setSortKey(1,key);
239 mItem->setSortKey(7,key); 245 mItem->setSortKey(7,key);
240 246
241 return true; 247 return true;
242} 248}
243 249
244KOListView::KOListView(Calendar *calendar, QWidget *parent, 250KOListView::KOListView(Calendar *calendar, QWidget *parent,
245 const char *name) 251 const char *name)
246 : KOEventView(calendar, parent, name) 252 : KOEventView(calendar, parent, name)
247{ 253{
248 254
249 mActiveItem = 0; 255 mActiveItem = 0;
250 mForceShowCompletedTodos = false; 256 mForceShowCompletedTodos = false;
251 mListView = new KOListViewListView(this); 257 mListView = new KOListViewListView(this);
252 mListView->addColumn(i18n("Summary")); 258 mListView->addColumn(i18n("Summary"));
253 mListView->addColumn(i18n("Start Date")); 259 mListView->addColumn(i18n("Start Date"));
254 mListView->addColumn(i18n("Start Time")); 260 mListView->addColumn(i18n("Start Time"));
255 mListView->addColumn(i18n("End Date")); 261 mListView->addColumn(i18n("End Date"));
256 mListView->addColumn(i18n("End Time")); 262 mListView->addColumn(i18n("End Time"));
257 mListView->addColumn(i18n("Alarm")); // alarm set? 263 mListView->addColumn(i18n("Alarm")); // alarm set?
258 mListView->addColumn(i18n("Recurs")); // recurs? 264 mListView->addColumn(i18n("Recurs")); // recurs?
259 mListView->addColumn(i18n("Due Date")); 265 mListView->addColumn(i18n("Due Date"));
260 mListView->addColumn(i18n("Due Time")); 266 mListView->addColumn(i18n("Due Time"));
261 mListView->addColumn(i18n("Cancelled")); 267 mListView->addColumn(i18n("Cancelled"));
262 mListView->addColumn(i18n("Categories")); 268 mListView->addColumn(i18n("Categories"));
263 mListView->addColumn(i18n("Calendar")); 269 mListView->addColumn(i18n("Calendar"));
264 270
265 mListView->setColumnAlignment(0,AlignLeft); 271 mListView->setColumnAlignment(0,AlignLeft);
266 mListView->setColumnAlignment(1,AlignLeft); 272 mListView->setColumnAlignment(1,AlignLeft);
267 mListView->setColumnAlignment(2,AlignHCenter); 273 mListView->setColumnAlignment(2,AlignHCenter);
268 mListView->setColumnAlignment(3,AlignLeft); 274 mListView->setColumnAlignment(3,AlignLeft);
269 mListView->setColumnAlignment(4,AlignHCenter); 275 mListView->setColumnAlignment(4,AlignHCenter);
270 mListView->setColumnAlignment(5,AlignLeft); 276 mListView->setColumnAlignment(5,AlignLeft);
271 mListView->setColumnAlignment(6,AlignLeft); 277 mListView->setColumnAlignment(6,AlignLeft);
272 mListView->setColumnAlignment(7,AlignLeft); 278 mListView->setColumnAlignment(7,AlignLeft);
273 mListView->setColumnAlignment(8,AlignLeft); 279 mListView->setColumnAlignment(8,AlignLeft);
274 mListView->setColumnAlignment(9,AlignLeft); 280 mListView->setColumnAlignment(9,AlignLeft);
275 mListView->setColumnAlignment(10,AlignLeft); 281 mListView->setColumnAlignment(10,AlignLeft);
276 mListView->setColumnAlignment(11,AlignLeft); 282 mListView->setColumnAlignment(11,AlignLeft);
277 mKOListViewWhatsThis = new KOListViewWhatsThis(mListView->viewport(),this); 283 mKOListViewWhatsThis = new KOListViewWhatsThis(mListView->viewport(),this);
278 284
279 int iii = 0; 285 int iii = 0;
280 for ( iii = 0; iii< 12 ; ++iii ) 286 for ( iii = 0; iii< 12 ; ++iii )
281 mListView->setColumnWidthMode( iii, QListView::Manual ); 287 mListView->setColumnWidthMode( iii, QListView::Manual );
282 288
283 QBoxLayout *layoutTop = new QVBoxLayout(this); 289 QBoxLayout *layoutTop = new QVBoxLayout(this);
284 layoutTop->addWidget(mListView); 290 layoutTop->addWidget(mListView);
285 mListView->setFont ( KOPrefs::instance()->mListViewFont ); 291 mListView->setFont ( KOPrefs::instance()->mListViewFont );
286 mPopupMenu = eventPopup(); 292 mPopupMenu = eventPopup();
287 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 293 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
288 i18n("Select all"),this, 294 i18n("Select all"),this,
289 SLOT(allSelection()),true); 295 SLOT(allSelection()),true);
290 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 296 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
291 i18n("Deselect all"),this, 297 i18n("Deselect all"),this,
292 SLOT(clearSelection()),true); 298 SLOT(clearSelection()),true);
293 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 299 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
294 i18n("Delete all selected"),this, 300 i18n("Delete all selected"),this,
295 SLOT(deleteAll()),true); 301 SLOT(deleteAll()),true);
296 302
297 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 303 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
298 i18n("Hide all selected"),this, 304 i18n("Hide all selected"),this,
299 SLOT(hideAll()),true); 305 SLOT(hideAll()),true);
300 306
301 mPopupMenu->insertSeparator(); 307 mPopupMenu->insertSeparator();
302#ifdef DESKTOP_VERSION 308#ifdef DESKTOP_VERSION
303 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 309 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
304 i18n("Print complete list"),this, 310 i18n("Print complete list"),this,
305 SLOT(printList()),true); 311 SLOT(printList()),true);
306 mPopupMenu->insertSeparator(); 312 mPopupMenu->insertSeparator();
307#endif 313#endif
308 mCalPopup = new QPopupMenu ( this ); 314 mCalPopup = new QPopupMenu ( this );
309 mPopupMenu->insertItem( i18n("Set Calendar"), mCalPopup ); 315 mPopupMenu->insertItem( i18n("Set Calendar"), mCalPopup );
310 316
311 QObject::connect(mCalPopup,SIGNAL(aboutToShow()),this, 317 QObject::connect(mCalPopup,SIGNAL(aboutToShow()),this,
312 SLOT( populateCalPopup() )); 318 SLOT( populateCalPopup() ));
313 QObject::connect(mCalPopup,SIGNAL(activated( int )),this, 319 QObject::connect(mCalPopup,SIGNAL(activated( int )),this,
314 SLOT( setCalendar( int ) )); 320 SLOT( setCalendar( int ) ));
315 QPopupMenu * exportPO = new QPopupMenu ( this ); 321 QPopupMenu * exportPO = new QPopupMenu ( this );
316 mPopupMenu->insertItem( i18n("Export selected"), exportPO ); 322 mPopupMenu->insertItem( i18n("Export selected"), exportPO );
317 exportPO->insertItem( i18n("As iCal (ics) file..."),this, 323 exportPO->insertItem( i18n("As iCal (ics) file..."),this,
diff --git a/korganizer/searchdialog.cpp b/korganizer/searchdialog.cpp
index 0e9f64c..72359df 100644
--- a/korganizer/searchdialog.cpp
+++ b/korganizer/searchdialog.cpp
@@ -125,192 +125,195 @@ SearchDialog::SearchDialog(Calendar *calendar,CalendarView *parent)
125 125
126 QWidget *rangeWidget = new QWidget(topFrame); 126 QWidget *rangeWidget = new QWidget(topFrame);
127 QHBoxLayout *rangeLayout = new QHBoxLayout(rangeWidget,0,KDialog::spacingHint()); 127 QHBoxLayout *rangeLayout = new QHBoxLayout(rangeWidget,0,KDialog::spacingHint());
128 rangeLayout->addWidget(new QLabel(i18n("From:"),rangeWidget)); 128 rangeLayout->addWidget(new QLabel(i18n("From:"),rangeWidget));
129 mStartDate = new KDateEdit(rangeWidget); 129 mStartDate = new KDateEdit(rangeWidget);
130 rangeLayout->addWidget(mStartDate); 130 rangeLayout->addWidget(mStartDate);
131 rangeLayout->addWidget(new QLabel(i18n("To:"),rangeWidget)); 131 rangeLayout->addWidget(new QLabel(i18n("To:"),rangeWidget));
132 mEndDate = new KDateEdit(rangeWidget); 132 mEndDate = new KDateEdit(rangeWidget);
133 mEndDate->setDate(QDate::currentDate().addDays(365)); 133 mEndDate->setDate(QDate::currentDate().addDays(365));
134 rangeLayout->addWidget(mEndDate); 134 rangeLayout->addWidget(mEndDate);
135 QToolButton *wt = QWhatsThis::whatsThisButton ( rangeWidget ); 135 QToolButton *wt = QWhatsThis::whatsThisButton ( rangeWidget );
136 rangeLayout->addWidget( (QWidget*)wt ); 136 rangeLayout->addWidget( (QWidget*)wt );
137 layout->addWidget(rangeWidget); 137 layout->addWidget(rangeWidget);
138 // Results list view 138 // Results list view
139 listView = new KOListView(mCalendar,topFrame); 139 listView = new KOListView(mCalendar,topFrame);
140 layout->addWidget(listView); 140 layout->addWidget(listView);
141 listView->showCompletedTodos(); 141 listView->showCompletedTodos();
142 //layout->setStretchFactor( listView, 333 ); 142 //layout->setStretchFactor( listView, 333 );
143 //listView->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Expanding) ); 143 //listView->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Expanding) );
144 //listView->setMaximumHeight( 50 ); 144 //listView->setMaximumHeight( 50 );
145 listView->readSettings(KOGlobals::config(),"SearchListView Layout"); 145 listView->readSettings(KOGlobals::config(),"SearchListView Layout");
146 connect(searchEdit,SIGNAL(scrollDOWN()),SLOT(setFocusToList())); 146 connect(searchEdit,SIGNAL(scrollDOWN()),SLOT(setFocusToList()));
147 147
148 setCaption( i18n("KO/Pi Find: ")); 148 setCaption( i18n("KO/Pi Find: "));
149#ifdef DESKTOP_VERSION 149#ifdef DESKTOP_VERSION
150 OkButton = new QPushButton( i18n("Close"), this ); 150 OkButton = new QPushButton( i18n("Close"), this );
151 connect(OkButton,SIGNAL(clicked()),SLOT(hide())); 151 connect(OkButton,SIGNAL(clicked()),SLOT(hide()));
152#endif 152#endif
153} 153}
154 154
155SearchDialog::~SearchDialog() 155SearchDialog::~SearchDialog()
156{ 156{
157 157
158} 158}
159void SearchDialog::slot_add( bool b ) 159void SearchDialog::slot_add( bool b )
160{ 160{
161 if ( b ) { 161 if ( b ) {
162 if ( mSubItems->isOn() ) mSubItems->toggle(); 162 if ( mSubItems->isOn() ) mSubItems->toggle();
163 if ( mRefineItems->isOn() ) mRefineItems->toggle(); 163 if ( mRefineItems->isOn() ) mRefineItems->toggle();
164 setCaption( i18n("Matching items will be added to list")); 164 setCaption( i18n("Matching items will be added to list"));
165 } else 165 } else
166 setCaption( i18n("List will be cleared before search")); 166 setCaption( i18n("List will be cleared before search"));
167} 167}
168void SearchDialog::slot_sub( bool b) 168void SearchDialog::slot_sub( bool b)
169{ 169{
170 if ( b ) { 170 if ( b ) {
171 if ( mRefineItems->isOn() ) mRefineItems->toggle(); 171 if ( mRefineItems->isOn() ) mRefineItems->toggle();
172 if ( mAddItems->isOn() ) mAddItems->toggle(); 172 if ( mAddItems->isOn() ) mAddItems->toggle();
173 setCaption( i18n("Matching items will be removed from list")); 173 setCaption( i18n("Matching items will be removed from list"));
174 } else 174 } else
175 setCaption( i18n("List will be cleared before search")); 175 setCaption( i18n("List will be cleared before search"));
176} 176}
177void SearchDialog::slot_refine( bool b) 177void SearchDialog::slot_refine( bool b)
178{ 178{
179 if ( b ) { 179 if ( b ) {
180 if ( mSubItems->isOn() ) mSubItems->toggle(); 180 if ( mSubItems->isOn() ) mSubItems->toggle();
181 if ( mAddItems->isOn() ) mAddItems->toggle(); 181 if ( mAddItems->isOn() ) mAddItems->toggle();
182 setCaption( i18n("Search on displayed list only")); 182 setCaption( i18n("Search on displayed list only"));
183 } else 183 } else
184 setCaption( i18n("List will be cleared before search")); 184 setCaption( i18n("List will be cleared before search"));
185} 185}
186void SearchDialog::toggleCheckboxes() 186void SearchDialog::toggleCheckboxes()
187{ 187{
188 if ( incidenceGroup->isVisible() ) { 188 if ( incidenceGroup->isVisible() ) {
189 incidenceGroup->hide() ; 189 incidenceGroup->hide() ;
190 subjectGroup->hide() ; 190 subjectGroup->hide() ;
191 attendeeGroup->hide() ; 191 attendeeGroup->hide() ;
192 } else { 192 } else {
193 incidenceGroup->show() ; 193 incidenceGroup->show() ;
194 subjectGroup->show() ; 194 subjectGroup->show() ;
195 attendeeGroup->show() ; 195 attendeeGroup->show() ;
196 } 196 }
197} 197}
198void SearchDialog::raiseAndSelect() 198void SearchDialog::raiseAndSelect()
199{ 199{
200 200
201 static int currentState = 0; 201 static int currentState = 0;
202 202
203 if ( !mSearchJournal->isChecked() && !mSearchTodo->isChecked() && !mSearchEvent->isChecked() ) 203 if ( !mSearchJournal->isChecked() && !mSearchTodo->isChecked() && !mSearchEvent->isChecked() )
204 currentState = 0; 204 currentState = 0;
205 int newState = 0; 205 int newState = 0;
206 if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) { 206 if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) {
207 newState = VIEW_J_VIEW; 207 newState = VIEW_J_VIEW;
208 } 208 }
209 else if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) { 209 else if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) {
210 newState = VIEW_T_VIEW; 210 newState = VIEW_T_VIEW;
211 } 211 }
212 else { 212 else {
213 newState = VIEW_A_VIEW; 213 newState = VIEW_A_VIEW;
214 } 214 }
215 if ( newState != currentState ) { 215 if ( newState != currentState ) {
216 if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) { 216 if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) {
217 if ( ! mSearchJournal->isChecked() ) { 217 if ( ! mSearchJournal->isChecked() ) {
218 mSearchJournal->setChecked( true ); 218 mSearchJournal->setChecked( true );
219 mSearchTodo->setChecked( false ); 219 mSearchTodo->setChecked( false );
220 mSearchEvent->setChecked( false ); 220 mSearchEvent->setChecked( false );
221 mSummaryCheck->setChecked( true );
222 mDescriptionCheck->setChecked( true );
223
221 } 224 }
222 } 225 }
223 else if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) { 226 else if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) {
224 if ( ! mSearchTodo->isChecked() ) { 227 if ( ! mSearchTodo->isChecked() ) {
225 mSearchTodo->setChecked( true ); 228 mSearchTodo->setChecked( true );
226 mSearchJournal->setChecked( false ); 229 mSearchJournal->setChecked( false );
227 mSearchEvent->setChecked( false ); 230 mSearchEvent->setChecked( false );
228 } 231 }
229 } 232 }
230 else { 233 else {
231 if ( ! mSearchEvent->isChecked() ) { 234 if ( ! mSearchEvent->isChecked() ) {
232 mSearchEvent->setChecked( true ); 235 mSearchEvent->setChecked( true );
233 mSearchJournal->setChecked( false ); 236 mSearchJournal->setChecked( false );
234 mSearchTodo->setChecked( false ); 237 mSearchTodo->setChecked( false );
235 } 238 }
236 } 239 }
237 } 240 }
238 currentState = newState; 241 currentState = newState;
239 raise(); 242 raise();
240} 243}
241void SearchDialog::setFocusToList() 244void SearchDialog::setFocusToList()
242{ 245{
243 listView->resetFocus(); 246 listView->resetFocus();
244} 247}
245void SearchDialog::accept() 248void SearchDialog::accept()
246{ 249{
247 doSearch(); 250 doSearch();
248} 251}
249void SearchDialog::updateList() 252void SearchDialog::updateList()
250{ 253{
251 //listView->updateList(); 254 //listView->updateList();
252 if ( isVisible() ) { 255 if ( isVisible() ) {
253 updateView(); 256 updateView();
254 //qDebug("SearchDialog::updated "); 257 //qDebug("SearchDialog::updated ");
255 } 258 }
256 else { 259 else {
257 listView->clear(); 260 listView->clear();
258 //qDebug("SearchDialog::cleared "); 261 //qDebug("SearchDialog::cleared ");
259 262
260 } 263 }
261} 264}
262void SearchDialog::searchTextChanged( const QString &_text ) 265void SearchDialog::searchTextChanged( const QString &_text )
263{ 266{
264#if 0 267#if 0
265 enableButton( KDialogBase::User1, !_text.isEmpty() ); 268 enableButton( KDialogBase::User1, !_text.isEmpty() );
266#endif 269#endif
267} 270}
268 271
269void SearchDialog::doSearch() 272void SearchDialog::doSearch()
270{ 273{
271 QRegExp re; 274 QRegExp re;
272 re.setWildcard(true); // most people understand these better. 275 re.setWildcard(true); // most people understand these better.
273 re.setCaseSensitive(false); 276 re.setCaseSensitive(false);
274 QString st = searchEdit->text(); 277 QString st = searchEdit->text();
275 if ( st.right(1) != "*") 278 if ( st.right(1) != "*")
276 st += "*"; 279 st += "*";
277 re.setPattern(st); 280 re.setPattern(st);
278 if (!mSearchEvent->isChecked() && !mSearchTodo->isChecked() && !mSearchJournal->isChecked() ) { 281 if (!mSearchEvent->isChecked() && !mSearchTodo->isChecked() && !mSearchJournal->isChecked() ) {
279 KMessageBox::sorry(this, 282 KMessageBox::sorry(this,
280 i18n("Please select at least one\nof the types to search for:\n\nEvents\nTodos\nJournals")); 283 i18n("Please select at least one\nof the types to search for:\n\nEvents\nTodos\nJournals"));
281 return; 284 return;
282 } 285 }
283 if (!re.isValid() ) { 286 if (!re.isValid() ) {
284 KMessageBox::sorry(this, 287 KMessageBox::sorry(this,
285 i18n("Invalid search expression,\ncannot perform " 288 i18n("Invalid search expression,\ncannot perform "
286 "the search.\nPlease enter a search expression\n" 289 "the search.\nPlease enter a search expression\n"
287 "using the wildcard characters\n '*' and '?'" 290 "using the wildcard characters\n '*' and '?'"
288 "where needed.")); 291 "where needed."));
289 return; 292 return;
290 } 293 }
291 search(re); 294 search(re);
292 listView->setStartDate( mStartDate->date() ); 295 listView->setStartDate( mStartDate->date() );
293 listView->showEvents(mMatchedEvents); 296 listView->showEvents(mMatchedEvents);
294 listView->addTodos(mMatchedTodos); 297 listView->addTodos(mMatchedTodos);
295 listView->addJournals(mMatchedJournals); 298 listView->addJournals(mMatchedJournals);
296 if (mMatchedEvents.count() + mMatchedJournals.count() + mMatchedTodos.count() == 0) { 299 if (mMatchedEvents.count() + mMatchedJournals.count() + mMatchedTodos.count() == 0) {
297 setCaption(i18n("No items found. Use '*' and '?' where needed.")); 300 setCaption(i18n("No items found. Use '*' and '?' where needed."));
298 } else { 301 } else {
299 QString mess; 302 QString mess;
300 mess = mess.sprintf( i18n("%d item(s) found."), mMatchedEvents.count()+ mMatchedJournals.count() + mMatchedTodos.count() ); 303 mess = mess.sprintf( i18n("%d item(s) found."), mMatchedEvents.count()+ mMatchedJournals.count() + mMatchedTodos.count() );
301 setCaption( i18n("KO/Pi Find: ") + mess); 304 setCaption( i18n("KO/Pi Find: ") + mess);
302 305
303 } 306 }
304 searchEdit->setFocus(); 307 searchEdit->setFocus();
305} 308}
306void SearchDialog::updateConfig() 309void SearchDialog::updateConfig()
307{ 310{
308 listView->updateConfig(); 311 listView->updateConfig();
309} 312}
310void SearchDialog::updateView() 313void SearchDialog::updateView()
311{ 314{
312 //qDebug("SearchDialog::updateView() %d ", isVisible()); 315 //qDebug("SearchDialog::updateView() %d ", isVisible());
313 QRegExp re; 316 QRegExp re;
314 re.setWildcard(true); // most people understand these better. 317 re.setWildcard(true); // most people understand these better.
315 re.setCaseSensitive(false); 318 re.setCaseSensitive(false);
316 QString st = searchEdit->text(); 319 QString st = searchEdit->text();
@@ -457,142 +460,158 @@ void SearchDialog::search(const QRegExp &re)
457 460
458 if ( mSearchTodo->isChecked() ) { 461 if ( mSearchTodo->isChecked() ) {
459 if ( !mRefineItems->isChecked() ) todos = mCalendar->todos( ); 462 if ( !mRefineItems->isChecked() ) todos = mCalendar->todos( );
460 Todo *tod; 463 Todo *tod;
461 for(tod=todos.first();tod;tod=todos.next()) { 464 for(tod=todos.first();tod;tod=todos.next()) {
462 if (mSummaryCheck->isChecked()) { 465 if (mSummaryCheck->isChecked()) {
463#if QT_VERSION >= 0x030000 466#if QT_VERSION >= 0x030000
464 if (re.search(tod->summary()) != -1) 467 if (re.search(tod->summary()) != -1)
465#else 468#else
466 if (re.match(tod->summary()) != -1) 469 if (re.match(tod->summary()) != -1)
467#endif 470#endif
468 { 471 {
469 if ( mSubItems->isChecked() ) 472 if ( mSubItems->isChecked() )
470 mMatchedTodos.remove(tod); 473 mMatchedTodos.remove(tod);
471 else if (!mMatchedTodos.contains( tod )) 474 else if (!mMatchedTodos.contains( tod ))
472 mMatchedTodos.append(tod); 475 mMatchedTodos.append(tod);
473 continue; 476 continue;
474 } 477 }
475 } 478 }
476 if (mDescriptionCheck->isChecked()) { 479 if (mDescriptionCheck->isChecked()) {
477#if QT_VERSION >= 0x030000 480#if QT_VERSION >= 0x030000
478 if (re.search(tod->description()) != -1) 481 if (re.search(tod->description()) != -1)
479#else 482#else
480 if (re.match(tod->description()) != -1) 483 if (re.match(tod->description()) != -1)
481#endif 484#endif
482 { 485 {
483 if ( mSubItems->isChecked() ) 486 if ( mSubItems->isChecked() )
484 mMatchedTodos.remove(tod); 487 mMatchedTodos.remove(tod);
485 else if (!mMatchedTodos.contains( tod )) 488 else if (!mMatchedTodos.contains( tod ))
486 mMatchedTodos.append(tod); 489 mMatchedTodos.append(tod);
487 continue; 490 continue;
488 } 491 }
489 } 492 }
490 if (mCategoryCheck->isChecked()) { 493 if (mCategoryCheck->isChecked()) {
491#if QT_VERSION >= 0x030000 494#if QT_VERSION >= 0x030000
492 if (re.search(tod->categoriesStr()) != -1) 495 if (re.search(tod->categoriesStr()) != -1)
493#else 496#else
494 if (re.match(tod->categoriesStr()) != -1) 497 if (re.match(tod->categoriesStr()) != -1)
495#endif 498#endif
496 { 499 {
497 if ( mSubItems->isChecked() ) 500 if ( mSubItems->isChecked() )
498 mMatchedTodos.remove(tod); 501 mMatchedTodos.remove(tod);
499 else if (!mMatchedTodos.contains( tod )) 502 else if (!mMatchedTodos.contains( tod ))
500 mMatchedTodos.append(tod); 503 mMatchedTodos.append(tod);
501 continue; 504 continue;
502 } 505 }
503 } 506 }
504 if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) { 507 if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) {
505 QPtrList<Attendee> tmpAList = tod->attendees(); 508 QPtrList<Attendee> tmpAList = tod->attendees();
506 Attendee *a; 509 Attendee *a;
507 for (a = tmpAList.first(); a; a = tmpAList.next()) { 510 for (a = tmpAList.first(); a; a = tmpAList.next()) {
508 if (mSearchAName->isChecked()) { 511 if (mSearchAName->isChecked()) {
509#if QT_VERSION >= 0x030000 512#if QT_VERSION >= 0x030000
510 if (re.search(a->name()) != -1) 513 if (re.search(a->name()) != -1)
511#else 514#else
512 if (re.match(a->name()) != -1) 515 if (re.match(a->name()) != -1)
513#endif 516#endif
514 { 517 {
515 if ( mSubItems->isChecked() ) 518 if ( mSubItems->isChecked() )
516 mMatchedTodos.remove(tod); 519 mMatchedTodos.remove(tod);
517 else if (!mMatchedTodos.contains( tod )) 520 else if (!mMatchedTodos.contains( tod ))
518 mMatchedTodos.append(tod); 521 mMatchedTodos.append(tod);
519 break; 522 break;
520 } 523 }
521 } 524 }
522 if (mSearchAEmail->isChecked()) { 525 if (mSearchAEmail->isChecked()) {
523#if QT_VERSION >= 0x030000 526#if QT_VERSION >= 0x030000
524 if (re.search(a->email()) != -1) 527 if (re.search(a->email()) != -1)
525#else 528#else
526 if (re.match(a->email()) != -1) 529 if (re.match(a->email()) != -1)
527#endif 530#endif
528 { 531 {
529 if ( mSubItems->isChecked() ) 532 if ( mSubItems->isChecked() )
530 mMatchedTodos.remove(tod); 533 mMatchedTodos.remove(tod);
531 else if (!mMatchedTodos.contains( tod )) 534 else if (!mMatchedTodos.contains( tod ))
532 mMatchedTodos.append(tod); 535 mMatchedTodos.append(tod);
533 break; 536 break;
534 } 537 }
535 } 538 }
536 } 539 }
537 } 540 }
538 } 541 }
539 } 542 }
540 543
541 QPtrList<Journal> journals; 544 QPtrList<Journal> journals;
542 if ( !mAddItems->isChecked() && !mSubItems->isChecked() ) { 545 if ( !mAddItems->isChecked() && !mSubItems->isChecked() ) {
543 if ( mRefineItems->isChecked() ) journals = mMatchedJournals ; 546 if ( mRefineItems->isChecked() ) journals = mMatchedJournals ;
544 mMatchedJournals.clear(); 547 mMatchedJournals.clear();
545 } 548 }
546 if (mSearchJournal->isChecked() ) { 549 if (mSearchJournal->isChecked() ) {
547 if ( ! mRefineItems->isChecked() ) journals = mCalendar->journals(); 550 if ( ! mRefineItems->isChecked() ) journals = mCalendar->journals();
548 Journal* journ; 551 Journal* journ;
549 552
550 for(journ=journals.first();journ;journ=journals.next()) { 553 for(journ=journals.first();journ;journ=journals.next()) {
551 if ( journ->dtStart().date() <= mEndDate->date() 554 if ( journ->dtStart().date() <= mEndDate->date()
552 &&journ->dtStart().date() >= mStartDate->date()) { 555 &&journ->dtStart().date() >= mStartDate->date()) {
556 if (mDescriptionCheck->isChecked()) {
553#if QT_VERSION >= 0x030000 557#if QT_VERSION >= 0x030000
554 if (re.search(journ->description()) != -1) 558 if (re.search(journ->description()) != -1)
555#else 559#else
556 if (re.match(journ->description()) != -1) 560 if (re.match(journ->description()) != -1)
557#endif 561#endif
558 { 562 {
559 if ( mSubItems->isChecked() ) 563 if ( mSubItems->isChecked() )
560 mMatchedJournals.remove(journ); 564 mMatchedJournals.remove(journ);
561 else if (!mMatchedJournals.contains( journ )) 565 else if (!mMatchedJournals.contains( journ ))
562 mMatchedJournals.append(journ); 566 mMatchedJournals.append(journ);
563 continue; 567 continue;
564 } 568 }
569 }
570 if (mSummaryCheck->isChecked()) {
571#if QT_VERSION >= 0x030000
572 if (re.search(journ->summary()) != -1)
573#else
574 if (re.match(journ->summary()) != -1)
575#endif
576 {
577 if ( mSubItems->isChecked() )
578 mMatchedJournals.remove(journ);
579 else if (!mMatchedJournals.contains( journ ))
580 mMatchedJournals.append(journ);
581 continue;
582 }
583 }
565 } 584 }
566 } 585 }
567 } 586 }
568 if ( mMatchedEvents.count() + mMatchedJournals.count() + mMatchedTodos.count() < 1 ) { 587 if ( mMatchedEvents.count() + mMatchedJournals.count() + mMatchedTodos.count() < 1 ) {
569 qDebug("count %d ", mMatchedEvents.count() + mMatchedJournals.count() + mMatchedTodos.count() ); 588 qDebug("count %d ", mMatchedEvents.count() + mMatchedJournals.count() + mMatchedTodos.count() );
570 if ( mRefineItems->isChecked() ) 589 if ( mRefineItems->isChecked() )
571 mRefineItems->setChecked( false ); 590 mRefineItems->setChecked( false );
572 else if ( mSubItems->isChecked() ) 591 else if ( mSubItems->isChecked() )
573 mSubItems->setChecked( false ); 592 mSubItems->setChecked( false );
574 } 593 }
575} 594}
576 595
577void SearchDialog::keyPressEvent ( QKeyEvent *e) 596void SearchDialog::keyPressEvent ( QKeyEvent *e)
578{ 597{
579 switch ( e->key() ) { 598 switch ( e->key() ) {
580 case Qt::Key_Escape: 599 case Qt::Key_Escape:
581 close(); 600 close();
582 break; 601 break;
583 case Qt::Key_F: 602 case Qt::Key_F:
584 if ( e->state() == Qt::ControlButton ) { 603 if ( e->state() == Qt::ControlButton ) {
585 604
586 } 605 }
587 break; 606 break;
588 case Qt::Key_Return: 607 case Qt::Key_Return:
589 case Qt::Key_Enter: 608 case Qt::Key_Enter:
590 doSearch(); 609 doSearch();
591 break; 610 break;
592 611
593 default: 612 default:
594 e->ignore(); 613 e->ignore();
595 } 614 }
596} 615}
597 616
598//mMatchedJournals; 617//mMatchedJournals;