summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-09-20 15:25:04 (UTC)
committer zautrix <zautrix>2004-09-20 15:25:04 (UTC)
commit6b6a28919908134ccbb3badcb24c2dcae0d426a5 (patch) (unidiff)
tree72b3f69fa1f40bd4cfbd945d9f41699229604ae6
parentf222bd1339ac8323e3c99af84a6f83c21cacb8f8 (diff)
downloadkdepimpi-6b6a28919908134ccbb3badcb24c2dcae0d426a5.zip
kdepimpi-6b6a28919908134ccbb3badcb24c2dcae0d426a5.tar.gz
kdepimpi-6b6a28919908134ccbb3badcb24c2dcae0d426a5.tar.bz2
Several bugfixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp2
-rw-r--r--korganizer/koviewmanager.cpp6
-rw-r--r--korganizer/koviewmanager.h2
-rw-r--r--korganizer/kowhatsnextview.cpp159
-rw-r--r--libkcal/incidence.cpp8
-rw-r--r--libkcal/incidencebase.cpp4
6 files changed, 104 insertions, 77 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index ba0e6c6..bbed05b 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -1891,97 +1891,97 @@ void CalendarView::writeLocale()
1891 dummy = KOPrefs::instance()->mUserDateFormatShort; 1891 dummy = KOPrefs::instance()->mUserDateFormatShort;
1892 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); 1892 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") ));
1893 KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving, 1893 KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving,
1894 KOPrefs::instance()->mDaylightsavingStart, 1894 KOPrefs::instance()->mDaylightsavingStart,
1895 KOPrefs::instance()->mDaylightsavingEnd ); 1895 KOPrefs::instance()->mDaylightsavingEnd );
1896 KGlobal::locale()->setTimezone( KOPrefs::instance()->mTimeZoneId ); 1896 KGlobal::locale()->setTimezone( KOPrefs::instance()->mTimeZoneId );
1897} 1897}
1898void CalendarView::updateConfig() 1898void CalendarView::updateConfig()
1899{ 1899{
1900 writeLocale(); 1900 writeLocale();
1901 if ( KOPrefs::instance()->mUseAppColors ) 1901 if ( KOPrefs::instance()->mUseAppColors )
1902 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 1902 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
1903 emit configChanged(); 1903 emit configChanged();
1904 mTodoList->updateConfig(); 1904 mTodoList->updateConfig();
1905 // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); 1905 // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont);
1906 mCalendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); 1906 mCalendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId);
1907 // To make the "fill window" configurations work 1907 // To make the "fill window" configurations work
1908 //mViewManager->raiseCurrentView(); 1908 //mViewManager->raiseCurrentView();
1909} 1909}
1910 1910
1911 1911
1912void CalendarView::eventChanged(Event *event) 1912void CalendarView::eventChanged(Event *event)
1913{ 1913{
1914 changeEventDisplay(event,KOGlobals::EVENTEDITED); 1914 changeEventDisplay(event,KOGlobals::EVENTEDITED);
1915 //updateUnmanagedViews(); 1915 //updateUnmanagedViews();
1916} 1916}
1917 1917
1918void CalendarView::eventAdded(Event *event) 1918void CalendarView::eventAdded(Event *event)
1919{ 1919{
1920 changeEventDisplay(event,KOGlobals::EVENTADDED); 1920 changeEventDisplay(event,KOGlobals::EVENTADDED);
1921} 1921}
1922 1922
1923void CalendarView::eventToBeDeleted(Event *) 1923void CalendarView::eventToBeDeleted(Event *)
1924{ 1924{
1925 kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; 1925 kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl;
1926} 1926}
1927 1927
1928void CalendarView::eventDeleted() 1928void CalendarView::eventDeleted()
1929{ 1929{
1930 changeEventDisplay(0,KOGlobals::EVENTDELETED); 1930 changeEventDisplay(0,KOGlobals::EVENTDELETED);
1931} 1931}
1932void CalendarView::changeTodoDisplay(Todo *which, int action) 1932void CalendarView::changeTodoDisplay(Todo *which, int action)
1933{ 1933{
1934 changeIncidenceDisplay((Incidence *)which, action); 1934 changeIncidenceDisplay((Incidence *)which, action);
1935 mDateNavigator->updateView(); //LR 1935 mDateNavigator->updateView(); //LR
1936 //mDialogManager->updateSearchDialog(); 1936 //mDialogManager->updateSearchDialog();
1937 1937
1938 if (which) { 1938 if (which) {
1939 //mViewManager->currentView()->updateView();//LR 1939 mViewManager->updateWNview();
1940 //mTodoList->updateView(); 1940 //mTodoList->updateView();
1941 } 1941 }
1942 1942
1943} 1943}
1944 1944
1945void CalendarView::changeIncidenceDisplay(Incidence *which, int action) 1945void CalendarView::changeIncidenceDisplay(Incidence *which, int action)
1946{ 1946{
1947 updateUnmanagedViews(); 1947 updateUnmanagedViews();
1948 //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); 1948 //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action );
1949 if ( action == KOGlobals::EVENTDELETED ) { //delete 1949 if ( action == KOGlobals::EVENTDELETED ) { //delete
1950 mCalendar->checkAlarmForIncidence( 0, true ); 1950 mCalendar->checkAlarmForIncidence( 0, true );
1951 if ( mEventViewerDialog ) 1951 if ( mEventViewerDialog )
1952 mEventViewerDialog->hide(); 1952 mEventViewerDialog->hide();
1953 } 1953 }
1954 else 1954 else
1955 mCalendar->checkAlarmForIncidence( which , false ); 1955 mCalendar->checkAlarmForIncidence( which , false );
1956} 1956}
1957 1957
1958// most of the changeEventDisplays() right now just call the view's 1958// most of the changeEventDisplays() right now just call the view's
1959// total update mode, but they SHOULD be recoded to be more refresh-efficient. 1959// total update mode, but they SHOULD be recoded to be more refresh-efficient.
1960void CalendarView::changeEventDisplay(Event *which, int action) 1960void CalendarView::changeEventDisplay(Event *which, int action)
1961{ 1961{
1962 // kdDebug() << "CalendarView::changeEventDisplay" << endl; 1962 // kdDebug() << "CalendarView::changeEventDisplay" << endl;
1963 changeIncidenceDisplay((Incidence *)which, action); 1963 changeIncidenceDisplay((Incidence *)which, action);
1964 mDateNavigator->updateView(); 1964 mDateNavigator->updateView();
1965 //mDialogManager->updateSearchDialog(); 1965 //mDialogManager->updateSearchDialog();
1966 1966
1967 if (which) { 1967 if (which) {
1968 // If there is an event view visible update the display 1968 // If there is an event view visible update the display
1969 mViewManager->currentView()->changeEventDisplay(which,action); 1969 mViewManager->currentView()->changeEventDisplay(which,action);
1970 // TODO: check, if update needed 1970 // TODO: check, if update needed
1971 // if (which->getTodoStatus()) { 1971 // if (which->getTodoStatus()) {
1972 mTodoList->updateView(); 1972 mTodoList->updateView();
1973 // } 1973 // }
1974 } else { 1974 } else {
1975 mViewManager->currentView()->updateView(); 1975 mViewManager->currentView()->updateView();
1976 } 1976 }
1977} 1977}
1978 1978
1979 1979
1980void CalendarView::updateTodoViews() 1980void CalendarView::updateTodoViews()
1981{ 1981{
1982 1982
1983 mTodoList->updateView(); 1983 mTodoList->updateView();
1984 mViewManager->currentView()->updateView(); 1984 mViewManager->currentView()->updateView();
1985 1985
1986} 1986}
1987 1987
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index fc2bc77..ba77b45 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -178,96 +178,102 @@ void KOViewManager::raiseCurrentView( bool fullScreen )
178 hei -= mMainView->leftFrame()->height(); 178 hei -= mMainView->leftFrame()->height();
179 else 179 else
180 wid -= mMainView->leftFrame()->width(); 180 wid -= mMainView->leftFrame()->width();
181 } 181 }
182 182
183 if ( globalFlagBlockAgenda == 5 ) { 183 if ( globalFlagBlockAgenda == 5 ) {
184 globalFlagBlockAgenda = 4; 184 globalFlagBlockAgenda = 4;
185 globalFlagBlockAgendaItemPaint = 1; 185 globalFlagBlockAgendaItemPaint = 1;
186 } 186 }
187 mMainView->viewStack()->raiseWidget(mCurrentView); 187 mMainView->viewStack()->raiseWidget(mCurrentView);
188 if ( globalFlagBlockAgenda == 4 ) { 188 if ( globalFlagBlockAgenda == 4 ) {
189 if ( mCurrentView == mAgendaView ) { 189 if ( mCurrentView == mAgendaView ) {
190 //globalFlagBlockAgenda =1 ; 190 //globalFlagBlockAgenda =1 ;
191 if ( KOPrefs::instance()->mSetTimeToDayStartAt ) 191 if ( KOPrefs::instance()->mSetTimeToDayStartAt )
192 mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins ); 192 mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins );
193 else if ( KOPrefs::instance()->mCenterOnCurrentTime ) 193 else if ( KOPrefs::instance()->mCenterOnCurrentTime )
194 mAgendaView->setStartHour( QTime::currentTime ().hour() ); 194 mAgendaView->setStartHour( QTime::currentTime ().hour() );
195 qApp->processEvents(); 195 qApp->processEvents();
196 //qDebug("qApp->processEvents() "); 196 //qDebug("qApp->processEvents() ");
197 globalFlagBlockAgenda = 0; 197 globalFlagBlockAgenda = 0;
198 mAgendaView->repaintAgenda(); 198 mAgendaView->repaintAgenda();
199 199
200 } 200 }
201 globalFlagBlockAgenda = 0; 201 globalFlagBlockAgenda = 0;
202 } 202 }
203 //qDebug("raiseCurrentView ende "); 203 //qDebug("raiseCurrentView ende ");
204} 204}
205 205
206void KOViewManager::updateView() 206void KOViewManager::updateView()
207{ 207{
208 // qDebug("KOViewManager::updateView() "); 208 // qDebug("KOViewManager::updateView() ");
209 // if we are updating mTodoView, we get endless recursion 209 // if we are updating mTodoView, we get endless recursion
210 if ( mTodoView == mCurrentView ) 210 if ( mTodoView == mCurrentView )
211 return; 211 return;
212 if ( mCurrentView ) mCurrentView->updateView(); 212 if ( mCurrentView ) mCurrentView->updateView();
213 213
214} 214}
215 215
216void KOViewManager::updateView(const QDate &start, const QDate &end) 216void KOViewManager::updateView(const QDate &start, const QDate &end)
217{ 217{
218 // kdDebug() << "KOViewManager::updateView()" << endl; 218 // kdDebug() << "KOViewManager::updateView()" << endl;
219 219
220 if (mCurrentView) mCurrentView->showDates(start, end); 220 if (mCurrentView) mCurrentView->showDates(start, end);
221 221
222 if (mTodoView) mTodoView->updateView(); 222 if (mTodoView) mTodoView->updateView();
223} 223}
224 224
225 225
226void KOViewManager::updateWNview()
227{
228 if ( mCurrentView == mWhatsNextView && mWhatsNextView )
229 mWhatsNextView->updateView();
230
231}
226void KOViewManager::showWhatsNextView() 232void KOViewManager::showWhatsNextView()
227{ 233{
228 if (!mWhatsNextView) { 234 if (!mWhatsNextView) {
229 mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(), 235 mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(),
230 "KOViewManager::WhatsNextView"); 236 "KOViewManager::WhatsNextView");
231 mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog()); 237 mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog());
232 connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig())); 238 connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig()));
233 addView(mWhatsNextView); 239 addView(mWhatsNextView);
234 } 240 }
235 globalFlagBlockAgenda = 1; 241 globalFlagBlockAgenda = 1;
236 showView(mWhatsNextView, true ); 242 showView(mWhatsNextView, true );
237 mWhatsNextView->updateView(); 243 mWhatsNextView->updateView();
238 244
239} 245}
240 246
241void KOViewManager::showListView() 247void KOViewManager::showListView()
242{ 248{
243 if (!mListView) { 249 if (!mListView) {
244 mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView"); 250 mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView");
245 addView(mListView); 251 addView(mListView);
246 252
247 connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)), 253 connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)),
248 mMainView, SLOT(showIncidence(Incidence *))); 254 mMainView, SLOT(showIncidence(Incidence *)));
249 connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)), 255 connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)),
250 mMainView, SLOT(editIncidence(Incidence *))); 256 mMainView, SLOT(editIncidence(Incidence *)));
251 connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)), 257 connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)),
252 mMainView, SLOT(deleteIncidence(Incidence *))); 258 mMainView, SLOT(deleteIncidence(Incidence *)));
253 connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ), 259 connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ),
254 mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 260 mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
255 connect( mListView, SIGNAL( signalNewEvent() ), 261 connect( mListView, SIGNAL( signalNewEvent() ),
256 mMainView, SLOT( newEvent() ) ); 262 mMainView, SLOT( newEvent() ) );
257 connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig())); 263 connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig()));
258 connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), 264 connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ),
259 mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); 265 mMainView, SLOT ( cloneIncidence( Incidence * ) ) );
260 connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), 266 connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ),
261 mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); 267 mMainView, SLOT ( cancelIncidence( Incidence * ) ) );
262 connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ), 268 connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ),
263 mMainView, SLOT ( moveIncidence( Incidence * ) ) ); 269 mMainView, SLOT ( moveIncidence( Incidence * ) ) );
264 connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ), 270 connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ),
265 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 271 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
266 } 272 }
267 // bool temp = mFlagShowNextxDays; 273 // bool temp = mFlagShowNextxDays;
268 //globalFlagBlockPainting = true; 274 //globalFlagBlockPainting = true;
269 globalFlagBlockAgenda = 1; 275 globalFlagBlockAgenda = 1;
270 if ( KOPrefs::instance()->mListViewMonthTimespan ) 276 if ( KOPrefs::instance()->mListViewMonthTimespan )
271 mMainView->dateNavigator()->selectMonth(); 277 mMainView->dateNavigator()->selectMonth();
272 showView(mListView, KOPrefs::instance()->mFullViewTodo); 278 showView(mListView, KOPrefs::instance()->mFullViewTodo);
273 //mFlagShowNextxDays = temp; 279 //mFlagShowNextxDays = temp;
diff --git a/korganizer/koviewmanager.h b/korganizer/koviewmanager.h
index f814c36..26b22be 100644
--- a/korganizer/koviewmanager.h
+++ b/korganizer/koviewmanager.h
@@ -8,97 +8,97 @@
8 the Free Software Foundation; either version 2 of the License, or 8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version. 9 (at your option) any later version.
10 10
11 This program is distributed in the hope that it will be useful, 11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
14 GNU General Public License for more details. 14 GNU General Public License for more details.
15 15
16 You should have received a copy of the GNU General Public License 16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software 17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 19
20 As a special exception, permission is given to link this program 20 As a special exception, permission is given to link this program
21 with any edition of Qt, and distribute the resulting executable, 21 with any edition of Qt, and distribute the resulting executable,
22 without including the source code for Qt in the source distribution. 22 without including the source code for Qt in the source distribution.
23*/ 23*/
24#ifndef KOVIEWMANAGER_H 24#ifndef KOVIEWMANAGER_H
25#define KOVIEWMANAGER_H 25#define KOVIEWMANAGER_H
26 26
27#include <qobject.h> 27#include <qobject.h>
28 28
29#include <korganizer/baseview.h> 29#include <korganizer/baseview.h>
30 30
31class CalendarView; 31class CalendarView;
32 32
33class KOListView; 33class KOListView;
34class KOAgendaView; 34class KOAgendaView;
35class KOMonthView; 35class KOMonthView;
36class KOTimeSpanView; 36class KOTimeSpanView;
37class KOTodoView; 37class KOTodoView;
38class KOWhatsNextView; 38class KOWhatsNextView;
39class KOJournalView; 39class KOJournalView;
40 40
41using namespace KCal; 41using namespace KCal;
42 42
43/** 43/**
44 This class manages the views of the calendar. It owns the objects and handles 44 This class manages the views of the calendar. It owns the objects and handles
45 creation and selection. 45 creation and selection.
46*/ 46*/
47class KOViewManager : public QObject 47class KOViewManager : public QObject
48{ 48{
49 Q_OBJECT 49 Q_OBJECT
50 public: 50 public:
51 KOViewManager( CalendarView * ); 51 KOViewManager( CalendarView * );
52 virtual ~KOViewManager(); 52 virtual ~KOViewManager();
53 53
54 /** changes the view to be the currently selected view */ 54 /** changes the view to be the currently selected view */
55 void showView(KOrg::BaseView *, bool fullScreen = false ); 55 void showView(KOrg::BaseView *, bool fullScreen = false );
56 56 void updateWNview();
57 void readSettings(KConfig *config); 57 void readSettings(KConfig *config);
58 void writeSettings(KConfig *config); 58 void writeSettings(KConfig *config);
59 bool showsNextDays(); 59 bool showsNextDays();
60 /** Read which view was shown last from config file */ 60 /** Read which view was shown last from config file */
61 void readCurrentView(KConfig *); 61 void readCurrentView(KConfig *);
62 /** Write which view is currently shown to config file */ 62 /** Write which view is currently shown to config file */
63 void writeCurrentView(KConfig *); 63 void writeCurrentView(KConfig *);
64 64
65 KOrg::BaseView *currentView(); 65 KOrg::BaseView *currentView();
66 66
67 void setDocumentId( const QString & ); 67 void setDocumentId( const QString & );
68 68
69 void updateView(); 69 void updateView();
70 void updateView( const QDate &start, const QDate &end ); 70 void updateView( const QDate &start, const QDate &end );
71 71
72 void raiseCurrentView( bool fullScreen = false ); 72 void raiseCurrentView( bool fullScreen = false );
73 73
74 void addView(KOrg::BaseView *); 74 void addView(KOrg::BaseView *);
75 75
76 Incidence *currentSelection(); 76 Incidence *currentSelection();
77 QDate currentSelectionDate(); 77 QDate currentSelectionDate();
78 78
79 KOAgendaView *agendaView() const { return mAgendaView; } 79 KOAgendaView *agendaView() const { return mAgendaView; }
80 80
81 public slots: 81 public slots:
82 void showWhatsNextView(); 82 void showWhatsNextView();
83 void showListView(); 83 void showListView();
84 void showAgendaView( bool fullScreen = false ); 84 void showAgendaView( bool fullScreen = false );
85 void showDayView(); 85 void showDayView();
86 void showWorkWeekView(); 86 void showWorkWeekView();
87 void showWeekView(); 87 void showWeekView();
88 void showNextXView(); 88 void showNextXView();
89 void showMonthView(); 89 void showMonthView();
90 void showTodoView(); 90 void showTodoView();
91 void showJournalView(); 91 void showJournalView();
92 void showTimeSpanView(); 92 void showTimeSpanView();
93 93
94 private: 94 private:
95 CalendarView *mMainView; 95 CalendarView *mMainView;
96 96
97 int mCurrentAgendaView; 97 int mCurrentAgendaView;
98 KOAgendaView *mAgendaView; 98 KOAgendaView *mAgendaView;
99 KOListView *mListView; 99 KOListView *mListView;
100 KOMonthView *mMonthView; 100 KOMonthView *mMonthView;
101 KOTodoView *mTodoView; 101 KOTodoView *mTodoView;
102 KOWhatsNextView *mWhatsNextView; 102 KOWhatsNextView *mWhatsNextView;
103 KOJournalView *mJournalView; 103 KOJournalView *mJournalView;
104 KOTimeSpanView *mTimeSpanView; 104 KOTimeSpanView *mTimeSpanView;
diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp
index b2001ec..2a8a7c1 100644
--- a/korganizer/kowhatsnextview.cpp
+++ b/korganizer/kowhatsnextview.cpp
@@ -218,295 +218,312 @@ void KOWhatsNextView::updateView()
218 // mText += "<h2>"; 218 // mText += "<h2>";
219 //<img src=\""; 219 //<img src=\"";
220 // mText += ipath; 220 // mText += ipath;
221 // mText += "\">"; 221 // mText += "\">";
222 // mText += i18n("Overdue To-Do:") + "</h2>\n"; 222 // mText += i18n("Overdue To-Do:") + "</h2>\n";
223 223
224 //mText += "<ul>\n"; 224 //mText += "<ul>\n";
225 bool gotone = false; 225 bool gotone = false;
226 int priority = 1; 226 int priority = 1;
227 int priosFound = 0; 227 int priosFound = 0;
228#ifdef DESKTOP_VERSION 228#ifdef DESKTOP_VERSION
229 mText +="<p></p>"; 229 mText +="<p></p>";
230#endif 230#endif
231 231
232 mText +="<big><big><strong><em><font color=\"#000080\">" + i18n("Incomplete Todo:") + "</font></em></strong></big></big>\n"; 232 mText +="<big><big><strong><em><font color=\"#000080\">" + i18n("Incomplete Todo:") + "</font></em></strong></big></big>\n";
233 mText += "<ul>\n"; 233 mText += "<ul>\n";
234 while (!gotone && priority<6) { 234 while (!gotone && priority<6) {
235 todo = todos.first(); 235 todo = todos.first();
236 while(todo) { 236 while(todo) {
237 if (!todo->isCompleted() && (todo->priority() == priority) ) { 237 if (!todo->isCompleted() && (todo->priority() == priority) ) {
238 if ( appendTodo(todo) ) 238 if ( appendTodo(todo) )
239 gotone = true; 239 gotone = true;
240 } 240 }
241 todo = todos.next(); 241 todo = todos.next();
242 } 242 }
243 if ( gotone ) { 243 if ( gotone ) {
244 gotone = false; 244 gotone = false;
245 ++priosFound; 245 ++priosFound;
246 if ( priosFound == topmostPrios ) 246 if ( priosFound == topmostPrios )
247 break; 247 break;
248 } 248 }
249 priority++; 249 priority++;
250 // kdDebug() << "adding the todos..." << endl; 250 // kdDebug() << "adding the todos..." << endl;
251 } 251 }
252 mText += "</ul>\n"; 252 mText += "</ul>\n";
253 } 253 }
254 254
255 int replys = 0; 255 int replys = 0;
256 events = calendar()->events(QDate::currentDate(), QDate(2975,12,6)); 256 events = calendar()->events(QDate::currentDate(), QDate(2975,12,6));
257 if (events.count() > 0) { 257 if (events.count() > 0) {
258 Event *ev = events.first(); 258 Event *ev = events.first();
259 while(ev) { 259 while(ev) {
260 Attendee *me = ev->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); 260 Attendee *me = ev->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email());
261 if (me!=0) { 261 if (me!=0) {
262 if (me->status()==Attendee::NeedsAction && me->RSVP()) { 262 if (me->status()==Attendee::NeedsAction && me->RSVP()) {
263 if (replys == 0) { 263 if (replys == 0) {
264 mText += "<p></p>"; 264 mText += "<p></p>";
265 // kil.loadIcon("reply",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); 265 // kil.loadIcon("reply",KIcon::NoGroup,22,KIcon::DefaultState,&ipath);
266 mText += "<h2>"; 266 //mText += "<h2>";
267 //<img src=\""; 267 //<img src=\"";
268 // mText += ipath; 268 // mText += ipath;
269 // mText += "\">"; 269 // mText += "\">";
270 mText += i18n("Events and To-Dos that need a reply:") + "</h2>\n"; 270 //mText += i18n("Events and To-Dos that need a reply:") + "</h2>\n";
271 mText +="<big><big><strong><em><font color=\"#000080\">" + i18n("Events and To-Dos that need a reply:") + "</font></em></strong></big></big>\n";
271 mText += "<table>\n"; 272 mText += "<table>\n";
272 } 273 }
273 replys++; 274 replys++;
274 appendEvent(ev,true); 275 appendEvent(ev,true);
275 } 276 }
276 } 277 }
277 ev = events.next(); 278 ev = events.next();
278 } 279 }
279 } 280 }
280 todos = calendar()->todos(); 281 todos = calendar()->todos();
281 if (todos.count() > 0) { 282 if (todos.count() > 0) {
282 Todo *to = todos.first(); 283 Todo *to = todos.first();
283 while(to) { 284 while(to) {
284 Attendee *me = to->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); 285 if ( !to->isCompleted() ){
285 if (me!=0) { 286 Attendee *me = to->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email());
286 if (me->status()==Attendee::NeedsAction && me->RSVP()) { 287 if (me!=0) {
287 if (replys == 0) { 288 if (me->status()==Attendee::NeedsAction && me->RSVP()) {
288 mText += "<p></p>"; 289 if (replys == 0) {
289 // kil.loadIcon("reply",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); 290 mText +="<big><big><strong><em><font color=\"#000080\">" + i18n("Events and To-Dos that need a reply:") + "</font></em></strong></big></big>\n";
290 mText += "<h2>"; 291 mText += "<table>\n";
291 //<img src=\""; 292 }
292 // mText += ipath; 293 replys++;
293 // mText += "\">"; 294 appendEvent(to, true);
294 mText += i18n("Events and To-Dos that need a reply:") + "</h2>\n";
295 mText += "<table>\n";
296 } 295 }
297 replys++;
298 appendEvent(to);
299 } 296 }
300 } 297 }
301 kdDebug () << "check for todo-replys..." << endl;
302 to = todos.next(); 298 to = todos.next();
303 } 299 }
304 } 300 }
305 if (replys > 0 ) mText += "</table>\n"; 301 if (replys > 0 ) mText += "</table>\n";
306 302
307 303
308 mText += "</td></tr>\n</table>\n"; 304 mText += "</td></tr>\n</table>\n";
309 305
310 kdDebug() << "KOWhatsNextView::updateView: text: " << mText << endl;
311 mView->setText(mText); 306 mView->setText(mText);
312 mView->setFocus(); 307 mView->setFocus();
313 308
314 // QPixmap bPix = SmallIcon( "back" ); 309 // QPixmap bPix = SmallIcon( "back" );
315 // qDebug("xxxxxxxxxxxxxxxxxxxxx "); 310 // qDebug("xxxxxxxxxxxxxxxxxxxxx ");
316 // QWidget* test = new QWidget(); 311 // QWidget* test = new QWidget();
317 // test->setBackgroundMode(FixedPixmap ); 312 // test->setBackgroundMode(FixedPixmap );
318 // test->setBackgroundPixmap ( bPix ); 313 // test->setBackgroundPixmap ( bPix );
319 // test->resize( 300, 400 ); 314 // test->resize( 300, 400 );
320 // test->show(); 315 // test->show();
321 // mView->setBackgroundMode(FixedPixmap ); 316 // mView->setBackgroundMode(FixedPixmap );
322 // mView->setBackgroundPixmap ( bPix ); 317 // mView->setBackgroundPixmap ( bPix );
323} 318}
324 319
325void KOWhatsNextView::appendDay( int i, QDate eventDate ) 320void KOWhatsNextView::appendDay( int i, QDate eventDate )
326{ 321{
327 QString date; 322 QString date;
328 QString day = KGlobal::locale()->formatDate( eventDate , KOPrefs::instance()->mShortDateInViewer); 323 QString day = KGlobal::locale()->formatDate( eventDate , KOPrefs::instance()->mShortDateInViewer);
329 if ( ! KOPrefs::instance()->mShortDateInViewer && QApplication::desktop()->width() < 320 ) { 324 if ( ! KOPrefs::instance()->mShortDateInViewer && QApplication::desktop()->width() < 320 ) {
330 if ( i == 0 ) { 325 if ( i == 0 ) {
331 mText += "<table>\n"; 326 mText += "<table>\n";
332 return;//date = "<em><font color=\"#008000\"><em>" + day+"</font></em>"; 327 return;//date = "<em><font color=\"#008000\"><em>" + day+"</font></em>";
333 } 328 }
334 else if ( i == 1 ) 329 else if ( i == 1 )
335 date = "<em><font color=\"#000080\">" + day + "</font></em>" ; 330 date = "<em><font color=\"#000080\">" + day + "</font></em>" ;
336 else date = "<em><font color=\"#000080\">" + day + "</font></em>"; 331 else date = "<em><font color=\"#000080\">" + day + "</font></em>";
337 //mText += "<h2>" + date + "</h2>\n"; 332 //mText += "<h2>" + date + "</h2>\n";
338 mText += "<big><big><strong>" + date + "</strong></big></big>\n"; 333 mText += "<big><big><strong>" + date + "</strong></big></big>\n";
339 mText += "<table>\n"; 334 mText += "<table>\n";
340 335
341 336
342 337
343 } else { 338 } else {
344 if ( i == 0 ) { 339 if ( i == 0 ) {
345 mText += "<table>\n"; 340 mText += "<table>\n";
346 return;// date = "<font color=\"#008000\"><em>" +i18n("Today: ") +"</em>" + day+"</font>"; 341 return;// date = "<font color=\"#008000\"><em>" +i18n("Today: ") +"</em>" + day+"</font>";
347 } 342 }
348 343
349#ifdef DESKTOP_VERSION 344#ifdef DESKTOP_VERSION
350 else if ( i == 1 ) { 345 else if ( i == 1 ) {
351 date = "<h2><em><font color=\"#000080\">" + i18n("Tomorrow: ") + day +"</font></em></h2>" ; 346 date = "<h2><em><font color=\"#000080\">" + i18n("Tomorrow: ") + day +"</font></em></h2>" ;
352 } 347 }
353 else date = "<h2><em><font color=\"#000080\">" + i18n("In %1 days: ").arg( i ) +day + "</font></em></h2>"; 348 else date = "<h2><em><font color=\"#000080\">" + i18n("In %1 days: ").arg( i ) +day + "</font></em></h2>";
354#else 349#else
355 else if ( i == 1 ) { 350 else if ( i == 1 ) {
356 date = "<em><font color=\"#000080\">" + i18n("Tomorrow: ") + day +"</font></em>" ; 351 date = "<em><font color=\"#000080\">" + i18n("Tomorrow: ") + day +"</font></em>" ;
357 } 352 }
358 else date = "<em><font color=\"#000080\">" + i18n("In %1 days: ").arg( i ) +day + "</font></em>"; 353 else date = "<em><font color=\"#000080\">" + i18n("In %1 days: ").arg( i ) +day + "</font></em>";
359 354
360#endif 355#endif
361 //mText += "<h2>" + date + "</h2>\n"; 356 //mText += "<h2>" + date + "</h2>\n";
362 mText += "<big><big><strong>" + date + "</strong></big></big>\n"; 357 mText += "<big><big><strong>" + date + "</strong></big></big>\n";
363 mText += "<table>\n"; 358 mText += "<table>\n";
364 } 359 }
365} 360}
366 361
367 362
368void KOWhatsNextView::showDates(const QDate &, const QDate &) 363void KOWhatsNextView::showDates(const QDate &, const QDate &)
369{ 364{
370 updateView(); 365 updateView();
371} 366}
372 367
373void KOWhatsNextView::showEvents(QPtrList<Event>) 368void KOWhatsNextView::showEvents(QPtrList<Event>)
374{ 369{
375} 370}
376 371
377void KOWhatsNextView::changeEventDisplay(Event *, int action) 372void KOWhatsNextView::changeEventDisplay(Event *, int action)
378{ 373{
379 switch(action) { 374 switch(action) {
380 case KOGlobals::EVENTADDED: 375 case KOGlobals::EVENTADDED:
381 updateView(); 376 updateView();
382 break; 377 break;
383 case KOGlobals::EVENTEDITED: 378 case KOGlobals::EVENTEDITED:
384 updateView(); 379 updateView();
385 break; 380 break;
386 case KOGlobals::EVENTDELETED: 381 case KOGlobals::EVENTDELETED:
387 updateView(); 382 updateView();
388 break; 383 break;
389 default: 384 default:
390 updateView(); 385 updateView();
391 kdDebug() << "KOWhatsNextView::changeEventDisplay(): Illegal action " << action << endl; 386 kdDebug() << "KOWhatsNextView::changeEventDisplay(): Illegal action " << action << endl;
392 } 387 }
393} 388}
394 389
395void KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed ) 390void KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed )
396{ 391{
397 if ( !KOPrefs::instance()->mShowSyncEvents && ev->uid().left(21) == QString("last-syncEvent-device") ) 392 if ( !KOPrefs::instance()->mShowSyncEvents && ev->uid().left(15) == QString("last-syncEvent-") )
398 return; 393 return;
399 QDateTime cdt = QDateTime::currentDateTime(); 394 QDateTime cdt = QDateTime::currentDateTime();
395 QDateTime noc;
396 bool ok = true;
397 if ( reply ) {
398 noc = ev->getNextOccurence( cdt, &ok );
399 if (! ok && ev->type() == "Event")
400 return;
401 }
400 mText += "<tr><td><b>"; 402 mText += "<tr><td><b>";
401 if (ev->type()=="Event") { 403 if (ev->type()=="Event") {
404 if (reply) {
405 if (!ev->doesFloat())
406 mText += KGlobal::locale()->formatDateTime( noc , KOPrefs::instance()->mShortDateInViewer) +": ";
407 else
408 mText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": ";
409
410 } else {
411 if (!ev->doesFloat()) {
412 Event *event = static_cast<Event *>(ev);
413 QDateTime st,end;
414 if ( event->recurrence()->doesRecur() ) {
415 QDate recDate= mEventDate;
416 int days = event->dtStart().date().daysTo (event->dtEnd().date() );
417 while ( ! event->recursOn( recDate ) ) {
418 recDate = recDate.addDays( -1 );
402 419
403 if (!ev->doesFloat()) { 420 }
404 Event *event = static_cast<Event *>(ev); 421 st = QDateTime ( recDate, event->dtStart().time() );
405 QDateTime st,end; 422 end = QDateTime ( recDate.addDays( days ), event->dtEnd().time() );
406 if ( event->recurrence()->doesRecur() ) { 423 }
407 QDate recDate= mEventDate; 424 else {
408 int days = event->dtStart().date().daysTo (event->dtEnd().date() ); 425 st = event->dtStart();
409 while ( ! event->recursOn( recDate ) ) { 426 end = event->dtEnd();
410 recDate = recDate.addDays( -1 );
411
412 } 427 }
413 st = QDateTime ( recDate, event->dtStart().time() );
414 end = QDateTime ( recDate.addDays( days ), event->dtEnd().time() );
415 }
416 else {
417 st = event->dtStart();
418 end = event->dtEnd();
419 }
420 428
421 if (reply) mText += "on " + event->dtStartDateStr() + ": "; 429
422 QString dateText; 430 QString dateText;
423 // qDebug("%s %s %s %s ", mEventDate.toString().latin1(),event->summary().latin1(), st .toString().latin1(),end.toString().latin1() ); 431 // qDebug("%s %s %s %s ", mEventDate.toString().latin1(),event->summary().latin1(), st .toString().latin1(),end.toString().latin1() );
424 if ( st.date() < mEventDate ) 432 if ( st.date() < mEventDate )
425 dateText = "++:++-"; 433 dateText = "++:++-";
426 else 434 else
427 dateText = event->dtStartTimeStr() + "-"; 435 dateText = event->dtStartTimeStr() + "-";
428 if ( end.date() > mEventDate ) 436 if ( end.date() > mEventDate )
429 dateText += "++:++"; 437 dateText += "++:++";
430 else
431 dateText += event->dtEndTimeStr();
432 if ( notRed )
433 mText += dateText;
434 else {
435 if ( end < cdt )
436 mText += "<font color=\"#F00000\">" + dateText + "</font>";
437 else if ( st < cdt )
438 mText += "<font color=\"#008000\">" + dateText + "</font>";
439 else 438 else
439 dateText += event->dtEndTimeStr();
440 if ( notRed )
440 mText += dateText; 441 mText += dateText;
441 } 442 else {
443 if ( end < cdt )
444 mText += "<font color=\"#F00000\">" + dateText + "</font>";
445 else if ( st < cdt )
446 mText += "<font color=\"#008000\">" + dateText + "</font>";
447 else
448 mText += dateText;
449
450 }
442 451
443 } else { 452 } else {
444 mText += i18n("Allday:"); 453 mText += i18n("Allday:");
445 454
455 }
446 } 456 }
447 } else { 457 } else {
448 mTodos.append( ev ); 458 mTodos.append( ev );
449 mText += i18n("ToDo:"); 459 mText += i18n("ToDo:");
450 if ( ((Todo*)ev)->dtDue().date() < QDate::currentDate() ) { 460 if (reply) {
451 // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; 461 mText += " ";
452 QString dfs = KGlobal::locale()->dateFormatShort(); 462 if ( noc != cdt ) {
453 KGlobal::locale()->setDateFormatShort("%d.%b"); 463 mText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": ";
454 mText +="<font color=\"#F00000\">" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "</font>"; 464 }
455 KGlobal::locale()->setDateFormatShort(dfs);
456 } else { 465 } else {
457 if (!ev->doesFloat() ) 466 if ( ((Todo*)ev)->dtDue().date() < QDate::currentDate() ) {
458 if( ( (Todo*)ev)->dtDue() < cdt ) { 467 // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>";
459 mText +="<font color=\"#F00000\">" + ((Todo*)ev)->dtDueTimeStr() + "</font>"; 468 QString dfs = KGlobal::locale()->dateFormatShort();
460 469 KGlobal::locale()->setDateFormatShort("%d.%b");
461 470 mText +="<font color=\"#F00000\">" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "</font>";
462 } else 471 KGlobal::locale()->setDateFormatShort(dfs);
463 mText +=((Todo*)ev)->dtDueTimeStr(); 472 } else {
464 mTodos.append( ev ); 473 if (!ev->doesFloat() )
474 if( ( (Todo*)ev)->dtDue() < cdt ) {
475 mText +="<font color=\"#F00000\">" + ((Todo*)ev)->dtDueTimeStr() + "</font>";
476
477
478 } else
479 mText +=((Todo*)ev)->dtDueTimeStr();
480 mTodos.append( ev );
481 }
465 } 482 }
466 } 483 }
467 mText += "</b></td><td>"; 484 mText += "</b></td><td>";
468 bool needClose = false; 485 bool needClose = false;
469 if ( ev->cancelled() ) { 486 if ( ev->cancelled() ) {
470 mText += "<font color=\"#F00000\">[c"; 487 mText += "<font color=\"#F00000\">[c";
471 needClose =true; 488 needClose =true;
472 489
473 } 490 }
474 if ( ev->isAlarmEnabled() ) { 491 if ( ev->isAlarmEnabled() ) {
475 if ( !needClose) 492 if ( !needClose)
476 mText +="["; 493 mText +="[";
477 mText += "a"; 494 mText += "a";
478 needClose =true; 495 needClose =true;
479 496
480 } 497 }
481 if ( ev->description().length() > 0 ) { 498 if ( ev->description().length() > 0 ) {
482 if ( !needClose) 499 if ( !needClose)
483 mText +="["; 500 mText +="[";
484 mText += "i"; 501 mText += "i";
485 needClose =true; 502 needClose =true;
486 } 503 }
487 if ( ev->recurrence()->doesRecur() ) { 504 if ( ev->recurrence()->doesRecur() ) {
488 if ( !needClose) 505 if ( !needClose)
489 mText +="["; 506 mText +="[";
490 mText += "r"; 507 mText += "r";
491 needClose =true; 508 needClose =true;
492 } 509 }
493 if ( needClose ) { 510 if ( needClose ) {
494 mText += "] "; 511 mText += "] ";
495 } 512 }
496 if ( ev->cancelled() ) 513 if ( ev->cancelled() )
497 mText += "</font>"; 514 mText += "</font>";
498 mText += "<a "; 515 mText += "<a ";
499 if (ev->type()=="Event") mText += "href=\"event:"; 516 if (ev->type()=="Event") mText += "href=\"event:";
500 if (ev->type()=="Todo") mText += "href=\"todo:"; 517 if (ev->type()=="Todo") mText += "href=\"todo:";
501 mText += ev->uid() + "\">"; 518 mText += ev->uid() + "\">";
502 if ( ev->summary().length() > 0 ) 519 if ( ev->summary().length() > 0 )
503 mText += ev->summary(); 520 mText += ev->summary();
504 else 521 else
505 mText += i18n("-no summary-"); 522 mText += i18n("-no summary-");
506 mText += "</a>"; 523 mText += "</a>";
507 if ( KOPrefs::instance()->mWNViewShowLocation ) 524 if ( KOPrefs::instance()->mWNViewShowLocation )
508 if ( !ev->location().isEmpty() ) 525 if ( !ev->location().isEmpty() )
509 mText += " ("+ev->location() +")"; 526 mText += " ("+ev->location() +")";
510 if ( ev->relatedTo() && KOPrefs::instance()->mWNViewShowsParents) 527 if ( ev->relatedTo() && KOPrefs::instance()->mWNViewShowsParents)
511 mText += " ["+ev->relatedTo()->summary() +"]"; 528 mText += " ["+ev->relatedTo()->summary() +"]";
512 mText += "</td></tr>\n"; 529 mText += "</td></tr>\n";
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp
index 56c9801..55ac6d4 100644
--- a/libkcal/incidence.cpp
+++ b/libkcal/incidence.cpp
@@ -545,55 +545,59 @@ void Incidence::setLocation(const QString &location)
545 if (mReadOnly) return; 545 if (mReadOnly) return;
546 mLocation = location; 546 mLocation = location;
547 updated(); 547 updated();
548} 548}
549 549
550QString Incidence::location() const 550QString Incidence::location() const
551{ 551{
552 return mLocation; 552 return mLocation;
553} 553}
554 554
555ushort Incidence::doesRecur() const 555ushort Incidence::doesRecur() const
556{ 556{
557 if ( mRecurrence ) return mRecurrence->doesRecur(); 557 if ( mRecurrence ) return mRecurrence->doesRecur();
558 else return Recurrence::rNone; 558 else return Recurrence::rNone;
559} 559}
560 560
561QDateTime Incidence::getNextOccurence( const QDateTime& dt, bool* ok ) const 561QDateTime Incidence::getNextOccurence( const QDateTime& dt, bool* ok ) const
562{ 562{
563 QDateTime incidenceStart = dt; 563 QDateTime incidenceStart = dt;
564 *ok = false; 564 *ok = false;
565 if ( doesRecur() ) { 565 if ( doesRecur() ) {
566 bool last; 566 bool last;
567 recurrence()->getPreviousDateTime( incidenceStart , &last ); 567 recurrence()->getPreviousDateTime( incidenceStart , &last );
568 int count = 0; 568 int count = 0;
569 if ( !last ) { 569 if ( !last ) {
570 while ( !last ) { 570 while ( !last ) {
571 ++count; 571 ++count;
572 incidenceStart = recurrence()->getNextDateTime( incidenceStart, &last ); 572 incidenceStart = recurrence()->getNextDateTime( incidenceStart, &last );
573 if ( recursOn( incidenceStart.date() ) ) { 573 if ( recursOn( incidenceStart.date() ) ) {
574 last = true; // exit while llop 574 last = true; // exit while llop
575 } else { 575 } else {
576 if ( last ) { // no alarm on last recurrence 576 if ( last ) { // no alarm on last recurrence
577 return QDateTime (); 577 return QDateTime ();
578 } 578 }
579 int year = incidenceStart.date().year(); 579 int year = incidenceStart.date().year();
580 // workaround for bug in recurrence 580 // workaround for bug in recurrence
581 if ( count == 100 || year < 1980 || year > 5000 ) { 581 if ( count == 100 || year < 1980 || year > 5000 ) {
582 return QDateTime (); 582 return QDateTime ();
583 } 583 }
584 incidenceStart = incidenceStart.addSecs( 1 ); 584 incidenceStart = incidenceStart.addSecs( 1 );
585 } 585 }
586 } 586 }
587 } else { 587 } else {
588 return QDateTime (); 588 return QDateTime ();
589 } 589 }
590 } else { 590 } else {
591 if ( hasStartDate () ) { 591 if ( hasStartDate () ) {
592 incidenceStart = dtStart(); 592 incidenceStart = dtStart();
593 593 }
594 } 594 if ( type() =="Todo" ) {
595 if ( ((Todo*)this)->hasDueDate() )
596 incidenceStart = ((Todo*)this)->dtDue();
597
598 }
595 } 599 }
596 if ( incidenceStart > dt ) 600 if ( incidenceStart > dt )
597 *ok = true; 601 *ok = true;
598 return incidenceStart; 602 return incidenceStart;
599} 603}
diff --git a/libkcal/incidencebase.cpp b/libkcal/incidencebase.cpp
index 64a343c..b36dc1a 100644
--- a/libkcal/incidencebase.cpp
+++ b/libkcal/incidencebase.cpp
@@ -226,115 +226,115 @@ void IncidenceBase::addAttendee(Attendee *a, bool doupdate)
226#if 0 226#if 0
227void IncidenceBase::removeAttendee(Attendee *a) 227void IncidenceBase::removeAttendee(Attendee *a)
228{ 228{
229 if (mReadOnly) return; 229 if (mReadOnly) return;
230 mAttendees.removeRef(a); 230 mAttendees.removeRef(a);
231 updated(); 231 updated();
232} 232}
233 233
234void IncidenceBase::removeAttendee(const char *n) 234void IncidenceBase::removeAttendee(const char *n)
235{ 235{
236 Attendee *a; 236 Attendee *a;
237 237
238 if (mReadOnly) return; 238 if (mReadOnly) return;
239 for (a = mAttendees.first(); a; a = mAttendees.next()) 239 for (a = mAttendees.first(); a; a = mAttendees.next())
240 if (a->getName() == n) { 240 if (a->getName() == n) {
241 mAttendees.remove(); 241 mAttendees.remove();
242 break; 242 break;
243 } 243 }
244} 244}
245#endif 245#endif
246 246
247void IncidenceBase::clearAttendees() 247void IncidenceBase::clearAttendees()
248{ 248{
249 if (mReadOnly) return; 249 if (mReadOnly) return;
250 mAttendees.clear(); 250 mAttendees.clear();
251} 251}
252 252
253#if 0 253#if 0
254Attendee *IncidenceBase::getAttendee(const char *n) const 254Attendee *IncidenceBase::getAttendee(const char *n) const
255{ 255{
256 QPtrListIterator<Attendee> qli(mAttendees); 256 QPtrListIterator<Attendee> qli(mAttendees);
257 257
258 qli.toFirst(); 258 qli.toFirst();
259 while (qli) { 259 while (qli) {
260 if (qli.current()->getName() == n) 260 if (qli.current()->getName() == n)
261 return qli.current(); 261 return qli.current();
262 ++qli; 262 ++qli;
263 } 263 }
264 return 0L; 264 return 0L;
265} 265}
266#endif 266#endif
267 267
268Attendee *IncidenceBase::attendeeByMail(const QString &email) 268Attendee *IncidenceBase::attendeeByMail(const QString &email)
269{ 269{
270 QPtrListIterator<Attendee> qli(mAttendees); 270 QPtrListIterator<Attendee> qli(mAttendees);
271 271
272 qli.toFirst(); 272 qli.toFirst();
273 while (qli) { 273 while (qli) {
274 if (qli.current()->email() == email) 274 if (qli.current()->email().lower() == email.lower())
275 return qli.current(); 275 return qli.current();
276 ++qli; 276 ++qli;
277 } 277 }
278 return 0L; 278 return 0L;
279} 279}
280 280
281Attendee *IncidenceBase::attendeeByMails(const QStringList &emails, const QString& email) 281Attendee *IncidenceBase::attendeeByMails(const QStringList &emails, const QString& email)
282{ 282{
283 QPtrListIterator<Attendee> qli(mAttendees); 283 QPtrListIterator<Attendee> qli(mAttendees);
284 284
285 QStringList mails = emails; 285 QStringList mails = emails;
286 if (!email.isEmpty()) { 286 if (!email.isEmpty()) {
287 mails.append(email); 287 mails.append(email);
288 } 288 }
289 qli.toFirst(); 289 qli.toFirst();
290 while (qli) { 290 while (qli) {
291 for ( QStringList::Iterator it = mails.begin(); it != mails.end(); ++it ) { 291 for ( QStringList::Iterator it = mails.begin(); it != mails.end(); ++it ) {
292 if (qli.current()->email() == *it) 292 if (qli.current()->email().lower() == (*it).lower())
293 return qli.current(); 293 return qli.current();
294 } 294 }
295 295
296 ++qli; 296 ++qli;
297 } 297 }
298 return 0L; 298 return 0L;
299} 299}
300 300
301void IncidenceBase::setDuration(int seconds) 301void IncidenceBase::setDuration(int seconds)
302{ 302{
303 mDuration = seconds; 303 mDuration = seconds;
304 setHasDuration(true); 304 setHasDuration(true);
305} 305}
306 306
307int IncidenceBase::duration() const 307int IncidenceBase::duration() const
308{ 308{
309 return mDuration; 309 return mDuration;
310} 310}
311 311
312void IncidenceBase::setHasDuration(bool b) 312void IncidenceBase::setHasDuration(bool b)
313{ 313{
314 mHasDuration = b; 314 mHasDuration = b;
315} 315}
316 316
317bool IncidenceBase::hasDuration() const 317bool IncidenceBase::hasDuration() const
318{ 318{
319 return mHasDuration; 319 return mHasDuration;
320} 320}
321 321
322void IncidenceBase::setSyncStatus(int stat) 322void IncidenceBase::setSyncStatus(int stat)
323{ 323{
324 if (mReadOnly) return; 324 if (mReadOnly) return;
325 mSyncStatus = stat; 325 mSyncStatus = stat;
326} 326}
327 327
328int IncidenceBase::syncStatus() const 328int IncidenceBase::syncStatus() const
329{ 329{
330 return mSyncStatus; 330 return mSyncStatus;
331} 331}
332 332
333void IncidenceBase::setPilotId( int id ) 333void IncidenceBase::setPilotId( int id )
334{ 334{
335 if (mReadOnly) return; 335 if (mReadOnly) return;
336 mPilotId = id; 336 mPilotId = id;
337} 337}
338 338
339int IncidenceBase::pilotId() const 339int IncidenceBase::pilotId() const
340{ 340{