summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/datenavigatorcontainer.cpp74
-rw-r--r--korganizer/datenavigatorcontainer.h8
-rw-r--r--korganizer/kdatenavigator.cpp2
-rw-r--r--korganizer/koagendaitem.cpp4
-rw-r--r--korganizer/koprefsdialog.cpp18
-rw-r--r--korganizer/mainwindow.cpp4
6 files changed, 65 insertions, 45 deletions
diff --git a/korganizer/datenavigatorcontainer.cpp b/korganizer/datenavigatorcontainer.cpp
index d1caff3..2290c53 100644
--- a/korganizer/datenavigatorcontainer.cpp
+++ b/korganizer/datenavigatorcontainer.cpp
@@ -1,227 +1,241 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 3
4 Copyright (c) 2001,2002,2003 Cornelius Schumacher <schumacher@kde.org> 4 Copyright (c) 2001,2002,2003 Cornelius Schumacher <schumacher@kde.org>
5 Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com> 5 Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
6 6
7 This program is free software; you can redistribute it and/or modify 7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by 8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or 9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version. 10 (at your option) any later version.
11 11
12 This program is distributed in the hope that it will be useful, 12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details. 15 GNU General Public License for more details.
16 16
17 You should have received a copy of the GNU General Public License 17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software 18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 20
21 As a special exception, permission is given to link this program 21 As a special exception, permission is given to link this program
22 with any edition of Qt, and distribute the resulting executable, 22 with any edition of Qt, and distribute the resulting executable,
23 without including the source code for Qt in the source distribution. 23 without including the source code for Qt in the source distribution.
24*/ 24*/
25 25
26#include <kdebug.h> 26#include <kdebug.h>
27#include <klocale.h> 27#include <klocale.h>
28 28
29//#include "koglobals.h" 29//#include "koglobals.h"
30#include "navigatorbar.h" 30#include "navigatorbar.h"
31#include "kdatenavigator.h" 31#include "kdatenavigator.h"
32 32
33#include <kcalendarsystem.h> 33#include <kcalendarsystem.h>
34 34
35#include "datenavigatorcontainer.h" 35#include "datenavigatorcontainer.h"
36#include "koprefs.h" 36#include "koprefs.h"
37 37
38DateNavigatorContainer::DateNavigatorContainer( QWidget *parent, 38DateNavigatorContainer::DateNavigatorContainer( QWidget *parent,
39 const char *name ) 39 const char *name )
40 : QWidget( parent, name ), mCalendar( 0 ), 40 : QWidget( parent, name ), mCalendar( 0 ),
41 mHorizontalCount( 1 ), mVerticalCount( 1 ) 41 mHorizontalCount( 1 ), mVerticalCount( 1 )
42{ 42{
43 mExtraViews.setAutoDelete( true ); 43 mExtraViews.setAutoDelete( true );
44 44
45 mNavigatorView = new KDateNavigator( this, name ); 45 mNavigatorView = new KDateNavigator( this, name );
46 46
47 connectNavigatorView( mNavigatorView ); 47 connectNavigatorView( mNavigatorView );
48 //setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) ); 48 //setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) );
49 mLastDisplayedDN = 0; 49 mLastDisplayedDN = 0;
50 mUpdateTimer; 50 mUpdateTimer;
51 mUpdateTimer = new QTimer( this ); 51 mUpdateTimer = new QTimer( this );
52 connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( checkUpdateDayMatrixDates() )); 52 connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( checkUpdateDayMatrixDates() ));
53 mFirstSelectedDate = QDate::currentDate(); 53 mFirstSelectedDate = QDate::currentDate();
54 mSelectedDateCount = 1; 54 mSelectedDateCount = 1;
55} 55}
56 56
57DateNavigatorContainer::~DateNavigatorContainer() 57DateNavigatorContainer::~DateNavigatorContainer()
58{ 58{
59} 59}
60 60
61void DateNavigatorContainer::connectNavigatorView( KDateNavigator *v ) 61void DateNavigatorContainer::connectNavigatorView( KDateNavigator *v )
62{ 62{
63 connect( v, SIGNAL( datesSelected( const KCal::DateList & ) ), 63 connect( v, SIGNAL( datesSelected( const KCal::DateList & ) ),
64 SIGNAL( datesSelected( const KCal::DateList & ) ) ); 64 SIGNAL( datesSelected( const KCal::DateList & ) ) );
65#if 0 65#if 0
66 connect( v, SIGNAL( incidenceDropped( Incidence *, const QDate & ) ), 66 connect( v, SIGNAL( incidenceDropped( Incidence *, const QDate & ) ),
67 SIGNAL( incidenceDropped( Incidence *, const QDate & ) ) ); 67 SIGNAL( incidenceDropped( Incidence *, const QDate & ) ) );
68 connect( v, SIGNAL( incidenceDroppedMove( Incidence *, const QDate & ) ), 68 connect( v, SIGNAL( incidenceDroppedMove( Incidence *, const QDate & ) ),
69 SIGNAL( incidenceDroppedMove( Incidence *, const QDate & ) ) ); 69 SIGNAL( incidenceDroppedMove( Incidence *, const QDate & ) ) );
70#endif 70#endif
71 connect( v, SIGNAL( weekClicked( const QDate & ) ), 71 connect( v, SIGNAL( weekClicked( const QDate & ) ),
72 SIGNAL( weekClicked( const QDate & ) ) ); 72 SIGNAL( weekClicked( const QDate & ) ) );
73 73
74 connect( v, SIGNAL( goPrevious() ), SIGNAL( goPrevious() ) ); 74 connect( v, SIGNAL( goPrevious() ), SIGNAL( goPrevious() ) );
75 connect( v, SIGNAL( goNext() ), SIGNAL( goNext() ) ); 75 connect( v, SIGNAL( goNext() ), SIGNAL( goNext() ) );
76 76
77 connect( v, SIGNAL( goNextMonth() ), SIGNAL( goNextMonth() ) ); 77 connect( v, SIGNAL( goNextMonth() ), SLOT( slotgoNextMonth() ) );
78 connect( v, SIGNAL( goPrevMonth() ), SIGNAL( goPrevMonth() ) ); 78 connect( v, SIGNAL( goPrevMonth() ), SLOT( slotgoPrevMonth() ) );
79 connect( v, SIGNAL( goNextYear() ), SIGNAL( goNextYear() ) ); 79 connect( v, SIGNAL( goNextYear() ), SLOT( slotgoNextYear() ) );
80 connect( v, SIGNAL( goPrevYear() ), SIGNAL( goPrevYear() ) ); 80 connect( v, SIGNAL( goPrevYear() ), SLOT( slotgoPrevYear() ) );
81 81
82 connect( v, SIGNAL( monthSelected( int ) ), SLOT( slotMonthSelected( int ) ) ); 82 connect( v, SIGNAL( monthSelected( int ) ), SLOT( slotMonthSelected( int ) ) );
83} 83}
84void DateNavigatorContainer::slotgoNextYear()
85{
86 jumpMonth( 12 );
87 emit goNextYear();
88
89}
90void DateNavigatorContainer::slotgoPrevYear()
91{
92 jumpMonth( -12 );
93 emit goPrevYear();
94
95}
96void DateNavigatorContainer::slotgoPrevMonth()
97{
98 jumpMonth( -1 );
99 emit goPrevMonth();
100
101}
102void DateNavigatorContainer::slotgoNextMonth()
103{
104 jumpMonth( 1 );
105 emit goNextMonth();
106}
107void DateNavigatorContainer::jumpMonth( int month )
108{
84 109
110 QDate baseDate = mNavigatorView->baseDate();
111 computeMonthSelected( baseDate.month() + month, false );
112}
85void DateNavigatorContainer::slotMonthSelected( int month ) 113void DateNavigatorContainer::slotMonthSelected( int month )
86{ 114{
87 //qDebug("slotMonthSelected %d ", month); 115 computeMonthSelected( month, true );
116}
117void DateNavigatorContainer::computeMonthSelected( int month , bool forceEmit )
118{
119 //qDebug("slotMonthSelected %d ", month);
88 QDate baseDate = mNavigatorView->baseDate(); 120 QDate baseDate = mNavigatorView->baseDate();
89 if ( baseDate.month() == month ) 121 if ( baseDate.month() == month )
90 return; 122 return;
91 //qDebug("month %d %d ",baseDate.month(),month); 123 //qDebug("month %d %d ",baseDate.month(),month);
92 QDate date = QDate ( baseDate.year(), baseDate.month() , 15 ); 124 QDate date = QDate ( baseDate.year(), baseDate.month() , 15 );
93 date = date.addDays( -(baseDate.month()-month ) *30 ); 125 date = date.addDays( -(baseDate.month()-month ) *30 );
94 QDate newBase = QDate ( date.year(), date.month() , baseDate.day() ); 126 QDate newBase = QDate ( date.year(), date.month() , baseDate.day() );
95 127
96#if 0
97 mFirstSelectedDate = dateList.first() ;
98 mSelectedDateCount = dateList.count() ;
99
100 KDateNavigator *view = mExtraViews.at( 0 );
101 QDate date = view->baseDate();
102
103 QDate curEnd = date.addDays( (mLastDisplayedDN)*30 +7);
104 //qDebug("End %s %s ",lDate.toString().latin1(),curEnd.toString().latin1() );
105 if ( lDate < curEnd && date.addDays( -30 ) < fDate) {
106 mNavigatorView->dayMatrix()->setSelectedDaysFrom( fDate , lDate );
107 mNavigatorView->dayMatrix()->repaint( false );
108 for( uint i = 0; i < mLastDisplayedDN; ++i ) {
109 KDateNavigator *n = mExtraViews.at( i );
110 if ( n->dayMatrix()->setSelectedDaysFrom( fDate , lDate ) ) {
111 n->dayMatrix()->repaint( false );
112 }
113 }
114 return;
115 }
116#endif
117 //qDebug("NEW BASE %s", newBase.toString().latin1()); 128 //qDebug("NEW BASE %s", newBase.toString().latin1());
118 mNavigatorView->setBaseDate( newBase ); 129 mNavigatorView->setBaseDate( newBase );
119 QDate last = lastAvailableDate(); 130 QDate last = lastAvailableDate();
120 QDate first = firstAvailableDate(); 131 QDate first = firstAvailableDate();
121 132
122 QDate selFirst = mFirstSelectedDate; 133 QDate selFirst = mFirstSelectedDate;
123 QDate selLast = selFirst.addDays( mSelectedDateCount-1 ); 134 QDate selLast = selFirst.addDays( mSelectedDateCount-1 );
124 if ( selFirst >= first && selLast <= last ) { 135 if ( selFirst >= first && selLast <= last ) {
125 setBaseDates(); 136 setBaseDates();
126 updateDayMatrixDates(); 137 if ( forceEmit )
138 updateDayMatrixDates();
127 } 139 }
128 else { 140 else {
129 setBaseDates(); 141 setBaseDates();
130 updateDayMatrixDates(); 142 if ( forceEmit )
131 emit monthSelected( month ); 143 updateDayMatrixDates();
144 if ( forceEmit )
145 emit monthSelected( month );
132 } 146 }
133} 147}
134void DateNavigatorContainer::setCalendar( Calendar *cal ) 148void DateNavigatorContainer::setCalendar( Calendar *cal )
135{ 149{
136 mCalendar = cal; 150 mCalendar = cal;
137 mNavigatorView->setCalendar( cal ); 151 mNavigatorView->setCalendar( cal );
138 for( uint i = 0; i < mLastDisplayedDN; ++i ) { 152 for( uint i = 0; i < mLastDisplayedDN; ++i ) {
139 KDateNavigator *n = mExtraViews.at( i ); 153 KDateNavigator *n = mExtraViews.at( i );
140 n->setCalendar( cal ); 154 n->setCalendar( cal );
141 } 155 }
142} 156}
143void DateNavigatorContainer::checkUpdateDayMatrixDates() 157void DateNavigatorContainer::checkUpdateDayMatrixDates()
144{ 158{
145 //qDebug("KODNC: wid %d hei %d ", width(), height()); 159 //qDebug("KODNC: wid %d hei %d ", width(), height());
146 mUpdateTimer->stop(); 160 mUpdateTimer->stop();
147 //return; 161 //return;
148 if ( width() < 3 || height() < 3 ) 162 if ( width() < 3 || height() < 3 )
149 return; 163 return;
150 static int lastWid = 0; 164 static int lastWid = 0;
151 static int lastHei = 0; 165 static int lastHei = 0;
152 if ( lastWid == width() && height() == lastHei ) { 166 if ( lastWid == width() && height() == lastHei ) {
153 qDebug("KODNC: No layout computing needed. "); 167 qDebug("KODNC: No layout computing needed. ");
154 } else { 168 } else {
155 lastWid = width(); 169 lastWid = width();
156 lastHei = height(); 170 lastHei = height();
157 171
158 QSize minSize = mNavigatorView->yourSizeHint(); 172 QSize minSize = mNavigatorView->yourSizeHint();
159 173
160 int verticalCount = size().height() / minSize.height(); 174 int verticalCount = size().height() / minSize.height();
161 int horizontalCount = size().width() / minSize.width(); 175 int horizontalCount = size().width() / minSize.width();
162 //qDebug(" wattdatt %d new %d %d ", size().width() ,e->size().width() , minSize.width() ); 176 //qDebug(" wattdatt %d new %d %d ", size().width() ,e->size().width() , minSize.width() );
163 //qDebug("COUNT %d %d %d %d ", verticalCount, horizontalCount , mVerticalCount, mHorizontalCount ); 177 //qDebug("COUNT %d %d %d %d ", verticalCount, horizontalCount , mVerticalCount, mHorizontalCount );
164 bool fontchange = false; 178 bool fontchange = false;
165 if ( horizontalCount == 1) 179 if ( horizontalCount == 1)
166 horizontalCount = size().width() / mNavigatorView->yourFullSizeHint().width(); 180 horizontalCount = size().width() / mNavigatorView->yourFullSizeHint().width();
167 QFont fo; 181 QFont fo;
168 if ( horizontalCount != mHorizontalCount || 182 if ( horizontalCount != mHorizontalCount ||
169 verticalCount != mVerticalCount ) { 183 verticalCount != mVerticalCount ) {
170 uint count = horizontalCount * verticalCount; 184 uint count = horizontalCount * verticalCount;
171 if ( count == 0 ) { 185 if ( count == 0 ) {
172 bool ok; 186 bool ok;
173 fo = mNavigatorView->yourFontHint( size() , &ok ); 187 fo = mNavigatorView->yourFontHint( size() , &ok );
174 //mNavigatorView->resize( size() ); 188 //mNavigatorView->resize( size() );
175 //if ( ! ok ) 189 //if ( ! ok )
176 // return; 190 // return;
177 int butt = 2; 191 int butt = 2;
178 horizontalCount = size().width() / mNavigatorView->sizeHintTwoButtons( ).width(); 192 horizontalCount = size().width() / mNavigatorView->sizeHintTwoButtons( ).width();
179 if ( horizontalCount <= 1 ) 193 if ( horizontalCount <= 1 )
180 minSize = mNavigatorView->sizeHintTwoButtons( 4 ); 194 minSize = mNavigatorView->sizeHintTwoButtons( 4 );
181 else 195 else
182 minSize = mNavigatorView->sizeHintTwoButtons(); 196 minSize = mNavigatorView->sizeHintTwoButtons();
183 verticalCount = size().height() / minSize.height(); 197 verticalCount = size().height() / minSize.height();
184 horizontalCount = size().width() / minSize.width(); 198 horizontalCount = size().width() / minSize.width();
185 if ( horizontalCount == 0 ) 199 if ( horizontalCount == 0 )
186 horizontalCount = 1; 200 horizontalCount = 1;
187 if ( verticalCount == 0 ) 201 if ( verticalCount == 0 )
188 verticalCount = 1; 202 verticalCount = 1;
189 fontchange = true; 203 fontchange = true;
190 count = horizontalCount * verticalCount; 204 count = horizontalCount * verticalCount;
191 } else { 205 } else {
192 if ( mNavigatorView->fontChanged() ) { 206 if ( mNavigatorView->fontChanged() ) {
193 fontchange = true; 207 fontchange = true;
194 fo = KOPrefs::instance()->mDateNavigatorFont; 208 fo = KOPrefs::instance()->mDateNavigatorFont;
195 mNavigatorView->changeFont( fo ); 209 mNavigatorView->changeFont( fo );
196 mNavigatorView->unsetFontChanged(); 210 mNavigatorView->unsetFontChanged();
197 } 211 }
198 } 212 }
199 213
200 mLastDisplayedDN = horizontalCount*verticalCount-1; 214 mLastDisplayedDN = horizontalCount*verticalCount-1;
201 while ( count > ( mExtraViews.count() + 1 ) ) { 215 while ( count > ( mExtraViews.count() + 1 ) ) {
202 KDateNavigator *n = new KDateNavigator( this ); 216 KDateNavigator *n = new KDateNavigator( this );
203 n->setMonthSignalOffset ( mExtraViews.count()+1 ); 217 n->setMonthSignalOffset ( mExtraViews.count()+1 );
204 mExtraViews.append( n ); 218 mExtraViews.append( n );
205 n->setCalendar( mCalendar ); 219 n->setCalendar( mCalendar );
206 connectNavigatorView( n ); 220 connectNavigatorView( n );
207 n->show(); 221 n->show();
208 } 222 }
209 int iii = 0; 223 int iii = 0;
210 while ( iii < ( mExtraViews.count() ) ) { 224 while ( iii < ( mExtraViews.count() ) ) {
211 if ( iii < count-1 ) 225 if ( iii < count-1 )
212 mExtraViews.at( iii )->show(); 226 mExtraViews.at( iii )->show();
213 else 227 else
214 mExtraViews.at( iii )->hide(); 228 mExtraViews.at( iii )->hide();
215 ++iii; 229 ++iii;
216 } 230 }
217 231
218 setBaseDates(); 232 setBaseDates();
219 if ( fontchange ) { 233 if ( fontchange ) {
220 //mNavigatorView->changeFont( fo ); 234 //mNavigatorView->changeFont( fo );
221 uint i; 235 uint i;
222 for( i = 0; i < mExtraViews.count(); ++i ) { 236 for( i = 0; i < mExtraViews.count(); ++i ) {
223 KDateNavigator *view = mExtraViews.at( i ); 237 KDateNavigator *view = mExtraViews.at( i );
224 view->changeFont( fo ); 238 view->changeFont( fo );
225 } 239 }
226 } 240 }
227 mHorizontalCount = horizontalCount; 241 mHorizontalCount = horizontalCount;
diff --git a/korganizer/datenavigatorcontainer.h b/korganizer/datenavigatorcontainer.h
index 9a64720..d2f397d 100644
--- a/korganizer/datenavigatorcontainer.h
+++ b/korganizer/datenavigatorcontainer.h
@@ -1,100 +1,106 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 3
4 Copyright (c) 2004 Cornelius Schumacher <schumacher@kde.org> 4 Copyright (c) 2004 Cornelius Schumacher <schumacher@kde.org>
5 Copyright (C) 2004 Reinhold Kainhofer <reinhold@kainhofer.com> 5 Copyright (C) 2004 Reinhold Kainhofer <reinhold@kainhofer.com>
6 6
7 This program is free software; you can redistribute it and/or modify 7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by 8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or 9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version. 10 (at your option) any later version.
11 11
12 This program is distributed in the hope that it will be useful, 12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details. 15 GNU General Public License for more details.
16 16
17 You should have received a copy of the GNU General Public License 17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software 18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 20
21 As a special exception, permission is given to link this program 21 As a special exception, permission is given to link this program
22 with any edition of Qt, and distribute the resulting executable, 22 with any edition of Qt, and distribute the resulting executable,
23 without including the source code for Qt in the source distribution. 23 without including the source code for Qt in the source distribution.
24*/ 24*/
25#ifndef DATENAVIGATORCONTAINER_H 25#ifndef DATENAVIGATORCONTAINER_H
26#define DATENAVIGATORCONTAINER_H 26#define DATENAVIGATORCONTAINER_H
27 27
28class KDateNavigator; 28class KDateNavigator;
29 29
30#include <qwidget.h> 30#include <qwidget.h>
31#include <qtimer.h> 31#include <qtimer.h>
32#include <libkcal/calendar.h> 32#include <libkcal/calendar.h>
33using namespace KCal; 33using namespace KCal;
34 34
35class DateNavigatorContainer: public QWidget 35class DateNavigatorContainer: public QWidget
36{ 36{
37 Q_OBJECT 37 Q_OBJECT
38 public: 38 public:
39 DateNavigatorContainer( QWidget *parent = 0, const char *name = 0 ); 39 DateNavigatorContainer( QWidget *parent = 0, const char *name = 0 );
40 ~DateNavigatorContainer(); 40 ~DateNavigatorContainer();
41 41
42 /** 42 /**
43 Associate date navigator with a calendar. It is used by KODayMatrix. 43 Associate date navigator with a calendar. It is used by KODayMatrix.
44 */ 44 */
45 void setCalendar( Calendar * ); 45 void setCalendar( Calendar * );
46 46
47 QSize minimumSizeHint() const; 47 QSize minimumSizeHint() const;
48 QSize sizeHint() const; 48 QSize sizeHint() const;
49 KDateNavigator * navigatorView() { return mNavigatorView;} 49 KDateNavigator * navigatorView() { return mNavigatorView;}
50 QDate lastAvailableDate() const ; 50 QDate lastAvailableDate() const ;
51 QDate firstAvailableDate() const ; 51 QDate firstAvailableDate() const ;
52 52
53 public slots: 53 public slots:
54 void selectDates( const KCal::DateList & ); 54 void selectDates( const KCal::DateList & );
55 void updateView(); 55 void updateView();
56 void updateConfig(); 56 void updateConfig();
57 void updateDayMatrix(); 57 void updateDayMatrix();
58 void updateDayMatrixDates(); 58 void updateDayMatrixDates();
59 void checkUpdateDayMatrixDates(); 59 void checkUpdateDayMatrixDates();
60 void updateToday(); 60 void updateToday();
61 void slotMonthSelected( int month ); 61 void slotMonthSelected( int month );
62 void slotgoNextMonth();
63 void slotgoPrevMonth();
64 void slotgoNextYear();
65 void slotgoPrevYear();
62 66
63 signals: 67 signals:
64 void datesSelected( const KCal::DateList & ); 68 void datesSelected( const KCal::DateList & );
65 void incidenceDropped( Incidence *, const QDate & ); 69 void incidenceDropped( Incidence *, const QDate & );
66 void incidenceDroppedMove( Incidence *, const QDate & ); 70 void incidenceDroppedMove( Incidence *, const QDate & );
67 void weekClicked( const QDate &); 71 void weekClicked( const QDate &);
68 72
69 void goPrevious(); 73 void goPrevious();
70 void goNext(); 74 void goNext();
71 75
72 void goNextMonth(); 76 void goNextMonth();
73 void goPrevMonth(); 77 void goPrevMonth();
74 void goNextYear(); 78 void goNextYear();
75 void goPrevYear(); 79 void goPrevYear();
76 80
77 void monthSelected( int month ); 81 void monthSelected( int month );
78 82
79 protected: 83 protected:
84 void computeMonthSelected( int month , bool forceEmit );
85 void jumpMonth( int month );
80 void resizeEvent( QResizeEvent * ); 86 void resizeEvent( QResizeEvent * );
81 87
82 void setBaseDates(); 88 void setBaseDates();
83 void connectNavigatorView( KDateNavigator *v ); 89 void connectNavigatorView( KDateNavigator *v );
84 90
85 private: 91 private:
86 QTimer* mUpdateTimer; 92 QTimer* mUpdateTimer;
87 int mLastDisplayedDN; 93 int mLastDisplayedDN;
88 QDate mFirstSelectedDate; 94 QDate mFirstSelectedDate;
89 int mSelectedDateCount; 95 int mSelectedDateCount;
90 KDateNavigator *mNavigatorView; 96 KDateNavigator *mNavigatorView;
91 97
92 KCal::Calendar *mCalendar; 98 KCal::Calendar *mCalendar;
93 99
94 QPtrList<KDateNavigator> mExtraViews; 100 QPtrList<KDateNavigator> mExtraViews;
95 101
96 int mHorizontalCount; 102 int mHorizontalCount;
97 int mVerticalCount; 103 int mVerticalCount;
98}; 104};
99 105
100#endif 106#endif
diff --git a/korganizer/kdatenavigator.cpp b/korganizer/kdatenavigator.cpp
index d62402f..6438c9a 100644
--- a/korganizer/kdatenavigator.cpp
+++ b/korganizer/kdatenavigator.cpp
@@ -26,193 +26,193 @@
26#include <qlayout.h> 26#include <qlayout.h>
27#include <qtimer.h> 27#include <qtimer.h>
28#include <qframe.h> 28#include <qframe.h>
29#include <qlabel.h> 29#include <qlabel.h>
30#include <qapplication.h> 30#include <qapplication.h>
31 31
32#include <kdebug.h> 32#include <kdebug.h>
33#include <klocale.h> 33#include <klocale.h>
34#include <kglobal.h> 34#include <kglobal.h>
35 35
36#include "koglobals.h" 36#include "koglobals.h"
37#include "koprefs.h" 37#include "koprefs.h"
38#ifndef KORG_NOPLUGINS 38#ifndef KORG_NOPLUGINS
39#include "kocore.h" 39#include "kocore.h"
40#endif 40#endif
41 41
42#include <kcalendarsystem.h> 42#include <kcalendarsystem.h>
43 43
44#include "navigatorbar.h" 44#include "navigatorbar.h"
45 45
46#include "kdatenavigator.h" 46#include "kdatenavigator.h"
47 47
48KDateNavigator::KDateNavigator( QWidget *parent, const char *name ) 48KDateNavigator::KDateNavigator( QWidget *parent, const char *name )
49 : QFrame(parent, name), 49 : QFrame(parent, name),
50 updateTimer(0L) 50 updateTimer(0L)
51{ 51{
52 setFrameStyle(QFrame::NoFrame); 52 setFrameStyle(QFrame::NoFrame);
53 QDate startDate = QDate::currentDate(); 53 QDate startDate = QDate::currentDate();
54 QGridLayout *topLayout = new QGridLayout(this,8,8); 54 QGridLayout *topLayout = new QGridLayout(this,8,8);
55 55
56 if (! startDate.isValid()) { 56 if (! startDate.isValid()) {
57 qDebug("KDateNavigator::invalid startdate "); 57 qDebug("KDateNavigator::invalid startdate ");
58 startDate = QDate::currentDate(); 58 startDate = QDate::currentDate();
59 } 59 }
60 mMonthSignalOffset = 0; 60 mMonthSignalOffset = 0;
61 mSelectedDates.append(startDate); 61 mSelectedDates.append(startDate);
62 m_MthYr = startDate; 62 m_MthYr = startDate;
63 m_bShowWeekNums = true; 63 m_bShowWeekNums = true;
64 64
65 setFont( KOPrefs::instance()->mDateNavigatorFont ); 65 setFont( KOPrefs::instance()->mDateNavigatorFont );
66 mNavigatorBar = new NavigatorBar( startDate, this ); 66 mNavigatorBar = new NavigatorBar( startDate, this );
67 topLayout->addMultiCellWidget( mNavigatorBar, 0, 0, 0, 7 ); 67 topLayout->addMultiCellWidget( mNavigatorBar, 0, 0, 0, 7 );
68 //mNavigatorBar->resize( 1,1); 68 //mNavigatorBar->resize( 1,1);
69 connect( mNavigatorBar, SIGNAL( goPrevYear() ), SIGNAL( goPrevYear() ) ); 69 connect( mNavigatorBar, SIGNAL( goPrevYear() ), SIGNAL( goPrevYear() ) );
70 connect( mNavigatorBar, SIGNAL( goPrevMonth() ), SIGNAL( goPrevMonth() ) ); 70 connect( mNavigatorBar, SIGNAL( goPrevMonth() ), SIGNAL( goPrevMonth() ) );
71 connect( mNavigatorBar, SIGNAL( goNextMonth() ), SIGNAL( goNextMonth() ) ); 71 connect( mNavigatorBar, SIGNAL( goNextMonth() ), SIGNAL( goNextMonth() ) );
72 connect( mNavigatorBar, SIGNAL( goNextYear() ), SIGNAL( goNextYear() ) ); 72 connect( mNavigatorBar, SIGNAL( goNextYear() ), SIGNAL( goNextYear() ) );
73 connect( mNavigatorBar, SIGNAL( monthSelected( int ) ), SLOT( slotMonthSelected( int ) ) ); 73 connect( mNavigatorBar, SIGNAL( monthSelected( int ) ), SLOT( slotMonthSelected( int ) ) );
74 74
75 // get the day of the week on the first day 75 // get the day of the week on the first day
76 QDate dayone(m_MthYr.year(), m_MthYr.month(), 1); 76 QDate dayone(m_MthYr.year(), m_MthYr.month(), 1);
77 m_fstDayOfWk = dayone.dayOfWeek(); 77 m_fstDayOfWk = dayone.dayOfWeek();
78 78
79 int i; 79 int i;
80 80
81 // Set up the heading fields. 81 // Set up the heading fields.
82 for( i = 0; i < 7; i++ ) { 82 for( i = 0; i < 7; i++ ) {
83 headings[i] = new QLabel("",this); 83 headings[i] = new QLabel("",this);
84 //headings[i]->setFont(QFont("Arial", 10, QFont::Bold)); 84 //headings[i]->setFont(QFont("Arial", 10, QFont::Bold));
85 headings[i]->setAlignment(AlignCenter); 85 headings[i]->setAlignment(AlignCenter);
86 headings[i]->installEventFilter(this); 86 headings[i]->installEventFilter(this);
87 87
88 topLayout->addWidget(headings[i],1,i+1); 88 topLayout->addWidget(headings[i],1,i+1);
89 } 89 }
90 90
91 // Create the weeknumber labels 91 // Create the weeknumber labels
92 for( i = 0; i < 6; i++ ) { 92 for( i = 0; i < 6; i++ ) {
93 weeknos[i] = new QLabel(this); 93 weeknos[i] = new QLabel(this);
94 weeknos[i]->setAlignment(AlignCenter); 94 weeknos[i]->setAlignment(AlignCenter);
95 //weeknos[i]->setFont(QFont("Arial", 10)); 95 //weeknos[i]->setFont(QFont("Arial", 10));
96 if(!m_bShowWeekNums) { 96 if(!m_bShowWeekNums) {
97 weeknos[i]->hide(); 97 weeknos[i]->hide();
98 } 98 }
99 weeknos[i]->installEventFilter(this); 99 weeknos[i]->installEventFilter(this);
100 100
101 topLayout->addWidget(weeknos[i],i+2,0); 101 topLayout->addWidget(weeknos[i],i+2,0);
102 } 102 }
103 103
104 daymatrix = new KODayMatrix( this, "KDateNavigator::DayMatrix"); 104 daymatrix = new KODayMatrix( this, "KDateNavigator::DayMatrix");
105 daymatrix->setFrameStyle(QFrame::Panel|QFrame::Sunken); 105 daymatrix->setFrameStyle(QFrame::Panel|QFrame::Sunken);
106 daymatrix->setLineWidth(1); 106 daymatrix->setLineWidth(1);
107 107
108 connect( daymatrix, SIGNAL( selected( const KCal::DateList & ) ), 108 connect( daymatrix, SIGNAL( selected( const KCal::DateList & ) ),
109 SIGNAL( datesSelected( const KCal::DateList & ) ) ); 109 SIGNAL( datesSelected( const KCal::DateList & ) ) );
110 110
111 connect( daymatrix, SIGNAL( eventDropped( Event * ) ), 111 connect( daymatrix, SIGNAL( eventDropped( Event * ) ),
112 SIGNAL( eventDropped( Event * ) ) ); 112 SIGNAL( eventDropped( Event * ) ) );
113 113
114 topLayout->addMultiCellWidget(daymatrix,2,7,1,7); 114 topLayout->addMultiCellWidget(daymatrix,2,7,1,7);
115 115
116 // read settings from configuration file. 116 // read settings from configuration file.
117 updateConfig(); 117 updateConfig();
118 enableRollover(FollowMonth); 118 enableRollover(FollowMonth);
119 mySizeHint = sizeHintTwoButtons(); 119 mySizeHint = sizeHintTwoButtons();
120 myFullSizeHint = sizeHintTwoButtons( 4 ); 120 myFullSizeHint = sizeHintTwoButtons( 4 );
121 mFontChanged = false; 121 mFontChanged = false;
122 resize ( mySizeHint ); 122 resize ( 0,0 );
123} 123}
124void KDateNavigator::changeFont ( QFont fo ) 124void KDateNavigator::changeFont ( QFont fo )
125{ 125{
126 setFont( fo ); 126 setFont( fo );
127 mNavigatorBar->resetFont( fo ); 127 mNavigatorBar->resetFont( fo );
128} 128}
129QFont KDateNavigator::yourFontHint( QSize si , bool *b) 129QFont KDateNavigator::yourFontHint( QSize si , bool *b)
130{ 130{
131 QFont fo = KOPrefs::instance()->mDateNavigatorFont; 131 QFont fo = KOPrefs::instance()->mDateNavigatorFont;
132 *b = false; 132 *b = false;
133 int fontPoint = fo.pointSize(); 133 int fontPoint = fo.pointSize();
134 while ( fontPoint > 5 ) { 134 while ( fontPoint > 5 ) {
135 --fontPoint; 135 --fontPoint;
136 fo.setPointSize( fontPoint ); 136 fo.setPointSize( fontPoint );
137 setFont( fo ); 137 setFont( fo );
138 mFontChanged = true; 138 mFontChanged = true;
139 mNavigatorBar->resetFont( fo ); 139 mNavigatorBar->resetFont( fo );
140 QSize sh = sizeHintTwoButtons( 2 ); 140 QSize sh = sizeHintTwoButtons( 2 );
141 //qDebug("fp %d %d %d %d %d", fontPoint, si.width() , sh.width() , si.height() , sh.height() ); 141 //qDebug("fp %d %d %d %d %d", fontPoint, si.width() , sh.width() , si.height() , sh.height() );
142 if ( si.width() > sh.width() && si.height() > sh.height()) { 142 if ( si.width() > sh.width() && si.height() > sh.height()) {
143 if ( si.width() / sh.width() == 1 ) { 143 if ( si.width() / sh.width() == 1 ) {
144 if ( si.width() < sizeHintTwoButtons( 4 ).width()) 144 if ( si.width() < sizeHintTwoButtons( 4 ).width())
145 continue; 145 continue;
146 } 146 }
147 *b = true; 147 *b = true;
148 //qDebug("fooooooooooooooooooooooouuuuund "); 148 //qDebug("fooooooooooooooooooooooouuuuund ");
149 break; 149 break;
150 } 150 }
151 } 151 }
152 //qDebug("returnnnnnnnnnnnnnnnnnnn %d", fo.pointSize() ); 152 //qDebug("returnnnnnnnnnnnnnnnnnnn %d", fo.pointSize() );
153 return fo; 153 return fo;
154} 154}
155QSize KDateNavigator::sizeHint() const 155QSize KDateNavigator::sizeHint() const
156{ 156{
157 QFontMetrics fm ( font() ); 157 QFontMetrics fm ( font() );
158 QSize day = daymatrix->sizeHint(); 158 QSize day = daymatrix->sizeHint();
159 QSize nav = mNavigatorBar->sizeHint(); 159 QSize nav = mNavigatorBar->sizeHint();
160 int wid = fm.width( "30") + day.width()+3; 160 int wid = fm.width( "30") + day.width()+3;
161 int hei = fm.height() +day.height()+nav.height()+2; 161 int hei = fm.height() +day.height()+nav.height()+2;
162 if ( wid < nav.width() ) 162 if ( wid < nav.width() )
163 wid = nav.width() ; 163 wid = nav.width() ;
164 //qDebug("KDateNavigator+++++++++++++ %d %d", wid , hei); 164 //qDebug("KDateNavigator+++++++++++++ %d %d", wid , hei);
165 return QSize ( wid, hei ); 165 return QSize ( wid, hei );
166} 166}
167QSize KDateNavigator::sizeHintTwoButtons( int butnum ) const 167QSize KDateNavigator::sizeHintTwoButtons( int butnum ) const
168{ 168{
169 QFontMetrics fm ( font() ); 169 QFontMetrics fm ( font() );
170 QSize day = daymatrix->sizeHint(); 170 QSize day = daymatrix->sizeHint();
171 QSize nav = mNavigatorBar->sizeHintTwoButtons( butnum ); 171 QSize nav = mNavigatorBar->sizeHintTwoButtons( butnum );
172 int wid = fm.width( "30") + day.width()+3; 172 int wid = fm.width( "30") + day.width()+3;
173 int hei = fm.height() +day.height()+nav.height()+2; 173 int hei = fm.height() +day.height()+nav.height()+2;
174 if ( wid < nav.width() ) 174 if ( wid < nav.width() )
175 wid = nav.width() ; 175 wid = nav.width() ;
176 //qDebug("KDateNavigator+++++++++++++ %d %d", wid , hei); 176 //qDebug("KDateNavigator+++++++++++++ %d %d", wid , hei);
177 return QSize ( wid, hei ); 177 return QSize ( wid, hei );
178} 178}
179void KDateNavigator::slotMonthSelected( int m ) 179void KDateNavigator::slotMonthSelected( int m )
180{ 180{
181 if ( m_MthYr.month() <= mMonthSignalOffset) 181 if ( m_MthYr.month() <= mMonthSignalOffset)
182 m += 12; 182 m += 12;
183 //qDebug("%d mMonthSignalOffset %d emit %d", m, mMonthSignalOffset, m - mMonthSignalOffset); 183 //qDebug("%d mMonthSignalOffset %d emit %d", m, mMonthSignalOffset, m - mMonthSignalOffset);
184 emit monthSelected( m - mMonthSignalOffset ); 184 emit monthSelected( m - mMonthSignalOffset );
185 185
186} 186}
187void KDateNavigator::setCalendar( Calendar *cal ) 187void KDateNavigator::setCalendar( Calendar *cal )
188{ 188{
189 daymatrix->setCalendar( cal ); 189 daymatrix->setCalendar( cal );
190} 190}
191 191
192void KDateNavigator::setBaseDate( const QDate &date , bool doRepaint ) // = true 192void KDateNavigator::setBaseDate( const QDate &date , bool doRepaint ) // = true
193{ 193{
194 m_MthYr = date; 194 m_MthYr = date;
195 //qDebug("KDateNavigator::setBaseDate %s ", date.toString().latin1()); 195 //qDebug("KDateNavigator::setBaseDate %s ", date.toString().latin1());
196 196
197 updateDates(); 197 updateDates();
198 updateView(); 198 updateView();
199 199
200 KCal::DateList dates; 200 KCal::DateList dates;
201 dates.append( date ); 201 dates.append( date );
202 mNavigatorBar->selectDates( dates ); 202 mNavigatorBar->selectDates( dates );
203 203
204 daymatrix->clearSelection(); 204 daymatrix->clearSelection();
205 if ( doRepaint ) 205 if ( doRepaint )
206 daymatrix->repaint( false ); 206 daymatrix->repaint( false );
207} 207}
208 208
209void KDateNavigator::enableRollover(RolloverType r) 209void KDateNavigator::enableRollover(RolloverType r)
210{ 210{
211 switch(r) 211 switch(r)
212 { 212 {
213 case None : 213 case None :
214 if (updateTimer) 214 if (updateTimer)
215 { 215 {
216 updateTimer->stop(); 216 updateTimer->stop();
217 delete updateTimer; 217 delete updateTimer;
218 updateTimer=0L; 218 updateTimer=0L;
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp
index 82d1eab..b30ad75 100644
--- a/korganizer/koagendaitem.cpp
+++ b/korganizer/koagendaitem.cpp
@@ -412,200 +412,200 @@ void KOAgendaItem::paintMe( bool selected, QPainter* paint )
412#else 412#else
413 align = ( AlignHCenter|BreakAnywhere|WordBreak|AlignTop); 413 align = ( AlignHCenter|BreakAnywhere|WordBreak|AlignTop);
414#endif 414#endif
415 415
416 } 416 }
417 } 417 }
418 QRect dr; 418 QRect dr;
419 if ( w + x > parentWidget()->width() ) 419 if ( w + x > parentWidget()->width() )
420 w = parentWidget()->width()-x; 420 w = parentWidget()->width()-x;
421 paint->drawText ( x, yy, w, h, align, mDisplayedText, -1, &dr ); 421 paint->drawText ( x, yy, w, h, align, mDisplayedText, -1, &dr );
422 //qDebug("%d %d %d %d ", x, yy, w, h ); 422 //qDebug("%d %d %d %d ", x, yy, w, h );
423 if ( mIncidence->cancelled() ){ 423 if ( mIncidence->cancelled() ){
424 if ( ! small ) { 424 if ( ! small ) {
425 QFontMetrics fm ( paint->font() ); 425 QFontMetrics fm ( paint->font() );
426 paint->drawLine(dr.left(), yy+fm.height()/2, dr.right()-2, yy+fm.height()/2); 426 paint->drawLine(dr.left(), yy+fm.height()/2, dr.right()-2, yy+fm.height()/2);
427 } 427 }
428 428
429 } 429 }
430 pa.end(); 430 pa.end();
431 431
432} 432}
433void KOAgendaItem::resizePixmap( int w , int h ) 433void KOAgendaItem::resizePixmap( int w , int h )
434{ 434{
435 paintPix()->resize( w, h ); 435 paintPix()->resize( w, h );
436 paintPixSel()->resize( w, h ); 436 paintPixSel()->resize( w, h );
437 437
438} 438}
439QPixmap * KOAgendaItem::paintPix() 439QPixmap * KOAgendaItem::paintPix()
440{ 440{
441 static QPixmap* mPaintPix = 0; 441 static QPixmap* mPaintPix = 0;
442 if ( ! mPaintPix ) 442 if ( ! mPaintPix )
443 mPaintPix = new QPixmap(1,1); 443 mPaintPix = new QPixmap(1,1);
444 return mPaintPix ; 444 return mPaintPix ;
445} 445}
446QPixmap * KOAgendaItem::paintPixAllday() 446QPixmap * KOAgendaItem::paintPixAllday()
447{ 447{
448 static QPixmap* mPaintPixA = 0; 448 static QPixmap* mPaintPixA = 0;
449 if ( ! mPaintPixA ) 449 if ( ! mPaintPixA )
450 mPaintPixA = new QPixmap(1,1); 450 mPaintPixA = new QPixmap(1,1);
451 return mPaintPixA ; 451 return mPaintPixA ;
452} 452}
453QPixmap * KOAgendaItem::paintPixSel() 453QPixmap * KOAgendaItem::paintPixSel()
454{ 454{
455 static QPixmap* mPaintPixSel = 0; 455 static QPixmap* mPaintPixSel = 0;
456 if ( ! mPaintPixSel ) 456 if ( ! mPaintPixSel )
457 mPaintPixSel = new QPixmap(1,1); 457 mPaintPixSel = new QPixmap(1,1);
458 return mPaintPixSel ; 458 return mPaintPixSel ;
459} 459}
460void KOAgendaItem::paintEvent ( QPaintEvent *e ) 460void KOAgendaItem::paintEvent ( QPaintEvent *e )
461{ 461{
462 462
463 if ( globalFlagBlockAgendaItemPaint ) 463 if ( globalFlagBlockAgendaItemPaint )
464 return; 464 return;
465 if ( globalFlagBlockAgenda > 0 && globalFlagBlockAgenda < 5 ) 465 if ( globalFlagBlockAgenda > 0 && globalFlagBlockAgenda < 5 )
466 return; 466 return;
467 int yy; 467 int yy;
468 if ( mAllDay ) 468 if ( mAllDay )
469 yy = y(); 469 yy = y();
470 else 470 else
471 yy = mCellYTop * ( height() / cellHeight() ); 471 yy = mCellYTop * ( height() / cellHeight() );
472 int xx = x(); 472 int xx = x();
473 473
474 if ( xPaintCoord != xx || yPaintCoord != yy || 474 if ( xPaintCoord != xx || yPaintCoord != yy ||
475 wPaintCoord != width() || hPaintCoord != height()) { 475 wPaintCoord != width() || hPaintCoord != height()) {
476 xPaintCoord= xx; 476 xPaintCoord= xx;
477 yPaintCoord = yy; 477 yPaintCoord = yy;
478 wPaintCoord = width(); 478 wPaintCoord = width();
479 hPaintCoord = height(); 479 hPaintCoord = height();
480 globalFlagBlockAgendaItemUpdate = 0; 480 globalFlagBlockAgendaItemUpdate = 0;
481 paintMe( mSelected ); 481 paintMe( mSelected );
482 //qDebug("calling paintMe "); 482 //qDebug("calling paintMe ");
483 globalFlagBlockAgendaItemUpdate = 1; 483 globalFlagBlockAgendaItemUpdate = 1;
484 } 484 }
485 int rx, ry, rw, rh; 485 int rx, ry, rw, rh;
486 rx = e->rect().x(); 486 rx = e->rect().x();
487 ry = e->rect().y(); 487 ry = e->rect().y();
488 rw = e->rect().width(); 488 rw = e->rect().width();
489 rh = e->rect().height(); 489 rh = e->rect().height();
490 //qDebug(" paintevent %s %d %d %d %d", mIncidence->summary().latin1(), x(), yy, width(), height()); 490 //qDebug(" paintevent %s %d %d %d %d", mIncidence->summary().latin1(), x(), yy, width(), height());
491 491
492 QPixmap* paintFrom ; 492 QPixmap* paintFrom ;
493 if ( mSelected ) { 493 if ( mSelected ) {
494 paintFrom = paintPixSel(); 494 paintFrom = paintPixSel();
495 } else { 495 } else {
496 if ( mAllDay ) 496 if ( mAllDay )
497 paintFrom = paintPixAllday(); 497 paintFrom = paintPixAllday();
498 else 498 else
499 paintFrom = paintPix(); 499 paintFrom = paintPix();
500 } 500 }
501 xx += rx; 501 xx += rx;
502 502
503 if ( xx < 0 ) { 503 if ( xx < 0 ) {
504 rw = rw + xx; 504 rw = rw + xx;
505 rx -= xx; 505 rx -= xx;
506 xx = 0; 506 xx = 0;
507 if ( rw <= 1 ) { 507 if ( rw <= 1 ) {
508 qDebug("KOAgendaItem::Width1 <= 1 (%d). Returning. %s",rw,mDisplayedText.latin1()); 508 //qDebug("KOAgendaItem::Width1 <= 1 (%d). Returning. %s",rw,mDisplayedText.latin1());
509 return; 509 return;
510 } 510 }
511 } 511 }
512 if ( paintFrom->width() < xx+rw ) { 512 if ( paintFrom->width() < xx+rw ) {
513 rw = paintFrom->width() - xx; 513 rw = paintFrom->width() - xx;
514 if ( rw <= 1 ) { 514 if ( rw <= 1 ) {
515 qDebug("KOAgendaItem::Width2 <= 1 (%d). Returning.%s ",rw,mDisplayedText.latin1() ); 515 //qDebug("KOAgendaItem::Width2 <= 1 (%d). Returning.%s ",rw,mDisplayedText.latin1() );
516 return; 516 return;
517 } 517 }
518 } 518 }
519 //qDebug("%d %d %d %d %d %d %d",rx, ry, paintFrom, xx ,yPaintCoord+ry, rw, rh); 519 //qDebug("%d %d %d %d %d %d %d",rx, ry, paintFrom, xx ,yPaintCoord+ry, rw, rh);
520 bitBlt (this, rx, ry, paintFrom, xx ,yPaintCoord+ry, rw, rh ,CopyROP); 520 bitBlt (this, rx, ry, paintFrom, xx ,yPaintCoord+ry, rw, rh ,CopyROP);
521} 521}
522void KOAgendaItem::computeText() 522void KOAgendaItem::computeText()
523{ 523{
524 524
525 mDisplayedText = mIncidence->summary(); 525 mDisplayedText = mIncidence->summary();
526 if ( (mIncidence->type() == "Todo") ) { 526 if ( (mIncidence->type() == "Todo") ) {
527 if ( static_cast<Todo*>(mIncidence)->hasDueDate() ) { 527 if ( static_cast<Todo*>(mIncidence)->hasDueDate() ) {
528 if ( static_cast<Todo*>(mIncidence)->dtDue().date() < QDate::currentDate() ) 528 if ( static_cast<Todo*>(mIncidence)->dtDue().date() < QDate::currentDate() )
529 mDisplayedText += i18n(" (") +KGlobal::locale()->formatDate((static_cast<Todo*>(mIncidence))->dtDue().date(), true)+")"; 529 mDisplayedText += i18n(" (") +KGlobal::locale()->formatDate((static_cast<Todo*>(mIncidence))->dtDue().date(), true)+")";
530 else if ( !(mIncidence->doesFloat())) 530 else if ( !(mIncidence->doesFloat()))
531 mDisplayedText += i18n(" (") +KGlobal::locale()->formatTime((static_cast<Todo*>(mIncidence))->dtDue().time())+")"; 531 mDisplayedText += i18n(" (") +KGlobal::locale()->formatTime((static_cast<Todo*>(mIncidence))->dtDue().time())+")";
532 } 532 }
533 } else { 533 } else {
534 if ( !(mIncidence->doesFloat()) && KOPrefs::instance()->mShowTimeInAgenda) 534 if ( !(mIncidence->doesFloat()) && KOPrefs::instance()->mShowTimeInAgenda)
535 mDisplayedText += ": " +KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtStart().time()) + "-" + KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtEnd().time()) ; 535 mDisplayedText += ": " +KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtStart().time()) + "-" + KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtEnd().time()) ;
536 536
537 if ( mAllDay ) { 537 if ( mAllDay ) {
538 if ( mIncidence->dtStart().date().addDays(3) < mIncidence->dtEnd().date() ) { 538 if ( mIncidence->dtStart().date().addDays(3) < mIncidence->dtEnd().date() ) {
539 mDisplayedText += ": " +KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtStart().date(), true) + " - " + KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtEnd().date(), true) ; 539 mDisplayedText += ": " +KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtStart().date(), true) + " - " + KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtEnd().date(), true) ;
540 } 540 }
541 } 541 }
542 542
543 } 543 }
544 544
545 if ( !mIncidence->location().isEmpty() ) { 545 if ( !mIncidence->location().isEmpty() ) {
546 if ( mAllDay ) 546 if ( mAllDay )
547 mDisplayedText += " ("; 547 mDisplayedText += " (";
548 else 548 else
549 mDisplayedText += "\n("; 549 mDisplayedText += "\n(";
550 mDisplayedText += mIncidence->location() +")"; 550 mDisplayedText += mIncidence->location() +")";
551 } 551 }
552 552
553 QString tipText = mIncidence->summary(); 553 QString tipText = mIncidence->summary();
554 if ( !mIncidence->doesFloat() ) { 554 if ( !mIncidence->doesFloat() ) {
555 if ( mIncidence->type() == "Event" ) { 555 if ( mIncidence->type() == "Event" ) {
556 if ( (static_cast<Event*>(mIncidence))->isMultiDay() ) { 556 if ( (static_cast<Event*>(mIncidence))->isMultiDay() ) {
557 tipText += "\n"+i18n("From: ")+mIncidence->dtStartStr(); 557 tipText += "\n"+i18n("From: ")+mIncidence->dtStartStr();
558 tipText += "\n"+i18n("To: ")+(static_cast<Event*>(mIncidence))->dtEndStr(); 558 tipText += "\n"+i18n("To: ")+(static_cast<Event*>(mIncidence))->dtEndStr();
559 } 559 }
560 else { 560 else {
561 tipText += "\n"+i18n("Time: ")+mIncidence->dtStartTimeStr(); 561 tipText += "\n"+i18n("Time: ")+mIncidence->dtStartTimeStr();
562 tipText += " - "+(static_cast<Event*>(mIncidence))->dtEndTimeStr(); 562 tipText += " - "+(static_cast<Event*>(mIncidence))->dtEndTimeStr();
563 } 563 }
564 } 564 }
565 else if ( mIncidence->type() == "Todo" ) { 565 else if ( mIncidence->type() == "Todo" ) {
566 if (mIncidence->hasStartDate()) 566 if (mIncidence->hasStartDate())
567 tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartStr(); 567 tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartStr();
568 if (((Todo*)mIncidence)->hasDueDate()) 568 if (((Todo*)mIncidence)->hasDueDate())
569 tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueStr(); 569 tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueStr();
570 } 570 }
571 } else if ( mIncidence->type() == "Todo" ) { 571 } else if ( mIncidence->type() == "Todo" ) {
572 if (mIncidence->hasStartDate()) 572 if (mIncidence->hasStartDate())
573 tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartDateStr(); 573 tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartDateStr();
574 if (((Todo*)mIncidence)->hasDueDate()) 574 if (((Todo*)mIncidence)->hasDueDate())
575 tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueDateStr(); 575 tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueDateStr();
576 } 576 }
577 577
578 if (!mIncidence->location().isEmpty()) { 578 if (!mIncidence->location().isEmpty()) {
579 tipText += "\n"+i18n("Location: ")+mIncidence->location(); 579 tipText += "\n"+i18n("Location: ")+mIncidence->location();
580 } 580 }
581 QToolTip::add(this,tipText,toolTipGroup(),""); 581 QToolTip::add(this,tipText,toolTipGroup(),"");
582 582
583} 583}
584void KOAgendaItem::updateItem() 584void KOAgendaItem::updateItem()
585{ 585{
586 computeText(); 586 computeText();
587 587
588 //qDebug("KOAgendaItem:: updateItem() %s %d %d ",incidence()->summary().latin1(), x(), y()); 588 //qDebug("KOAgendaItem:: updateItem() %s %d %d ",incidence()->summary().latin1(), x(), y());
589 paintMe( mSelected ); 589 paintMe( mSelected );
590 repaint( false); 590 repaint( false);
591} 591}
592 592
593void KOAgendaItem::resizeEvent ( QResizeEvent *ev ) 593void KOAgendaItem::resizeEvent ( QResizeEvent *ev )
594{ 594{
595 //qDebug("KOAgendaItem::resizeEvent %s ", mIncidence->summary().latin1()); 595 //qDebug("KOAgendaItem::resizeEvent %s ", mIncidence->summary().latin1());
596 paintMe( mSelected ); 596 paintMe( mSelected );
597 repaint( false ); 597 repaint( false );
598} 598}
599 599
600/* 600/*
601 Return height of item in units of agenda cells 601 Return height of item in units of agenda cells
602*/ 602*/
603int KOAgendaItem::cellHeight() 603int KOAgendaItem::cellHeight()
604{ 604{
605 int ret = mCellYBottom - mCellYTop + 1; 605 int ret = mCellYBottom - mCellYTop + 1;
606 if ( ret <= 0 ) { 606 if ( ret <= 0 ) {
607 ret = 1; 607 ret = 1;
608 mCellYBottom = 0; 608 mCellYBottom = 0;
609 mCellYTop = 0; 609 mCellYTop = 0;
610 } 610 }
611 return ret; 611 return ret;
diff --git a/korganizer/koprefsdialog.cpp b/korganizer/koprefsdialog.cpp
index 40e8a99..74037e6 100644
--- a/korganizer/koprefsdialog.cpp
+++ b/korganizer/koprefsdialog.cpp
@@ -497,263 +497,263 @@ void KOPrefsDialog::setupTimeTab()
497 dummy); 497 dummy);
498 //topLayout->addWidget(dayBegins->label(),2,0); 498 //topLayout->addWidget(dayBegins->label(),2,0);
499 499
500 //topLayout->addWidget(dayBegins->spinBox(),2,1); 500 //topLayout->addWidget(dayBegins->spinBox(),2,1);
501 topLayout->addMultiCellWidget(dummy,0,0,0,1); 501 topLayout->addMultiCellWidget(dummy,0,0,0,1);
502 502
503 topLayout->addWidget(new QLabel(i18n("Default appointment time:"), 503 topLayout->addWidget(new QLabel(i18n("Default appointment time:"),
504 topFrame),1,0); 504 topFrame),1,0);
505 mStartTimeSpin = new QSpinBox(0,23,1,topFrame); 505 mStartTimeSpin = new QSpinBox(0,23,1,topFrame);
506 mStartTimeSpin->setSuffix(":00"); 506 mStartTimeSpin->setSuffix(":00");
507 topLayout->addWidget(mStartTimeSpin,1,1); 507 topLayout->addWidget(mStartTimeSpin,1,1);
508 508
509 topLayout->addWidget(new QLabel(i18n("Def. duration of new app.:"), 509 topLayout->addWidget(new QLabel(i18n("Def. duration of new app.:"),
510 topFrame),2,0); 510 topFrame),2,0);
511 mDefaultDurationSpin = new QSpinBox(0,23,1,topFrame); 511 mDefaultDurationSpin = new QSpinBox(0,23,1,topFrame);
512 mDefaultDurationSpin->setSuffix(":00"); 512 mDefaultDurationSpin->setSuffix(":00");
513 topLayout->addWidget(mDefaultDurationSpin,2,1); 513 topLayout->addWidget(mDefaultDurationSpin,2,1);
514 514
515 QStringList alarmList; 515 QStringList alarmList;
516 alarmList << i18n("1 minute") << i18n("5 minutes") << i18n("10 minutes") 516 alarmList << i18n("1 minute") << i18n("5 minutes") << i18n("10 minutes")
517 << i18n("15 minutes") << i18n("30 minutes")<< i18n("1 hour")<< i18n("3 hours") << i18n("24 hours") ; 517 << i18n("15 minutes") << i18n("30 minutes")<< i18n("1 hour")<< i18n("3 hours") << i18n("24 hours") ;
518 topLayout->addWidget(new QLabel(i18n("Default alarm time:"),topFrame), 518 topLayout->addWidget(new QLabel(i18n("Default alarm time:"),topFrame),
519 3,0); 519 3,0);
520 mAlarmTimeCombo = new QComboBox(topFrame); 520 mAlarmTimeCombo = new QComboBox(topFrame);
521 mAlarmTimeCombo->insertStringList(alarmList); 521 mAlarmTimeCombo->insertStringList(alarmList);
522 topLayout->addWidget(mAlarmTimeCombo,3,1); 522 topLayout->addWidget(mAlarmTimeCombo,3,1);
523 523
524 524
525 QGroupBox *workingHoursGroup = new QGroupBox(1,Horizontal, 525 QGroupBox *workingHoursGroup = new QGroupBox(1,Horizontal,
526 i18n("Working Hours"), 526 i18n("Working Hours"),
527 topFrame); 527 topFrame);
528 topLayout->addMultiCellWidget(workingHoursGroup,4,4,0,1); 528 topLayout->addMultiCellWidget(workingHoursGroup,4,4,0,1);
529 workingHoursGroup->layout()->setSpacing( 0 ); 529 workingHoursGroup->layout()->setSpacing( 0 );
530 workingHoursGroup->layout()->setMargin( 4 ); 530 workingHoursGroup->layout()->setMargin( 4 );
531 QHBox *workStartBox = new QHBox(workingHoursGroup); 531 QHBox *workStartBox = new QHBox(workingHoursGroup);
532 // workStartBox->setMargin( 0 ); 532 // workStartBox->setMargin( 0 );
533 addWidTime(i18n("Daily starting hour:"), 533 addWidTime(i18n("Daily starting hour:"),
534 &(KOPrefs::instance()->mWorkingHoursStart),workStartBox); 534 &(KOPrefs::instance()->mWorkingHoursStart),workStartBox);
535 535
536 QHBox *workEndBox = new QHBox(workingHoursGroup); 536 QHBox *workEndBox = new QHBox(workingHoursGroup);
537 //workEndBox->setMargin( 0 ); 537 //workEndBox->setMargin( 0 );
538 addWidTime(i18n("Daily ending hour:"), 538 addWidTime(i18n("Daily ending hour:"),
539 &(KOPrefs::instance()->mWorkingHoursEnd),workEndBox); 539 &(KOPrefs::instance()->mWorkingHoursEnd),workEndBox);
540 QVBox *excludeBox = new QVBox(workingHoursGroup); 540 QVBox *excludeBox = new QVBox(workingHoursGroup);
541 //excludeBox->setMargin( 0 ); 541 //excludeBox->setMargin( 0 );
542 addWidBool(i18n("Exclude holidays"), 542 addWidBool(i18n("Exclude holidays"),
543 &(KOPrefs::instance()->mExcludeHolidays),excludeBox); 543 &(KOPrefs::instance()->mExcludeHolidays),excludeBox);
544 544
545 addWidBool(i18n("Exclude Saturdays"), 545 addWidBool(i18n("Exclude Saturdays"),
546 &(KOPrefs::instance()->mExcludeSaturdays),excludeBox); 546 &(KOPrefs::instance()->mExcludeSaturdays),excludeBox);
547 547
548// KPrefsDialogWidBool *marcusBainsShowSeconds = addWidBool(i18n("Show seconds on Marcus Bains line"), 548// KPrefsDialogWidBool *marcusBainsShowSeconds = addWidBool(i18n("Show seconds on Marcus Bains line"),
549 // &(KOPrefs::instance()->mMarcusBainsShowSeconds), 549 // &(KOPrefs::instance()->mMarcusBainsShowSeconds),
550 // topFrame); 550 // topFrame);
551// topLayout->addWidget(marcusBainsShowSeconds->checkBox(),5,0); 551// topLayout->addWidget(marcusBainsShowSeconds->checkBox(),5,0);
552 552
553 // topLayout->setRowStretch(6,1); 553 // topLayout->setRowStretch(6,1);
554} 554}
555 555
556 556
557void KOPrefsDialog::setupViewsTab() 557void KOPrefsDialog::setupViewsTab()
558{ 558{
559 559
560 QFrame *topFrame = addPage(i18n("Views"),0,0); 560 QFrame *topFrame = addPage(i18n("Views"),0,0);
561 // DesktopIcon("viewmag",KIcon::SizeMedium)); 561 // DesktopIcon("viewmag",KIcon::SizeMedium));
562 562
563 QGridLayout *topLayout = new QGridLayout(topFrame,6,1); 563 QGridLayout *topLayout = new QGridLayout(topFrame,6,1);
564 topLayout->setSpacing(spacingHint()); 564 topLayout->setSpacing(spacingHint());
565 topLayout->setMargin(marginHint()); 565 topLayout->setMargin(marginHint());
566 566
567// QBoxLayout *dayBeginsLayout = new QHBoxLayout; 567// QBoxLayout *dayBeginsLayout = new QHBoxLayout;
568// topLayout->addLayout(dayBeginsLayout,0,0); 568// topLayout->addLayout(dayBeginsLayout,0,0);
569 569
570// KPrefsDialogWidTime *dayBegins = 570// KPrefsDialogWidTime *dayBegins =
571// addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins), 571// addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins),
572// topFrame); 572// topFrame);
573// dayBeginsLayout->addWidget(dayBegins->label()); 573// dayBeginsLayout->addWidget(dayBegins->label());
574// dayBeginsLayout->addStretch(1); 574// dayBeginsLayout->addStretch(1);
575// dayBeginsLayout->addWidget(dayBegins->spinBox()); 575// dayBeginsLayout->addWidget(dayBegins->spinBox());
576 576
577// QBoxLayout *nextDaysLayout = new QHBoxLayout; 577// QBoxLayout *nextDaysLayout = new QHBoxLayout;
578// topLayout->addLayout(nextDaysLayout,1,0); 578// topLayout->addLayout(nextDaysLayout,1,0);
579// nextDaysLayout->addWidget(new QLabel(i18n("Days to show in Next-X-Days view:"),topFrame)); 579// nextDaysLayout->addWidget(new QLabel(i18n("Days to show in Next-X-Days view:"),topFrame));
580// mNextXDaysSpin = new QSpinBox(2,14,1,topFrame); 580// mNextXDaysSpin = new QSpinBox(2,14,1,topFrame);
581// nextDaysLayout->addStretch(1); 581// nextDaysLayout->addStretch(1);
582// nextDaysLayout->addWidget(mNextXDaysSpin); 582// nextDaysLayout->addWidget(mNextXDaysSpin);
583 583
584 584
585 int ii = 0; 585 int ii = 0;
586 KPrefsDialogWidBool *dummy = 586 KPrefsDialogWidBool *dummy =
587 addWidBool(i18n("Edit item on doubleclick (if not, show)"), 587 addWidBool(i18n("Edit item on doubleclick (if not, show)"),
588 &(KOPrefs::instance()->mEditOnDoubleClick),topFrame); 588 &(KOPrefs::instance()->mEditOnDoubleClick),topFrame);
589 topLayout->addWidget(dummy->checkBox(),ii++,0); 589 topLayout->addWidget(dummy->checkBox(),ii++,0);
590 590
591 591
592 592
593 if ( QApplication::desktop()->width() > 640 ) { 593
594
595 KPrefsDialogWidBool *enableToolTips =
596 addWidBool(i18n("Enable tooltips displaying summary of ev."),
597 &(KOPrefs::instance()->mEnableToolTips),topFrame);
598 topLayout->addWidget(enableToolTips->checkBox(),ii++,0);
599
600 }
601
602 594
603 595
604 // topLayout->addWidget(hourSizeGroup,ii++,0); 596 // topLayout->addWidget(hourSizeGroup,ii++,0);
605 // topLayout->addMultiCellWidget(hourSizeGroup,ii,ii,0,0); 597 // topLayout->addMultiCellWidget(hourSizeGroup,ii,ii,0,0);
606 //topLayout->setRowStretch(11,1); 598 //topLayout->setRowStretch(11,1);
607 599
608 600
609 601
610 602
611#if 0 603#if 0
612 604
613 topFrame = addPage(i18n("ViewChange"),0,0); 605 topFrame = addPage(i18n("ViewChange"),0,0);
614 // DesktopIcon("viewmag",KIcon::SizeMedium)); 606 // DesktopIcon("viewmag",KIcon::SizeMedium));
615 607
616 topLayout = new QGridLayout(topFrame,6,1); 608 topLayout = new QGridLayout(topFrame,6,1);
617 topLayout->setSpacing(spacingHint()); 609 topLayout->setSpacing(spacingHint());
618 topLayout->setMargin(marginHint()); 610 topLayout->setMargin(marginHint());
619 ii = 0; 611 ii = 0;
620 612
621#endif 613#endif
622 614
623 dummy = 615 dummy =
624 addWidBool(i18n("Hold fullscreen on view change"), 616 addWidBool(i18n("Hold fullscreen on view change"),
625 &(KOPrefs::instance()->mViewChangeHoldFullscreen),topFrame); 617 &(KOPrefs::instance()->mViewChangeHoldFullscreen),topFrame);
626 topLayout->addWidget(dummy->checkBox(),ii++,0); 618 topLayout->addWidget(dummy->checkBox(),ii++,0);
627 619
628 dummy = 620 dummy =
629 addWidBool(i18n("Hold non-fullscreen on view change"), 621 addWidBool(i18n("Hold non-fullscreen on view change"),
630 &(KOPrefs::instance()->mViewChangeHoldNonFullscreen),topFrame); 622 &(KOPrefs::instance()->mViewChangeHoldNonFullscreen),topFrame);
631 topLayout->addWidget(dummy->checkBox(),ii++,0); 623 topLayout->addWidget(dummy->checkBox(),ii++,0);
632 624
633 625
634 626
635 KPrefsDialogWidBool *fullViewMonth = 627 KPrefsDialogWidBool *fullViewMonth =
636 addWidBool(i18n("Next days view uses full window"), 628 addWidBool(i18n("Next days view uses full window"),
637 &(KOPrefs::instance()->mFullViewMonth),topFrame); 629 &(KOPrefs::instance()->mFullViewMonth),topFrame);
638 topLayout->addWidget(fullViewMonth->checkBox(),ii++,0); 630 topLayout->addWidget(fullViewMonth->checkBox(),ii++,0);
639 631
640 632
641 KPrefsDialogWidBool *fullViewTodo = 633 KPrefsDialogWidBool *fullViewTodo =
642 addWidBool(i18n("Event list view uses full window"), 634 addWidBool(i18n("Event list view uses full window"),
643 &(KOPrefs::instance()->mFullViewTodo),topFrame); 635 &(KOPrefs::instance()->mFullViewTodo),topFrame);
644 topLayout->addWidget(fullViewTodo->checkBox(),ii++,0); 636 topLayout->addWidget(fullViewTodo->checkBox(),ii++,0);
645 dummy = 637 dummy =
646 addWidBool(i18n("Listview uses monthly timespan"), 638 addWidBool(i18n("Listview uses monthly timespan"),
647 &(KOPrefs::instance()->mListViewMonthTimespan),topFrame); 639 &(KOPrefs::instance()->mListViewMonthTimespan),topFrame);
648 topLayout->addWidget(dummy->checkBox(),ii++,0); 640 topLayout->addWidget(dummy->checkBox(),ii++,0);
649 dummy = 641 dummy =
650 addWidBool(i18n("Highlight selection in Time Edit"), 642 addWidBool(i18n("Highlight selection in Time Edit"),
651 &(KOPrefs::instance()->mHightlightDateTimeEdit),topFrame); 643 &(KOPrefs::instance()->mHightlightDateTimeEdit),topFrame);
652 topLayout->addWidget( dummy->checkBox(), ii++,0); 644 topLayout->addWidget( dummy->checkBox(), ii++,0);
653 645
654 KPrefsDialogWidBool *dailyRecur = 646 KPrefsDialogWidBool *dailyRecur =
655 addWidBool(i18n("Show events that recur daily in date nav."), 647 addWidBool(i18n("Show events that recur daily in date nav."),
656 &(KOPrefs::instance()->mDailyRecur),topFrame); 648 &(KOPrefs::instance()->mDailyRecur),topFrame);
657 topLayout->addWidget(dailyRecur->checkBox(),ii++,0); 649 topLayout->addWidget(dailyRecur->checkBox(),ii++,0);
658 650
659 KPrefsDialogWidBool *weeklyRecur = 651 KPrefsDialogWidBool *weeklyRecur =
660 addWidBool(i18n("Show ev. that recur weekly in date nav."), 652 addWidBool(i18n("Show ev. that recur weekly in date nav."),
661 &(KOPrefs::instance()->mWeeklyRecur),topFrame); 653 &(KOPrefs::instance()->mWeeklyRecur),topFrame);
662 topLayout->addWidget(weeklyRecur->checkBox(),ii++,0); 654 topLayout->addWidget(weeklyRecur->checkBox(),ii++,0);
663 655
656
657 KPrefsDialogWidBool *enableToolTips =
658 addWidBool(i18n("Enable tooltips displaying summary of ev."),
659 &(KOPrefs::instance()->mEnableToolTips),topFrame);
660 topLayout->addWidget(enableToolTips->checkBox(),ii++,0);
661
662 // *********************************************************
663
664 topFrame = addPage(i18n("Agenda View"),0,0); 664 topFrame = addPage(i18n("Agenda View"),0,0);
665 // DesktopIcon("viewmag",KIcon::SizeMedium)); 665 // DesktopIcon("viewmag",KIcon::SizeMedium));
666 666
667 topLayout = new QGridLayout(topFrame,5,1); 667 topLayout = new QGridLayout(topFrame,5,1);
668 topLayout->setSpacing(spacingHint()); 668 topLayout->setSpacing(spacingHint());
669 topLayout->setMargin(marginHint()); 669 topLayout->setMargin(marginHint());
670 ii = 0; 670 ii = 0;
671 671
672 672
673 dummy = 673 dummy =
674 addWidBool(i18n("Show time in agenda items"), 674 addWidBool(i18n("Show time in agenda items"),
675 &(KOPrefs::instance()->mShowTimeInAgenda),topFrame); 675 &(KOPrefs::instance()->mShowTimeInAgenda),topFrame);
676 topLayout->addWidget(dummy->checkBox(),ii++,0); 676 topLayout->addWidget(dummy->checkBox(),ii++,0);
677 677
678 dummy = 678 dummy =
679 addWidBool(i18n("Highlight current day in agenda"), 679 addWidBool(i18n("Highlight current day in agenda"),
680 &(KOPrefs::instance()->mHighlightCurrentDay),topFrame); 680 &(KOPrefs::instance()->mHighlightCurrentDay),topFrame);
681 topLayout->addWidget(dummy->checkBox(),ii++,0); 681 topLayout->addWidget(dummy->checkBox(),ii++,0);
682 682
683 dummy = 683 dummy =
684 addWidBool(i18n("Use light color for highlight current day"), 684 addWidBool(i18n("Use light color for highlight current day"),
685 &(KOPrefs::instance()->mUseHighlightLightColor),topFrame); 685 &(KOPrefs::instance()->mUseHighlightLightColor),topFrame);
686 topLayout->addWidget(dummy->checkBox(),ii++,0); 686 topLayout->addWidget(dummy->checkBox(),ii++,0);
687 687
688 688
689 KPrefsDialogWidBool *marcusBainsEnabled = 689 KPrefsDialogWidBool *marcusBainsEnabled =
690 addWidBool(i18n("Show current time"), 690 addWidBool(i18n("Show current time"),
691 &(KOPrefs::instance()->mMarcusBainsEnabled),topFrame); 691 &(KOPrefs::instance()->mMarcusBainsEnabled),topFrame);
692 topLayout->addWidget(marcusBainsEnabled->checkBox(),ii++,0); 692 topLayout->addWidget(marcusBainsEnabled->checkBox(),ii++,0);
693 693
694 694
695 dummy = 695 dummy =
696 addWidBool(i18n("Set agenda to DayBeginsAt on change"), 696 addWidBool(i18n("Set agenda to DayBeginsAt on change"),
697 &(KOPrefs::instance()->mSetTimeToDayStartAt),topFrame); 697 &(KOPrefs::instance()->mSetTimeToDayStartAt),topFrame);
698 topLayout->addWidget(dummy->checkBox(),ii++,0); 698 topLayout->addWidget(dummy->checkBox(),ii++,0);
699 699
700 dummy = 700 dummy =
701 addWidBool(i18n("Set agenda to current time on change"), 701 addWidBool(i18n("Set agenda to current time on change"),
702 &(KOPrefs::instance()->mCenterOnCurrentTime),topFrame); 702 &(KOPrefs::instance()->mCenterOnCurrentTime),topFrame);
703 topLayout->addWidget(dummy->checkBox(),ii++,0); 703 topLayout->addWidget(dummy->checkBox(),ii++,0);
704 704
705 705
706 706
707 707
708 708
709 709
710 710
711 topFrame = addPage(i18n("Month View"),0,0); 711 topFrame = addPage(i18n("Month View"),0,0);
712 // DesktopIcon("viewmag",KIcon::SizeMedium)); 712 // DesktopIcon("viewmag",KIcon::SizeMedium));
713 713
714 topLayout = new QGridLayout(topFrame,5,1); 714 topLayout = new QGridLayout(topFrame,5,1);
715 topLayout->setSpacing(spacingHint()); 715 topLayout->setSpacing(spacingHint());
716 topLayout->setMargin(marginHint()); 716 topLayout->setMargin(marginHint());
717 ii = 0; 717 ii = 0;
718 QLabel *lab; 718 QLabel *lab;
719 QHBox *habo = new QHBox( topFrame ); 719 QHBox *habo = new QHBox( topFrame );
720 if ( QApplication::desktop()->width() <= 480 ) { 720 if ( QApplication::desktop()->width() <= 480 ) {
721 lab = new QLabel ( i18n("Show events that recur "), topFrame ); 721 lab = new QLabel ( i18n("Show events that recur "), topFrame );
722 topLayout->addMultiCellWidget(lab,ii, ii,0,1); 722 topLayout->addMultiCellWidget(lab,ii, ii,0,1);
723 ii++; 723 ii++;
724 } else { 724 } else {
725 new QLabel ( i18n("Show events that recur "), habo ); 725 new QLabel ( i18n("Show events that recur "), habo );
726 } 726 }
727 dailyRecur = 727 dailyRecur =
728 addWidBool(i18n("daily"), 728 addWidBool(i18n("daily"),
729 &(KOPrefs::instance()->mMonthDailyRecur),habo); 729 &(KOPrefs::instance()->mMonthDailyRecur),habo);
730 // topLayout->addWidget(dailyRecur->checkBox(),ii++,0); 730 // topLayout->addWidget(dailyRecur->checkBox(),ii++,0);
731 731
732 weeklyRecur = 732 weeklyRecur =
733 addWidBool(i18n("weekly"), 733 addWidBool(i18n("weekly"),
734 &(KOPrefs::instance()->mMonthWeeklyRecur),habo); 734 &(KOPrefs::instance()->mMonthWeeklyRecur),habo);
735 topLayout->addMultiCellWidget(habo,ii, ii,0,1); 735 topLayout->addMultiCellWidget(habo,ii, ii,0,1);
736 ii++; 736 ii++;
737 737
738 738
739 habo = new QHBox( topFrame ); 739 habo = new QHBox( topFrame );
740 if ( QApplication::desktop()->width() <= 480 ) { 740 if ( QApplication::desktop()->width() <= 480 ) {
741 lab = new QLabel (i18n("Show in every cell ") , topFrame ); 741 lab = new QLabel (i18n("Show in every cell ") , topFrame );
742 topLayout->addMultiCellWidget(lab,ii, ii,0,1); 742 topLayout->addMultiCellWidget(lab,ii, ii,0,1);
743 ii++; 743 ii++;
744 744
745 } else { 745 } else {
746 new QLabel ( i18n("Show in every cell "), habo ); 746 new QLabel ( i18n("Show in every cell "), habo );
747 } 747 }
748 weeklyRecur = 748 weeklyRecur =
749 addWidBool(i18n("short month"), 749 addWidBool(i18n("short month"),
750 &(KOPrefs::instance()->mMonthShowShort),habo); 750 &(KOPrefs::instance()->mMonthShowShort),habo);
751 weeklyRecur = 751 weeklyRecur =
752 addWidBool(i18n("icons"), 752 addWidBool(i18n("icons"),
753 &(KOPrefs::instance()->mMonthShowIcons),habo); 753 &(KOPrefs::instance()->mMonthShowIcons),habo);
754 754
755 topLayout->addMultiCellWidget(habo,ii, ii,0,1); 755 topLayout->addMultiCellWidget(habo,ii, ii,0,1);
756 ii++; 756 ii++;
757#ifdef DESKTOP_VERSION 757#ifdef DESKTOP_VERSION
758 KPrefsDialogWidBool *enableMonthScroll = 758 KPrefsDialogWidBool *enableMonthScroll =
759 addWidBool(i18n("Enable scrollbars in month view cells"), 759 addWidBool(i18n("Enable scrollbars in month view cells"),
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index bd9efc8..7faf675 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -907,300 +907,300 @@ void MainWindow::initActions()
907 connect( action, SIGNAL( activated() ), 907 connect( action, SIGNAL( activated() ),
908 this, SLOT( printCal() ) ); 908 this, SLOT( printCal() ) );
909 909
910 icon = loadPixmap( pathString + "print" ); 910 icon = loadPixmap( pathString + "print" );
911 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); 911 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this );
912 action->addTo( beamMenu_X ); 912 action->addTo( beamMenu_X );
913 connect( action, SIGNAL( activated() ), 913 connect( action, SIGNAL( activated() ),
914 this, SLOT( printSel() ) ); 914 this, SLOT( printSel() ) );
915 action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); 915 action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this );
916 action->addTo( beamMenu_X ); 916 action->addTo( beamMenu_X );
917 connect( action, SIGNAL( activated() ), 917 connect( action, SIGNAL( activated() ),
918 mView->viewManager(), SIGNAL( printWNV() ) ); 918 mView->viewManager(), SIGNAL( printWNV() ) );
919 importMenu->insertItem( i18n("Print"), beamMenu_X ); 919 importMenu->insertItem( i18n("Print"), beamMenu_X );
920#endif 920#endif
921 importMenu->insertSeparator(); 921 importMenu->insertSeparator();
922 action = new QAction( "manage cat", i18n("Manage new categories..."), 0, 922 action = new QAction( "manage cat", i18n("Manage new categories..."), 0,
923 this ); 923 this );
924 action->addTo( importMenu ); 924 action->addTo( importMenu );
925 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); 925 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) );
926 importMenu->insertSeparator(); 926 importMenu->insertSeparator();
927 action = new QAction( "beam all", i18n("Save"), 0, 927 action = new QAction( "beam all", i18n("Save"), 0,
928 this ); 928 this );
929 action->addTo( importMenu ); 929 action->addTo( importMenu );
930 connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); 930 connect( action, SIGNAL( activated() ), this, SLOT( save() ) );
931 action = new QAction( "beam all", i18n("Exit (+save)"), 0, 931 action = new QAction( "beam all", i18n("Exit (+save)"), 0,
932 this ); 932 this );
933 action->addTo( importMenu ); 933 action->addTo( importMenu );
934 connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); 934 connect( action, SIGNAL( activated() ), this, SLOT( close() ) );
935 935
936 //menuBar->insertItem( "Configure",configureMenu ); 936 //menuBar->insertItem( "Configure",configureMenu );
937 //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); 937 //configureMenu->insertItem( "Toolbar",configureToolBarMenu );
938 icon = loadPixmap( "korganizer/korganizer" ); 938 icon = loadPixmap( "korganizer/korganizer" );
939 939
940 action = new QAction( "Whats New", i18n("What's new?"), 0,this ); 940 action = new QAction( "Whats New", i18n("What's new?"), 0,this );
941 action->addTo( helpMenu ); 941 action->addTo( helpMenu );
942 connect( action, SIGNAL( activated() ), 942 connect( action, SIGNAL( activated() ),
943 SLOT( whatsNew() ) ); 943 SLOT( whatsNew() ) );
944 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); 944 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this );
945 action->addTo( helpMenu ); 945 action->addTo( helpMenu );
946 connect( action, SIGNAL( activated() ), 946 connect( action, SIGNAL( activated() ),
947 SLOT( features() ) ); 947 SLOT( features() ) );
948 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); 948 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this );
949 action->addTo( helpMenu ); 949 action->addTo( helpMenu );
950 connect( action, SIGNAL( activated() ), 950 connect( action, SIGNAL( activated() ),
951 SLOT( keyBindings() ) ); 951 SLOT( keyBindings() ) );
952 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); 952 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this );
953 action->addTo( helpMenu ); 953 action->addTo( helpMenu );
954 connect( action, SIGNAL( activated() ), 954 connect( action, SIGNAL( activated() ),
955 SLOT( synchowto() ) ); 955 SLOT( synchowto() ) );
956 action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); 956 action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this );
957 action->addTo( helpMenu ); 957 action->addTo( helpMenu );
958 connect( action, SIGNAL( activated() ), 958 connect( action, SIGNAL( activated() ),
959 SLOT( kdesynchowto() ) ); 959 SLOT( kdesynchowto() ) );
960 action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); 960 action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this );
961 action->addTo( helpMenu ); 961 action->addTo( helpMenu );
962 connect( action, SIGNAL( activated() ), 962 connect( action, SIGNAL( activated() ),
963 SLOT( multisynchowto() ) ); 963 SLOT( multisynchowto() ) );
964 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); 964 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this );
965 action->addTo( helpMenu ); 965 action->addTo( helpMenu );
966 connect( action, SIGNAL( activated() ), 966 connect( action, SIGNAL( activated() ),
967 SLOT( aboutAutoSaving() ) ); 967 SLOT( aboutAutoSaving() ) );
968 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); 968 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this );
969 action->addTo( helpMenu ); 969 action->addTo( helpMenu );
970 connect( action, SIGNAL( activated() ), 970 connect( action, SIGNAL( activated() ),
971 SLOT( aboutKnownBugs() ) ); 971 SLOT( aboutKnownBugs() ) );
972 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); 972 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this );
973 action->addTo( helpMenu ); 973 action->addTo( helpMenu );
974 connect( action, SIGNAL( activated() ), 974 connect( action, SIGNAL( activated() ),
975 SLOT( usertrans() ) ); 975 SLOT( usertrans() ) );
976 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); 976 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this );
977 action->addTo( helpMenu ); 977 action->addTo( helpMenu );
978 connect( action, SIGNAL( activated() ), 978 connect( action, SIGNAL( activated() ),
979 SLOT( faq() ) ); 979 SLOT( faq() ) );
980 action = new QAction( "licence", i18n("Licence..."), 0, this ); 980 action = new QAction( "licence", i18n("Licence..."), 0, this );
981 action->addTo( helpMenu ); 981 action->addTo( helpMenu );
982 connect( action, SIGNAL( activated() ), 982 connect( action, SIGNAL( activated() ),
983 SLOT( licence() ) ); 983 SLOT( licence() ) );
984 action = new QAction( "about", i18n("About..."), 0, this ); 984 action = new QAction( "about", i18n("About..."), 0, this );
985 action->addTo( helpMenu ); 985 action->addTo( helpMenu );
986 connect( action, SIGNAL( activated() ), 986 connect( action, SIGNAL( activated() ),
987 SLOT( about() ) ); 987 SLOT( about() ) );
988 //menuBar->insertSeparator(); 988 //menuBar->insertSeparator();
989 989
990 // ****************************************************** 990 // ******************************************************
991 // menubar icons 991 // menubar icons
992 992
993 993
994 iconToolBar->setHorizontalStretchable (true ); 994 iconToolBar->setHorizontalStretchable (true );
995 //menuBar->insertItem( iconToolBar ); 995 //menuBar->insertItem( iconToolBar );
996 //xdays_action 996 //xdays_action
997 if (p-> mShowIconNewEvent) 997 if (p-> mShowIconNewEvent)
998 ne_action->addTo( iconToolBar ); 998 ne_action->addTo( iconToolBar );
999 if (p->mShowIconNewTodo ) 999 if (p->mShowIconNewTodo )
1000 nt_action->addTo( iconToolBar ); 1000 nt_action->addTo( iconToolBar );
1001 if (p-> mShowIconSearch) 1001 if (p-> mShowIconSearch)
1002 search_action->addTo( iconToolBar ); 1002 search_action->addTo( iconToolBar );
1003 if (p-> mShowIconWhatsThis)
1004 QWhatsThis::whatsThisButton ( iconToolBar );
1003 if (p-> mShowIconNext) 1005 if (p-> mShowIconNext)
1004 whatsnext_action->addTo( iconToolBar ); 1006 whatsnext_action->addTo( iconToolBar );
1005 if (p-> mShowIconNextDays) 1007 if (p-> mShowIconNextDays)
1006 xdays_action->addTo( iconToolBar ); 1008 xdays_action->addTo( iconToolBar );
1007 if (p-> mShowIconList) 1009 if (p-> mShowIconList)
1008 showlist_action->addTo( iconToolBar ); 1010 showlist_action->addTo( iconToolBar );
1009 if (p-> mShowIconDay1) 1011 if (p-> mShowIconDay1)
1010 day1_action->addTo( iconToolBar ); 1012 day1_action->addTo( iconToolBar );
1011 if (p-> mShowIconDay5) 1013 if (p-> mShowIconDay5)
1012 day5_action->addTo( iconToolBar ); 1014 day5_action->addTo( iconToolBar );
1013 if (p-> mShowIconDay7) 1015 if (p-> mShowIconDay7)
1014 day7_action->addTo( iconToolBar ); 1016 day7_action->addTo( iconToolBar );
1015 if (p-> mShowIconDay6) 1017 if (p-> mShowIconDay6)
1016 day6_action->addTo( iconToolBar ); 1018 day6_action->addTo( iconToolBar );
1017 if (p-> mShowIconMonth) 1019 if (p-> mShowIconMonth)
1018 month_action->addTo( iconToolBar ); 1020 month_action->addTo( iconToolBar );
1019 if (p-> mShowIconTodoview) 1021 if (p-> mShowIconTodoview)
1020 todoview_action->addTo( iconToolBar ); 1022 todoview_action->addTo( iconToolBar );
1021 if (p-> mShowIconJournal) 1023 if (p-> mShowIconJournal)
1022 viewjournal_action->addTo( iconToolBar ); 1024 viewjournal_action->addTo( iconToolBar );
1023 icon = loadPixmap( pathString + "2leftarrowB" ); 1025 icon = loadPixmap( pathString + "2leftarrowB" );
1024 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14); 1026 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14);
1025 if (p-> mShowIconBackFast) { 1027 if (p-> mShowIconBackFast) {
1026 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); 1028 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this );
1027 connect( action, SIGNAL( activated() ), 1029 connect( action, SIGNAL( activated() ),
1028 mView, SLOT( goPreviousMonth() ) ); 1030 mView, SLOT( goPreviousMonth() ) );
1029 action->addTo( iconToolBar ); 1031 action->addTo( iconToolBar );
1030 } 1032 }
1031 icon = loadPixmap( pathString + "1leftarrowB" ); 1033 icon = loadPixmap( pathString + "1leftarrowB" );
1032 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15); 1034 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15);
1033 if (p-> mShowIconBack) { 1035 if (p-> mShowIconBack) {
1034 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); 1036 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this );
1035 connect( action, SIGNAL( activated() ), 1037 connect( action, SIGNAL( activated() ),
1036 mView, SLOT( goPrevious() ) ); 1038 mView, SLOT( goPrevious() ) );
1037 action->addTo( iconToolBar ); 1039 action->addTo( iconToolBar );
1038 } 1040 }
1039 icon = loadPixmap( pathString + "today" ); 1041 icon = loadPixmap( pathString + "today" );
1040 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); 1042 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130);
1041 if (p-> mShowIconToday) 1043 if (p-> mShowIconToday)
1042 today_action->addTo( iconToolBar ); 1044 today_action->addTo( iconToolBar );
1043 icon = loadPixmap( pathString + "1rightarrowB" ); 1045 icon = loadPixmap( pathString + "1rightarrowB" );
1044 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); 1046 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220);
1045 if (p-> mShowIconForward) { 1047 if (p-> mShowIconForward) {
1046 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); 1048 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this );
1047 connect( action, SIGNAL( activated() ), 1049 connect( action, SIGNAL( activated() ),
1048 mView, SLOT( goNext() ) ); 1050 mView, SLOT( goNext() ) );
1049 action->addTo( iconToolBar ); 1051 action->addTo( iconToolBar );
1050 } 1052 }
1051 icon = loadPixmap( pathString + "2rightarrowB" ); 1053 icon = loadPixmap( pathString + "2rightarrowB" );
1052 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); 1054 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230);
1053 if (p-> mShowIconForwardFast) { 1055 if (p-> mShowIconForwardFast) {
1054 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); 1056 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this );
1055 connect( action, SIGNAL( activated() ), 1057 connect( action, SIGNAL( activated() ),
1056 mView, SLOT( goNextMonth() ) ); 1058 mView, SLOT( goNextMonth() ) );
1057 action->addTo( iconToolBar ); 1059 action->addTo( iconToolBar );
1058 } 1060 }
1059 1061
1060 1062
1061 configureToolBarMenu->insertItem(i18n("What's This?"), 300); 1063 configureToolBarMenu->insertItem(i18n("What's This?"), 300);
1062 1064
1063 if (p-> mShowIconNewEvent) 1065 if (p-> mShowIconNewEvent)
1064 configureToolBarMenu->setItemChecked( 10, true ); 1066 configureToolBarMenu->setItemChecked( 10, true );
1065 if (p->mShowIconNewTodo ) 1067 if (p->mShowIconNewTodo )
1066 configureToolBarMenu->setItemChecked( 20, true ); 1068 configureToolBarMenu->setItemChecked( 20, true );
1067 if (p-> mShowIconSearch) 1069 if (p-> mShowIconSearch)
1068 configureToolBarMenu->setItemChecked( 120, true ); 1070 configureToolBarMenu->setItemChecked( 120, true );
1069 if (p-> mShowIconList) 1071 if (p-> mShowIconList)
1070 configureToolBarMenu->setItemChecked( 30, true ); 1072 configureToolBarMenu->setItemChecked( 30, true );
1071 if (p-> mShowIconDay1) 1073 if (p-> mShowIconDay1)
1072 configureToolBarMenu->setItemChecked( 40, true ); 1074 configureToolBarMenu->setItemChecked( 40, true );
1073 if (p-> mShowIconDay5) 1075 if (p-> mShowIconDay5)
1074 configureToolBarMenu->setItemChecked( 50, true ); 1076 configureToolBarMenu->setItemChecked( 50, true );
1075 if (p-> mShowIconDay6) 1077 if (p-> mShowIconDay6)
1076 configureToolBarMenu->setItemChecked( 75, true ); 1078 configureToolBarMenu->setItemChecked( 75, true );
1077 if (p-> mShowIconDay7) 1079 if (p-> mShowIconDay7)
1078 configureToolBarMenu->setItemChecked( 60, true ); 1080 configureToolBarMenu->setItemChecked( 60, true );
1079 if (p-> mShowIconMonth) 1081 if (p-> mShowIconMonth)
1080 configureToolBarMenu->setItemChecked( 70, true ); 1082 configureToolBarMenu->setItemChecked( 70, true );
1081 if (p-> mShowIconTodoview) 1083 if (p-> mShowIconTodoview)
1082 configureToolBarMenu->setItemChecked( 80, true ); 1084 configureToolBarMenu->setItemChecked( 80, true );
1083 if (p-> mShowIconBackFast) 1085 if (p-> mShowIconBackFast)
1084 configureToolBarMenu->setItemChecked( 200, true ); 1086 configureToolBarMenu->setItemChecked( 200, true );
1085 if (p-> mShowIconBack) 1087 if (p-> mShowIconBack)
1086 configureToolBarMenu->setItemChecked( 210, true ); 1088 configureToolBarMenu->setItemChecked( 210, true );
1087 if (p-> mShowIconToday) 1089 if (p-> mShowIconToday)
1088 configureToolBarMenu->setItemChecked( 130, true ); 1090 configureToolBarMenu->setItemChecked( 130, true );
1089 if (p-> mShowIconForward) 1091 if (p-> mShowIconForward)
1090 configureToolBarMenu->setItemChecked( 220, true ); 1092 configureToolBarMenu->setItemChecked( 220, true );
1091 if (p-> mShowIconForwardFast) 1093 if (p-> mShowIconForwardFast)
1092 configureToolBarMenu->setItemChecked( 230, true ); 1094 configureToolBarMenu->setItemChecked( 230, true );
1093 if (p-> mShowIconNextDays) 1095 if (p-> mShowIconNextDays)
1094 configureToolBarMenu->setItemChecked( 100, true ); 1096 configureToolBarMenu->setItemChecked( 100, true );
1095 if (p-> mShowIconNext) 1097 if (p-> mShowIconNext)
1096 configureToolBarMenu->setItemChecked( 110, true ); 1098 configureToolBarMenu->setItemChecked( 110, true );
1097 if (p-> mShowIconJournal) 1099 if (p-> mShowIconJournal)
1098 configureToolBarMenu->setItemChecked( 90, true ); 1100 configureToolBarMenu->setItemChecked( 90, true );
1099 if (p-> mShowIconWhatsThis) 1101 if (p-> mShowIconWhatsThis)
1100 configureToolBarMenu->setItemChecked( 300, true ); 1102 configureToolBarMenu->setItemChecked( 300, true );
1101 if (p-> mShowIconWeekNum) 1103 if (p-> mShowIconWeekNum)
1102 configureToolBarMenu->setItemChecked( 400, true ); 1104 configureToolBarMenu->setItemChecked( 400, true );
1103 QLabel* dummy = new QLabel( iconToolBar ); 1105 QLabel* dummy = new QLabel( iconToolBar );
1104 dummy->setBackgroundColor( iconToolBar->backgroundColor() ); 1106 dummy->setBackgroundColor( iconToolBar->backgroundColor() );
1105 if (!p-> mShowIconStretch) 1107 if (!p-> mShowIconStretch)
1106 iconToolBar->setStretchableWidget ( dummy ) ; 1108 iconToolBar->setStretchableWidget ( dummy ) ;
1107 else 1109 else
1108 configureToolBarMenu->setItemChecked( 5, true ); 1110 configureToolBarMenu->setItemChecked( 5, true );
1109 if (p-> mShowIconWhatsThis)
1110 QWhatsThis::whatsThisButton ( iconToolBar );
1111 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); 1111 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) );
1112 configureAgenda( p->mHourSize ); 1112 configureAgenda( p->mHourSize );
1113 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); 1113 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) );
1114} 1114}
1115 1115
1116void MainWindow::exportToPhone( int mode ) 1116void MainWindow::exportToPhone( int mode )
1117{ 1117{
1118 1118
1119 //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 1119 //ex2phone->insertItem(i18n("Complete calendar..."), 1 );
1120 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 1120 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
1121 KOex2phonePrefs ex2phone; 1121 KOex2phonePrefs ex2phone;
1122 1122
1123 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); 1123 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
1124 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); 1124 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
1125 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1125 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
1126 if ( mode == 1 ) 1126 if ( mode == 1 )
1127 ex2phone.setCaption(i18n("Export complete calendar")); 1127 ex2phone.setCaption(i18n("Export complete calendar"));
1128 if ( mode == 2 ) 1128 if ( mode == 2 )
1129 ex2phone.setCaption(i18n("Export filtered calendar")); 1129 ex2phone.setCaption(i18n("Export filtered calendar"));
1130 1130
1131 if ( !ex2phone.exec() ) { 1131 if ( !ex2phone.exec() ) {
1132 return; 1132 return;
1133 } 1133 }
1134 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 1134 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
1135 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 1135 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
1136 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 1136 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
1137 1137
1138 int inFuture = 0; 1138 int inFuture = 0;
1139 if ( ex2phone.mWriteBackFuture->isChecked() ) 1139 if ( ex2phone.mWriteBackFuture->isChecked() )
1140 inFuture = ex2phone.mWriteBackFutureWeeks->value(); 1140 inFuture = ex2phone.mWriteBackFutureWeeks->value();
1141 QPtrList<Incidence> delSel; 1141 QPtrList<Incidence> delSel;
1142 if ( mode == 1 ) 1142 if ( mode == 1 )
1143 delSel = mCalendar->rawIncidences(); 1143 delSel = mCalendar->rawIncidences();
1144 if ( mode == 2 ) 1144 if ( mode == 2 )
1145 delSel = mCalendar->incidences(); 1145 delSel = mCalendar->incidences();
1146 CalendarLocal* cal = new CalendarLocal(); 1146 CalendarLocal* cal = new CalendarLocal();
1147 cal->setLocalTime(); 1147 cal->setLocalTime();
1148 Incidence *incidence = delSel.first(); 1148 Incidence *incidence = delSel.first();
1149 QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); 1149 QDateTime cur = QDateTime::currentDateTime().addDays( -7 );
1150 QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); 1150 QDateTime end = cur.addDays( ( inFuture +1 ) *7 );
1151 while ( incidence ) { 1151 while ( incidence ) {
1152 if ( incidence->type() != "Journal" ) { 1152 if ( incidence->type() != "Journal" ) {
1153 bool add = true; 1153 bool add = true;
1154 if ( inFuture ) { 1154 if ( inFuture ) {
1155 QDateTime dt; 1155 QDateTime dt;
1156 if ( incidence->type() == "Todo" ) { 1156 if ( incidence->type() == "Todo" ) {
1157 Todo * t = (Todo*)incidence; 1157 Todo * t = (Todo*)incidence;
1158 if ( t->hasDueDate() ) 1158 if ( t->hasDueDate() )
1159 dt = t->dtDue(); 1159 dt = t->dtDue();
1160 else 1160 else
1161 dt = cur.addSecs( 62 ); 1161 dt = cur.addSecs( 62 );
1162 } 1162 }
1163 else { 1163 else {
1164 bool ok; 1164 bool ok;
1165 dt = incidence->getNextOccurence( cur, &ok ); 1165 dt = incidence->getNextOccurence( cur, &ok );
1166 if ( !ok ) 1166 if ( !ok )
1167 dt = cur.addSecs( -62 ); 1167 dt = cur.addSecs( -62 );
1168 } 1168 }
1169 if ( dt < cur || dt > end ) { 1169 if ( dt < cur || dt > end ) {
1170 add = false; 1170 add = false;
1171 } 1171 }
1172 } 1172 }
1173 if ( add ) { 1173 if ( add ) {
1174 Incidence *in = incidence->clone(); 1174 Incidence *in = incidence->clone();
1175 cal->addIncidence( in ); 1175 cal->addIncidence( in );
1176 } 1176 }
1177 } 1177 }
1178 incidence = delSel.next(); 1178 incidence = delSel.next();
1179 } 1179 }
1180 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, 1180 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
1181 KPimGlobalPrefs::instance()->mEx2PhoneConnection, 1181 KPimGlobalPrefs::instance()->mEx2PhoneConnection,
1182 KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1182 KPimGlobalPrefs::instance()->mEx2PhoneModel );
1183 1183
1184 setCaption( i18n("Writing to phone...")); 1184 setCaption( i18n("Writing to phone..."));
1185 if ( PhoneFormat::writeToPhone( cal ) ) 1185 if ( PhoneFormat::writeToPhone( cal ) )
1186 setCaption( i18n("Export to phone successful!")); 1186 setCaption( i18n("Export to phone successful!"));
1187 else 1187 else
1188 setCaption( i18n("Error exporting to phone!")); 1188 setCaption( i18n("Error exporting to phone!"));
1189 delete cal; 1189 delete cal;
1190} 1190}
1191 1191
1192 1192
1193void MainWindow::setDefaultPreferences() 1193void MainWindow::setDefaultPreferences()
1194{ 1194{
1195 KOPrefs *p = KOPrefs::instance(); 1195 KOPrefs *p = KOPrefs::instance();
1196 1196
1197 p->mCompactDialogs = true; 1197 p->mCompactDialogs = true;
1198 p->mConfirm = true; 1198 p->mConfirm = true;
1199 // p->mEnableQuickTodo = false; 1199 // p->mEnableQuickTodo = false;
1200 1200
1201} 1201}
1202 1202
1203QString MainWindow::resourcePath() 1203QString MainWindow::resourcePath()
1204{ 1204{
1205 return KGlobal::iconLoader()->iconPath(); 1205 return KGlobal::iconLoader()->iconPath();
1206} 1206}