summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/WhatsNew.txt4
-rw-r--r--korganizer/calendarview.cpp64
-rw-r--r--korganizer/koagenda.cpp4
-rw-r--r--korganizer/koagenda.h1
-rw-r--r--korganizer/komonthview.cpp5
5 files changed, 17 insertions, 61 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt
index 814c541..aa4a89a 100644
--- a/bin/kdepim/WhatsNew.txt
+++ b/bin/kdepim/WhatsNew.txt
@@ -1,105 +1,105 @@
1Info about the changes in new versions of KDE-Pim/Pi 1Info about the changes in new versions of KDE-Pim/Pi
2 2
3********** VERSION 2.1.14 ************ 3********** VERSION 2.1.14 ************
4 4
5Added some buttons to the KO/Pi Quick-todo line to make it possible to quickly access some todo view layout settings like display all flat/open/close and hide/show running/done. 5Added some buttons to the KO/Pi Quick-todo line to make it possible to quickly access some todo view layout settings like display all flat/open/close and hide/show running/done.
6Added a button to add a subtodo quickly. 6Added a button to add a subtodo quickly.
7 7
8Added a possibility to search for conflicting events. (In the Action menu. Keyboard shortcut "q" ). 8Added a possibility to search for conflicting events. (In the Action menu. Keyboard shortcut "q", shift+q or ctrl +q ).
9 9Added an option to change the layout of the list week to column mode.
10 10
11********** VERSION 2.1.13 ************ 11********** VERSION 2.1.13 ************
12 12
13Fixed a problem in KA/Pi search. 13Fixed a problem in KA/Pi search.
14Fixed some minor problems in KO/Pi. 14Fixed some minor problems in KO/Pi.
15Added calendar selection possibility to the todo view popup and to the event/todo/journal editor. 15Added calendar selection possibility to the todo view popup and to the event/todo/journal editor.
16 16
17Fixed memory usage problems in KA/Pi: 17Fixed memory usage problems in KA/Pi:
18When loading data KA/Pi did load the file data twice. 18When loading data KA/Pi did load the file data twice.
19Example: 19Example:
20 A 600k file did consume 1200k memory during loading process. 20 A 600k file did consume 1200k memory during loading process.
21 This is fixed, it does now consume only 600k during loading process. 21 This is fixed, it does now consume only 600k during loading process.
22When saving data KA/Pi did consume a lot of memory for the data parsing during the save process. 22When saving data KA/Pi did consume a lot of memory for the data parsing during the save process.
23This is fixed. 23This is fixed.
24Example: 24Example:
25 Before saving a 600k file KA/Pi did consume 21.7 Meg of Ram. 25 Before saving a 600k file KA/Pi did consume 21.7 Meg of Ram.
26 When saving KA/Pi did consume 28.6 Meg of Ram. That causes a crash on the Zaurus because there was no memeory left in the system. 26 When saving KA/Pi did consume 28.6 Meg of Ram. That causes a crash on the Zaurus because there was no memeory left in the system.
27 Now KA/Pi is consuming on saving the same data 22.0 Meg of Ram during the save process. 27 Now KA/Pi is consuming on saving the same data 22.0 Meg of Ram during the save process.
28Note: The memory usage of KA/Pi after the data is loaded/saved has not changed. 28Note: The memory usage of KA/Pi after the data is loaded/saved has not changed.
29The saving of data may be a bit slower now. 29The saving of data may be a bit slower now.
30 30
31Fixed memory usage problems in KO/Pi: 31Fixed memory usage problems in KO/Pi:
32When KO/Pi did save the data to file, it did not release the used buffers after saving. 32When KO/Pi did save the data to file, it did not release the used buffers after saving.
33The used buffer was released after saving the next time, but there was new buffer space allocated again on that save operation. 33The used buffer was released after saving the next time, but there was new buffer space allocated again on that save operation.
34This is fixed. 34This is fixed.
35Example: 35Example:
36 When saving a 400k file KO/Pi do now use 400k less memory now. 36 When saving a 400k file KO/Pi do now use 400k less memory now.
37 37
38Optimized memory usage in KO/Pi Agenda view: 38Optimized memory usage in KO/Pi Agenda view:
39KO/Pi is storing some paint information in extra buffers for faster repainting of the agenda view. 39KO/Pi is storing some paint information in extra buffers for faster repainting of the agenda view.
40These buffers were not made smaller (i.e. downsized) because of performance reasons. 40These buffers were not made smaller (i.e. downsized) because of performance reasons.
41The handling of these buffers are now much smarter: 41The handling of these buffers are now much smarter:
42Two (of six) buffers are removed completely. 42Two (of six) buffers are removed completely.
43The remaing four buffers are now downsized after not using the agenda view for 45 seconds. 43The remaing four buffers are now downsized after not using the agenda view for 45 seconds.
44Such that the memory usage of KO/Pi is smaller now in general ( because 2 buffers are removed) and is much smaller when not using the agenda view. That is very important when using fastload for KO/Pi. 44Such that the memory usage of KO/Pi is smaller now in general ( because 2 buffers are removed) and is much smaller when not using the agenda view. That is very important when using fastload for KO/Pi.
45 45
46Worst case example ( for a maximum size agenda content): 46Worst case example ( for a maximum size agenda content):
47 When resizing the agenda content to a large scale, KO/Pi did use 17Meg of mem ( and did not use less memory until it was stopped). Now KO/Pi is using on the same operation only 14.3 Meg of mem and after 45 seconds not using the agenda view it uses only 9.4 Meg of mem. 47 When resizing the agenda content to a large scale, KO/Pi did use 17Meg of mem ( and did not use less memory until it was stopped). Now KO/Pi is using on the same operation only 14.3 Meg of mem and after 45 seconds not using the agenda view it uses only 9.4 Meg of mem.
48 48
49When switching to an unused Agenda view now KO/Pi is upizing the buffers again. This takes less than a second. Such that switching to Agenda view (after not using it for more than 45 seconds) is now a bit slower. 49When switching to an unused Agenda view now KO/Pi is upizing the buffers again. This takes less than a second. Such that switching to Agenda view (after not using it for more than 45 seconds) is now a bit slower.
50 50
51Summary: 51Summary:
52Many memory wasting problems of KA/Pi and KO/Pi fixed such that it is better to use on the Zaurus. 52Many memory wasting problems of KA/Pi and KO/Pi fixed such that it is better to use on the Zaurus.
53 53
54********** VERSION 2.1.12 ************ 54********** VERSION 2.1.12 ************
55 55
56KO/Pi: 56KO/Pi:
57Many small usability fixes, e.g. rearranged the popup menus such that they are better to use on the Zaurus. 57Many small usability fixes, e.g. rearranged the popup menus such that they are better to use on the Zaurus.
58Fixed a problem with the month view when file was saved but KO/Pi was not the active window. 58Fixed a problem with the month view when file was saved but KO/Pi was not the active window.
59Fixed some problems in the resource config dialog (e.g. added a warning if you set all calendars to read-only). 59Fixed some problems in the resource config dialog (e.g. added a warning if you set all calendars to read-only).
60Fixed some other small problems. 60Fixed some other small problems.
61 61
62********** VERSION 2.1.11 ************ 62********** VERSION 2.1.11 ************
63 63
64KO/Pi: 64KO/Pi:
65Because we can have many calendars now in KO/Pi we can have more than one journal entry per day. 65Because we can have many calendars now in KO/Pi we can have more than one journal entry per day.
66Added features to handle (and add ) more than one journal entry per day. 66Added features to handle (and add ) more than one journal entry per day.
67Added option for a journal title. 67Added option for a journal title.
68 68
69Added info about the calendar, the item belongs to, to the event/todo/journal viewer. 69Added info about the calendar, the item belongs to, to the event/todo/journal viewer.
70Fixed a problem of the alarm of completed recurring todos. 70Fixed a problem of the alarm of completed recurring todos.
71Added to the event/todo editor to set quickly the category of an item. 71Added to the event/todo editor to set quickly the category of an item.
72 72
73 73
74Fixed some problems when calling KO/Pi or KA/Pi from the alarm applet. 74Fixed some problems when calling KO/Pi or KA/Pi from the alarm applet.
75 75
76Added KA/Pi multi sync to the multi sync called from the alarm applet. 76Added KA/Pi multi sync to the multi sync called from the alarm applet.
77 77
78********** VERSION 2.1.10 ************ 78********** VERSION 2.1.10 ************
79 79
80KO/Pi: 80KO/Pi:
81Importing Birthdays will now create another file resource "Birthdays" and import the birthday data from KA/Pi into that file. 81Importing Birthdays will now create another file resource "Birthdays" and import the birthday data from KA/Pi into that file.
82When a multidayevent is selected in monthview all occurences of this event in the monthview are now hightlighted. 82When a multidayevent is selected in monthview all occurences of this event in the monthview are now hightlighted.
83Fixed a bug in searching for a small timerange, i.e. one day. 83Fixed a bug in searching for a small timerange, i.e. one day.
84 84
85KA/Pi: 85KA/Pi:
86Fixed two problems in csv export. 86Fixed two problems in csv export.
87Fixed problems when calling the contact selection dialog from KO/Pi or OM/Pi. 87Fixed problems when calling the contact selection dialog from KO/Pi or OM/Pi.
88 88
89********** VERSION 2.1.9 ************ 89********** VERSION 2.1.9 ************
90 90
91KO/Pi: 91KO/Pi:
92Fixed some problems of the new search options in the search dialog. 92Fixed some problems of the new search options in the search dialog.
93Fixed some problems in the new resource config options. 93Fixed some problems in the new resource config options.
94Changed the recurrence edit of events and todos such that the recurrence edit page now is notified about a change of the start date on the first page. 94Changed the recurrence edit of events and todos such that the recurrence edit page now is notified about a change of the start date on the first page.
95Fixed a problem creating new events in the agenda view if at the day/time is already an agenda item shown: 95Fixed a problem creating new events in the agenda view if at the day/time is already an agenda item shown:
96Now you can click on the bottom/top of an allday agenda item or on the left/right side of an agenda item to get the "new todo/new event" popup. 96Now you can click on the bottom/top of an allday agenda item or on the left/right side of an agenda item to get the "new todo/new event" popup.
97 97
98Fixed a problem in recurrence range in syncing with DTM. 98Fixed a problem in recurrence range in syncing with DTM.
99 99
100KA/Pi: 100KA/Pi:
101Made it posiible to show in the contact overview the details of all data available for that contact( e.g. office, spouse, children, nickname ...) 101Made it posiible to show in the contact overview the details of all data available for that contact( e.g. office, spouse, children, nickname ...)
102 102
103PwM/Pi: 103PwM/Pi:
104Added "sec" to the timeout config settings to make it clear the timeout values are seconds. 104Added "sec" to the timeout config settings to make it clear the timeout values are seconds.
105 105
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 426e8f9..2582931 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -11,192 +11,193 @@
11 Laszlo Boloni (boloni@cs.purdue.edu) 11 Laszlo Boloni (boloni@cs.purdue.edu)
12 12
13 Copyright (c) 2000, 2001, 2002 13 Copyright (c) 2000, 2001, 2002
14 Cornelius Schumacher <schumacher@kde.org> 14 Cornelius Schumacher <schumacher@kde.org>
15 15
16 This program is free software; you can redistribute it and/or modify 16 This program is free software; you can redistribute it and/or modify
17 it under the terms of the GNU General Public License as published by 17 it under the terms of the GNU General Public License as published by
18 the Free Software Foundation; either version 2 of the License, or 18 the Free Software Foundation; either version 2 of the License, or
19 (at your option) any later version. 19 (at your option) any later version.
20 20
21 This program is distributed in the hope that it will be useful, 21 This program is distributed in the hope that it will be useful,
22 but WITHOUT ANY WARRANTY; without even the implied warranty of 22 but WITHOUT ANY WARRANTY; without even the implied warranty of
23 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the 23 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
24 GNU General Public License for more details. 24 GNU General Public License for more details.
25 25
26 You should have received a copy of the GNU General Public License 26 You should have received a copy of the GNU General Public License
27 along with this program; if not, write to the Free Software 27 along with this program; if not, write to the Free Software
28 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 28 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29*/ 29*/
30 30
31#include <stdlib.h> 31#include <stdlib.h>
32 32
33#include <qapplication.h> 33#include <qapplication.h>
34#include <qradiobutton.h> 34#include <qradiobutton.h>
35#include <qbuttongroup.h> 35#include <qbuttongroup.h>
36#include <qlayout.h> 36#include <qlayout.h>
37#include <qclipboard.h> 37#include <qclipboard.h>
38#include <qcursor.h> 38#include <qcursor.h>
39#include <qmessagebox.h> 39#include <qmessagebox.h>
40#include <qprogressbar.h> 40#include <qprogressbar.h>
41#include <qmultilineedit.h> 41#include <qmultilineedit.h>
42#include <qtimer.h> 42#include <qtimer.h>
43#include <qwidgetstack.h> 43#include <qwidgetstack.h>
44#include <qptrlist.h> 44#include <qptrlist.h>
45#include <qregexp.h> 45#include <qregexp.h>
46#include <qgroupbox.h> 46#include <qgroupbox.h>
47#include <qfile.h> 47#include <qfile.h>
48#include <qdir.h> 48#include <qdir.h>
49#ifndef KORG_NOSPLITTER 49#ifndef KORG_NOSPLITTER
50#include <qsplitter.h> 50#include <qsplitter.h>
51#endif 51#endif
52 52
53#include <kglobal.h> 53#include <kglobal.h>
54#include <kdebug.h> 54#include <kdebug.h>
55#include <kstandarddirs.h> 55#include <kstandarddirs.h>
56#include <kfiledialog.h> 56#include <kfiledialog.h>
57#include <kmessagebox.h> 57#include <kmessagebox.h>
58#include <knotifyclient.h> 58#include <knotifyclient.h>
59#include <kconfig.h> 59#include <kconfig.h>
60 60
61#include <libkdepim/ksyncprefsdialog.h> 61#include <libkdepim/ksyncprefsdialog.h>
62#include <krun.h> 62#include <krun.h>
63#include <kdirwatch.h> 63#include <kdirwatch.h>
64#include <libkdepim/kdatepicker.h> 64#include <libkdepim/kdatepicker.h>
65#include <libkdepim/ksyncprofile.h> 65#include <libkdepim/ksyncprofile.h>
66#include <libkdepim/kpimglobalprefs.h> 66#include <libkdepim/kpimglobalprefs.h>
67 67
68#include <libkcal/vcaldrag.h> 68#include <libkcal/vcaldrag.h>
69#include <libkcal/icaldrag.h> 69#include <libkcal/icaldrag.h>
70#include <libkcal/icalformat.h> 70#include <libkcal/icalformat.h>
71#include <libkcal/vcalformat.h> 71#include <libkcal/vcalformat.h>
72#include <libkcal/scheduler.h> 72#include <libkcal/scheduler.h>
73#include <libkcal/calendarlocal.h> 73#include <libkcal/calendarlocal.h>
74#include <libkcal/journal.h> 74#include <libkcal/journal.h>
75#include <libkcal/calfilter.h> 75#include <libkcal/calfilter.h>
76#include <libkcal/attendee.h> 76#include <libkcal/attendee.h>
77#include <libkcal/dndfactory.h> 77#include <libkcal/dndfactory.h>
78#include <libkcal/freebusy.h> 78#include <libkcal/freebusy.h>
79#include <libkcal/filestorage.h> 79#include <libkcal/filestorage.h>
80#include <libkcal/calendarresources.h> 80#include <libkcal/calendarresources.h>
81#include <libkcal/qtopiaformat.h> 81#include <libkcal/qtopiaformat.h>
82#include "../kalarmd/alarmdialog.h" 82#include "../kalarmd/alarmdialog.h"
83 83
84#ifndef DESKTOP_VERSION 84#ifndef DESKTOP_VERSION
85#include <libkcal/sharpformat.h> 85#include <libkcal/sharpformat.h>
86#include <externalapphandler.h> 86#include <externalapphandler.h>
87#endif 87#endif
88#include <libkcal/phoneformat.h> 88#include <libkcal/phoneformat.h>
89#ifndef KORG_NOMAIL 89#ifndef KORG_NOMAIL
90#include "komailclient.h" 90#include "komailclient.h"
91#endif 91#endif
92#ifndef KORG_NOPRINTER 92#ifndef KORG_NOPRINTER
93#include "calprinter.h" 93#include "calprinter.h"
94#endif 94#endif
95#ifndef KORG_NOPLUGINS 95#ifndef KORG_NOPLUGINS
96#include "kocore.h" 96#include "kocore.h"
97#endif 97#endif
98#include "koeventeditor.h" 98#include "koeventeditor.h"
99#include "kotodoeditor.h" 99#include "kotodoeditor.h"
100#include "koprefs.h" 100#include "koprefs.h"
101#include "koeventviewerdialog.h" 101#include "koeventviewerdialog.h"
102#include "publishdialog.h" 102#include "publishdialog.h"
103#include "kofilterview.h" 103#include "kofilterview.h"
104#include "koglobals.h" 104#include "koglobals.h"
105#include "koviewmanager.h" 105#include "koviewmanager.h"
106#include "koagendaview.h" 106#include "koagendaview.h"
107#include "koagenda.h"
107#include "kodialogmanager.h" 108#include "kodialogmanager.h"
108#include "outgoingdialog.h" 109#include "outgoingdialog.h"
109#include "incomingdialog.h" 110#include "incomingdialog.h"
110#include "datenavigatorcontainer.h" 111#include "datenavigatorcontainer.h"
111#include "statusdialog.h" 112#include "statusdialog.h"
112#include "kdatenavigator.h" 113#include "kdatenavigator.h"
113#include "kotodoview.h" 114#include "kotodoview.h"
114#include "datenavigator.h" 115#include "datenavigator.h"
115#include "resourceview.h" 116#include "resourceview.h"
116#include "navigatorbar.h" 117#include "navigatorbar.h"
117#include "searchdialog.h" 118#include "searchdialog.h"
118#include "mainwindow.h" 119#include "mainwindow.h"
119#include "categoryeditdialog.h" 120#include "categoryeditdialog.h"
120 121
121#include "calendarview.h" 122#include "calendarview.h"
122#ifndef DESKTOP_VERSION 123#ifndef DESKTOP_VERSION
123#include <qtopia/alarmserver.h> 124#include <qtopia/alarmserver.h>
124#endif 125#endif
125#ifndef _WIN32_ 126#ifndef _WIN32_
126#include <stdlib.h> 127#include <stdlib.h>
127#include <stdio.h> 128#include <stdio.h>
128#include <unistd.h> 129#include <unistd.h>
129#else 130#else
130#include <qprocess.h> 131#include <qprocess.h>
131#endif 132#endif
132 133
133#ifdef DESKTOP_VERSION 134#ifdef DESKTOP_VERSION
134#include <kabc/stdaddressbook.h> 135#include <kabc/stdaddressbook.h>
135#endif 136#endif
136using namespace KOrg; 137using namespace KOrg;
137using namespace KCal; 138using namespace KCal;
138extern int globalFlagBlockAgenda; 139extern int globalFlagBlockAgenda;
139extern int globalFlagBlockStartup; 140extern int globalFlagBlockStartup;
140 141
141 142
142MissedAlarmTextBrowser::MissedAlarmTextBrowser(QWidget *parent, QPtrList<Incidence> alarms,QDateTime start ) : QTextBrowser(parent) 143MissedAlarmTextBrowser::MissedAlarmTextBrowser(QWidget *parent, QPtrList<Incidence> alarms,QDateTime start ) : QTextBrowser(parent)
143 144
144{ 145{
145 mAlarms = alarms; 146 mAlarms = alarms;
146 viewport()->setBackgroundColor( QColor( 255, 255, 255 ) ); 147 viewport()->setBackgroundColor( QColor( 255, 255, 255 ) );
147 QString mText = "<table width=\"100%\">\n"; 148 QString mText = "<table width=\"100%\">\n";
148 //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; 149 //mText += "<tr bgcolor=\"#3679AD\"><td><h2>";
149#ifdef DESKTOP_VERSION 150#ifdef DESKTOP_VERSION
150 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>"; 151 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>";
151#else 152#else
152 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h3>"; 153 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h3>";
153#endif 154#endif
154 // mText += "<img src=\""; 155 // mText += "<img src=\"";
155 // mText += ipath; 156 // mText += ipath;
156 // mText += "\">"; 157 // mText += "\">";
157 //mEventDate = QDate::currentDate(); 158 //mEventDate = QDate::currentDate();
158#ifdef DESKTOP_VERSION 159#ifdef DESKTOP_VERSION
159 mText += "<font color=\"#FFFFFF\"> <em>" + i18n("You missed the alarms for the following events or todos:")+"</em></font></h2>"; 160 mText += "<font color=\"#FFFFFF\"> <em>" + i18n("You missed the alarms for the following events or todos:")+"</em></font></h2>";
160#else 161#else
161 mText += "<font color=\"#FFFFFF\"> <em>" + i18n("You missed the alarms for the following events or todos:")+"</em></font></h3>"; 162 mText += "<font color=\"#FFFFFF\"> <em>" + i18n("You missed the alarms for the following events or todos:")+"</em></font></h3>";
162#endif 163#endif
163 //mText += "</td></tr>\n<tr bgcolor=\"#FF997D\"><td>"; 164 //mText += "</td></tr>\n<tr bgcolor=\"#FF997D\"><td>";
164 165
165 Incidence * inc = getNextInc( start ); 166 Incidence * inc = getNextInc( start );
166 int time = 0; 167 int time = 0;
167 //mText += "<table>"; 168 //mText += "<table>";
168 while ( inc ) { 169 while ( inc ) {
169 QDateTime dt ; 170 QDateTime dt ;
170 QString tempText = "<a "; 171 QString tempText = "<a ";
171 bool ok; 172 bool ok;
172 dt = inc->getNextOccurence( start, &ok ); 173 dt = inc->getNextOccurence( start, &ok );
173 if ( !ok ) continue; 174 if ( !ok ) continue;
174 if ( inc->typeID() == eventID ) { 175 if ( inc->typeID() == eventID ) {
175 tempText += "href=\"event:"; 176 tempText += "href=\"event:";
176 } else if ( inc->typeID() == todoID ) { 177 } else if ( inc->typeID() == todoID ) {
177 tempText += "href=\"todo:"; 178 tempText += "href=\"todo:";
178 } 179 }
179 tempText += inc->uid() + "\">"; 180 tempText += inc->uid() + "\">";
180 if ( inc->typeID() == todoID ) 181 if ( inc->typeID() == todoID )
181 tempText += i18n("Todo: "); 182 tempText += i18n("Todo: ");
182 if ( inc->summary().length() > 0 ) 183 if ( inc->summary().length() > 0 )
183 tempText += inc->summary(); 184 tempText += inc->summary();
184 else 185 else
185 tempText += i18n("-no summary-"); 186 tempText += i18n("-no summary-");
186 QString timestr; 187 QString timestr;
187 if (!inc->doesFloat()) 188 if (!inc->doesFloat())
188 timestr = KGlobal::locale()->formatDateTime( dt, KOPrefs::instance()->mShortDateInViewer) +": "; 189 timestr = KGlobal::locale()->formatDateTime( dt, KOPrefs::instance()->mShortDateInViewer) +": ";
189 else 190 else
190 timestr = KGlobal::locale()->formatDate( dt.date() , KOPrefs::instance()->mShortDateInViewer) +": "; 191 timestr = KGlobal::locale()->formatDate( dt.date() , KOPrefs::instance()->mShortDateInViewer) +": ";
191 if ( dt.date() < QDate::currentDate() && time == 0 ) { 192 if ( dt.date() < QDate::currentDate() && time == 0 ) {
192 mText += "</td></tr>\n<tr bgcolor=\"#FF997D\"><td>"; 193 mText += "</td></tr>\n<tr bgcolor=\"#FF997D\"><td>";
193 mText += "<table>"; 194 mText += "<table>";
194 time = 1; 195 time = 1;
195 } 196 }
196 if ( dt.date() == QDate::currentDate() && time <= 1 ) { 197 if ( dt.date() == QDate::currentDate() && time <= 1 ) {
197 if ( time > 0 ) 198 if ( time > 0 )
198 mText +="</table>"; 199 mText +="</table>";
199 mText += "</td></tr>\n<tr bgcolor=\"#FFDC64\"><td>"; 200 mText += "</td></tr>\n<tr bgcolor=\"#FFDC64\"><td>";
200 mText += "<table>"; 201 mText += "<table>";
201 time = 2; 202 time = 2;
202 203
@@ -570,306 +571,253 @@ void CalendarView::init()
570 SIGNAL( todoModified( Todo *, int ) ) ); 571 SIGNAL( todoModified( Todo *, int ) ) );
571 572
572 connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), 573 connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ),
573 this, SLOT ( cloneIncidence( Incidence * ) ) ); 574 this, SLOT ( cloneIncidence( Incidence * ) ) );
574 connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), 575 connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ),
575 this, SLOT (cancelIncidence( Incidence * ) ) ); 576 this, SLOT (cancelIncidence( Incidence * ) ) );
576 577
577 connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), 578 connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ),
578 this, SLOT ( moveIncidence( Incidence * ) ) ); 579 this, SLOT ( moveIncidence( Incidence * ) ) );
579 connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), 580 connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ),
580 this, SLOT ( beamIncidence( Incidence * ) ) ); 581 this, SLOT ( beamIncidence( Incidence * ) ) );
581 582
582 connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), 583 connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ),
583 this, SLOT ( todo_unsub( Todo * ) ) ); 584 this, SLOT ( todo_unsub( Todo * ) ) );
584 585
585 connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), 586 connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ),
586 this, SLOT ( todo_resub( Todo *,Todo * ) ) ); 587 this, SLOT ( todo_resub( Todo *,Todo * ) ) );
587 connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, 588 connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList,
588 SLOT( updateTodo( Todo *, int ) ) ); 589 SLOT( updateTodo( Todo *, int ) ) );
589 connect( this, SIGNAL( todoModified( Todo *, int )), this, 590 connect( this, SIGNAL( todoModified( Todo *, int )), this,
590 SLOT( changeTodoDisplay( Todo *, int ) ) ); 591 SLOT( changeTodoDisplay( Todo *, int ) ) );
591 592
592 593
593 connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); 594 connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) );
594 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); 595 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) );
595 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); 596 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) );
596 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); 597 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) );
597 598
598 599
599 600
600 601
601 602
602 connect(QApplication::clipboard(),SIGNAL(dataChanged()), 603 connect(QApplication::clipboard(),SIGNAL(dataChanged()),
603 SLOT(checkClipboard())); 604 SLOT(checkClipboard()));
604 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), 605 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ),
605 SLOT( processTodoListSelection( Incidence * ) ) ); 606 SLOT( processTodoListSelection( Incidence * ) ) );
606 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); 607 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool)));
607 608
608 // kdDebug() << "CalendarView::CalendarView() done" << endl; 609 // kdDebug() << "CalendarView::CalendarView() done" << endl;
609 610
610 mDateFrame = new QVBox(0,0,WType_Popup); 611 mDateFrame = new QVBox(0,0,WType_Popup);
611 //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); 612 //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised);
612 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); 613 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised );
613 mDateFrame->setLineWidth(3); 614 mDateFrame->setLineWidth(3);
614 mDateFrame->hide(); 615 mDateFrame->hide();
615 mDateFrame->setCaption( i18n( "Pick a date to display")); 616 mDateFrame->setCaption( i18n( "Pick a date to display"));
616 mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); 617 mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() );
617 618
618 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); 619 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate)));
619 620
620 mEventEditor = mDialogManager->getEventEditor(); 621 mEventEditor = mDialogManager->getEventEditor();
621 mTodoEditor = mDialogManager->getTodoEditor(); 622 mTodoEditor = mDialogManager->getTodoEditor();
622 623
623 mFlagEditDescription = false; 624 mFlagEditDescription = false;
624 625
625 mSuspendTimer = new QTimer( this ); 626 mSuspendTimer = new QTimer( this );
626 mAlarmTimer = new QTimer( this ); 627 mAlarmTimer = new QTimer( this );
627 mRecheckAlarmTimer = new QTimer( this ); 628 mRecheckAlarmTimer = new QTimer( this );
628 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); 629 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) );
629 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); 630 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) );
630 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); 631 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) );
631 mAlarmDialog = new AlarmDialog( this ); 632 mAlarmDialog = new AlarmDialog( this );
632 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); 633 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) );
633 mAlarmDialog->setServerNotification( false ); 634 mAlarmDialog->setServerNotification( false );
634 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); 635 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime );
635 636
636 637
637#ifndef DESKTOP_VERSION 638#ifndef DESKTOP_VERSION
638//US listen for arriving address resultsets 639//US listen for arriving address resultsets
639 connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), 640 connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)),
640 this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); 641 this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)));
641#endif 642#endif
642 mDateNavigator->setCalendar( mCalendar ); 643 mDateNavigator->setCalendar( mCalendar );
643} 644}
644 645
645 646
646CalendarView::~CalendarView() 647CalendarView::~CalendarView()
647{ 648{
648 // kdDebug() << "~CalendarView()" << endl; 649 // kdDebug() << "~CalendarView()" << endl;
649 //qDebug("CalendarView::~CalendarView() "); 650 //qDebug("CalendarView::~CalendarView() ");
650 delete mDialogManager; 651 delete mDialogManager;
651 delete mViewManager; 652 delete mViewManager;
652 delete mStorage; 653 delete mStorage;
653 delete mDateFrame ; 654 delete mDateFrame ;
654 delete mEventViewerDialog; 655 delete mEventViewerDialog;
655 //kdDebug() << "~CalendarView() done" << endl; 656 //kdDebug() << "~CalendarView() done" << endl;
656} 657}
657void CalendarView::nextConflict( bool all, bool allday ) 658void CalendarView::nextConflict( bool all, bool allday )
658{ 659{
659 660
660 QPtrList<Event> testlist = mCalendar->events(); 661 QPtrList<Event> testlist = mCalendar->events();
661 Event * test = testlist.first(); 662 Event * test = testlist.first();
662 while ( test ) { 663 while ( test ) {
663 test->setTagged( false ); 664 test->setTagged( false );
664 test = testlist.next(); 665 test = testlist.next();
665 } 666 }
666 QDateTime startDT = QDateTime (mNavigator->selectedDates().first().addDays(1), QTime ( 0,0,0)); 667 QTime st ( 0,0,0);
668 if ( mViewManager->currentView() == mViewManager->agendaView() )
669 st = mViewManager->agendaView()->agenda()->getEndTime();
670 //qDebug("time %s ", st.toString().latin1());
671 QDateTime startDT = QDateTime (mNavigator->selectedDates().first(),st);
667 QDateTime conflict; 672 QDateTime conflict;
668 QDateTime retVal; 673 QDateTime retVal;
669 bool found = false; 674 bool found = false;
670 Event * cE = 0; 675 Event * cE = 0;
671 Event * cE2 = 0; 676 Event * cE2 = 0;
672 QPtrList<Event> testlist2 = testlist; 677 QPtrList<Event> testlist2 = testlist;
673 test = testlist.first(); 678 test = testlist.first();
674 bool skip = false; 679 bool skip = false;
675 while ( test ) { 680 while ( test ) {
676 skip = false; 681 skip = false;
677 if ( !all ) skip = ( allday != test->doesFloat() ); 682 if ( !all ) skip = ( allday != test->doesFloat() );
678 if ( !skip ) { 683 if ( !skip ) {
679 Event * test2 = testlist2.first(); 684 Event * test2 = testlist2.first();
680 while ( test2 ) { 685 while ( test2 ) {
681 skip = false; 686 skip = false;
682 if ( !all ) skip = ( allday != test2->doesFloat() ); 687 if ( !all ) skip = ( allday != test2->doesFloat() );
683 if ( !skip ) { 688 if ( !skip ) {
684 if ( !test2->isTagged() ) { 689 if ( !test2->isTagged() ) {
685 if ( test->isOverlapping ( test2, &retVal, &startDT ) ) { 690 if ( test->isOverlapping ( test2, &retVal, &startDT ) ) {
686 //qDebug("overlap "); 691 //qDebug("overlap ");
687 if ( ! found ) { 692 if ( ! found ) {
688 if ( retVal >= startDT ) { 693 if ( retVal >= startDT ) {
689 conflict = retVal; 694 conflict = retVal;
690 cE = test; 695 cE = test;
691 cE2 = test2; 696 cE2 = test2;
692 found = true; 697 found = true;
693 } 698 }
694 } else { 699 } else {
695 if ( retVal >= startDT && retVal < conflict ) { 700 if ( retVal >= startDT && retVal < conflict ) {
696 conflict = retVal; 701 conflict = retVal;
697 cE = test; 702 cE = test;
698 cE2 = test2; 703 cE2 = test2;
699 } 704 }
700 } 705 }
701 } 706 }
702 } 707 }
703 } 708 }
704 test2 = testlist2.next(); 709 test2 = testlist2.next();
705 } 710 }
706 } 711 }
707 test->setTagged( true ); 712 test->setTagged( true );
708 test = testlist.next(); 713 test = testlist.next();
709 } 714 }
710 if ( found ) { 715 if ( found ) {
711 if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 ) 716 if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 )
712 mViewManager->showDayView(); 717 mViewManager->showDayView();
713 mNavigator->slotDaySelect( conflict.date() ); 718 mNavigator->slotDaySelect( conflict.date() );
714 int hour = conflict.time().hour(); 719 int hour = conflict.time().hour();
715 mViewManager->agendaView()->setStartHour( hour ); 720 mViewManager->agendaView()->setStartHour( hour );
716 topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( cE->summary().left( 20 ) ).arg( cE2->summary().left( 20 ) ) ); 721 topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( cE->summary().left( 20 ) ).arg( cE2->summary().left( 20 ) ) );
717 return; 722 return;
718 } 723 }
719 724
720 topLevelWidget()->setCaption( i18n("No conflict found") ); 725 topLevelWidget()->setCaption( i18n("No conflict found") );
721 qDebug("No conflict found "); 726 qDebug("No conflict found ");
722 return; 727 return;
723
724
725
726
727
728#if 0
729
730
731 QDate end = start.addDays( 365*2);
732 while ( start < end ) {
733 QPtrList<Event> eventList = calendar()->events( start );
734 Event * ev = eventList.first();
735 QPtrList<Event> test = eventList;
736 while ( ev ) {
737 //qDebug("found %d on %s ", eventList.count(), start.toString().latin1());
738 Event * t_ev = test.first();
739 QDateTime es = ev->dtStart();
740 QDateTime ee = ev->dtEnd();
741 if ( ev->doesFloat() )
742 ee = ee.addDays( 1 );
743 if ( ! all ) {
744 if ( ev->doesFloat() != allday )
745 t_ev = 0;
746 }
747 while ( t_ev ) {
748 bool skip = false;
749 if ( ! all ) {
750 if ( t_ev->doesFloat() != allday )
751 skip = true;
752 }
753 if ( !skip && ev != t_ev ) {
754 QDateTime ets = t_ev->dtStart();
755 QDateTime ete = t_ev->dtEnd();
756 if ( t_ev->doesFloat() )
757 ete = ete.addDays( 1 );
758 //qDebug("test %s -- %s -------- %s -- %s ", es.toString().latin1() , ee.toString().latin1(), ets.toString().latin1() , ete.toString().latin1() );
759 if ( es < ete && ets < ee ) {
760 if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 )
761 mViewManager->showDayView();
762 mNavigator->slotDaySelect( start );
763 int hour = es.time().hour();
764 if ( ets > es )
765 hour = ets.time().hour();
766 mViewManager->agendaView()->setStartHour( hour );
767 topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( ev->summary().left( 20 ) ).arg( t_ev->summary().left( 20 ) ) );
768 return;
769 }
770 }
771 t_ev = test.next();
772 }
773 ev = eventList.next();
774 }
775 start = start.addDays( 1 );
776 }
777 topLevelWidget()->setCaption( i18n("No conflict found within the next two years") );
778 qDebug("No conflict found ");
779#endif
780} 728}
781 729
782void CalendarView::conflictAll() 730void CalendarView::conflictAll()
783{ 731{
784 nextConflict ( true, true ); 732 nextConflict ( true, true );
785} 733}
786void CalendarView::conflictAllday() 734void CalendarView::conflictAllday()
787{ 735{
788 nextConflict ( false, true ); 736 nextConflict ( false, true );
789} 737}
790void CalendarView::conflictNotAll() 738void CalendarView::conflictNotAll()
791{ 739{
792 nextConflict ( false, false ); 740 nextConflict ( false, false );
793} 741}
794 742
795void CalendarView::setCalReadOnly( int id, bool readO ) 743void CalendarView::setCalReadOnly( int id, bool readO )
796{ 744{
797 if ( readO ) { 745 if ( readO ) {
798 emit save(); 746 emit save();
799 } 747 }
800 mCalendar->setReadOnly( id, readO ); 748 mCalendar->setReadOnly( id, readO );
801} 749}
802void CalendarView::setScrollBarStep(int val ) 750void CalendarView::setScrollBarStep(int val )
803{ 751{
804#ifdef DESKTOP_VERSION 752#ifdef DESKTOP_VERSION
805 mDateScrollBar->setLineStep ( val ); 753 mDateScrollBar->setLineStep ( val );
806#endif 754#endif
807} 755}
808void CalendarView::scrollBarValue(int val ) 756void CalendarView::scrollBarValue(int val )
809{ 757{
810#ifdef DESKTOP_VERSION 758#ifdef DESKTOP_VERSION
811 if ( QApplication::desktop()->width() < 800 ) return; 759 if ( QApplication::desktop()->width() < 800 ) return;
812 static bool block = false; 760 static bool block = false;
813 if ( block ) return; 761 if ( block ) return;
814 block = true; 762 block = true;
815 int count = mNavigator->selectedDates().count(); 763 int count = mNavigator->selectedDates().count();
816 int day = mNavigator->selectedDates().first().dayOfYear(); 764 int day = mNavigator->selectedDates().first().dayOfYear();
817 int stepdays = val; 765 int stepdays = val;
818 if ( mDateScrollBar->lineStep () <= count ) { 766 if ( mDateScrollBar->lineStep () <= count ) {
819 //val = val/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep(); 767 //val = val/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep();
820 //qDebug("VAL %d ",val ); 768 //qDebug("VAL %d ",val );
821 stepdays = (val-day)/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep(); 769 stepdays = (val-day)/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep();
822 stepdays = day+stepdays; 770 stepdays = day+stepdays;
823 if ( stepdays < 0 ) stepdays = 0; 771 if ( stepdays < 0 ) stepdays = 0;
824 } 772 }
825 if ( stepdays == day ) { 773 if ( stepdays == day ) {
826 block = false; 774 block = false;
827 return; 775 return;
828 } 776 }
829 int year = mNavigator->selectedDates().first().year(); 777 int year = mNavigator->selectedDates().first().year();
830 QDate d ( year,1,1 ); 778 QDate d ( year,1,1 );
831 mNavigator->selectDates( d.addDays( stepdays-1) , count ); 779 mNavigator->selectDates( d.addDays( stepdays-1) , count );
832 block = false; 780 block = false;
833#endif 781#endif
834 782
835} 783}
836void CalendarView::updateView(const QDate &start, const QDate &end) 784void CalendarView::updateView(const QDate &start, const QDate &end)
837{ 785{
838#ifdef DESKTOP_VERSION 786#ifdef DESKTOP_VERSION
839 if ( ! mDateScrollBar->draggingSlider () ) { 787 if ( ! mDateScrollBar->draggingSlider () ) {
840 int dof = start.dayOfYear(); 788 int dof = start.dayOfYear();
841 //qDebug("dof %d day %d val %d ", dof, start.dayOfYear(),mDateScrollBar->value() ); 789 //qDebug("dof %d day %d val %d ", dof, start.dayOfYear(),mDateScrollBar->value() );
842 if ( dof != mDateScrollBar->value() ) { 790 if ( dof != mDateScrollBar->value() ) {
843 mDateScrollBar->blockSignals( true ); 791 mDateScrollBar->blockSignals( true );
844 mDateScrollBar->setValue( start.dayOfYear()); 792 mDateScrollBar->setValue( start.dayOfYear());
845 mDateScrollBar->blockSignals( false ); 793 mDateScrollBar->blockSignals( false );
846 } 794 }
847 } 795 }
848#endif 796#endif
849 mTodoList->updateView(); 797 mTodoList->updateView();
850 mViewManager->updateView(start, end); 798 mViewManager->updateView(start, end);
851 //mDateNavigator->updateView(); 799 //mDateNavigator->updateView();
852} 800}
853 801
854 802
855 803
856void CalendarView::checkFiles() 804void CalendarView::checkFiles()
857{ 805{
858 QString message; 806 QString message;
859 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; 807 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
860 KopiCalendarFile * cal = calendars.first(); 808 KopiCalendarFile * cal = calendars.first();
861 while ( cal ) { 809 while ( cal ) {
862 if ( cal->mErrorOnLoad ) { 810 if ( cal->mErrorOnLoad ) {
863 message += cal->mName +"\n"+KGlobal::formatMessage ( "(" +i18n( "Filepath: ")+ cal->mFileName+")" ,0 )+"\n"; 811 message += cal->mName +"\n"+KGlobal::formatMessage ( "(" +i18n( "Filepath: ")+ cal->mFileName+")" ,0 )+"\n";
864 } 812 }
865 cal = calendars.next(); 813 cal = calendars.next();
866 } 814 }
867 if ( !message.isEmpty() ) { 815 if ( !message.isEmpty() ) {
868 message = KGlobal::formatMessage( i18n("Calendar(s) not loaded:"),0 )+"\n" + message +KGlobal::formatMessage(i18n("You can try to reload the calendar in the Resource View!"),0); 816 message = KGlobal::formatMessage( i18n("Calendar(s) not loaded:"),0 )+"\n" + message +KGlobal::formatMessage(i18n("You can try to reload the calendar in the Resource View!"),0);
869 KMessageBox::error(this,message, i18n("Loding of calendar(s) failed")); 817 KMessageBox::error(this,message, i18n("Loding of calendar(s) failed"));
870 } 818 }
871 QTimer::singleShot( 2000, this, SLOT ( checkAlarms() )); 819 QTimer::singleShot( 2000, this, SLOT ( checkAlarms() ));
872} 820}
873void CalendarView::checkAlarms() 821void CalendarView::checkAlarms()
874{ 822{
875 823
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp
index b290020..779f12e 100644
--- a/korganizer/koagenda.cpp
+++ b/korganizer/koagenda.cpp
@@ -1540,192 +1540,196 @@ void KOAgenda::drawContentsToPainter( QPainter* paint, bool backgroundOnly )// i
1540 (mColumns - 1 - mSelectionCellX) * mGridSpacingX : 1540 (mColumns - 1 - mSelectionCellX) * mGridSpacingX :
1541 mSelectionCellX * mGridSpacingX; 1541 mSelectionCellX * mGridSpacingX;
1542 1542
1543 // Draw selection 1543 // Draw selection
1544 if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && 1544 if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) &&
1545 ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) { 1545 ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) {
1546 // TODO: paint only part within cx,cy,cw,ch 1546 // TODO: paint only part within cx,cy,cw,ch
1547 p->fillRect( selectionX, mSelectionYTop, mGridSpacingX, 1547 p->fillRect( selectionX, mSelectionYTop, mGridSpacingX,
1548 mSelectionHeight, KOPrefs::instance()->mHighlightColor ); 1548 mSelectionHeight, KOPrefs::instance()->mHighlightColor );
1549 } 1549 }
1550 */ 1550 */
1551 // Draw vertical lines of grid 1551 // Draw vertical lines of grid
1552 1552
1553 int x = ((int)(cx/mGridSpacingX))*mGridSpacingX; 1553 int x = ((int)(cx/mGridSpacingX))*mGridSpacingX;
1554 if ( mGridSpacingX > 0 ) { 1554 if ( mGridSpacingX > 0 ) {
1555 while (x < cx + cw) { 1555 while (x < cx + cw) {
1556 p->drawLine(x,cy,x,cy+ch); 1556 p->drawLine(x,cy,x,cy+ch);
1557 x+=mGridSpacingX; 1557 x+=mGridSpacingX;
1558 } 1558 }
1559 } 1559 }
1560 // Draw horizontal lines of grid 1560 // Draw horizontal lines of grid
1561 int y = ((int)(cy/lGridSpacingY))*lGridSpacingY; 1561 int y = ((int)(cy/lGridSpacingY))*lGridSpacingY;
1562 if ( lGridSpacingY > 0 ) { 1562 if ( lGridSpacingY > 0 ) {
1563 while (y < cy + ch) { 1563 while (y < cy + ch) {
1564 p->setPen( SolidLine ); 1564 p->setPen( SolidLine );
1565 p->drawLine(cx,y,cx+cw,y); 1565 p->drawLine(cx,y,cx+cw,y);
1566 y+=lGridSpacingY; 1566 y+=lGridSpacingY;
1567 p->setPen( DotLine ); 1567 p->setPen( DotLine );
1568 p->drawLine(cx,y,cx+cw,y); 1568 p->drawLine(cx,y,cx+cw,y);
1569 y+=lGridSpacingY; 1569 y+=lGridSpacingY;
1570 } 1570 }
1571 p->setPen( SolidLine ); 1571 p->setPen( SolidLine );
1572 } 1572 }
1573 mPixPainter.end() ; 1573 mPixPainter.end() ;
1574} 1574}
1575 1575
1576/* 1576/*
1577 Convert srcollview contents coordinates to agenda grid coordinates. 1577 Convert srcollview contents coordinates to agenda grid coordinates.
1578*/ 1578*/
1579void KOAgenda::contentsToGrid (int x, int y, int& gx, int& gy) 1579void KOAgenda::contentsToGrid (int x, int y, int& gx, int& gy)
1580{ 1580{
1581 gx = KOGlobals::self()->reverseLayout() ? mColumns - 1 - x/mGridSpacingX : 1581 gx = KOGlobals::self()->reverseLayout() ? mColumns - 1 - x/mGridSpacingX :
1582 x/mGridSpacingX; 1582 x/mGridSpacingX;
1583 gy = y/mGridSpacingY; 1583 gy = y/mGridSpacingY;
1584} 1584}
1585 1585
1586/* 1586/*
1587 Convert agenda grid coordinates to scrollview contents coordinates. 1587 Convert agenda grid coordinates to scrollview contents coordinates.
1588*/ 1588*/
1589void KOAgenda::gridToContents (int gx, int gy, int& x, int& y) 1589void KOAgenda::gridToContents (int gx, int gy, int& x, int& y)
1590{ 1590{
1591 x = KOGlobals::self()->reverseLayout() ? (mColumns - 1 - gx)*mGridSpacingX: 1591 x = KOGlobals::self()->reverseLayout() ? (mColumns - 1 - gx)*mGridSpacingX:
1592 gx*mGridSpacingX; 1592 gx*mGridSpacingX;
1593 y = gy*mGridSpacingY; 1593 y = gy*mGridSpacingY;
1594} 1594}
1595 1595
1596 1596
1597/* 1597/*
1598 Return Y coordinate corresponding to time. Coordinates are rounded to fit into 1598 Return Y coordinate corresponding to time. Coordinates are rounded to fit into
1599 the grid. 1599 the grid.
1600*/ 1600*/
1601int KOAgenda::timeToY(const QTime &time) 1601int KOAgenda::timeToY(const QTime &time)
1602{ 1602{
1603 int minutesPerCell = 24 * 60 / mRows; 1603 int minutesPerCell = 24 * 60 / mRows;
1604 int timeMinutes = time.hour() * 60 + time.minute(); 1604 int timeMinutes = time.hour() * 60 + time.minute();
1605 int Y = (timeMinutes + (minutesPerCell / 2)) / minutesPerCell; 1605 int Y = (timeMinutes + (minutesPerCell / 2)) / minutesPerCell;
1606 return Y; 1606 return Y;
1607} 1607}
1608 1608
1609 1609
1610/* 1610/*
1611 Return time corresponding to cell y coordinate. Coordinates are rounded to 1611 Return time corresponding to cell y coordinate. Coordinates are rounded to
1612 fit into the grid. 1612 fit into the grid.
1613*/ 1613*/
1614QTime KOAgenda::gyToTime(int gy) 1614QTime KOAgenda::gyToTime(int gy)
1615{ 1615{
1616 1616
1617 int secondsPerCell = 24 * 60 * 60/ mRows; 1617 int secondsPerCell = 24 * 60 * 60/ mRows;
1618 1618
1619 int timeSeconds = secondsPerCell * gy; 1619 int timeSeconds = secondsPerCell * gy;
1620 1620
1621 QTime time( 0, 0, 0 ); 1621 QTime time( 0, 0, 0 );
1622 if ( timeSeconds < 24 * 60 * 60 ) { 1622 if ( timeSeconds < 24 * 60 * 60 ) {
1623 time = time.addSecs(timeSeconds); 1623 time = time.addSecs(timeSeconds);
1624 } else { 1624 } else {
1625 time.setHMS( 23, 59, 59 ); 1625 time.setHMS( 23, 59, 59 );
1626 } 1626 }
1627 1627
1628 return time; 1628 return time;
1629} 1629}
1630 1630
1631void KOAgenda::setStartHour(int startHour) 1631void KOAgenda::setStartHour(int startHour)
1632{ 1632{
1633 int startCell = startHour * mRows / 24; 1633 int startCell = startHour * mRows / 24;
1634 setContentsPos(0,startCell * gridSpacingY()); 1634 setContentsPos(0,startCell * gridSpacingY());
1635} 1635}
1636QTime KOAgenda::getEndTime()
1637{
1638 return QTime ( (contentsY ()+viewport()->height())*24/contentsHeight ()+1,0,0);
1639}
1636void KOAgenda::hideUnused() 1640void KOAgenda::hideUnused()
1637{ 1641{
1638 // experimental only 1642 // experimental only
1639 // return; 1643 // return;
1640 KOAgendaItem *item; 1644 KOAgendaItem *item;
1641 for ( item=mUnusedItems.first(); item != 0; item=mUnusedItems.next() ) { 1645 for ( item=mUnusedItems.first(); item != 0; item=mUnusedItems.next() ) {
1642 item->hide(); 1646 item->hide();
1643 } 1647 }
1644} 1648}
1645 1649
1646 1650
1647KOAgendaItem *KOAgenda::getNewItem(Incidence * event,QDate qd, QWidget* view) 1651KOAgendaItem *KOAgenda::getNewItem(Incidence * event,QDate qd, QWidget* view)
1648{ 1652{
1649 1653
1650 KOAgendaItem *fi; 1654 KOAgendaItem *fi;
1651 for ( fi=mUnusedItems.first(); fi != 0; fi=mUnusedItems.next() ) { 1655 for ( fi=mUnusedItems.first(); fi != 0; fi=mUnusedItems.next() ) {
1652 if ( fi->incidence() == event ) { 1656 if ( fi->incidence() == event ) {
1653 mUnusedItems.remove(); 1657 mUnusedItems.remove();
1654 fi->init( event, qd ); 1658 fi->init( event, qd );
1655 return fi; 1659 return fi;
1656 } 1660 }
1657 } 1661 }
1658 fi=mUnusedItems.first(); 1662 fi=mUnusedItems.first();
1659 if ( fi ) { 1663 if ( fi ) {
1660 mUnusedItems.remove(); 1664 mUnusedItems.remove();
1661 fi->init( event, qd ); 1665 fi->init( event, qd );
1662 return fi; 1666 return fi;
1663 } 1667 }
1664 // qDebug("new KOAgendaItem "); 1668 // qDebug("new KOAgendaItem ");
1665 1669
1666 KOAgendaItem* agendaItem = new KOAgendaItem( event, qd, view, mAllDayMode ); 1670 KOAgendaItem* agendaItem = new KOAgendaItem( event, qd, view, mAllDayMode );
1667 agendaItem->installEventFilter(this); 1671 agendaItem->installEventFilter(this);
1668 addChild(agendaItem,0,0); 1672 addChild(agendaItem,0,0);
1669 return agendaItem; 1673 return agendaItem;
1670} 1674}
1671KOAgendaItem * KOAgenda::getItemForTodo ( Todo * todo ) 1675KOAgendaItem * KOAgenda::getItemForTodo ( Todo * todo )
1672{ 1676{
1673 KOAgendaItem *item; 1677 KOAgendaItem *item;
1674 for ( item=mItems.first(); item != 0; item=mItems.next() ) { 1678 for ( item=mItems.first(); item != 0; item=mItems.next() ) {
1675 if ( item->incidence() == todo ) { 1679 if ( item->incidence() == todo ) {
1676 mItems.remove(); 1680 mItems.remove();
1677 return item; 1681 return item;
1678 } 1682 }
1679 } 1683 }
1680 return 0; 1684 return 0;
1681} 1685}
1682 1686
1683 1687
1684void KOAgenda::updateTodo( Todo * todo, int days, bool remove) 1688void KOAgenda::updateTodo( Todo * todo, int days, bool remove)
1685{ 1689{
1686 // ( todo->hasCompletedDate() && todo->completed().date() == currentDate )|| 1690 // ( todo->hasCompletedDate() && todo->completed().date() == currentDate )||
1687 KOAgendaItem *item; 1691 KOAgendaItem *item;
1688 item = getItemForTodo ( todo ); 1692 item = getItemForTodo ( todo );
1689 //qDebug("KOAgenda::updateTodo %d %d %d %d", this, todo, days, remove); 1693 //qDebug("KOAgenda::updateTodo %d %d %d %d", this, todo, days, remove);
1690 if ( item ) { 1694 if ( item ) {
1691 blockSignals( true ); 1695 blockSignals( true );
1692 //qDebug("item found "); 1696 //qDebug("item found ");
1693 item->hide(); 1697 item->hide();
1694 item->setCellX(-2, -1 ); 1698 item->setCellX(-2, -1 );
1695 item->select(false); 1699 item->select(false);
1696 mUnusedItems.append( item ); 1700 mUnusedItems.append( item );
1697 mItems.remove( item ); 1701 mItems.remove( item );
1698 QPtrList<KOAgendaItem> oldconflictItems = item->conflictItems(); 1702 QPtrList<KOAgendaItem> oldconflictItems = item->conflictItems();
1699 KOAgendaItem *itemit; 1703 KOAgendaItem *itemit;
1700 //globalFlagBlockAgendaItemPaint = 1; 1704 //globalFlagBlockAgendaItemPaint = 1;
1701 for ( itemit=oldconflictItems.first(); itemit != 0; 1705 for ( itemit=oldconflictItems.first(); itemit != 0;
1702 itemit=oldconflictItems.next() ) { 1706 itemit=oldconflictItems.next() ) {
1703 if ( itemit != item ) 1707 if ( itemit != item )
1704 placeSubCells(itemit); 1708 placeSubCells(itemit);
1705 } 1709 }
1706 qApp->processEvents(); 1710 qApp->processEvents();
1707 //globalFlagBlockAgendaItemPaint = 0; 1711 //globalFlagBlockAgendaItemPaint = 0;
1708 for ( itemit=oldconflictItems.first(); itemit != 0; 1712 for ( itemit=oldconflictItems.first(); itemit != 0;
1709 itemit=oldconflictItems.next() ) { 1713 itemit=oldconflictItems.next() ) {
1710 globalFlagBlockAgendaItemUpdate = 0; 1714 globalFlagBlockAgendaItemUpdate = 0;
1711 if ( itemit != item ) 1715 if ( itemit != item )
1712 itemit->repaintMe(); 1716 itemit->repaintMe();
1713 globalFlagBlockAgendaItemUpdate = 1; 1717 globalFlagBlockAgendaItemUpdate = 1;
1714 //qDebug("sigleshot "); 1718 //qDebug("sigleshot ");
1715 QTimer::singleShot( 0, itemit, SLOT ( repaintItem() )); 1719 QTimer::singleShot( 0, itemit, SLOT ( repaintItem() ));
1716 //itemit->repaint( false ); repaintItem() 1720 //itemit->repaint( false ); repaintItem()
1717 } 1721 }
1718 blockSignals( false ); 1722 blockSignals( false );
1719 } 1723 }
1720 if ( remove ) { 1724 if ( remove ) {
1721 //qDebug("remove****************************************** "); 1725 //qDebug("remove****************************************** ");
1722 return; 1726 return;
1723 } 1727 }
1724 if ( todo->hasCompletedDate() && !KOPrefs::instance()->mShowCompletedTodoInAgenda ) 1728 if ( todo->hasCompletedDate() && !KOPrefs::instance()->mShowCompletedTodoInAgenda )
1725 return; 1729 return;
1726 //qDebug("updateTodo+++++++++++++++++++++++++++++++++++++ "); 1730 //qDebug("updateTodo+++++++++++++++++++++++++++++++++++++ ");
1727 QDate currentDate = QDate::currentDate(); 1731 QDate currentDate = QDate::currentDate();
1728 bool overdue = (!todo->isCompleted()) && (todo->dtDue() < currentDate)&& ( KOPrefs::instance()->mShowTodoInAgenda ); 1732 bool overdue = (!todo->isCompleted()) && (todo->dtDue() < currentDate)&& ( KOPrefs::instance()->mShowTodoInAgenda );
1729 QDateTime dt; 1733 QDateTime dt;
1730 if ( todo->hasCompletedDate() ) 1734 if ( todo->hasCompletedDate() )
1731 dt = todo->completed(); 1735 dt = todo->completed();
diff --git a/korganizer/koagenda.h b/korganizer/koagenda.h
index 0e3aed8..86cf2f4 100644
--- a/korganizer/koagenda.h
+++ b/korganizer/koagenda.h
@@ -34,192 +34,193 @@
34#include "koeventview.h" 34#include "koeventview.h"
35 35
36class QPopupMenu; 36class QPopupMenu;
37class QTime; 37class QTime;
38class KConfig; 38class KConfig;
39class QFrame; 39class QFrame;
40class KOAgenda; 40class KOAgenda;
41class KCal::Event; 41class KCal::Event;
42class KCal::Todo; 42class KCal::Todo;
43 43
44using namespace KCal; 44using namespace KCal;
45 45
46class MarcusBains : public QFrame { 46class MarcusBains : public QFrame {
47 Q_OBJECT 47 Q_OBJECT
48 public: 48 public:
49 MarcusBains(KOAgenda *agenda=0,const char *name=0); 49 MarcusBains(KOAgenda *agenda=0,const char *name=0);
50 virtual ~MarcusBains(); 50 virtual ~MarcusBains();
51 51
52 public slots: 52 public slots:
53 void updateLocation(bool recalculate=false); 53 void updateLocation(bool recalculate=false);
54 void updateLoc(); 54 void updateLoc();
55 55
56 private: 56 private:
57 int todayColumn(); 57 int todayColumn();
58 QTimer *minutes; 58 QTimer *minutes;
59 QLabel *mTimeBox; 59 QLabel *mTimeBox;
60 KOAgenda *agenda; 60 KOAgenda *agenda;
61 QTime oldTime; 61 QTime oldTime;
62 int oldToday; 62 int oldToday;
63}; 63};
64 64
65 65
66class KOAgenda : public QScrollView 66class KOAgenda : public QScrollView
67{ 67{
68 Q_OBJECT 68 Q_OBJECT
69 public: 69 public:
70 enum MouseActionType { NOP, MOVE, SELECT, 70 enum MouseActionType { NOP, MOVE, SELECT,
71 RESIZETOP, RESIZEBOTTOM, RESIZELEFT, RESIZERIGHT }; 71 RESIZETOP, RESIZEBOTTOM, RESIZELEFT, RESIZERIGHT };
72 72
73 KOAgenda ( int columns, int rows, int columnSize, QWidget * parent=0, 73 KOAgenda ( int columns, int rows, int columnSize, QWidget * parent=0,
74 const char * name=0, WFlags f=0 ); 74 const char * name=0, WFlags f=0 );
75 KOAgenda ( int columns, QWidget * parent=0, 75 KOAgenda ( int columns, QWidget * parent=0,
76 const char * name=0, WFlags f=0 ); 76 const char * name=0, WFlags f=0 );
77 virtual ~KOAgenda(); 77 virtual ~KOAgenda();
78 bool mInvalidPixmap; 78 bool mInvalidPixmap;
79 79
80 Incidence *selectedIncidence() const; 80 Incidence *selectedIncidence() const;
81 QDate selectedIncidenceDate() const; 81 QDate selectedIncidenceDate() const;
82 82
83 virtual bool eventFilter ( QObject *, QEvent * ); 83 virtual bool eventFilter ( QObject *, QEvent * );
84 84
85 void contentsToGrid (int x, int y, int& gx, int& gy); 85 void contentsToGrid (int x, int y, int& gx, int& gy);
86 void gridToContents (int gx, int gy, int& x, int& y); 86 void gridToContents (int gx, int gy, int& x, int& y);
87 87
88 int timeToY (const QTime &time); 88 int timeToY (const QTime &time);
89 QTime gyToTime (int y); 89 QTime gyToTime (int y);
90 90
91 void setStartHour(int startHour); 91 void setStartHour(int startHour);
92 92
93 KOAgendaItem *insertItem (Incidence *event,QDate qd,int X,int YTop,int YBottom); 93 KOAgendaItem *insertItem (Incidence *event,QDate qd,int X,int YTop,int YBottom);
94 KOAgendaItem *insertAllDayItem (Incidence *event,QDate qd,int XBegin,int XEnd); 94 KOAgendaItem *insertAllDayItem (Incidence *event,QDate qd,int XBegin,int XEnd);
95 void insertMultiItem (Event *event,QDate qd,int XBegin,int XEnd, 95 void insertMultiItem (Event *event,QDate qd,int XBegin,int XEnd,
96 int YTop,int YBottom); 96 int YTop,int YBottom);
97 97
98 void changeColumns(int columns); 98 void changeColumns(int columns);
99 99
100 int columns() { return mColumns; } 100 int columns() { return mColumns; }
101 int rows() { return mRows; } 101 int rows() { return mRows; }
102 102
103 int gridSpacingX() const { return mGridSpacingX; } 103 int gridSpacingX() const { return mGridSpacingX; }
104 int gridSpacingY() const { return mGridSpacingY; } 104 int gridSpacingY() const { return mGridSpacingY; }
105 105
106// virtual QSizePolicy sizePolicy() const; 106// virtual QSizePolicy sizePolicy() const;
107 107
108 void clear(); 108 void clear();
109 109
110 void clearSelection(); 110 void clearSelection();
111 void hideUnused(); 111 void hideUnused();
112 112
113 /** Calculates the minimum width */ 113 /** Calculates the minimum width */
114 virtual int minimumWidth() const; 114 virtual int minimumWidth() const;
115 /** Update configuration from preference settings */ 115 /** Update configuration from preference settings */
116 void updateConfig(); 116 void updateConfig();
117 117
118 void checkScrollBoundaries(); 118 void checkScrollBoundaries();
119 119
120 void setHolidayMask(QMemArray<bool> *); 120 void setHolidayMask(QMemArray<bool> *);
121 void setDateList(const DateList &selectedDates); 121 void setDateList(const DateList &selectedDates);
122 DateList dateList() const; 122 DateList dateList() const;
123 void drawContentsToPainter( QPainter* paint = 0, bool backgroundOnly = false); 123 void drawContentsToPainter( QPainter* paint = 0, bool backgroundOnly = false);
124 void finishUpdate(); 124 void finishUpdate();
125 void printSelection(); 125 void printSelection();
126 void storePosition(); 126 void storePosition();
127 void restorePosition(); 127 void restorePosition();
128 void setPopup( KOEventPopupMenu * p ) { mAllAgendaPopup = p; } 128 void setPopup( KOEventPopupMenu * p ) { mAllAgendaPopup = p; }
129 void shrinkPixmap(); 129 void shrinkPixmap();
130 QTime getEndTime();
130 131
131 public slots: 132 public slots:
132 void slotContentMove(int,int); 133 void slotContentMove(int,int);
133 void categoryChanged(Incidence * inc); 134 void categoryChanged(Incidence * inc);
134 void slotClearSelection(); 135 void slotClearSelection();
135 void popupMenu(); 136 void popupMenu();
136 void newItem( int ); 137 void newItem( int );
137 void moveChild( QWidget *, int, int ); 138 void moveChild( QWidget *, int, int );
138 void scrollUp(); 139 void scrollUp();
139 void scrollDown(); 140 void scrollDown();
140 void updateTodo( Todo * t, int , bool ); 141 void updateTodo( Todo * t, int , bool );
141 void popupAlarm(); 142 void popupAlarm();
142 143
143 void checkScrollBoundaries(int); 144 void checkScrollBoundaries(int);
144 145
145 /** Deselect selected items. This function does not emit any signals. */ 146 /** Deselect selected items. This function does not emit any signals. */
146 void deselectItem(); 147 void deselectItem();
147 /** Select item. If the argument is 0, the currently selected item gets 148 /** Select item. If the argument is 0, the currently selected item gets
148 deselected. This function emits the itemSelected(bool) signal to inform 149 deselected. This function emits the itemSelected(bool) signal to inform
149 about selection/deseelction of events. */ 150 about selection/deseelction of events. */
150 void selectItem(KOAgendaItem *); 151 void selectItem(KOAgendaItem *);
151 void finishResize(); 152 void finishResize();
152 153
153 signals: 154 signals:
154 void signalClearSelection(); 155 void signalClearSelection();
155 void showDateView( int, int); 156 void showDateView( int, int);
156 void newEventSignal(); 157 void newEventSignal();
157 void newEventSignal(int gx,int gy); 158 void newEventSignal(int gx,int gy);
158 void newTodoSignal(int gx,int gy); 159 void newTodoSignal(int gx,int gy);
159 void newEventSignal(int gxStart, int gyStart, int gxEnd, int gyEnd); 160 void newEventSignal(int gxStart, int gyStart, int gxEnd, int gyEnd);
160 void newTimeSpanSignal(int gxStart, int gyStart, int gxEnd, int gyEnd); 161 void newTimeSpanSignal(int gxStart, int gyStart, int gxEnd, int gyEnd);
161 void newStartSelectSignal(); 162 void newStartSelectSignal();
162 void showIncidenceSignal(Incidence *); 163 void showIncidenceSignal(Incidence *);
163 void editIncidenceSignal(Incidence *); 164 void editIncidenceSignal(Incidence *);
164 void deleteIncidenceSignal(Incidence *); 165 void deleteIncidenceSignal(Incidence *);
165 void showIncidencePopupSignal(Incidence *); 166 void showIncidencePopupSignal(Incidence *);
166 167
167 void itemModified(KOAgendaItem *item, int ); 168 void itemModified(KOAgendaItem *item, int );
168 void incidenceSelected(Incidence *); 169 void incidenceSelected(Incidence *);
169 170
170 void lowerYChanged(int); 171 void lowerYChanged(int);
171 void upperYChanged(int); 172 void upperYChanged(int);
172 173
173 void startDragSignal(Incidence *); 174 void startDragSignal(Incidence *);
174 void addToCalSignal(Incidence *, Incidence *); 175 void addToCalSignal(Incidence *, Incidence *);
175 void resizedSignal(); 176 void resizedSignal();
176 void updateViewSignal(); 177 void updateViewSignal();
177 void sendPing(); 178 void sendPing();
178 179
179 protected: 180 protected:
180 KOEventPopupMenu * mAllAgendaPopup; 181 KOEventPopupMenu * mAllAgendaPopup;
181 QPainter mPixPainter; 182 QPainter mPixPainter;
182 QPixmap mPaintPixmap; 183 QPixmap mPaintPixmap;
183 QPixmap mHighlightPixmap; 184 QPixmap mHighlightPixmap;
184 void drawContents(QPainter *p,int cx, int cy, int cw, int ch); 185 void drawContents(QPainter *p,int cx, int cy, int cw, int ch);
185 virtual void resizeEvent ( QResizeEvent * ); 186 virtual void resizeEvent ( QResizeEvent * );
186 187
187 /** Handles mouse events. Called from eventFilter */ 188 /** Handles mouse events. Called from eventFilter */
188 virtual bool eventFilter_mouse ( QObject *, QMouseEvent * ); 189 virtual bool eventFilter_mouse ( QObject *, QMouseEvent * );
189 190
190 /** Start selecting time span. */ 191 /** Start selecting time span. */
191 void startSelectAction(QPoint viewportPos); 192 void startSelectAction(QPoint viewportPos);
192 193
193 /** Select time span. */ 194 /** Select time span. */
194 void performSelectAction(QPoint viewportPos); 195 void performSelectAction(QPoint viewportPos);
195 196
196 /** Emd selecting time span. */ 197 /** Emd selecting time span. */
197 void endSelectAction( bool emitNewEvent = false ); 198 void endSelectAction( bool emitNewEvent = false );
198 199
199 /** Start moving/resizing agenda item */ 200 /** Start moving/resizing agenda item */
200 void startItemAction(QPoint viewportPos); 201 void startItemAction(QPoint viewportPos);
201 202
202 /** Move/resize agenda item */ 203 /** Move/resize agenda item */
203 void performItemAction(QPoint viewportPos); 204 void performItemAction(QPoint viewportPos);
204 205
205 /** End moving/resizing agenda item */ 206 /** End moving/resizing agenda item */
206 void endItemAction(); 207 void endItemAction();
207 208
208 /** Set cursor, when no item action is in progress */ 209 /** Set cursor, when no item action is in progress */
209 void setNoActionCursor(KOAgendaItem *moveItem,QPoint viewportPos); 210 void setNoActionCursor(KOAgendaItem *moveItem,QPoint viewportPos);
210 211
211 /** Place agenda item in agenda and adjust other cells if necessary */ 212 /** Place agenda item in agenda and adjust other cells if necessary */
212 void placeSubCells(KOAgendaItem *placeItem); 213 void placeSubCells(KOAgendaItem *placeItem);
213 214
214 /** Process the keyevent, including the ignored keyevents of eventwidgets. 215 /** Process the keyevent, including the ignored keyevents of eventwidgets.
215 * Implements pgup/pgdn and cursor key navigation in the view. 216 * Implements pgup/pgdn and cursor key navigation in the view.
216 */ 217 */
217 void keyPressEvent( QKeyEvent * ); 218 void keyPressEvent( QKeyEvent * );
218 219
219 void calculateWorkingHours(); 220 void calculateWorkingHours();
220 221
221 virtual void contentsMousePressEvent ( QMouseEvent * ); 222 virtual void contentsMousePressEvent ( QMouseEvent * );
222 223
223 private: 224 private:
224 void init(); 225 void init();
225 void marcus_bains(); 226 void marcus_bains();
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 53bbe28..b5a59af 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -1747,195 +1747,198 @@ void KOMonthView::updateView()
1747 } 1747 }
1748 // insert due todos 1748 // insert due todos
1749 QPtrList<Todo> todos = calendar()->todos( ); 1749 QPtrList<Todo> todos = calendar()->todos( );
1750 Todo *todo; 1750 Todo *todo;
1751 for(todo = todos.first(); todo; todo = todos.next()) { 1751 for(todo = todos.first(); todo; todo = todos.next()) {
1752 //insertTodo( todo ); 1752 //insertTodo( todo );
1753 if ( todo->hasDueDate() ) { 1753 if ( todo->hasDueDate() ) {
1754 int day = mStartDate.daysTo( todo->dtDue().date() ); 1754 int day = mStartDate.daysTo( todo->dtDue().date() );
1755 if ( day >= 0 && day < timeSpan + 1) { 1755 if ( day >= 0 && day < timeSpan + 1) {
1756 (*cells)[day]->insertTodo( todo ); 1756 (*cells)[day]->insertTodo( todo );
1757 } 1757 }
1758 } 1758 }
1759 } 1759 }
1760 1760
1761 for( i = 0; i < timeSpan+1; ++i ) { 1761 for( i = 0; i < timeSpan+1; ++i ) {
1762 (*cells)[i]->finishUpdateCell(); 1762 (*cells)[i]->finishUpdateCell();
1763 } 1763 }
1764 processSelectionChange(); 1764 processSelectionChange();
1765 //qApp->processEvents(); 1765 //qApp->processEvents();
1766 for( i = 0; i < timeSpan+1; ++i ) { 1766 for( i = 0; i < timeSpan+1; ++i ) {
1767 //(*cells)[i]->repaintfinishUpdateCell(); 1767 //(*cells)[i]->repaintfinishUpdateCell();
1768 QTimer::singleShot( 0, (*cells)[i], SLOT ( repaintfinishUpdateCell() ) ); 1768 QTimer::singleShot( 0, (*cells)[i], SLOT ( repaintfinishUpdateCell() ) );
1769 } 1769 }
1770 setKeyBFocus(); 1770 setKeyBFocus();
1771#else 1771#else
1772 // old code 1772 // old code
1773 //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); 1773 //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ");
1774 int i; 1774 int i;
1775 for( i = 0; i < (*cells).count(); ++i ) { 1775 for( i = 0; i < (*cells).count(); ++i ) {
1776 (*cells)[i]->updateCell(); 1776 (*cells)[i]->updateCell();
1777 } 1777 }
1778 1778
1779 //qDebug("KOMonthView::updateView() "); 1779 //qDebug("KOMonthView::updateView() ");
1780 processSelectionChange(); 1780 processSelectionChange();
1781 // qDebug("---------------------------------------------------------------------+ "); 1781 // qDebug("---------------------------------------------------------------------+ ");
1782 (*cells)[0]->setFocus(); 1782 (*cells)[0]->setFocus();
1783#endif 1783#endif
1784 1784
1785 //qDebug("update time %d ", ti.elapsed()); 1785 //qDebug("update time %d ", ti.elapsed());
1786} 1786}
1787 1787
1788void KOMonthView::setKeyBoardFocus() 1788void KOMonthView::setKeyBoardFocus()
1789{ 1789{
1790 //qDebug("KOMonthView::setKeyBoardFocus() "); 1790 //qDebug("KOMonthView::setKeyBoardFocus() ");
1791 bool shootAgain = false; 1791 bool shootAgain = false;
1792 if ( mShowWeekView ) { 1792 if ( mShowWeekView ) {
1793 shootAgain = !mWeekLabelsW[1]->hasFocus(); 1793 shootAgain = !mWeekLabelsW[1]->hasFocus();
1794 mWeekLabelsW[1]->setFocus(); 1794 mWeekLabelsW[1]->setFocus();
1795 } 1795 }
1796 else { 1796 else {
1797 shootAgain = !mWeekLabels[mNumWeeks]->hasFocus(); 1797 shootAgain = !mWeekLabels[mNumWeeks]->hasFocus();
1798 mWeekLabels[mNumWeeks]->setFocus(); 1798 mWeekLabels[mNumWeeks]->setFocus();
1799 } 1799 }
1800 --mKBFcounter; 1800 --mKBFcounter;
1801 if ( shootAgain && mKBFcounter > 0 ) { 1801 if ( shootAgain && mKBFcounter > 0 ) {
1802 QTimer::singleShot( 50, this, SLOT ( setKeyBoardFocus() ) ); 1802 QTimer::singleShot( 50, this, SLOT ( setKeyBoardFocus() ) );
1803 } 1803 }
1804} 1804}
1805void KOMonthView::setKeyBFocus() 1805void KOMonthView::setKeyBFocus()
1806{ 1806{
1807 //qDebug("KOMonthView::setKeyBFocus() "); 1807 //qDebug("KOMonthView::setKeyBFocus() ");
1808 mKBFcounter = 10; 1808 mKBFcounter = 10;
1809 QTimer::singleShot( 0, this, SLOT ( setKeyBoardFocus() ) ); 1809 QTimer::singleShot( 0, this, SLOT ( setKeyBoardFocus() ) );
1810} 1810}
1811void KOMonthView::resizeEvent(QResizeEvent * e) 1811void KOMonthView::resizeEvent(QResizeEvent * e)
1812{ 1812{
1813 //qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height()); 1813 //qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height());
1814 if ( isVisible() ) { 1814 if ( isVisible() ) {
1815 //qDebug("KOMonthView::isVisible "); 1815 //qDebug("KOMonthView::isVisible ");
1816 slotComputeLayout(); 1816 slotComputeLayout();
1817 } else 1817 } else
1818 mComputeLayoutTimer->start( 100 ); 1818 mComputeLayoutTimer->start( 100 );
1819 if ( e ) 1819 if ( e )
1820 KOEventView::resizeEvent( e ); 1820 KOEventView::resizeEvent( e );
1821} 1821}
1822 1822
1823void KOMonthView::slotComputeLayout() 1823void KOMonthView::slotComputeLayout()
1824{ 1824{
1825 mComputeLayoutTimer->stop(); 1825 mComputeLayoutTimer->stop();
1826 //qDebug("KOMonthView::Post - resizeEvent %d %d ", width(), height() ); 1826 //qDebug("KOMonthView::Post - resizeEvent %d %d ", width(), height() );
1827 computeLayout(); 1827 computeLayout();
1828 clPending = true; 1828 clPending = true;
1829 setKeyBFocus(); 1829 setKeyBFocus();
1830} 1830}
1831 1831
1832void KOMonthView::doComputeLayoutWeek() 1832void KOMonthView::doComputeLayoutWeek()
1833{ 1833{
1834 1834
1835 int daysToShow; 1835 int daysToShow;
1836 bool combinedSatSun = false; 1836 bool combinedSatSun = false;
1837 if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { 1837 if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) {
1838 daysToShow = 6; 1838 daysToShow = 6;
1839 combinedSatSun = true; 1839 combinedSatSun = true;
1840 } 1840 }
1841 int wid = width();//e 1841 int wid = width();//e
1842 int hei = height()-1-mNavigatorBar->height(); 1842 int hei = height()-1-mNavigatorBar->height();
1843#ifdef DESKTOP_VERSION
1843 if ( !KOPrefs::instance()->mMonthViewWeekRowlayout ) { 1844 if ( !KOPrefs::instance()->mMonthViewWeekRowlayout ) {
1844 daysToShow = 2; 1845 daysToShow = 2;
1845 } else { 1846 } else
1847#endif
1848 {
1846 if ( wid < hei ) 1849 if ( wid < hei )
1847 daysToShow = 2; 1850 daysToShow = 2;
1848 else 1851 else
1849 daysToShow = 3; 1852 daysToShow = 3;
1850 } 1853 }
1851 bool landscape = (daysToShow == 3); 1854 bool landscape = (daysToShow == 3);
1852 mShowSatSunComp = true; 1855 mShowSatSunComp = true;
1853 combinedSatSun = true; 1856 combinedSatSun = true;
1854 1857
1855 //qDebug("KOMonthView::computeLayout() WWW ------------------------------------ "); 1858 //qDebug("KOMonthView::computeLayout() WWW ------------------------------------ ");
1856 QFontMetrics fm ( mWeekLabels[0]->font() ); 1859 QFontMetrics fm ( mWeekLabels[0]->font() );
1857 int weeklabelwid = fm.width( "888" ); 1860 int weeklabelwid = fm.width( "888" );
1858 wid -= weeklabelwid; 1861 wid -= weeklabelwid;
1859 1862
1860 int colWid = wid / daysToShow; 1863 int colWid = wid / daysToShow;
1861 int dayLabelHei = mDayLabelsW[0]->sizeHint().height(); 1864 int dayLabelHei = mDayLabelsW[0]->sizeHint().height();
1862 int cellHei = (hei - (5- daysToShow )*dayLabelHei) /(5- daysToShow ); 1865 int cellHei = (hei - (5- daysToShow )*dayLabelHei) /(5- daysToShow );
1863 int colModulo = wid % daysToShow; 1866 int colModulo = wid % daysToShow;
1864 int rowModulo = (hei- (5- daysToShow )*dayLabelHei) % daysToShow-1; 1867 int rowModulo = (hei- (5- daysToShow )*dayLabelHei) % daysToShow-1;
1865 //qDebug("rowmod %d ", rowModulo); 1868 //qDebug("rowmod %d ", rowModulo);
1866 int i; 1869 int i;
1867 int x,y,w,h; 1870 int x,y,w,h;
1868 x= 0; 1871 x= 0;
1869 y= 0; 1872 y= 0;
1870 w = colWid; 1873 w = colWid;
1871 h = dayLabelHei ; 1874 h = dayLabelHei ;
1872 for ( i = 0; i < 7; i++) { 1875 for ( i = 0; i < 7; i++) {
1873 if ( i && !( i % daysToShow) && i < 6) { 1876 if ( i && !( i % daysToShow) && i < 6) {
1874 y += hei/(5-daysToShow); 1877 y += hei/(5-daysToShow);
1875 x = 0; 1878 x = 0;
1876 w = colWid; 1879 w = colWid;
1877 } 1880 }
1878 if ( ((i) % daysToShow) >= daysToShow-colModulo ) { 1881 if ( ((i) % daysToShow) >= daysToShow-colModulo ) {
1879 ++w; 1882 ++w;
1880 } 1883 }
1881 int xC,yC,wC,hC; 1884 int xC,yC,wC,hC;
1882 if ( i >= 5 ) { 1885 if ( i >= 5 ) {
1883 int wi = width() - x - weeklabelwid; 1886 int wi = width() - x - weeklabelwid;
1884 if ( i == 5 ) { 1887 if ( i == 5 ) {
1885 xC = x+weeklabelwid; 1888 xC = x+weeklabelwid;
1886 yC = y; 1889 yC = y;
1887 wC = wi/2+wi%2; 1890 wC = wi/2+wi%2;
1888 hC = h; 1891 hC = h;
1889 } else { 1892 } else {
1890 xC = x+weeklabelwid; 1893 xC = x+weeklabelwid;
1891 yC = y; 1894 yC = y;
1892 wC = wi; 1895 wC = wi;
1893 hC = h; 1896 hC = h;
1894 } 1897 }
1895 x = x - w + wi - (wi/2 ); 1898 x = x - w + wi - (wi/2 );
1896 } 1899 }
1897 else { 1900 else {
1898 int wi = w; 1901 int wi = w;
1899 if ( !(( i+1) % daysToShow)) { 1902 if ( !(( i+1) % daysToShow)) {
1900 wi = width() - x - weeklabelwid; 1903 wi = width() - x - weeklabelwid;
1901 } 1904 }
1902 xC = x+weeklabelwid; 1905 xC = x+weeklabelwid;
1903 yC = y; 1906 yC = y;
1904 wC = wi; 1907 wC = wi;
1905 hC = h; 1908 hC = h;
1906 } 1909 }
1907 mDayLabelsW[mapWeekLayout(i,landscape)]->setGeometry( xC,yC,wC,hC); 1910 mDayLabelsW[mapWeekLayout(i,landscape)]->setGeometry( xC,yC,wC,hC);
1908 1911
1909 1912
1910 x += w; 1913 x += w;
1911 } 1914 }
1912 x= 0; 1915 x= 0;
1913 y= dayLabelHei; 1916 y= dayLabelHei;
1914 w = colWid; 1917 w = colWid;
1915 h = cellHei; 1918 h = cellHei;
1916 int max = 0; 1919 int max = 0;
1917 int w_count = mCellsW.count(); 1920 int w_count = mCellsW.count();
1918 for ( i = 0; i < w_count; ++i) { 1921 for ( i = 0; i < w_count; ++i) {
1919 if ( i > 6 ) { 1922 if ( i > 6 ) {
1920 mCellsW[i]->hide(); 1923 mCellsW[i]->hide();
1921 continue; 1924 continue;
1922 } 1925 }
1923 1926
1924 w = colWid; 1927 w = colWid;
1925 if ( ((i) % daysToShow) >= daysToShow-colModulo ) { 1928 if ( ((i) % daysToShow) >= daysToShow-colModulo ) {
1926 ++w; 1929 ++w;
1927 } 1930 }
1928 if ( i == (daysToShow-1-rowModulo)*7) 1931 if ( i == (daysToShow-1-rowModulo)*7)
1929 ++h; 1932 ++h;
1930 1933
1931 int xC,yC,wC,hC; 1934 int xC,yC,wC,hC;
1932 if ( i >= 5 ) { 1935 if ( i >= 5 ) {
1933 if ( i ==5 ) { 1936 if ( i ==5 ) {
1934 max = h/2; 1937 max = h/2;
1935 xC = x+weeklabelwid; 1938 xC = x+weeklabelwid;
1936 yC = y; 1939 yC = y;
1937 wC = w; 1940 wC = w;
1938 hC = max; 1941 hC = max;
1939 x -= w ;y += h/2; 1942 x -= w ;y += h/2;
1940 } else { 1943 } else {
1941 if ( ((i-1) % daysToShow) >= daysToShow-colModulo ) { 1944 if ( ((i-1) % daysToShow) >= daysToShow-colModulo ) {