summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-02-16 22:08:18 (UTC)
committer zautrix <zautrix>2005-02-16 22:08:18 (UTC)
commit451b4de59893b5c0801a7bbb2f8cbe8e0266b324 (patch) (unidiff)
treece3f535541583d37cfe951ddd8d7474770d9c374 /korganizer
parentb2cf8e9a08082539e0a5578a98766e5990783f9a (diff)
downloadkdepimpi-451b4de59893b5c0801a7bbb2f8cbe8e0266b324.zip
kdepimpi-451b4de59893b5c0801a7bbb2f8cbe8e0266b324.tar.gz
kdepimpi-451b4de59893b5c0801a7bbb2f8cbe8e0266b324.tar.bz2
month view fixes
Diffstat (limited to 'korganizer') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/datenavigator.cpp15
-rw-r--r--korganizer/datenavigator.h3
-rw-r--r--korganizer/komonthview.cpp4
-rw-r--r--korganizer/komonthview.h3
-rw-r--r--korganizer/koprefs.cpp1
-rw-r--r--korganizer/koprefs.h1
-rw-r--r--korganizer/koviewmanager.cpp50
-rw-r--r--korganizer/koviewmanager.h2
-rw-r--r--korganizer/mainwindow.cpp12
-rw-r--r--korganizer/navigatorbar.cpp22
-rw-r--r--korganizer/navigatorbar.h4
11 files changed, 110 insertions, 7 deletions
diff --git a/korganizer/datenavigator.cpp b/korganizer/datenavigator.cpp
index 8b7c993..b0eac51 100644
--- a/korganizer/datenavigator.cpp
+++ b/korganizer/datenavigator.cpp
@@ -22,128 +22,134 @@
22*/ 22*/
23 23
24#include "datenavigator.h" 24#include "datenavigator.h"
25 25
26#include "koglobals.h" 26#include "koglobals.h"
27 27
28#include <kcalendarsystem.h> 28#include <kcalendarsystem.h>
29 29
30#include <kdebug.h> 30#include <kdebug.h>
31#include <kglobal.h> 31#include <kglobal.h>
32#include <klocale.h> 32#include <klocale.h>
33 33
34using namespace KCal; 34using namespace KCal;
35 35
36DateNavigator::DateNavigator( QObject *parent, const char *name , KOViewManager * v) 36DateNavigator::DateNavigator( QObject *parent, const char *name , KOViewManager * v)
37 : QObject( parent, name ) 37 : QObject( parent, name )
38{ 38{
39 mViewManager = v; 39 mViewManager = v;
40 mSelectedDates.append( QDate::currentDate() ); 40 mSelectedDates.append( QDate::currentDate() );
41} 41}
42 42
43DateNavigator::~DateNavigator() 43DateNavigator::~DateNavigator()
44{ 44{
45} 45}
46 46
47void DateNavigator::slotMonthSelect( int m ) 47void DateNavigator::slotMonthSelect( int m )
48{ 48{
49 QDate firstSelected = mSelectedDates.first(); 49 QDate firstSelected = mSelectedDates.first();
50 int weekDay = firstSelected.dayOfWeek(); 50 int weekDay = firstSelected.dayOfWeek();
51 int diff = m - firstSelected.month() ; 51 int diff = m - firstSelected.month() ;
52 firstSelected = KOGlobals::self()->calendarSystem()->addMonths( firstSelected, diff ); 52 firstSelected = KOGlobals::self()->calendarSystem()->addMonths( firstSelected, diff );
53 53
54 if ( mSelectedDates.first().day() == 1 && mSelectedDates.count() > 27 ) 54 if ( mSelectedDates.first().day() == 1 && mSelectedDates.count() > 27 )
55 selectMonthByDate( firstSelected ); 55 selectMonthByDate( firstSelected );
56 else 56 else
57 selectWeekByDay( weekDay, firstSelected ); 57 selectWeekByDay( weekDay, firstSelected );
58 58
59} 59}
60 60
61void DateNavigator::slotDaySelect( QDate d ) 61void DateNavigator::slotDaySelect( QDate d )
62{ 62{
63 QDate firstSelected = mSelectedDates.first(); 63 QDate firstSelected = mSelectedDates.first();
64 int weekDay = firstSelected.dayOfWeek(); 64 int weekDay = firstSelected.dayOfWeek();
65 //int diff = firstSelected.daysTo( d ) ; 65 //int diff = firstSelected.daysTo( d ) ;
66 firstSelected = firstSelected.addDays( firstSelected .daysTo( d ) ); 66 firstSelected = firstSelected.addDays( firstSelected .daysTo( d ) );
67 67
68 selectWeekByDay( weekDay, firstSelected ); 68 selectWeekByDay( weekDay, firstSelected );
69 69
70} 70}
71 71
72void DateNavigator::selectMonthByDate( const QDate & firstSelected ) 72void DateNavigator::selectMonthByDate( const QDate & firstSelected )
73{ 73{
74 74
75 int monthDay = firstSelected.day(); 75 int monthDay = firstSelected.day();
76 QDate date = firstSelected.addDays( 1-monthDay ); 76 QDate date = firstSelected.addDays( 1-monthDay );
77 selectDates( date , date.daysInMonth ()); 77 selectDates( date , date.daysInMonth ());
78 78
79} 79}
80void DateNavigator::selectMonth() 80void DateNavigator::selectMonth()
81{ 81{
82 82
83 QDate date =mSelectedDates.first(); 83 QDate date =mSelectedDates.first();
84 selectMonthByDate( date ); 84 selectMonthByDate( date );
85} 85}
86void DateNavigator::selectMonthFromMonthview()
87{
88
89 QDate date =mSelectedDates.first().addDays( 7 );
90 selectMonthByDate( date );
91}
86 92
87DateList DateNavigator::selectedDates() 93DateList DateNavigator::selectedDates()
88{ 94{
89 return mSelectedDates; 95 return mSelectedDates;
90} 96}
91 97
92int DateNavigator::datesCount() const 98int DateNavigator::datesCount() const
93{ 99{
94 return mSelectedDates.count(); 100 return mSelectedDates.count();
95} 101}
96 102
97void DateNavigator::selectDates( const DateList& dateList ) 103void DateNavigator::selectDates( const DateList& dateList )
98{ 104{
99 if (dateList.count() > 0) { 105 if (dateList.count() > 0) {
100 mSelectedDates = dateList; 106 mSelectedDates = dateList;
101 emitSelected(); 107 emitSelected();
102 } 108 }
103} 109}
104 110
105void DateNavigator::selectDate( const QDate &date ) 111void DateNavigator::selectDate( const QDate &date )
106{ 112{
107 QDate d = date; 113 QDate d = date;
108 114
109 if ( !d.isValid() ) { 115 if ( !d.isValid() ) {
110 d = QDate::currentDate(); 116 d = QDate::currentDate();
111 } 117 }
112 118
113 mSelectedDates.clear(); 119 mSelectedDates.clear();
114 mSelectedDates.append( d ); 120 mSelectedDates.append( d );
115 121
116 emitSelected(); 122 emitSelected();
117} 123}
118 124
119void DateNavigator::selectDates( int count ) 125void DateNavigator::selectDates( int count )
120{ 126{
121 127
122 QDate d = mSelectedDates.first(); 128 QDate d = mSelectedDates.first();
123 selectDates( d, count ); 129 selectDates( d, count );
124} 130}
125 131
126void DateNavigator::selectDates( const QDate &d, int count ) 132void DateNavigator::selectDates( const QDate &d, int count )
127{ 133{
128 DateList dates; 134 DateList dates;
129 135
130 int i; 136 int i;
131 for( i = 0; i < count; ++i ) { 137 for( i = 0; i < count; ++i ) {
132 dates.append( d.addDays( i ) ); 138 dates.append( d.addDays( i ) );
133 } 139 }
134 140
135 mSelectedDates = dates; 141 mSelectedDates = dates;
136 142
137 emitSelected(); 143 emitSelected();
138} 144}
139 145
140void DateNavigator::selectWeekByDay( int weekDay, const QDate &d ) 146void DateNavigator::selectWeekByDay( int weekDay, const QDate &d )
141{ 147{
142 // qDebug("selectWeekByDay( %d %s ", weekDay, d.toString().latin1()); 148 // qDebug("selectWeekByDay( %d %s ", weekDay, d.toString().latin1());
143 int dateCount = mSelectedDates.count(); 149 int dateCount = mSelectedDates.count();
144 bool weekStart = ( weekDay == KGlobal::locale()->weekStartDay() ); 150 bool weekStart = ( weekDay == KGlobal::locale()->weekStartDay() );
145 if ( weekDay == 1 && dateCount == 5 ) selectWorkWeek( d ); 151 if ( weekDay == 1 && dateCount == 5 ) selectWorkWeek( d );
146 else if ( weekStart && dateCount == 7 ) selectWeek( d ); 152 else if ( weekStart && dateCount == 7 ) selectWeek( d );
147 else selectDates( d, dateCount ); 153 else selectDates( d, dateCount );
148} 154}
149 155
@@ -197,104 +203,113 @@ void DateNavigator::selectWorkWeek( const QDate &d )
197{ 203{
198 int dayOfWeek = KOGlobals::self()->calendarSystem()->dayOfWeek( d ); 204 int dayOfWeek = KOGlobals::self()->calendarSystem()->dayOfWeek( d );
199 205
200 QDate firstDate = d.addDays( 1 - dayOfWeek ); 206 QDate firstDate = d.addDays( 1 - dayOfWeek );
201 207
202 int weekStart = KGlobal::locale()->weekStartDay(); 208 int weekStart = KGlobal::locale()->weekStartDay();
203 if ( weekStart != 1 && dayOfWeek >= weekStart ) { 209 if ( weekStart != 1 && dayOfWeek >= weekStart ) {
204 firstDate = firstDate.addDays( 7 ); 210 firstDate = firstDate.addDays( 7 );
205 } 211 }
206 212
207 selectDates( firstDate, 5 ); 213 selectDates( firstDate, 5 );
208} 214}
209 215
210void DateNavigator::selectTodayMonth() 216void DateNavigator::selectTodayMonth()
211{ 217{
212 QDate date = QDate::currentDate().addDays( 1-QDate::currentDate().day() ); 218 QDate date = QDate::currentDate().addDays( 1-QDate::currentDate().day() );
213 selectDates( date , date.daysInMonth ()); 219 selectDates( date , date.daysInMonth ());
214 220
215} 221}
216void DateNavigator::selectToday() 222void DateNavigator::selectToday()
217{ 223{
218 QDate d = QDate::currentDate(); 224 QDate d = QDate::currentDate();
219 225
220 int dateCount = mSelectedDates.count(); 226 int dateCount = mSelectedDates.count();
221 if ( dateCount == 5 && d.dayOfWeek() < 6 ) selectWorkWeek( d ); 227 if ( dateCount == 5 && d.dayOfWeek() < 6 ) selectWorkWeek( d );
222 else if ( dateCount == 7 ) selectWeek( d ); 228 else if ( dateCount == 7 ) selectWeek( d );
223 else selectDates( d, dateCount ); 229 else selectDates( d, dateCount );
224} 230}
225 231
226void DateNavigator::selectPreviousYear() 232void DateNavigator::selectPreviousYear()
227{ 233{
228 QDate firstSelected = mSelectedDates.first(); 234 QDate firstSelected = mSelectedDates.first();
229 int weekDay = firstSelected.dayOfWeek(); 235 int weekDay = firstSelected.dayOfWeek();
230 firstSelected = KOGlobals::self()->calendarSystem()->addYears( firstSelected, -1 ); 236 firstSelected = KOGlobals::self()->calendarSystem()->addYears( firstSelected, -1 );
231 237
232 selectWeekByDay( weekDay, firstSelected ); 238 selectWeekByDay( weekDay, firstSelected );
233} 239}
234 240
235void DateNavigator::selectPreviousMonth() 241void DateNavigator::selectPreviousMonth()
236{ 242{
237 QDate firstSelected = mSelectedDates.first(); 243 QDate firstSelected = mSelectedDates.first();
238 int weekDay = firstSelected.dayOfWeek(); 244 int weekDay = firstSelected.dayOfWeek();
239 firstSelected = KOGlobals::self()->calendarSystem()->addMonths( firstSelected, -1 ); 245 firstSelected = KOGlobals::self()->calendarSystem()->addMonths( firstSelected, -1 );
240 246
241 247
242 if ( mSelectedDates.first().day() == 1 && mSelectedDates.count() > 27 ) 248 if ( mSelectedDates.first().day() == 1 && mSelectedDates.count() > 27 )
243 selectMonthByDate( firstSelected ); 249 selectMonthByDate( firstSelected );
244 else 250 else
245 selectWeekByDay( weekDay, firstSelected ); 251 selectWeekByDay( weekDay, firstSelected );
246} 252}
247 253
248void DateNavigator::selectNextMonth() 254void DateNavigator::selectNextMonth()
249{ 255{
250 QDate firstSelected = mSelectedDates.first(); 256 QDate firstSelected = mSelectedDates.first();
251 int weekDay = firstSelected.dayOfWeek(); 257 int weekDay = firstSelected.dayOfWeek();
252 258
253 firstSelected = KOGlobals::self()->calendarSystem()->addMonths( firstSelected, 1 ); 259 firstSelected = KOGlobals::self()->calendarSystem()->addMonths( firstSelected, 1 );
254 260
255 if ( mSelectedDates.first().day() == 1 && mSelectedDates.count() > 27 ) 261 if ( mSelectedDates.first().day() == 1 && mSelectedDates.count() > 27 )
256 selectMonthByDate( firstSelected ); 262 selectMonthByDate( firstSelected );
257 else 263 else
258 selectWeekByDay( weekDay, firstSelected ); 264 selectWeekByDay( weekDay, firstSelected );
259 265
260} 266}
267void DateNavigator::selectPreviousWeek()
268{
269 selectDates( mSelectedDates.first().addDays( -7 ), datesCount() );
270}
271
272void DateNavigator::selectNextWeek()
273{
274 selectDates( mSelectedDates.first().addDays( 7 ), datesCount() );
275}
261 276
262void DateNavigator::selectNextYear() 277void DateNavigator::selectNextYear()
263{ 278{
264 QDate firstSelected = mSelectedDates.first(); 279 QDate firstSelected = mSelectedDates.first();
265 int weekDay = firstSelected.dayOfWeek(); 280 int weekDay = firstSelected.dayOfWeek();
266 firstSelected = KOGlobals::self()->calendarSystem()->addYears( firstSelected, 1 ); 281 firstSelected = KOGlobals::self()->calendarSystem()->addYears( firstSelected, 1 );
267 282
268 selectWeekByDay( weekDay, firstSelected ); 283 selectWeekByDay( weekDay, firstSelected );
269} 284}
270 285
271void DateNavigator::selectPrevious() 286void DateNavigator::selectPrevious()
272{ 287{
273 int offset = -7; 288 int offset = -7;
274 if ( datesCount() == 1 ) { 289 if ( datesCount() == 1 ) {
275 offset = -1; 290 offset = -1;
276 } 291 }
277 if ( mViewManager ) 292 if ( mViewManager )
278 if ( mViewManager->showsNextDays() ) 293 if ( mViewManager->showsNextDays() )
279 offset = -datesCount(); 294 offset = -datesCount();
280 selectDates( mSelectedDates.first().addDays( offset ), datesCount() ); 295 selectDates( mSelectedDates.first().addDays( offset ), datesCount() );
281} 296}
282 297
283void DateNavigator::selectNext() 298void DateNavigator::selectNext()
284{ 299{
285 int offset = 7; 300 int offset = 7;
286 if ( datesCount() == 1 ) { 301 if ( datesCount() == 1 ) {
287 offset = 1; 302 offset = 1;
288 } 303 }
289 if ( mViewManager ) 304 if ( mViewManager )
290 if ( mViewManager->showsNextDays() ) 305 if ( mViewManager->showsNextDays() )
291 offset = datesCount(); 306 offset = datesCount();
292 selectDates( mSelectedDates.first().addDays( offset ), datesCount() ); 307 selectDates( mSelectedDates.first().addDays( offset ), datesCount() );
293} 308}
294 309
295void DateNavigator::emitSelected() 310void DateNavigator::emitSelected()
296{ 311{
297 emit datesSelected( mSelectedDates ); 312 emit datesSelected( mSelectedDates );
298} 313}
299 314
300//#include "datenavigator.moc" 315//#include "datenavigator.moc"
diff --git a/korganizer/datenavigator.h b/korganizer/datenavigator.h
index 4265e84..9742d41 100644
--- a/korganizer/datenavigator.h
+++ b/korganizer/datenavigator.h
@@ -6,86 +6,89 @@
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 DATENAVIGATOR_H 23#ifndef DATENAVIGATOR_H
24#define DATENAVIGATOR_H 24#define DATENAVIGATOR_H
25 25
26#include <libkcal/incidencebase.h> 26#include <libkcal/incidencebase.h>
27 27
28#include <qobject.h> 28#include <qobject.h>
29#include "koviewmanager.h" 29#include "koviewmanager.h"
30 30
31/** 31/**
32 This class controls date navigation. All requests to move the views to another 32 This class controls date navigation. All requests to move the views to another
33 date are sent to the DateNavigator. The DateNavigator processes the new 33 date are sent to the DateNavigator. The DateNavigator processes the new
34 selection of dates and emits the required signals for the views. 34 selection of dates and emits the required signals for the views.
35*/ 35*/
36class DateNavigator : public QObject 36class DateNavigator : public QObject
37{ 37{
38 Q_OBJECT 38 Q_OBJECT
39 public: 39 public:
40 DateNavigator( QObject *parent = 0, const char *name = 0 , KOViewManager * v = 0); 40 DateNavigator( QObject *parent = 0, const char *name = 0 , KOViewManager * v = 0);
41 ~DateNavigator(); 41 ~DateNavigator();
42 42
43 KCal::DateList selectedDates(); 43 KCal::DateList selectedDates();
44 44
45 int datesCount() const; 45 int datesCount() const;
46 46
47 public slots: 47 public slots:
48 void selectDates( const KCal::DateList & ); 48 void selectDates( const KCal::DateList & );
49 void selectDate( const QDate & ); 49 void selectDate( const QDate & );
50 50
51 void selectDates( int count ); 51 void selectDates( int count );
52 void selectDates( const QDate &, int count ); 52 void selectDates( const QDate &, int count );
53 53
54 void selectWeek(); 54 void selectWeek();
55 void selectWeek( int weeknum ); 55 void selectWeek( int weeknum );
56 void selectWeekFromMonthView( int weeknum ); 56 void selectWeekFromMonthView( int weeknum );
57 void selectWeek( const QDate & ); 57 void selectWeek( const QDate & );
58 58
59 void selectWorkWeek(); 59 void selectWorkWeek();
60 void selectWorkWeek( const QDate & ); 60 void selectWorkWeek( const QDate & );
61 61
62 void selectWeekByDay( int weekDay, const QDate & ); 62 void selectWeekByDay( int weekDay, const QDate & );
63 63
64 void selectToday(); 64 void selectToday();
65 void selectTodayMonth(); 65 void selectTodayMonth();
66 66
67 void selectPreviousYear(); 67 void selectPreviousYear();
68 void selectPreviousMonth(); 68 void selectPreviousMonth();
69 void selectNextMonth(); 69 void selectNextMonth();
70 void selectPreviousWeek();
71 void selectNextWeek();
70 void selectNextYear(); 72 void selectNextYear();
71 73
72 void selectMonth(); 74 void selectMonth();
75 void selectMonthFromMonthview();
73 void selectMonthByDate( const QDate & ); 76 void selectMonthByDate( const QDate & );
74 77
75 void selectPrevious(); 78 void selectPrevious();
76 void selectNext(); 79 void selectNext();
77 void slotMonthSelect( int ); 80 void slotMonthSelect( int );
78 void slotDaySelect( QDate d ); 81 void slotDaySelect( QDate d );
79 82
80 signals: 83 signals:
81 void datesSelected( const KCal::DateList & ); 84 void datesSelected( const KCal::DateList & );
82 85
83 protected: 86 protected:
84 void emitSelected(); 87 void emitSelected();
85 88
86 private: 89 private:
87 KOViewManager * mViewManager; 90 KOViewManager * mViewManager;
88 KCal::DateList mSelectedDates; 91 KCal::DateList mSelectedDates;
89}; 92};
90 93
91#endif 94#endif
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index d0380e3..f9bc1ca 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -889,140 +889,142 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
889 SLOT( defaultAction( Incidence * ) ) ); 889 SLOT( defaultAction( Incidence * ) ) );
890 connect( cell, SIGNAL( newEventSignal( QDateTime ) ), 890 connect( cell, SIGNAL( newEventSignal( QDateTime ) ),
891 SIGNAL( newEventSignal( QDateTime ) ) ); 891 SIGNAL( newEventSignal( QDateTime ) ) );
892 connect( cell, SIGNAL( showDaySignal( QDate ) ), 892 connect( cell, SIGNAL( showDaySignal( QDate ) ),
893 SIGNAL( showDaySignal( QDate ) ) ); 893 SIGNAL( showDaySignal( QDate ) ) );
894 } 894 }
895 } 895 }
896 mCellsW.resize( mDaysPerWeek ); 896 mCellsW.resize( mDaysPerWeek );
897 for( col = 0; col < mDaysPerWeek; ++col ) { 897 for( col = 0; col < mDaysPerWeek; ++col ) {
898 MonthViewCell *cell = new MonthViewCell( this, mWeekView ); 898 MonthViewCell *cell = new MonthViewCell( this, mWeekView );
899 mCellsW.insert( col, cell ); 899 mCellsW.insert( col, cell );
900 900
901 connect( cell, SIGNAL( defaultAction( Incidence * ) ), 901 connect( cell, SIGNAL( defaultAction( Incidence * ) ),
902 SLOT( defaultAction( Incidence * ) ) ); 902 SLOT( defaultAction( Incidence * ) ) );
903 connect( cell, SIGNAL( newEventSignal( QDateTime ) ), 903 connect( cell, SIGNAL( newEventSignal( QDateTime ) ),
904 SIGNAL( newEventSignal( QDateTime ) ) ); 904 SIGNAL( newEventSignal( QDateTime ) ) );
905 connect( cell, SIGNAL( showDaySignal( QDate ) ), 905 connect( cell, SIGNAL( showDaySignal( QDate ) ),
906 SIGNAL( showDaySignal( QDate ) ) ); 906 SIGNAL( showDaySignal( QDate ) ) );
907 cell->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont ); 907 cell->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont );
908 } 908 }
909 909
910 //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) ); 910 //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) );
911 mContextMenu = eventPopup(); 911 mContextMenu = eventPopup();
912 // updateConfig(); //useless here... 912 // updateConfig(); //useless here...
913 // ... but we need mWidthLongDayLabel computed 913 // ... but we need mWidthLongDayLabel computed
914 QFontMetrics fontmetric(mDayLabels[0]->font()); 914 QFontMetrics fontmetric(mDayLabels[0]->font());
915 mWidthLongDayLabel = 0; 915 mWidthLongDayLabel = 0;
916 for (int i = 0; i < 7; i++) { 916 for (int i = 0; i < 7; i++) {
917 int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); 917 int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1));
918 if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; 918 if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width;
919 } 919 }
920 920
921 //mWeekLabels[mNumWeeks]->setText( i18n("W")); 921 //mWeekLabels[mNumWeeks]->setText( i18n("W"));
922 922
923#if 0 923#if 0
924 if ( mShowWeekView ) 924 if ( mShowWeekView )
925 mWidStack->raiseWidget( mWeekView ); 925 mWidStack->raiseWidget( mWeekView );
926 else 926 else
927 mWidStack->raiseWidget( mMonthView ); 927 mWidStack->raiseWidget( mMonthView );
928#endif 928#endif
929 929
930 emit incidenceSelected( 0 ); 930 emit incidenceSelected( 0 );
931#ifndef DESKTOP_VERSION 931#ifndef DESKTOP_VERSION
932 resize( QApplication::desktop()->size() ); 932 resize( QApplication::desktop()->size() );
933#else 933#else
934 resize(640, 480 ); 934 resize(640, 480 );
935 updatePossible = true; 935 updatePossible = true;
936#endif 936#endif
937 computeLayout(); 937 computeLayout();
938 938
939 if ( mShowWeekView ) 939 if ( mShowWeekView )
940 mWidStack->raiseWidget( mWeekView ); 940 mWidStack->raiseWidget( mWeekView );
941 else 941 else
942 mWidStack->raiseWidget( mMonthView ); 942 mWidStack->raiseWidget( mMonthView );
943} 943}
944 944
945KOMonthView::~KOMonthView() 945KOMonthView::~KOMonthView()
946{ 946{
947 delete mContextMenu; 947 delete mContextMenu;
948} 948}
949 949
950void KOMonthView::selectInternalWeekNum ( int n ) 950void KOMonthView::selectInternalWeekNum ( int n )
951{ 951{
952 switchView(); 952 switchView();
953 if ( !KOPrefs::instance()->mMonthViewWeek )
954 emit selectMonth ();
955 else
953 emit selectWeekNum ( n ); 956 emit selectWeekNum ( n );
954} 957}
955 958
956int KOMonthView::currentWeek() 959int KOMonthView::currentWeek()
957{ 960{
958 if ( mShowWeekView ) 961 if ( mShowWeekView )
959 return mWeekLabelsW[0]->getWeekNum(); 962 return mWeekLabelsW[0]->getWeekNum();
960 return mWeekLabels[0]->getWeekNum(); 963 return mWeekLabels[0]->getWeekNum();
961} 964}
962void KOMonthView::switchView() 965void KOMonthView::switchView()
963{ 966{
964
965 if ( selectedCell( ) ) 967 if ( selectedCell( ) )
966 selectedCell()->deselect(); 968 selectedCell()->deselect();
967 mShowWeekView = !mShowWeekView; 969 mShowWeekView = !mShowWeekView;
968 KOPrefs::instance()->mMonthViewWeek = mShowWeekView; 970 KOPrefs::instance()->mMonthViewWeek = mShowWeekView;
969 if ( clPending ) { 971 if ( clPending ) {
970 computeLayout(); 972 computeLayout();
971 updateConfig(); 973 updateConfig();
972 } 974 }
973 if ( mShowWeekView ) 975 if ( mShowWeekView )
974 mWidStack->raiseWidget( mWeekView ); 976 mWidStack->raiseWidget( mWeekView );
975 else 977 else
976 mWidStack->raiseWidget( mMonthView ); 978 mWidStack->raiseWidget( mMonthView );
977 clPending = false; 979 clPending = false;
978} 980}
979 981
980int KOMonthView::maxDatesHint() 982int KOMonthView::maxDatesHint()
981{ 983{
982 return mNumCells; 984 return mNumCells;
983} 985}
984 986
985int KOMonthView::currentDateCount() 987int KOMonthView::currentDateCount()
986{ 988{
987 return mNumCells; 989 return mNumCells;
988} 990}
989 991
990QPtrList<Incidence> KOMonthView::selectedIncidences() 992QPtrList<Incidence> KOMonthView::selectedIncidences()
991{ 993{
992 QPtrList<Incidence> selected; 994 QPtrList<Incidence> selected;
993 995
994 if ( mSelectedCell ) { 996 if ( mSelectedCell ) {
995 Incidence *incidence = mSelectedCell->selectedIncidence(); 997 Incidence *incidence = mSelectedCell->selectedIncidence();
996 if ( incidence ) selected.append( incidence ); 998 if ( incidence ) selected.append( incidence );
997 } 999 }
998 1000
999 return selected; 1001 return selected;
1000} 1002}
1001 1003
1002DateList KOMonthView::selectedDates() 1004DateList KOMonthView::selectedDates()
1003{ 1005{
1004 DateList selected; 1006 DateList selected;
1005 1007
1006 if ( mSelectedCell ) { 1008 if ( mSelectedCell ) {
1007 QDate qd = mSelectedCell->selectedIncidenceDate(); 1009 QDate qd = mSelectedCell->selectedIncidenceDate();
1008 if ( qd.isValid() ) selected.append( qd ); 1010 if ( qd.isValid() ) selected.append( qd );
1009 } 1011 }
1010 1012
1011 return selected; 1013 return selected;
1012} 1014}
1013 1015
1014void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd, 1016void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd,
1015 const QDate &td) 1017 const QDate &td)
1016{ 1018{
1017#ifndef KORG_NOPRINTER 1019#ifndef KORG_NOPRINTER
1018 calPrinter->preview(CalPrinter::Month, fd, td); 1020 calPrinter->preview(CalPrinter::Month, fd, td);
1019#endif 1021#endif
1020} 1022}
1021 1023
1022void KOMonthView::updateConfig() 1024void KOMonthView::updateConfig()
1023{ 1025{
1024 1026
1025 mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); 1027 mWeekStartsMonday = KGlobal::locale()->weekStartsMonday();
1026 1028
1027 if ( mShowWeekView ) { 1029 if ( mShowWeekView ) {
1028 mWeekStartsMonday = true; 1030 mWeekStartsMonday = true;
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h
index 03f9dc6..2f6f5dc 100644
--- a/korganizer/komonthview.h
+++ b/korganizer/komonthview.h
@@ -182,117 +182,118 @@ class MonthViewCell : public QWidget
182 QDate mDate; 182 QDate mDate;
183 bool mPrimary; 183 bool mPrimary;
184 bool mHoliday; 184 bool mHoliday;
185 QString mHolidayString; 185 QString mHolidayString;
186 186
187 //QLabel *mLabel; 187 //QLabel *mLabel;
188 QPushButton *mLabel; 188 QPushButton *mLabel;
189 QListBox *mItemList; 189 QListBox *mItemList;
190#ifdef DESKTOP_VERSION 190#ifdef DESKTOP_VERSION
191 static QToolTipGroup *mToolTipGroup; 191 static QToolTipGroup *mToolTipGroup;
192#endif 192#endif
193 QSize mLabelSize; 193 QSize mLabelSize;
194 QSize mLabelBigSize; 194 QSize mLabelBigSize;
195 QPalette mHolidayPalette; 195 QPalette mHolidayPalette;
196 QPalette mStandardPalette; 196 QPalette mStandardPalette;
197 QPalette mPrimaryPalette; 197 QPalette mPrimaryPalette;
198 QPalette mNonPrimaryPalette; 198 QPalette mNonPrimaryPalette;
199 void setMyPalette(); 199 void setMyPalette();
200 QPalette getPalette (); 200 QPalette getPalette ();
201 void keyPressEvent ( QKeyEvent * ) ; 201 void keyPressEvent ( QKeyEvent * ) ;
202 202
203}; 203};
204 204
205 205
206class KOMonthView: public KOEventView 206class KOMonthView: public KOEventView
207{ 207{
208 Q_OBJECT 208 Q_OBJECT
209 public: 209 public:
210 KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 ); 210 KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 );
211 ~KOMonthView(); 211 ~KOMonthView();
212 212
213 /** Returns maximum number of days supported by the komonthview */ 213 /** Returns maximum number of days supported by the komonthview */
214 virtual int maxDatesHint(); 214 virtual int maxDatesHint();
215 215
216 /** Returns number of currently shown dates. */ 216 /** Returns number of currently shown dates. */
217 virtual int currentDateCount(); 217 virtual int currentDateCount();
218 218
219 /** returns the currently selected events */ 219 /** returns the currently selected events */
220 virtual QPtrList<Incidence> selectedIncidences(); 220 virtual QPtrList<Incidence> selectedIncidences();
221 221
222 /** returns dates of the currently selected events */ 222 /** returns dates of the currently selected events */
223 virtual DateList selectedDates(); 223 virtual DateList selectedDates();
224 224
225 virtual void printPreview(CalPrinter *calPrinter, 225 virtual void printPreview(CalPrinter *calPrinter,
226 const QDate &, const QDate &); 226 const QDate &, const QDate &);
227 bool isMonthView() { return true; } 227 bool isMonthView() { return true; }
228 bool isUpdatePossible() { return updatePossible; } 228 bool isUpdatePossible() { return updatePossible; }
229 229
230 MonthViewCell * selectedCell(); 230 MonthViewCell * selectedCell();
231 bool skipResize; 231 bool skipResize;
232 NavigatorBar* navigatorBar() { return mNavigatorBar ;} 232 NavigatorBar* navigatorBar() { return mNavigatorBar ;}
233 public slots: 233 public slots:
234 virtual void updateView(); 234 virtual void updateView();
235 virtual void updateConfig(); 235 virtual void updateConfig();
236 virtual void showDates(const QDate &start, const QDate &end); 236 virtual void showDates(const QDate &start, const QDate &end);
237 virtual void showEvents(QPtrList<Event> eventList); 237 virtual void showEvents(QPtrList<Event> eventList);
238 238
239 void changeEventDisplay(Event *, int); 239 void changeEventDisplay(Event *, int);
240 240
241 void clearSelection(); 241 void clearSelection();
242 242
243 void showContextMenu( Incidence * ); 243 void showContextMenu( Incidence * );
244 244
245 void setSelectedCell( MonthViewCell * ); 245 void setSelectedCell( MonthViewCell * );
246 void switchView();
246 247
247 protected slots: 248 protected slots:
248 void selectInternalWeekNum ( int ); 249 void selectInternalWeekNum ( int );
249 void switchView();
250 void processSelectionChange(); 250 void processSelectionChange();
251 signals: 251 signals:
252 void nextMonth(); 252 void nextMonth();
253 void prevMonth(); 253 void prevMonth();
254 void selectWeekNum ( int ); 254 void selectWeekNum ( int );
255 void selectMonth ();
255 void showDaySignal( QDate ); 256 void showDaySignal( QDate );
256 protected: 257 protected:
257 void resizeEvent(QResizeEvent *); 258 void resizeEvent(QResizeEvent *);
258 void viewChanged(); 259 void viewChanged();
259 void updateDayLabels(); 260 void updateDayLabels();
260 261
261 private: 262 private:
262 NavigatorBar* mNavigatorBar; 263 NavigatorBar* mNavigatorBar;
263 int currentWeek(); 264 int currentWeek();
264 bool clPending; 265 bool clPending;
265 QWidgetStack * mWidStack; 266 QWidgetStack * mWidStack;
266 QWidget* mMonthView; 267 QWidget* mMonthView;
267 QWidget* mWeekView; 268 QWidget* mWeekView;
268 bool mShowWeekView; 269 bool mShowWeekView;
269 bool updatePossible; 270 bool updatePossible;
270 int mDaysPerWeek; 271 int mDaysPerWeek;
271 int mNumWeeks; 272 int mNumWeeks;
272 int mNumCells; 273 int mNumCells;
273 bool mWeekStartsMonday; 274 bool mWeekStartsMonday;
274 bool mShowSatSunComp; 275 bool mShowSatSunComp;
275 void computeLayout(); 276 void computeLayout();
276 void computeLayoutWeek(); 277 void computeLayoutWeek();
277 278
278 QPtrVector<MonthViewCell> mCells; 279 QPtrVector<MonthViewCell> mCells;
279 QPtrVector<QLabel> mDayLabels; 280 QPtrVector<QLabel> mDayLabels;
280 QPtrVector<KOWeekButton> mWeekLabels; 281 QPtrVector<KOWeekButton> mWeekLabels;
281 QPtrVector<MonthViewCell> mCellsW; 282 QPtrVector<MonthViewCell> mCellsW;
282 QPtrVector<QLabel> mDayLabelsW; 283 QPtrVector<QLabel> mDayLabelsW;
283 QPtrVector<KOWeekButton> mWeekLabelsW; 284 QPtrVector<KOWeekButton> mWeekLabelsW;
284 285
285 bool mShortDayLabelsM; 286 bool mShortDayLabelsM;
286 bool mShortDayLabelsW; 287 bool mShortDayLabelsW;
287 int mWidthLongDayLabel; 288 int mWidthLongDayLabel;
288 289
289 QDate mStartDate; 290 QDate mStartDate;
290 291
291 MonthViewCell *mSelectedCell; 292 MonthViewCell *mSelectedCell;
292 293
293 KOEventPopupMenu *mContextMenu; 294 KOEventPopupMenu *mContextMenu;
294 void keyPressEvent ( QKeyEvent * ) ; 295 void keyPressEvent ( QKeyEvent * ) ;
295 296
296}; 297};
297 298
298#endif 299#endif
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index 7efb6a6..5efc247 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -14,128 +14,129 @@
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <time.h> 24#include <time.h>
25#ifndef _WIN32_ 25#ifndef _WIN32_
26#include <unistd.h> 26#include <unistd.h>
27#endif 27#endif
28#include <qdir.h> 28#include <qdir.h>
29#include <qtextstream.h> 29#include <qtextstream.h>
30#include <qtextcodec.h> 30#include <qtextcodec.h>
31#include <qstring.h> 31#include <qstring.h>
32#include <qregexp.h> 32#include <qregexp.h>
33#include <qfont.h> 33#include <qfont.h>
34#include <qcolor.h> 34#include <qcolor.h>
35#include <qstringlist.h> 35#include <qstringlist.h>
36#include <stdlib.h> 36#include <stdlib.h>
37 37
38#include <kglobal.h> 38#include <kglobal.h>
39#include <kglobalsettings.h> 39#include <kglobalsettings.h>
40#include <kconfig.h> 40#include <kconfig.h>
41#include <klocale.h> 41#include <klocale.h>
42#include <kdebug.h> 42#include <kdebug.h>
43#include <kemailsettings.h> 43#include <kemailsettings.h>
44#include <kstaticdeleter.h> 44#include <kstaticdeleter.h>
45#include <libkdepim/kpimglobalprefs.h> 45#include <libkdepim/kpimglobalprefs.h>
46 46
47#include "koprefs.h" 47#include "koprefs.h"
48#include "mainwindow.h" 48#include "mainwindow.h"
49 49
50KOPrefs *KOPrefs::mInstance = 0; 50KOPrefs *KOPrefs::mInstance = 0;
51static KStaticDeleter<KOPrefs> insd; 51static KStaticDeleter<KOPrefs> insd;
52 52
53KOPrefs::KOPrefs() : 53KOPrefs::KOPrefs() :
54 KPimPrefs("korganizerrc") 54 KPimPrefs("korganizerrc")
55{ 55{
56 mCategoryColors.setAutoDelete(true); 56 mCategoryColors.setAutoDelete(true);
57 fillMailDefaults(); 57 fillMailDefaults();
58 mDefaultCategoryColor = QColor(175,210,255);//196,196,196); 58 mDefaultCategoryColor = QColor(175,210,255);//196,196,196);
59 QColor defaultHolidayColor = QColor(255,0,0); 59 QColor defaultHolidayColor = QColor(255,0,0);
60 QColor defaultHighlightColor = QColor(129,112,255);//64,64,255); 60 QColor defaultHighlightColor = QColor(129,112,255);//64,64,255);
61 QColor defaultAgendaBgColor = QColor(239,241,169);//128,128,128); 61 QColor defaultAgendaBgColor = QColor(239,241,169);//128,128,128);
62 QColor defaultWorkingHoursColor = QColor(170,223,150);//160,160,160); 62 QColor defaultWorkingHoursColor = QColor(170,223,150);//160,160,160);
63 QColor defaultTodoDueTodayColor = QColor(255,220,100); 63 QColor defaultTodoDueTodayColor = QColor(255,220,100);
64 QColor defaultTodoOverdueColor = QColor(255,153,125); 64 QColor defaultTodoOverdueColor = QColor(255,153,125);
65 65
66 66
67 KPrefs::setCurrentGroup("General"); 67 KPrefs::setCurrentGroup("General");
68 68
69 69
70 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); 70 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false);
71 71
72 addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true); 72 addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true);
73 addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true); 73 addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true);
74 addItemBool("ShowIconSearch",&mShowIconSearch,true); 74 addItemBool("ShowIconSearch",&mShowIconSearch,true);
75 addItemBool("ShowIconList",&mShowIconList,true); 75 addItemBool("ShowIconList",&mShowIconList,true);
76 addItemBool("ShowIconDay1",&mShowIconDay1,true); 76 addItemBool("ShowIconDay1",&mShowIconDay1,true);
77 addItemBool("ShowIconDay5",&mShowIconDay5,true); 77 addItemBool("ShowIconDay5",&mShowIconDay5,true);
78 addItemBool("ShowIconDay6",&mShowIconDay6,true);
78 addItemBool("ShowIconDay7",&mShowIconDay7,true); 79 addItemBool("ShowIconDay7",&mShowIconDay7,true);
79 addItemBool("ShowIconMonth",&mShowIconMonth,true); 80 addItemBool("ShowIconMonth",&mShowIconMonth,true);
80 addItemBool("ShowIconTodoview",&mShowIconTodoview,true); 81 addItemBool("ShowIconTodoview",&mShowIconTodoview,true);
81 addItemBool("ShowIconBackFast",&mShowIconBackFast,true); 82 addItemBool("ShowIconBackFast",&mShowIconBackFast,true);
82 addItemBool("ShowIconBack",&mShowIconBack,true); 83 addItemBool("ShowIconBack",&mShowIconBack,true);
83 addItemBool("ShowIconToday",&mShowIconToday,true); 84 addItemBool("ShowIconToday",&mShowIconToday,true);
84 addItemBool("ShowIconForward",&mShowIconForward,true); 85 addItemBool("ShowIconForward",&mShowIconForward,true);
85 addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true); 86 addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true);
86 addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,true); 87 addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,true);
87 addItemBool("ShowIconNextDays",&mShowIconNextDays,true); 88 addItemBool("ShowIconNextDays",&mShowIconNextDays,true);
88 addItemBool("ShowIconNext",&mShowIconNext,true); 89 addItemBool("ShowIconNext",&mShowIconNext,true);
89 addItemBool("ShowIconJournal",&mShowIconJournal,true); 90 addItemBool("ShowIconJournal",&mShowIconJournal,true);
90 addItemBool("ShowIconStretch",&mShowIconStretch,true); 91 addItemBool("ShowIconStretch",&mShowIconStretch,true);
91 addItemInt("LastLoadedLanguage",&mOldLanguage,0); 92 addItemInt("LastLoadedLanguage",&mOldLanguage,0);
92 93
93 addItemBool("AskForQuit",&mAskForQuit,false); 94 addItemBool("AskForQuit",&mAskForQuit,false);
94 95
95#ifndef DESKTOP_VERSION 96#ifndef DESKTOP_VERSION
96 addItemBool("ShowFullMenu",&mShowFullMenu,false); 97 addItemBool("ShowFullMenu",&mShowFullMenu,false);
97#else 98#else
98 addItemBool("ShowFullMenu",&mShowFullMenu,true); 99 addItemBool("ShowFullMenu",&mShowFullMenu,true);
99#endif 100#endif
100 addItemBool("ToolBarHor",&mToolBarHor, true ); 101 addItemBool("ToolBarHor",&mToolBarHor, true );
101 addItemBool("ToolBarUp",&mToolBarUp, false ); 102 addItemBool("ToolBarUp",&mToolBarUp, false );
102 addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false ); 103 addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false );
103 addItemInt("Whats Next Days",&mWhatsNextDays,3); 104 addItemInt("Whats Next Days",&mWhatsNextDays,3);
104 addItemInt("Whats Next Prios",&mWhatsNextPrios,1); 105 addItemInt("Whats Next Prios",&mWhatsNextPrios,1);
105 106
106 addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true); 107 addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true);
107 addItemBool("ShowTimeInAgenda",&mShowTimeInAgenda,true); 108 addItemBool("ShowTimeInAgenda",&mShowTimeInAgenda,true);
108 addItemBool("HideNonStartedTodos",&mHideNonStartedTodos,false); 109 addItemBool("HideNonStartedTodos",&mHideNonStartedTodos,false);
109 addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true); 110 addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true);
110 addItemInt("AllDay Size",&mAllDaySize,28); 111 addItemInt("AllDay Size",&mAllDaySize,28);
111 QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav"; 112 QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav";
112 addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm ); 113 addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm );
113 114
114 addItemStringList("LocationDefaults",&mLocationDefaults ); 115 addItemStringList("LocationDefaults",&mLocationDefaults );
115 addItemStringList("EventSummary User",&mEventSummaryUser); 116 addItemStringList("EventSummary User",&mEventSummaryUser);
116 addItemStringList("TodoSummary User",&mTodoSummaryUser); 117 addItemStringList("TodoSummary User",&mTodoSummaryUser);
117 118
118 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); 119 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false);
119 addItemBool("Enable Project View",&mEnableProjectView,false); 120 addItemBool("Enable Project View",&mEnableProjectView,false);
120 addItemBool("Auto Save",&mAutoSave,false); 121 addItemBool("Auto Save",&mAutoSave,false);
121 addItemInt("Auto Save Interval",&mAutoSaveInterval,3); 122 addItemInt("Auto Save Interval",&mAutoSaveInterval,3);
122 addItemBool("Confirm Deletes",&mConfirm,true); 123 addItemBool("Confirm Deletes",&mConfirm,true);
123 addItemString("Archive File",&mArchiveFile); 124 addItemString("Archive File",&mArchiveFile);
124 addItemString("Html Export File",&mHtmlExportFile, 125 addItemString("Html Export File",&mHtmlExportFile,
125 QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html")); 126 QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html"));
126 addItemBool("Html With Save",&mHtmlWithSave,false); 127 addItemBool("Html With Save",&mHtmlWithSave,false);
127 128
128 KPrefs::setCurrentGroup("Personal Settings"); 129 KPrefs::setCurrentGroup("Personal Settings");
129 130
130 addItemInt("Mail Client",&mMailClient,MailClientKMail); 131 addItemInt("Mail Client",&mMailClient,MailClientKMail);
131 addItemBool("Use Control Center Email",&mEmailControlCenter,false); 132 addItemBool("Use Control Center Email",&mEmailControlCenter,false);
132 addItemBool("Bcc",&mBcc,false); 133 addItemBool("Bcc",&mBcc,false);
133 134
134 KPrefs::setCurrentGroup("Time & Date"); 135 KPrefs::setCurrentGroup("Time & Date");
135 136
136 137
137 addItemInt("Default Start Time",&mStartTime,10); 138 addItemInt("Default Start Time",&mStartTime,10);
138 addItemInt("Default Duration",&mDefaultDuration,2); 139 addItemInt("Default Duration",&mDefaultDuration,2);
139 addItemInt("Default Alarm Time",&mAlarmTime,3); 140 addItemInt("Default Alarm Time",&mAlarmTime,3);
140 KPrefs::setCurrentGroup("AlarmSettings"); 141 KPrefs::setCurrentGroup("AlarmSettings");
141 addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20); 142 addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20);
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h
index fa69d52..e300067 100644
--- a/korganizer/koprefs.h
+++ b/korganizer/koprefs.h
@@ -110,128 +110,129 @@ class KOPrefs : public KPimPrefs
110 QFont mMonthViewFont; 110 QFont mMonthViewFont;
111 QFont mAgendaViewFont; 111 QFont mAgendaViewFont;
112 QFont mMarcusBainsFont; 112 QFont mMarcusBainsFont;
113 QFont mTimeLabelsFont; 113 QFont mTimeLabelsFont;
114 QFont mTodoViewFont; 114 QFont mTodoViewFont;
115 QFont mListViewFont; 115 QFont mListViewFont;
116 QFont mDateNavigatorFont; 116 QFont mDateNavigatorFont;
117 QFont mEditBoxFont; 117 QFont mEditBoxFont;
118 QFont mJornalViewFont; 118 QFont mJornalViewFont;
119 QFont mWhatsNextFont; 119 QFont mWhatsNextFont;
120 QFont mEventViewFont; 120 QFont mEventViewFont;
121 121
122 122
123 123
124 124
125 QColor mHolidayColor; 125 QColor mHolidayColor;
126 QColor mHighlightColor; 126 QColor mHighlightColor;
127 QColor mEventColor; 127 QColor mEventColor;
128 QColor mTodoDoneColor; 128 QColor mTodoDoneColor;
129 QColor mAgendaBgColor; 129 QColor mAgendaBgColor;
130 QColor mWorkingHoursColor; 130 QColor mWorkingHoursColor;
131 QColor mTodoDueTodayColor; 131 QColor mTodoDueTodayColor;
132 QColor mTodoOverdueColor; 132 QColor mTodoOverdueColor;
133 QColor mMonthViewEvenColor; 133 QColor mMonthViewEvenColor;
134 QColor mMonthViewOddColor; 134 QColor mMonthViewOddColor;
135 QColor mMonthViewHolidayColor; 135 QColor mMonthViewHolidayColor;
136 bool mMonthViewUsesDayColors; 136 bool mMonthViewUsesDayColors;
137 bool mMonthViewSatSunTog; 137 bool mMonthViewSatSunTog;
138 bool mMonthViewWeek; 138 bool mMonthViewWeek;
139 QColor mAppColor1; 139 QColor mAppColor1;
140 QColor mAppColor2; 140 QColor mAppColor2;
141 bool mUseAppColors; 141 bool mUseAppColors;
142 142
143 int mDayBegins; 143 int mDayBegins;
144 int mHourSize; 144 int mHourSize;
145 int mAllDaySize; 145 int mAllDaySize;
146 bool mShowFullMenu; 146 bool mShowFullMenu;
147 bool mDailyRecur; 147 bool mDailyRecur;
148 bool mWeeklyRecur; 148 bool mWeeklyRecur;
149 bool mMonthDailyRecur; 149 bool mMonthDailyRecur;
150 bool mMonthWeeklyRecur; 150 bool mMonthWeeklyRecur;
151 bool mMonthShowIcons; 151 bool mMonthShowIcons;
152 bool mMonthShowShort; 152 bool mMonthShowShort;
153 bool mEnableToolTips; 153 bool mEnableToolTips;
154 bool mEnableMonthScroll; 154 bool mEnableMonthScroll;
155 bool mFullViewMonth; 155 bool mFullViewMonth;
156 bool mMonthViewUsesCategoryColor; 156 bool mMonthViewUsesCategoryColor;
157 bool mFullViewTodo; 157 bool mFullViewTodo;
158 bool mShowCompletedTodo; 158 bool mShowCompletedTodo;
159 bool mMarcusBainsEnabled; 159 bool mMarcusBainsEnabled;
160 int mNextXDays; 160 int mNextXDays;
161 int mWhatsNextDays; 161 int mWhatsNextDays;
162 int mWhatsNextPrios; 162 int mWhatsNextPrios;
163 bool mEnableQuickTodo; 163 bool mEnableQuickTodo;
164 164
165 bool mCompactDialogs; 165 bool mCompactDialogs;
166 bool mVerticalScreen; 166 bool mVerticalScreen;
167 167
168 bool mShowIconNewTodo; 168 bool mShowIconNewTodo;
169 bool mShowIconNewEvent; 169 bool mShowIconNewEvent;
170 bool mShowIconSearch; 170 bool mShowIconSearch;
171 bool mShowIconList; 171 bool mShowIconList;
172 bool mShowIconDay1; 172 bool mShowIconDay1;
173 bool mShowIconDay5; 173 bool mShowIconDay5;
174 bool mShowIconDay6;
174 bool mShowIconDay7; 175 bool mShowIconDay7;
175 bool mShowIconMonth; 176 bool mShowIconMonth;
176 bool mShowIconTodoview; 177 bool mShowIconTodoview;
177 bool mShowIconBackFast; 178 bool mShowIconBackFast;
178 bool mShowIconBack; 179 bool mShowIconBack;
179 bool mShowIconToday; 180 bool mShowIconToday;
180 bool mShowIconForward; 181 bool mShowIconForward;
181 bool mShowIconForwardFast; 182 bool mShowIconForwardFast;
182 bool mShowIconWhatsThis; 183 bool mShowIconWhatsThis;
183 bool mShowIconNextDays; 184 bool mShowIconNextDays;
184 bool mShowIconNext; 185 bool mShowIconNext;
185 bool mShowIconJournal; 186 bool mShowIconJournal;
186 187
187 bool mShowIconStretch; 188 bool mShowIconStretch;
188 189
189 bool mToolBarHor; 190 bool mToolBarHor;
190 bool mToolBarUp; 191 bool mToolBarUp;
191 bool mToolBarMiniIcons; 192 bool mToolBarMiniIcons;
192 193
193 bool mAskForQuit; 194 bool mAskForQuit;
194 bool mUsePassWd; 195 bool mUsePassWd;
195 bool mShowSyncEvents; 196 bool mShowSyncEvents;
196 bool mShowTodoInAgenda; 197 bool mShowTodoInAgenda;
197 bool mShowTimeInAgenda; 198 bool mShowTimeInAgenda;
198 bool mHideNonStartedTodos; 199 bool mHideNonStartedTodos;
199 200
200 int mLastSyncTime; 201 int mLastSyncTime;
201 void setCategoryColor(QString cat,const QColor & color); 202 void setCategoryColor(QString cat,const QColor & color);
202 QColor *categoryColor(QString cat); 203 QColor *categoryColor(QString cat);
203 204
204 QString mArchiveFile; 205 QString mArchiveFile;
205 QString mHtmlExportFile; 206 QString mHtmlExportFile;
206 bool mHtmlWithSave; 207 bool mHtmlWithSave;
207 208
208 QStringList mSelectedPlugins; 209 QStringList mSelectedPlugins;
209 210
210 QString mLastImportFile; 211 QString mLastImportFile;
211 QString mLastVcalFile; 212 QString mLastVcalFile;
212 QString mLastSaveFile; 213 QString mLastSaveFile;
213 QString mLastLoadFile; 214 QString mLastLoadFile;
214 215
215 216
216 QString mDefaultAlarmFile; 217 QString mDefaultAlarmFile;
217 int mIMIPScheduler; 218 int mIMIPScheduler;
218 int mIMIPSend; 219 int mIMIPSend;
219 QStringList mAdditionalMails; 220 QStringList mAdditionalMails;
220 int mIMIPAutoRefresh; 221 int mIMIPAutoRefresh;
221 int mIMIPAutoInsertReply; 222 int mIMIPAutoInsertReply;
222 int mIMIPAutoInsertRequest; 223 int mIMIPAutoInsertRequest;
223 int mIMIPAutoFreeBusy; 224 int mIMIPAutoFreeBusy;
224 int mIMIPAutoFreeBusyReply; 225 int mIMIPAutoFreeBusyReply;
225 226
226 QStringList mTodoTemplates; 227 QStringList mTodoTemplates;
227 QStringList mEventTemplates; 228 QStringList mEventTemplates;
228 229
229 int mDestination; 230 int mDestination;
230 231
231 232
232 bool mEditOnDoubleClick; 233 bool mEditOnDoubleClick;
233 bool mViewChangeHoldFullscreen; 234 bool mViewChangeHoldFullscreen;
234 bool mViewChangeHoldNonFullscreen; 235 bool mViewChangeHoldNonFullscreen;
235 bool mCenterOnCurrentTime; 236 bool mCenterOnCurrentTime;
236 bool mSetTimeToDayStartAt; 237 bool mSetTimeToDayStartAt;
237 bool mHighlightCurrentDay; 238 bool mHighlightCurrentDay;
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index f8f6c1d..e22f096 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -27,247 +27,253 @@
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") showMonthView(); 91 else if (view == "Month") {
92 if ( KOPrefs::instance()->mMonthViewWeek )
93 showMonthView();
94 else
95 showMonthViewWeek();
96 }
92 else if (view == "List") showListView(); 97 else if (view == "List") showListView();
93 else if (view == "Journal") showJournalView(); 98 else if (view == "Journal") showJournalView();
94 else if (view == "TimeSpan") showTimeSpanView(); 99 else if (view == "TimeSpan") showTimeSpanView();
95 else if (view == "Todo") showTodoView(); 100 else if (view == "Todo") showTodoView();
96 else { 101 else {
97 config->setGroup( "Views" ); 102 config->setGroup( "Views" );
98 int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); 103 int dateCount = config->readNumEntry( "ShownDatesCount", 7 );
99 mCurrentAgendaView = dateCount; 104 mCurrentAgendaView = dateCount;
100 showAgendaView(); 105 showAgendaView();
101 mCurrentAgendaView = dateCount; 106 mCurrentAgendaView = dateCount;
102#ifdef DESKTOP_VERSION 107#ifdef DESKTOP_VERSION
103 QTimer::singleShot( 1000, mAgendaView, SLOT ( setInitStartHour() ) ); 108 QTimer::singleShot( 1000, mAgendaView, SLOT ( setInitStartHour() ) );
104#endif 109#endif
105 } 110 }
106} 111}
107 112
108void KOViewManager::showDateView( int view, QDate date) 113void KOViewManager::showDateView( int view, QDate date)
109{ 114{
110 static int lastMode = 0; 115 static int lastMode = 0;
111 static int lastCount = 0; 116 static int lastCount = 0;
112 static bool lastNDMode = false; 117 static bool lastNDMode = false;
113 static QDate lastDate; 118 static QDate lastDate;
114 //qDebug("date %d %s", view, date.toString().latin1()); 119 //qDebug("date %d %s", view, date.toString().latin1());
115 120
116 if (view != 9) 121 if (view != 9)
117 lastMode = 0; 122 lastMode = 0;
118 //qDebug("%d %d ", lastNDMode, mFlagShowNextxDays ); 123 //qDebug("%d %d ", lastNDMode, mFlagShowNextxDays );
119 bool savemFlagShowNextxDays = mFlagShowNextxDays; 124 bool savemFlagShowNextxDays = mFlagShowNextxDays;
120 mFlagShowNextxDays = false; 125 mFlagShowNextxDays = false;
121 if ( view == 3 ) { 126 if ( view == 3 ) {
122 //mCurrentAgendaView = 1 ; 127 //mCurrentAgendaView = 1 ;
123 lastDate = mMainView->dateNavigator()->selectedDates().first(); 128 lastDate = mMainView->dateNavigator()->selectedDates().first();
124 lastCount = mMainView->dateNavigator()->selectedDates().count(); 129 lastCount = mMainView->dateNavigator()->selectedDates().count();
125 lastNDMode = savemFlagShowNextxDays; 130 lastNDMode = savemFlagShowNextxDays;
126 mMainView->showDay( date ); 131 mMainView->showDay( date );
127 lastMode = 1; 132 lastMode = 1;
128 } else if (view == 4 ) { 133 } else if (view == 4 ) {
129 mCurrentAgendaView = 7 ; 134 mCurrentAgendaView = 7 ;
130 mMainView->dateNavigator()->selectDates( date, 7 ); 135 mMainView->dateNavigator()->selectDates( date, 7 );
131 } else if (view == 5 ) { 136 } else if (view == 5 ) {
132 mCurrentAgendaView = 14 ; 137 mCurrentAgendaView = 14 ;
133 mMainView->dateNavigator()->selectDates( date, 14); 138 mMainView->dateNavigator()->selectDates( date, 14);
134 } else if (view == 6 ) { 139 } else if (view == 6 ) {
135 //mMainView->dateNavigator()->selectDates( date, 7 ); 140 //mMainView->dateNavigator()->selectDates( date, 7 );
136 showMonthView(); 141 showMonthView();
137 } else if (view == 7 ) { 142 } else if (view == 7 ) {
138 mMainView->dateNavigator()->selectDate( date ); 143 mMainView->dateNavigator()->selectDate( date );
139 showJournalView(); 144 showJournalView();
140 } else if (view == 8 ) { 145 } else if (view == 8 ) {
141 globalFlagBlockAgenda = 1; 146 globalFlagBlockAgenda = 1;
142 if ( mCurrentAgendaView != 3 ) 147 if ( mCurrentAgendaView != 3 )
143 mCurrentAgendaView = -1; 148 mCurrentAgendaView = -1;
144 showAgendaView(KOPrefs::instance()->mFullViewMonth); 149 showAgendaView(KOPrefs::instance()->mFullViewMonth);
145 globalFlagBlockAgenda = 2; 150 globalFlagBlockAgenda = 2;
146 mMainView->dateNavigator()->selectDates( date , 151 mMainView->dateNavigator()->selectDates( date ,
147 KOPrefs::instance()->mNextXDays ); 152 KOPrefs::instance()->mNextXDays );
148 mFlagShowNextxDays = true; 153 mFlagShowNextxDays = true;
149 mCurrentAgendaView = 3 ; 154 mCurrentAgendaView = 3 ;
150 } if (view == 9) { // return behaviour, for getting back from mode == 3 (single day mode ) 155 } if (view == 9) { // return behaviour, for getting back from mode == 3 (single day mode )
151 if ( lastMode ) { 156 if ( lastMode ) {
152 mCurrentAgendaView = lastCount ; 157 mCurrentAgendaView = lastCount ;
153 mMainView->dateNavigator()->selectDates( lastDate, lastCount); 158 mMainView->dateNavigator()->selectDates( lastDate, lastCount);
154 mFlagShowNextxDays = lastNDMode; 159 mFlagShowNextxDays = lastNDMode;
155 if ( mFlagShowNextxDays ) { 160 if ( mFlagShowNextxDays ) {
156 mCurrentAgendaView = 3 ; 161 mCurrentAgendaView = 3 ;
157 } 162 }
158 } else 163 } else
159 showWeekView(); 164 showWeekView();
160 } else if (view == 10) { 165 } else if (view == 10) {
161 mMainView->dateNavigator()->selectDates( date,mMainView->dateNavigator()->selectedDates().count() ); 166 mMainView->dateNavigator()->selectDates( date,mMainView->dateNavigator()->selectedDates().count() );
162 } 167 }
163} 168}
164 169
165 170
166 171
167void KOViewManager::writeSettings(KConfig *config) 172void KOViewManager::writeSettings(KConfig *config)
168{ 173{
169 config->setGroup("General"); 174 config->setGroup("General");
170 175
171 QString view; 176 QString view;
172 if (mCurrentView == mWhatsNextView) view = "WhatsNext"; 177 if (mCurrentView == mWhatsNextView) view = "WhatsNext";
173 else if (mCurrentView == mMonthView) view = "Month"; 178 else if (mCurrentView == mMonthView) view = "Month";
174 else if (mCurrentView == mListView) view = "List"; 179 else if (mCurrentView == mListView) view = "List";
175 else if (mCurrentView == mJournalView) view = "Journal"; 180 else if (mCurrentView == mJournalView) view = "Journal";
176 else if (mCurrentView == mTimeSpanView) view = "TimeSpan"; 181 else if (mCurrentView == mTimeSpanView) view = "TimeSpan";
177 else if (mCurrentView == mTodoView) view = "Todo"; 182 else if (mCurrentView == mTodoView) view = "Todo";
178 else view = "Agenda"; 183 else view = "Agenda";
179 184
180 config->writeEntry("Current View",view); 185 config->writeEntry("Current View",view);
181 186
182 if (mAgendaView) { 187 if (mAgendaView) {
183 mAgendaView->writeSettings(config); 188 mAgendaView->writeSettings(config);
184 } 189 }
185 if (mTimeSpanView) { 190 if (mTimeSpanView) {
186 mTimeSpanView->writeSettings(config); 191 mTimeSpanView->writeSettings(config);
187 } 192 }
188 if (mListView) { 193 if (mListView) {
189 mListView->writeSettings(config); 194 mListView->writeSettings(config);
190 } 195 }
191 if (mTodoView) { 196 if (mTodoView) {
192 mTodoView->saveLayout(config,"Todo View"); 197 mTodoView->saveLayout(config,"Todo View");
193 } 198 }
194} 199}
195 200
196void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) 201void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen )
197{ 202{
198 203
199 //mFlagShowNextxDays = false; 204 //mFlagShowNextxDays = false;
200 //if(view == mCurrentView) return; 205 //if(view == mCurrentView) return;
201 if ( view == 0 ) { 206 if ( view == 0 ) {
202 view = mCurrentView; 207 view = mCurrentView;
203 if ( view == 0 ) 208 if ( view == 0 )
204 return; 209 return;
205 } 210 }
206 bool full = fullScreen; 211 bool full = fullScreen;
207 if(view == mCurrentView && view != mWhatsNextView ) { 212 if(view == mCurrentView && view != mWhatsNextView ) {
208 if ( mCurrentAgendaView < 0 ) 213 if ( mCurrentAgendaView < 0 )
209 return; 214 return;
215 if ( view != mMonthView )
210 full = mMainView->leftFrame()->isVisible(); 216 full = mMainView->leftFrame()->isVisible();
211 } else { 217 } else {
212 if ( view == mMonthView && mMonthView) 218 if ( view == mMonthView && mMonthView)
213 ;//mMonthView->skipResize = true ; 219 ;//mMonthView->skipResize = true ;
214 mCurrentView = view; 220 mCurrentView = view;
215 // bool full = fullScreen; 221 // bool full = fullScreen;
216 bool isFull = !mMainView->leftFrame()->isVisible(); 222 bool isFull = !mMainView->leftFrame()->isVisible();
217 if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) 223 if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen )
218 full = true; 224 full = true;
219 if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) 225 if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen )
220 full = false; 226 full = false;
221 } 227 }
222 if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); 228 if ( mAgendaView ) mAgendaView->deleteSelectedDateTime();
223 //raiseCurrentView( full ); 229 //raiseCurrentView( full );
224 mMainView->processIncidenceSelection( 0 ); 230 mMainView->processIncidenceSelection( 0 );
225 //mMainView->updateView(); 231 //mMainView->updateView();
226 raiseCurrentView( full, true ); 232 raiseCurrentView( full, true );
227 mMainView->adaptNavigationUnits(); 233 mMainView->adaptNavigationUnits();
228} 234}
229 235
230void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView ) 236void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView )
231{ 237{
232 mCurrentAgendaView = 0; 238 mCurrentAgendaView = 0;
233 if ( fullScreen ) { 239 if ( fullScreen ) {
234 mMainView->leftFrame()->hide(); 240 mMainView->leftFrame()->hide();
235 } else { 241 } else {
236 mMainView->leftFrame()->show(); 242 mMainView->leftFrame()->show();
237 } 243 }
238 emit signalFullScreen( !fullScreen ); 244 emit signalFullScreen( !fullScreen );
239 if ( callUpdateView ) 245 if ( callUpdateView )
240 mMainView->updateView(); 246 mMainView->updateView();
241 247
242 if ( globalFlagBlockAgenda == 5 ) { 248 if ( globalFlagBlockAgenda == 5 ) {
243 globalFlagBlockAgenda = 4; 249 globalFlagBlockAgenda = 4;
244 globalFlagBlockAgendaItemPaint = 1; 250 globalFlagBlockAgendaItemPaint = 1;
245 } 251 }
246 mMainView->viewStack()->raiseWidget(mCurrentView); 252 mMainView->viewStack()->raiseWidget(mCurrentView);
247 if ( globalFlagBlockAgenda == 4 ) { 253 if ( globalFlagBlockAgenda == 4 ) {
248 if ( mCurrentView == mAgendaView ) { 254 if ( mCurrentView == mAgendaView ) {
249 //globalFlagBlockAgenda =1 ; 255 //globalFlagBlockAgenda =1 ;
250 if ( KOPrefs::instance()->mSetTimeToDayStartAt ) 256 if ( KOPrefs::instance()->mSetTimeToDayStartAt )
251 mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins ); 257 mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins );
252 else if ( KOPrefs::instance()->mCenterOnCurrentTime ) 258 else if ( KOPrefs::instance()->mCenterOnCurrentTime )
253 mAgendaView->setStartHour( QTime::currentTime ().hour() ); 259 mAgendaView->setStartHour( QTime::currentTime ().hour() );
254 qApp->processEvents(); 260 qApp->processEvents();
255 //qDebug("qApp->processEvents() "); 261 //qDebug("qApp->processEvents() ");
256 globalFlagBlockAgenda = 0; 262 globalFlagBlockAgenda = 0;
257 mAgendaView->repaintAgenda(); 263 mAgendaView->repaintAgenda();
258 264
259 } 265 }
260 globalFlagBlockAgenda = 0; 266 globalFlagBlockAgenda = 0;
261 } 267 }
262 emit signalAgendaView( mCurrentView == mAgendaView ); 268 emit signalAgendaView( mCurrentView == mAgendaView );
263 //qDebug("raiseCurrentView ende "); 269 //qDebug("raiseCurrentView ende ");
264 270
265} 271}
266 272
267void KOViewManager::updateView() 273void KOViewManager::updateView()
268{ 274{
269 // qDebug("KOViewManager::updateView() "); 275 // qDebug("KOViewManager::updateView() ");
270 // if we are updating mTodoView, we get endless recursion 276 // if we are updating mTodoView, we get endless recursion
271 if ( mTodoView == mCurrentView ) 277 if ( mTodoView == mCurrentView )
272 return; 278 return;
273 if ( mCurrentView ) mCurrentView->updateView(); 279 if ( mCurrentView ) mCurrentView->updateView();
@@ -425,193 +431,227 @@ void KOViewManager::showDayView()
425 globalFlagBlockAgenda = 2; 431 globalFlagBlockAgenda = 2;
426 globalFlagBlockLabel = 0; 432 globalFlagBlockLabel = 0;
427 mMainView->dateNavigator()->selectDates( 1 ); 433 mMainView->dateNavigator()->selectDates( 1 );
428 mCurrentAgendaView = 1 ; 434 mCurrentAgendaView = 1 ;
429 435
430} 436}
431 437
432void KOViewManager::showWorkWeekView() 438void KOViewManager::showWorkWeekView()
433{ 439{
434 mFlagShowNextxDays = false; 440 mFlagShowNextxDays = false;
435 globalFlagBlockAgenda = 1; 441 globalFlagBlockAgenda = 1;
436 globalFlagBlockLabel = 1; 442 globalFlagBlockLabel = 1;
437 if ( mCurrentAgendaView != 5 ) 443 if ( mCurrentAgendaView != 5 )
438 mCurrentAgendaView = -1; 444 mCurrentAgendaView = -1;
439 showAgendaView(); 445 showAgendaView();
440 qApp->processEvents(); 446 qApp->processEvents();
441 globalFlagBlockAgenda = 2; 447 globalFlagBlockAgenda = 2;
442 globalFlagBlockLabel = 0; 448 globalFlagBlockLabel = 0;
443 mMainView->dateNavigator()->selectWorkWeek(); 449 mMainView->dateNavigator()->selectWorkWeek();
444 mCurrentAgendaView = 5 ; 450 mCurrentAgendaView = 5 ;
445 451
446} 452}
447 453
448void KOViewManager::showWeekView() 454void KOViewManager::showWeekView()
449{ 455{
450 /* 456 /*
451 globalFlagBlockAgenda = 2; 457 globalFlagBlockAgenda = 2;
452 qDebug("4globalFlagBlockAgenda = 2; "); 458 qDebug("4globalFlagBlockAgenda = 2; ");
453 //globalFlagBlockPainting = true; 459 //globalFlagBlockPainting = true;
454 mMainView->dateNavigator()->selectWeek(); 460 mMainView->dateNavigator()->selectWeek();
455 showAgendaView(); 461 showAgendaView();
456 */ 462 */
457 463
458 464
459 mFlagShowNextxDays = false; 465 mFlagShowNextxDays = false;
460 globalFlagBlockAgenda = 1; 466 globalFlagBlockAgenda = 1;
461 globalFlagBlockLabel = 1; 467 globalFlagBlockLabel = 1;
462 if ( mCurrentAgendaView != 7 ) 468 if ( mCurrentAgendaView != 7 )
463 mCurrentAgendaView = -1; 469 mCurrentAgendaView = -1;
464 showAgendaView(); 470 showAgendaView();
465 qApp->processEvents(); 471 qApp->processEvents();
466 globalFlagBlockAgenda = 2; 472 globalFlagBlockAgenda = 2;
467 globalFlagBlockLabel = 0; 473 globalFlagBlockLabel = 0;
468 mMainView->dateNavigator()->selectWeek(); 474 mMainView->dateNavigator()->selectWeek();
469 mCurrentAgendaView = 7 ; 475 mCurrentAgendaView = 7 ;
470} 476}
471 477
472void KOViewManager::showNextXView() 478void KOViewManager::showNextXView()
473{ 479{
474 480
475 globalFlagBlockAgenda = 1; 481 globalFlagBlockAgenda = 1;
476 if ( mCurrentAgendaView != 3 ) 482 if ( mCurrentAgendaView != 3 )
477 mCurrentAgendaView = -1; 483 mCurrentAgendaView = -1;
478 showAgendaView(KOPrefs::instance()->mFullViewMonth); 484 showAgendaView(KOPrefs::instance()->mFullViewMonth);
479 globalFlagBlockAgenda = 2; 485 globalFlagBlockAgenda = 2;
480 mMainView->dateNavigator()->selectDates( QDate::currentDate(), 486 mMainView->dateNavigator()->selectDates( QDate::currentDate(),
481 KOPrefs::instance()->mNextXDays ); 487 KOPrefs::instance()->mNextXDays );
482 mFlagShowNextxDays = true; 488 mFlagShowNextxDays = true;
483 mCurrentAgendaView = 3 ; 489 mCurrentAgendaView = 3 ;
484} 490}
485bool KOViewManager::showsNextDays() 491bool KOViewManager::showsNextDays()
486{ 492{
487 return mFlagShowNextxDays; 493 return mFlagShowNextxDays;
488} 494}
489void KOViewManager::showMonthView() 495void KOViewManager::createMonthView()
490 { 496 {
491 if (!mMonthView) { 497 if (!mMonthView) {
492 mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView"); 498 mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView");
493 499
494 addView(mMonthView); 500 addView(mMonthView);
495 // mMonthView->show(); 501 // mMonthView->show();
496 // SIGNALS/SLOTS FOR MONTH VIEW 502 // SIGNALS/SLOTS FOR MONTH VIEW
497 connect(mMonthView, SIGNAL(newEventSignal(QDateTime)), 503 connect(mMonthView, SIGNAL(newEventSignal(QDateTime)),
498 mMainView, SLOT(newEvent(QDateTime))); 504 mMainView, SLOT(newEvent(QDateTime)));
499 505
500 connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)), 506 connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)),
501 mMainView, SLOT(showIncidence(Incidence *))); 507 mMainView, SLOT(showIncidence(Incidence *)));
502 connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)), 508 connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)),
503 mMainView, SLOT(editIncidence(Incidence *))); 509 mMainView, SLOT(editIncidence(Incidence *)));
504 connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)), 510 connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)),
505 mMainView, SLOT(deleteIncidence(Incidence *))); 511 mMainView, SLOT(deleteIncidence(Incidence *)));
506 512
507 connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ), 513 connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ),
508 mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 514 mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
509 connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), 515 connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ),
510 mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); 516 mMainView, SLOT ( cloneIncidence( Incidence * ) ) );
511 connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), 517 connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ),
512 mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); 518 mMainView, SLOT ( cancelIncidence( Incidence * ) ) );
513 519
514 connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ), 520 connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ),
515 mMainView, SLOT ( moveIncidence( Incidence * ) ) ); 521 mMainView, SLOT ( moveIncidence( Incidence * ) ) );
516 connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ), 522 connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ),
517 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 523 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
518 connect( mMonthView, SIGNAL( selectWeekNum( int ) ), 524 connect( mMonthView, SIGNAL( selectWeekNum( int ) ),
519 mMainView->dateNavigator(), SLOT ( selectWeekFromMonthView( int ) ) ); 525 mMainView->dateNavigator(), SLOT ( selectWeekFromMonthView( int ) ) );
526 connect( mMonthView, SIGNAL( selectMonth() ),
527 mMainView->dateNavigator(), SLOT ( selectMonthFromMonthview() ) );
520 connect( mMonthView, SIGNAL( showDaySignal( QDate ) ), 528 connect( mMonthView, SIGNAL( showDaySignal( QDate ) ),
521 mMainView, SLOT ( showDay( QDate ) ) ); 529 mMainView, SLOT ( showDay( QDate ) ) );
522 connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig())); 530 connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig()));
523 connect( mMonthView, SIGNAL(nextMonth() ), 531 connect( mMonthView, SIGNAL(nextMonth() ),
524 mMonthView->navigatorBar(), SIGNAL(goNextMonth() ) ); 532 mMonthView->navigatorBar(), SIGNAL(goNextMonth() ) );
525 connect( mMonthView, SIGNAL(prevMonth() ), 533 connect( mMonthView, SIGNAL(prevMonth() ),
526 mMonthView->navigatorBar(), SIGNAL(goPrevMonth() ) ); 534 mMonthView->navigatorBar(), SIGNAL(goPrevMonth() ) );
527 connect( mMonthView->navigatorBar(), SIGNAL( goPrevYear() ), 535 connect( mMonthView->navigatorBar(), SIGNAL( goPrevYear() ),
528 mMainView->dateNavigator(), SLOT( selectPreviousYear() ) ); 536 mMainView->dateNavigator(), SLOT( selectPreviousYear() ) );
529 connect( mMonthView->navigatorBar(), SIGNAL( goNextYear() ), 537 connect( mMonthView->navigatorBar(), SIGNAL( goNextYear() ),
530 mMainView->dateNavigator(), SLOT( selectNextYear() ) ); 538 mMainView->dateNavigator(), SLOT( selectNextYear() ) );
531 connect( mMonthView->navigatorBar(), SIGNAL( goPrevMonth() ), 539 connect( mMonthView->navigatorBar(), SIGNAL( goPrevMonth() ),
532 mMainView->dateNavigator(), SLOT( selectPreviousMonth() ) ); 540 mMainView->dateNavigator(), SLOT( selectPreviousMonth() ) );
533 connect( mMonthView->navigatorBar(), SIGNAL( goNextMonth() ), 541 connect( mMonthView->navigatorBar(), SIGNAL( goNextMonth() ),
534 mMainView->dateNavigator(), SLOT( selectNextMonth() ) ); 542 mMainView->dateNavigator(), SLOT( selectNextMonth() ) );
543 connect( mMonthView->navigatorBar(), SIGNAL( goPrevWeek() ),
544 mMainView->dateNavigator(), SLOT( selectPreviousWeek() ) );
545 connect( mMonthView->navigatorBar(), SIGNAL( goNextWeek() ),
546 mMainView->dateNavigator(), SLOT( selectNextWeek() ) );
535 547
536 connect( mMainView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), 548 connect( mMainView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ),
537 mMonthView->navigatorBar(), SLOT( selectDates( const KCal::DateList & ) ) ); 549 mMonthView->navigatorBar(), SLOT( selectDates( const KCal::DateList & ) ) );
538 550
539 551
540 connect( mMonthView->navigatorBar(), SIGNAL( monthSelected ( int ) ), 552 connect( mMonthView->navigatorBar(), SIGNAL( monthSelected ( int ) ),
541 mMainView->dateNavigator(), SLOT( slotMonthSelect( int ) ) ); 553 mMainView->dateNavigator(), SLOT( slotMonthSelect( int ) ) );
542 554
543 } 555 }
556}
557void KOViewManager::showMonthViewWeek()
558{
559 createMonthView();
560 bool full = true;
561 if ( mCurrentView == mMonthView)
562 full = mMainView->leftFrame()->isVisible();
563 if ( !KOPrefs::instance()->mMonthViewWeek ) {
564 mMonthView->switchView();
565 if ( KOPrefs::instance()->mViewChangeHoldNonFullscreen && mMainView->leftFrame()->isVisible() )
566 full = false;
567 else
568 full = true;
569 }
570 mMainView->dateNavigator()->selectWeek();
571 showView(mMonthView, full );
572}
573
574void KOViewManager::showMonthView()
575 {
544 576
577 createMonthView();
545 globalFlagBlockAgenda = 1; 578 globalFlagBlockAgenda = 1;
546 //mFlagShowNextxDays = false; 579 //mFlagShowNextxDays = false;
580 bool full = true;
581 if ( mCurrentView == mMonthView)
582 full = mMainView->leftFrame()->isVisible();
547 // if(mMonthView == mCurrentView) return; 583 // if(mMonthView == mCurrentView) return;
548 if ( KOPrefs::instance()->mMonthViewWeek ) 584 if ( KOPrefs::instance()->mMonthViewWeek ) {
549 mMainView->dateNavigator()->selectWeek(); 585 mMonthView->switchView();
586 if ( KOPrefs::instance()->mViewChangeHoldNonFullscreen && mMainView->leftFrame()->isVisible() )
587 full = false;
550 else 588 else
589 full = true;
590 }
551 mMainView->dateNavigator()->selectMonth(); 591 mMainView->dateNavigator()->selectMonth();
552 592
553 showView(mMonthView, true ); 593 showView(mMonthView, full );
554 594
555} 595}
556 596
557void KOViewManager::showTodoView() 597void KOViewManager::showTodoView()
558{ 598{
559 //mFlagShowNextxDays = false; 599 //mFlagShowNextxDays = false;
560 if ( !mTodoView ) { 600 if ( !mTodoView ) {
561 mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(), 601 mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(),
562 "KOViewManager::TodoView" ); 602 "KOViewManager::TodoView" );
563 603
564 addView( mTodoView ); 604 addView( mTodoView );
565 // QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold ); 605 // QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold );
566 606
567 // SIGNALS/SLOTS FOR TODO VIEW 607 // SIGNALS/SLOTS FOR TODO VIEW
568 connect( mTodoView, SIGNAL( newTodoSignal() ), 608 connect( mTodoView, SIGNAL( newTodoSignal() ),
569 mMainView, SLOT( newTodo() ) ); 609 mMainView, SLOT( newTodo() ) );
570 connect( mTodoView, SIGNAL( newSubTodoSignal( Todo * ) ), 610 connect( mTodoView, SIGNAL( newSubTodoSignal( Todo * ) ),
571 mMainView, SLOT( newSubTodo( Todo *) ) ); 611 mMainView, SLOT( newSubTodo( Todo *) ) );
572 connect( mTodoView, SIGNAL( showTodoSignal( Todo *) ), 612 connect( mTodoView, SIGNAL( showTodoSignal( Todo *) ),
573 mMainView, SLOT( showTodo( Todo * ) ) ); 613 mMainView, SLOT( showTodo( Todo * ) ) );
574 connect( mTodoView, SIGNAL( editTodoSignal( Todo * ) ), 614 connect( mTodoView, SIGNAL( editTodoSignal( Todo * ) ),
575 mMainView, SLOT( editTodo( Todo * ) ) ); 615 mMainView, SLOT( editTodo( Todo * ) ) );
576 connect( mTodoView, SIGNAL( deleteTodoSignal( Todo * ) ), 616 connect( mTodoView, SIGNAL( deleteTodoSignal( Todo * ) ),
577 mMainView, SLOT( deleteTodo( Todo * ) ) ); 617 mMainView, SLOT( deleteTodo( Todo * ) ) );
578 connect( mTodoView, SIGNAL( purgeCompletedSignal() ), 618 connect( mTodoView, SIGNAL( purgeCompletedSignal() ),
579 mMainView, SLOT( purgeCompleted() ) ); 619 mMainView, SLOT( purgeCompleted() ) );
580 620
581 connect( mTodoView, SIGNAL( incidenceSelected( Incidence * ) ), 621 connect( mTodoView, SIGNAL( incidenceSelected( Incidence * ) ),
582 mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 622 mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
583 623
584 connect( mMainView, SIGNAL( configChanged() ), mTodoView, 624 connect( mMainView, SIGNAL( configChanged() ), mTodoView,
585 SLOT( updateConfig() ) ); 625 SLOT( updateConfig() ) );
586 connect( mMainView, SIGNAL( todoModified( Todo *, int )), mTodoView, 626 connect( mMainView, SIGNAL( todoModified( Todo *, int )), mTodoView,
587 SLOT( updateTodo( Todo *, int ) ) ); 627 SLOT( updateTodo( Todo *, int ) ) );
588 connect( mTodoView, SIGNAL( todoModifiedSignal( Todo *, int ) ), 628 connect( mTodoView, SIGNAL( todoModifiedSignal( Todo *, int ) ),
589 mMainView, SIGNAL ( todoModified( Todo *, int ) ) ); 629 mMainView, SIGNAL ( todoModified( Todo *, int ) ) );
590 connect( mTodoView, SIGNAL( cloneTodoSignal( Incidence * ) ), 630 connect( mTodoView, SIGNAL( cloneTodoSignal( Incidence * ) ),
591 mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); 631 mMainView, SLOT ( cloneIncidence( Incidence * ) ) );
592 connect( mTodoView, SIGNAL( cancelTodoSignal( Incidence * ) ), 632 connect( mTodoView, SIGNAL( cancelTodoSignal( Incidence * ) ),
593 mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); 633 mMainView, SLOT ( cancelIncidence( Incidence * ) ) );
594 connect( mTodoView, SIGNAL( unparentTodoSignal( Todo * ) ), 634 connect( mTodoView, SIGNAL( unparentTodoSignal( Todo * ) ),
595 mMainView, SLOT ( todo_unsub( Todo * ) ) ); 635 mMainView, SLOT ( todo_unsub( Todo * ) ) );
596 connect( mTodoView, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), 636 connect( mTodoView, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ),
597 mMainView, SLOT ( todo_resub( Todo *, Todo *) ) ); 637 mMainView, SLOT ( todo_resub( Todo *, Todo *) ) );
598 connect( mTodoView, SIGNAL( moveTodoSignal( Incidence * ) ), 638 connect( mTodoView, SIGNAL( moveTodoSignal( Incidence * ) ),
599 mMainView, SLOT ( moveIncidence( Incidence * ) ) ); 639 mMainView, SLOT ( moveIncidence( Incidence * ) ) );
600 connect( mTodoView, SIGNAL( beamTodoSignal( Incidence * ) ), 640 connect( mTodoView, SIGNAL( beamTodoSignal( Incidence * ) ),
601 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 641 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
602 KConfig *config = KOGlobals::config(); 642 KConfig *config = KOGlobals::config();
603 mTodoView->restoreLayout(config,"Todo View"); 643 mTodoView->restoreLayout(config,"Todo View");
604 mTodoView->setNavigator( mMainView->dateNavigator() ); 644 mTodoView->setNavigator( mMainView->dateNavigator() );
605 } 645 }
606 646
607 globalFlagBlockAgenda = 1; 647 globalFlagBlockAgenda = 1;
608 showView( mTodoView, true ); 648 showView( mTodoView, true );
609 649
610} 650}
611 651
612void KOViewManager::showJournalView() 652void KOViewManager::showJournalView()
613{ 653{
614 //mFlagShowNextxDays = false; 654 //mFlagShowNextxDays = false;
615 if (!mJournalView) { 655 if (!mJournalView) {
616 mJournalView = new KOJournalView(mMainView->calendar(),mMainView->viewStack(), 656 mJournalView = new KOJournalView(mMainView->calendar(),mMainView->viewStack(),
617 "KOViewManager::JournalView"); 657 "KOViewManager::JournalView");
diff --git a/korganizer/koviewmanager.h b/korganizer/koviewmanager.h
index 66ab138..8f0bf82 100644
--- a/korganizer/koviewmanager.h
+++ b/korganizer/koviewmanager.h
@@ -31,88 +31,90 @@
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 showDateView( int, QDate ); 85 void showDateView( int, QDate );
86 void updateView(); 86 void updateView();
87 void showWhatsNextView(); 87 void showWhatsNextView();
88 void showListView(); 88 void showListView();
89 void showAgendaView( bool fullScreen = false ); 89 void showAgendaView( bool fullScreen = false );
90 void showDayView(); 90 void showDayView();
91 void showWorkWeekView(); 91 void showWorkWeekView();
92 void showWeekView(); 92 void showWeekView();
93 void showNextXView(); 93 void showNextXView();
94 void showMonthView(); 94 void showMonthView();
95 void showMonthViewWeek();
95 void showTodoView(); 96 void showTodoView();
96 void showJournalView(); 97 void showJournalView();
97 void showTimeSpanView(); 98 void showTimeSpanView();
98 99
99 private: 100 private:
101 void createMonthView();
100 CalendarView *mMainView; 102 CalendarView *mMainView;
101 103
102 int mCurrentAgendaView; 104 int mCurrentAgendaView;
103 KOAgendaView *mAgendaView; 105 KOAgendaView *mAgendaView;
104 KOListView *mListView; 106 KOListView *mListView;
105 KOMonthView *mMonthView; 107 KOMonthView *mMonthView;
106 KOTodoView *mTodoView; 108 KOTodoView *mTodoView;
107 KOWhatsNextView *mWhatsNextView; 109 KOWhatsNextView *mWhatsNextView;
108 KOJournalView *mJournalView; 110 KOJournalView *mJournalView;
109 KOTimeSpanView *mTimeSpanView; 111 KOTimeSpanView *mTimeSpanView;
110 112
111 KOrg::BaseView *mCurrentView; // currently active event view 113 KOrg::BaseView *mCurrentView; // currently active event view
112 114
113 int mAgendaViewMode; 115 int mAgendaViewMode;
114 bool mFlagShowNextxDays; 116 bool mFlagShowNextxDays;
115 117
116}; 118};
117 119
118#endif 120#endif
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index ab0e4d6..16031b8 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -652,128 +652,135 @@ void MainWindow::initActions()
652 action->addTo( viewMenu ); 652 action->addTo( viewMenu );
653 connect( action, SIGNAL( activated() ), 653 connect( action, SIGNAL( activated() ),
654 mView, SLOT( toggleFilter() ) ); 654 mView, SLOT( toggleFilter() ) );
655 mToggleFilter = action; 655 mToggleFilter = action;
656 icon = loadPixmap( pathString + "allday" ); 656 icon = loadPixmap( pathString + "allday" );
657 action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); 657 action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this );
658 action->addTo( viewMenu ); 658 action->addTo( viewMenu );
659 connect( action, SIGNAL( activated() ), 659 connect( action, SIGNAL( activated() ),
660 mView, SLOT( toggleAllDaySize() ) ); 660 mView, SLOT( toggleAllDaySize() ) );
661 mToggleAllday = action; 661 mToggleAllday = action;
662 662
663 663
664 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 664 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
665 mToggleNav, SLOT( setEnabled ( bool ) ) ); 665 mToggleNav, SLOT( setEnabled ( bool ) ) );
666 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 666 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
667 mToggleFilter, SLOT( setEnabled ( bool ) ) ); 667 mToggleFilter, SLOT( setEnabled ( bool ) ) );
668 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), 668 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ),
669 mToggleAllday, SLOT( setEnabled ( bool ) ) ); 669 mToggleAllday, SLOT( setEnabled ( bool ) ) );
670 670
671 viewMenu->insertSeparator(); 671 viewMenu->insertSeparator();
672 icon = loadPixmap( pathString + "picker" ); 672 icon = loadPixmap( pathString + "picker" );
673 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); 673 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this );
674 action->addTo( viewMenu ); 674 action->addTo( viewMenu );
675 connect( action, SIGNAL( activated() ), 675 connect( action, SIGNAL( activated() ),
676 mView, SLOT( showDatePicker() ) ); 676 mView, SLOT( showDatePicker() ) );
677 action->addTo( iconToolBar ); 677 action->addTo( iconToolBar );
678 viewMenu->insertSeparator(); 678 viewMenu->insertSeparator();
679 icon = loadPixmap( pathString + "list" ); 679 icon = loadPixmap( pathString + "list" );
680 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); 680 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 );
681 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); 681 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this );
682 showlist_action->addTo( viewMenu ); 682 showlist_action->addTo( viewMenu );
683 connect( showlist_action, SIGNAL( activated() ), 683 connect( showlist_action, SIGNAL( activated() ),
684 mView->viewManager(), SLOT( showListView() ) ); 684 mView->viewManager(), SLOT( showListView() ) );
685 685
686 686
687 icon = loadPixmap( pathString + "day" ); 687 icon = loadPixmap( pathString + "day" );
688 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); 688 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 );
689 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); 689 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this );
690 day1_action->addTo( viewMenu ); 690 day1_action->addTo( viewMenu );
691 // action->addTo( toolBar ); 691 // action->addTo( toolBar );
692 connect( day1_action, SIGNAL( activated() ), 692 connect( day1_action, SIGNAL( activated() ),
693 mView->viewManager(), SLOT( showDayView() ) ); 693 mView->viewManager(), SLOT( showDayView() ) );
694 694
695 icon = loadPixmap( pathString + "workweek" ); 695 icon = loadPixmap( pathString + "workweek" );
696 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); 696 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 );
697 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); 697 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this );
698 day5_action->addTo( viewMenu ); 698 day5_action->addTo( viewMenu );
699 connect( day5_action, SIGNAL( activated() ), 699 connect( day5_action, SIGNAL( activated() ),
700 mView->viewManager(), SLOT( showWorkWeekView() ) ); 700 mView->viewManager(), SLOT( showWorkWeekView() ) );
701 701
702 icon = loadPixmap( pathString + "week" ); 702 icon = loadPixmap( pathString + "week" );
703 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); 703 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 );
704 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); 704 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this );
705 day7_action->addTo( viewMenu ); 705 day7_action->addTo( viewMenu );
706 connect( day7_action, SIGNAL( activated() ), 706 connect( day7_action, SIGNAL( activated() ),
707 mView->viewManager(), SLOT( showWeekView() ) ); 707 mView->viewManager(), SLOT( showWeekView() ) );
708 708
709 icon = loadPixmap( pathString + "month" ); 709 icon = loadPixmap( pathString + "month" );
710 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); 710 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 );
711 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); 711 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this );
712 month_action->addTo( viewMenu ); 712 month_action->addTo( viewMenu );
713 connect( month_action, SIGNAL( activated() ), 713 connect( month_action, SIGNAL( activated() ),
714 mView->viewManager(), SLOT( showMonthView() ) ); 714 mView->viewManager(), SLOT( showMonthView() ) );
715 715
716 icon = loadPixmap( pathString + "workweek2" );
717 configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 );
718 QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this );
719 day6_action->addTo( viewMenu );
720 connect( day6_action, SIGNAL( activated() ),
721 mView->viewManager(), SLOT( showMonthViewWeek() ) );
722
716 icon = loadPixmap( pathString + "todo" ); 723 icon = loadPixmap( pathString + "todo" );
717 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); 724 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 );
718 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); 725 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this );
719 todoview_action->addTo( viewMenu ); 726 todoview_action->addTo( viewMenu );
720 connect( todoview_action, SIGNAL( activated() ), 727 connect( todoview_action, SIGNAL( activated() ),
721 mView->viewManager(), SLOT( showTodoView() ) ); 728 mView->viewManager(), SLOT( showTodoView() ) );
722 729
723 icon = loadPixmap( pathString + "journal" ); 730 icon = loadPixmap( pathString + "journal" );
724 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); 731 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 );
725 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); 732 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this );
726 viewjournal_action->addTo( viewMenu ); 733 viewjournal_action->addTo( viewMenu );
727 connect( viewjournal_action, SIGNAL( activated() ), 734 connect( viewjournal_action, SIGNAL( activated() ),
728 mView->viewManager(), SLOT( showJournalView() ) ); 735 mView->viewManager(), SLOT( showJournalView() ) );
729 736
730 icon = loadPixmap( pathString + "xdays" ); 737 icon = loadPixmap( pathString + "xdays" );
731 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 ); 738 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 );
732 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); 739 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this );
733 xdays_action->addTo( viewMenu ); 740 xdays_action->addTo( viewMenu );
734 connect( xdays_action, SIGNAL( activated() ), 741 connect( xdays_action, SIGNAL( activated() ),
735 mView->viewManager(), SLOT( showNextXView() ) ); 742 mView->viewManager(), SLOT( showNextXView() ) );
736 743
737 icon = loadPixmap( pathString + "whatsnext" ); 744 icon = loadPixmap( pathString + "whatsnext" );
738 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 ); 745 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 );
739 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); 746 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this );
740 whatsnext_action->addTo( viewMenu ); 747 whatsnext_action->addTo( viewMenu );
741 connect( whatsnext_action, SIGNAL( activated() ), 748 connect( whatsnext_action, SIGNAL( activated() ),
742 mView->viewManager(), SLOT( showWhatsNextView() ) ); 749 mView->viewManager(), SLOT( showWhatsNextView() ) );
743 750
744#if 0 751#if 0
745 action = new QAction( "view_timespan", "Time Span", 0, this ); 752 action = new QAction( "view_timespan", "Time Span", 0, this );
746 action->addTo( viewMenu ); 753 action->addTo( viewMenu );
747 connect( action, SIGNAL( activated() ), 754 connect( action, SIGNAL( activated() ),
748 mView->viewManager(), SLOT( showTimeSpanView() ) ); 755 mView->viewManager(), SLOT( showTimeSpanView() ) );
749#endif 756#endif
750 757
751 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, 758 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0,
752 this ); 759 this );
753 mNewSubTodoAction->addTo( actionMenu ); 760 mNewSubTodoAction->addTo( actionMenu );
754 connect( mNewSubTodoAction, SIGNAL( activated() ), 761 connect( mNewSubTodoAction, SIGNAL( activated() ),
755 mView, SLOT( newSubTodo() ) ); 762 mView, SLOT( newSubTodo() ) );
756 763
757 actionMenu->insertSeparator(); 764 actionMenu->insertSeparator();
758 765
759 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); 766 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this );
760 mShowAction->addTo( actionMenu ); 767 mShowAction->addTo( actionMenu );
761 connect( mShowAction, SIGNAL( activated() ), 768 connect( mShowAction, SIGNAL( activated() ),
762 mView, SLOT( showIncidence() ) ); 769 mView, SLOT( showIncidence() ) );
763 770
764 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); 771 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this );
765 mEditAction->addTo( actionMenu ); 772 mEditAction->addTo( actionMenu );
766 connect( mEditAction, SIGNAL( activated() ), 773 connect( mEditAction, SIGNAL( activated() ),
767 mView, SLOT( editIncidence() ) ); 774 mView, SLOT( editIncidence() ) );
768 775
769 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); 776 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this );
770 mDeleteAction->addTo( actionMenu ); 777 mDeleteAction->addTo( actionMenu );
771 connect( mDeleteAction, SIGNAL( activated() ), 778 connect( mDeleteAction, SIGNAL( activated() ),
772 mView, SLOT( deleteIncidence() ) ); 779 mView, SLOT( deleteIncidence() ) );
773 780
774 781
775 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); 782 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this );
776 mCloneAction->addTo( actionMenu ); 783 mCloneAction->addTo( actionMenu );
777 connect( mCloneAction, SIGNAL( activated() ), 784 connect( mCloneAction, SIGNAL( activated() ),
778 mView, SLOT( cloneIncidence() ) ); 785 mView, SLOT( cloneIncidence() ) );
779 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); 786 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this );
@@ -934,184 +941,188 @@ void MainWindow::initActions()
934 action->addTo( helpMenu ); 941 action->addTo( helpMenu );
935 connect( action, SIGNAL( activated() ), 942 connect( action, SIGNAL( activated() ),
936 SLOT( synchowto() ) ); 943 SLOT( synchowto() ) );
937 action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); 944 action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this );
938 action->addTo( helpMenu ); 945 action->addTo( helpMenu );
939 connect( action, SIGNAL( activated() ), 946 connect( action, SIGNAL( activated() ),
940 SLOT( kdesynchowto() ) ); 947 SLOT( kdesynchowto() ) );
941 action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); 948 action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this );
942 action->addTo( helpMenu ); 949 action->addTo( helpMenu );
943 connect( action, SIGNAL( activated() ), 950 connect( action, SIGNAL( activated() ),
944 SLOT( multisynchowto() ) ); 951 SLOT( multisynchowto() ) );
945 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); 952 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this );
946 action->addTo( helpMenu ); 953 action->addTo( helpMenu );
947 connect( action, SIGNAL( activated() ), 954 connect( action, SIGNAL( activated() ),
948 SLOT( aboutAutoSaving() ) ); 955 SLOT( aboutAutoSaving() ) );
949 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); 956 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this );
950 action->addTo( helpMenu ); 957 action->addTo( helpMenu );
951 connect( action, SIGNAL( activated() ), 958 connect( action, SIGNAL( activated() ),
952 SLOT( aboutKnownBugs() ) ); 959 SLOT( aboutKnownBugs() ) );
953 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); 960 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this );
954 action->addTo( helpMenu ); 961 action->addTo( helpMenu );
955 connect( action, SIGNAL( activated() ), 962 connect( action, SIGNAL( activated() ),
956 SLOT( usertrans() ) ); 963 SLOT( usertrans() ) );
957 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); 964 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this );
958 action->addTo( helpMenu ); 965 action->addTo( helpMenu );
959 connect( action, SIGNAL( activated() ), 966 connect( action, SIGNAL( activated() ),
960 SLOT( faq() ) ); 967 SLOT( faq() ) );
961 action = new QAction( "licence", i18n("Licence..."), 0, this ); 968 action = new QAction( "licence", i18n("Licence..."), 0, this );
962 action->addTo( helpMenu ); 969 action->addTo( helpMenu );
963 connect( action, SIGNAL( activated() ), 970 connect( action, SIGNAL( activated() ),
964 SLOT( licence() ) ); 971 SLOT( licence() ) );
965 action = new QAction( "about", i18n("About..."), 0, this ); 972 action = new QAction( "about", i18n("About..."), 0, this );
966 action->addTo( helpMenu ); 973 action->addTo( helpMenu );
967 connect( action, SIGNAL( activated() ), 974 connect( action, SIGNAL( activated() ),
968 SLOT( about() ) ); 975 SLOT( about() ) );
969 //menuBar->insertSeparator(); 976 //menuBar->insertSeparator();
970 977
971 // ****************************************************** 978 // ******************************************************
972 // menubar icons 979 // menubar icons
973 980
974 981
975 iconToolBar->setHorizontalStretchable (true ); 982 iconToolBar->setHorizontalStretchable (true );
976 //menuBar->insertItem( iconToolBar ); 983 //menuBar->insertItem( iconToolBar );
977 //xdays_action 984 //xdays_action
978 if (p-> mShowIconNewEvent) 985 if (p-> mShowIconNewEvent)
979 ne_action->addTo( iconToolBar ); 986 ne_action->addTo( iconToolBar );
980 if (p->mShowIconNewTodo ) 987 if (p->mShowIconNewTodo )
981 nt_action->addTo( iconToolBar ); 988 nt_action->addTo( iconToolBar );
982 if (p-> mShowIconSearch) 989 if (p-> mShowIconSearch)
983 search_action->addTo( iconToolBar ); 990 search_action->addTo( iconToolBar );
984 if (p-> mShowIconNext) 991 if (p-> mShowIconNext)
985 whatsnext_action->addTo( iconToolBar ); 992 whatsnext_action->addTo( iconToolBar );
986 if (p-> mShowIconNextDays) 993 if (p-> mShowIconNextDays)
987 xdays_action->addTo( iconToolBar ); 994 xdays_action->addTo( iconToolBar );
988 if (p-> mShowIconList) 995 if (p-> mShowIconList)
989 showlist_action->addTo( iconToolBar ); 996 showlist_action->addTo( iconToolBar );
990 if (p-> mShowIconDay1) 997 if (p-> mShowIconDay1)
991 day1_action->addTo( iconToolBar ); 998 day1_action->addTo( iconToolBar );
992 if (p-> mShowIconDay5) 999 if (p-> mShowIconDay5)
993 day5_action->addTo( iconToolBar ); 1000 day5_action->addTo( iconToolBar );
994 if (p-> mShowIconDay7) 1001 if (p-> mShowIconDay7)
995 day7_action->addTo( iconToolBar ); 1002 day7_action->addTo( iconToolBar );
996 if (p-> mShowIconMonth) 1003 if (p-> mShowIconMonth)
997 month_action->addTo( iconToolBar ); 1004 month_action->addTo( iconToolBar );
1005 if (p-> mShowIconDay6)
1006 day6_action->addTo( iconToolBar );
998 if (p-> mShowIconTodoview) 1007 if (p-> mShowIconTodoview)
999 todoview_action->addTo( iconToolBar ); 1008 todoview_action->addTo( iconToolBar );
1000 if (p-> mShowIconJournal) 1009 if (p-> mShowIconJournal)
1001 viewjournal_action->addTo( iconToolBar ); 1010 viewjournal_action->addTo( iconToolBar );
1002 icon = loadPixmap( pathString + "2leftarrowB" ); 1011 icon = loadPixmap( pathString + "2leftarrowB" );
1003 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14); 1012 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14);
1004 if (p-> mShowIconBackFast) { 1013 if (p-> mShowIconBackFast) {
1005 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); 1014 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this );
1006 connect( action, SIGNAL( activated() ), 1015 connect( action, SIGNAL( activated() ),
1007 mView, SLOT( goPreviousMonth() ) ); 1016 mView, SLOT( goPreviousMonth() ) );
1008 action->addTo( iconToolBar ); 1017 action->addTo( iconToolBar );
1009 } 1018 }
1010 icon = loadPixmap( pathString + "1leftarrowB" ); 1019 icon = loadPixmap( pathString + "1leftarrowB" );
1011 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15); 1020 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15);
1012 if (p-> mShowIconBack) { 1021 if (p-> mShowIconBack) {
1013 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); 1022 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this );
1014 connect( action, SIGNAL( activated() ), 1023 connect( action, SIGNAL( activated() ),
1015 mView, SLOT( goPrevious() ) ); 1024 mView, SLOT( goPrevious() ) );
1016 action->addTo( iconToolBar ); 1025 action->addTo( iconToolBar );
1017 } 1026 }
1018 icon = loadPixmap( pathString + "today" ); 1027 icon = loadPixmap( pathString + "today" );
1019 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); 1028 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130);
1020 if (p-> mShowIconToday) 1029 if (p-> mShowIconToday)
1021 today_action->addTo( iconToolBar ); 1030 today_action->addTo( iconToolBar );
1022 icon = loadPixmap( pathString + "1rightarrowB" ); 1031 icon = loadPixmap( pathString + "1rightarrowB" );
1023 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); 1032 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220);
1024 if (p-> mShowIconForward) { 1033 if (p-> mShowIconForward) {
1025 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); 1034 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this );
1026 connect( action, SIGNAL( activated() ), 1035 connect( action, SIGNAL( activated() ),
1027 mView, SLOT( goNext() ) ); 1036 mView, SLOT( goNext() ) );
1028 action->addTo( iconToolBar ); 1037 action->addTo( iconToolBar );
1029 } 1038 }
1030 icon = loadPixmap( pathString + "2rightarrowB" ); 1039 icon = loadPixmap( pathString + "2rightarrowB" );
1031 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); 1040 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230);
1032 if (p-> mShowIconForwardFast) { 1041 if (p-> mShowIconForwardFast) {
1033 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); 1042 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this );
1034 connect( action, SIGNAL( activated() ), 1043 connect( action, SIGNAL( activated() ),
1035 mView, SLOT( goNextMonth() ) ); 1044 mView, SLOT( goNextMonth() ) );
1036 action->addTo( iconToolBar ); 1045 action->addTo( iconToolBar );
1037 } 1046 }
1038 1047
1039 1048
1040 configureToolBarMenu->insertItem(i18n("What's This?"), 300); 1049 configureToolBarMenu->insertItem(i18n("What's This?"), 300);
1041 1050
1042 if (p-> mShowIconNewEvent) 1051 if (p-> mShowIconNewEvent)
1043 configureToolBarMenu->setItemChecked( 10, true ); 1052 configureToolBarMenu->setItemChecked( 10, true );
1044 if (p->mShowIconNewTodo ) 1053 if (p->mShowIconNewTodo )
1045 configureToolBarMenu->setItemChecked( 20, true ); 1054 configureToolBarMenu->setItemChecked( 20, true );
1046 if (p-> mShowIconSearch) 1055 if (p-> mShowIconSearch)
1047 configureToolBarMenu->setItemChecked( 120, true ); 1056 configureToolBarMenu->setItemChecked( 120, true );
1048 if (p-> mShowIconList) 1057 if (p-> mShowIconList)
1049 configureToolBarMenu->setItemChecked( 30, true ); 1058 configureToolBarMenu->setItemChecked( 30, true );
1050 if (p-> mShowIconDay1) 1059 if (p-> mShowIconDay1)
1051 configureToolBarMenu->setItemChecked( 40, true ); 1060 configureToolBarMenu->setItemChecked( 40, true );
1052 if (p-> mShowIconDay5) 1061 if (p-> mShowIconDay5)
1053 configureToolBarMenu->setItemChecked( 50, true ); 1062 configureToolBarMenu->setItemChecked( 50, true );
1063 if (p-> mShowIconDay6)
1064 configureToolBarMenu->setItemChecked( 75, true );
1054 if (p-> mShowIconDay7) 1065 if (p-> mShowIconDay7)
1055 configureToolBarMenu->setItemChecked( 60, true ); 1066 configureToolBarMenu->setItemChecked( 60, true );
1056 if (p-> mShowIconMonth) 1067 if (p-> mShowIconMonth)
1057 configureToolBarMenu->setItemChecked( 70, true ); 1068 configureToolBarMenu->setItemChecked( 70, true );
1058 if (p-> mShowIconTodoview) 1069 if (p-> mShowIconTodoview)
1059 configureToolBarMenu->setItemChecked( 80, true ); 1070 configureToolBarMenu->setItemChecked( 80, true );
1060 if (p-> mShowIconBackFast) 1071 if (p-> mShowIconBackFast)
1061 configureToolBarMenu->setItemChecked( 200, true ); 1072 configureToolBarMenu->setItemChecked( 200, true );
1062 if (p-> mShowIconBack) 1073 if (p-> mShowIconBack)
1063 configureToolBarMenu->setItemChecked( 210, true ); 1074 configureToolBarMenu->setItemChecked( 210, true );
1064 if (p-> mShowIconToday) 1075 if (p-> mShowIconToday)
1065 configureToolBarMenu->setItemChecked( 130, true ); 1076 configureToolBarMenu->setItemChecked( 130, true );
1066 if (p-> mShowIconForward) 1077 if (p-> mShowIconForward)
1067 configureToolBarMenu->setItemChecked( 220, true ); 1078 configureToolBarMenu->setItemChecked( 220, true );
1068 if (p-> mShowIconForwardFast) 1079 if (p-> mShowIconForwardFast)
1069 configureToolBarMenu->setItemChecked( 230, true ); 1080 configureToolBarMenu->setItemChecked( 230, true );
1070 if (p-> mShowIconNextDays) 1081 if (p-> mShowIconNextDays)
1071 configureToolBarMenu->setItemChecked( 100, true ); 1082 configureToolBarMenu->setItemChecked( 100, true );
1072 if (p-> mShowIconNext) 1083 if (p-> mShowIconNext)
1073 configureToolBarMenu->setItemChecked( 110, true ); 1084 configureToolBarMenu->setItemChecked( 110, true );
1074 if (p-> mShowIconJournal) 1085 if (p-> mShowIconJournal)
1075 configureToolBarMenu->setItemChecked( 90, true ); 1086 configureToolBarMenu->setItemChecked( 90, true );
1076 if (p-> mShowIconWhatsThis) 1087 if (p-> mShowIconWhatsThis)
1077 configureToolBarMenu->setItemChecked( 300, true ); 1088 configureToolBarMenu->setItemChecked( 300, true );
1078 1089
1079 QLabel* dummy = new QLabel( iconToolBar ); 1090 QLabel* dummy = new QLabel( iconToolBar );
1080 dummy->setBackgroundColor( iconToolBar->backgroundColor() ); 1091 dummy->setBackgroundColor( iconToolBar->backgroundColor() );
1081 if (!p-> mShowIconStretch) 1092 if (!p-> mShowIconStretch)
1082 iconToolBar->setStretchableWidget ( dummy ) ; 1093 iconToolBar->setStretchableWidget ( dummy ) ;
1083 else 1094 else
1084 configureToolBarMenu->setItemChecked( 5, true ); 1095 configureToolBarMenu->setItemChecked( 5, true );
1085 if (p-> mShowIconWhatsThis) 1096 if (p-> mShowIconWhatsThis)
1086 QWhatsThis::whatsThisButton ( iconToolBar ); 1097 QWhatsThis::whatsThisButton ( iconToolBar );
1087 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); 1098 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) );
1088 configureAgenda( p->mHourSize ); 1099 configureAgenda( p->mHourSize );
1089 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); 1100 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) );
1090} 1101}
1091 1102
1092void MainWindow::exportToPhone( int mode ) 1103void MainWindow::exportToPhone( int mode )
1093{ 1104{
1094 1105
1095 //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 1106 //ex2phone->insertItem(i18n("Complete calendar..."), 1 );
1096 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 1107 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
1097 KOex2phonePrefs ex2phone; 1108 KOex2phonePrefs ex2phone;
1098 1109
1099 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); 1110 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
1100 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); 1111 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
1101 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1112 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
1102 if ( mode == 1 ) 1113 if ( mode == 1 )
1103 ex2phone.setCaption(i18n("Export complete calendar")); 1114 ex2phone.setCaption(i18n("Export complete calendar"));
1104 if ( mode == 2 ) 1115 if ( mode == 2 )
1105 ex2phone.setCaption(i18n("Export filtered calendar")); 1116 ex2phone.setCaption(i18n("Export filtered calendar"));
1106 1117
1107 if ( !ex2phone.exec() ) { 1118 if ( !ex2phone.exec() ) {
1108 return; 1119 return;
1109 } 1120 }
1110 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 1121 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
1111 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 1122 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
1112 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 1123 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
1113 1124
1114 int inFuture = 0; 1125 int inFuture = 0;
1115 if ( ex2phone.mWriteBackFuture->isChecked() ) 1126 if ( ex2phone.mWriteBackFuture->isChecked() )
1116 inFuture = ex2phone.mWriteBackFutureWeeks->value(); 1127 inFuture = ex2phone.mWriteBackFutureWeeks->value();
1117 QPtrList<Incidence> delSel; 1128 QPtrList<Incidence> delSel;
@@ -1738,128 +1749,129 @@ void MainWindow::keyPressEvent ( QKeyEvent * e )
1738 1749
1739 1750
1740 default: 1751 default:
1741 e->ignore(); 1752 e->ignore();
1742 } 1753 }
1743 if ( pro > 0 ) { 1754 if ( pro > 0 ) {
1744 mView->selectFilter( pro-1 ); 1755 mView->selectFilter( pro-1 );
1745 } 1756 }
1746 if ( showSelectedDates ) { 1757 if ( showSelectedDates ) {
1747 ;// setCaptionToDates(); 1758 ;// setCaptionToDates();
1748 } 1759 }
1749 1760
1750} 1761}
1751 1762
1752void MainWindow::fillFilterMenu() 1763void MainWindow::fillFilterMenu()
1753{ 1764{
1754 selectFilterMenu->clear(); 1765 selectFilterMenu->clear();
1755 bool disable = false; 1766 bool disable = false;
1756 selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); 1767 selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 );
1757 selectFilterMenu->insertSeparator(); 1768 selectFilterMenu->insertSeparator();
1758 if ( mView->filterView()->filtersEnabled() ) { 1769 if ( mView->filterView()->filtersEnabled() ) {
1759 selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 1 ); 1770 selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 1 );
1760 } 1771 }
1761 else { 1772 else {
1762 selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 1 ); 1773 selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 1 );
1763 disable = true; 1774 disable = true;
1764 } 1775 }
1765 selectFilterMenu->insertSeparator(); 1776 selectFilterMenu->insertSeparator();
1766 QPtrList<CalFilter> fili = mView->filters(); 1777 QPtrList<CalFilter> fili = mView->filters();
1767 CalFilter *curfilter = mView->filterView()->selectedFilter(); 1778 CalFilter *curfilter = mView->filterView()->selectedFilter();
1768 CalFilter *filter = fili.first(); 1779 CalFilter *filter = fili.first();
1769 int iii = 2; 1780 int iii = 2;
1770 while(filter) { 1781 while(filter) {
1771 selectFilterMenu->insertItem( filter->name(), iii ); 1782 selectFilterMenu->insertItem( filter->name(), iii );
1772 if ( filter == curfilter) 1783 if ( filter == curfilter)
1773 selectFilterMenu->setItemChecked( iii, true ); 1784 selectFilterMenu->setItemChecked( iii, true );
1774 if ( disable ) 1785 if ( disable )
1775 selectFilterMenu->setItemEnabled( iii, false ); 1786 selectFilterMenu->setItemEnabled( iii, false );
1776 filter = fili.next(); 1787 filter = fili.next();
1777 ++iii; 1788 ++iii;
1778 } 1789 }
1779} 1790}
1780void MainWindow::selectFilter( int fil ) 1791void MainWindow::selectFilter( int fil )
1781{ 1792{
1782 if ( fil == 0 ) { 1793 if ( fil == 0 ) {
1783 mView->editFilters( ); 1794 mView->editFilters( );
1784 } else if ( fil == 1 ){ 1795 } else if ( fil == 1 ){
1785 mView->toggleFilerEnabled( ); 1796 mView->toggleFilerEnabled( );
1786 } else { 1797 } else {
1787 mView->selectFilter( fil-2 ); 1798 mView->selectFilter( fil-2 );
1788 } 1799 }
1789} 1800}
1790void MainWindow::configureToolBar( int item ) 1801void MainWindow::configureToolBar( int item )
1791{ 1802{
1792 1803
1793 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); 1804 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) );
1794 KOPrefs *p = KOPrefs::instance(); 1805 KOPrefs *p = KOPrefs::instance();
1795 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); 1806 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 );
1796 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); 1807 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 );
1797 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); 1808 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 );
1798 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); 1809 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 );
1799 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); 1810 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 );
1800 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); 1811 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 );
1801 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); 1812 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 );
1813 p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 );
1802 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); 1814 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 );
1803 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); 1815 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 );
1804 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); 1816 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 );
1805 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); 1817 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 );
1806 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); 1818 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 );
1807 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); 1819 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 );
1808 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); 1820 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 );
1809 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); 1821 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 );
1810 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); 1822 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 );
1811 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); 1823 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 );
1812 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); 1824 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 );
1813 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); 1825 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 );
1814 // initActions(); 1826 // initActions();
1815} 1827}
1816 1828
1817void MainWindow::setCaptionToDates() 1829void MainWindow::setCaptionToDates()
1818{ 1830{
1819 QString selDates; 1831 QString selDates;
1820 selDates = KGlobal::locale()->formatDate(mView->startDate(), true); 1832 selDates = KGlobal::locale()->formatDate(mView->startDate(), true);
1821 if (mView->startDate() < mView->endDate() ) 1833 if (mView->startDate() < mView->endDate() )
1822 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); 1834 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true);
1823 else { 1835 else {
1824 QString addString; 1836 QString addString;
1825 if ( mView->startDate() == QDateTime::currentDateTime().date() ) 1837 if ( mView->startDate() == QDateTime::currentDateTime().date() )
1826 addString = i18n("Today"); 1838 addString = i18n("Today");
1827 else if ( mView->startDate() == QDateTime::currentDateTime().date().addDays(1) ) 1839 else if ( mView->startDate() == QDateTime::currentDateTime().date().addDays(1) )
1828 addString = i18n("Tomorrow"); 1840 addString = i18n("Tomorrow");
1829 if ( !addString.isEmpty() ) 1841 if ( !addString.isEmpty() )
1830 selDates = addString+", "+selDates ; 1842 selDates = addString+", "+selDates ;
1831 } 1843 }
1832 setCaption( i18n("Dates: ") + selDates ); 1844 setCaption( i18n("Dates: ") + selDates );
1833 1845
1834} 1846}
1835void MainWindow::showConfigureAgenda( ) 1847void MainWindow::showConfigureAgenda( )
1836{ 1848{
1837 int iii; 1849 int iii;
1838 for ( iii = 1;iii<= 10 ;++iii ){ 1850 for ( iii = 1;iii<= 10 ;++iii ){
1839 configureAgendaMenu->setItemChecked( (iii+1)*2, false ); 1851 configureAgendaMenu->setItemChecked( (iii+1)*2, false );
1840 } 1852 }
1841 configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true ); 1853 configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true );
1842} 1854}
1843void MainWindow::configureAgenda( int item ) 1855void MainWindow::configureAgenda( int item )
1844{ 1856{
1845 if ( KOPrefs::instance()->mHourSize == item ) 1857 if ( KOPrefs::instance()->mHourSize == item )
1846 return; 1858 return;
1847 KOPrefs::instance()->mHourSize=item; 1859 KOPrefs::instance()->mHourSize=item;
1848 mView->viewManager()->agendaView()->updateConfig(); 1860 mView->viewManager()->agendaView()->updateConfig();
1849} 1861}
1850 1862
1851void MainWindow::saveCalendar() 1863void MainWindow::saveCalendar()
1852{ 1864{
1853 QString fn = KOPrefs::instance()->mLastSaveFile; 1865 QString fn = KOPrefs::instance()->mLastSaveFile;
1854 fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); 1866 fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this );
1855 1867
1856 if ( fn == "" ) 1868 if ( fn == "" )
1857 return; 1869 return;
1858 QFileInfo info; 1870 QFileInfo info;
1859 info.setFile( fn ); 1871 info.setFile( fn );
1860 QString mes; 1872 QString mes;
1861 bool createbup = true; 1873 bool createbup = true;
1862 if ( info. exists() ) { 1874 if ( info. exists() ) {
1863 mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; 1875 mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ;
1864 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 1876 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
1865 i18n("Overwrite!"), i18n("Cancel"), 0, 1877 i18n("Overwrite!"), i18n("Cancel"), 0,
diff --git a/korganizer/navigatorbar.cpp b/korganizer/navigatorbar.cpp
index b591232..934e153 100644
--- a/korganizer/navigatorbar.cpp
+++ b/korganizer/navigatorbar.cpp
@@ -28,173 +28,195 @@
28#include <qlayout.h> 28#include <qlayout.h>
29#include <qframe.h> 29#include <qframe.h>
30#include <qlabel.h> 30#include <qlabel.h>
31#include <qpopupmenu.h> 31#include <qpopupmenu.h>
32#include <qapplication.h> 32#include <qapplication.h>
33 33
34#include <kdebug.h> 34#include <kdebug.h>
35#include <klocale.h> 35#include <klocale.h>
36#include <kglobal.h> 36#include <kglobal.h>
37#include <kiconloader.h> 37#include <kiconloader.h>
38#include "libkdepim/kdatepicker.h" 38#include "libkdepim/kdatepicker.h"
39#include <knotifyclient.h> 39#include <knotifyclient.h>
40#include "kdatetbl.h" 40#include "kdatetbl.h"
41 41
42#include "koglobals.h" 42#include "koglobals.h"
43#include <kglobalsettings.h> 43#include <kglobalsettings.h>
44#include "koprefs.h" 44#include "koprefs.h"
45#ifndef KORG_NOPLUGINS 45#ifndef KORG_NOPLUGINS
46#include "kocore.h" 46#include "kocore.h"
47#endif 47#endif
48 48
49#include <kcalendarsystem.h> 49#include <kcalendarsystem.h>
50 50
51#include "navigatorbar.h" 51#include "navigatorbar.h"
52 52
53NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *name ) 53NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *name )
54 : QWidget( parent, name ) 54 : QWidget( parent, name )
55{ 55{
56 QBoxLayout *topLayout = new QHBoxLayout( this ); 56 QBoxLayout *topLayout = new QHBoxLayout( this );
57 57
58 // Set up the control buttons and date label 58 // Set up the control buttons and date label
59 mCtrlFrame = new QFrame( this ); 59 mCtrlFrame = new QFrame( this );
60 mCtrlFrame->setFrameStyle(QFrame::Panel|QFrame::Raised); 60 mCtrlFrame->setFrameStyle(QFrame::Panel|QFrame::Raised);
61 mCtrlFrame->setLineWidth(1); 61 mCtrlFrame->setLineWidth(1);
62 62
63 topLayout->addWidget( mCtrlFrame ); 63 topLayout->addWidget( mCtrlFrame );
64 64
65 QFont tfont = font(); 65 QFont tfont = font();
66 if ( QApplication::desktop()->width() >= 480 ) 66 if ( QApplication::desktop()->width() >= 480 )
67 tfont.setPointSize(tfont.pointSize()+2); 67 tfont.setPointSize(tfont.pointSize()+2);
68 tfont.setBold(true); 68 tfont.setBold(true);
69 69
70 bool isRTL = KOGlobals::self()->reverseLayout(); 70 bool isRTL = KOGlobals::self()->reverseLayout();
71#ifndef DESKTOP_VERSION 71#ifndef DESKTOP_VERSION
72 bool isDesktop = false; 72 bool isDesktop = false;
73#else 73#else
74 bool isDesktop = true; 74 bool isDesktop = true;
75#endif 75#endif
76 if ( QString ( name ) == QString("useBigPixmaps") && QApplication::desktop()->width() > 320 ) 76 if ( QString ( name ) == QString("useBigPixmaps") && QApplication::desktop()->width() > 320 )
77 isDesktop = true; 77 isDesktop = true;
78 // Create backward navigation buttons 78 // Create backward navigation buttons
79 mPrevYear = new QPushButton( mCtrlFrame ); 79 mPrevYear = new QPushButton( mCtrlFrame );
80 mPrevYear->setPixmap( SmallIcon( isDesktop ? "2leftarrowB" : "2leftarrow" ) ); 80 mPrevYear->setPixmap( SmallIcon( isDesktop ? "2leftarrowB" : "2leftarrow" ) );
81 QToolTip::add( mPrevYear, i18n("Previous Year") ); 81 QToolTip::add( mPrevYear, i18n("Previous Year") );
82 82
83 mPrevMonth = new QPushButton( mCtrlFrame ); 83 mPrevMonth = new QPushButton( mCtrlFrame );
84 mPrevMonth->setPixmap( SmallIcon( isDesktop ? "1leftarrowB" : "1leftarrow") ); 84 mPrevMonth->setPixmap( SmallIcon( isDesktop ? "1leftarrowB" : "1leftarrow") );
85 QToolTip::add( mPrevMonth, i18n("Previous Month") ); 85 QToolTip::add( mPrevMonth, i18n("Previous Month") );
86 86
87 // Create forward navigation buttons 87 // Create forward navigation buttons
88 mNextMonth = new QPushButton( mCtrlFrame ); 88 mNextMonth = new QPushButton( mCtrlFrame );
89 mNextMonth->setPixmap( SmallIcon( isDesktop ? "1rightarrowB" : "1rightarrow") ); 89 mNextMonth->setPixmap( SmallIcon( isDesktop ? "1rightarrowB" : "1rightarrow") );
90 QToolTip::add( mNextMonth, i18n("Next Month") ); 90 QToolTip::add( mNextMonth, i18n("Next Month") );
91 91
92 mPrevWeek = new QPushButton( mCtrlFrame );
93 mPrevWeek->setPixmap( SmallIcon( isDesktop ? "1leftarrowB" : "1leftarrow") );
94 QToolTip::add( mPrevWeek, i18n("Previous Week") );
95
96 // Create forward navigation buttons
97 mNextWeek = new QPushButton( mCtrlFrame );
98 mNextWeek->setPixmap( SmallIcon( isDesktop ? "1rightarrowB" : "1rightarrow") );
99 QToolTip::add( mNextWeek, i18n("Next Week") );
100
92 mNextYear = new QPushButton( mCtrlFrame ); 101 mNextYear = new QPushButton( mCtrlFrame );
93 mNextYear->setPixmap( SmallIcon( isDesktop ? "2rightarrowB": "2rightarrow") ); 102 mNextYear->setPixmap( SmallIcon( isDesktop ? "2rightarrowB": "2rightarrow") );
94 QToolTip::add( mNextYear, i18n("Next Year") ); 103 QToolTip::add( mNextYear, i18n("Next Year") );
95 mSelectMonth = new QPushButton( mCtrlFrame ); 104 mSelectMonth = new QPushButton( mCtrlFrame );
96 // Create month name label 105 // Create month name label
97 //selectMonth->setFont( tfont ); 106 //selectMonth->setFont( tfont );
98 // selectMonth->setAlignment( AlignCenter ); 107 // selectMonth->setAlignment( AlignCenter );
99 //mDateLabel = new QLabel( selectMonth ); 108 //mDateLabel = new QLabel( selectMonth );
100 //mDateLabel->setFont( tfont ); 109 //mDateLabel->setFont( tfont );
101 //mDateLabel->setAlignment( AlignCenter ); 110 //mDateLabel->setAlignment( AlignCenter );
102 if ( QString ( name ) == QString("useBigPixmaps") ) { 111 if ( QString ( name ) == QString("useBigPixmaps") ) {
103 mNextMonth->setFlat( true); 112 mNextMonth->setFlat( true);
113 mNextWeek->setFlat( true);
104 mNextYear->setFlat( true); 114 mNextYear->setFlat( true);
105 mSelectMonth->setFlat( true); 115 mSelectMonth->setFlat( true);
106 mPrevYear->setFlat( true); 116 mPrevYear->setFlat( true);
107 mPrevMonth->setFlat( true); 117 mPrevMonth->setFlat( true);
118 mPrevWeek->setFlat( true);
119 } else {
120 mPrevWeek->hide();
121 mNextWeek->hide();
108 } 122 }
109 mSelectMonth->setFont( tfont ); 123 mSelectMonth->setFont( tfont );
110 // Set minimum width to width of widest month name label 124 // Set minimum width to width of widest month name label
111 int i; 125 int i;
112 int maxwidth = 0; 126 int maxwidth = 0;
113 QFontMetrics fm ( mSelectMonth->font() ); 127 QFontMetrics fm ( mSelectMonth->font() );
114 int width = fm.width("September '00" ); 128 int width = fm.width("September '00" );
115// for( i = 1; i <= KOGlobals::self()->calendarSystem()->monthsInYear(date); 129// for( i = 1; i <= KOGlobals::self()->calendarSystem()->monthsInYear(date);
116// ++i ) { 130// ++i ) {
117// //int width = fm.width( KOGlobals::self()->calendarSystem()->monthName(i, 131// //int width = fm.width( KOGlobals::self()->calendarSystem()->monthName(i,
118// // KOGlobals::self()->calendarSystem()->year(date) ) + " 2000" ); 132// // KOGlobals::self()->calendarSystem()->year(date) ) + " 2000" );
119// int width = fm.width("September 2000" ); 133// int width = fm.width("September 2000" );
120// if ( width > maxwidth ) maxwidth = width; 134// if ( width > maxwidth ) maxwidth = width;
121// } 135// }
122 maxwidth = width+2; 136 maxwidth = width+2;
123 int size = fm.height()+2; 137 int size = fm.height()+2;
124 if ( QApplication::desktop()->width() >= 480 ) { 138 if ( QApplication::desktop()->width() >= 480 ) {
125 size += 6; 139 size += 6;
126 maxwidth+= 6; 140 maxwidth+= 6;
127 } 141 }
128 142
129 mSelectMonth->setFixedWidth( maxwidth ); 143 mSelectMonth->setFixedWidth( maxwidth );
130 mSelectMonth->setFixedHeight( size ); 144 mSelectMonth->setFixedHeight( size );
131 mPrevYear->setFixedHeight( size ); 145 mPrevYear->setFixedHeight( size );
132 mPrevMonth->setFixedHeight( size ); 146 mPrevMonth->setFixedHeight( size );
147 mPrevWeek->setFixedHeight( size );
133 mNextMonth->setFixedHeight( size ); 148 mNextMonth->setFixedHeight( size );
149 mNextWeek->setFixedHeight( size );
134 mNextYear->setFixedHeight ( size ); 150 mNextYear->setFixedHeight ( size );
135 // set up control frame layout 151 // set up control frame layout
136 QBoxLayout *ctrlLayout = new QHBoxLayout( mCtrlFrame, 1 ); 152 QBoxLayout *ctrlLayout = new QHBoxLayout( mCtrlFrame, 1 );
137 ctrlLayout->addWidget( mPrevYear, 3 ); 153 ctrlLayout->addWidget( mPrevYear, 3 );
138 ctrlLayout->addWidget( mPrevMonth, 3 ); 154 ctrlLayout->addWidget( mPrevMonth, 3 );
155 ctrlLayout->addWidget( mPrevWeek, 3 );
139 //ctrlLayout->addStretch( 1 ); 156 //ctrlLayout->addStretch( 1 );
140 // ctrlLayout->addSpacing( 1 ); 157 // ctrlLayout->addSpacing( 1 );
141 // ctrlLayout->addWidget( mDateLabel ); 158 // ctrlLayout->addWidget( mDateLabel );
142 ctrlLayout->addWidget( mSelectMonth ); 159 ctrlLayout->addWidget( mSelectMonth );
143 // ctrlLayout->addSpacing( 1 ); 160 // ctrlLayout->addSpacing( 1 );
144 // ctrlLayout->addStretch( 1 ); 161 // ctrlLayout->addStretch( 1 );
162 ctrlLayout->addWidget( mNextWeek, 3 );
145 ctrlLayout->addWidget( mNextMonth, 3 ); 163 ctrlLayout->addWidget( mNextMonth, 3 );
146 ctrlLayout->addWidget( mNextYear, 3 ); 164 ctrlLayout->addWidget( mNextYear, 3 );
147 165
148 connect( mPrevYear, SIGNAL( clicked() ), SIGNAL( goPrevYear() ) ); 166 connect( mPrevYear, SIGNAL( clicked() ), SIGNAL( goPrevYear() ) );
149 connect( mPrevMonth, SIGNAL( clicked() ), SIGNAL( goPrevMonth() ) ); 167 connect( mPrevMonth, SIGNAL( clicked() ), SIGNAL( goPrevMonth() ) );
150 connect( mNextMonth, SIGNAL( clicked() ), SIGNAL( goNextMonth() ) ); 168 connect( mNextMonth, SIGNAL( clicked() ), SIGNAL( goNextMonth() ) );
169 connect( mPrevWeek, SIGNAL( clicked() ), SIGNAL( goPrevWeek() ) );
170 connect( mNextWeek, SIGNAL( clicked() ), SIGNAL( goNextWeek() ) );
151 connect( mNextYear, SIGNAL( clicked() ), SIGNAL( goNextYear() ) ); 171 connect( mNextYear, SIGNAL( clicked() ), SIGNAL( goNextYear() ) );
152 connect( mSelectMonth, SIGNAL( clicked() ),SLOT( selectMonth() ) ); 172 connect( mSelectMonth, SIGNAL( clicked() ),SLOT( selectMonth() ) );
153 mPrevYear->setFocusPolicy(NoFocus); 173 mPrevYear->setFocusPolicy(NoFocus);
154 mPrevMonth->setFocusPolicy(NoFocus); 174 mPrevMonth->setFocusPolicy(NoFocus);
155 mNextMonth->setFocusPolicy(NoFocus); 175 mNextMonth->setFocusPolicy(NoFocus);
176 mPrevWeek->setFocusPolicy(NoFocus);
177 mNextWeek->setFocusPolicy(NoFocus);
156 mNextYear->setFocusPolicy(NoFocus); 178 mNextYear->setFocusPolicy(NoFocus);
157 mSelectMonth->setFocusPolicy(NoFocus); 179 mSelectMonth->setFocusPolicy(NoFocus);
158 setSizePolicy( QSizePolicy ( QSizePolicy::Expanding ,QSizePolicy::Fixed ) ); 180 setSizePolicy( QSizePolicy ( QSizePolicy::Expanding ,QSizePolicy::Fixed ) );
159 181
160} 182}
161 183
162NavigatorBar::~NavigatorBar() 184NavigatorBar::~NavigatorBar()
163{ 185{
164} 186}
165 187
166void NavigatorBar::selectMonth() 188void NavigatorBar::selectMonth()
167{ 189{
168 190
169 int month; 191 int month;
170 KPopupFrame* popup = new KPopupFrame(this); 192 KPopupFrame* popup = new KPopupFrame(this);
171 KDateInternalMonthPicker* picker = new KDateInternalMonthPicker(popup); 193 KDateInternalMonthPicker* picker = new KDateInternalMonthPicker(popup);
172 // ----- 194 // -----
173 picker->resize(picker->sizeHint()); 195 picker->resize(picker->sizeHint());
174 popup->setMainWidget(picker); 196 popup->setMainWidget(picker);
175 picker->setFocus(); 197 picker->setFocus();
176 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); 198 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int)));
177 if(popup->exec(mSelectMonth->mapToGlobal(QPoint(0, mSelectMonth->height())))) 199 if(popup->exec(mSelectMonth->mapToGlobal(QPoint(0, mSelectMonth->height()))))
178 { 200 {
179 month = picker->getResult(); 201 month = picker->getResult();
180 emit monthSelected ( month ); 202 emit monthSelected ( month );
181 } else { 203 } else {
182 KNotifyClient::beep(); 204 KNotifyClient::beep();
183 } 205 }
184 delete popup; 206 delete popup;
185} 207}
186void NavigatorBar::selectDates( const KCal::DateList &dateList ) 208void NavigatorBar::selectDates( const KCal::DateList &dateList )
187{ 209{
188 if (dateList.count() > 0) { 210 if (dateList.count() > 0) {
189 QDate date = dateList.first(); 211 QDate date = dateList.first();
190 212
191 const KCalendarSystem *calSys = KOGlobals::self()->calendarSystem(); 213 const KCalendarSystem *calSys = KOGlobals::self()->calendarSystem();
192 214
193 // compute the label at the top of the navigator 215 // compute the label at the top of the navigator
194 QString dtstr = i18n(calSys->monthName( date )) + " '" + 216 QString dtstr = i18n(calSys->monthName( date )) + " '" +
195 QString::number( calSys->year( date ) ).right(2); 217 QString::number( calSys->year( date ) ).right(2);
196 218
197 mSelectMonth->setText( dtstr ); 219 mSelectMonth->setText( dtstr );
198 } 220 }
199} 221}
200 222
diff --git a/korganizer/navigatorbar.h b/korganizer/navigatorbar.h
index 93240a6..803c817 100644
--- a/korganizer/navigatorbar.h
+++ b/korganizer/navigatorbar.h
@@ -1,65 +1,69 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 3
4 Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org> 4 Copyright (c) 2003 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 NAVIGATORBAR_H 24#ifndef NAVIGATORBAR_H
25#define NAVIGATORBAR_H 25#define NAVIGATORBAR_H
26 26
27#include <libkcal/incidencebase.h> 27#include <libkcal/incidencebase.h>
28 28
29#include <qwidget.h> 29#include <qwidget.h>
30 30
31class QPushButton; 31class QPushButton;
32class QFrame; 32class QFrame;
33class QLabel; 33class QLabel;
34 34
35class NavigatorBar: public QWidget 35class NavigatorBar: public QWidget
36{ 36{
37 Q_OBJECT 37 Q_OBJECT
38 public: 38 public:
39 NavigatorBar( const QDate & date, QWidget *parent = 0, const char *name = 0 ); 39 NavigatorBar( const QDate & date, QWidget *parent = 0, const char *name = 0 );
40 ~NavigatorBar(); 40 ~NavigatorBar();
41 41
42 public slots: 42 public slots:
43 void selectDates( const KCal::DateList & ); 43 void selectDates( const KCal::DateList & );
44 void selectMonth(); 44 void selectMonth();
45 45
46 signals: 46 signals:
47 void goNextMonth(); 47 void goNextMonth();
48 void goPrevMonth(); 48 void goPrevMonth();
49 void goNextWeek();
50 void goPrevWeek();
49 void goNextYear(); 51 void goNextYear();
50 void goPrevYear(); 52 void goPrevYear();
51 void monthSelected( int ); 53 void monthSelected( int );
52 54
53 private: 55 private:
54 QFrame *mCtrlFrame; 56 QFrame *mCtrlFrame;
55 57
56 QPushButton *mPrevYear; 58 QPushButton *mPrevYear;
57 QPushButton *mPrevMonth; 59 QPushButton *mPrevMonth;
58 QPushButton *mNextMonth; 60 QPushButton *mNextMonth;
61 QPushButton *mPrevWeek;
62 QPushButton *mNextWeek;
59 QPushButton *mNextYear; 63 QPushButton *mNextYear;
60 QPushButton *mSelectMonth; 64 QPushButton *mSelectMonth;
61 65
62 //QLabel *mDateLabel; 66 //QLabel *mDateLabel;
63}; 67};
64 68
65#endif 69#endif