-rw-r--r-- | korganizer/koviewmanager.cpp | 2 | ||||
-rw-r--r-- | korganizer/kowhatsnextview.cpp | 29 | ||||
-rw-r--r-- | korganizer/kowhatsnextview.h | 9 |
3 files changed, 34 insertions, 6 deletions
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp index ba77b45..8e6cc53 100644 --- a/korganizer/koviewmanager.cpp +++ b/korganizer/koviewmanager.cpp | |||
@@ -1,575 +1,575 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | 3 | ||
4 | Copyright (c) 2001 | 4 | Copyright (c) 2001 |
5 | Cornelius Schumacher <schumacher@kde.org> | 5 | Cornelius Schumacher <schumacher@kde.org> |
6 | 6 | ||
7 | This program is free software; you can redistribute it and/or modify | 7 | This program is free software; you can redistribute it and/or modify |
8 | it under the terms of the GNU General Public License as published by | 8 | it under the terms of the GNU General Public License as published by |
9 | the Free Software Foundation; either version 2 of the License, or | 9 | the Free Software Foundation; either version 2 of the License, or |
10 | (at your option) any later version. | 10 | (at your option) any later version. |
11 | 11 | ||
12 | This program is distributed in the hope that it will be useful, | 12 | This program is distributed in the hope that it will be useful, |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the |
15 | GNU General Public License for more details. | 15 | GNU General Public License for more details. |
16 | 16 | ||
17 | You should have received a copy of the GNU General Public License | 17 | You should have received a copy of the GNU General Public License |
18 | along with this program; if not, write to the Free Software | 18 | along with this program; if not, write to the Free Software |
19 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 19 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
20 | 20 | ||
21 | As a special exception, permission is given to link this program | 21 | As a special exception, permission is given to link this program |
22 | with any edition of Qt, and distribute the resulting executable, | 22 | with any edition of Qt, and distribute the resulting executable, |
23 | without including the source code for Qt in the source distribution. | 23 | without including the source code for Qt in the source distribution. |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include <qwidgetstack.h> | 26 | #include <qwidgetstack.h> |
27 | 27 | ||
28 | #include <kconfig.h> | 28 | #include <kconfig.h> |
29 | #include <kglobal.h> | 29 | #include <kglobal.h> |
30 | #ifndef DESKTOP_VERSION | 30 | #ifndef DESKTOP_VERSION |
31 | #include <qpe/qpeapplication.h> | 31 | #include <qpe/qpeapplication.h> |
32 | #else | 32 | #else |
33 | #include <qapplication.h> | 33 | #include <qapplication.h> |
34 | #endif | 34 | #endif |
35 | #include "calendarview.h" | 35 | #include "calendarview.h" |
36 | #include "datenavigator.h" | 36 | #include "datenavigator.h" |
37 | #include "kotodoview.h" | 37 | #include "kotodoview.h" |
38 | #include "koagendaview.h" | 38 | #include "koagendaview.h" |
39 | #include "kodialogmanager.h" | 39 | #include "kodialogmanager.h" |
40 | #include "komonthview.h" | 40 | #include "komonthview.h" |
41 | #include "kolistview.h" | 41 | #include "kolistview.h" |
42 | #include "kowhatsnextview.h" | 42 | #include "kowhatsnextview.h" |
43 | #include "kojournalview.h" | 43 | #include "kojournalview.h" |
44 | #include "kotimespanview.h" | 44 | #include "kotimespanview.h" |
45 | #include "koprefs.h" | 45 | #include "koprefs.h" |
46 | #include "navigatorbar.h" | 46 | #include "navigatorbar.h" |
47 | 47 | ||
48 | #include "koviewmanager.h" | 48 | #include "koviewmanager.h" |
49 | //extern bool externFlagMonthviewBlockPainting; | 49 | //extern bool externFlagMonthviewBlockPainting; |
50 | 50 | ||
51 | //bool globalFlagBlockPainting = false; | 51 | //bool globalFlagBlockPainting = false; |
52 | int globalFlagBlockAgenda = 0; | 52 | int globalFlagBlockAgenda = 0; |
53 | int globalFlagBlockLabel = 0; | 53 | int globalFlagBlockLabel = 0; |
54 | int globalFlagBlockAgendaItemPaint = 1; | 54 | int globalFlagBlockAgendaItemPaint = 1; |
55 | int globalFlagBlockAgendaItemUpdate = 1; | 55 | int globalFlagBlockAgendaItemUpdate = 1; |
56 | 56 | ||
57 | 57 | ||
58 | KOViewManager::KOViewManager( CalendarView *mainView ) : | 58 | KOViewManager::KOViewManager( CalendarView *mainView ) : |
59 | QObject(), mMainView( mainView ) | 59 | QObject(), mMainView( mainView ) |
60 | { | 60 | { |
61 | mCurrentView = 0; | 61 | mCurrentView = 0; |
62 | 62 | ||
63 | mWhatsNextView = 0; | 63 | mWhatsNextView = 0; |
64 | mTodoView = 0; | 64 | mTodoView = 0; |
65 | mAgendaView = 0; | 65 | mAgendaView = 0; |
66 | mMonthView = 0; | 66 | mMonthView = 0; |
67 | mListView = 0; | 67 | mListView = 0; |
68 | mJournalView = 0; | 68 | mJournalView = 0; |
69 | mTimeSpanView = 0; | 69 | mTimeSpanView = 0; |
70 | mCurrentAgendaView = 0 ; | 70 | mCurrentAgendaView = 0 ; |
71 | mFlagShowNextxDays = false; | 71 | mFlagShowNextxDays = false; |
72 | } | 72 | } |
73 | 73 | ||
74 | KOViewManager::~KOViewManager() | 74 | KOViewManager::~KOViewManager() |
75 | { | 75 | { |
76 | } | 76 | } |
77 | 77 | ||
78 | 78 | ||
79 | KOrg::BaseView *KOViewManager::currentView() | 79 | KOrg::BaseView *KOViewManager::currentView() |
80 | { | 80 | { |
81 | return mCurrentView; | 81 | return mCurrentView; |
82 | } | 82 | } |
83 | 83 | ||
84 | void KOViewManager::readSettings(KConfig *config) | 84 | void KOViewManager::readSettings(KConfig *config) |
85 | { | 85 | { |
86 | config->setGroup("General"); | 86 | config->setGroup("General"); |
87 | QString view = config->readEntry("Current View"); | 87 | QString view = config->readEntry("Current View"); |
88 | if (view == "WhatsNext") showWhatsNextView(); | 88 | if (view == "WhatsNext") showWhatsNextView(); |
89 | else if (view == "Month") showMonthView(); | 89 | else if (view == "Month") showMonthView(); |
90 | else if (view == "List") showListView(); | 90 | else if (view == "List") showListView(); |
91 | else if (view == "Journal") showJournalView(); | 91 | else if (view == "Journal") showJournalView(); |
92 | else if (view == "TimeSpan") showTimeSpanView(); | 92 | else if (view == "TimeSpan") showTimeSpanView(); |
93 | else if (view == "Todo") showTodoView(); | 93 | else if (view == "Todo") showTodoView(); |
94 | else { | 94 | else { |
95 | showAgendaView(); | 95 | showAgendaView(); |
96 | } | 96 | } |
97 | } | 97 | } |
98 | 98 | ||
99 | void KOViewManager::writeSettings(KConfig *config) | 99 | void KOViewManager::writeSettings(KConfig *config) |
100 | { | 100 | { |
101 | config->setGroup("General"); | 101 | config->setGroup("General"); |
102 | 102 | ||
103 | QString view; | 103 | QString view; |
104 | if (mCurrentView == mWhatsNextView) view = "WhatsNext"; | 104 | if (mCurrentView == mWhatsNextView) view = "WhatsNext"; |
105 | else if (mCurrentView == mMonthView) view = "Month"; | 105 | else if (mCurrentView == mMonthView) view = "Month"; |
106 | else if (mCurrentView == mListView) view = "List"; | 106 | else if (mCurrentView == mListView) view = "List"; |
107 | else if (mCurrentView == mJournalView) view = "Journal"; | 107 | else if (mCurrentView == mJournalView) view = "Journal"; |
108 | else if (mCurrentView == mTimeSpanView) view = "TimeSpan"; | 108 | else if (mCurrentView == mTimeSpanView) view = "TimeSpan"; |
109 | else if (mCurrentView == mTodoView) view = "Todo"; | 109 | else if (mCurrentView == mTodoView) view = "Todo"; |
110 | else view = "Agenda"; | 110 | else view = "Agenda"; |
111 | 111 | ||
112 | config->writeEntry("Current View",view); | 112 | config->writeEntry("Current View",view); |
113 | 113 | ||
114 | if (mAgendaView) { | 114 | if (mAgendaView) { |
115 | mAgendaView->writeSettings(config); | 115 | mAgendaView->writeSettings(config); |
116 | } | 116 | } |
117 | if (mTimeSpanView) { | 117 | if (mTimeSpanView) { |
118 | mTimeSpanView->writeSettings(config); | 118 | mTimeSpanView->writeSettings(config); |
119 | } | 119 | } |
120 | if (mListView) { | 120 | if (mListView) { |
121 | mListView->writeSettings(config); | 121 | mListView->writeSettings(config); |
122 | } | 122 | } |
123 | if (mTodoView) { | 123 | if (mTodoView) { |
124 | mTodoView->saveLayout(config,"Todo View"); | 124 | mTodoView->saveLayout(config,"Todo View"); |
125 | } | 125 | } |
126 | } | 126 | } |
127 | 127 | ||
128 | void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) | 128 | void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) |
129 | { | 129 | { |
130 | 130 | ||
131 | //mFlagShowNextxDays = false; | 131 | //mFlagShowNextxDays = false; |
132 | //if(view == mCurrentView) return; | 132 | //if(view == mCurrentView) return; |
133 | if ( view == 0 ) { | 133 | if ( view == 0 ) { |
134 | view = mCurrentView; | 134 | view = mCurrentView; |
135 | if ( view == 0 ) | 135 | if ( view == 0 ) |
136 | return; | 136 | return; |
137 | } | 137 | } |
138 | bool full = fullScreen; | 138 | bool full = fullScreen; |
139 | if(view == mCurrentView && view != mWhatsNextView ) { | 139 | if(view == mCurrentView && view != mWhatsNextView ) { |
140 | if ( mCurrentAgendaView < 0 ) | 140 | if ( mCurrentAgendaView < 0 ) |
141 | return; | 141 | return; |
142 | full = mMainView->leftFrame()->isVisible(); | 142 | full = mMainView->leftFrame()->isVisible(); |
143 | } else { | 143 | } else { |
144 | mCurrentView = view; | 144 | mCurrentView = view; |
145 | 145 | ||
146 | // bool full = fullScreen; | 146 | // bool full = fullScreen; |
147 | bool isFull = !mMainView->leftFrame()->isVisible(); | 147 | bool isFull = !mMainView->leftFrame()->isVisible(); |
148 | if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) | 148 | if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) |
149 | full = true; | 149 | full = true; |
150 | if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) | 150 | if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) |
151 | full = false; | 151 | full = false; |
152 | } | 152 | } |
153 | if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); | 153 | if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); |
154 | raiseCurrentView( full ); | 154 | raiseCurrentView( full ); |
155 | mMainView->processIncidenceSelection( 0 ); | 155 | mMainView->processIncidenceSelection( 0 ); |
156 | mMainView->updateView(); | 156 | mMainView->updateView(); |
157 | mMainView->adaptNavigationUnits(); | 157 | mMainView->adaptNavigationUnits(); |
158 | } | 158 | } |
159 | 159 | ||
160 | void KOViewManager::raiseCurrentView( bool fullScreen ) | 160 | void KOViewManager::raiseCurrentView( bool fullScreen ) |
161 | { | 161 | { |
162 | //qDebug("raiseCurrentView "); | 162 | //qDebug("raiseCurrentView "); |
163 | mCurrentAgendaView = 0; | 163 | mCurrentAgendaView = 0; |
164 | int wid = mMainView->width() ; | 164 | int wid = mMainView->width() ; |
165 | int hei = mMainView->height(); | 165 | int hei = mMainView->height(); |
166 | if ( mCurrentView == mMonthView ) { | 166 | if ( mCurrentView == mMonthView ) { |
167 | mMainView->navigatorBar()->show(); | 167 | mMainView->navigatorBar()->show(); |
168 | hei -= mMainView->navigatorBar()->sizeHint().height(); | 168 | hei -= mMainView->navigatorBar()->sizeHint().height(); |
169 | //mMainView->navigatorBar()->hide(); | 169 | //mMainView->navigatorBar()->hide(); |
170 | } else { | 170 | } else { |
171 | mMainView->navigatorBar()->hide(); | 171 | mMainView->navigatorBar()->hide(); |
172 | } | 172 | } |
173 | if ( fullScreen ) { | 173 | if ( fullScreen ) { |
174 | mMainView->leftFrame()->hide(); | 174 | mMainView->leftFrame()->hide(); |
175 | } else { | 175 | } else { |
176 | mMainView->leftFrame()->show(); | 176 | mMainView->leftFrame()->show(); |
177 | if ( KOPrefs::instance()->mVerticalScreen ) | 177 | if ( KOPrefs::instance()->mVerticalScreen ) |
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 | ||
206 | void KOViewManager::updateView() | 206 | void 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 | ||
216 | void KOViewManager::updateView(const QDate &start, const QDate &end) | 216 | void 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 | ||
226 | void KOViewManager::updateWNview() | 226 | void KOViewManager::updateWNview() |
227 | { | 227 | { |
228 | if ( mCurrentView == mWhatsNextView && mWhatsNextView ) | 228 | if ( mCurrentView == mWhatsNextView && mWhatsNextView ) |
229 | mWhatsNextView->updateView(); | 229 | mWhatsNextView->updateView(); |
230 | 230 | ||
231 | } | 231 | } |
232 | void KOViewManager::showWhatsNextView() | 232 | void KOViewManager::showWhatsNextView() |
233 | { | 233 | { |
234 | if (!mWhatsNextView) { | 234 | if (!mWhatsNextView) { |
235 | mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(), | 235 | mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(), |
236 | "KOViewManager::WhatsNextView"); | 236 | "KOViewManager::WhatsNextView"); |
237 | mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog()); | 237 | mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog()); |
238 | connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig())); | 238 | connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig())); |
239 | addView(mWhatsNextView); | 239 | addView(mWhatsNextView); |
240 | } | 240 | } |
241 | globalFlagBlockAgenda = 1; | 241 | globalFlagBlockAgenda = 1; |
242 | showView(mWhatsNextView, true ); | 242 | showView(mWhatsNextView, true ); |
243 | mWhatsNextView->updateView(); | 243 | //mWhatsNextView->updateView(); |
244 | 244 | ||
245 | } | 245 | } |
246 | 246 | ||
247 | void KOViewManager::showListView() | 247 | void KOViewManager::showListView() |
248 | { | 248 | { |
249 | if (!mListView) { | 249 | if (!mListView) { |
250 | mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView"); | 250 | mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView"); |
251 | addView(mListView); | 251 | addView(mListView); |
252 | 252 | ||
253 | connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)), | 253 | connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)), |
254 | mMainView, SLOT(showIncidence(Incidence *))); | 254 | mMainView, SLOT(showIncidence(Incidence *))); |
255 | connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)), | 255 | connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)), |
256 | mMainView, SLOT(editIncidence(Incidence *))); | 256 | mMainView, SLOT(editIncidence(Incidence *))); |
257 | connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)), | 257 | connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)), |
258 | mMainView, SLOT(deleteIncidence(Incidence *))); | 258 | mMainView, SLOT(deleteIncidence(Incidence *))); |
259 | connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ), | 259 | connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ), |
260 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 260 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
261 | connect( mListView, SIGNAL( signalNewEvent() ), | 261 | connect( mListView, SIGNAL( signalNewEvent() ), |
262 | mMainView, SLOT( newEvent() ) ); | 262 | mMainView, SLOT( newEvent() ) ); |
263 | connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig())); | 263 | connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig())); |
264 | connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), | 264 | connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), |
265 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); | 265 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); |
266 | connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), | 266 | connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), |
267 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); | 267 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); |
268 | connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ), | 268 | connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ), |
269 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 269 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
270 | connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ), | 270 | connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ), |
271 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 271 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
272 | } | 272 | } |
273 | // bool temp = mFlagShowNextxDays; | 273 | // bool temp = mFlagShowNextxDays; |
274 | //globalFlagBlockPainting = true; | 274 | //globalFlagBlockPainting = true; |
275 | globalFlagBlockAgenda = 1; | 275 | globalFlagBlockAgenda = 1; |
276 | if ( KOPrefs::instance()->mListViewMonthTimespan ) | 276 | if ( KOPrefs::instance()->mListViewMonthTimespan ) |
277 | mMainView->dateNavigator()->selectMonth(); | 277 | mMainView->dateNavigator()->selectMonth(); |
278 | showView(mListView, KOPrefs::instance()->mFullViewTodo); | 278 | showView(mListView, KOPrefs::instance()->mFullViewTodo); |
279 | //mFlagShowNextxDays = temp; | 279 | //mFlagShowNextxDays = temp; |
280 | } | 280 | } |
281 | 281 | ||
282 | void KOViewManager::showAgendaView( bool fullScreen ) | 282 | void KOViewManager::showAgendaView( bool fullScreen ) |
283 | { | 283 | { |
284 | 284 | ||
285 | mMainView->dialogManager()->hideSearchDialog(); | 285 | mMainView->dialogManager()->hideSearchDialog(); |
286 | // qDebug("KOViewManager::showAgendaView "); | 286 | // qDebug("KOViewManager::showAgendaView "); |
287 | bool full; | 287 | bool full; |
288 | full = fullScreen; | 288 | full = fullScreen; |
289 | if (!mAgendaView) { | 289 | if (!mAgendaView) { |
290 | full = false; | 290 | full = false; |
291 | mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView"); | 291 | mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView"); |
292 | addView(mAgendaView); | 292 | addView(mAgendaView); |
293 | #ifndef DESKTOP_VERSION | 293 | #ifndef DESKTOP_VERSION |
294 | QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold ); | 294 | QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold ); |
295 | #endif | 295 | #endif |
296 | connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )), | 296 | connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )), |
297 | mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) )); | 297 | mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) )); |
298 | 298 | ||
299 | // SIGNALS/SLOTS FOR DAY/WEEK VIEW | 299 | // SIGNALS/SLOTS FOR DAY/WEEK VIEW |
300 | connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)), | 300 | connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)), |
301 | mMainView, SLOT(newEvent(QDateTime))); | 301 | mMainView, SLOT(newEvent(QDateTime))); |
302 | // connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)), | 302 | // connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)), |
303 | // mMainView, SLOT(newEvent(QDateTime,QDateTime))); | 303 | // mMainView, SLOT(newEvent(QDateTime,QDateTime))); |
304 | connect(mAgendaView,SIGNAL(newEventSignal(QDate)), | 304 | connect(mAgendaView,SIGNAL(newEventSignal(QDate)), |
305 | mMainView, SLOT(newEvent(QDate))); | 305 | mMainView, SLOT(newEvent(QDate))); |
306 | 306 | ||
307 | connect(mAgendaView, SIGNAL(editIncidenceSignal(Incidence *)), | 307 | connect(mAgendaView, SIGNAL(editIncidenceSignal(Incidence *)), |
308 | mMainView, SLOT(editIncidence(Incidence *))); | 308 | mMainView, SLOT(editIncidence(Incidence *))); |
309 | connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)), | 309 | connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)), |
310 | mMainView, SLOT(showIncidence(Incidence *))); | 310 | mMainView, SLOT(showIncidence(Incidence *))); |
311 | connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)), | 311 | connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)), |
312 | mMainView, SLOT(deleteIncidence(Incidence *))); | 312 | mMainView, SLOT(deleteIncidence(Incidence *))); |
313 | 313 | ||
314 | connect( mAgendaView, SIGNAL( incidenceSelected( Incidence * ) ), | 314 | connect( mAgendaView, SIGNAL( incidenceSelected( Incidence * ) ), |
315 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 315 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
316 | 316 | ||
317 | connect(mAgendaView, SIGNAL( toggleExpand() ), | 317 | connect(mAgendaView, SIGNAL( toggleExpand() ), |
318 | mMainView, SLOT( toggleExpand() ) ); | 318 | mMainView, SLOT( toggleExpand() ) ); |
319 | 319 | ||
320 | connect(mMainView, SIGNAL( calendarViewExpanded( bool ) ), | 320 | connect(mMainView, SIGNAL( calendarViewExpanded( bool ) ), |
321 | mAgendaView, SLOT( setExpandedButton( bool ) ) ); | 321 | mAgendaView, SLOT( setExpandedButton( bool ) ) ); |
322 | connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ), | 322 | connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ), |
323 | mMainView, SLOT(cloneIncidence(Incidence *) ) ) ; | 323 | mMainView, SLOT(cloneIncidence(Incidence *) ) ) ; |
324 | connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ), | 324 | connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ), |
325 | mMainView, SLOT(cancelIncidence(Incidence *) ) ) ; | 325 | mMainView, SLOT(cancelIncidence(Incidence *) ) ) ; |
326 | connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig())); | 326 | connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig())); |
327 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView, | 327 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView, |
328 | SLOT( updateTodo( Todo *, int ) ) ); | 328 | SLOT( updateTodo( Todo *, int ) ) ); |
329 | connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )), | 329 | connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )), |
330 | mMainView, SIGNAL( todoModified( Todo *, int ))); | 330 | mMainView, SIGNAL( todoModified( Todo *, int ))); |
331 | connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ), | 331 | connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ), |
332 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 332 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
333 | connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ), | 333 | connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ), |
334 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 334 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
335 | mAgendaView->readSettings(); | 335 | mAgendaView->readSettings(); |
336 | mAgendaView->updateConfig(); | 336 | mAgendaView->updateConfig(); |
337 | } | 337 | } |
338 | 338 | ||
339 | showView( mAgendaView, full); | 339 | showView( mAgendaView, full); |
340 | 340 | ||
341 | } | 341 | } |
342 | 342 | ||
343 | void KOViewManager::showDayView() | 343 | void KOViewManager::showDayView() |
344 | { | 344 | { |
345 | mFlagShowNextxDays = false; | 345 | mFlagShowNextxDays = false; |
346 | globalFlagBlockLabel = 1; | 346 | globalFlagBlockLabel = 1; |
347 | globalFlagBlockAgenda = 1; | 347 | globalFlagBlockAgenda = 1; |
348 | if ( mCurrentAgendaView != 1 ) | 348 | if ( mCurrentAgendaView != 1 ) |
349 | mCurrentAgendaView = -1; | 349 | mCurrentAgendaView = -1; |
350 | showAgendaView(); | 350 | showAgendaView(); |
351 | qApp->processEvents(); | 351 | qApp->processEvents(); |
352 | globalFlagBlockAgenda = 2; | 352 | globalFlagBlockAgenda = 2; |
353 | globalFlagBlockLabel = 0; | 353 | globalFlagBlockLabel = 0; |
354 | mMainView->dateNavigator()->selectDates( 1 ); | 354 | mMainView->dateNavigator()->selectDates( 1 ); |
355 | mCurrentAgendaView = 1 ; | 355 | mCurrentAgendaView = 1 ; |
356 | 356 | ||
357 | } | 357 | } |
358 | 358 | ||
359 | void KOViewManager::showWorkWeekView() | 359 | void KOViewManager::showWorkWeekView() |
360 | { | 360 | { |
361 | mFlagShowNextxDays = false; | 361 | mFlagShowNextxDays = false; |
362 | globalFlagBlockAgenda = 1; | 362 | globalFlagBlockAgenda = 1; |
363 | globalFlagBlockLabel = 1; | 363 | globalFlagBlockLabel = 1; |
364 | if ( mCurrentAgendaView != 5 ) | 364 | if ( mCurrentAgendaView != 5 ) |
365 | mCurrentAgendaView = -1; | 365 | mCurrentAgendaView = -1; |
366 | showAgendaView(); | 366 | showAgendaView(); |
367 | qApp->processEvents(); | 367 | qApp->processEvents(); |
368 | globalFlagBlockAgenda = 2; | 368 | globalFlagBlockAgenda = 2; |
369 | globalFlagBlockLabel = 0; | 369 | globalFlagBlockLabel = 0; |
370 | mMainView->dateNavigator()->selectWorkWeek(); | 370 | mMainView->dateNavigator()->selectWorkWeek(); |
371 | mCurrentAgendaView = 5 ; | 371 | mCurrentAgendaView = 5 ; |
372 | 372 | ||
373 | } | 373 | } |
374 | 374 | ||
375 | void KOViewManager::showWeekView() | 375 | void KOViewManager::showWeekView() |
376 | { | 376 | { |
377 | /* | 377 | /* |
378 | globalFlagBlockAgenda = 2; | 378 | globalFlagBlockAgenda = 2; |
379 | qDebug("4globalFlagBlockAgenda = 2; "); | 379 | qDebug("4globalFlagBlockAgenda = 2; "); |
380 | //globalFlagBlockPainting = true; | 380 | //globalFlagBlockPainting = true; |
381 | mMainView->dateNavigator()->selectWeek(); | 381 | mMainView->dateNavigator()->selectWeek(); |
382 | showAgendaView(); | 382 | showAgendaView(); |
383 | */ | 383 | */ |
384 | 384 | ||
385 | 385 | ||
386 | mFlagShowNextxDays = false; | 386 | mFlagShowNextxDays = false; |
387 | globalFlagBlockAgenda = 1; | 387 | globalFlagBlockAgenda = 1; |
388 | globalFlagBlockLabel = 1; | 388 | globalFlagBlockLabel = 1; |
389 | if ( mCurrentAgendaView != 7 ) | 389 | if ( mCurrentAgendaView != 7 ) |
390 | mCurrentAgendaView = -1; | 390 | mCurrentAgendaView = -1; |
391 | showAgendaView(); | 391 | showAgendaView(); |
392 | qApp->processEvents(); | 392 | qApp->processEvents(); |
393 | globalFlagBlockAgenda = 2; | 393 | globalFlagBlockAgenda = 2; |
394 | globalFlagBlockLabel = 0; | 394 | globalFlagBlockLabel = 0; |
395 | mMainView->dateNavigator()->selectWeek(); | 395 | mMainView->dateNavigator()->selectWeek(); |
396 | mCurrentAgendaView = 7 ; | 396 | mCurrentAgendaView = 7 ; |
397 | } | 397 | } |
398 | 398 | ||
399 | void KOViewManager::showNextXView() | 399 | void KOViewManager::showNextXView() |
400 | { | 400 | { |
401 | 401 | ||
402 | globalFlagBlockAgenda = 1; | 402 | globalFlagBlockAgenda = 1; |
403 | if ( mCurrentAgendaView != 3 ) | 403 | if ( mCurrentAgendaView != 3 ) |
404 | mCurrentAgendaView = -1; | 404 | mCurrentAgendaView = -1; |
405 | showAgendaView(KOPrefs::instance()->mFullViewMonth); | 405 | showAgendaView(KOPrefs::instance()->mFullViewMonth); |
406 | globalFlagBlockAgenda = 2; | 406 | globalFlagBlockAgenda = 2; |
407 | mMainView->dateNavigator()->selectDates( QDate::currentDate(), | 407 | mMainView->dateNavigator()->selectDates( QDate::currentDate(), |
408 | KOPrefs::instance()->mNextXDays ); | 408 | KOPrefs::instance()->mNextXDays ); |
409 | mFlagShowNextxDays = true; | 409 | mFlagShowNextxDays = true; |
410 | mCurrentAgendaView = 3 ; | 410 | mCurrentAgendaView = 3 ; |
411 | } | 411 | } |
412 | bool KOViewManager::showsNextDays() | 412 | bool KOViewManager::showsNextDays() |
413 | { | 413 | { |
414 | return mFlagShowNextxDays; | 414 | return mFlagShowNextxDays; |
415 | } | 415 | } |
416 | void KOViewManager::showMonthView() | 416 | void KOViewManager::showMonthView() |
417 | { | 417 | { |
418 | if (!mMonthView) { | 418 | if (!mMonthView) { |
419 | mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView"); | 419 | mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView"); |
420 | 420 | ||
421 | addView(mMonthView); | 421 | addView(mMonthView); |
422 | // mMonthView->show(); | 422 | // mMonthView->show(); |
423 | // SIGNALS/SLOTS FOR MONTH VIEW | 423 | // SIGNALS/SLOTS FOR MONTH VIEW |
424 | connect(mMonthView, SIGNAL(newEventSignal(QDateTime)), | 424 | connect(mMonthView, SIGNAL(newEventSignal(QDateTime)), |
425 | mMainView, SLOT(newEvent(QDateTime))); | 425 | mMainView, SLOT(newEvent(QDateTime))); |
426 | 426 | ||
427 | connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)), | 427 | connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)), |
428 | mMainView, SLOT(showIncidence(Incidence *))); | 428 | mMainView, SLOT(showIncidence(Incidence *))); |
429 | connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)), | 429 | connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)), |
430 | mMainView, SLOT(editIncidence(Incidence *))); | 430 | mMainView, SLOT(editIncidence(Incidence *))); |
431 | connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)), | 431 | connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)), |
432 | mMainView, SLOT(deleteIncidence(Incidence *))); | 432 | mMainView, SLOT(deleteIncidence(Incidence *))); |
433 | 433 | ||
434 | connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ), | 434 | connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ), |
435 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 435 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
436 | connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), | 436 | connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), |
437 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); | 437 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); |
438 | connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), | 438 | connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), |
439 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); | 439 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); |
440 | 440 | ||
441 | connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ), | 441 | connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ), |
442 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 442 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
443 | connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ), | 443 | connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ), |
444 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 444 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
445 | connect( mMonthView, SIGNAL( selectWeekNum( int ) ), | 445 | connect( mMonthView, SIGNAL( selectWeekNum( int ) ), |
446 | mMainView, SLOT ( selectWeekNum( int ) ) ); | 446 | mMainView, SLOT ( selectWeekNum( int ) ) ); |
447 | connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig())); | 447 | connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig())); |
448 | mMonthView->updateConfig(); | 448 | mMonthView->updateConfig(); |
449 | } | 449 | } |
450 | 450 | ||
451 | globalFlagBlockAgenda = 1; | 451 | globalFlagBlockAgenda = 1; |
452 | //mFlagShowNextxDays = false; | 452 | //mFlagShowNextxDays = false; |
453 | // if(mMonthView == mCurrentView) return; | 453 | // if(mMonthView == mCurrentView) return; |
454 | mMainView->dateNavigator()->selectMonth(); | 454 | mMainView->dateNavigator()->selectMonth(); |
455 | // DateList tmpList = mMainView->dateNavigator()->selectedDates( ); | 455 | // DateList tmpList = mMainView->dateNavigator()->selectedDates( ); |
456 | //mMonthView->showDates(tmpList.first(), tmpList.last()); | 456 | //mMonthView->showDates(tmpList.first(), tmpList.last()); |
457 | 457 | ||
458 | showView(mMonthView, true ); | 458 | showView(mMonthView, true ); |
459 | 459 | ||
460 | } | 460 | } |
461 | 461 | ||
462 | void KOViewManager::showTodoView() | 462 | void KOViewManager::showTodoView() |
463 | { | 463 | { |
464 | //mFlagShowNextxDays = false; | 464 | //mFlagShowNextxDays = false; |
465 | if ( !mTodoView ) { | 465 | if ( !mTodoView ) { |
466 | mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(), | 466 | mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(), |
467 | "KOViewManager::TodoView" ); | 467 | "KOViewManager::TodoView" ); |
468 | 468 | ||
469 | addView( mTodoView ); | 469 | addView( mTodoView ); |
470 | // QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold ); | 470 | // QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold ); |
471 | 471 | ||
472 | // SIGNALS/SLOTS FOR TODO VIEW | 472 | // SIGNALS/SLOTS FOR TODO VIEW |
473 | connect( mTodoView, SIGNAL( newTodoSignal() ), | 473 | connect( mTodoView, SIGNAL( newTodoSignal() ), |
474 | mMainView, SLOT( newTodo() ) ); | 474 | mMainView, SLOT( newTodo() ) ); |
475 | connect( mTodoView, SIGNAL( newSubTodoSignal( Todo * ) ), | 475 | connect( mTodoView, SIGNAL( newSubTodoSignal( Todo * ) ), |
476 | mMainView, SLOT( newSubTodo( Todo *) ) ); | 476 | mMainView, SLOT( newSubTodo( Todo *) ) ); |
477 | connect( mTodoView, SIGNAL( showTodoSignal( Todo *) ), | 477 | connect( mTodoView, SIGNAL( showTodoSignal( Todo *) ), |
478 | mMainView, SLOT( showTodo( Todo * ) ) ); | 478 | mMainView, SLOT( showTodo( Todo * ) ) ); |
479 | connect( mTodoView, SIGNAL( editTodoSignal( Todo * ) ), | 479 | connect( mTodoView, SIGNAL( editTodoSignal( Todo * ) ), |
480 | mMainView, SLOT( editTodo( Todo * ) ) ); | 480 | mMainView, SLOT( editTodo( Todo * ) ) ); |
481 | connect( mTodoView, SIGNAL( deleteTodoSignal( Todo * ) ), | 481 | connect( mTodoView, SIGNAL( deleteTodoSignal( Todo * ) ), |
482 | mMainView, SLOT( deleteTodo( Todo * ) ) ); | 482 | mMainView, SLOT( deleteTodo( Todo * ) ) ); |
483 | connect( mTodoView, SIGNAL( purgeCompletedSignal() ), | 483 | connect( mTodoView, SIGNAL( purgeCompletedSignal() ), |
484 | mMainView, SLOT( purgeCompleted() ) ); | 484 | mMainView, SLOT( purgeCompleted() ) ); |
485 | 485 | ||
486 | connect( mTodoView, SIGNAL( incidenceSelected( Incidence * ) ), | 486 | connect( mTodoView, SIGNAL( incidenceSelected( Incidence * ) ), |
487 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 487 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
488 | 488 | ||
489 | connect( mMainView, SIGNAL( configChanged() ), mTodoView, | 489 | connect( mMainView, SIGNAL( configChanged() ), mTodoView, |
490 | SLOT( updateConfig() ) ); | 490 | SLOT( updateConfig() ) ); |
491 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mTodoView, | 491 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mTodoView, |
492 | SLOT( updateTodo( Todo *, int ) ) ); | 492 | SLOT( updateTodo( Todo *, int ) ) ); |
493 | connect( mTodoView, SIGNAL( todoModifiedSignal( Todo *, int ) ), | 493 | connect( mTodoView, SIGNAL( todoModifiedSignal( Todo *, int ) ), |
494 | mMainView, SIGNAL ( todoModified( Todo *, int ) ) ); | 494 | mMainView, SIGNAL ( todoModified( Todo *, int ) ) ); |
495 | connect( mTodoView, SIGNAL( cloneTodoSignal( Incidence * ) ), | 495 | connect( mTodoView, SIGNAL( cloneTodoSignal( Incidence * ) ), |
496 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); | 496 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); |
497 | connect( mTodoView, SIGNAL( cancelTodoSignal( Incidence * ) ), | 497 | connect( mTodoView, SIGNAL( cancelTodoSignal( Incidence * ) ), |
498 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); | 498 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); |
499 | connect( mTodoView, SIGNAL( unparentTodoSignal( Todo * ) ), | 499 | connect( mTodoView, SIGNAL( unparentTodoSignal( Todo * ) ), |
500 | mMainView, SLOT ( todo_unsub( Todo * ) ) ); | 500 | mMainView, SLOT ( todo_unsub( Todo * ) ) ); |
501 | connect( mTodoView, SIGNAL( moveTodoSignal( Incidence * ) ), | 501 | connect( mTodoView, SIGNAL( moveTodoSignal( Incidence * ) ), |
502 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 502 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
503 | connect( mTodoView, SIGNAL( beamTodoSignal( Incidence * ) ), | 503 | connect( mTodoView, SIGNAL( beamTodoSignal( Incidence * ) ), |
504 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 504 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
505 | KConfig *config = KOGlobals::config(); | 505 | KConfig *config = KOGlobals::config(); |
506 | mTodoView->restoreLayout(config,"Todo View"); | 506 | mTodoView->restoreLayout(config,"Todo View"); |
507 | } | 507 | } |
508 | 508 | ||
509 | globalFlagBlockAgenda = 1; | 509 | globalFlagBlockAgenda = 1; |
510 | showView( mTodoView, true ); | 510 | showView( mTodoView, true ); |
511 | 511 | ||
512 | } | 512 | } |
513 | 513 | ||
514 | void KOViewManager::showJournalView() | 514 | void KOViewManager::showJournalView() |
515 | { | 515 | { |
516 | //mFlagShowNextxDays = false; | 516 | //mFlagShowNextxDays = false; |
517 | if (!mJournalView) { | 517 | if (!mJournalView) { |
518 | mJournalView = new KOJournalView(mMainView->calendar(),mMainView->viewStack(), | 518 | mJournalView = new KOJournalView(mMainView->calendar(),mMainView->viewStack(), |
519 | "KOViewManager::JournalView"); | 519 | "KOViewManager::JournalView"); |
520 | connect( mMainView, SIGNAL( configChanged() ), mJournalView, | 520 | connect( mMainView, SIGNAL( configChanged() ), mJournalView, |
521 | SLOT( updateConfig() ) ); | 521 | SLOT( updateConfig() ) ); |
522 | connect(mJournalView, SIGNAL(deleteJournal(Journal *) ), mMainView,SLOT(deleteJournal(Journal *)) ); | 522 | connect(mJournalView, SIGNAL(deleteJournal(Journal *) ), mMainView,SLOT(deleteJournal(Journal *)) ); |
523 | addView(mJournalView); | 523 | addView(mJournalView); |
524 | } | 524 | } |
525 | 525 | ||
526 | showView(mJournalView); | 526 | showView(mJournalView); |
527 | } | 527 | } |
528 | 528 | ||
529 | void KOViewManager::showTimeSpanView() | 529 | void KOViewManager::showTimeSpanView() |
530 | { | 530 | { |
531 | //mFlagShowNextxDays = false; | 531 | //mFlagShowNextxDays = false; |
532 | if (!mTimeSpanView) { | 532 | if (!mTimeSpanView) { |
533 | mTimeSpanView = new KOTimeSpanView(mMainView->calendar(),mMainView->viewStack(), | 533 | mTimeSpanView = new KOTimeSpanView(mMainView->calendar(),mMainView->viewStack(), |
534 | "KOViewManager::TimeSpanView"); | 534 | "KOViewManager::TimeSpanView"); |
535 | addView(mTimeSpanView); | 535 | addView(mTimeSpanView); |
536 | 536 | ||
537 | mTimeSpanView->readSettings(); | 537 | mTimeSpanView->readSettings(); |
538 | } | 538 | } |
539 | 539 | ||
540 | showView(mTimeSpanView); | 540 | showView(mTimeSpanView); |
541 | } | 541 | } |
542 | 542 | ||
543 | Incidence *KOViewManager::currentSelection() | 543 | Incidence *KOViewManager::currentSelection() |
544 | { | 544 | { |
545 | if (!mCurrentView) return 0; | 545 | if (!mCurrentView) return 0; |
546 | if ( mCurrentView == mListView ) { | 546 | if ( mCurrentView == mListView ) { |
547 | if ( mListView->currentItem() ) | 547 | if ( mListView->currentItem() ) |
548 | return mListView->currentItem(); | 548 | return mListView->currentItem(); |
549 | } | 549 | } |
550 | return mCurrentView->selectedIncidences().first(); | 550 | return mCurrentView->selectedIncidences().first(); |
551 | } | 551 | } |
552 | 552 | ||
553 | QDate KOViewManager::currentSelectionDate() | 553 | QDate KOViewManager::currentSelectionDate() |
554 | { | 554 | { |
555 | QDate qd; | 555 | QDate qd; |
556 | if (mCurrentView) { | 556 | if (mCurrentView) { |
557 | DateList qvl = mCurrentView->selectedDates(); | 557 | DateList qvl = mCurrentView->selectedDates(); |
558 | if (!qvl.isEmpty()) qd = qvl.first(); | 558 | if (!qvl.isEmpty()) qd = qvl.first(); |
559 | } | 559 | } |
560 | return qd; | 560 | return qd; |
561 | } | 561 | } |
562 | 562 | ||
563 | void KOViewManager::addView(KOrg::BaseView *view) | 563 | void KOViewManager::addView(KOrg::BaseView *view) |
564 | { | 564 | { |
565 | #if QT_VERSION >= 300 | 565 | #if QT_VERSION >= 300 |
566 | mMainView->viewStack()->addWidget( view ); | 566 | mMainView->viewStack()->addWidget( view ); |
567 | #else | 567 | #else |
568 | mMainView->viewStack()->addWidget( view, 1 ); | 568 | mMainView->viewStack()->addWidget( view, 1 ); |
569 | #endif | 569 | #endif |
570 | } | 570 | } |
571 | 571 | ||
572 | void KOViewManager::setDocumentId( const QString &id ) | 572 | void KOViewManager::setDocumentId( const QString &id ) |
573 | { | 573 | { |
574 | if (mTodoView) mTodoView->setDocumentId( id ); | 574 | if (mTodoView) mTodoView->setDocumentId( id ); |
575 | } | 575 | } |
diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp index 2a8a7c1..9b53110 100644 --- a/korganizer/kowhatsnextview.cpp +++ b/korganizer/kowhatsnextview.cpp | |||
@@ -1,660 +1,683 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <qlayout.h> | 20 | #include <qlayout.h> |
21 | #include <qtextbrowser.h> | 21 | #include <qtextbrowser.h> |
22 | #include <qtextcodec.h> | 22 | #include <qtextcodec.h> |
23 | #include <qfileinfo.h> | 23 | #include <qfileinfo.h> |
24 | #include <qlabel.h> | 24 | #include <qlabel.h> |
25 | 25 | ||
26 | #include <qapplication.h> | 26 | #include <qapplication.h> |
27 | 27 | ||
28 | #include <kglobal.h> | 28 | #include <kglobal.h> |
29 | #include <klocale.h> | 29 | #include <klocale.h> |
30 | #include <kdebug.h> | 30 | #include <kdebug.h> |
31 | #include <kiconloader.h> | 31 | #include <kiconloader.h> |
32 | #include <kmessagebox.h> | 32 | #include <kmessagebox.h> |
33 | 33 | ||
34 | #include <libkcal/calendar.h> | 34 | #include <libkcal/calendar.h> |
35 | 35 | ||
36 | #ifndef KORG_NOPRINTER | 36 | #ifndef KORG_NOPRINTER |
37 | #include "calprinter.h" | 37 | #include "calprinter.h" |
38 | #endif | 38 | #endif |
39 | #include "koglobals.h" | 39 | #include "koglobals.h" |
40 | #include "koprefs.h" | 40 | #include "koprefs.h" |
41 | #include "koeventviewerdialog.h" | 41 | #include "koeventviewerdialog.h" |
42 | 42 | ||
43 | #include "kowhatsnextview.h" | 43 | #include "kowhatsnextview.h" |
44 | using namespace KOrg; | 44 | using namespace KOrg; |
45 | 45 | ||
46 | void WhatsNextTextBrowser::setSource(const QString& n) | 46 | void WhatsNextTextBrowser::setSource(const QString& n) |
47 | { | 47 | { |
48 | 48 | ||
49 | if (n.startsWith("event:")) { | 49 | if (n.startsWith("event:")) { |
50 | emit showIncidence(n); | 50 | emit showIncidence(n); |
51 | return; | 51 | return; |
52 | } else if (n.startsWith("todo:")) { | 52 | } else if (n.startsWith("todo:")) { |
53 | emit showIncidence(n); | 53 | emit showIncidence(n); |
54 | return; | 54 | return; |
55 | } else { | 55 | } else { |
56 | QTextBrowser::setSource(n); | 56 | QTextBrowser::setSource(n); |
57 | } | 57 | } |
58 | } | 58 | } |
59 | 59 | ||
60 | KOWhatsNextView::KOWhatsNextView(Calendar *calendar, QWidget *parent, | 60 | KOWhatsNextView::KOWhatsNextView(Calendar *calendar, QWidget *parent, |
61 | const char *name) | 61 | const char *name) |
62 | : KOrg::BaseView(calendar, parent, name) | 62 | : KOrg::BaseView(calendar, parent, name) |
63 | { | 63 | { |
64 | // mDateLabel = | 64 | // mDateLabel = |
65 | // new QLabel(KGlobal::locale()->formatDate(QDate::currentDate()),this); | 65 | // new QLabel(KGlobal::locale()->formatDate(QDate::currentDate()),this); |
66 | // mDateLabel->setMargin(2); | 66 | // mDateLabel->setMargin(2); |
67 | // mDateLabel->setAlignment(AlignCenter); | 67 | // mDateLabel->setAlignment(AlignCenter); |
68 | setFont( KOPrefs::instance()->mWhatsNextFont ); | 68 | setFont( KOPrefs::instance()->mWhatsNextFont ); |
69 | mView = new WhatsNextTextBrowser(this); | 69 | mView = new WhatsNextTextBrowser(this); |
70 | connect(mView,SIGNAL(showIncidence(const QString &)),SLOT(showIncidence(const QString &))); | 70 | connect(mView,SIGNAL(showIncidence(const QString &)),SLOT(showIncidence(const QString &))); |
71 | 71 | ||
72 | mEventViewer = 0; | 72 | mEventViewer = 0; |
73 | 73 | ||
74 | QBoxLayout *topLayout = new QVBoxLayout(this); | 74 | QBoxLayout *topLayout = new QVBoxLayout(this); |
75 | // topLayout->addWidget(mDateLabel); | 75 | // topLayout->addWidget(mDateLabel); |
76 | topLayout->addWidget(mView); | 76 | topLayout->addWidget(mView); |
77 | mTimer = new QTimer( this ); | ||
78 | connect(mTimer,SIGNAL( timeout() ),this, SLOT(updateView())); | ||
79 | |||
80 | connect(mView->horizontalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer())); | ||
81 | connect(mView->verticalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer())); | ||
77 | } | 82 | } |
78 | 83 | ||
79 | KOWhatsNextView::~KOWhatsNextView() | 84 | KOWhatsNextView::~KOWhatsNextView() |
80 | { | 85 | { |
81 | } | 86 | } |
82 | 87 | ||
83 | int KOWhatsNextView::maxDatesHint() | 88 | int KOWhatsNextView::maxDatesHint() |
84 | { | 89 | { |
85 | return 0; | 90 | return 0; |
86 | } | 91 | } |
87 | 92 | ||
88 | int KOWhatsNextView::currentDateCount() | 93 | int KOWhatsNextView::currentDateCount() |
89 | { | 94 | { |
90 | return 0; | 95 | return 0; |
91 | } | 96 | } |
92 | 97 | ||
93 | QPtrList<Incidence> KOWhatsNextView::selectedIncidences() | 98 | QPtrList<Incidence> KOWhatsNextView::selectedIncidences() |
94 | { | 99 | { |
95 | QPtrList<Incidence> eventList; | 100 | QPtrList<Incidence> eventList; |
96 | 101 | ||
97 | return eventList; | 102 | return eventList; |
98 | } | 103 | } |
99 | 104 | ||
100 | 105 | ||
101 | void KOWhatsNextView::printPreview(CalPrinter *calPrinter, const QDate &fd, | 106 | void KOWhatsNextView::printPreview(CalPrinter *calPrinter, const QDate &fd, |
102 | const QDate &td) | 107 | const QDate &td) |
103 | { | 108 | { |
104 | #ifndef KORG_NOPRINTER | 109 | #ifndef KORG_NOPRINTER |
105 | calPrinter->preview(CalPrinter::Day, fd, td); | 110 | calPrinter->preview(CalPrinter::Day, fd, td); |
106 | #endif | 111 | #endif |
107 | } | 112 | } |
108 | void KOWhatsNextView::updateConfig() | 113 | void KOWhatsNextView::updateConfig() |
109 | { | 114 | { |
110 | setFont( KOPrefs::instance()->mWhatsNextFont ); | 115 | setFont( KOPrefs::instance()->mWhatsNextFont ); |
111 | updateView(); | 116 | updateView(); |
112 | 117 | ||
113 | } | 118 | } |
119 | void KOWhatsNextView::showEvent ( QShowEvent * e ) | ||
120 | { | ||
121 | //qDebug("KOWhatsNextView::showEvent "); | ||
122 | restartTimer(); | ||
123 | QWidget::showEvent ( e ); | ||
124 | } | ||
125 | void KOWhatsNextView::hideEvent ( QHideEvent * e) | ||
126 | { | ||
127 | //qDebug(" KOWhatsNextView::hideEvent"); | ||
128 | mTimer->stop(); | ||
129 | QWidget::hideEvent ( e ); | ||
130 | } | ||
131 | void KOWhatsNextView::restartTimer() | ||
132 | { | ||
133 | //qDebug("KOWhatsNextView::restartTimer() "); | ||
134 | mTimer->start( 180000 ); | ||
135 | //mTimer->start( 5000 ); | ||
136 | } | ||
114 | void KOWhatsNextView::updateView() | 137 | void KOWhatsNextView::updateView() |
115 | { | 138 | { |
116 | 139 | if ( mTimer->isActive() ) | |
140 | restartTimer(); | ||
141 | //qDebug("KOWhatsNextView::updateView() "); | ||
117 | // mDateLabel->setText(KGlobal::locale()->formatDate(QDate::currentDate())); | 142 | // mDateLabel->setText(KGlobal::locale()->formatDate(QDate::currentDate())); |
118 | KIconLoader kil("korganizer"); | 143 | KIconLoader kil("korganizer"); |
119 | QString ipath;// = new QString(); | 144 | QString ipath;// = new QString(); |
120 | // kil.loadIcon("korganizer",KIcon::NoGroup,32,KIcon::DefaultState,&ipath); | 145 | // kil.loadIcon("korganizer",KIcon::NoGroup,32,KIcon::DefaultState,&ipath); |
121 | //<big><big><strong>" + date + "</strong></big></big>\n"; | 146 | //<big><big><strong>" + date + "</strong></big></big>\n"; |
122 | mText = "<table width=\"100%\">\n"; | 147 | mText = "<table width=\"100%\">\n"; |
123 | //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; | 148 | //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; |
124 | #ifdef DESKTOP_VERSION | 149 | #ifdef DESKTOP_VERSION |
125 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h1>"; | 150 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h1>"; |
126 | #else | 151 | #else |
127 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>"; | 152 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>"; |
128 | #endif | 153 | #endif |
129 | // mText += "<img src=\""; | 154 | // mText += "<img src=\""; |
130 | // mText += ipath; | 155 | // mText += ipath; |
131 | // mText += "\">"; | 156 | // mText += "\">"; |
132 | mEventDate = QDate::currentDate(); | 157 | mEventDate = QDate::currentDate(); |
133 | #ifdef DESKTOP_VERSION | 158 | #ifdef DESKTOP_VERSION |
134 | mText += "<font color=\"#FFFFFF\"> <em>" + KGlobal::locale()->formatDate( mEventDate , false )+"</em></font></h1>"; | 159 | mText += "<font color=\"#FFFFFF\"> <em>" + KGlobal::locale()->formatDate( mEventDate , false )+"</em></font></h1>"; |
135 | #else | 160 | #else |
136 | mText += "<font color=\"#FFFFFF\"> <em>" + KGlobal::locale()->formatDate( mEventDate , false )+"</em></font></h2>"; | 161 | mText += "<font color=\"#FFFFFF\"> <em>" + KGlobal::locale()->formatDate( mEventDate , false )+"</em></font></h2>"; |
137 | #endif | 162 | #endif |
138 | mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>"; | 163 | mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>"; |
139 | int iii; | 164 | int iii; |
140 | mTodos.clear(); | 165 | mTodos.clear(); |
141 | QPtrList<Event> events; | 166 | QPtrList<Event> events; |
142 | QPtrList<Todo> todos = calendar()->todos(); | 167 | QPtrList<Todo> todos = calendar()->todos(); |
143 | Todo * todo; | 168 | Todo * todo; |
144 | //mText += "<h2>" + i18n("Events: ") + "</h2>\n"; | 169 | //mText += "<h2>" + i18n("Events: ") + "</h2>\n"; |
145 | int daysToShow = KOPrefs::instance()->mWhatsNextDays ; | 170 | int daysToShow = KOPrefs::instance()->mWhatsNextDays ; |
146 | bool itemAdded = false; | 171 | bool itemAdded = false; |
147 | for ( iii = 0; iii < daysToShow; ++iii ) { | 172 | for ( iii = 0; iii < daysToShow; ++iii ) { |
148 | QString date; | 173 | QString date; |
149 | itemAdded = false; | 174 | itemAdded = false; |
150 | events = calendar()->events( mEventDate, true ); | 175 | events = calendar()->events( mEventDate, true ); |
151 | 176 | ||
152 | if ( iii == 0 ) { // today !!! | 177 | if ( iii == 0 ) { // today !!! |
153 | todo = todos.first(); | 178 | todo = todos.first(); |
154 | while(todo) { | 179 | while(todo) { |
155 | if ( !todo->isCompleted() &&todo->hasDueDate() && todo->dtDue().date() < mEventDate ) { | 180 | if ( !todo->isCompleted() &&todo->hasDueDate() && todo->dtDue().date() < mEventDate ) { |
156 | if ( ! itemAdded ) { | 181 | if ( ! itemAdded ) { |
157 | appendDay ( iii, mEventDate ); | 182 | appendDay ( iii, mEventDate ); |
158 | itemAdded = true; | 183 | itemAdded = true; |
159 | 184 | ||
160 | } | 185 | } |
161 | appendEvent(todo); | 186 | appendEvent(todo); |
162 | } | 187 | } |
163 | todo = todos.next(); | 188 | todo = todos.next(); |
164 | } | 189 | } |
165 | } | 190 | } |
166 | 191 | ||
167 | 192 | ||
168 | if (events.count() > 0) { | 193 | if (events.count() > 0) { |
169 | // mText += "<p></p>"; | 194 | // mText += "<p></p>"; |
170 | // kil.loadIcon("month",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); | 195 | // kil.loadIcon("month",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); |
171 | // mText += "<h2>"; | 196 | // mText += "<h2>"; |
172 | //mText += " <img src=\""; | 197 | //mText += " <img src=\""; |
173 | //mText += ipath; | 198 | //mText += ipath; |
174 | //mText += "\">"; | 199 | //mText += "\">"; |
175 | if ( ! itemAdded ) { | 200 | if ( ! itemAdded ) { |
176 | appendDay ( iii, mEventDate ); | 201 | appendDay ( iii, mEventDate ); |
177 | itemAdded = true; | 202 | itemAdded = true; |
178 | 203 | ||
179 | } | 204 | } |
180 | Event *ev = events.first(); | 205 | Event *ev = events.first(); |
181 | while(ev) { | 206 | while(ev) { |
182 | //qDebug("+++++event append %s", ev->summary().latin1()); | 207 | //qDebug("+++++event append %s", ev->summary().latin1()); |
183 | if ( true /*!ev->recurrence()->doesRecur() || ev->recursOn( mEventDate)*/) { | 208 | if ( true /*!ev->recurrence()->doesRecur() || ev->recursOn( mEventDate)*/) { |
184 | appendEvent(ev, false , iii!= 0 ); | 209 | appendEvent(ev, false , iii!= 0 ); |
185 | } | 210 | } |
186 | ev = events.next(); | 211 | ev = events.next(); |
187 | } | 212 | } |
188 | 213 | ||
189 | //mText += "</table>\n"; | 214 | //mText += "</table>\n"; |
190 | } | 215 | } |
191 | 216 | ||
192 | todo = todos.first(); | 217 | todo = todos.first(); |
193 | while(todo) { | 218 | while(todo) { |
194 | if ( !todo->isCompleted() &&todo->hasDueDate() && todo->dtDue().date() == mEventDate ) { | 219 | if ( !todo->isCompleted() &&todo->hasDueDate() && todo->dtDue().date() == mEventDate ) { |
195 | if ( ! itemAdded ) { | 220 | if ( ! itemAdded ) { |
196 | appendDay ( iii, mEventDate ); | 221 | appendDay ( iii, mEventDate ); |
197 | itemAdded = true; | 222 | itemAdded = true; |
198 | } | 223 | } |
199 | appendEvent(todo); | 224 | appendEvent(todo); |
200 | } | 225 | } |
201 | todo = todos.next(); | 226 | todo = todos.next(); |
202 | } | 227 | } |
203 | if ( !itemAdded && iii == 0 ) { | 228 | if ( !itemAdded && iii == 0 ) { |
204 | // appendDay ( iii, mEventDate ); | 229 | // appendDay ( iii, mEventDate ); |
205 | //mText += "<table>"; | 230 | //mText += "<table>"; |
206 | // mText += "<b><font color=\"#000080\"><em>"+i18n("No event, nothing to do.") +"</em></font></b>\n"; | 231 | // mText += "<b><font color=\"#000080\"><em>"+i18n("No event, nothing to do.") +"</em></font></b>\n"; |
207 | mText += "<h3 align=\"center\"><font color=\"#008000\"><em>"+i18n("No event, nothing to do. ") +"</em></font></h3>\n"; | 232 | mText += "<h3 align=\"center\"><font color=\"#008000\"><em>"+i18n("No event, nothing to do. ") +"</em></font></h3>\n"; |
208 | //mText +="</table>"; | 233 | //mText +="</table>"; |
209 | } | 234 | } |
210 | if ( itemAdded ) | 235 | if ( itemAdded ) |
211 | mText += "</table>\n"; | 236 | mText += "</table>\n"; |
212 | mEventDate = mEventDate.addDays( 1 ); | 237 | mEventDate = mEventDate.addDays( 1 ); |
213 | } | 238 | } |
214 | 239 | ||
215 | int topmostPrios = KOPrefs::instance()->mWhatsNextPrios; | 240 | int topmostPrios = KOPrefs::instance()->mWhatsNextPrios; |
216 | if (todos.count() > 0 && topmostPrios > 0 ) { | 241 | if (todos.count() > 0 && topmostPrios > 0 ) { |
217 | // kil.loadIcon("todo",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); | 242 | // kil.loadIcon("todo",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); |
218 | // mText += "<h2>"; | 243 | // mText += "<h2>"; |
219 | //<img src=\""; | 244 | //<img src=\""; |
220 | // mText += ipath; | 245 | // mText += ipath; |
221 | // mText += "\">"; | 246 | // mText += "\">"; |
222 | // mText += i18n("Overdue To-Do:") + "</h2>\n"; | 247 | // mText += i18n("Overdue To-Do:") + "</h2>\n"; |
223 | 248 | ||
224 | //mText += "<ul>\n"; | 249 | //mText += "<ul>\n"; |
225 | bool gotone = false; | 250 | bool gotone = false; |
226 | int priority = 1; | 251 | int priority = 1; |
227 | int priosFound = 0; | 252 | int priosFound = 0; |
228 | #ifdef DESKTOP_VERSION | 253 | #ifdef DESKTOP_VERSION |
229 | mText +="<p></p>"; | 254 | mText +="<p></p>"; |
230 | #endif | 255 | #endif |
231 | 256 | ||
232 | mText +="<big><big><strong><em><font color=\"#000080\">" + i18n("Incomplete Todo:") + "</font></em></strong></big></big>\n"; | 257 | mText +="<big><big><strong><em><font color=\"#000080\">" + i18n("Incomplete Todo:") + "</font></em></strong></big></big>\n"; |
233 | mText += "<ul>\n"; | 258 | mText += "<ul>\n"; |
234 | while (!gotone && priority<6) { | 259 | while (!gotone && priority<6) { |
235 | todo = todos.first(); | 260 | todo = todos.first(); |
236 | while(todo) { | 261 | while(todo) { |
237 | if (!todo->isCompleted() && (todo->priority() == priority) ) { | 262 | if (!todo->isCompleted() && (todo->priority() == priority) ) { |
238 | if ( appendTodo(todo) ) | 263 | if ( appendTodo(todo) ) |
239 | gotone = true; | 264 | gotone = true; |
240 | } | 265 | } |
241 | todo = todos.next(); | 266 | todo = todos.next(); |
242 | } | 267 | } |
243 | if ( gotone ) { | 268 | if ( gotone ) { |
244 | gotone = false; | 269 | gotone = false; |
245 | ++priosFound; | 270 | ++priosFound; |
246 | if ( priosFound == topmostPrios ) | 271 | if ( priosFound == topmostPrios ) |
247 | break; | 272 | break; |
248 | } | 273 | } |
249 | priority++; | 274 | priority++; |
250 | // kdDebug() << "adding the todos..." << endl; | 275 | // kdDebug() << "adding the todos..." << endl; |
251 | } | 276 | } |
252 | mText += "</ul>\n"; | 277 | mText += "</ul>\n"; |
253 | } | 278 | } |
254 | 279 | ||
255 | int replys = 0; | 280 | int replys = 0; |
256 | events = calendar()->events(QDate::currentDate(), QDate(2975,12,6)); | 281 | events = calendar()->events(QDate::currentDate(), QDate(2975,12,6)); |
257 | if (events.count() > 0) { | 282 | if (events.count() > 0) { |
258 | Event *ev = events.first(); | 283 | Event *ev = events.first(); |
259 | while(ev) { | 284 | while(ev) { |
260 | Attendee *me = ev->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); | 285 | Attendee *me = ev->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); |
261 | if (me!=0) { | 286 | if (me!=0) { |
262 | if (me->status()==Attendee::NeedsAction && me->RSVP()) { | 287 | if (me->status()==Attendee::NeedsAction && me->RSVP()) { |
263 | if (replys == 0) { | 288 | if (replys == 0) { |
264 | mText += "<p></p>"; | 289 | mText += "<p></p>"; |
265 | // kil.loadIcon("reply",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); | 290 | // kil.loadIcon("reply",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); |
266 | //mText += "<h2>"; | 291 | //mText += "<h2>"; |
267 | //<img src=\""; | 292 | //<img src=\""; |
268 | // mText += ipath; | 293 | // mText += ipath; |
269 | // mText += "\">"; | 294 | // mText += "\">"; |
270 | //mText += i18n("Events and To-Dos that need a reply:") + "</h2>\n"; | 295 | //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"; | 296 | mText +="<big><big><strong><em><font color=\"#000080\">" + i18n("Events and To-Dos that need a reply:") + "</font></em></strong></big></big>\n"; |
272 | mText += "<table>\n"; | 297 | mText += "<table>\n"; |
273 | } | 298 | } |
274 | replys++; | 299 | replys++; |
275 | appendEvent(ev,true); | 300 | appendEvent(ev,true); |
276 | } | 301 | } |
277 | } | 302 | } |
278 | ev = events.next(); | 303 | ev = events.next(); |
279 | } | 304 | } |
280 | } | 305 | } |
281 | todos = calendar()->todos(); | 306 | todos = calendar()->todos(); |
282 | if (todos.count() > 0) { | 307 | if (todos.count() > 0) { |
283 | Todo *to = todos.first(); | 308 | Todo *to = todos.first(); |
284 | while(to) { | 309 | while(to) { |
285 | if ( !to->isCompleted() ){ | 310 | if ( !to->isCompleted() ){ |
286 | Attendee *me = to->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); | 311 | Attendee *me = to->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); |
287 | if (me!=0) { | 312 | if (me!=0) { |
288 | if (me->status()==Attendee::NeedsAction && me->RSVP()) { | 313 | if (me->status()==Attendee::NeedsAction && me->RSVP()) { |
289 | if (replys == 0) { | 314 | if (replys == 0) { |
290 | mText +="<big><big><strong><em><font color=\"#000080\">" + i18n("Events and To-Dos that need a reply:") + "</font></em></strong></big></big>\n"; | 315 | mText +="<big><big><strong><em><font color=\"#000080\">" + i18n("Events and To-Dos that need a reply:") + "</font></em></strong></big></big>\n"; |
291 | mText += "<table>\n"; | 316 | mText += "<table>\n"; |
292 | } | 317 | } |
293 | replys++; | 318 | replys++; |
294 | appendEvent(to, true); | 319 | appendEvent(to, true); |
295 | } | 320 | } |
296 | } | 321 | } |
297 | } | 322 | } |
298 | to = todos.next(); | 323 | to = todos.next(); |
299 | } | 324 | } |
300 | } | 325 | } |
301 | if (replys > 0 ) mText += "</table>\n"; | 326 | if (replys > 0 ) mText += "</table>\n"; |
302 | 327 | ||
303 | 328 | ||
304 | mText += "</td></tr>\n</table>\n"; | 329 | mText += "</td></tr>\n</table>\n"; |
305 | 330 | ||
306 | mView->setText(mText); | 331 | mView->setText(mText); |
307 | mView->setFocus(); | 332 | mView->setFocus(); |
308 | 333 | ||
309 | // QPixmap bPix = SmallIcon( "back" ); | 334 | // QPixmap bPix = SmallIcon( "back" ); |
310 | // qDebug("xxxxxxxxxxxxxxxxxxxxx "); | 335 | // qDebug("xxxxxxxxxxxxxxxxxxxxx "); |
311 | // QWidget* test = new QWidget(); | 336 | // QWidget* test = new QWidget(); |
312 | // test->setBackgroundMode(FixedPixmap ); | 337 | // test->setBackgroundMode(FixedPixmap ); |
313 | // test->setBackgroundPixmap ( bPix ); | 338 | // test->setBackgroundPixmap ( bPix ); |
314 | // test->resize( 300, 400 ); | 339 | // test->resize( 300, 400 ); |
315 | // test->show(); | 340 | // test->show(); |
316 | // mView->setBackgroundMode(FixedPixmap ); | 341 | // mView->setBackgroundMode(FixedPixmap ); |
317 | // mView->setBackgroundPixmap ( bPix ); | 342 | // mView->setBackgroundPixmap ( bPix ); |
318 | } | 343 | } |
319 | 344 | ||
320 | void KOWhatsNextView::appendDay( int i, QDate eventDate ) | 345 | void KOWhatsNextView::appendDay( int i, QDate eventDate ) |
321 | { | 346 | { |
322 | QString date; | 347 | QString date; |
323 | QString day = KGlobal::locale()->formatDate( eventDate , KOPrefs::instance()->mShortDateInViewer); | 348 | QString day = KGlobal::locale()->formatDate( eventDate , KOPrefs::instance()->mShortDateInViewer); |
324 | if ( ! KOPrefs::instance()->mShortDateInViewer && QApplication::desktop()->width() < 320 ) { | 349 | if ( ! KOPrefs::instance()->mShortDateInViewer && QApplication::desktop()->width() < 320 ) { |
325 | if ( i == 0 ) { | 350 | if ( i == 0 ) { |
326 | mText += "<table>\n"; | 351 | mText += "<table>\n"; |
327 | return;//date = "<em><font color=\"#008000\"><em>" + day+"</font></em>"; | 352 | return;//date = "<em><font color=\"#008000\"><em>" + day+"</font></em>"; |
328 | } | 353 | } |
329 | else if ( i == 1 ) | 354 | else if ( i == 1 ) |
330 | date = "<em><font color=\"#000080\">" + day + "</font></em>" ; | 355 | date = "<em><font color=\"#000080\">" + day + "</font></em>" ; |
331 | else date = "<em><font color=\"#000080\">" + day + "</font></em>"; | 356 | else date = "<em><font color=\"#000080\">" + day + "</font></em>"; |
332 | //mText += "<h2>" + date + "</h2>\n"; | 357 | //mText += "<h2>" + date + "</h2>\n"; |
333 | mText += "<big><big><strong>" + date + "</strong></big></big>\n"; | 358 | mText += "<big><big><strong>" + date + "</strong></big></big>\n"; |
334 | mText += "<table>\n"; | 359 | mText += "<table>\n"; |
335 | 360 | ||
336 | 361 | ||
337 | 362 | ||
338 | } else { | 363 | } else { |
339 | if ( i == 0 ) { | 364 | if ( i == 0 ) { |
340 | mText += "<table>\n"; | 365 | mText += "<table>\n"; |
341 | return;// date = "<font color=\"#008000\"><em>" +i18n("Today: ") +"</em>" + day+"</font>"; | 366 | return;// date = "<font color=\"#008000\"><em>" +i18n("Today: ") +"</em>" + day+"</font>"; |
342 | } | 367 | } |
343 | 368 | ||
344 | #ifdef DESKTOP_VERSION | 369 | #ifdef DESKTOP_VERSION |
345 | else if ( i == 1 ) { | 370 | else if ( i == 1 ) { |
346 | date = "<h2><em><font color=\"#000080\">" + i18n("Tomorrow: ") + day +"</font></em></h2>" ; | 371 | date = "<h2><em><font color=\"#000080\">" + i18n("Tomorrow: ") + day +"</font></em></h2>" ; |
347 | } | 372 | } |
348 | else date = "<h2><em><font color=\"#000080\">" + i18n("In %1 days: ").arg( i ) +day + "</font></em></h2>"; | 373 | else date = "<h2><em><font color=\"#000080\">" + i18n("In %1 days: ").arg( i ) +day + "</font></em></h2>"; |
349 | #else | 374 | #else |
350 | else if ( i == 1 ) { | 375 | else if ( i == 1 ) { |
351 | date = "<em><font color=\"#000080\">" + i18n("Tomorrow: ") + day +"</font></em>" ; | 376 | date = "<em><font color=\"#000080\">" + i18n("Tomorrow: ") + day +"</font></em>" ; |
352 | } | 377 | } |
353 | else date = "<em><font color=\"#000080\">" + i18n("In %1 days: ").arg( i ) +day + "</font></em>"; | 378 | else date = "<em><font color=\"#000080\">" + i18n("In %1 days: ").arg( i ) +day + "</font></em>"; |
354 | 379 | ||
355 | #endif | 380 | #endif |
356 | //mText += "<h2>" + date + "</h2>\n"; | 381 | //mText += "<h2>" + date + "</h2>\n"; |
357 | mText += "<big><big><strong>" + date + "</strong></big></big>\n"; | 382 | mText += "<big><big><strong>" + date + "</strong></big></big>\n"; |
358 | mText += "<table>\n"; | 383 | mText += "<table>\n"; |
359 | } | 384 | } |
360 | } | 385 | } |
361 | 386 | ||
362 | 387 | ||
363 | void KOWhatsNextView::showDates(const QDate &, const QDate &) | 388 | void KOWhatsNextView::showDates(const QDate &, const QDate &) |
364 | { | 389 | { |
365 | updateView(); | 390 | updateView(); |
366 | } | 391 | } |
367 | 392 | ||
368 | void KOWhatsNextView::showEvents(QPtrList<Event>) | 393 | void KOWhatsNextView::showEvents(QPtrList<Event>) |
369 | { | 394 | { |
370 | } | 395 | } |
371 | 396 | ||
372 | void KOWhatsNextView::changeEventDisplay(Event *, int action) | 397 | void KOWhatsNextView::changeEventDisplay(Event *, int action) |
373 | { | 398 | { |
374 | switch(action) { | 399 | switch(action) { |
375 | case KOGlobals::EVENTADDED: | 400 | case KOGlobals::EVENTADDED: |
376 | updateView(); | 401 | updateView(); |
377 | break; | 402 | break; |
378 | case KOGlobals::EVENTEDITED: | 403 | case KOGlobals::EVENTEDITED: |
379 | updateView(); | 404 | updateView(); |
380 | break; | 405 | break; |
381 | case KOGlobals::EVENTDELETED: | 406 | case KOGlobals::EVENTDELETED: |
382 | updateView(); | 407 | updateView(); |
383 | break; | 408 | break; |
384 | default: | 409 | default: |
385 | updateView(); | 410 | updateView(); |
386 | kdDebug() << "KOWhatsNextView::changeEventDisplay(): Illegal action " << action << endl; | 411 | kdDebug() << "KOWhatsNextView::changeEventDisplay(): Illegal action " << action << endl; |
387 | } | 412 | } |
388 | } | 413 | } |
389 | 414 | ||
390 | void KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed ) | 415 | void KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed ) |
391 | { | 416 | { |
392 | if ( !KOPrefs::instance()->mShowSyncEvents && ev->uid().left(15) == QString("last-syncEvent-") ) | 417 | if ( !KOPrefs::instance()->mShowSyncEvents && ev->uid().left(15) == QString("last-syncEvent-") ) |
393 | return; | 418 | return; |
394 | QDateTime cdt = QDateTime::currentDateTime(); | 419 | QDateTime cdt = QDateTime::currentDateTime(); |
395 | QDateTime noc; | 420 | QDateTime noc; |
396 | bool ok = true; | 421 | bool ok = true; |
397 | if ( reply ) { | 422 | if ( reply ) { |
398 | noc = ev->getNextOccurence( cdt, &ok ); | 423 | noc = ev->getNextOccurence( cdt, &ok ); |
399 | if (! ok && ev->type() == "Event") | 424 | if (! ok && ev->type() == "Event") |
400 | return; | 425 | return; |
401 | } | 426 | } |
402 | mText += "<tr><td><b>"; | 427 | mText += "<tr><td><b>"; |
403 | if (ev->type()=="Event") { | 428 | if (ev->type()=="Event") { |
404 | if (reply) { | 429 | if (reply) { |
405 | if (!ev->doesFloat()) | 430 | if (!ev->doesFloat()) |
406 | mText += KGlobal::locale()->formatDateTime( noc , KOPrefs::instance()->mShortDateInViewer) +": "; | 431 | mText += KGlobal::locale()->formatDateTime( noc , KOPrefs::instance()->mShortDateInViewer) +": "; |
407 | else | 432 | else |
408 | mText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": "; | 433 | mText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": "; |
409 | 434 | ||
410 | } else { | 435 | } else { |
411 | if (!ev->doesFloat()) { | 436 | if (!ev->doesFloat()) { |
412 | Event *event = static_cast<Event *>(ev); | 437 | Event *event = static_cast<Event *>(ev); |
413 | QDateTime st,end; | 438 | QDateTime st,end; |
414 | if ( event->recurrence()->doesRecur() ) { | 439 | if ( event->recurrence()->doesRecur() ) { |
415 | QDate recDate= mEventDate; | 440 | QDate recDate= mEventDate; |
416 | int days = event->dtStart().date().daysTo (event->dtEnd().date() ); | 441 | int days = event->dtStart().date().daysTo (event->dtEnd().date() ); |
417 | while ( ! event->recursOn( recDate ) ) { | 442 | while ( ! event->recursOn( recDate ) ) { |
418 | recDate = recDate.addDays( -1 ); | 443 | recDate = recDate.addDays( -1 ); |
419 | 444 | ||
420 | } | 445 | } |
421 | st = QDateTime ( recDate, event->dtStart().time() ); | 446 | st = QDateTime ( recDate, event->dtStart().time() ); |
422 | end = QDateTime ( recDate.addDays( days ), event->dtEnd().time() ); | 447 | end = QDateTime ( recDate.addDays( days ), event->dtEnd().time() ); |
423 | } | 448 | } |
424 | else { | 449 | else { |
425 | st = event->dtStart(); | 450 | st = event->dtStart(); |
426 | end = event->dtEnd(); | 451 | end = event->dtEnd(); |
427 | } | 452 | } |
428 | 453 | ||
429 | 454 | ||
430 | QString dateText; | 455 | QString dateText; |
431 | // qDebug("%s %s %s %s ", mEventDate.toString().latin1(),event->summary().latin1(), st .toString().latin1(),end.toString().latin1() ); | 456 | // qDebug("%s %s %s %s ", mEventDate.toString().latin1(),event->summary().latin1(), st .toString().latin1(),end.toString().latin1() ); |
432 | if ( st.date() < mEventDate ) | 457 | if ( st.date() < mEventDate ) |
433 | dateText = "++:++-"; | 458 | dateText = "++:++-"; |
434 | else | 459 | else |
435 | dateText = event->dtStartTimeStr() + "-"; | 460 | dateText = event->dtStartTimeStr() + "-"; |
436 | if ( end.date() > mEventDate ) | 461 | if ( end.date() > mEventDate ) |
437 | dateText += "++:++"; | 462 | dateText += "++:++"; |
438 | else | 463 | else |
439 | dateText += event->dtEndTimeStr(); | 464 | dateText += event->dtEndTimeStr(); |
440 | if ( notRed ) | 465 | if ( notRed ) |
441 | mText += dateText; | 466 | mText += dateText; |
442 | else { | 467 | else { |
443 | if ( end < cdt ) | 468 | if ( end < cdt ) |
444 | mText += "<font color=\"#F00000\">" + dateText + "</font>"; | 469 | mText += "<font color=\"#F00000\">" + dateText + "</font>"; |
445 | else if ( st < cdt ) | 470 | else if ( st < cdt ) |
446 | mText += "<font color=\"#008000\">" + dateText + "</font>"; | 471 | mText += "<font color=\"#008000\">" + dateText + "</font>"; |
447 | else | 472 | else |
448 | mText += dateText; | 473 | mText += dateText; |
449 | 474 | ||
450 | } | 475 | } |
451 | 476 | ||
452 | } else { | 477 | } else { |
453 | mText += i18n("Allday:"); | 478 | mText += i18n("Allday:"); |
454 | 479 | ||
455 | } | 480 | } |
456 | } | 481 | } |
457 | } else { | 482 | } else { |
458 | mTodos.append( ev ); | 483 | mTodos.append( ev ); |
459 | mText += i18n("ToDo:"); | 484 | mText += i18n("ToDo:"); |
460 | if (reply) { | 485 | if (reply) { |
461 | mText += " "; | 486 | mText += " "; |
462 | if ( noc != cdt ) { | 487 | if ( noc != cdt ) { |
463 | mText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": "; | 488 | mText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": "; |
464 | } | 489 | } |
465 | } else { | 490 | } else { |
466 | if ( ((Todo*)ev)->dtDue().date() < QDate::currentDate() ) { | 491 | if ( ((Todo*)ev)->dtDue().date() < QDate::currentDate() ) { |
467 | // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; | 492 | // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; |
468 | QString dfs = KGlobal::locale()->dateFormatShort(); | 493 | QString dfs = KGlobal::locale()->dateFormatShort(); |
469 | KGlobal::locale()->setDateFormatShort("%d.%b"); | 494 | KGlobal::locale()->setDateFormatShort("%d.%b"); |
470 | mText +="<font color=\"#F00000\">" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "</font>"; | 495 | mText +="<font color=\"#F00000\">" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "</font>"; |
471 | KGlobal::locale()->setDateFormatShort(dfs); | 496 | KGlobal::locale()->setDateFormatShort(dfs); |
472 | } else { | 497 | } else { |
473 | if (!ev->doesFloat() ) | 498 | if (!ev->doesFloat() ) |
474 | if( ( (Todo*)ev)->dtDue() < cdt ) { | 499 | if( ( (Todo*)ev)->dtDue() < cdt ) { |
475 | mText +="<font color=\"#F00000\">" + ((Todo*)ev)->dtDueTimeStr() + "</font>"; | 500 | mText +="<font color=\"#F00000\">" + ((Todo*)ev)->dtDueTimeStr() + "</font>"; |
476 | 501 | ||
477 | 502 | ||
478 | } else | 503 | } else |
479 | mText +=((Todo*)ev)->dtDueTimeStr(); | 504 | mText +=((Todo*)ev)->dtDueTimeStr(); |
480 | mTodos.append( ev ); | 505 | mTodos.append( ev ); |
481 | } | 506 | } |
482 | } | 507 | } |
483 | } | 508 | } |
484 | mText += "</b></td><td>"; | 509 | mText += "</b></td><td>"; |
485 | bool needClose = false; | 510 | bool needClose = false; |
486 | if ( ev->cancelled() ) { | 511 | if ( ev->cancelled() ) { |
487 | mText += "<font color=\"#F00000\">[c"; | 512 | mText += "<font color=\"#F00000\">[c"; |
488 | needClose =true; | 513 | needClose =true; |
489 | 514 | ||
490 | } | 515 | } |
491 | if ( ev->isAlarmEnabled() ) { | 516 | if ( ev->isAlarmEnabled() ) { |
492 | if ( !needClose) | 517 | if ( !needClose) |
493 | mText +="["; | 518 | mText +="["; |
494 | mText += "a"; | 519 | mText += "a"; |
495 | needClose =true; | 520 | needClose =true; |
496 | 521 | ||
497 | } | 522 | } |
498 | if ( ev->description().length() > 0 ) { | 523 | if ( ev->description().length() > 0 ) { |
499 | if ( !needClose) | 524 | if ( !needClose) |
500 | mText +="["; | 525 | mText +="["; |
501 | mText += "i"; | 526 | mText += "i"; |
502 | needClose =true; | 527 | needClose =true; |
503 | } | 528 | } |
504 | if ( ev->recurrence()->doesRecur() ) { | 529 | if ( ev->recurrence()->doesRecur() ) { |
505 | if ( !needClose) | 530 | if ( !needClose) |
506 | mText +="["; | 531 | mText +="["; |
507 | mText += "r"; | 532 | mText += "r"; |
508 | needClose =true; | 533 | needClose =true; |
509 | } | 534 | } |
510 | if ( needClose ) { | 535 | if ( needClose ) { |
511 | mText += "] "; | 536 | mText += "] "; |
512 | } | 537 | } |
513 | if ( ev->cancelled() ) | 538 | if ( ev->cancelled() ) |
514 | mText += "</font>"; | 539 | mText += "</font>"; |
515 | mText += "<a "; | 540 | mText += "<a "; |
516 | if (ev->type()=="Event") mText += "href=\"event:"; | 541 | if (ev->type()=="Event") mText += "href=\"event:"; |
517 | if (ev->type()=="Todo") mText += "href=\"todo:"; | 542 | if (ev->type()=="Todo") mText += "href=\"todo:"; |
518 | mText += ev->uid() + "\">"; | 543 | mText += ev->uid() + "\">"; |
519 | if ( ev->summary().length() > 0 ) | 544 | if ( ev->summary().length() > 0 ) |
520 | mText += ev->summary(); | 545 | mText += ev->summary(); |
521 | else | 546 | else |
522 | mText += i18n("-no summary-"); | 547 | mText += i18n("-no summary-"); |
523 | mText += "</a>"; | 548 | mText += "</a>"; |
524 | if ( KOPrefs::instance()->mWNViewShowLocation ) | 549 | if ( KOPrefs::instance()->mWNViewShowLocation ) |
525 | if ( !ev->location().isEmpty() ) | 550 | if ( !ev->location().isEmpty() ) |
526 | mText += " ("+ev->location() +")"; | 551 | mText += " ("+ev->location() +")"; |
527 | if ( ev->relatedTo() && KOPrefs::instance()->mWNViewShowsParents) | 552 | if ( ev->relatedTo() && KOPrefs::instance()->mWNViewShowsParents) |
528 | mText += " ["+ev->relatedTo()->summary() +"]"; | 553 | mText += " ["+ev->relatedTo()->summary() +"]"; |
529 | mText += "</td></tr>\n"; | 554 | mText += "</td></tr>\n"; |
530 | } | 555 | } |
531 | 556 | ||
532 | bool KOWhatsNextView::appendTodo(Incidence *ev, QString ind , bool isSub ) | 557 | bool KOWhatsNextView::appendTodo(Incidence *ev, QString ind , bool isSub ) |
533 | { | 558 | { |
534 | if ( mTodos.find( ev ) != mTodos.end() ) return false; | 559 | if ( mTodos.find( ev ) != mTodos.end() ) return false; |
535 | 560 | ||
536 | mTodos.append( ev ); | 561 | mTodos.append( ev ); |
537 | if ( !isSub ) | 562 | if ( !isSub ) |
538 | mText += "<p>"; | 563 | mText += "<p>"; |
539 | else | 564 | else |
540 | mText += "<li>"; | 565 | mText += "<li>"; |
541 | mText += "[" +QString::number(ev->priority()) + "/" + QString::number(((Todo*)ev)->percentComplete())+"%] "; | 566 | mText += "[" +QString::number(ev->priority()) + "/" + QString::number(((Todo*)ev)->percentComplete())+"%] "; |
542 | 567 | ||
543 | 568 | ||
544 | mText += ind; | 569 | mText += ind; |
545 | bool needClose = false; | 570 | bool needClose = false; |
546 | if ( ev->cancelled() ) { | 571 | if ( ev->cancelled() ) { |
547 | mText += "<font color=\"#F00000\">[c"; | 572 | mText += "<font color=\"#F00000\">[c"; |
548 | needClose =true; | 573 | needClose =true; |
549 | 574 | ||
550 | } | 575 | } |
551 | if ( ev->isAlarmEnabled() ) { | 576 | if ( ev->isAlarmEnabled() ) { |
552 | if ( !needClose) | 577 | if ( !needClose) |
553 | mText +="["; | 578 | mText +="["; |
554 | mText += "a"; | 579 | mText += "a"; |
555 | needClose =true; | 580 | needClose =true; |
556 | 581 | ||
557 | } | 582 | } |
558 | 583 | ||
559 | if ( ev->description().length() > 0 ) { | 584 | if ( ev->description().length() > 0 ) { |
560 | if ( !needClose) | 585 | if ( !needClose) |
561 | mText +="["; | 586 | mText +="["; |
562 | mText += "i"; | 587 | mText += "i"; |
563 | needClose =true; | 588 | needClose =true; |
564 | } | 589 | } |
565 | // if ( ev->recurrence()->doesRecur() ) { | 590 | // if ( ev->recurrence()->doesRecur() ) { |
566 | // if ( !needClose) | 591 | // if ( !needClose) |
567 | // mText +="("; | 592 | // mText +="("; |
568 | // mText += "r"; | 593 | // mText += "r"; |
569 | // needClose =true; | 594 | // needClose =true; |
570 | // } | 595 | // } |
571 | if ( needClose ) | 596 | if ( needClose ) |
572 | mText += "] "; | 597 | mText += "] "; |
573 | if ( ev->cancelled() ) | 598 | if ( ev->cancelled() ) |
574 | mText += "</font>"; | 599 | mText += "</font>"; |
575 | mText += "<a href=\"todo:" + ev->uid() + "\">"; | 600 | mText += "<a href=\"todo:" + ev->uid() + "\">"; |
576 | mText += ev->summary(); | 601 | mText += ev->summary(); |
577 | mText += "</a>"; | 602 | mText += "</a>"; |
578 | if ( ((Todo*)ev)->hasDueDate () ) { | 603 | if ( ((Todo*)ev)->hasDueDate () ) { |
579 | QString year = ""; | 604 | QString year = ""; |
580 | int ye = ((Todo*)ev)->dtDue().date().year(); | 605 | int ye = ((Todo*)ev)->dtDue().date().year(); |
581 | if ( QDateTime::currentDateTime().date().year() != ye ) | 606 | if ( QDateTime::currentDateTime().date().year() != ye ) |
582 | year = QString::number( ye ); | 607 | year = QString::number( ye ); |
583 | QString dfs = KGlobal::locale()->dateFormatShort(); | 608 | QString dfs = KGlobal::locale()->dateFormatShort(); |
584 | KGlobal::locale()->setDateFormatShort("%d.%b"); | 609 | KGlobal::locale()->setDateFormatShort("%d.%b"); |
585 | mText +="<font color=\"#00A000\"> [" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "."+ year +"]</font>"; | 610 | mText +="<font color=\"#00A000\"> [" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "."+ year +"]</font>"; |
586 | KGlobal::locale()->setDateFormatShort(dfs); | 611 | KGlobal::locale()->setDateFormatShort(dfs); |
587 | } | 612 | } |
588 | if ( KOPrefs::instance()->mWNViewShowLocation ) | 613 | if ( KOPrefs::instance()->mWNViewShowLocation ) |
589 | if ( !ev->location().isEmpty() ) | 614 | if ( !ev->location().isEmpty() ) |
590 | mText += " ("+ev->location() +")"; | 615 | mText += " ("+ev->location() +")"; |
591 | if ( !isSub ) { | 616 | if ( !isSub ) { |
592 | if ( ((Todo*)ev)->relatedTo()&& KOPrefs::instance()->mWNViewShowsParents) | 617 | if ( ((Todo*)ev)->relatedTo()&& KOPrefs::instance()->mWNViewShowsParents) |
593 | mText += " ["+ev->relatedTo()->summary() +"]"; | 618 | mText += " ["+ev->relatedTo()->summary() +"]"; |
594 | mText += "</p>\n"; | 619 | mText += "</p>\n"; |
595 | } | 620 | } |
596 | else { | 621 | else { |
597 | ind += "-"; | 622 | ind += "-"; |
598 | mText += "</li>\n"; | 623 | mText += "</li>\n"; |
599 | } | 624 | } |
600 | QPtrList<Incidence> Relations = ev->relations(); | 625 | QPtrList<Incidence> Relations = ev->relations(); |
601 | Incidence *to; | 626 | Incidence *to; |
602 | for (to=Relations.first();to;to=Relations.next()) { | 627 | for (to=Relations.first();to;to=Relations.next()) { |
603 | if (!((Todo*)to)->isCompleted()) | 628 | if (!((Todo*)to)->isCompleted()) |
604 | appendTodo( to, ind , true ); | 629 | appendTodo( to, ind , true ); |
605 | } | 630 | } |
606 | 631 | ||
607 | return true; | 632 | return true; |
608 | } | 633 | } |
609 | 634 | ||
610 | /* | 635 | /* |
611 | void KOWhatsNextView::createEventViewer() | 636 | void KOWhatsNextView::createEventViewer() |
612 | { | 637 | { |
613 | if (!mEventViewer) { | 638 | if (!mEventViewer) { |
614 | 639 | ||
615 | mEventViewer = new KOEventViewerDialog(this); | 640 | mEventViewer = new KOEventViewerDialog(this); |
616 | } | 641 | } |
617 | } | 642 | } |
618 | */ | 643 | */ |
619 | void KOWhatsNextView::setEventViewer(KOEventViewerDialog* v ) | 644 | void KOWhatsNextView::setEventViewer(KOEventViewerDialog* v ) |
620 | { | 645 | { |
621 | if ( mEventViewer ) | ||
622 | delete mEventViewer; | ||
623 | mEventViewer = v; | 646 | mEventViewer = v; |
624 | } | 647 | } |
625 | 648 | ||
626 | // TODO: Create this function in CalendarView and remove it from here | 649 | // TODO: Create this function in CalendarView and remove it from here |
627 | void KOWhatsNextView::showIncidence(const QString &uid) | 650 | void KOWhatsNextView::showIncidence(const QString &uid) |
628 | { | 651 | { |
629 | if ( !mEventViewer ) { | 652 | if ( !mEventViewer ) { |
630 | qDebug("KOWhatsNextView::showIncidence::sorry, no event viewer set "); | 653 | qDebug("KOWhatsNextView::showIncidence::sorry, no event viewer set "); |
631 | return; | 654 | return; |
632 | } | 655 | } |
633 | //kdDebug() << "KOWhatsNextView::showIncidence(): " << uid << endl; | 656 | //kdDebug() << "KOWhatsNextView::showIncidence(): " << uid << endl; |
634 | //qDebug("KOWhatsNextView::showIncidence %s ", uid.latin1()); | 657 | //qDebug("KOWhatsNextView::showIncidence %s ", uid.latin1()); |
635 | if (uid.startsWith("event:")) { | 658 | if (uid.startsWith("event:")) { |
636 | #ifdef DESKTOP_VERSION | 659 | #ifdef DESKTOP_VERSION |
637 | Event *event = calendar()->event(uid.mid(8)); | 660 | Event *event = calendar()->event(uid.mid(8)); |
638 | #else | 661 | #else |
639 | Event *event = calendar()->event(uid.mid(6)); | 662 | Event *event = calendar()->event(uid.mid(6)); |
640 | #endif | 663 | #endif |
641 | //qDebug("event %d uid %s ", event, uid.mid(6).latin1()); | 664 | //qDebug("event %d uid %s ", event, uid.mid(6).latin1()); |
642 | if (!event) return; | 665 | if (!event) return; |
643 | //createEventViewer(); | 666 | //createEventViewer(); |
644 | mEventViewer->setEvent(event); | 667 | mEventViewer->setEvent(event); |
645 | } else if (uid.startsWith("todo:")) { | 668 | } else if (uid.startsWith("todo:")) { |
646 | #ifdef DESKTOP_VERSION | 669 | #ifdef DESKTOP_VERSION |
647 | Todo *todo = calendar()->todo(uid.mid(7)); | 670 | Todo *todo = calendar()->todo(uid.mid(7)); |
648 | #else | 671 | #else |
649 | Todo *todo = calendar()->todo(uid.mid(5)); | 672 | Todo *todo = calendar()->todo(uid.mid(5)); |
650 | #endif | 673 | #endif |
651 | if (!todo) return; | 674 | if (!todo) return; |
652 | //createEventViewer(); | 675 | //createEventViewer(); |
653 | mEventViewer->setTodo(todo); | 676 | mEventViewer->setTodo(todo); |
654 | } else { | 677 | } else { |
655 | return; | 678 | return; |
656 | 679 | ||
657 | } | 680 | } |
658 | mEventViewer->showMe(); | 681 | mEventViewer->showMe(); |
659 | mEventViewer->raise(); | 682 | mEventViewer->raise(); |
660 | } | 683 | } |
diff --git a/korganizer/kowhatsnextview.h b/korganizer/kowhatsnextview.h index fff769a..1118bdd 100644 --- a/korganizer/kowhatsnextview.h +++ b/korganizer/kowhatsnextview.h | |||
@@ -1,91 +1,96 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | */ | 18 | */ |
19 | #ifndef KOWHATSNEXTVIEW_H | 19 | #ifndef KOWHATSNEXTVIEW_H |
20 | #define KOWHATSNEXTVIEW_H | 20 | #define KOWHATSNEXTVIEW_H |
21 | 21 | ||
22 | #include <qtextbrowser.h> | 22 | #include <qtextbrowser.h> |
23 | #include <qtimer.h> | ||
23 | 24 | ||
24 | #include <korganizer/baseview.h> | 25 | #include <korganizer/baseview.h> |
25 | 26 | ||
26 | class QListView; | 27 | class QListView; |
27 | class QLabel; | 28 | class QLabel; |
28 | 29 | ||
29 | class KOEventViewerDialog; | 30 | class KOEventViewerDialog; |
30 | 31 | ||
31 | class WhatsNextTextBrowser : public QTextBrowser { | 32 | class WhatsNextTextBrowser : public QTextBrowser { |
32 | Q_OBJECT | 33 | Q_OBJECT |
33 | public: | 34 | public: |
34 | WhatsNextTextBrowser(QWidget *parent) : QTextBrowser(parent) {} | 35 | WhatsNextTextBrowser(QWidget *parent) : QTextBrowser(parent) {} |
35 | 36 | ||
36 | void setSource(const QString &); | 37 | void setSource(const QString &); |
37 | 38 | ||
38 | signals: | 39 | signals: |
39 | void showIncidence(const QString &uid); | 40 | void showIncidence(const QString &uid); |
40 | }; | 41 | }; |
41 | 42 | ||
42 | 43 | ||
43 | /** | 44 | /** |
44 | This class provides a view of the next events and todos | 45 | This class provides a view of the next events and todos |
45 | */ | 46 | */ |
46 | class KOWhatsNextView : public KOrg::BaseView | 47 | class KOWhatsNextView : public KOrg::BaseView |
47 | { | 48 | { |
48 | Q_OBJECT | 49 | Q_OBJECT |
49 | public: | 50 | public: |
50 | KOWhatsNextView(Calendar *calendar, QWidget *parent = 0, | 51 | KOWhatsNextView(Calendar *calendar, QWidget *parent = 0, |
51 | const char *name = 0); | 52 | const char *name = 0); |
52 | ~KOWhatsNextView(); | 53 | ~KOWhatsNextView(); |
53 | 54 | ||
54 | virtual int maxDatesHint(); | 55 | virtual int maxDatesHint(); |
55 | virtual int currentDateCount(); | 56 | virtual int currentDateCount(); |
56 | void setEventViewer(KOEventViewerDialog* v ); | 57 | void setEventViewer(KOEventViewerDialog* v ); |
57 | virtual QPtrList<Incidence> selectedIncidences(); | 58 | virtual QPtrList<Incidence> selectedIncidences(); |
58 | DateList selectedDates() | 59 | DateList selectedDates() |
59 | {DateList q; | 60 | {DateList q; |
60 | return q;} | 61 | return q;} |
61 | virtual void printPreview(CalPrinter *calPrinter, | 62 | virtual void printPreview(CalPrinter *calPrinter, |
62 | const QDate &, const QDate &); | 63 | const QDate &, const QDate &); |
63 | 64 | ||
64 | public slots: | 65 | public slots: |
65 | virtual void updateView(); | 66 | virtual void updateView(); |
66 | virtual void showDates(const QDate &start, const QDate &end); | 67 | virtual void showDates(const QDate &start, const QDate &end); |
67 | virtual void showEvents(QPtrList<Event> eventList); | 68 | virtual void showEvents(QPtrList<Event> eventList); |
68 | void updateConfig(); | 69 | void updateConfig(); |
69 | void changeEventDisplay(Event *, int); | 70 | void changeEventDisplay(Event *, int); |
70 | 71 | ||
71 | protected: | 72 | protected: |
72 | void appendEvent(Incidence *, bool reply=false, bool notRed = true); | 73 | void appendEvent(Incidence *, bool reply=false, bool notRed = true); |
73 | bool appendTodo(Incidence *, QString ind = "", bool isSub = false ); | 74 | bool appendTodo(Incidence *, QString ind = "", bool isSub = false ); |
74 | void appendDay( int i, QDate date ); | 75 | void appendDay( int i, QDate date ); |
75 | QDate mEventDate; | 76 | QDate mEventDate; |
77 | virtual void showEvent ( QShowEvent * ); | ||
78 | virtual void hideEvent ( QHideEvent * ); | ||
76 | 79 | ||
77 | private slots: | 80 | private slots: |
78 | void showIncidence(const QString &); | 81 | void showIncidence(const QString &); |
82 | void restartTimer(); | ||
83 | |||
79 | 84 | ||
80 | private: | 85 | private: |
81 | //void createEventViewer(); | 86 | //void createEventViewer(); |
82 | 87 | QTimer* mTimer; | |
83 | QTextBrowser *mView; | 88 | QTextBrowser *mView; |
84 | QString mText; | 89 | QString mText; |
85 | // QLabel *mDateLabel; | 90 | // QLabel *mDateLabel; |
86 | KOEventViewerDialog *mEventViewer; | 91 | KOEventViewerDialog *mEventViewer; |
87 | 92 | ||
88 | QValueList<Incidence *> mTodos; | 93 | QValueList<Incidence *> mTodos; |
89 | }; | 94 | }; |
90 | 95 | ||
91 | #endif | 96 | #endif |