summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-03-25 21:08:48 (UTC)
committer zautrix <zautrix>2005-03-25 21:08:48 (UTC)
commit6427570041c902840fe0f557415a07bb7aa8c031 (patch) (unidiff)
treee397342aca97119927ec6c312be5ac5f953d5eec
parent4d93404e3453229e58c2ff9305beae131c9f1af9 (diff)
downloadkdepimpi-6427570041c902840fe0f557415a07bb7aa8c031.zip
kdepimpi-6427570041c902840fe0f557415a07bb7aa8c031.tar.gz
kdepimpi-6427570041c902840fe0f557415a07bb7aa8c031.tar.bz2
fix
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/WhatsNew.txt8
-rw-r--r--korganizer/calendarview.cpp4
-rw-r--r--korganizer/datenavigatorcontainer.cpp2
-rw-r--r--korganizer/datenavigatorcontainer.h1
-rw-r--r--korganizer/kdatenavigator.cpp3
-rw-r--r--korganizer/kdatenavigator.h1
-rw-r--r--korganizer/koviewmanager.cpp10
-rw-r--r--korganizer/koviewmanager.h3
8 files changed, 29 insertions, 3 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt
index 1c2bff8..6f8b041 100644
--- a/bin/kdepim/WhatsNew.txt
+++ b/bin/kdepim/WhatsNew.txt
@@ -1,183 +1,189 @@
1Info about the changes in new versions of KDE-Pim/Pi 1Info about the changes in new versions of KDE-Pim/Pi
2 2
3********** VERSION 2.0.21 ************ 3********** VERSION 2.0.21 ************
4 4
5Fixed another SMTP problem in OM/Pi. 5Fixed another SMTP problem in OM/Pi.
6Some small changed in the new datenavigator in KO/Pi. 6Some small changed in the new datenavigator in KO/Pi.
7Changed default setting for new filter in KA/Pi to "exclude categories". 7Changed default setting for new filter in KA/Pi to "exclude categories".
8Changed the default font size for 640x480 display 8Changed the default font size for 640x480 display .
9Changed popup menu behaviour in agenda and list view.
10Fixed some layout problems of the date label size in the month view.
11Made month view update faster.
12Made first datenavigator repainting faster.
13Changed the title of the event/todo edit dialogs.
14
9 15
10********** VERSION 2.0.20 ************ 16********** VERSION 2.0.20 ************
11 17
12Two small fixes in OM/Pi. 18Two small fixes in OM/Pi.
13 19
14Better resizing of the new datenavigator in KO/Pi. 20Better resizing of the new datenavigator in KO/Pi.
15 21
16********** VERSION 2.0.19 ************ 22********** VERSION 2.0.19 ************
17KO/Pi: 23KO/Pi:
18Enhancements and bugfixes in the new datenavigator. 24Enhancements and bugfixes in the new datenavigator.
19Bugfix in this changelog: 25Bugfix in this changelog:
20The datenavigator was changed in version 2.0.18, not the datepicker. 26The datenavigator was changed in version 2.0.18, not the datepicker.
21 27
22********** VERSION 2.0.18 ************ 28********** VERSION 2.0.18 ************
23KO/Pi: 29KO/Pi:
24Fixed some minor problems. 30Fixed some minor problems.
25Cleaned up the KO/Pi config dialog. 31Cleaned up the KO/Pi config dialog.
26Fixed problem moving events in aganda view. 32Fixed problem moving events in aganda view.
27Made datepicker scaleable, i.e. if the datenavigator shows now a 33Made datepicker scaleable, i.e. if the datenavigator shows now a
28datenavigator matrix depending on its size. 34datenavigator matrix depending on its size.
29Birthdays are now displayed green in the datenavigator. 35Birthdays are now displayed green in the datenavigator.
30What'sThis Help in datenavigator shows all events of the day. 36What'sThis Help in datenavigator shows all events of the day.
31 37
32OM/Pi: 38OM/Pi:
33Updated the backend mail library to the latest version. 39Updated the backend mail library to the latest version.
34Please backup your mail before using this version. 40Please backup your mail before using this version.
35 41
36********** VERSION 2.0.17 ************ 42********** VERSION 2.0.17 ************
37 43
38KO/Pi: 44KO/Pi:
39Tooltips in month view were not sorted. Fixed. 45Tooltips in month view were not sorted. Fixed.
40Daylabel in agenda view ( for display of one day ) was too short. Fixed. 46Daylabel in agenda view ( for display of one day ) was too short. Fixed.
41Conflict display dialog for syncing was not on top of other windows. Fixed. 47Conflict display dialog for syncing was not on top of other windows. Fixed.
42Fixed some minor problems. 48Fixed some minor problems.
43 49
44Fixed an endless loop when importing vcs file with RESOURCES entry. 50Fixed an endless loop when importing vcs file with RESOURCES entry.
45 51
46********** VERSION 2.0.16 ************ 52********** VERSION 2.0.16 ************
47OM/Pi: 53OM/Pi:
48Fixed the SMTP account setting the option. 54Fixed the SMTP account setting the option.
49Fixed something in mail sending. 55Fixed something in mail sending.
50 56
51KO/Pi: 57KO/Pi:
52Added possibility to export selected events/todos as vcal file. 58Added possibility to export selected events/todos as vcal file.
53 59
54********** VERSION 2.0.15 ************ 60********** VERSION 2.0.15 ************
55 61
56PwM/Pi: 62PwM/Pi:
57Added keyboard shorcuts for 63Added keyboard shorcuts for
58- toggling summary view (space bar) 64- toggling summary view (space bar)
59- delete item (delete + backspace key) 65- delete item (delete + backspace key)
60- add new item ( i + n key) 66- add new item ( i + n key)
61Fixed length of info in the title. 67Fixed length of info in the title.
62 68
63KO/Pi-KA/Pi: 69KO/Pi-KA/Pi:
64Changed "ME" menu bar entry to an icon. 70Changed "ME" menu bar entry to an icon.
65 71
66KO/Pi: 72KO/Pi:
67Fixed two minor bugs in displaying todos. 73Fixed two minor bugs in displaying todos.
68If in month view a cell is selected, the key shortcut "d" shows now that date. 74If in month view a cell is selected, the key shortcut "d" shows now that date.
69Added complete info for a todo in month view as an icon left of the text. 75Added complete info for a todo in month view as an icon left of the text.
70Fixed problems of displaying data when "<" or ">" are used in summary/location/description. 76Fixed problems of displaying data when "<" or ">" are used in summary/location/description.
71Fixed problem of search dialog size when switching displays. 77Fixed problem of search dialog size when switching displays.
72Cancel key now closes date picker. 78Cancel key now closes date picker.
73Rearranged KO/Pi file menu structure. 79Rearranged KO/Pi file menu structure.
74 80
75OM/Pi: 81OM/Pi:
76Added to the SMTP account setting the option 82Added to the SMTP account setting the option
77"No secure connection". 83"No secure connection".
78You have to configure your SMTP accounts again, sorry. 84You have to configure your SMTP accounts again, sorry.
79 85
80KA/Pi: 86KA/Pi:
81Added support for importing quoted-printable. 87Added support for importing quoted-printable.
82Support was added by Peter P.. Thanks, Peter! 88Support was added by Peter P.. Thanks, Peter!
83 89
84 90
85********** VERSION 2.0.14 ************ 91********** VERSION 2.0.14 ************
86 92
87Made Passwordmanager PwM/Pi more userfriendly: 93Made Passwordmanager PwM/Pi more userfriendly:
88Rearranged some toolbar icons, optimized setting of focus, fixed layout problems and more. 94Rearranged some toolbar icons, optimized setting of focus, fixed layout problems and more.
89Fixed bug in KO/Pi todo printing. 95Fixed bug in KO/Pi todo printing.
90Made Qtopia calendar import possible on desktop . 96Made Qtopia calendar import possible on desktop .
91 97
92********** VERSION 2.0.13 ************ 98********** VERSION 2.0.13 ************
93 99
94Fixed a problem in the addressee select dialog and made it more user friendly by adding a minimize splitter. 100Fixed a problem in the addressee select dialog and made it more user friendly by adding a minimize splitter.
95 101
96In the search dialog you can switch now the focus from search line edit to the list view by pressing key "arrow down". 102In the search dialog you can switch now the focus from search line edit to the list view by pressing key "arrow down".
97 103
98OM/Pi: 104OM/Pi:
99Fixed a refresh problem of outgoing/sent/sendfailed folders after sending mails. 105Fixed a refresh problem of outgoing/sent/sendfailed folders after sending mails.
100Added missing German translation. 106Added missing German translation.
101Added warning if path is specified in local folder settings of account config. 107Added warning if path is specified in local folder settings of account config.
102 108
103********** VERSION 2.0.12 ************ 109********** VERSION 2.0.12 ************
104 110
105KO/Pi: 111KO/Pi:
106Fixed a bug in todo start/due date handling for non recurring todos with a start and due date. 112Fixed a bug in todo start/due date handling for non recurring todos with a start and due date.
107Fixed some layout problems in the KO/Pi agenda view when there were many conflicting itmes. 113Fixed some layout problems in the KO/Pi agenda view when there were many conflicting itmes.
108Fixed several problems of the keyboard focus in the desktop versions when opening the search dialog/event viewer. 114Fixed several problems of the keyboard focus in the desktop versions when opening the search dialog/event viewer.
109 115
110Fixed problem in pi-sync mode when wrong password was sent. 116Fixed problem in pi-sync mode when wrong password was sent.
111 117
112OM/Pi: 118OM/Pi:
113Fixed a crash when displaying mails with "Show mail as html" was checked in the config. 119Fixed a crash when displaying mails with "Show mail as html" was checked in the config.
114Added a check before displaying the mail if the mail is in html format, if "Show mail as html" is enabled. 120Added a check before displaying the mail if the mail is in html format, if "Show mail as html" is enabled.
115 121
116********** VERSION 2.0.11 ************ 122********** VERSION 2.0.11 ************
117 123
118Fixed some problems in pi-sync mode 124Fixed some problems in pi-sync mode
119(e.g. details of events were not synced properly) 125(e.g. details of events were not synced properly)
120 126
121********** VERSION 2.0.10 ************ 127********** VERSION 2.0.10 ************
122 128
123KO/Pi: 129KO/Pi:
124In the desktop versions the context menu in the search dialog was broken after introducing the What'sThis info for the list view. 130In the desktop versions the context menu in the search dialog was broken after introducing the What'sThis info for the list view.
125This is fixed. 131This is fixed.
126Changed the search dialog a bit to make it more user friendly. 132Changed the search dialog a bit to make it more user friendly.
127(E.g.: Removed message box about "no items found" and set key focus to search line edit after search). 133(E.g.: Removed message box about "no items found" and set key focus to search line edit after search).
128 134
129Added config option to hide the week number in KO/Pi toolbar. 135Added config option to hide the week number in KO/Pi toolbar.
130 136
131********** VERSION 2.0.9 ************ 137********** VERSION 2.0.9 ************
132 138
133Made month view icons for multiday events a bit nicer. 139Made month view icons for multiday events a bit nicer.
134Some minor fixes in KO/Pi 140Some minor fixes in KO/Pi
135(e.g. go to today did not work for new week view properly). 141(e.g. go to today did not work for new week view properly).
136 142
137 143
138********** VERSION 2.0.8 ************ 144********** VERSION 2.0.8 ************
139 145
140Fixed a problem in dependency info in the ipk files for the Zaurus. 146Fixed a problem in dependency info in the ipk files for the Zaurus.
141 147
142Added icon for the stealth new week view and made navigation more user friendly in monthview by adding a prev/next week button to the navigator bar. 148Added icon for the stealth new week view and made navigation more user friendly in monthview by adding a prev/next week button to the navigator bar.
143 149
144Added a "go today" button to the datepicker. 150Added a "go today" button to the datepicker.
145 151
146Added "created" and "last modified" to event/todo viewer (and What'sThis viewer) 152Added "created" and "last modified" to event/todo viewer (and What'sThis viewer)
147and made it configureable to show these values. 153and made it configureable to show these values.
148 154
149Fixed a problem for events (from external iCal files) that do have a duration but no end date. 155Fixed a problem for events (from external iCal files) that do have a duration but no end date.
150 156
151 157
152********** VERSION 2.0.7 ************ 158********** VERSION 2.0.7 ************
153 159
154Added global application font settings 160Added global application font settings
155(for all KDE-Pim/Pi apps) to the general settings. 161(for all KDE-Pim/Pi apps) to the general settings.
156 162
157Fixed a problem in OM/Pi when trying to login to some IMAP servers 163Fixed a problem in OM/Pi when trying to login to some IMAP servers
158(like the IMAP server of Apple: mail.mac.com ) 164(like the IMAP server of Apple: mail.mac.com )
159 165
160Added recurring todos to KO/Pi. 166Added recurring todos to KO/Pi.
161 167
162 168
163********** VERSION 2.0.6 ************ 169********** VERSION 2.0.6 ************
164 170
165Stable release 2.0.6! 171Stable release 2.0.6!
166 172
167Some bugfixes in the pi-sync mode. 173Some bugfixes in the pi-sync mode.
168Added German translation for pi-sync mode. 174Added German translation for pi-sync mode.
169 175
170KO/Pi: 176KO/Pi:
171Made the todolist using alternate background. 177Made the todolist using alternate background.
172 178
173Other minor fixes in KO/Pi. 179Other minor fixes in KO/Pi.
174 180
175 181
176You can find the complete changelog 182You can find the complete changelog
177from version 1.7.7 to 2.0.5 183from version 1.7.7 to 2.0.5
178in the source package or on 184in the source package or on
179 185
180http://www.pi-sync.net/html/changelog.html 186http://www.pi-sync.net/html/changelog.html
181 187
182 188
183 189
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 6ed6a1c..92fd59c 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -181,384 +181,388 @@ class KOCatPrefs : public QDialog
181 QDialog( parent, name, true ) 181 QDialog( parent, name, true )
182 { 182 {
183 setCaption( i18n("Manage new Categories") ); 183 setCaption( i18n("Manage new Categories") );
184 QVBoxLayout* lay = new QVBoxLayout( this ); 184 QVBoxLayout* lay = new QVBoxLayout( this );
185 lay->setSpacing( 3 ); 185 lay->setSpacing( 3 );
186 lay->setMargin( 3 ); 186 lay->setMargin( 3 );
187 QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\nevents or todos\nwhich are not in the category list.\nPlease choose what to do:\n "), this ); 187 QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\nevents or todos\nwhich are not in the category list.\nPlease choose what to do:\n "), this );
188 lay->addWidget( lab ); 188 lay->addWidget( lab );
189 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); 189 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this );
190 lay->addWidget( format ); 190 lay->addWidget( format );
191 format->setExclusive ( true ) ; 191 format->setExclusive ( true ) ;
192 addCatBut = new QRadioButton(i18n("Add to category list"), format ); 192 addCatBut = new QRadioButton(i18n("Add to category list"), format );
193 new QRadioButton(i18n("Remove from Events/Todos"), format ); 193 new QRadioButton(i18n("Remove from Events/Todos"), format );
194 addCatBut->setChecked( true ); 194 addCatBut->setChecked( true );
195 QPushButton * ok = new QPushButton( i18n("OK"), this ); 195 QPushButton * ok = new QPushButton( i18n("OK"), this );
196 lay->addWidget( ok ); 196 lay->addWidget( ok );
197 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 197 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
198 lay->addWidget( cancel ); 198 lay->addWidget( cancel );
199 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 199 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
200 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 200 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
201 resize( 200, 200 ); 201 resize( 200, 200 );
202 } 202 }
203 203
204 bool addCat() { return addCatBut->isChecked(); } 204 bool addCat() { return addCatBut->isChecked(); }
205private: 205private:
206 QRadioButton* addCatBut; 206 QRadioButton* addCatBut;
207}; 207};
208 208
209 209
210 210
211CalendarView::CalendarView( CalendarResources *calendar, 211CalendarView::CalendarView( CalendarResources *calendar,
212 QWidget *parent, const char *name ) 212 QWidget *parent, const char *name )
213 : CalendarViewBase( parent, name ), 213 : CalendarViewBase( parent, name ),
214 mCalendar( calendar ), 214 mCalendar( calendar ),
215 mResourceManager( calendar->resourceManager() ) 215 mResourceManager( calendar->resourceManager() )
216{ 216{
217 217
218 mEventEditor = 0; 218 mEventEditor = 0;
219 mTodoEditor = 0; 219 mTodoEditor = 0;
220 220
221 init(); 221 init();
222} 222}
223 223
224CalendarView::CalendarView( Calendar *calendar, 224CalendarView::CalendarView( Calendar *calendar,
225 QWidget *parent, const char *name ) 225 QWidget *parent, const char *name )
226 : CalendarViewBase( parent, name ), 226 : CalendarViewBase( parent, name ),
227 mCalendar( calendar ), 227 mCalendar( calendar ),
228 mResourceManager( 0 ) 228 mResourceManager( 0 )
229{ 229{
230 230
231 mEventEditor = 0; 231 mEventEditor = 0;
232 mTodoEditor = 0; 232 mTodoEditor = 0;
233 init(); 233 init();
234} 234}
235 235
236void CalendarView::init() 236void CalendarView::init()
237{ 237{
238 238
239 setFocusPolicy ( WheelFocus ); 239 setFocusPolicy ( WheelFocus );
240 mViewerCallerIsSearchDialog = false; 240 mViewerCallerIsSearchDialog = false;
241 mBlockShowDates = false; 241 mBlockShowDates = false;
242 beamDialog = new KOBeamPrefs(); 242 beamDialog = new KOBeamPrefs();
243 mDatePickerMode = 0; 243 mDatePickerMode = 0;
244 mCurrentSyncDevice = ""; 244 mCurrentSyncDevice = "";
245 writeLocale(); 245 writeLocale();
246 mViewManager = new KOViewManager( this ); 246 mViewManager = new KOViewManager( this );
247 mDialogManager = new KODialogManager( this ); 247 mDialogManager = new KODialogManager( this );
248 mEventViewerDialog = 0; 248 mEventViewerDialog = 0;
249 mModified = false; 249 mModified = false;
250 mReadOnly = false; 250 mReadOnly = false;
251 mSelectedIncidence = 0; 251 mSelectedIncidence = 0;
252 mCalPrinter = 0; 252 mCalPrinter = 0;
253 mFilters.setAutoDelete(true); 253 mFilters.setAutoDelete(true);
254 254
255 mCalendar->registerObserver( this ); 255 mCalendar->registerObserver( this );
256 // TODO: Make sure that view is updated, when calendar is changed. 256 // TODO: Make sure that view is updated, when calendar is changed.
257 257
258 mStorage = new FileStorage( mCalendar ); 258 mStorage = new FileStorage( mCalendar );
259 mNavigator = new DateNavigator( this, "datevav", mViewManager ); 259 mNavigator = new DateNavigator( this, "datevav", mViewManager );
260 260
261 QBoxLayout *topLayout = (QBoxLayout*)layout(); 261 QBoxLayout *topLayout = (QBoxLayout*)layout();
262#ifndef KORG_NOSPLITTER 262#ifndef KORG_NOSPLITTER
263 // create the main layout frames. 263 // create the main layout frames.
264 mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); 264 mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner");
265 topLayout->addWidget(mPanner); 265 topLayout->addWidget(mPanner);
266 266
267 mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, 267 mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner,
268 "CalendarView::LeftFrame"); 268 "CalendarView::LeftFrame");
269 mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); 269 mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize);
270 270
271 mDateNavigator = new DateNavigatorContainer( mLeftSplitter, 271 mDateNavigator = new DateNavigatorContainer( mLeftSplitter,
272 "CalendarView::DateNavigator" ); 272 "CalendarView::DateNavigator" );
273 273
274 mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); 274 mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize);
275 mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); 275 mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2");
276 mTodoList->setNavigator( mNavigator ); 276 mTodoList->setNavigator( mNavigator );
277 mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); 277 mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView");
278 278
279#ifdef KORG_NORESOURCEVIEW 279#ifdef KORG_NORESOURCEVIEW
280 mResourceView = 0; 280 mResourceView = 0;
281#else 281#else
282 if ( mResourceManager ) { 282 if ( mResourceManager ) {
283 mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); 283 mResourceView = new ResourceView( mResourceManager, mLeftSplitter );
284 mResourceView->updateView(); 284 mResourceView->updateView();
285 connect( mResourceView, SIGNAL( resourcesChanged() ), 285 connect( mResourceView, SIGNAL( resourcesChanged() ),
286 SLOT( updateView() ) ); 286 SLOT( updateView() ) );
287 } else { 287 } else {
288 mResourceView = 0; 288 mResourceView = 0;
289 } 289 }
290#endif 290#endif
291 QWidget *rightBox = new QWidget( mPanner ); 291 QWidget *rightBox = new QWidget( mPanner );
292 QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); 292 QBoxLayout *rightLayout = new QVBoxLayout( rightBox );
293 293
294 mRightFrame = new QWidgetStack( rightBox ); 294 mRightFrame = new QWidgetStack( rightBox );
295 rightLayout->addWidget( mRightFrame, 1 ); 295 rightLayout->addWidget( mRightFrame, 1 );
296 296
297 mLeftFrame = mLeftSplitter; 297 mLeftFrame = mLeftSplitter;
298#else 298#else
299 //QWidget *mainBox = new QWidget( this ); 299 //QWidget *mainBox = new QWidget( this );
300 //QWidget *leftFrame = new QWidget( mainBox ); 300 //QWidget *leftFrame = new QWidget( mainBox );
301 //QBoxLayout * mainBoxLayout; 301 //QBoxLayout * mainBoxLayout;
302 if ( KOPrefs::instance()->mVerticalScreen ) { 302 if ( KOPrefs::instance()->mVerticalScreen ) {
303 //mainBoxLayout = new QVBoxLayout(mainBox); 303 //mainBoxLayout = new QVBoxLayout(mainBox);
304 //leftFrameLayout = new QHBoxLayout(leftFrame ); 304 //leftFrameLayout = new QHBoxLayout(leftFrame );
305 mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this ); 305 mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this );
306 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); 306 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up );
307 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);; 307 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);;
308 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 308 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
309 } else { 309 } else {
310 //mainBoxLayout = new QHBoxLayout(mainBox); 310 //mainBoxLayout = new QHBoxLayout(mainBox);
311 //leftFrameLayout = new QVBoxLayout(leftFrame ); 311 //leftFrameLayout = new QVBoxLayout(leftFrame );
312 mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 312 mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
313 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left); 313 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left);
314 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame); 314 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame);
315 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); 315 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up );
316 } 316 }
317 mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) ); 317 mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) );
318 //QBoxLayout * leftFrameLayout; 318 //QBoxLayout * leftFrameLayout;
319 topLayout->addWidget( mMainFrame ); 319 topLayout->addWidget( mMainFrame );
320 //mainBoxLayout->addWidget (mLeftFrame); 320 //mainBoxLayout->addWidget (mLeftFrame);
321 mDateNavigator = new DateNavigatorContainer( mLeftFrame, 321 mDateNavigator = new DateNavigatorContainer( mLeftFrame,
322 "CalendarView::DateNavigator" ); 322 "CalendarView::DateNavigator" );
323#if 0 323#if 0
324 // FIXME 324 // FIXME
325 mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE, 325 mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE,
326 "CalendarView::DateNavigator", QDate::currentDate()); 326 "CalendarView::DateNavigator", QDate::currentDate());
327#endif 327#endif
328 // mDateNavigator->blockSignals( true ); 328 // mDateNavigator->blockSignals( true );
329 //leftFrameLayout->addWidget( mDateNavigator ); 329 //leftFrameLayout->addWidget( mDateNavigator );
330 mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall"); 330 mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall");
331 mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView"); 331 mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView");
332 mTodoList->setNavigator( mNavigator ); 332 mTodoList->setNavigator( mNavigator );
333#if 0 333#if 0
334 if ( QApplication::desktop()->width() < 480 ) { 334 if ( QApplication::desktop()->width() < 480 ) {
335 leftFrameLayout->addWidget(mFilterView); 335 leftFrameLayout->addWidget(mFilterView);
336 leftFrameLayout->addWidget(mTodoList, 2 ); 336 leftFrameLayout->addWidget(mTodoList, 2 );
337 337
338 } else { 338 } else {
339 leftFrameLayout->addWidget(mTodoList,2 ); 339 leftFrameLayout->addWidget(mTodoList,2 );
340 leftFrameLayout->addWidget(mFilterView ); 340 leftFrameLayout->addWidget(mFilterView );
341 } 341 }
342#endif 342#endif
343 mFilterView->hide(); 343 mFilterView->hide();
344 QWidget *rightBox = new QWidget( mMainFrame ); 344 QWidget *rightBox = new QWidget( mMainFrame );
345 //mainBoxLayout->addWidget ( rightBox, 10 ); 345 //mainBoxLayout->addWidget ( rightBox, 10 );
346 QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); 346 QBoxLayout *rightLayout = new QVBoxLayout( rightBox );
347 mRightFrame = new QWidgetStack( rightBox ); 347 mRightFrame = new QWidgetStack( rightBox );
348 rightLayout->addWidget( mRightFrame, 10 ); 348 rightLayout->addWidget( mRightFrame, 10 );
349 349
350 //mLeftFrame = (QWidget *)leftFrame; 350 //mLeftFrame = (QWidget *)leftFrame;
351 if ( KOPrefs::instance()->mVerticalScreen ) { 351 if ( KOPrefs::instance()->mVerticalScreen ) {
352 //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() ); 352 //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() );
353 //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() ); 353 //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() );
354 //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); 354 //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() );
355 //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); 355 //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() );
356 } else { 356 } else {
357 //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() ); 357 //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() );
358 //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); 358 //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() );
359 //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); 359 //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() );
360 } 360 }
361 if ( !KOPrefs::instance()->mShowDateNavigator) 361 if ( !KOPrefs::instance()->mShowDateNavigator)
362 mDateNavigator->hide(); 362 mDateNavigator->hide();
363 //qDebug("Calendarview Size %d %d ", width(), height()); 363 //qDebug("Calendarview Size %d %d ", width(), height());
364#endif 364#endif
365 365
366 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 366 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
367 SLOT( showDates( const KCal::DateList & ) ) ); 367 SLOT( showDates( const KCal::DateList & ) ) );
368 368
369 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 369 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
370 mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); 370 mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) );
371 371
372 372
373
374 connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ),
375 mViewManager, SLOT( showMonth( const QDate & ) ) );
376
373 connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), 377 connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ),
374 mNavigator, SLOT( selectWeek( const QDate & ) ) ); 378 mNavigator, SLOT( selectWeek( const QDate & ) ) );
375 379
376 connect( mDateNavigator, SIGNAL( goPrevYear() ), 380 connect( mDateNavigator, SIGNAL( goPrevYear() ),
377 mNavigator, SLOT( selectPreviousYear() ) ); 381 mNavigator, SLOT( selectPreviousYear() ) );
378 connect( mDateNavigator, SIGNAL( goNextYear() ), 382 connect( mDateNavigator, SIGNAL( goNextYear() ),
379 mNavigator, SLOT( selectNextYear() ) ); 383 mNavigator, SLOT( selectNextYear() ) );
380 connect( mDateNavigator, SIGNAL( goPrevMonth() ), 384 connect( mDateNavigator, SIGNAL( goPrevMonth() ),
381 mNavigator, SLOT( selectPreviousMonth() ) ); 385 mNavigator, SLOT( selectPreviousMonth() ) );
382 connect( mDateNavigator, SIGNAL( goNextMonth() ), 386 connect( mDateNavigator, SIGNAL( goNextMonth() ),
383 mNavigator, SLOT( selectNextMonth() ) ); 387 mNavigator, SLOT( selectNextMonth() ) );
384 388
385 connect( mDateNavigator, SIGNAL( goPrevious() ), 389 connect( mDateNavigator, SIGNAL( goPrevious() ),
386 mNavigator, SLOT( selectPrevious() ) ); 390 mNavigator, SLOT( selectPrevious() ) );
387 connect( mDateNavigator, SIGNAL( goNext() ), 391 connect( mDateNavigator, SIGNAL( goNext() ),
388 mNavigator, SLOT( selectNext() ) ); 392 mNavigator, SLOT( selectNext() ) );
389 connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), 393 connect( mDateNavigator, SIGNAL( monthSelected ( int ) ),
390 mNavigator, SLOT( slotMonthSelect( int ) ) ); 394 mNavigator, SLOT( slotMonthSelect( int ) ) );
391 395
392 connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 396 connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
393 mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); 397 mNavigator, SLOT( selectDates( const KCal::DateList & ) ) );
394#if 0 398#if 0
395 connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ), 399 connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ),
396 SLOT( incidenceAdded( Incidence *) ) ); 400 SLOT( incidenceAdded( Incidence *) ) );
397#endif 401#endif
398 // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); 402 // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView()));
399 403
400 connect( this, SIGNAL( configChanged() ), 404 connect( this, SIGNAL( configChanged() ),
401 mDateNavigator, SLOT( updateConfig() ) ); 405 mDateNavigator, SLOT( updateConfig() ) );
402 406
403 connect( mTodoList, SIGNAL( newTodoSignal() ), 407 connect( mTodoList, SIGNAL( newTodoSignal() ),
404 SLOT( newTodo() ) ); 408 SLOT( newTodo() ) );
405 connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), 409 connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ),
406 SLOT( newSubTodo( Todo * ) ) ); 410 SLOT( newSubTodo( Todo * ) ) );
407 connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), 411 connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ),
408 SLOT( editTodo( Todo * ) ) ); 412 SLOT( editTodo( Todo * ) ) );
409 connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), 413 connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ),
410 SLOT( showTodo( Todo *) ) ); 414 SLOT( showTodo( Todo *) ) );
411 connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), 415 connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ),
412 SLOT( deleteTodo( Todo *) ) ); 416 SLOT( deleteTodo( Todo *) ) );
413 connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); 417 connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) );
414 connect( mTodoList, SIGNAL( purgeCompletedSignal() ), 418 connect( mTodoList, SIGNAL( purgeCompletedSignal() ),
415 SLOT( purgeCompleted() ) ); 419 SLOT( purgeCompleted() ) );
416 connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), 420 connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ),
417 SIGNAL( todoModified( Todo *, int ) ) ); 421 SIGNAL( todoModified( Todo *, int ) ) );
418 422
419 connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), 423 connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ),
420 this, SLOT ( cloneIncidence( Incidence * ) ) ); 424 this, SLOT ( cloneIncidence( Incidence * ) ) );
421 connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), 425 connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ),
422 this, SLOT (cancelIncidence( Incidence * ) ) ); 426 this, SLOT (cancelIncidence( Incidence * ) ) );
423 427
424 connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), 428 connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ),
425 this, SLOT ( moveIncidence( Incidence * ) ) ); 429 this, SLOT ( moveIncidence( Incidence * ) ) );
426 connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), 430 connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ),
427 this, SLOT ( beamIncidence( Incidence * ) ) ); 431 this, SLOT ( beamIncidence( Incidence * ) ) );
428 432
429 connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), 433 connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ),
430 this, SLOT ( todo_unsub( Todo * ) ) ); 434 this, SLOT ( todo_unsub( Todo * ) ) );
431 435
432 connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), 436 connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ),
433 this, SLOT ( todo_resub( Todo *,Todo * ) ) ); 437 this, SLOT ( todo_resub( Todo *,Todo * ) ) );
434 connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, 438 connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList,
435 SLOT( updateTodo( Todo *, int ) ) ); 439 SLOT( updateTodo( Todo *, int ) ) );
436 connect( this, SIGNAL( todoModified( Todo *, int )), this, 440 connect( this, SIGNAL( todoModified( Todo *, int )), this,
437 SLOT( changeTodoDisplay( Todo *, int ) ) ); 441 SLOT( changeTodoDisplay( Todo *, int ) ) );
438 442
439 443
440 connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); 444 connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) );
441 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); 445 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) );
442 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); 446 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) );
443 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); 447 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) );
444 448
445 449
446 450
447 451
448 452
449 connect(QApplication::clipboard(),SIGNAL(dataChanged()), 453 connect(QApplication::clipboard(),SIGNAL(dataChanged()),
450 SLOT(checkClipboard())); 454 SLOT(checkClipboard()));
451 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), 455 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ),
452 SLOT( processTodoListSelection( Incidence * ) ) ); 456 SLOT( processTodoListSelection( Incidence * ) ) );
453 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); 457 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool)));
454 458
455 // kdDebug() << "CalendarView::CalendarView() done" << endl; 459 // kdDebug() << "CalendarView::CalendarView() done" << endl;
456 460
457 mDateFrame = new QVBox(0,0,WType_Popup); 461 mDateFrame = new QVBox(0,0,WType_Popup);
458 //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); 462 //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised);
459 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); 463 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised );
460 mDateFrame->setLineWidth(3); 464 mDateFrame->setLineWidth(3);
461 mDateFrame->hide(); 465 mDateFrame->hide();
462 mDateFrame->setCaption( i18n( "Pick a date to display")); 466 mDateFrame->setCaption( i18n( "Pick a date to display"));
463 mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); 467 mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() );
464 468
465 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); 469 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate)));
466 470
467 mEventEditor = mDialogManager->getEventEditor(); 471 mEventEditor = mDialogManager->getEventEditor();
468 mTodoEditor = mDialogManager->getTodoEditor(); 472 mTodoEditor = mDialogManager->getTodoEditor();
469 473
470 mFlagEditDescription = false; 474 mFlagEditDescription = false;
471 475
472 mSuspendTimer = new QTimer( this ); 476 mSuspendTimer = new QTimer( this );
473 mAlarmTimer = new QTimer( this ); 477 mAlarmTimer = new QTimer( this );
474 mRecheckAlarmTimer = new QTimer( this ); 478 mRecheckAlarmTimer = new QTimer( this );
475 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); 479 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) );
476 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); 480 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) );
477 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); 481 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) );
478 mAlarmDialog = new AlarmDialog( this ); 482 mAlarmDialog = new AlarmDialog( this );
479 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); 483 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) );
480 mAlarmDialog->setServerNotification( false ); 484 mAlarmDialog->setServerNotification( false );
481 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); 485 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime );
482 486
483 487
484#ifndef DESKTOP_VERSION 488#ifndef DESKTOP_VERSION
485//US listen for arriving address resultsets 489//US listen for arriving address resultsets
486 connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), 490 connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)),
487 this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); 491 this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)));
488#endif 492#endif
489 mDateNavigator->setCalendar( mCalendar ); 493 mDateNavigator->setCalendar( mCalendar );
490} 494}
491 495
492 496
493CalendarView::~CalendarView() 497CalendarView::~CalendarView()
494{ 498{
495 // kdDebug() << "~CalendarView()" << endl; 499 // kdDebug() << "~CalendarView()" << endl;
496 //qDebug("CalendarView::~CalendarView() "); 500 //qDebug("CalendarView::~CalendarView() ");
497 delete mDialogManager; 501 delete mDialogManager;
498 delete mViewManager; 502 delete mViewManager;
499 delete mStorage; 503 delete mStorage;
500 delete mDateFrame ; 504 delete mDateFrame ;
501 delete beamDialog; 505 delete beamDialog;
502 delete mEventViewerDialog; 506 delete mEventViewerDialog;
503 //kdDebug() << "~CalendarView() done" << endl; 507 //kdDebug() << "~CalendarView() done" << endl;
504} 508}
505 509
506void CalendarView::showDay( QDate d ) 510void CalendarView::showDay( QDate d )
507{ 511{
508 dateNavigator()->blockSignals( true ); 512 dateNavigator()->blockSignals( true );
509 dateNavigator()->selectDate( d ); 513 dateNavigator()->selectDate( d );
510 dateNavigator()->blockSignals( false ); 514 dateNavigator()->blockSignals( false );
511 mViewManager->showDayView(); 515 mViewManager->showDayView();
512 //dateNavigator()->selectDate( d ); 516 //dateNavigator()->selectDate( d );
513} 517}
514void CalendarView::timerAlarm() 518void CalendarView::timerAlarm()
515{ 519{
516 //qDebug("CalendarView::timerAlarm() "); 520 //qDebug("CalendarView::timerAlarm() ");
517 computeAlarm(mAlarmNotification ); 521 computeAlarm(mAlarmNotification );
518} 522}
519 523
520void CalendarView::suspendAlarm() 524void CalendarView::suspendAlarm()
521{ 525{
522 //qDebug(" CalendarView::suspendAlarm() "); 526 //qDebug(" CalendarView::suspendAlarm() ");
523 computeAlarm(mSuspendAlarmNotification ); 527 computeAlarm(mSuspendAlarmNotification );
524 528
525} 529}
526 530
527void CalendarView::startAlarm( QString mess , QString filename) 531void CalendarView::startAlarm( QString mess , QString filename)
528{ 532{
529 mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); 533 mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount );
530 QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); 534 QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) );
531 535
532} 536}
533 537
534void CalendarView::checkNextTimerAlarm() 538void CalendarView::checkNextTimerAlarm()
535{ 539{
536 mCalendar->checkAlarmForIncidence( 0, true ); 540 mCalendar->checkAlarmForIncidence( 0, true );
537} 541}
538 542
539void CalendarView::computeAlarm( QString msg ) 543void CalendarView::computeAlarm( QString msg )
540{ 544{
541 545
542 QString mess = msg; 546 QString mess = msg;
543 QString mAlarmMessage = mess.mid( 9 ); 547 QString mAlarmMessage = mess.mid( 9 );
544 QString filename = MainWindow::resourcePath(); 548 QString filename = MainWindow::resourcePath();
545 filename += "koalarm.wav"; 549 filename += "koalarm.wav";
546 QString tempfilename; 550 QString tempfilename;
547 if ( mess.left( 13 ) == "suspend_alarm") { 551 if ( mess.left( 13 ) == "suspend_alarm") {
548 bool error = false; 552 bool error = false;
549 int len = mess.mid( 13 ).find("+++"); 553 int len = mess.mid( 13 ).find("+++");
550 if ( len < 2 ) 554 if ( len < 2 )
551 error = true; 555 error = true;
552 else { 556 else {
553 tempfilename = mess.mid( 13, len ); 557 tempfilename = mess.mid( 13, len );
554 if ( !QFile::exists( tempfilename ) ) 558 if ( !QFile::exists( tempfilename ) )
555 error = true; 559 error = true;
556 } 560 }
557 if ( ! error ) { 561 if ( ! error ) {
558 filename = tempfilename; 562 filename = tempfilename;
559 } 563 }
560 mAlarmMessage = mess.mid( 13+len+3 ); 564 mAlarmMessage = mess.mid( 13+len+3 );
561 //qDebug("suspend file %s ",tempfilename.latin1() ); 565 //qDebug("suspend file %s ",tempfilename.latin1() );
562 startAlarm( mAlarmMessage, filename); 566 startAlarm( mAlarmMessage, filename);
563 return; 567 return;
564 } 568 }
diff --git a/korganizer/datenavigatorcontainer.cpp b/korganizer/datenavigatorcontainer.cpp
index 11dc592..edeebdf 100644
--- a/korganizer/datenavigatorcontainer.cpp
+++ b/korganizer/datenavigatorcontainer.cpp
@@ -1,265 +1,267 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 3
4 Copyright (c) 2001,2002,2003 Cornelius Schumacher <schumacher@kde.org> 4 Copyright (c) 2001,2002,2003 Cornelius Schumacher <schumacher@kde.org>
5 Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com> 5 Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
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 <kdebug.h> 26#include <kdebug.h>
27#include <klocale.h> 27#include <klocale.h>
28 28
29//#include "koglobals.h" 29//#include "koglobals.h"
30#include "navigatorbar.h" 30#include "navigatorbar.h"
31#include "kdatenavigator.h" 31#include "kdatenavigator.h"
32 32
33#include <kcalendarsystem.h> 33#include <kcalendarsystem.h>
34 34
35#include "datenavigatorcontainer.h" 35#include "datenavigatorcontainer.h"
36#include "koprefs.h" 36#include "koprefs.h"
37 37
38DateNavigatorContainer::DateNavigatorContainer( QWidget *parent, 38DateNavigatorContainer::DateNavigatorContainer( QWidget *parent,
39 const char *name ) 39 const char *name )
40 : QWidget( parent, name ), mCalendar( 0 ), 40 : QWidget( parent, name ), mCalendar( 0 ),
41 mHorizontalCount( 1 ), mVerticalCount( 1 ) 41 mHorizontalCount( 1 ), mVerticalCount( 1 )
42{ 42{
43 mResizeEnabled = false; 43 mResizeEnabled = false;
44 mExtraViews.setAutoDelete( true ); 44 mExtraViews.setAutoDelete( true );
45 45
46 mNavigatorView = new KDateNavigator( this, name ); 46 mNavigatorView = new KDateNavigator( this, name );
47 mNavigatorView->hide(); 47 mNavigatorView->hide();
48 connectNavigatorView( mNavigatorView ); 48 connectNavigatorView( mNavigatorView );
49 //setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) ); 49 //setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) );
50 mLastDisplayedDN = 0; 50 mLastDisplayedDN = 0;
51 mUpdateTimer; 51 mUpdateTimer;
52 mUpdateTimer = new QTimer( this ); 52 mUpdateTimer = new QTimer( this );
53 connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( checkUpdateDayMatrixDates() )); 53 connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( checkUpdateDayMatrixDates() ));
54 mFirstSelectedDate = QDate::currentDate(); 54 mFirstSelectedDate = QDate::currentDate();
55 mSelectedDateCount = 1; 55 mSelectedDateCount = 1;
56} 56}
57 57
58DateNavigatorContainer::~DateNavigatorContainer() 58DateNavigatorContainer::~DateNavigatorContainer()
59{ 59{
60} 60}
61 61
62void DateNavigatorContainer::connectNavigatorView( KDateNavigator *v ) 62void DateNavigatorContainer::connectNavigatorView( KDateNavigator *v )
63{ 63{
64 connect( v, SIGNAL( datesSelected( const KCal::DateList & ) ), 64 connect( v, SIGNAL( datesSelected( const KCal::DateList & ) ),
65 SIGNAL( datesSelected( const KCal::DateList & ) ) ); 65 SIGNAL( datesSelected( const KCal::DateList & ) ) );
66#if 0 66#if 0
67 connect( v, SIGNAL( incidenceDropped( Incidence *, const QDate & ) ), 67 connect( v, SIGNAL( incidenceDropped( Incidence *, const QDate & ) ),
68 SIGNAL( incidenceDropped( Incidence *, const QDate & ) ) ); 68 SIGNAL( incidenceDropped( Incidence *, const QDate & ) ) );
69 connect( v, SIGNAL( incidenceDroppedMove( Incidence *, const QDate & ) ), 69 connect( v, SIGNAL( incidenceDroppedMove( Incidence *, const QDate & ) ),
70 SIGNAL( incidenceDroppedMove( Incidence *, const QDate & ) ) ); 70 SIGNAL( incidenceDroppedMove( Incidence *, const QDate & ) ) );
71#endif 71#endif
72 connect( v, SIGNAL( weekClicked( const QDate & ) ), 72 connect( v, SIGNAL( weekClicked( const QDate & ) ),
73 SIGNAL( weekClicked( const QDate & ) ) ); 73 SIGNAL( weekClicked( const QDate & ) ) );
74 connect( v, SIGNAL( showMonth( const QDate & ) ),
75 SIGNAL( showMonth( const QDate & ) ) );
74 76
75 connect( v, SIGNAL( goPrevious() ), SIGNAL( goPrevious() ) ); 77 connect( v, SIGNAL( goPrevious() ), SIGNAL( goPrevious() ) );
76 connect( v, SIGNAL( goNext() ), SIGNAL( goNext() ) ); 78 connect( v, SIGNAL( goNext() ), SIGNAL( goNext() ) );
77 79
78 connect( v, SIGNAL( goNextMonth() ), SLOT( slotgoNextMonth() ) ); 80 connect( v, SIGNAL( goNextMonth() ), SLOT( slotgoNextMonth() ) );
79 connect( v, SIGNAL( goPrevMonth() ), SLOT( slotgoPrevMonth() ) ); 81 connect( v, SIGNAL( goPrevMonth() ), SLOT( slotgoPrevMonth() ) );
80 connect( v, SIGNAL( goNextYear() ), SLOT( slotgoNextYear() ) ); 82 connect( v, SIGNAL( goNextYear() ), SLOT( slotgoNextYear() ) );
81 connect( v, SIGNAL( goPrevYear() ), SLOT( slotgoPrevYear() ) ); 83 connect( v, SIGNAL( goPrevYear() ), SLOT( slotgoPrevYear() ) );
82 84
83 connect( v, SIGNAL( monthSelected( int ) ), SLOT( slotMonthSelected( int ) ) ); 85 connect( v, SIGNAL( monthSelected( int ) ), SLOT( slotMonthSelected( int ) ) );
84} 86}
85void DateNavigatorContainer::slotgoNextYear() 87void DateNavigatorContainer::slotgoNextYear()
86{ 88{
87 jumpMonth( 12 ); 89 jumpMonth( 12 );
88 emit goNextYear(); 90 emit goNextYear();
89 91
90} 92}
91void DateNavigatorContainer::slotgoPrevYear() 93void DateNavigatorContainer::slotgoPrevYear()
92{ 94{
93 jumpMonth( -12 ); 95 jumpMonth( -12 );
94 emit goPrevYear(); 96 emit goPrevYear();
95 97
96} 98}
97void DateNavigatorContainer::slotgoPrevMonth() 99void DateNavigatorContainer::slotgoPrevMonth()
98{ 100{
99 jumpMonth( -1 ); 101 jumpMonth( -1 );
100 emit goPrevMonth(); 102 emit goPrevMonth();
101 103
102} 104}
103void DateNavigatorContainer::slotgoNextMonth() 105void DateNavigatorContainer::slotgoNextMonth()
104{ 106{
105 jumpMonth( 1 ); 107 jumpMonth( 1 );
106 emit goNextMonth(); 108 emit goNextMonth();
107} 109}
108void DateNavigatorContainer::jumpMonth( int month ) 110void DateNavigatorContainer::jumpMonth( int month )
109{ 111{
110 112
111 QDate baseDate = mNavigatorView->baseDate(); 113 QDate baseDate = mNavigatorView->baseDate();
112 computeMonthSelected( baseDate.month() + month, false ); 114 computeMonthSelected( baseDate.month() + month, false );
113} 115}
114void DateNavigatorContainer::slotMonthSelected( int month ) 116void DateNavigatorContainer::slotMonthSelected( int month )
115{ 117{
116 computeMonthSelected( month, true ); 118 computeMonthSelected( month, true );
117} 119}
118void DateNavigatorContainer::computeMonthSelected( int month , bool forceEmit ) 120void DateNavigatorContainer::computeMonthSelected( int month , bool forceEmit )
119{ 121{
120 //qDebug("slotMonthSelected %d ", month); 122 //qDebug("slotMonthSelected %d ", month);
121 QDate baseDate = mNavigatorView->baseDate(); 123 QDate baseDate = mNavigatorView->baseDate();
122 if ( baseDate.month() == month ) 124 if ( baseDate.month() == month )
123 return; 125 return;
124 //qDebug("month %d %d ",baseDate.month(),month); 126 //qDebug("month %d %d ",baseDate.month(),month);
125 QDate date = QDate ( baseDate.year(), baseDate.month() , 15 ); 127 QDate date = QDate ( baseDate.year(), baseDate.month() , 15 );
126 date = date.addDays( -(baseDate.month()-month ) *30 ); 128 date = date.addDays( -(baseDate.month()-month ) *30 );
127 QDate newBase = QDate ( date.year(), date.month() , baseDate.day() ); 129 QDate newBase = QDate ( date.year(), date.month() , baseDate.day() );
128 130
129 //qDebug("NEW BASE %s", newBase.toString().latin1()); 131 //qDebug("NEW BASE %s", newBase.toString().latin1());
130 mNavigatorView->setBaseDate( newBase ); 132 mNavigatorView->setBaseDate( newBase );
131 QDate last = lastAvailableDate(); 133 QDate last = lastAvailableDate();
132 QDate first = firstAvailableDate(); 134 QDate first = firstAvailableDate();
133 135
134 QDate selFirst = mFirstSelectedDate; 136 QDate selFirst = mFirstSelectedDate;
135 QDate selLast = selFirst.addDays( mSelectedDateCount-1 ); 137 QDate selLast = selFirst.addDays( mSelectedDateCount-1 );
136 if ( selFirst >= first && selLast <= last ) { 138 if ( selFirst >= first && selLast <= last ) {
137 setBaseDates(); 139 setBaseDates();
138 if ( forceEmit ) 140 if ( forceEmit )
139 updateDayMatrixDates(); 141 updateDayMatrixDates();
140 } 142 }
141 else { 143 else {
142 setBaseDates(); 144 setBaseDates();
143 if ( forceEmit ) 145 if ( forceEmit )
144 updateDayMatrixDates(); 146 updateDayMatrixDates();
145 if ( forceEmit ) 147 if ( forceEmit )
146 emit monthSelected( month ); 148 emit monthSelected( month );
147 } 149 }
148} 150}
149void DateNavigatorContainer::setCalendar( Calendar *cal ) 151void DateNavigatorContainer::setCalendar( Calendar *cal )
150{ 152{
151 mCalendar = cal; 153 mCalendar = cal;
152 mNavigatorView->setCalendar( cal ); 154 mNavigatorView->setCalendar( cal );
153 for( uint i = 0; i < mLastDisplayedDN; ++i ) { 155 for( uint i = 0; i < mLastDisplayedDN; ++i ) {
154 KDateNavigator *n = mExtraViews.at( i ); 156 KDateNavigator *n = mExtraViews.at( i );
155 n->setCalendar( cal ); 157 n->setCalendar( cal );
156 } 158 }
157} 159}
158void DateNavigatorContainer::checkUpdateDayMatrixDates() 160void DateNavigatorContainer::checkUpdateDayMatrixDates()
159{ 161{
160 //qDebug("KODNC: wid %d hei %d ", width(), height()); 162 //qDebug("KODNC: wid %d hei %d ", width(), height());
161 mUpdateTimer->stop(); 163 mUpdateTimer->stop();
162 //return; 164 //return;
163 if ( width() < 3 || height() < 3 ) 165 if ( width() < 3 || height() < 3 )
164 return; 166 return;
165 static int lastWid = 0; 167 static int lastWid = 0;
166 static int lastHei = 0; 168 static int lastHei = 0;
167 if ( lastWid == width() && height() == lastHei ) { 169 if ( lastWid == width() && height() == lastHei ) {
168 qDebug("KODNC: No layout computing needed. "); 170 qDebug("KODNC: No layout computing needed. ");
169 } else { 171 } else {
170 lastWid = width(); 172 lastWid = width();
171 lastHei = height(); 173 lastHei = height();
172 174
173 QSize minSize = mNavigatorView->yourSizeHint(); 175 QSize minSize = mNavigatorView->yourSizeHint();
174 176
175 int verticalCount = size().height() / minSize.height(); 177 int verticalCount = size().height() / minSize.height();
176 int horizontalCount = size().width() / minSize.width(); 178 int horizontalCount = size().width() / minSize.width();
177 //qDebug(" wattdatt %d new %d %d ", size().width() ,e->size().width() , minSize.width() ); 179 //qDebug(" wattdatt %d new %d %d ", size().width() ,e->size().width() , minSize.width() );
178 //qDebug("COUNT %d %d %d %d ", verticalCount, horizontalCount , mVerticalCount, mHorizontalCount ); 180 //qDebug("COUNT %d %d %d %d ", verticalCount, horizontalCount , mVerticalCount, mHorizontalCount );
179 bool fontchange = false; 181 bool fontchange = false;
180 if ( horizontalCount == 1) 182 if ( horizontalCount == 1)
181 horizontalCount = size().width() / mNavigatorView->yourFullSizeHint().width(); 183 horizontalCount = size().width() / mNavigatorView->yourFullSizeHint().width();
182 QFont fo; 184 QFont fo;
183 if ( horizontalCount != mHorizontalCount || 185 if ( horizontalCount != mHorizontalCount ||
184 verticalCount != mVerticalCount ) { 186 verticalCount != mVerticalCount ) {
185 uint count = horizontalCount * verticalCount; 187 uint count = horizontalCount * verticalCount;
186 if ( count == 0 ) { 188 if ( count == 0 ) {
187 bool ok; 189 bool ok;
188 fo = mNavigatorView->yourFontHint( size() , &ok ); 190 fo = mNavigatorView->yourFontHint( size() , &ok );
189 //mNavigatorView->resize( size() ); 191 //mNavigatorView->resize( size() );
190 //if ( ! ok ) 192 //if ( ! ok )
191 // return; 193 // return;
192 int butt = 2; 194 int butt = 2;
193 horizontalCount = size().width() / mNavigatorView->sizeHintTwoButtons( ).width(); 195 horizontalCount = size().width() / mNavigatorView->sizeHintTwoButtons( ).width();
194 if ( horizontalCount <= 1 ) 196 if ( horizontalCount <= 1 )
195 minSize = mNavigatorView->sizeHintTwoButtons( 4 ); 197 minSize = mNavigatorView->sizeHintTwoButtons( 4 );
196 else 198 else
197 minSize = mNavigatorView->sizeHintTwoButtons(); 199 minSize = mNavigatorView->sizeHintTwoButtons();
198 verticalCount = size().height() / minSize.height(); 200 verticalCount = size().height() / minSize.height();
199 horizontalCount = size().width() / minSize.width(); 201 horizontalCount = size().width() / minSize.width();
200 if ( horizontalCount == 0 ) 202 if ( horizontalCount == 0 )
201 horizontalCount = 1; 203 horizontalCount = 1;
202 if ( verticalCount == 0 ) 204 if ( verticalCount == 0 )
203 verticalCount = 1; 205 verticalCount = 1;
204 fontchange = true; 206 fontchange = true;
205 count = horizontalCount * verticalCount; 207 count = horizontalCount * verticalCount;
206 } else { 208 } else {
207 if ( mNavigatorView->fontChanged() ) { 209 if ( mNavigatorView->fontChanged() ) {
208 fontchange = true; 210 fontchange = true;
209 fo = KOPrefs::instance()->mDateNavigatorFont; 211 fo = KOPrefs::instance()->mDateNavigatorFont;
210 mNavigatorView->changeFont( fo ); 212 mNavigatorView->changeFont( fo );
211 mNavigatorView->unsetFontChanged(); 213 mNavigatorView->unsetFontChanged();
212 } 214 }
213 } 215 }
214 216
215 mLastDisplayedDN = horizontalCount*verticalCount-1; 217 mLastDisplayedDN = horizontalCount*verticalCount-1;
216 while ( count > ( mExtraViews.count() + 1 ) ) { 218 while ( count > ( mExtraViews.count() + 1 ) ) {
217 KDateNavigator *n = new KDateNavigator( this ); 219 KDateNavigator *n = new KDateNavigator( this );
218 n->setMonthSignalOffset ( mExtraViews.count()+1 ); 220 n->setMonthSignalOffset ( mExtraViews.count()+1 );
219 mExtraViews.append( n ); 221 mExtraViews.append( n );
220 n->setCalendar( mCalendar ); 222 n->setCalendar( mCalendar );
221 connectNavigatorView( n ); 223 connectNavigatorView( n );
222 // n->show(); 224 // n->show();
223 } 225 }
224 226
225 227
226 setBaseDates(); 228 setBaseDates();
227 if ( fontchange ) { 229 if ( fontchange ) {
228 //mNavigatorView->changeFont( fo ); 230 //mNavigatorView->changeFont( fo );
229 uint i; 231 uint i;
230 for( i = 0; i < mExtraViews.count(); ++i ) { 232 for( i = 0; i < mExtraViews.count(); ++i ) {
231 KDateNavigator *view = mExtraViews.at( i ); 233 KDateNavigator *view = mExtraViews.at( i );
232 view->changeFont( fo ); 234 view->changeFont( fo );
233 } 235 }
234 } 236 }
235 mHorizontalCount = horizontalCount; 237 mHorizontalCount = horizontalCount;
236 mVerticalCount = verticalCount; 238 mVerticalCount = verticalCount;
237 239
238 } 240 }
239 241
240 int theight = height() / mVerticalCount; 242 int theight = height() / mVerticalCount;
241 int twidth = width() / mHorizontalCount; 243 int twidth = width() / mHorizontalCount;
242 244
243 NavigatorBar *bar = mNavigatorView->navigatorBar(); 245 NavigatorBar *bar = mNavigatorView->navigatorBar();
244 if ( mHorizontalCount > 1 ) bar->showButtons( true, false ); 246 if ( mHorizontalCount > 1 ) bar->showButtons( true, false );
245 else bar->showButtons( true, true ); 247 else bar->showButtons( true, true );
246 248
247 mNavigatorView->setGeometry(0, 249 mNavigatorView->setGeometry(0,
248 0, twidth, theight ); 250 0, twidth, theight );
249 for( uint i = 0; i < mLastDisplayedDN; ++i ) { 251 for( uint i = 0; i < mLastDisplayedDN; ++i ) {
250 int x = ( i + 1 ) % mHorizontalCount; 252 int x = ( i + 1 ) % mHorizontalCount;
251 int y = ( i + 1 ) / mHorizontalCount; 253 int y = ( i + 1 ) / mHorizontalCount;
252 254
253 KDateNavigator *view = mExtraViews.at( i ); 255 KDateNavigator *view = mExtraViews.at( i );
254 bar = view->navigatorBar(); 256 bar = view->navigatorBar();
255 if ( y > 0 ) bar->showButtons( false, false ); 257 if ( y > 0 ) bar->showButtons( false, false );
256 else { 258 else {
257 if ( x + 1 == mHorizontalCount ) bar->showButtons( false, true ); 259 if ( x + 1 == mHorizontalCount ) bar->showButtons( false, true );
258 else bar->showButtons( false, false ); 260 else bar->showButtons( false, false );
259 } 261 }
260 view->setGeometry( x * twidth, 262 view->setGeometry( x * twidth,
261 y * theight, twidth, theight ); 263 y * theight, twidth, theight );
262 } 264 }
263 int iii = 0; 265 int iii = 0;
264 int ccc = mHorizontalCount * mVerticalCount; 266 int ccc = mHorizontalCount * mVerticalCount;
265 mNavigatorView->show(); 267 mNavigatorView->show();
diff --git a/korganizer/datenavigatorcontainer.h b/korganizer/datenavigatorcontainer.h
index ac9745d..87cc59f 100644
--- a/korganizer/datenavigatorcontainer.h
+++ b/korganizer/datenavigatorcontainer.h
@@ -1,108 +1,109 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 3
4 Copyright (c) 2004 Cornelius Schumacher <schumacher@kde.org> 4 Copyright (c) 2004 Cornelius Schumacher <schumacher@kde.org>
5 Copyright (C) 2004 Reinhold Kainhofer <reinhold@kainhofer.com> 5 Copyright (C) 2004 Reinhold Kainhofer <reinhold@kainhofer.com>
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#ifndef DATENAVIGATORCONTAINER_H 25#ifndef DATENAVIGATORCONTAINER_H
26#define DATENAVIGATORCONTAINER_H 26#define DATENAVIGATORCONTAINER_H
27 27
28class KDateNavigator; 28class KDateNavigator;
29 29
30#include <qwidget.h> 30#include <qwidget.h>
31#include <qtimer.h> 31#include <qtimer.h>
32#include <libkcal/calendar.h> 32#include <libkcal/calendar.h>
33using namespace KCal; 33using namespace KCal;
34 34
35class DateNavigatorContainer: public QWidget 35class DateNavigatorContainer: public QWidget
36{ 36{
37 Q_OBJECT 37 Q_OBJECT
38 public: 38 public:
39 DateNavigatorContainer( QWidget *parent = 0, const char *name = 0 ); 39 DateNavigatorContainer( QWidget *parent = 0, const char *name = 0 );
40 ~DateNavigatorContainer(); 40 ~DateNavigatorContainer();
41 41
42 /** 42 /**
43 Associate date navigator with a calendar. It is used by KODayMatrix. 43 Associate date navigator with a calendar. It is used by KODayMatrix.
44 */ 44 */
45 void setCalendar( Calendar * ); 45 void setCalendar( Calendar * );
46 46
47 QSize minimumSizeHint() const; 47 QSize minimumSizeHint() const;
48 QSize sizeHint() const; 48 QSize sizeHint() const;
49 KDateNavigator * navigatorView() { return mNavigatorView;} 49 KDateNavigator * navigatorView() { return mNavigatorView;}
50 QDate lastAvailableDate() const ; 50 QDate lastAvailableDate() const ;
51 QDate firstAvailableDate() const ; 51 QDate firstAvailableDate() const ;
52 52
53 public slots: 53 public slots:
54 void selectDates( const KCal::DateList & ); 54 void selectDates( const KCal::DateList & );
55 void updateView(); 55 void updateView();
56 void updateConfig(); 56 void updateConfig();
57 void updateDayMatrix(); 57 void updateDayMatrix();
58 void updateDayMatrixDates(); 58 void updateDayMatrixDates();
59 void checkUpdateDayMatrixDates(); 59 void checkUpdateDayMatrixDates();
60 void updateToday(); 60 void updateToday();
61 void slotMonthSelected( int month ); 61 void slotMonthSelected( int month );
62 void slotgoNextMonth(); 62 void slotgoNextMonth();
63 void slotgoPrevMonth(); 63 void slotgoPrevMonth();
64 void slotgoNextYear(); 64 void slotgoNextYear();
65 void slotgoPrevYear(); 65 void slotgoPrevYear();
66 void setResizeEnabled(); 66 void setResizeEnabled();
67 67
68 signals: 68 signals:
69 void datesSelected( const KCal::DateList & ); 69 void datesSelected( const KCal::DateList & );
70 void incidenceDropped( Incidence *, const QDate & ); 70 void incidenceDropped( Incidence *, const QDate & );
71 void incidenceDroppedMove( Incidence *, const QDate & ); 71 void incidenceDroppedMove( Incidence *, const QDate & );
72 void weekClicked( const QDate &); 72 void weekClicked( const QDate &);
73 73
74 void goPrevious(); 74 void goPrevious();
75 void goNext(); 75 void goNext();
76 76
77 void goNextMonth(); 77 void goNextMonth();
78 void goPrevMonth(); 78 void goPrevMonth();
79 void goNextYear(); 79 void goNextYear();
80 void goPrevYear(); 80 void goPrevYear();
81 void showMonth( const QDate & );
81 82
82 void monthSelected( int month ); 83 void monthSelected( int month );
83 84
84 protected: 85 protected:
85 void computeMonthSelected( int month , bool forceEmit ); 86 void computeMonthSelected( int month , bool forceEmit );
86 void jumpMonth( int month ); 87 void jumpMonth( int month );
87 void resizeEvent( QResizeEvent * ); 88 void resizeEvent( QResizeEvent * );
88 89
89 void setBaseDates(); 90 void setBaseDates();
90 void connectNavigatorView( KDateNavigator *v ); 91 void connectNavigatorView( KDateNavigator *v );
91 92
92 private: 93 private:
93 bool mResizeEnabled; 94 bool mResizeEnabled;
94 QTimer* mUpdateTimer; 95 QTimer* mUpdateTimer;
95 int mLastDisplayedDN; 96 int mLastDisplayedDN;
96 QDate mFirstSelectedDate; 97 QDate mFirstSelectedDate;
97 int mSelectedDateCount; 98 int mSelectedDateCount;
98 KDateNavigator *mNavigatorView; 99 KDateNavigator *mNavigatorView;
99 100
100 KCal::Calendar *mCalendar; 101 KCal::Calendar *mCalendar;
101 102
102 QPtrList<KDateNavigator> mExtraViews; 103 QPtrList<KDateNavigator> mExtraViews;
103 104
104 int mHorizontalCount; 105 int mHorizontalCount;
105 int mVerticalCount; 106 int mVerticalCount;
106}; 107};
107 108
108#endif 109#endif
diff --git a/korganizer/kdatenavigator.cpp b/korganizer/kdatenavigator.cpp
index 5eccfd6..38bddc2 100644
--- a/korganizer/kdatenavigator.cpp
+++ b/korganizer/kdatenavigator.cpp
@@ -258,210 +258,213 @@ void KDateNavigator::passedMidnight()
258 if (emitMonth) { emit monthPassed(today); } 258 if (emitMonth) { emit monthPassed(today); }
259} 259}
260 260
261/* slot */ void KDateNavigator::possiblyPastMidnight() 261/* slot */ void KDateNavigator::possiblyPastMidnight()
262{ 262{
263 if (lastDayChecked!=QDate::currentDate()) 263 if (lastDayChecked!=QDate::currentDate())
264 { 264 {
265 passedMidnight(); 265 passedMidnight();
266 lastDayChecked=QDate::currentDate(); 266 lastDayChecked=QDate::currentDate();
267 } 267 }
268 // Set the timer to go off 1 second after midnight 268 // Set the timer to go off 1 second after midnight
269 // or after 8 minutes, whichever comes first. 269 // or after 8 minutes, whichever comes first.
270 if (updateTimer) 270 if (updateTimer)
271 { 271 {
272 QTime now = QTime::currentTime(); 272 QTime now = QTime::currentTime();
273 QTime midnight = QTime(23,59,59); 273 QTime midnight = QTime(23,59,59);
274 int msecsWait = QMIN(480000,now.msecsTo(midnight)+2000); 274 int msecsWait = QMIN(480000,now.msecsTo(midnight)+2000);
275 275
276 // qDebug(QString("Waiting %1 msec from %2 to %3.").arg(msecsWait)) 276 // qDebug(QString("Waiting %1 msec from %2 to %3.").arg(msecsWait))
277 //.arg(now.toString()).arg(midnight.toString())); 277 //.arg(now.toString()).arg(midnight.toString()));
278 278
279 updateTimer->stop(); 279 updateTimer->stop();
280 updateTimer->start(msecsWait,true); 280 updateTimer->start(msecsWait,true);
281 } 281 }
282} 282}
283 283
284void KDateNavigator::updateDates() 284void KDateNavigator::updateDates()
285{ 285{
286 // Find the first day of the week of the current month. 286 // Find the first day of the week of the current month.
287 //int d1 = KOGlobals::self()->calendarSystem()->day( m_MthYr ); 287 //int d1 = KOGlobals::self()->calendarSystem()->day( m_MthYr );
288 QDate dayone( m_MthYr.year(), m_MthYr.month(), m_MthYr.day() ); 288 QDate dayone( m_MthYr.year(), m_MthYr.month(), m_MthYr.day() );
289 int d2 = KOGlobals::self()->calendarSystem()->day( dayone ); 289 int d2 = KOGlobals::self()->calendarSystem()->day( dayone );
290 //int di = d1 - d2 + 1; 290 //int di = d1 - d2 + 1;
291 dayone = dayone.addDays( -d2 + 1 ); 291 dayone = dayone.addDays( -d2 + 1 );
292 292
293 int m_fstDayOfWkCalsys = KOGlobals::self()->calendarSystem()->dayOfWeek( dayone ); 293 int m_fstDayOfWkCalsys = KOGlobals::self()->calendarSystem()->dayOfWeek( dayone );
294 294
295 // If month begins on Monday and Monday is first day of week, 295 // If month begins on Monday and Monday is first day of week,
296 // month should begin on second line. Sunday doesn't have this problem. 296 // month should begin on second line. Sunday doesn't have this problem.
297 int nextLine = ( ( m_fstDayOfWkCalsys == 1) && 297 int nextLine = ( ( m_fstDayOfWkCalsys == 1) &&
298 ( KGlobal::locale()->weekStartsMonday() == 1 ) ) ? 7 : 0; 298 ( KGlobal::locale()->weekStartsMonday() == 1 ) ) ? 7 : 0;
299 299
300 // update the matrix dates 300 // update the matrix dates
301 int index = (KGlobal::locale()->weekStartsMonday() ? 1 : 0) - m_fstDayOfWkCalsys - nextLine; 301 int index = (KGlobal::locale()->weekStartsMonday() ? 1 : 0) - m_fstDayOfWkCalsys - nextLine;
302 302
303 303
304 daymatrix->updateView(dayone.addDays(index)); 304 daymatrix->updateView(dayone.addDays(index));
305//each updateDates is followed by an updateView -> repaint is issued there ! 305//each updateDates is followed by an updateView -> repaint is issued there !
306// daymatrix->repaint(); 306// daymatrix->repaint();
307} 307}
308 308
309void KDateNavigator::updateDayMatrix() 309void KDateNavigator::updateDayMatrix()
310{ 310{
311 daymatrix->updateView(); 311 daymatrix->updateView();
312 //daymatrix->repaint(); 312 //daymatrix->repaint();
313} 313}
314 314
315 315
316void KDateNavigator::updateView() 316void KDateNavigator::updateView()
317{ 317{
318 318
319 setUpdatesEnabled( false ); 319 setUpdatesEnabled( false );
320 320
321 int i; 321 int i;
322 322
323// kdDebug() << "updateView() -> daymatrix->updateView()" << endl; 323// kdDebug() << "updateView() -> daymatrix->updateView()" << endl;
324 daymatrix->updateView(); 324 daymatrix->updateView();
325 325
326 // set the week numbers. 326 // set the week numbers.
327 for(i = 0; i < 6; i++) { 327 for(i = 0; i < 6; i++) {
328 QString weeknum; 328 QString weeknum;
329 // remember, according to ISO 8601, the first week of the year is the 329 // remember, according to ISO 8601, the first week of the year is the
330 // first week that contains a thursday. Thus we must subtract off 4, 330 // first week that contains a thursday. Thus we must subtract off 4,
331 // not just 1. 331 // not just 1.
332 332
333 //ET int dayOfYear = buttons[(i + 1) * 7 - 4]->date().dayOfYear(); 333 //ET int dayOfYear = buttons[(i + 1) * 7 - 4]->date().dayOfYear();
334 int dayOfYear = KOGlobals::self()->calendarSystem()->dayOfYear((daymatrix->getDate((i+1)*7-4))); 334 int dayOfYear = KOGlobals::self()->calendarSystem()->dayOfYear((daymatrix->getDate((i+1)*7-4)));
335 335
336 int add = 0; 336 int add = 0;
337 if ( ! KGlobal::locale()->weekStartsMonday() ) 337 if ( ! KGlobal::locale()->weekStartsMonday() )
338 ++add; 338 ++add;
339 if (dayOfYear % 7 != 0) 339 if (dayOfYear % 7 != 0)
340 weeknum.setNum(dayOfYear / 7 + 1+add); 340 weeknum.setNum(dayOfYear / 7 + 1+add);
341 else 341 else
342 weeknum.setNum(dayOfYear / 7 +add); 342 weeknum.setNum(dayOfYear / 7 +add);
343 weeknos[i]->setText(weeknum); 343 weeknos[i]->setText(weeknum);
344 } 344 }
345 345
346 setUpdatesEnabled( true ); 346 setUpdatesEnabled( true );
347// kdDebug() << "updateView() -> repaint()" << endl; 347// kdDebug() << "updateView() -> repaint()" << endl;
348 repaint(); 348 repaint();
349 // daymatrix->repaint(); 349 // daymatrix->repaint();
350} 350}
351 351
352void KDateNavigator::updateConfig() 352void KDateNavigator::updateConfig()
353{ 353{
354 int day; 354 int day;
355 for(int i=0; i<7; i++) { 355 for(int i=0; i<7; i++) {
356 // take the first letter of the day name to be the abbreviation 356 // take the first letter of the day name to be the abbreviation
357 if (KGlobal::locale()->weekStartsMonday()) { 357 if (KGlobal::locale()->weekStartsMonday()) {
358 day = i+1; 358 day = i+1;
359 } else { 359 } else {
360 if (i==0) day = 7; 360 if (i==0) day = 7;
361 else day = i; 361 else day = i;
362 } 362 }
363 QString dayName = KOGlobals::self()->calendarSystem()->weekDayName( day, 363 QString dayName = KOGlobals::self()->calendarSystem()->weekDayName( day,
364 true ); 364 true );
365 if ( KOPrefs::instance()->mCompactDialogs ) dayName = dayName.left( 1 ); 365 if ( KOPrefs::instance()->mCompactDialogs ) dayName = dayName.left( 1 );
366 headings[i]->setText( dayName ); 366 headings[i]->setText( dayName );
367 } 367 }
368 updateDates(); 368 updateDates();
369 updateView(); 369 updateView();
370} 370}
371 371
372void KDateNavigator::setShowWeekNums(bool enabled) 372void KDateNavigator::setShowWeekNums(bool enabled)
373{ 373{
374 qDebug("KDateNavigator::setShowWeekNums***************************** "); 374 qDebug("KDateNavigator::setShowWeekNums***************************** ");
375 m_bShowWeekNums = enabled; 375 m_bShowWeekNums = enabled;
376 for(int i=0; i<6; i++) { 376 for(int i=0; i<6; i++) {
377 if(enabled) 377 if(enabled)
378 weeknos[i]->show(); 378 weeknos[i]->show();
379 else 379 else
380 weeknos[i]->hide(); 380 weeknos[i]->hide();
381 } 381 }
382 resize(size()); 382 resize(size());
383} 383}
384 384
385void KDateNavigator::selectDates(const DateList& dateList) 385void KDateNavigator::selectDates(const DateList& dateList)
386{ 386{
387 387
388 if (dateList.count() > 0) { 388 if (dateList.count() > 0) {
389 mNavigatorBar->selectDates( dateList ); 389 mNavigatorBar->selectDates( dateList );
390 mSelectedDates = dateList; 390 mSelectedDates = dateList;
391 391
392 // set our record of the month and year that this datetbl is 392 // set our record of the month and year that this datetbl is
393 // displaying. 393 // displaying.
394 m_MthYr = mSelectedDates.first(); 394 m_MthYr = mSelectedDates.first();
395 395
396 396
397 // set our record of the first day of the week of the current 397 // set our record of the first day of the week of the current
398 // month. This needs to be done before calling dayToIndex, since it 398 // month. This needs to be done before calling dayToIndex, since it
399 // relies on this information being up to date. 399 // relies on this information being up to date.
400 QDate dayone(m_MthYr.year(), m_MthYr.month(), 1); 400 QDate dayone(m_MthYr.year(), m_MthYr.month(), 1);
401 m_fstDayOfWk = dayone.dayOfWeek(); 401 m_fstDayOfWk = dayone.dayOfWeek();
402 402
403 updateDates(); 403 updateDates();
404 404
405 daymatrix->setSelectedDaysFrom(*(dateList.begin()), *(--dateList.end())); 405 daymatrix->setSelectedDaysFrom(*(dateList.begin()), *(--dateList.end()));
406 406
407 updateView(); 407 updateView();
408 } 408 }
409} 409}
410 410
411int KDateNavigator::dayNum(int row, int col) 411int KDateNavigator::dayNum(int row, int col)
412{ 412{
413 return 7 * (row - 1) + (col + 1) - m_fstDayOfWk; 413 return 7 * (row - 1) + (col + 1) - m_fstDayOfWk;
414} 414}
415 415
416int KDateNavigator::dayToIndex(int dayNum) 416int KDateNavigator::dayToIndex(int dayNum)
417{ 417{
418 int row, col; 418 int row, col;
419 419
420 row = (dayNum+m_fstDayOfWk-1-(KGlobal::locale()->weekStartsMonday() ? 1 : 0)) / 7; 420 row = (dayNum+m_fstDayOfWk-1-(KGlobal::locale()->weekStartsMonday() ? 1 : 0)) / 7;
421 if (KGlobal::locale()->weekStartsMonday() && (m_fstDayOfWk == 1)) 421 if (KGlobal::locale()->weekStartsMonday() && (m_fstDayOfWk == 1))
422 row++; 422 row++;
423 col = (dayNum+m_fstDayOfWk-1-(KGlobal::locale()->weekStartsMonday() ? 1 : 0)) % 7; 423 col = (dayNum+m_fstDayOfWk-1-(KGlobal::locale()->weekStartsMonday() ? 1 : 0)) % 7;
424 return row * 7 + col; 424 return row * 7 + col;
425} 425}
426 426
427void KDateNavigator::wheelEvent (QWheelEvent *e) 427void KDateNavigator::wheelEvent (QWheelEvent *e)
428{ 428{
429 if(e->delta()>0) emit goPrevious(); 429 if(e->delta()>0) emit goPrevious();
430 else emit goNext(); 430 else emit goNext();
431 431
432 e->accept(); 432 e->accept();
433} 433}
434 434
435bool KDateNavigator::eventFilter (QObject *o,QEvent *e) 435bool KDateNavigator::eventFilter (QObject *o,QEvent *e)
436{ 436{
437 if (e->type() == QEvent::MouseButtonPress) { 437 if (e->type() == QEvent::MouseButtonPress) {
438 int i; 438 int i;
439 for(i=0;i<6;++i) { 439 for(i=0;i<6;++i) {
440 if (o == weeknos[i]) { 440 if (o == weeknos[i]) {
441 QDate weekstart = daymatrix->getDate(i*7); 441 QDate weekstart = daymatrix->getDate(i*7);
442 emit weekClicked(weekstart); 442 emit weekClicked(weekstart);
443 break; 443 break;
444 } 444 }
445 } 445 }
446 for(i=0;i<7;++i) { 446 for(i=0;i<7;++i) {
447 if (o == headings[i]) { 447 if (o == headings[i]) {
448 KCal::DateList selDays; 448 KCal::DateList selDays;
449 QDate date = daymatrix->getDate(14); 449 QDate date = daymatrix->getDate(14);
450 emit showMonth(date );
451#if 0
450 int dio = date.daysInMonth(); 452 int dio = date.daysInMonth();
451 int j; 453 int j;
452 int ye = date.year(); 454 int ye = date.year();
453 int mo = date.month(); 455 int mo = date.month();
454 for ( j = 1; j <= dio; ++j ) { 456 for ( j = 1; j <= dio; ++j ) {
455 selDays.append( QDate( ye, mo, j ) ); 457 selDays.append( QDate( ye, mo, j ) );
456 } 458 }
457 emit datesSelected( selDays ); 459 emit datesSelected( selDays );
460#endif
458 break; 461 break;
459 } 462 }
460 } 463 }
461 return true; 464 return true;
462 } else { 465 } else {
463 return false; 466 return false;
464 } 467 }
465} 468}
466 469
467//#include "kdatenavigator.moc" 470//#include "kdatenavigator.moc"
diff --git a/korganizer/kdatenavigator.h b/korganizer/kdatenavigator.h
index 93bbceb..780ebb8 100644
--- a/korganizer/kdatenavigator.h
+++ b/korganizer/kdatenavigator.h
@@ -1,166 +1,167 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23#ifndef KDATENAVIGATOR_H 23#ifndef KDATENAVIGATOR_H
24#define KDATENAVIGATOR_H 24#define KDATENAVIGATOR_H
25 25
26#include <qframe.h> 26#include <qframe.h>
27#include <qdatetime.h> 27#include <qdatetime.h>
28#include <qlabel.h> 28#include <qlabel.h>
29 29
30#include <libkcal/calendar.h> 30#include <libkcal/calendar.h>
31 31
32#include "kodaymatrix.h" 32#include "kodaymatrix.h"
33 33
34class QPushButton; 34class QPushButton;
35class QTimer; 35class QTimer;
36 36
37class KCalendarSystem; 37class KCalendarSystem;
38 38
39class NavigatorBar; 39class NavigatorBar;
40 40
41class KDateNavigator: public QFrame 41class KDateNavigator: public QFrame
42{ 42{
43 Q_OBJECT 43 Q_OBJECT
44 public: 44 public:
45 KDateNavigator( QWidget *parent = 0,const char *name = 0 ); 45 KDateNavigator( QWidget *parent = 0,const char *name = 0 );
46 ~KDateNavigator(); 46 ~KDateNavigator();
47 47
48 /** The DateNavigator automatically checks for 48 /** The DateNavigator automatically checks for
49 * the passage of midnight. If rollover type is 49 * the passage of midnight. If rollover type is
50 * set to None, no signals are emitted and no 50 * set to None, no signals are emitted and no
51 * processing is done. With rollover set to 51 * processing is done. With rollover set to
52 * FollowDay, the day highlighter changes at 52 * FollowDay, the day highlighter changes at
53 * midnight and dayPassed() is emitted. 53 * midnight and dayPassed() is emitted.
54 * With FollowMonth, it has the same effect 54 * With FollowMonth, it has the same effect
55 * as FollowDay but also adjusts the month that is 55 * as FollowDay but also adjusts the month that is
56 * visible and emits monthPassed() when the month changes. 56 * visible and emits monthPassed() when the month changes.
57 */ 57 */
58 enum RolloverType { None, FollowDay, FollowMonth } ; 58 enum RolloverType { None, FollowDay, FollowMonth } ;
59 void enableRollover( RolloverType ); 59 void enableRollover( RolloverType );
60 60
61 void setShowWeekNums( bool enabled ); 61 void setShowWeekNums( bool enabled );
62 void setCalendar( Calendar * ); 62 void setCalendar( Calendar * );
63 void setBaseDate( const QDate & , bool doRepaint = true ); 63 void setBaseDate( const QDate & , bool doRepaint = true );
64 64
65 QDate baseDate() const { return m_MthYr;} 65 QDate baseDate() const { return m_MthYr;}
66 66
67 KCal::DateList selectedDates() const { return mSelectedDates; } 67 KCal::DateList selectedDates() const { return mSelectedDates; }
68 NavigatorBar *navigatorBar() const { return mNavigatorBar; } 68 NavigatorBar *navigatorBar() const { return mNavigatorBar; }
69 void setMonthSignalOffset ( int off ) { mMonthSignalOffset = off%12;} 69 void setMonthSignalOffset ( int off ) { mMonthSignalOffset = off%12;}
70 QSize yourSizeHint()const { return mySizeHint; }; 70 QSize yourSizeHint()const { return mySizeHint; };
71 QSize yourFullSizeHint() const { return myFullSizeHint;}; 71 QSize yourFullSizeHint() const { return myFullSizeHint;};
72 QFont yourFontHint( QSize , bool * b); 72 QFont yourFontHint( QSize , bool * b);
73 bool fontChanged() {return mFontChanged; } 73 bool fontChanged() {return mFontChanged; }
74 void unsetFontChanged() { mFontChanged = false; } 74 void unsetFontChanged() { mFontChanged = false; }
75 KODayMatrix *dayMatrix() { return daymatrix ;} 75 KODayMatrix *dayMatrix() { return daymatrix ;}
76 QSize sizeHint() const; 76 QSize sizeHint() const;
77 QSize sizeHintTwoButtons( int butnum = 2 ) const; 77 QSize sizeHintTwoButtons( int butnum = 2 ) const;
78 void changeFont ( QFont fo ); 78 void changeFont ( QFont fo );
79 public slots: 79 public slots:
80 void selectDates( const KCal::DateList & ); 80 void selectDates( const KCal::DateList & );
81 void updateView(); 81 void updateView();
82 void updateConfig(); 82 void updateConfig();
83 void updateDayMatrix(); 83 void updateDayMatrix();
84 84
85 signals: 85 signals:
86 void datesSelected( const KCal::DateList & ); 86 void datesSelected( const KCal::DateList & );
87 void eventDropped( Event * ); 87 void eventDropped( Event * );
88 void weekClicked( const QDate &); 88 void weekClicked( const QDate &);
89 void showMonth( const QDate & );
89 90
90 void goPrevious(); 91 void goPrevious();
91 void goNext(); 92 void goNext();
92 93
93 void goNextMonth(); 94 void goNextMonth();
94 void goPrevMonth(); 95 void goPrevMonth();
95 void goNextYear(); 96 void goNextYear();
96 void goPrevYear(); 97 void goPrevYear();
97 void monthSelected( int ); 98 void monthSelected( int );
98 99
99 // Signals emitted at midnight carrying the new date. 100 // Signals emitted at midnight carrying the new date.
100 void dayPassed( QDate ); 101 void dayPassed( QDate );
101 void monthPassed( QDate ); 102 void monthPassed( QDate );
102 103
103 protected slots: 104 protected slots:
104 105
105 /** 106 /**
106 * Called regularly to see if we need to update the view 107 * Called regularly to see if we need to update the view
107 * wrt. the today box and the month box. Only important 108 * wrt. the today box and the month box. Only important
108 * if you leave KOrganizer idle for long periods of time. 109 * if you leave KOrganizer idle for long periods of time.
109 * 110 *
110 * Until we have a reliable way of setting QTimers to go 111 * Until we have a reliable way of setting QTimers to go
111 * off at a particular wall-clock time, we need this, 112 * off at a particular wall-clock time, we need this,
112 * which calls passedMidnight() at the right moments. 113 * which calls passedMidnight() at the right moments.
113 */ 114 */
114 void possiblyPastMidnight(); 115 void possiblyPastMidnight();
115 116
116 /** handles updating the view when midnight has come by due to idle time. 117 /** handles updating the view when midnight has come by due to idle time.
117 * 118 *
118 */ 119 */
119 void passedMidnight(); 120 void passedMidnight();
120 void slotMonthSelected( int m ); 121 void slotMonthSelected( int m );
121 protected: 122 protected:
122 void updateDates(); 123 void updateDates();
123 124
124 void wheelEvent (QWheelEvent *); 125 void wheelEvent (QWheelEvent *);
125 126
126 bool eventFilter (QObject *,QEvent *); 127 bool eventFilter (QObject *,QEvent *);
127 128
128 private: 129 private:
129 QSize mySizeHint; 130 QSize mySizeHint;
130 QSize myFullSizeHint; 131 QSize myFullSizeHint;
131 bool mFontChanged; 132 bool mFontChanged;
132 int mMonthSignalOffset; 133 int mMonthSignalOffset;
133 NavigatorBar *mNavigatorBar; 134 NavigatorBar *mNavigatorBar;
134 135
135 QFrame *headingSep; 136 QFrame *headingSep;
136 QFrame *weeknumSep; 137 QFrame *weeknumSep;
137 QLabel *headings[7]; 138 QLabel *headings[7];
138 QLabel *weeknos[7]; 139 QLabel *weeknos[7];
139 KODayMatrix *daymatrix; 140 KODayMatrix *daymatrix;
140 141
141 KCal::DateList mSelectedDates; 142 KCal::DateList mSelectedDates;
142 QDate m_MthYr; 143 QDate m_MthYr;
143 int m_fstDayOfWk; 144 int m_fstDayOfWk;
144 bool m_bShowWeekNums; 145 bool m_bShowWeekNums;
145 146
146 int dayNum(int row, int col); 147 int dayNum(int row, int col);
147 int dayToIndex(int dayNum); 148 int dayToIndex(int dayNum);
148 149
149 Calendar *mCalendar; 150 Calendar *mCalendar;
150 KCalendarSystem *mCalendarSystem; 151 KCalendarSystem *mCalendarSystem;
151 152
152 const QString *curHeaders; 153 const QString *curHeaders;
153 154
154 /** used to update the day view periodically, in particular every 155 /** used to update the day view periodically, in particular every
155 * midnight to move the "today" rectangle. 156 * midnight to move the "today" rectangle.
156 */ 157 */
157 QTimer *updateTimer; 158 QTimer *updateTimer;
158 QDate lastDayChecked; 159 QDate lastDayChecked;
159 RolloverType updateRollover; 160 RolloverType updateRollover;
160 161
161 // Disabling copy constructor and assignment operator 162 // Disabling copy constructor and assignment operator
162 KDateNavigator(const KDateNavigator & ); 163 KDateNavigator(const KDateNavigator & );
163 KDateNavigator &operator=(const KDateNavigator &); 164 KDateNavigator &operator=(const KDateNavigator &);
164}; 165};
165 166
166#endif 167#endif
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index c6e76c4..5a2dce3 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -1,324 +1,325 @@
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 <qdatetime.h> 35#include <qdatetime.h>
36#include "calendarview.h" 36#include "calendarview.h"
37#include "datenavigator.h" 37#include "datenavigator.h"
38#include "kotodoview.h" 38#include "kotodoview.h"
39#include "koagendaview.h" 39#include "koagendaview.h"
40#include "kodialogmanager.h" 40#include "kodialogmanager.h"
41#include "komonthview.h" 41#include "komonthview.h"
42#include "kolistview.h" 42#include "kolistview.h"
43#include "kowhatsnextview.h" 43#include "kowhatsnextview.h"
44#include "kojournalview.h" 44#include "kojournalview.h"
45#include "kotimespanview.h" 45#include "kotimespanview.h"
46#include "koprefs.h" 46#include "koprefs.h"
47#include "navigatorbar.h" 47#include "navigatorbar.h"
48#include "kdatenavigator.h" 48#include "kdatenavigator.h"
49 49
50#include "koviewmanager.h" 50#include "koviewmanager.h"
51//extern bool externFlagMonthviewBlockPainting; 51//extern bool externFlagMonthviewBlockPainting;
52 52
53//bool globalFlagBlockPainting = false; 53//bool globalFlagBlockPainting = false;
54int globalFlagBlockAgenda = 0; 54int globalFlagBlockAgenda = 0;
55int globalFlagBlockLabel = 0; 55int globalFlagBlockLabel = 0;
56int globalFlagBlockAgendaItemPaint = 1; 56int globalFlagBlockAgendaItemPaint = 1;
57int globalFlagBlockAgendaItemUpdate = 1; 57int globalFlagBlockAgendaItemUpdate = 1;
58 58
59 59
60KOViewManager::KOViewManager( CalendarView *mainView ) : 60KOViewManager::KOViewManager( CalendarView *mainView ) :
61 QObject(), mMainView( mainView ) 61 QObject(), mMainView( mainView )
62{ 62{
63 mCurrentView = 0; 63 mCurrentView = 0;
64 64
65 mWhatsNextView = 0; 65 mWhatsNextView = 0;
66 mTodoView = 0; 66 mTodoView = 0;
67 mAgendaView = 0; 67 mAgendaView = 0;
68 mMonthView = 0; 68 mMonthView = 0;
69 mListView = 0; 69 mListView = 0;
70 mJournalView = 0; 70 mJournalView = 0;
71 mTimeSpanView = 0; 71 mTimeSpanView = 0;
72 mCurrentAgendaView = 0 ; 72 mCurrentAgendaView = 0 ;
73 mFlagShowNextxDays = false; 73 mFlagShowNextxDays = false;
74} 74}
75 75
76KOViewManager::~KOViewManager() 76KOViewManager::~KOViewManager()
77{ 77{
78} 78}
79 79
80 80
81KOrg::BaseView *KOViewManager::currentView() 81KOrg::BaseView *KOViewManager::currentView()
82{ 82{
83 return mCurrentView; 83 return mCurrentView;
84} 84}
85 85
86void KOViewManager::readSettings(KConfig *config) 86void KOViewManager::readSettings(KConfig *config)
87{ 87{
88 config->setGroup("General"); 88 config->setGroup("General");
89 QString view = config->readEntry("Current View"); 89 QString view = config->readEntry("Current View");
90 if (view == "WhatsNext") showWhatsNextView(); 90 if (view == "WhatsNext") showWhatsNextView();
91 else if (view == "Month") { 91 else if (view == "Month") {
92 if ( !KOPrefs::instance()->mMonthViewWeek ) 92 if ( !KOPrefs::instance()->mMonthViewWeek )
93 showMonthView(); 93 showMonthView();
94 else 94 else
95 showMonthViewWeek(); 95 showMonthViewWeek();
96 } 96 }
97 else if (view == "List") showListView(); 97 else if (view == "List") showListView();
98 else if (view == "Journal") showJournalView(); 98 else if (view == "Journal") showJournalView();
99 else if (view == "TimeSpan") showTimeSpanView(); 99 else if (view == "TimeSpan") showTimeSpanView();
100 else if (view == "Todo") showTodoView(); 100 else if (view == "Todo") showTodoView();
101 else { 101 else {
102 config->setGroup( "Views" ); 102 config->setGroup( "Views" );
103 int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); 103 int dateCount = config->readNumEntry( "ShownDatesCount", 7 );
104 mCurrentAgendaView = dateCount; 104 mCurrentAgendaView = dateCount;
105 showAgendaView(); 105 showAgendaView();
106 mCurrentAgendaView = dateCount; 106 mCurrentAgendaView = dateCount;
107#ifdef DESKTOP_VERSION 107#ifdef DESKTOP_VERSION
108 QTimer::singleShot( 1000, mAgendaView, SLOT ( setInitStartHour() ) ); 108 QTimer::singleShot( 1000, mAgendaView, SLOT ( setInitStartHour() ) );
109#endif 109#endif
110 } 110 }
111} 111}
112 112
113void KOViewManager::showDateView( int view, QDate date) 113void KOViewManager::showDateView( int view, QDate date)
114{ 114{
115 static int lastMode = 0; 115 static int lastMode = 0;
116 static int lastCount = 0; 116 static int lastCount = 0;
117 static bool lastNDMode = false; 117 static bool lastNDMode = false;
118 static QDate lastDate; 118 static QDate lastDate;
119 //qDebug("date %d %s", view, date.toString().latin1()); 119 //qDebug("date %d %s", view, date.toString().latin1());
120 120
121 if (view != 9) 121 if (view != 9)
122 lastMode = 0; 122 lastMode = 0;
123 //qDebug("%d %d ", lastNDMode, mFlagShowNextxDays ); 123 //qDebug("%d %d ", lastNDMode, mFlagShowNextxDays );
124 bool savemFlagShowNextxDays = mFlagShowNextxDays; 124 bool savemFlagShowNextxDays = mFlagShowNextxDays;
125 mFlagShowNextxDays = false; 125 mFlagShowNextxDays = false;
126 if ( view == 3 ) { 126 if ( view == 3 ) {
127 //mCurrentAgendaView = 1 ; 127 //mCurrentAgendaView = 1 ;
128 lastDate = mMainView->dateNavigator()->selectedDates().first(); 128 lastDate = mMainView->dateNavigator()->selectedDates().first();
129 lastCount = mMainView->dateNavigator()->selectedDates().count(); 129 lastCount = mMainView->dateNavigator()->selectedDates().count();
130 lastNDMode = savemFlagShowNextxDays; 130 lastNDMode = savemFlagShowNextxDays;
131 mMainView->showDay( date ); 131 mMainView->dateNavigator()->selectDate( date );
132 lastMode = 1; 132 lastMode = 1;
133 mCurrentAgendaView = 1 ;
133 } else if (view == 4 ) { 134 } else if (view == 4 ) {
134 mCurrentAgendaView = 7 ; 135 mCurrentAgendaView = 7 ;
135 mMainView->dateNavigator()->selectDates( date, 7 ); 136 mMainView->dateNavigator()->selectDates( date, 7 );
136 } else if (view == 5 ) { 137 } else if (view == 5 ) {
137 mCurrentAgendaView = 14 ; 138 mCurrentAgendaView = 14 ;
138 mMainView->dateNavigator()->selectDates( date, 14); 139 mMainView->dateNavigator()->selectDates( date, 14);
139 } else if (view == 6 ) { 140 } else if (view == 6 ) {
140 //mMainView->dateNavigator()->selectDates( date, 7 ); 141 //mMainView->dateNavigator()->selectDates( date, 7 );
141 showMonthView(); 142 showMonthView();
142 } else if (view == 7 ) { 143 } else if (view == 7 ) {
143 mMainView->dateNavigator()->selectDate( date ); 144 mMainView->dateNavigator()->selectDate( date );
144 showJournalView(); 145 showJournalView();
145 } else if (view == 8 ) { 146 } else if (view == 8 ) {
146 globalFlagBlockAgenda = 1; 147 globalFlagBlockAgenda = 1;
147 if ( mCurrentAgendaView != 3 ) 148 if ( mCurrentAgendaView != 3 )
148 mCurrentAgendaView = -1; 149 mCurrentAgendaView = -1;
149 showAgendaView(KOPrefs::instance()->mFullViewMonth); 150 showAgendaView(KOPrefs::instance()->mFullViewMonth);
150 globalFlagBlockAgenda = 2; 151 globalFlagBlockAgenda = 2;
151 mMainView->dateNavigator()->selectDates( date , 152 mMainView->dateNavigator()->selectDates( date ,
152 KOPrefs::instance()->mNextXDays ); 153 KOPrefs::instance()->mNextXDays );
153 mFlagShowNextxDays = true; 154 mFlagShowNextxDays = true;
154 mCurrentAgendaView = 3 ; 155 mCurrentAgendaView = 3 ;
155 } if (view == 9) { // return behaviour, for getting back from mode == 3 (single day mode ) 156 } if (view == 9) { // return behaviour, for getting back from mode == 3 (single day mode )
156 if ( lastMode ) { 157 if ( lastMode ) {
157 mCurrentAgendaView = lastCount ; 158 mCurrentAgendaView = lastCount ;
158 mMainView->dateNavigator()->selectDates( lastDate, lastCount); 159 mMainView->dateNavigator()->selectDates( lastDate, lastCount);
159 mFlagShowNextxDays = lastNDMode; 160 mFlagShowNextxDays = lastNDMode;
160 if ( mFlagShowNextxDays ) { 161 if ( mFlagShowNextxDays ) {
161 mCurrentAgendaView = 3 ; 162 mCurrentAgendaView = 3 ;
162 } 163 }
163 } else 164 } else
164 showWeekView(); 165 showWeekView();
165 } else if (view == 10) { 166 } else if (view == 10) {
166 mMainView->dateNavigator()->selectDates( date,mMainView->dateNavigator()->selectedDates().count() ); 167 mMainView->dateNavigator()->selectDates( date,mMainView->dateNavigator()->selectedDates().count() );
167 } 168 }
168} 169}
169 170
170 171
171 172
172void KOViewManager::writeSettings(KConfig *config) 173void KOViewManager::writeSettings(KConfig *config)
173{ 174{
174 config->setGroup("General"); 175 config->setGroup("General");
175 176
176 QString view; 177 QString view;
177 if (mCurrentView == mWhatsNextView) view = "WhatsNext"; 178 if (mCurrentView == mWhatsNextView) view = "WhatsNext";
178 else if (mCurrentView == mMonthView) view = "Month"; 179 else if (mCurrentView == mMonthView) view = "Month";
179 else if (mCurrentView == mListView) view = "List"; 180 else if (mCurrentView == mListView) view = "List";
180 else if (mCurrentView == mJournalView) view = "Journal"; 181 else if (mCurrentView == mJournalView) view = "Journal";
181 else if (mCurrentView == mTimeSpanView) view = "TimeSpan"; 182 else if (mCurrentView == mTimeSpanView) view = "TimeSpan";
182 else if (mCurrentView == mTodoView) view = "Todo"; 183 else if (mCurrentView == mTodoView) view = "Todo";
183 else view = "Agenda"; 184 else view = "Agenda";
184 185
185 config->writeEntry("Current View",view); 186 config->writeEntry("Current View",view);
186 187
187 if (mAgendaView) { 188 if (mAgendaView) {
188 mAgendaView->writeSettings(config); 189 mAgendaView->writeSettings(config);
189 } 190 }
190 if (mTimeSpanView) { 191 if (mTimeSpanView) {
191 mTimeSpanView->writeSettings(config); 192 mTimeSpanView->writeSettings(config);
192 } 193 }
193 if (mListView) { 194 if (mListView) {
194 mListView->writeSettings(config); 195 mListView->writeSettings(config);
195 } 196 }
196 if (mTodoView) { 197 if (mTodoView) {
197 mTodoView->saveLayout(config,"Todo View"); 198 mTodoView->saveLayout(config,"Todo View");
198 } 199 }
199} 200}
200 201
201void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) 202void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen )
202{ 203{
203 204
204 //mFlagShowNextxDays = false; 205 //mFlagShowNextxDays = false;
205 //if(view == mCurrentView) return; 206 //if(view == mCurrentView) return;
206 if ( view == 0 ) { 207 if ( view == 0 ) {
207 view = mCurrentView; 208 view = mCurrentView;
208 if ( view == 0 ) 209 if ( view == 0 )
209 return; 210 return;
210 } 211 }
211 bool callupdate = !(view == mCurrentView); 212 bool callupdate = !(view == mCurrentView);
212 bool full = fullScreen; 213 bool full = fullScreen;
213 if(view == mCurrentView && view != mWhatsNextView ) { 214 if(view == mCurrentView && view != mWhatsNextView ) {
214 if ( mCurrentAgendaView < 0 ) 215 if ( mCurrentAgendaView < 0 )
215 return; 216 return;
216 if ( view != mMonthView ) 217 if ( view != mMonthView )
217 full = mMainView->leftFrame()->isVisible(); 218 full = mMainView->leftFrame()->isVisible();
218 } else { 219 } else {
219 if ( view == mMonthView && mMonthView) 220 if ( view == mMonthView && mMonthView)
220 ;//mMonthView->skipResize = true ; 221 ;//mMonthView->skipResize = true ;
221 mCurrentView = view; 222 mCurrentView = view;
222 // bool full = fullScreen; 223 // bool full = fullScreen;
223 bool isFull = !mMainView->leftFrame()->isVisible(); 224 bool isFull = !mMainView->leftFrame()->isVisible();
224 if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) 225 if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen )
225 full = true; 226 full = true;
226 if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) 227 if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen )
227 full = false; 228 full = false;
228 } 229 }
229 if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); 230 if ( mAgendaView ) mAgendaView->deleteSelectedDateTime();
230 //raiseCurrentView( full ); 231 //raiseCurrentView( full );
231 mMainView->processIncidenceSelection( 0 ); 232 mMainView->processIncidenceSelection( 0 );
232 //mMainView->updateView(); 233 //mMainView->updateView();
233 raiseCurrentView( full, callupdate ); 234 raiseCurrentView( full, callupdate );
234 mMainView->adaptNavigationUnits(); 235 mMainView->adaptNavigationUnits();
235} 236}
236 237
237void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView ) 238void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView )
238{ 239{
239 mCurrentAgendaView = 0; 240 mCurrentAgendaView = 0;
240 if ( fullScreen ) { 241 if ( fullScreen ) {
241 mMainView->leftFrame()->hide(); 242 mMainView->leftFrame()->hide();
242 } else { 243 } else {
243 mMainView->leftFrame()->show(); 244 mMainView->leftFrame()->show();
244 } 245 }
245 //if ( mCurrentView == mMonthView ) qApp->processEvents(); 246 //if ( mCurrentView == mMonthView ) qApp->processEvents();
246 emit signalFullScreen( !fullScreen ); 247 emit signalFullScreen( !fullScreen );
247 if ( callUpdateView ) 248 if ( callUpdateView )
248 mMainView->updateView(); 249 mMainView->updateView();
249 250
250 if ( globalFlagBlockAgenda == 5 ) { 251 if ( globalFlagBlockAgenda == 5 ) {
251 globalFlagBlockAgenda = 4; 252 globalFlagBlockAgenda = 4;
252 globalFlagBlockAgendaItemPaint = 1; 253 globalFlagBlockAgendaItemPaint = 1;
253 } 254 }
254 mMainView->viewStack()->raiseWidget(mCurrentView); 255 mMainView->viewStack()->raiseWidget(mCurrentView);
255 if ( globalFlagBlockAgenda == 4 ) { 256 if ( globalFlagBlockAgenda == 4 ) {
256 if ( mCurrentView == mAgendaView ) { 257 if ( mCurrentView == mAgendaView ) {
257 //globalFlagBlockAgenda =1 ; 258 //globalFlagBlockAgenda =1 ;
258 if ( KOPrefs::instance()->mSetTimeToDayStartAt ) 259 if ( KOPrefs::instance()->mSetTimeToDayStartAt )
259 mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins ); 260 mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins );
260 else if ( KOPrefs::instance()->mCenterOnCurrentTime ) 261 else if ( KOPrefs::instance()->mCenterOnCurrentTime )
261 mAgendaView->setStartHour( QTime::currentTime ().hour() ); 262 mAgendaView->setStartHour( QTime::currentTime ().hour() );
262 qApp->processEvents(); 263 qApp->processEvents();
263 //qDebug("qApp->processEvents() "); 264 //qDebug("qApp->processEvents() ");
264 globalFlagBlockAgenda = 0; 265 globalFlagBlockAgenda = 0;
265 mAgendaView->repaintAgenda(); 266 mAgendaView->repaintAgenda();
266 267
267 } 268 }
268 globalFlagBlockAgenda = 0; 269 globalFlagBlockAgenda = 0;
269 } 270 }
270 emit signalAgendaView( mCurrentView == mAgendaView ); 271 emit signalAgendaView( mCurrentView == mAgendaView );
271 //qDebug("raiseCurrentView ende "); 272 //qDebug("raiseCurrentView ende ");
272 273
273} 274}
274 275
275void KOViewManager::updateView() 276void KOViewManager::updateView()
276{ 277{
277 // qDebug("KOViewManager::updateView() "); 278 // qDebug("KOViewManager::updateView() ");
278 // if we are updating mTodoView, we get endless recursion 279 // if we are updating mTodoView, we get endless recursion
279 if ( mTodoView == mCurrentView ) 280 if ( mTodoView == mCurrentView )
280 return; 281 return;
281 if ( mCurrentView ) mCurrentView->updateView(); 282 if ( mCurrentView ) mCurrentView->updateView();
282 283
283} 284}
284 285
285void KOViewManager::updateView(const QDate &start, const QDate &end) 286void KOViewManager::updateView(const QDate &start, const QDate &end)
286{ 287{
287 // kdDebug() << "KOViewManager::updateView()" << endl; 288 // kdDebug() << "KOViewManager::updateView()" << endl;
288 289
289 if (mCurrentView) mCurrentView->showDates(start, end); 290 if (mCurrentView) mCurrentView->showDates(start, end);
290 291
291 if (mTodoView && mTodoView == mCurrentView ) mTodoView->updateView(); 292 if (mTodoView && mTodoView == mCurrentView ) mTodoView->updateView();
292} 293}
293 294
294 295
295void KOViewManager::updateWNview() 296void KOViewManager::updateWNview()
296{ 297{
297 if ( mCurrentView == mWhatsNextView && mWhatsNextView ) 298 if ( mCurrentView == mWhatsNextView && mWhatsNextView )
298 mWhatsNextView->updateView(); 299 mWhatsNextView->updateView();
299 300
300} 301}
301void KOViewManager::showWhatsNextView() 302void KOViewManager::showWhatsNextView()
302{ 303{
303 if (!mWhatsNextView) { 304 if (!mWhatsNextView) {
304 mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(), 305 mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(),
305 "KOViewManager::WhatsNextView"); 306 "KOViewManager::WhatsNextView");
306 mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog()); 307 mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog());
307 connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig())); 308 connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig()));
308 addView(mWhatsNextView); 309 addView(mWhatsNextView);
309 connect(this, SIGNAL( printWNV() ), 310 connect(this, SIGNAL( printWNV() ),
310 mWhatsNextView, SLOT( printMe() ) ); 311 mWhatsNextView, SLOT( printMe() ) );
311 } 312 }
312 globalFlagBlockAgenda = 1; 313 globalFlagBlockAgenda = 1;
313 showView(mWhatsNextView, true ); 314 showView(mWhatsNextView, true );
314 //mWhatsNextView->updateView(); 315 //mWhatsNextView->updateView();
315 316
316} 317}
317 318
318void KOViewManager::showListView() 319void KOViewManager::showListView()
319{ 320{
320 if (!mListView) { 321 if (!mListView) {
321 mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView"); 322 mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView");
322 addView(mListView); 323 addView(mListView);
323 324
324 connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)), 325 connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)),
@@ -388,333 +389,340 @@ void KOViewManager::showAgendaView( bool fullScreen )
388 connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)), 389 connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)),
389 mMainView, SLOT(showIncidence(Incidence *))); 390 mMainView, SLOT(showIncidence(Incidence *)));
390 connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)), 391 connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)),
391 mMainView, SLOT(deleteIncidence(Incidence *))); 392 mMainView, SLOT(deleteIncidence(Incidence *)));
392 393
393 connect( mAgendaView, SIGNAL( incidenceSelected( Incidence * ) ), 394 connect( mAgendaView, SIGNAL( incidenceSelected( Incidence * ) ),
394 mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 395 mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
395 396
396 connect(mAgendaView, SIGNAL( toggleExpand() ), 397 connect(mAgendaView, SIGNAL( toggleExpand() ),
397 mMainView, SLOT( toggleExpand() ) ); 398 mMainView, SLOT( toggleExpand() ) );
398 399
399 connect(mMainView, SIGNAL( calendarViewExpanded( bool ) ), 400 connect(mMainView, SIGNAL( calendarViewExpanded( bool ) ),
400 mAgendaView, SLOT( setExpandedButton( bool ) ) ); 401 mAgendaView, SLOT( setExpandedButton( bool ) ) );
401 connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ), 402 connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ),
402 mMainView, SLOT(cloneIncidence(Incidence *) ) ) ; 403 mMainView, SLOT(cloneIncidence(Incidence *) ) ) ;
403 connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ), 404 connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ),
404 mMainView, SLOT(cancelIncidence(Incidence *) ) ) ; 405 mMainView, SLOT(cancelIncidence(Incidence *) ) ) ;
405 connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig())); 406 connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig()));
406 connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView, 407 connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView,
407 SLOT( updateTodo( Todo *, int ) ) ); 408 SLOT( updateTodo( Todo *, int ) ) );
408 connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )), 409 connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )),
409 mMainView, SIGNAL( todoModified( Todo *, int ))); 410 mMainView, SIGNAL( todoModified( Todo *, int )));
410 connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ), 411 connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ),
411 mMainView, SLOT ( moveIncidence( Incidence * ) ) ); 412 mMainView, SLOT ( moveIncidence( Incidence * ) ) );
412 connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ), 413 connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ),
413 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 414 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
414 connect( mAgendaView, SIGNAL( selectWeekNum( int ) ), 415 connect( mAgendaView, SIGNAL( selectWeekNum( int ) ),
415 mMainView->dateNavigator(), SLOT ( selectWeek( int ) ) ); 416 mMainView->dateNavigator(), SLOT ( selectWeek( int ) ) );
416 mAgendaView->readSettings(); 417 mAgendaView->readSettings();
417 mAgendaView->updateConfig(); 418 mAgendaView->updateConfig();
418 } 419 }
419 420
420 showView( mAgendaView, full); 421 showView( mAgendaView, full);
421 422
422} 423}
423 424
424void KOViewManager::showDayView() 425void KOViewManager::showDayView()
425{ 426{
426 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count(); 427 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count();
427 mFlagShowNextxDays = false; 428 mFlagShowNextxDays = false;
428 globalFlagBlockLabel = 1; 429 globalFlagBlockLabel = 1;
429 globalFlagBlockAgenda = 1; 430 globalFlagBlockAgenda = 1;
430 if ( mCurrentAgendaView != 1 ) 431 if ( mCurrentAgendaView != 1 )
431 mCurrentAgendaView = -1; 432 mCurrentAgendaView = -1;
432 showAgendaView(); 433 showAgendaView();
433 qApp->processEvents(); 434 qApp->processEvents();
434 globalFlagBlockAgenda = 2; 435 globalFlagBlockAgenda = 2;
435 globalFlagBlockLabel = 0; 436 globalFlagBlockLabel = 0;
436 mMainView->dateNavigator()->selectDates( 1 ); 437 mMainView->dateNavigator()->selectDates( 1 );
437 mCurrentAgendaView = 1 ; 438 mCurrentAgendaView = 1 ;
438 439
439} 440}
440 441
441void KOViewManager::showWorkWeekView() 442void KOViewManager::showWorkWeekView()
442{ 443{
443 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count(); 444 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count();
444 mFlagShowNextxDays = false; 445 mFlagShowNextxDays = false;
445 globalFlagBlockAgenda = 1; 446 globalFlagBlockAgenda = 1;
446 globalFlagBlockLabel = 1; 447 globalFlagBlockLabel = 1;
447 if ( mCurrentAgendaView != 5 ) 448 if ( mCurrentAgendaView != 5 )
448 mCurrentAgendaView = -1; 449 mCurrentAgendaView = -1;
449 showAgendaView(); 450 showAgendaView();
450 qApp->processEvents(); 451 qApp->processEvents();
451 globalFlagBlockAgenda = 2; 452 globalFlagBlockAgenda = 2;
452 globalFlagBlockLabel = 0; 453 globalFlagBlockLabel = 0;
453 mMainView->dateNavigator()->selectWorkWeek(); 454 mMainView->dateNavigator()->selectWorkWeek();
454 mCurrentAgendaView = 5 ; 455 mCurrentAgendaView = 5 ;
455 456
456} 457}
457 458
458void KOViewManager::showWeekView() 459void KOViewManager::showWeekView()
459{ 460{
460 /* 461 /*
461 globalFlagBlockAgenda = 2; 462 globalFlagBlockAgenda = 2;
462 qDebug("4globalFlagBlockAgenda = 2; "); 463 qDebug("4globalFlagBlockAgenda = 2; ");
463 //globalFlagBlockPainting = true; 464 //globalFlagBlockPainting = true;
464 mMainView->dateNavigator()->selectWeek(); 465 mMainView->dateNavigator()->selectWeek();
465 showAgendaView(); 466 showAgendaView();
466 */ 467 */
467 468
468 469
469 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count(); 470 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count();
470 mFlagShowNextxDays = false; 471 mFlagShowNextxDays = false;
471 globalFlagBlockAgenda = 1; 472 globalFlagBlockAgenda = 1;
472 globalFlagBlockLabel = 1; 473 globalFlagBlockLabel = 1;
473 if ( mCurrentAgendaView != 7 ) 474 if ( mCurrentAgendaView != 7 )
474 mCurrentAgendaView = -1; 475 mCurrentAgendaView = -1;
475 showAgendaView(); 476 showAgendaView();
476 qApp->processEvents(); 477 qApp->processEvents();
477 globalFlagBlockAgenda = 2; 478 globalFlagBlockAgenda = 2;
478 globalFlagBlockLabel = 0; 479 globalFlagBlockLabel = 0;
479 mMainView->dateNavigator()->selectWeek(); 480 mMainView->dateNavigator()->selectWeek();
480 mCurrentAgendaView = 7 ; 481 mCurrentAgendaView = 7 ;
481} 482}
482 483
483void KOViewManager::showNextXView() 484void KOViewManager::showNextXView()
484{ 485{
485 486
486 globalFlagBlockAgenda = 1; 487 globalFlagBlockAgenda = 1;
487 if ( mCurrentAgendaView != 3 ) 488 if ( mCurrentAgendaView != 3 )
488 mCurrentAgendaView = -1; 489 mCurrentAgendaView = -1;
489 showAgendaView(KOPrefs::instance()->mFullViewMonth); 490 showAgendaView(KOPrefs::instance()->mFullViewMonth);
490 globalFlagBlockAgenda = 2; 491 globalFlagBlockAgenda = 2;
491 mMainView->dateNavigator()->selectDates( QDate::currentDate(), 492 mMainView->dateNavigator()->selectDates( QDate::currentDate(),
492 KOPrefs::instance()->mNextXDays ); 493 KOPrefs::instance()->mNextXDays );
493 mFlagShowNextxDays = true; 494 mFlagShowNextxDays = true;
494 mCurrentAgendaView = 3 ; 495 mCurrentAgendaView = 3 ;
495} 496}
496bool KOViewManager::showsNextDays() 497bool KOViewManager::showsNextDays()
497{ 498{
498 return mFlagShowNextxDays; 499 return mFlagShowNextxDays;
499} 500}
500void KOViewManager::createMonthView() 501void KOViewManager::createMonthView()
501{ 502{
502if (!mMonthView) { 503if (!mMonthView) {
503 mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView"); 504 mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView");
504 505
505 addView(mMonthView); 506 addView(mMonthView);
506 // mMonthView->show(); 507 // mMonthView->show();
507 // SIGNALS/SLOTS FOR MONTH VIEW 508 // SIGNALS/SLOTS FOR MONTH VIEW
508 connect(mMonthView, SIGNAL(newEventSignal(QDateTime)), 509 connect(mMonthView, SIGNAL(newEventSignal(QDateTime)),
509 mMainView, SLOT(newEvent(QDateTime))); 510 mMainView, SLOT(newEvent(QDateTime)));
510 511
511 connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)), 512 connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)),
512 mMainView, SLOT(showIncidence(Incidence *))); 513 mMainView, SLOT(showIncidence(Incidence *)));
513 connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)), 514 connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)),
514 mMainView, SLOT(editIncidence(Incidence *))); 515 mMainView, SLOT(editIncidence(Incidence *)));
515 connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)), 516 connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)),
516 mMainView, SLOT(deleteIncidence(Incidence *))); 517 mMainView, SLOT(deleteIncidence(Incidence *)));
517 518
518 connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ), 519 connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ),
519 mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 520 mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
520 connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), 521 connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ),
521 mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); 522 mMainView, SLOT ( cloneIncidence( Incidence * ) ) );
522 connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), 523 connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ),
523 mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); 524 mMainView, SLOT ( cancelIncidence( Incidence * ) ) );
524 525
525 connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ), 526 connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ),
526 mMainView, SLOT ( moveIncidence( Incidence * ) ) ); 527 mMainView, SLOT ( moveIncidence( Incidence * ) ) );
527 connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ), 528 connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ),
528 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 529 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
529 connect( mMonthView, SIGNAL( selectWeekNum( int ) ), 530 connect( mMonthView, SIGNAL( selectWeekNum( int ) ),
530 mMainView->dateNavigator(), SLOT ( selectWeekFromMonthView( int ) ) ); 531 mMainView->dateNavigator(), SLOT ( selectWeekFromMonthView( int ) ) );
531 connect( mMonthView, SIGNAL( selectMonth() ), 532 connect( mMonthView, SIGNAL( selectMonth() ),
532 mMainView->dateNavigator(), SLOT ( selectMonthFromMonthview() ) ); 533 mMainView->dateNavigator(), SLOT ( selectMonthFromMonthview() ) );
533 connect( mMonthView, SIGNAL( showDaySignal( QDate ) ), 534 connect( mMonthView, SIGNAL( showDaySignal( QDate ) ),
534 mMainView, SLOT ( showDay( QDate ) ) ); 535 mMainView, SLOT ( showDay( QDate ) ) );
535 connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig())); 536 connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig()));
536 connect( mMonthView, SIGNAL(nextMonth() ), 537 connect( mMonthView, SIGNAL(nextMonth() ),
537 mMonthView->navigatorBar(), SIGNAL(goNextMonth() ) ); 538 mMonthView->navigatorBar(), SIGNAL(goNextMonth() ) );
538 connect( mMonthView, SIGNAL(prevMonth() ), 539 connect( mMonthView, SIGNAL(prevMonth() ),
539 mMonthView->navigatorBar(), SIGNAL(goPrevMonth() ) ); 540 mMonthView->navigatorBar(), SIGNAL(goPrevMonth() ) );
540 connect( mMonthView->navigatorBar(), SIGNAL( goPrevYear() ), 541 connect( mMonthView->navigatorBar(), SIGNAL( goPrevYear() ),
541 mMainView->dateNavigator(), SLOT( selectPreviousYear() ) ); 542 mMainView->dateNavigator(), SLOT( selectPreviousYear() ) );
542 connect( mMonthView->navigatorBar(), SIGNAL( goNextYear() ), 543 connect( mMonthView->navigatorBar(), SIGNAL( goNextYear() ),
543 mMainView->dateNavigator(), SLOT( selectNextYear() ) ); 544 mMainView->dateNavigator(), SLOT( selectNextYear() ) );
544 connect( mMonthView->navigatorBar(), SIGNAL( goPrevMonth() ), 545 connect( mMonthView->navigatorBar(), SIGNAL( goPrevMonth() ),
545 mMainView->dateNavigator(), SLOT( selectPreviousMonth() ) ); 546 mMainView->dateNavigator(), SLOT( selectPreviousMonth() ) );
546 connect( mMonthView->navigatorBar(), SIGNAL( goNextMonth() ), 547 connect( mMonthView->navigatorBar(), SIGNAL( goNextMonth() ),
547 mMainView->dateNavigator(), SLOT( selectNextMonth() ) ); 548 mMainView->dateNavigator(), SLOT( selectNextMonth() ) );
548 connect( mMonthView->navigatorBar(), SIGNAL( goPrevWeek() ), 549 connect( mMonthView->navigatorBar(), SIGNAL( goPrevWeek() ),
549 mMainView->dateNavigator(), SLOT( selectPreviousWeek() ) ); 550 mMainView->dateNavigator(), SLOT( selectPreviousWeek() ) );
550 connect( mMonthView->navigatorBar(), SIGNAL( goNextWeek() ), 551 connect( mMonthView->navigatorBar(), SIGNAL( goNextWeek() ),
551 mMainView->dateNavigator(), SLOT( selectNextWeek() ) ); 552 mMainView->dateNavigator(), SLOT( selectNextWeek() ) );
552 553
553 connect( mMainView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), 554 connect( mMainView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ),
554 mMonthView->navigatorBar(), SLOT( selectDates( const KCal::DateList & ) ) ); 555 mMonthView->navigatorBar(), SLOT( selectDates( const KCal::DateList & ) ) );
555 556
556 557
557 connect( mMonthView->navigatorBar(), SIGNAL( monthSelected ( int ) ), 558 connect( mMonthView->navigatorBar(), SIGNAL( monthSelected ( int ) ),
558 mMainView->dateNavigator(), SLOT( slotMonthSelect( int ) ) ); 559 mMainView->dateNavigator(), SLOT( slotMonthSelect( int ) ) );
559 560
560 } 561 }
561} 562}
562void KOViewManager::showMonthViewWeek() 563void KOViewManager::showMonthViewWeek()
563{ 564{
564 createMonthView(); 565 createMonthView();
565 globalFlagBlockAgenda = 1; 566 globalFlagBlockAgenda = 1;
566 bool full = true; 567 bool full = true;
567 if ( mCurrentView == mMonthView) 568 if ( mCurrentView == mMonthView)
568 full = mMainView->leftFrame()->isVisible(); 569 full = mMainView->leftFrame()->isVisible();
569 if ( !KOPrefs::instance()->mMonthViewWeek ) { 570 if ( !KOPrefs::instance()->mMonthViewWeek ) {
570 mMonthView->switchView(); 571 mMonthView->switchView();
571 if ( KOPrefs::instance()->mViewChangeHoldNonFullscreen && mMainView->leftFrame()->isVisible() ) 572 if ( KOPrefs::instance()->mViewChangeHoldNonFullscreen && mMainView->leftFrame()->isVisible() )
572 full = false; 573 full = false;
573 else 574 else
574 full = true; 575 full = true;
575 } 576 }
576 mMainView->dateNavigator()->selectWeek(); 577 mMainView->dateNavigator()->selectWeek();
577 showView(mMonthView, full ); 578 showView(mMonthView, full );
578} 579}
579 580
581void KOViewManager::showMonth( const QDate & date )
582{
583 mMainView->dateNavigator()->blockSignals( true );
584 mMainView->dateNavigator()->selectDate( date );
585 mMainView->dateNavigator()->blockSignals( false );
586 showMonthView();
587}
580void KOViewManager::showMonthView() 588void KOViewManager::showMonthView()
581 { 589 {
582 590
583 createMonthView(); 591 createMonthView();
584 globalFlagBlockAgenda = 1; 592 globalFlagBlockAgenda = 1;
585 //mFlagShowNextxDays = false; 593 //mFlagShowNextxDays = false;
586 bool full = true; 594 bool full = true;
587 if ( mCurrentView == mMonthView) 595 if ( mCurrentView == mMonthView)
588 full = mMainView->leftFrame()->isVisible(); 596 full = mMainView->leftFrame()->isVisible();
589 // if(mMonthView == mCurrentView) return; 597 // if(mMonthView == mCurrentView) return;
590 if ( KOPrefs::instance()->mMonthViewWeek ) { 598 if ( KOPrefs::instance()->mMonthViewWeek ) {
591 mMonthView->switchView(); 599 mMonthView->switchView();
592 if ( KOPrefs::instance()->mViewChangeHoldNonFullscreen && mMainView->leftFrame()->isVisible() ) 600 if ( KOPrefs::instance()->mViewChangeHoldNonFullscreen && mMainView->leftFrame()->isVisible() )
593 full = false; 601 full = false;
594 else 602 else
595 full = true; 603 full = true;
596 } 604 }
597 mMainView->dateNavigator()->selectMonth(); 605 mMainView->dateNavigator()->selectMonth();
598 606
599 showView(mMonthView, full ); 607 showView(mMonthView, full );
600 608
601} 609}
602 610
603void KOViewManager::showTodoView() 611void KOViewManager::showTodoView()
604{ 612{
605 //mFlagShowNextxDays = false; 613 //mFlagShowNextxDays = false;
606 if ( !mTodoView ) { 614 if ( !mTodoView ) {
607 mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(), 615 mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(),
608 "KOViewManager::TodoView" ); 616 "KOViewManager::TodoView" );
609 617
610 addView( mTodoView ); 618 addView( mTodoView );
611 // QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold ); 619 // QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold );
612 620
613 // SIGNALS/SLOTS FOR TODO VIEW 621 // SIGNALS/SLOTS FOR TODO VIEW
614 connect( mTodoView, SIGNAL( newTodoSignal() ), 622 connect( mTodoView, SIGNAL( newTodoSignal() ),
615 mMainView, SLOT( newTodo() ) ); 623 mMainView, SLOT( newTodo() ) );
616 connect( mTodoView, SIGNAL( newSubTodoSignal( Todo * ) ), 624 connect( mTodoView, SIGNAL( newSubTodoSignal( Todo * ) ),
617 mMainView, SLOT( newSubTodo( Todo *) ) ); 625 mMainView, SLOT( newSubTodo( Todo *) ) );
618 connect( mTodoView, SIGNAL( showTodoSignal( Todo *) ), 626 connect( mTodoView, SIGNAL( showTodoSignal( Todo *) ),
619 mMainView, SLOT( showTodo( Todo * ) ) ); 627 mMainView, SLOT( showTodo( Todo * ) ) );
620 connect( mTodoView, SIGNAL( editTodoSignal( Todo * ) ), 628 connect( mTodoView, SIGNAL( editTodoSignal( Todo * ) ),
621 mMainView, SLOT( editTodo( Todo * ) ) ); 629 mMainView, SLOT( editTodo( Todo * ) ) );
622 connect( mTodoView, SIGNAL( deleteTodoSignal( Todo * ) ), 630 connect( mTodoView, SIGNAL( deleteTodoSignal( Todo * ) ),
623 mMainView, SLOT( deleteTodo( Todo * ) ) ); 631 mMainView, SLOT( deleteTodo( Todo * ) ) );
624 connect( mTodoView, SIGNAL( purgeCompletedSignal() ), 632 connect( mTodoView, SIGNAL( purgeCompletedSignal() ),
625 mMainView, SLOT( purgeCompleted() ) ); 633 mMainView, SLOT( purgeCompleted() ) );
626 634
627 connect( mTodoView, SIGNAL( incidenceSelected( Incidence * ) ), 635 connect( mTodoView, SIGNAL( incidenceSelected( Incidence * ) ),
628 mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 636 mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
629 637
630 connect( mMainView, SIGNAL( configChanged() ), mTodoView, 638 connect( mMainView, SIGNAL( configChanged() ), mTodoView,
631 SLOT( updateConfig() ) ); 639 SLOT( updateConfig() ) );
632 connect( mMainView, SIGNAL( todoModified( Todo *, int )), mTodoView, 640 connect( mMainView, SIGNAL( todoModified( Todo *, int )), mTodoView,
633 SLOT( updateTodo( Todo *, int ) ) ); 641 SLOT( updateTodo( Todo *, int ) ) );
634 connect( mTodoView, SIGNAL( todoModifiedSignal( Todo *, int ) ), 642 connect( mTodoView, SIGNAL( todoModifiedSignal( Todo *, int ) ),
635 mMainView, SIGNAL ( todoModified( Todo *, int ) ) ); 643 mMainView, SIGNAL ( todoModified( Todo *, int ) ) );
636 connect( mTodoView, SIGNAL( cloneTodoSignal( Incidence * ) ), 644 connect( mTodoView, SIGNAL( cloneTodoSignal( Incidence * ) ),
637 mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); 645 mMainView, SLOT ( cloneIncidence( Incidence * ) ) );
638 connect( mTodoView, SIGNAL( cancelTodoSignal( Incidence * ) ), 646 connect( mTodoView, SIGNAL( cancelTodoSignal( Incidence * ) ),
639 mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); 647 mMainView, SLOT ( cancelIncidence( Incidence * ) ) );
640 connect( mTodoView, SIGNAL( unparentTodoSignal( Todo * ) ), 648 connect( mTodoView, SIGNAL( unparentTodoSignal( Todo * ) ),
641 mMainView, SLOT ( todo_unsub( Todo * ) ) ); 649 mMainView, SLOT ( todo_unsub( Todo * ) ) );
642 connect( mTodoView, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), 650 connect( mTodoView, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ),
643 mMainView, SLOT ( todo_resub( Todo *, Todo *) ) ); 651 mMainView, SLOT ( todo_resub( Todo *, Todo *) ) );
644 connect( mTodoView, SIGNAL( moveTodoSignal( Incidence * ) ), 652 connect( mTodoView, SIGNAL( moveTodoSignal( Incidence * ) ),
645 mMainView, SLOT ( moveIncidence( Incidence * ) ) ); 653 mMainView, SLOT ( moveIncidence( Incidence * ) ) );
646 connect( mTodoView, SIGNAL( beamTodoSignal( Incidence * ) ), 654 connect( mTodoView, SIGNAL( beamTodoSignal( Incidence * ) ),
647 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 655 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
648 KConfig *config = KOGlobals::config(); 656 KConfig *config = KOGlobals::config();
649 mTodoView->restoreLayout(config,"Todo View"); 657 mTodoView->restoreLayout(config,"Todo View");
650 mTodoView->setNavigator( mMainView->dateNavigator() ); 658 mTodoView->setNavigator( mMainView->dateNavigator() );
651 } 659 }
652 660
653 globalFlagBlockAgenda = 1; 661 globalFlagBlockAgenda = 1;
654 showView( mTodoView, true ); 662 showView( mTodoView, true );
655 663
656} 664}
657 665
658void KOViewManager::showJournalView() 666void KOViewManager::showJournalView()
659{ 667{
660 //mFlagShowNextxDays = false; 668 //mFlagShowNextxDays = false;
661 if (!mJournalView) { 669 if (!mJournalView) {
662 mJournalView = new KOJournalView(mMainView->calendar(),mMainView->viewStack(), 670 mJournalView = new KOJournalView(mMainView->calendar(),mMainView->viewStack(),
663 "KOViewManager::JournalView"); 671 "KOViewManager::JournalView");
664 connect( mMainView, SIGNAL( configChanged() ), mJournalView, 672 connect( mMainView, SIGNAL( configChanged() ), mJournalView,
665 SLOT( updateConfig() ) ); 673 SLOT( updateConfig() ) );
666 connect(mJournalView, SIGNAL(deleteJournal(Journal *) ), mMainView,SLOT(deleteJournal(Journal *)) ); 674 connect(mJournalView, SIGNAL(deleteJournal(Journal *) ), mMainView,SLOT(deleteJournal(Journal *)) );
667 addView(mJournalView); 675 addView(mJournalView);
668 } 676 }
669 677
670 showView(mJournalView); 678 showView(mJournalView);
671 mMainView->dateNavigator()->selectDates( 1 ); 679 mMainView->dateNavigator()->selectDates( 1 );
672} 680}
673 681
674void KOViewManager::showTimeSpanView() 682void KOViewManager::showTimeSpanView()
675{ 683{
676 //mFlagShowNextxDays = false; 684 //mFlagShowNextxDays = false;
677 if (!mTimeSpanView) { 685 if (!mTimeSpanView) {
678 mTimeSpanView = new KOTimeSpanView(mMainView->calendar(),mMainView->viewStack(), 686 mTimeSpanView = new KOTimeSpanView(mMainView->calendar(),mMainView->viewStack(),
679 "KOViewManager::TimeSpanView"); 687 "KOViewManager::TimeSpanView");
680 addView(mTimeSpanView); 688 addView(mTimeSpanView);
681 689
682 mTimeSpanView->readSettings(); 690 mTimeSpanView->readSettings();
683 } 691 }
684 692
685 showView(mTimeSpanView); 693 showView(mTimeSpanView);
686} 694}
687 695
688Incidence *KOViewManager::currentSelection() 696Incidence *KOViewManager::currentSelection()
689{ 697{
690 if (!mCurrentView) return 0; 698 if (!mCurrentView) return 0;
691 if ( mCurrentView == mListView ) { 699 if ( mCurrentView == mListView ) {
692 if ( mListView->currentItem() ) 700 if ( mListView->currentItem() )
693 return mListView->currentItem(); 701 return mListView->currentItem();
694 } 702 }
695 return mCurrentView->selectedIncidences().first(); 703 return mCurrentView->selectedIncidences().first();
696} 704}
697 705
698QDate KOViewManager::currentSelectionDate() 706QDate KOViewManager::currentSelectionDate()
699{ 707{
700 QDate qd; 708 QDate qd;
701 if (mCurrentView) { 709 if (mCurrentView) {
702 DateList qvl = mCurrentView->selectedDates(); 710 DateList qvl = mCurrentView->selectedDates();
703 if (!qvl.isEmpty()) qd = qvl.first(); 711 if (!qvl.isEmpty()) qd = qvl.first();
704 } 712 }
705 return qd; 713 return qd;
706} 714}
707 715
708void KOViewManager::addView(KOrg::BaseView *view) 716void KOViewManager::addView(KOrg::BaseView *view)
709{ 717{
710#if QT_VERSION >= 0x030000 718#if QT_VERSION >= 0x030000
711 mMainView->viewStack()->addWidget( view ); 719 mMainView->viewStack()->addWidget( view );
712#else 720#else
713 mMainView->viewStack()->addWidget( view, 1 ); 721 mMainView->viewStack()->addWidget( view, 1 );
714#endif 722#endif
715} 723}
716 724
717void KOViewManager::setDocumentId( const QString &id ) 725void KOViewManager::setDocumentId( const QString &id )
718{ 726{
719 if (mTodoView) mTodoView->setDocumentId( id ); 727 if (mTodoView) mTodoView->setDocumentId( id );
720} 728}
diff --git a/korganizer/koviewmanager.h b/korganizer/koviewmanager.h
index 8f0bf82..6290227 100644
--- a/korganizer/koviewmanager.h
+++ b/korganizer/koviewmanager.h
@@ -1,120 +1,121 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 3 Copyright (c) 2001
4 Cornelius Schumacher <schumacher@kde.org> 4 Cornelius Schumacher <schumacher@kde.org>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by 7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or 8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version. 9 (at your option) any later version.
10 10
11 This program is distributed in the hope that it will be useful, 11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
14 GNU General Public License for more details. 14 GNU General Public License for more details.
15 15
16 You should have received a copy of the GNU General Public License 16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software 17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 19
20 As a special exception, permission is given to link this program 20 As a special exception, permission is given to link this program
21 with any edition of Qt, and distribute the resulting executable, 21 with any edition of Qt, and distribute the resulting executable,
22 without including the source code for Qt in the source distribution. 22 without including the source code for Qt in the source distribution.
23*/ 23*/
24#ifndef KOVIEWMANAGER_H 24#ifndef KOVIEWMANAGER_H
25#define KOVIEWMANAGER_H 25#define KOVIEWMANAGER_H
26 26
27#include <qobject.h> 27#include <qobject.h>
28 28
29#include <korganizer/baseview.h> 29#include <korganizer/baseview.h>
30 30
31class CalendarView; 31class CalendarView;
32 32
33class KOListView; 33class KOListView;
34class KOAgendaView; 34class KOAgendaView;
35class KOMonthView; 35class KOMonthView;
36class KOTimeSpanView; 36class KOTimeSpanView;
37class KOTodoView; 37class KOTodoView;
38class KOWhatsNextView; 38class KOWhatsNextView;
39class KOJournalView; 39class KOJournalView;
40 40
41using namespace KCal; 41using namespace KCal;
42 42
43/** 43/**
44 This class manages the views of the calendar. It owns the objects and handles 44 This class manages the views of the calendar. It owns the objects and handles
45 creation and selection. 45 creation and selection.
46*/ 46*/
47class KOViewManager : public QObject 47class KOViewManager : public QObject
48{ 48{
49 Q_OBJECT 49 Q_OBJECT
50 public: 50 public:
51 KOViewManager( CalendarView * ); 51 KOViewManager( CalendarView * );
52 virtual ~KOViewManager(); 52 virtual ~KOViewManager();
53 53
54 /** changes the view to be the currently selected view */ 54 /** changes the view to be the currently selected view */
55 void showView(KOrg::BaseView *, bool fullScreen = false ); 55 void showView(KOrg::BaseView *, bool fullScreen = false );
56 void updateWNview(); 56 void updateWNview();
57 void readSettings(KConfig *config); 57 void readSettings(KConfig *config);
58 void writeSettings(KConfig *config); 58 void writeSettings(KConfig *config);
59 bool showsNextDays(); 59 bool showsNextDays();
60 /** Read which view was shown last from config file */ 60 /** Read which view was shown last from config file */
61 void readCurrentView(KConfig *); 61 void readCurrentView(KConfig *);
62 /** Write which view is currently shown to config file */ 62 /** Write which view is currently shown to config file */
63 void writeCurrentView(KConfig *); 63 void writeCurrentView(KConfig *);
64 64
65 KOrg::BaseView *currentView(); 65 KOrg::BaseView *currentView();
66 66
67 void setDocumentId( const QString & ); 67 void setDocumentId( const QString & );
68 68
69 void updateView( const QDate &start, const QDate &end ); 69 void updateView( const QDate &start, const QDate &end );
70 70
71 void raiseCurrentView( bool fullScreen = false , bool updateView = false); 71 void raiseCurrentView( bool fullScreen = false , bool updateView = false);
72 72
73 void addView(KOrg::BaseView *); 73 void addView(KOrg::BaseView *);
74 74
75 Incidence *currentSelection(); 75 Incidence *currentSelection();
76 QDate currentSelectionDate(); 76 QDate currentSelectionDate();
77 77
78 KOAgendaView *agendaView() const { return mAgendaView; } 78 KOAgendaView *agendaView() const { return mAgendaView; }
79 79
80 signals: 80 signals:
81 void printWNV(); 81 void printWNV();
82 void signalFullScreen( bool ); 82 void signalFullScreen( bool );
83 void signalAgendaView( bool ); 83 void signalAgendaView( bool );
84 public slots: 84 public slots:
85 void showMonth( const QDate & );
85 void showDateView( int, QDate ); 86 void showDateView( int, QDate );
86 void updateView(); 87 void updateView();
87 void showWhatsNextView(); 88 void showWhatsNextView();
88 void showListView(); 89 void showListView();
89 void showAgendaView( bool fullScreen = false ); 90 void showAgendaView( bool fullScreen = false );
90 void showDayView(); 91 void showDayView();
91 void showWorkWeekView(); 92 void showWorkWeekView();
92 void showWeekView(); 93 void showWeekView();
93 void showNextXView(); 94 void showNextXView();
94 void showMonthView(); 95 void showMonthView();
95 void showMonthViewWeek(); 96 void showMonthViewWeek();
96 void showTodoView(); 97 void showTodoView();
97 void showJournalView(); 98 void showJournalView();
98 void showTimeSpanView(); 99 void showTimeSpanView();
99 100
100 private: 101 private:
101 void createMonthView(); 102 void createMonthView();
102 CalendarView *mMainView; 103 CalendarView *mMainView;
103 104
104 int mCurrentAgendaView; 105 int mCurrentAgendaView;
105 KOAgendaView *mAgendaView; 106 KOAgendaView *mAgendaView;
106 KOListView *mListView; 107 KOListView *mListView;
107 KOMonthView *mMonthView; 108 KOMonthView *mMonthView;
108 KOTodoView *mTodoView; 109 KOTodoView *mTodoView;
109 KOWhatsNextView *mWhatsNextView; 110 KOWhatsNextView *mWhatsNextView;
110 KOJournalView *mJournalView; 111 KOJournalView *mJournalView;
111 KOTimeSpanView *mTimeSpanView; 112 KOTimeSpanView *mTimeSpanView;
112 113
113 KOrg::BaseView *mCurrentView; // currently active event view 114 KOrg::BaseView *mCurrentView; // currently active event view
114 115
115 int mAgendaViewMode; 116 int mAgendaViewMode;
116 bool mFlagShowNextxDays; 117 bool mFlagShowNextxDays;
117 118
118}; 119};
119 120
120#endif 121#endif