-rw-r--r-- | korganizer/datenavigatorcontainer.cpp | 3 | ||||
-rw-r--r-- | korganizer/kodaymatrix.cpp | 8 | ||||
-rw-r--r-- | korganizer/koeventviewerdialog.cpp | 16 | ||||
-rw-r--r-- | korganizer/koeventviewerdialog.h | 1 | ||||
-rw-r--r-- | korganizer/koprefsdialog.cpp | 3 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 4 |
6 files changed, 18 insertions, 17 deletions
diff --git a/korganizer/datenavigatorcontainer.cpp b/korganizer/datenavigatorcontainer.cpp index e57daa4..f9c8b73 100644 --- a/korganizer/datenavigatorcontainer.cpp +++ b/korganizer/datenavigatorcontainer.cpp | |||
@@ -26,206 +26,205 @@ | |||
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 | ||
38 | DateNavigatorContainer::DateNavigatorContainer( QWidget *parent, | 38 | DateNavigatorContainer::DateNavigatorContainer( QWidget *parent, |
39 | const char *name ) | 39 | const char *name ) |
40 | : QWidget( parent, name ), mCalendar( 0 ), | 40 | : QWidget( parent, name ), mCalendar( 0 ), |
41 | mHorizontalCount( 1 ), mVerticalCount( 1 ) | 41 | mHorizontalCount( 1 ), mVerticalCount( 1 ) |
42 | { | 42 | { |
43 | mResizeEnabled = false; | 43 | mResizeEnabled = false; |
44 | mExtraViews.setAutoDelete( true ); | 44 | mExtraViews.setAutoDelete( true ); |
45 | 45 | ||
46 | mNavigatorView = new KDateNavigator( this, name ); | 46 | mNavigatorView = new KDateNavigator( this, name ); |
47 | mNavigatorView->hide(); | 47 | mNavigatorView->hide(); |
48 | connectNavigatorView( mNavigatorView ); | 48 | connectNavigatorView( mNavigatorView ); |
49 | //setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) ); | 49 | //setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) ); |
50 | mLastDisplayedDN = 0; | 50 | mLastDisplayedDN = 0; |
51 | mUpdateTimer; | 51 | mUpdateTimer; |
52 | mUpdateTimer = new QTimer( this ); | 52 | mUpdateTimer = new QTimer( this ); |
53 | connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( checkUpdateDayMatrixDates() )); | 53 | connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( checkUpdateDayMatrixDates() )); |
54 | mFirstSelectedDate = QDate::currentDate(); | 54 | mFirstSelectedDate = QDate::currentDate(); |
55 | mSelectedDateCount = 1; | 55 | mSelectedDateCount = 1; |
56 | } | 56 | } |
57 | 57 | ||
58 | DateNavigatorContainer::~DateNavigatorContainer() | 58 | DateNavigatorContainer::~DateNavigatorContainer() |
59 | { | 59 | { |
60 | } | 60 | } |
61 | 61 | ||
62 | void DateNavigatorContainer::connectNavigatorView( KDateNavigator *v ) | 62 | void DateNavigatorContainer::connectNavigatorView( KDateNavigator *v ) |
63 | { | 63 | { |
64 | connect( v, SIGNAL( datesSelected( const KCal::DateList & ) ), | 64 | connect( v, SIGNAL( datesSelected( const KCal::DateList & ) ), |
65 | SIGNAL( datesSelected( const KCal::DateList & ) ) ); | 65 | SIGNAL( datesSelected( const KCal::DateList & ) ) ); |
66 | #if 0 | 66 | #if 0 |
67 | connect( v, SIGNAL( incidenceDropped( Incidence *, const QDate & ) ), | 67 | connect( v, SIGNAL( incidenceDropped( Incidence *, const QDate & ) ), |
68 | SIGNAL( incidenceDropped( Incidence *, const QDate & ) ) ); | 68 | SIGNAL( incidenceDropped( Incidence *, const QDate & ) ) ); |
69 | connect( v, SIGNAL( incidenceDroppedMove( Incidence *, const QDate & ) ), | 69 | connect( v, SIGNAL( incidenceDroppedMove( Incidence *, const QDate & ) ), |
70 | SIGNAL( incidenceDroppedMove( Incidence *, const QDate & ) ) ); | 70 | SIGNAL( incidenceDroppedMove( Incidence *, const QDate & ) ) ); |
71 | #endif | 71 | #endif |
72 | connect( v, SIGNAL( weekClicked( const QDate & ) ), | 72 | connect( v, SIGNAL( weekClicked( const QDate & ) ), |
73 | SIGNAL( weekClicked( const QDate & ) ) ); | 73 | SIGNAL( weekClicked( const QDate & ) ) ); |
74 | connect( v, SIGNAL( showMonth( const QDate & ) ), | 74 | connect( v, SIGNAL( showMonth( const QDate & ) ), |
75 | SIGNAL( showMonth( const QDate & ) ) ); | 75 | SIGNAL( showMonth( const QDate & ) ) ); |
76 | 76 | ||
77 | connect( v, SIGNAL( goPrevious() ), SIGNAL( goPrevious() ) ); | 77 | connect( v, SIGNAL( goPrevious() ), SIGNAL( goPrevious() ) ); |
78 | connect( v, SIGNAL( goNext() ), SIGNAL( goNext() ) ); | 78 | connect( v, SIGNAL( goNext() ), SIGNAL( goNext() ) ); |
79 | 79 | ||
80 | connect( v, SIGNAL( goNextMonth() ), SLOT( slotgoNextMonth() ) ); | 80 | connect( v, SIGNAL( goNextMonth() ), SLOT( slotgoNextMonth() ) ); |
81 | connect( v, SIGNAL( goPrevMonth() ), SLOT( slotgoPrevMonth() ) ); | 81 | connect( v, SIGNAL( goPrevMonth() ), SLOT( slotgoPrevMonth() ) ); |
82 | connect( v, SIGNAL( goNextYear() ), SLOT( slotgoNextYear() ) ); | 82 | connect( v, SIGNAL( goNextYear() ), SLOT( slotgoNextYear() ) ); |
83 | connect( v, SIGNAL( goPrevYear() ), SLOT( slotgoPrevYear() ) ); | 83 | connect( v, SIGNAL( goPrevYear() ), SLOT( slotgoPrevYear() ) ); |
84 | 84 | ||
85 | connect( v, SIGNAL( monthSelected( int ) ), SLOT( slotMonthSelected( int ) ) ); | 85 | connect( v, SIGNAL( monthSelected( int ) ), SLOT( slotMonthSelected( int ) ) ); |
86 | } | 86 | } |
87 | void DateNavigatorContainer::slotgoNextYear() | 87 | void DateNavigatorContainer::slotgoNextYear() |
88 | { | 88 | { |
89 | jumpMonth( 12 ); | 89 | jumpMonth( 12 ); |
90 | emit goNextYear(); | 90 | emit goNextYear(); |
91 | 91 | ||
92 | } | 92 | } |
93 | void DateNavigatorContainer::slotgoPrevYear() | 93 | void DateNavigatorContainer::slotgoPrevYear() |
94 | { | 94 | { |
95 | jumpMonth( -12 ); | 95 | jumpMonth( -12 ); |
96 | emit goPrevYear(); | 96 | emit goPrevYear(); |
97 | 97 | ||
98 | } | 98 | } |
99 | void DateNavigatorContainer::slotgoPrevMonth() | 99 | void DateNavigatorContainer::slotgoPrevMonth() |
100 | { | 100 | { |
101 | jumpMonth( -1 ); | 101 | jumpMonth( -1 ); |
102 | emit goPrevMonth(); | 102 | emit goPrevMonth(); |
103 | 103 | ||
104 | } | 104 | } |
105 | void DateNavigatorContainer::slotgoNextMonth() | 105 | void DateNavigatorContainer::slotgoNextMonth() |
106 | { | 106 | { |
107 | jumpMonth( 1 ); | 107 | jumpMonth( 1 ); |
108 | emit goNextMonth(); | 108 | emit goNextMonth(); |
109 | } | 109 | } |
110 | void DateNavigatorContainer::jumpMonth( int month ) | 110 | void DateNavigatorContainer::jumpMonth( int month ) |
111 | { | 111 | { |
112 | 112 | ||
113 | QDate baseDate = mNavigatorView->baseDate(); | 113 | QDate baseDate = mNavigatorView->baseDate(); |
114 | computeMonthSelected( baseDate.month() + month, false ); | 114 | computeMonthSelected( baseDate.month() + month, false ); |
115 | } | 115 | } |
116 | void DateNavigatorContainer::slotMonthSelected( int month ) | 116 | void DateNavigatorContainer::slotMonthSelected( int month ) |
117 | { | 117 | { |
118 | computeMonthSelected( month, true ); | 118 | computeMonthSelected( month, true ); |
119 | } | 119 | } |
120 | void DateNavigatorContainer::computeMonthSelected( int month , bool forceEmit ) | 120 | void DateNavigatorContainer::computeMonthSelected( int month , bool forceEmit ) |
121 | { | 121 | { |
122 | //qDebug("slotMonthSelected %d ", month); | 122 | //qDebug("slotMonthSelected %d ", month); |
123 | QDate baseDate = mNavigatorView->baseDate(); | 123 | QDate baseDate = mNavigatorView->baseDate(); |
124 | if ( baseDate.month() == month ) | 124 | if ( baseDate.month() == month ) |
125 | return; | 125 | return; |
126 | //qDebug("month %d %d ",baseDate.month(),month); | 126 | //qDebug("month %d %d ",baseDate.month(),month); |
127 | QDate date = QDate ( baseDate.year(), baseDate.month() , 15 ); | 127 | QDate date = QDate ( baseDate.year(), baseDate.month() , 15 ); |
128 | date = date.addDays( -(baseDate.month()-month ) *30 ); | 128 | date = date.addDays( -(baseDate.month()-month ) *30 ); |
129 | QDate newBase = QDate ( date.year(), date.month() ,1 ); | 129 | QDate newBase = QDate ( date.year(), date.month() ,1 ); |
130 | 130 | ||
131 | //qDebug("NEW BASE %s", newBase.toString().latin1()); | 131 | //qDebug("NEW BASE %s", newBase.toString().latin1()); |
132 | mNavigatorView->setBaseDate( newBase ); | 132 | mNavigatorView->setBaseDate( newBase ); |
133 | QDate last = lastAvailableDate(); | 133 | QDate last = lastAvailableDate(); |
134 | QDate first = firstAvailableDate(); | 134 | QDate first = firstAvailableDate(); |
135 | |||
136 | QDate selFirst = mFirstSelectedDate; | 135 | QDate selFirst = mFirstSelectedDate; |
137 | QDate selLast = selFirst.addDays( mSelectedDateCount-1 ); | 136 | QDate selLast = selFirst.addDays( mSelectedDateCount-1 ); |
138 | if ( selFirst >= first && selLast <= last ) { | 137 | if ( selFirst >= first && selLast <= last ) { |
139 | setBaseDates(); | 138 | setBaseDates(); |
140 | if ( forceEmit ) | 139 | if ( forceEmit ) |
141 | updateDayMatrixDates(); | 140 | updateDayMatrixDates(); |
142 | } | 141 | } |
143 | else { | 142 | else { |
144 | setBaseDates(); | 143 | setBaseDates(); |
145 | if ( forceEmit ) | 144 | if ( forceEmit ) |
146 | updateDayMatrixDates(); | 145 | updateDayMatrixDates(); |
147 | if ( forceEmit ) | 146 | if ( forceEmit ) |
148 | emit monthSelected( month ); | 147 | emit monthSelected( month ); |
149 | } | 148 | } |
150 | } | 149 | } |
151 | void DateNavigatorContainer::setCalendar( Calendar *cal ) | 150 | void DateNavigatorContainer::setCalendar( Calendar *cal ) |
152 | { | 151 | { |
153 | mCalendar = cal; | 152 | mCalendar = cal; |
154 | mNavigatorView->setCalendar( cal ); | 153 | mNavigatorView->setCalendar( cal ); |
155 | for( uint i = 0; i < mLastDisplayedDN; ++i ) { | 154 | for( uint i = 0; i < mLastDisplayedDN; ++i ) { |
156 | KDateNavigator *n = mExtraViews.at( i ); | 155 | KDateNavigator *n = mExtraViews.at( i ); |
157 | n->setCalendar( cal ); | 156 | n->setCalendar( cal ); |
158 | } | 157 | } |
159 | } | 158 | } |
160 | void DateNavigatorContainer::checkUpdateDayMatrixDates() | 159 | void DateNavigatorContainer::checkUpdateDayMatrixDates() |
161 | { | 160 | { |
162 | //qDebug("KODNC: wid %d hei %d ", width(), height()); | 161 | //qDebug("KODNC: wid %d hei %d ", width(), height()); |
163 | mUpdateTimer->stop(); | 162 | mUpdateTimer->stop(); |
164 | //return; | 163 | //return; |
165 | if ( width() < 3 || height() < 3 ) | 164 | if ( width() < 3 || height() < 3 ) |
166 | return; | 165 | return; |
167 | static int lastWid = 0; | 166 | static int lastWid = 0; |
168 | static int lastHei = 0; | 167 | static int lastHei = 0; |
169 | if ( lastWid == width() && height() == lastHei ) { | 168 | if ( lastWid == width() && height() == lastHei ) { |
170 | qDebug("KODNC: No layout computing needed. "); | 169 | qDebug("KODNC: No layout computing needed. "); |
171 | } else { | 170 | } else { |
172 | lastWid = width(); | 171 | lastWid = width(); |
173 | lastHei = height(); | 172 | lastHei = height(); |
174 | 173 | ||
175 | QSize minSize = mNavigatorView->yourSizeHint(); | 174 | QSize minSize = mNavigatorView->yourSizeHint(); |
176 | 175 | ||
177 | int verticalCount = size().height() / minSize.height(); | 176 | int verticalCount = size().height() / minSize.height(); |
178 | int horizontalCount = size().width() / minSize.width(); | 177 | int horizontalCount = size().width() / minSize.width(); |
179 | //qDebug(" wattdatt %d new %d %d ", size().width() ,e->size().width() , minSize.width() ); | 178 | //qDebug(" wattdatt %d new %d %d ", size().width() ,e->size().width() , minSize.width() ); |
180 | //qDebug("COUNT %d %d %d %d ", verticalCount, horizontalCount , mVerticalCount, mHorizontalCount ); | 179 | //qDebug("COUNT %d %d %d %d ", verticalCount, horizontalCount , mVerticalCount, mHorizontalCount ); |
181 | bool fontchange = false; | 180 | bool fontchange = false; |
182 | if ( horizontalCount == 1) | 181 | if ( horizontalCount == 1) |
183 | horizontalCount = size().width() / mNavigatorView->yourFullSizeHint().width(); | 182 | horizontalCount = size().width() / mNavigatorView->yourFullSizeHint().width(); |
184 | QFont fo; | 183 | QFont fo; |
185 | if ( horizontalCount != mHorizontalCount || | 184 | if ( horizontalCount != mHorizontalCount || |
186 | verticalCount != mVerticalCount ) { | 185 | verticalCount != mVerticalCount ) { |
187 | uint count = horizontalCount * verticalCount; | 186 | uint count = horizontalCount * verticalCount; |
188 | if ( count == 0 ) { | 187 | if ( count == 0 ) { |
189 | bool ok; | 188 | bool ok; |
190 | fo = mNavigatorView->yourFontHint( size() , &ok ); | 189 | fo = mNavigatorView->yourFontHint( size() , &ok ); |
191 | //mNavigatorView->resize( size() ); | 190 | //mNavigatorView->resize( size() ); |
192 | //if ( ! ok ) | 191 | //if ( ! ok ) |
193 | // return; | 192 | // return; |
194 | int butt = 2; | 193 | int butt = 2; |
195 | horizontalCount = size().width() / mNavigatorView->sizeHintTwoButtons( ).width(); | 194 | horizontalCount = size().width() / mNavigatorView->sizeHintTwoButtons( ).width(); |
196 | if ( horizontalCount <= 1 ) | 195 | if ( horizontalCount <= 1 ) |
197 | minSize = mNavigatorView->sizeHintTwoButtons( 4 ); | 196 | minSize = mNavigatorView->sizeHintTwoButtons( 4 ); |
198 | else | 197 | else |
199 | minSize = mNavigatorView->sizeHintTwoButtons(); | 198 | minSize = mNavigatorView->sizeHintTwoButtons(); |
200 | verticalCount = size().height() / minSize.height(); | 199 | verticalCount = size().height() / minSize.height(); |
201 | horizontalCount = size().width() / minSize.width(); | 200 | horizontalCount = size().width() / minSize.width(); |
202 | if ( horizontalCount == 0 ) | 201 | if ( horizontalCount == 0 ) |
203 | horizontalCount = 1; | 202 | horizontalCount = 1; |
204 | if ( verticalCount == 0 ) | 203 | if ( verticalCount == 0 ) |
205 | verticalCount = 1; | 204 | verticalCount = 1; |
206 | fontchange = true; | 205 | fontchange = true; |
207 | count = horizontalCount * verticalCount; | 206 | count = horizontalCount * verticalCount; |
208 | } else { | 207 | } else { |
209 | if ( mNavigatorView->fontChanged() ) { | 208 | if ( mNavigatorView->fontChanged() ) { |
210 | fontchange = true; | 209 | fontchange = true; |
211 | fo = KOPrefs::instance()->mDateNavigatorFont; | 210 | fo = KOPrefs::instance()->mDateNavigatorFont; |
212 | mNavigatorView->changeFont( fo ); | 211 | mNavigatorView->changeFont( fo ); |
213 | mNavigatorView->unsetFontChanged(); | 212 | mNavigatorView->unsetFontChanged(); |
214 | } | 213 | } |
215 | } | 214 | } |
216 | mLastDisplayedDN = horizontalCount*verticalCount-1; | 215 | mLastDisplayedDN = horizontalCount*verticalCount-1; |
217 | while ( count > ( mExtraViews.count() + 1 ) ) { | 216 | while ( count > ( mExtraViews.count() + 1 ) ) { |
218 | KDateNavigator *n = new KDateNavigator( this ); | 217 | KDateNavigator *n = new KDateNavigator( this ); |
219 | n->setMonthSignalOffset ( mExtraViews.count()+1 ); | 218 | n->setMonthSignalOffset ( mExtraViews.count()+1 ); |
220 | mExtraViews.append( n ); | 219 | mExtraViews.append( n ); |
221 | n->setCalendar( mCalendar ); | 220 | n->setCalendar( mCalendar ); |
222 | connectNavigatorView( n ); | 221 | connectNavigatorView( n ); |
223 | // n->show(); | 222 | // n->show(); |
224 | } | 223 | } |
225 | 224 | ||
226 | setBaseDates(); | 225 | setBaseDates(); |
227 | if ( fontchange ) { | 226 | if ( fontchange ) { |
228 | //mNavigatorView->changeFont( fo ); | 227 | //mNavigatorView->changeFont( fo ); |
229 | uint i; | 228 | uint i; |
230 | for( i = 0; i < mExtraViews.count(); ++i ) { | 229 | for( i = 0; i < mExtraViews.count(); ++i ) { |
231 | KDateNavigator *view = mExtraViews.at( i ); | 230 | KDateNavigator *view = mExtraViews.at( i ); |
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp index 322131f..ecca374 100644 --- a/korganizer/kodaymatrix.cpp +++ b/korganizer/kodaymatrix.cpp | |||
@@ -247,196 +247,196 @@ KODayMatrix::~KODayMatrix() | |||
247 | // delete mKODaymatrixWhatsThis; | 247 | // delete mKODaymatrixWhatsThis; |
248 | delete [] days; | 248 | delete [] days; |
249 | delete [] daylbls; | 249 | delete [] daylbls; |
250 | //delete [] events; | 250 | //delete [] events; |
251 | delete mToolTip; | 251 | delete mToolTip; |
252 | } | 252 | } |
253 | 253 | ||
254 | /* | 254 | /* |
255 | void KODayMatrix::setStartDate(QDate start) | 255 | void KODayMatrix::setStartDate(QDate start) |
256 | { | 256 | { |
257 | updateView(start); | 257 | updateView(start); |
258 | } | 258 | } |
259 | */ | 259 | */ |
260 | 260 | ||
261 | void KODayMatrix::addSelectedDaysTo(DateList& selDays) | 261 | void KODayMatrix::addSelectedDaysTo(DateList& selDays) |
262 | { | 262 | { |
263 | 263 | ||
264 | if (mSelStart == NOSELECTION) { | 264 | if (mSelStart == NOSELECTION) { |
265 | return; | 265 | return; |
266 | } | 266 | } |
267 | 267 | ||
268 | //cope with selection being out of matrix limits at top (< 0) | 268 | //cope with selection being out of matrix limits at top (< 0) |
269 | int i0 = mSelStart; | 269 | int i0 = mSelStart; |
270 | if (i0 < 0) { | 270 | if (i0 < 0) { |
271 | for (int i = i0; i < 0; i++) { | 271 | for (int i = i0; i < 0; i++) { |
272 | selDays.append(days[0].addDays(i)); | 272 | selDays.append(days[0].addDays(i)); |
273 | } | 273 | } |
274 | i0 = 0; | 274 | i0 = 0; |
275 | } | 275 | } |
276 | 276 | ||
277 | //cope with selection being out of matrix limits at bottom (> NUMDAYS-1) | 277 | //cope with selection being out of matrix limits at bottom (> NUMDAYS-1) |
278 | if (mSelEnd > NUMDAYS-1) { | 278 | if (mSelEnd > NUMDAYS-1) { |
279 | for (int i = i0; i <= NUMDAYS-1; i++) { | 279 | for (int i = i0; i <= NUMDAYS-1; i++) { |
280 | selDays.append(days[i]); | 280 | selDays.append(days[i]); |
281 | } | 281 | } |
282 | for (int i = NUMDAYS; i < mSelEnd; i++) { | 282 | for (int i = NUMDAYS; i < mSelEnd; i++) { |
283 | selDays.append(days[0].addDays(i)); | 283 | selDays.append(days[0].addDays(i)); |
284 | } | 284 | } |
285 | 285 | ||
286 | // apply normal routine to selection being entirely within matrix limits | 286 | // apply normal routine to selection being entirely within matrix limits |
287 | } else { | 287 | } else { |
288 | for (int i = i0; i <= mSelEnd; i++) { | 288 | for (int i = i0; i <= mSelEnd; i++) { |
289 | selDays.append(days[i]); | 289 | selDays.append(days[i]); |
290 | } | 290 | } |
291 | } | 291 | } |
292 | } | 292 | } |
293 | 293 | ||
294 | bool KODayMatrix::setSelectedDaysFrom(const QDate& start, const QDate& end) | 294 | bool KODayMatrix::setSelectedDaysFrom(const QDate& start, const QDate& end) |
295 | { | 295 | { |
296 | mRedrawNeeded = true; | 296 | mRedrawNeeded = true; |
297 | bool noSel = (mSelEnd == NOSELECTION && mSelStart == NOSELECTION ); | 297 | bool noSel = (mSelEnd == NOSELECTION && mSelStart == NOSELECTION ); |
298 | mSelStart = startdate.daysTo(start); | 298 | mSelStart = startdate.daysTo(start); |
299 | if ( mSelStart < 0 ) | 299 | if ( mSelStart < 0 ) |
300 | mSelStart = 0; | 300 | mSelStart = 0; |
301 | mSelEnd = startdate.daysTo(end); | 301 | mSelEnd = startdate.daysTo(end); |
302 | if ( mSelEnd > NUMDAYS-1 ) | 302 | if ( mSelEnd > NUMDAYS-1 ) |
303 | mSelEnd = NUMDAYS-1; | 303 | mSelEnd = NUMDAYS-1; |
304 | if ( mSelEnd < 0 || mSelStart > NUMDAYS-1 ) { | 304 | if ( mSelEnd < 0 || mSelStart > NUMDAYS-1 ) { |
305 | clearSelection(); | 305 | clearSelection(); |
306 | if ( noSel ) | 306 | if ( noSel ) |
307 | return false; | 307 | return false; |
308 | } | 308 | } |
309 | 309 | ||
310 | return true; | 310 | return true; |
311 | } | 311 | } |
312 | void KODayMatrix::clearSelection() | 312 | void KODayMatrix::clearSelection() |
313 | { | 313 | { |
314 | mSelEnd = mSelStart = NOSELECTION; | 314 | mSelEnd = mSelStart = NOSELECTION; |
315 | } | 315 | } |
316 | 316 | ||
317 | 317 | ||
318 | void KODayMatrix::recalculateToday() | 318 | void KODayMatrix::recalculateToday() |
319 | { | 319 | { |
320 | today = -1; | 320 | today = -1; |
321 | for (int i=0; i<NUMDAYS; i++) { | 321 | for (int i=0; i<NUMDAYS; i++) { |
322 | //events[i] = 0; | 322 | //events[i] = 0; |
323 | days[i] = startdate.addDays(i); | 323 | days[i] = startdate.addDays(i); |
324 | daylbls[i] = QString::number( KOGlobals::self()->calendarSystem()->day( days[i] )); | 324 | daylbls[i] = QString::number( KOGlobals::self()->calendarSystem()->day( days[i] )); |
325 | 325 | ||
326 | // if today is in the currently displayed month, hilight today | 326 | // if today is in the currently displayed month, hilight today |
327 | if (days[i].year() == QDate::currentDate().year() && | 327 | if (days[i].year() == QDate::currentDate().year() && |
328 | days[i].month() == QDate::currentDate().month() && | 328 | days[i].month() == QDate::currentDate().month() && |
329 | days[i].day() == QDate::currentDate().day()) { | 329 | days[i].day() == QDate::currentDate().day()) { |
330 | today = i; | 330 | today = i; |
331 | } | 331 | } |
332 | } | 332 | } |
333 | // qDebug(QString("Today is visible at %1.").arg(today)); | 333 | // qDebug(QString("Today is visible at %1.").arg(today)); |
334 | } | 334 | } |
335 | 335 | ||
336 | void KODayMatrix::updateView() | 336 | void KODayMatrix::updateView() |
337 | { | 337 | { |
338 | updateView(startdate); | 338 | updateView(startdate); |
339 | } | 339 | } |
340 | void KODayMatrix::repaintViewTimed() | 340 | void KODayMatrix::repaintViewTimed() |
341 | { | 341 | { |
342 | mRedrawNeeded = true; | 342 | mRedrawNeeded = true; |
343 | bDays.fill( false); | 343 | // bDays.fill( false); |
344 | pDays.fill( false); | 344 | //pDays.fill( false); |
345 | hDays.fill( false); | 345 | //hDays.fill( false); |
346 | eDays.fill( false); | 346 | //eDays.fill( false); |
347 | mRepaintTimer->stop(); | 347 | mRepaintTimer->stop(); |
348 | int startDay = days[0].dayOfWeek(); // 1...7 7 = sunday | 348 | int startDay = days[0].dayOfWeek(); // 1...7 7 = sunday |
349 | int i; | 349 | int i; |
350 | for(i = 0; i < NUMDAYS; i++) { | 350 | for(i = 0; i < NUMDAYS; i++) { |
351 | if ( ( (i+startDay) % 7 == 0 ) ) { | 351 | if ( ( (i+startDay) % 7 == 0 ) ) { |
352 | pDays.setBit(i); | 352 | pDays.setBit(i); |
353 | } | 353 | } |
354 | } | 354 | } |
355 | repaint(false); | 355 | repaint(false); |
356 | } | 356 | } |
357 | void KODayMatrix::computeEvent(Event *event, int i ) | 357 | void KODayMatrix::computeEvent(Event *event, int i ) |
358 | { | 358 | { |
359 | QString holiStr = mHolidays[i]; | 359 | QString holiStr = mHolidays[i]; |
360 | if ( event->isHoliday()) { | 360 | if ( event->isHoliday()) { |
361 | pDays.setBit(i); | 361 | pDays.setBit(i); |
362 | hDays.setBit(i); | 362 | hDays.setBit(i); |
363 | if ( !holiStr.isEmpty() ) | 363 | if ( !holiStr.isEmpty() ) |
364 | holiStr += "\n"; | 364 | holiStr += "\n"; |
365 | holiStr += event->summary(); | 365 | holiStr += event->summary(); |
366 | if ( !event->location().isEmpty() ) | 366 | if ( !event->location().isEmpty() ) |
367 | holiStr += " (" + event->location() + ")"; | 367 | holiStr += " (" + event->location() + ")"; |
368 | mHolidays[i] =holiStr ; | 368 | mHolidays[i] =holiStr ; |
369 | } | 369 | } |
370 | if ( event->isBirthday()) { | 370 | if ( event->isBirthday()) { |
371 | pDays.setBit(i); | 371 | pDays.setBit(i); |
372 | if ( !holiStr.isEmpty() ) | 372 | if ( !holiStr.isEmpty() ) |
373 | holiStr += "\n"; | 373 | holiStr += "\n"; |
374 | holiStr += i18n("Birthday") + ": "+event->summary(); | 374 | holiStr += i18n("Birthday") + ": "+event->summary(); |
375 | if ( !event->location().isEmpty() ) | 375 | if ( !event->location().isEmpty() ) |
376 | holiStr += " (" + event->location() + ")"; | 376 | holiStr += " (" + event->location() + ")"; |
377 | bDays.setBit(i); | 377 | bDays.setBit(i); |
378 | mHolidays[i] =holiStr ; | 378 | mHolidays[i] =holiStr ; |
379 | } | 379 | } |
380 | eDays.setBit(i); | 380 | eDays.setBit(i); |
381 | } | 381 | } |
382 | void KODayMatrix::updateViewTimed() | 382 | void KODayMatrix::updateViewTimed() |
383 | { | 383 | { |
384 | mUpdateTimer->stop(); | 384 | mUpdateTimer->stop(); |
385 | if ( !mCalendar ) { | 385 | if ( !mCalendar ) { |
386 | qDebug("NOT CAL "); | 386 | qDebug("NOT CAL "); |
387 | return; | 387 | return; |
388 | } | 388 | } |
389 | #if 1 | 389 | #if 1 |
390 | 390 | ||
391 | int i; | 391 | int i; |
392 | int timeSpan = NUMDAYS-1; | 392 | int timeSpan = NUMDAYS-1; |
393 | QPtrList<Event> events = mCalendar->events(); | 393 | QPtrList<Event> events = mCalendar->events(); |
394 | Event *event; | 394 | Event *event; |
395 | QDateTime dt; | 395 | QDateTime dt; |
396 | bool ok; | 396 | bool ok; |
397 | bDays.fill( false); | 397 | bDays.fill( false); |
398 | pDays.fill( false); | 398 | pDays.fill( false); |
399 | hDays.fill( false); | 399 | hDays.fill( false); |
400 | eDays.fill( false); | 400 | eDays.fill( false); |
401 | mHolidays.clear(); | 401 | mHolidays.clear(); |
402 | QDate mStartDate = days[0]; | 402 | QDate mStartDate = days[0]; |
403 | QDate endDate = mStartDate.addDays( timeSpan ); | 403 | QDate endDate = mStartDate.addDays( timeSpan ); |
404 | for( event = events.first(); event; event = events.next() ) { // for event | 404 | for( event = events.first(); event; event = events.next() ) { // for event |
405 | ushort recurType = event->recurrence()->doesRecur(); | 405 | ushort recurType = event->recurrence()->doesRecur(); |
406 | if ((recurType == Recurrence::rDaily && !KOPrefs::instance()->mDailyRecur) || | 406 | if ((recurType == Recurrence::rDaily && !KOPrefs::instance()->mDailyRecur) || |
407 | (recurType == Recurrence::rWeekly && !KOPrefs::instance()->mWeeklyRecur)) { | 407 | (recurType == Recurrence::rWeekly && !KOPrefs::instance()->mWeeklyRecur)) { |
408 | continue; | 408 | continue; |
409 | } | 409 | } |
410 | if ( event->doesRecur() ) { | 410 | if ( event->doesRecur() ) { |
411 | bool last; | 411 | bool last; |
412 | QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last ); | 412 | QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last ); |
413 | QDateTime incidenceEnd; | 413 | QDateTime incidenceEnd; |
414 | int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() ); | 414 | int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() ); |
415 | bool invalid = false; | 415 | bool invalid = false; |
416 | while( true ) { | 416 | while( true ) { |
417 | if ( incidenceStart.isValid() ) { | 417 | if ( incidenceStart.isValid() ) { |
418 | incidenceEnd = incidenceStart.addDays( eventlen ); | 418 | incidenceEnd = incidenceStart.addDays( eventlen ); |
419 | int st = incidenceStart.date().daysTo( endDate ); | 419 | int st = incidenceStart.date().daysTo( endDate ); |
420 | if ( st >= 0 ) { // start before timeend | 420 | if ( st >= 0 ) { // start before timeend |
421 | int end = mStartDate.daysTo( incidenceEnd.date() ); | 421 | int end = mStartDate.daysTo( incidenceEnd.date() ); |
422 | if ( end >= 0 ) { // end after timestart --- got one! | 422 | if ( end >= 0 ) { // end after timestart --- got one! |
423 | //normalize | 423 | //normalize |
424 | st = timeSpan - st; | 424 | st = timeSpan - st; |
425 | if ( st < 0 ) st = 0; | 425 | if ( st < 0 ) st = 0; |
426 | if ( end > timeSpan ) end = timeSpan; | 426 | if ( end > timeSpan ) end = timeSpan; |
427 | int iii; | 427 | int iii; |
428 | //qDebug("found %s %d %d ",event->summary().latin1(), st, end ); | 428 | //qDebug("found %s %d %d ",event->summary().latin1(), st, end ); |
429 | for ( iii = st;iii<= end;++iii) { | 429 | for ( iii = st;iii<= end;++iii) { |
430 | computeEvent( event, iii ); | 430 | computeEvent( event, iii ); |
431 | } | 431 | } |
432 | } | 432 | } |
433 | } | 433 | } |
434 | } else { | 434 | } else { |
435 | if ( invalid ) | 435 | if ( invalid ) |
436 | break; | 436 | break; |
437 | invalid = true; | 437 | invalid = true; |
438 | //qDebug("invalid %s", event->summary().latin1()); | 438 | //qDebug("invalid %s", event->summary().latin1()); |
439 | incidenceStart = QDateTime( mStartDate ).addSecs( -2 );; | 439 | incidenceStart = QDateTime( mStartDate ).addSecs( -2 );; |
440 | } | 440 | } |
441 | if ( last ) | 441 | if ( last ) |
442 | break; | 442 | break; |
diff --git a/korganizer/koeventviewerdialog.cpp b/korganizer/koeventviewerdialog.cpp index 35d084d..1dce841 100644 --- a/korganizer/koeventviewerdialog.cpp +++ b/korganizer/koeventviewerdialog.cpp | |||
@@ -1,308 +1,314 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <klocale.h> | 20 | #include <klocale.h> |
21 | 21 | ||
22 | #include <libkcal/event.h> | 22 | #include <libkcal/event.h> |
23 | #include <qtimer.h> | 23 | #include <qtimer.h> |
24 | #include <qpushbutton.h> | 24 | #include <qpushbutton.h> |
25 | 25 | ||
26 | #include "koeventviewer.h" | 26 | #include "koeventviewer.h" |
27 | #include <kmessagebox.h> | 27 | #include <kmessagebox.h> |
28 | #include "koprefs.h" | 28 | #include "koprefs.h" |
29 | #include <libkcal/todo.h> | 29 | #include <libkcal/todo.h> |
30 | #include "qapp.h" | 30 | #include "qapp.h" |
31 | 31 | ||
32 | #include "koeventviewerdialog.h" | 32 | #include "koeventviewerdialog.h" |
33 | extern int globalFlagBlockAgenda; | 33 | extern int globalFlagBlockAgenda; |
34 | 34 | ||
35 | KOEventViewerDialog::KOEventViewerDialog(QWidget *parent,const char *name) | 35 | KOEventViewerDialog::KOEventViewerDialog(QWidget *parent,const char *name) |
36 | : KDialogBase(parent,name, | 36 | : KDialogBase(parent,name, |
37 | #ifndef DESKTOP_VERSION | 37 | #ifndef DESKTOP_VERSION |
38 | true , | 38 | true , |
39 | #else | 39 | #else |
40 | false, | 40 | false, |
41 | #endif | 41 | #endif |
42 | i18n("Event Viewer"),Ok|User1|Close,Close, false, i18n("Agenda")) | 42 | i18n("Event Viewer"),Ok|User1|Close,Close, false, i18n("Agenda")) |
43 | { | 43 | { |
44 | sendSignalViewerClosed = true; | 44 | sendSignalViewerClosed = true; |
45 | mEventViewer = new KOEventViewer(this); | 45 | mEventViewer = new KOEventViewer(this); |
46 | mEventViewer->setFont( KOPrefs::instance()->mEventViewFont ); | 46 | mEventViewer->setFont( KOPrefs::instance()->mEventViewFont ); |
47 | setMainWidget(mEventViewer); | 47 | setMainWidget(mEventViewer); |
48 | setButtonText(Ok, i18n("Edit") ); | 48 | setButtonText(Ok, i18n("Edit") ); |
49 | 49 | ||
50 | QObject::connect(findButton( Ok ),SIGNAL(clicked()), | 50 | QObject::connect(findButton( Ok ),SIGNAL(clicked()), |
51 | SLOT(editIncidence())); | 51 | SLOT(editIncidence())); |
52 | QObject::connect(this,SIGNAL(user1Clicked()), | 52 | QObject::connect(this,SIGNAL(user1Clicked()), |
53 | SLOT(showIncidence())); | 53 | SLOT(showIncidence())); |
54 | mIncidence = 0; | 54 | mIncidence = 0; |
55 | // TODO: Set a sensible size (based on the content?). | 55 | // TODO: Set a sensible size (based on the content?). |
56 | //showMaximized(); | 56 | //showMaximized(); |
57 | //qDebug("++++++++++++KOEventViewerDialog() "); | 57 | //qDebug("++++++++++++KOEventViewerDialog() "); |
58 | // if ( KOPrefs::instance()->mCompactDialogs ) { | 58 | // if ( KOPrefs::instance()->mCompactDialogs ) { |
59 | // setFixedSize( 240,284 ); | 59 | // setFixedSize( 240,284 ); |
60 | // move( 0, 15 ); | 60 | // move( 0, 15 ); |
61 | // } else { | 61 | // } else { |
62 | // setMinimumSize(300,200); | 62 | // setMinimumSize(300,200); |
63 | // resize(320,300); | 63 | // resize(320,300); |
64 | // } | 64 | // } |
65 | mSyncMode = false; | 65 | mSyncMode = false; |
66 | mSyncResult = 0; | 66 | mSyncResult = 0; |
67 | 67 | ||
68 | } | 68 | } |
69 | 69 | ||
70 | KOEventViewerDialog::~KOEventViewerDialog() | 70 | KOEventViewerDialog::~KOEventViewerDialog() |
71 | { | 71 | { |
72 | //qDebug("-------~KOEventViewerDialog() "); | 72 | //qDebug("-------~KOEventViewerDialog() "); |
73 | } | 73 | } |
74 | void KOEventViewerDialog::showMe() | 74 | void KOEventViewerDialog::showMe() |
75 | { | 75 | { |
76 | 76 | ||
77 | #ifdef DESKTOP_VERSION | 77 | #ifdef DESKTOP_VERSION |
78 | int x,y,w,h; | 78 | int x,y,w,h; |
79 | x = geometry().x(); | 79 | x = geometry().x(); |
80 | y = geometry().y(); | 80 | y = geometry().y(); |
81 | w = width(); | 81 | w = width(); |
82 | h = height(); | 82 | h = height(); |
83 | show(); | 83 | show(); |
84 | setGeometry(x,y,w,h); | 84 | setGeometry(x,y,w,h); |
85 | raise(); | ||
85 | #else | 86 | #else |
86 | showMaximized(); | 87 | showMaximized(); |
87 | #endif | 88 | #endif |
88 | raise(); | 89 | QTimer::singleShot( 1, this, SLOT ( setMyFocus() ) ); |
89 | setActiveWindow(); | ||
90 | mEventViewer->setFocus(); | ||
91 | //raise(); | ||
92 | 90 | ||
93 | } | 91 | } |
92 | void KOEventViewerDialog::setMyFocus() | ||
93 | { | ||
94 | |||
95 | setActiveWindow(); | ||
96 | mEventViewer->setFocus(); | ||
97 | |||
98 | } | ||
94 | void KOEventViewerDialog::print() | 99 | void KOEventViewerDialog::print() |
95 | { | 100 | { |
96 | mEventViewer->printMe(); | 101 | mEventViewer->printMe(); |
97 | 102 | ||
98 | } | 103 | } |
99 | void KOEventViewerDialog::setSyncMode( bool b ) | 104 | void KOEventViewerDialog::setSyncMode( bool b ) |
100 | { | 105 | { |
101 | mSyncMode = b; | 106 | mSyncMode = b; |
102 | //qDebug("KOEventViewerDialog::setSyncMode %d ",mSyncMode ); | 107 | //qDebug("KOEventViewerDialog::setSyncMode %d ",mSyncMode ); |
103 | if ( mSyncMode ) { | 108 | if ( mSyncMode ) { |
104 | findButton( Close )->setText( i18n("Cancel Sync")); | 109 | findButton( Close )->setText( i18n("Cancel Sync")); |
105 | findButton( Ok )->setText( i18n("Remote")); | 110 | findButton( Ok )->setText( i18n("Remote")); |
106 | findButton( User1 )->setText( i18n("Local")); | 111 | findButton( User1 )->setText( i18n("Local")); |
107 | } else { | 112 | } else { |
108 | findButton( Close )->setText( i18n("Close")); | 113 | findButton( Close )->setText( i18n("Close")); |
109 | findButton( Ok )->setText( i18n("Edit")); | 114 | findButton( Ok )->setText( i18n("Edit")); |
110 | findButton( User1 )->setText( i18n("Agenda")); | 115 | findButton( User1 )->setText( i18n("Agenda")); |
111 | } | 116 | } |
112 | mEventViewer->setSyncMode( b ); | 117 | mEventViewer->setSyncMode( b ); |
113 | } | 118 | } |
114 | void KOEventViewerDialog::setColorMode( int m ) | 119 | void KOEventViewerDialog::setColorMode( int m ) |
115 | { | 120 | { |
116 | mEventViewer->setColorMode( m ); | 121 | mEventViewer->setColorMode( m ); |
117 | } | 122 | } |
118 | int KOEventViewerDialog::executeS( bool local ) | 123 | int KOEventViewerDialog::executeS( bool local ) |
119 | { | 124 | { |
120 | mSyncResult = 3; | 125 | mSyncResult = 3; |
121 | if ( local ) | 126 | if ( local ) |
122 | findButton( User1 )->setFocus(); | 127 | findButton( User1 )->setFocus(); |
123 | else | 128 | else |
124 | findButton( Ok )->setFocus(); | 129 | findButton( Ok )->setFocus(); |
125 | exec(); | 130 | exec(); |
126 | return mSyncResult; | 131 | return mSyncResult; |
127 | } | 132 | } |
128 | 133 | ||
129 | void KOEventViewerDialog::updateConfig() | 134 | void KOEventViewerDialog::updateConfig() |
130 | { | 135 | { |
131 | mEventViewer->setFont( KOPrefs::instance()->mEventViewFont ); | 136 | mEventViewer->setFont( KOPrefs::instance()->mEventViewFont ); |
132 | 137 | ||
133 | } | 138 | } |
134 | void KOEventViewerDialog::setEvent(Event *event) | 139 | void KOEventViewerDialog::setEvent(Event *event) |
135 | { | 140 | { |
136 | mEventViewer->setEvent(event); | 141 | mEventViewer->setEvent(event); |
137 | mIncidence = event; | 142 | mIncidence = event; |
138 | mEventViewer->setFocus(); | 143 | mEventViewer->setFocus(); |
139 | //findButton( Close )->setFocus(); | 144 | //findButton( Close )->setFocus(); |
140 | if ( !mSyncMode ) { | 145 | if ( !mSyncMode ) { |
141 | findButton( User1 )->setText( i18n("Agenda")); | 146 | findButton( User1 )->setText( i18n("Agenda")); |
142 | } | 147 | } |
143 | } | 148 | } |
144 | void KOEventViewerDialog::setIncidence(Incidence *in ) | 149 | void KOEventViewerDialog::setIncidence(Incidence *in ) |
145 | { | 150 | { |
146 | if ( in->type() == "Event" ) | 151 | if ( in->type() == "Event" ) |
147 | setEvent( (Event*) in ); | 152 | setEvent( (Event*) in ); |
148 | else if ( in->type() =="Todo" ) | 153 | else if ( in->type() =="Todo" ) |
149 | setTodo( (Todo*) in ); | 154 | setTodo( (Todo*) in ); |
150 | else if ( in->type() =="Journal" ) | 155 | else if ( in->type() =="Journal" ) |
151 | setJournal( (Journal*) in ); | 156 | setJournal( (Journal*) in ); |
152 | } | 157 | } |
153 | void KOEventViewerDialog::addIncidence(Incidence *in) | 158 | void KOEventViewerDialog::addIncidence(Incidence *in) |
154 | { | 159 | { |
155 | if ( in->type() == "Event" ) | 160 | if ( in->type() == "Event" ) |
156 | addEvent( (Event*) in ); | 161 | addEvent( (Event*) in ); |
157 | else if ( in->type() =="Todo" ) | 162 | else if ( in->type() =="Todo" ) |
158 | mEventViewer->setTodo( (Todo*) in, false ); | 163 | mEventViewer->setTodo( (Todo*) in, false ); |
159 | else if ( in->type() =="Journal" ) | 164 | else if ( in->type() =="Journal" ) |
160 | mEventViewer->setJournal( (Journal*) in, false ); | 165 | mEventViewer->setJournal( (Journal*) in, false ); |
161 | if ( mSyncMode ) { | 166 | if ( mSyncMode ) { |
162 | findButton( User1 )->setFocus(); | 167 | findButton( User1 )->setFocus(); |
163 | setCaption(i18n("Conflict! Please choose entry")); | 168 | setCaption(i18n("Conflict! Please choose entry")); |
164 | } | 169 | } |
165 | } | 170 | } |
166 | 171 | ||
167 | void KOEventViewerDialog::addEvent(Event *event) | 172 | void KOEventViewerDialog::addEvent(Event *event) |
168 | { | 173 | { |
169 | mEventViewer->addEvent(event); | 174 | mEventViewer->addEvent(event); |
170 | mIncidence = event; | 175 | mIncidence = event; |
171 | mEventViewer->setFocus(); | 176 | mEventViewer->setFocus(); |
172 | //findButton( Close )->setFocus(); | 177 | //findButton( Close )->setFocus(); |
173 | if ( !mSyncMode ) { | 178 | if ( !mSyncMode ) { |
174 | findButton( User1 )->setText( i18n("Agenda")); | 179 | findButton( User1 )->setText( i18n("Agenda")); |
175 | } | 180 | } |
176 | } | 181 | } |
177 | 182 | ||
178 | void KOEventViewerDialog::setTodo(Todo *event) | 183 | void KOEventViewerDialog::setTodo(Todo *event) |
179 | { | 184 | { |
180 | mEventViewer->setTodo(event); | 185 | mEventViewer->setTodo(event); |
181 | mIncidence = (Incidence*)event; | 186 | mIncidence = (Incidence*)event; |
182 | mEventViewer->setFocus(); | 187 | mEventViewer->setFocus(); |
183 | //findButton( Close )->setFocus(); | 188 | //findButton( Close )->setFocus(); |
184 | if ( !mSyncMode ) { | 189 | if ( !mSyncMode ) { |
185 | findButton( User1 )->setText( i18n("Set complete")); | 190 | findButton( User1 )->setText( i18n("Set complete")); |
186 | } | 191 | } |
187 | } | 192 | } |
188 | void KOEventViewerDialog::setJournal(Journal *j) | 193 | void KOEventViewerDialog::setJournal(Journal *j) |
189 | { | 194 | { |
190 | mEventViewer->setJournal(j); | 195 | mEventViewer->setJournal(j); |
191 | mIncidence = (Incidence*)j; | 196 | mIncidence = (Incidence*)j; |
192 | mEventViewer->setFocus(); | 197 | mEventViewer->setFocus(); |
193 | //findButton( Close )->setFocus(); | 198 | //findButton( Close )->setFocus(); |
194 | if ( !mSyncMode ) { | 199 | if ( !mSyncMode ) { |
195 | findButton( User1 )->setText( i18n("Agenda")); | 200 | findButton( User1 )->setText( i18n("Agenda")); |
196 | } | 201 | } |
197 | } | 202 | } |
198 | 203 | ||
199 | void KOEventViewerDialog::addText(QString text) | 204 | void KOEventViewerDialog::addText(QString text) |
200 | { | 205 | { |
201 | mEventViewer->addText(text); | 206 | mEventViewer->addText(text); |
202 | mEventViewer->setFocus(); | 207 | mEventViewer->setFocus(); |
203 | //findButton( Close )->setFocus(); | 208 | //findButton( Close )->setFocus(); |
204 | } | 209 | } |
205 | void KOEventViewerDialog::editIncidence() | 210 | void KOEventViewerDialog::editIncidence() |
206 | { | 211 | { |
207 | sendSignalViewerClosed = false; | 212 | sendSignalViewerClosed = false; |
208 | if ( mSyncMode ) { | 213 | if ( mSyncMode ) { |
209 | mSyncResult = 2; | 214 | mSyncResult = 2; |
210 | accept(); | 215 | accept(); |
211 | return; | 216 | return; |
212 | } | 217 | } |
213 | if ( mIncidence ){ | 218 | if ( mIncidence ){ |
214 | #ifndef DESKTOP_VERSION | 219 | #ifndef DESKTOP_VERSION |
215 | hide(); | 220 | //hide(); |
221 | close(); | ||
216 | #endif | 222 | #endif |
217 | emit editIncidence( mIncidence ); | 223 | emit editIncidence( mIncidence ); |
218 | } | 224 | } |
219 | } | 225 | } |
220 | void KOEventViewerDialog::showIncidence() | 226 | void KOEventViewerDialog::showIncidence() |
221 | { | 227 | { |
222 | sendSignalViewerClosed = false; | 228 | sendSignalViewerClosed = false; |
223 | if ( mSyncMode ) { | 229 | if ( mSyncMode ) { |
224 | mSyncResult = 1; | 230 | mSyncResult = 1; |
225 | accept(); | 231 | accept(); |
226 | return; | 232 | return; |
227 | } | 233 | } |
228 | 234 | ||
229 | if ( mIncidence ){ | 235 | if ( mIncidence ){ |
230 | #ifndef DESKTOP_VERSION | 236 | #ifndef DESKTOP_VERSION |
231 | hide(); | 237 | hide(); |
232 | #endif | 238 | #endif |
233 | QDate date; | 239 | QDate date; |
234 | if ( mIncidence->type() == "Todo" ) { | 240 | if ( mIncidence->type() == "Todo" ) { |
235 | /* | 241 | /* |
236 | if ( ((Todo*)mIncidence)->hasDueDate() ) | 242 | if ( ((Todo*)mIncidence)->hasDueDate() ) |
237 | date = ((Todo*)mIncidence)->dtDue().date(); | 243 | date = ((Todo*)mIncidence)->dtDue().date(); |
238 | else { | 244 | else { |
239 | globalFlagBlockAgenda = 2; | 245 | globalFlagBlockAgenda = 2; |
240 | emit showAgendaView( false ); | 246 | emit showAgendaView( false ); |
241 | return; | 247 | return; |
242 | } | 248 | } |
243 | */ | 249 | */ |
244 | ((Todo*)mIncidence)->setCompleted( true ); | 250 | ((Todo*)mIncidence)->setCompleted( true ); |
245 | ((Todo*)mIncidence)->setCompleted(QDateTime::currentDateTime() ); | 251 | ((Todo*)mIncidence)->setCompleted(QDateTime::currentDateTime() ); |
246 | hide(); | 252 | hide(); |
247 | emit todoCompleted(((Todo*)mIncidence)); | 253 | emit todoCompleted(((Todo*)mIncidence)); |
248 | return; | 254 | return; |
249 | 255 | ||
250 | } else | 256 | } else |
251 | date = mIncidence->dtStart().date(); | 257 | date = mIncidence->dtStart().date(); |
252 | globalFlagBlockAgenda = 1; | 258 | globalFlagBlockAgenda = 1; |
253 | emit showAgendaView( false ); | 259 | emit showAgendaView( false ); |
254 | globalFlagBlockAgenda = 2; | 260 | globalFlagBlockAgenda = 2; |
255 | emit jumpToTime( date ); | 261 | emit jumpToTime( date ); |
256 | } | 262 | } |
257 | } | 263 | } |
258 | void KOEventViewerDialog::keyPressEvent ( QKeyEvent * e ) | 264 | void KOEventViewerDialog::keyPressEvent ( QKeyEvent * e ) |
259 | { | 265 | { |
260 | switch ( e->key() ) { | 266 | switch ( e->key() ) { |
261 | 267 | ||
262 | case Qt::Key_A : | 268 | case Qt::Key_A : |
263 | case Qt::Key_L : | 269 | case Qt::Key_L : |
264 | showIncidence(); | 270 | showIncidence(); |
265 | break; | 271 | break; |
266 | case Qt::Key_E : | 272 | case Qt::Key_E : |
267 | case Qt::Key_R : | 273 | case Qt::Key_R : |
268 | editIncidence(); | 274 | editIncidence(); |
269 | break; | 275 | break; |
270 | case Qt::Key_C: | 276 | case Qt::Key_C: |
271 | case Qt::Key_Escape: | 277 | case Qt::Key_Escape: |
272 | sendSignalViewerClosed = true; | 278 | sendSignalViewerClosed = true; |
273 | close(); | 279 | close(); |
274 | break; | 280 | break; |
275 | case Qt::Key_I: | 281 | case Qt::Key_I: |
276 | #ifndef DESKTOP_VERSION | 282 | #ifndef DESKTOP_VERSION |
277 | sendSignalViewerClosed = true; | 283 | sendSignalViewerClosed = true; |
278 | close(); | 284 | close(); |
279 | #else | 285 | #else |
280 | sendSignalViewerClosed = true; | 286 | sendSignalViewerClosed = true; |
281 | slotViewerClosed(); | 287 | slotViewerClosed(); |
282 | //accept(); | 288 | //accept(); |
283 | #endif | 289 | #endif |
284 | break; | 290 | break; |
285 | default: | 291 | default: |
286 | KDialogBase::keyPressEvent ( e ); | 292 | KDialogBase::keyPressEvent ( e ); |
287 | break; | 293 | break; |
288 | } | 294 | } |
289 | 295 | ||
290 | } | 296 | } |
291 | void KOEventViewerDialog::hideEvent ( QHideEvent * e ) | 297 | void KOEventViewerDialog::hideEvent ( QHideEvent * e ) |
292 | { | 298 | { |
293 | KDialogBase::hideEvent ( e ); | 299 | KDialogBase::hideEvent ( e ); |
294 | QTimer::singleShot( 1, this, SLOT (slotViewerClosed() ) ); | 300 | QTimer::singleShot( 1, this, SLOT (slotViewerClosed() ) ); |
295 | } | 301 | } |
296 | 302 | ||
297 | void KOEventViewerDialog::slotViewerClosed() | 303 | void KOEventViewerDialog::slotViewerClosed() |
298 | { | 304 | { |
299 | if ( mSyncMode ) | 305 | if ( mSyncMode ) |
300 | return; | 306 | return; |
301 | 307 | ||
302 | if ( sendSignalViewerClosed ) { | 308 | if ( sendSignalViewerClosed ) { |
303 | //qDebug("KOEventViewerDialog::hideEvent "); | 309 | //qDebug("KOEventViewerDialog::hideEvent "); |
304 | emit signalViewerClosed(); | 310 | emit signalViewerClosed(); |
305 | } | 311 | } |
306 | sendSignalViewerClosed = true; | 312 | sendSignalViewerClosed = true; |
307 | } | 313 | } |
308 | 314 | ||
diff --git a/korganizer/koeventviewerdialog.h b/korganizer/koeventviewerdialog.h index 8e1cd44..29fee49 100644 --- a/korganizer/koeventviewerdialog.h +++ b/korganizer/koeventviewerdialog.h | |||
@@ -1,76 +1,77 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000, 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000, 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | */ | 18 | */ |
19 | #ifndef KOEVENTVIEWERDIALOG_H | 19 | #ifndef KOEVENTVIEWERDIALOG_H |
20 | #define KOEVENTVIEWERDIALOG_H | 20 | #define KOEVENTVIEWERDIALOG_H |
21 | // | 21 | // |
22 | // Viewer dialog for events. | 22 | // Viewer dialog for events. |
23 | // | 23 | // |
24 | 24 | ||
25 | #include <qtextview.h> | 25 | #include <qtextview.h> |
26 | 26 | ||
27 | #include <kdialogbase.h> | 27 | #include <kdialogbase.h> |
28 | 28 | ||
29 | #include <libkcal/event.h> | 29 | #include <libkcal/event.h> |
30 | 30 | ||
31 | using namespace KCal; | 31 | using namespace KCal; |
32 | 32 | ||
33 | class KOEventViewer; | 33 | class KOEventViewer; |
34 | 34 | ||
35 | class KOEventViewerDialog : public KDialogBase { | 35 | class KOEventViewerDialog : public KDialogBase { |
36 | Q_OBJECT | 36 | Q_OBJECT |
37 | public: | 37 | public: |
38 | KOEventViewerDialog(QWidget *parent=0,const char *name=0); | 38 | KOEventViewerDialog(QWidget *parent=0,const char *name=0); |
39 | virtual ~KOEventViewerDialog(); | 39 | virtual ~KOEventViewerDialog(); |
40 | 40 | ||
41 | void setEvent(Event *event); | 41 | void setEvent(Event *event); |
42 | void addEvent(Event *event); | 42 | void addEvent(Event *event); |
43 | void setTodo(Todo *event); | 43 | void setTodo(Todo *event); |
44 | void setJournal(Journal *journal); | 44 | void setJournal(Journal *journal); |
45 | void setIncidence(Incidence *inc); | 45 | void setIncidence(Incidence *inc); |
46 | void addIncidence(Incidence *inc); | 46 | void addIncidence(Incidence *inc); |
47 | void addText(QString text); | 47 | void addText(QString text); |
48 | void showMe(); | 48 | void showMe(); |
49 | void setSyncMode( bool ); | 49 | void setSyncMode( bool ); |
50 | void setColorMode( int m ); | 50 | void setColorMode( int m ); |
51 | int executeS( bool ); | 51 | int executeS( bool ); |
52 | public slots: | 52 | public slots: |
53 | void updateConfig(); | 53 | void updateConfig(); |
54 | void print(); | 54 | void print(); |
55 | void setMyFocus(); | ||
55 | signals: | 56 | signals: |
56 | void editIncidence( Incidence* ); | 57 | void editIncidence( Incidence* ); |
57 | void jumpToTime( const QDate &); | 58 | void jumpToTime( const QDate &); |
58 | void showAgendaView( bool ); | 59 | void showAgendaView( bool ); |
59 | void todoCompleted(Todo*); | 60 | void todoCompleted(Todo*); |
60 | void signalViewerClosed(); | 61 | void signalViewerClosed(); |
61 | private slots: | 62 | private slots: |
62 | void slotViewerClosed(); | 63 | void slotViewerClosed(); |
63 | void editIncidence(); | 64 | void editIncidence(); |
64 | void showIncidence(); | 65 | void showIncidence(); |
65 | protected: | 66 | protected: |
66 | void hideEvent ( QHideEvent * e ); | 67 | void hideEvent ( QHideEvent * e ); |
67 | private: | 68 | private: |
68 | bool sendSignalViewerClosed; | 69 | bool sendSignalViewerClosed; |
69 | bool mSyncMode; | 70 | bool mSyncMode; |
70 | int mSyncResult; | 71 | int mSyncResult; |
71 | KOEventViewer *mEventViewer; | 72 | KOEventViewer *mEventViewer; |
72 | Incidence* mIncidence; | 73 | Incidence* mIncidence; |
73 | void keyPressEvent ( QKeyEvent * e ); | 74 | void keyPressEvent ( QKeyEvent * e ); |
74 | }; | 75 | }; |
75 | 76 | ||
76 | #endif | 77 | #endif |
diff --git a/korganizer/koprefsdialog.cpp b/korganizer/koprefsdialog.cpp index e72f94b..0bbb3bf 100644 --- a/korganizer/koprefsdialog.cpp +++ b/korganizer/koprefsdialog.cpp | |||
@@ -1,174 +1,174 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qlayout.h> | 24 | #include <qlayout.h> |
25 | #include <qlabel.h> | 25 | #include <qlabel.h> |
26 | #include <qgroupbox.h> | 26 | #include <qgroupbox.h> |
27 | #include <qbuttongroup.h> | 27 | #include <qbuttongroup.h> |
28 | #include <qlineedit.h> | 28 | #include <qlineedit.h> |
29 | #include <qfont.h> | 29 | #include <qfont.h> |
30 | #include <qslider.h> | 30 | #include <qslider.h> |
31 | #include <qfile.h> | 31 | #include <qfile.h> |
32 | #include <qtextstream.h> | 32 | #include <qtextstream.h> |
33 | #include <qcombobox.h> | 33 | #include <qcombobox.h> |
34 | #include <qvbox.h> | 34 | #include <qvbox.h> |
35 | #include <qhbox.h> | 35 | #include <qhbox.h> |
36 | #include <qregexp.h> | 36 | #include <qregexp.h> |
37 | #include <qspinbox.h> | 37 | #include <qspinbox.h> |
38 | #include <qdatetime.h> | 38 | #include <qdatetime.h> |
39 | #include <qcheckbox.h> | 39 | #include <qcheckbox.h> |
40 | #include <qradiobutton.h> | 40 | #include <qradiobutton.h> |
41 | #include <qpushbutton.h> | 41 | #include <qpushbutton.h> |
42 | #include <qstrlist.h> | 42 | #include <qstrlist.h> |
43 | #include <qapplication.h> | 43 | #include <qapplication.h> |
44 | 44 | ||
45 | #include <kcolorbutton.h> | 45 | #include <kcolorbutton.h> |
46 | #include <kdebug.h> | 46 | #include <kdebug.h> |
47 | #include <klocale.h> | 47 | #include <klocale.h> |
48 | #include <kglobal.h> | 48 | #include <kglobal.h> |
49 | #include <kfontdialog.h> | 49 | #include <kfontdialog.h> |
50 | #include <kfiledialog.h> | 50 | #include <kfiledialog.h> |
51 | #include <kmessagebox.h> | 51 | #include <kmessagebox.h> |
52 | #include <kcolordialog.h> | 52 | #include <kcolordialog.h> |
53 | #include <kiconloader.h> | 53 | #include <kiconloader.h> |
54 | #include <kemailsettings.h> | 54 | #include <kemailsettings.h> |
55 | #include <kstandarddirs.h> | 55 | #include <kstandarddirs.h> |
56 | #include <kglobalsettings.h> | 56 | #include <kglobalsettings.h> |
57 | 57 | ||
58 | #include <kurlrequester.h> | 58 | #include <kurlrequester.h> |
59 | #include <klineedit.h> | 59 | #include <klineedit.h> |
60 | 60 | ||
61 | #if defined(USE_SOLARIS) | 61 | #if defined(USE_SOLARIS) |
62 | #include <sys/param.h> | 62 | #include <sys/param.h> |
63 | 63 | ||
64 | #define ZONEINFODIR "/usr/share/lib/zoneinfo" | 64 | #define ZONEINFODIR "/usr/share/lib/zoneinfo" |
65 | #define INITFILE "/etc/default/init" | 65 | #define INITFILE "/etc/default/init" |
66 | #endif | 66 | #endif |
67 | 67 | ||
68 | #include "koprefs.h" | 68 | #include "koprefs.h" |
69 | 69 | ||
70 | #include "koprefsdialog.h" | 70 | #include "koprefsdialog.h" |
71 | #include "kpimglobalprefs.h" | 71 | #include "kpimglobalprefs.h" |
72 | 72 | ||
73 | 73 | ||
74 | KOPrefsDialog::KOPrefsDialog(QWidget *parent, char *name, bool modal) : | 74 | KOPrefsDialog::KOPrefsDialog(QWidget *parent, char *name, bool modal) : |
75 | KPrefsDialog(KOPrefs::instance(),parent,name,true) | 75 | KPrefsDialog(KOPrefs::instance(),parent,name,true) |
76 | { | 76 | { |
77 | 77 | ||
78 | setFont( KGlobalSettings::generalFont() ); | 78 | setFont( KGlobalSettings::generalMaxFont() ); |
79 | setCaption( i18n("Preferences - some settings need a restart (nr)")); | 79 | setCaption( i18n("Preferences - some settings need a restart (nr)")); |
80 | mCategoryDict.setAutoDelete(true); | 80 | mCategoryDict.setAutoDelete(true); |
81 | 81 | ||
82 | KGlobal::locale()->insertCatalogue("timezones"); | 82 | KGlobal::locale()->insertCatalogue("timezones"); |
83 | mSpacingHint = spacingHintSmall(); | 83 | mSpacingHint = spacingHintSmall(); |
84 | mMarginHint = marginHintSmall(); | 84 | mMarginHint = marginHintSmall(); |
85 | #ifndef DESKTOP_VERSION | 85 | #ifndef DESKTOP_VERSION |
86 | if ( QApplication::desktop()->height() == 480 ) | 86 | if ( QApplication::desktop()->height() == 480 ) |
87 | hideButtons(); | 87 | hideButtons(); |
88 | #endif | 88 | #endif |
89 | 89 | ||
90 | setupGlobalTab(); | 90 | setupGlobalTab(); |
91 | setupMainTab(); | 91 | setupMainTab(); |
92 | // setupLocaleTab(); | 92 | // setupLocaleTab(); |
93 | //setupTimeZoneTab(); | 93 | //setupTimeZoneTab(); |
94 | setupTimeTab(); | 94 | setupTimeTab(); |
95 | //setupLocaleDateTab(); | 95 | //setupLocaleDateTab(); |
96 | setupFontsTab(); | 96 | setupFontsTab(); |
97 | setupColorsTab(); | 97 | setupColorsTab(); |
98 | setupViewsTab(); | 98 | setupViewsTab(); |
99 | //setupSyncTab(); | 99 | //setupSyncTab(); |
100 | //setupSyncAlgTab(); | 100 | //setupSyncAlgTab(); |
101 | //setupPrinterTab(); | 101 | //setupPrinterTab(); |
102 | //setupGroupSchedulingTab(); | 102 | //setupGroupSchedulingTab(); |
103 | //setupGroupAutomationTab(); | 103 | //setupGroupAutomationTab(); |
104 | 104 | ||
105 | 105 | ||
106 | } | 106 | } |
107 | 107 | ||
108 | 108 | ||
109 | KOPrefsDialog::~KOPrefsDialog() | 109 | KOPrefsDialog::~KOPrefsDialog() |
110 | { | 110 | { |
111 | } | 111 | } |
112 | void KOPrefsDialog::setupGlobalTab() | 112 | void KOPrefsDialog::setupGlobalTab() |
113 | { | 113 | { |
114 | QFrame *topFrame = addPage(i18n("Global"),0,0); | 114 | QFrame *topFrame = addPage(i18n("Global"),0,0); |
115 | kdelibcfg = new KDEPIMConfigWidget( KPimGlobalPrefs::instance(), topFrame, "KCMKdeLibConfig" ); | 115 | kdelibcfg = new KDEPIMConfigWidget( KPimGlobalPrefs::instance(), topFrame, "KCMKdeLibConfig" ); |
116 | QVBoxLayout *topLayout = new QVBoxLayout(topFrame); | 116 | QVBoxLayout *topLayout = new QVBoxLayout(topFrame); |
117 | topLayout->addWidget( kdelibcfg ); | 117 | topLayout->addWidget( kdelibcfg ); |
118 | 118 | ||
119 | 119 | ||
120 | } | 120 | } |
121 | void KOPrefsDialog::setupLocaleDateTab() | 121 | void KOPrefsDialog::setupLocaleDateTab() |
122 | { | 122 | { |
123 | #if 0 | 123 | #if 0 |
124 | QFrame *topFrame = addPage(i18n("Date Format"),0,0); | 124 | QFrame *topFrame = addPage(i18n("Date Format"),0,0); |
125 | QGridLayout *topLayout = new QGridLayout(topFrame,3,2); | 125 | QGridLayout *topLayout = new QGridLayout(topFrame,3,2); |
126 | topLayout->setSpacing(mSpacingHint); | 126 | topLayout->setSpacing(mSpacingHint); |
127 | topLayout->setMargin(mMarginHint); | 127 | topLayout->setMargin(mMarginHint); |
128 | int iii = 0; | 128 | int iii = 0; |
129 | 129 | ||
130 | 130 | ||
131 | KPrefsDialogWidRadios *syncPrefsGroup = | 131 | KPrefsDialogWidRadios *syncPrefsGroup = |
132 | addWidRadios(i18n("Date Format:"),&(KOPrefs::instance()->mPreferredDate),topFrame); | 132 | addWidRadios(i18n("Date Format:"),&(KOPrefs::instance()->mPreferredDate),topFrame); |
133 | QString format; | 133 | QString format; |
134 | if ( QApplication::desktop()->width() < 480 ) | 134 | if ( QApplication::desktop()->width() < 480 ) |
135 | format = "(%d.%m.%Y)"; | 135 | format = "(%d.%m.%Y)"; |
136 | else | 136 | else |
137 | format = "(%d.%m.%Y|%A %d %B %Y)"; | 137 | format = "(%d.%m.%Y|%A %d %B %Y)"; |
138 | syncPrefsGroup->addRadio(i18n("24.03.2004 "+format)); | 138 | syncPrefsGroup->addRadio(i18n("24.03.2004 "+format)); |
139 | if ( QApplication::desktop()->width() < 480 ) | 139 | if ( QApplication::desktop()->width() < 480 ) |
140 | format = "(%m.%d.%Y)"; | 140 | format = "(%m.%d.%Y)"; |
141 | else | 141 | else |
142 | format = "(%m.%d.%Y|%A %B %d %Y)"; | 142 | format = "(%m.%d.%Y|%A %B %d %Y)"; |
143 | syncPrefsGroup->addRadio(i18n("03.24.2004 "+format)); | 143 | syncPrefsGroup->addRadio(i18n("03.24.2004 "+format)); |
144 | if ( QApplication::desktop()->width() < 480 ) | 144 | if ( QApplication::desktop()->width() < 480 ) |
145 | format = "(%Y-%m-%d)"; | 145 | format = "(%Y-%m-%d)"; |
146 | else | 146 | else |
147 | format = "(%Y-%m-%d|%A %Y %B %d)"; | 147 | format = "(%Y-%m-%d|%A %Y %B %d)"; |
148 | syncPrefsGroup->addRadio(i18n("2004-03-24 "+format)); | 148 | syncPrefsGroup->addRadio(i18n("2004-03-24 "+format)); |
149 | syncPrefsGroup->addRadio(i18n("User defined")); | 149 | syncPrefsGroup->addRadio(i18n("User defined")); |
150 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); | 150 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); |
151 | ++iii; | 151 | ++iii; |
152 | ++iii; | 152 | ++iii; |
153 | QLabel * lab; | 153 | QLabel * lab; |
154 | mUserDateFormatLong = new QLineEdit(topFrame); | 154 | mUserDateFormatLong = new QLineEdit(topFrame); |
155 | lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame); | 155 | lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame); |
156 | topLayout->addWidget(lab ,iii,0); | 156 | topLayout->addWidget(lab ,iii,0); |
157 | topLayout->addWidget(mUserDateFormatLong,iii,1); | 157 | topLayout->addWidget(mUserDateFormatLong,iii,1); |
158 | ++iii; | 158 | ++iii; |
159 | mUserDateFormatShort = new QLineEdit(topFrame); | 159 | mUserDateFormatShort = new QLineEdit(topFrame); |
160 | lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame); | 160 | lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame); |
161 | topLayout->addWidget(lab ,iii,0); | 161 | topLayout->addWidget(lab ,iii,0); |
162 | topLayout->addWidget(mUserDateFormatShort,iii,1); | 162 | topLayout->addWidget(mUserDateFormatShort,iii,1); |
163 | ++iii; | 163 | ++iii; |
164 | lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame); | 164 | lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame); |
165 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); | 165 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); |
166 | ++iii; | 166 | ++iii; |
167 | lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame); | 167 | lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame); |
168 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); | 168 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); |
169 | ++iii; | 169 | ++iii; |
170 | lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame); | 170 | lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame); |
171 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); | 171 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); |
172 | ++iii; | 172 | ++iii; |
173 | #endif | 173 | #endif |
174 | 174 | ||
@@ -626,193 +626,192 @@ void KOPrefsDialog::setupViewsTab() | |||
626 | addWidBool(i18n("Hold non-fullscreen on view change"), | 626 | addWidBool(i18n("Hold non-fullscreen on view change"), |
627 | &(KOPrefs::instance()->mViewChangeHoldNonFullscreen),topFrame); | 627 | &(KOPrefs::instance()->mViewChangeHoldNonFullscreen),topFrame); |
628 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 628 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
629 | 629 | ||
630 | 630 | ||
631 | 631 | ||
632 | KPrefsDialogWidBool *fullViewMonth = | 632 | KPrefsDialogWidBool *fullViewMonth = |
633 | addWidBool(i18n("Next days view uses full window"), | 633 | addWidBool(i18n("Next days view uses full window"), |
634 | &(KOPrefs::instance()->mFullViewMonth),topFrame); | 634 | &(KOPrefs::instance()->mFullViewMonth),topFrame); |
635 | topLayout->addWidget(fullViewMonth->checkBox(),ii++,0); | 635 | topLayout->addWidget(fullViewMonth->checkBox(),ii++,0); |
636 | 636 | ||
637 | 637 | ||
638 | KPrefsDialogWidBool *fullViewTodo = | 638 | KPrefsDialogWidBool *fullViewTodo = |
639 | addWidBool(i18n("Event list view uses full window"), | 639 | addWidBool(i18n("Event list view uses full window"), |
640 | &(KOPrefs::instance()->mFullViewTodo),topFrame); | 640 | &(KOPrefs::instance()->mFullViewTodo),topFrame); |
641 | topLayout->addWidget(fullViewTodo->checkBox(),ii++,0); | 641 | topLayout->addWidget(fullViewTodo->checkBox(),ii++,0); |
642 | dummy = | 642 | dummy = |
643 | addWidBool(i18n("Listview uses monthly timespan"), | 643 | addWidBool(i18n("Listview uses monthly timespan"), |
644 | &(KOPrefs::instance()->mListViewMonthTimespan),topFrame); | 644 | &(KOPrefs::instance()->mListViewMonthTimespan),topFrame); |
645 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 645 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
646 | dummy = | 646 | dummy = |
647 | addWidBool(i18n("Highlight selection in Time Edit"), | 647 | addWidBool(i18n("Highlight selection in Time Edit"), |
648 | &(KOPrefs::instance()->mHightlightDateTimeEdit),topFrame); | 648 | &(KOPrefs::instance()->mHightlightDateTimeEdit),topFrame); |
649 | topLayout->addWidget( dummy->checkBox(), ii++,0); | 649 | topLayout->addWidget( dummy->checkBox(), ii++,0); |
650 | 650 | ||
651 | KPrefsDialogWidBool *dailyRecur = | 651 | KPrefsDialogWidBool *dailyRecur = |
652 | addWidBool(i18n("Show events that recur daily in date nav."), | 652 | addWidBool(i18n("Show events that recur daily in date nav."), |
653 | &(KOPrefs::instance()->mDailyRecur),topFrame); | 653 | &(KOPrefs::instance()->mDailyRecur),topFrame); |
654 | topLayout->addWidget(dailyRecur->checkBox(),ii++,0); | 654 | topLayout->addWidget(dailyRecur->checkBox(),ii++,0); |
655 | 655 | ||
656 | KPrefsDialogWidBool *weeklyRecur = | 656 | KPrefsDialogWidBool *weeklyRecur = |
657 | addWidBool(i18n("Show ev. that recur weekly in date nav."), | 657 | addWidBool(i18n("Show ev. that recur weekly in date nav."), |
658 | &(KOPrefs::instance()->mWeeklyRecur),topFrame); | 658 | &(KOPrefs::instance()->mWeeklyRecur),topFrame); |
659 | topLayout->addWidget(weeklyRecur->checkBox(),ii++,0); | 659 | topLayout->addWidget(weeklyRecur->checkBox(),ii++,0); |
660 | 660 | ||
661 | #ifdef DESKTOP_VERSION | 661 | #ifdef DESKTOP_VERSION |
662 | KPrefsDialogWidBool *enableToolTips = | 662 | KPrefsDialogWidBool *enableToolTips = |
663 | addWidBool(i18n("Enable tooltips displaying summary of ev."), | 663 | addWidBool(i18n("Enable tooltips displaying summary of ev."), |
664 | &(KOPrefs::instance()->mEnableToolTips),topFrame); | 664 | &(KOPrefs::instance()->mEnableToolTips),topFrame); |
665 | topLayout->addWidget(enableToolTips->checkBox(),ii++,0); | 665 | topLayout->addWidget(enableToolTips->checkBox(),ii++,0); |
666 | #endif | 666 | #endif |
667 | // ********************************************************* | 667 | // ********************************************************* |
668 | 668 | ||
669 | topFrame = addPage(i18n("Agenda View"),0,0); | 669 | topFrame = addPage(i18n("Agenda View"),0,0); |
670 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | 670 | // DesktopIcon("viewmag",KIcon::SizeMedium)); |
671 | 671 | ||
672 | topLayout = new QGridLayout(topFrame,5,1); | 672 | topLayout = new QGridLayout(topFrame,5,1); |
673 | topLayout->setSpacing(mSpacingHint); | 673 | topLayout->setSpacing(mSpacingHint); |
674 | topLayout->setMargin(mMarginHint); | 674 | topLayout->setMargin(mMarginHint); |
675 | ii = 0; | 675 | ii = 0; |
676 | 676 | ||
677 | 677 | ||
678 | dummy = | 678 | dummy = |
679 | addWidBool(i18n("Show time in agenda items"), | 679 | addWidBool(i18n("Show time in agenda items"), |
680 | &(KOPrefs::instance()->mShowTimeInAgenda),topFrame); | 680 | &(KOPrefs::instance()->mShowTimeInAgenda),topFrame); |
681 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 681 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
682 | 682 | ||
683 | dummy = | 683 | dummy = |
684 | addWidBool(i18n("Highlight current day in agenda"), | 684 | addWidBool(i18n("Highlight current day in agenda"), |
685 | &(KOPrefs::instance()->mHighlightCurrentDay),topFrame); | 685 | &(KOPrefs::instance()->mHighlightCurrentDay),topFrame); |
686 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 686 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
687 | 687 | ||
688 | dummy = | 688 | dummy = |
689 | addWidBool(i18n("Use light color for highlight current day"), | 689 | addWidBool(i18n("Use light color for highlight current day"), |
690 | &(KOPrefs::instance()->mUseHighlightLightColor),topFrame); | 690 | &(KOPrefs::instance()->mUseHighlightLightColor),topFrame); |
691 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 691 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
692 | 692 | ||
693 | 693 | ||
694 | KPrefsDialogWidBool *marcusBainsEnabled = | 694 | KPrefsDialogWidBool *marcusBainsEnabled = |
695 | addWidBool(i18n("Show current time"), | 695 | addWidBool(i18n("Show current time"), |
696 | &(KOPrefs::instance()->mMarcusBainsEnabled),topFrame); | 696 | &(KOPrefs::instance()->mMarcusBainsEnabled),topFrame); |
697 | topLayout->addWidget(marcusBainsEnabled->checkBox(),ii++,0); | 697 | topLayout->addWidget(marcusBainsEnabled->checkBox(),ii++,0); |
698 | 698 | ||
699 | 699 | ||
700 | dummy = | 700 | dummy = |
701 | addWidBool(i18n("Set agenda to DayBeginsAt on change"), | 701 | addWidBool(i18n("Set agenda to DayBeginsAt on change"), |
702 | &(KOPrefs::instance()->mSetTimeToDayStartAt),topFrame); | 702 | &(KOPrefs::instance()->mSetTimeToDayStartAt),topFrame); |
703 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 703 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
704 | 704 | ||
705 | dummy = | 705 | dummy = |
706 | addWidBool(i18n("Set agenda to current time on change"), | 706 | addWidBool(i18n("Set agenda to current time on change"), |
707 | &(KOPrefs::instance()->mCenterOnCurrentTime),topFrame); | 707 | &(KOPrefs::instance()->mCenterOnCurrentTime),topFrame); |
708 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 708 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
709 | 709 | ||
710 | 710 | ||
711 | 711 | ||
712 | 712 | ||
713 | 713 | ||
714 | 714 | ||
715 | 715 | ||
716 | topFrame = addPage(i18n("Month View"),0,0); | 716 | topFrame = addPage(i18n("Month View"),0,0); |
717 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | 717 | // DesktopIcon("viewmag",KIcon::SizeMedium)); |
718 | 718 | ||
719 | topLayout = new QGridLayout(topFrame,5,1); | 719 | topLayout = new QGridLayout(topFrame,5,1); |
720 | topLayout->setSpacing(mSpacingHint); | 720 | topLayout->setSpacing(mSpacingHint); |
721 | topLayout->setMargin(mMarginHint); | 721 | topLayout->setMargin(mMarginHint); |
722 | qDebug("%d %d ",mSpacingHint, mMarginHint ); | ||
723 | ii = 0; | 722 | ii = 0; |
724 | QLabel *lab; | 723 | QLabel *lab; |
725 | QHBox *habo = new QHBox( topFrame ); | 724 | QHBox *habo = new QHBox( topFrame ); |
726 | if ( QApplication::desktop()->width() <= 480 ) { | 725 | if ( QApplication::desktop()->width() <= 480 ) { |
727 | lab = new QLabel ( i18n("Show events that recur "), topFrame ); | 726 | lab = new QLabel ( i18n("Show events that recur "), topFrame ); |
728 | topLayout->addMultiCellWidget(lab,ii, ii,0,1); | 727 | topLayout->addMultiCellWidget(lab,ii, ii,0,1); |
729 | ii++; | 728 | ii++; |
730 | } else { | 729 | } else { |
731 | new QLabel ( i18n("Show events that recur "), habo ); | 730 | new QLabel ( i18n("Show events that recur "), habo ); |
732 | } | 731 | } |
733 | dailyRecur = | 732 | dailyRecur = |
734 | addWidBool(i18n("daily"), | 733 | addWidBool(i18n("daily"), |
735 | &(KOPrefs::instance()->mMonthDailyRecur),habo); | 734 | &(KOPrefs::instance()->mMonthDailyRecur),habo); |
736 | // topLayout->addWidget(dailyRecur->checkBox(),ii++,0); | 735 | // topLayout->addWidget(dailyRecur->checkBox(),ii++,0); |
737 | 736 | ||
738 | weeklyRecur = | 737 | weeklyRecur = |
739 | addWidBool(i18n("weekly"), | 738 | addWidBool(i18n("weekly"), |
740 | &(KOPrefs::instance()->mMonthWeeklyRecur),habo); | 739 | &(KOPrefs::instance()->mMonthWeeklyRecur),habo); |
741 | topLayout->addMultiCellWidget(habo,ii, ii,0,1); | 740 | topLayout->addMultiCellWidget(habo,ii, ii,0,1); |
742 | ii++; | 741 | ii++; |
743 | 742 | ||
744 | 743 | ||
745 | habo = new QHBox( topFrame ); | 744 | habo = new QHBox( topFrame ); |
746 | if ( QApplication::desktop()->width() <= 480 ) { | 745 | if ( QApplication::desktop()->width() <= 480 ) { |
747 | lab = new QLabel (i18n("Show in every cell ") , topFrame ); | 746 | lab = new QLabel (i18n("Show in every cell ") , topFrame ); |
748 | topLayout->addMultiCellWidget(lab,ii, ii,0,1); | 747 | topLayout->addMultiCellWidget(lab,ii, ii,0,1); |
749 | ii++; | 748 | ii++; |
750 | 749 | ||
751 | } else { | 750 | } else { |
752 | new QLabel ( i18n("Show in every cell "), habo ); | 751 | new QLabel ( i18n("Show in every cell "), habo ); |
753 | } | 752 | } |
754 | weeklyRecur = | 753 | weeklyRecur = |
755 | addWidBool(i18n("short month"), | 754 | addWidBool(i18n("short month"), |
756 | &(KOPrefs::instance()->mMonthShowShort),habo); | 755 | &(KOPrefs::instance()->mMonthShowShort),habo); |
757 | weeklyRecur = | 756 | weeklyRecur = |
758 | addWidBool(i18n("icons"), | 757 | addWidBool(i18n("icons"), |
759 | &(KOPrefs::instance()->mMonthShowIcons),habo); | 758 | &(KOPrefs::instance()->mMonthShowIcons),habo); |
760 | 759 | ||
761 | topLayout->addMultiCellWidget(habo,ii, ii,0,1); | 760 | topLayout->addMultiCellWidget(habo,ii, ii,0,1); |
762 | ii++; | 761 | ii++; |
763 | #ifdef DESKTOP_VERSION | 762 | #ifdef DESKTOP_VERSION |
764 | KPrefsDialogWidBool *enableMonthScroll = | 763 | KPrefsDialogWidBool *enableMonthScroll = |
765 | addWidBool(i18n("Enable scrollbars in month view cells"), | 764 | addWidBool(i18n("Enable scrollbars in month view cells"), |
766 | &(KOPrefs::instance()->mEnableMonthScroll),topFrame); | 765 | &(KOPrefs::instance()->mEnableMonthScroll),topFrame); |
767 | topLayout->addWidget(enableMonthScroll->checkBox(),ii++,0); | 766 | topLayout->addWidget(enableMonthScroll->checkBox(),ii++,0); |
768 | #endif | 767 | #endif |
769 | dummy = | 768 | dummy = |
770 | addWidBool(i18n("Week view mode uses bigger font"), | 769 | addWidBool(i18n("Week view mode uses bigger font"), |
771 | &(KOPrefs::instance()->mMonthViewUsesBigFont),topFrame); | 770 | &(KOPrefs::instance()->mMonthViewUsesBigFont),topFrame); |
772 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 771 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
773 | dummy = | 772 | dummy = |
774 | addWidBool(i18n("Show Sat/Sun together"), | 773 | addWidBool(i18n("Show Sat/Sun together"), |
775 | &(KOPrefs::instance()->mMonthViewSatSunTog),topFrame); | 774 | &(KOPrefs::instance()->mMonthViewSatSunTog),topFrame); |
776 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 775 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
777 | 776 | ||
778 | KPrefsDialogWidBool *coloredCategoriesInMonthView = | 777 | KPrefsDialogWidBool *coloredCategoriesInMonthView = |
779 | addWidBool(i18n("Month view uses category colors"), | 778 | addWidBool(i18n("Month view uses category colors"), |
780 | &(KOPrefs::instance()->mMonthViewUsesCategoryColor),topFrame); | 779 | &(KOPrefs::instance()->mMonthViewUsesCategoryColor),topFrame); |
781 | topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); | 780 | topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); |
782 | 781 | ||
783 | dummy = | 782 | dummy = |
784 | addWidBool(i18n("Categorie colors are applied to text"), | 783 | addWidBool(i18n("Categorie colors are applied to text"), |
785 | &(KOPrefs::instance()->mMonthViewUsesForegroundColor),topFrame); | 784 | &(KOPrefs::instance()->mMonthViewUsesForegroundColor),topFrame); |
786 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 785 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
787 | coloredCategoriesInMonthView = | 786 | coloredCategoriesInMonthView = |
788 | addWidBool(i18n("Month view uses day colors"), | 787 | addWidBool(i18n("Month view uses day colors"), |
789 | &(KOPrefs::instance()->mMonthViewUsesDayColors),topFrame); | 788 | &(KOPrefs::instance()->mMonthViewUsesDayColors),topFrame); |
790 | topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); | 789 | topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); |
791 | 790 | ||
792 | KPrefsDialogWidColor *holidayColor = | 791 | KPrefsDialogWidColor *holidayColor = |
793 | addWidColor(i18n("Day color odd months"), | 792 | addWidColor(i18n("Day color odd months"), |
794 | &(KOPrefs::instance()->mMonthViewOddColor),topFrame); | 793 | &(KOPrefs::instance()->mMonthViewOddColor),topFrame); |
795 | topLayout->addWidget(holidayColor->label(),ii,0); | 794 | topLayout->addWidget(holidayColor->label(),ii,0); |
796 | topLayout->addWidget(holidayColor->button(),ii++,1); | 795 | topLayout->addWidget(holidayColor->button(),ii++,1); |
797 | 796 | ||
798 | holidayColor = | 797 | holidayColor = |
799 | addWidColor(i18n("Day color even months"), | 798 | addWidColor(i18n("Day color even months"), |
800 | &(KOPrefs::instance()->mMonthViewEvenColor),topFrame); | 799 | &(KOPrefs::instance()->mMonthViewEvenColor),topFrame); |
801 | topLayout->addWidget(holidayColor->label(),ii,0); | 800 | topLayout->addWidget(holidayColor->label(),ii,0); |
802 | topLayout->addWidget(holidayColor->button(),ii++,1); | 801 | topLayout->addWidget(holidayColor->button(),ii++,1); |
803 | 802 | ||
804 | 803 | ||
805 | holidayColor = | 804 | holidayColor = |
806 | addWidColor(i18n("Color for Sundays + category \"Holiday\""), | 805 | addWidColor(i18n("Color for Sundays + category \"Holiday\""), |
807 | &(KOPrefs::instance()->mMonthViewHolidayColor),topFrame); | 806 | &(KOPrefs::instance()->mMonthViewHolidayColor),topFrame); |
808 | topLayout->addWidget(holidayColor->label(),ii,0); | 807 | topLayout->addWidget(holidayColor->label(),ii,0); |
809 | topLayout->addWidget(holidayColor->button(),ii++,1); | 808 | topLayout->addWidget(holidayColor->button(),ii++,1); |
810 | // *********************** What'sNext View | 809 | // *********************** What'sNext View |
811 | topFrame = addPage(i18n("What's Next View"),0,0); | 810 | topFrame = addPage(i18n("What's Next View"),0,0); |
812 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | 811 | // DesktopIcon("viewmag",KIcon::SizeMedium)); |
813 | 812 | ||
814 | topLayout = new QGridLayout(topFrame,4,1); | 813 | topLayout = new QGridLayout(topFrame,4,1); |
815 | topLayout->setSpacing(mSpacingHint); | 814 | topLayout->setSpacing(mSpacingHint); |
816 | topLayout->setMargin(mMarginHint); | 815 | topLayout->setMargin(mMarginHint); |
817 | ii = 0; | 816 | ii = 0; |
818 | 817 | ||
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 9505d06..94f4677 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -1681,196 +1681,192 @@ void MainWindow::importQtopia() | |||
1681 | #else | 1681 | #else |
1682 | QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml"; | 1682 | QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml"; |
1683 | QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml"; | 1683 | QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml"; |
1684 | QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml"; | 1684 | QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml"; |
1685 | #endif | 1685 | #endif |
1686 | mView->importQtopia( categories, datebook, todolist ); | 1686 | mView->importQtopia( categories, datebook, todolist ); |
1687 | } | 1687 | } |
1688 | #if 0 | 1688 | #if 0 |
1689 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1689 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1690 | i18n("Not supported \non desktop!\n"), | 1690 | i18n("Not supported \non desktop!\n"), |
1691 | i18n("Ok"), i18n("Cancel"), 0, | 1691 | i18n("Ok"), i18n("Cancel"), 0, |
1692 | 0, 1 ); | 1692 | 0, 1 ); |
1693 | 1693 | ||
1694 | #endif | 1694 | #endif |
1695 | } | 1695 | } |
1696 | 1696 | ||
1697 | void MainWindow::saveOnClose() | 1697 | void MainWindow::saveOnClose() |
1698 | { | 1698 | { |
1699 | KOPrefs *p = KOPrefs::instance(); | 1699 | KOPrefs *p = KOPrefs::instance(); |
1700 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); | 1700 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); |
1701 | p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal ); | 1701 | p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal ); |
1702 | p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal ); | 1702 | p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal ); |
1703 | if ( filterToolBar ) { | 1703 | if ( filterToolBar ) { |
1704 | p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal ); | 1704 | p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal ); |
1705 | } | 1705 | } |
1706 | #ifdef DESKTOP_VERSION | 1706 | #ifdef DESKTOP_VERSION |
1707 | 1707 | ||
1708 | QPoint myP; | 1708 | QPoint myP; |
1709 | myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1709 | myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1710 | if ( p->mToolBarHor ) | 1710 | if ( p->mToolBarHor ) |
1711 | p->mToolBarUp = myP.y() > height()/2; | 1711 | p->mToolBarUp = myP.y() > height()/2; |
1712 | else | 1712 | else |
1713 | p->mToolBarUp = myP.x() > width()/2; | 1713 | p->mToolBarUp = myP.x() > width()/2; |
1714 | myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1714 | myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1715 | if ( p->mToolBarHorV ) | 1715 | if ( p->mToolBarHorV ) |
1716 | p->mToolBarUpV = myP.y() > height()/2; | 1716 | p->mToolBarUpV = myP.y() > height()/2; |
1717 | else | 1717 | else |
1718 | p->mToolBarUpV = myP.x() > width()/2 ; | 1718 | p->mToolBarUpV = myP.x() > width()/2 ; |
1719 | myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1719 | myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1720 | if ( p->mToolBarHorN ) | 1720 | if ( p->mToolBarHorN ) |
1721 | p->mToolBarUpN = myP.y() > height()/2; | 1721 | p->mToolBarUpN = myP.y() > height()/2; |
1722 | else | 1722 | else |
1723 | p->mToolBarUpN = myP.x() > width()/2 ; | 1723 | p->mToolBarUpN = myP.x() > width()/2 ; |
1724 | if ( filterToolBar ) { | 1724 | if ( filterToolBar ) { |
1725 | myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1725 | myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1726 | if ( p->mToolBarHorF ) | 1726 | if ( p->mToolBarHorF ) |
1727 | p->mToolBarUpF = myP.y() > height()/2; | 1727 | p->mToolBarUpF = myP.y() > height()/2; |
1728 | else | 1728 | else |
1729 | p->mToolBarUpF = myP.x() > width()/2 ; | 1729 | p->mToolBarUpF = myP.x() > width()/2 ; |
1730 | } | 1730 | } |
1731 | #else | 1731 | #else |
1732 | if ( p->mToolBarHor ) | 1732 | if ( p->mToolBarHor ) |
1733 | p->mToolBarUp = iconToolBar->y() > height()/2; | 1733 | p->mToolBarUp = iconToolBar->y() > height()/2; |
1734 | else | 1734 | else |
1735 | p->mToolBarUp = iconToolBar->x() > width()/2; | 1735 | p->mToolBarUp = iconToolBar->x() > width()/2; |
1736 | if ( p->mToolBarHorV ) | 1736 | if ( p->mToolBarHorV ) |
1737 | p->mToolBarUpV = viewToolBar->y() > height()/2; | 1737 | p->mToolBarUpV = viewToolBar->y() > height()/2; |
1738 | else | 1738 | else |
1739 | p->mToolBarUpV = viewToolBar->x() > width()/2 ; | 1739 | p->mToolBarUpV = viewToolBar->x() > width()/2 ; |
1740 | 1740 | ||
1741 | if ( p->mToolBarHorN ) | 1741 | if ( p->mToolBarHorN ) |
1742 | p->mToolBarUpN = navigatorToolBar->y() > height()/2; | 1742 | p->mToolBarUpN = navigatorToolBar->y() > height()/2; |
1743 | else | 1743 | else |
1744 | p->mToolBarUpN = navigatorToolBar->x() > width()/2 ; | 1744 | p->mToolBarUpN = navigatorToolBar->x() > width()/2 ; |
1745 | if ( filterToolBar ) { | 1745 | if ( filterToolBar ) { |
1746 | if ( p->mToolBarHorF ) | 1746 | if ( p->mToolBarHorF ) |
1747 | p->mToolBarUpF = filterToolBar->y() > height()/2; | 1747 | p->mToolBarUpF = filterToolBar->y() > height()/2; |
1748 | else | 1748 | else |
1749 | p->mToolBarUpF = filterToolBar->x() > width()/2 ; | 1749 | p->mToolBarUpF = filterToolBar->x() > width()/2 ; |
1750 | } | 1750 | } |
1751 | #endif | 1751 | #endif |
1752 | 1752 | ||
1753 | 1753 | ||
1754 | mView->writeSettings(); | 1754 | mView->writeSettings(); |
1755 | if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) | 1755 | if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) |
1756 | save(); | 1756 | save(); |
1757 | } | 1757 | } |
1758 | void MainWindow::slotModifiedChanged( bool changed ) | 1758 | void MainWindow::slotModifiedChanged( bool changed ) |
1759 | { | 1759 | { |
1760 | if ( mBlockAtStartup ) | 1760 | if ( mBlockAtStartup ) |
1761 | return; | 1761 | return; |
1762 | 1762 | ||
1763 | int msec; | 1763 | int msec; |
1764 | // we store the changes after 1 minute, | 1764 | // we store the changes after 1 minute, |
1765 | // and for safety reasons after 10 minutes again | 1765 | // and for safety reasons after 10 minutes again |
1766 | if ( !mSyncManager->blockSave() ) | 1766 | if ( !mSyncManager->blockSave() ) |
1767 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; | 1767 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; |
1768 | else | 1768 | else |
1769 | msec = 1000 * 600; | 1769 | msec = 1000 * 600; |
1770 | mSaveTimer.start( msec, true ); // 1 minute | 1770 | mSaveTimer.start( msec, true ); // 1 minute |
1771 | qDebug("KO: Saving File in %d secs!", msec/1000); | 1771 | qDebug("KO: Saving File in %d secs!", msec/1000); |
1772 | mCalendarModifiedFlag = true; | 1772 | mCalendarModifiedFlag = true; |
1773 | } | 1773 | } |
1774 | void MainWindow::saveStopTimer() | 1774 | void MainWindow::saveStopTimer() |
1775 | { | 1775 | { |
1776 | mSaveTimer.stop(); | 1776 | mSaveTimer.stop(); |
1777 | if (mSaveTimer.isActive() ) | ||
1778 | qDebug("ti active "); | ||
1779 | else | ||
1780 | qDebug("KO: Save timer stopped"); | ||
1781 | } | 1777 | } |
1782 | void MainWindow::save() | 1778 | void MainWindow::save() |
1783 | { | 1779 | { |
1784 | if ( !mCalendarModifiedFlag ) { | 1780 | if ( !mCalendarModifiedFlag ) { |
1785 | qDebug("KO: Calendar not modified. Nothing saved."); | 1781 | qDebug("KO: Calendar not modified. Nothing saved."); |
1786 | return; | 1782 | return; |
1787 | } | 1783 | } |
1788 | if ( mSyncManager->blockSave() ) | 1784 | if ( mSyncManager->blockSave() ) |
1789 | return; | 1785 | return; |
1790 | mSyncManager->setBlockSave(true); | 1786 | mSyncManager->setBlockSave(true); |
1791 | if ( mView->checkFileVersion( defaultFileName()) ) { | 1787 | if ( mView->checkFileVersion( defaultFileName()) ) { |
1792 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 1788 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
1793 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); | 1789 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); |
1794 | qDebug("KO: Start saving data to file!"); | 1790 | qDebug("KO: Start saving data to file!"); |
1795 | mView->saveCalendar( defaultFileName() ); | 1791 | mView->saveCalendar( defaultFileName() ); |
1796 | mCalendarModifiedFlag = false; | 1792 | mCalendarModifiedFlag = false; |
1797 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 1793 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
1798 | qDebug("KO: Needed %d ms for saving.",msNeeded ); | 1794 | qDebug("KO: Needed %d ms for saving.",msNeeded ); |
1799 | QString savemes; | 1795 | QString savemes; |
1800 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); | 1796 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); |
1801 | setCaption(savemes); | 1797 | setCaption(savemes); |
1802 | } else | 1798 | } else |
1803 | setCaption(i18n("Saving cancelled!")); | 1799 | setCaption(i18n("Saving cancelled!")); |
1804 | mSyncManager->setBlockSave( false ); | 1800 | mSyncManager->setBlockSave( false ); |
1805 | } | 1801 | } |
1806 | 1802 | ||
1807 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) | 1803 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) |
1808 | { | 1804 | { |
1809 | if ( !e->isAutoRepeat() ) { | 1805 | if ( !e->isAutoRepeat() ) { |
1810 | mFlagKeyPressed = false; | 1806 | mFlagKeyPressed = false; |
1811 | } | 1807 | } |
1812 | } | 1808 | } |
1813 | void MainWindow::keyPressEvent ( QKeyEvent * e ) | 1809 | void MainWindow::keyPressEvent ( QKeyEvent * e ) |
1814 | { | 1810 | { |
1815 | qApp->processEvents(); | 1811 | qApp->processEvents(); |
1816 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { | 1812 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { |
1817 | e->ignore(); | 1813 | e->ignore(); |
1818 | // qDebug(" ignore %d",e->isAutoRepeat() ); | 1814 | // qDebug(" ignore %d",e->isAutoRepeat() ); |
1819 | return; | 1815 | return; |
1820 | } | 1816 | } |
1821 | if (! e->isAutoRepeat() ) | 1817 | if (! e->isAutoRepeat() ) |
1822 | mFlagKeyPressed = true; | 1818 | mFlagKeyPressed = true; |
1823 | KOPrefs *p = KOPrefs::instance(); | 1819 | KOPrefs *p = KOPrefs::instance(); |
1824 | bool showSelectedDates = false; | 1820 | bool showSelectedDates = false; |
1825 | int size; | 1821 | int size; |
1826 | int pro = 0; | 1822 | int pro = 0; |
1827 | //qDebug("MainWindow::keyPressEvent "); | 1823 | //qDebug("MainWindow::keyPressEvent "); |
1828 | switch ( e->key() ) { | 1824 | switch ( e->key() ) { |
1829 | case Qt::Key_Right: | 1825 | case Qt::Key_Right: |
1830 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 1826 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
1831 | mView->goNextMonth(); | 1827 | mView->goNextMonth(); |
1832 | else | 1828 | else |
1833 | mView->goNext(); | 1829 | mView->goNext(); |
1834 | showSelectedDates = true; | 1830 | showSelectedDates = true; |
1835 | break; | 1831 | break; |
1836 | case Qt::Key_Left: | 1832 | case Qt::Key_Left: |
1837 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1833 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1838 | mView->goPreviousMonth(); | 1834 | mView->goPreviousMonth(); |
1839 | else | 1835 | else |
1840 | mView->goPrevious(); | 1836 | mView->goPrevious(); |
1841 | showSelectedDates = true; | 1837 | showSelectedDates = true; |
1842 | break; | 1838 | break; |
1843 | case Qt::Key_Down: | 1839 | case Qt::Key_Down: |
1844 | mView->viewManager()->agendaView()->scrollOneHourDown(); | 1840 | mView->viewManager()->agendaView()->scrollOneHourDown(); |
1845 | break; | 1841 | break; |
1846 | case Qt::Key_Up: | 1842 | case Qt::Key_Up: |
1847 | mView->viewManager()->agendaView()->scrollOneHourUp(); | 1843 | mView->viewManager()->agendaView()->scrollOneHourUp(); |
1848 | break; | 1844 | break; |
1849 | case Qt::Key_K: | 1845 | case Qt::Key_K: |
1850 | mView->viewManager()->showMonthViewWeek(); | 1846 | mView->viewManager()->showMonthViewWeek(); |
1851 | break; | 1847 | break; |
1852 | case Qt::Key_I: | 1848 | case Qt::Key_I: |
1853 | mView->showIncidence(); | 1849 | mView->showIncidence(); |
1854 | break; | 1850 | break; |
1855 | case Qt::Key_Delete: | 1851 | case Qt::Key_Delete: |
1856 | case Qt::Key_Backspace: | 1852 | case Qt::Key_Backspace: |
1857 | mView->deleteIncidence(); | 1853 | mView->deleteIncidence(); |
1858 | break; | 1854 | break; |
1859 | case Qt::Key_D: | 1855 | case Qt::Key_D: |
1860 | mView->viewManager()->showDayView(); | 1856 | mView->viewManager()->showDayView(); |
1861 | showSelectedDates = true; | 1857 | showSelectedDates = true; |
1862 | break; | 1858 | break; |
1863 | case Qt::Key_O: | 1859 | case Qt::Key_O: |
1864 | mView->toggleFilerEnabled( ); | 1860 | mView->toggleFilerEnabled( ); |
1865 | break; | 1861 | break; |
1866 | case Qt::Key_0: | 1862 | case Qt::Key_0: |
1867 | case Qt::Key_1: | 1863 | case Qt::Key_1: |
1868 | case Qt::Key_2: | 1864 | case Qt::Key_2: |
1869 | case Qt::Key_3: | 1865 | case Qt::Key_3: |
1870 | case Qt::Key_4: | 1866 | case Qt::Key_4: |
1871 | case Qt::Key_5: | 1867 | case Qt::Key_5: |
1872 | case Qt::Key_6: | 1868 | case Qt::Key_6: |
1873 | case Qt::Key_7: | 1869 | case Qt::Key_7: |
1874 | case Qt::Key_8: | 1870 | case Qt::Key_8: |
1875 | case Qt::Key_9: | 1871 | case Qt::Key_9: |
1876 | pro = e->key()-48; | 1872 | pro = e->key()-48; |