-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 | |||
@@ -1,443 +1,442 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | 3 | ||
4 | Copyright (c) 2001,2002,2003 Cornelius Schumacher <schumacher@kde.org> | 4 | Copyright (c) 2001,2002,2003 Cornelius Schumacher <schumacher@kde.org> |
5 | Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com> | 5 | Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com> |
6 | 6 | ||
7 | This program is free software; you can redistribute it and/or modify | 7 | This program is free software; you can redistribute it and/or modify |
8 | it under the terms of the GNU General Public License as published by | 8 | it under the terms of the GNU General Public License as published by |
9 | the Free Software Foundation; either version 2 of the License, or | 9 | the Free Software Foundation; either version 2 of the License, or |
10 | (at your option) any later version. | 10 | (at your option) any later version. |
11 | 11 | ||
12 | This program is distributed in the hope that it will be useful, | 12 | This program is distributed in the hope that it will be useful, |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | GNU General Public License for more details. | 15 | GNU General Public License for more details. |
16 | 16 | ||
17 | You should have received a copy of the GNU General Public License | 17 | You should have received a copy of the GNU General Public License |
18 | along with this program; if not, write to the Free Software | 18 | along with this program; if not, write to the Free Software |
19 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 19 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
20 | 20 | ||
21 | As a special exception, permission is given to link this program | 21 | As a special exception, permission is given to link this program |
22 | with any edition of Qt, and distribute the resulting executable, | 22 | with any edition of Qt, and distribute the resulting executable, |
23 | without including the source code for Qt in the source distribution. | 23 | without including the source code for Qt in the source distribution. |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include <kdebug.h> | 26 | #include <kdebug.h> |
27 | #include <klocale.h> | 27 | #include <klocale.h> |
28 | 28 | ||
29 | //#include "koglobals.h" | 29 | //#include "koglobals.h" |
30 | #include "navigatorbar.h" | 30 | #include "navigatorbar.h" |
31 | #include "kdatenavigator.h" | 31 | #include "kdatenavigator.h" |
32 | 32 | ||
33 | #include <kcalendarsystem.h> | 33 | #include <kcalendarsystem.h> |
34 | 34 | ||
35 | #include "datenavigatorcontainer.h" | 35 | #include "datenavigatorcontainer.h" |
36 | #include "koprefs.h" | 36 | #include "koprefs.h" |
37 | 37 | ||
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 ); |
232 | view->changeFont( fo ); | 231 | view->changeFont( fo ); |
233 | } | 232 | } |
234 | } | 233 | } |
235 | mHorizontalCount = horizontalCount; | 234 | mHorizontalCount = horizontalCount; |
236 | mVerticalCount = verticalCount; | 235 | mVerticalCount = verticalCount; |
237 | 236 | ||
238 | } | 237 | } |
239 | if ( mNavigatorView->fontChanged() && ! fontchange ) { | 238 | if ( mNavigatorView->fontChanged() && ! fontchange ) { |
240 | qDebug("KDNC: Resetting all fonts "); | 239 | qDebug("KDNC: Resetting all fonts "); |
241 | fo = KOPrefs::instance()->mDateNavigatorFont; | 240 | fo = KOPrefs::instance()->mDateNavigatorFont; |
242 | mNavigatorView->changeFont( fo ); | 241 | mNavigatorView->changeFont( fo ); |
243 | mNavigatorView->unsetFontChanged(); | 242 | mNavigatorView->unsetFontChanged(); |
244 | uint i; | 243 | uint i; |
245 | for( i = 0; i < mExtraViews.count(); ++i ) { | 244 | for( i = 0; i < mExtraViews.count(); ++i ) { |
246 | KDateNavigator *view = mExtraViews.at( i ); | 245 | KDateNavigator *view = mExtraViews.at( i ); |
247 | view->changeFont( fo ); | 246 | view->changeFont( fo ); |
248 | } | 247 | } |
249 | } | 248 | } |
250 | int theight = height() / mVerticalCount; | 249 | int theight = height() / mVerticalCount; |
251 | int twidth = width() / mHorizontalCount; | 250 | int twidth = width() / mHorizontalCount; |
252 | 251 | ||
253 | NavigatorBar *bar = mNavigatorView->navigatorBar(); | 252 | NavigatorBar *bar = mNavigatorView->navigatorBar(); |
254 | if ( mHorizontalCount > 1 ) bar->showButtons( true, false ); | 253 | if ( mHorizontalCount > 1 ) bar->showButtons( true, false ); |
255 | else bar->showButtons( true, true ); | 254 | else bar->showButtons( true, true ); |
256 | 255 | ||
257 | mNavigatorView->setGeometry(0, | 256 | mNavigatorView->setGeometry(0, |
258 | 0, twidth, theight ); | 257 | 0, twidth, theight ); |
259 | for( uint i = 0; i < mLastDisplayedDN; ++i ) { | 258 | for( uint i = 0; i < mLastDisplayedDN; ++i ) { |
260 | int x = ( i + 1 ) % mHorizontalCount; | 259 | int x = ( i + 1 ) % mHorizontalCount; |
261 | int y = ( i + 1 ) / mHorizontalCount; | 260 | int y = ( i + 1 ) / mHorizontalCount; |
262 | 261 | ||
263 | KDateNavigator *view = mExtraViews.at( i ); | 262 | KDateNavigator *view = mExtraViews.at( i ); |
264 | bar = view->navigatorBar(); | 263 | bar = view->navigatorBar(); |
265 | if ( y > 0 ) bar->showButtons( false, false ); | 264 | if ( y > 0 ) bar->showButtons( false, false ); |
266 | else { | 265 | else { |
267 | if ( x + 1 == mHorizontalCount ) bar->showButtons( false, true ); | 266 | if ( x + 1 == mHorizontalCount ) bar->showButtons( false, true ); |
268 | else bar->showButtons( false, false ); | 267 | else bar->showButtons( false, false ); |
269 | } | 268 | } |
270 | view->setGeometry( x * twidth, | 269 | view->setGeometry( x * twidth, |
271 | y * theight, twidth, theight ); | 270 | y * theight, twidth, theight ); |
272 | } | 271 | } |
273 | int iii = 0; | 272 | int iii = 0; |
274 | int ccc = mHorizontalCount * mVerticalCount; | 273 | int ccc = mHorizontalCount * mVerticalCount; |
275 | mNavigatorView->show(); | 274 | mNavigatorView->show(); |
276 | while ( iii < ( mExtraViews.count() ) ) { | 275 | while ( iii < ( mExtraViews.count() ) ) { |
277 | if ( iii < ccc-1 ) | 276 | if ( iii < ccc-1 ) |
278 | mExtraViews.at( iii )->show(); | 277 | mExtraViews.at( iii )->show(); |
279 | else | 278 | else |
280 | mExtraViews.at( iii )->hide(); | 279 | mExtraViews.at( iii )->hide(); |
281 | ++iii; | 280 | ++iii; |
282 | } | 281 | } |
283 | } | 282 | } |
284 | 283 | ||
285 | QDate last = lastAvailableDate(); | 284 | QDate last = lastAvailableDate(); |
286 | QDate first = firstAvailableDate(); | 285 | QDate first = firstAvailableDate(); |
287 | 286 | ||
288 | QDate selFirst = mFirstSelectedDate; | 287 | QDate selFirst = mFirstSelectedDate; |
289 | QDate selLast = selFirst.addDays( mSelectedDateCount-1 ); | 288 | QDate selLast = selFirst.addDays( mSelectedDateCount-1 ); |
290 | if ( selFirst >= first && selLast <= last ) { | 289 | if ( selFirst >= first && selLast <= last ) { |
291 | updateDayMatrixDates(); | 290 | updateDayMatrixDates(); |
292 | } | 291 | } |
293 | else { | 292 | else { |
294 | updateDayMatrixDates(); | 293 | updateDayMatrixDates(); |
295 | emit monthSelected( mFirstSelectedDate.month() ); | 294 | emit monthSelected( mFirstSelectedDate.month() ); |
296 | } | 295 | } |
297 | } | 296 | } |
298 | void DateNavigatorContainer::updateDayMatrixDates() | 297 | void DateNavigatorContainer::updateDayMatrixDates() |
299 | { | 298 | { |
300 | QDate fDate = mFirstSelectedDate; | 299 | QDate fDate = mFirstSelectedDate; |
301 | QDate lDate = fDate.addDays( mSelectedDateCount - 1 ); | 300 | QDate lDate = fDate.addDays( mSelectedDateCount - 1 ); |
302 | mNavigatorView->dayMatrix()->setSelectedDaysFrom( fDate , lDate ); | 301 | mNavigatorView->dayMatrix()->setSelectedDaysFrom( fDate , lDate ); |
303 | mNavigatorView->dayMatrix()->repaint( false ); | 302 | mNavigatorView->dayMatrix()->repaint( false ); |
304 | for( uint i = 0; i < mLastDisplayedDN; ++i ) { | 303 | for( uint i = 0; i < mLastDisplayedDN; ++i ) { |
305 | KDateNavigator *n = mExtraViews.at( i ); | 304 | KDateNavigator *n = mExtraViews.at( i ); |
306 | if ( n->dayMatrix()->setSelectedDaysFrom( fDate , lDate ) ) { | 305 | if ( n->dayMatrix()->setSelectedDaysFrom( fDate , lDate ) ) { |
307 | n->dayMatrix()->repaint( false ); | 306 | n->dayMatrix()->repaint( false ); |
308 | } | 307 | } |
309 | } | 308 | } |
310 | } | 309 | } |
311 | 310 | ||
312 | void DateNavigatorContainer::updateDayMatrix() | 311 | void DateNavigatorContainer::updateDayMatrix() |
313 | { | 312 | { |
314 | mNavigatorView->updateDayMatrix(); | 313 | mNavigatorView->updateDayMatrix(); |
315 | for( uint i = 0; i < mLastDisplayedDN; ++i ) { | 314 | for( uint i = 0; i < mLastDisplayedDN; ++i ) { |
316 | KDateNavigator *n = mExtraViews.at( i ); | 315 | KDateNavigator *n = mExtraViews.at( i ); |
317 | n->updateDayMatrix(); | 316 | n->updateDayMatrix(); |
318 | } | 317 | } |
319 | } | 318 | } |
320 | 319 | ||
321 | void DateNavigatorContainer::updateToday() | 320 | void DateNavigatorContainer::updateToday() |
322 | { | 321 | { |
323 | qDebug("DateNavigatorContainer::updateToday() NOT IMPL "); | 322 | qDebug("DateNavigatorContainer::updateToday() NOT IMPL "); |
324 | #if 0 | 323 | #if 0 |
325 | mNavigatorView->updateToday(); | 324 | mNavigatorView->updateToday(); |
326 | KDateNavigator *n; | 325 | KDateNavigator *n; |
327 | for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { | 326 | for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { |
328 | n->updateToday(); | 327 | n->updateToday(); |
329 | } | 328 | } |
330 | #endif | 329 | #endif |
331 | } | 330 | } |
332 | 331 | ||
333 | void DateNavigatorContainer::updateView() | 332 | void DateNavigatorContainer::updateView() |
334 | { | 333 | { |
335 | mNavigatorView->updateView(); | 334 | mNavigatorView->updateView(); |
336 | for( uint i = 0; i < mLastDisplayedDN; ++i ) { | 335 | for( uint i = 0; i < mLastDisplayedDN; ++i ) { |
337 | KDateNavigator *n = mExtraViews.at( i ); | 336 | KDateNavigator *n = mExtraViews.at( i ); |
338 | n->updateView(); | 337 | n->updateView(); |
339 | } | 338 | } |
340 | } | 339 | } |
341 | 340 | ||
342 | void DateNavigatorContainer::updateConfig() | 341 | void DateNavigatorContainer::updateConfig() |
343 | { | 342 | { |
344 | mNavigatorView->updateConfig(); | 343 | mNavigatorView->updateConfig(); |
345 | for( uint i = 0; i < mLastDisplayedDN; ++i ) { | 344 | for( uint i = 0; i < mLastDisplayedDN; ++i ) { |
346 | KDateNavigator *n = mExtraViews.at( i ); | 345 | KDateNavigator *n = mExtraViews.at( i ); |
347 | n->updateConfig(); | 346 | n->updateConfig(); |
348 | } | 347 | } |
349 | } | 348 | } |
350 | QDate DateNavigatorContainer::lastAvailableDate() const | 349 | QDate DateNavigatorContainer::lastAvailableDate() const |
351 | { | 350 | { |
352 | QDate date = mNavigatorView->baseDate(); | 351 | QDate date = mNavigatorView->baseDate(); |
353 | QDate last = QDate ( date.year(), date.month(), date.daysInMonth() ); | 352 | QDate last = QDate ( date.year(), date.month(), date.daysInMonth() ); |
354 | int iii = mLastDisplayedDN; | 353 | int iii = mLastDisplayedDN; |
355 | if ( mLastDisplayedDN ) | 354 | if ( mLastDisplayedDN ) |
356 | last = last.addDays( 1); | 355 | last = last.addDays( 1); |
357 | while ( iii ) { | 356 | while ( iii ) { |
358 | last = last.addDays( last.daysInMonth ()); | 357 | last = last.addDays( last.daysInMonth ()); |
359 | //qDebug("DATE %s ", last.toString().latin1() ); | 358 | //qDebug("DATE %s ", last.toString().latin1() ); |
360 | --iii; | 359 | --iii; |
361 | } | 360 | } |
362 | if ( mLastDisplayedDN ) | 361 | if ( mLastDisplayedDN ) |
363 | last = last.addDays( -1); | 362 | last = last.addDays( -1); |
364 | return last; | 363 | return last; |
365 | } | 364 | } |
366 | QDate DateNavigatorContainer::firstAvailableDate() const | 365 | QDate DateNavigatorContainer::firstAvailableDate() const |
367 | { | 366 | { |
368 | return QDate ( mNavigatorView->baseDate().year(), mNavigatorView->baseDate().month(), 1 ); | 367 | return QDate ( mNavigatorView->baseDate().year(), mNavigatorView->baseDate().month(), 1 ); |
369 | } | 368 | } |
370 | void DateNavigatorContainer::selectDates( const DateList &dateList ) | 369 | void DateNavigatorContainer::selectDates( const DateList &dateList ) |
371 | { | 370 | { |
372 | mFirstSelectedDate = dateList.first() ; | 371 | mFirstSelectedDate = dateList.first() ; |
373 | mSelectedDateCount = dateList.count() ; | 372 | mSelectedDateCount = dateList.count() ; |
374 | if ( !mLastDisplayedDN ) { | 373 | if ( !mLastDisplayedDN ) { |
375 | mNavigatorView->selectDates( dateList ); | 374 | mNavigatorView->selectDates( dateList ); |
376 | return; | 375 | return; |
377 | } | 376 | } |
378 | QDate fDate = dateList.first(); | 377 | QDate fDate = dateList.first(); |
379 | QDate lDate = dateList.last(); | 378 | QDate lDate = dateList.last(); |
380 | //qDebug("%s %s ", lastAvailableDate().toString().latin1(), firstAvailableDate().toString().latin1() ); | 379 | //qDebug("%s %s ", lastAvailableDate().toString().latin1(), firstAvailableDate().toString().latin1() ); |
381 | //qDebug("End %s %s ",lDate.toString().latin1(),curEnd.toString().latin1() ); | 380 | //qDebug("End %s %s ",lDate.toString().latin1(),curEnd.toString().latin1() ); |
382 | if ( lDate <= lastAvailableDate() && firstAvailableDate() <= fDate) { | 381 | if ( lDate <= lastAvailableDate() && firstAvailableDate() <= fDate) { |
383 | updateDayMatrixDates(); | 382 | updateDayMatrixDates(); |
384 | return; | 383 | return; |
385 | } | 384 | } |
386 | mNavigatorView->selectDates( dateList ); | 385 | mNavigatorView->selectDates( dateList ); |
387 | setBaseDates(); | 386 | setBaseDates(); |
388 | if ( mLastDisplayedDN ) { | 387 | if ( mLastDisplayedDN ) { |
389 | KDateNavigator *view = mExtraViews.at( 0 ); | 388 | KDateNavigator *view = mExtraViews.at( 0 ); |
390 | view->dayMatrix()->setSelectedDaysFrom(*(dateList.begin()), *(--dateList.end())); | 389 | view->dayMatrix()->setSelectedDaysFrom(*(dateList.begin()), *(--dateList.end())); |
391 | view->dayMatrix()->repaint( false ); | 390 | view->dayMatrix()->repaint( false ); |
392 | if ( mLastDisplayedDN > 1 ) { | 391 | if ( mLastDisplayedDN > 1 ) { |
393 | KDateNavigator *view = mExtraViews.at( 1 ); | 392 | KDateNavigator *view = mExtraViews.at( 1 ); |
394 | view->dayMatrix()->setSelectedDaysFrom(*(dateList.begin()), *(--dateList.end())); | 393 | view->dayMatrix()->setSelectedDaysFrom(*(dateList.begin()), *(--dateList.end())); |
395 | view->dayMatrix()->repaint( false ); | 394 | view->dayMatrix()->repaint( false ); |
396 | } | 395 | } |
397 | } | 396 | } |
398 | } | 397 | } |
399 | 398 | ||
400 | void DateNavigatorContainer::setBaseDates() | 399 | void DateNavigatorContainer::setBaseDates() |
401 | { | 400 | { |
402 | QDate baseDate = mNavigatorView->baseDate(); | 401 | QDate baseDate = mNavigatorView->baseDate(); |
403 | bool doRepaint = true; | 402 | bool doRepaint = true; |
404 | for( uint i = 0; i < mLastDisplayedDN; ++i ) { | 403 | for( uint i = 0; i < mLastDisplayedDN; ++i ) { |
405 | KDateNavigator *n = mExtraViews.at( i ); | 404 | KDateNavigator *n = mExtraViews.at( i ); |
406 | baseDate = baseDate.addDays( baseDate.daysInMonth () - baseDate.day() +1 ); | 405 | baseDate = baseDate.addDays( baseDate.daysInMonth () - baseDate.day() +1 ); |
407 | n->setBaseDate( baseDate, doRepaint ); | 406 | n->setBaseDate( baseDate, doRepaint ); |
408 | } | 407 | } |
409 | } | 408 | } |
410 | void DateNavigatorContainer::setResizeEnabled() | 409 | void DateNavigatorContainer::setResizeEnabled() |
411 | { | 410 | { |
412 | mResizeEnabled = true; | 411 | mResizeEnabled = true; |
413 | //qDebug("DateNavigatorContainer::setResizeEnabled "); | 412 | //qDebug("DateNavigatorContainer::setResizeEnabled "); |
414 | checkUpdateDayMatrixDates(); | 413 | checkUpdateDayMatrixDates(); |
415 | } | 414 | } |
416 | void DateNavigatorContainer::resizeEvent( QResizeEvent * e ) | 415 | void DateNavigatorContainer::resizeEvent( QResizeEvent * e ) |
417 | { | 416 | { |
418 | 417 | ||
419 | //qDebug("DateNavigatorContainer::resizeEvent %d %d ", width(), height()); | 418 | //qDebug("DateNavigatorContainer::resizeEvent %d %d ", width(), height()); |
420 | //qDebug("COUNT %d ", mExtraViews.count()); | 419 | //qDebug("COUNT %d ", mExtraViews.count()); |
421 | if ( ! mResizeEnabled ) { | 420 | if ( ! mResizeEnabled ) { |
422 | //qDebug("NOT ResizeEnabled"); | 421 | //qDebug("NOT ResizeEnabled"); |
423 | return; | 422 | return; |
424 | } | 423 | } |
425 | else | 424 | else |
426 | #ifdef DESKTOP_VERSION | 425 | #ifdef DESKTOP_VERSION |
427 | mUpdateTimer->start( 100 ); | 426 | mUpdateTimer->start( 100 ); |
428 | #else | 427 | #else |
429 | mUpdateTimer->start( 50 ); | 428 | mUpdateTimer->start( 50 ); |
430 | #endif | 429 | #endif |
431 | 430 | ||
432 | //updateDayMatrixDates(); | 431 | //updateDayMatrixDates(); |
433 | } | 432 | } |
434 | 433 | ||
435 | QSize DateNavigatorContainer::minimumSizeHint() const | 434 | QSize DateNavigatorContainer::minimumSizeHint() const |
436 | { | 435 | { |
437 | return mNavigatorView->minimumSizeHint(); | 436 | return mNavigatorView->minimumSizeHint(); |
438 | } | 437 | } |
439 | 438 | ||
440 | QSize DateNavigatorContainer::sizeHint() const | 439 | QSize DateNavigatorContainer::sizeHint() const |
441 | { | 440 | { |
442 | return mNavigatorView->yourSizeHint(); | 441 | return mNavigatorView->yourSizeHint(); |
443 | } | 442 | } |
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp index 322131f..ecca374 100644 --- a/korganizer/kodaymatrix.cpp +++ b/korganizer/kodaymatrix.cpp | |||
@@ -1,1130 +1,1130 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 Eitzenberger Thomas <thomas.eitzenberger@siemens.at> | 3 | Copyright (c) 2001 Eitzenberger Thomas <thomas.eitzenberger@siemens.at> |
4 | Parts of the source code have been copied from kdpdatebutton.cpp | 4 | Parts of the source code have been copied from kdpdatebutton.cpp |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
7 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
8 | the Free Software Foundation; either version 2 of the License, or | 8 | the Free Software Foundation; either version 2 of the License, or |
9 | (at your option) any later version. | 9 | (at your option) any later version. |
10 | 10 | ||
11 | This program is distributed in the hope that it will be useful, | 11 | This program is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public License | 16 | You should have received a copy of the GNU General Public License |
17 | along with this program; if not, write to the Free Software | 17 | along with this program; if not, write to the Free Software |
18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
19 | 19 | ||
20 | As a special exception, permission is given to link this program | 20 | As a special exception, permission is given to link this program |
21 | with any edition of Qt, and distribute the resulting executable, | 21 | with any edition of Qt, and distribute the resulting executable, |
22 | without including the source ode for Qt in the source distribution. | 22 | without including the source ode for Qt in the source distribution. |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include <qevent.h> | 25 | #include <qevent.h> |
26 | #include <qpainter.h> | 26 | #include <qpainter.h> |
27 | #include <qptrlist.h> | 27 | #include <qptrlist.h> |
28 | #include <qtimer.h> | 28 | #include <qtimer.h> |
29 | #include <qwhatsthis.h> | 29 | #include <qwhatsthis.h> |
30 | 30 | ||
31 | #include <kglobal.h> | 31 | #include <kglobal.h> |
32 | #include <kdebug.h> | 32 | #include <kdebug.h> |
33 | #include <klocale.h> | 33 | #include <klocale.h> |
34 | 34 | ||
35 | #include <libkcal/vcaldrag.h> | 35 | #include <libkcal/vcaldrag.h> |
36 | #include <libkcal/icaldrag.h> | 36 | #include <libkcal/icaldrag.h> |
37 | #include <libkcal/dndfactory.h> | 37 | #include <libkcal/dndfactory.h> |
38 | #include <libkcal/calendarresources.h> | 38 | #include <libkcal/calendarresources.h> |
39 | #include <libkcal/resourcecalendar.h> | 39 | #include <libkcal/resourcecalendar.h> |
40 | #include <kresources/resourceselectdialog.h> | 40 | #include <kresources/resourceselectdialog.h> |
41 | 41 | ||
42 | #include <kcalendarsystem.h> | 42 | #include <kcalendarsystem.h> |
43 | 43 | ||
44 | #ifndef KORG_NOPLUGINS | 44 | #ifndef KORG_NOPLUGINS |
45 | #include "kocore.h" | 45 | #include "kocore.h" |
46 | #endif | 46 | #endif |
47 | #include "koprefs.h" | 47 | #include "koprefs.h" |
48 | #include "koglobals.h" | 48 | #include "koglobals.h" |
49 | 49 | ||
50 | #include "kodaymatrix.h" | 50 | #include "kodaymatrix.h" |
51 | 51 | ||
52 | // ============================================================================ | 52 | // ============================================================================ |
53 | // D Y N A M I C T I P | 53 | // D Y N A M I C T I P |
54 | // ============================================================================ | 54 | // ============================================================================ |
55 | 55 | ||
56 | DynamicTip::DynamicTip( QWidget * parent ) | 56 | DynamicTip::DynamicTip( QWidget * parent ) |
57 | : QToolTip( parent ) | 57 | : QToolTip( parent ) |
58 | { | 58 | { |
59 | matrix = (KODayMatrix*)parent; | 59 | matrix = (KODayMatrix*)parent; |
60 | } | 60 | } |
61 | 61 | ||
62 | class KODaymatrixWhatsThis :public QWhatsThis | 62 | class KODaymatrixWhatsThis :public QWhatsThis |
63 | { | 63 | { |
64 | public: | 64 | public: |
65 | KODaymatrixWhatsThis( KODayMatrix* view ) : QWhatsThis( view ),_view (view) { ;}; | 65 | KODaymatrixWhatsThis( KODayMatrix* view ) : QWhatsThis( view ),_view (view) { ;}; |
66 | ~KODaymatrixWhatsThis() { ; }; | 66 | ~KODaymatrixWhatsThis() { ; }; |
67 | 67 | ||
68 | protected: | 68 | protected: |
69 | virtual QString text( const QPoint& p ) | 69 | virtual QString text( const QPoint& p ) |
70 | { | 70 | { |
71 | return _view->getWhatsThisText( p ) ; | 71 | return _view->getWhatsThisText( p ) ; |
72 | } | 72 | } |
73 | private: | 73 | private: |
74 | KODayMatrix * _view; | 74 | KODayMatrix * _view; |
75 | }; | 75 | }; |
76 | 76 | ||
77 | void DynamicTip::maybeTip( const QPoint &pos ) | 77 | void DynamicTip::maybeTip( const QPoint &pos ) |
78 | { | 78 | { |
79 | //calculate which cell of the matrix the mouse is in | 79 | //calculate which cell of the matrix the mouse is in |
80 | QRect sz = matrix->frameRect(); | 80 | QRect sz = matrix->frameRect(); |
81 | int dheight = sz.height()*7 / 42; | 81 | int dheight = sz.height()*7 / 42; |
82 | int dwidth = sz.width() / 7; | 82 | int dwidth = sz.width() / 7; |
83 | int row = pos.y()/dheight; | 83 | int row = pos.y()/dheight; |
84 | int col = pos.x()/dwidth; | 84 | int col = pos.x()/dwidth; |
85 | 85 | ||
86 | QRect rct(col*dwidth, row*dheight, dwidth, dheight); | 86 | QRect rct(col*dwidth, row*dheight, dwidth, dheight); |
87 | 87 | ||
88 | // kdDebug() << "DynamicTip::maybeTip matrix cell index [" << | 88 | // kdDebug() << "DynamicTip::maybeTip matrix cell index [" << |
89 | // col << "][" << row << "] => " <<(col+row*7) << endl; | 89 | // col << "][" << row << "] => " <<(col+row*7) << endl; |
90 | 90 | ||
91 | //show holiday names only | 91 | //show holiday names only |
92 | QString str = matrix->getHolidayLabel(col+row*7); | 92 | QString str = matrix->getHolidayLabel(col+row*7); |
93 | if (str.isEmpty()) return; | 93 | if (str.isEmpty()) return; |
94 | tip(rct, str); | 94 | tip(rct, str); |
95 | } | 95 | } |
96 | 96 | ||
97 | 97 | ||
98 | // ============================================================================ | 98 | // ============================================================================ |
99 | // K O D A Y M A T R I X | 99 | // K O D A Y M A T R I X |
100 | // ============================================================================ | 100 | // ============================================================================ |
101 | 101 | ||
102 | const int KODayMatrix::NOSELECTION = -1000; | 102 | const int KODayMatrix::NOSELECTION = -1000; |
103 | const int KODayMatrix::NUMDAYS = 42; | 103 | const int KODayMatrix::NUMDAYS = 42; |
104 | 104 | ||
105 | KODayMatrix::KODayMatrix( QWidget *parent, const char *name ) | 105 | KODayMatrix::KODayMatrix( QWidget *parent, const char *name ) |
106 | : QFrame( parent, name , Qt::WRepaintNoErase ), mCalendar( 0 ) | 106 | : QFrame( parent, name , Qt::WRepaintNoErase ), mCalendar( 0 ) |
107 | 107 | ||
108 | #if 0 | 108 | #if 0 |
109 | KODayMatrix::KODayMatrix(QWidget *parent, Calendar* calendar, QDate date, const char *name) : | 109 | KODayMatrix::KODayMatrix(QWidget *parent, Calendar* calendar, QDate date, const char *name) : |
110 | QFrame(parent, name) | 110 | QFrame(parent, name) |
111 | #endif | 111 | #endif |
112 | { | 112 | { |
113 | oldW = 0; | 113 | oldW = 0; |
114 | oldH = 0; | 114 | oldH = 0; |
115 | myPix.resize( 150, 120 ); | 115 | myPix.resize( 150, 120 ); |
116 | mRedrawNeeded = true; | 116 | mRedrawNeeded = true; |
117 | mKODaymatrixWhatsThis = new KODaymatrixWhatsThis(this); | 117 | mKODaymatrixWhatsThis = new KODaymatrixWhatsThis(this); |
118 | mPendingUpdateBeforeRepaint = false; | 118 | mPendingUpdateBeforeRepaint = false; |
119 | mouseDown = false; | 119 | mouseDown = false; |
120 | // initialize dynamic arrays | 120 | // initialize dynamic arrays |
121 | bDays.resize ( NUMDAYS ); | 121 | bDays.resize ( NUMDAYS ); |
122 | pDays.resize ( NUMDAYS ); | 122 | pDays.resize ( NUMDAYS ); |
123 | hDays.resize ( NUMDAYS ); | 123 | hDays.resize ( NUMDAYS ); |
124 | eDays.resize ( NUMDAYS ); | 124 | eDays.resize ( NUMDAYS ); |
125 | days = new QDate[NUMDAYS]; | 125 | days = new QDate[NUMDAYS]; |
126 | daylbls = new QString[NUMDAYS]; | 126 | daylbls = new QString[NUMDAYS]; |
127 | //events = new int[NUMDAYS]; | 127 | //events = new int[NUMDAYS]; |
128 | mToolTip = new DynamicTip(this); | 128 | mToolTip = new DynamicTip(this); |
129 | 129 | ||
130 | // set default values used for drawing the matrix | 130 | // set default values used for drawing the matrix |
131 | mDefaultBackColor = palette().active().base(); | 131 | mDefaultBackColor = palette().active().base(); |
132 | mDefaultTextColor = palette().active().foreground(); | 132 | mDefaultTextColor = palette().active().foreground(); |
133 | mDefaultTextColorShaded = getShadedColor(mDefaultTextColor); | 133 | mDefaultTextColorShaded = getShadedColor(mDefaultTextColor); |
134 | mHolidayColorShaded = getShadedColor(KOPrefs::instance()->mHolidayColor); | 134 | mHolidayColorShaded = getShadedColor(KOPrefs::instance()->mHolidayColor); |
135 | mSelectedDaysColor = QColor("white"); | 135 | mSelectedDaysColor = QColor("white"); |
136 | mTodayMarginWidth = 2; | 136 | mTodayMarginWidth = 2; |
137 | mSelEnd = mSelStart = NOSELECTION; | 137 | mSelEnd = mSelStart = NOSELECTION; |
138 | 138 | ||
139 | setAcceptDrops(true); | 139 | setAcceptDrops(true); |
140 | //setFont( QFont("Arial", 10) ); | 140 | //setFont( QFont("Arial", 10) ); |
141 | 141 | ||
142 | mUpdateTimer = new QTimer( this ); | 142 | mUpdateTimer = new QTimer( this ); |
143 | connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( updateViewTimed() )); | 143 | connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( updateViewTimed() )); |
144 | mRepaintTimer = new QTimer( this ); | 144 | mRepaintTimer = new QTimer( this ); |
145 | connect (mRepaintTimer ,SIGNAL(timeout()), this, SLOT ( repaintViewTimed() )); | 145 | connect (mRepaintTimer ,SIGNAL(timeout()), this, SLOT ( repaintViewTimed() )); |
146 | mDayChanged = false; | 146 | mDayChanged = false; |
147 | updateView(); | 147 | updateView(); |
148 | } | 148 | } |
149 | QString KODayMatrix::getWhatsThisText( QPoint p ) | 149 | QString KODayMatrix::getWhatsThisText( QPoint p ) |
150 | { | 150 | { |
151 | 151 | ||
152 | int tmp = getDayIndexFrom(p.x(), p.y()); | 152 | int tmp = getDayIndexFrom(p.x(), p.y()); |
153 | if ( tmp < 0 || tmp > NUMDAYS-1 || !mCalendar ) | 153 | if ( tmp < 0 || tmp > NUMDAYS-1 || !mCalendar ) |
154 | return QString(); | 154 | return QString(); |
155 | QDate mDate = days[tmp]; | 155 | QDate mDate = days[tmp]; |
156 | QPtrList<Event> eventlist = mCalendar->events(mDate); | 156 | QPtrList<Event> eventlist = mCalendar->events(mDate); |
157 | Event *event; | 157 | Event *event; |
158 | QStringList mToolTip; | 158 | QStringList mToolTip; |
159 | for(event=eventlist.first();event != 0;event=eventlist.next()) { | 159 | for(event=eventlist.first();event != 0;event=eventlist.next()) { |
160 | QString mToolTipText; | 160 | QString mToolTipText; |
161 | QString text; | 161 | QString text; |
162 | int multiday = 0;// 1 = start, 2 = midddle, 3 = end day | 162 | int multiday = 0;// 1 = start, 2 = midddle, 3 = end day |
163 | if (event->isMultiDay()) { | 163 | if (event->isMultiDay()) { |
164 | QString prefix = "<->";multiday = 2; | 164 | QString prefix = "<->";multiday = 2; |
165 | QString time; | 165 | QString time; |
166 | if ( event->doesRecur() ) { | 166 | if ( event->doesRecur() ) { |
167 | if ( event->recursOn( mDate) ) { | 167 | if ( event->recursOn( mDate) ) { |
168 | prefix ="->" ;multiday = 1; | 168 | prefix ="->" ;multiday = 1; |
169 | } | 169 | } |
170 | else { | 170 | else { |
171 | int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); | 171 | int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); |
172 | if ( event->recursOn( mDate.addDays( -days)) ) { | 172 | if ( event->recursOn( mDate.addDays( -days)) ) { |
173 | prefix ="<-" ;multiday = 3; | 173 | prefix ="<-" ;multiday = 3; |
174 | } | 174 | } |
175 | } | 175 | } |
176 | } else { | 176 | } else { |
177 | if (mDate == event->dtStart().date()) { | 177 | if (mDate == event->dtStart().date()) { |
178 | prefix ="->" ;multiday = 1; | 178 | prefix ="->" ;multiday = 1; |
179 | } else if (mDate == event->dtEnd().date()) { | 179 | } else if (mDate == event->dtEnd().date()) { |
180 | prefix ="<-" ;multiday = 3; | 180 | prefix ="<-" ;multiday = 3; |
181 | } | 181 | } |
182 | } | 182 | } |
183 | if ( !event->doesFloat() ) { | 183 | if ( !event->doesFloat() ) { |
184 | if ( mDate == event->dtStart().date () ) | 184 | if ( mDate == event->dtStart().date () ) |
185 | time = KGlobal::locale()->formatTime(event->dtStart().time())+" "; | 185 | time = KGlobal::locale()->formatTime(event->dtStart().time())+" "; |
186 | else if ( mDate == event->dtEnd().date () ) | 186 | else if ( mDate == event->dtEnd().date () ) |
187 | time = KGlobal::locale()->formatTime(event->dtEnd().time())+" "; | 187 | time = KGlobal::locale()->formatTime(event->dtEnd().time())+" "; |
188 | 188 | ||
189 | } | 189 | } |
190 | text = time + event->summary(); | 190 | text = time + event->summary(); |
191 | mToolTipText += prefix + text; | 191 | mToolTipText += prefix + text; |
192 | } else { | 192 | } else { |
193 | if (event->doesFloat()) { | 193 | if (event->doesFloat()) { |
194 | text = event->summary(); | 194 | text = event->summary(); |
195 | mToolTipText += text; | 195 | mToolTipText += text; |
196 | } | 196 | } |
197 | else { | 197 | else { |
198 | text = KGlobal::locale()->formatTime(event->dtStart().time()); | 198 | text = KGlobal::locale()->formatTime(event->dtStart().time()); |
199 | text += " " + event->summary(); | 199 | text += " " + event->summary(); |
200 | mToolTipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); | 200 | mToolTipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); |
201 | } | 201 | } |
202 | } | 202 | } |
203 | if ( !event->location().isEmpty() ) | 203 | if ( !event->location().isEmpty() ) |
204 | mToolTipText += " (" + event->location() + ")"; | 204 | mToolTipText += " (" + event->location() + ")"; |
205 | #if QT_VERSION >= 0x030000 | 205 | #if QT_VERSION >= 0x030000 |
206 | mToolTipText.replace( '<' , "<" ); | 206 | mToolTipText.replace( '<' , "<" ); |
207 | mToolTipText.replace( '>' , ">" ); | 207 | mToolTipText.replace( '>' , ">" ); |
208 | #else | 208 | #else |
209 | if ( mToolTipText.find ('<') >= 0 ) { | 209 | if ( mToolTipText.find ('<') >= 0 ) { |
210 | mToolTipText.replace( QRegExp("<") , "<" ); | 210 | mToolTipText.replace( QRegExp("<") , "<" ); |
211 | } | 211 | } |
212 | if ( mToolTipText.find ('>') >= 0 ) { | 212 | if ( mToolTipText.find ('>') >= 0 ) { |
213 | mToolTipText.replace( QRegExp(">") , ">" ); | 213 | mToolTipText.replace( QRegExp(">") , ">" ); |
214 | } | 214 | } |
215 | #endif | 215 | #endif |
216 | //qDebug("TTT: %s ", mToolTipText.latin1()); | 216 | //qDebug("TTT: %s ", mToolTipText.latin1()); |
217 | mToolTip.append( mToolTipText ); | 217 | mToolTip.append( mToolTipText ); |
218 | } | 218 | } |
219 | mToolTip.sort(); | 219 | mToolTip.sort(); |
220 | return "<b>"+KGlobal::locale()->formatDate(days[tmp]) + "</b><br>" + mToolTip.join("<br>"); | 220 | return "<b>"+KGlobal::locale()->formatDate(days[tmp]) + "</b><br>" + mToolTip.join("<br>"); |
221 | } | 221 | } |
222 | void KODayMatrix::setCalendar( Calendar *cal ) | 222 | void KODayMatrix::setCalendar( Calendar *cal ) |
223 | { | 223 | { |
224 | mCalendar = cal; | 224 | mCalendar = cal; |
225 | 225 | ||
226 | setAcceptDrops( mCalendar ); | 226 | setAcceptDrops( mCalendar ); |
227 | 227 | ||
228 | updateEvents(); | 228 | updateEvents(); |
229 | } | 229 | } |
230 | 230 | ||
231 | QColor KODayMatrix::getShadedColor(QColor color) | 231 | QColor KODayMatrix::getShadedColor(QColor color) |
232 | { | 232 | { |
233 | QColor shaded; | 233 | QColor shaded; |
234 | int h=0; | 234 | int h=0; |
235 | int s=0; | 235 | int s=0; |
236 | int v=0; | 236 | int v=0; |
237 | color.hsv(&h,&s,&v); | 237 | color.hsv(&h,&s,&v); |
238 | s = s/4; | 238 | s = s/4; |
239 | v = 192+v/4; | 239 | v = 192+v/4; |
240 | shaded.setHsv(h,s,v); | 240 | shaded.setHsv(h,s,v); |
241 | 241 | ||
242 | return shaded; | 242 | return shaded; |
243 | } | 243 | } |
244 | 244 | ||
245 | KODayMatrix::~KODayMatrix() | 245 | KODayMatrix::~KODayMatrix() |
246 | { | 246 | { |
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; |
443 | bool ok; | 443 | bool ok; |
444 | incidenceStart = event->getNextOccurence( incidenceStart.addSecs( 1 ) ,&ok ); | 444 | incidenceStart = event->getNextOccurence( incidenceStart.addSecs( 1 ) ,&ok ); |
445 | if ( ! ok ) | 445 | if ( ! ok ) |
446 | break; | 446 | break; |
447 | if ( incidenceStart.date() > endDate ) | 447 | if ( incidenceStart.date() > endDate ) |
448 | break; | 448 | break; |
449 | } | 449 | } |
450 | } else { // no recur | 450 | } else { // no recur |
451 | int st = event->dtStart().date().daysTo( endDate ); | 451 | int st = event->dtStart().date().daysTo( endDate ); |
452 | if ( st >= 0 ) { // start before timeend | 452 | if ( st >= 0 ) { // start before timeend |
453 | int end = mStartDate.daysTo( event->dtEnd().date() ); | 453 | int end = mStartDate.daysTo( event->dtEnd().date() ); |
454 | if ( end >= 0 ) { // end after timestart --- got one! | 454 | if ( end >= 0 ) { // end after timestart --- got one! |
455 | //normalize | 455 | //normalize |
456 | st = timeSpan - st; | 456 | st = timeSpan - st; |
457 | if ( st < 0 ) st = 0; | 457 | if ( st < 0 ) st = 0; |
458 | if ( end > timeSpan ) end = timeSpan; | 458 | if ( end > timeSpan ) end = timeSpan; |
459 | int iii; | 459 | int iii; |
460 | for ( iii = st;iii<= end;++iii) | 460 | for ( iii = st;iii<= end;++iii) |
461 | computeEvent( event, iii ); | 461 | computeEvent( event, iii ); |
462 | } | 462 | } |
463 | } | 463 | } |
464 | } | 464 | } |
465 | } | 465 | } |
466 | int startDay = days[0].dayOfWeek(); // 1...7 7 = sunday | 466 | int startDay = days[0].dayOfWeek(); // 1...7 7 = sunday |
467 | for(i = 0; i < NUMDAYS; i++) { | 467 | for(i = 0; i < NUMDAYS; i++) { |
468 | if ( ( (i+startDay) % 7 == 0 ) ) { | 468 | if ( ( (i+startDay) % 7 == 0 ) ) { |
469 | pDays.setBit(i); | 469 | pDays.setBit(i); |
470 | } | 470 | } |
471 | } | 471 | } |
472 | 472 | ||
473 | #if 0 | 473 | #if 0 |
474 | // insert due todos | 474 | // insert due todos |
475 | QPtrList<Todo> todos = calendar()->todos( ); | 475 | QPtrList<Todo> todos = calendar()->todos( ); |
476 | Todo *todo; | 476 | Todo *todo; |
477 | for(todo = todos.first(); todo; todo = todos.next()) { | 477 | for(todo = todos.first(); todo; todo = todos.next()) { |
478 | //insertTodo( todo ); | 478 | //insertTodo( todo ); |
479 | if ( todo->hasDueDate() ) { | 479 | if ( todo->hasDueDate() ) { |
480 | int day = mStartDate.daysTo( todo->dtDue().date() ); | 480 | int day = mStartDate.daysTo( todo->dtDue().date() ); |
481 | if ( day >= 0 && day < timeSpan + 1) { | 481 | if ( day >= 0 && day < timeSpan + 1) { |
482 | (*cells)[day]->insertTodo( todo ); | 482 | (*cells)[day]->insertTodo( todo ); |
483 | } | 483 | } |
484 | } | 484 | } |
485 | } | 485 | } |
486 | #endif | 486 | #endif |
487 | 487 | ||
488 | #else | 488 | #else |
489 | //qDebug("KODayMatrix::updateViewTimed "); | 489 | //qDebug("KODayMatrix::updateViewTimed "); |
490 | for(int i = 0; i < NUMDAYS; i++) { | 490 | for(int i = 0; i < NUMDAYS; i++) { |
491 | // if events are set for the day then remember to draw it bold | 491 | // if events are set for the day then remember to draw it bold |
492 | QPtrList<Event> eventlist = mCalendar->events(days[i]); | 492 | QPtrList<Event> eventlist = mCalendar->events(days[i]); |
493 | Event *event; | 493 | Event *event; |
494 | int numEvents = eventlist.count(); | 494 | int numEvents = eventlist.count(); |
495 | QString holiStr = ""; | 495 | QString holiStr = ""; |
496 | bDays.clearBit(i); | 496 | bDays.clearBit(i); |
497 | hDays.clearBit(i); | 497 | hDays.clearBit(i); |
498 | eDays.clearBit(i); | 498 | eDays.clearBit(i); |
499 | for(event=eventlist.first();event != 0;event=eventlist.next()) { | 499 | for(event=eventlist.first();event != 0;event=eventlist.next()) { |
500 | qDebug("FFFFFFFFFFFFFFFFFFFFFFFFF "); | 500 | qDebug("FFFFFFFFFFFFFFFFFFFFFFFFF "); |
501 | ushort recurType = event->recurrence()->doesRecur(); | 501 | ushort recurType = event->recurrence()->doesRecur(); |
502 | if ((recurType == Recurrence::rDaily && !KOPrefs::instance()->mDailyRecur) || | 502 | if ((recurType == Recurrence::rDaily && !KOPrefs::instance()->mDailyRecur) || |
503 | (recurType == Recurrence::rWeekly && !KOPrefs::instance()->mWeeklyRecur)) { | 503 | (recurType == Recurrence::rWeekly && !KOPrefs::instance()->mWeeklyRecur)) { |
504 | numEvents--; | 504 | numEvents--; |
505 | } | 505 | } |
506 | if ( event->isHoliday()) { | 506 | if ( event->isHoliday()) { |
507 | hDays.setBit(i); | 507 | hDays.setBit(i); |
508 | if ( !holiStr.isEmpty() ) | 508 | if ( !holiStr.isEmpty() ) |
509 | holiStr += "\n"; | 509 | holiStr += "\n"; |
510 | holiStr += event->summary(); | 510 | holiStr += event->summary(); |
511 | if ( !event->location().isEmpty() ) | 511 | if ( !event->location().isEmpty() ) |
512 | holiStr += " (" + event->location() + ")"; | 512 | holiStr += " (" + event->location() + ")"; |
513 | } | 513 | } |
514 | if ( event->isBirthday()) { | 514 | if ( event->isBirthday()) { |
515 | if ( !holiStr.isEmpty() ) | 515 | if ( !holiStr.isEmpty() ) |
516 | holiStr += "\n"; | 516 | holiStr += "\n"; |
517 | holiStr += i18n("Birthday") + ": "+event->summary(); | 517 | holiStr += i18n("Birthday") + ": "+event->summary(); |
518 | if ( !event->location().isEmpty() ) | 518 | if ( !event->location().isEmpty() ) |
519 | holiStr += " (" + event->location() + ")"; | 519 | holiStr += " (" + event->location() + ")"; |
520 | bDays.setBit(i); | 520 | bDays.setBit(i); |
521 | } | 521 | } |
522 | } | 522 | } |
523 | if ( numEvents ) | 523 | if ( numEvents ) |
524 | eDays.setBit(i); | 524 | eDays.setBit(i); |
525 | //if it is a holy day then draw it red. Sundays are consider holidays, too | 525 | //if it is a holy day then draw it red. Sundays are consider holidays, too |
526 | if ( (KOGlobals::self()->calendarSystem()->dayOfWeek(days[i]) == KOGlobals::self()->calendarSystem()->weekDayOfPray()) || | 526 | if ( (KOGlobals::self()->calendarSystem()->dayOfWeek(days[i]) == KOGlobals::self()->calendarSystem()->weekDayOfPray()) || |
527 | !holiStr.isEmpty()) { | 527 | !holiStr.isEmpty()) { |
528 | mHolidays[i] = holiStr; | 528 | mHolidays[i] = holiStr; |
529 | } else { | 529 | } else { |
530 | mHolidays[i] = QString::null; | 530 | mHolidays[i] = QString::null; |
531 | } | 531 | } |
532 | } | 532 | } |
533 | #endif | 533 | #endif |
534 | mRedrawNeeded = true; | 534 | mRedrawNeeded = true; |
535 | if ( ! mPendingUpdateBeforeRepaint ) | 535 | if ( ! mPendingUpdateBeforeRepaint ) |
536 | repaint(false); | 536 | repaint(false); |
537 | } | 537 | } |
538 | void KODayMatrix::updateView(QDate actdate) | 538 | void KODayMatrix::updateView(QDate actdate) |
539 | { | 539 | { |
540 | 540 | ||
541 | if ( ! actdate.isValid() ) { | 541 | if ( ! actdate.isValid() ) { |
542 | //qDebug("date not valid "); | 542 | //qDebug("date not valid "); |
543 | return; | 543 | return; |
544 | } | 544 | } |
545 | mDayChanged = false; | 545 | mDayChanged = false; |
546 | //flag to indicate if the starting day of the matrix has changed by this call | 546 | //flag to indicate if the starting day of the matrix has changed by this call |
547 | //mDayChanged = false; | 547 | //mDayChanged = false; |
548 | // if a new startdate is to be set then apply Cornelius's calculation | 548 | // if a new startdate is to be set then apply Cornelius's calculation |
549 | // of the first day to be shown | 549 | // of the first day to be shown |
550 | if (actdate != startdate) { | 550 | if (actdate != startdate) { |
551 | // reset index of selection according to shift of starting date from startdate to actdate | 551 | // reset index of selection according to shift of starting date from startdate to actdate |
552 | if (mSelStart != NOSELECTION) { | 552 | if (mSelStart != NOSELECTION) { |
553 | int tmp = actdate.daysTo(startdate); | 553 | int tmp = actdate.daysTo(startdate); |
554 | //kdDebug() << "Shift of Selection1: " << mSelStart << " - " << mSelEnd << " -> " << tmp << "(" << offset << ")" << endl; | 554 | //kdDebug() << "Shift of Selection1: " << mSelStart << " - " << mSelEnd << " -> " << tmp << "(" << offset << ")" << endl; |
555 | // shift selection if new one would be visible at least partly ! | 555 | // shift selection if new one would be visible at least partly ! |
556 | 556 | ||
557 | if (mSelStart+tmp < NUMDAYS && mSelEnd+tmp >= 0) { | 557 | if (mSelStart+tmp < NUMDAYS && mSelEnd+tmp >= 0) { |
558 | // nested if is required for next X display pushed from a different month - correction required | 558 | // nested if is required for next X display pushed from a different month - correction required |
559 | // otherwise, for month forward and backward, it must be avoided | 559 | // otherwise, for month forward and backward, it must be avoided |
560 | if( mSelStart > NUMDAYS || mSelStart < 0 ) | 560 | if( mSelStart > NUMDAYS || mSelStart < 0 ) |
561 | mSelStart = mSelStart + tmp; | 561 | mSelStart = mSelStart + tmp; |
562 | if( mSelEnd > NUMDAYS || mSelEnd < 0 ) | 562 | if( mSelEnd > NUMDAYS || mSelEnd < 0 ) |
563 | mSelEnd = mSelEnd + tmp; | 563 | mSelEnd = mSelEnd + tmp; |
564 | } | 564 | } |
565 | } | 565 | } |
566 | startdate = actdate; | 566 | startdate = actdate; |
567 | mDayChanged = true; | 567 | mDayChanged = true; |
568 | recalculateToday(); | 568 | recalculateToday(); |
569 | mRedrawNeeded = true; | 569 | mRedrawNeeded = true; |
570 | } | 570 | } |
571 | //qDebug("restart Timer %d vis: %d", mDayChanged, isVisible() ); | 571 | //qDebug("restart Timer %d vis: %d", mDayChanged, isVisible() ); |
572 | if ( !isVisible() ) { | 572 | if ( !isVisible() ) { |
573 | mPendingUpdateBeforeRepaint = true; | 573 | mPendingUpdateBeforeRepaint = true; |
574 | } else { | 574 | } else { |
575 | #ifdef DESKTOP_VERSION | 575 | #ifdef DESKTOP_VERSION |
576 | //mRepaintTimer->start( 100 ); | 576 | //mRepaintTimer->start( 100 ); |
577 | //updateViewTimed(); | 577 | //updateViewTimed(); |
578 | mUpdateTimer->start( 50 ); | 578 | mUpdateTimer->start( 50 ); |
579 | #else | 579 | #else |
580 | mRepaintTimer->start( 350 ); | 580 | mRepaintTimer->start( 350 ); |
581 | mUpdateTimer->start( 800 ); | 581 | mUpdateTimer->start( 800 ); |
582 | #endif | 582 | #endif |
583 | } | 583 | } |
584 | } | 584 | } |
585 | void KODayMatrix::updateEvents() | 585 | void KODayMatrix::updateEvents() |
586 | { | 586 | { |
587 | if ( !mCalendar ) return; | 587 | if ( !mCalendar ) return; |
588 | 588 | ||
589 | for( int i = 0; i < NUMDAYS; i++ ) { | 589 | for( int i = 0; i < NUMDAYS; i++ ) { |
590 | // if events are set for the day then remember to draw it bold | 590 | // if events are set for the day then remember to draw it bold |
591 | QPtrList<Event> eventlist = mCalendar->events( days[ i ] ); | 591 | QPtrList<Event> eventlist = mCalendar->events( days[ i ] ); |
592 | int numEvents = eventlist.count(); | 592 | int numEvents = eventlist.count(); |
593 | Event *event; | 593 | Event *event; |
594 | for( event = eventlist.first(); event != 0;event=eventlist.next()) { | 594 | for( event = eventlist.first(); event != 0;event=eventlist.next()) { |
595 | ushort recurType = event->doesRecur(); | 595 | ushort recurType = event->doesRecur(); |
596 | 596 | ||
597 | if ( ( recurType == Recurrence::rDaily && | 597 | if ( ( recurType == Recurrence::rDaily && |
598 | !KOPrefs::instance()->mDailyRecur ) || | 598 | !KOPrefs::instance()->mDailyRecur ) || |
599 | ( recurType == Recurrence::rWeekly && | 599 | ( recurType == Recurrence::rWeekly && |
600 | !KOPrefs::instance()->mWeeklyRecur ) ) { | 600 | !KOPrefs::instance()->mWeeklyRecur ) ) { |
601 | numEvents--; | 601 | numEvents--; |
602 | } | 602 | } |
603 | } | 603 | } |
604 | if ( numEvents ) | 604 | if ( numEvents ) |
605 | eDays.setBit(i); | 605 | eDays.setBit(i); |
606 | else | 606 | else |
607 | eDays.clearBit(i); | 607 | eDays.clearBit(i); |
608 | } | 608 | } |
609 | } | 609 | } |
610 | 610 | ||
611 | const QDate& KODayMatrix::getDate(int offset) | 611 | const QDate& KODayMatrix::getDate(int offset) |
612 | { | 612 | { |
613 | if (offset < 0 || offset > NUMDAYS-1) { | 613 | if (offset < 0 || offset > NUMDAYS-1) { |
614 | qDebug("Wrong offset2 %d", offset); | 614 | qDebug("Wrong offset2 %d", offset); |
615 | return days[0]; | 615 | return days[0]; |
616 | } | 616 | } |
617 | return days[offset]; | 617 | return days[offset]; |
618 | } | 618 | } |
619 | 619 | ||
620 | QString KODayMatrix::getHolidayLabel(int offset) | 620 | QString KODayMatrix::getHolidayLabel(int offset) |
621 | { | 621 | { |
622 | if (offset < 0 || offset > NUMDAYS-1) { | 622 | if (offset < 0 || offset > NUMDAYS-1) { |
623 | qDebug("Wrong offset1 %d", offset); | 623 | qDebug("Wrong offset1 %d", offset); |
624 | return QString(); | 624 | return QString(); |
625 | } | 625 | } |
626 | return mHolidays[offset]; | 626 | return mHolidays[offset]; |
627 | } | 627 | } |
628 | 628 | ||
629 | int KODayMatrix::getDayIndexFrom(int x, int y) | 629 | int KODayMatrix::getDayIndexFrom(int x, int y) |
630 | { | 630 | { |
631 | int colModulo = (width()-2) % 7; | 631 | int colModulo = (width()-2) % 7; |
632 | int rowModulo = (height()-2) % 6; | 632 | int rowModulo = (height()-2) % 6; |
633 | #if 0 | 633 | #if 0 |
634 | return 7*(y/daysize.height()) + (KOGlobals::self()->reverseLayout() ? | 634 | return 7*(y/daysize.height()) + (KOGlobals::self()->reverseLayout() ? |
635 | 6 - x/daysize.width() : x/daysize.width()); | 635 | 6 - x/daysize.width() : x/daysize.width()); |
636 | #endif | 636 | #endif |
637 | int xVal = (x-colModulo/2-2)/daysize.width(); | 637 | int xVal = (x-colModulo/2-2)/daysize.width(); |
638 | int yVal = (y-rowModulo/2-2)/daysize.height(); | 638 | int yVal = (y-rowModulo/2-2)/daysize.height(); |
639 | 639 | ||
640 | 640 | ||
641 | return 7*(yVal) + xVal; | 641 | return 7*(yVal) + xVal; |
642 | 642 | ||
643 | } | 643 | } |
644 | 644 | ||
645 | // ---------------------------------------------------------------------------- | 645 | // ---------------------------------------------------------------------------- |
646 | // M O U S E E V E N T H A N D L I N G | 646 | // M O U S E E V E N T H A N D L I N G |
647 | // ---------------------------------------------------------------------------- | 647 | // ---------------------------------------------------------------------------- |
648 | 648 | ||
649 | void KODayMatrix::mousePressEvent (QMouseEvent* e) | 649 | void KODayMatrix::mousePressEvent (QMouseEvent* e) |
650 | { | 650 | { |
651 | 651 | ||
652 | if ( e->button() == LeftButton ) | 652 | if ( e->button() == LeftButton ) |
653 | mouseDown = true; | 653 | mouseDown = true; |
654 | mSelStart = getDayIndexFrom(e->x(), e->y()); | 654 | mSelStart = getDayIndexFrom(e->x(), e->y()); |
655 | if (mSelStart > NUMDAYS-1) mSelStart=NUMDAYS-1; | 655 | if (mSelStart > NUMDAYS-1) mSelStart=NUMDAYS-1; |
656 | mSelInit = mSelStart; | 656 | mSelInit = mSelStart; |
657 | mSelEnd = mSelStart; | 657 | mSelEnd = mSelStart; |
658 | mRedrawNeeded = true; | 658 | mRedrawNeeded = true; |
659 | repaint(false); | 659 | repaint(false); |
660 | } | 660 | } |
661 | 661 | ||
662 | void KODayMatrix::mouseReleaseEvent (QMouseEvent* e) | 662 | void KODayMatrix::mouseReleaseEvent (QMouseEvent* e) |
663 | { | 663 | { |
664 | mRedrawNeeded = true; | 664 | mRedrawNeeded = true; |
665 | if ( e->button() == LeftButton ) | 665 | if ( e->button() == LeftButton ) |
666 | if ( ! mouseDown ) { | 666 | if ( ! mouseDown ) { |
667 | return; | 667 | return; |
668 | } | 668 | } |
669 | else | 669 | else |
670 | mouseDown = false; | 670 | mouseDown = false; |
671 | int tmp = getDayIndexFrom(e->x(), e->y()); | 671 | int tmp = getDayIndexFrom(e->x(), e->y()); |
672 | if (tmp > NUMDAYS-1) tmp=NUMDAYS-1; | 672 | if (tmp > NUMDAYS-1) tmp=NUMDAYS-1; |
673 | 673 | ||
674 | if (mSelInit > tmp) { | 674 | if (mSelInit > tmp) { |
675 | mSelEnd = mSelInit; | 675 | mSelEnd = mSelInit; |
676 | if (tmp != mSelStart) { | 676 | if (tmp != mSelStart) { |
677 | mSelStart = tmp; | 677 | mSelStart = tmp; |
678 | repaint(false); | 678 | repaint(false); |
679 | } | 679 | } |
680 | } else { | 680 | } else { |
681 | mSelStart = mSelInit; | 681 | mSelStart = mSelInit; |
682 | 682 | ||
683 | //repaint only if selection has changed | 683 | //repaint only if selection has changed |
684 | if (tmp != mSelEnd) { | 684 | if (tmp != mSelEnd) { |
685 | mSelEnd = tmp; | 685 | mSelEnd = tmp; |
686 | repaint(false); | 686 | repaint(false); |
687 | } | 687 | } |
688 | } | 688 | } |
689 | 689 | ||
690 | DateList daylist; | 690 | DateList daylist; |
691 | if ( mSelStart < 0 ) | 691 | if ( mSelStart < 0 ) |
692 | mSelStart = 0; | 692 | mSelStart = 0; |
693 | for (int i = mSelStart; i <= mSelEnd; i++) { | 693 | for (int i = mSelStart; i <= mSelEnd; i++) { |
694 | daylist.append(days[i]); | 694 | daylist.append(days[i]); |
695 | } | 695 | } |
696 | emit selected((const DateList)daylist); | 696 | emit selected((const DateList)daylist); |
697 | 697 | ||
698 | } | 698 | } |
699 | 699 | ||
700 | void KODayMatrix::mouseMoveEvent (QMouseEvent* e) | 700 | void KODayMatrix::mouseMoveEvent (QMouseEvent* e) |
701 | { | 701 | { |
702 | if ( ! mouseDown ) { | 702 | if ( ! mouseDown ) { |
703 | return; | 703 | return; |
704 | } | 704 | } |
705 | mRedrawNeeded = true; | 705 | mRedrawNeeded = true; |
706 | int tmp = getDayIndexFrom(e->x(), e->y()); | 706 | int tmp = getDayIndexFrom(e->x(), e->y()); |
707 | if (tmp > NUMDAYS-1) tmp=NUMDAYS-1; | 707 | if (tmp > NUMDAYS-1) tmp=NUMDAYS-1; |
708 | 708 | ||
709 | if (mSelInit > tmp) { | 709 | if (mSelInit > tmp) { |
710 | mSelEnd = mSelInit; | 710 | mSelEnd = mSelInit; |
711 | if (tmp != mSelStart) { | 711 | if (tmp != mSelStart) { |
712 | mSelStart = tmp; | 712 | mSelStart = tmp; |
713 | repaint(false); | 713 | repaint(false); |
714 | } | 714 | } |
715 | } else { | 715 | } else { |
716 | mSelStart = mSelInit; | 716 | mSelStart = mSelInit; |
717 | 717 | ||
718 | //repaint only if selection has changed | 718 | //repaint only if selection has changed |
719 | if (tmp != mSelEnd) { | 719 | if (tmp != mSelEnd) { |
720 | mSelEnd = tmp; | 720 | mSelEnd = tmp; |
721 | repaint(false); | 721 | repaint(false); |
722 | } | 722 | } |
723 | } | 723 | } |
724 | } | 724 | } |
725 | 725 | ||
726 | // ---------------------------------------------------------------------------- | 726 | // ---------------------------------------------------------------------------- |
727 | // D R A G ' N D R O P H A N D L I N G | 727 | // D R A G ' N D R O P H A N D L I N G |
728 | // ---------------------------------------------------------------------------- | 728 | // ---------------------------------------------------------------------------- |
729 | 729 | ||
730 | void KODayMatrix::dragEnterEvent(QDragEnterEvent *e) | 730 | void KODayMatrix::dragEnterEvent(QDragEnterEvent *e) |
731 | { | 731 | { |
732 | #ifndef KORG_NODND | 732 | #ifndef KORG_NODND |
733 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) ) { | 733 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) ) { |
734 | e->ignore(); | 734 | e->ignore(); |
735 | return; | 735 | return; |
736 | } | 736 | } |
737 | 737 | ||
738 | // some visual feedback | 738 | // some visual feedback |
739 | // oldPalette = palette(); | 739 | // oldPalette = palette(); |
740 | // setPalette(my_HilitePalette); | 740 | // setPalette(my_HilitePalette); |
741 | // update(); | 741 | // update(); |
742 | #endif | 742 | #endif |
743 | } | 743 | } |
744 | 744 | ||
745 | void KODayMatrix::dragMoveEvent(QDragMoveEvent *e) | 745 | void KODayMatrix::dragMoveEvent(QDragMoveEvent *e) |
746 | { | 746 | { |
747 | #ifndef KORG_NODND | 747 | #ifndef KORG_NODND |
748 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) ) { | 748 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) ) { |
749 | e->ignore(); | 749 | e->ignore(); |
750 | return; | 750 | return; |
751 | } | 751 | } |
752 | 752 | ||
753 | e->accept(); | 753 | e->accept(); |
754 | #endif | 754 | #endif |
755 | } | 755 | } |
756 | 756 | ||
757 | void KODayMatrix::dragLeaveEvent(QDragLeaveEvent */*dl*/) | 757 | void KODayMatrix::dragLeaveEvent(QDragLeaveEvent */*dl*/) |
758 | { | 758 | { |
759 | #ifndef KORG_NODND | 759 | #ifndef KORG_NODND |
760 | // setPalette(oldPalette); | 760 | // setPalette(oldPalette); |
761 | // update(); | 761 | // update(); |
762 | #endif | 762 | #endif |
763 | } | 763 | } |
764 | 764 | ||
765 | void KODayMatrix::dropEvent(QDropEvent *e) | 765 | void KODayMatrix::dropEvent(QDropEvent *e) |
766 | { | 766 | { |
767 | #ifndef KORG_NODND | 767 | #ifndef KORG_NODND |
768 | // kdDebug() << "KODayMatrix::dropEvent(e) begin" << endl; | 768 | // kdDebug() << "KODayMatrix::dropEvent(e) begin" << endl; |
769 | 769 | ||
770 | if (!mCalendar || !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) ) { | 770 | if (!mCalendar || !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) ) { |
771 | e->ignore(); | 771 | e->ignore(); |
772 | return; | 772 | return; |
773 | } | 773 | } |
774 | 774 | ||
775 | DndFactory factory( mCalendar ); | 775 | DndFactory factory( mCalendar ); |
776 | Event *event = factory.createDrop(e); | 776 | Event *event = factory.createDrop(e); |
777 | 777 | ||
778 | if (event) { | 778 | if (event) { |
779 | e->acceptAction(); | 779 | e->acceptAction(); |
780 | 780 | ||
781 | Event *existingEvent = mCalendar->event(event->uid()); | 781 | Event *existingEvent = mCalendar->event(event->uid()); |
782 | 782 | ||
783 | if(existingEvent) { | 783 | if(existingEvent) { |
784 | // uniquify event | 784 | // uniquify event |
785 | event->recreate(); | 785 | event->recreate(); |
786 | /* | 786 | /* |
787 | KMessageBox::sorry(this, | 787 | KMessageBox::sorry(this, |
788 | i18n("Event already exists in this calendar."), | 788 | i18n("Event already exists in this calendar."), |
789 | i18n("Drop Event")); | 789 | i18n("Drop Event")); |
790 | delete event; | 790 | delete event; |
791 | return; | 791 | return; |
792 | */ | 792 | */ |
793 | } | 793 | } |
794 | // kdDebug() << "Drop new Event" << endl; | 794 | // kdDebug() << "Drop new Event" << endl; |
795 | // Adjust date | 795 | // Adjust date |
796 | QDateTime start = event->dtStart(); | 796 | QDateTime start = event->dtStart(); |
797 | QDateTime end = event->dtEnd(); | 797 | QDateTime end = event->dtEnd(); |
798 | int duration = start.daysTo(end); | 798 | int duration = start.daysTo(end); |
799 | int idx = getDayIndexFrom(e->pos().x(), e->pos().y()); | 799 | int idx = getDayIndexFrom(e->pos().x(), e->pos().y()); |
800 | 800 | ||
801 | start.setDate(days[idx]); | 801 | start.setDate(days[idx]); |
802 | end.setDate(days[idx].addDays(duration)); | 802 | end.setDate(days[idx].addDays(duration)); |
803 | 803 | ||
804 | event->setDtStart(start); | 804 | event->setDtStart(start); |
805 | event->setDtEnd(end); | 805 | event->setDtEnd(end); |
806 | mCalendar->addEvent(event); | 806 | mCalendar->addEvent(event); |
807 | 807 | ||
808 | emit eventDropped(event); | 808 | emit eventDropped(event); |
809 | } else { | 809 | } else { |
810 | // kdDebug() << "KODayMatrix::dropEvent(): Event from drop not decodable" << endl; | 810 | // kdDebug() << "KODayMatrix::dropEvent(): Event from drop not decodable" << endl; |
811 | e->ignore(); | 811 | e->ignore(); |
812 | } | 812 | } |
813 | #endif | 813 | #endif |
814 | } | 814 | } |
815 | 815 | ||
816 | // ---------------------------------------------------------------------------- | 816 | // ---------------------------------------------------------------------------- |
817 | // P A I N T E V E N T H A N D L I N G | 817 | // P A I N T E V E N T H A N D L I N G |
818 | // ---------------------------------------------------------------------------- | 818 | // ---------------------------------------------------------------------------- |
819 | 819 | ||
820 | void KODayMatrix::paintEvent(QPaintEvent * pevent) | 820 | void KODayMatrix::paintEvent(QPaintEvent * pevent) |
821 | { | 821 | { |
822 | 822 | ||
823 | if ( width() <= 0 || height() <= 0 ) | 823 | if ( width() <= 0 || height() <= 0 ) |
824 | return; | 824 | return; |
825 | if ( mPendingUpdateBeforeRepaint ) { | 825 | if ( mPendingUpdateBeforeRepaint ) { |
826 | updateViewTimed(); | 826 | updateViewTimed(); |
827 | mPendingUpdateBeforeRepaint = false; | 827 | mPendingUpdateBeforeRepaint = false; |
828 | } | 828 | } |
829 | #if 0 | 829 | #if 0 |
830 | if ( myPix.width() != width() || myPix.height()!=height() ) { | 830 | if ( myPix.width() != width() || myPix.height()!=height() ) { |
831 | myPix.resize(size() ); | 831 | myPix.resize(size() ); |
832 | mRedrawNeeded = true; | 832 | mRedrawNeeded = true; |
833 | } | 833 | } |
834 | #endif | 834 | #endif |
835 | if ( oldW != width() || oldH !=height() ) | 835 | if ( oldW != width() || oldH !=height() ) |
836 | mRedrawNeeded = true; | 836 | mRedrawNeeded = true; |
837 | 837 | ||
838 | oldH = height() ; | 838 | oldH = height() ; |
839 | oldW = width(); | 839 | oldW = width(); |
840 | if ( myPix.width() < width() || myPix.height() < height() ) { | 840 | if ( myPix.width() < width() || myPix.height() < height() ) { |
841 | myPix.resize(size() ); | 841 | myPix.resize(size() ); |
842 | mRedrawNeeded = true; | 842 | mRedrawNeeded = true; |
843 | 843 | ||
844 | } | 844 | } |
845 | 845 | ||
846 | if ( mRedrawNeeded ) { | 846 | if ( mRedrawNeeded ) { |
847 | //qDebug("REDRAW "); | 847 | //qDebug("REDRAW "); |
848 | QPainter p(&myPix); | 848 | QPainter p(&myPix); |
849 | p.setFont(font()); | 849 | p.setFont(font()); |
850 | 850 | ||
851 | 851 | ||
852 | int dheight = daysize.height(); | 852 | int dheight = daysize.height(); |
853 | int dwidth = daysize.width(); | 853 | int dwidth = daysize.width(); |
854 | int row,col; | 854 | int row,col; |
855 | int selw, selh; | 855 | int selw, selh; |
856 | int xyOff = frameWidth(); | 856 | int xyOff = frameWidth(); |
857 | int colModulo = (width()-2) % 7; | 857 | int colModulo = (width()-2) % 7; |
858 | int rowModulo = (height()-2) % 6; | 858 | int rowModulo = (height()-2) % 6; |
859 | //qDebug("col %d row %d ",colModulo,rowModulo ); | 859 | //qDebug("col %d row %d ",colModulo,rowModulo ); |
860 | 860 | ||
861 | bool isRTL = KOGlobals::self()->reverseLayout(); | 861 | bool isRTL = KOGlobals::self()->reverseLayout(); |
862 | 862 | ||
863 | // draw background and topleft frame | 863 | // draw background and topleft frame |
864 | p.fillRect(0,0,width(),height(), mDefaultBackColor); | 864 | p.fillRect(0,0,width(),height(), mDefaultBackColor); |
865 | p.setPen(mDefaultTextColor); | 865 | p.setPen(mDefaultTextColor); |
866 | p.drawRect(0, 0, width(), height()); | 866 | p.drawRect(0, 0, width(), height()); |
867 | int mSelStartT = mSelStart; | 867 | int mSelStartT = mSelStart; |
868 | int mSelEndT = mSelEnd; | 868 | int mSelEndT = mSelEnd; |
869 | if ( mSelEndT >= NUMDAYS ) | 869 | if ( mSelEndT >= NUMDAYS ) |
870 | mSelEndT = NUMDAYS-1; | 870 | mSelEndT = NUMDAYS-1; |
871 | // draw selected days with highlighted background color | 871 | // draw selected days with highlighted background color |
872 | if (mSelStart != NOSELECTION) { | 872 | if (mSelStart != NOSELECTION) { |
873 | bool skip = false; | 873 | bool skip = false; |
874 | if ( ! mouseDown ) { | 874 | if ( ! mouseDown ) { |
875 | int mo = days[20].month(); | 875 | int mo = days[20].month(); |
876 | //qDebug("-- %d %d ", mSelStartT, mSelEndT); | 876 | //qDebug("-- %d %d ", mSelStartT, mSelEndT); |
877 | //qDebug("%d %d %d - d %d", mo, days[mSelStartT].month() , days[mSelEndT].month(), days[mSelEndT].day() ); | 877 | //qDebug("%d %d %d - d %d", mo, days[mSelStartT].month() , days[mSelEndT].month(), days[mSelEndT].day() ); |
878 | int startMo = days[mSelStartT].month(); | 878 | int startMo = days[mSelStartT].month(); |
879 | int endMo = days[mSelEndT].month(); | 879 | int endMo = days[mSelEndT].month(); |
880 | if ( startMo == 12 && mo == 1 && endMo <= 2 ) | 880 | if ( startMo == 12 && mo == 1 && endMo <= 2 ) |
881 | startMo = 1; | 881 | startMo = 1; |
882 | if ( endMo == 1 && mo == 12 ) | 882 | if ( endMo == 1 && mo == 12 ) |
883 | endMo = 12; | 883 | endMo = 12; |
884 | if ( mo == 12 && startMo == 1 ) | 884 | if ( mo == 12 && startMo == 1 ) |
885 | startMo = 13; | 885 | startMo = 13; |
886 | if ( (startMo > mo || endMo < mo) ) { | 886 | if ( (startMo > mo || endMo < mo) ) { |
887 | skip = true; | 887 | skip = true; |
888 | } else { | 888 | } else { |
889 | if ( days[mSelStartT].month() != mo ) { | 889 | if ( days[mSelStartT].month() != mo ) { |
890 | int add = days[mSelStartT].daysInMonth ()-days[mSelStartT].day(); | 890 | int add = days[mSelStartT].daysInMonth ()-days[mSelStartT].day(); |
891 | mSelStartT += add +1; | 891 | mSelStartT += add +1; |
892 | } | 892 | } |
893 | if ( days[mSelEndT].month() != mo ) { | 893 | if ( days[mSelEndT].month() != mo ) { |
894 | int sub = days[mSelEndT].day(); | 894 | int sub = days[mSelEndT].day(); |
895 | mSelEndT -= sub ; | 895 | mSelEndT -= sub ; |
896 | } | 896 | } |
897 | } | 897 | } |
898 | } | 898 | } |
899 | //qDebug("SKIP %d ", skip); | 899 | //qDebug("SKIP %d ", skip); |
900 | if ( ! skip ) { | 900 | if ( ! skip ) { |
901 | row = mSelStartT/7; | 901 | row = mSelStartT/7; |
902 | col = mSelStartT -row*7; | 902 | col = mSelStartT -row*7; |
903 | QColor selcol = KOPrefs::instance()->mHighlightColor; | 903 | QColor selcol = KOPrefs::instance()->mHighlightColor; |
904 | int addCol = 0; | 904 | int addCol = 0; |
905 | int addRow = 0; | 905 | int addRow = 0; |
906 | int addRow2 = 0; | 906 | int addRow2 = 0; |
907 | int addCol2 = 0; | 907 | int addCol2 = 0; |
908 | if (row == mSelEndT/7) { | 908 | if (row == mSelEndT/7) { |
909 | if ( rowModulo ) { | 909 | if ( rowModulo ) { |
910 | if ( row >= 6 - rowModulo ) | 910 | if ( row >= 6 - rowModulo ) |
911 | addRow = row - 5 + rowModulo; | 911 | addRow = row - 5 + rowModulo; |
912 | } | 912 | } |
913 | if ( colModulo ) { | 913 | if ( colModulo ) { |
914 | int colt1 = mSelEndT%7; | 914 | int colt1 = mSelEndT%7; |
915 | //qDebug("colt1 %d ", colt1 ); | 915 | //qDebug("colt1 %d ", colt1 ); |
916 | if ( colt1 >= 7 - colModulo ) | 916 | if ( colt1 >= 7 - colModulo ) |
917 | addCol = colt1 - 7 + colModulo+1; | 917 | addCol = colt1 - 7 + colModulo+1; |
918 | int colt = mSelStartT%7; | 918 | int colt = mSelStartT%7; |
919 | if ( colt >= 7 - colModulo ) | 919 | if ( colt >= 7 - colModulo ) |
920 | addCol2 = colt - 7 + colModulo; | 920 | addCol2 = colt - 7 + colModulo; |
921 | addCol -= addCol2; | 921 | addCol -= addCol2; |
922 | //qDebug("COL %d %d %d %d ",col , colt1 ,addCol ,addCol2 ); | 922 | //qDebug("COL %d %d %d %d ",col , colt1 ,addCol ,addCol2 ); |
923 | } | 923 | } |
924 | // Single row selection | 924 | // Single row selection |
925 | //if ( row == 0) | 925 | //if ( row == 0) |
926 | // addRow = 1; | 926 | // addRow = 1; |
927 | p.fillRect(isRTL ? (7 - (mSelEndT-mSelStartT+1) - col)*dwidth : col*dwidth+1+addCol2, | 927 | p.fillRect(isRTL ? (7 - (mSelEndT-mSelStartT+1) - col)*dwidth : col*dwidth+1+addCol2, |
928 | row*dheight+addRow, (mSelEndT-mSelStartT+1)*dwidth+addCol, dheight+1, selcol); | 928 | row*dheight+addRow, (mSelEndT-mSelStartT+1)*dwidth+addCol, dheight+1, selcol); |
929 | } else { | 929 | } else { |
930 | // draw first row to the right | 930 | // draw first row to the right |
931 | if ( colModulo ) { | 931 | if ( colModulo ) { |
932 | if ( col >= 7 - colModulo ) | 932 | if ( col >= 7 - colModulo ) |
933 | addCol2 = col - 7 + colModulo; | 933 | addCol2 = col - 7 + colModulo; |
934 | } | 934 | } |
935 | if ( rowModulo ) { | 935 | if ( rowModulo ) { |
936 | if ( row >= 6 - rowModulo ) | 936 | if ( row >= 6 - rowModulo ) |
937 | addRow = row - 5 + rowModulo; | 937 | addRow = row - 5 + rowModulo; |
938 | } | 938 | } |
939 | //if ( row == 0) | 939 | //if ( row == 0) |
940 | // addRow = 1; | 940 | // addRow = 1; |
941 | int drawWid = width()-(col*dwidth+1+addCol2)-1; | 941 | int drawWid = width()-(col*dwidth+1+addCol2)-1; |
942 | p.fillRect(isRTL ? 0 : col*dwidth+1+addCol2, row*dheight+addRow, drawWid, | 942 | p.fillRect(isRTL ? 0 : col*dwidth+1+addCol2, row*dheight+addRow, drawWid, |
943 | dheight+1, selcol); | 943 | dheight+1, selcol); |
944 | // draw full block till last line | 944 | // draw full block till last line |
945 | selh = mSelEndT/7-row; | 945 | selh = mSelEndT/7-row; |
946 | addRow = 0; | 946 | addRow = 0; |
947 | if ( rowModulo ) { | 947 | if ( rowModulo ) { |
948 | if ( mSelEndT/7 >= 6 - rowModulo ) | 948 | if ( mSelEndT/7 >= 6 - rowModulo ) |
949 | addRow = mSelEndT/7 - 5 + rowModulo; | 949 | addRow = mSelEndT/7 - 5 + rowModulo; |
950 | } | 950 | } |
951 | //qDebug("%d %d %d ",selh, row, addRow ); | 951 | //qDebug("%d %d %d ",selh, row, addRow ); |
952 | int addrow2 = addRow-selh+1; | 952 | int addrow2 = addRow-selh+1; |
953 | if ( addrow2 < 0 ) | 953 | if ( addrow2 < 0 ) |
954 | addrow2 = 0; | 954 | addrow2 = 0; |
955 | if (selh > 1) { | 955 | if (selh > 1) { |
956 | p.fillRect(1, (row+1)*dheight+addrow2, 7*dwidth+colModulo, (selh-1)*dheight+addRow,selcol); | 956 | p.fillRect(1, (row+1)*dheight+addrow2, 7*dwidth+colModulo, (selh-1)*dheight+addRow,selcol); |
957 | } | 957 | } |
958 | // draw last block from left to mSelEndT | 958 | // draw last block from left to mSelEndT |
959 | selw = mSelEndT-7*(mSelEndT/7)+1; | 959 | selw = mSelEndT-7*(mSelEndT/7)+1; |
960 | //qDebug("esl %d ",selw ); | 960 | //qDebug("esl %d ",selw ); |
961 | int add = 0; | 961 | int add = 0; |
962 | if ( colModulo ) { | 962 | if ( colModulo ) { |
963 | add = 7 - colModulo; | 963 | add = 7 - colModulo; |
964 | if ( selw > add ) | 964 | if ( selw > add ) |
965 | add = selw - add; | 965 | add = selw - add; |
966 | else | 966 | else |
967 | add = 0; | 967 | add = 0; |
968 | } | 968 | } |
969 | //qDebug("add %d ", add); | 969 | //qDebug("add %d ", add); |
970 | p.fillRect(isRTL ? (7-selw)*dwidth : 1, (row+selh)*dheight+addRow, | 970 | p.fillRect(isRTL ? (7-selw)*dwidth : 1, (row+selh)*dheight+addRow, |
971 | selw*dwidth+add, dheight+1, selcol); | 971 | selw*dwidth+add, dheight+1, selcol); |
972 | } | 972 | } |
973 | } | 973 | } |
974 | } | 974 | } |
975 | 975 | ||
976 | // iterate over all days in the matrix and draw the day label in appropriate colors | 976 | // iterate over all days in the matrix and draw the day label in appropriate colors |
977 | QColor actcol = mDefaultTextColorShaded; | 977 | QColor actcol = mDefaultTextColorShaded; |
978 | p.setPen(actcol); | 978 | p.setPen(actcol); |
979 | QPen tmppen; | 979 | QPen tmppen; |
980 | for(int i = 0; i < NUMDAYS; i++) { | 980 | for(int i = 0; i < NUMDAYS; i++) { |
981 | row = i/7; | 981 | row = i/7; |
982 | col = isRTL ? 6-(i-row*7) : i-row*7; | 982 | col = isRTL ? 6-(i-row*7) : i-row*7; |
983 | 983 | ||
984 | // if it is the first day of a month switch color from normal to shaded and vice versa | 984 | // if it is the first day of a month switch color from normal to shaded and vice versa |
985 | if ( KOGlobals::self()->calendarSystem()->day( days[i] ) == 1) { | 985 | if ( KOGlobals::self()->calendarSystem()->day( days[i] ) == 1) { |
986 | if (actcol == mDefaultTextColorShaded) { | 986 | if (actcol == mDefaultTextColorShaded) { |
987 | actcol = mDefaultTextColor; | 987 | actcol = mDefaultTextColor; |
988 | } else { | 988 | } else { |
989 | actcol = mDefaultTextColorShaded; | 989 | actcol = mDefaultTextColorShaded; |
990 | } | 990 | } |
991 | p.setPen(actcol); | 991 | p.setPen(actcol); |
992 | } | 992 | } |
993 | if (actcol == mDefaultTextColorShaded) { | 993 | if (actcol == mDefaultTextColorShaded) { |
994 | if ( ! mouseDown ) { | 994 | if ( ! mouseDown ) { |
995 | continue; | 995 | continue; |
996 | } | 996 | } |
997 | } | 997 | } |
998 | //Reset pen color after selected days block | 998 | //Reset pen color after selected days block |
999 | if (i == mSelEndT+1) { | 999 | if (i == mSelEndT+1) { |
1000 | p.setPen(actcol); | 1000 | p.setPen(actcol); |
1001 | } | 1001 | } |
1002 | 1002 | ||
1003 | // if today then draw rectangle around day | 1003 | // if today then draw rectangle around day |
1004 | if (today == i) { | 1004 | if (today == i) { |
1005 | tmppen = p.pen(); | 1005 | tmppen = p.pen(); |
1006 | QPen mTodayPen(p.pen()); | 1006 | QPen mTodayPen(p.pen()); |
1007 | if ( daysize.width() < 20 ) | 1007 | if ( daysize.width() < 20 ) |
1008 | mTodayPen.setWidth(1); | 1008 | mTodayPen.setWidth(1); |
1009 | else | 1009 | else |
1010 | mTodayPen.setWidth(mTodayMarginWidth); | 1010 | mTodayPen.setWidth(mTodayMarginWidth); |
1011 | //draw red rectangle for holidays | 1011 | //draw red rectangle for holidays |
1012 | if (pDays.testBit(i)) { | 1012 | if (pDays.testBit(i)) { |
1013 | if (actcol == mDefaultTextColor) { | 1013 | if (actcol == mDefaultTextColor) { |
1014 | mTodayPen.setColor(KOPrefs::instance()->mHolidayColor); | 1014 | mTodayPen.setColor(KOPrefs::instance()->mHolidayColor); |
1015 | } else { | 1015 | } else { |
1016 | mTodayPen.setColor(mHolidayColorShaded); | 1016 | mTodayPen.setColor(mHolidayColorShaded); |
1017 | } | 1017 | } |
1018 | } | 1018 | } |
1019 | //draw gray rectangle for today if in selection | 1019 | //draw gray rectangle for today if in selection |
1020 | if (i >= mSelStartT && i <= mSelEndT) { | 1020 | if (i >= mSelStartT && i <= mSelEndT) { |
1021 | QColor grey("grey"); | 1021 | QColor grey("grey"); |
1022 | mTodayPen.setColor(grey); | 1022 | mTodayPen.setColor(grey); |
1023 | } | 1023 | } |
1024 | p.setPen(mTodayPen); | 1024 | p.setPen(mTodayPen); |
1025 | 1025 | ||
1026 | 1026 | ||
1027 | int addCol = 0; | 1027 | int addCol = 0; |
1028 | int addRow = 0; | 1028 | int addRow = 0; |
1029 | if (rowModulo) { | 1029 | if (rowModulo) { |
1030 | if ( row >= 6 - rowModulo ) | 1030 | if ( row >= 6 - rowModulo ) |
1031 | addRow = row - 5 + rowModulo; | 1031 | addRow = row - 5 + rowModulo; |
1032 | } | 1032 | } |
1033 | if ( colModulo ) { | 1033 | if ( colModulo ) { |
1034 | if ( col >= 7 - colModulo ) | 1034 | if ( col >= 7 - colModulo ) |
1035 | addCol = col - 6 + colModulo-1; | 1035 | addCol = col - 6 + colModulo-1; |
1036 | } | 1036 | } |
1037 | 1037 | ||
1038 | addCol += 1; | 1038 | addCol += 1; |
1039 | if ( row == 0 ) | 1039 | if ( row == 0 ) |
1040 | addRow = 1; | 1040 | addRow = 1; |
1041 | p.drawRect(col*dwidth+addCol, row*dheight+addRow, dwidth+1, dheight+1); | 1041 | p.drawRect(col*dwidth+addCol, row*dheight+addRow, dwidth+1, dheight+1); |
1042 | p.setPen(tmppen); | 1042 | p.setPen(tmppen); |
1043 | } | 1043 | } |
1044 | 1044 | ||
1045 | // if any events are on that day then draw it using a bold font | 1045 | // if any events are on that day then draw it using a bold font |
1046 | if ( eDays.testBit(i) ) { | 1046 | if ( eDays.testBit(i) ) { |
1047 | QFont myFont = font(); | 1047 | QFont myFont = font(); |
1048 | myFont.setBold(true); | 1048 | myFont.setBold(true); |
1049 | p.setFont(myFont); | 1049 | p.setFont(myFont); |
1050 | } | 1050 | } |
1051 | 1051 | ||
1052 | // if it is a holiday then use the default holiday color | 1052 | // if it is a holiday then use the default holiday color |
1053 | if ( pDays.testBit(i)) { | 1053 | if ( pDays.testBit(i)) { |
1054 | if ( bDays.testBit(i) ) { | 1054 | if ( bDays.testBit(i) ) { |
1055 | if ( hDays.testBit(i) ) | 1055 | if ( hDays.testBit(i) ) |
1056 | p.setPen(QColor(Qt::green)); | 1056 | p.setPen(QColor(Qt::green)); |
1057 | else | 1057 | else |
1058 | p.setPen(QColor(Qt::green).dark()); | 1058 | p.setPen(QColor(Qt::green).dark()); |
1059 | } else { | 1059 | } else { |
1060 | if (actcol == mDefaultTextColor ) { | 1060 | if (actcol == mDefaultTextColor ) { |
1061 | p.setPen(KOPrefs::instance()->mHolidayColor); | 1061 | p.setPen(KOPrefs::instance()->mHolidayColor); |
1062 | } else { | 1062 | } else { |
1063 | p.setPen(mHolidayColorShaded); | 1063 | p.setPen(mHolidayColorShaded); |
1064 | } | 1064 | } |
1065 | } | 1065 | } |
1066 | } | 1066 | } |
1067 | 1067 | ||
1068 | // draw selected days with special color | 1068 | // draw selected days with special color |
1069 | // DO NOT specially highlight holidays in selection ! | 1069 | // DO NOT specially highlight holidays in selection ! |
1070 | if (i >= mSelStartT && i <= mSelEndT) { | 1070 | if (i >= mSelStartT && i <= mSelEndT) { |
1071 | ;//p.setPen(mSelectedDaysColor); | 1071 | ;//p.setPen(mSelectedDaysColor); |
1072 | } | 1072 | } |
1073 | 1073 | ||
1074 | int addCol = 0; | 1074 | int addCol = 0; |
1075 | int addRow = 0; | 1075 | int addRow = 0; |
1076 | if ( colModulo ) { | 1076 | if ( colModulo ) { |
1077 | if ( col >= 7 - colModulo ) | 1077 | if ( col >= 7 - colModulo ) |
1078 | addCol = col - 7 + colModulo; | 1078 | addCol = col - 7 + colModulo; |
1079 | } | 1079 | } |
1080 | if ( rowModulo ) { | 1080 | if ( rowModulo ) { |
1081 | if ( row >= 6 - rowModulo ) | 1081 | if ( row >= 6 - rowModulo ) |
1082 | addRow = row - 5 + rowModulo; | 1082 | addRow = row - 5 + rowModulo; |
1083 | } | 1083 | } |
1084 | //qDebug("add %d %d -- %d %d ", col, addCol, row, addRow); | 1084 | //qDebug("add %d %d -- %d %d ", col, addCol, row, addRow); |
1085 | ++addCol;//++addCol; | 1085 | ++addCol;//++addCol; |
1086 | if ( row == 0) | 1086 | if ( row == 0) |
1087 | addRow = 1; | 1087 | addRow = 1; |
1088 | p.drawText(col*dwidth+addCol, row*dheight+addRow, dwidth, dheight, | 1088 | p.drawText(col*dwidth+addCol, row*dheight+addRow, dwidth, dheight, |
1089 | Qt::AlignHCenter | Qt::AlignVCenter, daylbls[i]); | 1089 | Qt::AlignHCenter | Qt::AlignVCenter, daylbls[i]); |
1090 | 1090 | ||
1091 | // reset color to actual color | 1091 | // reset color to actual color |
1092 | if (pDays.testBit(i)) { | 1092 | if (pDays.testBit(i)) { |
1093 | p.setPen(actcol); | 1093 | p.setPen(actcol); |
1094 | } | 1094 | } |
1095 | // reset bold font to plain font | 1095 | // reset bold font to plain font |
1096 | if ( eDays.testBit(i)) { | 1096 | if ( eDays.testBit(i)) { |
1097 | QFont myFont = font(); | 1097 | QFont myFont = font(); |
1098 | myFont.setBold(false); | 1098 | myFont.setBold(false); |
1099 | p.setFont(myFont); | 1099 | p.setFont(myFont); |
1100 | } | 1100 | } |
1101 | } | 1101 | } |
1102 | } else { | 1102 | } else { |
1103 | //qDebug("NO redraw "); | 1103 | //qDebug("NO redraw "); |
1104 | } | 1104 | } |
1105 | 1105 | ||
1106 | bitBlt (this, pevent->rect().topLeft(), &myPix , pevent->rect() ,CopyROP); | 1106 | bitBlt (this, pevent->rect().topLeft(), &myPix , pevent->rect() ,CopyROP); |
1107 | mRedrawNeeded = false; | 1107 | mRedrawNeeded = false; |
1108 | } | 1108 | } |
1109 | 1109 | ||
1110 | // ---------------------------------------------------------------------------- | 1110 | // ---------------------------------------------------------------------------- |
1111 | // R E SI Z E E V E N T H A N D L I N G | 1111 | // R E SI Z E E V E N T H A N D L I N G |
1112 | // ---------------------------------------------------------------------------- | 1112 | // ---------------------------------------------------------------------------- |
1113 | 1113 | ||
1114 | void KODayMatrix::resizeEvent(QResizeEvent *) | 1114 | void KODayMatrix::resizeEvent(QResizeEvent *) |
1115 | { | 1115 | { |
1116 | QRect sz = frameRect(); | 1116 | QRect sz = frameRect(); |
1117 | daysize.setHeight(sz.height()*7 / NUMDAYS); | 1117 | daysize.setHeight(sz.height()*7 / NUMDAYS); |
1118 | daysize.setWidth(sz.width() / 7); | 1118 | daysize.setWidth(sz.width() / 7); |
1119 | } | 1119 | } |
1120 | 1120 | ||
1121 | QSize KODayMatrix::sizeHint() const | 1121 | QSize KODayMatrix::sizeHint() const |
1122 | { | 1122 | { |
1123 | 1123 | ||
1124 | QFontMetrics fm ( font() ); | 1124 | QFontMetrics fm ( font() ); |
1125 | int wid = fm.width( "30") *7+3; | 1125 | int wid = fm.width( "30") *7+3; |
1126 | int hei = fm.height() * 6+3; | 1126 | int hei = fm.height() * 6+3; |
1127 | //qDebug("KODayMatrix::sizeHint()********************* %d %d", wid , hei); | 1127 | //qDebug("KODayMatrix::sizeHint()********************* %d %d", wid , hei); |
1128 | return QSize ( wid, hei ); | 1128 | return QSize ( wid, hei ); |
1129 | 1129 | ||
1130 | } | 1130 | } |
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,1724 +1,1723 @@ | |||
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 | ||
175 | } | 175 | } |
176 | 176 | ||
177 | void KOPrefsDialog::setupLocaleTab() | 177 | void KOPrefsDialog::setupLocaleTab() |
178 | { | 178 | { |
179 | #if 0 | 179 | #if 0 |
180 | QFrame *topFrame = addPage(i18n("Locale"),0,0); | 180 | QFrame *topFrame = addPage(i18n("Locale"),0,0); |
181 | QGridLayout *topLayout = new QGridLayout(topFrame,4,2); | 181 | QGridLayout *topLayout = new QGridLayout(topFrame,4,2); |
182 | topLayout->setSpacing(mSpacingHint); | 182 | topLayout->setSpacing(mSpacingHint); |
183 | topLayout->setMargin(mMarginHint); | 183 | topLayout->setMargin(mMarginHint); |
184 | int iii = 0; | 184 | int iii = 0; |
185 | KPrefsDialogWidRadios *syncPrefsGroup = | 185 | KPrefsDialogWidRadios *syncPrefsGroup = |
186 | addWidRadios(i18n("Language:(needs restart)"),&(KOPrefs::instance()->mPreferredLanguage),topFrame); | 186 | addWidRadios(i18n("Language:(needs restart)"),&(KOPrefs::instance()->mPreferredLanguage),topFrame); |
187 | syncPrefsGroup->addRadio(i18n("English")); | 187 | syncPrefsGroup->addRadio(i18n("English")); |
188 | syncPrefsGroup->addRadio(i18n("German")); | 188 | syncPrefsGroup->addRadio(i18n("German")); |
189 | syncPrefsGroup->addRadio(i18n("French")); | 189 | syncPrefsGroup->addRadio(i18n("French")); |
190 | syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)")); | 190 | syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)")); |
191 | if ( QApplication::desktop()->width() < 300 ) | 191 | if ( QApplication::desktop()->width() < 300 ) |
192 | ;// syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); | 192 | ;// syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); |
193 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); | 193 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); |
194 | ++iii; | 194 | ++iii; |
195 | 195 | ||
196 | syncPrefsGroup = | 196 | syncPrefsGroup = |
197 | addWidRadios(i18n("Time Format(nr):"),&(KOPrefs::instance()->mPreferredTime),topFrame); | 197 | addWidRadios(i18n("Time Format(nr):"),&(KOPrefs::instance()->mPreferredTime),topFrame); |
198 | if ( QApplication::desktop()->width() > 300 ) | 198 | if ( QApplication::desktop()->width() > 300 ) |
199 | syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); | 199 | syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); |
200 | syncPrefsGroup->addRadio(i18n("24:00")); | 200 | syncPrefsGroup->addRadio(i18n("24:00")); |
201 | syncPrefsGroup->addRadio(i18n("12:00am")); | 201 | syncPrefsGroup->addRadio(i18n("12:00am")); |
202 | syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); | 202 | syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); |
203 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); | 203 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); |
204 | ++iii; | 204 | ++iii; |
205 | KPrefsDialogWidBool *sb; | 205 | KPrefsDialogWidBool *sb; |
206 | if ( QApplication::desktop()->width() < 300 ) { | 206 | if ( QApplication::desktop()->width() < 300 ) { |
207 | sb = | 207 | sb = |
208 | addWidBool(i18n("Week starts on Sunday"), | 208 | addWidBool(i18n("Week starts on Sunday"), |
209 | &(KOPrefs::instance()->mWeekStartsOnSunday),topFrame); | 209 | &(KOPrefs::instance()->mWeekStartsOnSunday),topFrame); |
210 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); | 210 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); |
211 | ++iii; | 211 | ++iii; |
212 | sb = | 212 | sb = |
213 | addWidBool(i18n("Use short date in (WN/E) view"), | 213 | addWidBool(i18n("Use short date in (WN/E) view"), |
214 | &(KOPrefs::instance()->mShortDateInViewer),topFrame); | 214 | &(KOPrefs::instance()->mShortDateInViewer),topFrame); |
215 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); | 215 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); |
216 | } | 216 | } |
217 | else { | 217 | else { |
218 | QWidget * hb = new QWidget( topFrame ); | 218 | QWidget * hb = new QWidget( topFrame ); |
219 | QHBoxLayout *hbLayout = new QHBoxLayout(hb); | 219 | QHBoxLayout *hbLayout = new QHBoxLayout(hb); |
220 | sb = | 220 | sb = |
221 | addWidBool(i18n("Week starts on Sunday"), | 221 | addWidBool(i18n("Week starts on Sunday"), |
222 | &(KOPrefs::instance()->mWeekStartsOnSunday),hb); | 222 | &(KOPrefs::instance()->mWeekStartsOnSunday),hb); |
223 | hbLayout->addWidget(sb->checkBox() ); | 223 | hbLayout->addWidget(sb->checkBox() ); |
224 | sb = | 224 | sb = |
225 | addWidBool(i18n("Use short date in (WN/E) view"), | 225 | addWidBool(i18n("Use short date in (WN/E) view"), |
226 | &(KOPrefs::instance()->mShortDateInViewer),hb); | 226 | &(KOPrefs::instance()->mShortDateInViewer),hb); |
227 | hbLayout->addWidget(sb->checkBox() ); | 227 | hbLayout->addWidget(sb->checkBox() ); |
228 | topLayout->addMultiCellWidget(hb, iii,iii,0,1); | 228 | topLayout->addMultiCellWidget(hb, iii,iii,0,1); |
229 | 229 | ||
230 | } | 230 | } |
231 | // KPrefsDialogWidBool *sb; //#ifndef DESKTOP_VERSION | 231 | // KPrefsDialogWidBool *sb; //#ifndef DESKTOP_VERSION |
232 | #if 0 | 232 | #if 0 |
233 | ++iii; | 233 | ++iii; |
234 | sb = | 234 | sb = |
235 | addWidBool(i18n("Quick load/save (w/o Unicode)"), | 235 | addWidBool(i18n("Quick load/save (w/o Unicode)"), |
236 | &(KOPrefs::instance()->mUseQuicksave),topFrame); | 236 | &(KOPrefs::instance()->mUseQuicksave),topFrame); |
237 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); | 237 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); |
238 | #endif | 238 | #endif |
239 | #endif | 239 | #endif |
240 | } | 240 | } |
241 | void KOPrefsDialog::showSyncPage() | 241 | void KOPrefsDialog::showSyncPage() |
242 | { | 242 | { |
243 | showPage ( 0 ) ; | 243 | showPage ( 0 ) ; |
244 | kdelibcfg->showTimeZoneTab() ; | 244 | kdelibcfg->showTimeZoneTab() ; |
245 | 245 | ||
246 | } | 246 | } |
247 | void KOPrefsDialog::setupSyncAlgTab() | 247 | void KOPrefsDialog::setupSyncAlgTab() |
248 | { | 248 | { |
249 | #if 0 | 249 | #if 0 |
250 | QLabel * lab; | 250 | QLabel * lab; |
251 | QFrame *topFrame = addPage(i18n("Sync Prefs"),0,0); | 251 | QFrame *topFrame = addPage(i18n("Sync Prefs"),0,0); |
252 | mSetupSyncAlgTab = topFrame; | 252 | mSetupSyncAlgTab = topFrame; |
253 | QGridLayout *topLayout = new QGridLayout(topFrame,6,2); | 253 | QGridLayout *topLayout = new QGridLayout(topFrame,6,2); |
254 | topLayout->setSpacing(mSpacingHint); | 254 | topLayout->setSpacing(mSpacingHint); |
255 | topLayout->setMargin(mMarginHint); | 255 | topLayout->setMargin(mMarginHint); |
256 | int iii = 0; | 256 | int iii = 0; |
257 | 257 | ||
258 | KPrefsDialogWidBool *sb = | 258 | KPrefsDialogWidBool *sb = |
259 | addWidBool(i18n("Ask for preferences before syncing"), | 259 | addWidBool(i18n("Ask for preferences before syncing"), |
260 | &(KOPrefs::instance()->mAskForPreferences),topFrame); | 260 | &(KOPrefs::instance()->mAskForPreferences),topFrame); |
261 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); | 261 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); |
262 | 262 | ||
263 | ++iii; | 263 | ++iii; |
264 | 264 | ||
265 | KPrefsDialogWidRadios *syncPrefsGroup = | 265 | KPrefsDialogWidRadios *syncPrefsGroup = |
266 | addWidRadios(i18n("Sync preferences:"),&(KOPrefs::instance()->mSyncAlgoPrefs), | 266 | addWidRadios(i18n("Sync preferences:"),&(KOPrefs::instance()->mSyncAlgoPrefs), |
267 | topFrame); | 267 | topFrame); |
268 | syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); | 268 | syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); |
269 | syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); | 269 | syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); |
270 | syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); | 270 | syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); |
271 | syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); | 271 | syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); |
272 | syncPrefsGroup->addRadio(i18n("Force take local entry always")); | 272 | syncPrefsGroup->addRadio(i18n("Force take local entry always")); |
273 | syncPrefsGroup->addRadio(i18n("Force take remote entry always")); | 273 | syncPrefsGroup->addRadio(i18n("Force take remote entry always")); |
274 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); | 274 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); |
275 | ++iii; | 275 | ++iii; |
276 | sb = | 276 | sb = |
277 | addWidBool(i18n("Show summary after syncing"), | 277 | addWidBool(i18n("Show summary after syncing"), |
278 | &(KOPrefs::instance()->mShowSyncSummary),topFrame); | 278 | &(KOPrefs::instance()->mShowSyncSummary),topFrame); |
279 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); | 279 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); |
280 | 280 | ||
281 | ++iii; | 281 | ++iii; |
282 | #endif | 282 | #endif |
283 | 283 | ||
284 | 284 | ||
285 | 285 | ||
286 | } | 286 | } |
287 | 287 | ||
288 | 288 | ||
289 | void KOPrefsDialog::setupSyncTab() | 289 | void KOPrefsDialog::setupSyncTab() |
290 | { | 290 | { |
291 | #if 0 | 291 | #if 0 |
292 | QLabel * lab; | 292 | QLabel * lab; |
293 | QFrame *topFrame = addPage(i18n("Sync Network"),0,0); | 293 | QFrame *topFrame = addPage(i18n("Sync Network"),0,0); |
294 | QGridLayout *topLayout = new QGridLayout(topFrame,6,2); | 294 | QGridLayout *topLayout = new QGridLayout(topFrame,6,2); |
295 | topLayout->setSpacing(mSpacingHint); | 295 | topLayout->setSpacing(mSpacingHint); |
296 | topLayout->setMargin(mMarginHint); | 296 | topLayout->setMargin(mMarginHint); |
297 | lab = new QLabel(i18n("Remote syncing (via ssh/scp)\nnetwork settings "), topFrame); | 297 | lab = new QLabel(i18n("Remote syncing (via ssh/scp)\nnetwork settings "), topFrame); |
298 | int iii = 0; | 298 | int iii = 0; |
299 | topLayout->addMultiCellWidget(lab , iii,iii,0,1); | 299 | topLayout->addMultiCellWidget(lab , iii,iii,0,1); |
300 | ++iii; | 300 | ++iii; |
301 | 301 | ||
302 | mRemoteIPEdit = new QLineEdit(topFrame); | 302 | mRemoteIPEdit = new QLineEdit(topFrame); |
303 | lab = new QLabel(mRemoteIPEdit, i18n("Remote IP:"), topFrame); | 303 | lab = new QLabel(mRemoteIPEdit, i18n("Remote IP:"), topFrame); |
304 | topLayout->addWidget(lab ,iii,0); | 304 | topLayout->addWidget(lab ,iii,0); |
305 | topLayout->addWidget(mRemoteIPEdit,iii,1); | 305 | topLayout->addWidget(mRemoteIPEdit,iii,1); |
306 | ++iii; | 306 | ++iii; |
307 | mRemoteUser = new QLineEdit(topFrame); | 307 | mRemoteUser = new QLineEdit(topFrame); |
308 | lab = new QLabel(mRemoteUser, i18n("Remote user:"), topFrame); | 308 | lab = new QLabel(mRemoteUser, i18n("Remote user:"), topFrame); |
309 | topLayout->addWidget(lab ,iii,0); | 309 | topLayout->addWidget(lab ,iii,0); |
310 | topLayout->addWidget(mRemoteUser, iii,1); | 310 | topLayout->addWidget(mRemoteUser, iii,1); |
311 | ++iii; | 311 | ++iii; |
312 | 312 | ||
313 | mRemoteFile = new QLineEdit(topFrame); | 313 | mRemoteFile = new QLineEdit(topFrame); |
314 | lab = new QLabel(mRemoteFile, i18n("Remote file:"), topFrame); | 314 | lab = new QLabel(mRemoteFile, i18n("Remote file:"), topFrame); |
315 | topLayout->addWidget(lab ,iii,0); | 315 | topLayout->addWidget(lab ,iii,0); |
316 | topLayout->addWidget(mRemoteFile,iii,1); | 316 | topLayout->addWidget(mRemoteFile,iii,1); |
317 | ++iii; | 317 | ++iii; |
318 | 318 | ||
319 | mLocalTempFile = new QLineEdit(topFrame); | 319 | mLocalTempFile = new QLineEdit(topFrame); |
320 | lab = new QLabel(mLocalTempFile, i18n("Local temp file:"), topFrame); | 320 | lab = new QLabel(mLocalTempFile, i18n("Local temp file:"), topFrame); |
321 | topLayout->addWidget(lab ,iii,0); | 321 | topLayout->addWidget(lab ,iii,0); |
322 | topLayout->addWidget(mLocalTempFile,iii,1); | 322 | topLayout->addWidget(mLocalTempFile,iii,1); |
323 | ++iii; | 323 | ++iii; |
324 | 324 | ||
325 | KPrefsDialogWidBool *wb = | 325 | KPrefsDialogWidBool *wb = |
326 | addWidBool(i18n("Write back synced file"), | 326 | addWidBool(i18n("Write back synced file"), |
327 | &(KOPrefs::instance()->mWriteBackFile),topFrame); | 327 | &(KOPrefs::instance()->mWriteBackFile),topFrame); |
328 | topLayout->addMultiCellWidget(wb->checkBox(), iii,iii,0,1); | 328 | topLayout->addMultiCellWidget(wb->checkBox(), iii,iii,0,1); |
329 | ++iii; | 329 | ++iii; |
330 | wb = | 330 | wb = |
331 | addWidBool(i18n("Write back existing entries only"), | 331 | addWidBool(i18n("Write back existing entries only"), |
332 | &(KOPrefs::instance()->mWriteBackExistingOnly),topFrame); | 332 | &(KOPrefs::instance()->mWriteBackExistingOnly),topFrame); |
333 | topLayout->addMultiCellWidget(wb->checkBox(), iii,iii,0,1); | 333 | topLayout->addMultiCellWidget(wb->checkBox(), iii,iii,0,1); |
334 | ++iii; | 334 | ++iii; |
335 | 335 | ||
336 | #endif | 336 | #endif |
337 | } | 337 | } |
338 | 338 | ||
339 | void KOPrefsDialog::setupMainTab() | 339 | void KOPrefsDialog::setupMainTab() |
340 | { | 340 | { |
341 | QFrame *topFrame = addPage(i18n("General"),0,0); | 341 | QFrame *topFrame = addPage(i18n("General"),0,0); |
342 | // DesktopIcon("identity",KIcon::SizeMedium)); | 342 | // DesktopIcon("identity",KIcon::SizeMedium)); |
343 | 343 | ||
344 | QGridLayout *topLayout = new QGridLayout(topFrame,5,2); | 344 | QGridLayout *topLayout = new QGridLayout(topFrame,5,2); |
345 | topLayout->setSpacing(mSpacingHint); | 345 | topLayout->setSpacing(mSpacingHint); |
346 | topLayout->setMargin(mMarginHint); | 346 | topLayout->setMargin(mMarginHint); |
347 | 347 | ||
348 | // KPrefsDialogWidBool *emailControlCenter = | 348 | // KPrefsDialogWidBool *emailControlCenter = |
349 | // addWidBool(i18n("&Use email settings from Control Center"), | 349 | // addWidBool(i18n("&Use email settings from Control Center"), |
350 | // &(KOPrefs::instance()->mEmailControlCenter),topFrame); | 350 | // &(KOPrefs::instance()->mEmailControlCenter),topFrame); |
351 | // topLayout->addMultiCellWidget(emailControlCenter->checkBox(),0,0,0,1); | 351 | // topLayout->addMultiCellWidget(emailControlCenter->checkBox(),0,0,0,1); |
352 | // connect(emailControlCenter->checkBox(),SIGNAL(toggled(bool)), | 352 | // connect(emailControlCenter->checkBox(),SIGNAL(toggled(bool)), |
353 | // SLOT(toggleEmailSettings(bool))); | 353 | // SLOT(toggleEmailSettings(bool))); |
354 | 354 | ||
355 | mNameEdit = new QLineEdit(topFrame); | 355 | mNameEdit = new QLineEdit(topFrame); |
356 | mNameLabel = new QLabel(mNameEdit, i18n("Full &name:"), topFrame); | 356 | mNameLabel = new QLabel(mNameEdit, i18n("Full &name:"), topFrame); |
357 | topLayout->addWidget(mNameLabel,0,0); | 357 | topLayout->addWidget(mNameLabel,0,0); |
358 | topLayout->addWidget(mNameEdit,0,1); | 358 | topLayout->addWidget(mNameEdit,0,1); |
359 | 359 | ||
360 | mEmailEdit = new QLineEdit(topFrame); | 360 | mEmailEdit = new QLineEdit(topFrame); |
361 | mEmailLabel = new QLabel(mEmailEdit, i18n("E&mail address:"),topFrame); | 361 | mEmailLabel = new QLabel(mEmailEdit, i18n("E&mail address:"),topFrame); |
362 | topLayout->addWidget(mEmailLabel,1,0); | 362 | topLayout->addWidget(mEmailLabel,1,0); |
363 | topLayout->addWidget(mEmailEdit,1,1); | 363 | topLayout->addWidget(mEmailEdit,1,1); |
364 | KPrefsDialogWidBool *wb; | 364 | KPrefsDialogWidBool *wb; |
365 | 365 | ||
366 | 366 | ||
367 | 367 | ||
368 | KPrefsDialogWidBool *widbool = addWidBool(i18n("Full menu bar(nr)"), | 368 | KPrefsDialogWidBool *widbool = addWidBool(i18n("Full menu bar(nr)"), |
369 | &(KOPrefs::instance()->mShowFullMenu),topFrame); | 369 | &(KOPrefs::instance()->mShowFullMenu),topFrame); |
370 | topLayout->addMultiCellWidget( widbool->checkBox(), 2,2,0,1); | 370 | topLayout->addMultiCellWidget( widbool->checkBox(), 2,2,0,1); |
371 | 371 | ||
372 | 372 | ||
373 | widbool = addWidBool(i18n("Mini icons in toolbar(nr)"), | 373 | widbool = addWidBool(i18n("Mini icons in toolbar(nr)"), |
374 | &(KOPrefs::instance()->mToolBarMiniIcons),topFrame); | 374 | &(KOPrefs::instance()->mToolBarMiniIcons),topFrame); |
375 | topLayout->addMultiCellWidget( widbool->checkBox(), 3,3,0,1); | 375 | topLayout->addMultiCellWidget( widbool->checkBox(), 3,3,0,1); |
376 | 376 | ||
377 | 377 | ||
378 | KPrefsDialogWidBool *verticalScreen = | 378 | KPrefsDialogWidBool *verticalScreen = |
379 | addWidBool(i18n("Show vertical screen (Needs restart)"), | 379 | addWidBool(i18n("Show vertical screen (Needs restart)"), |
380 | &(KOPrefs::instance()->mVerticalScreen),topFrame); | 380 | &(KOPrefs::instance()->mVerticalScreen),topFrame); |
381 | //topLayout->addWidget(verticalScreen->checkBox(),ii++,0); | 381 | //topLayout->addWidget(verticalScreen->checkBox(),ii++,0); |
382 | topLayout->addMultiCellWidget(verticalScreen->checkBox(),4,4,0,1); | 382 | topLayout->addMultiCellWidget(verticalScreen->checkBox(),4,4,0,1); |
383 | 383 | ||
384 | 384 | ||
385 | QHBox *dummy = new QHBox(topFrame); | 385 | QHBox *dummy = new QHBox(topFrame); |
386 | new QLabel(i18n("Days in Next-X-Days:"),dummy); | 386 | new QLabel(i18n("Days in Next-X-Days:"),dummy); |
387 | mNextXDaysSpin = new QSpinBox(2,14,1,dummy); | 387 | mNextXDaysSpin = new QSpinBox(2,14,1,dummy); |
388 | 388 | ||
389 | topLayout->addMultiCellWidget(dummy,5,5,0,1); | 389 | topLayout->addMultiCellWidget(dummy,5,5,0,1); |
390 | 390 | ||
391 | 391 | ||
392 | 392 | ||
393 | // KPrefsDialogWidBool *bcc = | 393 | // KPrefsDialogWidBool *bcc = |
394 | // addWidBool(i18n("Send copy to owner when mailing events"), | 394 | // addWidBool(i18n("Send copy to owner when mailing events"), |
395 | // &(KOPrefs::instance()->mBcc),topFrame); | 395 | // &(KOPrefs::instance()->mBcc),topFrame); |
396 | // topLayout->addMultiCellWidget(bcc->checkBox(),4,4,0,1); | 396 | // topLayout->addMultiCellWidget(bcc->checkBox(),4,4,0,1); |
397 | 397 | ||
398 | 398 | ||
399 | // QGroupBox *autoSaveGroup = new QGroupBox(1,Horizontal,i18n("Auto-Save"), topFrame); | 399 | // QGroupBox *autoSaveGroup = new QGroupBox(1,Horizontal,i18n("Auto-Save"), topFrame); |
400 | //topLayout->addMultiCellWidget(autoSaveGroup,6,6,0,1); | 400 | //topLayout->addMultiCellWidget(autoSaveGroup,6,6,0,1); |
401 | 401 | ||
402 | // addWidBool(i18n("Enable automatic saving of calendar"), | 402 | // addWidBool(i18n("Enable automatic saving of calendar"), |
403 | // &(KOPrefs::instance()->mAutoSave),autoSaveGroup); | 403 | // &(KOPrefs::instance()->mAutoSave),autoSaveGroup); |
404 | 404 | ||
405 | QHBox *intervalBox = new QHBox(topFrame); | 405 | QHBox *intervalBox = new QHBox(topFrame); |
406 | // intervalBox->setSpacing(mSpacingHint); | 406 | // intervalBox->setSpacing(mSpacingHint); |
407 | topLayout->addMultiCellWidget(intervalBox,6,6,0,1); | 407 | topLayout->addMultiCellWidget(intervalBox,6,6,0,1); |
408 | QLabel *autoSaveIntervalLabel = new QLabel(i18n("Auto save delay in minutes:"),intervalBox); | 408 | QLabel *autoSaveIntervalLabel = new QLabel(i18n("Auto save delay in minutes:"),intervalBox); |
409 | mAutoSaveIntervalSpin = new QSpinBox(0,500,1,intervalBox); | 409 | mAutoSaveIntervalSpin = new QSpinBox(0,500,1,intervalBox); |
410 | autoSaveIntervalLabel->setBuddy(mAutoSaveIntervalSpin); | 410 | autoSaveIntervalLabel->setBuddy(mAutoSaveIntervalSpin); |
411 | /* | 411 | /* |
412 | QHBox * agendasize = new QHBox ( topFrame ); | 412 | QHBox * agendasize = new QHBox ( topFrame ); |
413 | 413 | ||
414 | new QLabel (i18n("AllDayAgenda Height:"), agendasize ); | 414 | new QLabel (i18n("AllDayAgenda Height:"), agendasize ); |
415 | 415 | ||
416 | 416 | ||
417 | mHourSizeSlider = new QSlider(24,47,1,24,Horizontal,agendasize); | 417 | mHourSizeSlider = new QSlider(24,47,1,24,Horizontal,agendasize); |
418 | topLayout->addMultiCellWidget(agendasize,7,7,0,1); | 418 | topLayout->addMultiCellWidget(agendasize,7,7,0,1); |
419 | */ | 419 | */ |
420 | 420 | ||
421 | 421 | ||
422 | KPrefsDialogWidBool *ask = | 422 | KPrefsDialogWidBool *ask = |
423 | addWidBool(i18n("Ask for quit when closing KO/Pi"), | 423 | addWidBool(i18n("Ask for quit when closing KO/Pi"), |
424 | &(KOPrefs::instance()->mAskForQuit),topFrame); | 424 | &(KOPrefs::instance()->mAskForQuit),topFrame); |
425 | topLayout->addMultiCellWidget(ask->checkBox(),7,7,0,1); | 425 | topLayout->addMultiCellWidget(ask->checkBox(),7,7,0,1); |
426 | 426 | ||
427 | 427 | ||
428 | /* | 428 | /* |
429 | KPrefsDialogWidBool *confirmCheck = | 429 | KPrefsDialogWidBool *confirmCheck = |
430 | addWidBool(i18n("Confirm &deletes"),&(KOPrefs::instance()->mConfirm), | 430 | addWidBool(i18n("Confirm &deletes"),&(KOPrefs::instance()->mConfirm), |
431 | topFrame); | 431 | topFrame); |
432 | topLayout->addMultiCellWidget(confirmCheck->checkBox(),7,7,0,1); | 432 | topLayout->addMultiCellWidget(confirmCheck->checkBox(),7,7,0,1); |
433 | 433 | ||
434 | 434 | ||
435 | mEnableGroupScheduling = | 435 | mEnableGroupScheduling = |
436 | addWidBool(i18n("Enable group scheduling"), | 436 | addWidBool(i18n("Enable group scheduling"), |
437 | &(KOPrefs::instance()->mEnableGroupScheduling),topFrame); | 437 | &(KOPrefs::instance()->mEnableGroupScheduling),topFrame); |
438 | topLayout->addWidget(mEnableGroupScheduling->checkBox(),8,0); | 438 | topLayout->addWidget(mEnableGroupScheduling->checkBox(),8,0); |
439 | connect(mEnableGroupScheduling->checkBox(),SIGNAL(clicked()), | 439 | connect(mEnableGroupScheduling->checkBox(),SIGNAL(clicked()), |
440 | SLOT(warningGroupScheduling())); | 440 | SLOT(warningGroupScheduling())); |
441 | 441 | ||
442 | mEnableProjectView = | 442 | mEnableProjectView = |
443 | addWidBool(i18n("Enable project view"), | 443 | addWidBool(i18n("Enable project view"), |
444 | &(KOPrefs::instance()->mEnableProjectView),topFrame); | 444 | &(KOPrefs::instance()->mEnableProjectView),topFrame); |
445 | topLayout->addWidget(mEnableProjectView->checkBox(),9,0); | 445 | topLayout->addWidget(mEnableProjectView->checkBox(),9,0); |
446 | connect(mEnableProjectView->checkBox(),SIGNAL(clicked()), | 446 | connect(mEnableProjectView->checkBox(),SIGNAL(clicked()), |
447 | SLOT(warningProjectView())); | 447 | SLOT(warningProjectView())); |
448 | 448 | ||
449 | // Can't be disabled anymore | 449 | // Can't be disabled anymore |
450 | mEnableGroupScheduling->checkBox()->hide(); | 450 | mEnableGroupScheduling->checkBox()->hide(); |
451 | 451 | ||
452 | // Disable setting, because this feature now becomes stable | 452 | // Disable setting, because this feature now becomes stable |
453 | mEnableProjectView->checkBox()->hide(); | 453 | mEnableProjectView->checkBox()->hide(); |
454 | 454 | ||
455 | KPrefsDialogWidRadios *defaultFormatGroup = | 455 | KPrefsDialogWidRadios *defaultFormatGroup = |
456 | addWidRadios(i18n("Default Calendar Format"), | 456 | addWidRadios(i18n("Default Calendar Format"), |
457 | &(KOPrefs::instance()->mDefaultFormat),topFrame); | 457 | &(KOPrefs::instance()->mDefaultFormat),topFrame); |
458 | defaultFormatGroup->addRadio(i18n("vCalendar")); | 458 | defaultFormatGroup->addRadio(i18n("vCalendar")); |
459 | defaultFormatGroup->addRadio(i18n("iCalendar")); | 459 | defaultFormatGroup->addRadio(i18n("iCalendar")); |
460 | 460 | ||
461 | topLayout->addMultiCellWidget(defaultFormatGroup->groupBox(),10,10,0,1); | 461 | topLayout->addMultiCellWidget(defaultFormatGroup->groupBox(),10,10,0,1); |
462 | 462 | ||
463 | // Default format unconditionally is iCalendar | 463 | // Default format unconditionally is iCalendar |
464 | defaultFormatGroup->groupBox()->hide(); | 464 | defaultFormatGroup->groupBox()->hide(); |
465 | 465 | ||
466 | KPrefsDialogWidRadios *mailClientGroup = | 466 | KPrefsDialogWidRadios *mailClientGroup = |
467 | addWidRadios(i18n("Mail Client"),&(KOPrefs::instance()->mMailClient), | 467 | addWidRadios(i18n("Mail Client"),&(KOPrefs::instance()->mMailClient), |
468 | topFrame); | 468 | topFrame); |
469 | mailClientGroup->addRadio(i18n("KMail")); | 469 | mailClientGroup->addRadio(i18n("KMail")); |
470 | mailClientGroup->addRadio(i18n("Sendmail")); | 470 | mailClientGroup->addRadio(i18n("Sendmail")); |
471 | topLayout->addMultiCellWidget(mailClientGroup->groupBox(),11,11,0,1); | 471 | topLayout->addMultiCellWidget(mailClientGroup->groupBox(),11,11,0,1); |
472 | 472 | ||
473 | KPrefsDialogWidBool *htmlsave = | 473 | KPrefsDialogWidBool *htmlsave = |
474 | addWidBool(i18n("Export to HTML with every save"),&(KOPrefs::instance()->mHtmlWithSave), | 474 | addWidBool(i18n("Export to HTML with every save"),&(KOPrefs::instance()->mHtmlWithSave), |
475 | topFrame); | 475 | topFrame); |
476 | topLayout->addMultiCellWidget(htmlsave->checkBox(),12,12,0,1); | 476 | topLayout->addMultiCellWidget(htmlsave->checkBox(),12,12,0,1); |
477 | 477 | ||
478 | KPrefsDialogWidRadios *destinationGroup = | 478 | KPrefsDialogWidRadios *destinationGroup = |
479 | addWidRadios(i18n("New Events/Todos should"),&(KOPrefs::instance()->mDestination), | 479 | addWidRadios(i18n("New Events/Todos should"),&(KOPrefs::instance()->mDestination), |
480 | topFrame); | 480 | topFrame); |
481 | destinationGroup->addRadio(i18n("be added to the standard resource")); | 481 | destinationGroup->addRadio(i18n("be added to the standard resource")); |
482 | destinationGroup->addRadio(i18n("be asked which resource to use")); | 482 | destinationGroup->addRadio(i18n("be asked which resource to use")); |
483 | topLayout->addMultiCellWidget(destinationGroup->groupBox(),13,13,0,1); | 483 | topLayout->addMultiCellWidget(destinationGroup->groupBox(),13,13,0,1); |
484 | 484 | ||
485 | topLayout->setRowStretch(14,1); | 485 | topLayout->setRowStretch(14,1); |
486 | */ | 486 | */ |
487 | } | 487 | } |
488 | 488 | ||
489 | 489 | ||
490 | void KOPrefsDialog::setupTimeTab() | 490 | void KOPrefsDialog::setupTimeTab() |
491 | { | 491 | { |
492 | QFrame *topFrame = addPage(i18n("Time"),0,0); | 492 | QFrame *topFrame = addPage(i18n("Time"),0,0); |
493 | // DesktopIcon("clock",KIcon::SizeMedium)); | 493 | // DesktopIcon("clock",KIcon::SizeMedium)); |
494 | 494 | ||
495 | QGridLayout *topLayout = new QGridLayout(topFrame,4,2); | 495 | QGridLayout *topLayout = new QGridLayout(topFrame,4,2); |
496 | topLayout->setSpacing(mSpacingHint); | 496 | topLayout->setSpacing(mSpacingHint); |
497 | topLayout->setMargin(mMarginHint); | 497 | topLayout->setMargin(mMarginHint); |
498 | 498 | ||
499 | QHBox *dummy = new QHBox(topFrame); | 499 | QHBox *dummy = new QHBox(topFrame); |
500 | KPrefsDialogWidTime *dayBegins = | 500 | KPrefsDialogWidTime *dayBegins = |
501 | addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins), | 501 | addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins), |
502 | dummy); | 502 | dummy); |
503 | //topLayout->addWidget(dayBegins->label(),2,0); | 503 | //topLayout->addWidget(dayBegins->label(),2,0); |
504 | 504 | ||
505 | //topLayout->addWidget(dayBegins->spinBox(),2,1); | 505 | //topLayout->addWidget(dayBegins->spinBox(),2,1); |
506 | topLayout->addMultiCellWidget(dummy,0,0,0,1); | 506 | topLayout->addMultiCellWidget(dummy,0,0,0,1); |
507 | 507 | ||
508 | topLayout->addWidget(new QLabel(i18n("Default appointment time:"), | 508 | topLayout->addWidget(new QLabel(i18n("Default appointment time:"), |
509 | topFrame),1,0); | 509 | topFrame),1,0); |
510 | mStartTimeSpin = new QSpinBox(0,23,1,topFrame); | 510 | mStartTimeSpin = new QSpinBox(0,23,1,topFrame); |
511 | mStartTimeSpin->setSuffix(":00"); | 511 | mStartTimeSpin->setSuffix(":00"); |
512 | topLayout->addWidget(mStartTimeSpin,1,1); | 512 | topLayout->addWidget(mStartTimeSpin,1,1); |
513 | 513 | ||
514 | topLayout->addWidget(new QLabel(i18n("Def. duration of new app.:"), | 514 | topLayout->addWidget(new QLabel(i18n("Def. duration of new app.:"), |
515 | topFrame),2,0); | 515 | topFrame),2,0); |
516 | mDefaultDurationSpin = new QSpinBox(0,23,1,topFrame); | 516 | mDefaultDurationSpin = new QSpinBox(0,23,1,topFrame); |
517 | mDefaultDurationSpin->setSuffix(":00"); | 517 | mDefaultDurationSpin->setSuffix(":00"); |
518 | topLayout->addWidget(mDefaultDurationSpin,2,1); | 518 | topLayout->addWidget(mDefaultDurationSpin,2,1); |
519 | 519 | ||
520 | QStringList alarmList; | 520 | QStringList alarmList; |
521 | alarmList << i18n("1 minute") << i18n("5 minutes") << i18n("10 minutes") | 521 | alarmList << i18n("1 minute") << i18n("5 minutes") << i18n("10 minutes") |
522 | << i18n("15 minutes") << i18n("30 minutes")<< i18n("1 hour")<< i18n("3 hours") << i18n("24 hours") ; | 522 | << i18n("15 minutes") << i18n("30 minutes")<< i18n("1 hour")<< i18n("3 hours") << i18n("24 hours") ; |
523 | topLayout->addWidget(new QLabel(i18n("Default alarm time:"),topFrame), | 523 | topLayout->addWidget(new QLabel(i18n("Default alarm time:"),topFrame), |
524 | 3,0); | 524 | 3,0); |
525 | mAlarmTimeCombo = new QComboBox(topFrame); | 525 | mAlarmTimeCombo = new QComboBox(topFrame); |
526 | mAlarmTimeCombo->insertStringList(alarmList); | 526 | mAlarmTimeCombo->insertStringList(alarmList); |
527 | topLayout->addWidget(mAlarmTimeCombo,3,1); | 527 | topLayout->addWidget(mAlarmTimeCombo,3,1); |
528 | 528 | ||
529 | 529 | ||
530 | QGroupBox *workingHoursGroup = new QGroupBox(1,Horizontal, | 530 | QGroupBox *workingHoursGroup = new QGroupBox(1,Horizontal, |
531 | i18n("Working Hours"), | 531 | i18n("Working Hours"), |
532 | topFrame); | 532 | topFrame); |
533 | topLayout->addMultiCellWidget(workingHoursGroup,4,4,0,1); | 533 | topLayout->addMultiCellWidget(workingHoursGroup,4,4,0,1); |
534 | workingHoursGroup->layout()->setSpacing( 0 ); | 534 | workingHoursGroup->layout()->setSpacing( 0 ); |
535 | workingHoursGroup->layout()->setMargin( 4 ); | 535 | workingHoursGroup->layout()->setMargin( 4 ); |
536 | QHBox *workStartBox = new QHBox(workingHoursGroup); | 536 | QHBox *workStartBox = new QHBox(workingHoursGroup); |
537 | // workStartBox->setMargin( 0 ); | 537 | // workStartBox->setMargin( 0 ); |
538 | addWidTime(i18n("Daily starting hour:"), | 538 | addWidTime(i18n("Daily starting hour:"), |
539 | &(KOPrefs::instance()->mWorkingHoursStart),workStartBox); | 539 | &(KOPrefs::instance()->mWorkingHoursStart),workStartBox); |
540 | 540 | ||
541 | QHBox *workEndBox = new QHBox(workingHoursGroup); | 541 | QHBox *workEndBox = new QHBox(workingHoursGroup); |
542 | //workEndBox->setMargin( 0 ); | 542 | //workEndBox->setMargin( 0 ); |
543 | addWidTime(i18n("Daily ending hour:"), | 543 | addWidTime(i18n("Daily ending hour:"), |
544 | &(KOPrefs::instance()->mWorkingHoursEnd),workEndBox); | 544 | &(KOPrefs::instance()->mWorkingHoursEnd),workEndBox); |
545 | QVBox *excludeBox = new QVBox(workingHoursGroup); | 545 | QVBox *excludeBox = new QVBox(workingHoursGroup); |
546 | //excludeBox->setMargin( 0 ); | 546 | //excludeBox->setMargin( 0 ); |
547 | addWidBool(i18n("Exclude holidays"), | 547 | addWidBool(i18n("Exclude holidays"), |
548 | &(KOPrefs::instance()->mExcludeHolidays),excludeBox); | 548 | &(KOPrefs::instance()->mExcludeHolidays),excludeBox); |
549 | 549 | ||
550 | addWidBool(i18n("Exclude Saturdays"), | 550 | addWidBool(i18n("Exclude Saturdays"), |
551 | &(KOPrefs::instance()->mExcludeSaturdays),excludeBox); | 551 | &(KOPrefs::instance()->mExcludeSaturdays),excludeBox); |
552 | 552 | ||
553 | // KPrefsDialogWidBool *marcusBainsShowSeconds = addWidBool(i18n("Show seconds on Marcus Bains line"), | 553 | // KPrefsDialogWidBool *marcusBainsShowSeconds = addWidBool(i18n("Show seconds on Marcus Bains line"), |
554 | // &(KOPrefs::instance()->mMarcusBainsShowSeconds), | 554 | // &(KOPrefs::instance()->mMarcusBainsShowSeconds), |
555 | // topFrame); | 555 | // topFrame); |
556 | // topLayout->addWidget(marcusBainsShowSeconds->checkBox(),5,0); | 556 | // topLayout->addWidget(marcusBainsShowSeconds->checkBox(),5,0); |
557 | 557 | ||
558 | // topLayout->setRowStretch(6,1); | 558 | // topLayout->setRowStretch(6,1); |
559 | } | 559 | } |
560 | 560 | ||
561 | 561 | ||
562 | void KOPrefsDialog::setupViewsTab() | 562 | void KOPrefsDialog::setupViewsTab() |
563 | { | 563 | { |
564 | 564 | ||
565 | QFrame *topFrame = addPage(i18n("Views"),0,0); | 565 | QFrame *topFrame = addPage(i18n("Views"),0,0); |
566 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | 566 | // DesktopIcon("viewmag",KIcon::SizeMedium)); |
567 | 567 | ||
568 | QGridLayout *topLayout = new QGridLayout(topFrame,6,1); | 568 | QGridLayout *topLayout = new QGridLayout(topFrame,6,1); |
569 | topLayout->setSpacing(mSpacingHint); | 569 | topLayout->setSpacing(mSpacingHint); |
570 | topLayout->setMargin(mMarginHint); | 570 | topLayout->setMargin(mMarginHint); |
571 | 571 | ||
572 | // QBoxLayout *dayBeginsLayout = new QHBoxLayout; | 572 | // QBoxLayout *dayBeginsLayout = new QHBoxLayout; |
573 | // topLayout->addLayout(dayBeginsLayout,0,0); | 573 | // topLayout->addLayout(dayBeginsLayout,0,0); |
574 | 574 | ||
575 | // KPrefsDialogWidTime *dayBegins = | 575 | // KPrefsDialogWidTime *dayBegins = |
576 | // addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins), | 576 | // addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins), |
577 | // topFrame); | 577 | // topFrame); |
578 | // dayBeginsLayout->addWidget(dayBegins->label()); | 578 | // dayBeginsLayout->addWidget(dayBegins->label()); |
579 | // dayBeginsLayout->addStretch(1); | 579 | // dayBeginsLayout->addStretch(1); |
580 | // dayBeginsLayout->addWidget(dayBegins->spinBox()); | 580 | // dayBeginsLayout->addWidget(dayBegins->spinBox()); |
581 | 581 | ||
582 | // QBoxLayout *nextDaysLayout = new QHBoxLayout; | 582 | // QBoxLayout *nextDaysLayout = new QHBoxLayout; |
583 | // topLayout->addLayout(nextDaysLayout,1,0); | 583 | // topLayout->addLayout(nextDaysLayout,1,0); |
584 | // nextDaysLayout->addWidget(new QLabel(i18n("Days to show in Next-X-Days view:"),topFrame)); | 584 | // nextDaysLayout->addWidget(new QLabel(i18n("Days to show in Next-X-Days view:"),topFrame)); |
585 | // mNextXDaysSpin = new QSpinBox(2,14,1,topFrame); | 585 | // mNextXDaysSpin = new QSpinBox(2,14,1,topFrame); |
586 | // nextDaysLayout->addStretch(1); | 586 | // nextDaysLayout->addStretch(1); |
587 | // nextDaysLayout->addWidget(mNextXDaysSpin); | 587 | // nextDaysLayout->addWidget(mNextXDaysSpin); |
588 | 588 | ||
589 | 589 | ||
590 | int ii = 0; | 590 | int ii = 0; |
591 | KPrefsDialogWidBool *dummy = | 591 | KPrefsDialogWidBool *dummy = |
592 | addWidBool(i18n("Edit item on doubleclick (if not, show)"), | 592 | addWidBool(i18n("Edit item on doubleclick (if not, show)"), |
593 | &(KOPrefs::instance()->mEditOnDoubleClick),topFrame); | 593 | &(KOPrefs::instance()->mEditOnDoubleClick),topFrame); |
594 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 594 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
595 | 595 | ||
596 | 596 | ||
597 | 597 | ||
598 | 598 | ||
599 | 599 | ||
600 | 600 | ||
601 | // topLayout->addWidget(hourSizeGroup,ii++,0); | 601 | // topLayout->addWidget(hourSizeGroup,ii++,0); |
602 | // topLayout->addMultiCellWidget(hourSizeGroup,ii,ii,0,0); | 602 | // topLayout->addMultiCellWidget(hourSizeGroup,ii,ii,0,0); |
603 | //topLayout->setRowStretch(11,1); | 603 | //topLayout->setRowStretch(11,1); |
604 | 604 | ||
605 | 605 | ||
606 | 606 | ||
607 | 607 | ||
608 | #if 0 | 608 | #if 0 |
609 | 609 | ||
610 | topFrame = addPage(i18n("ViewChange"),0,0); | 610 | topFrame = addPage(i18n("ViewChange"),0,0); |
611 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | 611 | // DesktopIcon("viewmag",KIcon::SizeMedium)); |
612 | 612 | ||
613 | topLayout = new QGridLayout(topFrame,6,1); | 613 | topLayout = new QGridLayout(topFrame,6,1); |
614 | topLayout->setSpacing(mSpacingHint); | 614 | topLayout->setSpacing(mSpacingHint); |
615 | topLayout->setMargin(mMarginHint); | 615 | topLayout->setMargin(mMarginHint); |
616 | ii = 0; | 616 | ii = 0; |
617 | 617 | ||
618 | #endif | 618 | #endif |
619 | 619 | ||
620 | dummy = | 620 | dummy = |
621 | addWidBool(i18n("Hold fullscreen on view change"), | 621 | addWidBool(i18n("Hold fullscreen on view change"), |
622 | &(KOPrefs::instance()->mViewChangeHoldFullscreen),topFrame); | 622 | &(KOPrefs::instance()->mViewChangeHoldFullscreen),topFrame); |
623 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 623 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
624 | 624 | ||
625 | dummy = | 625 | dummy = |
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 | ||
819 | 818 | ||
820 | QHBox* hdummy = new QHBox(topFrame); | 819 | QHBox* hdummy = new QHBox(topFrame); |
821 | new QLabel(i18n("Days in What's Next:"),hdummy); | 820 | new QLabel(i18n("Days in What's Next:"),hdummy); |
822 | mWhatsNextSpin = new QSpinBox(1,14,1,hdummy); | 821 | mWhatsNextSpin = new QSpinBox(1,14,1,hdummy); |
823 | 822 | ||
824 | topLayout->addWidget(hdummy,ii++,0); | 823 | topLayout->addWidget(hdummy,ii++,0); |
825 | 824 | ||
826 | QHBox *prioBox = new QHBox(topFrame); | 825 | QHBox *prioBox = new QHBox(topFrame); |
827 | // intervalBox->setSpacing(mSpacingHint); | 826 | // intervalBox->setSpacing(mSpacingHint); |
828 | topLayout->addWidget(prioBox,ii++,0); | 827 | topLayout->addWidget(prioBox,ii++,0); |
829 | 828 | ||
830 | QLabel *prioLabel = new QLabel(i18n("Number of max.displayed todo prios:"), prioBox); | 829 | QLabel *prioLabel = new QLabel(i18n("Number of max.displayed todo prios:"), prioBox); |
831 | mPrioSpin = new QSpinBox(0,5,1,prioBox); | 830 | mPrioSpin = new QSpinBox(0,5,1,prioBox); |
832 | if ( QApplication::desktop()->width() < 300 ) | 831 | if ( QApplication::desktop()->width() < 300 ) |
833 | mPrioSpin->setFixedWidth( 40 ); | 832 | mPrioSpin->setFixedWidth( 40 ); |
834 | 833 | ||
835 | KPrefsDialogWidBool *passwdk = | 834 | KPrefsDialogWidBool *passwdk = |
836 | 835 | ||
837 | addWidBool(i18n("Show events, that are done"), | 836 | addWidBool(i18n("Show events, that are done"), |
838 | &(KOPrefs::instance()->mWNViewShowsPast),topFrame); | 837 | &(KOPrefs::instance()->mWNViewShowsPast),topFrame); |
839 | topLayout->addWidget(passwdk->checkBox(), ii++,0); | 838 | topLayout->addWidget(passwdk->checkBox(), ii++,0); |
840 | passwdk = | 839 | passwdk = |
841 | addWidBool(i18n("Show parent To-Do's"), | 840 | addWidBool(i18n("Show parent To-Do's"), |
842 | &(KOPrefs::instance()->mWNViewShowsParents),topFrame); | 841 | &(KOPrefs::instance()->mWNViewShowsParents),topFrame); |
843 | topLayout->addWidget(passwdk->checkBox(), ii++,0); | 842 | topLayout->addWidget(passwdk->checkBox(), ii++,0); |
844 | 843 | ||
845 | passwdk = | 844 | passwdk = |
846 | addWidBool(i18n("Show location"), | 845 | addWidBool(i18n("Show location"), |
847 | &(KOPrefs::instance()->mWNViewShowLocation),topFrame); | 846 | &(KOPrefs::instance()->mWNViewShowLocation),topFrame); |
848 | topLayout->addWidget(passwdk->checkBox(), ii++,0); | 847 | topLayout->addWidget(passwdk->checkBox(), ii++,0); |
849 | 848 | ||
850 | passwdk = | 849 | passwdk = |
851 | addWidBool(i18n("Show Sync Events in WN+Agenda"), | 850 | addWidBool(i18n("Show Sync Events in WN+Agenda"), |
852 | &(KOPrefs::instance()->mShowSyncEvents),topFrame); | 851 | &(KOPrefs::instance()->mShowSyncEvents),topFrame); |
853 | topLayout->addWidget(passwdk->checkBox(), ii++,0); | 852 | topLayout->addWidget(passwdk->checkBox(), ii++,0); |
854 | passwdk = | 853 | passwdk = |
855 | addWidBool(i18n("Use short date in WN+Event view"), | 854 | addWidBool(i18n("Use short date in WN+Event view"), |
856 | &(KOPrefs::instance()->mShortDateInViewer),topFrame); | 855 | &(KOPrefs::instance()->mShortDateInViewer),topFrame); |
857 | topLayout->addWidget(passwdk->checkBox(), ii++,0); | 856 | topLayout->addWidget(passwdk->checkBox(), ii++,0); |
858 | 857 | ||
859 | 858 | ||
860 | 859 | ||
861 | 860 | ||
862 | // *********************** Todo View | 861 | // *********************** Todo View |
863 | 862 | ||
864 | topFrame = addPage(i18n("Todo View"),0,0); | 863 | topFrame = addPage(i18n("Todo View"),0,0); |
865 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | 864 | // DesktopIcon("viewmag",KIcon::SizeMedium)); |
866 | 865 | ||
867 | topLayout = new QGridLayout(topFrame,4,1); | 866 | topLayout = new QGridLayout(topFrame,4,1); |
868 | topLayout->setSpacing(mSpacingHint); | 867 | topLayout->setSpacing(mSpacingHint); |
869 | topLayout->setMargin(mMarginHint); | 868 | topLayout->setMargin(mMarginHint); |
870 | ii = 0; | 869 | ii = 0; |
871 | dummy = | 870 | dummy = |
872 | addWidBool(i18n("Hide not running Todos in To-do view"), | 871 | addWidBool(i18n("Hide not running Todos in To-do view"), |
873 | &(KOPrefs::instance()->mHideNonStartedTodos),topFrame); | 872 | &(KOPrefs::instance()->mHideNonStartedTodos),topFrame); |
874 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 873 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
875 | 874 | ||
876 | 875 | ||
877 | KPrefsDialogWidBool *showCompletedTodo = | 876 | KPrefsDialogWidBool *showCompletedTodo = |
878 | addWidBool(i18n("To-do view shows completed Todos"), | 877 | addWidBool(i18n("To-do view shows completed Todos"), |
879 | &(KOPrefs::instance()->mShowCompletedTodo),topFrame); | 878 | &(KOPrefs::instance()->mShowCompletedTodo),topFrame); |
880 | topLayout->addWidget(showCompletedTodo->checkBox(),ii++,0); | 879 | topLayout->addWidget(showCompletedTodo->checkBox(),ii++,0); |
881 | dummy = | 880 | dummy = |
882 | addWidBool(i18n("To-do view shows complete as 'xx %'"), | 881 | addWidBool(i18n("To-do view shows complete as 'xx %'"), |
883 | &(KOPrefs::instance()->mTodoViewShowsPercentage),topFrame); | 882 | &(KOPrefs::instance()->mTodoViewShowsPercentage),topFrame); |
884 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 883 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
885 | 884 | ||
886 | dummy = | 885 | dummy = |
887 | addWidBool(i18n("Small To-do view uses smaller font"), | 886 | addWidBool(i18n("Small To-do view uses smaller font"), |
888 | &(KOPrefs::instance()->mTodoViewUsesSmallFont),topFrame); | 887 | &(KOPrefs::instance()->mTodoViewUsesSmallFont),topFrame); |
889 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 888 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
890 | 889 | ||
891 | 890 | ||
892 | 891 | ||
893 | dummy = | 892 | dummy = |
894 | addWidBool(i18n("Todo view uses category colors"), | 893 | addWidBool(i18n("Todo view uses category colors"), |
895 | &(KOPrefs::instance()->mTodoViewUsesCatColors),topFrame); | 894 | &(KOPrefs::instance()->mTodoViewUsesCatColors),topFrame); |
896 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 895 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
897 | 896 | ||
898 | 897 | ||
899 | QWidget* wid = new QWidget( topFrame ); | 898 | QWidget* wid = new QWidget( topFrame ); |
900 | // Todo due today color | 899 | // Todo due today color |
901 | KPrefsDialogWidColor *todoDueTodayColor = | 900 | KPrefsDialogWidColor *todoDueTodayColor = |
902 | addWidColor(i18n("Todo due today color:"), | 901 | addWidColor(i18n("Todo due today color:"), |
903 | &(KOPrefs::instance()->mTodoDueTodayColor),wid); | 902 | &(KOPrefs::instance()->mTodoDueTodayColor),wid); |
904 | QHBoxLayout *widLayout = new QHBoxLayout(wid); | 903 | QHBoxLayout *widLayout = new QHBoxLayout(wid); |
905 | widLayout->addWidget( todoDueTodayColor->label() ); | 904 | widLayout->addWidget( todoDueTodayColor->label() ); |
906 | widLayout->addWidget( todoDueTodayColor->button() ); | 905 | widLayout->addWidget( todoDueTodayColor->button() ); |
907 | topLayout->addWidget(wid,ii++,0); | 906 | topLayout->addWidget(wid,ii++,0); |
908 | //topLayout->addWidget(todoDueTodayColor->button(),ii++,1); | 907 | //topLayout->addWidget(todoDueTodayColor->button(),ii++,1); |
909 | 908 | ||
910 | // Todo overdue color | 909 | // Todo overdue color |
911 | wid = new QWidget( topFrame ); | 910 | wid = new QWidget( topFrame ); |
912 | widLayout = new QHBoxLayout(wid); | 911 | widLayout = new QHBoxLayout(wid); |
913 | KPrefsDialogWidColor *todoOverdueColor = | 912 | KPrefsDialogWidColor *todoOverdueColor = |
914 | addWidColor(i18n("Todo overdue color:"), | 913 | addWidColor(i18n("Todo overdue color:"), |
915 | &(KOPrefs::instance()->mTodoOverdueColor),wid); | 914 | &(KOPrefs::instance()->mTodoOverdueColor),wid); |
916 | widLayout->addWidget(todoOverdueColor->label()); | 915 | widLayout->addWidget(todoOverdueColor->label()); |
917 | widLayout->addWidget(todoOverdueColor->button()); | 916 | widLayout->addWidget(todoOverdueColor->button()); |
918 | topLayout->addWidget(wid,ii++,0); | 917 | topLayout->addWidget(wid,ii++,0); |
919 | 918 | ||
920 | dummy = | 919 | dummy = |
921 | addWidBool(i18n("Colors are applied to text"), | 920 | addWidBool(i18n("Colors are applied to text"), |
922 | &(KOPrefs::instance()->mTodoViewUsesForegroundColor),topFrame); | 921 | &(KOPrefs::instance()->mTodoViewUsesForegroundColor),topFrame); |
923 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 922 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
924 | 923 | ||
925 | dummy = | 924 | dummy = |
926 | addWidBool(i18n("Allday Agenda view shows todos"), | 925 | addWidBool(i18n("Allday Agenda view shows todos"), |
927 | &(KOPrefs::instance()->mShowTodoInAgenda),topFrame); | 926 | &(KOPrefs::instance()->mShowTodoInAgenda),topFrame); |
928 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 927 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
929 | 928 | ||
930 | 929 | ||
931 | topFrame = addPage(i18n("View Options"),0,0); | 930 | topFrame = addPage(i18n("View Options"),0,0); |
932 | 931 | ||
933 | topLayout = new QGridLayout(topFrame,4,1); | 932 | topLayout = new QGridLayout(topFrame,4,1); |
934 | topLayout->setSpacing(mSpacingHint); | 933 | topLayout->setSpacing(mSpacingHint); |
935 | topLayout->setMargin(mMarginHint); | 934 | topLayout->setMargin(mMarginHint); |
936 | ii = 0; | 935 | ii = 0; |
937 | lab = new QLabel( i18n("Show in todo/event viewer:"), topFrame); | 936 | lab = new QLabel( i18n("Show in todo/event viewer:"), topFrame); |
938 | topLayout->addWidget(lab ,ii++,0); | 937 | topLayout->addWidget(lab ,ii++,0); |
939 | 938 | ||
940 | dummy = addWidBool(i18n("Details"), | 939 | dummy = addWidBool(i18n("Details"), |
941 | &(KOPrefs::instance()->mEVshowDetails),topFrame); | 940 | &(KOPrefs::instance()->mEVshowDetails),topFrame); |
942 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 941 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
943 | dummy = addWidBool(i18n("Created time"), | 942 | dummy = addWidBool(i18n("Created time"), |
944 | &(KOPrefs::instance()->mEVshowCreated),topFrame); | 943 | &(KOPrefs::instance()->mEVshowCreated),topFrame); |
945 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 944 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
946 | dummy = addWidBool(i18n("Last modified time"), | 945 | dummy = addWidBool(i18n("Last modified time"), |
947 | &(KOPrefs::instance()->mEVshowChanged),topFrame); | 946 | &(KOPrefs::instance()->mEVshowChanged),topFrame); |
948 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 947 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
949 | 948 | ||
950 | 949 | ||
951 | lab = new QLabel( i18n("Show in What'sThis quick overview:"), topFrame); | 950 | lab = new QLabel( i18n("Show in What'sThis quick overview:"), topFrame); |
952 | topLayout->addWidget(lab ,ii++,0); | 951 | topLayout->addWidget(lab ,ii++,0); |
953 | 952 | ||
954 | dummy = addWidBool(i18n("Details"), | 953 | dummy = addWidBool(i18n("Details"), |
955 | &(KOPrefs::instance()->mWTshowDetails),topFrame); | 954 | &(KOPrefs::instance()->mWTshowDetails),topFrame); |
956 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 955 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
957 | dummy = addWidBool(i18n("Created time"), | 956 | dummy = addWidBool(i18n("Created time"), |
958 | &(KOPrefs::instance()->mWTshowCreated),topFrame); | 957 | &(KOPrefs::instance()->mWTshowCreated),topFrame); |
959 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 958 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
960 | dummy = addWidBool(i18n("Last modified time"), | 959 | dummy = addWidBool(i18n("Last modified time"), |
961 | &(KOPrefs::instance()->mWTshowChanged),topFrame); | 960 | &(KOPrefs::instance()->mWTshowChanged),topFrame); |
962 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 961 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
963 | 962 | ||
964 | 963 | ||
965 | topFrame = addPage(i18n("Alarm"),0,0); | 964 | topFrame = addPage(i18n("Alarm"),0,0); |
966 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | 965 | // DesktopIcon("viewmag",KIcon::SizeMedium)); |
967 | 966 | ||
968 | topLayout = new QGridLayout(topFrame,2,1); | 967 | topLayout = new QGridLayout(topFrame,2,1); |
969 | topLayout->setSpacing(mSpacingHint); | 968 | topLayout->setSpacing(mSpacingHint); |
970 | topLayout->setMargin(mMarginHint); | 969 | topLayout->setMargin(mMarginHint); |
971 | int iii = 0; | 970 | int iii = 0; |
972 | 971 | ||
973 | dummy = | 972 | dummy = |
974 | addWidBool(i18n("Use internal alarm notification"), | 973 | addWidBool(i18n("Use internal alarm notification"), |
975 | &(KOPrefs::instance()->mUseInternalAlarmNotification),topFrame); | 974 | &(KOPrefs::instance()->mUseInternalAlarmNotification),topFrame); |
976 | topLayout->addWidget(dummy->checkBox(),iii++,0); | 975 | topLayout->addWidget(dummy->checkBox(),iii++,0); |
977 | lab = new QLabel( i18n("Note: KO/Pi must be running to notify you about an alarm. Recommended for use on Zaurus: Disable this option and install KO/Pi alarm applet.\n"), topFrame); | 976 | lab = new QLabel( i18n("Note: KO/Pi must be running to notify you about an alarm. Recommended for use on Zaurus: Disable this option and install KO/Pi alarm applet.\n"), topFrame); |
978 | 977 | ||
979 | topLayout->addWidget(lab ,iii++,0); | 978 | topLayout->addWidget(lab ,iii++,0); |
980 | #ifndef DESKTOP_VERSION | 979 | #ifndef DESKTOP_VERSION |
981 | lab->setAlignment( AlignLeft|WordBreak|AlignTop); | 980 | lab->setAlignment( AlignLeft|WordBreak|AlignTop); |
982 | #else | 981 | #else |
983 | lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop); | 982 | lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop); |
984 | lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); | 983 | lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); |
985 | #endif | 984 | #endif |
986 | 985 | ||
987 | QHBox* dummyBox = new QHBox(topFrame); | 986 | QHBox* dummyBox = new QHBox(topFrame); |
988 | new QLabel(i18n("Play beeps count:"),dummyBox); | 987 | new QLabel(i18n("Play beeps count:"),dummyBox); |
989 | mAlarmPlayBeeps = new QSpinBox(0,500,1,dummyBox); | 988 | mAlarmPlayBeeps = new QSpinBox(0,500,1,dummyBox); |
990 | topLayout->addWidget(dummyBox,iii++,0); | 989 | topLayout->addWidget(dummyBox,iii++,0); |
991 | 990 | ||
992 | dummyBox = new QHBox(topFrame); | 991 | dummyBox = new QHBox(topFrame); |
993 | new QLabel(i18n("Beeps interval in sec:"),dummyBox); | 992 | new QLabel(i18n("Beeps interval in sec:"),dummyBox); |
994 | mAlarmBeepInterval = new QSpinBox(1,600,1,dummyBox); | 993 | mAlarmBeepInterval = new QSpinBox(1,600,1,dummyBox); |
995 | topLayout->addWidget(dummyBox,iii++,0); | 994 | topLayout->addWidget(dummyBox,iii++,0); |
996 | 995 | ||
997 | dummyBox = new QHBox(topFrame); | 996 | dummyBox = new QHBox(topFrame); |
998 | new QLabel(i18n("Default suspend time in min:"),dummyBox); | 997 | new QLabel(i18n("Default suspend time in min:"),dummyBox); |
999 | mAlarmSuspendTime = new QSpinBox(1,600,1,dummyBox); | 998 | mAlarmSuspendTime = new QSpinBox(1,600,1,dummyBox); |
1000 | topLayout->addWidget(dummyBox,iii++,0); | 999 | topLayout->addWidget(dummyBox,iii++,0); |
1001 | 1000 | ||
1002 | dummyBox = new QHBox(topFrame); | 1001 | dummyBox = new QHBox(topFrame); |
1003 | new QLabel(i18n("Auto suspend count:"),dummyBox); | 1002 | new QLabel(i18n("Auto suspend count:"),dummyBox); |
1004 | mAlarmSuspendCount = new QSpinBox(0,60,1,dummyBox); | 1003 | mAlarmSuspendCount = new QSpinBox(0,60,1,dummyBox); |
1005 | topLayout->addWidget(dummyBox,iii++,0); | 1004 | topLayout->addWidget(dummyBox,iii++,0); |
1006 | 1005 | ||
1007 | 1006 | ||
1008 | 1007 | ||
1009 | 1008 | ||
1010 | 1009 | ||
1011 | 1010 | ||
1012 | 1011 | ||
1013 | QHBox* hbo = new QHBox ( topFrame ); | 1012 | QHBox* hbo = new QHBox ( topFrame ); |
1014 | mDefaultAlarmFile = new QLineEdit(hbo); | 1013 | mDefaultAlarmFile = new QLineEdit(hbo); |
1015 | QPushButton * loadTemplate = new QPushButton(hbo); | 1014 | QPushButton * loadTemplate = new QPushButton(hbo); |
1016 | QPixmap icon; | 1015 | QPixmap icon; |
1017 | if ( QApplication::desktop()->width() < 321 ) | 1016 | if ( QApplication::desktop()->width() < 321 ) |
1018 | icon = SmallIcon("fileimport16"); | 1017 | icon = SmallIcon("fileimport16"); |
1019 | else | 1018 | else |
1020 | icon = SmallIcon("fileimport"); | 1019 | icon = SmallIcon("fileimport"); |
1021 | loadTemplate->setIconSet (icon ) ; | 1020 | loadTemplate->setIconSet (icon ) ; |
1022 | connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( selectSoundFile() ) ); | 1021 | connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( selectSoundFile() ) ); |
1023 | int size = loadTemplate->sizeHint().height(); | 1022 | int size = loadTemplate->sizeHint().height(); |
1024 | loadTemplate->setFixedSize( size, size ); | 1023 | loadTemplate->setFixedSize( size, size ); |
1025 | //lab = new QLabel( i18n("This setting is useless for 5500 user!"), topFrame); | 1024 | //lab = new QLabel( i18n("This setting is useless for 5500 user!"), topFrame); |
1026 | // topLayout->addWidget(lab ,iii++,0); | 1025 | // topLayout->addWidget(lab ,iii++,0); |
1027 | lab = new QLabel( i18n("Alarm *.wav file for newly created alarm:"), topFrame); | 1026 | lab = new QLabel( i18n("Alarm *.wav file for newly created alarm:"), topFrame); |
1028 | topLayout->addWidget(lab ,iii++,0); | 1027 | topLayout->addWidget(lab ,iii++,0); |
1029 | topLayout->addWidget(hbo,iii++,0); | 1028 | topLayout->addWidget(hbo,iii++,0); |
1030 | // lab = new QLabel( i18n("Note: This does not mean, that for every alarm this file is replayed. This file here is associated with a newly created alarm."), topFrame); | 1029 | // lab = new QLabel( i18n("Note: This does not mean, that for every alarm this file is replayed. This file here is associated with a newly created alarm."), topFrame); |
1031 | 1030 | ||
1032 | // topLayout->addWidget(lab ,iii++,0); | 1031 | // topLayout->addWidget(lab ,iii++,0); |
1033 | // #ifndef DESKTOP_VERSION | 1032 | // #ifndef DESKTOP_VERSION |
1034 | // lab->setAlignment( AlignLeft|WordBreak|AlignTop); | 1033 | // lab->setAlignment( AlignLeft|WordBreak|AlignTop); |
1035 | // #else | 1034 | // #else |
1036 | // lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop); | 1035 | // lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop); |
1037 | // lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); | 1036 | // lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); |
1038 | // #endif | 1037 | // #endif |
1039 | 1038 | ||
1040 | 1039 | ||
1041 | } | 1040 | } |
1042 | 1041 | ||
1043 | void KOPrefsDialog::selectSoundFile() | 1042 | void KOPrefsDialog::selectSoundFile() |
1044 | { | 1043 | { |
1045 | QString fileName = mDefaultAlarmFile->text(); | 1044 | QString fileName = mDefaultAlarmFile->text(); |
1046 | fileName = KFileDialog::getSaveFileName( mDefaultAlarmFile->text() , "Choose default alarm file", this ); | 1045 | fileName = KFileDialog::getSaveFileName( mDefaultAlarmFile->text() , "Choose default alarm file", this ); |
1047 | if ( fileName.length() > 0 ) | 1046 | if ( fileName.length() > 0 ) |
1048 | mDefaultAlarmFile->setText( fileName ); | 1047 | mDefaultAlarmFile->setText( fileName ); |
1049 | } | 1048 | } |
1050 | void KOPrefsDialog::setupFontsTab() | 1049 | void KOPrefsDialog::setupFontsTab() |
1051 | { | 1050 | { |
1052 | 1051 | ||
1053 | QFrame *topFrame = addPage(i18n("Fonts"),0,0); | 1052 | QFrame *topFrame = addPage(i18n("Fonts"),0,0); |
1054 | // DesktopIcon("fonts",KIcon::SizeMedium)); | 1053 | // DesktopIcon("fonts",KIcon::SizeMedium)); |
1055 | 1054 | ||
1056 | QGridLayout *topLayout = new QGridLayout(topFrame,7,3); | 1055 | QGridLayout *topLayout = new QGridLayout(topFrame,7,3); |
1057 | topLayout->setSpacing(1); | 1056 | topLayout->setSpacing(1); |
1058 | topLayout->setMargin(3); | 1057 | topLayout->setMargin(3); |
1059 | KPrefsDialogWidFont * tVFont; | 1058 | KPrefsDialogWidFont * tVFont; |
1060 | int i = 0; | 1059 | int i = 0; |
1061 | KPrefsDialogWidFont *timeLabelsFont = | 1060 | KPrefsDialogWidFont *timeLabelsFont = |
1062 | addWidFont(i18n("23"),i18n("DateNavigator:(nr)"), | 1061 | addWidFont(i18n("23"),i18n("DateNavigator:(nr)"), |
1063 | &(KOPrefs::instance()->mDateNavigatorFont),topFrame); | 1062 | &(KOPrefs::instance()->mDateNavigatorFont),topFrame); |
1064 | topLayout->addWidget(timeLabelsFont->label(),i,0); | 1063 | topLayout->addWidget(timeLabelsFont->label(),i,0); |
1065 | topLayout->addWidget(timeLabelsFont->preview(),i,1); | 1064 | topLayout->addWidget(timeLabelsFont->preview(),i,1); |
1066 | topLayout->addWidget(timeLabelsFont->button(),i,2); | 1065 | topLayout->addWidget(timeLabelsFont->button(),i,2); |
1067 | ++i; | 1066 | ++i; |
1068 | 1067 | ||
1069 | 1068 | ||
1070 | timeLabelsFont = | 1069 | timeLabelsFont = |
1071 | addWidFont(i18n("Mon 15"),i18n("Date Labels:"), | 1070 | addWidFont(i18n("Mon 15"),i18n("Date Labels:"), |
1072 | &(KOPrefs::instance()->mTimeLabelsFont),topFrame); | 1071 | &(KOPrefs::instance()->mTimeLabelsFont),topFrame); |
1073 | topLayout->addWidget(timeLabelsFont->label(),i,0); | 1072 | topLayout->addWidget(timeLabelsFont->label(),i,0); |
1074 | topLayout->addWidget(timeLabelsFont->preview(),i,1); | 1073 | topLayout->addWidget(timeLabelsFont->preview(),i,1); |
1075 | topLayout->addWidget(timeLabelsFont->button(),i,2); | 1074 | topLayout->addWidget(timeLabelsFont->button(),i,2); |
1076 | ++i; | 1075 | ++i; |
1077 | 1076 | ||
1078 | KPrefsDialogWidFont *timeBarFont = | 1077 | KPrefsDialogWidFont *timeBarFont = |
1079 | addWidFont(KGlobal::locale()->formatTime(QTime(12,34)),i18n("Time bar:"), | 1078 | addWidFont(KGlobal::locale()->formatTime(QTime(12,34)),i18n("Time bar:"), |
1080 | &(KOPrefs::instance()->mTimeBarFont),topFrame); | 1079 | &(KOPrefs::instance()->mTimeBarFont),topFrame); |
1081 | topLayout->addWidget(timeBarFont->label(),i,0); | 1080 | topLayout->addWidget(timeBarFont->label(),i,0); |
1082 | topLayout->addWidget(timeBarFont->preview(),i,1); | 1081 | topLayout->addWidget(timeBarFont->preview(),i,1); |
1083 | topLayout->addWidget(timeBarFont->button(),i,2); | 1082 | topLayout->addWidget(timeBarFont->button(),i,2); |
1084 | ++i; | 1083 | ++i; |
1085 | 1084 | ||
1086 | 1085 | ||
1087 | KPrefsDialogWidFont *marcusBainsFont = | 1086 | KPrefsDialogWidFont *marcusBainsFont = |
1088 | addWidFont(KGlobal::locale()->formatTime(QTime(12,34,23)),i18n("M. Bains line:"), | 1087 | addWidFont(KGlobal::locale()->formatTime(QTime(12,34,23)),i18n("M. Bains line:"), |
1089 | &(KOPrefs::instance()->mMarcusBainsFont),topFrame); | 1088 | &(KOPrefs::instance()->mMarcusBainsFont),topFrame); |
1090 | topLayout->addWidget(marcusBainsFont->label(),i,0); | 1089 | topLayout->addWidget(marcusBainsFont->label(),i,0); |
1091 | topLayout->addWidget(marcusBainsFont->preview(),i,1); | 1090 | topLayout->addWidget(marcusBainsFont->preview(),i,1); |
1092 | topLayout->addWidget(marcusBainsFont->button(),i,2); | 1091 | topLayout->addWidget(marcusBainsFont->button(),i,2); |
1093 | ++i; | 1092 | ++i; |
1094 | 1093 | ||
1095 | tVFont = | 1094 | tVFont = |
1096 | addWidFont(i18n("Summary"),i18n("Event Viewer:"), | 1095 | addWidFont(i18n("Summary"),i18n("Event Viewer:"), |
1097 | &(KOPrefs::instance()->mEventViewFont),topFrame); | 1096 | &(KOPrefs::instance()->mEventViewFont),topFrame); |
1098 | topLayout->addWidget(tVFont->label(),i,0); | 1097 | topLayout->addWidget(tVFont->label(),i,0); |
1099 | topLayout->addWidget(tVFont->preview(),i,1); | 1098 | topLayout->addWidget(tVFont->preview(),i,1); |
1100 | topLayout->addWidget(tVFont->button(),i,2); | 1099 | topLayout->addWidget(tVFont->button(),i,2); |
1101 | ++i; | 1100 | ++i; |
1102 | 1101 | ||
1103 | 1102 | ||
1104 | 1103 | ||
1105 | tVFont = | 1104 | tVFont = |
1106 | addWidFont(i18n("Details"),i18n("EditorBox:"), | 1105 | addWidFont(i18n("Details"),i18n("EditorBox:"), |
1107 | &(KOPrefs::instance()->mEditBoxFont),topFrame); | 1106 | &(KOPrefs::instance()->mEditBoxFont),topFrame); |
1108 | topLayout->addWidget(tVFont->label(),i,0); | 1107 | topLayout->addWidget(tVFont->label(),i,0); |
1109 | topLayout->addWidget(tVFont->preview(),i,1); | 1108 | topLayout->addWidget(tVFont->preview(),i,1); |
1110 | topLayout->addWidget(tVFont->button(),i,2); | 1109 | topLayout->addWidget(tVFont->button(),i,2); |
1111 | ++i; | 1110 | ++i; |
1112 | 1111 | ||
1113 | 1112 | ||
1114 | 1113 | ||
1115 | topLayout->setColStretch(1,1); | 1114 | topLayout->setColStretch(1,1); |
1116 | topLayout->setRowStretch(4,1); | 1115 | topLayout->setRowStretch(4,1); |
1117 | 1116 | ||
1118 | 1117 | ||
1119 | i = 0; | 1118 | i = 0; |
1120 | topFrame = addPage(i18n("View Fonts"),0, | 1119 | topFrame = addPage(i18n("View Fonts"),0, |
1121 | DesktopIcon("fonts",KIcon::SizeMedium)); | 1120 | DesktopIcon("fonts",KIcon::SizeMedium)); |
1122 | 1121 | ||
1123 | topLayout = new QGridLayout(topFrame,7,3); | 1122 | topLayout = new QGridLayout(topFrame,7,3); |
1124 | topLayout->setSpacing(1); | 1123 | topLayout->setSpacing(1); |
1125 | topLayout->setMargin(3); | 1124 | topLayout->setMargin(3); |
1126 | 1125 | ||
1127 | tVFont = | 1126 | tVFont = |
1128 | addWidFont(i18n("Configure KO"),i18n("What's Next View:"), | 1127 | addWidFont(i18n("Configure KO"),i18n("What's Next View:"), |
1129 | &(KOPrefs::instance()->mWhatsNextFont),topFrame); | 1128 | &(KOPrefs::instance()->mWhatsNextFont),topFrame); |
1130 | topLayout->addWidget(tVFont->label(),i,0); | 1129 | topLayout->addWidget(tVFont->label(),i,0); |
1131 | topLayout->addWidget(tVFont->preview(),i,1); | 1130 | topLayout->addWidget(tVFont->preview(),i,1); |
1132 | topLayout->addWidget(tVFont->button(),i,2); | 1131 | topLayout->addWidget(tVFont->button(),i,2); |
1133 | ++i; | 1132 | ++i; |
1134 | KPrefsDialogWidFont *agendaViewFont = | 1133 | KPrefsDialogWidFont *agendaViewFont = |
1135 | addWidFont(i18n("Event text"),i18n("Agenda view:"), | 1134 | addWidFont(i18n("Event text"),i18n("Agenda view:"), |
1136 | &(KOPrefs::instance()->mAgendaViewFont),topFrame); | 1135 | &(KOPrefs::instance()->mAgendaViewFont),topFrame); |
1137 | topLayout->addWidget(agendaViewFont->label(),i,0); | 1136 | topLayout->addWidget(agendaViewFont->label(),i,0); |
1138 | topLayout->addWidget(agendaViewFont->preview(),i,1); | 1137 | topLayout->addWidget(agendaViewFont->preview(),i,1); |
1139 | topLayout->addWidget(agendaViewFont->button(),i,2); | 1138 | topLayout->addWidget(agendaViewFont->button(),i,2); |
1140 | ++i; | 1139 | ++i; |
1141 | 1140 | ||
1142 | 1141 | ||
1143 | KPrefsDialogWidFont *monthViewFont = | 1142 | KPrefsDialogWidFont *monthViewFont = |
1144 | addWidFont(KGlobal::locale()->formatTime(QTime(12,34)) + " " + i18n("Event"), | 1143 | addWidFont(KGlobal::locale()->formatTime(QTime(12,34)) + " " + i18n("Event"), |
1145 | i18n("Month view:"),&(KOPrefs::instance()->mMonthViewFont),topFrame); | 1144 | i18n("Month view:"),&(KOPrefs::instance()->mMonthViewFont),topFrame); |
1146 | topLayout->addWidget(monthViewFont->label(),i,0); | 1145 | topLayout->addWidget(monthViewFont->label(),i,0); |
1147 | topLayout->addWidget(monthViewFont->preview(),i,1); | 1146 | topLayout->addWidget(monthViewFont->preview(),i,1); |
1148 | topLayout->addWidget(monthViewFont->button(),i,2); | 1147 | topLayout->addWidget(monthViewFont->button(),i,2); |
1149 | ++i; | 1148 | ++i; |
1150 | 1149 | ||
1151 | 1150 | ||
1152 | KPrefsDialogWidFont *lVFont = | 1151 | KPrefsDialogWidFont *lVFont = |
1153 | addWidFont(i18n("Event"),i18n("List View:"), | 1152 | addWidFont(i18n("Event"),i18n("List View:"), |
1154 | &(KOPrefs::instance()->mListViewFont),topFrame); | 1153 | &(KOPrefs::instance()->mListViewFont),topFrame); |
1155 | topLayout->addWidget(lVFont->label(),i,0); | 1154 | topLayout->addWidget(lVFont->label(),i,0); |
1156 | topLayout->addWidget(lVFont->preview(),i,1); | 1155 | topLayout->addWidget(lVFont->preview(),i,1); |
1157 | topLayout->addWidget(lVFont->button(),i,2); | 1156 | topLayout->addWidget(lVFont->button(),i,2); |
1158 | ++i; | 1157 | ++i; |
1159 | 1158 | ||
1160 | 1159 | ||
1161 | tVFont = | 1160 | tVFont = |
1162 | addWidFont(i18n("ToDo"),i18n("ToDoView:"), | 1161 | addWidFont(i18n("ToDo"),i18n("ToDoView:"), |
1163 | &(KOPrefs::instance()->mTodoViewFont),topFrame); | 1162 | &(KOPrefs::instance()->mTodoViewFont),topFrame); |
1164 | topLayout->addWidget(tVFont->label(),i,0); | 1163 | topLayout->addWidget(tVFont->label(),i,0); |
1165 | topLayout->addWidget(tVFont->preview(),i,1); | 1164 | topLayout->addWidget(tVFont->preview(),i,1); |
1166 | topLayout->addWidget(tVFont->button(),i,2); | 1165 | topLayout->addWidget(tVFont->button(),i,2); |
1167 | ++i; | 1166 | ++i; |
1168 | 1167 | ||
1169 | 1168 | ||
1170 | tVFont = | 1169 | tVFont = |
1171 | addWidFont(i18n("Today"),i18n("JournalView:"), | 1170 | addWidFont(i18n("Today"),i18n("JournalView:"), |
1172 | &(KOPrefs::instance()->mJornalViewFont),topFrame); | 1171 | &(KOPrefs::instance()->mJornalViewFont),topFrame); |
1173 | topLayout->addWidget(tVFont->label(),i,0); | 1172 | topLayout->addWidget(tVFont->label(),i,0); |
1174 | topLayout->addWidget(tVFont->preview(),i,1); | 1173 | topLayout->addWidget(tVFont->preview(),i,1); |
1175 | topLayout->addWidget(tVFont->button(),i,2); | 1174 | topLayout->addWidget(tVFont->button(),i,2); |
1176 | ++i; | 1175 | ++i; |
1177 | 1176 | ||
1178 | 1177 | ||
1179 | 1178 | ||
1180 | 1179 | ||
1181 | topLayout->setColStretch(1,1); | 1180 | topLayout->setColStretch(1,1); |
1182 | topLayout->setRowStretch(4,1); | 1181 | topLayout->setRowStretch(4,1); |
1183 | 1182 | ||
1184 | 1183 | ||
1185 | 1184 | ||
1186 | 1185 | ||
1187 | } | 1186 | } |
1188 | 1187 | ||
1189 | void KOPrefsDialog::setupColorsTab() | 1188 | void KOPrefsDialog::setupColorsTab() |
1190 | { | 1189 | { |
1191 | QFrame *topFrame = addPage(i18n("Colors"),0,0); | 1190 | QFrame *topFrame = addPage(i18n("Colors"),0,0); |
1192 | // DesktopIcon("colorize",KIcon::SizeMedium)); | 1191 | // DesktopIcon("colorize",KIcon::SizeMedium)); |
1193 | 1192 | ||
1194 | QGridLayout *topLayout = new QGridLayout(topFrame,5,2); | 1193 | QGridLayout *topLayout = new QGridLayout(topFrame,5,2); |
1195 | // topLayout->setSpacing(mSpacingHint); | 1194 | // topLayout->setSpacing(mSpacingHint); |
1196 | // topLayout->setMargin(mMarginHint); | 1195 | // topLayout->setMargin(mMarginHint); |
1197 | 1196 | ||
1198 | topLayout->setSpacing(2); | 1197 | topLayout->setSpacing(2); |
1199 | topLayout->setMargin(3); | 1198 | topLayout->setMargin(3); |
1200 | 1199 | ||
1201 | int ii = 1; | 1200 | int ii = 1; |
1202 | QGroupBox *categoryGroup ; | 1201 | QGroupBox *categoryGroup ; |
1203 | 1202 | ||
1204 | categoryGroup = new QGroupBox(1,Vertical,i18n("Categories"), | 1203 | categoryGroup = new QGroupBox(1,Vertical,i18n("Categories"), |
1205 | topFrame); | 1204 | topFrame); |
1206 | topLayout->addMultiCellWidget(categoryGroup,0,0,0,1); | 1205 | topLayout->addMultiCellWidget(categoryGroup,0,0,0,1); |
1207 | 1206 | ||
1208 | mCategoryCombo = new QComboBox(categoryGroup); | 1207 | mCategoryCombo = new QComboBox(categoryGroup); |
1209 | mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories); | 1208 | mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories); |
1210 | connect(mCategoryCombo,SIGNAL(activated(int)),SLOT(updateCategoryColor())); | 1209 | connect(mCategoryCombo,SIGNAL(activated(int)),SLOT(updateCategoryColor())); |
1211 | 1210 | ||
1212 | mCategoryButton = new KColorButton(categoryGroup); | 1211 | mCategoryButton = new KColorButton(categoryGroup); |
1213 | connect(mCategoryButton,SIGNAL(changed(const QColor &)),SLOT(setCategoryColor())); | 1212 | connect(mCategoryButton,SIGNAL(changed(const QColor &)),SLOT(setCategoryColor())); |
1214 | updateCategoryColor(); | 1213 | updateCategoryColor(); |
1215 | 1214 | ||
1216 | 1215 | ||
1217 | // Holiday Color | 1216 | // Holiday Color |
1218 | 1217 | ||
1219 | KPrefsDialogWidColor *holidayColor = | 1218 | KPrefsDialogWidColor *holidayColor = |
1220 | addWidColor(i18n("Holiday color:"), | 1219 | addWidColor(i18n("Holiday color:"), |
1221 | &(KOPrefs::instance()->mHolidayColor),topFrame); | 1220 | &(KOPrefs::instance()->mHolidayColor),topFrame); |
1222 | topLayout->addWidget(holidayColor->label(),ii,0); | 1221 | topLayout->addWidget(holidayColor->label(),ii,0); |
1223 | topLayout->addWidget(holidayColor->button(),ii++,1); | 1222 | topLayout->addWidget(holidayColor->button(),ii++,1); |
1224 | 1223 | ||
1225 | // Highlight Color | 1224 | // Highlight Color |
1226 | KPrefsDialogWidColor *highlightColor = | 1225 | KPrefsDialogWidColor *highlightColor = |
1227 | addWidColor(i18n("Highlight color:"), | 1226 | addWidColor(i18n("Highlight color:"), |
1228 | &(KOPrefs::instance()->mHighlightColor),topFrame); | 1227 | &(KOPrefs::instance()->mHighlightColor),topFrame); |
1229 | topLayout->addWidget(highlightColor->label(),ii,0); | 1228 | topLayout->addWidget(highlightColor->label(),ii,0); |
1230 | topLayout->addWidget(highlightColor->button(),ii++,1); | 1229 | topLayout->addWidget(highlightColor->button(),ii++,1); |
1231 | 1230 | ||
1232 | // Event color | 1231 | // Event color |
1233 | KPrefsDialogWidColor *eventColor = | 1232 | KPrefsDialogWidColor *eventColor = |
1234 | addWidColor(i18n("Default event color:"), | 1233 | addWidColor(i18n("Default event color:"), |
1235 | &(KOPrefs::instance()->mEventColor),topFrame); | 1234 | &(KOPrefs::instance()->mEventColor),topFrame); |
1236 | topLayout->addWidget(eventColor->label(),ii,0); | 1235 | topLayout->addWidget(eventColor->label(),ii,0); |
1237 | topLayout->addWidget(eventColor->button(),ii++,1); | 1236 | topLayout->addWidget(eventColor->button(),ii++,1); |
1238 | eventColor = | 1237 | eventColor = |
1239 | addWidColor(i18n("Default todo done color:"), | 1238 | addWidColor(i18n("Default todo done color:"), |
1240 | &(KOPrefs::instance()->mTodoDoneColor),topFrame); | 1239 | &(KOPrefs::instance()->mTodoDoneColor),topFrame); |
1241 | topLayout->addWidget(eventColor->label(),ii,0); | 1240 | topLayout->addWidget(eventColor->label(),ii,0); |
1242 | topLayout->addWidget(eventColor->button(),ii++,1); | 1241 | topLayout->addWidget(eventColor->button(),ii++,1); |
1243 | 1242 | ||
1244 | 1243 | ||
1245 | // agenda view background color | 1244 | // agenda view background color |
1246 | KPrefsDialogWidColor *agendaBgColor = | 1245 | KPrefsDialogWidColor *agendaBgColor = |
1247 | addWidColor(i18n("Agenda view background color:"), | 1246 | addWidColor(i18n("Agenda view background color:"), |
1248 | &(KOPrefs::instance()->mAgendaBgColor),topFrame); | 1247 | &(KOPrefs::instance()->mAgendaBgColor),topFrame); |
1249 | topLayout->addWidget(agendaBgColor->label(),ii,0); | 1248 | topLayout->addWidget(agendaBgColor->label(),ii,0); |
1250 | topLayout->addWidget(agendaBgColor->button(),ii++,1); | 1249 | topLayout->addWidget(agendaBgColor->button(),ii++,1); |
1251 | 1250 | ||
1252 | // working hours color | 1251 | // working hours color |
1253 | KPrefsDialogWidColor *workingHoursColor = | 1252 | KPrefsDialogWidColor *workingHoursColor = |
1254 | addWidColor(i18n("Working hours color:"), | 1253 | addWidColor(i18n("Working hours color:"), |
1255 | &(KOPrefs::instance()->mWorkingHoursColor),topFrame); | 1254 | &(KOPrefs::instance()->mWorkingHoursColor),topFrame); |
1256 | topLayout->addWidget(workingHoursColor->label(),ii,0); | 1255 | topLayout->addWidget(workingHoursColor->label(),ii,0); |
1257 | topLayout->addWidget(workingHoursColor->button(),ii++,1); | 1256 | topLayout->addWidget(workingHoursColor->button(),ii++,1); |
1258 | 1257 | ||
1259 | KPrefsDialogWidBool *sb = | 1258 | KPrefsDialogWidBool *sb = |
1260 | addWidBool(i18n("Use colors for application:"), | 1259 | addWidBool(i18n("Use colors for application:"), |
1261 | &(KOPrefs::instance()->mUseAppColors),topFrame); | 1260 | &(KOPrefs::instance()->mUseAppColors),topFrame); |
1262 | topLayout->addMultiCellWidget(sb->checkBox(), ii, ii, 0,1 ); | 1261 | topLayout->addMultiCellWidget(sb->checkBox(), ii, ii, 0,1 ); |
1263 | 1262 | ||
1264 | ii++; | 1263 | ii++; |
1265 | KPrefsDialogWidColor * workingHoursColor1 = | 1264 | KPrefsDialogWidColor * workingHoursColor1 = |
1266 | addWidColor(i18n("Buttons, menus, etc.:"), | 1265 | addWidColor(i18n("Buttons, menus, etc.:"), |
1267 | &(KOPrefs::instance()->mAppColor1),topFrame); | 1266 | &(KOPrefs::instance()->mAppColor1),topFrame); |
1268 | topLayout->addWidget(workingHoursColor1->label(),ii,0); | 1267 | topLayout->addWidget(workingHoursColor1->label(),ii,0); |
1269 | topLayout->addWidget(workingHoursColor1->button(),ii++,1); | 1268 | topLayout->addWidget(workingHoursColor1->button(),ii++,1); |
1270 | 1269 | ||
1271 | KPrefsDialogWidColor * workingHoursColor2 = | 1270 | KPrefsDialogWidColor * workingHoursColor2 = |
1272 | addWidColor(i18n("Frames, labels, etc.:"), | 1271 | addWidColor(i18n("Frames, labels, etc.:"), |
1273 | &(KOPrefs::instance()->mAppColor2),topFrame); | 1272 | &(KOPrefs::instance()->mAppColor2),topFrame); |
1274 | topLayout->addWidget(workingHoursColor2->label(),ii,0); | 1273 | topLayout->addWidget(workingHoursColor2->label(),ii,0); |
1275 | topLayout->addWidget(workingHoursColor2->button(),ii++,1); | 1274 | topLayout->addWidget(workingHoursColor2->button(),ii++,1); |
1276 | 1275 | ||
1277 | 1276 | ||
1278 | 1277 | ||
1279 | } | 1278 | } |
1280 | 1279 | ||
1281 | void KOPrefsDialog::setCategoryColor() | 1280 | void KOPrefsDialog::setCategoryColor() |
1282 | { | 1281 | { |
1283 | mCategoryDict.replace(mCategoryCombo->currentText(), new QColor(mCategoryButton->color())); | 1282 | mCategoryDict.replace(mCategoryCombo->currentText(), new QColor(mCategoryButton->color())); |
1284 | } | 1283 | } |
1285 | 1284 | ||
1286 | void KOPrefsDialog::updateCategoryColor() | 1285 | void KOPrefsDialog::updateCategoryColor() |
1287 | { | 1286 | { |
1288 | QString cat = mCategoryCombo->currentText(); | 1287 | QString cat = mCategoryCombo->currentText(); |
1289 | QColor *color = mCategoryDict.find(cat); | 1288 | QColor *color = mCategoryDict.find(cat); |
1290 | if (!color) { | 1289 | if (!color) { |
1291 | color = KOPrefs::instance()->categoryColor(cat); | 1290 | color = KOPrefs::instance()->categoryColor(cat); |
1292 | } | 1291 | } |
1293 | if (color) { | 1292 | if (color) { |
1294 | mCategoryButton->setColor(*color); | 1293 | mCategoryButton->setColor(*color); |
1295 | } | 1294 | } |
1296 | } | 1295 | } |
1297 | 1296 | ||
1298 | void KOPrefsDialog::setupPrinterTab() | 1297 | void KOPrefsDialog::setupPrinterTab() |
1299 | { | 1298 | { |
1300 | mPrinterTab = addPage(i18n("Printing"),0, | 1299 | mPrinterTab = addPage(i18n("Printing"),0, |
1301 | DesktopIcon("fileprint",KIcon::SizeMedium)); | 1300 | DesktopIcon("fileprint",KIcon::SizeMedium)); |
1302 | 1301 | ||
1303 | QGridLayout *topLayout = new QGridLayout(mPrinterTab,5,2); | 1302 | QGridLayout *topLayout = new QGridLayout(mPrinterTab,5,2); |
1304 | topLayout->setSpacing(mSpacingHint); | 1303 | topLayout->setSpacing(mSpacingHint); |
1305 | topLayout->setMargin(mMarginHint); | 1304 | topLayout->setMargin(mMarginHint); |
1306 | 1305 | ||
1307 | topLayout->setRowStretch(4,1); | 1306 | topLayout->setRowStretch(4,1); |
1308 | } | 1307 | } |
1309 | 1308 | ||
1310 | void KOPrefsDialog::setupGroupSchedulingTab() | 1309 | void KOPrefsDialog::setupGroupSchedulingTab() |
1311 | { | 1310 | { |
1312 | #if 0 | 1311 | #if 0 |
1313 | QFrame *topFrame = addPage(i18n("Group Scheduling"),0, | 1312 | QFrame *topFrame = addPage(i18n("Group Scheduling"),0, |
1314 | DesktopIcon("personal",KIcon::SizeMedium)); | 1313 | DesktopIcon("personal",KIcon::SizeMedium)); |
1315 | 1314 | ||
1316 | QGridLayout *topLayout = new QGridLayout(topFrame,6,2); | 1315 | QGridLayout *topLayout = new QGridLayout(topFrame,6,2); |
1317 | topLayout->setSpacing(mSpacingHint); | 1316 | topLayout->setSpacing(mSpacingHint); |
1318 | topLayout->setMargin(mMarginHint); | 1317 | topLayout->setMargin(mMarginHint); |
1319 | 1318 | ||
1320 | #if 0 | 1319 | #if 0 |
1321 | KPrefsDialogWidRadios *schedulerGroup = | 1320 | KPrefsDialogWidRadios *schedulerGroup = |
1322 | addWidRadios(i18n("Scheduler Mail Client"),&(KOPrefs::instance()->mIMIPScheduler), | 1321 | addWidRadios(i18n("Scheduler Mail Client"),&(KOPrefs::instance()->mIMIPScheduler), |
1323 | topFrame); | 1322 | topFrame); |
1324 | schedulerGroup->addRadio("Dummy"); // Only for debugging | 1323 | schedulerGroup->addRadio("Dummy"); // Only for debugging |
1325 | schedulerGroup->addRadio(i18n("Mail client")); | 1324 | schedulerGroup->addRadio(i18n("Mail client")); |
1326 | 1325 | ||
1327 | topLayout->addMultiCellWidget(schedulerGroup->groupBox(),0,0,0,1); | 1326 | topLayout->addMultiCellWidget(schedulerGroup->groupBox(),0,0,0,1); |
1328 | #endif | 1327 | #endif |
1329 | 1328 | ||
1330 | KPrefsDialogWidRadios *sendGroup = | 1329 | KPrefsDialogWidRadios *sendGroup = |
1331 | addWidRadios(i18n("Scheduler Mails Should Be"),&(KOPrefs::instance()->mIMIPSend), | 1330 | addWidRadios(i18n("Scheduler Mails Should Be"),&(KOPrefs::instance()->mIMIPSend), |
1332 | topFrame); | 1331 | topFrame); |
1333 | sendGroup->addRadio(i18n("Send to outbox")); | 1332 | sendGroup->addRadio(i18n("Send to outbox")); |
1334 | sendGroup->addRadio(i18n("Send directly")); | 1333 | sendGroup->addRadio(i18n("Send directly")); |
1335 | 1334 | ||
1336 | topLayout->addMultiCellWidget(sendGroup->groupBox(),1,1,0,1); | 1335 | topLayout->addMultiCellWidget(sendGroup->groupBox(),1,1,0,1); |
1337 | 1336 | ||
1338 | topLayout->addMultiCellWidget(new QLabel(i18n("Additional email addresses:"),topFrame),2,2,0,1); | 1337 | topLayout->addMultiCellWidget(new QLabel(i18n("Additional email addresses:"),topFrame),2,2,0,1); |
1339 | mAMails = new QListView(topFrame); | 1338 | mAMails = new QListView(topFrame); |
1340 | mAMails->addColumn(i18n("Email"),300); | 1339 | mAMails->addColumn(i18n("Email"),300); |
1341 | topLayout->addMultiCellWidget(mAMails,3,3,0,1); | 1340 | topLayout->addMultiCellWidget(mAMails,3,3,0,1); |
1342 | 1341 | ||
1343 | topLayout->addWidget(new QLabel(i18n("Additional email address:"),topFrame),4,0); | 1342 | topLayout->addWidget(new QLabel(i18n("Additional email address:"),topFrame),4,0); |
1344 | aEmailsEdit = new QLineEdit(topFrame); | 1343 | aEmailsEdit = new QLineEdit(topFrame); |
1345 | aEmailsEdit->setEnabled(false); | 1344 | aEmailsEdit->setEnabled(false); |
1346 | topLayout->addWidget(aEmailsEdit,4,1); | 1345 | topLayout->addWidget(aEmailsEdit,4,1); |
1347 | 1346 | ||
1348 | QPushButton *add = new QPushButton(i18n("New"),topFrame,"new"); | 1347 | QPushButton *add = new QPushButton(i18n("New"),topFrame,"new"); |
1349 | topLayout->addWidget(add,5,0); | 1348 | topLayout->addWidget(add,5,0); |
1350 | QPushButton *del = new QPushButton(i18n("Remove"),topFrame,"remove"); | 1349 | QPushButton *del = new QPushButton(i18n("Remove"),topFrame,"remove"); |
1351 | topLayout->addWidget(del,5,1); | 1350 | topLayout->addWidget(del,5,1); |
1352 | 1351 | ||
1353 | //topLayout->setRowStretch(2,1); | 1352 | //topLayout->setRowStretch(2,1); |
1354 | connect(add, SIGNAL( clicked() ), this, SLOT(addItem()) ); | 1353 | connect(add, SIGNAL( clicked() ), this, SLOT(addItem()) ); |
1355 | connect(del, SIGNAL( clicked() ), this, SLOT(removeItem()) ); | 1354 | connect(del, SIGNAL( clicked() ), this, SLOT(removeItem()) ); |
1356 | connect(aEmailsEdit,SIGNAL( textChanged(const QString&) ), this,SLOT(updateItem())); | 1355 | connect(aEmailsEdit,SIGNAL( textChanged(const QString&) ), this,SLOT(updateItem())); |
1357 | connect(mAMails,SIGNAL(selectionChanged(QListViewItem *)),SLOT(updateInput())); | 1356 | connect(mAMails,SIGNAL(selectionChanged(QListViewItem *)),SLOT(updateInput())); |
1358 | #endif | 1357 | #endif |
1359 | } | 1358 | } |
1360 | 1359 | ||
1361 | void KOPrefsDialog::setupGroupAutomationTab() | 1360 | void KOPrefsDialog::setupGroupAutomationTab() |
1362 | { | 1361 | { |
1363 | return; | 1362 | return; |
1364 | QFrame *topFrame = addPage(i18n("Group Automation"),0, | 1363 | QFrame *topFrame = addPage(i18n("Group Automation"),0, |
1365 | DesktopIcon("personal",KIcon::SizeMedium)); | 1364 | DesktopIcon("personal",KIcon::SizeMedium)); |
1366 | 1365 | ||
1367 | QGridLayout *topLayout = new QGridLayout(topFrame,5,1); | 1366 | QGridLayout *topLayout = new QGridLayout(topFrame,5,1); |
1368 | topLayout->setSpacing(mSpacingHint); | 1367 | topLayout->setSpacing(mSpacingHint); |
1369 | topLayout->setMargin(mMarginHint); | 1368 | topLayout->setMargin(mMarginHint); |
1370 | 1369 | ||
1371 | KPrefsDialogWidRadios *autoRefreshGroup = | 1370 | KPrefsDialogWidRadios *autoRefreshGroup = |
1372 | addWidRadios(i18n("Auto Send Refresh"), | 1371 | addWidRadios(i18n("Auto Send Refresh"), |
1373 | &(KOPrefs::instance()->mIMIPAutoRefresh),topFrame); | 1372 | &(KOPrefs::instance()->mIMIPAutoRefresh),topFrame); |
1374 | autoRefreshGroup->addRadio(i18n("Never")); | 1373 | autoRefreshGroup->addRadio(i18n("Never")); |
1375 | autoRefreshGroup->addRadio(i18n("If attendee is in addressbook")); | 1374 | autoRefreshGroup->addRadio(i18n("If attendee is in addressbook")); |
1376 | //autoRefreshGroup->addRadio(i18n("selected emails")); | 1375 | //autoRefreshGroup->addRadio(i18n("selected emails")); |
1377 | topLayout->addMultiCellWidget(autoRefreshGroup->groupBox(),0,0,0,0); | 1376 | topLayout->addMultiCellWidget(autoRefreshGroup->groupBox(),0,0,0,0); |
1378 | 1377 | ||
1379 | KPrefsDialogWidRadios *autoInsertGroup = | 1378 | KPrefsDialogWidRadios *autoInsertGroup = |
1380 | addWidRadios(i18n("Auto Insert IMIP Replies"), | 1379 | addWidRadios(i18n("Auto Insert IMIP Replies"), |
1381 | &(KOPrefs::instance()->mIMIPAutoInsertReply),topFrame); | 1380 | &(KOPrefs::instance()->mIMIPAutoInsertReply),topFrame); |
1382 | autoInsertGroup->addRadio(i18n("Never")); | 1381 | autoInsertGroup->addRadio(i18n("Never")); |
1383 | autoInsertGroup->addRadio(i18n("If attendee is in addressbook")); | 1382 | autoInsertGroup->addRadio(i18n("If attendee is in addressbook")); |
1384 | //autoInsertGroup->addRadio(i18n("selected emails")); | 1383 | //autoInsertGroup->addRadio(i18n("selected emails")); |
1385 | topLayout->addMultiCellWidget(autoInsertGroup->groupBox(),1,1,0,0); | 1384 | topLayout->addMultiCellWidget(autoInsertGroup->groupBox(),1,1,0,0); |
1386 | 1385 | ||
1387 | KPrefsDialogWidRadios *autoRequestGroup = | 1386 | KPrefsDialogWidRadios *autoRequestGroup = |
1388 | addWidRadios(i18n("Auto Insert IMIP Requests"), | 1387 | addWidRadios(i18n("Auto Insert IMIP Requests"), |
1389 | &(KOPrefs::instance()->mIMIPAutoInsertRequest),topFrame); | 1388 | &(KOPrefs::instance()->mIMIPAutoInsertRequest),topFrame); |
1390 | autoRequestGroup->addRadio(i18n("Never")); | 1389 | autoRequestGroup->addRadio(i18n("Never")); |
1391 | autoRequestGroup->addRadio(i18n("If organizer is in addressbook")); | 1390 | autoRequestGroup->addRadio(i18n("If organizer is in addressbook")); |
1392 | //autoInsertGroup->addRadio(i18n("selected emails")); | 1391 | //autoInsertGroup->addRadio(i18n("selected emails")); |
1393 | topLayout->addMultiCellWidget(autoRequestGroup->groupBox(),2,2,0,0); | 1392 | topLayout->addMultiCellWidget(autoRequestGroup->groupBox(),2,2,0,0); |
1394 | 1393 | ||
1395 | KPrefsDialogWidRadios *autoFreeBusyGroup = | 1394 | KPrefsDialogWidRadios *autoFreeBusyGroup = |
1396 | addWidRadios(i18n("Auto Send FreeBusy Information"), | 1395 | addWidRadios(i18n("Auto Send FreeBusy Information"), |
1397 | &(KOPrefs::instance()->mIMIPAutoFreeBusy),topFrame); | 1396 | &(KOPrefs::instance()->mIMIPAutoFreeBusy),topFrame); |
1398 | autoFreeBusyGroup->addRadio(i18n("Never")); | 1397 | autoFreeBusyGroup->addRadio(i18n("Never")); |
1399 | autoFreeBusyGroup->addRadio(i18n("If requested from an email in addressbook")); | 1398 | autoFreeBusyGroup->addRadio(i18n("If requested from an email in addressbook")); |
1400 | //autoFreeBusyGroup->addRadio(i18n("selected emails")); | 1399 | //autoFreeBusyGroup->addRadio(i18n("selected emails")); |
1401 | topLayout->addMultiCellWidget(autoFreeBusyGroup->groupBox(),3,3,0,0); | 1400 | topLayout->addMultiCellWidget(autoFreeBusyGroup->groupBox(),3,3,0,0); |
1402 | 1401 | ||
1403 | KPrefsDialogWidRadios *autoFreeBusyReplyGroup = | 1402 | KPrefsDialogWidRadios *autoFreeBusyReplyGroup = |
1404 | addWidRadios(i18n("Auto Save FreeBusy Replies"), | 1403 | addWidRadios(i18n("Auto Save FreeBusy Replies"), |
1405 | &(KOPrefs::instance()->mIMIPAutoFreeBusyReply),topFrame); | 1404 | &(KOPrefs::instance()->mIMIPAutoFreeBusyReply),topFrame); |
1406 | autoFreeBusyReplyGroup->addRadio(i18n("Never")); | 1405 | autoFreeBusyReplyGroup->addRadio(i18n("Never")); |
1407 | autoFreeBusyReplyGroup->addRadio(i18n("If attendee is in addressbook")); | 1406 | autoFreeBusyReplyGroup->addRadio(i18n("If attendee is in addressbook")); |
1408 | //autoFreeBusyGroup->addRadio(i18n("selected emails")); | 1407 | //autoFreeBusyGroup->addRadio(i18n("selected emails")); |
1409 | topLayout->addMultiCellWidget(autoFreeBusyReplyGroup->groupBox(),4,4,0,0); | 1408 | topLayout->addMultiCellWidget(autoFreeBusyReplyGroup->groupBox(),4,4,0,0); |
1410 | } | 1409 | } |
1411 | 1410 | ||
1412 | void KOPrefsDialog::showPrinterTab() | 1411 | void KOPrefsDialog::showPrinterTab() |
1413 | { | 1412 | { |
1414 | showPage(pageIndex(mPrinterTab)); | 1413 | showPage(pageIndex(mPrinterTab)); |
1415 | } | 1414 | } |
1416 | 1415 | ||
1417 | 1416 | ||
1418 | void KOPrefsDialog::setCombo(QComboBox *combo, const QString & text, | 1417 | void KOPrefsDialog::setCombo(QComboBox *combo, const QString & text, |
1419 | const QStringList *tags) | 1418 | const QStringList *tags) |
1420 | { | 1419 | { |
1421 | if (tags) { | 1420 | if (tags) { |
1422 | int i = tags->findIndex(text); | 1421 | int i = tags->findIndex(text); |
1423 | if (i > 0) combo->setCurrentItem(i); | 1422 | if (i > 0) combo->setCurrentItem(i); |
1424 | } else { | 1423 | } else { |
1425 | for(int i=0;i<combo->count();++i) { | 1424 | for(int i=0;i<combo->count();++i) { |
1426 | if (combo->text(i) == text) { | 1425 | if (combo->text(i) == text) { |
1427 | combo->setCurrentItem(i); | 1426 | combo->setCurrentItem(i); |
1428 | break; | 1427 | break; |
1429 | } | 1428 | } |
1430 | } | 1429 | } |
1431 | } | 1430 | } |
1432 | } | 1431 | } |
1433 | 1432 | ||
1434 | void KOPrefsDialog::usrReadConfig() | 1433 | void KOPrefsDialog::usrReadConfig() |
1435 | { | 1434 | { |
1436 | kdelibcfg->readConfig(); | 1435 | kdelibcfg->readConfig(); |
1437 | mNameEdit->setText(KOPrefs::instance()->fullName()); | 1436 | mNameEdit->setText(KOPrefs::instance()->fullName()); |
1438 | mEmailEdit->setText(KOPrefs::instance()->email()); | 1437 | mEmailEdit->setText(KOPrefs::instance()->email()); |
1439 | 1438 | ||
1440 | mAutoSaveIntervalSpin->setValue(KOPrefs::instance()->mAutoSaveInterval); | 1439 | mAutoSaveIntervalSpin->setValue(KOPrefs::instance()->mAutoSaveInterval); |
1441 | // QDate current ( 2001, 1,1); | 1440 | // QDate current ( 2001, 1,1); |
1442 | //mStartDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingStart-1)); | 1441 | //mStartDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingStart-1)); |
1443 | //mEndDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingEnd-1)); | 1442 | //mEndDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingEnd-1)); |
1444 | //setCombo(mTimeZoneCombo,i18n(KOPrefs::instance()->mTimeZoneId)); | 1443 | //setCombo(mTimeZoneCombo,i18n(KOPrefs::instance()->mTimeZoneId)); |
1445 | //mTimezoneOffsetSpin->setValue( KOPrefs::instance()->mTimeZoneOffset); | 1444 | //mTimezoneOffsetSpin->setValue( KOPrefs::instance()->mTimeZoneOffset); |
1446 | mStartTimeSpin->setValue(KOPrefs::instance()->mStartTime); | 1445 | mStartTimeSpin->setValue(KOPrefs::instance()->mStartTime); |
1447 | mDefaultDurationSpin->setValue(KOPrefs::instance()->mDefaultDuration); | 1446 | mDefaultDurationSpin->setValue(KOPrefs::instance()->mDefaultDuration); |
1448 | mAlarmTimeCombo->setCurrentItem(KOPrefs::instance()->mAlarmTime); | 1447 | mAlarmTimeCombo->setCurrentItem(KOPrefs::instance()->mAlarmTime); |
1449 | // if (KOPrefs::instance()->mAllDaySize > 47 ) | 1448 | // if (KOPrefs::instance()->mAllDaySize > 47 ) |
1450 | // KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize/2; | 1449 | // KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize/2; |
1451 | //mHourSizeSlider->setValue(KOPrefs::instance()->mAllDaySize); | 1450 | //mHourSizeSlider->setValue(KOPrefs::instance()->mAllDaySize); |
1452 | 1451 | ||
1453 | mNextXDaysSpin->setValue(KOPrefs::instance()->mNextXDays); | 1452 | mNextXDaysSpin->setValue(KOPrefs::instance()->mNextXDays); |
1454 | mWhatsNextSpin->setValue(KOPrefs::instance()->mWhatsNextDays); | 1453 | mWhatsNextSpin->setValue(KOPrefs::instance()->mWhatsNextDays); |
1455 | mPrioSpin->setValue(KOPrefs::instance()->mWhatsNextPrios); | 1454 | mPrioSpin->setValue(KOPrefs::instance()->mWhatsNextPrios); |
1456 | // mAMails->clear(); | 1455 | // mAMails->clear(); |
1457 | // for ( QStringList::Iterator it = KOPrefs::instance()->mAdditionalMails.begin(); | 1456 | // for ( QStringList::Iterator it = KOPrefs::instance()->mAdditionalMails.begin(); |
1458 | // it != KOPrefs::instance()->mAdditionalMails.end(); ++it ) { | 1457 | // it != KOPrefs::instance()->mAdditionalMails.end(); ++it ) { |
1459 | // QListViewItem *item = new QListViewItem(mAMails); | 1458 | // QListViewItem *item = new QListViewItem(mAMails); |
1460 | // item->setText(0,*it); | 1459 | // item->setText(0,*it); |
1461 | // mAMails->insertItem(item); | 1460 | // mAMails->insertItem(item); |
1462 | // } | 1461 | // } |
1463 | 1462 | ||
1464 | // mRemoteIPEdit->setText(KOPrefs::instance()->mRemoteIP); | 1463 | // mRemoteIPEdit->setText(KOPrefs::instance()->mRemoteIP); |
1465 | //mRemoteUser->setText(KOPrefs::instance()->mRemoteUser); | 1464 | //mRemoteUser->setText(KOPrefs::instance()->mRemoteUser); |
1466 | //mRemotePassWd->setText(KOPrefs::instance()->mRemotePassWd); | 1465 | //mRemotePassWd->setText(KOPrefs::instance()->mRemotePassWd); |
1467 | //mRemoteFile->setText(KOPrefs::instance()->mRemoteFile); | 1466 | //mRemoteFile->setText(KOPrefs::instance()->mRemoteFile); |
1468 | 1467 | ||
1469 | //that soundmLocalTempFile->setText(KOPrefs::instance()->mLocalTempFile); | 1468 | //that soundmLocalTempFile->setText(KOPrefs::instance()->mLocalTempFile); |
1470 | mDefaultAlarmFile->setText(KOPrefs::instance()->mDefaultAlarmFile); | 1469 | mDefaultAlarmFile->setText(KOPrefs::instance()->mDefaultAlarmFile); |
1471 | //QString dummy = KOPrefs::instance()->mUserDateFormatLong; | 1470 | //QString dummy = KOPrefs::instance()->mUserDateFormatLong; |
1472 | //mUserDateFormatLong->setText(dummy.replace( QRegExp("K"), QString(",") )); | 1471 | //mUserDateFormatLong->setText(dummy.replace( QRegExp("K"), QString(",") )); |
1473 | //dummy = KOPrefs::instance()->mUserDateFormatShort; | 1472 | //dummy = KOPrefs::instance()->mUserDateFormatShort; |
1474 | //mUserDateFormatShort->setText(dummy.replace( QRegExp("K"), QString(",") )); | 1473 | //mUserDateFormatShort->setText(dummy.replace( QRegExp("K"), QString(",") )); |
1475 | updateCategories(); | 1474 | updateCategories(); |
1476 | mAlarmPlayBeeps->setValue(KOPrefs::instance()->mAlarmPlayBeeps ); | 1475 | mAlarmPlayBeeps->setValue(KOPrefs::instance()->mAlarmPlayBeeps ); |
1477 | mAlarmSuspendTime->setValue(KOPrefs::instance()->mAlarmSuspendTime ); | 1476 | mAlarmSuspendTime->setValue(KOPrefs::instance()->mAlarmSuspendTime ); |
1478 | mAlarmSuspendCount->setValue(KOPrefs::instance()->mAlarmSuspendCount ); | 1477 | mAlarmSuspendCount->setValue(KOPrefs::instance()->mAlarmSuspendCount ); |
1479 | mAlarmBeepInterval->setValue(KOPrefs::instance()->mAlarmBeepInterval ); | 1478 | mAlarmBeepInterval->setValue(KOPrefs::instance()->mAlarmBeepInterval ); |
1480 | } | 1479 | } |
1481 | 1480 | ||
1482 | 1481 | ||
1483 | void KOPrefsDialog::usrWriteConfig() | 1482 | void KOPrefsDialog::usrWriteConfig() |
1484 | { | 1483 | { |
1485 | 1484 | ||
1486 | kdelibcfg->writeConfig(); | 1485 | kdelibcfg->writeConfig(); |
1487 | // KOPrefs::instance()->mRemoteIP = mRemoteIPEdit->text(); | 1486 | // KOPrefs::instance()->mRemoteIP = mRemoteIPEdit->text(); |
1488 | //KOPrefs::instance()->mRemoteUser = mRemoteUser->text(); | 1487 | //KOPrefs::instance()->mRemoteUser = mRemoteUser->text(); |
1489 | //KOPrefs::instance()->mRemotePassWd = mRemotePassWd->text(); | 1488 | //KOPrefs::instance()->mRemotePassWd = mRemotePassWd->text(); |
1490 | //KOPrefs::instance()->mRemoteFile= mRemoteFile->text(); | 1489 | //KOPrefs::instance()->mRemoteFile= mRemoteFile->text(); |
1491 | //KOPrefs::instance()->mLocalTempFile =mLocalTempFile->text(); | 1490 | //KOPrefs::instance()->mLocalTempFile =mLocalTempFile->text(); |
1492 | KOPrefs::instance()->mDefaultAlarmFile =mDefaultAlarmFile->text(); | 1491 | KOPrefs::instance()->mDefaultAlarmFile =mDefaultAlarmFile->text(); |
1493 | 1492 | ||
1494 | //KOPrefs::instance()->mUserDateFormatShort = mUserDateFormatShort->text().replace( QRegExp(","), QString("K") ); | 1493 | //KOPrefs::instance()->mUserDateFormatShort = mUserDateFormatShort->text().replace( QRegExp(","), QString("K") ); |
1495 | //KOPrefs::instance()->mUserDateFormatLong = mUserDateFormatLong->text().replace( QRegExp(","), QString("K") ); | 1494 | //KOPrefs::instance()->mUserDateFormatLong = mUserDateFormatLong->text().replace( QRegExp(","), QString("K") ); |
1496 | KOPrefs::instance()->setFullName(mNameEdit->text()); | 1495 | KOPrefs::instance()->setFullName(mNameEdit->text()); |
1497 | KOPrefs::instance()->setEmail(mEmailEdit->text()); | 1496 | KOPrefs::instance()->setEmail(mEmailEdit->text()); |
1498 | 1497 | ||
1499 | KOPrefs::instance()->mAutoSaveInterval = mAutoSaveIntervalSpin->value(); | 1498 | KOPrefs::instance()->mAutoSaveInterval = mAutoSaveIntervalSpin->value(); |
1500 | 1499 | ||
1501 | // KOPrefs::instance()->mTimeZoneId = mTimeZoneCombo->currentText(); | 1500 | // KOPrefs::instance()->mTimeZoneId = mTimeZoneCombo->currentText(); |
1502 | //QDate date; | 1501 | //QDate date; |
1503 | //date = mStartDateSavingEdit->date(); | 1502 | //date = mStartDateSavingEdit->date(); |
1504 | //int sub = 0; | 1503 | //int sub = 0; |
1505 | //if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) | 1504 | //if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) |
1506 | // sub = 1; | 1505 | // sub = 1; |
1507 | // KOPrefs::instance()->mDaylightsavingStart = date.dayOfYear()-sub; | 1506 | // KOPrefs::instance()->mDaylightsavingStart = date.dayOfYear()-sub; |
1508 | // date = mEndDateSavingEdit->date(); | 1507 | // date = mEndDateSavingEdit->date(); |
1509 | // if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) | 1508 | // if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) |
1510 | // sub = 1; | 1509 | // sub = 1; |
1511 | // else | 1510 | // else |
1512 | // sub = 0; | 1511 | // sub = 0; |
1513 | // KOPrefs::instance()->mDaylightsavingEnd = date.dayOfYear()-sub; | 1512 | // KOPrefs::instance()->mDaylightsavingEnd = date.dayOfYear()-sub; |
1514 | // // KOPrefs::instance()->mTimeZoneOffset = mTimezoneOffsetSpin->value(); | 1513 | // // KOPrefs::instance()->mTimeZoneOffset = mTimezoneOffsetSpin->value(); |
1515 | 1514 | ||
1516 | KOPrefs::instance()->mStartTime = mStartTimeSpin->value(); | 1515 | KOPrefs::instance()->mStartTime = mStartTimeSpin->value(); |
1517 | KOPrefs::instance()->mDefaultDuration = mDefaultDurationSpin->value(); | 1516 | KOPrefs::instance()->mDefaultDuration = mDefaultDurationSpin->value(); |
1518 | KOPrefs::instance()->mAlarmTime = mAlarmTimeCombo->currentItem(); | 1517 | KOPrefs::instance()->mAlarmTime = mAlarmTimeCombo->currentItem(); |
1519 | 1518 | ||
1520 | //KOPrefs::instance()->mAllDaySize = mHourSizeSlider->value(); | 1519 | //KOPrefs::instance()->mAllDaySize = mHourSizeSlider->value(); |
1521 | 1520 | ||
1522 | QDictIterator<QColor> it(mCategoryDict); | 1521 | QDictIterator<QColor> it(mCategoryDict); |
1523 | while (it.current()) { | 1522 | while (it.current()) { |
1524 | KOPrefs::instance()->setCategoryColor(it.currentKey(),*it.current()); | 1523 | KOPrefs::instance()->setCategoryColor(it.currentKey(),*it.current()); |
1525 | ++it; | 1524 | ++it; |
1526 | } | 1525 | } |
1527 | 1526 | ||
1528 | KOPrefs::instance()->mNextXDays = mNextXDaysSpin->value(); | 1527 | KOPrefs::instance()->mNextXDays = mNextXDaysSpin->value(); |
1529 | KOPrefs::instance()->mWhatsNextDays = mWhatsNextSpin->value(); | 1528 | KOPrefs::instance()->mWhatsNextDays = mWhatsNextSpin->value(); |
1530 | KOPrefs::instance()->mWhatsNextPrios = mPrioSpin->value(); | 1529 | KOPrefs::instance()->mWhatsNextPrios = mPrioSpin->value(); |
1531 | 1530 | ||
1532 | KOPrefs::instance()->mAdditionalMails.clear(); | 1531 | KOPrefs::instance()->mAdditionalMails.clear(); |
1533 | // QListViewItem *item; | 1532 | // QListViewItem *item; |
1534 | // item = mAMails->firstChild(); | 1533 | // item = mAMails->firstChild(); |
1535 | // while (item) | 1534 | // while (item) |
1536 | // { | 1535 | // { |
1537 | // KOPrefs::instance()->mAdditionalMails.append( item->text(0) ); | 1536 | // KOPrefs::instance()->mAdditionalMails.append( item->text(0) ); |
1538 | // item = item->nextSibling(); | 1537 | // item = item->nextSibling(); |
1539 | // } | 1538 | // } |
1540 | KOPrefs::instance()->mAlarmPlayBeeps = mAlarmPlayBeeps->value(); | 1539 | KOPrefs::instance()->mAlarmPlayBeeps = mAlarmPlayBeeps->value(); |
1541 | KOPrefs::instance()->mAlarmSuspendTime = mAlarmSuspendTime->value() ; | 1540 | KOPrefs::instance()->mAlarmSuspendTime = mAlarmSuspendTime->value() ; |
1542 | KOPrefs::instance()->mAlarmSuspendCount= mAlarmSuspendCount->value() ; | 1541 | KOPrefs::instance()->mAlarmSuspendCount= mAlarmSuspendCount->value() ; |
1543 | KOPrefs::instance()->mAlarmBeepInterval= mAlarmBeepInterval->value() ; | 1542 | KOPrefs::instance()->mAlarmBeepInterval= mAlarmBeepInterval->value() ; |
1544 | 1543 | ||
1545 | } | 1544 | } |
1546 | 1545 | ||
1547 | void KOPrefsDialog::updateCategories() | 1546 | void KOPrefsDialog::updateCategories() |
1548 | { | 1547 | { |
1549 | mCategoryCombo->clear(); | 1548 | mCategoryCombo->clear(); |
1550 | mCategoryDict.clear(); | 1549 | mCategoryDict.clear(); |
1551 | mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories); | 1550 | mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories); |
1552 | updateCategoryColor(); | 1551 | updateCategoryColor(); |
1553 | } | 1552 | } |
1554 | 1553 | ||
1555 | void KOPrefsDialog::warningGroupScheduling() | 1554 | void KOPrefsDialog::warningGroupScheduling() |
1556 | { | 1555 | { |
1557 | warningExperimental(mEnableGroupScheduling->checkBox()->isChecked()); | 1556 | warningExperimental(mEnableGroupScheduling->checkBox()->isChecked()); |
1558 | } | 1557 | } |
1559 | 1558 | ||
1560 | void KOPrefsDialog::warningProjectView() | 1559 | void KOPrefsDialog::warningProjectView() |
1561 | { | 1560 | { |
1562 | warningExperimental(mEnableProjectView->checkBox()->isChecked()); | 1561 | warningExperimental(mEnableProjectView->checkBox()->isChecked()); |
1563 | } | 1562 | } |
1564 | 1563 | ||
1565 | void KOPrefsDialog::warningExperimental(bool on) | 1564 | void KOPrefsDialog::warningExperimental(bool on) |
1566 | { | 1565 | { |
1567 | if (on) { | 1566 | if (on) { |
1568 | KMessageBox::information(this,i18n("This is an experimental feature. " | 1567 | KMessageBox::information(this,i18n("This is an experimental feature. " |
1569 | "It may not work, it may do nothing useful and it may cause data loss. " | 1568 | "It may not work, it may do nothing useful and it may cause data loss. " |
1570 | "Use with care.\n" | 1569 | "Use with care.\n" |
1571 | "You have to restart KOrganizer for this setting to take effect.")); | 1570 | "You have to restart KOrganizer for this setting to take effect.")); |
1572 | } else { | 1571 | } else { |
1573 | KMessageBox::information(this, | 1572 | KMessageBox::information(this, |
1574 | i18n("You have to restart KOrganizer for this setting to take effect.")); | 1573 | i18n("You have to restart KOrganizer for this setting to take effect.")); |
1575 | } | 1574 | } |
1576 | } | 1575 | } |
1577 | 1576 | ||
1578 | void KOPrefsDialog::toggleEmailSettings(bool on) | 1577 | void KOPrefsDialog::toggleEmailSettings(bool on) |
1579 | { | 1578 | { |
1580 | if (on) { | 1579 | if (on) { |
1581 | mEmailEdit->setEnabled(false); | 1580 | mEmailEdit->setEnabled(false); |
1582 | mNameEdit->setEnabled(false); | 1581 | mNameEdit->setEnabled(false); |
1583 | mEmailLabel->setEnabled(false); | 1582 | mEmailLabel->setEnabled(false); |
1584 | mNameLabel->setEnabled(false); | 1583 | mNameLabel->setEnabled(false); |
1585 | 1584 | ||
1586 | KEMailSettings settings; | 1585 | KEMailSettings settings; |
1587 | mNameEdit->setText(settings.getSetting(KEMailSettings::RealName)); | 1586 | mNameEdit->setText(settings.getSetting(KEMailSettings::RealName)); |
1588 | mEmailEdit->setText(settings.getSetting(KEMailSettings::EmailAddress)); | 1587 | mEmailEdit->setText(settings.getSetting(KEMailSettings::EmailAddress)); |
1589 | } else { | 1588 | } else { |
1590 | mEmailEdit->setEnabled(true); | 1589 | mEmailEdit->setEnabled(true); |
1591 | mNameEdit->setEnabled(true); | 1590 | mNameEdit->setEnabled(true); |
1592 | mEmailLabel->setEnabled(true); | 1591 | mEmailLabel->setEnabled(true); |
1593 | mNameLabel->setEnabled(true); | 1592 | mNameLabel->setEnabled(true); |
1594 | } | 1593 | } |
1595 | } | 1594 | } |
1596 | 1595 | ||
1597 | void KOPrefsDialog::addItem() | 1596 | void KOPrefsDialog::addItem() |
1598 | { | 1597 | { |
1599 | // aEmailsEdit->setEnabled(true); | 1598 | // aEmailsEdit->setEnabled(true); |
1600 | // QListViewItem *item = new QListViewItem(mAMails); | 1599 | // QListViewItem *item = new QListViewItem(mAMails); |
1601 | // mAMails->insertItem(item); | 1600 | // mAMails->insertItem(item); |
1602 | // mAMails->setSelected(item,true); | 1601 | // mAMails->setSelected(item,true); |
1603 | // aEmailsEdit->setText(i18n("(EmptyEmail)")); | 1602 | // aEmailsEdit->setText(i18n("(EmptyEmail)")); |
1604 | } | 1603 | } |
1605 | 1604 | ||
1606 | void KOPrefsDialog::removeItem() | 1605 | void KOPrefsDialog::removeItem() |
1607 | { | 1606 | { |
1608 | // QListViewItem *item; | 1607 | // QListViewItem *item; |
1609 | // item = mAMails->selectedItem(); | 1608 | // item = mAMails->selectedItem(); |
1610 | // if (!item) return; | 1609 | // if (!item) return; |
1611 | // mAMails->takeItem(item); | 1610 | // mAMails->takeItem(item); |
1612 | // item = mAMails->selectedItem(); | 1611 | // item = mAMails->selectedItem(); |
1613 | // if (!item) { | 1612 | // if (!item) { |
1614 | // aEmailsEdit->setText(""); | 1613 | // aEmailsEdit->setText(""); |
1615 | // aEmailsEdit->setEnabled(false); | 1614 | // aEmailsEdit->setEnabled(false); |
1616 | // } | 1615 | // } |
1617 | // if (mAMails->childCount() == 0) { | 1616 | // if (mAMails->childCount() == 0) { |
1618 | // aEmailsEdit->setEnabled(false); | 1617 | // aEmailsEdit->setEnabled(false); |
1619 | // } | 1618 | // } |
1620 | } | 1619 | } |
1621 | 1620 | ||
1622 | void KOPrefsDialog::updateItem() | 1621 | void KOPrefsDialog::updateItem() |
1623 | { | 1622 | { |
1624 | // QListViewItem *item; | 1623 | // QListViewItem *item; |
1625 | // item = mAMails->selectedItem(); | 1624 | // item = mAMails->selectedItem(); |
1626 | // if (!item) return; | 1625 | // if (!item) return; |
1627 | // item->setText(0,aEmailsEdit->text()); | 1626 | // item->setText(0,aEmailsEdit->text()); |
1628 | } | 1627 | } |
1629 | 1628 | ||
1630 | void KOPrefsDialog::updateInput() | 1629 | void KOPrefsDialog::updateInput() |
1631 | { | 1630 | { |
1632 | // QListViewItem *item; | 1631 | // QListViewItem *item; |
1633 | // item = mAMails->selectedItem(); | 1632 | // item = mAMails->selectedItem(); |
1634 | // if (!item) return; | 1633 | // if (!item) return; |
1635 | // aEmailsEdit->setEnabled(true); | 1634 | // aEmailsEdit->setEnabled(true); |
1636 | // aEmailsEdit->setText(item->text(0)); | 1635 | // aEmailsEdit->setText(item->text(0)); |
1637 | } | 1636 | } |
1638 | void KOPrefsDialog::updateTimezoneOffset( int index ) | 1637 | void KOPrefsDialog::updateTimezoneOffset( int index ) |
1639 | { | 1638 | { |
1640 | /* | 1639 | /* |
1641 | qDebug("updateTimezoneOffset %d ", index); | 1640 | qDebug("updateTimezoneOffset %d ", index); |
1642 | if ( index < 24 ) { | 1641 | if ( index < 24 ) { |
1643 | mTimezoneOffsetSpin->setEnabled ( false ); | 1642 | mTimezoneOffsetSpin->setEnabled ( false ); |
1644 | mTimezoneOffsetSpin->setValue( ( index-11 ) * 60 ); | 1643 | mTimezoneOffsetSpin->setValue( ( index-11 ) * 60 ); |
1645 | 1644 | ||
1646 | 1645 | ||
1647 | } else { | 1646 | } else { |
1648 | if ( index == 24 ) { | 1647 | if ( index == 24 ) { |
1649 | mTimezoneOffsetSpin->setEnabled ( true ); | 1648 | mTimezoneOffsetSpin->setEnabled ( true ); |
1650 | mTimezoneOffsetSpin->setValue( KOPrefs::instance()->mTimeZoneOffset); | 1649 | mTimezoneOffsetSpin->setValue( KOPrefs::instance()->mTimeZoneOffset); |
1651 | 1650 | ||
1652 | } else { | 1651 | } else { |
1653 | mTimezoneOffsetSpin->setEnabled ( false ); | 1652 | mTimezoneOffsetSpin->setEnabled ( false ); |
1654 | mTimezoneOffsetSpin->setValue( 0 ); | 1653 | mTimezoneOffsetSpin->setValue( 0 ); |
1655 | } | 1654 | } |
1656 | } | 1655 | } |
1657 | */ | 1656 | */ |
1658 | } | 1657 | } |
1659 | 1658 | ||
1660 | void KOPrefsDialog::setupTimeZoneTab() | 1659 | void KOPrefsDialog::setupTimeZoneTab() |
1661 | { | 1660 | { |
1662 | #if 0 | 1661 | #if 0 |
1663 | QFrame *topFrame = addPage(i18n("Time Zone"),0,0); | 1662 | QFrame *topFrame = addPage(i18n("Time Zone"),0,0); |
1664 | // DesktopIcon("clock",KIcon::SizeMedium)); | 1663 | // DesktopIcon("clock",KIcon::SizeMedium)); |
1665 | 1664 | ||
1666 | QGridLayout *topLayout = new QGridLayout(topFrame,5,2); | 1665 | QGridLayout *topLayout = new QGridLayout(topFrame,5,2); |
1667 | topLayout->setSpacing(mSpacingHint); | 1666 | topLayout->setSpacing(mSpacingHint); |
1668 | topLayout->setMargin(mMarginHint); | 1667 | topLayout->setMargin(mMarginHint); |
1669 | 1668 | ||
1670 | QHBox *timeZoneBox = new QHBox( topFrame ); | 1669 | QHBox *timeZoneBox = new QHBox( topFrame ); |
1671 | topLayout->addMultiCellWidget( timeZoneBox, 0, 0, 0, 1 ); | 1670 | topLayout->addMultiCellWidget( timeZoneBox, 0, 0, 0, 1 ); |
1672 | 1671 | ||
1673 | new QLabel( i18n("Timezone:"), timeZoneBox ); | 1672 | new QLabel( i18n("Timezone:"), timeZoneBox ); |
1674 | mTimeZoneCombo = new QComboBox( timeZoneBox ); | 1673 | mTimeZoneCombo = new QComboBox( timeZoneBox ); |
1675 | if ( QApplication::desktop()->width() < 300 ) { | 1674 | if ( QApplication::desktop()->width() < 300 ) { |
1676 | mTimeZoneCombo->setMaximumWidth(150); | 1675 | mTimeZoneCombo->setMaximumWidth(150); |
1677 | } | 1676 | } |
1678 | 1677 | ||
1679 | QStringList list; | 1678 | QStringList list; |
1680 | list = KGlobal::locale()->timeZoneList(); | 1679 | list = KGlobal::locale()->timeZoneList(); |
1681 | mTimeZoneCombo->insertStringList(list); | 1680 | mTimeZoneCombo->insertStringList(list); |
1682 | 1681 | ||
1683 | // find the currently set time zone and select it | 1682 | // find the currently set time zone and select it |
1684 | QString sCurrentlySet = KOPrefs::instance()->mTimeZoneId; | 1683 | QString sCurrentlySet = KOPrefs::instance()->mTimeZoneId; |
1685 | int nCurrentlySet = 11; | 1684 | int nCurrentlySet = 11; |
1686 | for (int i = 0; i < mTimeZoneCombo->count(); i++) | 1685 | for (int i = 0; i < mTimeZoneCombo->count(); i++) |
1687 | { | 1686 | { |
1688 | if (mTimeZoneCombo->text(i) == sCurrentlySet) | 1687 | if (mTimeZoneCombo->text(i) == sCurrentlySet) |
1689 | { | 1688 | { |
1690 | nCurrentlySet = i; | 1689 | nCurrentlySet = i; |
1691 | break; | 1690 | break; |
1692 | } | 1691 | } |
1693 | } | 1692 | } |
1694 | mTimeZoneCombo->setCurrentItem(nCurrentlySet); | 1693 | mTimeZoneCombo->setCurrentItem(nCurrentlySet); |
1695 | int iii = 1; | 1694 | int iii = 1; |
1696 | KPrefsDialogWidBool *sb = | 1695 | KPrefsDialogWidBool *sb = |
1697 | addWidBool(i18n("Timezone has daylight saving"), | 1696 | addWidBool(i18n("Timezone has daylight saving"), |
1698 | &(KOPrefs::instance()->mUseDaylightsaving),topFrame); | 1697 | &(KOPrefs::instance()->mUseDaylightsaving),topFrame); |
1699 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); | 1698 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); |
1700 | ++iii; | 1699 | ++iii; |
1701 | QLabel* lab = new QLabel( i18n("Actual start and end is the\nsunday before this date."), topFrame ); | 1700 | QLabel* lab = new QLabel( i18n("Actual start and end is the\nsunday before this date."), topFrame ); |
1702 | topLayout->addMultiCellWidget(lab, iii,iii,0,1); | 1701 | topLayout->addMultiCellWidget(lab, iii,iii,0,1); |
1703 | ++iii; | 1702 | ++iii; |
1704 | lab = new QLabel( i18n("The year in the date is ignored."), topFrame ); | 1703 | lab = new QLabel( i18n("The year in the date is ignored."), topFrame ); |
1705 | topLayout->addMultiCellWidget(lab, iii,iii,0,1); | 1704 | topLayout->addMultiCellWidget(lab, iii,iii,0,1); |
1706 | ++iii; | 1705 | ++iii; |
1707 | lab = new QLabel( i18n("Daylight start:"), topFrame ); | 1706 | lab = new QLabel( i18n("Daylight start:"), topFrame ); |
1708 | topLayout->addWidget(lab, iii,0); | 1707 | topLayout->addWidget(lab, iii,0); |
1709 | mStartDateSavingEdit = new KDateEdit(topFrame); | 1708 | mStartDateSavingEdit = new KDateEdit(topFrame); |
1710 | topLayout->addWidget(mStartDateSavingEdit, iii,1); | 1709 | topLayout->addWidget(mStartDateSavingEdit, iii,1); |
1711 | ++iii; | 1710 | ++iii; |
1712 | 1711 | ||
1713 | lab = new QLabel( i18n("Daylight end:"), topFrame ); | 1712 | lab = new QLabel( i18n("Daylight end:"), topFrame ); |
1714 | topLayout->addWidget(lab, iii,0); | 1713 | topLayout->addWidget(lab, iii,0); |
1715 | mEndDateSavingEdit = new KDateEdit(topFrame); | 1714 | mEndDateSavingEdit = new KDateEdit(topFrame); |
1716 | topLayout->addWidget(mEndDateSavingEdit, iii,1); | 1715 | topLayout->addWidget(mEndDateSavingEdit, iii,1); |
1717 | ++iii; | 1716 | ++iii; |
1718 | QDate current ( 2001, 1,1); | 1717 | QDate current ( 2001, 1,1); |
1719 | mStartDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingStart-1)); | 1718 | mStartDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingStart-1)); |
1720 | mEndDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingEnd-1)); | 1719 | mEndDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingEnd-1)); |
1721 | #endif | 1720 | #endif |
1722 | 1721 | ||
1723 | } | 1722 | } |
1724 | 1723 | ||
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 9505d06..94f4677 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -753,1695 +753,1691 @@ void MainWindow::initActions() | |||
753 | if ( KOPrefs::instance()->mVerticalScreen ) { | 753 | if ( KOPrefs::instance()->mVerticalScreen ) { |
754 | icon = SmallIcon( "1updownarrow" ); | 754 | icon = SmallIcon( "1updownarrow" ); |
755 | } else { | 755 | } else { |
756 | icon = SmallIcon("1leftrightarrow" ); | 756 | icon = SmallIcon("1leftrightarrow" ); |
757 | } | 757 | } |
758 | configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 ); | 758 | configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 ); |
759 | QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this ); | 759 | QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this ); |
760 | FSaction->addTo( viewMenu ); | 760 | FSaction->addTo( viewMenu ); |
761 | connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() )); | 761 | connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() )); |
762 | 762 | ||
763 | icon = loadPixmap( pathString + "navi" ); | 763 | icon = loadPixmap( pathString + "navi" ); |
764 | configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 ); | 764 | configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 ); |
765 | action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); | 765 | action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); |
766 | action->addTo( viewMenu ); | 766 | action->addTo( viewMenu ); |
767 | connect( action, SIGNAL( activated() ), | 767 | connect( action, SIGNAL( activated() ), |
768 | mView, SLOT( toggleDateNavigatorWidget() ) ); | 768 | mView, SLOT( toggleDateNavigatorWidget() ) ); |
769 | mToggleNav = action ; | 769 | mToggleNav = action ; |
770 | icon = loadPixmap( pathString + "filter" ); | 770 | icon = loadPixmap( pathString + "filter" ); |
771 | configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 ); | 771 | configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 ); |
772 | action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); | 772 | action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); |
773 | action->addTo( viewMenu ); | 773 | action->addTo( viewMenu ); |
774 | connect( action, SIGNAL( activated() ), | 774 | connect( action, SIGNAL( activated() ), |
775 | mView, SLOT( toggleFilter() ) ); | 775 | mView, SLOT( toggleFilter() ) ); |
776 | mToggleFilter = action; | 776 | mToggleFilter = action; |
777 | icon = loadPixmap( pathString + "allday" ); | 777 | icon = loadPixmap( pathString + "allday" ); |
778 | configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 ); | 778 | configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 ); |
779 | action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); | 779 | action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); |
780 | action->addTo( viewMenu ); | 780 | action->addTo( viewMenu ); |
781 | connect( action, SIGNAL( activated() ), | 781 | connect( action, SIGNAL( activated() ), |
782 | mView, SLOT( toggleAllDaySize() ) ); | 782 | mView, SLOT( toggleAllDaySize() ) ); |
783 | mToggleAllday = action; | 783 | mToggleAllday = action; |
784 | 784 | ||
785 | 785 | ||
786 | connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), | 786 | connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), |
787 | mToggleNav, SLOT( setEnabled ( bool ) ) ); | 787 | mToggleNav, SLOT( setEnabled ( bool ) ) ); |
788 | connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), | 788 | connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), |
789 | mToggleFilter, SLOT( setEnabled ( bool ) ) ); | 789 | mToggleFilter, SLOT( setEnabled ( bool ) ) ); |
790 | connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), | 790 | connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), |
791 | mToggleAllday, SLOT( setEnabled ( bool ) ) ); | 791 | mToggleAllday, SLOT( setEnabled ( bool ) ) ); |
792 | 792 | ||
793 | viewMenu->insertSeparator(); | 793 | viewMenu->insertSeparator(); |
794 | icon = loadPixmap( pathString + "picker" ); | 794 | icon = loadPixmap( pathString + "picker" ); |
795 | action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); | 795 | action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); |
796 | action->addTo( viewMenu ); | 796 | action->addTo( viewMenu ); |
797 | connect( action, SIGNAL( activated() ), | 797 | connect( action, SIGNAL( activated() ), |
798 | mView, SLOT( showDatePicker() ) ); | 798 | mView, SLOT( showDatePicker() ) ); |
799 | action->addTo( iconToolBar ); | 799 | action->addTo( iconToolBar ); |
800 | viewMenu->insertSeparator(); | 800 | viewMenu->insertSeparator(); |
801 | 801 | ||
802 | if ( p-> mShowIconToggleFull ) | 802 | if ( p-> mShowIconToggleFull ) |
803 | FSaction->addTo( iconToolBar ); | 803 | FSaction->addTo( iconToolBar ); |
804 | if ( p->mShowIconNavigator ) mToggleNav ->addTo( iconToolBar ); | 804 | if ( p->mShowIconNavigator ) mToggleNav ->addTo( iconToolBar ); |
805 | 805 | ||
806 | //******************** | 806 | //******************** |
807 | if ( p->mShowIconAllday ) mToggleAllday->addTo( iconToolBar ); | 807 | if ( p->mShowIconAllday ) mToggleAllday->addTo( iconToolBar ); |
808 | 808 | ||
809 | 809 | ||
810 | icon = loadPixmap( pathString + "whatsnext" ); | 810 | icon = loadPixmap( pathString + "whatsnext" ); |
811 | configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 ); | 811 | configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 ); |
812 | QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); | 812 | QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); |
813 | whatsnext_action->addTo( viewMenu ); | 813 | whatsnext_action->addTo( viewMenu ); |
814 | connect( whatsnext_action, SIGNAL( activated() ), | 814 | connect( whatsnext_action, SIGNAL( activated() ), |
815 | mView->viewManager(), SLOT( showWhatsNextView() ) ); | 815 | mView->viewManager(), SLOT( showWhatsNextView() ) ); |
816 | 816 | ||
817 | icon = loadPixmap( pathString + "xdays" ); | 817 | icon = loadPixmap( pathString + "xdays" ); |
818 | configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 ); | 818 | configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 ); |
819 | QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); | 819 | QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); |
820 | xdays_action->addTo( viewMenu ); | 820 | xdays_action->addTo( viewMenu ); |
821 | connect( xdays_action, SIGNAL( activated() ), | 821 | connect( xdays_action, SIGNAL( activated() ), |
822 | mView->viewManager(), SLOT( showNextXView() ) ); | 822 | mView->viewManager(), SLOT( showNextXView() ) ); |
823 | 823 | ||
824 | 824 | ||
825 | icon = loadPixmap( pathString + "journal" ); | 825 | icon = loadPixmap( pathString + "journal" ); |
826 | configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); | 826 | configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); |
827 | QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); | 827 | QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); |
828 | viewjournal_action->addTo( viewMenu ); | 828 | viewjournal_action->addTo( viewMenu ); |
829 | connect( viewjournal_action, SIGNAL( activated() ), | 829 | connect( viewjournal_action, SIGNAL( activated() ), |
830 | mView->viewManager(), SLOT( showJournalView() ) ); | 830 | mView->viewManager(), SLOT( showJournalView() ) ); |
831 | 831 | ||
832 | 832 | ||
833 | icon = loadPixmap( pathString + "day" ); | 833 | icon = loadPixmap( pathString + "day" ); |
834 | configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); | 834 | configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); |
835 | QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); | 835 | QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); |
836 | day1_action->addTo( viewMenu ); | 836 | day1_action->addTo( viewMenu ); |
837 | // action->addTo( toolBar ); | 837 | // action->addTo( toolBar ); |
838 | connect( day1_action, SIGNAL( activated() ), | 838 | connect( day1_action, SIGNAL( activated() ), |
839 | mView->viewManager(), SLOT( showDayView() ) ); | 839 | mView->viewManager(), SLOT( showDayView() ) ); |
840 | 840 | ||
841 | icon = loadPixmap( pathString + "workweek" ); | 841 | icon = loadPixmap( pathString + "workweek" ); |
842 | configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); | 842 | configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); |
843 | QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); | 843 | QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); |
844 | day5_action->addTo( viewMenu ); | 844 | day5_action->addTo( viewMenu ); |
845 | connect( day5_action, SIGNAL( activated() ), | 845 | connect( day5_action, SIGNAL( activated() ), |
846 | mView->viewManager(), SLOT( showWorkWeekView() ) ); | 846 | mView->viewManager(), SLOT( showWorkWeekView() ) ); |
847 | 847 | ||
848 | icon = loadPixmap( pathString + "week" ); | 848 | icon = loadPixmap( pathString + "week" ); |
849 | configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); | 849 | configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); |
850 | QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); | 850 | QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); |
851 | day7_action->addTo( viewMenu ); | 851 | day7_action->addTo( viewMenu ); |
852 | connect( day7_action, SIGNAL( activated() ), | 852 | connect( day7_action, SIGNAL( activated() ), |
853 | mView->viewManager(), SLOT( showWeekView() ) ); | 853 | mView->viewManager(), SLOT( showWeekView() ) ); |
854 | 854 | ||
855 | icon = loadPixmap( pathString + "workweek2" ); | 855 | icon = loadPixmap( pathString + "workweek2" ); |
856 | configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 ); | 856 | configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 ); |
857 | QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this ); | 857 | QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this ); |
858 | day6_action->addTo( viewMenu ); | 858 | day6_action->addTo( viewMenu ); |
859 | connect( day6_action, SIGNAL( activated() ), | 859 | connect( day6_action, SIGNAL( activated() ), |
860 | mView->viewManager(), SLOT( showMonthViewWeek() ) ); | 860 | mView->viewManager(), SLOT( showMonthViewWeek() ) ); |
861 | 861 | ||
862 | icon = loadPixmap( pathString + "month" ); | 862 | icon = loadPixmap( pathString + "month" ); |
863 | configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); | 863 | configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); |
864 | QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); | 864 | QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); |
865 | month_action->addTo( viewMenu ); | 865 | month_action->addTo( viewMenu ); |
866 | connect( month_action, SIGNAL( activated() ), | 866 | connect( month_action, SIGNAL( activated() ), |
867 | mView->viewManager(), SLOT( showMonthView() ) ); | 867 | mView->viewManager(), SLOT( showMonthView() ) ); |
868 | 868 | ||
869 | icon = loadPixmap( pathString + "list" ); | 869 | icon = loadPixmap( pathString + "list" ); |
870 | configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); | 870 | configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); |
871 | QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); | 871 | QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); |
872 | showlist_action->addTo( viewMenu ); | 872 | showlist_action->addTo( viewMenu ); |
873 | connect( showlist_action, SIGNAL( activated() ), | 873 | connect( showlist_action, SIGNAL( activated() ), |
874 | mView->viewManager(), SLOT( showListView() ) ); | 874 | mView->viewManager(), SLOT( showListView() ) ); |
875 | 875 | ||
876 | icon = loadPixmap( pathString + "todo" ); | 876 | icon = loadPixmap( pathString + "todo" ); |
877 | configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); | 877 | configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); |
878 | QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); | 878 | QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); |
879 | todoview_action->addTo( viewMenu ); | 879 | todoview_action->addTo( viewMenu ); |
880 | connect( todoview_action, SIGNAL( activated() ), | 880 | connect( todoview_action, SIGNAL( activated() ), |
881 | mView->viewManager(), SLOT( showTodoView() ) ); | 881 | mView->viewManager(), SLOT( showTodoView() ) ); |
882 | 882 | ||
883 | 883 | ||
884 | 884 | ||
885 | #if 0 | 885 | #if 0 |
886 | action = new QAction( "view_timespan", "Time Span", 0, this ); | 886 | action = new QAction( "view_timespan", "Time Span", 0, this ); |
887 | action->addTo( viewMenu ); | 887 | action->addTo( viewMenu ); |
888 | connect( action, SIGNAL( activated() ), | 888 | connect( action, SIGNAL( activated() ), |
889 | mView->viewManager(), SLOT( showTimeSpanView() ) ); | 889 | mView->viewManager(), SLOT( showTimeSpanView() ) ); |
890 | #endif | 890 | #endif |
891 | 891 | ||
892 | mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, | 892 | mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, |
893 | this ); | 893 | this ); |
894 | mNewSubTodoAction->addTo( actionMenu ); | 894 | mNewSubTodoAction->addTo( actionMenu ); |
895 | connect( mNewSubTodoAction, SIGNAL( activated() ), | 895 | connect( mNewSubTodoAction, SIGNAL( activated() ), |
896 | mView, SLOT( newSubTodo() ) ); | 896 | mView, SLOT( newSubTodo() ) ); |
897 | 897 | ||
898 | actionMenu->insertSeparator(); | 898 | actionMenu->insertSeparator(); |
899 | 899 | ||
900 | mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); | 900 | mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); |
901 | mShowAction->addTo( actionMenu ); | 901 | mShowAction->addTo( actionMenu ); |
902 | connect( mShowAction, SIGNAL( activated() ), | 902 | connect( mShowAction, SIGNAL( activated() ), |
903 | mView, SLOT( showIncidence() ) ); | 903 | mView, SLOT( showIncidence() ) ); |
904 | 904 | ||
905 | mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); | 905 | mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); |
906 | mEditAction->addTo( actionMenu ); | 906 | mEditAction->addTo( actionMenu ); |
907 | connect( mEditAction, SIGNAL( activated() ), | 907 | connect( mEditAction, SIGNAL( activated() ), |
908 | mView, SLOT( editIncidence() ) ); | 908 | mView, SLOT( editIncidence() ) ); |
909 | 909 | ||
910 | mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); | 910 | mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); |
911 | mDeleteAction->addTo( actionMenu ); | 911 | mDeleteAction->addTo( actionMenu ); |
912 | connect( mDeleteAction, SIGNAL( activated() ), | 912 | connect( mDeleteAction, SIGNAL( activated() ), |
913 | mView, SLOT( deleteIncidence() ) ); | 913 | mView, SLOT( deleteIncidence() ) ); |
914 | 914 | ||
915 | 915 | ||
916 | mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); | 916 | mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); |
917 | mCloneAction->addTo( actionMenu ); | 917 | mCloneAction->addTo( actionMenu ); |
918 | connect( mCloneAction, SIGNAL( activated() ), | 918 | connect( mCloneAction, SIGNAL( activated() ), |
919 | mView, SLOT( cloneIncidence() ) ); | 919 | mView, SLOT( cloneIncidence() ) ); |
920 | mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); | 920 | mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); |
921 | mMoveAction->addTo( actionMenu ); | 921 | mMoveAction->addTo( actionMenu ); |
922 | connect( mMoveAction, SIGNAL( activated() ), | 922 | connect( mMoveAction, SIGNAL( activated() ), |
923 | mView, SLOT( moveIncidence() ) ); | 923 | mView, SLOT( moveIncidence() ) ); |
924 | mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); | 924 | mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); |
925 | mBeamAction->addTo( actionMenu ); | 925 | mBeamAction->addTo( actionMenu ); |
926 | connect( mBeamAction, SIGNAL( activated() ), | 926 | connect( mBeamAction, SIGNAL( activated() ), |
927 | mView, SLOT( beamIncidence() ) ); | 927 | mView, SLOT( beamIncidence() ) ); |
928 | mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); | 928 | mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); |
929 | mCancelAction->addTo( actionMenu ); | 929 | mCancelAction->addTo( actionMenu ); |
930 | connect( mCancelAction, SIGNAL( activated() ), | 930 | connect( mCancelAction, SIGNAL( activated() ), |
931 | mView, SLOT( toggleCancelIncidence() ) ); | 931 | mView, SLOT( toggleCancelIncidence() ) ); |
932 | 932 | ||
933 | actionMenu->insertSeparator(); | 933 | actionMenu->insertSeparator(); |
934 | 934 | ||
935 | action = new QAction( "purge_completed", i18n("Purge Completed"), 0, | 935 | action = new QAction( "purge_completed", i18n("Purge Completed"), 0, |
936 | this ); | 936 | this ); |
937 | action->addTo( actionMenu ); | 937 | action->addTo( actionMenu ); |
938 | connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); | 938 | connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); |
939 | 939 | ||
940 | icon = loadPixmap( pathString + "search" ); | 940 | icon = loadPixmap( pathString + "search" ); |
941 | QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); | 941 | QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); |
942 | configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5); | 942 | configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5); |
943 | search_action->addTo( actionMenu ); | 943 | search_action->addTo( actionMenu ); |
944 | connect( search_action, SIGNAL( activated() ), | 944 | connect( search_action, SIGNAL( activated() ), |
945 | mView->dialogManager(), SLOT( showSearchDialog() ) ); | 945 | mView->dialogManager(), SLOT( showSearchDialog() ) ); |
946 | 946 | ||
947 | 947 | ||
948 | 948 | ||
949 | if ( KOPrefs::instance()->mShowFullMenu ) { | 949 | if ( KOPrefs::instance()->mShowFullMenu ) { |
950 | actionMenu->insertSeparator(); | 950 | actionMenu->insertSeparator(); |
951 | actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); | 951 | actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); |
952 | 952 | ||
953 | } | 953 | } |
954 | // actionMenu->insertSeparator(); | 954 | // actionMenu->insertSeparator(); |
955 | action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, | 955 | action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, |
956 | this ); | 956 | this ); |
957 | action->addTo( importMenu_X ); | 957 | action->addTo( importMenu_X ); |
958 | connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); | 958 | connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); |
959 | action = new QAction( "import_quick", i18n("Import last file"), 0, | 959 | action = new QAction( "import_quick", i18n("Import last file"), 0, |
960 | this ); | 960 | this ); |
961 | action->addTo( importMenu_X ); | 961 | action->addTo( importMenu_X ); |
962 | connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); | 962 | connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); |
963 | importMenu_X->insertSeparator(); | 963 | importMenu_X->insertSeparator(); |
964 | action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, | 964 | action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, |
965 | this ); | 965 | this ); |
966 | action->addTo( importMenu_X ); | 966 | action->addTo( importMenu_X ); |
967 | connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); | 967 | connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); |
968 | //#ifndef DESKTOP_VERSION | 968 | //#ifndef DESKTOP_VERSION |
969 | importMenu_X->insertSeparator(); | 969 | importMenu_X->insertSeparator(); |
970 | action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, | 970 | action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, |
971 | this ); | 971 | this ); |
972 | action->addTo( importMenu_X ); | 972 | action->addTo( importMenu_X ); |
973 | connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); | 973 | connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); |
974 | //#else | 974 | //#else |
975 | #ifdef _OL_IMPORT_ | 975 | #ifdef _OL_IMPORT_ |
976 | importMenu_X->insertSeparator(); | 976 | importMenu_X->insertSeparator(); |
977 | action = new QAction( "import_ol", i18n("Import from OL"), 0, | 977 | action = new QAction( "import_ol", i18n("Import from OL"), 0, |
978 | this ); | 978 | this ); |
979 | action->addTo( importMenu_X ); | 979 | action->addTo( importMenu_X ); |
980 | connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); | 980 | connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); |
981 | #endif | 981 | #endif |
982 | //#endif | 982 | //#endif |
983 | 983 | ||
984 | //importMenu->insertSeparator(); | 984 | //importMenu->insertSeparator(); |
985 | action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, | 985 | action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, |
986 | this ); | 986 | this ); |
987 | action->addTo( importMenu ); | 987 | action->addTo( importMenu ); |
988 | connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); | 988 | connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); |
989 | 989 | ||
990 | action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, | 990 | action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, |
991 | this ); | 991 | this ); |
992 | action->addTo( importMenu ); | 992 | action->addTo( importMenu ); |
993 | connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); | 993 | connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); |
994 | importMenu->insertSeparator(); | 994 | importMenu->insertSeparator(); |
995 | importMenu->insertItem( i18n("Import"), importMenu_X ); | 995 | importMenu->insertItem( i18n("Import"), importMenu_X ); |
996 | //importMenu->insertSeparator(); | 996 | //importMenu->insertSeparator(); |
997 | action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, | 997 | action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, |
998 | this ); | 998 | this ); |
999 | action->addTo( exportMenu_X ); | 999 | action->addTo( exportMenu_X ); |
1000 | connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); | 1000 | connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); |
1001 | 1001 | ||
1002 | 1002 | ||
1003 | //LR | 1003 | //LR |
1004 | QPopupMenu *ex2phone = new QPopupMenu( this ); | 1004 | QPopupMenu *ex2phone = new QPopupMenu( this ); |
1005 | ex2phone->insertItem(i18n("Complete calendar..."), 1 ); | 1005 | ex2phone->insertItem(i18n("Complete calendar..."), 1 ); |
1006 | ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); | 1006 | ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); |
1007 | connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); | 1007 | connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); |
1008 | exportMenu_X->insertItem( i18n("Export to phone"), ex2phone ); | 1008 | exportMenu_X->insertItem( i18n("Export to phone"), ex2phone ); |
1009 | 1009 | ||
1010 | importMenu->insertItem( i18n("Export"), exportMenu_X ); | 1010 | importMenu->insertItem( i18n("Export"), exportMenu_X ); |
1011 | #ifndef DESKTOP_VERSION | 1011 | #ifndef DESKTOP_VERSION |
1012 | //importMenu->insertSeparator(); | 1012 | //importMenu->insertSeparator(); |
1013 | brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, | 1013 | brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, |
1014 | this ); | 1014 | this ); |
1015 | brAction->addTo( beamMenu_X ); | 1015 | brAction->addTo( beamMenu_X ); |
1016 | brAction->setToggleAction (true ) ; | 1016 | brAction->setToggleAction (true ) ; |
1017 | connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); | 1017 | connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); |
1018 | 1018 | ||
1019 | action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, | 1019 | action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, |
1020 | this ); | 1020 | this ); |
1021 | action->addTo( beamMenu_X ); | 1021 | action->addTo( beamMenu_X ); |
1022 | connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); | 1022 | connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); |
1023 | 1023 | ||
1024 | action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, | 1024 | action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, |
1025 | this ); | 1025 | this ); |
1026 | action->addTo( beamMenu_X ); | 1026 | action->addTo( beamMenu_X ); |
1027 | connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); | 1027 | connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); |
1028 | importMenu->insertItem( i18n("Beam"), beamMenu_X ); | 1028 | importMenu->insertItem( i18n("Beam"), beamMenu_X ); |
1029 | #else | 1029 | #else |
1030 | //importMenu->insertSeparator(); | 1030 | //importMenu->insertSeparator(); |
1031 | icon = loadPixmap( pathString + "print" ); | 1031 | icon = loadPixmap( pathString + "print" ); |
1032 | action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); | 1032 | action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); |
1033 | action->addTo( beamMenu_X ); | 1033 | action->addTo( beamMenu_X ); |
1034 | connect( action, SIGNAL( activated() ), | 1034 | connect( action, SIGNAL( activated() ), |
1035 | this, SLOT( printCal() ) ); | 1035 | this, SLOT( printCal() ) ); |
1036 | 1036 | ||
1037 | icon = loadPixmap( pathString + "print" ); | 1037 | icon = loadPixmap( pathString + "print" ); |
1038 | action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); | 1038 | action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); |
1039 | action->addTo( beamMenu_X ); | 1039 | action->addTo( beamMenu_X ); |
1040 | connect( action, SIGNAL( activated() ), | 1040 | connect( action, SIGNAL( activated() ), |
1041 | this, SLOT( printSel() ) ); | 1041 | this, SLOT( printSel() ) ); |
1042 | action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); | 1042 | action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); |
1043 | action->addTo( beamMenu_X ); | 1043 | action->addTo( beamMenu_X ); |
1044 | connect( action, SIGNAL( activated() ), | 1044 | connect( action, SIGNAL( activated() ), |
1045 | mView->viewManager(), SLOT( slotprintWNV() ) ); | 1045 | mView->viewManager(), SLOT( slotprintWNV() ) ); |
1046 | 1046 | ||
1047 | action = new QAction( i18n("Print selected event / todo..."),icon,i18n("Print selected event / todo..."), 0, this ); | 1047 | action = new QAction( i18n("Print selected event / todo..."),icon,i18n("Print selected event / todo..."), 0, this ); |
1048 | action->addTo( beamMenu_X ); | 1048 | action->addTo( beamMenu_X ); |
1049 | connect( action, SIGNAL( activated() ), | 1049 | connect( action, SIGNAL( activated() ), |
1050 | mView, SLOT( slotprintSelInc() ) ); | 1050 | mView, SLOT( slotprintSelInc() ) ); |
1051 | 1051 | ||
1052 | 1052 | ||
1053 | importMenu->insertItem( i18n("Print"), beamMenu_X ); | 1053 | importMenu->insertItem( i18n("Print"), beamMenu_X ); |
1054 | #endif | 1054 | #endif |
1055 | importMenu->insertSeparator(); | 1055 | importMenu->insertSeparator(); |
1056 | action = new QAction( "manage cat", i18n("Manage new categories..."), 0, | 1056 | action = new QAction( "manage cat", i18n("Manage new categories..."), 0, |
1057 | this ); | 1057 | this ); |
1058 | action->addTo( importMenu ); | 1058 | action->addTo( importMenu ); |
1059 | connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); | 1059 | connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); |
1060 | importMenu->insertSeparator(); | 1060 | importMenu->insertSeparator(); |
1061 | action = new QAction( "beam all", i18n("Save"), 0, | 1061 | action = new QAction( "beam all", i18n("Save"), 0, |
1062 | this ); | 1062 | this ); |
1063 | action->addTo( importMenu ); | 1063 | action->addTo( importMenu ); |
1064 | connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); | 1064 | connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); |
1065 | action = new QAction( "beam all", i18n("Exit (+save)"), 0, | 1065 | action = new QAction( "beam all", i18n("Exit (+save)"), 0, |
1066 | this ); | 1066 | this ); |
1067 | action->addTo( importMenu ); | 1067 | action->addTo( importMenu ); |
1068 | connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); | 1068 | connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); |
1069 | 1069 | ||
1070 | //menuBar->insertItem( "Configure",configureMenu ); | 1070 | //menuBar->insertItem( "Configure",configureMenu ); |
1071 | //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); | 1071 | //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); |
1072 | icon = loadPixmap( "korganizer/korganizer" ); | 1072 | icon = loadPixmap( "korganizer/korganizer" ); |
1073 | 1073 | ||
1074 | action = new QAction( "Whats New", i18n("What's new?"), 0,this ); | 1074 | action = new QAction( "Whats New", i18n("What's new?"), 0,this ); |
1075 | action->addTo( helpMenu ); | 1075 | action->addTo( helpMenu ); |
1076 | connect( action, SIGNAL( activated() ), | 1076 | connect( action, SIGNAL( activated() ), |
1077 | SLOT( whatsNew() ) ); | 1077 | SLOT( whatsNew() ) ); |
1078 | action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); | 1078 | action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); |
1079 | action->addTo( helpMenu ); | 1079 | action->addTo( helpMenu ); |
1080 | connect( action, SIGNAL( activated() ), | 1080 | connect( action, SIGNAL( activated() ), |
1081 | SLOT( features() ) ); | 1081 | SLOT( features() ) ); |
1082 | action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); | 1082 | action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); |
1083 | action->addTo( helpMenu ); | 1083 | action->addTo( helpMenu ); |
1084 | connect( action, SIGNAL( activated() ), | 1084 | connect( action, SIGNAL( activated() ), |
1085 | SLOT( keyBindings() ) ); | 1085 | SLOT( keyBindings() ) ); |
1086 | action = new QAction( "Storage Howto", i18n("Storage HowTo..."), 0,this ); | 1086 | action = new QAction( "Storage Howto", i18n("Storage HowTo..."), 0,this ); |
1087 | action->addTo( helpMenu ); | 1087 | action->addTo( helpMenu ); |
1088 | connect( action, SIGNAL( activated() ), | 1088 | connect( action, SIGNAL( activated() ), |
1089 | SLOT( storagehowto() ) ); | 1089 | SLOT( storagehowto() ) ); |
1090 | action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); | 1090 | action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); |
1091 | action->addTo( helpMenu ); | 1091 | action->addTo( helpMenu ); |
1092 | connect( action, SIGNAL( activated() ), | 1092 | connect( action, SIGNAL( activated() ), |
1093 | SLOT( synchowto() ) ); | 1093 | SLOT( synchowto() ) ); |
1094 | action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); | 1094 | action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); |
1095 | action->addTo( helpMenu ); | 1095 | action->addTo( helpMenu ); |
1096 | connect( action, SIGNAL( activated() ), | 1096 | connect( action, SIGNAL( activated() ), |
1097 | SLOT( kdesynchowto() ) ); | 1097 | SLOT( kdesynchowto() ) ); |
1098 | action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); | 1098 | action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); |
1099 | action->addTo( helpMenu ); | 1099 | action->addTo( helpMenu ); |
1100 | connect( action, SIGNAL( activated() ), | 1100 | connect( action, SIGNAL( activated() ), |
1101 | SLOT( multisynchowto() ) ); | 1101 | SLOT( multisynchowto() ) ); |
1102 | action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); | 1102 | action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); |
1103 | action->addTo( helpMenu ); | 1103 | action->addTo( helpMenu ); |
1104 | connect( action, SIGNAL( activated() ), | 1104 | connect( action, SIGNAL( activated() ), |
1105 | SLOT( aboutAutoSaving() ) ); | 1105 | SLOT( aboutAutoSaving() ) ); |
1106 | action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); | 1106 | action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); |
1107 | action->addTo( helpMenu ); | 1107 | action->addTo( helpMenu ); |
1108 | connect( action, SIGNAL( activated() ), | 1108 | connect( action, SIGNAL( activated() ), |
1109 | SLOT( aboutKnownBugs() ) ); | 1109 | SLOT( aboutKnownBugs() ) ); |
1110 | action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); | 1110 | action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); |
1111 | action->addTo( helpMenu ); | 1111 | action->addTo( helpMenu ); |
1112 | connect( action, SIGNAL( activated() ), | 1112 | connect( action, SIGNAL( activated() ), |
1113 | SLOT( usertrans() ) ); | 1113 | SLOT( usertrans() ) ); |
1114 | action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); | 1114 | action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); |
1115 | action->addTo( helpMenu ); | 1115 | action->addTo( helpMenu ); |
1116 | connect( action, SIGNAL( activated() ), | 1116 | connect( action, SIGNAL( activated() ), |
1117 | SLOT( faq() ) ); | 1117 | SLOT( faq() ) ); |
1118 | action = new QAction( "licence", i18n("Licence..."), 0, this ); | 1118 | action = new QAction( "licence", i18n("Licence..."), 0, this ); |
1119 | action->addTo( helpMenu ); | 1119 | action->addTo( helpMenu ); |
1120 | connect( action, SIGNAL( activated() ), | 1120 | connect( action, SIGNAL( activated() ), |
1121 | SLOT( licence() ) ); | 1121 | SLOT( licence() ) ); |
1122 | action = new QAction( "about", i18n("About..."), 0, this ); | 1122 | action = new QAction( "about", i18n("About..."), 0, this ); |
1123 | action->addTo( helpMenu ); | 1123 | action->addTo( helpMenu ); |
1124 | connect( action, SIGNAL( activated() ), | 1124 | connect( action, SIGNAL( activated() ), |
1125 | SLOT( about() ) ); | 1125 | SLOT( about() ) ); |
1126 | //menuBar->insertSeparator(); | 1126 | //menuBar->insertSeparator(); |
1127 | 1127 | ||
1128 | // ****************************************************** | 1128 | // ****************************************************** |
1129 | // menubar icons | 1129 | // menubar icons |
1130 | 1130 | ||
1131 | 1131 | ||
1132 | 1132 | ||
1133 | //menuBar->insertItem( iconToolBar ); | 1133 | //menuBar->insertItem( iconToolBar ); |
1134 | //xdays_action | 1134 | //xdays_action |
1135 | if (p-> mShowIconNewEvent) | 1135 | if (p-> mShowIconNewEvent) |
1136 | ne_action->addTo( iconToolBar ); | 1136 | ne_action->addTo( iconToolBar ); |
1137 | if (p->mShowIconNewTodo ) | 1137 | if (p->mShowIconNewTodo ) |
1138 | nt_action->addTo( iconToolBar ); | 1138 | nt_action->addTo( iconToolBar ); |
1139 | if (p-> mShowIconSearch) | 1139 | if (p-> mShowIconSearch) |
1140 | search_action->addTo( iconToolBar ); | 1140 | search_action->addTo( iconToolBar ); |
1141 | if (p-> mShowIconWhatsThis) | 1141 | if (p-> mShowIconWhatsThis) |
1142 | QWhatsThis::whatsThisButton ( iconToolBar ); | 1142 | QWhatsThis::whatsThisButton ( iconToolBar ); |
1143 | if (p-> mShowIconNext) | 1143 | if (p-> mShowIconNext) |
1144 | whatsnext_action->addTo( viewToolBar ); | 1144 | whatsnext_action->addTo( viewToolBar ); |
1145 | if (p-> mShowIconNextDays) | 1145 | if (p-> mShowIconNextDays) |
1146 | xdays_action->addTo( viewToolBar ); | 1146 | xdays_action->addTo( viewToolBar ); |
1147 | if (p-> mShowIconJournal) | 1147 | if (p-> mShowIconJournal) |
1148 | viewjournal_action->addTo( viewToolBar ); | 1148 | viewjournal_action->addTo( viewToolBar ); |
1149 | if (p-> mShowIconDay1) | 1149 | if (p-> mShowIconDay1) |
1150 | day1_action->addTo( viewToolBar ); | 1150 | day1_action->addTo( viewToolBar ); |
1151 | if (p-> mShowIconDay5) | 1151 | if (p-> mShowIconDay5) |
1152 | day5_action->addTo( viewToolBar ); | 1152 | day5_action->addTo( viewToolBar ); |
1153 | if (p-> mShowIconDay7) | 1153 | if (p-> mShowIconDay7) |
1154 | day7_action->addTo( viewToolBar ); | 1154 | day7_action->addTo( viewToolBar ); |
1155 | if (p-> mShowIconDay6) | 1155 | if (p-> mShowIconDay6) |
1156 | day6_action->addTo( viewToolBar ); | 1156 | day6_action->addTo( viewToolBar ); |
1157 | if (p-> mShowIconMonth) | 1157 | if (p-> mShowIconMonth) |
1158 | month_action->addTo( viewToolBar ); | 1158 | month_action->addTo( viewToolBar ); |
1159 | if (p-> mShowIconList) | 1159 | if (p-> mShowIconList) |
1160 | showlist_action->addTo( viewToolBar ); | 1160 | showlist_action->addTo( viewToolBar ); |
1161 | if (p-> mShowIconTodoview) | 1161 | if (p-> mShowIconTodoview) |
1162 | todoview_action->addTo( viewToolBar ); | 1162 | todoview_action->addTo( viewToolBar ); |
1163 | 1163 | ||
1164 | icon = loadPixmap( pathString + "2leftarrowB" ); | 1164 | icon = loadPixmap( pathString + "2leftarrowB" ); |
1165 | configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200); | 1165 | configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200); |
1166 | if (p-> mShowIconBackFast) { | 1166 | if (p-> mShowIconBackFast) { |
1167 | action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); | 1167 | action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); |
1168 | connect( action, SIGNAL( activated() ), | 1168 | connect( action, SIGNAL( activated() ), |
1169 | mView, SLOT( goPreviousMonth() ) ); | 1169 | mView, SLOT( goPreviousMonth() ) ); |
1170 | action->addTo( navigatorToolBar ); | 1170 | action->addTo( navigatorToolBar ); |
1171 | } | 1171 | } |
1172 | icon = loadPixmap( pathString + "1leftarrowB" ); | 1172 | icon = loadPixmap( pathString + "1leftarrowB" ); |
1173 | configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210); | 1173 | configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210); |
1174 | if (p-> mShowIconBack) { | 1174 | if (p-> mShowIconBack) { |
1175 | action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); | 1175 | action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); |
1176 | connect( action, SIGNAL( activated() ), | 1176 | connect( action, SIGNAL( activated() ), |
1177 | mView, SLOT( goPrevious() ) ); | 1177 | mView, SLOT( goPrevious() ) ); |
1178 | action->addTo( navigatorToolBar ); | 1178 | action->addTo( navigatorToolBar ); |
1179 | } | 1179 | } |
1180 | icon = loadPixmap( pathString + "today" ); | 1180 | icon = loadPixmap( pathString + "today" ); |
1181 | configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); | 1181 | configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); |
1182 | if (p-> mShowIconToday) | 1182 | if (p-> mShowIconToday) |
1183 | today_action->addTo( navigatorToolBar ); | 1183 | today_action->addTo( navigatorToolBar ); |
1184 | icon = loadPixmap( pathString + "1rightarrowB" ); | 1184 | icon = loadPixmap( pathString + "1rightarrowB" ); |
1185 | configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); | 1185 | configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); |
1186 | if (p-> mShowIconForward) { | 1186 | if (p-> mShowIconForward) { |
1187 | action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); | 1187 | action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); |
1188 | connect( action, SIGNAL( activated() ), | 1188 | connect( action, SIGNAL( activated() ), |
1189 | mView, SLOT( goNext() ) ); | 1189 | mView, SLOT( goNext() ) ); |
1190 | action->addTo( navigatorToolBar ); | 1190 | action->addTo( navigatorToolBar ); |
1191 | } | 1191 | } |
1192 | icon = loadPixmap( pathString + "2rightarrowB" ); | 1192 | icon = loadPixmap( pathString + "2rightarrowB" ); |
1193 | configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); | 1193 | configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); |
1194 | if (p-> mShowIconForwardFast) { | 1194 | if (p-> mShowIconForwardFast) { |
1195 | action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); | 1195 | action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); |
1196 | connect( action, SIGNAL( activated() ), | 1196 | connect( action, SIGNAL( activated() ), |
1197 | mView, SLOT( goNextMonth() ) ); | 1197 | mView, SLOT( goNextMonth() ) ); |
1198 | action->addTo( navigatorToolBar ); | 1198 | action->addTo( navigatorToolBar ); |
1199 | } | 1199 | } |
1200 | 1200 | ||
1201 | 1201 | ||
1202 | configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6); | 1202 | configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6); |
1203 | 1203 | ||
1204 | 1204 | ||
1205 | if ( p->mShowIconNavigator ) configureToolBarMenu->setItemChecked( 22 , true); | 1205 | if ( p->mShowIconNavigator ) configureToolBarMenu->setItemChecked( 22 , true); |
1206 | if ( p->mShowIconAllday ) configureToolBarMenu->setItemChecked( 24 , true); | 1206 | if ( p->mShowIconAllday ) configureToolBarMenu->setItemChecked( 24 , true); |
1207 | if ( p->mShowIconFilterview ) configureToolBarMenu->setItemChecked( 26 , true); | 1207 | if ( p->mShowIconFilterview ) configureToolBarMenu->setItemChecked( 26 , true); |
1208 | if ( p->mShowIconToggleFull ) configureToolBarMenu->setItemChecked( 28 , true); | 1208 | if ( p->mShowIconToggleFull ) configureToolBarMenu->setItemChecked( 28 , true); |
1209 | 1209 | ||
1210 | if (p-> mShowIconNewEvent) | 1210 | if (p-> mShowIconNewEvent) |
1211 | configureToolBarMenu->setItemChecked( 10, true ); | 1211 | configureToolBarMenu->setItemChecked( 10, true ); |
1212 | if (p->mShowIconNewTodo ) | 1212 | if (p->mShowIconNewTodo ) |
1213 | configureToolBarMenu->setItemChecked( 20, true ); | 1213 | configureToolBarMenu->setItemChecked( 20, true ); |
1214 | if (p-> mShowIconSearch) | 1214 | if (p-> mShowIconSearch) |
1215 | configureToolBarMenu->setItemChecked( 120, true ); | 1215 | configureToolBarMenu->setItemChecked( 120, true ); |
1216 | if (p-> mShowIconList) | 1216 | if (p-> mShowIconList) |
1217 | configureToolBarMenu->setItemChecked( 30, true ); | 1217 | configureToolBarMenu->setItemChecked( 30, true ); |
1218 | if (p-> mShowIconDay1) | 1218 | if (p-> mShowIconDay1) |
1219 | configureToolBarMenu->setItemChecked( 40, true ); | 1219 | configureToolBarMenu->setItemChecked( 40, true ); |
1220 | if (p-> mShowIconDay5) | 1220 | if (p-> mShowIconDay5) |
1221 | configureToolBarMenu->setItemChecked( 50, true ); | 1221 | configureToolBarMenu->setItemChecked( 50, true ); |
1222 | if (p-> mShowIconDay6) | 1222 | if (p-> mShowIconDay6) |
1223 | configureToolBarMenu->setItemChecked( 75, true ); | 1223 | configureToolBarMenu->setItemChecked( 75, true ); |
1224 | if (p-> mShowIconDay7) | 1224 | if (p-> mShowIconDay7) |
1225 | configureToolBarMenu->setItemChecked( 60, true ); | 1225 | configureToolBarMenu->setItemChecked( 60, true ); |
1226 | if (p-> mShowIconMonth) | 1226 | if (p-> mShowIconMonth) |
1227 | configureToolBarMenu->setItemChecked( 70, true ); | 1227 | configureToolBarMenu->setItemChecked( 70, true ); |
1228 | if (p-> mShowIconTodoview) | 1228 | if (p-> mShowIconTodoview) |
1229 | configureToolBarMenu->setItemChecked( 80, true ); | 1229 | configureToolBarMenu->setItemChecked( 80, true ); |
1230 | if (p-> mShowIconBackFast) | 1230 | if (p-> mShowIconBackFast) |
1231 | configureToolBarMenu->setItemChecked( 200, true ); | 1231 | configureToolBarMenu->setItemChecked( 200, true ); |
1232 | if (p-> mShowIconBack) | 1232 | if (p-> mShowIconBack) |
1233 | configureToolBarMenu->setItemChecked( 210, true ); | 1233 | configureToolBarMenu->setItemChecked( 210, true ); |
1234 | if (p-> mShowIconToday) | 1234 | if (p-> mShowIconToday) |
1235 | configureToolBarMenu->setItemChecked( 130, true ); | 1235 | configureToolBarMenu->setItemChecked( 130, true ); |
1236 | if (p-> mShowIconForward) | 1236 | if (p-> mShowIconForward) |
1237 | configureToolBarMenu->setItemChecked( 220, true ); | 1237 | configureToolBarMenu->setItemChecked( 220, true ); |
1238 | if (p-> mShowIconForwardFast) | 1238 | if (p-> mShowIconForwardFast) |
1239 | configureToolBarMenu->setItemChecked( 230, true ); | 1239 | configureToolBarMenu->setItemChecked( 230, true ); |
1240 | if (p-> mShowIconNextDays) | 1240 | if (p-> mShowIconNextDays) |
1241 | configureToolBarMenu->setItemChecked( 100, true ); | 1241 | configureToolBarMenu->setItemChecked( 100, true ); |
1242 | if (p-> mShowIconNext) | 1242 | if (p-> mShowIconNext) |
1243 | configureToolBarMenu->setItemChecked( 110, true ); | 1243 | configureToolBarMenu->setItemChecked( 110, true ); |
1244 | if (p-> mShowIconJournal) | 1244 | if (p-> mShowIconJournal) |
1245 | configureToolBarMenu->setItemChecked( 90, true ); | 1245 | configureToolBarMenu->setItemChecked( 90, true ); |
1246 | if (p-> mShowIconWhatsThis) | 1246 | if (p-> mShowIconWhatsThis) |
1247 | configureToolBarMenu->setItemChecked( 300, true ); | 1247 | configureToolBarMenu->setItemChecked( 300, true ); |
1248 | if (p-> mShowIconWeekNum) | 1248 | if (p-> mShowIconWeekNum) |
1249 | configureToolBarMenu->setItemChecked( 400, true ); | 1249 | configureToolBarMenu->setItemChecked( 400, true ); |
1250 | if (!p-> mShowIconStretch) { | 1250 | if (!p-> mShowIconStretch) { |
1251 | QLabel* dummy = new QLabel( iconToolBar ); | 1251 | QLabel* dummy = new QLabel( iconToolBar ); |
1252 | dummy->setBackgroundColor( iconToolBar->backgroundColor() ); | 1252 | dummy->setBackgroundColor( iconToolBar->backgroundColor() ); |
1253 | dummy->setMinimumWidth( 0 ); | 1253 | dummy->setMinimumWidth( 0 ); |
1254 | iconToolBar->setStretchableWidget ( dummy ) ; | 1254 | iconToolBar->setStretchableWidget ( dummy ) ; |
1255 | } | 1255 | } |
1256 | else { | 1256 | else { |
1257 | iconToolBar->setHorizontalStretchable (true ); | 1257 | iconToolBar->setHorizontalStretchable (true ); |
1258 | viewToolBar->setHorizontalStretchable (true ); | 1258 | viewToolBar->setHorizontalStretchable (true ); |
1259 | navigatorToolBar->setHorizontalStretchable (true ); | 1259 | navigatorToolBar->setHorizontalStretchable (true ); |
1260 | iconToolBar->setVerticalStretchable (true ); | 1260 | iconToolBar->setVerticalStretchable (true ); |
1261 | viewToolBar->setVerticalStretchable (true ); | 1261 | viewToolBar->setVerticalStretchable (true ); |
1262 | navigatorToolBar->setVerticalStretchable (true ); | 1262 | navigatorToolBar->setVerticalStretchable (true ); |
1263 | configureToolBarMenu->setItemChecked( 5, true ); | 1263 | configureToolBarMenu->setItemChecked( 5, true ); |
1264 | } | 1264 | } |
1265 | if (p-> mShowIconFilter) | 1265 | if (p-> mShowIconFilter) |
1266 | configureToolBarMenu->setItemChecked( 7, true ); | 1266 | configureToolBarMenu->setItemChecked( 7, true ); |
1267 | if (p-> mShowIconOnetoolbar) | 1267 | if (p-> mShowIconOnetoolbar) |
1268 | configureToolBarMenu->setItemChecked( 6, true ); | 1268 | configureToolBarMenu->setItemChecked( 6, true ); |
1269 | 1269 | ||
1270 | 1270 | ||
1271 | if ( filterMenubar ) | 1271 | if ( filterMenubar ) |
1272 | connect( mView->filterView(), SIGNAL( filterChanged() ), SLOT( updateFilterToolbar() ) ); | 1272 | connect( mView->filterView(), SIGNAL( filterChanged() ), SLOT( updateFilterToolbar() ) ); |
1273 | connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); | 1273 | connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); |
1274 | configureAgenda( p->mHourSize ); | 1274 | configureAgenda( p->mHourSize ); |
1275 | connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); | 1275 | connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); |
1276 | } | 1276 | } |
1277 | 1277 | ||
1278 | void MainWindow::exportToPhone( int mode ) | 1278 | void MainWindow::exportToPhone( int mode ) |
1279 | { | 1279 | { |
1280 | 1280 | ||
1281 | //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); | 1281 | //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); |
1282 | //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); | 1282 | //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); |
1283 | KOex2phonePrefs ex2phone; | 1283 | KOex2phonePrefs ex2phone; |
1284 | 1284 | ||
1285 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); | 1285 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); |
1286 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); | 1286 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); |
1287 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 1287 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
1288 | if ( mode == 1 ) | 1288 | if ( mode == 1 ) |
1289 | ex2phone.setCaption(i18n("Export complete calendar")); | 1289 | ex2phone.setCaption(i18n("Export complete calendar")); |
1290 | if ( mode == 2 ) | 1290 | if ( mode == 2 ) |
1291 | ex2phone.setCaption(i18n("Export filtered calendar")); | 1291 | ex2phone.setCaption(i18n("Export filtered calendar")); |
1292 | 1292 | ||
1293 | if ( !ex2phone.exec() ) { | 1293 | if ( !ex2phone.exec() ) { |
1294 | return; | 1294 | return; |
1295 | } | 1295 | } |
1296 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); | 1296 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); |
1297 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); | 1297 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); |
1298 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); | 1298 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); |
1299 | 1299 | ||
1300 | int inFuture = 0; | 1300 | int inFuture = 0; |
1301 | if ( ex2phone.mWriteBackFuture->isChecked() ) | 1301 | if ( ex2phone.mWriteBackFuture->isChecked() ) |
1302 | inFuture = ex2phone.mWriteBackFutureWeeks->value(); | 1302 | inFuture = ex2phone.mWriteBackFutureWeeks->value(); |
1303 | QPtrList<Incidence> delSel; | 1303 | QPtrList<Incidence> delSel; |
1304 | if ( mode == 1 ) | 1304 | if ( mode == 1 ) |
1305 | delSel = mCalendar->rawIncidences(); | 1305 | delSel = mCalendar->rawIncidences(); |
1306 | if ( mode == 2 ) | 1306 | if ( mode == 2 ) |
1307 | delSel = mCalendar->incidences(); | 1307 | delSel = mCalendar->incidences(); |
1308 | CalendarLocal* cal = new CalendarLocal(); | 1308 | CalendarLocal* cal = new CalendarLocal(); |
1309 | cal->setLocalTime(); | 1309 | cal->setLocalTime(); |
1310 | Incidence *incidence = delSel.first(); | 1310 | Incidence *incidence = delSel.first(); |
1311 | QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); | 1311 | QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); |
1312 | QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); | 1312 | QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); |
1313 | while ( incidence ) { | 1313 | while ( incidence ) { |
1314 | if ( incidence->type() != "Journal" ) { | 1314 | if ( incidence->type() != "Journal" ) { |
1315 | bool add = true; | 1315 | bool add = true; |
1316 | if ( inFuture ) { | 1316 | if ( inFuture ) { |
1317 | QDateTime dt; | 1317 | QDateTime dt; |
1318 | if ( incidence->type() == "Todo" ) { | 1318 | if ( incidence->type() == "Todo" ) { |
1319 | Todo * t = (Todo*)incidence; | 1319 | Todo * t = (Todo*)incidence; |
1320 | if ( t->hasDueDate() ) | 1320 | if ( t->hasDueDate() ) |
1321 | dt = t->dtDue(); | 1321 | dt = t->dtDue(); |
1322 | else | 1322 | else |
1323 | dt = cur.addSecs( 62 ); | 1323 | dt = cur.addSecs( 62 ); |
1324 | } | 1324 | } |
1325 | else { | 1325 | else { |
1326 | bool ok; | 1326 | bool ok; |
1327 | dt = incidence->getNextOccurence( cur, &ok ); | 1327 | dt = incidence->getNextOccurence( cur, &ok ); |
1328 | if ( !ok ) | 1328 | if ( !ok ) |
1329 | dt = cur.addSecs( -62 ); | 1329 | dt = cur.addSecs( -62 ); |
1330 | } | 1330 | } |
1331 | if ( dt < cur || dt > end ) { | 1331 | if ( dt < cur || dt > end ) { |
1332 | add = false; | 1332 | add = false; |
1333 | } | 1333 | } |
1334 | } | 1334 | } |
1335 | if ( add ) { | 1335 | if ( add ) { |
1336 | Incidence *in = incidence->clone(); | 1336 | Incidence *in = incidence->clone(); |
1337 | cal->addIncidence( in ); | 1337 | cal->addIncidence( in ); |
1338 | } | 1338 | } |
1339 | } | 1339 | } |
1340 | incidence = delSel.next(); | 1340 | incidence = delSel.next(); |
1341 | } | 1341 | } |
1342 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, | 1342 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, |
1343 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, | 1343 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, |
1344 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 1344 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
1345 | 1345 | ||
1346 | setCaption( i18n("Writing to phone...")); | 1346 | setCaption( i18n("Writing to phone...")); |
1347 | if ( PhoneFormat::writeToPhone( cal ) ) | 1347 | if ( PhoneFormat::writeToPhone( cal ) ) |
1348 | setCaption( i18n("Export to phone successful!")); | 1348 | setCaption( i18n("Export to phone successful!")); |
1349 | else | 1349 | else |
1350 | setCaption( i18n("Error exporting to phone!")); | 1350 | setCaption( i18n("Error exporting to phone!")); |
1351 | delete cal; | 1351 | delete cal; |
1352 | } | 1352 | } |
1353 | 1353 | ||
1354 | 1354 | ||
1355 | void MainWindow::setDefaultPreferences() | 1355 | void MainWindow::setDefaultPreferences() |
1356 | { | 1356 | { |
1357 | KOPrefs *p = KOPrefs::instance(); | 1357 | KOPrefs *p = KOPrefs::instance(); |
1358 | 1358 | ||
1359 | p->mCompactDialogs = true; | 1359 | p->mCompactDialogs = true; |
1360 | p->mConfirm = true; | 1360 | p->mConfirm = true; |
1361 | // p->mEnableQuickTodo = false; | 1361 | // p->mEnableQuickTodo = false; |
1362 | 1362 | ||
1363 | } | 1363 | } |
1364 | 1364 | ||
1365 | QString MainWindow::resourcePath() | 1365 | QString MainWindow::resourcePath() |
1366 | { | 1366 | { |
1367 | return KGlobal::iconLoader()->iconPath(); | 1367 | return KGlobal::iconLoader()->iconPath(); |
1368 | } | 1368 | } |
1369 | 1369 | ||
1370 | void MainWindow::displayText( QString text ,QString cap ) | 1370 | void MainWindow::displayText( QString text ,QString cap ) |
1371 | { | 1371 | { |
1372 | QDialog dia( this, "name", true ); ; | 1372 | QDialog dia( this, "name", true ); ; |
1373 | dia.setCaption( cap ); | 1373 | dia.setCaption( cap ); |
1374 | QVBoxLayout* lay = new QVBoxLayout( &dia ); | 1374 | QVBoxLayout* lay = new QVBoxLayout( &dia ); |
1375 | lay->setSpacing( 3 ); | 1375 | lay->setSpacing( 3 ); |
1376 | lay->setMargin( 3 ); | 1376 | lay->setMargin( 3 ); |
1377 | QTextBrowser tb ( &dia ); | 1377 | QTextBrowser tb ( &dia ); |
1378 | lay->addWidget( &tb ); | 1378 | lay->addWidget( &tb ); |
1379 | tb.setText( text ); | 1379 | tb.setText( text ); |
1380 | #ifdef DESKTOP_VERSION | 1380 | #ifdef DESKTOP_VERSION |
1381 | dia.resize( 640, 480); | 1381 | dia.resize( 640, 480); |
1382 | #else | 1382 | #else |
1383 | dia.showMaximized(); | 1383 | dia.showMaximized(); |
1384 | #endif | 1384 | #endif |
1385 | dia.exec(); | 1385 | dia.exec(); |
1386 | } | 1386 | } |
1387 | 1387 | ||
1388 | void MainWindow::features() | 1388 | void MainWindow::features() |
1389 | { | 1389 | { |
1390 | 1390 | ||
1391 | KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); | 1391 | KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); |
1392 | } | 1392 | } |
1393 | 1393 | ||
1394 | void MainWindow::usertrans() | 1394 | void MainWindow::usertrans() |
1395 | { | 1395 | { |
1396 | 1396 | ||
1397 | KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); | 1397 | KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); |
1398 | } | 1398 | } |
1399 | 1399 | ||
1400 | void MainWindow::storagehowto() | 1400 | void MainWindow::storagehowto() |
1401 | { | 1401 | { |
1402 | KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" ); | 1402 | KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" ); |
1403 | } | 1403 | } |
1404 | void MainWindow::kdesynchowto() | 1404 | void MainWindow::kdesynchowto() |
1405 | { | 1405 | { |
1406 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); | 1406 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); |
1407 | } | 1407 | } |
1408 | void MainWindow::multisynchowto() | 1408 | void MainWindow::multisynchowto() |
1409 | { | 1409 | { |
1410 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); | 1410 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); |
1411 | } | 1411 | } |
1412 | void MainWindow::synchowto() | 1412 | void MainWindow::synchowto() |
1413 | { | 1413 | { |
1414 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); | 1414 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); |
1415 | } | 1415 | } |
1416 | void MainWindow::faq() | 1416 | void MainWindow::faq() |
1417 | { | 1417 | { |
1418 | KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); | 1418 | KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); |
1419 | 1419 | ||
1420 | } | 1420 | } |
1421 | void MainWindow::whatsNew() | 1421 | void MainWindow::whatsNew() |
1422 | { | 1422 | { |
1423 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); | 1423 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); |
1424 | 1424 | ||
1425 | } | 1425 | } |
1426 | void MainWindow::licence() | 1426 | void MainWindow::licence() |
1427 | { | 1427 | { |
1428 | KApplication::showLicence(); | 1428 | KApplication::showLicence(); |
1429 | 1429 | ||
1430 | } | 1430 | } |
1431 | void MainWindow::about() | 1431 | void MainWindow::about() |
1432 | { | 1432 | { |
1433 | QString version; | 1433 | QString version; |
1434 | #include <../version> | 1434 | #include <../version> |
1435 | QMessageBox::about( this, i18n("About KOrganizer/Pi"), | 1435 | QMessageBox::about( this, i18n("About KOrganizer/Pi"), |
1436 | i18n("KOrganizer/Platform-independent\n") + | 1436 | i18n("KOrganizer/Platform-independent\n") + |
1437 | "(KO/Pi) " + version + " - " + | 1437 | "(KO/Pi) " + version + " - " + |
1438 | 1438 | ||
1439 | #ifdef DESKTOP_VERSION | 1439 | #ifdef DESKTOP_VERSION |
1440 | i18n("Desktop Edition\n") + | 1440 | i18n("Desktop Edition\n") + |
1441 | #else | 1441 | #else |
1442 | i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") + | 1442 | i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") + |
1443 | #endif | 1443 | #endif |
1444 | i18n("(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.info --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!") ); | 1444 | i18n("(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.info --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!") ); |
1445 | } | 1445 | } |
1446 | void MainWindow::keyBindings() | 1446 | void MainWindow::keyBindings() |
1447 | { | 1447 | { |
1448 | QString cap = i18n("KO/Pi Keys + Colors"); | 1448 | QString cap = i18n("KO/Pi Keys + Colors"); |
1449 | QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + | 1449 | QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + |
1450 | i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ | 1450 | i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ |
1451 | i18n("<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n") + | 1451 | i18n("<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n") + |
1452 | i18n("<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n") + | 1452 | i18n("<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n") + |
1453 | i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + | 1453 | i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + |
1454 | i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ | 1454 | i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ |
1455 | i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ | 1455 | i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ |
1456 | i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ | 1456 | i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ |
1457 | i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ | 1457 | i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ |
1458 | i18n("<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ")+ | 1458 | i18n("<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ")+ |
1459 | i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ | 1459 | i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ |
1460 | i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ | 1460 | i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ |
1461 | i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ | 1461 | i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ |
1462 | i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+ | 1462 | i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+ |
1463 | i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ | 1463 | i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ |
1464 | i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ | 1464 | i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ |
1465 | i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n")+ | 1465 | i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n")+ |
1466 | i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ | 1466 | i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ |
1467 | i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ | 1467 | i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ |
1468 | i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ | 1468 | i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ |
1469 | i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ | 1469 | i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ |
1470 | i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ | 1470 | i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ |
1471 | i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ | 1471 | i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ |
1472 | i18n("<p><h3>In agenda view:</h3></p>\n") + | 1472 | i18n("<p><h3>In agenda view:</h3></p>\n") + |
1473 | i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ | 1473 | i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ |
1474 | i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ | 1474 | i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ |
1475 | i18n("<p><h3>In todo view:</h3></p>\n") + | 1475 | i18n("<p><h3>In todo view:</h3></p>\n") + |
1476 | i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ | 1476 | i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ |
1477 | i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ | 1477 | i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ |
1478 | i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ | 1478 | i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ |
1479 | i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ | 1479 | i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ |
1480 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1480 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1481 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ | 1481 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ |
1482 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ | 1482 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ |
1483 | i18n("<p><h3>In list view:</h3></p>\n") + | 1483 | i18n("<p><h3>In list view:</h3></p>\n") + |
1484 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1484 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1485 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ | 1485 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ |
1486 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ | 1486 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ |
1487 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ | 1487 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ |
1488 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ | 1488 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ |
1489 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ | 1489 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ |
1490 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + | 1490 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + |
1491 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ | 1491 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ |
1492 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ | 1492 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ |
1493 | i18n("<p><b>E</b>: Edit item</p>\n") + | 1493 | i18n("<p><b>E</b>: Edit item</p>\n") + |
1494 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + | 1494 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + |
1495 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + | 1495 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + |
1496 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ | 1496 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ |
1497 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ | 1497 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ |
1498 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ | 1498 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ |
1499 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ | 1499 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ |
1500 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ | 1500 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ |
1501 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + | 1501 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + |
1502 | i18n("<p><b>White</b>: Item readonly</p>\n"); | 1502 | i18n("<p><b>White</b>: Item readonly</p>\n"); |
1503 | displayText( text, cap); | 1503 | displayText( text, cap); |
1504 | } | 1504 | } |
1505 | void MainWindow::aboutAutoSaving() | 1505 | void MainWindow::aboutAutoSaving() |
1506 | { | 1506 | { |
1507 | QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"); | 1507 | QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"); |
1508 | 1508 | ||
1509 | KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); | 1509 | KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); |
1510 | 1510 | ||
1511 | } | 1511 | } |
1512 | void MainWindow::aboutKnownBugs() | 1512 | void MainWindow::aboutKnownBugs() |
1513 | { | 1513 | { |
1514 | QMessageBox* msg; | 1514 | QMessageBox* msg; |
1515 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), | 1515 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), |
1516 | i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ | 1516 | i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ |
1517 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ | 1517 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ |
1518 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") + | 1518 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") + |
1519 | i18n("\nor report them in the bugtracker on\n") + | 1519 | i18n("\nor report them in the bugtracker on\n") + |
1520 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), | 1520 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), |
1521 | QMessageBox::NoIcon, | 1521 | QMessageBox::NoIcon, |
1522 | QMessageBox::Ok, | 1522 | QMessageBox::Ok, |
1523 | QMessageBox::NoButton, | 1523 | QMessageBox::NoButton, |
1524 | QMessageBox::NoButton); | 1524 | QMessageBox::NoButton); |
1525 | msg->exec(); | 1525 | msg->exec(); |
1526 | delete msg; | 1526 | delete msg; |
1527 | 1527 | ||
1528 | } | 1528 | } |
1529 | 1529 | ||
1530 | QString MainWindow::defaultFileName() | 1530 | QString MainWindow::defaultFileName() |
1531 | { | 1531 | { |
1532 | return locateLocal( "data", "korganizer/mycalendar.ics" ); | 1532 | return locateLocal( "data", "korganizer/mycalendar.ics" ); |
1533 | } | 1533 | } |
1534 | QString MainWindow::syncFileName() | 1534 | QString MainWindow::syncFileName() |
1535 | { | 1535 | { |
1536 | #ifdef DESKTOP_VERSION | 1536 | #ifdef DESKTOP_VERSION |
1537 | return locateLocal( "tmp", "synccalendar.ics" ); | 1537 | return locateLocal( "tmp", "synccalendar.ics" ); |
1538 | #else | 1538 | #else |
1539 | return QString( "/tmp/synccalendar.ics" ); | 1539 | return QString( "/tmp/synccalendar.ics" ); |
1540 | #endif | 1540 | #endif |
1541 | } | 1541 | } |
1542 | #include "koglobals.h" | 1542 | #include "koglobals.h" |
1543 | #include <kcalendarsystem.h> | 1543 | #include <kcalendarsystem.h> |
1544 | void MainWindow::updateWeek(QDate seda) | 1544 | void MainWindow::updateWeek(QDate seda) |
1545 | { | 1545 | { |
1546 | int weekNum = KGlobal::locale()->weekNum ( seda ); | 1546 | int weekNum = KGlobal::locale()->weekNum ( seda ); |
1547 | mWeekPixmap.fill( mWeekBgColor ); | 1547 | mWeekPixmap.fill( mWeekBgColor ); |
1548 | QPainter p ( &mWeekPixmap ); | 1548 | QPainter p ( &mWeekPixmap ); |
1549 | p.setFont( mWeekFont ); | 1549 | p.setFont( mWeekFont ); |
1550 | p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); | 1550 | p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); |
1551 | p.end(); | 1551 | p.end(); |
1552 | QIconSet icon3 ( mWeekPixmap ); | 1552 | QIconSet icon3 ( mWeekPixmap ); |
1553 | mWeekAction->setIconSet ( icon3 ); | 1553 | mWeekAction->setIconSet ( icon3 ); |
1554 | 1554 | ||
1555 | } | 1555 | } |
1556 | void MainWindow::updateWeekNum(const DateList &selectedDates) | 1556 | void MainWindow::updateWeekNum(const DateList &selectedDates) |
1557 | { | 1557 | { |
1558 | updateWeek( selectedDates.first() ); | 1558 | updateWeek( selectedDates.first() ); |
1559 | } | 1559 | } |
1560 | void MainWindow::processIncidenceSelection( Incidence *incidence ) | 1560 | void MainWindow::processIncidenceSelection( Incidence *incidence ) |
1561 | { | 1561 | { |
1562 | 1562 | ||
1563 | if ( !incidence ) { | 1563 | if ( !incidence ) { |
1564 | enableIncidenceActions( false ); | 1564 | enableIncidenceActions( false ); |
1565 | 1565 | ||
1566 | mNewSubTodoAction->setEnabled( false ); | 1566 | mNewSubTodoAction->setEnabled( false ); |
1567 | setCaptionToDates(); | 1567 | setCaptionToDates(); |
1568 | return; | 1568 | return; |
1569 | 1569 | ||
1570 | } | 1570 | } |
1571 | 1571 | ||
1572 | //KGlobal::locale()->formatDateTime(nextA, true); | 1572 | //KGlobal::locale()->formatDateTime(nextA, true); |
1573 | QString startString = ""; | 1573 | QString startString = ""; |
1574 | if ( incidence->type() != "Todo" ) { | 1574 | if ( incidence->type() != "Todo" ) { |
1575 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { | 1575 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { |
1576 | if ( incidence->doesFloat() ) { | 1576 | if ( incidence->doesFloat() ) { |
1577 | startString += ": "+incidence->dtStartDateStr( true ); | 1577 | startString += ": "+incidence->dtStartDateStr( true ); |
1578 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); | 1578 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); |
1579 | 1579 | ||
1580 | } else { | 1580 | } else { |
1581 | startString = ": "+incidence->dtStartStr(true); | 1581 | startString = ": "+incidence->dtStartStr(true); |
1582 | startString += " --- "+((Event*)incidence)->dtEndStr(true); | 1582 | startString += " --- "+((Event*)incidence)->dtEndStr(true); |
1583 | 1583 | ||
1584 | } | 1584 | } |
1585 | 1585 | ||
1586 | } else { | 1586 | } else { |
1587 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) | 1587 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) |
1588 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ | 1588 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ |
1589 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); | 1589 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); |
1590 | if ( incidence->categories().contains( i18n("Birthday") ) || incidence->categories().contains( i18n("Anniversary") ) ) { | 1590 | if ( incidence->categories().contains( i18n("Birthday") ) || incidence->categories().contains( i18n("Anniversary") ) ) { |
1591 | bool ok; | 1591 | bool ok; |
1592 | QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); | 1592 | QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); |
1593 | if ( ok ) { | 1593 | if ( ok ) { |
1594 | int years = noc.date().year() - incidence->dtStart().date().year(); | 1594 | int years = noc.date().year() - incidence->dtStart().date().year(); |
1595 | startString += i18n(" (%1 y.)"). arg( years ); | 1595 | startString += i18n(" (%1 y.)"). arg( years ); |
1596 | } | 1596 | } |
1597 | } | 1597 | } |
1598 | else | 1598 | else |
1599 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); | 1599 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); |
1600 | } | 1600 | } |
1601 | 1601 | ||
1602 | } | 1602 | } |
1603 | else | 1603 | else |
1604 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); | 1604 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); |
1605 | if ( !incidence->location().isEmpty() ) | 1605 | if ( !incidence->location().isEmpty() ) |
1606 | startString += " (" +incidence->location()+")"; | 1606 | startString += " (" +incidence->location()+")"; |
1607 | setCaption( incidence->summary()+startString); | 1607 | setCaption( incidence->summary()+startString); |
1608 | 1608 | ||
1609 | enableIncidenceActions( true ); | 1609 | enableIncidenceActions( true ); |
1610 | 1610 | ||
1611 | if ( incidence->type() == "Event" ) { | 1611 | if ( incidence->type() == "Event" ) { |
1612 | mShowAction->setText( i18n("Show Event...") ); | 1612 | mShowAction->setText( i18n("Show Event...") ); |
1613 | mEditAction->setText( i18n("Edit Event...") ); | 1613 | mEditAction->setText( i18n("Edit Event...") ); |
1614 | mDeleteAction->setText( i18n("Delete Event...") ); | 1614 | mDeleteAction->setText( i18n("Delete Event...") ); |
1615 | 1615 | ||
1616 | mNewSubTodoAction->setEnabled( false ); | 1616 | mNewSubTodoAction->setEnabled( false ); |
1617 | } else if ( incidence->type() == "Todo" ) { | 1617 | } else if ( incidence->type() == "Todo" ) { |
1618 | mShowAction->setText( i18n("Show Todo...") ); | 1618 | mShowAction->setText( i18n("Show Todo...") ); |
1619 | mEditAction->setText( i18n("Edit Todo...") ); | 1619 | mEditAction->setText( i18n("Edit Todo...") ); |
1620 | mDeleteAction->setText( i18n("Delete Todo...") ); | 1620 | mDeleteAction->setText( i18n("Delete Todo...") ); |
1621 | 1621 | ||
1622 | mNewSubTodoAction->setEnabled( true ); | 1622 | mNewSubTodoAction->setEnabled( true ); |
1623 | } else { | 1623 | } else { |
1624 | mShowAction->setText( i18n("Show...") ); | 1624 | mShowAction->setText( i18n("Show...") ); |
1625 | mShowAction->setText( i18n("Edit...") ); | 1625 | mShowAction->setText( i18n("Edit...") ); |
1626 | mShowAction->setText( i18n("Delete...") ); | 1626 | mShowAction->setText( i18n("Delete...") ); |
1627 | 1627 | ||
1628 | mNewSubTodoAction->setEnabled( false ); | 1628 | mNewSubTodoAction->setEnabled( false ); |
1629 | } | 1629 | } |
1630 | } | 1630 | } |
1631 | 1631 | ||
1632 | void MainWindow::enableIncidenceActions( bool enabled ) | 1632 | void MainWindow::enableIncidenceActions( bool enabled ) |
1633 | { | 1633 | { |
1634 | mShowAction->setEnabled( enabled ); | 1634 | mShowAction->setEnabled( enabled ); |
1635 | mEditAction->setEnabled( enabled ); | 1635 | mEditAction->setEnabled( enabled ); |
1636 | mDeleteAction->setEnabled( enabled ); | 1636 | mDeleteAction->setEnabled( enabled ); |
1637 | 1637 | ||
1638 | mCloneAction->setEnabled( enabled ); | 1638 | mCloneAction->setEnabled( enabled ); |
1639 | mMoveAction->setEnabled( enabled ); | 1639 | mMoveAction->setEnabled( enabled ); |
1640 | mBeamAction->setEnabled( enabled ); | 1640 | mBeamAction->setEnabled( enabled ); |
1641 | mCancelAction->setEnabled( enabled ); | 1641 | mCancelAction->setEnabled( enabled ); |
1642 | } | 1642 | } |
1643 | 1643 | ||
1644 | void MainWindow::importOL() | 1644 | void MainWindow::importOL() |
1645 | { | 1645 | { |
1646 | #ifdef _OL_IMPORT_ | 1646 | #ifdef _OL_IMPORT_ |
1647 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); | 1647 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); |
1648 | id->exec(); | 1648 | id->exec(); |
1649 | delete id; | 1649 | delete id; |
1650 | mView->updateView(); | 1650 | mView->updateView(); |
1651 | #endif | 1651 | #endif |
1652 | } | 1652 | } |
1653 | void MainWindow::importBday() | 1653 | void MainWindow::importBday() |
1654 | { | 1654 | { |
1655 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1655 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1656 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), | 1656 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), |
1657 | i18n("Import!"), i18n("Cancel"), 0, | 1657 | i18n("Import!"), i18n("Cancel"), 0, |
1658 | 0, 1 ); | 1658 | 0, 1 ); |
1659 | if ( result == 0 ) { | 1659 | if ( result == 0 ) { |
1660 | mView->importBday(); | 1660 | mView->importBday(); |
1661 | 1661 | ||
1662 | } | 1662 | } |
1663 | 1663 | ||
1664 | 1664 | ||
1665 | } | 1665 | } |
1666 | void MainWindow::importQtopia() | 1666 | void MainWindow::importQtopia() |
1667 | { | 1667 | { |
1668 | //#ifndef DESKTOP_VERSION | 1668 | //#ifndef DESKTOP_VERSION |
1669 | QString mess = i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"); | 1669 | QString mess = i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"); |
1670 | #ifdef DESKTOP_VERSION | 1670 | #ifdef DESKTOP_VERSION |
1671 | mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml"); | 1671 | mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml"); |
1672 | #endif | 1672 | #endif |
1673 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, | 1673 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, |
1674 | i18n("Import!"), i18n("Cancel"), 0, | 1674 | i18n("Import!"), i18n("Cancel"), 0, |
1675 | 0, 1 ); | 1675 | 0, 1 ); |
1676 | if ( result == 0 ) { | 1676 | if ( result == 0 ) { |
1677 | #ifndef DESKTOP_VERSION | 1677 | #ifndef DESKTOP_VERSION |
1678 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); | 1678 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); |
1679 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); | 1679 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); |
1680 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; | 1680 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; |
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; |
1877 | if ( pro == 0 ) | 1873 | if ( pro == 0 ) |
1878 | pro = 10; | 1874 | pro = 10; |
1879 | if ( e->state() == Qt::ControlButton) | 1875 | if ( e->state() == Qt::ControlButton) |
1880 | pro += 10; | 1876 | pro += 10; |
1881 | break; | 1877 | break; |
1882 | case Qt::Key_M: | 1878 | case Qt::Key_M: |
1883 | mView->viewManager()->showMonthView(); | 1879 | mView->viewManager()->showMonthView(); |
1884 | showSelectedDates = true; | 1880 | showSelectedDates = true; |
1885 | break; | 1881 | break; |
1886 | case Qt::Key_Insert: | 1882 | case Qt::Key_Insert: |
1887 | mView->newEvent(); | 1883 | mView->newEvent(); |
1888 | break; | 1884 | break; |
1889 | case Qt::Key_S : | 1885 | case Qt::Key_S : |
1890 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 1886 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
1891 | mView->newSubTodo(); | 1887 | mView->newSubTodo(); |
1892 | else | 1888 | else |
1893 | mView->dialogManager()->showSearchDialog(); | 1889 | mView->dialogManager()->showSearchDialog(); |
1894 | break; | 1890 | break; |
1895 | case Qt::Key_Y : | 1891 | case Qt::Key_Y : |
1896 | case Qt::Key_Z : | 1892 | case Qt::Key_Z : |
1897 | mView->viewManager()->showWorkWeekView(); | 1893 | mView->viewManager()->showWorkWeekView(); |
1898 | showSelectedDates = true; | 1894 | showSelectedDates = true; |
1899 | break; | 1895 | break; |
1900 | case Qt::Key_U : | 1896 | case Qt::Key_U : |
1901 | mView->viewManager()->showWeekView(); | 1897 | mView->viewManager()->showWeekView(); |
1902 | showSelectedDates = true; | 1898 | showSelectedDates = true; |
1903 | break; | 1899 | break; |
1904 | case Qt::Key_H : | 1900 | case Qt::Key_H : |
1905 | keyBindings(); | 1901 | keyBindings(); |
1906 | break; | 1902 | break; |
1907 | case Qt::Key_W: | 1903 | case Qt::Key_W: |
1908 | mView->viewManager()->showWhatsNextView(); | 1904 | mView->viewManager()->showWhatsNextView(); |
1909 | break; | 1905 | break; |
1910 | case Qt::Key_L: | 1906 | case Qt::Key_L: |
1911 | mView->viewManager()->showListView(); | 1907 | mView->viewManager()->showListView(); |
1912 | break; | 1908 | break; |
1913 | case Qt::Key_N: | 1909 | case Qt::Key_N: |
1914 | mView->viewManager()->showNextView(); | 1910 | mView->viewManager()->showNextView(); |
1915 | break; | 1911 | break; |
1916 | case Qt::Key_V: | 1912 | case Qt::Key_V: |
1917 | mView->viewManager()->showTodoView(); | 1913 | mView->viewManager()->showTodoView(); |
1918 | break; | 1914 | break; |
1919 | case Qt::Key_C: | 1915 | case Qt::Key_C: |
1920 | mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); | 1916 | mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); |
1921 | break; | 1917 | break; |
1922 | case Qt::Key_P: | 1918 | case Qt::Key_P: |
1923 | mView->showDatePicker( ); | 1919 | mView->showDatePicker( ); |
1924 | break; | 1920 | break; |
1925 | case Qt::Key_F: | 1921 | case Qt::Key_F: |
1926 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1922 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1927 | mView->editFilters(); | 1923 | mView->editFilters(); |
1928 | else | 1924 | else |
1929 | mView->toggleFilter(); | 1925 | mView->toggleFilter(); |
1930 | break; | 1926 | break; |
1931 | case Qt::Key_X: | 1927 | case Qt::Key_X: |
1932 | if ( e->state() == Qt::ControlButton ) | 1928 | if ( e->state() == Qt::ControlButton ) |
1933 | mView->toggleDateNavigatorWidget(); | 1929 | mView->toggleDateNavigatorWidget(); |
1934 | else { | 1930 | else { |
1935 | mView->viewManager()->showNextXView(); | 1931 | mView->viewManager()->showNextXView(); |
1936 | showSelectedDates = true; | 1932 | showSelectedDates = true; |
1937 | } | 1933 | } |
1938 | break; | 1934 | break; |
1939 | case Qt::Key_Space: | 1935 | case Qt::Key_Space: |
1940 | mView->toggleExpand(); | 1936 | mView->toggleExpand(); |
1941 | break; | 1937 | break; |
1942 | case Qt::Key_A: | 1938 | case Qt::Key_A: |
1943 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton ) | 1939 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton ) |
1944 | mView->showNextAlarms(); | 1940 | mView->showNextAlarms(); |
1945 | else | 1941 | else |
1946 | mView->toggleAllDaySize(); | 1942 | mView->toggleAllDaySize(); |
1947 | break; | 1943 | break; |
1948 | case Qt::Key_T: | 1944 | case Qt::Key_T: |
1949 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1945 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1950 | mView->newTodo(); | 1946 | mView->newTodo(); |
1951 | else { | 1947 | else { |
1952 | mView->goToday(); | 1948 | mView->goToday(); |
1953 | showSelectedDates = true; | 1949 | showSelectedDates = true; |
1954 | } | 1950 | } |
1955 | break; | 1951 | break; |
1956 | case Qt::Key_J: | 1952 | case Qt::Key_J: |
1957 | mView->viewManager()->showJournalView(); | 1953 | mView->viewManager()->showJournalView(); |
1958 | break; | 1954 | break; |
1959 | case Qt::Key_B: | 1955 | case Qt::Key_B: |
1960 | mView->editIncidenceDescription();; | 1956 | mView->editIncidenceDescription();; |
1961 | break; | 1957 | break; |
1962 | // case Qt::Key_Return: | 1958 | // case Qt::Key_Return: |
1963 | case Qt::Key_E: | 1959 | case Qt::Key_E: |
1964 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1960 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1965 | mView->newEvent(); | 1961 | mView->newEvent(); |
1966 | else | 1962 | else |
1967 | mView->editIncidence(); | 1963 | mView->editIncidence(); |
1968 | break; | 1964 | break; |
1969 | case Qt::Key_Plus: | 1965 | case Qt::Key_Plus: |
1970 | size = p->mHourSize +2; | 1966 | size = p->mHourSize +2; |
1971 | if ( size <= 22 ) | 1967 | if ( size <= 22 ) |
1972 | configureAgenda( size ); | 1968 | configureAgenda( size ); |
1973 | break; | 1969 | break; |
1974 | case Qt::Key_Minus: | 1970 | case Qt::Key_Minus: |
1975 | size = p->mHourSize - 2; | 1971 | size = p->mHourSize - 2; |
1976 | if ( size >= 4 ) | 1972 | if ( size >= 4 ) |
1977 | configureAgenda( size ); | 1973 | configureAgenda( size ); |
1978 | break; | 1974 | break; |
1979 | 1975 | ||
1980 | 1976 | ||
1981 | default: | 1977 | default: |
1982 | e->ignore(); | 1978 | e->ignore(); |
1983 | } | 1979 | } |
1984 | if ( pro > 0 ) { | 1980 | if ( pro > 0 ) { |
1985 | mView->selectFilter( pro-1 ); | 1981 | mView->selectFilter( pro-1 ); |
1986 | } | 1982 | } |
1987 | if ( showSelectedDates ) { | 1983 | if ( showSelectedDates ) { |
1988 | ;// setCaptionToDates(); | 1984 | ;// setCaptionToDates(); |
1989 | } | 1985 | } |
1990 | 1986 | ||
1991 | } | 1987 | } |
1992 | void MainWindow::fillFilterMenuTB() | 1988 | void MainWindow::fillFilterMenuTB() |
1993 | { | 1989 | { |
1994 | selectFilterMenuTB->clear(); | 1990 | selectFilterMenuTB->clear(); |
1995 | selectFilterMenuTB->insertItem(i18n ( "Edit Filters" ), 0 ); | 1991 | selectFilterMenuTB->insertItem(i18n ( "Edit Filters" ), 0 ); |
1996 | selectFilterMenuTB->insertSeparator(); | 1992 | selectFilterMenuTB->insertSeparator(); |
1997 | selectFilterMenuTB->insertItem(i18n ( "No Filter" ), 1 ); | 1993 | selectFilterMenuTB->insertItem(i18n ( "No Filter" ), 1 ); |
1998 | 1994 | ||
1999 | selectFilterMenuTB->insertSeparator(); | 1995 | selectFilterMenuTB->insertSeparator(); |
2000 | QPtrList<CalFilter> fili = mView->filters(); | 1996 | QPtrList<CalFilter> fili = mView->filters(); |
2001 | CalFilter *curfilter = mView->filterView()->selectedFilter(); | 1997 | CalFilter *curfilter = mView->filterView()->selectedFilter(); |
2002 | CalFilter *filter = fili.first(); | 1998 | CalFilter *filter = fili.first(); |
2003 | int iii = 2; | 1999 | int iii = 2; |
2004 | bool checkitem = mView->filterView()->filtersEnabled(); | 2000 | bool checkitem = mView->filterView()->filtersEnabled(); |
2005 | while(filter) { | 2001 | while(filter) { |
2006 | selectFilterMenuTB->insertItem( filter->name(), iii ); | 2002 | selectFilterMenuTB->insertItem( filter->name(), iii ); |
2007 | if ( filter == curfilter) | 2003 | if ( filter == curfilter) |
2008 | selectFilterMenuTB->setItemChecked( iii, checkitem ); | 2004 | selectFilterMenuTB->setItemChecked( iii, checkitem ); |
2009 | filter = fili.next(); | 2005 | filter = fili.next(); |
2010 | ++iii; | 2006 | ++iii; |
2011 | } | 2007 | } |
2012 | if ( !checkitem ) | 2008 | if ( !checkitem ) |
2013 | selectFilterMenuTB->setItemChecked( 1, true ); | 2009 | selectFilterMenuTB->setItemChecked( 1, true ); |
2014 | 2010 | ||
2015 | int x = 0; | 2011 | int x = 0; |
2016 | int y = iconToolBar->height(); | 2012 | int y = iconToolBar->height(); |
2017 | int dX = 0; | 2013 | int dX = 0; |
2018 | int dY = 0; | 2014 | int dY = 0; |
2019 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { | 2015 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { |
2020 | if ( iconToolBar->y() > height()/2 ) { | 2016 | if ( iconToolBar->y() > height()/2 ) { |
2021 | dY = selectFilterMenuTB->sizeHint().height()+8; | 2017 | dY = selectFilterMenuTB->sizeHint().height()+8; |
2022 | y = 0; | 2018 | y = 0; |
2023 | } | 2019 | } |
2024 | } else { | 2020 | } else { |
2025 | if ( iconToolBar->x() > width()/2 ) { // right side | 2021 | if ( iconToolBar->x() > width()/2 ) { // right side |
2026 | x=0; | 2022 | x=0; |
2027 | dX= selectFilterMenuTB->sizeHint().width()+8; | 2023 | dX= selectFilterMenuTB->sizeHint().width()+8; |
2028 | y = 0; | 2024 | y = 0; |
2029 | } else { | 2025 | } else { |
2030 | x= iconToolBar->width(); | 2026 | x= iconToolBar->width(); |
2031 | y = 0; | 2027 | y = 0; |
2032 | } | 2028 | } |
2033 | } | 2029 | } |
2034 | //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); | 2030 | //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); |
2035 | selectFilterMenuTB->popup(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY))); | 2031 | selectFilterMenuTB->popup(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY))); |
2036 | } | 2032 | } |
2037 | void MainWindow::fillFilterMenu() | 2033 | void MainWindow::fillFilterMenu() |
2038 | { | 2034 | { |
2039 | selectFilterMenu->clear(); | 2035 | selectFilterMenu->clear(); |
2040 | selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); | 2036 | selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); |
2041 | selectFilterMenu->insertSeparator(); | 2037 | selectFilterMenu->insertSeparator(); |
2042 | selectFilterMenu->insertItem(i18n ( "No Filter" ), 1 ); | 2038 | selectFilterMenu->insertItem(i18n ( "No Filter" ), 1 ); |
2043 | 2039 | ||
2044 | selectFilterMenu->insertSeparator(); | 2040 | selectFilterMenu->insertSeparator(); |
2045 | QPtrList<CalFilter> fili = mView->filters(); | 2041 | QPtrList<CalFilter> fili = mView->filters(); |
2046 | CalFilter *curfilter = mView->filterView()->selectedFilter(); | 2042 | CalFilter *curfilter = mView->filterView()->selectedFilter(); |
2047 | CalFilter *filter = fili.first(); | 2043 | CalFilter *filter = fili.first(); |
2048 | int iii = 2; | 2044 | int iii = 2; |
2049 | bool checkitem = mView->filterView()->filtersEnabled(); | 2045 | bool checkitem = mView->filterView()->filtersEnabled(); |
2050 | while(filter) { | 2046 | while(filter) { |
2051 | selectFilterMenu->insertItem( filter->name(), iii ); | 2047 | selectFilterMenu->insertItem( filter->name(), iii ); |
2052 | if ( filter == curfilter) | 2048 | if ( filter == curfilter) |
2053 | selectFilterMenu->setItemChecked( iii, checkitem ); | 2049 | selectFilterMenu->setItemChecked( iii, checkitem ); |
2054 | filter = fili.next(); | 2050 | filter = fili.next(); |
2055 | ++iii; | 2051 | ++iii; |
2056 | } | 2052 | } |
2057 | if ( !checkitem ) | 2053 | if ( !checkitem ) |
2058 | selectFilterMenu->setItemChecked( 1, true ); | 2054 | selectFilterMenu->setItemChecked( 1, true ); |
2059 | } | 2055 | } |
2060 | void MainWindow::fillFilterMenuPopup() | 2056 | void MainWindow::fillFilterMenuPopup() |
2061 | { | 2057 | { |
2062 | filterPopupMenu->clear(); | 2058 | filterPopupMenu->clear(); |
2063 | filterPopupMenu->insertItem(i18n ( "No Filter" ), 0 ); | 2059 | filterPopupMenu->insertItem(i18n ( "No Filter" ), 0 ); |
2064 | 2060 | ||
2065 | filterPopupMenu->insertSeparator(); | 2061 | filterPopupMenu->insertSeparator(); |
2066 | QPtrList<CalFilter> fili = mView->filters(); | 2062 | QPtrList<CalFilter> fili = mView->filters(); |
2067 | CalFilter *curfilter = mView->filterView()->selectedFilter(); | 2063 | CalFilter *curfilter = mView->filterView()->selectedFilter(); |
2068 | CalFilter *filter = fili.first(); | 2064 | CalFilter *filter = fili.first(); |
2069 | int iii = 1; | 2065 | int iii = 1; |
2070 | bool checkitem = mView->filterView()->filtersEnabled(); | 2066 | bool checkitem = mView->filterView()->filtersEnabled(); |
2071 | while(filter) { | 2067 | while(filter) { |
2072 | filterPopupMenu->insertItem( filter->name(), iii ); | 2068 | filterPopupMenu->insertItem( filter->name(), iii ); |
2073 | if ( filter == curfilter) | 2069 | if ( filter == curfilter) |
2074 | filterPopupMenu->setItemChecked( iii, checkitem ); | 2070 | filterPopupMenu->setItemChecked( iii, checkitem ); |
2075 | filter = fili.next(); | 2071 | filter = fili.next(); |
2076 | ++iii; | 2072 | ++iii; |
2077 | } | 2073 | } |
2078 | if ( !checkitem ) | 2074 | if ( !checkitem ) |
2079 | filterPopupMenu->setItemChecked( 0, true ); | 2075 | filterPopupMenu->setItemChecked( 0, true ); |
2080 | } | 2076 | } |
2081 | void MainWindow::selectFilter( int fil ) | 2077 | void MainWindow::selectFilter( int fil ) |
2082 | { | 2078 | { |
2083 | 2079 | ||
2084 | if ( fil == 0 ) { | 2080 | if ( fil == 0 ) { |
2085 | mView->editFilters( ); | 2081 | mView->editFilters( ); |
2086 | } else if ( fil == 1 ){ | 2082 | } else if ( fil == 1 ){ |
2087 | if ( mView->filterView()->filtersEnabled() ) | 2083 | if ( mView->filterView()->filtersEnabled() ) |
2088 | mView->toggleFilerEnabled( ); | 2084 | mView->toggleFilerEnabled( ); |
2089 | } else { | 2085 | } else { |
2090 | if ( !mView->filterView()->filtersEnabled() ) { | 2086 | if ( !mView->filterView()->filtersEnabled() ) { |
2091 | mView->filterView()->blockSignals( true ); | 2087 | mView->filterView()->blockSignals( true ); |
2092 | mView->toggleFilerEnabled( ); | 2088 | mView->toggleFilerEnabled( ); |
2093 | mView->filterView()->blockSignals( false ); | 2089 | mView->filterView()->blockSignals( false ); |
2094 | } | 2090 | } |
2095 | mView->selectFilter( fil-2 ); | 2091 | mView->selectFilter( fil-2 ); |
2096 | } | 2092 | } |
2097 | } | 2093 | } |
2098 | void MainWindow::updateFilterToolbar() | 2094 | void MainWindow::updateFilterToolbar() |
2099 | { | 2095 | { |
2100 | if ( filterMenubar ) { | 2096 | if ( filterMenubar ) { |
2101 | if ( !mView->filterView()->filtersEnabled() ) { | 2097 | if ( !mView->filterView()->filtersEnabled() ) { |
2102 | filterMenubar->changeItem( 0, i18n("No Filter") ); | 2098 | filterMenubar->changeItem( 0, i18n("No Filter") ); |
2103 | } else { | 2099 | } else { |
2104 | CalFilter *curfilter = mView->filterView()->selectedFilter(); | 2100 | CalFilter *curfilter = mView->filterView()->selectedFilter(); |
2105 | if ( curfilter ) { | 2101 | if ( curfilter ) { |
2106 | filterMenubar->changeItem( 0, curfilter->name() ); | 2102 | filterMenubar->changeItem( 0, curfilter->name() ); |
2107 | } | 2103 | } |
2108 | } | 2104 | } |
2109 | } | 2105 | } |
2110 | } | 2106 | } |
2111 | void MainWindow::selectFilterPopup( int fil ) | 2107 | void MainWindow::selectFilterPopup( int fil ) |
2112 | { | 2108 | { |
2113 | selectFilter( fil + 1 ); | 2109 | selectFilter( fil + 1 ); |
2114 | 2110 | ||
2115 | } | 2111 | } |
2116 | void MainWindow::configureToolBar( int item ) | 2112 | void MainWindow::configureToolBar( int item ) |
2117 | { | 2113 | { |
2118 | 2114 | ||
2119 | configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); | 2115 | configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); |
2120 | KOPrefs *p = KOPrefs::instance(); | 2116 | KOPrefs *p = KOPrefs::instance(); |
2121 | p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); | 2117 | p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); |
2122 | p-> mShowIconOnetoolbar = configureToolBarMenu->isItemChecked( 6 ); | 2118 | p-> mShowIconOnetoolbar = configureToolBarMenu->isItemChecked( 6 ); |
2123 | p-> mShowIconFilter = configureToolBarMenu->isItemChecked( 7 ); | 2119 | p-> mShowIconFilter = configureToolBarMenu->isItemChecked( 7 ); |
2124 | p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); | 2120 | p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); |
2125 | p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); | 2121 | p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); |
2126 | p->mShowIconNavigator = configureToolBarMenu->isItemChecked( 22 ); | 2122 | p->mShowIconNavigator = configureToolBarMenu->isItemChecked( 22 ); |
2127 | p->mShowIconAllday = configureToolBarMenu->isItemChecked( 24 ); | 2123 | p->mShowIconAllday = configureToolBarMenu->isItemChecked( 24 ); |
2128 | p->mShowIconFilterview = configureToolBarMenu->isItemChecked( 26 ); | 2124 | p->mShowIconFilterview = configureToolBarMenu->isItemChecked( 26 ); |
2129 | p->mShowIconToggleFull = configureToolBarMenu->isItemChecked( 28 ); | 2125 | p->mShowIconToggleFull = configureToolBarMenu->isItemChecked( 28 ); |
2130 | p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); | 2126 | p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); |
2131 | p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); | 2127 | p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); |
2132 | p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); | 2128 | p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); |
2133 | p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); | 2129 | p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); |
2134 | p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 ); | 2130 | p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 ); |
2135 | p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); | 2131 | p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); |
2136 | p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); | 2132 | p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); |
2137 | p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); | 2133 | p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); |
2138 | p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); | 2134 | p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); |
2139 | p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); | 2135 | p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); |
2140 | p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); | 2136 | p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); |
2141 | p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); | 2137 | p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); |
2142 | p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); | 2138 | p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); |
2143 | p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); | 2139 | p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); |
2144 | p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); | 2140 | p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); |
2145 | p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); | 2141 | p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); |
2146 | p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); | 2142 | p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); |
2147 | p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 ); | 2143 | p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 ); |
2148 | // initActions(); | 2144 | // initActions(); |
2149 | } | 2145 | } |
2150 | void MainWindow::setCaption ( const QString & c ) | 2146 | void MainWindow::setCaption ( const QString & c ) |
2151 | { | 2147 | { |
2152 | QString cap = c; | 2148 | QString cap = c; |
2153 | cap.replace( QRegExp("\n"), " " ); | 2149 | cap.replace( QRegExp("\n"), " " ); |
2154 | cap = cap.stripWhiteSpace(); | 2150 | cap = cap.stripWhiteSpace(); |
2155 | if ( cap.isEmpty() ) | 2151 | if ( cap.isEmpty() ) |
2156 | cap = "KO/Pi"; | 2152 | cap = "KO/Pi"; |
2157 | QWidget::setCaption( cap ); | 2153 | QWidget::setCaption( cap ); |
2158 | } | 2154 | } |
2159 | void MainWindow::setCaptionToDates() | 2155 | void MainWindow::setCaptionToDates() |
2160 | { | 2156 | { |
2161 | QString selDates; | 2157 | QString selDates; |
2162 | QDate date = mView->startDate(); | 2158 | QDate date = mView->startDate(); |
2163 | if ( ! date.isValid() ) { | 2159 | if ( ! date.isValid() ) { |
2164 | setCaption(""); | 2160 | setCaption(""); |
2165 | return; | 2161 | return; |
2166 | } | 2162 | } |
2167 | selDates = KGlobal::locale()->formatDate( date, true); | 2163 | selDates = KGlobal::locale()->formatDate( date, true); |
2168 | if (mView->startDate() < mView->endDate() ) | 2164 | if (mView->startDate() < mView->endDate() ) |
2169 | selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); | 2165 | selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); |
2170 | else { | 2166 | else { |
2171 | QString addString; | 2167 | QString addString; |
2172 | if ( date == QDateTime::currentDateTime().date() ) | 2168 | if ( date == QDateTime::currentDateTime().date() ) |
2173 | addString = i18n("Today"); | 2169 | addString = i18n("Today"); |
2174 | else if ( date == QDateTime::currentDateTime().date().addDays(1) ) | 2170 | else if ( date == QDateTime::currentDateTime().date().addDays(1) ) |
2175 | addString = i18n("Tomorrow"); | 2171 | addString = i18n("Tomorrow"); |
2176 | if ( !addString.isEmpty() ) | 2172 | if ( !addString.isEmpty() ) |
2177 | selDates = addString+", "+selDates ; | 2173 | selDates = addString+", "+selDates ; |
2178 | } | 2174 | } |
2179 | setCaption( i18n("Dates: ") + selDates ); | 2175 | setCaption( i18n("Dates: ") + selDates ); |
2180 | 2176 | ||
2181 | } | 2177 | } |
2182 | void MainWindow::showConfigureAgenda( ) | 2178 | void MainWindow::showConfigureAgenda( ) |
2183 | { | 2179 | { |
2184 | int iii; | 2180 | int iii; |
2185 | for ( iii = 1;iii<= 10 ;++iii ){ | 2181 | for ( iii = 1;iii<= 10 ;++iii ){ |
2186 | configureAgendaMenu->setItemChecked( (iii+1)*2, false ); | 2182 | configureAgendaMenu->setItemChecked( (iii+1)*2, false ); |
2187 | } | 2183 | } |
2188 | configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true ); | 2184 | configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true ); |
2189 | } | 2185 | } |
2190 | void MainWindow::configureAgenda( int item ) | 2186 | void MainWindow::configureAgenda( int item ) |
2191 | { | 2187 | { |
2192 | if ( KOPrefs::instance()->mHourSize == item ) | 2188 | if ( KOPrefs::instance()->mHourSize == item ) |
2193 | return; | 2189 | return; |
2194 | KOPrefs::instance()->mHourSize=item; | 2190 | KOPrefs::instance()->mHourSize=item; |
2195 | mView->viewManager()->agendaView()->updateConfig(); | 2191 | mView->viewManager()->agendaView()->updateConfig(); |
2196 | } | 2192 | } |
2197 | 2193 | ||
2198 | void MainWindow::saveCalendar() | 2194 | void MainWindow::saveCalendar() |
2199 | { | 2195 | { |
2200 | QString fn = KOPrefs::instance()->mLastSaveFile; | 2196 | QString fn = KOPrefs::instance()->mLastSaveFile; |
2201 | fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); | 2197 | fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); |
2202 | 2198 | ||
2203 | if ( fn == "" ) | 2199 | if ( fn == "" ) |
2204 | return; | 2200 | return; |
2205 | QFileInfo info; | 2201 | QFileInfo info; |
2206 | info.setFile( fn ); | 2202 | info.setFile( fn ); |
2207 | QString mes; | 2203 | QString mes; |
2208 | bool createbup = true; | 2204 | bool createbup = true; |
2209 | if ( info. exists() ) { | 2205 | if ( info. exists() ) { |
2210 | mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; | 2206 | mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; |
2211 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, | 2207 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, |
2212 | i18n("Overwrite!"), i18n("Cancel"), 0, | 2208 | i18n("Overwrite!"), i18n("Cancel"), 0, |
2213 | 0, 1 ); | 2209 | 0, 1 ); |
2214 | if ( result != 0 ) { | 2210 | if ( result != 0 ) { |
2215 | createbup = false; | 2211 | createbup = false; |
2216 | } | 2212 | } |
2217 | } | 2213 | } |
2218 | if ( createbup ) { | 2214 | if ( createbup ) { |
2219 | mView->saveCalendar( fn ); | 2215 | mView->saveCalendar( fn ); |
2220 | mes = i18n("KO/Pi:Saved %1").arg(fn); | 2216 | mes = i18n("KO/Pi:Saved %1").arg(fn); |
2221 | KOPrefs::instance()->mLastSaveFile = fn; | 2217 | KOPrefs::instance()->mLastSaveFile = fn; |
2222 | setCaption(mes); | 2218 | setCaption(mes); |
2223 | } | 2219 | } |
2224 | } | 2220 | } |
2225 | void MainWindow::loadCalendar() | 2221 | void MainWindow::loadCalendar() |
2226 | { | 2222 | { |
2227 | 2223 | ||
2228 | QString fn = KOPrefs::instance()->mLastLoadFile; | 2224 | QString fn = KOPrefs::instance()->mLastLoadFile; |
2229 | fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); | 2225 | fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); |
2230 | 2226 | ||
2231 | if ( fn == "" ) | 2227 | if ( fn == "" ) |
2232 | return; | 2228 | return; |
2233 | QFileInfo info; | 2229 | QFileInfo info; |
2234 | info.setFile( fn ); | 2230 | info.setFile( fn ); |
2235 | QString mess; | 2231 | QString mess; |
2236 | bool loadbup = true; | 2232 | bool loadbup = true; |
2237 | if ( info. exists() ) { | 2233 | if ( info. exists() ) { |
2238 | mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); | 2234 | mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); |
2239 | int result = QMessageBox::warning( this, "KO/Pi: Warning!", | 2235 | int result = QMessageBox::warning( this, "KO/Pi: Warning!", |
2240 | mess, | 2236 | mess, |
2241 | i18n("Load!"), i18n("Cancel"), 0, | 2237 | i18n("Load!"), i18n("Cancel"), 0, |
2242 | 0, 1 ); | 2238 | 0, 1 ); |
2243 | if ( result != 0 ) { | 2239 | if ( result != 0 ) { |
2244 | loadbup = false; | 2240 | loadbup = false; |
2245 | } | 2241 | } |
2246 | } else { | 2242 | } else { |
2247 | QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 2243 | QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
2248 | i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, | 2244 | i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, |
2249 | 0, 1 ); | 2245 | 0, 1 ); |
2250 | 2246 | ||
2251 | return; | 2247 | return; |
2252 | } | 2248 | } |
2253 | if ( loadbup ) { | 2249 | if ( loadbup ) { |
2254 | mView->openCalendar( fn ); | 2250 | mView->openCalendar( fn ); |
2255 | KOPrefs::instance()->mLastLoadFile = fn; | 2251 | KOPrefs::instance()->mLastLoadFile = fn; |
2256 | mess = i18n("KO/Pi:Loaded %1").arg(fn) ; | 2252 | mess = i18n("KO/Pi:Loaded %1").arg(fn) ; |
2257 | setCaption(mess); | 2253 | setCaption(mess); |
2258 | } | 2254 | } |
2259 | 2255 | ||
2260 | } | 2256 | } |
2261 | void MainWindow::quickImportIcal() | 2257 | void MainWindow::quickImportIcal() |
2262 | { | 2258 | { |
2263 | importFile( KOPrefs::instance()->mLastImportFile, false ); | 2259 | importFile( KOPrefs::instance()->mLastImportFile, false ); |
2264 | } | 2260 | } |
2265 | void MainWindow::importFile( QString fn, bool quick ) | 2261 | void MainWindow::importFile( QString fn, bool quick ) |
2266 | { | 2262 | { |
2267 | QFileInfo info; | 2263 | QFileInfo info; |
2268 | info.setFile( fn ); | 2264 | info.setFile( fn ); |
2269 | QString mess; | 2265 | QString mess; |
2270 | bool loadbup = true; | 2266 | bool loadbup = true; |
2271 | if ( !info. exists() ) { | 2267 | if ( !info. exists() ) { |
2272 | mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); | 2268 | mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); |
2273 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 2269 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
2274 | mess ); | 2270 | mess ); |
2275 | return; | 2271 | return; |
2276 | } | 2272 | } |
2277 | int result = 0; | 2273 | int result = 0; |
2278 | if ( !quick ) { | 2274 | if ( !quick ) { |
2279 | mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); | 2275 | mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); |
2280 | result = QMessageBox::warning( this, "KO/Pi: Warning!", | 2276 | result = QMessageBox::warning( this, "KO/Pi: Warning!", |
2281 | mess, | 2277 | mess, |
2282 | "Import", "Cancel", 0, | 2278 | "Import", "Cancel", 0, |
2283 | 0, 1 ); | 2279 | 0, 1 ); |
2284 | } | 2280 | } |
2285 | if ( result == 0 ) { | 2281 | if ( result == 0 ) { |
2286 | if ( mView->openCalendar( fn, true )) { | 2282 | if ( mView->openCalendar( fn, true )) { |
2287 | KOPrefs::instance()->mLastImportFile = fn; | 2283 | KOPrefs::instance()->mLastImportFile = fn; |
2288 | setCaption(i18n("Imported file successfully")); | 2284 | setCaption(i18n("Imported file successfully")); |
2289 | } else { | 2285 | } else { |
2290 | setCaption(i18n("Error importing file")); | 2286 | setCaption(i18n("Error importing file")); |
2291 | } | 2287 | } |
2292 | } | 2288 | } |
2293 | } | 2289 | } |
2294 | 2290 | ||
2295 | void MainWindow::importIcal() | 2291 | void MainWindow::importIcal() |
2296 | { | 2292 | { |
2297 | 2293 | ||
2298 | QString fn =KOPrefs::instance()->mLastImportFile; | 2294 | QString fn =KOPrefs::instance()->mLastImportFile; |
2299 | 2295 | ||
2300 | fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); | 2296 | fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); |
2301 | if ( fn == "" ) | 2297 | if ( fn == "" ) |
2302 | return; | 2298 | return; |
2303 | importFile( fn, true ); | 2299 | importFile( fn, true ); |
2304 | 2300 | ||
2305 | } | 2301 | } |
2306 | 2302 | ||
2307 | void MainWindow::exportVCalendar() | 2303 | void MainWindow::exportVCalendar() |
2308 | { | 2304 | { |
2309 | QString fn = KOPrefs::instance()->mLastVcalFile; | 2305 | QString fn = KOPrefs::instance()->mLastVcalFile; |
2310 | fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); | 2306 | fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); |
2311 | if ( fn == "" ) | 2307 | if ( fn == "" ) |
2312 | return; | 2308 | return; |
2313 | QFileInfo info; | 2309 | QFileInfo info; |
2314 | info.setFile( fn ); | 2310 | info.setFile( fn ); |
2315 | QString mes; | 2311 | QString mes; |
2316 | bool createbup = true; | 2312 | bool createbup = true; |
2317 | if ( info. exists() ) { | 2313 | if ( info. exists() ) { |
2318 | mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); | 2314 | mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); |
2319 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, | 2315 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, |
2320 | i18n("Overwrite!"), i18n("Cancel"), 0, | 2316 | i18n("Overwrite!"), i18n("Cancel"), 0, |
2321 | 0, 1 ); | 2317 | 0, 1 ); |
2322 | if ( result != 0 ) { | 2318 | if ( result != 0 ) { |
2323 | createbup = false; | 2319 | createbup = false; |
2324 | } | 2320 | } |
2325 | } | 2321 | } |
2326 | if ( createbup ) { | 2322 | if ( createbup ) { |
2327 | if ( mView->exportVCalendar( fn ) ) { | 2323 | if ( mView->exportVCalendar( fn ) ) { |
2328 | KOPrefs::instance()->mLastVcalFile = fn; | 2324 | KOPrefs::instance()->mLastVcalFile = fn; |
2329 | if ( fn.length() > 20 ) | 2325 | if ( fn.length() > 20 ) |
2330 | mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; | 2326 | mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; |
2331 | else | 2327 | else |
2332 | mes = i18n("KO/Pi:Exported to %1").arg(fn ); | 2328 | mes = i18n("KO/Pi:Exported to %1").arg(fn ); |
2333 | setCaption(mes); | 2329 | setCaption(mes); |
2334 | } | 2330 | } |
2335 | } | 2331 | } |
2336 | 2332 | ||
2337 | } | 2333 | } |
2338 | QString MainWindow::sentSyncFile() | 2334 | QString MainWindow::sentSyncFile() |
2339 | { | 2335 | { |
2340 | #ifdef DESKTOP_VERSION | 2336 | #ifdef DESKTOP_VERSION |
2341 | return locateLocal( "tmp", "copysynccal.ics" ); | 2337 | return locateLocal( "tmp", "copysynccal.ics" ); |
2342 | #else | 2338 | #else |
2343 | return QString( "/tmp/copysynccal.ics" ); | 2339 | return QString( "/tmp/copysynccal.ics" ); |
2344 | #endif | 2340 | #endif |
2345 | } | 2341 | } |
2346 | 2342 | ||
2347 | void MainWindow::syncFileRequest() | 2343 | void MainWindow::syncFileRequest() |
2348 | { | 2344 | { |
2349 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { | 2345 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { |
2350 | mSyncManager->slotSyncMenu( 999 ); | 2346 | mSyncManager->slotSyncMenu( 999 ); |
2351 | } | 2347 | } |
2352 | 2348 | ||
2353 | setCaption(i18n("Saving Data to temp file ..." )); | 2349 | setCaption(i18n("Saving Data to temp file ..." )); |
2354 | mView->saveCalendar( sentSyncFile() ); | 2350 | mView->saveCalendar( sentSyncFile() ); |
2355 | setCaption(i18n("Data saved to temp file!" )); | 2351 | setCaption(i18n("Data saved to temp file!" )); |
2356 | 2352 | ||
2357 | } | 2353 | } |
2358 | void MainWindow::getFile( bool success ) | 2354 | void MainWindow::getFile( bool success ) |
2359 | { | 2355 | { |
2360 | if ( ! success ) { | 2356 | if ( ! success ) { |
2361 | setCaption( i18n("Error receiving file. Nothing changed!") ); | 2357 | setCaption( i18n("Error receiving file. Nothing changed!") ); |
2362 | return; | 2358 | return; |
2363 | } | 2359 | } |
2364 | mView->openCalendar( sentSyncFile() ); | 2360 | mView->openCalendar( sentSyncFile() ); |
2365 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { | 2361 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { |
2366 | mSyncManager->slotSyncMenu( 999 ); | 2362 | mSyncManager->slotSyncMenu( 999 ); |
2367 | } | 2363 | } |
2368 | setCaption( i18n("Pi-Sync successful!") ); | 2364 | setCaption( i18n("Pi-Sync successful!") ); |
2369 | } | 2365 | } |
2370 | 2366 | ||
2371 | void MainWindow::printSel( ) | 2367 | void MainWindow::printSel( ) |
2372 | { | 2368 | { |
2373 | mView->viewManager()->agendaView()->agenda()->printSelection(); | 2369 | mView->viewManager()->agendaView()->agenda()->printSelection(); |
2374 | } | 2370 | } |
2375 | 2371 | ||
2376 | void MainWindow::printCal() | 2372 | void MainWindow::printCal() |
2377 | { | 2373 | { |
2378 | mView->print();//mCp->showDialog(); | 2374 | mView->print();//mCp->showDialog(); |
2379 | } | 2375 | } |
2380 | 2376 | ||
2381 | 2377 | ||
2382 | #include "libkdepim/kdatepicker.h" | 2378 | #include "libkdepim/kdatepicker.h" |
2383 | #include <kdatetbl.h> | 2379 | #include <kdatetbl.h> |
2384 | 2380 | ||
2385 | void MainWindow::weekAction() | 2381 | void MainWindow::weekAction() |
2386 | { | 2382 | { |
2387 | int month; | 2383 | int month; |
2388 | KPopupFrame* popup = new KPopupFrame(this); | 2384 | KPopupFrame* popup = new KPopupFrame(this); |
2389 | KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup); | 2385 | KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup); |
2390 | // ----- | 2386 | // ----- |
2391 | picker->resize(picker->sizeHint()); | 2387 | picker->resize(picker->sizeHint()); |
2392 | popup->setMainWidget(picker); | 2388 | popup->setMainWidget(picker); |
2393 | picker->setFocus(); | 2389 | picker->setFocus(); |
2394 | connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); | 2390 | connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); |
2395 | int x = 0; | 2391 | int x = 0; |
2396 | int y = iconToolBar->height(); | 2392 | int y = iconToolBar->height(); |
2397 | int dX = 0; | 2393 | int dX = 0; |
2398 | int dY = 0; | 2394 | int dY = 0; |
2399 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { | 2395 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { |
2400 | if ( iconToolBar->y() > height()/2 ) { | 2396 | if ( iconToolBar->y() > height()/2 ) { |
2401 | dY = picker->sizeHint().height()+8; | 2397 | dY = picker->sizeHint().height()+8; |
2402 | y = 0; | 2398 | y = 0; |
2403 | } | 2399 | } |
2404 | } else { | 2400 | } else { |
2405 | if ( iconToolBar->x() > width()/2 ) { // right side | 2401 | if ( iconToolBar->x() > width()/2 ) { // right side |
2406 | x=0; | 2402 | x=0; |
2407 | dX= picker->sizeHint().width()+8; | 2403 | dX= picker->sizeHint().width()+8; |
2408 | y = 0; | 2404 | y = 0; |
2409 | } else { | 2405 | } else { |
2410 | x= iconToolBar->width(); | 2406 | x= iconToolBar->width(); |
2411 | y = 0; | 2407 | y = 0; |
2412 | } | 2408 | } |
2413 | } | 2409 | } |
2414 | //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); | 2410 | //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); |
2415 | if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)))) | 2411 | if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)))) |
2416 | { | 2412 | { |
2417 | month = picker->getResult(); | 2413 | month = picker->getResult(); |
2418 | emit selectWeek ( month ); | 2414 | emit selectWeek ( month ); |
2419 | //qDebug("weekSelected %d ", month); | 2415 | //qDebug("weekSelected %d ", month); |
2420 | } | 2416 | } |
2421 | delete popup; | 2417 | delete popup; |
2422 | } | 2418 | } |
2423 | 2419 | ||
2424 | void MainWindow::hideEvent ( QHideEvent * ) | 2420 | void MainWindow::hideEvent ( QHideEvent * ) |
2425 | { | 2421 | { |
2426 | QString message; | 2422 | QString message; |
2427 | QDateTime nextA = mCalendar->nextAlarmEventDateTime(); | 2423 | QDateTime nextA = mCalendar->nextAlarmEventDateTime(); |
2428 | if ( nextA.isValid() ) { | 2424 | if ( nextA.isValid() ) { |
2429 | QString sum = mCalendar->nextSummary(); | 2425 | QString sum = mCalendar->nextSummary(); |
2430 | 2426 | ||
2431 | message = i18n("%1 %2 - %3 (next event/todo with alarm)").arg( KGlobal::locale()->formatTime(nextA.time() , false)).arg(sum ).arg( KGlobal::locale()->formatDate(nextA.date() , false)); | 2427 | message = i18n("%1 %2 - %3 (next event/todo with alarm)").arg( KGlobal::locale()->formatTime(nextA.time() , false)).arg(sum ).arg( KGlobal::locale()->formatDate(nextA.date() , false)); |
2432 | setCaption( message ); | 2428 | setCaption( message ); |
2433 | } | 2429 | } |
2434 | } | 2430 | } |
2435 | 2431 | ||
2436 | void MainWindow::resizeEvent( QResizeEvent* e) | 2432 | void MainWindow::resizeEvent( QResizeEvent* e) |
2437 | { | 2433 | { |
2438 | #ifndef DESKTOP_VERSION | 2434 | #ifndef DESKTOP_VERSION |
2439 | if ( !KOPrefs::instance()->mShowIconFilter && !KOPrefs::instance()->mShowIconOnetoolbar && QApplication::desktop()->width() > 320) { | 2435 | if ( !KOPrefs::instance()->mShowIconFilter && !KOPrefs::instance()->mShowIconOnetoolbar && QApplication::desktop()->width() > 320) { |
2440 | if (QApplication::desktop()->width() > QApplication::desktop()->height() ) | 2436 | if (QApplication::desktop()->width() > QApplication::desktop()->height() ) |
2441 | filterToolBar->hide(); | 2437 | filterToolBar->hide(); |
2442 | else | 2438 | else |
2443 | filterToolBar->show(); | 2439 | filterToolBar->show(); |
2444 | } | 2440 | } |
2445 | #endif | 2441 | #endif |
2446 | QMainWindow::resizeEvent( e); | 2442 | QMainWindow::resizeEvent( e); |
2447 | } | 2443 | } |