-rw-r--r-- | korganizer/koagendaview.cpp | 28 | ||||
-rw-r--r-- | korganizer/kodaymatrix.cpp | 8 | ||||
-rw-r--r-- | korganizer/koeditordetails.cpp | 5 | ||||
-rw-r--r-- | korganizer/koprefs.cpp | 25 | ||||
-rw-r--r-- | korganizer/koprefsdialog.cpp | 98 | ||||
-rw-r--r-- | korganizer/koprefsdialog.h | 2 | ||||
-rw-r--r-- | korganizer/navigatorbar.cpp | 2 |
7 files changed, 91 insertions, 77 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index 218396d..072d464 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp | |||
@@ -1,1216 +1,1216 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qhbox.h> | 24 | #include <qhbox.h> |
25 | #include <qvbox.h> | 25 | #include <qvbox.h> |
26 | #include <qlabel.h> | 26 | #include <qlabel.h> |
27 | #include <qframe.h> | 27 | #include <qframe.h> |
28 | #include <qlayout.h> | 28 | #include <qlayout.h> |
29 | #ifndef KORG_NOSPLITTER | 29 | #ifndef KORG_NOSPLITTER |
30 | #include <qsplitter.h> | 30 | #include <qsplitter.h> |
31 | #endif | 31 | #endif |
32 | #include <qfont.h> | 32 | #include <qfont.h> |
33 | #include <qfontmetrics.h> | 33 | #include <qfontmetrics.h> |
34 | #include <qpopupmenu.h> | 34 | #include <qpopupmenu.h> |
35 | #include <qtooltip.h> | 35 | #include <qtooltip.h> |
36 | #include <qpainter.h> | 36 | #include <qpainter.h> |
37 | #include <qpushbutton.h> | 37 | #include <qpushbutton.h> |
38 | #include <qapplication.h> | 38 | #include <qapplication.h> |
39 | 39 | ||
40 | #include <kapplication.h> | 40 | #include <kapplication.h> |
41 | #include <KDGanttMinimizeSplitter.h> | 41 | #include <KDGanttMinimizeSplitter.h> |
42 | #include <kdebug.h> | 42 | #include <kdebug.h> |
43 | #include <kstandarddirs.h> | 43 | #include <kstandarddirs.h> |
44 | #include <kiconloader.h> | 44 | #include <kiconloader.h> |
45 | #include <klocale.h> | 45 | #include <klocale.h> |
46 | #include <kconfig.h> | 46 | #include <kconfig.h> |
47 | #include <kglobal.h> | 47 | #include <kglobal.h> |
48 | #include "calendarview.h" | 48 | #include "calendarview.h" |
49 | #include "koviewmanager.h" | 49 | #include "koviewmanager.h" |
50 | 50 | ||
51 | #include <libkcal/calendar.h> | 51 | #include <libkcal/calendar.h> |
52 | #include <libkcal/icaldrag.h> | 52 | #include <libkcal/icaldrag.h> |
53 | #include <libkcal/dndfactory.h> | 53 | #include <libkcal/dndfactory.h> |
54 | 54 | ||
55 | #include <kcalendarsystem.h> | 55 | #include <kcalendarsystem.h> |
56 | 56 | ||
57 | #include "koglobals.h" | 57 | #include "koglobals.h" |
58 | #ifndef KORG_NOPLUGINS | 58 | #ifndef KORG_NOPLUGINS |
59 | #include "kocore.h" | 59 | #include "kocore.h" |
60 | #endif | 60 | #endif |
61 | #include "koprefs.h" | 61 | #include "koprefs.h" |
62 | #include "koagenda.h" | 62 | #include "koagenda.h" |
63 | #include "koagendaitem.h" | 63 | #include "koagendaitem.h" |
64 | #ifndef KORG_NOPRINTER | 64 | #ifndef KORG_NOPRINTER |
65 | #include "calprinter.h" | 65 | #include "calprinter.h" |
66 | #endif | 66 | #endif |
67 | 67 | ||
68 | #include "koagendaview.h" | 68 | #include "koagendaview.h" |
69 | //#include "koagendaview.moc" | 69 | //#include "koagendaview.moc" |
70 | 70 | ||
71 | //extern bool globalFlagBlockPainting; | 71 | //extern bool globalFlagBlockPainting; |
72 | extern int globalFlagBlockAgenda; | 72 | extern int globalFlagBlockAgenda; |
73 | extern int globalFlagBlockStartup; | 73 | extern int globalFlagBlockStartup; |
74 | extern int globalFlagBlockAgendaItemPaint; | 74 | extern int globalFlagBlockAgendaItemPaint; |
75 | extern int globalFlagBlockAgendaItemUpdate; | 75 | extern int globalFlagBlockAgendaItemUpdate; |
76 | extern int globalFlagBlockLabel; | 76 | extern int globalFlagBlockLabel; |
77 | using namespace KOrg; | 77 | using namespace KOrg; |
78 | 78 | ||
79 | 79 | ||
80 | 80 | ||
81 | TimeLabels::TimeLabels(int rows,QWidget *parent,const char *name,WFlags f) : | 81 | TimeLabels::TimeLabels(int rows,QWidget *parent,const char *name,WFlags f) : |
82 | QScrollView(parent,name,f) | 82 | QScrollView(parent,name,f) |
83 | { | 83 | { |
84 | myPix.resize( 1, 1 ); | 84 | myPix.resize( 1, 1 ); |
85 | mRows = rows; | 85 | mRows = rows; |
86 | 86 | ||
87 | mRedrawNeeded = true; | 87 | mRedrawNeeded = true; |
88 | setMinimumHeight( 20 ); | 88 | setMinimumHeight( 20 ); |
89 | mCellHeight = KOPrefs::instance()->mHourSize*4; | 89 | mCellHeight = KOPrefs::instance()->mHourSize*4; |
90 | 90 | ||
91 | enableClipper(true); | 91 | enableClipper(true); |
92 | 92 | ||
93 | setHScrollBarMode(AlwaysOff); | 93 | setHScrollBarMode(AlwaysOff); |
94 | setVScrollBarMode(AlwaysOff); | 94 | setVScrollBarMode(AlwaysOff); |
95 | 95 | ||
96 | resizeContents(50,mRows * mCellHeight); | 96 | resizeContents(50,mRows * mCellHeight); |
97 | 97 | ||
98 | viewport()->setBackgroundMode( PaletteBackground ); | 98 | viewport()->setBackgroundMode( PaletteBackground ); |
99 | } | 99 | } |
100 | 100 | ||
101 | void TimeLabels::setCellHeight(int height) | 101 | void TimeLabels::setCellHeight(int height) |
102 | { | 102 | { |
103 | mCellHeight = height; | 103 | mCellHeight = height; |
104 | } | 104 | } |
105 | 105 | ||
106 | /* | 106 | /* |
107 | Optimization so that only the "dirty" portion of the scroll view | 107 | Optimization so that only the "dirty" portion of the scroll view |
108 | is redrawn. Unfortunately, this is not called by default paintEvent() method. | 108 | is redrawn. Unfortunately, this is not called by default paintEvent() method. |
109 | */ | 109 | */ |
110 | void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch) | 110 | void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch) |
111 | { | 111 | { |
112 | 112 | ||
113 | // if ( globalFlagBlockAgenda ) | 113 | // if ( globalFlagBlockAgenda ) |
114 | // return; | 114 | // return; |
115 | // bug: the parameters cx, cy, cw, ch are the areas that need to be | 115 | // bug: the parameters cx, cy, cw, ch are the areas that need to be |
116 | // redrawn, not the area of the widget. unfortunately, this | 116 | // redrawn, not the area of the widget. unfortunately, this |
117 | // code assumes the latter... | 117 | // code assumes the latter... |
118 | 118 | ||
119 | // now, for a workaround... | 119 | // now, for a workaround... |
120 | // these two assignments fix the weird redraw bug | 120 | // these two assignments fix the weird redraw bug |
121 | mRedrawNeeded = true; | ||
121 | if ( mRedrawNeeded ) { | 122 | if ( mRedrawNeeded ) { |
122 | cx = contentsX() + 2; | 123 | cx = contentsX() + frameWidth()*2; |
123 | cw = contentsWidth() - 2; | 124 | cw = contentsWidth() ; |
124 | // end of workaround | 125 | // end of workaround |
125 | 126 | ||
126 | int cell = ((int)(cy/mCellHeight)); | 127 | int cell = ((int)(cy/mCellHeight)); |
127 | int y = cell * mCellHeight; | 128 | int y = cell * mCellHeight; |
128 | QFontMetrics fm = fontMetrics(); | 129 | QFontMetrics fm = fontMetrics(); |
129 | QString hour; | 130 | QString hour; |
130 | QString suffix; | 131 | QString suffix; |
131 | int tW = fm.width("24:00i"); | 132 | int tW = fm.width("24:00i"); |
132 | int timeHeight = fm.height(); | 133 | int timeHeight = fm.height(); |
133 | //timeHeight -= (timeHeight/4-2); | 134 | //timeHeight -= (timeHeight/4-2); |
134 | int borderWidth = 0; | 135 | int borderWidth = 0; |
135 | QFont nFont = p->font(); | 136 | QFont nFont = p->font(); |
136 | 137 | ||
137 | if (!KGlobal::locale()->use12Clock()) | 138 | if (!KGlobal::locale()->use12Clock()) |
138 | suffix = "00"; | 139 | suffix = "00"; |
139 | else | 140 | else |
140 | borderWidth = 0; | 141 | borderWidth = 0; |
141 | if ( timeHeight > mCellHeight ) { | 142 | if ( timeHeight > mCellHeight ) { |
142 | timeHeight = mCellHeight-1; | 143 | timeHeight = mCellHeight-1; |
143 | int pointS = nFont.pointSize(); | 144 | int pointS = nFont.pointSize(); |
144 | while ( pointS > 4 ) { | 145 | while ( pointS > 4 ) { |
145 | nFont.setPointSize( pointS ); | 146 | nFont.setPointSize( pointS ); |
146 | fm = QFontMetrics( nFont ); | 147 | fm = QFontMetrics( nFont ); |
147 | if ( fm.height() < mCellHeight ) | 148 | if ( fm.height() < mCellHeight ) |
148 | break; | 149 | break; |
149 | -- pointS; | 150 | -- pointS; |
150 | } | 151 | } |
151 | fm = QFontMetrics( nFont ); | 152 | fm = QFontMetrics( nFont ); |
152 | borderWidth = 4; | 153 | borderWidth = 4; |
153 | timeHeight = fm.height(); | 154 | timeHeight = fm.height(); |
154 | } | 155 | } |
155 | timeHeight -= (timeHeight/4-2); | 156 | //timeHeight -= (timeHeight/4-2); |
156 | QFont sFont = nFont; | 157 | QFont sFont = nFont; |
157 | sFont.setPointSize( sFont.pointSize()/2+2 ); | 158 | sFont.setPointSize( sFont.pointSize()/2+2 ); |
158 | QFontMetrics fmS( sFont ); | 159 | QFontMetrics fmS( sFont ); |
159 | int sHei = fmS.height(); | 160 | int sHei = fmS.height(); |
160 | sHei -= (sHei/4-2); | 161 | //sHei -= (sHei/4-2); |
161 | int startW = this->width() - frameWidth(); | 162 | int startW = this->width() - frameWidth()-1; |
162 | while (y < cy + ch) { | 163 | while (y < cy + ch) { |
163 | p->drawLine(cx,y,cx+tW,y); | 164 | p->drawLine(cx,y,cx+tW,y); |
164 | hour.setNum(cell); | 165 | hour.setNum(cell); |
165 | 166 | ||
166 | // handle 24h and am/pm time formats | 167 | // handle 24h and am/pm time formats |
167 | if (KGlobal::locale()->use12Clock()) { | 168 | if (KGlobal::locale()->use12Clock()) { |
168 | if (cell > 11) suffix = "pm"; | 169 | if (cell > 11) suffix = "pm"; |
169 | else | 170 | else |
170 | suffix = "am"; | 171 | suffix = "am"; |
171 | if (cell == 0) hour.setNum(12); | 172 | if (cell == 0) hour.setNum(12); |
172 | if (cell > 12) hour.setNum(cell - 12); | 173 | if (cell > 12) hour.setNum(cell - 12); |
173 | } | 174 | } |
174 | 175 | ||
175 | // center and draw the time label | 176 | // center and draw the time label |
176 | int timeWidth = fm.width(hour+"i"); | 177 | int timeWidth = fm.width(hour); |
177 | int tw2 = fm.width(suffix); | 178 | int tw2 = fm.width(suffix); |
178 | int offset = startW - timeWidth - tw2 ; | 179 | int offset = startW - timeWidth - tw2 ; |
179 | p->setFont( nFont ); | 180 | p->setFont( nFont ); |
180 | p->drawText(cx - borderWidth + offset, y+ timeHeight, hour); | 181 | p->drawText( offset, y+ timeHeight, hour); |
181 | p->setFont( sFont ); | 182 | p->setFont( sFont ); |
182 | offset = startW - tw2-1; | 183 | offset = startW - tw2+1; |
183 | p->drawText(cx - borderWidth + offset, y+ sHei, suffix); | 184 | p->drawText( offset, y+ sHei, suffix); |
184 | 185 | ||
185 | // increment indices | 186 | // increment indices |
186 | y += mCellHeight; | 187 | y += mCellHeight; |
187 | cell++; | 188 | cell++; |
188 | } | 189 | } |
189 | } else { | 190 | } else { |
190 | //qDebug("NO redraw "); | 191 | //qDebug("NO redraw "); |
191 | } | 192 | } |
192 | // double buffer not yet implemented | 193 | // double buffer not yet implemented |
193 | //bitBlt (this, 0, 0, &myPix, 0 ,0,width(), height() ,CopyROP); | 194 | //bitBlt (this, 0, 0, &myPix, 0 ,0,width(), height() ,CopyROP); |
194 | //mRedrawNeeded = false; | 195 | //mRedrawNeeded = false; |
195 | } | 196 | } |
196 | 197 | ||
197 | /** | 198 | /** |
198 | Calculates the minimum width. | 199 | Calculates the minimum width. |
199 | */ | 200 | */ |
200 | int TimeLabels::minimumWidth() const | 201 | int TimeLabels::minimumWidth() const |
201 | { | 202 | { |
202 | return mMiniWidth; | 203 | return mMiniWidth; |
203 | } | 204 | } |
204 | 205 | ||
205 | /** updates widget's internal state */ | 206 | /** updates widget's internal state */ |
206 | void TimeLabels::updateConfig() | 207 | void TimeLabels::updateConfig() |
207 | { | 208 | { |
208 | mRedrawNeeded = true; | 209 | mRedrawNeeded = true; |
209 | // set the font | 210 | // set the font |
210 | // config->setGroup("Fonts"); | 211 | // config->setGroup("Fonts"); |
211 | // QFont font = config->readFontEntry("TimeBar Font"); | 212 | // QFont font = config->readFontEntry("TimeBar Font"); |
212 | setFont(KOPrefs::instance()->mTimeBarFont); | 213 | setFont(KOPrefs::instance()->mTimeBarFont); |
213 | QString test = "88:88"; | 214 | QString test = "88:88"; |
214 | if (KGlobal::locale()->use12Clock()) | 215 | if (KGlobal::locale()->use12Clock()) |
215 | test += "i"; | 216 | test += "i"; |
216 | mMiniWidth = fontMetrics().width(test) + frameWidth()*2 +1 ; | 217 | mMiniWidth = fontMetrics().width(test) + frameWidth()*2 +1 ; |
217 | // update geometry restrictions based on new settings | 218 | // update geometry restrictions based on new settings |
218 | setFixedWidth(minimumWidth()); | 219 | setFixedWidth(minimumWidth()); |
219 | 220 | ||
220 | // update HourSize | 221 | // update HourSize |
221 | mCellHeight = KOPrefs::instance()->mHourSize*4; | 222 | mCellHeight = KOPrefs::instance()->mHourSize*4; |
222 | resizeContents(50,mRows * mCellHeight); | 223 | resizeContents(50,mRows * mCellHeight); |
223 | } | 224 | } |
224 | 225 | ||
225 | /** update time label positions */ | 226 | /** update time label positions */ |
226 | void TimeLabels::positionChanged() | 227 | void TimeLabels::positionChanged() |
227 | { | 228 | { |
228 | int adjustment = mAgenda->contentsY(); | 229 | int adjustment = mAgenda->contentsY(); |
229 | setContentsPos(0, adjustment); | 230 | setContentsPos(0, adjustment); |
230 | } | 231 | } |
231 | 232 | ||
232 | /** */ | 233 | /** */ |
233 | void TimeLabels::setAgenda(KOAgenda* agenda) | 234 | void TimeLabels::setAgenda(KOAgenda* agenda) |
234 | { | 235 | { |
235 | mAgenda = agenda; | 236 | mAgenda = agenda; |
236 | } | 237 | } |
237 | 238 | ||
238 | void TimeLabels::contentsMousePressEvent ( QMouseEvent * e) | 239 | void TimeLabels::contentsMousePressEvent ( QMouseEvent * e) |
239 | { | 240 | { |
240 | mMouseDownY = e->pos().y(); | 241 | mMouseDownY = e->pos().y(); |
241 | mOrgCap = topLevelWidget()->caption(); | 242 | mOrgCap = topLevelWidget()->caption(); |
242 | } | 243 | } |
243 | 244 | ||
244 | void TimeLabels::contentsMouseMoveEvent ( QMouseEvent * e ) | 245 | void TimeLabels::contentsMouseMoveEvent ( QMouseEvent * e ) |
245 | { | 246 | { |
246 | int diff = mMouseDownY - e->pos().y(); | 247 | int diff = mMouseDownY - e->pos().y(); |
247 | if ( diff < 10 && diff > -10 ) | 248 | if ( diff < 10 && diff > -10 ) |
248 | return; | 249 | return; |
249 | int tSize = KOPrefs::instance()->mHourSize + (diff/10) ; | 250 | int tSize = KOPrefs::instance()->mHourSize + (diff/10) ; |
250 | if ( tSize < 4 ) | 251 | if ( tSize < 4 ) |
251 | tSize = 4; | 252 | tSize = 4; |
252 | if ( tSize > 22 ) | 253 | if ( tSize > 22 ) |
253 | tSize = 22; | 254 | tSize = 22; |
254 | tSize = (tSize-2)/2; | 255 | tSize = (tSize-2)/2; |
255 | topLevelWidget()->setCaption(i18n("New Agendasize: %1").arg(tSize)); | 256 | topLevelWidget()->setCaption(i18n("New Agendasize: %1").arg(tSize)); |
256 | 257 | ||
257 | } | 258 | } |
258 | void TimeLabels::contentsMouseReleaseEvent ( QMouseEvent * e ) | 259 | void TimeLabels::contentsMouseReleaseEvent ( QMouseEvent * e ) |
259 | { | 260 | { |
260 | topLevelWidget()->setCaption( mOrgCap ); | 261 | topLevelWidget()->setCaption( mOrgCap ); |
261 | int diff = mMouseDownY - e->pos().y(); | 262 | int diff = mMouseDownY - e->pos().y(); |
262 | if ( diff < 10 && diff > -10 ) | 263 | if ( diff < 10 && diff > -10 ) |
263 | return; | 264 | return; |
264 | int tSize = KOPrefs::instance()->mHourSize + (diff/10); | 265 | int tSize = KOPrefs::instance()->mHourSize + (diff/10); |
265 | if ( tSize < 4 ) | 266 | if ( tSize < 4 ) |
266 | tSize = 4; | 267 | tSize = 4; |
267 | if ( tSize > 22 ) | 268 | if ( tSize > 22 ) |
268 | tSize = 22; | 269 | tSize = 22; |
269 | tSize = (tSize/2)*2; | 270 | tSize = (tSize/2)*2; |
270 | if ( tSize == KOPrefs::instance()->mHourSize ) | 271 | if ( tSize == KOPrefs::instance()->mHourSize ) |
271 | return; | 272 | return; |
272 | KOPrefs::instance()->mHourSize = tSize; | 273 | KOPrefs::instance()->mHourSize = tSize; |
273 | emit scaleChanged(); | 274 | emit scaleChanged(); |
274 | } | 275 | } |
275 | 276 | ||
276 | /** This is called in response to repaint() */ | 277 | /** This is called in response to repaint() */ |
277 | void TimeLabels::paintEvent(QPaintEvent*) | 278 | void TimeLabels::paintEvent(QPaintEvent*) |
278 | { | 279 | { |
279 | 280 | ||
280 | // kdDebug() << "paintevent..." << endl; | 281 | // kdDebug() << "paintevent..." << endl; |
281 | // this is another hack! | 282 | // this is another hack! |
282 | // QPainter painter(this); | 283 | // QPainter painter(this); |
283 | //QString c | 284 | //QString c |
284 | repaintContents(contentsX(), contentsY(), visibleWidth(), visibleHeight()); | 285 | repaintContents(contentsX(), contentsY(), visibleWidth(), visibleHeight()); |
285 | } | 286 | } |
286 | 287 | ||
287 | //////////////////////////////////////////////////////////////////////////// | 288 | //////////////////////////////////////////////////////////////////////////// |
288 | 289 | ||
289 | EventIndicator::EventIndicator(Location loc,QWidget *parent,const char *name) | 290 | EventIndicator::EventIndicator(Location loc,QWidget *parent,const char *name) |
290 | : QFrame(parent,name) | 291 | : QFrame(parent,name) |
291 | { | 292 | { |
292 | mColumns = 1; | 293 | mColumns = 1; |
293 | mTopBox = 0; | 294 | mTopBox = 0; |
294 | mLocation = loc; | 295 | mLocation = loc; |
295 | mTopLayout = 0; | 296 | mTopLayout = 0; |
296 | mPaintWidget = 0; | 297 | mPaintWidget = 0; |
297 | mXOffset = 0; | 298 | mXOffset = 0; |
298 | if (mLocation == Top) mPixmap = SmallIcon("1uparrow"); | 299 | if (mLocation == Top) mPixmap = SmallIcon("1uparrow"); |
299 | else mPixmap = SmallIcon("1downarrow"); | 300 | else mPixmap = SmallIcon("1downarrow"); |
300 | mEnabled.resize(mColumns); | 301 | mEnabled.resize(mColumns); |
301 | mEnabled.fill( false ); | 302 | mEnabled.fill( false ); |
302 | setMinimumHeight(mPixmap.height()); | 303 | setMinimumHeight(mPixmap.height()); |
303 | } | 304 | } |
304 | 305 | ||
305 | EventIndicator::~EventIndicator() | 306 | EventIndicator::~EventIndicator() |
306 | { | 307 | { |
307 | } | 308 | } |
308 | 309 | ||
309 | void EventIndicator::drawContents(QPainter *p) | 310 | void EventIndicator::drawContents(QPainter *p) |
310 | { | 311 | { |
311 | 312 | ||
312 | // kdDebug() << "======== top: " << contentsRect().top() << " bottom " << // contentsRect().bottom() << " left " << contentsRect().left() << " right " << contentsRect().right() << endl; | 313 | // kdDebug() << "======== top: " << contentsRect().top() << " bottom " << // contentsRect().bottom() << " left " << contentsRect().left() << " right " << contentsRect().right() << endl; |
313 | KDGanttSplitterHandle* han = 0; | 314 | KDGanttSplitterHandle* han = 0; |
314 | if ( mPaintWidget ) | 315 | if ( mPaintWidget ) |
315 | han = mPaintWidget->firstHandle(); | 316 | han = mPaintWidget->firstHandle(); |
316 | if ( ! han ) { | 317 | if ( ! han ) { |
317 | int i; | 318 | int i; |
318 | for(i=0;i<mColumns;++i) { | 319 | for(i=0;i<mColumns;++i) { |
319 | if (mEnabled[i]) { | 320 | if (mEnabled[i]) { |
320 | int cellWidth = contentsRect().right()/mColumns; | 321 | int cellWidth = contentsRect().right()/mColumns; |
321 | int xOffset = KOGlobals::self()->reverseLayout() ? | 322 | int xOffset = KOGlobals::self()->reverseLayout() ? |
322 | (mColumns - 1 - i)*cellWidth + (cellWidth -mPixmap.width())/2 : | 323 | (mColumns - 1 - i)*cellWidth + (cellWidth -mPixmap.width())/2 : |
323 | i*cellWidth + (cellWidth -mPixmap.width()) /2; | 324 | i*cellWidth + (cellWidth -mPixmap.width()) /2; |
324 | p->drawPixmap(QPoint(1+xOffset,0),mPixmap); | 325 | p->drawPixmap(QPoint(1+xOffset,0),mPixmap); |
325 | } | 326 | } |
326 | } | 327 | } |
327 | } else { | 328 | } else { |
328 | han->repaint(); | 329 | han->repaint(); |
329 | //mPaintWidget->setBackgroundColor( red ); | 330 | //mPaintWidget->setBackgroundColor( red ); |
330 | 331 | ||
331 | QPainter pa( han ); | 332 | QPainter pa( han ); |
332 | int i; | 333 | int i; |
333 | bool setColor = false; | 334 | bool setColor = false; |
334 | for(i=0;i<mColumns;++i) { | 335 | for(i=0;i<mColumns;++i) { |
335 | if (mEnabled[i]) { | 336 | if (mEnabled[i]) { |
336 | setColor = true; | 337 | setColor = true; |
337 | 338 | ||
338 | int cellWidth = contentsRect().right()/mColumns; | 339 | int cellWidth = contentsRect().right()/mColumns; |
339 | int xOffset = KOGlobals::self()->reverseLayout() ? | 340 | int xOffset = KOGlobals::self()->reverseLayout() ? |
340 | (mColumns - 1 - i)*cellWidth + cellWidth/2 -mPixmap.width()/2 : | 341 | (mColumns - 1 - i)*cellWidth + cellWidth/2 -mPixmap.width()/2 : |
341 | i*cellWidth + cellWidth/2 -mPixmap.width()/2; | 342 | i*cellWidth + cellWidth/2 -mPixmap.width()/2; |
342 | pa.drawPixmap(QPoint(mXOffset + xOffset,0),mPixmap); | 343 | pa.drawPixmap(QPoint(mXOffset + xOffset,0),mPixmap); |
343 | //qDebug("222draw pix %d ",xOffset ); | 344 | //qDebug("222draw pix %d ",xOffset ); |
344 | 345 | ||
345 | } | 346 | } |
346 | 347 | ||
347 | } | 348 | } |
348 | pa.end(); | 349 | pa.end(); |
349 | 350 | ||
350 | } | 351 | } |
351 | } | 352 | } |
352 | 353 | ||
353 | void EventIndicator::setXOffset( int x ) | 354 | void EventIndicator::setXOffset( int x ) |
354 | { | 355 | { |
355 | mXOffset = x; | 356 | mXOffset = x; |
356 | } | 357 | } |
357 | void EventIndicator::setPaintWidget( KDGanttMinimizeSplitter * w ) | 358 | void EventIndicator::setPaintWidget( KDGanttMinimizeSplitter * w ) |
358 | { | 359 | { |
359 | mPaintWidget = w; | 360 | mPaintWidget = w; |
360 | setMaximumHeight(0); | 361 | setMaximumHeight(0); |
361 | setMinimumHeight(0); | 362 | setMinimumHeight(0); |
362 | } | 363 | } |
363 | void EventIndicator::changeColumns(int columns) | 364 | void EventIndicator::changeColumns(int columns) |
364 | { | 365 | { |
365 | mColumns = columns; | 366 | mColumns = columns; |
366 | mEnabled.resize(mColumns); | 367 | mEnabled.resize(mColumns); |
367 | 368 | ||
368 | update(); | 369 | update(); |
369 | } | 370 | } |
370 | 371 | ||
371 | void EventIndicator::enableColumn(int column, bool enable) | 372 | void EventIndicator::enableColumn(int column, bool enable) |
372 | { | 373 | { |
373 | mEnabled[column] = enable; | 374 | mEnabled[column] = enable; |
374 | } | 375 | } |
375 | 376 | ||
376 | 377 | ||
377 | //////////////////////////////////////////////////////////////////////////// | 378 | //////////////////////////////////////////////////////////////////////////// |
378 | //////////////////////////////////////////////////////////////////////////// | 379 | //////////////////////////////////////////////////////////////////////////// |
379 | //////////////////////////////////////////////////////////////////////////// | 380 | //////////////////////////////////////////////////////////////////////////// |
380 | 381 | ||
381 | KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : | 382 | KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : |
382 | KOEventView (cal,parent,name) | 383 | KOEventView (cal,parent,name) |
383 | { | 384 | { |
384 | mBlockUpdating = true; | 385 | mBlockUpdating = true; |
385 | mStartHour = 8; | 386 | mStartHour = 8; |
386 | mSelectedDates.append(QDate::currentDate()); | 387 | mSelectedDates.append(QDate::currentDate()); |
387 | 388 | ||
388 | mLayoutDayLabels = 0; | 389 | mLayoutDayLabels = 0; |
389 | mDayLabelsFrame = 0; | 390 | mDayLabelsFrame = 0; |
390 | mDayLabels = 0; | 391 | mDayLabels = 0; |
391 | bool isRTL = KOGlobals::self()->reverseLayout(); | 392 | bool isRTL = KOGlobals::self()->reverseLayout(); |
392 | QPixmap expandPix; | 393 | QPixmap expandPix; |
393 | if ( KOPrefs::instance()->mVerticalScreen ) { | 394 | if ( KOPrefs::instance()->mVerticalScreen ) { |
394 | expandPix = SmallIcon( "1updownarrow" ); | 395 | expandPix = SmallIcon( "1updownarrow" ); |
395 | } else { | 396 | } else { |
396 | expandPix = SmallIcon("1leftrightarrow" ); | 397 | expandPix = SmallIcon("1leftrightarrow" ); |
397 | } | 398 | } |
398 | 399 | ||
399 | QBoxLayout *topLayout = new QVBoxLayout(this); | 400 | QBoxLayout *topLayout = new QVBoxLayout(this); |
400 | 401 | ||
401 | // Create day name labels for agenda columns | 402 | // Create day name labels for agenda columns |
402 | // Create agenda splitter | 403 | // Create agenda splitter |
403 | 404 | ||
404 | mSplitterAgenda = new KDGanttMinimizeSplitter( Qt::Vertical, this); | 405 | mSplitterAgenda = new KDGanttMinimizeSplitter( Qt::Vertical, this); |
405 | mSplitterAgenda->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); | 406 | mSplitterAgenda->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); |
406 | topLayout->addWidget( mSplitterAgenda ); | 407 | topLayout->addWidget( mSplitterAgenda ); |
407 | mAllDayFrame = new QHBox(mSplitterAgenda); | 408 | mAllDayFrame = new QHBox(mSplitterAgenda); |
408 | mAllDayFrame->setFocusPolicy(NoFocus); | 409 | mAllDayFrame->setFocusPolicy(NoFocus); |
409 | QWidget *agendaFrame = new QWidget(mSplitterAgenda); | 410 | QWidget *agendaFrame = new QWidget(mSplitterAgenda); |
410 | agendaFrame->setFocusPolicy(NoFocus); | 411 | agendaFrame->setFocusPolicy(NoFocus); |
411 | 412 | ||
412 | // Create all-day agenda widget | 413 | // Create all-day agenda widget |
413 | mDummyAllDayLeft = new QVBox( mAllDayFrame ); | 414 | mDummyAllDayLeft = new QVBox( mAllDayFrame ); |
414 | 415 | ||
415 | mExpandButton = new QPushButton(mDummyAllDayLeft); | 416 | mExpandButton = new QPushButton(mDummyAllDayLeft); |
416 | mExpandButton->setPixmap( expandPix ); | 417 | mExpandButton->setPixmap( expandPix ); |
417 | int widebut = mExpandButton->sizeHint().width()+4; | 418 | int widebut = mExpandButton->sizeHint().width()+4; |
418 | int heibut = mExpandButton->sizeHint().height()+4; | 419 | int heibut = mExpandButton->sizeHint().height()+4; |
419 | if ( heibut > widebut ) | 420 | if ( heibut > widebut ) |
420 | widebut = heibut ; | 421 | widebut = heibut ; |
421 | if ( QApplication::desktop()->width() < 480 ) | 422 | |
422 | widebut = widebut*3/2; | ||
423 | //mExpandButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, | 423 | //mExpandButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, |
424 | // QSizePolicy::Fixed ) ); | 424 | // QSizePolicy::Fixed ) ); |
425 | mExpandButton->setFixedSize( widebut, widebut); | 425 | mExpandButton->setFixedSize( widebut, widebut); |
426 | connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) ); | 426 | connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) ); |
427 | mExpandButton->setFocusPolicy(NoFocus); | 427 | mExpandButton->setFocusPolicy(NoFocus); |
428 | mAllDayAgenda = new KOAgenda(1,mAllDayFrame); | 428 | mAllDayAgenda = new KOAgenda(1,mAllDayFrame); |
429 | mAllDayAgenda->setFocusPolicy(NoFocus); | 429 | mAllDayAgenda->setFocusPolicy(NoFocus); |
430 | QLabel *dummyAllDayRight = new QLabel (mAllDayFrame); | 430 | QLabel *dummyAllDayRight = new QLabel (mAllDayFrame); |
431 | 431 | ||
432 | // Create event context menu for all day agenda | 432 | // Create event context menu for all day agenda |
433 | mAllDayAgendaPopup = eventPopup(); | 433 | mAllDayAgendaPopup = eventPopup(); |
434 | connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), | 434 | connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), |
435 | mAllDayAgendaPopup,SLOT(showIncidencePopup(Incidence *))); | 435 | mAllDayAgendaPopup,SLOT(showIncidencePopup(Incidence *))); |
436 | 436 | ||
437 | // Create agenda frame | 437 | // Create agenda frame |
438 | QGridLayout *agendaLayout = new QGridLayout(agendaFrame,4,3); | 438 | QGridLayout *agendaLayout = new QGridLayout(agendaFrame,4,3); |
439 | // QHBox *agendaFrame = new QHBox(splitterAgenda); | 439 | // QHBox *agendaFrame = new QHBox(splitterAgenda); |
440 | 440 | ||
441 | // create event indicator bars | 441 | // create event indicator bars |
442 | mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame); | 442 | mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame); |
443 | #ifndef DESKTOP_VERSION | 443 | #ifndef DESKTOP_VERSION |
444 | // FIX | 444 | // FIX |
445 | mEventIndicatorTop->setPaintWidget( mSplitterAgenda ); | 445 | mEventIndicatorTop->setPaintWidget( mSplitterAgenda ); |
446 | #endif | 446 | #endif |
447 | mDayLabelsFrame = new QHBox(agendaFrame); | 447 | mDayLabelsFrame = new QHBox(agendaFrame); |
448 | //topLayout->addWidget(mDayLabelsFrame); | 448 | //topLayout->addWidget(mDayLabelsFrame); |
449 | mDayLabels = new QFrame (mDayLabelsFrame); | 449 | mDayLabels = new QFrame (mDayLabelsFrame); |
450 | mLayoutDayLabels = new QHBoxLayout(mDayLabels); | 450 | mLayoutDayLabels = new QHBoxLayout(mDayLabels); |
451 | agendaLayout->addMultiCellWidget(mDayLabelsFrame ,0,0,0,2); | 451 | agendaLayout->addMultiCellWidget(mDayLabelsFrame ,0,0,0,2); |
452 | agendaLayout->addWidget(mEventIndicatorTop,1,1); | 452 | agendaLayout->addWidget(mEventIndicatorTop,1,1); |
453 | 453 | ||
454 | mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom, | 454 | mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom, |
455 | agendaFrame); | 455 | agendaFrame); |
456 | agendaLayout->addWidget(mEventIndicatorBottom,3,1); | 456 | agendaLayout->addWidget(mEventIndicatorBottom,3,1); |
457 | QWidget *dummyAgendaRight = new QWidget(agendaFrame); | 457 | QWidget *dummyAgendaRight = new QWidget(agendaFrame); |
458 | agendaLayout->addWidget(dummyAgendaRight,1,2); | 458 | agendaLayout->addWidget(dummyAgendaRight,1,2); |
459 | 459 | ||
460 | // Create time labels | 460 | // Create time labels |
461 | mTimeLabels = new TimeLabels(24,agendaFrame); | 461 | mTimeLabels = new TimeLabels(24,agendaFrame); |
462 | agendaLayout->addWidget(mTimeLabels,2,0); | 462 | agendaLayout->addWidget(mTimeLabels,2,0); |
463 | connect(mTimeLabels,SIGNAL( scaleChanged()), | 463 | connect(mTimeLabels,SIGNAL( scaleChanged()), |
464 | this,SLOT(updateConfig())); | 464 | this,SLOT(updateConfig())); |
465 | 465 | ||
466 | // Create agenda | 466 | // Create agenda |
467 | mAgenda = new KOAgenda(1,96,KOPrefs::instance()->mHourSize,agendaFrame); | 467 | mAgenda = new KOAgenda(1,96,KOPrefs::instance()->mHourSize,agendaFrame); |
468 | agendaLayout->addMultiCellWidget(mAgenda,2,2,1,2); | 468 | agendaLayout->addMultiCellWidget(mAgenda,2,2,1,2); |
469 | agendaLayout->setColStretch(1,1); | 469 | agendaLayout->setColStretch(1,1); |
470 | mAgenda->setFocusPolicy(NoFocus); | 470 | mAgenda->setFocusPolicy(NoFocus); |
471 | // Create event context menu for agenda | 471 | // Create event context menu for agenda |
472 | mAgendaPopup = eventPopup(); | 472 | mAgendaPopup = eventPopup(); |
473 | 473 | ||
474 | mAgendaPopup->addAdditionalItem(QIconSet(SmallIcon("bell")), | 474 | mAgendaPopup->addAdditionalItem(QIconSet(SmallIcon("bell")), |
475 | i18n("Toggle Alarm"),mAgenda, | 475 | i18n("Toggle Alarm"),mAgenda, |
476 | SLOT(popupAlarm()),true); | 476 | SLOT(popupAlarm()),true); |
477 | 477 | ||
478 | 478 | ||
479 | connect(mAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), | 479 | connect(mAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), |
480 | mAgendaPopup,SLOT(showIncidencePopup(Incidence *))); | 480 | mAgendaPopup,SLOT(showIncidencePopup(Incidence *))); |
481 | 481 | ||
482 | // make connections between dependent widgets | 482 | // make connections between dependent widgets |
483 | mTimeLabels->setAgenda(mAgenda); | 483 | mTimeLabels->setAgenda(mAgenda); |
484 | 484 | ||
485 | // Update widgets to reflect user preferences | 485 | // Update widgets to reflect user preferences |
486 | // updateConfig(); | 486 | // updateConfig(); |
487 | 487 | ||
488 | // createDayLabels(); | 488 | // createDayLabels(); |
489 | 489 | ||
490 | // these blank widgets make the All Day Event box line up with the agenda | 490 | // these blank widgets make the All Day Event box line up with the agenda |
491 | dummyAllDayRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); | 491 | dummyAllDayRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); |
492 | dummyAgendaRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); | 492 | dummyAgendaRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); |
493 | mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); | 493 | mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); |
494 | 494 | ||
495 | // Scrolling | 495 | // Scrolling |
496 | connect(mAgenda->verticalScrollBar(),SIGNAL(valueChanged(int)), | 496 | connect(mAgenda->verticalScrollBar(),SIGNAL(valueChanged(int)), |
497 | mTimeLabels, SLOT(positionChanged())); | 497 | mTimeLabels, SLOT(positionChanged())); |
498 | connect(mTimeLabels->verticalScrollBar(),SIGNAL(valueChanged(int)), | 498 | connect(mTimeLabels->verticalScrollBar(),SIGNAL(valueChanged(int)), |
499 | SLOT(setContentsPos(int))); | 499 | SLOT(setContentsPos(int))); |
500 | 500 | ||
501 | connect(mAgenda,SIGNAL(showDateView( int, int)),SLOT(slotShowDateView( int, int ))); | 501 | connect(mAgenda,SIGNAL(showDateView( int, int)),SLOT(slotShowDateView( int, int ))); |
502 | connect(mAllDayAgenda,SIGNAL(showDateView( int, int )), SLOT(slotShowDateView( int, int ) )); | 502 | connect(mAllDayAgenda,SIGNAL(showDateView( int, int )), SLOT(slotShowDateView( int, int ) )); |
503 | 503 | ||
504 | // Create/Show/Edit/Delete Event | 504 | // Create/Show/Edit/Delete Event |
505 | connect(mAgenda,SIGNAL(newEventSignal(int,int)), | 505 | connect(mAgenda,SIGNAL(newEventSignal(int,int)), |
506 | SLOT(newEvent(int,int))); | 506 | SLOT(newEvent(int,int))); |
507 | connect(mAgenda,SIGNAL(newTodoSignal(int,int)), | 507 | connect(mAgenda,SIGNAL(newTodoSignal(int,int)), |
508 | SLOT(newTodo(int,int))); | 508 | SLOT(newTodo(int,int))); |
509 | connect(mAgenda,SIGNAL(newEventSignal(int,int,int,int)), | 509 | connect(mAgenda,SIGNAL(newEventSignal(int,int,int,int)), |
510 | SLOT(newEvent(int,int,int,int))); | 510 | SLOT(newEvent(int,int,int,int))); |
511 | connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int)), | 511 | connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int)), |
512 | SLOT(newEventAllDay(int,int))); | 512 | SLOT(newEventAllDay(int,int))); |
513 | connect(mAllDayAgenda,SIGNAL(newTodoSignal(int,int)), | 513 | connect(mAllDayAgenda,SIGNAL(newTodoSignal(int,int)), |
514 | SLOT(newTodoAllDay(int,int))); | 514 | SLOT(newTodoAllDay(int,int))); |
515 | connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int,int,int)), | 515 | connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int,int,int)), |
516 | SLOT(newEventAllDay(int,int))); | 516 | SLOT(newEventAllDay(int,int))); |
517 | connect(mAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), | 517 | connect(mAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), |
518 | SLOT(newTimeSpanSelected(int,int,int,int))); | 518 | SLOT(newTimeSpanSelected(int,int,int,int))); |
519 | connect(mAllDayAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), | 519 | connect(mAllDayAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), |
520 | SLOT(newTimeSpanSelectedAllDay(int,int,int,int))); | 520 | SLOT(newTimeSpanSelectedAllDay(int,int,int,int))); |
521 | connect(mAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); | 521 | connect(mAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); |
522 | connect(mAllDayAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); | 522 | connect(mAllDayAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); |
523 | 523 | ||
524 | connect(mAgenda,SIGNAL(editIncidenceSignal(Incidence *)), | 524 | connect(mAgenda,SIGNAL(editIncidenceSignal(Incidence *)), |
525 | SIGNAL(editIncidenceSignal(Incidence *))); | 525 | SIGNAL(editIncidenceSignal(Incidence *))); |
526 | connect(mAllDayAgenda,SIGNAL(editIncidenceSignal(Incidence *)), | 526 | connect(mAllDayAgenda,SIGNAL(editIncidenceSignal(Incidence *)), |
527 | SIGNAL(editIncidenceSignal(Incidence *))); | 527 | SIGNAL(editIncidenceSignal(Incidence *))); |
528 | connect(mAgenda,SIGNAL(showIncidenceSignal(Incidence *)), | 528 | connect(mAgenda,SIGNAL(showIncidenceSignal(Incidence *)), |
529 | SIGNAL(showIncidenceSignal(Incidence *))); | 529 | SIGNAL(showIncidenceSignal(Incidence *))); |
530 | connect(mAllDayAgenda,SIGNAL(showIncidenceSignal(Incidence *)), | 530 | connect(mAllDayAgenda,SIGNAL(showIncidenceSignal(Incidence *)), |
531 | SIGNAL(showIncidenceSignal(Incidence *))); | 531 | SIGNAL(showIncidenceSignal(Incidence *))); |
532 | connect(mAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), | 532 | connect(mAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), |
533 | SIGNAL(deleteIncidenceSignal(Incidence *))); | 533 | SIGNAL(deleteIncidenceSignal(Incidence *))); |
534 | connect(mAllDayAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), | 534 | connect(mAllDayAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), |
535 | SIGNAL(deleteIncidenceSignal(Incidence *))); | 535 | SIGNAL(deleteIncidenceSignal(Incidence *))); |
536 | 536 | ||
537 | connect(mAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), | 537 | connect(mAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), |
538 | SLOT(updateEventDates(KOAgendaItem *, int ))); | 538 | SLOT(updateEventDates(KOAgendaItem *, int ))); |
539 | connect(mAllDayAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), | 539 | connect(mAllDayAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), |
540 | SLOT(updateEventDates(KOAgendaItem *, int))); | 540 | SLOT(updateEventDates(KOAgendaItem *, int))); |
541 | 541 | ||
542 | // event indicator update | 542 | // event indicator update |
543 | connect(mAgenda,SIGNAL(lowerYChanged(int)), | 543 | connect(mAgenda,SIGNAL(lowerYChanged(int)), |
544 | SLOT(updateEventIndicatorTop(int))); | 544 | SLOT(updateEventIndicatorTop(int))); |
545 | connect(mAgenda,SIGNAL(upperYChanged(int)), | 545 | connect(mAgenda,SIGNAL(upperYChanged(int)), |
546 | SLOT(updateEventIndicatorBottom(int))); | 546 | SLOT(updateEventIndicatorBottom(int))); |
547 | // drag signals | 547 | // drag signals |
548 | /* | 548 | /* |
549 | connect(mAgenda,SIGNAL(startDragSignal(Event *)), | 549 | connect(mAgenda,SIGNAL(startDragSignal(Event *)), |
550 | SLOT(startDrag(Event *))); | 550 | SLOT(startDrag(Event *))); |
551 | connect(mAllDayAgenda,SIGNAL(startDragSignal(Event *)), | 551 | connect(mAllDayAgenda,SIGNAL(startDragSignal(Event *)), |
552 | SLOT(startDrag(Event *))); | 552 | SLOT(startDrag(Event *))); |
553 | */ | 553 | */ |
554 | // synchronize selections | 554 | // synchronize selections |
555 | connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 555 | connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
556 | mAllDayAgenda, SLOT( deselectItem() ) ); | 556 | mAllDayAgenda, SLOT( deselectItem() ) ); |
557 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 557 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
558 | mAgenda, SLOT( deselectItem() ) ); | 558 | mAgenda, SLOT( deselectItem() ) ); |
559 | connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 559 | connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
560 | SIGNAL( incidenceSelected( Incidence * ) ) ); | 560 | SIGNAL( incidenceSelected( Incidence * ) ) ); |
561 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 561 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
562 | SIGNAL( incidenceSelected( Incidence * ) ) ); | 562 | SIGNAL( incidenceSelected( Incidence * ) ) ); |
563 | connect( mAgenda, SIGNAL( resizedSignal() ), | 563 | connect( mAgenda, SIGNAL( resizedSignal() ), |
564 | SLOT( updateConfig( ) ) ); | 564 | SLOT( updateConfig( ) ) ); |
565 | connect( mAgenda, SIGNAL( addToCalSignal(Incidence *, Incidence *) ), | 565 | connect( mAgenda, SIGNAL( addToCalSignal(Incidence *, Incidence *) ), |
566 | SLOT( addToCalSlot(Incidence *, Incidence * ) ) ); | 566 | SLOT( addToCalSlot(Incidence *, Incidence * ) ) ); |
567 | connect( mAllDayAgenda, SIGNAL( addToCalSignal(Incidence * ,Incidence *) ), | 567 | connect( mAllDayAgenda, SIGNAL( addToCalSignal(Incidence * ,Incidence *) ), |
568 | SLOT( addToCalSlot(Incidence * , Incidence *) ) ); | 568 | SLOT( addToCalSlot(Incidence * , Incidence *) ) ); |
569 | // connect( mAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); | 569 | // connect( mAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); |
570 | //connect( mAllDayAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); | 570 | //connect( mAllDayAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); |
571 | 571 | ||
572 | 572 | ||
573 | } | 573 | } |
574 | 574 | ||
575 | void KOAgendaView::toggleAllDay() | 575 | void KOAgendaView::toggleAllDay() |
576 | { | 576 | { |
577 | if ( mSplitterAgenda->firstHandle() ) | 577 | if ( mSplitterAgenda->firstHandle() ) |
578 | mSplitterAgenda->firstHandle()->toggle(); | 578 | mSplitterAgenda->firstHandle()->toggle(); |
579 | } | 579 | } |
580 | void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld ) | 580 | void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld ) |
581 | { | 581 | { |
582 | calendar()->addIncidence( inc ); | 582 | calendar()->addIncidence( inc ); |
583 | 583 | ||
584 | if ( incOld ) { | 584 | if ( incOld ) { |
585 | if ( incOld->type() == "Todo" ) | 585 | if ( incOld->type() == "Todo" ) |
586 | emit todoMoved((Todo*)incOld, KOGlobals::EVENTEDITED ); | 586 | emit todoMoved((Todo*)incOld, KOGlobals::EVENTEDITED ); |
587 | else | 587 | else |
588 | emit incidenceChanged(incOld, KOGlobals::EVENTEDITED); | 588 | emit incidenceChanged(incOld, KOGlobals::EVENTEDITED); |
589 | } | 589 | } |
590 | 590 | ||
591 | } | 591 | } |
592 | 592 | ||
593 | KOAgendaView::~KOAgendaView() | 593 | KOAgendaView::~KOAgendaView() |
594 | { | 594 | { |
595 | delete mAgendaPopup; | 595 | delete mAgendaPopup; |
596 | delete mAllDayAgendaPopup; | 596 | delete mAllDayAgendaPopup; |
597 | delete KOAgendaItem::paintPix(); | 597 | delete KOAgendaItem::paintPix(); |
598 | delete KOAgendaItem::paintPixSel(); | 598 | delete KOAgendaItem::paintPixSel(); |
599 | } | 599 | } |
600 | void KOAgendaView::resizeEvent( QResizeEvent* e ) | 600 | void KOAgendaView::resizeEvent( QResizeEvent* e ) |
601 | { | 601 | { |
602 | //qDebug("KOAgendaView::resizeEvent( QResizeEvent* e ) %d ", e->size().width()); | 602 | //qDebug("KOAgendaView::resizeEvent( QResizeEvent* e ) %d ", e->size().width()); |
603 | bool uc = false; | 603 | bool uc = false; |
604 | int ow = e->oldSize().width(); | 604 | int ow = e->oldSize().width(); |
605 | int oh = e->oldSize().height(); | 605 | int oh = e->oldSize().height(); |
606 | int w = e->size().width(); | 606 | int w = e->size().width(); |
607 | int h = e->size().height(); | 607 | int h = e->size().height(); |
608 | if ( (ow > oh && w< h ) || (ow < oh && w > h ) ) { | 608 | if ( (ow > oh && w< h ) || (ow < oh && w > h ) ) { |
609 | if ( ! mBlockUpdating && !globalFlagBlockStartup && !globalFlagBlockAgenda ) | 609 | if ( ! mBlockUpdating && !globalFlagBlockStartup && !globalFlagBlockAgenda ) |
610 | uc = true; | 610 | uc = true; |
611 | //qDebug("view changed %d %d %d %d ", ow, oh , w , h); | 611 | //qDebug("view changed %d %d %d %d ", ow, oh , w , h); |
612 | } | 612 | } |
613 | mUpcomingWidth = e->size().width() ; | 613 | mUpcomingWidth = e->size().width() ; |
614 | if ( mBlockUpdating || uc ) { | 614 | if ( mBlockUpdating || uc ) { |
615 | mBlockUpdating = false; | 615 | mBlockUpdating = false; |
616 | //mAgenda->setMinimumSize(800 , 600 ); | 616 | //mAgenda->setMinimumSize(800 , 600 ); |
617 | //qDebug("mAgenda->resize+++++++++++++++ "); | 617 | //qDebug("mAgenda->resize+++++++++++++++ "); |
618 | updateConfig(); | 618 | updateConfig(); |
619 | //qDebug("KOAgendaView::Updating now possible "); | 619 | //qDebug("KOAgendaView::Updating now possible "); |
620 | } else | 620 | } else |
621 | createDayLabels(); | 621 | createDayLabels(); |
622 | //qDebug("resizeEvent end "); | 622 | //qDebug("resizeEvent end "); |
623 | 623 | ||
624 | } | 624 | } |
625 | void KOAgendaView::slotDaylabelClicked( int num ) | 625 | void KOAgendaView::slotDaylabelClicked( int num ) |
626 | { | 626 | { |
627 | 627 | ||
628 | QDate firstDate = mSelectedDates.first(); | 628 | QDate firstDate = mSelectedDates.first(); |
629 | if ( num == -1 ) | 629 | if ( num == -1 ) |
630 | emit showDateView( 6, firstDate ); | 630 | emit showDateView( 6, firstDate ); |
631 | else if (num >= 0 ) { | 631 | else if (num >= 0 ) { |
632 | if ( mSelectedDates.count() == 1) | 632 | if ( mSelectedDates.count() == 1) |
633 | emit showDateView( 9, firstDate.addDays( num ) ); | 633 | emit showDateView( 9, firstDate.addDays( num ) ); |
634 | else | 634 | else |
635 | emit showDateView( 3, firstDate.addDays( num ) ); | 635 | emit showDateView( 3, firstDate.addDays( num ) ); |
636 | } | 636 | } |
637 | else | 637 | else |
638 | showDateView( 10, firstDate.addDays(1) ); | 638 | showDateView( 10, firstDate.addDays(1) ); |
639 | } | 639 | } |
640 | 640 | ||
641 | KOAgendaButton* KOAgendaView::getNewDaylabel() | 641 | KOAgendaButton* KOAgendaView::getNewDaylabel() |
642 | { | 642 | { |
643 | 643 | ||
644 | KOAgendaButton * dayLabel = new KOAgendaButton(mDayLabels); | 644 | KOAgendaButton * dayLabel = new KOAgendaButton(mDayLabels); |
645 | connect( dayLabel, SIGNAL( numClicked(int) ), this, SLOT ( slotDaylabelClicked(int) ) ); | 645 | connect( dayLabel, SIGNAL( numClicked(int) ), this, SLOT ( slotDaylabelClicked(int) ) ); |
646 | mDayLabelsList.append( dayLabel ); | 646 | mDayLabelsList.append( dayLabel ); |
647 | mLayoutDayLabels->addWidget(dayLabel); | 647 | mLayoutDayLabels->addWidget(dayLabel); |
648 | return dayLabel ; | 648 | return dayLabel ; |
649 | } | 649 | } |
650 | 650 | ||
651 | void KOAgendaView::createDayLabels() | 651 | void KOAgendaView::createDayLabels() |
652 | { | 652 | { |
653 | 653 | ||
654 | if ( mBlockUpdating || globalFlagBlockLabel == 1) { | 654 | if ( mBlockUpdating || globalFlagBlockLabel == 1) { |
655 | // qDebug(" KOAgendaView::createDayLabels() blocked "); | 655 | // qDebug(" KOAgendaView::createDayLabels() blocked "); |
656 | return; | 656 | return; |
657 | 657 | ||
658 | } | 658 | } |
659 | int newHight; | 659 | int newHight; |
660 | 660 | ||
661 | // ### Before deleting and recreating we could check if mSelectedDates changed... | 661 | // ### Before deleting and recreating we could check if mSelectedDates changed... |
662 | // It would remove some flickering and gain speed (since this is called by | 662 | // It would remove some flickering and gain speed (since this is called by |
663 | // each updateView() call) | 663 | // each updateView() call) |
664 | 664 | ||
665 | int maxWid = mUpcomingWidth - mTimeLabels->width()- mAgenda->verticalScrollBar()->width() - 2; | 665 | int maxWid = mUpcomingWidth - mTimeLabels->width()- mAgenda->verticalScrollBar()->width() - 2; |
666 | mDayLabelsFrame->setMaximumWidth( mUpcomingWidth ); | 666 | mDayLabelsFrame->setMaximumWidth( mUpcomingWidth ); |
667 | if ( maxWid < 0 ) | 667 | if ( maxWid < 0 ) |
668 | maxWid = 20; | 668 | maxWid = 20; |
669 | 669 | ||
670 | QFont dlf = KOPrefs::instance()->mTimeLabelsFont; | 670 | QFont dlf = KOPrefs::instance()->mTimeLabelsFont; |
671 | QFontMetrics fm ( dlf ); | 671 | QFontMetrics fm ( dlf ); |
672 | int selCount = mSelectedDates.count(); | 672 | int selCount = mSelectedDates.count(); |
673 | QString dayTest = "Mon 20"; | 673 | QString dayTest = "Mon 20"; |
674 | //QString dayTest = "Mon 20"; | 674 | //QString dayTest = "Mon 20"; |
675 | int wid = fm.width( dayTest ); | 675 | int wid = fm.width( dayTest ); |
676 | //maxWid -= ( selCount * 3 ); //working for QLabels | 676 | //maxWid -= ( selCount * 3 ); //working for QLabels |
677 | maxWid -= ( selCount * 3 ); //working for QPushButton | 677 | maxWid -= ( selCount * 3 ); //working for QPushButton |
678 | if ( maxWid < 0 ) | 678 | if ( maxWid < 0 ) |
679 | maxWid = 20; | 679 | maxWid = 20; |
680 | int needWid = wid * selCount; | 680 | int needWid = wid * selCount; |
681 | //qDebug("++++++++Needed : %d MaxWidth: %d", needWid, maxWid ); | 681 | //qDebug("++++++++Needed : %d MaxWidth: %d", needWid, maxWid ); |
682 | //if ( needWid > maxWid ) | 682 | //if ( needWid > maxWid ) |
683 | // qDebug("DAYLABELS TOOOOOOO BIG "); | 683 | // qDebug("DAYLABELS TOOOOOOO BIG "); |
684 | while ( needWid > maxWid ) { | 684 | while ( needWid > maxWid ) { |
685 | dayTest = dayTest.left( dayTest.length() - 1 ); | 685 | dayTest = dayTest.left( dayTest.length() - 1 ); |
686 | wid = fm.width( dayTest ); | 686 | wid = fm.width( dayTest ); |
687 | needWid = wid * selCount; | 687 | needWid = wid * selCount; |
688 | } | 688 | } |
689 | int maxLen = dayTest.length(); | 689 | int maxLen = dayTest.length(); |
690 | int fontPoint = dlf.pointSize(); | 690 | int fontPoint = dlf.pointSize(); |
691 | if ( maxLen < 2 ) { | 691 | if ( maxLen < 2 ) { |
692 | int fontPoint = dlf.pointSize(); | 692 | int fontPoint = dlf.pointSize(); |
693 | while ( fontPoint > 4 ) { | 693 | while ( fontPoint > 4 ) { |
694 | --fontPoint; | 694 | --fontPoint; |
695 | dlf.setPointSize( fontPoint ); | 695 | dlf.setPointSize( fontPoint ); |
696 | QFontMetrics f( dlf ); | 696 | QFontMetrics f( dlf ); |
697 | wid = f.width( "30" ); | 697 | wid = f.width( "30" ); |
698 | needWid = wid * selCount; | 698 | needWid = wid * selCount; |
699 | if ( needWid < maxWid ) | 699 | if ( needWid < maxWid ) |
700 | break; | 700 | break; |
701 | } | 701 | } |
702 | maxLen = 2; | 702 | maxLen = 2; |
703 | } | 703 | } |
704 | //qDebug("Max len %d ", dayTest.length() ); | 704 | //qDebug("Max len %d ", dayTest.length() ); |
705 | 705 | ||
706 | QFontMetrics tempF( dlf ); | 706 | QFontMetrics tempF( dlf ); |
707 | newHight = tempF.height(); | 707 | newHight = tempF.height(); |
708 | mDayLabels->setFont( dlf ); | 708 | mDayLabels->setFont( dlf ); |
709 | // mLayoutDayLabels = new QHBoxLayout(mDayLabels);; | 709 | // mLayoutDayLabels = new QHBoxLayout(mDayLabels);; |
710 | // mLayoutDayLabels->addSpacing(mTimeLabels->width()); | 710 | // mLayoutDayLabels->addSpacing(mTimeLabels->width()); |
711 | //mLayoutDayLabels->addSpacing( 2 ); | 711 | //mLayoutDayLabels->addSpacing( 2 ); |
712 | // QFont lFont = dlf; | 712 | // QFont lFont = dlf; |
713 | bool appendLabels = false; | 713 | bool appendLabels = false; |
714 | KOAgendaButton *dayLabel; | 714 | KOAgendaButton *dayLabel; |
715 | dayLabel = mDayLabelsList.first(); | 715 | dayLabel = mDayLabelsList.first(); |
716 | if ( !dayLabel ) { | 716 | if ( !dayLabel ) { |
717 | appendLabels = true; | 717 | appendLabels = true; |
718 | dayLabel = getNewDaylabel(); | 718 | dayLabel = getNewDaylabel(); |
719 | } | 719 | } |
720 | dayLabel->setFixedWidth( mTimeLabels->width()+2 ); | 720 | dayLabel->setFixedWidth( mTimeLabels->width()+mAgenda->frameWidth() ); |
721 | dayLabel->setFont( dlf ); | 721 | dayLabel->setFont( dlf ); |
722 | dayLabel->setNum( -1 ); | 722 | dayLabel->setNum( -1 ); |
723 | //dayLabel->setAlignment(QLabel::AlignHCenter); | 723 | //dayLabel->setAlignment(QLabel::AlignHCenter); |
724 | dayLabel->setText( KOGlobals::self()->calendarSystem()->monthName( mSelectedDates.first(), true ) ); | 724 | dayLabel->setText( KOGlobals::self()->calendarSystem()->monthName( mSelectedDates.first(), true ) ); |
725 | dayLabel->show(); | 725 | dayLabel->show(); |
726 | DateList::ConstIterator dit; | 726 | DateList::ConstIterator dit; |
727 | bool oneday = (mSelectedDates.first() == mSelectedDates.last() ); | 727 | bool oneday = (mSelectedDates.first() == mSelectedDates.last() ); |
728 | int counter = -1; | 728 | int counter = -1; |
729 | for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) { | 729 | for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) { |
730 | ++counter; | 730 | ++counter; |
731 | QDate date = *dit; | 731 | QDate date = *dit; |
732 | // QBoxLayout *dayLayout = new QVBoxLayout(mLayoutDayLabels); | 732 | // QBoxLayout *dayLayout = new QVBoxLayout(mLayoutDayLabels); |
733 | if ( ! appendLabels ) { | 733 | if ( ! appendLabels ) { |
734 | dayLabel = mDayLabelsList.next(); | 734 | dayLabel = mDayLabelsList.next(); |
735 | if ( !dayLabel ) | 735 | if ( !dayLabel ) |
736 | appendLabels = true; | 736 | appendLabels = true; |
737 | } | 737 | } |
738 | if ( appendLabels ) { | 738 | if ( appendLabels ) { |
739 | dayLabel = getNewDaylabel(); | 739 | dayLabel = getNewDaylabel(); |
740 | } | 740 | } |
741 | dayLabel->setMinimumWidth( 1 ); | 741 | dayLabel->setMinimumWidth( 1 ); |
742 | dayLabel->setMaximumWidth( 10240 ); | 742 | dayLabel->setMaximumWidth( 10240 ); |
743 | dayLabel->setFont( dlf ); | 743 | dayLabel->setFont( dlf ); |
744 | dayLabel->show(); | 744 | dayLabel->show(); |
745 | dayLabel->setAutoRepeat( false ); | 745 | dayLabel->setAutoRepeat( false ); |
746 | dayLabel->setNum( counter ); | 746 | dayLabel->setNum( counter ); |
747 | QString str; | 747 | QString str; |
748 | int dW = KOGlobals::self()->calendarSystem()->dayOfWeek(date); | 748 | int dW = KOGlobals::self()->calendarSystem()->dayOfWeek(date); |
749 | QString dayName = KOGlobals::self()->calendarSystem()->weekDayName( dW, true ); | 749 | QString dayName = KOGlobals::self()->calendarSystem()->weekDayName( dW, true ); |
750 | switch ( maxLen ) { | 750 | switch ( maxLen ) { |
751 | case 2: | 751 | case 2: |
752 | str = QString::number( date.day() ); | 752 | str = QString::number( date.day() ); |
753 | break; | 753 | break; |
754 | 754 | ||
755 | case 3: | 755 | case 3: |
756 | str = dayName.left( 1 ) +QString::number( date.day()); | 756 | str = dayName.left( 1 ) +QString::number( date.day()); |
757 | 757 | ||
758 | break; | 758 | break; |
759 | case 4: | 759 | case 4: |
760 | str = dayName.left( 1 ) + " " +QString::number( date.day()); | 760 | str = dayName.left( 1 ) + " " +QString::number( date.day()); |
761 | 761 | ||
762 | break; | 762 | break; |
763 | case 5: | 763 | case 5: |
764 | str = dayName.left( 2 ) + " " +QString::number( date.day()); | 764 | str = dayName.left( 2 ) + " " +QString::number( date.day()); |
765 | 765 | ||
766 | break; | 766 | break; |
767 | case 6: | 767 | case 6: |
768 | str = dayName.left( 3 ) + " " +QString::number( date.day()); | 768 | str = dayName.left( 3 ) + " " +QString::number( date.day()); |
769 | break; | 769 | break; |
770 | 770 | ||
771 | default: | 771 | default: |
772 | break; | 772 | break; |
773 | } | 773 | } |
774 | if ( oneday ) { | 774 | if ( oneday ) { |
775 | QString addString; | 775 | QString addString; |
776 | if ( mSelectedDates.first() == QDateTime::currentDateTime().date() ) | 776 | if ( mSelectedDates.first() == QDateTime::currentDateTime().date() ) |
777 | addString = i18n("Today"); | 777 | addString = i18n("Today"); |
778 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(1) ) | 778 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(1) ) |
779 | addString = i18n("Tomorrow"); | 779 | addString = i18n("Tomorrow"); |
780 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(-1) ) | 780 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(-1) ) |
781 | addString = i18n("Yesterday"); | 781 | addString = i18n("Yesterday"); |
782 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(-2) ) | 782 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(-2) ) |
783 | addString = i18n("Day before yesterday"); | 783 | addString = i18n("Day before yesterday"); |
784 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(2) ) | 784 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(2) ) |
785 | addString = i18n("Day after tomorrow"); | 785 | addString = i18n("Day after tomorrow"); |
786 | if ( !addString.isEmpty() ) { | 786 | if ( !addString.isEmpty() ) { |
787 | str = addString+", " + str; | 787 | str = addString+", " + str; |
788 | } else { | 788 | } else { |
789 | str = KGlobal::locale()->formatDate( date, KOPrefs::instance()->mShortDateInViewer); | 789 | str = KGlobal::locale()->formatDate( date, KOPrefs::instance()->mShortDateInViewer); |
790 | } | 790 | } |
791 | } | 791 | } |
792 | dayLabel->setText(str); | 792 | dayLabel->setText(str); |
793 | //dayLabel->setAlignment(QLabel::AlignHCenter); | 793 | //dayLabel->setAlignment(QLabel::AlignHCenter); |
794 | if (date == QDate::currentDate()) { | 794 | if (date == QDate::currentDate()) { |
795 | QFont bFont = dlf; | 795 | QFont bFont = dlf; |
796 | bFont.setBold( true ); | 796 | bFont.setBold( true ); |
797 | dayLabel->setFont(bFont); | 797 | dayLabel->setFont(bFont); |
798 | } | 798 | } |
799 | //dayLayout->addWidget(dayLabel); | 799 | //dayLayout->addWidget(dayLabel); |
800 | 800 | ||
801 | #ifndef KORG_NOPLUGINS | 801 | #ifndef KORG_NOPLUGINS |
802 | CalendarDecoration::List cds = KOCore::self()->calendarDecorations(); | 802 | CalendarDecoration::List cds = KOCore::self()->calendarDecorations(); |
803 | CalendarDecoration *it; | 803 | CalendarDecoration *it; |
804 | for(it = cds.first(); it; it = cds.next()) { | 804 | for(it = cds.first(); it; it = cds.next()) { |
805 | QString text = it->shortText( date ); | 805 | QString text = it->shortText( date ); |
806 | if ( !text.isEmpty() ) { | 806 | if ( !text.isEmpty() ) { |
807 | QLabel *label = new QLabel(text,mDayLabels); | 807 | QLabel *label = new QLabel(text,mDayLabels); |
808 | label->setAlignment(AlignCenter); | 808 | label->setAlignment(AlignCenter); |
809 | dayLayout->addWidget(label); | 809 | dayLayout->addWidget(label); |
810 | } | 810 | } |
811 | } | 811 | } |
812 | 812 | ||
813 | for(it = cds.first(); it; it = cds.next()) { | 813 | for(it = cds.first(); it; it = cds.next()) { |
814 | QWidget *wid = it->smallWidget(mDayLabels,date); | 814 | QWidget *wid = it->smallWidget(mDayLabels,date); |
815 | if ( wid ) { | 815 | if ( wid ) { |
816 | // wid->setHeight(20); | 816 | // wid->setHeight(20); |
817 | dayLayout->addWidget(wid); | 817 | dayLayout->addWidget(wid); |
818 | } | 818 | } |
819 | } | 819 | } |
820 | #endif | 820 | #endif |
821 | } | 821 | } |
822 | if ( ! appendLabels ) { | 822 | if ( ! appendLabels ) { |
823 | dayLabel = mDayLabelsList.next(); | 823 | dayLabel = mDayLabelsList.next(); |
824 | if ( !dayLabel ) | 824 | if ( !dayLabel ) |
825 | appendLabels = true; | 825 | appendLabels = true; |
826 | } | 826 | } |
827 | if ( appendLabels ) { | 827 | if ( appendLabels ) { |
828 | dayLabel = getNewDaylabel(); | 828 | dayLabel = getNewDaylabel(); |
829 | } | 829 | } |
830 | //dayLabel->hide();//test only | 830 | //dayLabel->hide();//test only |
831 | 831 | qDebug("fremwidd %d ", mAgenda->frameWidth()); | |
832 | int offset = (mAgenda->width() - mAgenda->verticalScrollBar()->width()-3 ) % mSelectedDates.count() ; | 832 | int offset = (mAgenda->width() - mAgenda->verticalScrollBar()->width()- (mAgenda->frameWidth()*2) ) % mSelectedDates.count() ; |
833 | if ( offset < 0 ) offset = 0; | 833 | if ( offset < 0 ) offset = 0; |
834 | //qDebug("mLayoutDayLabels->addSpacing %d ", mAgenda->verticalScrollBar()->width()+offset+2 ); | 834 | //qDebug("mLayoutDayLabels->addSpacing %d ", mAgenda->verticalScrollBar()->width()+offset+2 ); |
835 | dayLabel->setText(">");//QString::number ( mSelectedDates.first().month() ) ); | 835 | dayLabel->setText(">");//QString::number ( mSelectedDates.first().month() ) ); |
836 | dayLabel->setFont( dlf ); | 836 | dayLabel->setFont( dlf ); |
837 | dayLabel->setAutoRepeat( true ); | 837 | dayLabel->setAutoRepeat( true ); |
838 | dayLabel->show(); | 838 | dayLabel->show(); |
839 | dayLabel->setNum( -2 ); | 839 | dayLabel->setNum( -2 ); |
840 | dayLabel->setFixedWidth( mAgenda->verticalScrollBar()->width()+ offset ); | 840 | dayLabel->setFixedWidth( mAgenda->verticalScrollBar()->width()+ offset ); |
841 | //qDebug("setToFixed %d ", mAgenda->verticalScrollBar()->width()+ offset+2); | 841 | //qDebug("setToFixed %d ", mAgenda->verticalScrollBar()->width()+ offset+2); |
842 | //mLayoutDayLabels->addSpacing(mAgenda->verticalScrollBar()->width()+ offset+2); | 842 | //mLayoutDayLabels->addSpacing(mAgenda->verticalScrollBar()->width()+ offset+2); |
843 | if ( !appendLabels ) { | 843 | if ( !appendLabels ) { |
844 | dayLabel = mDayLabelsList.next(); | 844 | dayLabel = mDayLabelsList.next(); |
845 | while ( dayLabel ) { | 845 | while ( dayLabel ) { |
846 | //qDebug("!dayLabel %d",dayLabel ); | 846 | //qDebug("!dayLabel %d",dayLabel ); |
847 | dayLabel->hide(); | 847 | dayLabel->hide(); |
848 | dayLabel = mDayLabelsList.next(); | 848 | dayLabel = mDayLabelsList.next(); |
849 | } | 849 | } |
850 | } | 850 | } |
851 | 851 | ||
852 | mDayLabelsFrame->setFixedHeight( newHight + 4 ); | 852 | mDayLabelsFrame->setFixedHeight( newHight + 4 ); |
853 | } | 853 | } |
854 | 854 | ||
855 | int KOAgendaView::maxDatesHint() | 855 | int KOAgendaView::maxDatesHint() |
856 | { | 856 | { |
857 | // Not sure about the max number of events, so return 0 for now. | 857 | // Not sure about the max number of events, so return 0 for now. |
858 | return 0; | 858 | return 0; |
859 | } | 859 | } |
860 | 860 | ||
861 | int KOAgendaView::currentDateCount() | 861 | int KOAgendaView::currentDateCount() |
862 | { | 862 | { |
863 | return mSelectedDates.count(); | 863 | return mSelectedDates.count(); |
864 | } | 864 | } |
865 | 865 | ||
866 | QPtrList<Incidence> KOAgendaView::selectedIncidences() | 866 | QPtrList<Incidence> KOAgendaView::selectedIncidences() |
867 | { | 867 | { |
868 | QPtrList<Incidence> selected; | 868 | QPtrList<Incidence> selected; |
869 | Incidence *incidence; | 869 | Incidence *incidence; |
870 | 870 | ||
871 | incidence = mAgenda->selectedIncidence(); | 871 | incidence = mAgenda->selectedIncidence(); |
872 | if (incidence) selected.append(incidence); | 872 | if (incidence) selected.append(incidence); |
873 | 873 | ||
874 | incidence = mAllDayAgenda->selectedIncidence(); | 874 | incidence = mAllDayAgenda->selectedIncidence(); |
875 | if (incidence) selected.append(incidence); | 875 | if (incidence) selected.append(incidence); |
876 | 876 | ||
877 | return selected; | 877 | return selected; |
878 | } | 878 | } |
879 | 879 | ||
880 | DateList KOAgendaView::selectedDates() | 880 | DateList KOAgendaView::selectedDates() |
881 | { | 881 | { |
882 | DateList selected; | 882 | DateList selected; |
883 | QDate qd; | 883 | QDate qd; |
884 | 884 | ||
885 | qd = mAgenda->selectedIncidenceDate(); | 885 | qd = mAgenda->selectedIncidenceDate(); |
886 | if (qd.isValid()) selected.append(qd); | 886 | if (qd.isValid()) selected.append(qd); |
887 | 887 | ||
888 | qd = mAllDayAgenda->selectedIncidenceDate(); | 888 | qd = mAllDayAgenda->selectedIncidenceDate(); |
889 | if (qd.isValid()) selected.append(qd); | 889 | if (qd.isValid()) selected.append(qd); |
890 | 890 | ||
891 | return selected; | 891 | return selected; |
892 | } | 892 | } |
893 | 893 | ||
894 | 894 | ||
895 | void KOAgendaView::updateView() | 895 | void KOAgendaView::updateView() |
896 | { | 896 | { |
897 | if ( mBlockUpdating ) | 897 | if ( mBlockUpdating ) |
898 | return; | 898 | return; |
899 | // kdDebug() << "KOAgendaView::updateView()" << endl; | 899 | // kdDebug() << "KOAgendaView::updateView()" << endl; |
900 | fillAgenda(); | 900 | fillAgenda(); |
901 | 901 | ||
902 | } | 902 | } |
903 | 903 | ||
904 | 904 | ||
905 | /* | 905 | /* |
906 | Update configuration settings for the agenda view. This method is not | 906 | Update configuration settings for the agenda view. This method is not |
907 | complete. | 907 | complete. |
908 | */ | 908 | */ |
909 | void KOAgendaView::updateConfig() | 909 | void KOAgendaView::updateConfig() |
910 | { | 910 | { |
911 | if ( mBlockUpdating ) | 911 | if ( mBlockUpdating ) |
912 | return; | 912 | return; |
913 | if ( mAgenda->height() > 96 * KOPrefs::instance()->mHourSize ) { | 913 | if ( mAgenda->height() > 96 * KOPrefs::instance()->mHourSize ) { |
914 | int old = KOPrefs::instance()->mHourSize; | 914 | int old = KOPrefs::instance()->mHourSize; |
915 | KOPrefs::instance()->mHourSize = mAgenda->height()/96 +1; | 915 | KOPrefs::instance()->mHourSize = mAgenda->height()/96 +1; |
916 | qDebug("KOPrefs::instance()->mHourSize adjusted %d to %d ", old,KOPrefs::instance()->mHourSize ); | 916 | qDebug("KOPrefs::instance()->mHourSize adjusted %d to %d ", old,KOPrefs::instance()->mHourSize ); |
917 | } | 917 | } |
918 | 918 | ||
919 | 919 | ||
920 | // update config for children | 920 | // update config for children |
921 | mTimeLabels->updateConfig(); | 921 | mTimeLabels->updateConfig(); |
922 | mAgenda->storePosition(); | 922 | mAgenda->storePosition(); |
923 | mAgenda->updateConfig(); | 923 | mAgenda->updateConfig(); |
924 | mAllDayAgenda->updateConfig(); | 924 | mAllDayAgenda->updateConfig(); |
925 | // widget synchronization | 925 | // widget synchronization |
926 | //TODO: find a better way, maybe signal/slot | 926 | //TODO: find a better way, maybe signal/slot |
927 | mTimeLabels->positionChanged(); | 927 | mTimeLabels->positionChanged(); |
928 | 928 | ||
929 | // for some reason, this needs to be called explicitly | 929 | // for some reason, this needs to be called explicitly |
930 | mTimeLabels->repaint(); | 930 | mTimeLabels->repaint(); |
931 | 931 | ||
932 | mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); | 932 | mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); |
933 | 933 | ||
934 | // ToolTips displaying summary of events | 934 | // ToolTips displaying summary of events |
935 | KOAgendaItem::toolTipGroup()->setEnabled(KOPrefs::instance() | 935 | KOAgendaItem::toolTipGroup()->setEnabled(KOPrefs::instance() |
936 | ->mEnableToolTips); | 936 | ->mEnableToolTips); |
937 | 937 | ||
938 | //setHolidayMasks(); | 938 | //setHolidayMasks(); |
939 | 939 | ||
940 | //createDayLabels(); called by via updateView(); | 940 | //createDayLabels(); called by via updateView(); |
941 | mEventIndicatorTop->setXOffset(mTimeLabels->width() + mAgenda->frameWidth()); | 941 | mEventIndicatorTop->setXOffset(mTimeLabels->width() + mAgenda->frameWidth()); |
942 | updateView(); | 942 | updateView(); |
943 | mAgenda->restorePosition(); | 943 | mAgenda->restorePosition(); |
944 | } | 944 | } |
945 | 945 | ||
946 | 946 | ||
947 | void KOAgendaView::updateEventDates(KOAgendaItem *item, int type) | 947 | void KOAgendaView::updateEventDates(KOAgendaItem *item, int type) |
948 | { | 948 | { |
949 | // kdDebug() << "KOAgendaView::updateEventDates(): " << item->text() << endl; | 949 | // kdDebug() << "KOAgendaView::updateEventDates(): " << item->text() << endl; |
950 | //qDebug("KOAgendaView::updateEventDates "); | 950 | //qDebug("KOAgendaView::updateEventDates "); |
951 | QDateTime startDt,endDt; | 951 | QDateTime startDt,endDt; |
952 | QDate startDate; | 952 | QDate startDate; |
953 | int lenInSecs; | 953 | int lenInSecs; |
954 | // if ( type == KOAgenda::RESIZETOP ) | 954 | // if ( type == KOAgenda::RESIZETOP ) |
955 | // qDebug("RESIZETOP "); | 955 | // qDebug("RESIZETOP "); |
956 | // if ( type == KOAgenda::RESIZEBOTTOM ) | 956 | // if ( type == KOAgenda::RESIZEBOTTOM ) |
957 | // qDebug("RESIZEBOTTOM "); | 957 | // qDebug("RESIZEBOTTOM "); |
958 | // if ( type == KOAgenda::MOVE ) | 958 | // if ( type == KOAgenda::MOVE ) |
959 | // qDebug("MOVE "); | 959 | // qDebug("MOVE "); |
960 | if ( item->incidence()->type() == "Event" ) { | 960 | if ( item->incidence()->type() == "Event" ) { |
961 | startDt =item->incidence()->dtStart(); | 961 | startDt =item->incidence()->dtStart(); |
962 | endDt = item->incidence()->dtEnd(); | 962 | endDt = item->incidence()->dtEnd(); |
963 | lenInSecs = startDt.secsTo( endDt ); | 963 | lenInSecs = startDt.secsTo( endDt ); |
964 | } | 964 | } |
965 | 965 | ||
966 | // emit incidenceItemChanged( item->incidence(), KOGlobals::EVENTEDITED ); | 966 | // emit incidenceItemChanged( item->incidence(), KOGlobals::EVENTEDITED ); |
967 | 967 | ||
968 | if ( item->incidence()->type()=="Todo" && item->mLastMoveXPos > 0 ) { | 968 | if ( item->incidence()->type()=="Todo" && item->mLastMoveXPos > 0 ) { |
969 | startDate = mSelectedDates[item->mLastMoveXPos]; | 969 | startDate = mSelectedDates[item->mLastMoveXPos]; |
970 | } else { | 970 | } else { |
971 | if (item->cellX() < 0) { | 971 | if (item->cellX() < 0) { |
972 | startDate = (mSelectedDates.first()).addDays(item->cellX()); | 972 | startDate = (mSelectedDates.first()).addDays(item->cellX()); |
973 | } else { | 973 | } else { |
974 | startDate = mSelectedDates[item->cellX()]; | 974 | startDate = mSelectedDates[item->cellX()]; |
975 | } | 975 | } |
976 | } | 976 | } |
977 | startDt.setDate(startDate); | 977 | startDt.setDate(startDate); |
978 | 978 | ||
979 | if (item->incidence()->doesFloat()) { | 979 | if (item->incidence()->doesFloat()) { |
980 | endDt.setDate(startDate.addDays(item->cellWidth() - 1)); | 980 | endDt.setDate(startDate.addDays(item->cellWidth() - 1)); |
981 | } else { | 981 | } else { |
982 | if ( type == KOAgenda::RESIZETOP || type == KOAgenda::MOVE ) | 982 | if ( type == KOAgenda::RESIZETOP || type == KOAgenda::MOVE ) |
983 | startDt.setTime(mAgenda->gyToTime(item->cellYTop())); | 983 | startDt.setTime(mAgenda->gyToTime(item->cellYTop())); |
984 | if ( item->incidence()->type() == "Event" ) { | 984 | if ( item->incidence()->type() == "Event" ) { |
985 | if ( type == KOAgenda::MOVE ) { | 985 | if ( type == KOAgenda::MOVE ) { |
986 | endDt = startDt.addSecs(lenInSecs); | 986 | endDt = startDt.addSecs(lenInSecs); |
987 | 987 | ||
988 | } else if ( type == KOAgenda::RESIZEBOTTOM ) { | 988 | } else if ( type == KOAgenda::RESIZEBOTTOM ) { |
989 | if (item->lastMultiItem()) { | 989 | if (item->lastMultiItem()) { |
990 | endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1)); | 990 | endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1)); |
991 | endDt.setDate(startDate. | 991 | endDt.setDate(startDate. |
992 | addDays(item->lastMultiItem()->cellX() - item->cellX())); | 992 | addDays(item->lastMultiItem()->cellX() - item->cellX())); |
993 | } else { | 993 | } else { |
994 | endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); | 994 | endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); |
995 | endDt.setDate(startDate); | 995 | endDt.setDate(startDate); |
996 | } | 996 | } |
997 | } | 997 | } |
998 | } else { | 998 | } else { |
999 | // todo | 999 | // todo |
1000 | if (item->lastMultiItem()) { | 1000 | if (item->lastMultiItem()) { |
1001 | endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1)); | 1001 | endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1)); |
1002 | endDt.setDate(startDate. | 1002 | endDt.setDate(startDate. |
1003 | addDays(item->lastMultiItem()->cellX() - item->cellX())); | 1003 | addDays(item->lastMultiItem()->cellX() - item->cellX())); |
1004 | } else { | 1004 | } else { |
1005 | //qDebug("tem->cellYBottom() %d",item->cellYBottom() ); | 1005 | //qDebug("tem->cellYBottom() %d",item->cellYBottom() ); |
1006 | if ( item->cellYBottom() > 0 ) | 1006 | if ( item->cellYBottom() > 0 ) |
1007 | endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); | 1007 | endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); |
1008 | else | 1008 | else |
1009 | endDt.setTime((static_cast<Todo*>(item->incidence()))->dtDue().time()); | 1009 | endDt.setTime((static_cast<Todo*>(item->incidence()))->dtDue().time()); |
1010 | endDt.setDate(startDate); | 1010 | endDt.setDate(startDate); |
1011 | } | 1011 | } |
1012 | } | 1012 | } |
1013 | } | 1013 | } |
1014 | if ( item->incidence()->type() == "Event" ) { | 1014 | if ( item->incidence()->type() == "Event" ) { |
1015 | item->incidence()->setDtStart(startDt); | 1015 | item->incidence()->setDtStart(startDt); |
1016 | (static_cast<Event*>(item->incidence()))->setDtEnd(endDt); | 1016 | (static_cast<Event*>(item->incidence()))->setDtEnd(endDt); |
1017 | } else if ( item->incidence()->type() == "Todo" ) { | 1017 | } else if ( item->incidence()->type() == "Todo" ) { |
1018 | Todo* to = static_cast<Todo*>(item->incidence()); | 1018 | Todo* to = static_cast<Todo*>(item->incidence()); |
1019 | 1019 | ||
1020 | to->setDtDue(endDt); | 1020 | to->setDtDue(endDt); |
1021 | if ( to->hasStartDate() ) { | 1021 | if ( to->hasStartDate() ) { |
1022 | if (to->dtStart() >= to->dtDue() ) | 1022 | if (to->dtStart() >= to->dtDue() ) |
1023 | to->setDtStart(to->dtDue().addDays( -2 )); | 1023 | to->setDtStart(to->dtDue().addDays( -2 )); |
1024 | } | 1024 | } |
1025 | 1025 | ||
1026 | } | 1026 | } |
1027 | //qDebug("KOAgendaView::updateEventDates stsart %s end %s ", startDt.toString().latin1(), endDt.toString().latin1() ); | 1027 | //qDebug("KOAgendaView::updateEventDates stsart %s end %s ", startDt.toString().latin1(), endDt.toString().latin1() ); |
1028 | item->incidence()->setRevision(item->incidence()->revision()+1); | 1028 | item->incidence()->setRevision(item->incidence()->revision()+1); |
1029 | item->setItemDate(startDt.date()); | 1029 | item->setItemDate(startDt.date()); |
1030 | //item->updateItem(); | 1030 | //item->updateItem(); |
1031 | if ( item->incidence()->type() == "Todo" ) { | 1031 | if ( item->incidence()->type() == "Todo" ) { |
1032 | emit todoMoved((Todo*)item->incidence(), KOGlobals::EVENTEDITED ); | 1032 | emit todoMoved((Todo*)item->incidence(), KOGlobals::EVENTEDITED ); |
1033 | 1033 | ||
1034 | } | 1034 | } |
1035 | else | 1035 | else |
1036 | emit incidenceChanged(item->incidence(), KOGlobals::EVENTEDITED); | 1036 | emit incidenceChanged(item->incidence(), KOGlobals::EVENTEDITED); |
1037 | item->updateItem(); | 1037 | item->updateItem(); |
1038 | } | 1038 | } |
1039 | 1039 | ||
1040 | void KOAgendaView::showDates( const QDate &start, const QDate &end ) | 1040 | void KOAgendaView::showDates( const QDate &start, const QDate &end ) |
1041 | { | 1041 | { |
1042 | // kdDebug() << "KOAgendaView::selectDates" << endl; | 1042 | // kdDebug() << "KOAgendaView::selectDates" << endl; |
1043 | 1043 | ||
1044 | mSelectedDates.clear(); | 1044 | mSelectedDates.clear(); |
1045 | // qDebug("KOAgendaView::showDates "); | 1045 | // qDebug("KOAgendaView::showDates "); |
1046 | QDate d = start; | 1046 | QDate d = start; |
1047 | while (d <= end) { | 1047 | while (d <= end) { |
1048 | mSelectedDates.append(d); | 1048 | mSelectedDates.append(d); |
1049 | d = d.addDays( 1 ); | 1049 | d = d.addDays( 1 ); |
1050 | } | 1050 | } |
1051 | 1051 | ||
1052 | // and update the view | 1052 | // and update the view |
1053 | fillAgenda(); | 1053 | fillAgenda(); |
1054 | } | 1054 | } |
1055 | 1055 | ||
1056 | 1056 | ||
1057 | void KOAgendaView::showEvents(QPtrList<Event>) | 1057 | void KOAgendaView::showEvents(QPtrList<Event>) |
1058 | { | 1058 | { |
1059 | kdDebug() << "KOAgendaView::showEvents() is not yet implemented" << endl; | 1059 | kdDebug() << "KOAgendaView::showEvents() is not yet implemented" << endl; |
1060 | } | 1060 | } |
1061 | 1061 | ||
1062 | void KOAgendaView::changeEventDisplay(Event *, int) | 1062 | void KOAgendaView::changeEventDisplay(Event *, int) |
1063 | { | 1063 | { |
1064 | // qDebug("KOAgendaView::changeEventDisplay "); | 1064 | // qDebug("KOAgendaView::changeEventDisplay "); |
1065 | // kdDebug() << "KOAgendaView::changeEventDisplay" << endl; | 1065 | // kdDebug() << "KOAgendaView::changeEventDisplay" << endl; |
1066 | // this should be re-written to be MUCH smarter. Right now we | 1066 | // this should be re-written to be MUCH smarter. Right now we |
1067 | // are just playing dumb. | 1067 | // are just playing dumb. |
1068 | fillAgenda(); | 1068 | fillAgenda(); |
1069 | } | 1069 | } |
1070 | 1070 | ||
1071 | void KOAgendaView::fillAgenda(const QDate &) | 1071 | void KOAgendaView::fillAgenda(const QDate &) |
1072 | { | 1072 | { |
1073 | // qDebug("KOAgendaView::fillAgenda "); | 1073 | // qDebug("KOAgendaView::fillAgenda "); |
1074 | fillAgenda(); | 1074 | fillAgenda(); |
1075 | } | 1075 | } |
1076 | 1076 | ||
1077 | void KOAgendaView::fillAgenda() | 1077 | void KOAgendaView::fillAgenda() |
1078 | { | 1078 | { |
1079 | if ( globalFlagBlockStartup ) | 1079 | if ( globalFlagBlockStartup ) |
1080 | return; | 1080 | return; |
1081 | if ( globalFlagBlockAgenda == 1 ) | 1081 | if ( globalFlagBlockAgenda == 1 ) |
1082 | return; | 1082 | return; |
1083 | static bool onlyOne = false; | 1083 | static bool onlyOne = false; |
1084 | if ( onlyOne ) | 1084 | if ( onlyOne ) |
1085 | return; | 1085 | return; |
1086 | onlyOne = true; | 1086 | onlyOne = true; |
1087 | //if ( globalFlagBlockAgenda == 2 ) | 1087 | //if ( globalFlagBlockAgenda == 2 ) |
1088 | //globalFlagBlockAgenda = 0; | 1088 | //globalFlagBlockAgenda = 0; |
1089 | // globalFlagBlockPainting = false; | 1089 | // globalFlagBlockPainting = false; |
1090 | if ( globalFlagBlockAgenda == 0 ) | 1090 | if ( globalFlagBlockAgenda == 0 ) |
1091 | globalFlagBlockAgenda = 1; | 1091 | globalFlagBlockAgenda = 1; |
1092 | // clearView(); | 1092 | // clearView(); |
1093 | //qDebug("fillAgenda()++++ "); | 1093 | //qDebug("fillAgenda()++++ "); |
1094 | globalFlagBlockAgendaItemPaint = 1; | 1094 | globalFlagBlockAgendaItemPaint = 1; |
1095 | 1095 | ||
1096 | mAllDayAgenda->changeColumns(mSelectedDates.count()); | 1096 | mAllDayAgenda->changeColumns(mSelectedDates.count()); |
1097 | mAgenda->changeColumns(mSelectedDates.count()); | 1097 | mAgenda->changeColumns(mSelectedDates.count()); |
1098 | qApp->processEvents(); | 1098 | qApp->processEvents(); |
1099 | mEventIndicatorTop->changeColumns(mSelectedDates.count()); | 1099 | mEventIndicatorTop->changeColumns(mSelectedDates.count()); |
1100 | mEventIndicatorBottom->changeColumns(mSelectedDates.count()); | 1100 | mEventIndicatorBottom->changeColumns(mSelectedDates.count()); |
1101 | setHolidayMasks(); | 1101 | setHolidayMasks(); |
1102 | 1102 | ||
1103 | //mAgenda->hideUnused(); | 1103 | //mAgenda->hideUnused(); |
1104 | //mAllDayAgenda->hideUnused(); | 1104 | //mAllDayAgenda->hideUnused(); |
1105 | 1105 | ||
1106 | // mAgenda->blockNextRepaint( false ); | 1106 | // mAgenda->blockNextRepaint( false ); |
1107 | // mAgenda->viewport()->repaint(); | 1107 | // mAgenda->viewport()->repaint(); |
1108 | // mAgenda->blockNextRepaint( true ); | 1108 | // mAgenda->blockNextRepaint( true ); |
1109 | mMinY.resize(mSelectedDates.count()); | 1109 | mMinY.resize(mSelectedDates.count()); |
1110 | mMaxY.resize(mSelectedDates.count()); | 1110 | mMaxY.resize(mSelectedDates.count()); |
1111 | 1111 | ||
1112 | QPtrList<Event> dayEvents; | 1112 | QPtrList<Event> dayEvents; |
1113 | 1113 | ||
1114 | // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. | 1114 | // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. |
1115 | // Therefore, gtodoset all of them. | 1115 | // Therefore, gtodoset all of them. |
1116 | QPtrList<Todo> todos = calendar()->todos(); | 1116 | QPtrList<Todo> todos = calendar()->todos(); |
1117 | 1117 | ||
1118 | mAgenda->setDateList(mSelectedDates); | 1118 | mAgenda->setDateList(mSelectedDates); |
1119 | 1119 | ||
1120 | QDate today = QDate::currentDate(); | 1120 | QDate today = QDate::currentDate(); |
1121 | 1121 | ||
1122 | DateList::ConstIterator dit; | 1122 | DateList::ConstIterator dit; |
1123 | int curCol = 0; | 1123 | int curCol = 0; |
1124 | for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) { | 1124 | for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) { |
1125 | QDate currentDate = *dit; | 1125 | QDate currentDate = *dit; |
1126 | // kdDebug() << "KOAgendaView::fillAgenda(): " << currentDate.toString() | 1126 | // kdDebug() << "KOAgendaView::fillAgenda(): " << currentDate.toString() |
1127 | // << endl; | 1127 | // << endl; |
1128 | 1128 | ||
1129 | dayEvents = calendar()->events(currentDate,true); | 1129 | dayEvents = calendar()->events(currentDate,true); |
1130 | 1130 | ||
1131 | // Default values, which can never be reached | 1131 | // Default values, which can never be reached |
1132 | mMinY[curCol] = mAgenda->timeToY(QTime(23,59)) + 1; | 1132 | mMinY[curCol] = mAgenda->timeToY(QTime(23,59)) + 1; |
1133 | mMaxY[curCol] = mAgenda->timeToY(QTime(0,0)) - 1; | 1133 | mMaxY[curCol] = mAgenda->timeToY(QTime(0,0)) - 1; |
1134 | 1134 | ||
1135 | unsigned int numEvent; | 1135 | unsigned int numEvent; |
1136 | for(numEvent=0;numEvent<dayEvents.count();++numEvent) { | 1136 | for(numEvent=0;numEvent<dayEvents.count();++numEvent) { |
1137 | Event *event = dayEvents.at(numEvent); | 1137 | Event *event = dayEvents.at(numEvent); |
1138 | if ( !KOPrefs::instance()->mShowSyncEvents && event->uid().left(2) == QString("la") ) | 1138 | if ( !KOPrefs::instance()->mShowSyncEvents && event->uid().left(2) == QString("la") ) |
1139 | if ( event->uid().left(15) == QString("last-syncEvent-") ) | 1139 | if ( event->uid().left(15) == QString("last-syncEvent-") ) |
1140 | continue; | 1140 | continue; |
1141 | // kdDebug() << " Event: " << event->summary() << endl; | 1141 | // kdDebug() << " Event: " << event->summary() << endl; |
1142 | 1142 | ||
1143 | int beginX = currentDate.daysTo(event->dtStart().date()) + curCol; | 1143 | int beginX = currentDate.daysTo(event->dtStart().date()) + curCol; |
1144 | int endX = currentDate.daysTo(event->dtEnd().date()) + curCol; | 1144 | int endX = currentDate.daysTo(event->dtEnd().date()) + curCol; |
1145 | 1145 | ||
1146 | // kdDebug() << " beginX: " << beginX << " endX: " << endX << endl; | 1146 | // kdDebug() << " beginX: " << beginX << " endX: " << endX << endl; |
1147 | 1147 | ||
1148 | if (event->doesFloat()) { | 1148 | if (event->doesFloat()) { |
1149 | if (event->recurrence()->doesRecur()) { | 1149 | if (event->recurrence()->doesRecur()) { |
1150 | mAllDayAgenda->insertAllDayItem(event,currentDate,curCol,curCol); | 1150 | mAllDayAgenda->insertAllDayItem(event,currentDate,curCol,curCol); |
1151 | } else { | 1151 | } else { |
1152 | if (beginX <= 0 && curCol == 0) { | 1152 | if (beginX <= 0 && curCol == 0) { |
1153 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); | 1153 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); |
1154 | } else if (beginX == curCol) { | 1154 | } else if (beginX == curCol) { |
1155 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); | 1155 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); |
1156 | } | 1156 | } |
1157 | } | 1157 | } |
1158 | } else if (event->isMultiDay()) { | 1158 | } else if (event->isMultiDay()) { |
1159 | if ( event->doesRecur () ) { | 1159 | if ( event->doesRecur () ) { |
1160 | QDate dateit = currentDate; | 1160 | QDate dateit = currentDate; |
1161 | int count = 0; | 1161 | int count = 0; |
1162 | int max = event->dtStart().daysTo( event->dtEnd() ) +2; | 1162 | int max = event->dtStart().daysTo( event->dtEnd() ) +2; |
1163 | while (! event->recursOn( dateit ) && count <= max ) { | 1163 | while (! event->recursOn( dateit ) && count <= max ) { |
1164 | ++count; | 1164 | ++count; |
1165 | dateit = dateit.addDays( -1 ); | 1165 | dateit = dateit.addDays( -1 ); |
1166 | } | 1166 | } |
1167 | bool ok; | 1167 | bool ok; |
1168 | QDateTime nextOcstart = event->getNextOccurence( QDateTime(dateit) ,&ok ); | 1168 | QDateTime nextOcstart = event->getNextOccurence( QDateTime(dateit) ,&ok ); |
1169 | if ( ok ) | 1169 | if ( ok ) |
1170 | { | 1170 | { |
1171 | int secs = event->dtStart().secsTo( event->dtEnd() ); | 1171 | int secs = event->dtStart().secsTo( event->dtEnd() ); |
1172 | QDateTime nextOcend =nextOcstart.addSecs( secs ); ; | 1172 | QDateTime nextOcend =nextOcstart.addSecs( secs ); ; |
1173 | beginX = currentDate.daysTo(nextOcstart.date()) + curCol; | 1173 | beginX = currentDate.daysTo(nextOcstart.date()) + curCol; |
1174 | endX = currentDate.daysTo(nextOcend.date()) + curCol; | 1174 | endX = currentDate.daysTo(nextOcend.date()) + curCol; |
1175 | 1175 | ||
1176 | } | 1176 | } |
1177 | } | 1177 | } |
1178 | int startY = mAgenda->timeToY(event->dtStart().time()); | 1178 | int startY = mAgenda->timeToY(event->dtStart().time()); |
1179 | int endY = mAgenda->timeToY(event->dtEnd().time()) - 1; | 1179 | int endY = mAgenda->timeToY(event->dtEnd().time()) - 1; |
1180 | //qDebug("insert %d %d %d %d %d ",beginX,endX,startY,endY , curCol ); | 1180 | //qDebug("insert %d %d %d %d %d ",beginX,endX,startY,endY , curCol ); |
1181 | if ((beginX <= 0 && curCol == 0) || beginX == curCol) { | 1181 | if ((beginX <= 0 && curCol == 0) || beginX == curCol) { |
1182 | //qDebug("insert!!! "); | 1182 | //qDebug("insert!!! "); |
1183 | mAgenda->insertMultiItem(event,currentDate,beginX,endX,startY,endY); | 1183 | mAgenda->insertMultiItem(event,currentDate,beginX,endX,startY,endY); |
1184 | } | 1184 | } |
1185 | if (beginX == curCol) { | 1185 | if (beginX == curCol) { |
1186 | mMaxY[curCol] = mAgenda->timeToY(QTime(23,59)); | 1186 | mMaxY[curCol] = mAgenda->timeToY(QTime(23,59)); |
1187 | if (startY < mMinY[curCol]) mMinY[curCol] = startY; | 1187 | if (startY < mMinY[curCol]) mMinY[curCol] = startY; |
1188 | } else if (endX == curCol) { | 1188 | } else if (endX == curCol) { |
1189 | mMinY[curCol] = mAgenda->timeToY(QTime(0,0)); | 1189 | mMinY[curCol] = mAgenda->timeToY(QTime(0,0)); |
1190 | if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; | 1190 | if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; |
1191 | } else { | 1191 | } else { |
1192 | mMinY[curCol] = mAgenda->timeToY(QTime(0,0)); | 1192 | mMinY[curCol] = mAgenda->timeToY(QTime(0,0)); |
1193 | mMaxY[curCol] = mAgenda->timeToY(QTime(23,59)); | 1193 | mMaxY[curCol] = mAgenda->timeToY(QTime(23,59)); |
1194 | } | 1194 | } |
1195 | } else { | 1195 | } else { |
1196 | int startY = mAgenda->timeToY(event->dtStart().time()); | 1196 | int startY = mAgenda->timeToY(event->dtStart().time()); |
1197 | int endY = mAgenda->timeToY(event->dtEnd().time()) - 1; | 1197 | int endY = mAgenda->timeToY(event->dtEnd().time()) - 1; |
1198 | if (endY < startY) endY = startY; | 1198 | if (endY < startY) endY = startY; |
1199 | mAgenda->insertItem(event,currentDate,curCol,startY,endY); | 1199 | mAgenda->insertItem(event,currentDate,curCol,startY,endY); |
1200 | if (startY < mMinY[curCol]) mMinY[curCol] = startY; | 1200 | if (startY < mMinY[curCol]) mMinY[curCol] = startY; |
1201 | if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; | 1201 | if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; |
1202 | } | 1202 | } |
1203 | } | 1203 | } |
1204 | // ---------- [display Todos -------------- | 1204 | // ---------- [display Todos -------------- |
1205 | unsigned int numTodo; | 1205 | unsigned int numTodo; |
1206 | for (numTodo = 0; numTodo < todos.count(); ++numTodo) { | 1206 | for (numTodo = 0; numTodo < todos.count(); ++numTodo) { |
1207 | Todo *todo = todos.at(numTodo); | 1207 | Todo *todo = todos.at(numTodo); |
1208 | 1208 | ||
1209 | if ( ! todo->hasDueDate() && !todo->hasCompletedDate()) continue; // todo shall not be displayed if it has no date | 1209 | if ( ! todo->hasDueDate() && !todo->hasCompletedDate()) continue; // todo shall not be displayed if it has no date |
1210 | 1210 | ||
1211 | // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. | 1211 | // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. |
1212 | // Already completed items can be displayed on their original due date | 1212 | // Already completed items can be displayed on their original due date |
1213 | //if not KOPrefs::instance()->mShowTodoInAgenda, show overdue in agenda | 1213 | //if not KOPrefs::instance()->mShowTodoInAgenda, show overdue in agenda |
1214 | bool overdue = (!todo->isCompleted()) && (todo->dtDue() < today) && KOPrefs::instance()->mShowTodoInAgenda; | 1214 | bool overdue = (!todo->isCompleted()) && (todo->dtDue() < today) && KOPrefs::instance()->mShowTodoInAgenda; |
1215 | bool fillIn = false; | 1215 | bool fillIn = false; |
1216 | if ( todo->hasCompletedDate() && todo->completed().date() == currentDate ) | 1216 | if ( todo->hasCompletedDate() && todo->completed().date() == currentDate ) |
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp index dfc6af7..c55f7d7 100644 --- a/korganizer/kodaymatrix.cpp +++ b/korganizer/kodaymatrix.cpp | |||
@@ -1,942 +1,946 @@ | |||
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 | mRedrawNeeded = true; | 113 | mRedrawNeeded = true; |
114 | mKODaymatrixWhatsThis = new KODaymatrixWhatsThis(this); | 114 | mKODaymatrixWhatsThis = new KODaymatrixWhatsThis(this); |
115 | mPendingUpdateBeforeRepaint = false; | 115 | mPendingUpdateBeforeRepaint = false; |
116 | mouseDown = false; | 116 | mouseDown = false; |
117 | // initialize dynamic arrays | 117 | // initialize dynamic arrays |
118 | bDays.resize ( NUMDAYS ); | 118 | bDays.resize ( NUMDAYS ); |
119 | hDays.resize ( NUMDAYS );; | 119 | hDays.resize ( NUMDAYS );; |
120 | eDays.resize ( NUMDAYS );; | 120 | eDays.resize ( NUMDAYS );; |
121 | days = new QDate[NUMDAYS]; | 121 | days = new QDate[NUMDAYS]; |
122 | daylbls = new QString[NUMDAYS]; | 122 | daylbls = new QString[NUMDAYS]; |
123 | //events = new int[NUMDAYS]; | 123 | //events = new int[NUMDAYS]; |
124 | mToolTip = new DynamicTip(this); | 124 | mToolTip = new DynamicTip(this); |
125 | 125 | ||
126 | // set default values used for drawing the matrix | 126 | // set default values used for drawing the matrix |
127 | mDefaultBackColor = palette().active().base(); | 127 | mDefaultBackColor = palette().active().base(); |
128 | mDefaultTextColor = palette().active().foreground(); | 128 | mDefaultTextColor = palette().active().foreground(); |
129 | mDefaultTextColorShaded = getShadedColor(mDefaultTextColor); | 129 | mDefaultTextColorShaded = getShadedColor(mDefaultTextColor); |
130 | mHolidayColorShaded = getShadedColor(KOPrefs::instance()->mHolidayColor); | 130 | mHolidayColorShaded = getShadedColor(KOPrefs::instance()->mHolidayColor); |
131 | mSelectedDaysColor = QColor("white"); | 131 | mSelectedDaysColor = QColor("white"); |
132 | mTodayMarginWidth = 2; | 132 | mTodayMarginWidth = 2; |
133 | mSelEnd = mSelStart = NOSELECTION; | 133 | mSelEnd = mSelStart = NOSELECTION; |
134 | 134 | ||
135 | setAcceptDrops(true); | 135 | setAcceptDrops(true); |
136 | //setFont( QFont("Arial", 10) ); | 136 | //setFont( QFont("Arial", 10) ); |
137 | 137 | ||
138 | mUpdateTimer = new QTimer( this ); | 138 | mUpdateTimer = new QTimer( this ); |
139 | connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( updateViewTimed() )); | 139 | connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( updateViewTimed() )); |
140 | mRepaintTimer = new QTimer( this ); | 140 | mRepaintTimer = new QTimer( this ); |
141 | connect (mRepaintTimer ,SIGNAL(timeout()), this, SLOT ( repaintViewTimed() )); | 141 | connect (mRepaintTimer ,SIGNAL(timeout()), this, SLOT ( repaintViewTimed() )); |
142 | mDayChanged = false; | 142 | mDayChanged = false; |
143 | updateView(); | 143 | updateView(); |
144 | } | 144 | } |
145 | QString KODayMatrix::getWhatsThisText( QPoint p ) | 145 | QString KODayMatrix::getWhatsThisText( QPoint p ) |
146 | { | 146 | { |
147 | 147 | ||
148 | int tmp = getDayIndexFrom(p.x(), p.y()); | 148 | int tmp = getDayIndexFrom(p.x(), p.y()); |
149 | if ( tmp < 0 || tmp > NUMDAYS-1 || !mCalendar ) | 149 | if ( tmp < 0 || tmp > NUMDAYS-1 || !mCalendar ) |
150 | return QString(); | 150 | return QString(); |
151 | QDate mDate = days[tmp]; | 151 | QDate mDate = days[tmp]; |
152 | QPtrList<Event> eventlist = mCalendar->events(mDate); | 152 | QPtrList<Event> eventlist = mCalendar->events(mDate); |
153 | Event *event; | 153 | Event *event; |
154 | QStringList mToolTip; | 154 | QStringList mToolTip; |
155 | for(event=eventlist.first();event != 0;event=eventlist.next()) { | 155 | for(event=eventlist.first();event != 0;event=eventlist.next()) { |
156 | QString mToolTipText; | 156 | QString mToolTipText; |
157 | QString text; | 157 | QString text; |
158 | int multiday = 0;// 1 = start, 2 = midddle, 3 = end day | 158 | int multiday = 0;// 1 = start, 2 = midddle, 3 = end day |
159 | if (event->isMultiDay()) { | 159 | if (event->isMultiDay()) { |
160 | QString prefix = "<->";multiday = 2; | 160 | QString prefix = "<->";multiday = 2; |
161 | QString time; | 161 | QString time; |
162 | if ( event->doesRecur() ) { | 162 | if ( event->doesRecur() ) { |
163 | if ( event->recursOn( mDate) ) { | 163 | if ( event->recursOn( mDate) ) { |
164 | prefix ="->" ;multiday = 1; | 164 | prefix ="->" ;multiday = 1; |
165 | } | 165 | } |
166 | else { | 166 | else { |
167 | int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); | 167 | int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); |
168 | if ( event->recursOn( mDate.addDays( -days)) ) { | 168 | if ( event->recursOn( mDate.addDays( -days)) ) { |
169 | prefix ="<-" ;multiday = 3; | 169 | prefix ="<-" ;multiday = 3; |
170 | } | 170 | } |
171 | } | 171 | } |
172 | } else { | 172 | } else { |
173 | if (mDate == event->dtStart().date()) { | 173 | if (mDate == event->dtStart().date()) { |
174 | prefix ="->" ;multiday = 1; | 174 | prefix ="->" ;multiday = 1; |
175 | } else if (mDate == event->dtEnd().date()) { | 175 | } else if (mDate == event->dtEnd().date()) { |
176 | prefix ="<-" ;multiday = 3; | 176 | prefix ="<-" ;multiday = 3; |
177 | } | 177 | } |
178 | } | 178 | } |
179 | if ( !event->doesFloat() ) { | 179 | if ( !event->doesFloat() ) { |
180 | if ( mDate == event->dtStart().date () ) | 180 | if ( mDate == event->dtStart().date () ) |
181 | time = KGlobal::locale()->formatTime(event->dtStart().time())+" "; | 181 | time = KGlobal::locale()->formatTime(event->dtStart().time())+" "; |
182 | else if ( mDate == event->dtEnd().date () ) | 182 | else if ( mDate == event->dtEnd().date () ) |
183 | time = KGlobal::locale()->formatTime(event->dtEnd().time())+" "; | 183 | time = KGlobal::locale()->formatTime(event->dtEnd().time())+" "; |
184 | 184 | ||
185 | } | 185 | } |
186 | text = time + event->summary(); | 186 | text = time + event->summary(); |
187 | mToolTipText += prefix + text; | 187 | mToolTipText += prefix + text; |
188 | } else { | 188 | } else { |
189 | if (event->doesFloat()) { | 189 | if (event->doesFloat()) { |
190 | text = event->summary(); | 190 | text = event->summary(); |
191 | mToolTipText += text; | 191 | mToolTipText += text; |
192 | } | 192 | } |
193 | else { | 193 | else { |
194 | text = KGlobal::locale()->formatTime(event->dtStart().time()); | 194 | text = KGlobal::locale()->formatTime(event->dtStart().time()); |
195 | text += " " + event->summary(); | 195 | text += " " + event->summary(); |
196 | mToolTipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); | 196 | mToolTipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); |
197 | } | 197 | } |
198 | } | 198 | } |
199 | if ( !event->location().isEmpty() ) | 199 | if ( !event->location().isEmpty() ) |
200 | mToolTipText += " (" + event->location() + ")"; | 200 | mToolTipText += " (" + event->location() + ")"; |
201 | #if QT_VERSION >= 0x030000 | 201 | #if QT_VERSION >= 0x030000 |
202 | mToolTipText.replace( '<' , "<" ); | 202 | mToolTipText.replace( '<' , "<" ); |
203 | mToolTipText.replace( '>' , ">" ); | 203 | mToolTipText.replace( '>' , ">" ); |
204 | #else | 204 | #else |
205 | if ( mToolTipText.find ('<') >= 0 ) { | 205 | if ( mToolTipText.find ('<') >= 0 ) { |
206 | mToolTipText.replace( QRegExp("<") , "<" ); | 206 | mToolTipText.replace( QRegExp("<") , "<" ); |
207 | } | 207 | } |
208 | if ( mToolTipText.find ('>') >= 0 ) { | 208 | if ( mToolTipText.find ('>') >= 0 ) { |
209 | mToolTipText.replace( QRegExp(">") , ">" ); | 209 | mToolTipText.replace( QRegExp(">") , ">" ); |
210 | } | 210 | } |
211 | #endif | 211 | #endif |
212 | //qDebug("TTT: %s ", mToolTipText.latin1()); | 212 | //qDebug("TTT: %s ", mToolTipText.latin1()); |
213 | mToolTip.append( mToolTipText ); | 213 | mToolTip.append( mToolTipText ); |
214 | } | 214 | } |
215 | mToolTip.sort(); | 215 | mToolTip.sort(); |
216 | return "<b>"+KGlobal::locale()->formatDate(days[tmp]) + "</b><br>" + mToolTip.join("<br>"); | 216 | return "<b>"+KGlobal::locale()->formatDate(days[tmp]) + "</b><br>" + mToolTip.join("<br>"); |
217 | } | 217 | } |
218 | void KODayMatrix::setCalendar( Calendar *cal ) | 218 | void KODayMatrix::setCalendar( Calendar *cal ) |
219 | { | 219 | { |
220 | mCalendar = cal; | 220 | mCalendar = cal; |
221 | 221 | ||
222 | setAcceptDrops( mCalendar ); | 222 | setAcceptDrops( mCalendar ); |
223 | 223 | ||
224 | updateEvents(); | 224 | updateEvents(); |
225 | } | 225 | } |
226 | 226 | ||
227 | QColor KODayMatrix::getShadedColor(QColor color) | 227 | QColor KODayMatrix::getShadedColor(QColor color) |
228 | { | 228 | { |
229 | QColor shaded; | 229 | QColor shaded; |
230 | int h=0; | 230 | int h=0; |
231 | int s=0; | 231 | int s=0; |
232 | int v=0; | 232 | int v=0; |
233 | color.hsv(&h,&s,&v); | 233 | color.hsv(&h,&s,&v); |
234 | s = s/4; | 234 | s = s/4; |
235 | v = 192+v/4; | 235 | v = 192+v/4; |
236 | shaded.setHsv(h,s,v); | 236 | shaded.setHsv(h,s,v); |
237 | 237 | ||
238 | return shaded; | 238 | return shaded; |
239 | } | 239 | } |
240 | 240 | ||
241 | KODayMatrix::~KODayMatrix() | 241 | KODayMatrix::~KODayMatrix() |
242 | { | 242 | { |
243 | // delete mKODaymatrixWhatsThis; | 243 | // delete mKODaymatrixWhatsThis; |
244 | delete [] days; | 244 | delete [] days; |
245 | delete [] daylbls; | 245 | delete [] daylbls; |
246 | //delete [] events; | 246 | //delete [] events; |
247 | delete mToolTip; | 247 | delete mToolTip; |
248 | } | 248 | } |
249 | 249 | ||
250 | /* | 250 | /* |
251 | void KODayMatrix::setStartDate(QDate start) | 251 | void KODayMatrix::setStartDate(QDate start) |
252 | { | 252 | { |
253 | updateView(start); | 253 | updateView(start); |
254 | } | 254 | } |
255 | */ | 255 | */ |
256 | 256 | ||
257 | void KODayMatrix::addSelectedDaysTo(DateList& selDays) | 257 | void KODayMatrix::addSelectedDaysTo(DateList& selDays) |
258 | { | 258 | { |
259 | 259 | ||
260 | if (mSelStart == NOSELECTION) { | 260 | if (mSelStart == NOSELECTION) { |
261 | return; | 261 | return; |
262 | } | 262 | } |
263 | 263 | ||
264 | //cope with selection being out of matrix limits at top (< 0) | 264 | //cope with selection being out of matrix limits at top (< 0) |
265 | int i0 = mSelStart; | 265 | int i0 = mSelStart; |
266 | if (i0 < 0) { | 266 | if (i0 < 0) { |
267 | for (int i = i0; i < 0; i++) { | 267 | for (int i = i0; i < 0; i++) { |
268 | selDays.append(days[0].addDays(i)); | 268 | selDays.append(days[0].addDays(i)); |
269 | } | 269 | } |
270 | i0 = 0; | 270 | i0 = 0; |
271 | } | 271 | } |
272 | 272 | ||
273 | //cope with selection being out of matrix limits at bottom (> NUMDAYS-1) | 273 | //cope with selection being out of matrix limits at bottom (> NUMDAYS-1) |
274 | if (mSelEnd > NUMDAYS-1) { | 274 | if (mSelEnd > NUMDAYS-1) { |
275 | for (int i = i0; i <= NUMDAYS-1; i++) { | 275 | for (int i = i0; i <= NUMDAYS-1; i++) { |
276 | selDays.append(days[i]); | 276 | selDays.append(days[i]); |
277 | } | 277 | } |
278 | for (int i = NUMDAYS; i < mSelEnd; i++) { | 278 | for (int i = NUMDAYS; i < mSelEnd; i++) { |
279 | selDays.append(days[0].addDays(i)); | 279 | selDays.append(days[0].addDays(i)); |
280 | } | 280 | } |
281 | 281 | ||
282 | // apply normal routine to selection being entirely within matrix limits | 282 | // apply normal routine to selection being entirely within matrix limits |
283 | } else { | 283 | } else { |
284 | for (int i = i0; i <= mSelEnd; i++) { | 284 | for (int i = i0; i <= mSelEnd; i++) { |
285 | selDays.append(days[i]); | 285 | selDays.append(days[i]); |
286 | } | 286 | } |
287 | } | 287 | } |
288 | } | 288 | } |
289 | 289 | ||
290 | bool KODayMatrix::setSelectedDaysFrom(const QDate& start, const QDate& end) | 290 | bool KODayMatrix::setSelectedDaysFrom(const QDate& start, const QDate& end) |
291 | { | 291 | { |
292 | mRedrawNeeded = true; | ||
292 | bool noSel = (mSelEnd == NOSELECTION && mSelStart == NOSELECTION ); | 293 | bool noSel = (mSelEnd == NOSELECTION && mSelStart == NOSELECTION ); |
293 | mSelStart = startdate.daysTo(start); | 294 | mSelStart = startdate.daysTo(start); |
294 | if ( mSelStart < 0 ) | 295 | if ( mSelStart < 0 ) |
295 | mSelStart = 0; | 296 | mSelStart = 0; |
296 | mSelEnd = startdate.daysTo(end); | 297 | mSelEnd = startdate.daysTo(end); |
297 | if ( mSelEnd > NUMDAYS-1 ) | 298 | if ( mSelEnd > NUMDAYS-1 ) |
298 | mSelEnd = NUMDAYS-1; | 299 | mSelEnd = NUMDAYS-1; |
299 | if ( mSelEnd < 0 || mSelStart > NUMDAYS-1 ) { | 300 | if ( mSelEnd < 0 || mSelStart > NUMDAYS-1 ) { |
300 | clearSelection(); | 301 | clearSelection(); |
301 | if ( noSel ) | 302 | if ( noSel ) |
302 | return false; | 303 | return false; |
303 | } | 304 | } |
304 | 305 | ||
305 | return true; | 306 | return true; |
306 | } | 307 | } |
307 | void KODayMatrix::clearSelection() | 308 | void KODayMatrix::clearSelection() |
308 | { | 309 | { |
309 | mSelEnd = mSelStart = NOSELECTION; | 310 | mSelEnd = mSelStart = NOSELECTION; |
310 | } | 311 | } |
311 | 312 | ||
312 | 313 | ||
313 | void KODayMatrix::recalculateToday() | 314 | void KODayMatrix::recalculateToday() |
314 | { | 315 | { |
315 | today = -1; | 316 | today = -1; |
316 | for (int i=0; i<NUMDAYS; i++) { | 317 | for (int i=0; i<NUMDAYS; i++) { |
317 | //events[i] = 0; | 318 | //events[i] = 0; |
318 | days[i] = startdate.addDays(i); | 319 | days[i] = startdate.addDays(i); |
319 | daylbls[i] = QString::number( KOGlobals::self()->calendarSystem()->day( days[i] )); | 320 | daylbls[i] = QString::number( KOGlobals::self()->calendarSystem()->day( days[i] )); |
320 | 321 | ||
321 | // if today is in the currently displayed month, hilight today | 322 | // if today is in the currently displayed month, hilight today |
322 | if (days[i].year() == QDate::currentDate().year() && | 323 | if (days[i].year() == QDate::currentDate().year() && |
323 | days[i].month() == QDate::currentDate().month() && | 324 | days[i].month() == QDate::currentDate().month() && |
324 | days[i].day() == QDate::currentDate().day()) { | 325 | days[i].day() == QDate::currentDate().day()) { |
325 | today = i; | 326 | today = i; |
326 | } | 327 | } |
327 | } | 328 | } |
328 | // qDebug(QString("Today is visible at %1.").arg(today)); | 329 | // qDebug(QString("Today is visible at %1.").arg(today)); |
329 | } | 330 | } |
330 | 331 | ||
331 | void KODayMatrix::updateView() | 332 | void KODayMatrix::updateView() |
332 | { | 333 | { |
333 | updateView(startdate); | 334 | updateView(startdate); |
334 | } | 335 | } |
335 | void KODayMatrix::repaintViewTimed() | 336 | void KODayMatrix::repaintViewTimed() |
336 | { | 337 | { |
337 | mRepaintTimer->stop(); | 338 | mRepaintTimer->stop(); |
338 | repaint(false); | 339 | repaint(false); |
339 | } | 340 | } |
340 | void KODayMatrix::updateViewTimed() | 341 | void KODayMatrix::updateViewTimed() |
341 | { | 342 | { |
342 | mUpdateTimer->stop(); | 343 | mUpdateTimer->stop(); |
343 | if ( !mCalendar ) { | 344 | if ( !mCalendar ) { |
344 | qDebug("NOT CAL "); | 345 | qDebug("NOT CAL "); |
345 | return; | 346 | return; |
346 | } | 347 | } |
347 | //qDebug("KODayMatrix::updateViewTimed "); | 348 | //qDebug("KODayMatrix::updateViewTimed "); |
348 | for(int i = 0; i < NUMDAYS; i++) { | 349 | for(int i = 0; i < NUMDAYS; i++) { |
349 | // if events are set for the day then remember to draw it bold | 350 | // if events are set for the day then remember to draw it bold |
350 | QPtrList<Event> eventlist = mCalendar->events(days[i]); | 351 | QPtrList<Event> eventlist = mCalendar->events(days[i]); |
351 | Event *event; | 352 | Event *event; |
352 | int numEvents = eventlist.count(); | 353 | int numEvents = eventlist.count(); |
353 | QString holiStr = ""; | 354 | QString holiStr = ""; |
354 | bDays.clearBit(i); | 355 | bDays.clearBit(i); |
355 | hDays.clearBit(i); | 356 | hDays.clearBit(i); |
356 | eDays.clearBit(i); | 357 | eDays.clearBit(i); |
357 | for(event=eventlist.first();event != 0;event=eventlist.next()) { | 358 | for(event=eventlist.first();event != 0;event=eventlist.next()) { |
358 | ushort recurType = event->recurrence()->doesRecur(); | 359 | ushort recurType = event->recurrence()->doesRecur(); |
359 | if ((recurType == Recurrence::rDaily && !KOPrefs::instance()->mDailyRecur) || | 360 | if ((recurType == Recurrence::rDaily && !KOPrefs::instance()->mDailyRecur) || |
360 | (recurType == Recurrence::rWeekly && !KOPrefs::instance()->mWeeklyRecur)) { | 361 | (recurType == Recurrence::rWeekly && !KOPrefs::instance()->mWeeklyRecur)) { |
361 | numEvents--; | 362 | numEvents--; |
362 | } | 363 | } |
363 | if ( event->isHoliday()) { | 364 | if ( event->isHoliday()) { |
364 | hDays.setBit(i); | 365 | hDays.setBit(i); |
365 | if ( !holiStr.isEmpty() ) | 366 | if ( !holiStr.isEmpty() ) |
366 | holiStr += "\n"; | 367 | holiStr += "\n"; |
367 | holiStr += event->summary(); | 368 | holiStr += event->summary(); |
368 | if ( !event->location().isEmpty() ) | 369 | if ( !event->location().isEmpty() ) |
369 | holiStr += " (" + event->location() + ")"; | 370 | holiStr += " (" + event->location() + ")"; |
370 | } | 371 | } |
371 | if ( event->isBirthday()) { | 372 | if ( event->isBirthday()) { |
372 | if ( !holiStr.isEmpty() ) | 373 | if ( !holiStr.isEmpty() ) |
373 | holiStr += "\n"; | 374 | holiStr += "\n"; |
374 | holiStr += i18n("Birthday") + ": "+event->summary(); | 375 | holiStr += i18n("Birthday") + ": "+event->summary(); |
375 | if ( !event->location().isEmpty() ) | 376 | if ( !event->location().isEmpty() ) |
376 | holiStr += " (" + event->location() + ")"; | 377 | holiStr += " (" + event->location() + ")"; |
377 | bDays.setBit(i); | 378 | bDays.setBit(i); |
378 | } | 379 | } |
379 | } | 380 | } |
380 | if ( numEvents ) | 381 | if ( numEvents ) |
381 | eDays.setBit(i); | 382 | eDays.setBit(i); |
382 | //if it is a holy day then draw it red. Sundays are consider holidays, too | 383 | //if it is a holy day then draw it red. Sundays are consider holidays, too |
383 | if ( (KOGlobals::self()->calendarSystem()->dayOfWeek(days[i]) == KOGlobals::self()->calendarSystem()->weekDayOfPray()) || | 384 | if ( (KOGlobals::self()->calendarSystem()->dayOfWeek(days[i]) == KOGlobals::self()->calendarSystem()->weekDayOfPray()) || |
384 | !holiStr.isEmpty()) { | 385 | !holiStr.isEmpty()) { |
385 | mHolidays[i] = holiStr; | 386 | mHolidays[i] = holiStr; |
386 | } else { | 387 | } else { |
387 | mHolidays[i] = QString::null; | 388 | mHolidays[i] = QString::null; |
388 | } | 389 | } |
389 | } | 390 | } |
390 | mRedrawNeeded = true; | 391 | mRedrawNeeded = true; |
391 | if ( ! mPendingUpdateBeforeRepaint ) | 392 | if ( ! mPendingUpdateBeforeRepaint ) |
392 | repaint(false); | 393 | repaint(false); |
393 | } | 394 | } |
394 | void KODayMatrix::updateView(QDate actdate) | 395 | void KODayMatrix::updateView(QDate actdate) |
395 | { | 396 | { |
396 | 397 | ||
397 | if ( ! actdate.isValid() ) { | 398 | if ( ! actdate.isValid() ) { |
398 | //qDebug("date not valid "); | 399 | //qDebug("date not valid "); |
399 | return; | 400 | return; |
400 | } | 401 | } |
401 | mDayChanged = false; | 402 | mDayChanged = false; |
402 | //flag to indicate if the starting day of the matrix has changed by this call | 403 | //flag to indicate if the starting day of the matrix has changed by this call |
403 | //mDayChanged = false; | 404 | //mDayChanged = false; |
404 | // if a new startdate is to be set then apply Cornelius's calculation | 405 | // if a new startdate is to be set then apply Cornelius's calculation |
405 | // of the first day to be shown | 406 | // of the first day to be shown |
406 | if (actdate != startdate) { | 407 | if (actdate != startdate) { |
407 | // reset index of selection according to shift of starting date from startdate to actdate | 408 | // reset index of selection according to shift of starting date from startdate to actdate |
408 | if (mSelStart != NOSELECTION) { | 409 | if (mSelStart != NOSELECTION) { |
409 | int tmp = actdate.daysTo(startdate); | 410 | int tmp = actdate.daysTo(startdate); |
410 | //kdDebug() << "Shift of Selection1: " << mSelStart << " - " << mSelEnd << " -> " << tmp << "(" << offset << ")" << endl; | 411 | //kdDebug() << "Shift of Selection1: " << mSelStart << " - " << mSelEnd << " -> " << tmp << "(" << offset << ")" << endl; |
411 | // shift selection if new one would be visible at least partly ! | 412 | // shift selection if new one would be visible at least partly ! |
412 | 413 | ||
413 | if (mSelStart+tmp < NUMDAYS && mSelEnd+tmp >= 0) { | 414 | if (mSelStart+tmp < NUMDAYS && mSelEnd+tmp >= 0) { |
414 | // nested if is required for next X display pushed from a different month - correction required | 415 | // nested if is required for next X display pushed from a different month - correction required |
415 | // otherwise, for month forward and backward, it must be avoided | 416 | // otherwise, for month forward and backward, it must be avoided |
416 | if( mSelStart > NUMDAYS || mSelStart < 0 ) | 417 | if( mSelStart > NUMDAYS || mSelStart < 0 ) |
417 | mSelStart = mSelStart + tmp; | 418 | mSelStart = mSelStart + tmp; |
418 | if( mSelEnd > NUMDAYS || mSelEnd < 0 ) | 419 | if( mSelEnd > NUMDAYS || mSelEnd < 0 ) |
419 | mSelEnd = mSelEnd + tmp; | 420 | mSelEnd = mSelEnd + tmp; |
420 | } | 421 | } |
421 | } | 422 | } |
422 | startdate = actdate; | 423 | startdate = actdate; |
423 | mDayChanged = true; | 424 | mDayChanged = true; |
424 | recalculateToday(); | 425 | recalculateToday(); |
425 | mRedrawNeeded = true; | 426 | mRedrawNeeded = true; |
426 | } | 427 | } |
427 | //qDebug("restart Timer %d vis: %d", mDayChanged, isVisible() ); | 428 | //qDebug("restart Timer %d vis: %d", mDayChanged, isVisible() ); |
428 | if ( !isVisible() ) { | 429 | if ( !isVisible() ) { |
429 | mPendingUpdateBeforeRepaint = true; | 430 | mPendingUpdateBeforeRepaint = true; |
430 | } else { | 431 | } else { |
431 | #ifdef DESKTOP_VERSION | 432 | #ifdef DESKTOP_VERSION |
432 | //mRepaintTimer->start( 100 ); | 433 | //mRepaintTimer->start( 100 ); |
433 | //updateViewTimed(); | 434 | //updateViewTimed(); |
434 | mUpdateTimer->start( 50 ); | 435 | mUpdateTimer->start( 50 ); |
435 | #else | 436 | #else |
436 | mRepaintTimer->start( 350 ); | 437 | mRepaintTimer->start( 350 ); |
437 | mUpdateTimer->start( 1200 ); | 438 | mUpdateTimer->start( 1200 ); |
438 | #endif | 439 | #endif |
439 | } | 440 | } |
440 | } | 441 | } |
441 | void KODayMatrix::updateEvents() | 442 | void KODayMatrix::updateEvents() |
442 | { | 443 | { |
443 | if ( !mCalendar ) return; | 444 | if ( !mCalendar ) return; |
444 | 445 | ||
445 | for( int i = 0; i < NUMDAYS; i++ ) { | 446 | for( int i = 0; i < NUMDAYS; i++ ) { |
446 | // if events are set for the day then remember to draw it bold | 447 | // if events are set for the day then remember to draw it bold |
447 | QPtrList<Event> eventlist = mCalendar->events( days[ i ] ); | 448 | QPtrList<Event> eventlist = mCalendar->events( days[ i ] ); |
448 | int numEvents = eventlist.count(); | 449 | int numEvents = eventlist.count(); |
449 | Event *event; | 450 | Event *event; |
450 | for( event = eventlist.first(); event != 0;event=eventlist.next()) { | 451 | for( event = eventlist.first(); event != 0;event=eventlist.next()) { |
451 | ushort recurType = event->doesRecur(); | 452 | ushort recurType = event->doesRecur(); |
452 | 453 | ||
453 | if ( ( recurType == Recurrence::rDaily && | 454 | if ( ( recurType == Recurrence::rDaily && |
454 | !KOPrefs::instance()->mDailyRecur ) || | 455 | !KOPrefs::instance()->mDailyRecur ) || |
455 | ( recurType == Recurrence::rWeekly && | 456 | ( recurType == Recurrence::rWeekly && |
456 | !KOPrefs::instance()->mWeeklyRecur ) ) { | 457 | !KOPrefs::instance()->mWeeklyRecur ) ) { |
457 | numEvents--; | 458 | numEvents--; |
458 | } | 459 | } |
459 | } | 460 | } |
460 | if ( numEvents ) | 461 | if ( numEvents ) |
461 | eDays.setBit(i); | 462 | eDays.setBit(i); |
462 | else | 463 | else |
463 | eDays.clearBit(i); | 464 | eDays.clearBit(i); |
464 | } | 465 | } |
465 | } | 466 | } |
466 | 467 | ||
467 | const QDate& KODayMatrix::getDate(int offset) | 468 | const QDate& KODayMatrix::getDate(int offset) |
468 | { | 469 | { |
469 | if (offset < 0 || offset > NUMDAYS-1) { | 470 | if (offset < 0 || offset > NUMDAYS-1) { |
470 | qDebug("Wrong offset2 %d", offset); | 471 | qDebug("Wrong offset2 %d", offset); |
471 | return days[0]; | 472 | return days[0]; |
472 | } | 473 | } |
473 | return days[offset]; | 474 | return days[offset]; |
474 | } | 475 | } |
475 | 476 | ||
476 | QString KODayMatrix::getHolidayLabel(int offset) | 477 | QString KODayMatrix::getHolidayLabel(int offset) |
477 | { | 478 | { |
478 | if (offset < 0 || offset > NUMDAYS-1) { | 479 | if (offset < 0 || offset > NUMDAYS-1) { |
479 | qDebug("Wrong offset1 %d", offset); | 480 | qDebug("Wrong offset1 %d", offset); |
480 | return QString(); | 481 | return QString(); |
481 | } | 482 | } |
482 | return mHolidays[offset]; | 483 | return mHolidays[offset]; |
483 | } | 484 | } |
484 | 485 | ||
485 | int KODayMatrix::getDayIndexFrom(int x, int y) | 486 | int KODayMatrix::getDayIndexFrom(int x, int y) |
486 | { | 487 | { |
487 | int colModulo = (width()-2) % 7; | 488 | int colModulo = (width()-2) % 7; |
488 | int rowModulo = (height()-2) % 6; | 489 | int rowModulo = (height()-2) % 6; |
489 | #if 0 | 490 | #if 0 |
490 | return 7*(y/daysize.height()) + (KOGlobals::self()->reverseLayout() ? | 491 | return 7*(y/daysize.height()) + (KOGlobals::self()->reverseLayout() ? |
491 | 6 - x/daysize.width() : x/daysize.width()); | 492 | 6 - x/daysize.width() : x/daysize.width()); |
492 | #endif | 493 | #endif |
493 | int xVal = (x-colModulo/2-2)/daysize.width(); | 494 | int xVal = (x-colModulo/2-2)/daysize.width(); |
494 | int yVal = (y-rowModulo/2-2)/daysize.height(); | 495 | int yVal = (y-rowModulo/2-2)/daysize.height(); |
495 | 496 | ||
496 | 497 | ||
497 | return 7*(yVal) + xVal; | 498 | return 7*(yVal) + xVal; |
498 | 499 | ||
499 | } | 500 | } |
500 | 501 | ||
501 | // ---------------------------------------------------------------------------- | 502 | // ---------------------------------------------------------------------------- |
502 | // M O U S E E V E N T H A N D L I N G | 503 | // M O U S E E V E N T H A N D L I N G |
503 | // ---------------------------------------------------------------------------- | 504 | // ---------------------------------------------------------------------------- |
504 | 505 | ||
505 | void KODayMatrix::mousePressEvent (QMouseEvent* e) | 506 | void KODayMatrix::mousePressEvent (QMouseEvent* e) |
506 | { | 507 | { |
507 | 508 | ||
508 | if ( e->button() == LeftButton ) | 509 | if ( e->button() == LeftButton ) |
509 | mouseDown = true; | 510 | mouseDown = true; |
510 | mSelStart = getDayIndexFrom(e->x(), e->y()); | 511 | mSelStart = getDayIndexFrom(e->x(), e->y()); |
511 | if (mSelStart > NUMDAYS-1) mSelStart=NUMDAYS-1; | 512 | if (mSelStart > NUMDAYS-1) mSelStart=NUMDAYS-1; |
512 | mSelInit = mSelStart; | 513 | mSelInit = mSelStart; |
513 | mSelEnd = mSelStart; | 514 | mSelEnd = mSelStart; |
515 | mRedrawNeeded = true; | ||
514 | repaint(false); | 516 | repaint(false); |
515 | } | 517 | } |
516 | 518 | ||
517 | void KODayMatrix::mouseReleaseEvent (QMouseEvent* e) | 519 | void KODayMatrix::mouseReleaseEvent (QMouseEvent* e) |
518 | { | 520 | { |
521 | mRedrawNeeded = true; | ||
519 | if ( e->button() == LeftButton ) | 522 | if ( e->button() == LeftButton ) |
520 | if ( ! mouseDown ) { | 523 | if ( ! mouseDown ) { |
521 | return; | 524 | return; |
522 | } | 525 | } |
523 | else | 526 | else |
524 | mouseDown = false; | 527 | mouseDown = false; |
525 | int tmp = getDayIndexFrom(e->x(), e->y()); | 528 | int tmp = getDayIndexFrom(e->x(), e->y()); |
526 | if (tmp > NUMDAYS-1) tmp=NUMDAYS-1; | 529 | if (tmp > NUMDAYS-1) tmp=NUMDAYS-1; |
527 | 530 | ||
528 | if (mSelInit > tmp) { | 531 | if (mSelInit > tmp) { |
529 | mSelEnd = mSelInit; | 532 | mSelEnd = mSelInit; |
530 | if (tmp != mSelStart) { | 533 | if (tmp != mSelStart) { |
531 | mSelStart = tmp; | 534 | mSelStart = tmp; |
532 | repaint(false); | 535 | repaint(false); |
533 | } | 536 | } |
534 | } else { | 537 | } else { |
535 | mSelStart = mSelInit; | 538 | mSelStart = mSelInit; |
536 | 539 | ||
537 | //repaint only if selection has changed | 540 | //repaint only if selection has changed |
538 | if (tmp != mSelEnd) { | 541 | if (tmp != mSelEnd) { |
539 | mSelEnd = tmp; | 542 | mSelEnd = tmp; |
540 | repaint(false); | 543 | repaint(false); |
541 | } | 544 | } |
542 | } | 545 | } |
543 | 546 | ||
544 | DateList daylist; | 547 | DateList daylist; |
545 | if ( mSelStart < 0 ) | 548 | if ( mSelStart < 0 ) |
546 | mSelStart = 0; | 549 | mSelStart = 0; |
547 | for (int i = mSelStart; i <= mSelEnd; i++) { | 550 | for (int i = mSelStart; i <= mSelEnd; i++) { |
548 | daylist.append(days[i]); | 551 | daylist.append(days[i]); |
549 | } | 552 | } |
550 | emit selected((const DateList)daylist); | 553 | emit selected((const DateList)daylist); |
551 | 554 | ||
552 | } | 555 | } |
553 | 556 | ||
554 | void KODayMatrix::mouseMoveEvent (QMouseEvent* e) | 557 | void KODayMatrix::mouseMoveEvent (QMouseEvent* e) |
555 | { | 558 | { |
556 | if ( ! mouseDown ) { | 559 | if ( ! mouseDown ) { |
557 | return; | 560 | return; |
558 | } | 561 | } |
562 | mRedrawNeeded = true; | ||
559 | int tmp = getDayIndexFrom(e->x(), e->y()); | 563 | int tmp = getDayIndexFrom(e->x(), e->y()); |
560 | if (tmp > NUMDAYS-1) tmp=NUMDAYS-1; | 564 | if (tmp > NUMDAYS-1) tmp=NUMDAYS-1; |
561 | 565 | ||
562 | if (mSelInit > tmp) { | 566 | if (mSelInit > tmp) { |
563 | mSelEnd = mSelInit; | 567 | mSelEnd = mSelInit; |
564 | if (tmp != mSelStart) { | 568 | if (tmp != mSelStart) { |
565 | mSelStart = tmp; | 569 | mSelStart = tmp; |
566 | repaint(false); | 570 | repaint(false); |
567 | } | 571 | } |
568 | } else { | 572 | } else { |
569 | mSelStart = mSelInit; | 573 | mSelStart = mSelInit; |
570 | 574 | ||
571 | //repaint only if selection has changed | 575 | //repaint only if selection has changed |
572 | if (tmp != mSelEnd) { | 576 | if (tmp != mSelEnd) { |
573 | mSelEnd = tmp; | 577 | mSelEnd = tmp; |
574 | repaint(false); | 578 | repaint(false); |
575 | } | 579 | } |
576 | } | 580 | } |
577 | } | 581 | } |
578 | 582 | ||
579 | // ---------------------------------------------------------------------------- | 583 | // ---------------------------------------------------------------------------- |
580 | // D R A G ' N D R O P H A N D L I N G | 584 | // D R A G ' N D R O P H A N D L I N G |
581 | // ---------------------------------------------------------------------------- | 585 | // ---------------------------------------------------------------------------- |
582 | 586 | ||
583 | void KODayMatrix::dragEnterEvent(QDragEnterEvent *e) | 587 | void KODayMatrix::dragEnterEvent(QDragEnterEvent *e) |
584 | { | 588 | { |
585 | #ifndef KORG_NODND | 589 | #ifndef KORG_NODND |
586 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) ) { | 590 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) ) { |
587 | e->ignore(); | 591 | e->ignore(); |
588 | return; | 592 | return; |
589 | } | 593 | } |
590 | 594 | ||
591 | // some visual feedback | 595 | // some visual feedback |
592 | // oldPalette = palette(); | 596 | // oldPalette = palette(); |
593 | // setPalette(my_HilitePalette); | 597 | // setPalette(my_HilitePalette); |
594 | // update(); | 598 | // update(); |
595 | #endif | 599 | #endif |
596 | } | 600 | } |
597 | 601 | ||
598 | void KODayMatrix::dragMoveEvent(QDragMoveEvent *e) | 602 | void KODayMatrix::dragMoveEvent(QDragMoveEvent *e) |
599 | { | 603 | { |
600 | #ifndef KORG_NODND | 604 | #ifndef KORG_NODND |
601 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) ) { | 605 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) ) { |
602 | e->ignore(); | 606 | e->ignore(); |
603 | return; | 607 | return; |
604 | } | 608 | } |
605 | 609 | ||
606 | e->accept(); | 610 | e->accept(); |
607 | #endif | 611 | #endif |
608 | } | 612 | } |
609 | 613 | ||
610 | void KODayMatrix::dragLeaveEvent(QDragLeaveEvent */*dl*/) | 614 | void KODayMatrix::dragLeaveEvent(QDragLeaveEvent */*dl*/) |
611 | { | 615 | { |
612 | #ifndef KORG_NODND | 616 | #ifndef KORG_NODND |
613 | // setPalette(oldPalette); | 617 | // setPalette(oldPalette); |
614 | // update(); | 618 | // update(); |
615 | #endif | 619 | #endif |
616 | } | 620 | } |
617 | 621 | ||
618 | void KODayMatrix::dropEvent(QDropEvent *e) | 622 | void KODayMatrix::dropEvent(QDropEvent *e) |
619 | { | 623 | { |
620 | #ifndef KORG_NODND | 624 | #ifndef KORG_NODND |
621 | // kdDebug() << "KODayMatrix::dropEvent(e) begin" << endl; | 625 | // kdDebug() << "KODayMatrix::dropEvent(e) begin" << endl; |
622 | 626 | ||
623 | if (!mCalendar || !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) ) { | 627 | if (!mCalendar || !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) ) { |
624 | e->ignore(); | 628 | e->ignore(); |
625 | return; | 629 | return; |
626 | } | 630 | } |
627 | 631 | ||
628 | DndFactory factory( mCalendar ); | 632 | DndFactory factory( mCalendar ); |
629 | Event *event = factory.createDrop(e); | 633 | Event *event = factory.createDrop(e); |
630 | 634 | ||
631 | if (event) { | 635 | if (event) { |
632 | e->acceptAction(); | 636 | e->acceptAction(); |
633 | 637 | ||
634 | Event *existingEvent = mCalendar->event(event->uid()); | 638 | Event *existingEvent = mCalendar->event(event->uid()); |
635 | 639 | ||
636 | if(existingEvent) { | 640 | if(existingEvent) { |
637 | // uniquify event | 641 | // uniquify event |
638 | event->recreate(); | 642 | event->recreate(); |
639 | /* | 643 | /* |
640 | KMessageBox::sorry(this, | 644 | KMessageBox::sorry(this, |
641 | i18n("Event already exists in this calendar."), | 645 | i18n("Event already exists in this calendar."), |
642 | i18n("Drop Event")); | 646 | i18n("Drop Event")); |
643 | delete event; | 647 | delete event; |
644 | return; | 648 | return; |
645 | */ | 649 | */ |
646 | } | 650 | } |
647 | // kdDebug() << "Drop new Event" << endl; | 651 | // kdDebug() << "Drop new Event" << endl; |
648 | // Adjust date | 652 | // Adjust date |
649 | QDateTime start = event->dtStart(); | 653 | QDateTime start = event->dtStart(); |
650 | QDateTime end = event->dtEnd(); | 654 | QDateTime end = event->dtEnd(); |
651 | int duration = start.daysTo(end); | 655 | int duration = start.daysTo(end); |
652 | int idx = getDayIndexFrom(e->pos().x(), e->pos().y()); | 656 | int idx = getDayIndexFrom(e->pos().x(), e->pos().y()); |
653 | 657 | ||
654 | start.setDate(days[idx]); | 658 | start.setDate(days[idx]); |
655 | end.setDate(days[idx].addDays(duration)); | 659 | end.setDate(days[idx].addDays(duration)); |
656 | 660 | ||
657 | event->setDtStart(start); | 661 | event->setDtStart(start); |
658 | event->setDtEnd(end); | 662 | event->setDtEnd(end); |
659 | mCalendar->addEvent(event); | 663 | mCalendar->addEvent(event); |
660 | 664 | ||
661 | emit eventDropped(event); | 665 | emit eventDropped(event); |
662 | } else { | 666 | } else { |
663 | // kdDebug() << "KODayMatrix::dropEvent(): Event from drop not decodable" << endl; | 667 | // kdDebug() << "KODayMatrix::dropEvent(): Event from drop not decodable" << endl; |
664 | e->ignore(); | 668 | e->ignore(); |
665 | } | 669 | } |
666 | #endif | 670 | #endif |
667 | } | 671 | } |
668 | 672 | ||
669 | // ---------------------------------------------------------------------------- | 673 | // ---------------------------------------------------------------------------- |
670 | // P A I N T E V E N T H A N D L I N G | 674 | // P A I N T E V E N T H A N D L I N G |
671 | // ---------------------------------------------------------------------------- | 675 | // ---------------------------------------------------------------------------- |
672 | 676 | ||
673 | void KODayMatrix::paintEvent(QPaintEvent * pevent) | 677 | void KODayMatrix::paintEvent(QPaintEvent * pevent) |
674 | { | 678 | { |
675 | 679 | ||
676 | if ( width() <= 0 || height() <= 0 ) | 680 | if ( width() <= 0 || height() <= 0 ) |
677 | return; | 681 | return; |
678 | if ( mPendingUpdateBeforeRepaint ) { | 682 | if ( mPendingUpdateBeforeRepaint ) { |
679 | updateViewTimed(); | 683 | updateViewTimed(); |
680 | mPendingUpdateBeforeRepaint = false; | 684 | mPendingUpdateBeforeRepaint = false; |
681 | } | 685 | } |
682 | if ( myPix.width() != width() || myPix.height()!=height() ) { | 686 | if ( myPix.width() != width() || myPix.height()!=height() ) { |
683 | myPix.resize(size() ); | 687 | myPix.resize(size() ); |
684 | mRedrawNeeded = true; | 688 | mRedrawNeeded = true; |
685 | } | 689 | } |
686 | 690 | ||
687 | if ( mRedrawNeeded ) { | 691 | if ( mRedrawNeeded ) { |
688 | //qDebug("REDRAW "); | 692 | //qDebug("REDRAW "); |
689 | QPainter p(&myPix); | 693 | QPainter p(&myPix); |
690 | p.setFont(font()); | 694 | p.setFont(font()); |
691 | 695 | ||
692 | 696 | ||
693 | int dheight = daysize.height(); | 697 | int dheight = daysize.height(); |
694 | int dwidth = daysize.width(); | 698 | int dwidth = daysize.width(); |
695 | int row,col; | 699 | int row,col; |
696 | int selw, selh; | 700 | int selw, selh; |
697 | int xyOff = frameWidth(); | 701 | int xyOff = frameWidth(); |
698 | int colModulo = (width()-2) % 7; | 702 | int colModulo = (width()-2) % 7; |
699 | int rowModulo = (height()-2) % 6; | 703 | int rowModulo = (height()-2) % 6; |
700 | //qDebug("col %d row %d ",colModulo,rowModulo ); | 704 | //qDebug("col %d row %d ",colModulo,rowModulo ); |
701 | 705 | ||
702 | bool isRTL = KOGlobals::self()->reverseLayout(); | 706 | bool isRTL = KOGlobals::self()->reverseLayout(); |
703 | 707 | ||
704 | // draw background and topleft frame | 708 | // draw background and topleft frame |
705 | p.fillRect(0,0,width(),height(), mDefaultBackColor); | 709 | p.fillRect(0,0,width(),height(), mDefaultBackColor); |
706 | p.setPen(mDefaultTextColor); | 710 | p.setPen(mDefaultTextColor); |
707 | p.drawRect(0, 0, width(), height()); | 711 | p.drawRect(0, 0, width(), height()); |
708 | int mSelStartT = mSelStart; | 712 | int mSelStartT = mSelStart; |
709 | int mSelEndT = mSelEnd; | 713 | int mSelEndT = mSelEnd; |
710 | if ( mSelEndT >= NUMDAYS ) | 714 | if ( mSelEndT >= NUMDAYS ) |
711 | mSelEndT = NUMDAYS-1; | 715 | mSelEndT = NUMDAYS-1; |
712 | // draw selected days with highlighted background color | 716 | // draw selected days with highlighted background color |
713 | if (mSelStart != NOSELECTION) { | 717 | if (mSelStart != NOSELECTION) { |
714 | bool skip = false; | 718 | bool skip = false; |
715 | if ( ! mouseDown ) { | 719 | if ( ! mouseDown ) { |
716 | int mo = days[20].month(); | 720 | int mo = days[20].month(); |
717 | //qDebug("-- %d %d ", mSelStartT, mSelEndT); | 721 | //qDebug("-- %d %d ", mSelStartT, mSelEndT); |
718 | //qDebug("%d %d %d - d %d", mo, days[mSelStartT].month() , days[mSelEndT].month(), days[mSelEndT].day() ); | 722 | //qDebug("%d %d %d - d %d", mo, days[mSelStartT].month() , days[mSelEndT].month(), days[mSelEndT].day() ); |
719 | int startMo = days[mSelStartT].month(); | 723 | int startMo = days[mSelStartT].month(); |
720 | int endMo = days[mSelEndT].month(); | 724 | int endMo = days[mSelEndT].month(); |
721 | if ( startMo == 12 && mo == 1 && endMo <= 2 ) | 725 | if ( startMo == 12 && mo == 1 && endMo <= 2 ) |
722 | startMo = 1; | 726 | startMo = 1; |
723 | if ( endMo == 1 && mo == 12 ) | 727 | if ( endMo == 1 && mo == 12 ) |
724 | endMo = 12; | 728 | endMo = 12; |
725 | if ( mo == 12 && startMo == 1 ) | 729 | if ( mo == 12 && startMo == 1 ) |
726 | startMo = 13; | 730 | startMo = 13; |
727 | if ( (startMo > mo || endMo < mo) ) { | 731 | if ( (startMo > mo || endMo < mo) ) { |
728 | skip = true; | 732 | skip = true; |
729 | } else { | 733 | } else { |
730 | if ( days[mSelStartT].month() != mo ) { | 734 | if ( days[mSelStartT].month() != mo ) { |
731 | int add = days[mSelStartT].daysInMonth ()-days[mSelStartT].day(); | 735 | int add = days[mSelStartT].daysInMonth ()-days[mSelStartT].day(); |
732 | mSelStartT += add +1; | 736 | mSelStartT += add +1; |
733 | } | 737 | } |
734 | if ( days[mSelEndT].month() != mo ) { | 738 | if ( days[mSelEndT].month() != mo ) { |
735 | int sub = days[mSelEndT].day(); | 739 | int sub = days[mSelEndT].day(); |
736 | mSelEndT -= sub ; | 740 | mSelEndT -= sub ; |
737 | } | 741 | } |
738 | } | 742 | } |
739 | } | 743 | } |
740 | //qDebug("SKIP %d ", skip); | 744 | //qDebug("SKIP %d ", skip); |
741 | if ( ! skip ) { | 745 | if ( ! skip ) { |
742 | row = mSelStartT/7; | 746 | row = mSelStartT/7; |
743 | col = mSelStartT -row*7; | 747 | col = mSelStartT -row*7; |
744 | QColor selcol = KOPrefs::instance()->mHighlightColor; | 748 | QColor selcol = KOPrefs::instance()->mHighlightColor; |
745 | int addCol = 0; | 749 | int addCol = 0; |
746 | int addRow = 0; | 750 | int addRow = 0; |
747 | int addRow2 = 0; | 751 | int addRow2 = 0; |
748 | int addCol2 = 0; | 752 | int addCol2 = 0; |
749 | if (row == mSelEndT/7) { | 753 | if (row == mSelEndT/7) { |
750 | if ( rowModulo ) { | 754 | if ( rowModulo ) { |
751 | if ( row >= 6 - rowModulo ) | 755 | if ( row >= 6 - rowModulo ) |
752 | addRow = row - 5 + rowModulo; | 756 | addRow = row - 5 + rowModulo; |
753 | } | 757 | } |
754 | if ( colModulo ) { | 758 | if ( colModulo ) { |
755 | int colt1 = mSelEndT%7; | 759 | int colt1 = mSelEndT%7; |
756 | //qDebug("colt1 %d ", colt1 ); | 760 | //qDebug("colt1 %d ", colt1 ); |
757 | if ( colt1 >= 7 - colModulo ) | 761 | if ( colt1 >= 7 - colModulo ) |
758 | addCol = colt1 - 7 + colModulo+1; | 762 | addCol = colt1 - 7 + colModulo+1; |
759 | int colt = mSelStartT%7; | 763 | int colt = mSelStartT%7; |
760 | if ( colt >= 7 - colModulo ) | 764 | if ( colt >= 7 - colModulo ) |
761 | addCol2 = colt - 7 + colModulo; | 765 | addCol2 = colt - 7 + colModulo; |
762 | addCol -= addCol2; | 766 | addCol -= addCol2; |
763 | //qDebug("COL %d %d %d %d ",col , colt1 ,addCol ,addCol2 ); | 767 | //qDebug("COL %d %d %d %d ",col , colt1 ,addCol ,addCol2 ); |
764 | } | 768 | } |
765 | // Single row selection | 769 | // Single row selection |
766 | if ( row == 0) | 770 | if ( row == 0) |
767 | addRow = 1; | 771 | addRow = 1; |
768 | p.fillRect(isRTL ? (7 - (mSelEndT-mSelStartT+1) - col)*dwidth : col*dwidth+1+addCol2, | 772 | p.fillRect(isRTL ? (7 - (mSelEndT-mSelStartT+1) - col)*dwidth : col*dwidth+1+addCol2, |
769 | row*dheight+addRow, (mSelEndT-mSelStartT+1)*dwidth+addCol, dheight+1, selcol); | 773 | row*dheight+addRow, (mSelEndT-mSelStartT+1)*dwidth+addCol, dheight+1, selcol); |
770 | } else { | 774 | } else { |
771 | // draw first row to the right | 775 | // draw first row to the right |
772 | if ( colModulo ) { | 776 | if ( colModulo ) { |
773 | if ( col >= 7 - colModulo ) | 777 | if ( col >= 7 - colModulo ) |
774 | addCol2 = col - 7 + colModulo; | 778 | addCol2 = col - 7 + colModulo; |
775 | } | 779 | } |
776 | if ( rowModulo ) { | 780 | if ( rowModulo ) { |
777 | if ( row >= 6 - rowModulo ) | 781 | if ( row >= 6 - rowModulo ) |
778 | addRow = row - 5 + rowModulo; | 782 | addRow = row - 5 + rowModulo; |
779 | } | 783 | } |
780 | if ( row == 0) | 784 | if ( row == 0) |
781 | addRow = 1; | 785 | addRow = 1; |
782 | int drawWid = width()-(col*dwidth+1+addCol2)-1; | 786 | int drawWid = width()-(col*dwidth+1+addCol2)-1; |
783 | p.fillRect(isRTL ? 0 : col*dwidth+1+addCol2, row*dheight+addRow, drawWid, | 787 | p.fillRect(isRTL ? 0 : col*dwidth+1+addCol2, row*dheight+addRow, drawWid, |
784 | dheight+1, selcol); | 788 | dheight+1, selcol); |
785 | // draw full block till last line | 789 | // draw full block till last line |
786 | selh = mSelEndT/7-row; | 790 | selh = mSelEndT/7-row; |
787 | addRow = 0; | 791 | addRow = 0; |
788 | if ( rowModulo ) { | 792 | if ( rowModulo ) { |
789 | if ( mSelEndT/7 >= 6 - rowModulo ) | 793 | if ( mSelEndT/7 >= 6 - rowModulo ) |
790 | addRow = mSelEndT/7 - 5 + rowModulo; | 794 | addRow = mSelEndT/7 - 5 + rowModulo; |
791 | } | 795 | } |
792 | if (selh > 1) { | 796 | if (selh > 1) { |
793 | p.fillRect(1, (row+1)*dheight, 7*dwidth+colModulo, (selh-1)*dheight+addRow,selcol); | 797 | p.fillRect(1, (row+1)*dheight, 7*dwidth+colModulo, (selh-1)*dheight+addRow,selcol); |
794 | } | 798 | } |
795 | // draw last block from left to mSelEndT | 799 | // draw last block from left to mSelEndT |
796 | selw = mSelEndT-7*(mSelEndT/7)+1; | 800 | selw = mSelEndT-7*(mSelEndT/7)+1; |
797 | //qDebug("esl %d ",selw ); | 801 | //qDebug("esl %d ",selw ); |
798 | int add = 0; | 802 | int add = 0; |
799 | if ( colModulo ) { | 803 | if ( colModulo ) { |
800 | add = 7 - colModulo; | 804 | add = 7 - colModulo; |
801 | if ( selw > add ) | 805 | if ( selw > add ) |
802 | add = selw - add; | 806 | add = selw - add; |
803 | else | 807 | else |
804 | add = 0; | 808 | add = 0; |
805 | } | 809 | } |
806 | //qDebug("add %d ", add); | 810 | //qDebug("add %d ", add); |
807 | p.fillRect(isRTL ? (7-selw)*dwidth : 1, (row+selh)*dheight+addRow, | 811 | p.fillRect(isRTL ? (7-selw)*dwidth : 1, (row+selh)*dheight+addRow, |
808 | selw*dwidth+add, dheight+1, selcol); | 812 | selw*dwidth+add, dheight+1, selcol); |
809 | } | 813 | } |
810 | } | 814 | } |
811 | } | 815 | } |
812 | 816 | ||
813 | // iterate over all days in the matrix and draw the day label in appropriate colors | 817 | // iterate over all days in the matrix and draw the day label in appropriate colors |
814 | QColor actcol = mDefaultTextColorShaded; | 818 | QColor actcol = mDefaultTextColorShaded; |
815 | p.setPen(actcol); | 819 | p.setPen(actcol); |
816 | QPen tmppen; | 820 | QPen tmppen; |
817 | for(int i = 0; i < NUMDAYS; i++) { | 821 | for(int i = 0; i < NUMDAYS; i++) { |
818 | row = i/7; | 822 | row = i/7; |
819 | col = isRTL ? 6-(i-row*7) : i-row*7; | 823 | col = isRTL ? 6-(i-row*7) : i-row*7; |
820 | 824 | ||
821 | // if it is the first day of a month switch color from normal to shaded and vice versa | 825 | // if it is the first day of a month switch color from normal to shaded and vice versa |
822 | if ( KOGlobals::self()->calendarSystem()->day( days[i] ) == 1) { | 826 | if ( KOGlobals::self()->calendarSystem()->day( days[i] ) == 1) { |
823 | if (actcol == mDefaultTextColorShaded) { | 827 | if (actcol == mDefaultTextColorShaded) { |
824 | actcol = mDefaultTextColor; | 828 | actcol = mDefaultTextColor; |
825 | } else { | 829 | } else { |
826 | actcol = mDefaultTextColorShaded; | 830 | actcol = mDefaultTextColorShaded; |
827 | } | 831 | } |
828 | p.setPen(actcol); | 832 | p.setPen(actcol); |
829 | } | 833 | } |
830 | if (actcol == mDefaultTextColorShaded) { | 834 | if (actcol == mDefaultTextColorShaded) { |
831 | if ( ! mouseDown ) { | 835 | if ( ! mouseDown ) { |
832 | continue; | 836 | continue; |
833 | } | 837 | } |
834 | } | 838 | } |
835 | //Reset pen color after selected days block | 839 | //Reset pen color after selected days block |
836 | if (i == mSelEndT+1) { | 840 | if (i == mSelEndT+1) { |
837 | p.setPen(actcol); | 841 | p.setPen(actcol); |
838 | } | 842 | } |
839 | 843 | ||
840 | // if today then draw rectangle around day | 844 | // if today then draw rectangle around day |
841 | if (today == i) { | 845 | if (today == i) { |
842 | tmppen = p.pen(); | 846 | tmppen = p.pen(); |
843 | QPen mTodayPen(p.pen()); | 847 | QPen mTodayPen(p.pen()); |
844 | if ( daysize.width() < 20 ) | 848 | if ( daysize.width() < 20 ) |
845 | mTodayPen.setWidth(1); | 849 | mTodayPen.setWidth(1); |
846 | else | 850 | else |
847 | mTodayPen.setWidth(mTodayMarginWidth); | 851 | mTodayPen.setWidth(mTodayMarginWidth); |
848 | //draw red rectangle for holidays | 852 | //draw red rectangle for holidays |
849 | if (!mHolidays[i].isNull()) { | 853 | if (!mHolidays[i].isNull()) { |
850 | if (actcol == mDefaultTextColor) { | 854 | if (actcol == mDefaultTextColor) { |
851 | mTodayPen.setColor(KOPrefs::instance()->mHolidayColor); | 855 | mTodayPen.setColor(KOPrefs::instance()->mHolidayColor); |
852 | } else { | 856 | } else { |
853 | mTodayPen.setColor(mHolidayColorShaded); | 857 | mTodayPen.setColor(mHolidayColorShaded); |
854 | } | 858 | } |
855 | } | 859 | } |
856 | //draw gray rectangle for today if in selection | 860 | //draw gray rectangle for today if in selection |
857 | if (i >= mSelStartT && i <= mSelEndT) { | 861 | if (i >= mSelStartT && i <= mSelEndT) { |
858 | QColor grey("grey"); | 862 | QColor grey("grey"); |
859 | mTodayPen.setColor(grey); | 863 | mTodayPen.setColor(grey); |
860 | } | 864 | } |
861 | p.setPen(mTodayPen); | 865 | p.setPen(mTodayPen); |
862 | 866 | ||
863 | 867 | ||
864 | int addCol = 0; | 868 | int addCol = 0; |
865 | int addRow = 0; | 869 | int addRow = 0; |
866 | if (rowModulo) { | 870 | if (rowModulo) { |
867 | if ( row >= 6 - rowModulo ) | 871 | if ( row >= 6 - rowModulo ) |
868 | addRow = row - 5 + rowModulo; | 872 | addRow = row - 5 + rowModulo; |
869 | } | 873 | } |
870 | if ( colModulo ) { | 874 | if ( colModulo ) { |
871 | if ( col >= 7 - colModulo ) | 875 | if ( col >= 7 - colModulo ) |
872 | addCol = col - 6 + colModulo-1; | 876 | addCol = col - 6 + colModulo-1; |
873 | } | 877 | } |
874 | 878 | ||
875 | addCol += 1; | 879 | addCol += 1; |
876 | p.drawRect(col*dwidth+addCol, row*dheight+addRow, dwidth, dheight+1); | 880 | p.drawRect(col*dwidth+addCol, row*dheight+addRow, dwidth, dheight+1); |
877 | p.setPen(tmppen); | 881 | p.setPen(tmppen); |
878 | } | 882 | } |
879 | 883 | ||
880 | // if any events are on that day then draw it using a bold font | 884 | // if any events are on that day then draw it using a bold font |
881 | if ( eDays.testBit(i) ) { | 885 | if ( eDays.testBit(i) ) { |
882 | QFont myFont = font(); | 886 | QFont myFont = font(); |
883 | myFont.setBold(true); | 887 | myFont.setBold(true); |
884 | p.setFont(myFont); | 888 | p.setFont(myFont); |
885 | } | 889 | } |
886 | 890 | ||
887 | // if it is a holiday then use the default holiday color | 891 | // if it is a holiday then use the default holiday color |
888 | if ( !mHolidays[i].isNull()) { | 892 | if ( !mHolidays[i].isNull()) { |
889 | if ( bDays.testBit(i) ) { | 893 | if ( bDays.testBit(i) ) { |
890 | if ( hDays.testBit(i) ) | 894 | if ( hDays.testBit(i) ) |
891 | p.setPen(QColor(Qt::green)); | 895 | p.setPen(QColor(Qt::green)); |
892 | else | 896 | else |
893 | p.setPen(QColor(Qt::green).dark()); | 897 | p.setPen(QColor(Qt::green).dark()); |
894 | } else { | 898 | } else { |
895 | if (actcol == mDefaultTextColor ) { | 899 | if (actcol == mDefaultTextColor ) { |
896 | p.setPen(KOPrefs::instance()->mHolidayColor); | 900 | p.setPen(KOPrefs::instance()->mHolidayColor); |
897 | } else { | 901 | } else { |
898 | p.setPen(mHolidayColorShaded); | 902 | p.setPen(mHolidayColorShaded); |
899 | } | 903 | } |
900 | } | 904 | } |
901 | } | 905 | } |
902 | 906 | ||
903 | // draw selected days with special color | 907 | // draw selected days with special color |
904 | // DO NOT specially highlight holidays in selection ! | 908 | // DO NOT specially highlight holidays in selection ! |
905 | if (i >= mSelStartT && i <= mSelEndT) { | 909 | if (i >= mSelStartT && i <= mSelEndT) { |
906 | ;//p.setPen(mSelectedDaysColor); | 910 | ;//p.setPen(mSelectedDaysColor); |
907 | } | 911 | } |
908 | 912 | ||
909 | int addCol = 0; | 913 | int addCol = 0; |
910 | int addRow = 0; | 914 | int addRow = 0; |
911 | if ( colModulo ) { | 915 | if ( colModulo ) { |
912 | if ( col >= 7 - colModulo ) | 916 | if ( col >= 7 - colModulo ) |
913 | addCol = col - 7 + colModulo; | 917 | addCol = col - 7 + colModulo; |
914 | } | 918 | } |
915 | if ( rowModulo ) { | 919 | if ( rowModulo ) { |
916 | if ( row >= 6 - rowModulo ) | 920 | if ( row >= 6 - rowModulo ) |
917 | addRow = row - 5 + rowModulo; | 921 | addRow = row - 5 + rowModulo; |
918 | } | 922 | } |
919 | //qDebug("add %d %d -- %d %d ", col, addCol, row, addRow); | 923 | //qDebug("add %d %d -- %d %d ", col, addCol, row, addRow); |
920 | ++addCol;//++addCol; | 924 | ++addCol;//++addCol; |
921 | if ( row == 0) | 925 | if ( row == 0) |
922 | addRow = 1; | 926 | addRow = 1; |
923 | p.drawText(col*dwidth+addCol, row*dheight+addRow, dwidth, dheight, | 927 | p.drawText(col*dwidth+addCol, row*dheight+addRow, dwidth, dheight, |
924 | Qt::AlignHCenter | Qt::AlignVCenter, daylbls[i]); | 928 | Qt::AlignHCenter | Qt::AlignVCenter, daylbls[i]); |
925 | 929 | ||
926 | // reset color to actual color | 930 | // reset color to actual color |
927 | if (!mHolidays[i].isNull()) { | 931 | if (!mHolidays[i].isNull()) { |
928 | p.setPen(actcol); | 932 | p.setPen(actcol); |
929 | } | 933 | } |
930 | // reset bold font to plain font | 934 | // reset bold font to plain font |
931 | if ( eDays.testBit(i)) { | 935 | if ( eDays.testBit(i)) { |
932 | QFont myFont = font(); | 936 | QFont myFont = font(); |
933 | myFont.setBold(false); | 937 | myFont.setBold(false); |
934 | p.setFont(myFont); | 938 | p.setFont(myFont); |
935 | } | 939 | } |
936 | } | 940 | } |
937 | } else { | 941 | } else { |
938 | //qDebug("NO redraw "); | 942 | //qDebug("NO redraw "); |
939 | } | 943 | } |
940 | bitBlt (this, 0, 0, &myPix, 0 ,0,width(), height() ,CopyROP); | 944 | bitBlt (this, 0, 0, &myPix, 0 ,0,width(), height() ,CopyROP); |
941 | mRedrawNeeded = false; | 945 | mRedrawNeeded = false; |
942 | } | 946 | } |
diff --git a/korganizer/koeditordetails.cpp b/korganizer/koeditordetails.cpp index 2fd13bd..802261c 100644 --- a/korganizer/koeditordetails.cpp +++ b/korganizer/koeditordetails.cpp | |||
@@ -1,453 +1,454 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in thse hope that it will be useful, | 10 | This program is distributed in thse 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 <qtooltip.h> | 24 | #include <qtooltip.h> |
25 | #include <qfiledialog.h> | 25 | #include <qfiledialog.h> |
26 | #include <qlayout.h> | 26 | #include <qlayout.h> |
27 | #include <qvbox.h> | 27 | #include <qvbox.h> |
28 | #include <qbuttongroup.h> | 28 | #include <qbuttongroup.h> |
29 | #include <qvgroupbox.h> | 29 | #include <qvgroupbox.h> |
30 | #include <qwidgetstack.h> | 30 | #include <qwidgetstack.h> |
31 | #include <qdatetime.h> | 31 | #include <qdatetime.h> |
32 | #include <qapp.h> | 32 | #include <qapp.h> |
33 | 33 | ||
34 | #include <klocale.h> | 34 | #include <klocale.h> |
35 | #include <kglobal.h> | 35 | #include <kglobal.h> |
36 | #include <kiconloader.h> | 36 | #include <kiconloader.h> |
37 | #include <kstandarddirs.h> | 37 | #include <kstandarddirs.h> |
38 | #include <kmessagebox.h> | 38 | #include <kmessagebox.h> |
39 | #ifndef KORG_NOKABC | 39 | #ifndef KORG_NOKABC |
40 | 40 | ||
41 | #ifdef DESKTOP_VERSION | 41 | #ifdef DESKTOP_VERSION |
42 | #include <kabc/addresseedialog.h> | 42 | #include <kabc/addresseedialog.h> |
43 | #else //DESKTOP_VERSION | 43 | #else //DESKTOP_VERSION |
44 | #include <externalapphandler.h> | 44 | #include <externalapphandler.h> |
45 | #endif //DESKTOP_VERSION | 45 | #endif //DESKTOP_VERSION |
46 | 46 | ||
47 | #endif | 47 | #endif |
48 | 48 | ||
49 | #include <libkcal/incidence.h> | 49 | #include <libkcal/incidence.h> |
50 | 50 | ||
51 | #include "koprefs.h" | 51 | #include "koprefs.h" |
52 | 52 | ||
53 | #include "koeditordetails.h" | 53 | #include "koeditordetails.h" |
54 | 54 | ||
55 | template <> | 55 | template <> |
56 | CustomListViewItem<class Attendee *>::~CustomListViewItem() | 56 | CustomListViewItem<class Attendee *>::~CustomListViewItem() |
57 | { | 57 | { |
58 | delete mData; | 58 | delete mData; |
59 | } | 59 | } |
60 | 60 | ||
61 | template <> | 61 | template <> |
62 | void CustomListViewItem<class Attendee *>::updateItem() | 62 | void CustomListViewItem<class Attendee *>::updateItem() |
63 | { | 63 | { |
64 | setText(0,mData->name()); | 64 | setText(0,mData->name()); |
65 | setText(1,mData->email()); | 65 | setText(1,mData->email()); |
66 | setText(2,mData->roleStr()); | 66 | setText(2,mData->roleStr()); |
67 | setText(3,mData->statusStr()); | 67 | setText(3,mData->statusStr()); |
68 | if (mData->RSVP() && !mData->email().isEmpty()) | 68 | if (mData->RSVP() && !mData->email().isEmpty()) |
69 | setPixmap(4,SmallIcon("mailappt")); | 69 | setPixmap(4,SmallIcon("mailappt")); |
70 | else | 70 | else |
71 | setPixmap(4,SmallIcon("nomailappt")); | 71 | setPixmap(4,SmallIcon("nomailappt")); |
72 | } | 72 | } |
73 | 73 | ||
74 | 74 | ||
75 | KOEditorDetails::KOEditorDetails (int spacing,QWidget* parent,const char* name) | 75 | KOEditorDetails::KOEditorDetails (int spacing,QWidget* parent,const char* name) |
76 | : QWidget( parent, name), mDisableItemUpdate( false ) | 76 | : QWidget( parent, name), mDisableItemUpdate( false ) |
77 | { | 77 | { |
78 | QGridLayout *topLayout = new QGridLayout(this); | 78 | QGridLayout *topLayout = new QGridLayout(this); |
79 | topLayout->setSpacing(spacing); | 79 | topLayout->setSpacing(spacing); |
80 | 80 | ||
81 | QString organizer = KOPrefs::instance()->email(); | 81 | QString organizer = KOPrefs::instance()->email(); |
82 | mOrganizerLabel = new QLabel(i18n("Organizer: %1").arg(organizer),this); | 82 | mOrganizerLabel = new QLabel(i18n("Organizer: %1").arg(organizer),this); |
83 | 83 | ||
84 | mListView = new KListView(this,"mListView"); | 84 | mListView = new KListView(this,"mListView"); |
85 | mListView->addColumn(i18n("Name"),180); | 85 | mListView->addColumn(i18n("Name"),180); |
86 | mListView->addColumn(i18n("Email"),180); | 86 | mListView->addColumn(i18n("Email"),180); |
87 | mListView->addColumn(i18n("Role"),60); | 87 | mListView->addColumn(i18n("Role"),60); |
88 | mListView->addColumn(i18n("Status"),100); | 88 | mListView->addColumn(i18n("Status"),100); |
89 | mListView->addColumn(i18n("RSVP"),35); | 89 | mListView->addColumn(i18n("RSVP"),35); |
90 | if ( KOPrefs::instance()->mCompactDialogs ) { | 90 | if ( QApplication::desktop()->width() <= 320 ) { |
91 | //mListView->setFixedHeight(78); | 91 | //mListView->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding) ); |
92 | mListView->setFixedHeight(80); | ||
92 | } | 93 | } |
93 | mListView->setAllColumnsShowFocus (true ); | 94 | mListView->setAllColumnsShowFocus (true ); |
94 | //mListView->setSingleClick( true ); | 95 | //mListView->setSingleClick( true ); |
95 | connect(mListView,SIGNAL(selectionChanged(QListViewItem *)), | 96 | connect(mListView,SIGNAL(selectionChanged(QListViewItem *)), |
96 | SLOT(updateAttendeeInput())); | 97 | SLOT(updateAttendeeInput())); |
97 | 98 | ||
98 | connect(mListView,SIGNAL(executed(QListViewItem * ,const QPoint&, int )), | 99 | connect(mListView,SIGNAL(executed(QListViewItem * ,const QPoint&, int )), |
99 | SLOT(itemClicked(QListViewItem * ,const QPoint& , int ))); | 100 | SLOT(itemClicked(QListViewItem * ,const QPoint& , int ))); |
100 | 101 | ||
101 | mRsvpButton = new QCheckBox(this); | 102 | mRsvpButton = new QCheckBox(this); |
102 | mRsvpButton->setText(i18n("Request response")); | 103 | mRsvpButton->setText(i18n("Request response")); |
103 | mAddressBookButton = new QPushButton(i18n("Address &Book..."),this); | 104 | mAddressBookButton = new QPushButton(i18n("Address &Book..."),this); |
104 | QLabel *attendeeLabel = new QLabel(this); | 105 | QLabel *attendeeLabel = new QLabel(this); |
105 | attendeeLabel->setText(i18n("Name:")); | 106 | attendeeLabel->setText(i18n("Name:")); |
106 | attendeeLabel->setFixedSize( attendeeLabel->sizeHint() ); | 107 | attendeeLabel->setFixedSize( attendeeLabel->sizeHint() ); |
107 | mNameEdit = new QLineEdit(this); | 108 | mNameEdit = new QLineEdit(this); |
108 | connect(mNameEdit,SIGNAL(textChanged(const QString &)), | 109 | connect(mNameEdit,SIGNAL(textChanged(const QString &)), |
109 | SLOT(updateAttendeeItem())); | 110 | SLOT(updateAttendeeItem())); |
110 | 111 | ||
111 | mUidEdit = new QLineEdit(0); | 112 | mUidEdit = new QLineEdit(0); |
112 | mUidEdit->setText(""); | 113 | mUidEdit->setText(""); |
113 | 114 | ||
114 | QLabel *emailLabel = new QLabel(this); | 115 | QLabel *emailLabel = new QLabel(this); |
115 | emailLabel->setText(i18n("Email:")); | 116 | emailLabel->setText(i18n("Email:")); |
116 | mEmailEdit = new QLineEdit(this); | 117 | mEmailEdit = new QLineEdit(this); |
117 | connect(mEmailEdit,SIGNAL(textChanged(const QString &)), | 118 | connect(mEmailEdit,SIGNAL(textChanged(const QString &)), |
118 | SLOT(updateAttendeeItem())); | 119 | SLOT(updateAttendeeItem())); |
119 | 120 | ||
120 | QLabel *attendeeRoleLabel = new QLabel(this); | 121 | QLabel *attendeeRoleLabel = new QLabel(this); |
121 | attendeeRoleLabel->setText(i18n("Role:")); | 122 | attendeeRoleLabel->setText(i18n("Role:")); |
122 | mRoleCombo = new QComboBox(false,this); | 123 | mRoleCombo = new QComboBox(false,this); |
123 | mRoleCombo->insertStringList(Attendee::roleList()); | 124 | mRoleCombo->insertStringList(Attendee::roleList()); |
124 | connect(mRoleCombo,SIGNAL(activated(int)),SLOT(updateAttendeeItem())); | 125 | connect(mRoleCombo,SIGNAL(activated(int)),SLOT(updateAttendeeItem())); |
125 | 126 | ||
126 | QLabel *statusLabel = new QLabel(this); | 127 | QLabel *statusLabel = new QLabel(this); |
127 | statusLabel->setText( i18n("Status:") ); | 128 | statusLabel->setText( i18n("Status:") ); |
128 | 129 | ||
129 | mStatusCombo = new QComboBox(false,this); | 130 | mStatusCombo = new QComboBox(false,this); |
130 | mStatusCombo->insertStringList(Attendee::statusList()); | 131 | mStatusCombo->insertStringList(Attendee::statusList()); |
131 | connect(mStatusCombo,SIGNAL(activated(int)),SLOT(updateAttendeeItem())); | 132 | connect(mStatusCombo,SIGNAL(activated(int)),SLOT(updateAttendeeItem())); |
132 | 133 | ||
133 | 134 | ||
134 | connect(mRsvpButton,SIGNAL(clicked()),SLOT(updateAttendeeItem())); | 135 | connect(mRsvpButton,SIGNAL(clicked()),SLOT(updateAttendeeItem())); |
135 | QWidget *buttonBox = new QWidget(this); | 136 | QWidget *buttonBox = new QWidget(this); |
136 | QVBoxLayout *buttonLayout = new QVBoxLayout(buttonBox); | 137 | QVBoxLayout *buttonLayout = new QVBoxLayout(buttonBox); |
137 | 138 | ||
138 | QPushButton *newButton = new QPushButton(i18n("&New"),buttonBox); | 139 | QPushButton *newButton = new QPushButton(i18n("&New"),buttonBox); |
139 | buttonLayout->addWidget(newButton); | 140 | buttonLayout->addWidget(newButton); |
140 | connect(newButton,SIGNAL(clicked()),SLOT(addNewAttendee())); | 141 | connect(newButton,SIGNAL(clicked()),SLOT(addNewAttendee())); |
141 | 142 | ||
142 | mRemoveButton = new QPushButton(i18n("&Remove"),buttonBox); | 143 | mRemoveButton = new QPushButton(i18n("&Remove"),buttonBox); |
143 | buttonLayout->addWidget(mRemoveButton); | 144 | buttonLayout->addWidget(mRemoveButton); |
144 | connect(mRemoveButton, SIGNAL(clicked()),SLOT(removeAttendee())); | 145 | connect(mRemoveButton, SIGNAL(clicked()),SLOT(removeAttendee())); |
145 | 146 | ||
146 | // buttonLayout->addWidget(mAddressBookButton); | 147 | // buttonLayout->addWidget(mAddressBookButton); |
147 | connect(mAddressBookButton,SIGNAL(clicked()),SLOT(openAddressBook())); | 148 | connect(mAddressBookButton,SIGNAL(clicked()),SLOT(openAddressBook())); |
148 | //mRoleCombo->setFixedSize( mRoleCombo->sizeHint () ); | 149 | //mRoleCombo->setFixedSize( mRoleCombo->sizeHint () ); |
149 | 150 | ||
150 | if (qApp->desktop()->width() < 640 ) { | 151 | if (qApp->desktop()->width() < 640 ) { |
151 | if ( qApp->desktop()->width() < 300 ) | 152 | if ( qApp->desktop()->width() < 300 ) |
152 | topLayout->setSpacing(1); | 153 | topLayout->setSpacing(1); |
153 | ;//mListView->setFixedHeight(80); | 154 | ;//mListView->setFixedHeight(80); |
154 | topLayout->addMultiCellWidget(mOrganizerLabel,0,0,0,3); | 155 | topLayout->addMultiCellWidget(mOrganizerLabel,0,0,0,3); |
155 | topLayout->addMultiCellWidget(mListView,1,1,0,3); | 156 | topLayout->addMultiCellWidget(mListView,1,1,0,3); |
156 | topLayout->addWidget(attendeeLabel,3,0); | 157 | topLayout->addWidget(attendeeLabel,3,0); |
157 | topLayout->addMultiCellWidget(mNameEdit,3,3,1,2); | 158 | topLayout->addMultiCellWidget(mNameEdit,3,3,1,2); |
158 | topLayout->addWidget(emailLabel,4,0); | 159 | topLayout->addWidget(emailLabel,4,0); |
159 | topLayout->addMultiCellWidget(mEmailEdit,4,4,1,2); | 160 | topLayout->addMultiCellWidget(mEmailEdit,4,4,1,2); |
160 | topLayout->addWidget(attendeeRoleLabel,5,0); | 161 | topLayout->addWidget(attendeeRoleLabel,5,0); |
161 | topLayout->addMultiCellWidget(mRoleCombo,5,5,1,3); | 162 | topLayout->addMultiCellWidget(mRoleCombo,5,5,1,3); |
162 | topLayout->addWidget(statusLabel,6,0); | 163 | topLayout->addWidget(statusLabel,6,0); |
163 | topLayout->addMultiCellWidget(mStatusCombo,6,6,1,3); | 164 | topLayout->addMultiCellWidget(mStatusCombo,6,6,1,3); |
164 | topLayout->addMultiCellWidget(mAddressBookButton,2,2,2,3); | 165 | topLayout->addMultiCellWidget(mAddressBookButton,2,2,2,3); |
165 | topLayout->addMultiCellWidget(mRsvpButton,2,2,0,1); | 166 | topLayout->addMultiCellWidget(mRsvpButton,2,2,0,1); |
166 | topLayout->addMultiCellWidget(buttonBox,3,4,3,3); | 167 | topLayout->addMultiCellWidget(buttonBox,3,4,3,3); |
167 | topLayout->setRowStretch(1,2); | 168 | topLayout->setRowStretch(1,2); |
168 | topLayout->setColStretch(0,0); | 169 | topLayout->setColStretch(0,0); |
169 | topLayout->setColStretch(1,2); | 170 | topLayout->setColStretch(1,2); |
170 | topLayout->setColStretch(2,1); | 171 | topLayout->setColStretch(2,1); |
171 | topLayout->setColStretch(3,1); | 172 | topLayout->setColStretch(3,1); |
172 | 173 | ||
173 | } else { | 174 | } else { |
174 | topLayout->addMultiCellWidget(mOrganizerLabel,0,0,0,5); | 175 | topLayout->addMultiCellWidget(mOrganizerLabel,0,0,0,5); |
175 | topLayout->addMultiCellWidget(mListView,1,1,0,5); | 176 | topLayout->addMultiCellWidget(mListView,1,1,0,5); |
176 | topLayout->addWidget(attendeeLabel,3,0); | 177 | topLayout->addWidget(attendeeLabel,3,0); |
177 | topLayout->addMultiCellWidget(mNameEdit,3,3,1,4); | 178 | topLayout->addMultiCellWidget(mNameEdit,3,3,1,4); |
178 | topLayout->addWidget(emailLabel,4,0); | 179 | topLayout->addWidget(emailLabel,4,0); |
179 | topLayout->addMultiCellWidget(mEmailEdit,4,4,1,4); | 180 | topLayout->addMultiCellWidget(mEmailEdit,4,4,1,4); |
180 | topLayout->addWidget(attendeeRoleLabel,5,0); | 181 | topLayout->addWidget(attendeeRoleLabel,5,0); |
181 | topLayout->addMultiCellWidget(mRoleCombo,5,5,1,2); | 182 | topLayout->addMultiCellWidget(mRoleCombo,5,5,1,2); |
182 | topLayout->addWidget(statusLabel,5,3); | 183 | topLayout->addWidget(statusLabel,5,3); |
183 | topLayout->addMultiCellWidget(mStatusCombo,5,5,4,5); | 184 | topLayout->addMultiCellWidget(mStatusCombo,5,5,4,5); |
184 | topLayout->addMultiCellWidget(mAddressBookButton,2,2,4,5); | 185 | topLayout->addMultiCellWidget(mAddressBookButton,2,2,4,5); |
185 | topLayout->addMultiCellWidget(mRsvpButton,2,2,0,1); | 186 | topLayout->addMultiCellWidget(mRsvpButton,2,2,0,1); |
186 | topLayout->addMultiCellWidget(buttonBox,3,4,5,5); | 187 | topLayout->addMultiCellWidget(buttonBox,3,4,5,5); |
187 | topLayout->setRowStretch(1,5); | 188 | topLayout->setRowStretch(1,5); |
188 | topLayout->setColStretch(0,0); | 189 | topLayout->setColStretch(0,0); |
189 | } | 190 | } |
190 | // #if 0 | 191 | // #if 0 |
191 | // topLayout->setColStretch(2,1); | 192 | // topLayout->setColStretch(2,1); |
192 | // topLayout->addWidget(statusLabel,3,3); | 193 | // topLayout->addWidget(statusLabel,3,3); |
193 | // topLayout->addWidget(mStatusCombo,3,4); | 194 | // topLayout->addWidget(mStatusCombo,3,4); |
194 | // #else | 195 | // #else |
195 | // topLayout->addWidget(statusLabel,4,3); | 196 | // topLayout->addWidget(statusLabel,4,3); |
196 | // // topLayout->addWidget(mStatusCombo,4,3); | 197 | // // topLayout->addWidget(mStatusCombo,4,3); |
197 | // topLayout->addMultiCellWidget(mStatusCombo,4,4,4,5); | 198 | // topLayout->addMultiCellWidget(mStatusCombo,4,4,4,5); |
198 | 199 | ||
199 | // #endif | 200 | // #endif |
200 | // // topLayout->setRowStretch(5,1); | 201 | // // topLayout->setRowStretch(5,1); |
201 | // topLayout->addMultiCellWidget(mRsvpButton,5,5,0,1); | 202 | // topLayout->addMultiCellWidget(mRsvpButton,5,5,0,1); |
202 | // topLayout->addMultiCellWidget(buttonBox,2,3,5,5); | 203 | // topLayout->addMultiCellWidget(buttonBox,2,3,5,5); |
203 | // topLayout->setRowStretch(1,5); | 204 | // topLayout->setRowStretch(1,5); |
204 | // topLayout->setColStretch(0,0); | 205 | // topLayout->setColStretch(0,0); |
205 | 206 | ||
206 | #ifdef KORG_NOKABC | 207 | #ifdef KORG_NOKABC |
207 | mAddressBookButton->hide(); | 208 | mAddressBookButton->hide(); |
208 | #endif | 209 | #endif |
209 | 210 | ||
210 | updateAttendeeInput(); | 211 | updateAttendeeInput(); |
211 | #ifndef DESKTOP_VERSION | 212 | #ifndef DESKTOP_VERSION |
212 | //US listen for arriving address resultsets | 213 | //US listen for arriving address resultsets |
213 | connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)), | 214 | connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)), |
214 | this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&))); | 215 | this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&))); |
215 | #endif | 216 | #endif |
216 | 217 | ||
217 | } | 218 | } |
218 | 219 | ||
219 | KOEditorDetails::~KOEditorDetails() | 220 | KOEditorDetails::~KOEditorDetails() |
220 | { | 221 | { |
221 | } | 222 | } |
222 | 223 | ||
223 | void KOEditorDetails::removeAttendee() | 224 | void KOEditorDetails::removeAttendee() |
224 | { | 225 | { |
225 | AttendeeListItem *aItem = (AttendeeListItem *)mListView->selectedItem(); | 226 | AttendeeListItem *aItem = (AttendeeListItem *)mListView->selectedItem(); |
226 | if (!aItem) return; | 227 | if (!aItem) return; |
227 | 228 | ||
228 | Attendee *delA = new Attendee(aItem->data()->name(),aItem->data()->email(), | 229 | Attendee *delA = new Attendee(aItem->data()->name(),aItem->data()->email(), |
229 | aItem->data()->RSVP(),aItem->data()->status(),aItem->data()->role(), | 230 | aItem->data()->RSVP(),aItem->data()->status(),aItem->data()->role(), |
230 | aItem->data()->uid()); | 231 | aItem->data()->uid()); |
231 | mdelAttendees.append(delA); | 232 | mdelAttendees.append(delA); |
232 | 233 | ||
233 | delete aItem; | 234 | delete aItem; |
234 | 235 | ||
235 | updateAttendeeInput(); | 236 | updateAttendeeInput(); |
236 | } | 237 | } |
237 | 238 | ||
238 | 239 | ||
239 | void KOEditorDetails::openAddressBook() | 240 | void KOEditorDetails::openAddressBook() |
240 | { | 241 | { |
241 | #ifndef KORG_NOKABC | 242 | #ifndef KORG_NOKABC |
242 | 243 | ||
243 | #ifdef DESKTOP_VERSION | 244 | #ifdef DESKTOP_VERSION |
244 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); | 245 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); |
245 | uint i=0; | 246 | uint i=0; |
246 | for (i=0; i < list.count(); i++) { | 247 | for (i=0; i < list.count(); i++) { |
247 | insertAttendee( new Attendee( list[i].realName(), list[i].preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,list[i].uid()) ); | 248 | insertAttendee( new Attendee( list[i].realName(), list[i].preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,list[i].uid()) ); |
248 | } | 249 | } |
249 | #else | 250 | #else |
250 | bool res = ExternalAppHandler::instance()->requestNameEmailUidListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); | 251 | bool res = ExternalAppHandler::instance()->requestNameEmailUidListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); |
251 | // the result should now arrive through method insertAttendees | 252 | // the result should now arrive through method insertAttendees |
252 | #endif | 253 | #endif |
253 | 254 | ||
254 | 255 | ||
255 | #if 0 | 256 | #if 0 |
256 | KABC::Addressee a = KABC::AddresseeDialog::getAddressee(this); | 257 | KABC::Addressee a = KABC::AddresseeDialog::getAddressee(this); |
257 | if (!a.isEmpty()) { | 258 | if (!a.isEmpty()) { |
258 | insertAttendee( new Attendee( a.realName(), a.preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,a.uid()) ); | 259 | insertAttendee( new Attendee( a.realName(), a.preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,a.uid()) ); |
259 | } | 260 | } |
260 | #endif | 261 | #endif |
261 | #endif | 262 | #endif |
262 | } | 263 | } |
263 | 264 | ||
264 | 265 | ||
265 | void KOEditorDetails::addNewAttendee() | 266 | void KOEditorDetails::addNewAttendee() |
266 | { | 267 | { |
267 | #if 0 | 268 | #if 0 |
268 | // this is cool. If they didn't enter an email address, | 269 | // this is cool. If they didn't enter an email address, |
269 | // try to look it up in the address book and fill it in for them. | 270 | // try to look it up in the address book and fill it in for them. |
270 | if (QString(mEmailEdit->text()).stripWhiteSpace().isEmpty()) { | 271 | if (QString(mEmailEdit->text()).stripWhiteSpace().isEmpty()) { |
271 | KabAPI addrBook; | 272 | KabAPI addrBook; |
272 | QString name; | 273 | QString name; |
273 | std::list<AddressBook::Entry> entries; | 274 | std::list<AddressBook::Entry> entries; |
274 | name = mNameEdit->text(); | 275 | name = mNameEdit->text(); |
275 | if (addrBook.init() == AddressBook::NoError) { | 276 | if (addrBook.init() == AddressBook::NoError) { |
276 | if (addrBook.getEntryByName(name, entries, 1) == AddressBook::NoError) { | 277 | if (addrBook.getEntryByName(name, entries, 1) == AddressBook::NoError) { |
277 | kdDebug() << "positive match" << endl; | 278 | kdDebug() << "positive match" << endl; |
278 | // take first email address | 279 | // take first email address |
279 | if (!entries.front().emails.isEmpty() && | 280 | if (!entries.front().emails.isEmpty() && |
280 | entries.front().emails.first().length()>0) | 281 | entries.front().emails.first().length()>0) |
281 | mEmailEdit->setText(entries.front().emails.first()); | 282 | mEmailEdit->setText(entries.front().emails.first()); |
282 | } | 283 | } |
283 | } | 284 | } |
284 | } | 285 | } |
285 | #endif | 286 | #endif |
286 | 287 | ||
287 | Attendee *a = new Attendee(i18n("(EmptyName)"),i18n("(EmptyEmail)")); | 288 | Attendee *a = new Attendee(i18n("(EmptyName)"),i18n("(EmptyEmail)")); |
288 | insertAttendee(a); | 289 | insertAttendee(a); |
289 | } | 290 | } |
290 | 291 | ||
291 | //the map includes name/email pairs, that comes from Ka/Pi | 292 | //the map includes name/email pairs, that comes from Ka/Pi |
292 | void KOEditorDetails::insertAttendees(const QString& uid,const QStringList& nameList,const QStringList& emailList,const QStringList& uidList) | 293 | void KOEditorDetails::insertAttendees(const QString& uid,const QStringList& nameList,const QStringList& emailList,const QStringList& uidList) |
293 | { | 294 | { |
294 | if (uid == this->name()) | 295 | if (uid == this->name()) |
295 | { | 296 | { |
296 | for ( int i = 0; i < nameList.count(); i++) | 297 | for ( int i = 0; i < nameList.count(); i++) |
297 | { | 298 | { |
298 | QString _name = nameList[i]; | 299 | QString _name = nameList[i]; |
299 | QString _email = emailList[i]; | 300 | QString _email = emailList[i]; |
300 | QString _uid = uidList[i]; | 301 | QString _uid = uidList[i]; |
301 | 302 | ||
302 | Attendee *a = new Attendee(_name,_email,false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant, _uid); | 303 | Attendee *a = new Attendee(_name,_email,false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant, _uid); |
303 | insertAttendee(a); | 304 | insertAttendee(a); |
304 | } | 305 | } |
305 | } | 306 | } |
306 | 307 | ||
307 | } | 308 | } |
308 | 309 | ||
309 | void KOEditorDetails::insertAttendee(Attendee *a) | 310 | void KOEditorDetails::insertAttendee(Attendee *a) |
310 | { | 311 | { |
311 | AttendeeListItem *first = (AttendeeListItem*) mListView->firstChild(); | 312 | AttendeeListItem *first = (AttendeeListItem*) mListView->firstChild(); |
312 | while (first) { | 313 | while (first) { |
313 | if ( first->data()->name() == a->name() && first->data()->email() == a->email() ) | 314 | if ( first->data()->name() == a->name() && first->data()->email() == a->email() ) |
314 | return; | 315 | return; |
315 | first = (AttendeeListItem*) first->nextSibling(); | 316 | first = (AttendeeListItem*) first->nextSibling(); |
316 | } | 317 | } |
317 | 318 | ||
318 | AttendeeListItem *item = new AttendeeListItem(a,mListView); | 319 | AttendeeListItem *item = new AttendeeListItem(a,mListView); |
319 | mListView->setSelected( item, true ); | 320 | mListView->setSelected( item, true ); |
320 | } | 321 | } |
321 | 322 | ||
322 | void KOEditorDetails::setDefaults() | 323 | void KOEditorDetails::setDefaults() |
323 | { | 324 | { |
324 | mRsvpButton->setChecked(true); | 325 | mRsvpButton->setChecked(true); |
325 | mListView->clear(); | 326 | mListView->clear(); |
326 | mdelAttendees.clear(); | 327 | mdelAttendees.clear(); |
327 | clearAttendeeInput(); | 328 | clearAttendeeInput(); |
328 | mOrganizerLabel->setText(i18n("Organizer: %1").arg(KOPrefs::instance()->email())); | 329 | mOrganizerLabel->setText(i18n("Organizer: %1").arg(KOPrefs::instance()->email())); |
329 | 330 | ||
330 | mNameEdit->setText(""); | 331 | mNameEdit->setText(""); |
331 | mUidEdit->setText(""); | 332 | mUidEdit->setText(""); |
332 | mEmailEdit->setText(""); | 333 | mEmailEdit->setText(""); |
333 | mRoleCombo->setCurrentItem( 0 ); | 334 | mRoleCombo->setCurrentItem( 0 ); |
334 | mStatusCombo->setCurrentItem( 0 ); | 335 | mStatusCombo->setCurrentItem( 0 ); |
335 | 336 | ||
336 | } | 337 | } |
337 | 338 | ||
338 | void KOEditorDetails::readEvent(Incidence *event) | 339 | void KOEditorDetails::readEvent(Incidence *event) |
339 | { | 340 | { |
340 | setDefaults(); | 341 | setDefaults(); |
341 | //mListView->clear(); | 342 | //mListView->clear(); |
342 | //mdelAttendees.clear(); | 343 | //mdelAttendees.clear(); |
343 | QPtrList<Attendee> tmpAList = event->attendees(); | 344 | QPtrList<Attendee> tmpAList = event->attendees(); |
344 | Attendee *a; | 345 | Attendee *a; |
345 | for (a = tmpAList.first(); a; a = tmpAList.next()) | 346 | for (a = tmpAList.first(); a; a = tmpAList.next()) |
346 | insertAttendee(new Attendee(*a)); | 347 | insertAttendee(new Attendee(*a)); |
347 | 348 | ||
348 | mListView->setSelected( mListView->firstChild(), true ); | 349 | mListView->setSelected( mListView->firstChild(), true ); |
349 | mOrganizerLabel->setText(i18n("Organizer: %1").arg(event->organizer())); | 350 | mOrganizerLabel->setText(i18n("Organizer: %1").arg(event->organizer())); |
350 | } | 351 | } |
351 | 352 | ||
352 | void KOEditorDetails::writeEvent(Incidence *event) | 353 | void KOEditorDetails::writeEvent(Incidence *event) |
353 | { | 354 | { |
354 | event->clearAttendees(); | 355 | event->clearAttendees(); |
355 | QListViewItem *item; | 356 | QListViewItem *item; |
356 | AttendeeListItem *a; | 357 | AttendeeListItem *a; |
357 | for (item = mListView->firstChild(); item; | 358 | for (item = mListView->firstChild(); item; |
358 | item = item->nextSibling()) { | 359 | item = item->nextSibling()) { |
359 | a = (AttendeeListItem *)item; | 360 | a = (AttendeeListItem *)item; |
360 | event->addAttendee(new Attendee(*(a->data()))); | 361 | event->addAttendee(new Attendee(*(a->data()))); |
361 | } | 362 | } |
362 | event->setOrganizer(KOPrefs::instance()->email()); | 363 | event->setOrganizer(KOPrefs::instance()->email()); |
363 | } | 364 | } |
364 | 365 | ||
365 | void KOEditorDetails::cancelAttendeeEvent(Incidence *event) | 366 | void KOEditorDetails::cancelAttendeeEvent(Incidence *event) |
366 | { | 367 | { |
367 | event->clearAttendees(); | 368 | event->clearAttendees(); |
368 | Attendee * att; | 369 | Attendee * att; |
369 | for (att=mdelAttendees.first();att;att=mdelAttendees.next()) { | 370 | for (att=mdelAttendees.first();att;att=mdelAttendees.next()) { |
370 | event->addAttendee(new Attendee(*att)); | 371 | event->addAttendee(new Attendee(*att)); |
371 | } | 372 | } |
372 | mdelAttendees.clear(); | 373 | mdelAttendees.clear(); |
373 | } | 374 | } |
374 | 375 | ||
375 | bool KOEditorDetails::validateInput() | 376 | bool KOEditorDetails::validateInput() |
376 | { | 377 | { |
377 | return true; | 378 | return true; |
378 | } | 379 | } |
379 | 380 | ||
380 | void KOEditorDetails::updateAttendeeInput() | 381 | void KOEditorDetails::updateAttendeeInput() |
381 | { | 382 | { |
382 | QListViewItem *item = mListView->selectedItem(); | 383 | QListViewItem *item = mListView->selectedItem(); |
383 | AttendeeListItem *aItem = static_cast<AttendeeListItem *>( item ); | 384 | AttendeeListItem *aItem = static_cast<AttendeeListItem *>( item ); |
384 | if (aItem) { | 385 | if (aItem) { |
385 | fillAttendeeInput( aItem ); | 386 | fillAttendeeInput( aItem ); |
386 | } else { | 387 | } else { |
387 | clearAttendeeInput(); | 388 | clearAttendeeInput(); |
388 | } | 389 | } |
389 | } | 390 | } |
390 | 391 | ||
391 | void KOEditorDetails::clearAttendeeInput() | 392 | void KOEditorDetails::clearAttendeeInput() |
392 | { | 393 | { |
393 | mNameEdit->setText(""); | 394 | mNameEdit->setText(""); |
394 | mUidEdit->setText(""); | 395 | mUidEdit->setText(""); |
395 | mEmailEdit->setText(""); | 396 | mEmailEdit->setText(""); |
396 | mRoleCombo->setCurrentItem(0); | 397 | mRoleCombo->setCurrentItem(0); |
397 | mStatusCombo->setCurrentItem(0); | 398 | mStatusCombo->setCurrentItem(0); |
398 | mRsvpButton->setChecked(true); | 399 | mRsvpButton->setChecked(true); |
399 | setEnabledAttendeeInput( false ); | 400 | setEnabledAttendeeInput( false ); |
400 | } | 401 | } |
401 | 402 | ||
402 | void KOEditorDetails::fillAttendeeInput( AttendeeListItem *aItem ) | 403 | void KOEditorDetails::fillAttendeeInput( AttendeeListItem *aItem ) |
403 | { | 404 | { |
404 | Attendee *a = aItem->data(); | 405 | Attendee *a = aItem->data(); |
405 | mDisableItemUpdate = true; | 406 | mDisableItemUpdate = true; |
406 | mNameEdit->setText(a->name()); | 407 | mNameEdit->setText(a->name()); |
407 | mUidEdit->setText(a->uid()); | 408 | mUidEdit->setText(a->uid()); |
408 | mEmailEdit->setText(a->email()); | 409 | mEmailEdit->setText(a->email()); |
409 | mRoleCombo->setCurrentItem(a->role()); | 410 | mRoleCombo->setCurrentItem(a->role()); |
410 | mStatusCombo->setCurrentItem(a->status()); | 411 | mStatusCombo->setCurrentItem(a->status()); |
411 | mRsvpButton->setChecked(a->RSVP()); | 412 | mRsvpButton->setChecked(a->RSVP()); |
412 | 413 | ||
413 | mDisableItemUpdate = false; | 414 | mDisableItemUpdate = false; |
414 | 415 | ||
415 | setEnabledAttendeeInput( true ); | 416 | setEnabledAttendeeInput( true ); |
416 | } | 417 | } |
417 | 418 | ||
418 | void KOEditorDetails::setEnabledAttendeeInput( bool enabled ) | 419 | void KOEditorDetails::setEnabledAttendeeInput( bool enabled ) |
419 | { | 420 | { |
420 | mNameEdit->setEnabled( enabled ); | 421 | mNameEdit->setEnabled( enabled ); |
421 | mEmailEdit->setEnabled( enabled ); | 422 | mEmailEdit->setEnabled( enabled ); |
422 | mRoleCombo->setEnabled( enabled ); | 423 | mRoleCombo->setEnabled( enabled ); |
423 | mStatusCombo->setEnabled( enabled ); | 424 | mStatusCombo->setEnabled( enabled ); |
424 | mRsvpButton->setEnabled( enabled ); | 425 | mRsvpButton->setEnabled( enabled ); |
425 | 426 | ||
426 | mRemoveButton->setEnabled( enabled ); | 427 | mRemoveButton->setEnabled( enabled ); |
427 | } | 428 | } |
428 | 429 | ||
429 | void KOEditorDetails::itemClicked(QListViewItem * item ,const QPoint & pnt, int c ) | 430 | void KOEditorDetails::itemClicked(QListViewItem * item ,const QPoint & pnt, int c ) |
430 | { | 431 | { |
431 | if ( item && c == 4 ) { | 432 | if ( item && c == 4 ) { |
432 | mRsvpButton->setChecked( !mRsvpButton->isChecked() ); | 433 | mRsvpButton->setChecked( !mRsvpButton->isChecked() ); |
433 | updateAttendeeItem(); | 434 | updateAttendeeItem(); |
434 | } | 435 | } |
435 | } | 436 | } |
436 | void KOEditorDetails::updateAttendeeItem() | 437 | void KOEditorDetails::updateAttendeeItem() |
437 | { | 438 | { |
438 | if (mDisableItemUpdate) return; | 439 | if (mDisableItemUpdate) return; |
439 | 440 | ||
440 | QListViewItem *item = mListView->selectedItem(); | 441 | QListViewItem *item = mListView->selectedItem(); |
441 | AttendeeListItem *aItem = static_cast<AttendeeListItem *>( item ); | 442 | AttendeeListItem *aItem = static_cast<AttendeeListItem *>( item ); |
442 | if ( !aItem ) return; | 443 | if ( !aItem ) return; |
443 | 444 | ||
444 | Attendee *a = aItem->data(); | 445 | Attendee *a = aItem->data(); |
445 | 446 | ||
446 | a->setName( mNameEdit->text() ); | 447 | a->setName( mNameEdit->text() ); |
447 | a->setUid( mUidEdit->text() ); | 448 | a->setUid( mUidEdit->text() ); |
448 | a->setEmail( mEmailEdit->text() ); | 449 | a->setEmail( mEmailEdit->text() ); |
449 | a->setRole( Attendee::Role( mRoleCombo->currentItem() ) ); | 450 | a->setRole( Attendee::Role( mRoleCombo->currentItem() ) ); |
450 | a->setStatus( Attendee::PartStat( mStatusCombo->currentItem() ) ); | 451 | a->setStatus( Attendee::PartStat( mStatusCombo->currentItem() ) ); |
451 | a->setRSVP( mRsvpButton->isChecked() ); | 452 | a->setRSVP( mRsvpButton->isChecked() ); |
452 | aItem->updateItem(); | 453 | aItem->updateItem(); |
453 | } | 454 | } |
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp index 97ab4e8..5879a2d 100644 --- a/korganizer/koprefs.cpp +++ b/korganizer/koprefs.cpp | |||
@@ -1,510 +1,511 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <time.h> | 24 | #include <time.h> |
25 | #ifndef _WIN32_ | 25 | #ifndef _WIN32_ |
26 | #include <unistd.h> | 26 | #include <unistd.h> |
27 | #endif | 27 | #endif |
28 | #include <qdir.h> | 28 | #include <qdir.h> |
29 | #include <qtextstream.h> | 29 | #include <qtextstream.h> |
30 | #include <qtextcodec.h> | 30 | #include <qtextcodec.h> |
31 | #include <qstring.h> | 31 | #include <qstring.h> |
32 | #include <qregexp.h> | 32 | #include <qregexp.h> |
33 | #include <qfont.h> | 33 | #include <qfont.h> |
34 | #include <qcolor.h> | 34 | #include <qcolor.h> |
35 | #include <qstringlist.h> | 35 | #include <qstringlist.h> |
36 | #include <stdlib.h> | 36 | #include <stdlib.h> |
37 | 37 | ||
38 | #include <kglobal.h> | 38 | #include <kglobal.h> |
39 | #include <kglobalsettings.h> | 39 | #include <kglobalsettings.h> |
40 | #include <kconfig.h> | 40 | #include <kconfig.h> |
41 | #include <klocale.h> | 41 | #include <klocale.h> |
42 | #include <kdebug.h> | 42 | #include <kdebug.h> |
43 | #include <kemailsettings.h> | 43 | #include <kemailsettings.h> |
44 | #include <kstaticdeleter.h> | 44 | #include <kstaticdeleter.h> |
45 | #include <libkdepim/kpimglobalprefs.h> | 45 | #include <libkdepim/kpimglobalprefs.h> |
46 | 46 | ||
47 | #include "koprefs.h" | 47 | #include "koprefs.h" |
48 | #include "mainwindow.h" | 48 | #include "mainwindow.h" |
49 | 49 | ||
50 | KOPrefs *KOPrefs::mInstance = 0; | 50 | KOPrefs *KOPrefs::mInstance = 0; |
51 | static KStaticDeleter<KOPrefs> insd; | 51 | static KStaticDeleter<KOPrefs> insd; |
52 | 52 | ||
53 | KOPrefs::KOPrefs() : | 53 | KOPrefs::KOPrefs() : |
54 | KPimPrefs("korganizerrc") | 54 | KPimPrefs("korganizerrc") |
55 | { | 55 | { |
56 | mCategoryColors.setAutoDelete(true); | 56 | mCategoryColors.setAutoDelete(true); |
57 | fillMailDefaults(); | 57 | fillMailDefaults(); |
58 | mDefaultCategoryColor = QColor(175,210,255);//196,196,196); | 58 | mDefaultCategoryColor = QColor(175,210,255);//196,196,196); |
59 | QColor defaultHolidayColor = QColor(255,0,0); | 59 | QColor defaultHolidayColor = QColor(255,0,0); |
60 | QColor defaultHighlightColor = QColor(129,112,255);//64,64,255); | 60 | QColor defaultHighlightColor = QColor(129,112,255);//64,64,255); |
61 | QColor defaultAgendaBgColor = QColor(239,241,169);//128,128,128); | 61 | QColor defaultAgendaBgColor = QColor(239,241,169);//128,128,128); |
62 | QColor defaultWorkingHoursColor = QColor(170,223,150);//160,160,160); | 62 | QColor defaultWorkingHoursColor = QColor(170,223,150);//160,160,160); |
63 | QColor defaultTodoDueTodayColor = QColor(255,220,100); | 63 | QColor defaultTodoDueTodayColor = QColor(255,220,100); |
64 | QColor defaultTodoOverdueColor = QColor(255,153,125); | 64 | QColor defaultTodoOverdueColor = QColor(255,153,125); |
65 | 65 | ||
66 | 66 | ||
67 | KPrefs::setCurrentGroup("General"); | 67 | KPrefs::setCurrentGroup("General"); |
68 | 68 | ||
69 | 69 | ||
70 | addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); | 70 | addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); |
71 | 71 | ||
72 | addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true); | 72 | addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true); |
73 | addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true); | 73 | addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true); |
74 | addItemBool("ShowIconSearch",&mShowIconSearch,true); | 74 | addItemBool("ShowIconSearch",&mShowIconSearch,true); |
75 | addItemBool("ShowIconList",&mShowIconList,true); | 75 | addItemBool("ShowIconList",&mShowIconList,true); |
76 | addItemBool("ShowIconDay1",&mShowIconDay1,true); | 76 | addItemBool("ShowIconDay1",&mShowIconDay1,true); |
77 | addItemBool("ShowIconDay5",&mShowIconDay5,true); | 77 | addItemBool("ShowIconDay5",&mShowIconDay5,true); |
78 | addItemBool("ShowIconDay6",&mShowIconDay6,true); | 78 | addItemBool("ShowIconDay6",&mShowIconDay6,true); |
79 | addItemBool("ShowIconDay7",&mShowIconDay7,true); | 79 | addItemBool("ShowIconDay7",&mShowIconDay7,true); |
80 | addItemBool("ShowIconMonth",&mShowIconMonth,true); | 80 | addItemBool("ShowIconMonth",&mShowIconMonth,true); |
81 | addItemBool("ShowIconTodoview",&mShowIconTodoview,true); | 81 | addItemBool("ShowIconTodoview",&mShowIconTodoview,true); |
82 | addItemBool("ShowIconBackFast",&mShowIconBackFast,true); | 82 | addItemBool("ShowIconBackFast",&mShowIconBackFast,true); |
83 | addItemBool("ShowIconBack",&mShowIconBack,true); | 83 | addItemBool("ShowIconBack",&mShowIconBack,true); |
84 | addItemBool("ShowIconToday",&mShowIconToday,true); | 84 | addItemBool("ShowIconToday",&mShowIconToday,true); |
85 | addItemBool("ShowIconForward",&mShowIconForward,true); | 85 | addItemBool("ShowIconForward",&mShowIconForward,true); |
86 | addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true); | 86 | addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true); |
87 | addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,true); | 87 | addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,true); |
88 | addItemBool("ShowIconWeekNum",&mShowIconWeekNum,true); | 88 | addItemBool("ShowIconWeekNum",&mShowIconWeekNum,true); |
89 | addItemBool("ShowIconNextDays",&mShowIconNextDays,true); | 89 | addItemBool("ShowIconNextDays",&mShowIconNextDays,true); |
90 | addItemBool("ShowIconNext",&mShowIconNext,true); | 90 | addItemBool("ShowIconNext",&mShowIconNext,true); |
91 | addItemBool("ShowIconJournal",&mShowIconJournal,true); | 91 | addItemBool("ShowIconJournal",&mShowIconJournal,true); |
92 | addItemBool("ShowIconStretch",&mShowIconStretch,true); | 92 | addItemBool("ShowIconStretch",&mShowIconStretch,true); |
93 | addItemBool("ShowIconFilter",&mShowIconFilter,false); | 93 | addItemBool("ShowIconFilter",&mShowIconFilter,false); |
94 | addItemBool("ShowIconOnetoolbar",&mShowIconOnetoolbar,true); | 94 | addItemBool("ShowIconOnetoolbar",&mShowIconOnetoolbar,true); |
95 | 95 | ||
96 | bool addIcons = false; | 96 | bool addIcons = false; |
97 | #ifdef DESKTOP_VERSION | 97 | #ifdef DESKTOP_VERSION |
98 | addIcons = true; | 98 | addIcons = true; |
99 | #endif | 99 | #endif |
100 | addItemBool("ShowIconNavigator",&mShowIconNavigator,addIcons); | 100 | addItemBool("ShowIconNavigator",&mShowIconNavigator,addIcons); |
101 | addItemBool("ShowIconAllday",&mShowIconAllday,addIcons); | 101 | addItemBool("ShowIconAllday",&mShowIconAllday,addIcons); |
102 | addItemBool("ShowIconFilterview",&mShowIconFilterview,addIcons); | 102 | addItemBool("ShowIconFilterview",&mShowIconFilterview,addIcons); |
103 | addItemBool("ShowIconToggleFull",&mShowIconToggleFull,addIcons); | 103 | addItemBool("ShowIconToggleFull",&mShowIconToggleFull,addIcons); |
104 | 104 | ||
105 | addItemInt("LastLoadedLanguage",&mOldLanguage,0); | 105 | addItemInt("LastLoadedLanguage",&mOldLanguage,0); |
106 | 106 | ||
107 | addItemBool("AskForQuit",&mAskForQuit,false); | 107 | addItemBool("AskForQuit",&mAskForQuit,false); |
108 | 108 | ||
109 | #ifndef DESKTOP_VERSION | 109 | #ifndef DESKTOP_VERSION |
110 | addItemBool("ShowFullMenu",&mShowFullMenu,false); | 110 | addItemBool("ShowFullMenu",&mShowFullMenu,false); |
111 | #else | 111 | #else |
112 | addItemBool("ShowFullMenu",&mShowFullMenu,true); | 112 | addItemBool("ShowFullMenu",&mShowFullMenu,true); |
113 | #endif | 113 | #endif |
114 | addItemBool("ToolBarHor",&mToolBarHor, true ); | 114 | addItemBool("ToolBarHor",&mToolBarHor, true ); |
115 | addItemBool("ToolBarUp",&mToolBarUp, false ); | 115 | addItemBool("ToolBarUp",&mToolBarUp, false ); |
116 | addItemBool("ToolBarHorV",&mToolBarHorV, true ); | 116 | addItemBool("ToolBarHorV",&mToolBarHorV, true ); |
117 | addItemBool("ToolBarUpV",&mToolBarUpV, false ); | 117 | addItemBool("ToolBarUpV",&mToolBarUpV, false ); |
118 | addItemBool("ToolBarHorN",&mToolBarHorN, true ); | 118 | addItemBool("ToolBarHorN",&mToolBarHorN, true ); |
119 | addItemBool("ToolBarUpN",&mToolBarUpN, false ); | 119 | addItemBool("ToolBarUpN",&mToolBarUpN, false ); |
120 | addItemBool("ToolBarHorF",&mToolBarHorF, true ); | 120 | addItemBool("ToolBarHorF",&mToolBarHorF, true ); |
121 | addItemBool("ToolBarUpF",&mToolBarUpF, false ); | 121 | addItemBool("ToolBarUpF",&mToolBarUpF, false ); |
122 | addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false ); | 122 | addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false ); |
123 | addItemInt("Whats Next Days",&mWhatsNextDays,3); | 123 | addItemInt("Whats Next Days",&mWhatsNextDays,3); |
124 | addItemInt("Whats Next Prios",&mWhatsNextPrios,1); | 124 | addItemInt("Whats Next Prios",&mWhatsNextPrios,1); |
125 | 125 | ||
126 | addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true); | 126 | addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true); |
127 | addItemBool("ShowTimeInAgenda",&mShowTimeInAgenda,true); | 127 | addItemBool("ShowTimeInAgenda",&mShowTimeInAgenda,true); |
128 | addItemBool("HideNonStartedTodos",&mHideNonStartedTodos,false); | 128 | addItemBool("HideNonStartedTodos",&mHideNonStartedTodos,false); |
129 | addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true); | 129 | addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true); |
130 | addItemInt("AllDay Size",&mAllDaySize,28); | 130 | addItemInt("AllDay Size",&mAllDaySize,28); |
131 | QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav"; | 131 | QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav"; |
132 | addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm ); | 132 | addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm ); |
133 | 133 | ||
134 | addItemStringList("LocationDefaults",&mLocationDefaults ); | 134 | addItemStringList("LocationDefaults",&mLocationDefaults ); |
135 | addItemStringList("EventSummary User",&mEventSummaryUser); | 135 | addItemStringList("EventSummary User",&mEventSummaryUser); |
136 | addItemStringList("TodoSummary User",&mTodoSummaryUser); | 136 | addItemStringList("TodoSummary User",&mTodoSummaryUser); |
137 | 137 | ||
138 | addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); | 138 | addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); |
139 | addItemBool("Enable Project View",&mEnableProjectView,false); | 139 | addItemBool("Enable Project View",&mEnableProjectView,false); |
140 | addItemBool("Auto Save",&mAutoSave,false); | 140 | addItemBool("Auto Save",&mAutoSave,false); |
141 | addItemInt("Auto Save Interval",&mAutoSaveInterval,3); | 141 | addItemInt("Auto Save Interval",&mAutoSaveInterval,3); |
142 | addItemBool("Confirm Deletes",&mConfirm,true); | 142 | addItemBool("Confirm Deletes",&mConfirm,true); |
143 | addItemString("Archive File",&mArchiveFile); | 143 | addItemString("Archive File",&mArchiveFile); |
144 | addItemString("Html Export File",&mHtmlExportFile, | 144 | addItemString("Html Export File",&mHtmlExportFile, |
145 | QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html")); | 145 | QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html")); |
146 | addItemBool("Html With Save",&mHtmlWithSave,false); | 146 | addItemBool("Html With Save",&mHtmlWithSave,false); |
147 | 147 | ||
148 | KPrefs::setCurrentGroup("Personal Settings"); | 148 | KPrefs::setCurrentGroup("Personal Settings"); |
149 | 149 | ||
150 | addItemInt("Mail Client",&mMailClient,MailClientKMail); | 150 | addItemInt("Mail Client",&mMailClient,MailClientKMail); |
151 | addItemBool("Use Control Center Email",&mEmailControlCenter,false); | 151 | addItemBool("Use Control Center Email",&mEmailControlCenter,false); |
152 | addItemBool("Bcc",&mBcc,false); | 152 | addItemBool("Bcc",&mBcc,false); |
153 | 153 | ||
154 | KPrefs::setCurrentGroup("Time & Date"); | 154 | KPrefs::setCurrentGroup("Time & Date"); |
155 | 155 | ||
156 | 156 | ||
157 | addItemInt("Default Start Time",&mStartTime,10); | 157 | addItemInt("Default Start Time",&mStartTime,10); |
158 | addItemInt("Default Duration",&mDefaultDuration,2); | 158 | addItemInt("Default Duration",&mDefaultDuration,2); |
159 | addItemInt("Default Alarm Time",&mAlarmTime,3); | 159 | addItemInt("Default Alarm Time",&mAlarmTime,3); |
160 | KPrefs::setCurrentGroup("AlarmSettings"); | 160 | KPrefs::setCurrentGroup("AlarmSettings"); |
161 | addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20); | 161 | addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20); |
162 | addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7); | 162 | addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7); |
163 | addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5); | 163 | addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5); |
164 | addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3); | 164 | addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3); |
165 | 165 | ||
166 | 166 | ||
167 | KPrefs::setCurrentGroup("Calendar"); | 167 | KPrefs::setCurrentGroup("Calendar"); |
168 | 168 | ||
169 | addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar); | 169 | addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar); |
170 | 170 | ||
171 | KPrefs::setCurrentGroup("Fonts"); | 171 | KPrefs::setCurrentGroup("Fonts"); |
172 | // qDebug(" KPrefs::setCurrentGroup(Fonts); "); | 172 | // qDebug(" KPrefs::setCurrentGroup(Fonts); "); |
173 | addItemFont("TimeBar Font",&mTimeBarFont,KGlobalSettings::generalFont() ); | 173 | QFont fon = KGlobalSettings::generalFont(); |
174 | addItemFont("MonthView Font",&mMonthViewFont,KGlobalSettings::generalFont()); | 174 | addItemFont("TimeBar Font",&mTimeBarFont,fon ); |
175 | addItemFont("AgendaView Font",&mAgendaViewFont,KGlobalSettings::generalFont()); | 175 | addItemFont("MonthView Font",&mMonthViewFont,fon); |
176 | addItemFont("MarcusBains Font",&mMarcusBainsFont,KGlobalSettings::generalFont()); | 176 | addItemFont("AgendaView Font",&mAgendaViewFont,fon); |
177 | addItemFont("TimeLabels Font",&mTimeLabelsFont,KGlobalSettings::generalFont()); | 177 | addItemFont("MarcusBains Font",&mMarcusBainsFont,fon); |
178 | addItemFont("TodoView Font",&mTodoViewFont,KGlobalSettings::generalFont()); | 178 | addItemFont("TimeLabels Font",&mTimeLabelsFont,fon); |
179 | addItemFont("ListView Font",&mListViewFont,KGlobalSettings::generalFont()); | 179 | addItemFont("TodoView Font",&mTodoViewFont,fon); |
180 | addItemFont("DateNavigator Font",&mDateNavigatorFont,KGlobalSettings::generalFont()); | 180 | addItemFont("ListView Font",&mListViewFont,fon); |
181 | addItemFont("EditBox Font",&mEditBoxFont,KGlobalSettings::generalFont()); | 181 | addItemFont("DateNavigator Font",&mDateNavigatorFont,fon); |
182 | addItemFont("JournalView Font",&mJornalViewFont,KGlobalSettings::generalFont()); | 182 | addItemFont("EditBox Font",&mEditBoxFont,fon); |
183 | addItemFont("WhatsNextView Font",&mWhatsNextFont,KGlobalSettings::generalFont()); | 183 | addItemFont("JournalView Font",&mJornalViewFont,fon); |
184 | addItemFont("EventView Font",&mEventViewFont,KGlobalSettings::generalFont()); | 184 | addItemFont("WhatsNextView Font",&mWhatsNextFont,fon); |
185 | addItemFont("EventView Font",&mEventViewFont,fon); | ||
185 | 186 | ||
186 | KPrefs::setCurrentGroup("RemoteSyncing"); | 187 | KPrefs::setCurrentGroup("RemoteSyncing"); |
187 | addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" ); | 188 | addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" ); |
188 | addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" ); | 189 | addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" ); |
189 | addItemBool("ShowSyncEvents",&mShowSyncEvents,false); | 190 | addItemBool("ShowSyncEvents",&mShowSyncEvents,false); |
190 | addItemInt("LastSyncTime",&mLastSyncTime,0); | 191 | addItemInt("LastSyncTime",&mLastSyncTime,0); |
191 | 192 | ||
192 | #ifdef _WIN32_ | 193 | #ifdef _WIN32_ |
193 | QString hdp= locateLocal("data","korganizer")+"\\\\"; | 194 | QString hdp= locateLocal("data","korganizer")+"\\\\"; |
194 | #else | 195 | #else |
195 | QString hdp= locateLocal("data","korganizer")+"/"; | 196 | QString hdp= locateLocal("data","korganizer")+"/"; |
196 | #endif | 197 | #endif |
197 | 198 | ||
198 | KPrefs::setCurrentGroup("LoadSaveFileNames"); | 199 | KPrefs::setCurrentGroup("LoadSaveFileNames"); |
199 | 200 | ||
200 | addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" ); | 201 | addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" ); |
201 | addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" ); | 202 | addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" ); |
202 | addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" ); | 203 | addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" ); |
203 | addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" ); | 204 | addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" ); |
204 | 205 | ||
205 | 206 | ||
206 | KPrefs::setCurrentGroup("Locale"); | 207 | KPrefs::setCurrentGroup("Locale"); |
207 | addItemBool("ShortDateInViewer",&mShortDateInViewer,false); | 208 | addItemBool("ShortDateInViewer",&mShortDateInViewer,false); |
208 | 209 | ||
209 | 210 | ||
210 | KPrefs::setCurrentGroup("Colors"); | 211 | KPrefs::setCurrentGroup("Colors"); |
211 | addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor); | 212 | addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor); |
212 | addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor); | 213 | addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor); |
213 | addItemColor("Event Color",&mEventColor,mDefaultCategoryColor); | 214 | addItemColor("Event Color",&mEventColor,mDefaultCategoryColor); |
214 | addItemColor("Todo done Color",&mTodoDoneColor,QColor(111,255,115) ); | 215 | addItemColor("Todo done Color",&mTodoDoneColor,QColor(111,255,115) ); |
215 | addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor); | 216 | addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor); |
216 | addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor); | 217 | addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor); |
217 | addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor); | 218 | addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor); |
218 | addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor); | 219 | addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor); |
219 | addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 )); | 220 | addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 )); |
220 | addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 )); | 221 | addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 )); |
221 | addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 )); | 222 | addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 )); |
222 | addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true); | 223 | addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true); |
223 | addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true); | 224 | addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true); |
224 | addItemBool("MonthViewWeek",&mMonthViewWeek,false); | 225 | addItemBool("MonthViewWeek",&mMonthViewWeek,false); |
225 | addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false); | 226 | addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false); |
226 | addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 )); | 227 | addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 )); |
227 | addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 )); | 228 | addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 )); |
228 | addItemBool("UseAppColors",&mUseAppColors,false); | 229 | addItemBool("UseAppColors",&mUseAppColors,false); |
229 | 230 | ||
230 | 231 | ||
231 | 232 | ||
232 | KPrefs::setCurrentGroup("Views"); | 233 | KPrefs::setCurrentGroup("Views"); |
233 | addItemBool("Show Date Navigator",&mShowDateNavigator,true); | 234 | addItemBool("Show Date Navigator",&mShowDateNavigator,true); |
234 | addItemInt("Hour Size",&mHourSize,8); | 235 | addItemInt("Hour Size",&mHourSize,8); |
235 | addItemBool("Show Daily Recurrences",&mDailyRecur,true); | 236 | addItemBool("Show Daily Recurrences",&mDailyRecur,true); |
236 | addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true); | 237 | addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true); |
237 | addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true); | 238 | addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true); |
238 | addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true); | 239 | addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true); |
239 | addItemBool("ShowShortMonthName",&mMonthShowShort,false); | 240 | addItemBool("ShowShortMonthName",&mMonthShowShort,false); |
240 | addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true); | 241 | addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true); |
241 | #ifdef DESKTOP_VERION | 242 | #ifdef DESKTOP_VERION |
242 | addItemBool("Enable ToolTips",&mEnableToolTips,true); | 243 | addItemBool("Enable ToolTips",&mEnableToolTips,true); |
243 | #else | 244 | #else |
244 | addItemBool("Enable ToolTips",&mEnableToolTips,false); | 245 | addItemBool("Enable ToolTips",&mEnableToolTips,false); |
245 | #endif | 246 | #endif |
246 | addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false); | 247 | addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false); |
247 | addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false); | 248 | addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false); |
248 | addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true); | 249 | addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true); |
249 | addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true); | 250 | addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true); |
250 | addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,true); | 251 | addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,true); |
251 | addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false); | 252 | addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false); |
252 | addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false); | 253 | addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false); |
253 | addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true); | 254 | addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true); |
254 | addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true); | 255 | addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true); |
255 | addItemBool("WNViewShowsParents",&mWNViewShowsParents,true);; | 256 | addItemBool("WNViewShowsParents",&mWNViewShowsParents,true);; |
256 | addItemBool("WNViewShowsPast",&mWNViewShowsPast,true); | 257 | addItemBool("WNViewShowsPast",&mWNViewShowsPast,true); |
257 | addItemBool("WNViewShowLocation",&mWNViewShowLocation,false); | 258 | addItemBool("WNViewShowLocation",&mWNViewShowLocation,false); |
258 | addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false); | 259 | addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false); |
259 | addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true); | 260 | addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true); |
260 | addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false); | 261 | addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false); |
261 | addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false); | 262 | addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false); |
262 | addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,true); | 263 | addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,true); |
263 | addItemBool("MonthViewUsesBigFont",&mMonthViewUsesBigFont,true); | 264 | addItemBool("MonthViewUsesBigFont",&mMonthViewUsesBigFont,true); |
264 | addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false); | 265 | addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false); |
265 | addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false); | 266 | addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false); |
266 | #ifdef DESKTOP_VERSION | 267 | #ifdef DESKTOP_VERSION |
267 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true); | 268 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true); |
268 | #else | 269 | #else |
269 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false); | 270 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false); |
270 | #endif | 271 | #endif |
271 | addItemInt("Day Begins",&mDayBegins,7); | 272 | addItemInt("Day Begins",&mDayBegins,7); |
272 | addItemInt("Working Hours Start",&mWorkingHoursStart,8); | 273 | addItemInt("Working Hours Start",&mWorkingHoursStart,8); |
273 | addItemInt("Working Hours End",&mWorkingHoursEnd,17); | 274 | addItemInt("Working Hours End",&mWorkingHoursEnd,17); |
274 | addItemBool("Exclude Holidays",&mExcludeHolidays,true); | 275 | addItemBool("Exclude Holidays",&mExcludeHolidays,true); |
275 | addItemBool("Exclude Saturdays",&mExcludeSaturdays,true); | 276 | addItemBool("Exclude Saturdays",&mExcludeSaturdays,true); |
276 | 277 | ||
277 | addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false); | 278 | addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false); |
278 | addItemBool("Full View Month",&mFullViewMonth,true); | 279 | addItemBool("Full View Month",&mFullViewMonth,true); |
279 | addItemBool("Full View Todo",&mFullViewTodo,true); | 280 | addItemBool("Full View Todo",&mFullViewTodo,true); |
280 | addItemBool("Quick Todo",&mEnableQuickTodo,false); | 281 | addItemBool("Quick Todo",&mEnableQuickTodo,false); |
281 | 282 | ||
282 | addItemInt("Next X Days",&mNextXDays,3); | 283 | addItemInt("Next X Days",&mNextXDays,3); |
283 | 284 | ||
284 | KPrefs::setCurrentGroup("Printer"); | 285 | KPrefs::setCurrentGroup("Printer"); |
285 | 286 | ||
286 | KPrefs::setCurrentGroup("Layout"); | 287 | KPrefs::setCurrentGroup("Layout"); |
287 | 288 | ||
288 | addItemBool("CompactDialogs",&mCompactDialogs,false); | 289 | addItemBool("CompactDialogs",&mCompactDialogs,false); |
289 | addItemBool("VerticalScreen",&mVerticalScreen,true); | 290 | addItemBool("VerticalScreen",&mVerticalScreen,true); |
290 | 291 | ||
291 | KPrefs::setCurrentGroup("KOrganizer Plugins"); | 292 | KPrefs::setCurrentGroup("KOrganizer Plugins"); |
292 | 293 | ||
293 | addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays"); | 294 | addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays"); |
294 | 295 | ||
295 | KPrefs::setCurrentGroup("Group Scheduling"); | 296 | KPrefs::setCurrentGroup("Group Scheduling"); |
296 | 297 | ||
297 | addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail); | 298 | addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail); |
298 | addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend); | 299 | addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend); |
299 | addItemStringList("AdditionalMails",&mAdditionalMails,""); | 300 | addItemStringList("AdditionalMails",&mAdditionalMails,""); |
300 | addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto); | 301 | addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto); |
301 | addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto); | 302 | addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto); |
302 | addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto); | 303 | addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto); |
303 | addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto); | 304 | addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto); |
304 | addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto); | 305 | addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto); |
305 | 306 | ||
306 | KPrefs::setCurrentGroup( "Editors" ); | 307 | KPrefs::setCurrentGroup( "Editors" ); |
307 | 308 | ||
308 | addItemStringList( "EventTemplates", &mEventTemplates ); | 309 | addItemStringList( "EventTemplates", &mEventTemplates ); |
309 | addItemStringList( "TodoTemplates", &mTodoTemplates ); | 310 | addItemStringList( "TodoTemplates", &mTodoTemplates ); |
310 | 311 | ||
311 | addItemInt("DestinationPolicy",&mDestination,standardDestination); | 312 | addItemInt("DestinationPolicy",&mDestination,standardDestination); |
312 | 313 | ||
313 | KPrefs::setCurrentGroup( "ViewOptions" ); | 314 | KPrefs::setCurrentGroup( "ViewOptions" ); |
314 | addItemBool("EVshowDetails",&mEVshowDetails,true); | 315 | addItemBool("EVshowDetails",&mEVshowDetails,true); |
315 | addItemBool("EVshowCreated",&mEVshowCreated,true); | 316 | addItemBool("EVshowCreated",&mEVshowCreated,true); |
316 | addItemBool("EVshowChanged",&mEVshowChanged,true); | 317 | addItemBool("EVshowChanged",&mEVshowChanged,true); |
317 | addItemBool("WTshowDetails",&mWTshowDetails,false); | 318 | addItemBool("WTshowDetails",&mWTshowDetails,false); |
318 | addItemBool("WTshowCreated",&mWTshowCreated,false); | 319 | addItemBool("WTshowCreated",&mWTshowCreated,false); |
319 | addItemBool("WTshowChanged",&mWTshowChanged,false); | 320 | addItemBool("WTshowChanged",&mWTshowChanged,false); |
320 | 321 | ||
321 | } | 322 | } |
322 | 323 | ||
323 | 324 | ||
324 | KOPrefs::~KOPrefs() | 325 | KOPrefs::~KOPrefs() |
325 | { | 326 | { |
326 | if (mInstance == this) | 327 | if (mInstance == this) |
327 | mInstance = insd.setObject(0); | 328 | mInstance = insd.setObject(0); |
328 | 329 | ||
329 | //qDebug("KOPrefs::~KOPrefs() "); | 330 | //qDebug("KOPrefs::~KOPrefs() "); |
330 | } | 331 | } |
331 | 332 | ||
332 | 333 | ||
333 | KOPrefs *KOPrefs::instance() | 334 | KOPrefs *KOPrefs::instance() |
334 | { | 335 | { |
335 | if (!mInstance) { | 336 | if (!mInstance) { |
336 | mInstance = insd.setObject(new KOPrefs()); | 337 | mInstance = insd.setObject(new KOPrefs()); |
337 | mInstance->readConfig(); | 338 | mInstance->readConfig(); |
338 | } | 339 | } |
339 | 340 | ||
340 | return mInstance; | 341 | return mInstance; |
341 | } | 342 | } |
342 | 343 | ||
343 | void KOPrefs::usrSetDefaults() | 344 | void KOPrefs::usrSetDefaults() |
344 | { | 345 | { |
345 | 346 | ||
346 | } | 347 | } |
347 | 348 | ||
348 | void KOPrefs::fillMailDefaults() | 349 | void KOPrefs::fillMailDefaults() |
349 | { | 350 | { |
350 | if (mName.isEmpty()) mName = i18n("Anonymous"); | 351 | if (mName.isEmpty()) mName = i18n("Anonymous"); |
351 | if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere"); | 352 | if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere"); |
352 | } | 353 | } |
353 | 354 | ||
354 | void KOPrefs::setTimeZoneIdDefault() | 355 | void KOPrefs::setTimeZoneIdDefault() |
355 | { | 356 | { |
356 | ; | 357 | ; |
357 | } | 358 | } |
358 | 359 | ||
359 | void KOPrefs::setAllDefaults() | 360 | void KOPrefs::setAllDefaults() |
360 | { | 361 | { |
361 | setCategoryDefaults(); | 362 | setCategoryDefaults(); |
362 | mEventSummaryUser = getDefaultList() ; | 363 | mEventSummaryUser = getDefaultList() ; |
363 | mTodoSummaryUser = getDefaultList() ; | 364 | mTodoSummaryUser = getDefaultList() ; |
364 | mLocationDefaults = getLocationDefaultList(); | 365 | mLocationDefaults = getLocationDefaultList(); |
365 | } | 366 | } |
366 | 367 | ||
367 | void KOPrefs::setCategoryDefaults() | 368 | void KOPrefs::setCategoryDefaults() |
368 | { | 369 | { |
369 | mCustomCategories.clear(); | 370 | mCustomCategories.clear(); |
370 | mCustomCategories = getDefaultList(); | 371 | mCustomCategories = getDefaultList(); |
371 | 372 | ||
372 | QStringList::Iterator it; | 373 | QStringList::Iterator it; |
373 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { | 374 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { |
374 | setCategoryColor(*it,mDefaultCategoryColor); | 375 | setCategoryColor(*it,mDefaultCategoryColor); |
375 | } | 376 | } |
376 | } | 377 | } |
377 | QStringList KOPrefs::getLocationDefaultList() | 378 | QStringList KOPrefs::getLocationDefaultList() |
378 | { | 379 | { |
379 | QStringList retval ; | 380 | QStringList retval ; |
380 | retval << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach") | 381 | retval << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach") |
381 | << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") | 382 | << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") |
382 | << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten") | 383 | << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten") |
383 | << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; | 384 | << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; |
384 | // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") | 385 | // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") |
385 | 386 | ||
386 | retval.sort(); | 387 | retval.sort(); |
387 | return retval; | 388 | return retval; |
388 | } | 389 | } |
389 | QStringList KOPrefs::getDefaultList() | 390 | QStringList KOPrefs::getDefaultList() |
390 | { | 391 | { |
391 | QStringList retval ; | 392 | QStringList retval ; |
392 | retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Business Travel") << i18n("Cinema") << i18n("Customer") | 393 | retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Business Travel") << i18n("Cinema") << i18n("Customer") |
393 | << i18n("Break")<< i18n("Breakfast")<< i18n("Competition")<< i18n("Dinner") | 394 | << i18n("Break")<< i18n("Breakfast")<< i18n("Competition")<< i18n("Dinner") |
394 | << i18n("Education")<< i18n("Family") << i18n("Favorites") << i18n("Festival")<< i18n("Fishing")<< i18n("Flight") << i18n("Gifts") | 395 | << i18n("Education")<< i18n("Family") << i18n("Favorites") << i18n("Festival")<< i18n("Fishing")<< i18n("Flight") << i18n("Gifts") |
395 | << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Hiking") << i18n("Hunting") << i18n("Key Customer") << i18n("Kids") | 396 | << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Hiking") << i18n("Hunting") << i18n("Key Customer") << i18n("Kids") |
396 | << i18n("Lunch") << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner")<< i18n("Party") << i18n("Personal") << i18n("Personal Travel") | 397 | << i18n("Lunch") << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner")<< i18n("Party") << i18n("Personal") << i18n("Personal Travel") |
397 | << i18n("PHB") << i18n("Phone Calls") << i18n("Projects") << i18n("Recurring") << i18n("School") << i18n("Shopping") | 398 | << i18n("PHB") << i18n("Phone Calls") << i18n("Projects") << i18n("Recurring") << i18n("School") << i18n("Shopping") |
398 | << i18n("Speach") << i18n("Special Occasion") << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University") | 399 | << i18n("Speach") << i18n("Special Occasion") << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University") |
399 | << i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ; | 400 | << i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ; |
400 | retval.sort(); | 401 | retval.sort(); |
401 | //qDebug("cat %s ", retval.join("-").latin1()); | 402 | //qDebug("cat %s ", retval.join("-").latin1()); |
402 | return retval; | 403 | return retval; |
403 | } | 404 | } |
404 | 405 | ||
405 | void KOPrefs::usrReadConfig() | 406 | void KOPrefs::usrReadConfig() |
406 | { | 407 | { |
407 | config()->setGroup("General"); | 408 | config()->setGroup("General"); |
408 | 409 | ||
409 | //qDebug("KOPrefs::usrReadConfig() "); | 410 | //qDebug("KOPrefs::usrReadConfig() "); |
410 | mCustomCategories = config()->readListEntry("Custom Categories"); | 411 | mCustomCategories = config()->readListEntry("Custom Categories"); |
411 | mOldLoadedLanguage = mOldLanguage ; | 412 | mOldLoadedLanguage = mOldLanguage ; |
412 | mOldLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage; | 413 | mOldLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage; |
413 | if (mLocationDefaults.isEmpty()) { | 414 | if (mLocationDefaults.isEmpty()) { |
414 | mLocationDefaults = getLocationDefaultList(); | 415 | mLocationDefaults = getLocationDefaultList(); |
415 | } | 416 | } |
416 | 417 | ||
417 | if (mEventSummaryUser.isEmpty()) { | 418 | if (mEventSummaryUser.isEmpty()) { |
418 | mEventSummaryUser = getDefaultList() ; | 419 | mEventSummaryUser = getDefaultList() ; |
419 | } | 420 | } |
420 | if (mTodoSummaryUser.isEmpty()) { | 421 | if (mTodoSummaryUser.isEmpty()) { |
421 | mTodoSummaryUser = getDefaultList() ; | 422 | mTodoSummaryUser = getDefaultList() ; |
422 | } | 423 | } |
423 | 424 | ||
424 | if (mCustomCategories.isEmpty()) setCategoryDefaults(); | 425 | if (mCustomCategories.isEmpty()) setCategoryDefaults(); |
425 | 426 | ||
426 | config()->setGroup("Personal Settings"); | 427 | config()->setGroup("Personal Settings"); |
427 | mName = config()->readEntry("user_name",""); | 428 | mName = config()->readEntry("user_name",""); |
428 | mEmail = config()->readEntry("user_email",""); | 429 | mEmail = config()->readEntry("user_email",""); |
429 | fillMailDefaults(); | 430 | fillMailDefaults(); |
430 | 431 | ||
431 | config()->setGroup("Category Colors"); | 432 | config()->setGroup("Category Colors"); |
432 | QStringList::Iterator it; | 433 | QStringList::Iterator it; |
433 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { | 434 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { |
434 | setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor)); | 435 | setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor)); |
435 | 436 | ||
436 | } | 437 | } |
437 | 438 | ||
438 | KPimPrefs::usrReadConfig(); | 439 | KPimPrefs::usrReadConfig(); |
439 | } | 440 | } |
440 | 441 | ||
441 | 442 | ||
442 | void KOPrefs::usrWriteConfig() | 443 | void KOPrefs::usrWriteConfig() |
443 | { | 444 | { |
444 | config()->setGroup("General"); | 445 | config()->setGroup("General"); |
445 | config()->writeEntry("Custom Categories",mCustomCategories); | 446 | config()->writeEntry("Custom Categories",mCustomCategories); |
446 | 447 | ||
447 | config()->setGroup("Personal Settings"); | 448 | config()->setGroup("Personal Settings"); |
448 | config()->writeEntry("user_name",mName); | 449 | config()->writeEntry("user_name",mName); |
449 | config()->writeEntry("user_email",mEmail); | 450 | config()->writeEntry("user_email",mEmail); |
450 | 451 | ||
451 | config()->setGroup("Category Colors"); | 452 | config()->setGroup("Category Colors"); |
452 | QDictIterator<QColor> it(mCategoryColors); | 453 | QDictIterator<QColor> it(mCategoryColors); |
453 | while (it.current()) { | 454 | while (it.current()) { |
454 | config()->writeEntry(it.currentKey(),*(it.current())); | 455 | config()->writeEntry(it.currentKey(),*(it.current())); |
455 | ++it; | 456 | ++it; |
456 | } | 457 | } |
457 | 458 | ||
458 | 459 | ||
459 | KPimPrefs::usrWriteConfig(); | 460 | KPimPrefs::usrWriteConfig(); |
460 | } | 461 | } |
461 | 462 | ||
462 | void KOPrefs::setCategoryColor(QString cat,const QColor & color) | 463 | void KOPrefs::setCategoryColor(QString cat,const QColor & color) |
463 | { | 464 | { |
464 | mCategoryColors.replace(cat,new QColor(color)); | 465 | mCategoryColors.replace(cat,new QColor(color)); |
465 | } | 466 | } |
466 | 467 | ||
467 | QColor *KOPrefs::categoryColor(QString cat) | 468 | QColor *KOPrefs::categoryColor(QString cat) |
468 | { | 469 | { |
469 | QColor *color = 0; | 470 | QColor *color = 0; |
470 | 471 | ||
471 | if (!cat.isEmpty()) color = mCategoryColors[cat]; | 472 | if (!cat.isEmpty()) color = mCategoryColors[cat]; |
472 | 473 | ||
473 | if (color) return color; | 474 | if (color) return color; |
474 | else return &mDefaultCategoryColor; | 475 | else return &mDefaultCategoryColor; |
475 | } | 476 | } |
476 | 477 | ||
477 | void KOPrefs::setFullName(const QString &name) | 478 | void KOPrefs::setFullName(const QString &name) |
478 | { | 479 | { |
479 | mName = name; | 480 | mName = name; |
480 | } | 481 | } |
481 | 482 | ||
482 | void KOPrefs::setEmail(const QString &email) | 483 | void KOPrefs::setEmail(const QString &email) |
483 | { | 484 | { |
484 | //qDebug(" KOPrefs::setEmai*********** %s",email.latin1() ); | 485 | //qDebug(" KOPrefs::setEmai*********** %s",email.latin1() ); |
485 | mEmail = email; | 486 | mEmail = email; |
486 | } | 487 | } |
487 | 488 | ||
488 | QString KOPrefs::fullName() | 489 | QString KOPrefs::fullName() |
489 | { | 490 | { |
490 | if (mEmailControlCenter) { | 491 | if (mEmailControlCenter) { |
491 | KEMailSettings settings; | 492 | KEMailSettings settings; |
492 | return settings.getSetting(KEMailSettings::RealName); | 493 | return settings.getSetting(KEMailSettings::RealName); |
493 | } else { | 494 | } else { |
494 | return mName; | 495 | return mName; |
495 | } | 496 | } |
496 | } | 497 | } |
497 | 498 | ||
498 | QString KOPrefs::email() | 499 | QString KOPrefs::email() |
499 | { | 500 | { |
500 | if (mEmailControlCenter) { | 501 | if (mEmailControlCenter) { |
501 | KEMailSettings settings; | 502 | KEMailSettings settings; |
502 | return settings.getSetting(KEMailSettings::EmailAddress); | 503 | return settings.getSetting(KEMailSettings::EmailAddress); |
503 | } else { | 504 | } else { |
504 | return mEmail; | 505 | return mEmail; |
505 | } | 506 | } |
506 | } | 507 | } |
507 | KConfig* KOPrefs::getConfig() | 508 | KConfig* KOPrefs::getConfig() |
508 | { | 509 | { |
509 | return config(); | 510 | return config(); |
510 | } | 511 | } |
diff --git a/korganizer/koprefsdialog.cpp b/korganizer/koprefsdialog.cpp index 74037e6..8439b81 100644 --- a/korganizer/koprefsdialog.cpp +++ b/korganizer/koprefsdialog.cpp | |||
@@ -1,1721 +1,1727 @@ | |||
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 | 57 | ||
57 | #include <kurlrequester.h> | 58 | #include <kurlrequester.h> |
58 | #include <klineedit.h> | 59 | #include <klineedit.h> |
59 | 60 | ||
60 | #if defined(USE_SOLARIS) | 61 | #if defined(USE_SOLARIS) |
61 | #include <sys/param.h> | 62 | #include <sys/param.h> |
62 | 63 | ||
63 | #define ZONEINFODIR "/usr/share/lib/zoneinfo" | 64 | #define ZONEINFODIR "/usr/share/lib/zoneinfo" |
64 | #define INITFILE "/etc/default/init" | 65 | #define INITFILE "/etc/default/init" |
65 | #endif | 66 | #endif |
66 | 67 | ||
67 | #include "koprefs.h" | 68 | #include "koprefs.h" |
68 | 69 | ||
69 | #include "koprefsdialog.h" | 70 | #include "koprefsdialog.h" |
70 | #include "kpimglobalprefs.h" | 71 | #include "kpimglobalprefs.h" |
71 | 72 | ||
72 | 73 | ||
73 | KOPrefsDialog::KOPrefsDialog(QWidget *parent, char *name, bool modal) : | 74 | KOPrefsDialog::KOPrefsDialog(QWidget *parent, char *name, bool modal) : |
74 | KPrefsDialog(KOPrefs::instance(),parent,name,true) | 75 | KPrefsDialog(KOPrefs::instance(),parent,name,true) |
75 | { | 76 | { |
76 | 77 | ||
78 | setFont( KGlobalSettings::generalFont() ); | ||
77 | setCaption( i18n("Preferences - some settings need a restart (nr)")); | 79 | setCaption( i18n("Preferences - some settings need a restart (nr)")); |
78 | mCategoryDict.setAutoDelete(true); | 80 | mCategoryDict.setAutoDelete(true); |
79 | 81 | ||
80 | KGlobal::locale()->insertCatalogue("timezones"); | 82 | KGlobal::locale()->insertCatalogue("timezones"); |
83 | mSpacingHint = spacingHintSmall(); | ||
84 | mMarginHint = marginHintSmall(); | ||
85 | #ifndef DESKTOP_VERSION | ||
86 | if ( QApplication::desktop()->height() == 480 ) | ||
87 | hideButtons(); | ||
88 | #endif | ||
81 | 89 | ||
82 | setupGlobalTab(); | 90 | setupGlobalTab(); |
83 | setupMainTab(); | 91 | setupMainTab(); |
84 | // setupLocaleTab(); | 92 | // setupLocaleTab(); |
85 | //setupTimeZoneTab(); | 93 | //setupTimeZoneTab(); |
86 | setupTimeTab(); | 94 | setupTimeTab(); |
87 | //setupLocaleDateTab(); | 95 | //setupLocaleDateTab(); |
88 | setupFontsTab(); | 96 | setupFontsTab(); |
89 | setupColorsTab(); | 97 | setupColorsTab(); |
90 | setupViewsTab(); | 98 | setupViewsTab(); |
91 | //setupSyncTab(); | 99 | //setupSyncTab(); |
92 | //setupSyncAlgTab(); | 100 | //setupSyncAlgTab(); |
93 | //setupPrinterTab(); | 101 | //setupPrinterTab(); |
94 | //setupGroupSchedulingTab(); | 102 | //setupGroupSchedulingTab(); |
95 | //setupGroupAutomationTab(); | 103 | //setupGroupAutomationTab(); |
96 | 104 | ||
97 | #ifndef DESKTOP_VERSION | 105 | |
98 | if ( QApplication::desktop()->height() == 480 ) | ||
99 | hideButtons(); | ||
100 | #endif | ||
101 | } | 106 | } |
102 | 107 | ||
103 | 108 | ||
104 | KOPrefsDialog::~KOPrefsDialog() | 109 | KOPrefsDialog::~KOPrefsDialog() |
105 | { | 110 | { |
106 | } | 111 | } |
107 | void KOPrefsDialog::setupGlobalTab() | 112 | void KOPrefsDialog::setupGlobalTab() |
108 | { | 113 | { |
109 | QFrame *topFrame = addPage(i18n("Global"),0,0); | 114 | QFrame *topFrame = addPage(i18n("Global"),0,0); |
110 | kdelibcfg = new KDEPIMConfigWidget( KPimGlobalPrefs::instance(), topFrame, "KCMKdeLibConfig" ); | 115 | kdelibcfg = new KDEPIMConfigWidget( KPimGlobalPrefs::instance(), topFrame, "KCMKdeLibConfig" ); |
111 | QVBoxLayout *topLayout = new QVBoxLayout(topFrame); | 116 | QVBoxLayout *topLayout = new QVBoxLayout(topFrame); |
112 | topLayout->addWidget( kdelibcfg ); | 117 | topLayout->addWidget( kdelibcfg ); |
113 | 118 | ||
114 | 119 | ||
115 | } | 120 | } |
116 | void KOPrefsDialog::setupLocaleDateTab() | 121 | void KOPrefsDialog::setupLocaleDateTab() |
117 | { | 122 | { |
118 | #if 0 | 123 | #if 0 |
119 | QFrame *topFrame = addPage(i18n("Date Format"),0,0); | 124 | QFrame *topFrame = addPage(i18n("Date Format"),0,0); |
120 | QGridLayout *topLayout = new QGridLayout(topFrame,3,2); | 125 | QGridLayout *topLayout = new QGridLayout(topFrame,3,2); |
121 | topLayout->setSpacing(spacingHint()); | 126 | topLayout->setSpacing(mSpacingHint); |
122 | topLayout->setMargin(marginHint()); | 127 | topLayout->setMargin(mMarginHint); |
123 | int iii = 0; | 128 | int iii = 0; |
124 | 129 | ||
125 | 130 | ||
126 | KPrefsDialogWidRadios *syncPrefsGroup = | 131 | KPrefsDialogWidRadios *syncPrefsGroup = |
127 | addWidRadios(i18n("Date Format:"),&(KOPrefs::instance()->mPreferredDate),topFrame); | 132 | addWidRadios(i18n("Date Format:"),&(KOPrefs::instance()->mPreferredDate),topFrame); |
128 | QString format; | 133 | QString format; |
129 | if ( QApplication::desktop()->width() < 480 ) | 134 | if ( QApplication::desktop()->width() < 480 ) |
130 | format = "(%d.%m.%Y)"; | 135 | format = "(%d.%m.%Y)"; |
131 | else | 136 | else |
132 | format = "(%d.%m.%Y|%A %d %B %Y)"; | 137 | format = "(%d.%m.%Y|%A %d %B %Y)"; |
133 | syncPrefsGroup->addRadio(i18n("24.03.2004 "+format)); | 138 | syncPrefsGroup->addRadio(i18n("24.03.2004 "+format)); |
134 | if ( QApplication::desktop()->width() < 480 ) | 139 | if ( QApplication::desktop()->width() < 480 ) |
135 | format = "(%m.%d.%Y)"; | 140 | format = "(%m.%d.%Y)"; |
136 | else | 141 | else |
137 | format = "(%m.%d.%Y|%A %B %d %Y)"; | 142 | format = "(%m.%d.%Y|%A %B %d %Y)"; |
138 | syncPrefsGroup->addRadio(i18n("03.24.2004 "+format)); | 143 | syncPrefsGroup->addRadio(i18n("03.24.2004 "+format)); |
139 | if ( QApplication::desktop()->width() < 480 ) | 144 | if ( QApplication::desktop()->width() < 480 ) |
140 | format = "(%Y-%m-%d)"; | 145 | format = "(%Y-%m-%d)"; |
141 | else | 146 | else |
142 | format = "(%Y-%m-%d|%A %Y %B %d)"; | 147 | format = "(%Y-%m-%d|%A %Y %B %d)"; |
143 | syncPrefsGroup->addRadio(i18n("2004-03-24 "+format)); | 148 | syncPrefsGroup->addRadio(i18n("2004-03-24 "+format)); |
144 | syncPrefsGroup->addRadio(i18n("User defined")); | 149 | syncPrefsGroup->addRadio(i18n("User defined")); |
145 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); | 150 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); |
146 | ++iii; | 151 | ++iii; |
147 | ++iii; | 152 | ++iii; |
148 | QLabel * lab; | 153 | QLabel * lab; |
149 | mUserDateFormatLong = new QLineEdit(topFrame); | 154 | mUserDateFormatLong = new QLineEdit(topFrame); |
150 | lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame); | 155 | lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame); |
151 | topLayout->addWidget(lab ,iii,0); | 156 | topLayout->addWidget(lab ,iii,0); |
152 | topLayout->addWidget(mUserDateFormatLong,iii,1); | 157 | topLayout->addWidget(mUserDateFormatLong,iii,1); |
153 | ++iii; | 158 | ++iii; |
154 | mUserDateFormatShort = new QLineEdit(topFrame); | 159 | mUserDateFormatShort = new QLineEdit(topFrame); |
155 | lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame); | 160 | lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame); |
156 | topLayout->addWidget(lab ,iii,0); | 161 | topLayout->addWidget(lab ,iii,0); |
157 | topLayout->addWidget(mUserDateFormatShort,iii,1); | 162 | topLayout->addWidget(mUserDateFormatShort,iii,1); |
158 | ++iii; | 163 | ++iii; |
159 | 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); |
160 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); | 165 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); |
161 | ++iii; | 166 | ++iii; |
162 | 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); |
163 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); | 168 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); |
164 | ++iii; | 169 | ++iii; |
165 | 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); |
166 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); | 171 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); |
167 | ++iii; | 172 | ++iii; |
168 | #endif | 173 | #endif |
169 | 174 | ||
170 | } | 175 | } |
171 | 176 | ||
172 | void KOPrefsDialog::setupLocaleTab() | 177 | void KOPrefsDialog::setupLocaleTab() |
173 | { | 178 | { |
174 | #if 0 | 179 | #if 0 |
175 | QFrame *topFrame = addPage(i18n("Locale"),0,0); | 180 | QFrame *topFrame = addPage(i18n("Locale"),0,0); |
176 | QGridLayout *topLayout = new QGridLayout(topFrame,4,2); | 181 | QGridLayout *topLayout = new QGridLayout(topFrame,4,2); |
177 | topLayout->setSpacing(spacingHint()); | 182 | topLayout->setSpacing(mSpacingHint); |
178 | topLayout->setMargin(marginHint()); | 183 | topLayout->setMargin(mMarginHint); |
179 | int iii = 0; | 184 | int iii = 0; |
180 | KPrefsDialogWidRadios *syncPrefsGroup = | 185 | KPrefsDialogWidRadios *syncPrefsGroup = |
181 | addWidRadios(i18n("Language:(needs restart)"),&(KOPrefs::instance()->mPreferredLanguage),topFrame); | 186 | addWidRadios(i18n("Language:(needs restart)"),&(KOPrefs::instance()->mPreferredLanguage),topFrame); |
182 | syncPrefsGroup->addRadio(i18n("English")); | 187 | syncPrefsGroup->addRadio(i18n("English")); |
183 | syncPrefsGroup->addRadio(i18n("German")); | 188 | syncPrefsGroup->addRadio(i18n("German")); |
184 | syncPrefsGroup->addRadio(i18n("French")); | 189 | syncPrefsGroup->addRadio(i18n("French")); |
185 | syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)")); | 190 | syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)")); |
186 | if ( QApplication::desktop()->width() < 300 ) | 191 | if ( QApplication::desktop()->width() < 300 ) |
187 | ;// syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); | 192 | ;// syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); |
188 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); | 193 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); |
189 | ++iii; | 194 | ++iii; |
190 | 195 | ||
191 | syncPrefsGroup = | 196 | syncPrefsGroup = |
192 | addWidRadios(i18n("Time Format(nr):"),&(KOPrefs::instance()->mPreferredTime),topFrame); | 197 | addWidRadios(i18n("Time Format(nr):"),&(KOPrefs::instance()->mPreferredTime),topFrame); |
193 | if ( QApplication::desktop()->width() > 300 ) | 198 | if ( QApplication::desktop()->width() > 300 ) |
194 | syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); | 199 | syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); |
195 | syncPrefsGroup->addRadio(i18n("24:00")); | 200 | syncPrefsGroup->addRadio(i18n("24:00")); |
196 | syncPrefsGroup->addRadio(i18n("12:00am")); | 201 | syncPrefsGroup->addRadio(i18n("12:00am")); |
197 | syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); | 202 | syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); |
198 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); | 203 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); |
199 | ++iii; | 204 | ++iii; |
200 | KPrefsDialogWidBool *sb; | 205 | KPrefsDialogWidBool *sb; |
201 | if ( QApplication::desktop()->width() < 300 ) { | 206 | if ( QApplication::desktop()->width() < 300 ) { |
202 | sb = | 207 | sb = |
203 | addWidBool(i18n("Week starts on Sunday"), | 208 | addWidBool(i18n("Week starts on Sunday"), |
204 | &(KOPrefs::instance()->mWeekStartsOnSunday),topFrame); | 209 | &(KOPrefs::instance()->mWeekStartsOnSunday),topFrame); |
205 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); | 210 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); |
206 | ++iii; | 211 | ++iii; |
207 | sb = | 212 | sb = |
208 | addWidBool(i18n("Use short date in (WN/E) view"), | 213 | addWidBool(i18n("Use short date in (WN/E) view"), |
209 | &(KOPrefs::instance()->mShortDateInViewer),topFrame); | 214 | &(KOPrefs::instance()->mShortDateInViewer),topFrame); |
210 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); | 215 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); |
211 | } | 216 | } |
212 | else { | 217 | else { |
213 | QWidget * hb = new QWidget( topFrame ); | 218 | QWidget * hb = new QWidget( topFrame ); |
214 | QHBoxLayout *hbLayout = new QHBoxLayout(hb); | 219 | QHBoxLayout *hbLayout = new QHBoxLayout(hb); |
215 | sb = | 220 | sb = |
216 | addWidBool(i18n("Week starts on Sunday"), | 221 | addWidBool(i18n("Week starts on Sunday"), |
217 | &(KOPrefs::instance()->mWeekStartsOnSunday),hb); | 222 | &(KOPrefs::instance()->mWeekStartsOnSunday),hb); |
218 | hbLayout->addWidget(sb->checkBox() ); | 223 | hbLayout->addWidget(sb->checkBox() ); |
219 | sb = | 224 | sb = |
220 | addWidBool(i18n("Use short date in (WN/E) view"), | 225 | addWidBool(i18n("Use short date in (WN/E) view"), |
221 | &(KOPrefs::instance()->mShortDateInViewer),hb); | 226 | &(KOPrefs::instance()->mShortDateInViewer),hb); |
222 | hbLayout->addWidget(sb->checkBox() ); | 227 | hbLayout->addWidget(sb->checkBox() ); |
223 | topLayout->addMultiCellWidget(hb, iii,iii,0,1); | 228 | topLayout->addMultiCellWidget(hb, iii,iii,0,1); |
224 | 229 | ||
225 | } | 230 | } |
226 | // KPrefsDialogWidBool *sb; //#ifndef DESKTOP_VERSION | 231 | // KPrefsDialogWidBool *sb; //#ifndef DESKTOP_VERSION |
227 | #if 0 | 232 | #if 0 |
228 | ++iii; | 233 | ++iii; |
229 | sb = | 234 | sb = |
230 | addWidBool(i18n("Quick load/save (w/o Unicode)"), | 235 | addWidBool(i18n("Quick load/save (w/o Unicode)"), |
231 | &(KOPrefs::instance()->mUseQuicksave),topFrame); | 236 | &(KOPrefs::instance()->mUseQuicksave),topFrame); |
232 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); | 237 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); |
233 | #endif | 238 | #endif |
234 | #endif | 239 | #endif |
235 | } | 240 | } |
236 | void KOPrefsDialog::showSyncPage() | 241 | void KOPrefsDialog::showSyncPage() |
237 | { | 242 | { |
238 | showPage ( 0 ) ; | 243 | showPage ( 0 ) ; |
239 | kdelibcfg->showTimeZoneTab() ; | 244 | kdelibcfg->showTimeZoneTab() ; |
240 | 245 | ||
241 | } | 246 | } |
242 | void KOPrefsDialog::setupSyncAlgTab() | 247 | void KOPrefsDialog::setupSyncAlgTab() |
243 | { | 248 | { |
244 | #if 0 | 249 | #if 0 |
245 | QLabel * lab; | 250 | QLabel * lab; |
246 | QFrame *topFrame = addPage(i18n("Sync Prefs"),0,0); | 251 | QFrame *topFrame = addPage(i18n("Sync Prefs"),0,0); |
247 | mSetupSyncAlgTab = topFrame; | 252 | mSetupSyncAlgTab = topFrame; |
248 | QGridLayout *topLayout = new QGridLayout(topFrame,6,2); | 253 | QGridLayout *topLayout = new QGridLayout(topFrame,6,2); |
249 | topLayout->setSpacing(spacingHint()); | 254 | topLayout->setSpacing(mSpacingHint); |
250 | topLayout->setMargin(marginHint()); | 255 | topLayout->setMargin(mMarginHint); |
251 | int iii = 0; | 256 | int iii = 0; |
252 | 257 | ||
253 | KPrefsDialogWidBool *sb = | 258 | KPrefsDialogWidBool *sb = |
254 | addWidBool(i18n("Ask for preferences before syncing"), | 259 | addWidBool(i18n("Ask for preferences before syncing"), |
255 | &(KOPrefs::instance()->mAskForPreferences),topFrame); | 260 | &(KOPrefs::instance()->mAskForPreferences),topFrame); |
256 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); | 261 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); |
257 | 262 | ||
258 | ++iii; | 263 | ++iii; |
259 | 264 | ||
260 | KPrefsDialogWidRadios *syncPrefsGroup = | 265 | KPrefsDialogWidRadios *syncPrefsGroup = |
261 | addWidRadios(i18n("Sync preferences:"),&(KOPrefs::instance()->mSyncAlgoPrefs), | 266 | addWidRadios(i18n("Sync preferences:"),&(KOPrefs::instance()->mSyncAlgoPrefs), |
262 | topFrame); | 267 | topFrame); |
263 | syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); | 268 | syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); |
264 | syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); | 269 | syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); |
265 | syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); | 270 | syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); |
266 | syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); | 271 | syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); |
267 | syncPrefsGroup->addRadio(i18n("Force take local entry always")); | 272 | syncPrefsGroup->addRadio(i18n("Force take local entry always")); |
268 | syncPrefsGroup->addRadio(i18n("Force take remote entry always")); | 273 | syncPrefsGroup->addRadio(i18n("Force take remote entry always")); |
269 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); | 274 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); |
270 | ++iii; | 275 | ++iii; |
271 | sb = | 276 | sb = |
272 | addWidBool(i18n("Show summary after syncing"), | 277 | addWidBool(i18n("Show summary after syncing"), |
273 | &(KOPrefs::instance()->mShowSyncSummary),topFrame); | 278 | &(KOPrefs::instance()->mShowSyncSummary),topFrame); |
274 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); | 279 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); |
275 | 280 | ||
276 | ++iii; | 281 | ++iii; |
277 | #endif | 282 | #endif |
278 | 283 | ||
279 | 284 | ||
280 | 285 | ||
281 | } | 286 | } |
282 | 287 | ||
283 | 288 | ||
284 | void KOPrefsDialog::setupSyncTab() | 289 | void KOPrefsDialog::setupSyncTab() |
285 | { | 290 | { |
286 | #if 0 | 291 | #if 0 |
287 | QLabel * lab; | 292 | QLabel * lab; |
288 | QFrame *topFrame = addPage(i18n("Sync Network"),0,0); | 293 | QFrame *topFrame = addPage(i18n("Sync Network"),0,0); |
289 | QGridLayout *topLayout = new QGridLayout(topFrame,6,2); | 294 | QGridLayout *topLayout = new QGridLayout(topFrame,6,2); |
290 | topLayout->setSpacing(spacingHint()); | 295 | topLayout->setSpacing(mSpacingHint); |
291 | topLayout->setMargin(marginHint()); | 296 | topLayout->setMargin(mMarginHint); |
292 | 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); |
293 | int iii = 0; | 298 | int iii = 0; |
294 | topLayout->addMultiCellWidget(lab , iii,iii,0,1); | 299 | topLayout->addMultiCellWidget(lab , iii,iii,0,1); |
295 | ++iii; | 300 | ++iii; |
296 | 301 | ||
297 | mRemoteIPEdit = new QLineEdit(topFrame); | 302 | mRemoteIPEdit = new QLineEdit(topFrame); |
298 | lab = new QLabel(mRemoteIPEdit, i18n("Remote IP:"), topFrame); | 303 | lab = new QLabel(mRemoteIPEdit, i18n("Remote IP:"), topFrame); |
299 | topLayout->addWidget(lab ,iii,0); | 304 | topLayout->addWidget(lab ,iii,0); |
300 | topLayout->addWidget(mRemoteIPEdit,iii,1); | 305 | topLayout->addWidget(mRemoteIPEdit,iii,1); |
301 | ++iii; | 306 | ++iii; |
302 | mRemoteUser = new QLineEdit(topFrame); | 307 | mRemoteUser = new QLineEdit(topFrame); |
303 | lab = new QLabel(mRemoteUser, i18n("Remote user:"), topFrame); | 308 | lab = new QLabel(mRemoteUser, i18n("Remote user:"), topFrame); |
304 | topLayout->addWidget(lab ,iii,0); | 309 | topLayout->addWidget(lab ,iii,0); |
305 | topLayout->addWidget(mRemoteUser, iii,1); | 310 | topLayout->addWidget(mRemoteUser, iii,1); |
306 | ++iii; | 311 | ++iii; |
307 | 312 | ||
308 | mRemoteFile = new QLineEdit(topFrame); | 313 | mRemoteFile = new QLineEdit(topFrame); |
309 | lab = new QLabel(mRemoteFile, i18n("Remote file:"), topFrame); | 314 | lab = new QLabel(mRemoteFile, i18n("Remote file:"), topFrame); |
310 | topLayout->addWidget(lab ,iii,0); | 315 | topLayout->addWidget(lab ,iii,0); |
311 | topLayout->addWidget(mRemoteFile,iii,1); | 316 | topLayout->addWidget(mRemoteFile,iii,1); |
312 | ++iii; | 317 | ++iii; |
313 | 318 | ||
314 | mLocalTempFile = new QLineEdit(topFrame); | 319 | mLocalTempFile = new QLineEdit(topFrame); |
315 | lab = new QLabel(mLocalTempFile, i18n("Local temp file:"), topFrame); | 320 | lab = new QLabel(mLocalTempFile, i18n("Local temp file:"), topFrame); |
316 | topLayout->addWidget(lab ,iii,0); | 321 | topLayout->addWidget(lab ,iii,0); |
317 | topLayout->addWidget(mLocalTempFile,iii,1); | 322 | topLayout->addWidget(mLocalTempFile,iii,1); |
318 | ++iii; | 323 | ++iii; |
319 | 324 | ||
320 | KPrefsDialogWidBool *wb = | 325 | KPrefsDialogWidBool *wb = |
321 | addWidBool(i18n("Write back synced file"), | 326 | addWidBool(i18n("Write back synced file"), |
322 | &(KOPrefs::instance()->mWriteBackFile),topFrame); | 327 | &(KOPrefs::instance()->mWriteBackFile),topFrame); |
323 | topLayout->addMultiCellWidget(wb->checkBox(), iii,iii,0,1); | 328 | topLayout->addMultiCellWidget(wb->checkBox(), iii,iii,0,1); |
324 | ++iii; | 329 | ++iii; |
325 | wb = | 330 | wb = |
326 | addWidBool(i18n("Write back existing entries only"), | 331 | addWidBool(i18n("Write back existing entries only"), |
327 | &(KOPrefs::instance()->mWriteBackExistingOnly),topFrame); | 332 | &(KOPrefs::instance()->mWriteBackExistingOnly),topFrame); |
328 | topLayout->addMultiCellWidget(wb->checkBox(), iii,iii,0,1); | 333 | topLayout->addMultiCellWidget(wb->checkBox(), iii,iii,0,1); |
329 | ++iii; | 334 | ++iii; |
330 | 335 | ||
331 | #endif | 336 | #endif |
332 | } | 337 | } |
333 | 338 | ||
334 | void KOPrefsDialog::setupMainTab() | 339 | void KOPrefsDialog::setupMainTab() |
335 | { | 340 | { |
336 | QFrame *topFrame = addPage(i18n("General"),0,0); | 341 | QFrame *topFrame = addPage(i18n("General"),0,0); |
337 | // DesktopIcon("identity",KIcon::SizeMedium)); | 342 | // DesktopIcon("identity",KIcon::SizeMedium)); |
338 | 343 | ||
339 | QGridLayout *topLayout = new QGridLayout(topFrame,5,2); | 344 | QGridLayout *topLayout = new QGridLayout(topFrame,5,2); |
340 | topLayout->setSpacing(spacingHint()); | 345 | topLayout->setSpacing(mSpacingHint); |
341 | topLayout->setMargin(marginHint()); | 346 | topLayout->setMargin(mMarginHint); |
342 | 347 | ||
343 | // KPrefsDialogWidBool *emailControlCenter = | 348 | // KPrefsDialogWidBool *emailControlCenter = |
344 | // addWidBool(i18n("&Use email settings from Control Center"), | 349 | // addWidBool(i18n("&Use email settings from Control Center"), |
345 | // &(KOPrefs::instance()->mEmailControlCenter),topFrame); | 350 | // &(KOPrefs::instance()->mEmailControlCenter),topFrame); |
346 | // topLayout->addMultiCellWidget(emailControlCenter->checkBox(),0,0,0,1); | 351 | // topLayout->addMultiCellWidget(emailControlCenter->checkBox(),0,0,0,1); |
347 | // connect(emailControlCenter->checkBox(),SIGNAL(toggled(bool)), | 352 | // connect(emailControlCenter->checkBox(),SIGNAL(toggled(bool)), |
348 | // SLOT(toggleEmailSettings(bool))); | 353 | // SLOT(toggleEmailSettings(bool))); |
349 | 354 | ||
350 | mNameEdit = new QLineEdit(topFrame); | 355 | mNameEdit = new QLineEdit(topFrame); |
351 | mNameLabel = new QLabel(mNameEdit, i18n("Full &name:"), topFrame); | 356 | mNameLabel = new QLabel(mNameEdit, i18n("Full &name:"), topFrame); |
352 | topLayout->addWidget(mNameLabel,0,0); | 357 | topLayout->addWidget(mNameLabel,0,0); |
353 | topLayout->addWidget(mNameEdit,0,1); | 358 | topLayout->addWidget(mNameEdit,0,1); |
354 | 359 | ||
355 | mEmailEdit = new QLineEdit(topFrame); | 360 | mEmailEdit = new QLineEdit(topFrame); |
356 | mEmailLabel = new QLabel(mEmailEdit, i18n("E&mail address:"),topFrame); | 361 | mEmailLabel = new QLabel(mEmailEdit, i18n("E&mail address:"),topFrame); |
357 | topLayout->addWidget(mEmailLabel,1,0); | 362 | topLayout->addWidget(mEmailLabel,1,0); |
358 | topLayout->addWidget(mEmailEdit,1,1); | 363 | topLayout->addWidget(mEmailEdit,1,1); |
359 | KPrefsDialogWidBool *wb; | 364 | KPrefsDialogWidBool *wb; |
360 | 365 | ||
361 | 366 | ||
362 | 367 | ||
363 | KPrefsDialogWidBool *widbool = addWidBool(i18n("Full menu bar(nr)"), | 368 | KPrefsDialogWidBool *widbool = addWidBool(i18n("Full menu bar(nr)"), |
364 | &(KOPrefs::instance()->mShowFullMenu),topFrame); | 369 | &(KOPrefs::instance()->mShowFullMenu),topFrame); |
365 | topLayout->addMultiCellWidget( widbool->checkBox(), 2,2,0,1); | 370 | topLayout->addMultiCellWidget( widbool->checkBox(), 2,2,0,1); |
366 | 371 | ||
367 | 372 | ||
368 | widbool = addWidBool(i18n("Mini icons in toolbar(nr)"), | 373 | widbool = addWidBool(i18n("Mini icons in toolbar(nr)"), |
369 | &(KOPrefs::instance()->mToolBarMiniIcons),topFrame); | 374 | &(KOPrefs::instance()->mToolBarMiniIcons),topFrame); |
370 | topLayout->addMultiCellWidget( widbool->checkBox(), 3,3,0,1); | 375 | topLayout->addMultiCellWidget( widbool->checkBox(), 3,3,0,1); |
371 | 376 | ||
372 | 377 | ||
373 | KPrefsDialogWidBool *verticalScreen = | 378 | KPrefsDialogWidBool *verticalScreen = |
374 | addWidBool(i18n("Show vertical screen (Needs restart)"), | 379 | addWidBool(i18n("Show vertical screen (Needs restart)"), |
375 | &(KOPrefs::instance()->mVerticalScreen),topFrame); | 380 | &(KOPrefs::instance()->mVerticalScreen),topFrame); |
376 | //topLayout->addWidget(verticalScreen->checkBox(),ii++,0); | 381 | //topLayout->addWidget(verticalScreen->checkBox(),ii++,0); |
377 | topLayout->addMultiCellWidget(verticalScreen->checkBox(),4,4,0,1); | 382 | topLayout->addMultiCellWidget(verticalScreen->checkBox(),4,4,0,1); |
378 | 383 | ||
379 | 384 | ||
380 | QHBox *dummy = new QHBox(topFrame); | 385 | QHBox *dummy = new QHBox(topFrame); |
381 | new QLabel(i18n("Days in Next-X-Days:"),dummy); | 386 | new QLabel(i18n("Days in Next-X-Days:"),dummy); |
382 | mNextXDaysSpin = new QSpinBox(2,14,1,dummy); | 387 | mNextXDaysSpin = new QSpinBox(2,14,1,dummy); |
383 | 388 | ||
384 | topLayout->addMultiCellWidget(dummy,5,5,0,1); | 389 | topLayout->addMultiCellWidget(dummy,5,5,0,1); |
385 | 390 | ||
386 | 391 | ||
387 | 392 | ||
388 | // KPrefsDialogWidBool *bcc = | 393 | // KPrefsDialogWidBool *bcc = |
389 | // addWidBool(i18n("Send copy to owner when mailing events"), | 394 | // addWidBool(i18n("Send copy to owner when mailing events"), |
390 | // &(KOPrefs::instance()->mBcc),topFrame); | 395 | // &(KOPrefs::instance()->mBcc),topFrame); |
391 | // topLayout->addMultiCellWidget(bcc->checkBox(),4,4,0,1); | 396 | // topLayout->addMultiCellWidget(bcc->checkBox(),4,4,0,1); |
392 | 397 | ||
393 | 398 | ||
394 | // QGroupBox *autoSaveGroup = new QGroupBox(1,Horizontal,i18n("Auto-Save"), topFrame); | 399 | // QGroupBox *autoSaveGroup = new QGroupBox(1,Horizontal,i18n("Auto-Save"), topFrame); |
395 | //topLayout->addMultiCellWidget(autoSaveGroup,6,6,0,1); | 400 | //topLayout->addMultiCellWidget(autoSaveGroup,6,6,0,1); |
396 | 401 | ||
397 | // addWidBool(i18n("Enable automatic saving of calendar"), | 402 | // addWidBool(i18n("Enable automatic saving of calendar"), |
398 | // &(KOPrefs::instance()->mAutoSave),autoSaveGroup); | 403 | // &(KOPrefs::instance()->mAutoSave),autoSaveGroup); |
399 | 404 | ||
400 | QHBox *intervalBox = new QHBox(topFrame); | 405 | QHBox *intervalBox = new QHBox(topFrame); |
401 | // intervalBox->setSpacing(spacingHint()); | 406 | // intervalBox->setSpacing(mSpacingHint); |
402 | topLayout->addMultiCellWidget(intervalBox,6,6,0,1); | 407 | topLayout->addMultiCellWidget(intervalBox,6,6,0,1); |
403 | QLabel *autoSaveIntervalLabel = new QLabel(i18n("Auto save delay in minutes:"),intervalBox); | 408 | QLabel *autoSaveIntervalLabel = new QLabel(i18n("Auto save delay in minutes:"),intervalBox); |
404 | mAutoSaveIntervalSpin = new QSpinBox(0,500,1,intervalBox); | 409 | mAutoSaveIntervalSpin = new QSpinBox(0,500,1,intervalBox); |
405 | autoSaveIntervalLabel->setBuddy(mAutoSaveIntervalSpin); | 410 | autoSaveIntervalLabel->setBuddy(mAutoSaveIntervalSpin); |
406 | /* | 411 | /* |
407 | QHBox * agendasize = new QHBox ( topFrame ); | 412 | QHBox * agendasize = new QHBox ( topFrame ); |
408 | 413 | ||
409 | new QLabel (i18n("AllDayAgenda Height:"), agendasize ); | 414 | new QLabel (i18n("AllDayAgenda Height:"), agendasize ); |
410 | 415 | ||
411 | 416 | ||
412 | mHourSizeSlider = new QSlider(24,47,1,24,Horizontal,agendasize); | 417 | mHourSizeSlider = new QSlider(24,47,1,24,Horizontal,agendasize); |
413 | topLayout->addMultiCellWidget(agendasize,7,7,0,1); | 418 | topLayout->addMultiCellWidget(agendasize,7,7,0,1); |
414 | */ | 419 | */ |
415 | 420 | ||
416 | 421 | ||
417 | KPrefsDialogWidBool *ask = | 422 | KPrefsDialogWidBool *ask = |
418 | addWidBool(i18n("Ask for quit when closing KO/Pi"), | 423 | addWidBool(i18n("Ask for quit when closing KO/Pi"), |
419 | &(KOPrefs::instance()->mAskForQuit),topFrame); | 424 | &(KOPrefs::instance()->mAskForQuit),topFrame); |
420 | topLayout->addMultiCellWidget(ask->checkBox(),7,7,0,1); | 425 | topLayout->addMultiCellWidget(ask->checkBox(),7,7,0,1); |
421 | 426 | ||
422 | 427 | ||
423 | /* | 428 | /* |
424 | KPrefsDialogWidBool *confirmCheck = | 429 | KPrefsDialogWidBool *confirmCheck = |
425 | addWidBool(i18n("Confirm &deletes"),&(KOPrefs::instance()->mConfirm), | 430 | addWidBool(i18n("Confirm &deletes"),&(KOPrefs::instance()->mConfirm), |
426 | topFrame); | 431 | topFrame); |
427 | topLayout->addMultiCellWidget(confirmCheck->checkBox(),7,7,0,1); | 432 | topLayout->addMultiCellWidget(confirmCheck->checkBox(),7,7,0,1); |
428 | 433 | ||
429 | 434 | ||
430 | mEnableGroupScheduling = | 435 | mEnableGroupScheduling = |
431 | addWidBool(i18n("Enable group scheduling"), | 436 | addWidBool(i18n("Enable group scheduling"), |
432 | &(KOPrefs::instance()->mEnableGroupScheduling),topFrame); | 437 | &(KOPrefs::instance()->mEnableGroupScheduling),topFrame); |
433 | topLayout->addWidget(mEnableGroupScheduling->checkBox(),8,0); | 438 | topLayout->addWidget(mEnableGroupScheduling->checkBox(),8,0); |
434 | connect(mEnableGroupScheduling->checkBox(),SIGNAL(clicked()), | 439 | connect(mEnableGroupScheduling->checkBox(),SIGNAL(clicked()), |
435 | SLOT(warningGroupScheduling())); | 440 | SLOT(warningGroupScheduling())); |
436 | 441 | ||
437 | mEnableProjectView = | 442 | mEnableProjectView = |
438 | addWidBool(i18n("Enable project view"), | 443 | addWidBool(i18n("Enable project view"), |
439 | &(KOPrefs::instance()->mEnableProjectView),topFrame); | 444 | &(KOPrefs::instance()->mEnableProjectView),topFrame); |
440 | topLayout->addWidget(mEnableProjectView->checkBox(),9,0); | 445 | topLayout->addWidget(mEnableProjectView->checkBox(),9,0); |
441 | connect(mEnableProjectView->checkBox(),SIGNAL(clicked()), | 446 | connect(mEnableProjectView->checkBox(),SIGNAL(clicked()), |
442 | SLOT(warningProjectView())); | 447 | SLOT(warningProjectView())); |
443 | 448 | ||
444 | // Can't be disabled anymore | 449 | // Can't be disabled anymore |
445 | mEnableGroupScheduling->checkBox()->hide(); | 450 | mEnableGroupScheduling->checkBox()->hide(); |
446 | 451 | ||
447 | // Disable setting, because this feature now becomes stable | 452 | // Disable setting, because this feature now becomes stable |
448 | mEnableProjectView->checkBox()->hide(); | 453 | mEnableProjectView->checkBox()->hide(); |
449 | 454 | ||
450 | KPrefsDialogWidRadios *defaultFormatGroup = | 455 | KPrefsDialogWidRadios *defaultFormatGroup = |
451 | addWidRadios(i18n("Default Calendar Format"), | 456 | addWidRadios(i18n("Default Calendar Format"), |
452 | &(KOPrefs::instance()->mDefaultFormat),topFrame); | 457 | &(KOPrefs::instance()->mDefaultFormat),topFrame); |
453 | defaultFormatGroup->addRadio(i18n("vCalendar")); | 458 | defaultFormatGroup->addRadio(i18n("vCalendar")); |
454 | defaultFormatGroup->addRadio(i18n("iCalendar")); | 459 | defaultFormatGroup->addRadio(i18n("iCalendar")); |
455 | 460 | ||
456 | topLayout->addMultiCellWidget(defaultFormatGroup->groupBox(),10,10,0,1); | 461 | topLayout->addMultiCellWidget(defaultFormatGroup->groupBox(),10,10,0,1); |
457 | 462 | ||
458 | // Default format unconditionally is iCalendar | 463 | // Default format unconditionally is iCalendar |
459 | defaultFormatGroup->groupBox()->hide(); | 464 | defaultFormatGroup->groupBox()->hide(); |
460 | 465 | ||
461 | KPrefsDialogWidRadios *mailClientGroup = | 466 | KPrefsDialogWidRadios *mailClientGroup = |
462 | addWidRadios(i18n("Mail Client"),&(KOPrefs::instance()->mMailClient), | 467 | addWidRadios(i18n("Mail Client"),&(KOPrefs::instance()->mMailClient), |
463 | topFrame); | 468 | topFrame); |
464 | mailClientGroup->addRadio(i18n("KMail")); | 469 | mailClientGroup->addRadio(i18n("KMail")); |
465 | mailClientGroup->addRadio(i18n("Sendmail")); | 470 | mailClientGroup->addRadio(i18n("Sendmail")); |
466 | topLayout->addMultiCellWidget(mailClientGroup->groupBox(),11,11,0,1); | 471 | topLayout->addMultiCellWidget(mailClientGroup->groupBox(),11,11,0,1); |
467 | 472 | ||
468 | KPrefsDialogWidBool *htmlsave = | 473 | KPrefsDialogWidBool *htmlsave = |
469 | addWidBool(i18n("Export to HTML with every save"),&(KOPrefs::instance()->mHtmlWithSave), | 474 | addWidBool(i18n("Export to HTML with every save"),&(KOPrefs::instance()->mHtmlWithSave), |
470 | topFrame); | 475 | topFrame); |
471 | topLayout->addMultiCellWidget(htmlsave->checkBox(),12,12,0,1); | 476 | topLayout->addMultiCellWidget(htmlsave->checkBox(),12,12,0,1); |
472 | 477 | ||
473 | KPrefsDialogWidRadios *destinationGroup = | 478 | KPrefsDialogWidRadios *destinationGroup = |
474 | addWidRadios(i18n("New Events/Todos should"),&(KOPrefs::instance()->mDestination), | 479 | addWidRadios(i18n("New Events/Todos should"),&(KOPrefs::instance()->mDestination), |
475 | topFrame); | 480 | topFrame); |
476 | destinationGroup->addRadio(i18n("be added to the standard resource")); | 481 | destinationGroup->addRadio(i18n("be added to the standard resource")); |
477 | destinationGroup->addRadio(i18n("be asked which resource to use")); | 482 | destinationGroup->addRadio(i18n("be asked which resource to use")); |
478 | topLayout->addMultiCellWidget(destinationGroup->groupBox(),13,13,0,1); | 483 | topLayout->addMultiCellWidget(destinationGroup->groupBox(),13,13,0,1); |
479 | 484 | ||
480 | topLayout->setRowStretch(14,1); | 485 | topLayout->setRowStretch(14,1); |
481 | */ | 486 | */ |
482 | } | 487 | } |
483 | 488 | ||
484 | 489 | ||
485 | void KOPrefsDialog::setupTimeTab() | 490 | void KOPrefsDialog::setupTimeTab() |
486 | { | 491 | { |
487 | QFrame *topFrame = addPage(i18n("Time"),0,0); | 492 | QFrame *topFrame = addPage(i18n("Time"),0,0); |
488 | // DesktopIcon("clock",KIcon::SizeMedium)); | 493 | // DesktopIcon("clock",KIcon::SizeMedium)); |
489 | 494 | ||
490 | QGridLayout *topLayout = new QGridLayout(topFrame,4,2); | 495 | QGridLayout *topLayout = new QGridLayout(topFrame,4,2); |
491 | topLayout->setSpacing(spacingHint()); | 496 | topLayout->setSpacing(mSpacingHint); |
492 | topLayout->setMargin(marginHint()); | 497 | topLayout->setMargin(mMarginHint); |
493 | 498 | ||
494 | QHBox *dummy = new QHBox(topFrame); | 499 | QHBox *dummy = new QHBox(topFrame); |
495 | KPrefsDialogWidTime *dayBegins = | 500 | KPrefsDialogWidTime *dayBegins = |
496 | addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins), | 501 | addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins), |
497 | dummy); | 502 | dummy); |
498 | //topLayout->addWidget(dayBegins->label(),2,0); | 503 | //topLayout->addWidget(dayBegins->label(),2,0); |
499 | 504 | ||
500 | //topLayout->addWidget(dayBegins->spinBox(),2,1); | 505 | //topLayout->addWidget(dayBegins->spinBox(),2,1); |
501 | topLayout->addMultiCellWidget(dummy,0,0,0,1); | 506 | topLayout->addMultiCellWidget(dummy,0,0,0,1); |
502 | 507 | ||
503 | topLayout->addWidget(new QLabel(i18n("Default appointment time:"), | 508 | topLayout->addWidget(new QLabel(i18n("Default appointment time:"), |
504 | topFrame),1,0); | 509 | topFrame),1,0); |
505 | mStartTimeSpin = new QSpinBox(0,23,1,topFrame); | 510 | mStartTimeSpin = new QSpinBox(0,23,1,topFrame); |
506 | mStartTimeSpin->setSuffix(":00"); | 511 | mStartTimeSpin->setSuffix(":00"); |
507 | topLayout->addWidget(mStartTimeSpin,1,1); | 512 | topLayout->addWidget(mStartTimeSpin,1,1); |
508 | 513 | ||
509 | topLayout->addWidget(new QLabel(i18n("Def. duration of new app.:"), | 514 | topLayout->addWidget(new QLabel(i18n("Def. duration of new app.:"), |
510 | topFrame),2,0); | 515 | topFrame),2,0); |
511 | mDefaultDurationSpin = new QSpinBox(0,23,1,topFrame); | 516 | mDefaultDurationSpin = new QSpinBox(0,23,1,topFrame); |
512 | mDefaultDurationSpin->setSuffix(":00"); | 517 | mDefaultDurationSpin->setSuffix(":00"); |
513 | topLayout->addWidget(mDefaultDurationSpin,2,1); | 518 | topLayout->addWidget(mDefaultDurationSpin,2,1); |
514 | 519 | ||
515 | QStringList alarmList; | 520 | QStringList alarmList; |
516 | alarmList << i18n("1 minute") << i18n("5 minutes") << i18n("10 minutes") | 521 | alarmList << i18n("1 minute") << i18n("5 minutes") << i18n("10 minutes") |
517 | << i18n("15 minutes") << i18n("30 minutes")<< i18n("1 hour")<< i18n("3 hours") << i18n("24 hours") ; | 522 | << i18n("15 minutes") << i18n("30 minutes")<< i18n("1 hour")<< i18n("3 hours") << i18n("24 hours") ; |
518 | topLayout->addWidget(new QLabel(i18n("Default alarm time:"),topFrame), | 523 | topLayout->addWidget(new QLabel(i18n("Default alarm time:"),topFrame), |
519 | 3,0); | 524 | 3,0); |
520 | mAlarmTimeCombo = new QComboBox(topFrame); | 525 | mAlarmTimeCombo = new QComboBox(topFrame); |
521 | mAlarmTimeCombo->insertStringList(alarmList); | 526 | mAlarmTimeCombo->insertStringList(alarmList); |
522 | topLayout->addWidget(mAlarmTimeCombo,3,1); | 527 | topLayout->addWidget(mAlarmTimeCombo,3,1); |
523 | 528 | ||
524 | 529 | ||
525 | QGroupBox *workingHoursGroup = new QGroupBox(1,Horizontal, | 530 | QGroupBox *workingHoursGroup = new QGroupBox(1,Horizontal, |
526 | i18n("Working Hours"), | 531 | i18n("Working Hours"), |
527 | topFrame); | 532 | topFrame); |
528 | topLayout->addMultiCellWidget(workingHoursGroup,4,4,0,1); | 533 | topLayout->addMultiCellWidget(workingHoursGroup,4,4,0,1); |
529 | workingHoursGroup->layout()->setSpacing( 0 ); | 534 | workingHoursGroup->layout()->setSpacing( 0 ); |
530 | workingHoursGroup->layout()->setMargin( 4 ); | 535 | workingHoursGroup->layout()->setMargin( 4 ); |
531 | QHBox *workStartBox = new QHBox(workingHoursGroup); | 536 | QHBox *workStartBox = new QHBox(workingHoursGroup); |
532 | // workStartBox->setMargin( 0 ); | 537 | // workStartBox->setMargin( 0 ); |
533 | addWidTime(i18n("Daily starting hour:"), | 538 | addWidTime(i18n("Daily starting hour:"), |
534 | &(KOPrefs::instance()->mWorkingHoursStart),workStartBox); | 539 | &(KOPrefs::instance()->mWorkingHoursStart),workStartBox); |
535 | 540 | ||
536 | QHBox *workEndBox = new QHBox(workingHoursGroup); | 541 | QHBox *workEndBox = new QHBox(workingHoursGroup); |
537 | //workEndBox->setMargin( 0 ); | 542 | //workEndBox->setMargin( 0 ); |
538 | addWidTime(i18n("Daily ending hour:"), | 543 | addWidTime(i18n("Daily ending hour:"), |
539 | &(KOPrefs::instance()->mWorkingHoursEnd),workEndBox); | 544 | &(KOPrefs::instance()->mWorkingHoursEnd),workEndBox); |
540 | QVBox *excludeBox = new QVBox(workingHoursGroup); | 545 | QVBox *excludeBox = new QVBox(workingHoursGroup); |
541 | //excludeBox->setMargin( 0 ); | 546 | //excludeBox->setMargin( 0 ); |
542 | addWidBool(i18n("Exclude holidays"), | 547 | addWidBool(i18n("Exclude holidays"), |
543 | &(KOPrefs::instance()->mExcludeHolidays),excludeBox); | 548 | &(KOPrefs::instance()->mExcludeHolidays),excludeBox); |
544 | 549 | ||
545 | addWidBool(i18n("Exclude Saturdays"), | 550 | addWidBool(i18n("Exclude Saturdays"), |
546 | &(KOPrefs::instance()->mExcludeSaturdays),excludeBox); | 551 | &(KOPrefs::instance()->mExcludeSaturdays),excludeBox); |
547 | 552 | ||
548 | // KPrefsDialogWidBool *marcusBainsShowSeconds = addWidBool(i18n("Show seconds on Marcus Bains line"), | 553 | // KPrefsDialogWidBool *marcusBainsShowSeconds = addWidBool(i18n("Show seconds on Marcus Bains line"), |
549 | // &(KOPrefs::instance()->mMarcusBainsShowSeconds), | 554 | // &(KOPrefs::instance()->mMarcusBainsShowSeconds), |
550 | // topFrame); | 555 | // topFrame); |
551 | // topLayout->addWidget(marcusBainsShowSeconds->checkBox(),5,0); | 556 | // topLayout->addWidget(marcusBainsShowSeconds->checkBox(),5,0); |
552 | 557 | ||
553 | // topLayout->setRowStretch(6,1); | 558 | // topLayout->setRowStretch(6,1); |
554 | } | 559 | } |
555 | 560 | ||
556 | 561 | ||
557 | void KOPrefsDialog::setupViewsTab() | 562 | void KOPrefsDialog::setupViewsTab() |
558 | { | 563 | { |
559 | 564 | ||
560 | QFrame *topFrame = addPage(i18n("Views"),0,0); | 565 | QFrame *topFrame = addPage(i18n("Views"),0,0); |
561 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | 566 | // DesktopIcon("viewmag",KIcon::SizeMedium)); |
562 | 567 | ||
563 | QGridLayout *topLayout = new QGridLayout(topFrame,6,1); | 568 | QGridLayout *topLayout = new QGridLayout(topFrame,6,1); |
564 | topLayout->setSpacing(spacingHint()); | 569 | topLayout->setSpacing(mSpacingHint); |
565 | topLayout->setMargin(marginHint()); | 570 | topLayout->setMargin(mMarginHint); |
566 | 571 | ||
567 | // QBoxLayout *dayBeginsLayout = new QHBoxLayout; | 572 | // QBoxLayout *dayBeginsLayout = new QHBoxLayout; |
568 | // topLayout->addLayout(dayBeginsLayout,0,0); | 573 | // topLayout->addLayout(dayBeginsLayout,0,0); |
569 | 574 | ||
570 | // KPrefsDialogWidTime *dayBegins = | 575 | // KPrefsDialogWidTime *dayBegins = |
571 | // addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins), | 576 | // addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins), |
572 | // topFrame); | 577 | // topFrame); |
573 | // dayBeginsLayout->addWidget(dayBegins->label()); | 578 | // dayBeginsLayout->addWidget(dayBegins->label()); |
574 | // dayBeginsLayout->addStretch(1); | 579 | // dayBeginsLayout->addStretch(1); |
575 | // dayBeginsLayout->addWidget(dayBegins->spinBox()); | 580 | // dayBeginsLayout->addWidget(dayBegins->spinBox()); |
576 | 581 | ||
577 | // QBoxLayout *nextDaysLayout = new QHBoxLayout; | 582 | // QBoxLayout *nextDaysLayout = new QHBoxLayout; |
578 | // topLayout->addLayout(nextDaysLayout,1,0); | 583 | // topLayout->addLayout(nextDaysLayout,1,0); |
579 | // 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)); |
580 | // mNextXDaysSpin = new QSpinBox(2,14,1,topFrame); | 585 | // mNextXDaysSpin = new QSpinBox(2,14,1,topFrame); |
581 | // nextDaysLayout->addStretch(1); | 586 | // nextDaysLayout->addStretch(1); |
582 | // nextDaysLayout->addWidget(mNextXDaysSpin); | 587 | // nextDaysLayout->addWidget(mNextXDaysSpin); |
583 | 588 | ||
584 | 589 | ||
585 | int ii = 0; | 590 | int ii = 0; |
586 | KPrefsDialogWidBool *dummy = | 591 | KPrefsDialogWidBool *dummy = |
587 | addWidBool(i18n("Edit item on doubleclick (if not, show)"), | 592 | addWidBool(i18n("Edit item on doubleclick (if not, show)"), |
588 | &(KOPrefs::instance()->mEditOnDoubleClick),topFrame); | 593 | &(KOPrefs::instance()->mEditOnDoubleClick),topFrame); |
589 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 594 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
590 | 595 | ||
591 | 596 | ||
592 | 597 | ||
593 | 598 | ||
594 | 599 | ||
595 | 600 | ||
596 | // topLayout->addWidget(hourSizeGroup,ii++,0); | 601 | // topLayout->addWidget(hourSizeGroup,ii++,0); |
597 | // topLayout->addMultiCellWidget(hourSizeGroup,ii,ii,0,0); | 602 | // topLayout->addMultiCellWidget(hourSizeGroup,ii,ii,0,0); |
598 | //topLayout->setRowStretch(11,1); | 603 | //topLayout->setRowStretch(11,1); |
599 | 604 | ||
600 | 605 | ||
601 | 606 | ||
602 | 607 | ||
603 | #if 0 | 608 | #if 0 |
604 | 609 | ||
605 | topFrame = addPage(i18n("ViewChange"),0,0); | 610 | topFrame = addPage(i18n("ViewChange"),0,0); |
606 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | 611 | // DesktopIcon("viewmag",KIcon::SizeMedium)); |
607 | 612 | ||
608 | topLayout = new QGridLayout(topFrame,6,1); | 613 | topLayout = new QGridLayout(topFrame,6,1); |
609 | topLayout->setSpacing(spacingHint()); | 614 | topLayout->setSpacing(mSpacingHint); |
610 | topLayout->setMargin(marginHint()); | 615 | topLayout->setMargin(mMarginHint); |
611 | ii = 0; | 616 | ii = 0; |
612 | 617 | ||
613 | #endif | 618 | #endif |
614 | 619 | ||
615 | dummy = | 620 | dummy = |
616 | addWidBool(i18n("Hold fullscreen on view change"), | 621 | addWidBool(i18n("Hold fullscreen on view change"), |
617 | &(KOPrefs::instance()->mViewChangeHoldFullscreen),topFrame); | 622 | &(KOPrefs::instance()->mViewChangeHoldFullscreen),topFrame); |
618 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 623 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
619 | 624 | ||
620 | dummy = | 625 | dummy = |
621 | addWidBool(i18n("Hold non-fullscreen on view change"), | 626 | addWidBool(i18n("Hold non-fullscreen on view change"), |
622 | &(KOPrefs::instance()->mViewChangeHoldNonFullscreen),topFrame); | 627 | &(KOPrefs::instance()->mViewChangeHoldNonFullscreen),topFrame); |
623 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 628 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
624 | 629 | ||
625 | 630 | ||
626 | 631 | ||
627 | KPrefsDialogWidBool *fullViewMonth = | 632 | KPrefsDialogWidBool *fullViewMonth = |
628 | addWidBool(i18n("Next days view uses full window"), | 633 | addWidBool(i18n("Next days view uses full window"), |
629 | &(KOPrefs::instance()->mFullViewMonth),topFrame); | 634 | &(KOPrefs::instance()->mFullViewMonth),topFrame); |
630 | topLayout->addWidget(fullViewMonth->checkBox(),ii++,0); | 635 | topLayout->addWidget(fullViewMonth->checkBox(),ii++,0); |
631 | 636 | ||
632 | 637 | ||
633 | KPrefsDialogWidBool *fullViewTodo = | 638 | KPrefsDialogWidBool *fullViewTodo = |
634 | addWidBool(i18n("Event list view uses full window"), | 639 | addWidBool(i18n("Event list view uses full window"), |
635 | &(KOPrefs::instance()->mFullViewTodo),topFrame); | 640 | &(KOPrefs::instance()->mFullViewTodo),topFrame); |
636 | topLayout->addWidget(fullViewTodo->checkBox(),ii++,0); | 641 | topLayout->addWidget(fullViewTodo->checkBox(),ii++,0); |
637 | dummy = | 642 | dummy = |
638 | addWidBool(i18n("Listview uses monthly timespan"), | 643 | addWidBool(i18n("Listview uses monthly timespan"), |
639 | &(KOPrefs::instance()->mListViewMonthTimespan),topFrame); | 644 | &(KOPrefs::instance()->mListViewMonthTimespan),topFrame); |
640 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 645 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
641 | dummy = | 646 | dummy = |
642 | addWidBool(i18n("Highlight selection in Time Edit"), | 647 | addWidBool(i18n("Highlight selection in Time Edit"), |
643 | &(KOPrefs::instance()->mHightlightDateTimeEdit),topFrame); | 648 | &(KOPrefs::instance()->mHightlightDateTimeEdit),topFrame); |
644 | topLayout->addWidget( dummy->checkBox(), ii++,0); | 649 | topLayout->addWidget( dummy->checkBox(), ii++,0); |
645 | 650 | ||
646 | KPrefsDialogWidBool *dailyRecur = | 651 | KPrefsDialogWidBool *dailyRecur = |
647 | addWidBool(i18n("Show events that recur daily in date nav."), | 652 | addWidBool(i18n("Show events that recur daily in date nav."), |
648 | &(KOPrefs::instance()->mDailyRecur),topFrame); | 653 | &(KOPrefs::instance()->mDailyRecur),topFrame); |
649 | topLayout->addWidget(dailyRecur->checkBox(),ii++,0); | 654 | topLayout->addWidget(dailyRecur->checkBox(),ii++,0); |
650 | 655 | ||
651 | KPrefsDialogWidBool *weeklyRecur = | 656 | KPrefsDialogWidBool *weeklyRecur = |
652 | addWidBool(i18n("Show ev. that recur weekly in date nav."), | 657 | addWidBool(i18n("Show ev. that recur weekly in date nav."), |
653 | &(KOPrefs::instance()->mWeeklyRecur),topFrame); | 658 | &(KOPrefs::instance()->mWeeklyRecur),topFrame); |
654 | topLayout->addWidget(weeklyRecur->checkBox(),ii++,0); | 659 | topLayout->addWidget(weeklyRecur->checkBox(),ii++,0); |
655 | 660 | ||
656 | 661 | #ifdef DESKTOP_VERSION | |
657 | KPrefsDialogWidBool *enableToolTips = | 662 | KPrefsDialogWidBool *enableToolTips = |
658 | addWidBool(i18n("Enable tooltips displaying summary of ev."), | 663 | addWidBool(i18n("Enable tooltips displaying summary of ev."), |
659 | &(KOPrefs::instance()->mEnableToolTips),topFrame); | 664 | &(KOPrefs::instance()->mEnableToolTips),topFrame); |
660 | topLayout->addWidget(enableToolTips->checkBox(),ii++,0); | 665 | topLayout->addWidget(enableToolTips->checkBox(),ii++,0); |
661 | 666 | #endif | |
662 | // ********************************************************* | 667 | // ********************************************************* |
663 | 668 | ||
664 | topFrame = addPage(i18n("Agenda View"),0,0); | 669 | topFrame = addPage(i18n("Agenda View"),0,0); |
665 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | 670 | // DesktopIcon("viewmag",KIcon::SizeMedium)); |
666 | 671 | ||
667 | topLayout = new QGridLayout(topFrame,5,1); | 672 | topLayout = new QGridLayout(topFrame,5,1); |
668 | topLayout->setSpacing(spacingHint()); | 673 | topLayout->setSpacing(mSpacingHint); |
669 | topLayout->setMargin(marginHint()); | 674 | topLayout->setMargin(mMarginHint); |
670 | ii = 0; | 675 | ii = 0; |
671 | 676 | ||
672 | 677 | ||
673 | dummy = | 678 | dummy = |
674 | addWidBool(i18n("Show time in agenda items"), | 679 | addWidBool(i18n("Show time in agenda items"), |
675 | &(KOPrefs::instance()->mShowTimeInAgenda),topFrame); | 680 | &(KOPrefs::instance()->mShowTimeInAgenda),topFrame); |
676 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 681 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
677 | 682 | ||
678 | dummy = | 683 | dummy = |
679 | addWidBool(i18n("Highlight current day in agenda"), | 684 | addWidBool(i18n("Highlight current day in agenda"), |
680 | &(KOPrefs::instance()->mHighlightCurrentDay),topFrame); | 685 | &(KOPrefs::instance()->mHighlightCurrentDay),topFrame); |
681 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 686 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
682 | 687 | ||
683 | dummy = | 688 | dummy = |
684 | addWidBool(i18n("Use light color for highlight current day"), | 689 | addWidBool(i18n("Use light color for highlight current day"), |
685 | &(KOPrefs::instance()->mUseHighlightLightColor),topFrame); | 690 | &(KOPrefs::instance()->mUseHighlightLightColor),topFrame); |
686 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 691 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
687 | 692 | ||
688 | 693 | ||
689 | KPrefsDialogWidBool *marcusBainsEnabled = | 694 | KPrefsDialogWidBool *marcusBainsEnabled = |
690 | addWidBool(i18n("Show current time"), | 695 | addWidBool(i18n("Show current time"), |
691 | &(KOPrefs::instance()->mMarcusBainsEnabled),topFrame); | 696 | &(KOPrefs::instance()->mMarcusBainsEnabled),topFrame); |
692 | topLayout->addWidget(marcusBainsEnabled->checkBox(),ii++,0); | 697 | topLayout->addWidget(marcusBainsEnabled->checkBox(),ii++,0); |
693 | 698 | ||
694 | 699 | ||
695 | dummy = | 700 | dummy = |
696 | addWidBool(i18n("Set agenda to DayBeginsAt on change"), | 701 | addWidBool(i18n("Set agenda to DayBeginsAt on change"), |
697 | &(KOPrefs::instance()->mSetTimeToDayStartAt),topFrame); | 702 | &(KOPrefs::instance()->mSetTimeToDayStartAt),topFrame); |
698 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 703 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
699 | 704 | ||
700 | dummy = | 705 | dummy = |
701 | addWidBool(i18n("Set agenda to current time on change"), | 706 | addWidBool(i18n("Set agenda to current time on change"), |
702 | &(KOPrefs::instance()->mCenterOnCurrentTime),topFrame); | 707 | &(KOPrefs::instance()->mCenterOnCurrentTime),topFrame); |
703 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 708 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
704 | 709 | ||
705 | 710 | ||
706 | 711 | ||
707 | 712 | ||
708 | 713 | ||
709 | 714 | ||
710 | 715 | ||
711 | topFrame = addPage(i18n("Month View"),0,0); | 716 | topFrame = addPage(i18n("Month View"),0,0); |
712 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | 717 | // DesktopIcon("viewmag",KIcon::SizeMedium)); |
713 | 718 | ||
714 | topLayout = new QGridLayout(topFrame,5,1); | 719 | topLayout = new QGridLayout(topFrame,5,1); |
715 | topLayout->setSpacing(spacingHint()); | 720 | topLayout->setSpacing(mSpacingHint); |
716 | topLayout->setMargin(marginHint()); | 721 | topLayout->setMargin(mMarginHint); |
722 | qDebug("%d %d ",mSpacingHint, mMarginHint ); | ||
717 | ii = 0; | 723 | ii = 0; |
718 | QLabel *lab; | 724 | QLabel *lab; |
719 | QHBox *habo = new QHBox( topFrame ); | 725 | QHBox *habo = new QHBox( topFrame ); |
720 | if ( QApplication::desktop()->width() <= 480 ) { | 726 | if ( QApplication::desktop()->width() <= 480 ) { |
721 | lab = new QLabel ( i18n("Show events that recur "), topFrame ); | 727 | lab = new QLabel ( i18n("Show events that recur "), topFrame ); |
722 | topLayout->addMultiCellWidget(lab,ii, ii,0,1); | 728 | topLayout->addMultiCellWidget(lab,ii, ii,0,1); |
723 | ii++; | 729 | ii++; |
724 | } else { | 730 | } else { |
725 | new QLabel ( i18n("Show events that recur "), habo ); | 731 | new QLabel ( i18n("Show events that recur "), habo ); |
726 | } | 732 | } |
727 | dailyRecur = | 733 | dailyRecur = |
728 | addWidBool(i18n("daily"), | 734 | addWidBool(i18n("daily"), |
729 | &(KOPrefs::instance()->mMonthDailyRecur),habo); | 735 | &(KOPrefs::instance()->mMonthDailyRecur),habo); |
730 | // topLayout->addWidget(dailyRecur->checkBox(),ii++,0); | 736 | // topLayout->addWidget(dailyRecur->checkBox(),ii++,0); |
731 | 737 | ||
732 | weeklyRecur = | 738 | weeklyRecur = |
733 | addWidBool(i18n("weekly"), | 739 | addWidBool(i18n("weekly"), |
734 | &(KOPrefs::instance()->mMonthWeeklyRecur),habo); | 740 | &(KOPrefs::instance()->mMonthWeeklyRecur),habo); |
735 | topLayout->addMultiCellWidget(habo,ii, ii,0,1); | 741 | topLayout->addMultiCellWidget(habo,ii, ii,0,1); |
736 | ii++; | 742 | ii++; |
737 | 743 | ||
738 | 744 | ||
739 | habo = new QHBox( topFrame ); | 745 | habo = new QHBox( topFrame ); |
740 | if ( QApplication::desktop()->width() <= 480 ) { | 746 | if ( QApplication::desktop()->width() <= 480 ) { |
741 | lab = new QLabel (i18n("Show in every cell ") , topFrame ); | 747 | lab = new QLabel (i18n("Show in every cell ") , topFrame ); |
742 | topLayout->addMultiCellWidget(lab,ii, ii,0,1); | 748 | topLayout->addMultiCellWidget(lab,ii, ii,0,1); |
743 | ii++; | 749 | ii++; |
744 | 750 | ||
745 | } else { | 751 | } else { |
746 | new QLabel ( i18n("Show in every cell "), habo ); | 752 | new QLabel ( i18n("Show in every cell "), habo ); |
747 | } | 753 | } |
748 | weeklyRecur = | 754 | weeklyRecur = |
749 | addWidBool(i18n("short month"), | 755 | addWidBool(i18n("short month"), |
750 | &(KOPrefs::instance()->mMonthShowShort),habo); | 756 | &(KOPrefs::instance()->mMonthShowShort),habo); |
751 | weeklyRecur = | 757 | weeklyRecur = |
752 | addWidBool(i18n("icons"), | 758 | addWidBool(i18n("icons"), |
753 | &(KOPrefs::instance()->mMonthShowIcons),habo); | 759 | &(KOPrefs::instance()->mMonthShowIcons),habo); |
754 | 760 | ||
755 | topLayout->addMultiCellWidget(habo,ii, ii,0,1); | 761 | topLayout->addMultiCellWidget(habo,ii, ii,0,1); |
756 | ii++; | 762 | ii++; |
757 | #ifdef DESKTOP_VERSION | 763 | #ifdef DESKTOP_VERSION |
758 | KPrefsDialogWidBool *enableMonthScroll = | 764 | KPrefsDialogWidBool *enableMonthScroll = |
759 | addWidBool(i18n("Enable scrollbars in month view cells"), | 765 | addWidBool(i18n("Enable scrollbars in month view cells"), |
760 | &(KOPrefs::instance()->mEnableMonthScroll),topFrame); | 766 | &(KOPrefs::instance()->mEnableMonthScroll),topFrame); |
761 | topLayout->addWidget(enableMonthScroll->checkBox(),ii++,0); | 767 | topLayout->addWidget(enableMonthScroll->checkBox(),ii++,0); |
762 | #endif | 768 | #endif |
763 | dummy = | 769 | dummy = |
764 | addWidBool(i18n("Week view mode uses bigger font"), | 770 | addWidBool(i18n("Week view mode uses bigger font"), |
765 | &(KOPrefs::instance()->mMonthViewUsesBigFont),topFrame); | 771 | &(KOPrefs::instance()->mMonthViewUsesBigFont),topFrame); |
766 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 772 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
767 | dummy = | 773 | dummy = |
768 | addWidBool(i18n("Show Sat/Sun together"), | 774 | addWidBool(i18n("Show Sat/Sun together"), |
769 | &(KOPrefs::instance()->mMonthViewSatSunTog),topFrame); | 775 | &(KOPrefs::instance()->mMonthViewSatSunTog),topFrame); |
770 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 776 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
771 | 777 | ||
772 | KPrefsDialogWidBool *coloredCategoriesInMonthView = | 778 | KPrefsDialogWidBool *coloredCategoriesInMonthView = |
773 | addWidBool(i18n("Month view uses category colors"), | 779 | addWidBool(i18n("Month view uses category colors"), |
774 | &(KOPrefs::instance()->mMonthViewUsesCategoryColor),topFrame); | 780 | &(KOPrefs::instance()->mMonthViewUsesCategoryColor),topFrame); |
775 | topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); | 781 | topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); |
776 | 782 | ||
777 | dummy = | 783 | dummy = |
778 | addWidBool(i18n("Categorie colors are applied to text"), | 784 | addWidBool(i18n("Categorie colors are applied to text"), |
779 | &(KOPrefs::instance()->mMonthViewUsesForegroundColor),topFrame); | 785 | &(KOPrefs::instance()->mMonthViewUsesForegroundColor),topFrame); |
780 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 786 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
781 | coloredCategoriesInMonthView = | 787 | coloredCategoriesInMonthView = |
782 | addWidBool(i18n("Month view uses day colors"), | 788 | addWidBool(i18n("Month view uses day colors"), |
783 | &(KOPrefs::instance()->mMonthViewUsesDayColors),topFrame); | 789 | &(KOPrefs::instance()->mMonthViewUsesDayColors),topFrame); |
784 | topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); | 790 | topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); |
785 | 791 | ||
786 | KPrefsDialogWidColor *holidayColor = | 792 | KPrefsDialogWidColor *holidayColor = |
787 | addWidColor(i18n("Day color odd months"), | 793 | addWidColor(i18n("Day color odd months"), |
788 | &(KOPrefs::instance()->mMonthViewOddColor),topFrame); | 794 | &(KOPrefs::instance()->mMonthViewOddColor),topFrame); |
789 | topLayout->addWidget(holidayColor->label(),ii,0); | 795 | topLayout->addWidget(holidayColor->label(),ii,0); |
790 | topLayout->addWidget(holidayColor->button(),ii++,1); | 796 | topLayout->addWidget(holidayColor->button(),ii++,1); |
791 | 797 | ||
792 | holidayColor = | 798 | holidayColor = |
793 | addWidColor(i18n("Day color even months"), | 799 | addWidColor(i18n("Day color even months"), |
794 | &(KOPrefs::instance()->mMonthViewEvenColor),topFrame); | 800 | &(KOPrefs::instance()->mMonthViewEvenColor),topFrame); |
795 | topLayout->addWidget(holidayColor->label(),ii,0); | 801 | topLayout->addWidget(holidayColor->label(),ii,0); |
796 | topLayout->addWidget(holidayColor->button(),ii++,1); | 802 | topLayout->addWidget(holidayColor->button(),ii++,1); |
797 | 803 | ||
798 | 804 | ||
799 | holidayColor = | 805 | holidayColor = |
800 | addWidColor(i18n("Color for Sundays + category \"Holiday\""), | 806 | addWidColor(i18n("Color for Sundays + category \"Holiday\""), |
801 | &(KOPrefs::instance()->mMonthViewHolidayColor),topFrame); | 807 | &(KOPrefs::instance()->mMonthViewHolidayColor),topFrame); |
802 | topLayout->addWidget(holidayColor->label(),ii,0); | 808 | topLayout->addWidget(holidayColor->label(),ii,0); |
803 | topLayout->addWidget(holidayColor->button(),ii++,1); | 809 | topLayout->addWidget(holidayColor->button(),ii++,1); |
804 | // *********************** What'sNext View | 810 | // *********************** What'sNext View |
805 | topFrame = addPage(i18n("What's Next View"),0,0); | 811 | topFrame = addPage(i18n("What's Next View"),0,0); |
806 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | 812 | // DesktopIcon("viewmag",KIcon::SizeMedium)); |
807 | 813 | ||
808 | topLayout = new QGridLayout(topFrame,4,1); | 814 | topLayout = new QGridLayout(topFrame,4,1); |
809 | topLayout->setSpacing(spacingHint()); | 815 | topLayout->setSpacing(mSpacingHint); |
810 | topLayout->setMargin(marginHint()); | 816 | topLayout->setMargin(mMarginHint); |
811 | ii = 0; | 817 | ii = 0; |
812 | 818 | ||
813 | 819 | ||
814 | QHBox* hdummy = new QHBox(topFrame); | 820 | QHBox* hdummy = new QHBox(topFrame); |
815 | new QLabel(i18n("Days in What's Next:"),hdummy); | 821 | new QLabel(i18n("Days in What's Next:"),hdummy); |
816 | mWhatsNextSpin = new QSpinBox(1,14,1,hdummy); | 822 | mWhatsNextSpin = new QSpinBox(1,14,1,hdummy); |
817 | 823 | ||
818 | topLayout->addWidget(hdummy,ii++,0); | 824 | topLayout->addWidget(hdummy,ii++,0); |
819 | 825 | ||
820 | QHBox *prioBox = new QHBox(topFrame); | 826 | QHBox *prioBox = new QHBox(topFrame); |
821 | // intervalBox->setSpacing(spacingHint()); | 827 | // intervalBox->setSpacing(mSpacingHint); |
822 | topLayout->addWidget(prioBox,ii++,0); | 828 | topLayout->addWidget(prioBox,ii++,0); |
823 | QString messa = i18n("Show topmost todo prios in What's Next:"); | 829 | QString messa = i18n("Show topmost todo prios in What's Next:"); |
824 | 830 | ||
825 | if ( QApplication::desktop()->width() < 300 ) | 831 | if ( QApplication::desktop()->width() < 300 ) |
826 | messa = i18n("Show topmost todo prios in What's N.:"); | 832 | messa = i18n("Show topmost todo prios in What's N.:"); |
827 | QLabel *prioLabel = new QLabel(messa, prioBox); | 833 | QLabel *prioLabel = new QLabel(messa, prioBox); |
828 | mPrioSpin = new QSpinBox(0,5,1,prioBox); | 834 | mPrioSpin = new QSpinBox(0,5,1,prioBox); |
829 | if ( QApplication::desktop()->width() < 300 ) | 835 | if ( QApplication::desktop()->width() < 300 ) |
830 | mPrioSpin->setFixedWidth( 40 ); | 836 | mPrioSpin->setFixedWidth( 40 ); |
831 | 837 | ||
832 | KPrefsDialogWidBool *passwdk = | 838 | KPrefsDialogWidBool *passwdk = |
833 | 839 | ||
834 | addWidBool(i18n("Show events, that are done in \nWhat's Next view"), | 840 | addWidBool(i18n("Show events, that are done in \nWhat's Next view"), |
835 | &(KOPrefs::instance()->mWNViewShowsPast),topFrame); | 841 | &(KOPrefs::instance()->mWNViewShowsPast),topFrame); |
836 | topLayout->addWidget(passwdk->checkBox(), ii++,0); | 842 | topLayout->addWidget(passwdk->checkBox(), ii++,0); |
837 | passwdk = | 843 | passwdk = |
838 | addWidBool(i18n("Show parent To-Do's in What's Next view"), | 844 | addWidBool(i18n("Show parent To-Do's in What's Next view"), |
839 | &(KOPrefs::instance()->mWNViewShowsParents),topFrame); | 845 | &(KOPrefs::instance()->mWNViewShowsParents),topFrame); |
840 | topLayout->addWidget(passwdk->checkBox(), ii++,0); | 846 | topLayout->addWidget(passwdk->checkBox(), ii++,0); |
841 | 847 | ||
842 | passwdk = | 848 | passwdk = |
843 | addWidBool(i18n("Show location in What's Next view"), | 849 | addWidBool(i18n("Show location in What's Next view"), |
844 | &(KOPrefs::instance()->mWNViewShowLocation),topFrame); | 850 | &(KOPrefs::instance()->mWNViewShowLocation),topFrame); |
845 | topLayout->addWidget(passwdk->checkBox(), ii++,0); | 851 | topLayout->addWidget(passwdk->checkBox(), ii++,0); |
846 | 852 | ||
847 | passwdk = | 853 | passwdk = |
848 | addWidBool(i18n("Show Sync Events in \nWhat's Next/Agenda view"), | 854 | addWidBool(i18n("Show Sync Events in \nWhat's Next/Agenda view"), |
849 | &(KOPrefs::instance()->mShowSyncEvents),topFrame); | 855 | &(KOPrefs::instance()->mShowSyncEvents),topFrame); |
850 | topLayout->addWidget(passwdk->checkBox(), ii++,0); | 856 | topLayout->addWidget(passwdk->checkBox(), ii++,0); |
851 | passwdk = | 857 | passwdk = |
852 | addWidBool(i18n("Use short date in \nWhat's Next/Event view"), | 858 | addWidBool(i18n("Use short date in \nWhat's Next/Event view"), |
853 | &(KOPrefs::instance()->mShortDateInViewer),topFrame); | 859 | &(KOPrefs::instance()->mShortDateInViewer),topFrame); |
854 | topLayout->addWidget(passwdk->checkBox(), ii++,0); | 860 | topLayout->addWidget(passwdk->checkBox(), ii++,0); |
855 | 861 | ||
856 | 862 | ||
857 | 863 | ||
858 | 864 | ||
859 | // *********************** Todo View | 865 | // *********************** Todo View |
860 | 866 | ||
861 | topFrame = addPage(i18n("Todo View"),0,0); | 867 | topFrame = addPage(i18n("Todo View"),0,0); |
862 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | 868 | // DesktopIcon("viewmag",KIcon::SizeMedium)); |
863 | 869 | ||
864 | topLayout = new QGridLayout(topFrame,4,1); | 870 | topLayout = new QGridLayout(topFrame,4,1); |
865 | topLayout->setSpacing(spacingHint()); | 871 | topLayout->setSpacing(mSpacingHint); |
866 | topLayout->setMargin(marginHint()); | 872 | topLayout->setMargin(mMarginHint); |
867 | ii = 0; | 873 | ii = 0; |
868 | dummy = | 874 | dummy = |
869 | addWidBool(i18n("Hide not running Todos in To-do view"), | 875 | addWidBool(i18n("Hide not running Todos in To-do view"), |
870 | &(KOPrefs::instance()->mHideNonStartedTodos),topFrame); | 876 | &(KOPrefs::instance()->mHideNonStartedTodos),topFrame); |
871 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 877 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
872 | 878 | ||
873 | 879 | ||
874 | KPrefsDialogWidBool *showCompletedTodo = | 880 | KPrefsDialogWidBool *showCompletedTodo = |
875 | addWidBool(i18n("To-do view shows completed Todos"), | 881 | addWidBool(i18n("To-do view shows completed Todos"), |
876 | &(KOPrefs::instance()->mShowCompletedTodo),topFrame); | 882 | &(KOPrefs::instance()->mShowCompletedTodo),topFrame); |
877 | topLayout->addWidget(showCompletedTodo->checkBox(),ii++,0); | 883 | topLayout->addWidget(showCompletedTodo->checkBox(),ii++,0); |
878 | dummy = | 884 | dummy = |
879 | addWidBool(i18n("To-do view shows complete as 'xx %'"), | 885 | addWidBool(i18n("To-do view shows complete as 'xx %'"), |
880 | &(KOPrefs::instance()->mTodoViewShowsPercentage),topFrame); | 886 | &(KOPrefs::instance()->mTodoViewShowsPercentage),topFrame); |
881 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 887 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
882 | 888 | ||
883 | dummy = | 889 | dummy = |
884 | addWidBool(i18n("Small To-do view uses smaller font"), | 890 | addWidBool(i18n("Small To-do view uses smaller font"), |
885 | &(KOPrefs::instance()->mTodoViewUsesSmallFont),topFrame); | 891 | &(KOPrefs::instance()->mTodoViewUsesSmallFont),topFrame); |
886 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 892 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
887 | 893 | ||
888 | 894 | ||
889 | 895 | ||
890 | dummy = | 896 | dummy = |
891 | addWidBool(i18n("Todo view uses category colors"), | 897 | addWidBool(i18n("Todo view uses category colors"), |
892 | &(KOPrefs::instance()->mTodoViewUsesCatColors),topFrame); | 898 | &(KOPrefs::instance()->mTodoViewUsesCatColors),topFrame); |
893 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 899 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
894 | 900 | ||
895 | 901 | ||
896 | QWidget* wid = new QWidget( topFrame ); | 902 | QWidget* wid = new QWidget( topFrame ); |
897 | // Todo due today color | 903 | // Todo due today color |
898 | KPrefsDialogWidColor *todoDueTodayColor = | 904 | KPrefsDialogWidColor *todoDueTodayColor = |
899 | addWidColor(i18n("Todo due today color:"), | 905 | addWidColor(i18n("Todo due today color:"), |
900 | &(KOPrefs::instance()->mTodoDueTodayColor),wid); | 906 | &(KOPrefs::instance()->mTodoDueTodayColor),wid); |
901 | QHBoxLayout *widLayout = new QHBoxLayout(wid); | 907 | QHBoxLayout *widLayout = new QHBoxLayout(wid); |
902 | widLayout->addWidget( todoDueTodayColor->label() ); | 908 | widLayout->addWidget( todoDueTodayColor->label() ); |
903 | widLayout->addWidget( todoDueTodayColor->button() ); | 909 | widLayout->addWidget( todoDueTodayColor->button() ); |
904 | topLayout->addWidget(wid,ii++,0); | 910 | topLayout->addWidget(wid,ii++,0); |
905 | //topLayout->addWidget(todoDueTodayColor->button(),ii++,1); | 911 | //topLayout->addWidget(todoDueTodayColor->button(),ii++,1); |
906 | 912 | ||
907 | // Todo overdue color | 913 | // Todo overdue color |
908 | wid = new QWidget( topFrame ); | 914 | wid = new QWidget( topFrame ); |
909 | widLayout = new QHBoxLayout(wid); | 915 | widLayout = new QHBoxLayout(wid); |
910 | KPrefsDialogWidColor *todoOverdueColor = | 916 | KPrefsDialogWidColor *todoOverdueColor = |
911 | addWidColor(i18n("Todo overdue color:"), | 917 | addWidColor(i18n("Todo overdue color:"), |
912 | &(KOPrefs::instance()->mTodoOverdueColor),wid); | 918 | &(KOPrefs::instance()->mTodoOverdueColor),wid); |
913 | widLayout->addWidget(todoOverdueColor->label()); | 919 | widLayout->addWidget(todoOverdueColor->label()); |
914 | widLayout->addWidget(todoOverdueColor->button()); | 920 | widLayout->addWidget(todoOverdueColor->button()); |
915 | topLayout->addWidget(wid,ii++,0); | 921 | topLayout->addWidget(wid,ii++,0); |
916 | 922 | ||
917 | dummy = | 923 | dummy = |
918 | addWidBool(i18n("Colors are applied to text"), | 924 | addWidBool(i18n("Colors are applied to text"), |
919 | &(KOPrefs::instance()->mTodoViewUsesForegroundColor),topFrame); | 925 | &(KOPrefs::instance()->mTodoViewUsesForegroundColor),topFrame); |
920 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 926 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
921 | 927 | ||
922 | dummy = | 928 | dummy = |
923 | addWidBool(i18n("Allday Agenda view shows todos"), | 929 | addWidBool(i18n("Allday Agenda view shows todos"), |
924 | &(KOPrefs::instance()->mShowTodoInAgenda),topFrame); | 930 | &(KOPrefs::instance()->mShowTodoInAgenda),topFrame); |
925 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 931 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
926 | 932 | ||
927 | 933 | ||
928 | topFrame = addPage(i18n("View Options"),0,0); | 934 | topFrame = addPage(i18n("View Options"),0,0); |
929 | 935 | ||
930 | topLayout = new QGridLayout(topFrame,4,1); | 936 | topLayout = new QGridLayout(topFrame,4,1); |
931 | topLayout->setSpacing(spacingHint()); | 937 | topLayout->setSpacing(mSpacingHint); |
932 | topLayout->setMargin(marginHint()); | 938 | topLayout->setMargin(mMarginHint); |
933 | ii = 0; | 939 | ii = 0; |
934 | lab = new QLabel( i18n("Show in todo/event viewer:"), topFrame); | 940 | lab = new QLabel( i18n("Show in todo/event viewer:"), topFrame); |
935 | topLayout->addWidget(lab ,ii++,0); | 941 | topLayout->addWidget(lab ,ii++,0); |
936 | 942 | ||
937 | dummy = addWidBool(i18n("Details"), | 943 | dummy = addWidBool(i18n("Details"), |
938 | &(KOPrefs::instance()->mEVshowDetails),topFrame); | 944 | &(KOPrefs::instance()->mEVshowDetails),topFrame); |
939 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 945 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
940 | dummy = addWidBool(i18n("Created time"), | 946 | dummy = addWidBool(i18n("Created time"), |
941 | &(KOPrefs::instance()->mEVshowCreated),topFrame); | 947 | &(KOPrefs::instance()->mEVshowCreated),topFrame); |
942 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 948 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
943 | dummy = addWidBool(i18n("Last modified time"), | 949 | dummy = addWidBool(i18n("Last modified time"), |
944 | &(KOPrefs::instance()->mEVshowChanged),topFrame); | 950 | &(KOPrefs::instance()->mEVshowChanged),topFrame); |
945 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 951 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
946 | 952 | ||
947 | 953 | ||
948 | lab = new QLabel( i18n("Show in What'sThis quick overview:"), topFrame); | 954 | lab = new QLabel( i18n("Show in What'sThis quick overview:"), topFrame); |
949 | topLayout->addWidget(lab ,ii++,0); | 955 | topLayout->addWidget(lab ,ii++,0); |
950 | 956 | ||
951 | dummy = addWidBool(i18n("Details"), | 957 | dummy = addWidBool(i18n("Details"), |
952 | &(KOPrefs::instance()->mWTshowDetails),topFrame); | 958 | &(KOPrefs::instance()->mWTshowDetails),topFrame); |
953 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 959 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
954 | dummy = addWidBool(i18n("Created time"), | 960 | dummy = addWidBool(i18n("Created time"), |
955 | &(KOPrefs::instance()->mWTshowCreated),topFrame); | 961 | &(KOPrefs::instance()->mWTshowCreated),topFrame); |
956 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 962 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
957 | dummy = addWidBool(i18n("Last modified time"), | 963 | dummy = addWidBool(i18n("Last modified time"), |
958 | &(KOPrefs::instance()->mWTshowChanged),topFrame); | 964 | &(KOPrefs::instance()->mWTshowChanged),topFrame); |
959 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 965 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
960 | 966 | ||
961 | 967 | ||
962 | topFrame = addPage(i18n("Alarm"),0,0); | 968 | topFrame = addPage(i18n("Alarm"),0,0); |
963 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | 969 | // DesktopIcon("viewmag",KIcon::SizeMedium)); |
964 | 970 | ||
965 | topLayout = new QGridLayout(topFrame,2,1); | 971 | topLayout = new QGridLayout(topFrame,2,1); |
966 | topLayout->setSpacing(spacingHint()); | 972 | topLayout->setSpacing(mSpacingHint); |
967 | topLayout->setMargin(marginHint()); | 973 | topLayout->setMargin(mMarginHint); |
968 | int iii = 0; | 974 | int iii = 0; |
969 | 975 | ||
970 | dummy = | 976 | dummy = |
971 | addWidBool(i18n("Use internal alarm notification"), | 977 | addWidBool(i18n("Use internal alarm notification"), |
972 | &(KOPrefs::instance()->mUseInternalAlarmNotification),topFrame); | 978 | &(KOPrefs::instance()->mUseInternalAlarmNotification),topFrame); |
973 | topLayout->addWidget(dummy->checkBox(),iii++,0); | 979 | topLayout->addWidget(dummy->checkBox(),iii++,0); |
974 | 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); | 980 | 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); |
975 | 981 | ||
976 | topLayout->addWidget(lab ,iii++,0); | 982 | topLayout->addWidget(lab ,iii++,0); |
977 | #ifndef DESKTOP_VERSION | 983 | #ifndef DESKTOP_VERSION |
978 | lab->setAlignment( AlignLeft|WordBreak|AlignTop); | 984 | lab->setAlignment( AlignLeft|WordBreak|AlignTop); |
979 | #else | 985 | #else |
980 | lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop); | 986 | lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop); |
981 | lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); | 987 | lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); |
982 | #endif | 988 | #endif |
983 | 989 | ||
984 | QHBox* dummyBox = new QHBox(topFrame); | 990 | QHBox* dummyBox = new QHBox(topFrame); |
985 | new QLabel(i18n("Play beeps count:"),dummyBox); | 991 | new QLabel(i18n("Play beeps count:"),dummyBox); |
986 | mAlarmPlayBeeps = new QSpinBox(0,500,1,dummyBox); | 992 | mAlarmPlayBeeps = new QSpinBox(0,500,1,dummyBox); |
987 | topLayout->addWidget(dummyBox,iii++,0); | 993 | topLayout->addWidget(dummyBox,iii++,0); |
988 | 994 | ||
989 | dummyBox = new QHBox(topFrame); | 995 | dummyBox = new QHBox(topFrame); |
990 | new QLabel(i18n("Beeps interval in sec:"),dummyBox); | 996 | new QLabel(i18n("Beeps interval in sec:"),dummyBox); |
991 | mAlarmBeepInterval = new QSpinBox(1,600,1,dummyBox); | 997 | mAlarmBeepInterval = new QSpinBox(1,600,1,dummyBox); |
992 | topLayout->addWidget(dummyBox,iii++,0); | 998 | topLayout->addWidget(dummyBox,iii++,0); |
993 | 999 | ||
994 | dummyBox = new QHBox(topFrame); | 1000 | dummyBox = new QHBox(topFrame); |
995 | new QLabel(i18n("Default suspend time in min:"),dummyBox); | 1001 | new QLabel(i18n("Default suspend time in min:"),dummyBox); |
996 | mAlarmSuspendTime = new QSpinBox(1,600,1,dummyBox); | 1002 | mAlarmSuspendTime = new QSpinBox(1,600,1,dummyBox); |
997 | topLayout->addWidget(dummyBox,iii++,0); | 1003 | topLayout->addWidget(dummyBox,iii++,0); |
998 | 1004 | ||
999 | dummyBox = new QHBox(topFrame); | 1005 | dummyBox = new QHBox(topFrame); |
1000 | new QLabel(i18n("Auto suspend count:"),dummyBox); | 1006 | new QLabel(i18n("Auto suspend count:"),dummyBox); |
1001 | mAlarmSuspendCount = new QSpinBox(0,60,1,dummyBox); | 1007 | mAlarmSuspendCount = new QSpinBox(0,60,1,dummyBox); |
1002 | topLayout->addWidget(dummyBox,iii++,0); | 1008 | topLayout->addWidget(dummyBox,iii++,0); |
1003 | 1009 | ||
1004 | 1010 | ||
1005 | 1011 | ||
1006 | 1012 | ||
1007 | 1013 | ||
1008 | 1014 | ||
1009 | 1015 | ||
1010 | QHBox* hbo = new QHBox ( topFrame ); | 1016 | QHBox* hbo = new QHBox ( topFrame ); |
1011 | mDefaultAlarmFile = new QLineEdit(hbo); | 1017 | mDefaultAlarmFile = new QLineEdit(hbo); |
1012 | QPushButton * loadTemplate = new QPushButton(hbo); | 1018 | QPushButton * loadTemplate = new QPushButton(hbo); |
1013 | QPixmap icon; | 1019 | QPixmap icon; |
1014 | if ( QApplication::desktop()->width() < 321 ) | 1020 | if ( QApplication::desktop()->width() < 321 ) |
1015 | icon = SmallIcon("fileimport16"); | 1021 | icon = SmallIcon("fileimport16"); |
1016 | else | 1022 | else |
1017 | icon = SmallIcon("fileimport"); | 1023 | icon = SmallIcon("fileimport"); |
1018 | loadTemplate->setIconSet (icon ) ; | 1024 | loadTemplate->setIconSet (icon ) ; |
1019 | connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( selectSoundFile() ) ); | 1025 | connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( selectSoundFile() ) ); |
1020 | int size = loadTemplate->sizeHint().height(); | 1026 | int size = loadTemplate->sizeHint().height(); |
1021 | loadTemplate->setFixedSize( size, size ); | 1027 | loadTemplate->setFixedSize( size, size ); |
1022 | //lab = new QLabel( i18n("This setting is useless for 5500 user!"), topFrame); | 1028 | //lab = new QLabel( i18n("This setting is useless for 5500 user!"), topFrame); |
1023 | // topLayout->addWidget(lab ,iii++,0); | 1029 | // topLayout->addWidget(lab ,iii++,0); |
1024 | lab = new QLabel( i18n("Alarm *.wav file for newly created alarm:"), topFrame); | 1030 | lab = new QLabel( i18n("Alarm *.wav file for newly created alarm:"), topFrame); |
1025 | topLayout->addWidget(lab ,iii++,0); | 1031 | topLayout->addWidget(lab ,iii++,0); |
1026 | topLayout->addWidget(hbo,iii++,0); | 1032 | topLayout->addWidget(hbo,iii++,0); |
1027 | // 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); | 1033 | // 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); |
1028 | 1034 | ||
1029 | // topLayout->addWidget(lab ,iii++,0); | 1035 | // topLayout->addWidget(lab ,iii++,0); |
1030 | // #ifndef DESKTOP_VERSION | 1036 | // #ifndef DESKTOP_VERSION |
1031 | // lab->setAlignment( AlignLeft|WordBreak|AlignTop); | 1037 | // lab->setAlignment( AlignLeft|WordBreak|AlignTop); |
1032 | // #else | 1038 | // #else |
1033 | // lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop); | 1039 | // lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop); |
1034 | // lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); | 1040 | // lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); |
1035 | // #endif | 1041 | // #endif |
1036 | 1042 | ||
1037 | 1043 | ||
1038 | } | 1044 | } |
1039 | 1045 | ||
1040 | void KOPrefsDialog::selectSoundFile() | 1046 | void KOPrefsDialog::selectSoundFile() |
1041 | { | 1047 | { |
1042 | QString fileName = mDefaultAlarmFile->text(); | 1048 | QString fileName = mDefaultAlarmFile->text(); |
1043 | fileName = KFileDialog::getSaveFileName( mDefaultAlarmFile->text() , "Choose default alarm file", this ); | 1049 | fileName = KFileDialog::getSaveFileName( mDefaultAlarmFile->text() , "Choose default alarm file", this ); |
1044 | if ( fileName.length() > 0 ) | 1050 | if ( fileName.length() > 0 ) |
1045 | mDefaultAlarmFile->setText( fileName ); | 1051 | mDefaultAlarmFile->setText( fileName ); |
1046 | } | 1052 | } |
1047 | void KOPrefsDialog::setupFontsTab() | 1053 | void KOPrefsDialog::setupFontsTab() |
1048 | { | 1054 | { |
1049 | 1055 | ||
1050 | QFrame *topFrame = addPage(i18n("Fonts"),0,0); | 1056 | QFrame *topFrame = addPage(i18n("Fonts"),0,0); |
1051 | // DesktopIcon("fonts",KIcon::SizeMedium)); | 1057 | // DesktopIcon("fonts",KIcon::SizeMedium)); |
1052 | 1058 | ||
1053 | QGridLayout *topLayout = new QGridLayout(topFrame,7,3); | 1059 | QGridLayout *topLayout = new QGridLayout(topFrame,7,3); |
1054 | topLayout->setSpacing(1); | 1060 | topLayout->setSpacing(1); |
1055 | topLayout->setMargin(3); | 1061 | topLayout->setMargin(3); |
1056 | KPrefsDialogWidFont * tVFont; | 1062 | KPrefsDialogWidFont * tVFont; |
1057 | int i = 0; | 1063 | int i = 0; |
1058 | KPrefsDialogWidFont *timeLabelsFont = | 1064 | KPrefsDialogWidFont *timeLabelsFont = |
1059 | addWidFont(i18n("23"),i18n("DateNavigator:(nr)"), | 1065 | addWidFont(i18n("23"),i18n("DateNavigator:(nr)"), |
1060 | &(KOPrefs::instance()->mDateNavigatorFont),topFrame); | 1066 | &(KOPrefs::instance()->mDateNavigatorFont),topFrame); |
1061 | topLayout->addWidget(timeLabelsFont->label(),i,0); | 1067 | topLayout->addWidget(timeLabelsFont->label(),i,0); |
1062 | topLayout->addWidget(timeLabelsFont->preview(),i,1); | 1068 | topLayout->addWidget(timeLabelsFont->preview(),i,1); |
1063 | topLayout->addWidget(timeLabelsFont->button(),i,2); | 1069 | topLayout->addWidget(timeLabelsFont->button(),i,2); |
1064 | ++i; | 1070 | ++i; |
1065 | 1071 | ||
1066 | 1072 | ||
1067 | timeLabelsFont = | 1073 | timeLabelsFont = |
1068 | addWidFont(i18n("Mon 15"),i18n("Date Labels:"), | 1074 | addWidFont(i18n("Mon 15"),i18n("Date Labels:"), |
1069 | &(KOPrefs::instance()->mTimeLabelsFont),topFrame); | 1075 | &(KOPrefs::instance()->mTimeLabelsFont),topFrame); |
1070 | topLayout->addWidget(timeLabelsFont->label(),i,0); | 1076 | topLayout->addWidget(timeLabelsFont->label(),i,0); |
1071 | topLayout->addWidget(timeLabelsFont->preview(),i,1); | 1077 | topLayout->addWidget(timeLabelsFont->preview(),i,1); |
1072 | topLayout->addWidget(timeLabelsFont->button(),i,2); | 1078 | topLayout->addWidget(timeLabelsFont->button(),i,2); |
1073 | ++i; | 1079 | ++i; |
1074 | 1080 | ||
1075 | KPrefsDialogWidFont *timeBarFont = | 1081 | KPrefsDialogWidFont *timeBarFont = |
1076 | addWidFont(KGlobal::locale()->formatTime(QTime(12,34)),i18n("Time bar:"), | 1082 | addWidFont(KGlobal::locale()->formatTime(QTime(12,34)),i18n("Time bar:"), |
1077 | &(KOPrefs::instance()->mTimeBarFont),topFrame); | 1083 | &(KOPrefs::instance()->mTimeBarFont),topFrame); |
1078 | topLayout->addWidget(timeBarFont->label(),i,0); | 1084 | topLayout->addWidget(timeBarFont->label(),i,0); |
1079 | topLayout->addWidget(timeBarFont->preview(),i,1); | 1085 | topLayout->addWidget(timeBarFont->preview(),i,1); |
1080 | topLayout->addWidget(timeBarFont->button(),i,2); | 1086 | topLayout->addWidget(timeBarFont->button(),i,2); |
1081 | ++i; | 1087 | ++i; |
1082 | 1088 | ||
1083 | 1089 | ||
1084 | KPrefsDialogWidFont *marcusBainsFont = | 1090 | KPrefsDialogWidFont *marcusBainsFont = |
1085 | addWidFont(KGlobal::locale()->formatTime(QTime(12,34,23)),i18n("M. Bains line:"), | 1091 | addWidFont(KGlobal::locale()->formatTime(QTime(12,34,23)),i18n("M. Bains line:"), |
1086 | &(KOPrefs::instance()->mMarcusBainsFont),topFrame); | 1092 | &(KOPrefs::instance()->mMarcusBainsFont),topFrame); |
1087 | topLayout->addWidget(marcusBainsFont->label(),i,0); | 1093 | topLayout->addWidget(marcusBainsFont->label(),i,0); |
1088 | topLayout->addWidget(marcusBainsFont->preview(),i,1); | 1094 | topLayout->addWidget(marcusBainsFont->preview(),i,1); |
1089 | topLayout->addWidget(marcusBainsFont->button(),i,2); | 1095 | topLayout->addWidget(marcusBainsFont->button(),i,2); |
1090 | ++i; | 1096 | ++i; |
1091 | 1097 | ||
1092 | tVFont = | 1098 | tVFont = |
1093 | addWidFont(i18n("Summary"),i18n("Event Viewer:"), | 1099 | addWidFont(i18n("Summary"),i18n("Event Viewer:"), |
1094 | &(KOPrefs::instance()->mEventViewFont),topFrame); | 1100 | &(KOPrefs::instance()->mEventViewFont),topFrame); |
1095 | topLayout->addWidget(tVFont->label(),i,0); | 1101 | topLayout->addWidget(tVFont->label(),i,0); |
1096 | topLayout->addWidget(tVFont->preview(),i,1); | 1102 | topLayout->addWidget(tVFont->preview(),i,1); |
1097 | topLayout->addWidget(tVFont->button(),i,2); | 1103 | topLayout->addWidget(tVFont->button(),i,2); |
1098 | ++i; | 1104 | ++i; |
1099 | 1105 | ||
1100 | 1106 | ||
1101 | 1107 | ||
1102 | tVFont = | 1108 | tVFont = |
1103 | addWidFont(i18n("Details"),i18n("EditorBox:"), | 1109 | addWidFont(i18n("Details"),i18n("EditorBox:"), |
1104 | &(KOPrefs::instance()->mEditBoxFont),topFrame); | 1110 | &(KOPrefs::instance()->mEditBoxFont),topFrame); |
1105 | topLayout->addWidget(tVFont->label(),i,0); | 1111 | topLayout->addWidget(tVFont->label(),i,0); |
1106 | topLayout->addWidget(tVFont->preview(),i,1); | 1112 | topLayout->addWidget(tVFont->preview(),i,1); |
1107 | topLayout->addWidget(tVFont->button(),i,2); | 1113 | topLayout->addWidget(tVFont->button(),i,2); |
1108 | ++i; | 1114 | ++i; |
1109 | 1115 | ||
1110 | 1116 | ||
1111 | 1117 | ||
1112 | topLayout->setColStretch(1,1); | 1118 | topLayout->setColStretch(1,1); |
1113 | topLayout->setRowStretch(4,1); | 1119 | topLayout->setRowStretch(4,1); |
1114 | 1120 | ||
1115 | 1121 | ||
1116 | i = 0; | 1122 | i = 0; |
1117 | topFrame = addPage(i18n("View Fonts"),0, | 1123 | topFrame = addPage(i18n("View Fonts"),0, |
1118 | DesktopIcon("fonts",KIcon::SizeMedium)); | 1124 | DesktopIcon("fonts",KIcon::SizeMedium)); |
1119 | 1125 | ||
1120 | topLayout = new QGridLayout(topFrame,7,3); | 1126 | topLayout = new QGridLayout(topFrame,7,3); |
1121 | topLayout->setSpacing(1); | 1127 | topLayout->setSpacing(1); |
1122 | topLayout->setMargin(3); | 1128 | topLayout->setMargin(3); |
1123 | 1129 | ||
1124 | tVFont = | 1130 | tVFont = |
1125 | addWidFont(i18n("Configure KO"),i18n("What's Next View:"), | 1131 | addWidFont(i18n("Configure KO"),i18n("What's Next View:"), |
1126 | &(KOPrefs::instance()->mWhatsNextFont),topFrame); | 1132 | &(KOPrefs::instance()->mWhatsNextFont),topFrame); |
1127 | topLayout->addWidget(tVFont->label(),i,0); | 1133 | topLayout->addWidget(tVFont->label(),i,0); |
1128 | topLayout->addWidget(tVFont->preview(),i,1); | 1134 | topLayout->addWidget(tVFont->preview(),i,1); |
1129 | topLayout->addWidget(tVFont->button(),i,2); | 1135 | topLayout->addWidget(tVFont->button(),i,2); |
1130 | ++i; | 1136 | ++i; |
1131 | KPrefsDialogWidFont *agendaViewFont = | 1137 | KPrefsDialogWidFont *agendaViewFont = |
1132 | addWidFont(i18n("Event text"),i18n("Agenda view:"), | 1138 | addWidFont(i18n("Event text"),i18n("Agenda view:"), |
1133 | &(KOPrefs::instance()->mAgendaViewFont),topFrame); | 1139 | &(KOPrefs::instance()->mAgendaViewFont),topFrame); |
1134 | topLayout->addWidget(agendaViewFont->label(),i,0); | 1140 | topLayout->addWidget(agendaViewFont->label(),i,0); |
1135 | topLayout->addWidget(agendaViewFont->preview(),i,1); | 1141 | topLayout->addWidget(agendaViewFont->preview(),i,1); |
1136 | topLayout->addWidget(agendaViewFont->button(),i,2); | 1142 | topLayout->addWidget(agendaViewFont->button(),i,2); |
1137 | ++i; | 1143 | ++i; |
1138 | 1144 | ||
1139 | 1145 | ||
1140 | KPrefsDialogWidFont *monthViewFont = | 1146 | KPrefsDialogWidFont *monthViewFont = |
1141 | addWidFont(KGlobal::locale()->formatTime(QTime(12,34)) + " " + i18n("Event"), | 1147 | addWidFont(KGlobal::locale()->formatTime(QTime(12,34)) + " " + i18n("Event"), |
1142 | i18n("Month view:"),&(KOPrefs::instance()->mMonthViewFont),topFrame); | 1148 | i18n("Month view:"),&(KOPrefs::instance()->mMonthViewFont),topFrame); |
1143 | topLayout->addWidget(monthViewFont->label(),i,0); | 1149 | topLayout->addWidget(monthViewFont->label(),i,0); |
1144 | topLayout->addWidget(monthViewFont->preview(),i,1); | 1150 | topLayout->addWidget(monthViewFont->preview(),i,1); |
1145 | topLayout->addWidget(monthViewFont->button(),i,2); | 1151 | topLayout->addWidget(monthViewFont->button(),i,2); |
1146 | ++i; | 1152 | ++i; |
1147 | 1153 | ||
1148 | 1154 | ||
1149 | KPrefsDialogWidFont *lVFont = | 1155 | KPrefsDialogWidFont *lVFont = |
1150 | addWidFont(i18n("Event"),i18n("List View:"), | 1156 | addWidFont(i18n("Event"),i18n("List View:"), |
1151 | &(KOPrefs::instance()->mListViewFont),topFrame); | 1157 | &(KOPrefs::instance()->mListViewFont),topFrame); |
1152 | topLayout->addWidget(lVFont->label(),i,0); | 1158 | topLayout->addWidget(lVFont->label(),i,0); |
1153 | topLayout->addWidget(lVFont->preview(),i,1); | 1159 | topLayout->addWidget(lVFont->preview(),i,1); |
1154 | topLayout->addWidget(lVFont->button(),i,2); | 1160 | topLayout->addWidget(lVFont->button(),i,2); |
1155 | ++i; | 1161 | ++i; |
1156 | 1162 | ||
1157 | 1163 | ||
1158 | tVFont = | 1164 | tVFont = |
1159 | addWidFont(i18n("ToDo"),i18n("ToDoView:"), | 1165 | addWidFont(i18n("ToDo"),i18n("ToDoView:"), |
1160 | &(KOPrefs::instance()->mTodoViewFont),topFrame); | 1166 | &(KOPrefs::instance()->mTodoViewFont),topFrame); |
1161 | topLayout->addWidget(tVFont->label(),i,0); | 1167 | topLayout->addWidget(tVFont->label(),i,0); |
1162 | topLayout->addWidget(tVFont->preview(),i,1); | 1168 | topLayout->addWidget(tVFont->preview(),i,1); |
1163 | topLayout->addWidget(tVFont->button(),i,2); | 1169 | topLayout->addWidget(tVFont->button(),i,2); |
1164 | ++i; | 1170 | ++i; |
1165 | 1171 | ||
1166 | 1172 | ||
1167 | tVFont = | 1173 | tVFont = |
1168 | addWidFont(i18n("Today"),i18n("JournalView:"), | 1174 | addWidFont(i18n("Today"),i18n("JournalView:"), |
1169 | &(KOPrefs::instance()->mJornalViewFont),topFrame); | 1175 | &(KOPrefs::instance()->mJornalViewFont),topFrame); |
1170 | topLayout->addWidget(tVFont->label(),i,0); | 1176 | topLayout->addWidget(tVFont->label(),i,0); |
1171 | topLayout->addWidget(tVFont->preview(),i,1); | 1177 | topLayout->addWidget(tVFont->preview(),i,1); |
1172 | topLayout->addWidget(tVFont->button(),i,2); | 1178 | topLayout->addWidget(tVFont->button(),i,2); |
1173 | ++i; | 1179 | ++i; |
1174 | 1180 | ||
1175 | 1181 | ||
1176 | 1182 | ||
1177 | 1183 | ||
1178 | topLayout->setColStretch(1,1); | 1184 | topLayout->setColStretch(1,1); |
1179 | topLayout->setRowStretch(4,1); | 1185 | topLayout->setRowStretch(4,1); |
1180 | 1186 | ||
1181 | 1187 | ||
1182 | 1188 | ||
1183 | 1189 | ||
1184 | } | 1190 | } |
1185 | 1191 | ||
1186 | void KOPrefsDialog::setupColorsTab() | 1192 | void KOPrefsDialog::setupColorsTab() |
1187 | { | 1193 | { |
1188 | QFrame *topFrame = addPage(i18n("Colors"),0,0); | 1194 | QFrame *topFrame = addPage(i18n("Colors"),0,0); |
1189 | // DesktopIcon("colorize",KIcon::SizeMedium)); | 1195 | // DesktopIcon("colorize",KIcon::SizeMedium)); |
1190 | 1196 | ||
1191 | QGridLayout *topLayout = new QGridLayout(topFrame,5,2); | 1197 | QGridLayout *topLayout = new QGridLayout(topFrame,5,2); |
1192 | // topLayout->setSpacing(spacingHint()); | 1198 | // topLayout->setSpacing(mSpacingHint); |
1193 | // topLayout->setMargin(marginHint()); | 1199 | // topLayout->setMargin(mMarginHint); |
1194 | 1200 | ||
1195 | topLayout->setSpacing(2); | 1201 | topLayout->setSpacing(2); |
1196 | topLayout->setMargin(3); | 1202 | topLayout->setMargin(3); |
1197 | 1203 | ||
1198 | int ii = 1; | 1204 | int ii = 1; |
1199 | QGroupBox *categoryGroup ; | 1205 | QGroupBox *categoryGroup ; |
1200 | 1206 | ||
1201 | categoryGroup = new QGroupBox(1,Vertical,i18n("Categories"), | 1207 | categoryGroup = new QGroupBox(1,Vertical,i18n("Categories"), |
1202 | topFrame); | 1208 | topFrame); |
1203 | topLayout->addMultiCellWidget(categoryGroup,0,0,0,1); | 1209 | topLayout->addMultiCellWidget(categoryGroup,0,0,0,1); |
1204 | 1210 | ||
1205 | mCategoryCombo = new QComboBox(categoryGroup); | 1211 | mCategoryCombo = new QComboBox(categoryGroup); |
1206 | mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories); | 1212 | mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories); |
1207 | connect(mCategoryCombo,SIGNAL(activated(int)),SLOT(updateCategoryColor())); | 1213 | connect(mCategoryCombo,SIGNAL(activated(int)),SLOT(updateCategoryColor())); |
1208 | 1214 | ||
1209 | mCategoryButton = new KColorButton(categoryGroup); | 1215 | mCategoryButton = new KColorButton(categoryGroup); |
1210 | connect(mCategoryButton,SIGNAL(changed(const QColor &)),SLOT(setCategoryColor())); | 1216 | connect(mCategoryButton,SIGNAL(changed(const QColor &)),SLOT(setCategoryColor())); |
1211 | updateCategoryColor(); | 1217 | updateCategoryColor(); |
1212 | 1218 | ||
1213 | 1219 | ||
1214 | // Holiday Color | 1220 | // Holiday Color |
1215 | 1221 | ||
1216 | KPrefsDialogWidColor *holidayColor = | 1222 | KPrefsDialogWidColor *holidayColor = |
1217 | addWidColor(i18n("Holiday color:"), | 1223 | addWidColor(i18n("Holiday color:"), |
1218 | &(KOPrefs::instance()->mHolidayColor),topFrame); | 1224 | &(KOPrefs::instance()->mHolidayColor),topFrame); |
1219 | topLayout->addWidget(holidayColor->label(),ii,0); | 1225 | topLayout->addWidget(holidayColor->label(),ii,0); |
1220 | topLayout->addWidget(holidayColor->button(),ii++,1); | 1226 | topLayout->addWidget(holidayColor->button(),ii++,1); |
1221 | 1227 | ||
1222 | // Highlight Color | 1228 | // Highlight Color |
1223 | KPrefsDialogWidColor *highlightColor = | 1229 | KPrefsDialogWidColor *highlightColor = |
1224 | addWidColor(i18n("Highlight color:"), | 1230 | addWidColor(i18n("Highlight color:"), |
1225 | &(KOPrefs::instance()->mHighlightColor),topFrame); | 1231 | &(KOPrefs::instance()->mHighlightColor),topFrame); |
1226 | topLayout->addWidget(highlightColor->label(),ii,0); | 1232 | topLayout->addWidget(highlightColor->label(),ii,0); |
1227 | topLayout->addWidget(highlightColor->button(),ii++,1); | 1233 | topLayout->addWidget(highlightColor->button(),ii++,1); |
1228 | 1234 | ||
1229 | // Event color | 1235 | // Event color |
1230 | KPrefsDialogWidColor *eventColor = | 1236 | KPrefsDialogWidColor *eventColor = |
1231 | addWidColor(i18n("Default event color:"), | 1237 | addWidColor(i18n("Default event color:"), |
1232 | &(KOPrefs::instance()->mEventColor),topFrame); | 1238 | &(KOPrefs::instance()->mEventColor),topFrame); |
1233 | topLayout->addWidget(eventColor->label(),ii,0); | 1239 | topLayout->addWidget(eventColor->label(),ii,0); |
1234 | topLayout->addWidget(eventColor->button(),ii++,1); | 1240 | topLayout->addWidget(eventColor->button(),ii++,1); |
1235 | eventColor = | 1241 | eventColor = |
1236 | addWidColor(i18n("Default todo done color:"), | 1242 | addWidColor(i18n("Default todo done color:"), |
1237 | &(KOPrefs::instance()->mTodoDoneColor),topFrame); | 1243 | &(KOPrefs::instance()->mTodoDoneColor),topFrame); |
1238 | topLayout->addWidget(eventColor->label(),ii,0); | 1244 | topLayout->addWidget(eventColor->label(),ii,0); |
1239 | topLayout->addWidget(eventColor->button(),ii++,1); | 1245 | topLayout->addWidget(eventColor->button(),ii++,1); |
1240 | 1246 | ||
1241 | 1247 | ||
1242 | // agenda view background color | 1248 | // agenda view background color |
1243 | KPrefsDialogWidColor *agendaBgColor = | 1249 | KPrefsDialogWidColor *agendaBgColor = |
1244 | addWidColor(i18n("Agenda view background color:"), | 1250 | addWidColor(i18n("Agenda view background color:"), |
1245 | &(KOPrefs::instance()->mAgendaBgColor),topFrame); | 1251 | &(KOPrefs::instance()->mAgendaBgColor),topFrame); |
1246 | topLayout->addWidget(agendaBgColor->label(),ii,0); | 1252 | topLayout->addWidget(agendaBgColor->label(),ii,0); |
1247 | topLayout->addWidget(agendaBgColor->button(),ii++,1); | 1253 | topLayout->addWidget(agendaBgColor->button(),ii++,1); |
1248 | 1254 | ||
1249 | // working hours color | 1255 | // working hours color |
1250 | KPrefsDialogWidColor *workingHoursColor = | 1256 | KPrefsDialogWidColor *workingHoursColor = |
1251 | addWidColor(i18n("Working hours color:"), | 1257 | addWidColor(i18n("Working hours color:"), |
1252 | &(KOPrefs::instance()->mWorkingHoursColor),topFrame); | 1258 | &(KOPrefs::instance()->mWorkingHoursColor),topFrame); |
1253 | topLayout->addWidget(workingHoursColor->label(),ii,0); | 1259 | topLayout->addWidget(workingHoursColor->label(),ii,0); |
1254 | topLayout->addWidget(workingHoursColor->button(),ii++,1); | 1260 | topLayout->addWidget(workingHoursColor->button(),ii++,1); |
1255 | 1261 | ||
1256 | KPrefsDialogWidBool *sb = | 1262 | KPrefsDialogWidBool *sb = |
1257 | addWidBool(i18n("Use colors for application:"), | 1263 | addWidBool(i18n("Use colors for application:"), |
1258 | &(KOPrefs::instance()->mUseAppColors),topFrame); | 1264 | &(KOPrefs::instance()->mUseAppColors),topFrame); |
1259 | topLayout->addMultiCellWidget(sb->checkBox(), ii, ii, 0,1 ); | 1265 | topLayout->addMultiCellWidget(sb->checkBox(), ii, ii, 0,1 ); |
1260 | 1266 | ||
1261 | ii++; | 1267 | ii++; |
1262 | KPrefsDialogWidColor * workingHoursColor1 = | 1268 | KPrefsDialogWidColor * workingHoursColor1 = |
1263 | addWidColor(i18n("Buttons, menus, etc.:"), | 1269 | addWidColor(i18n("Buttons, menus, etc.:"), |
1264 | &(KOPrefs::instance()->mAppColor1),topFrame); | 1270 | &(KOPrefs::instance()->mAppColor1),topFrame); |
1265 | topLayout->addWidget(workingHoursColor1->label(),ii,0); | 1271 | topLayout->addWidget(workingHoursColor1->label(),ii,0); |
1266 | topLayout->addWidget(workingHoursColor1->button(),ii++,1); | 1272 | topLayout->addWidget(workingHoursColor1->button(),ii++,1); |
1267 | 1273 | ||
1268 | KPrefsDialogWidColor * workingHoursColor2 = | 1274 | KPrefsDialogWidColor * workingHoursColor2 = |
1269 | addWidColor(i18n("Frames, labels, etc.:"), | 1275 | addWidColor(i18n("Frames, labels, etc.:"), |
1270 | &(KOPrefs::instance()->mAppColor2),topFrame); | 1276 | &(KOPrefs::instance()->mAppColor2),topFrame); |
1271 | topLayout->addWidget(workingHoursColor2->label(),ii,0); | 1277 | topLayout->addWidget(workingHoursColor2->label(),ii,0); |
1272 | topLayout->addWidget(workingHoursColor2->button(),ii++,1); | 1278 | topLayout->addWidget(workingHoursColor2->button(),ii++,1); |
1273 | 1279 | ||
1274 | 1280 | ||
1275 | 1281 | ||
1276 | } | 1282 | } |
1277 | 1283 | ||
1278 | void KOPrefsDialog::setCategoryColor() | 1284 | void KOPrefsDialog::setCategoryColor() |
1279 | { | 1285 | { |
1280 | mCategoryDict.replace(mCategoryCombo->currentText(), new QColor(mCategoryButton->color())); | 1286 | mCategoryDict.replace(mCategoryCombo->currentText(), new QColor(mCategoryButton->color())); |
1281 | } | 1287 | } |
1282 | 1288 | ||
1283 | void KOPrefsDialog::updateCategoryColor() | 1289 | void KOPrefsDialog::updateCategoryColor() |
1284 | { | 1290 | { |
1285 | QString cat = mCategoryCombo->currentText(); | 1291 | QString cat = mCategoryCombo->currentText(); |
1286 | QColor *color = mCategoryDict.find(cat); | 1292 | QColor *color = mCategoryDict.find(cat); |
1287 | if (!color) { | 1293 | if (!color) { |
1288 | color = KOPrefs::instance()->categoryColor(cat); | 1294 | color = KOPrefs::instance()->categoryColor(cat); |
1289 | } | 1295 | } |
1290 | if (color) { | 1296 | if (color) { |
1291 | mCategoryButton->setColor(*color); | 1297 | mCategoryButton->setColor(*color); |
1292 | } | 1298 | } |
1293 | } | 1299 | } |
1294 | 1300 | ||
1295 | void KOPrefsDialog::setupPrinterTab() | 1301 | void KOPrefsDialog::setupPrinterTab() |
1296 | { | 1302 | { |
1297 | mPrinterTab = addPage(i18n("Printing"),0, | 1303 | mPrinterTab = addPage(i18n("Printing"),0, |
1298 | DesktopIcon("fileprint",KIcon::SizeMedium)); | 1304 | DesktopIcon("fileprint",KIcon::SizeMedium)); |
1299 | 1305 | ||
1300 | QGridLayout *topLayout = new QGridLayout(mPrinterTab,5,2); | 1306 | QGridLayout *topLayout = new QGridLayout(mPrinterTab,5,2); |
1301 | topLayout->setSpacing(spacingHint()); | 1307 | topLayout->setSpacing(mSpacingHint); |
1302 | topLayout->setMargin(marginHint()); | 1308 | topLayout->setMargin(mMarginHint); |
1303 | 1309 | ||
1304 | topLayout->setRowStretch(4,1); | 1310 | topLayout->setRowStretch(4,1); |
1305 | } | 1311 | } |
1306 | 1312 | ||
1307 | void KOPrefsDialog::setupGroupSchedulingTab() | 1313 | void KOPrefsDialog::setupGroupSchedulingTab() |
1308 | { | 1314 | { |
1309 | #if 0 | 1315 | #if 0 |
1310 | QFrame *topFrame = addPage(i18n("Group Scheduling"),0, | 1316 | QFrame *topFrame = addPage(i18n("Group Scheduling"),0, |
1311 | DesktopIcon("personal",KIcon::SizeMedium)); | 1317 | DesktopIcon("personal",KIcon::SizeMedium)); |
1312 | 1318 | ||
1313 | QGridLayout *topLayout = new QGridLayout(topFrame,6,2); | 1319 | QGridLayout *topLayout = new QGridLayout(topFrame,6,2); |
1314 | topLayout->setSpacing(spacingHint()); | 1320 | topLayout->setSpacing(mSpacingHint); |
1315 | topLayout->setMargin(marginHint()); | 1321 | topLayout->setMargin(mMarginHint); |
1316 | 1322 | ||
1317 | #if 0 | 1323 | #if 0 |
1318 | KPrefsDialogWidRadios *schedulerGroup = | 1324 | KPrefsDialogWidRadios *schedulerGroup = |
1319 | addWidRadios(i18n("Scheduler Mail Client"),&(KOPrefs::instance()->mIMIPScheduler), | 1325 | addWidRadios(i18n("Scheduler Mail Client"),&(KOPrefs::instance()->mIMIPScheduler), |
1320 | topFrame); | 1326 | topFrame); |
1321 | schedulerGroup->addRadio("Dummy"); // Only for debugging | 1327 | schedulerGroup->addRadio("Dummy"); // Only for debugging |
1322 | schedulerGroup->addRadio(i18n("Mail client")); | 1328 | schedulerGroup->addRadio(i18n("Mail client")); |
1323 | 1329 | ||
1324 | topLayout->addMultiCellWidget(schedulerGroup->groupBox(),0,0,0,1); | 1330 | topLayout->addMultiCellWidget(schedulerGroup->groupBox(),0,0,0,1); |
1325 | #endif | 1331 | #endif |
1326 | 1332 | ||
1327 | KPrefsDialogWidRadios *sendGroup = | 1333 | KPrefsDialogWidRadios *sendGroup = |
1328 | addWidRadios(i18n("Scheduler Mails Should Be"),&(KOPrefs::instance()->mIMIPSend), | 1334 | addWidRadios(i18n("Scheduler Mails Should Be"),&(KOPrefs::instance()->mIMIPSend), |
1329 | topFrame); | 1335 | topFrame); |
1330 | sendGroup->addRadio(i18n("Send to outbox")); | 1336 | sendGroup->addRadio(i18n("Send to outbox")); |
1331 | sendGroup->addRadio(i18n("Send directly")); | 1337 | sendGroup->addRadio(i18n("Send directly")); |
1332 | 1338 | ||
1333 | topLayout->addMultiCellWidget(sendGroup->groupBox(),1,1,0,1); | 1339 | topLayout->addMultiCellWidget(sendGroup->groupBox(),1,1,0,1); |
1334 | 1340 | ||
1335 | topLayout->addMultiCellWidget(new QLabel(i18n("Additional email addresses:"),topFrame),2,2,0,1); | 1341 | topLayout->addMultiCellWidget(new QLabel(i18n("Additional email addresses:"),topFrame),2,2,0,1); |
1336 | mAMails = new QListView(topFrame); | 1342 | mAMails = new QListView(topFrame); |
1337 | mAMails->addColumn(i18n("Email"),300); | 1343 | mAMails->addColumn(i18n("Email"),300); |
1338 | topLayout->addMultiCellWidget(mAMails,3,3,0,1); | 1344 | topLayout->addMultiCellWidget(mAMails,3,3,0,1); |
1339 | 1345 | ||
1340 | topLayout->addWidget(new QLabel(i18n("Additional email address:"),topFrame),4,0); | 1346 | topLayout->addWidget(new QLabel(i18n("Additional email address:"),topFrame),4,0); |
1341 | aEmailsEdit = new QLineEdit(topFrame); | 1347 | aEmailsEdit = new QLineEdit(topFrame); |
1342 | aEmailsEdit->setEnabled(false); | 1348 | aEmailsEdit->setEnabled(false); |
1343 | topLayout->addWidget(aEmailsEdit,4,1); | 1349 | topLayout->addWidget(aEmailsEdit,4,1); |
1344 | 1350 | ||
1345 | QPushButton *add = new QPushButton(i18n("New"),topFrame,"new"); | 1351 | QPushButton *add = new QPushButton(i18n("New"),topFrame,"new"); |
1346 | topLayout->addWidget(add,5,0); | 1352 | topLayout->addWidget(add,5,0); |
1347 | QPushButton *del = new QPushButton(i18n("Remove"),topFrame,"remove"); | 1353 | QPushButton *del = new QPushButton(i18n("Remove"),topFrame,"remove"); |
1348 | topLayout->addWidget(del,5,1); | 1354 | topLayout->addWidget(del,5,1); |
1349 | 1355 | ||
1350 | //topLayout->setRowStretch(2,1); | 1356 | //topLayout->setRowStretch(2,1); |
1351 | connect(add, SIGNAL( clicked() ), this, SLOT(addItem()) ); | 1357 | connect(add, SIGNAL( clicked() ), this, SLOT(addItem()) ); |
1352 | connect(del, SIGNAL( clicked() ), this, SLOT(removeItem()) ); | 1358 | connect(del, SIGNAL( clicked() ), this, SLOT(removeItem()) ); |
1353 | connect(aEmailsEdit,SIGNAL( textChanged(const QString&) ), this,SLOT(updateItem())); | 1359 | connect(aEmailsEdit,SIGNAL( textChanged(const QString&) ), this,SLOT(updateItem())); |
1354 | connect(mAMails,SIGNAL(selectionChanged(QListViewItem *)),SLOT(updateInput())); | 1360 | connect(mAMails,SIGNAL(selectionChanged(QListViewItem *)),SLOT(updateInput())); |
1355 | #endif | 1361 | #endif |
1356 | } | 1362 | } |
1357 | 1363 | ||
1358 | void KOPrefsDialog::setupGroupAutomationTab() | 1364 | void KOPrefsDialog::setupGroupAutomationTab() |
1359 | { | 1365 | { |
1360 | return; | 1366 | return; |
1361 | QFrame *topFrame = addPage(i18n("Group Automation"),0, | 1367 | QFrame *topFrame = addPage(i18n("Group Automation"),0, |
1362 | DesktopIcon("personal",KIcon::SizeMedium)); | 1368 | DesktopIcon("personal",KIcon::SizeMedium)); |
1363 | 1369 | ||
1364 | QGridLayout *topLayout = new QGridLayout(topFrame,5,1); | 1370 | QGridLayout *topLayout = new QGridLayout(topFrame,5,1); |
1365 | topLayout->setSpacing(spacingHint()); | 1371 | topLayout->setSpacing(mSpacingHint); |
1366 | topLayout->setMargin(marginHint()); | 1372 | topLayout->setMargin(mMarginHint); |
1367 | 1373 | ||
1368 | KPrefsDialogWidRadios *autoRefreshGroup = | 1374 | KPrefsDialogWidRadios *autoRefreshGroup = |
1369 | addWidRadios(i18n("Auto Send Refresh"), | 1375 | addWidRadios(i18n("Auto Send Refresh"), |
1370 | &(KOPrefs::instance()->mIMIPAutoRefresh),topFrame); | 1376 | &(KOPrefs::instance()->mIMIPAutoRefresh),topFrame); |
1371 | autoRefreshGroup->addRadio(i18n("Never")); | 1377 | autoRefreshGroup->addRadio(i18n("Never")); |
1372 | autoRefreshGroup->addRadio(i18n("If attendee is in addressbook")); | 1378 | autoRefreshGroup->addRadio(i18n("If attendee is in addressbook")); |
1373 | //autoRefreshGroup->addRadio(i18n("selected emails")); | 1379 | //autoRefreshGroup->addRadio(i18n("selected emails")); |
1374 | topLayout->addMultiCellWidget(autoRefreshGroup->groupBox(),0,0,0,0); | 1380 | topLayout->addMultiCellWidget(autoRefreshGroup->groupBox(),0,0,0,0); |
1375 | 1381 | ||
1376 | KPrefsDialogWidRadios *autoInsertGroup = | 1382 | KPrefsDialogWidRadios *autoInsertGroup = |
1377 | addWidRadios(i18n("Auto Insert IMIP Replies"), | 1383 | addWidRadios(i18n("Auto Insert IMIP Replies"), |
1378 | &(KOPrefs::instance()->mIMIPAutoInsertReply),topFrame); | 1384 | &(KOPrefs::instance()->mIMIPAutoInsertReply),topFrame); |
1379 | autoInsertGroup->addRadio(i18n("Never")); | 1385 | autoInsertGroup->addRadio(i18n("Never")); |
1380 | autoInsertGroup->addRadio(i18n("If attendee is in addressbook")); | 1386 | autoInsertGroup->addRadio(i18n("If attendee is in addressbook")); |
1381 | //autoInsertGroup->addRadio(i18n("selected emails")); | 1387 | //autoInsertGroup->addRadio(i18n("selected emails")); |
1382 | topLayout->addMultiCellWidget(autoInsertGroup->groupBox(),1,1,0,0); | 1388 | topLayout->addMultiCellWidget(autoInsertGroup->groupBox(),1,1,0,0); |
1383 | 1389 | ||
1384 | KPrefsDialogWidRadios *autoRequestGroup = | 1390 | KPrefsDialogWidRadios *autoRequestGroup = |
1385 | addWidRadios(i18n("Auto Insert IMIP Requests"), | 1391 | addWidRadios(i18n("Auto Insert IMIP Requests"), |
1386 | &(KOPrefs::instance()->mIMIPAutoInsertRequest),topFrame); | 1392 | &(KOPrefs::instance()->mIMIPAutoInsertRequest),topFrame); |
1387 | autoRequestGroup->addRadio(i18n("Never")); | 1393 | autoRequestGroup->addRadio(i18n("Never")); |
1388 | autoRequestGroup->addRadio(i18n("If organizer is in addressbook")); | 1394 | autoRequestGroup->addRadio(i18n("If organizer is in addressbook")); |
1389 | //autoInsertGroup->addRadio(i18n("selected emails")); | 1395 | //autoInsertGroup->addRadio(i18n("selected emails")); |
1390 | topLayout->addMultiCellWidget(autoRequestGroup->groupBox(),2,2,0,0); | 1396 | topLayout->addMultiCellWidget(autoRequestGroup->groupBox(),2,2,0,0); |
1391 | 1397 | ||
1392 | KPrefsDialogWidRadios *autoFreeBusyGroup = | 1398 | KPrefsDialogWidRadios *autoFreeBusyGroup = |
1393 | addWidRadios(i18n("Auto Send FreeBusy Information"), | 1399 | addWidRadios(i18n("Auto Send FreeBusy Information"), |
1394 | &(KOPrefs::instance()->mIMIPAutoFreeBusy),topFrame); | 1400 | &(KOPrefs::instance()->mIMIPAutoFreeBusy),topFrame); |
1395 | autoFreeBusyGroup->addRadio(i18n("Never")); | 1401 | autoFreeBusyGroup->addRadio(i18n("Never")); |
1396 | autoFreeBusyGroup->addRadio(i18n("If requested from an email in addressbook")); | 1402 | autoFreeBusyGroup->addRadio(i18n("If requested from an email in addressbook")); |
1397 | //autoFreeBusyGroup->addRadio(i18n("selected emails")); | 1403 | //autoFreeBusyGroup->addRadio(i18n("selected emails")); |
1398 | topLayout->addMultiCellWidget(autoFreeBusyGroup->groupBox(),3,3,0,0); | 1404 | topLayout->addMultiCellWidget(autoFreeBusyGroup->groupBox(),3,3,0,0); |
1399 | 1405 | ||
1400 | KPrefsDialogWidRadios *autoFreeBusyReplyGroup = | 1406 | KPrefsDialogWidRadios *autoFreeBusyReplyGroup = |
1401 | addWidRadios(i18n("Auto Save FreeBusy Replies"), | 1407 | addWidRadios(i18n("Auto Save FreeBusy Replies"), |
1402 | &(KOPrefs::instance()->mIMIPAutoFreeBusyReply),topFrame); | 1408 | &(KOPrefs::instance()->mIMIPAutoFreeBusyReply),topFrame); |
1403 | autoFreeBusyReplyGroup->addRadio(i18n("Never")); | 1409 | autoFreeBusyReplyGroup->addRadio(i18n("Never")); |
1404 | autoFreeBusyReplyGroup->addRadio(i18n("If attendee is in addressbook")); | 1410 | autoFreeBusyReplyGroup->addRadio(i18n("If attendee is in addressbook")); |
1405 | //autoFreeBusyGroup->addRadio(i18n("selected emails")); | 1411 | //autoFreeBusyGroup->addRadio(i18n("selected emails")); |
1406 | topLayout->addMultiCellWidget(autoFreeBusyReplyGroup->groupBox(),4,4,0,0); | 1412 | topLayout->addMultiCellWidget(autoFreeBusyReplyGroup->groupBox(),4,4,0,0); |
1407 | } | 1413 | } |
1408 | 1414 | ||
1409 | void KOPrefsDialog::showPrinterTab() | 1415 | void KOPrefsDialog::showPrinterTab() |
1410 | { | 1416 | { |
1411 | showPage(pageIndex(mPrinterTab)); | 1417 | showPage(pageIndex(mPrinterTab)); |
1412 | } | 1418 | } |
1413 | 1419 | ||
1414 | 1420 | ||
1415 | void KOPrefsDialog::setCombo(QComboBox *combo, const QString & text, | 1421 | void KOPrefsDialog::setCombo(QComboBox *combo, const QString & text, |
1416 | const QStringList *tags) | 1422 | const QStringList *tags) |
1417 | { | 1423 | { |
1418 | if (tags) { | 1424 | if (tags) { |
1419 | int i = tags->findIndex(text); | 1425 | int i = tags->findIndex(text); |
1420 | if (i > 0) combo->setCurrentItem(i); | 1426 | if (i > 0) combo->setCurrentItem(i); |
1421 | } else { | 1427 | } else { |
1422 | for(int i=0;i<combo->count();++i) { | 1428 | for(int i=0;i<combo->count();++i) { |
1423 | if (combo->text(i) == text) { | 1429 | if (combo->text(i) == text) { |
1424 | combo->setCurrentItem(i); | 1430 | combo->setCurrentItem(i); |
1425 | break; | 1431 | break; |
1426 | } | 1432 | } |
1427 | } | 1433 | } |
1428 | } | 1434 | } |
1429 | } | 1435 | } |
1430 | 1436 | ||
1431 | void KOPrefsDialog::usrReadConfig() | 1437 | void KOPrefsDialog::usrReadConfig() |
1432 | { | 1438 | { |
1433 | kdelibcfg->readConfig(); | 1439 | kdelibcfg->readConfig(); |
1434 | mNameEdit->setText(KOPrefs::instance()->fullName()); | 1440 | mNameEdit->setText(KOPrefs::instance()->fullName()); |
1435 | mEmailEdit->setText(KOPrefs::instance()->email()); | 1441 | mEmailEdit->setText(KOPrefs::instance()->email()); |
1436 | 1442 | ||
1437 | mAutoSaveIntervalSpin->setValue(KOPrefs::instance()->mAutoSaveInterval); | 1443 | mAutoSaveIntervalSpin->setValue(KOPrefs::instance()->mAutoSaveInterval); |
1438 | // QDate current ( 2001, 1,1); | 1444 | // QDate current ( 2001, 1,1); |
1439 | //mStartDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingStart-1)); | 1445 | //mStartDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingStart-1)); |
1440 | //mEndDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingEnd-1)); | 1446 | //mEndDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingEnd-1)); |
1441 | //setCombo(mTimeZoneCombo,i18n(KOPrefs::instance()->mTimeZoneId)); | 1447 | //setCombo(mTimeZoneCombo,i18n(KOPrefs::instance()->mTimeZoneId)); |
1442 | //mTimezoneOffsetSpin->setValue( KOPrefs::instance()->mTimeZoneOffset); | 1448 | //mTimezoneOffsetSpin->setValue( KOPrefs::instance()->mTimeZoneOffset); |
1443 | mStartTimeSpin->setValue(KOPrefs::instance()->mStartTime); | 1449 | mStartTimeSpin->setValue(KOPrefs::instance()->mStartTime); |
1444 | mDefaultDurationSpin->setValue(KOPrefs::instance()->mDefaultDuration); | 1450 | mDefaultDurationSpin->setValue(KOPrefs::instance()->mDefaultDuration); |
1445 | mAlarmTimeCombo->setCurrentItem(KOPrefs::instance()->mAlarmTime); | 1451 | mAlarmTimeCombo->setCurrentItem(KOPrefs::instance()->mAlarmTime); |
1446 | // if (KOPrefs::instance()->mAllDaySize > 47 ) | 1452 | // if (KOPrefs::instance()->mAllDaySize > 47 ) |
1447 | // KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize/2; | 1453 | // KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize/2; |
1448 | //mHourSizeSlider->setValue(KOPrefs::instance()->mAllDaySize); | 1454 | //mHourSizeSlider->setValue(KOPrefs::instance()->mAllDaySize); |
1449 | 1455 | ||
1450 | mNextXDaysSpin->setValue(KOPrefs::instance()->mNextXDays); | 1456 | mNextXDaysSpin->setValue(KOPrefs::instance()->mNextXDays); |
1451 | mWhatsNextSpin->setValue(KOPrefs::instance()->mWhatsNextDays); | 1457 | mWhatsNextSpin->setValue(KOPrefs::instance()->mWhatsNextDays); |
1452 | mPrioSpin->setValue(KOPrefs::instance()->mWhatsNextPrios); | 1458 | mPrioSpin->setValue(KOPrefs::instance()->mWhatsNextPrios); |
1453 | // mAMails->clear(); | 1459 | // mAMails->clear(); |
1454 | // for ( QStringList::Iterator it = KOPrefs::instance()->mAdditionalMails.begin(); | 1460 | // for ( QStringList::Iterator it = KOPrefs::instance()->mAdditionalMails.begin(); |
1455 | // it != KOPrefs::instance()->mAdditionalMails.end(); ++it ) { | 1461 | // it != KOPrefs::instance()->mAdditionalMails.end(); ++it ) { |
1456 | // QListViewItem *item = new QListViewItem(mAMails); | 1462 | // QListViewItem *item = new QListViewItem(mAMails); |
1457 | // item->setText(0,*it); | 1463 | // item->setText(0,*it); |
1458 | // mAMails->insertItem(item); | 1464 | // mAMails->insertItem(item); |
1459 | // } | 1465 | // } |
1460 | 1466 | ||
1461 | // mRemoteIPEdit->setText(KOPrefs::instance()->mRemoteIP); | 1467 | // mRemoteIPEdit->setText(KOPrefs::instance()->mRemoteIP); |
1462 | //mRemoteUser->setText(KOPrefs::instance()->mRemoteUser); | 1468 | //mRemoteUser->setText(KOPrefs::instance()->mRemoteUser); |
1463 | //mRemotePassWd->setText(KOPrefs::instance()->mRemotePassWd); | 1469 | //mRemotePassWd->setText(KOPrefs::instance()->mRemotePassWd); |
1464 | //mRemoteFile->setText(KOPrefs::instance()->mRemoteFile); | 1470 | //mRemoteFile->setText(KOPrefs::instance()->mRemoteFile); |
1465 | 1471 | ||
1466 | //that soundmLocalTempFile->setText(KOPrefs::instance()->mLocalTempFile); | 1472 | //that soundmLocalTempFile->setText(KOPrefs::instance()->mLocalTempFile); |
1467 | mDefaultAlarmFile->setText(KOPrefs::instance()->mDefaultAlarmFile); | 1473 | mDefaultAlarmFile->setText(KOPrefs::instance()->mDefaultAlarmFile); |
1468 | //QString dummy = KOPrefs::instance()->mUserDateFormatLong; | 1474 | //QString dummy = KOPrefs::instance()->mUserDateFormatLong; |
1469 | //mUserDateFormatLong->setText(dummy.replace( QRegExp("K"), QString(",") )); | 1475 | //mUserDateFormatLong->setText(dummy.replace( QRegExp("K"), QString(",") )); |
1470 | //dummy = KOPrefs::instance()->mUserDateFormatShort; | 1476 | //dummy = KOPrefs::instance()->mUserDateFormatShort; |
1471 | //mUserDateFormatShort->setText(dummy.replace( QRegExp("K"), QString(",") )); | 1477 | //mUserDateFormatShort->setText(dummy.replace( QRegExp("K"), QString(",") )); |
1472 | updateCategories(); | 1478 | updateCategories(); |
1473 | mAlarmPlayBeeps->setValue(KOPrefs::instance()->mAlarmPlayBeeps ); | 1479 | mAlarmPlayBeeps->setValue(KOPrefs::instance()->mAlarmPlayBeeps ); |
1474 | mAlarmSuspendTime->setValue(KOPrefs::instance()->mAlarmSuspendTime ); | 1480 | mAlarmSuspendTime->setValue(KOPrefs::instance()->mAlarmSuspendTime ); |
1475 | mAlarmSuspendCount->setValue(KOPrefs::instance()->mAlarmSuspendCount ); | 1481 | mAlarmSuspendCount->setValue(KOPrefs::instance()->mAlarmSuspendCount ); |
1476 | mAlarmBeepInterval->setValue(KOPrefs::instance()->mAlarmBeepInterval ); | 1482 | mAlarmBeepInterval->setValue(KOPrefs::instance()->mAlarmBeepInterval ); |
1477 | } | 1483 | } |
1478 | 1484 | ||
1479 | 1485 | ||
1480 | void KOPrefsDialog::usrWriteConfig() | 1486 | void KOPrefsDialog::usrWriteConfig() |
1481 | { | 1487 | { |
1482 | 1488 | ||
1483 | kdelibcfg->writeConfig(); | 1489 | kdelibcfg->writeConfig(); |
1484 | // KOPrefs::instance()->mRemoteIP = mRemoteIPEdit->text(); | 1490 | // KOPrefs::instance()->mRemoteIP = mRemoteIPEdit->text(); |
1485 | //KOPrefs::instance()->mRemoteUser = mRemoteUser->text(); | 1491 | //KOPrefs::instance()->mRemoteUser = mRemoteUser->text(); |
1486 | //KOPrefs::instance()->mRemotePassWd = mRemotePassWd->text(); | 1492 | //KOPrefs::instance()->mRemotePassWd = mRemotePassWd->text(); |
1487 | //KOPrefs::instance()->mRemoteFile= mRemoteFile->text(); | 1493 | //KOPrefs::instance()->mRemoteFile= mRemoteFile->text(); |
1488 | //KOPrefs::instance()->mLocalTempFile =mLocalTempFile->text(); | 1494 | //KOPrefs::instance()->mLocalTempFile =mLocalTempFile->text(); |
1489 | KOPrefs::instance()->mDefaultAlarmFile =mDefaultAlarmFile->text(); | 1495 | KOPrefs::instance()->mDefaultAlarmFile =mDefaultAlarmFile->text(); |
1490 | 1496 | ||
1491 | //KOPrefs::instance()->mUserDateFormatShort = mUserDateFormatShort->text().replace( QRegExp(","), QString("K") ); | 1497 | //KOPrefs::instance()->mUserDateFormatShort = mUserDateFormatShort->text().replace( QRegExp(","), QString("K") ); |
1492 | //KOPrefs::instance()->mUserDateFormatLong = mUserDateFormatLong->text().replace( QRegExp(","), QString("K") ); | 1498 | //KOPrefs::instance()->mUserDateFormatLong = mUserDateFormatLong->text().replace( QRegExp(","), QString("K") ); |
1493 | KOPrefs::instance()->setFullName(mNameEdit->text()); | 1499 | KOPrefs::instance()->setFullName(mNameEdit->text()); |
1494 | KOPrefs::instance()->setEmail(mEmailEdit->text()); | 1500 | KOPrefs::instance()->setEmail(mEmailEdit->text()); |
1495 | 1501 | ||
1496 | KOPrefs::instance()->mAutoSaveInterval = mAutoSaveIntervalSpin->value(); | 1502 | KOPrefs::instance()->mAutoSaveInterval = mAutoSaveIntervalSpin->value(); |
1497 | 1503 | ||
1498 | // KOPrefs::instance()->mTimeZoneId = mTimeZoneCombo->currentText(); | 1504 | // KOPrefs::instance()->mTimeZoneId = mTimeZoneCombo->currentText(); |
1499 | //QDate date; | 1505 | //QDate date; |
1500 | //date = mStartDateSavingEdit->date(); | 1506 | //date = mStartDateSavingEdit->date(); |
1501 | //int sub = 0; | 1507 | //int sub = 0; |
1502 | //if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) | 1508 | //if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) |
1503 | // sub = 1; | 1509 | // sub = 1; |
1504 | // KOPrefs::instance()->mDaylightsavingStart = date.dayOfYear()-sub; | 1510 | // KOPrefs::instance()->mDaylightsavingStart = date.dayOfYear()-sub; |
1505 | // date = mEndDateSavingEdit->date(); | 1511 | // date = mEndDateSavingEdit->date(); |
1506 | // if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) | 1512 | // if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) |
1507 | // sub = 1; | 1513 | // sub = 1; |
1508 | // else | 1514 | // else |
1509 | // sub = 0; | 1515 | // sub = 0; |
1510 | // KOPrefs::instance()->mDaylightsavingEnd = date.dayOfYear()-sub; | 1516 | // KOPrefs::instance()->mDaylightsavingEnd = date.dayOfYear()-sub; |
1511 | // // KOPrefs::instance()->mTimeZoneOffset = mTimezoneOffsetSpin->value(); | 1517 | // // KOPrefs::instance()->mTimeZoneOffset = mTimezoneOffsetSpin->value(); |
1512 | 1518 | ||
1513 | KOPrefs::instance()->mStartTime = mStartTimeSpin->value(); | 1519 | KOPrefs::instance()->mStartTime = mStartTimeSpin->value(); |
1514 | KOPrefs::instance()->mDefaultDuration = mDefaultDurationSpin->value(); | 1520 | KOPrefs::instance()->mDefaultDuration = mDefaultDurationSpin->value(); |
1515 | KOPrefs::instance()->mAlarmTime = mAlarmTimeCombo->currentItem(); | 1521 | KOPrefs::instance()->mAlarmTime = mAlarmTimeCombo->currentItem(); |
1516 | 1522 | ||
1517 | //KOPrefs::instance()->mAllDaySize = mHourSizeSlider->value(); | 1523 | //KOPrefs::instance()->mAllDaySize = mHourSizeSlider->value(); |
1518 | 1524 | ||
1519 | QDictIterator<QColor> it(mCategoryDict); | 1525 | QDictIterator<QColor> it(mCategoryDict); |
1520 | while (it.current()) { | 1526 | while (it.current()) { |
1521 | KOPrefs::instance()->setCategoryColor(it.currentKey(),*it.current()); | 1527 | KOPrefs::instance()->setCategoryColor(it.currentKey(),*it.current()); |
1522 | ++it; | 1528 | ++it; |
1523 | } | 1529 | } |
1524 | 1530 | ||
1525 | KOPrefs::instance()->mNextXDays = mNextXDaysSpin->value(); | 1531 | KOPrefs::instance()->mNextXDays = mNextXDaysSpin->value(); |
1526 | KOPrefs::instance()->mWhatsNextDays = mWhatsNextSpin->value(); | 1532 | KOPrefs::instance()->mWhatsNextDays = mWhatsNextSpin->value(); |
1527 | KOPrefs::instance()->mWhatsNextPrios = mPrioSpin->value(); | 1533 | KOPrefs::instance()->mWhatsNextPrios = mPrioSpin->value(); |
1528 | 1534 | ||
1529 | KOPrefs::instance()->mAdditionalMails.clear(); | 1535 | KOPrefs::instance()->mAdditionalMails.clear(); |
1530 | // QListViewItem *item; | 1536 | // QListViewItem *item; |
1531 | // item = mAMails->firstChild(); | 1537 | // item = mAMails->firstChild(); |
1532 | // while (item) | 1538 | // while (item) |
1533 | // { | 1539 | // { |
1534 | // KOPrefs::instance()->mAdditionalMails.append( item->text(0) ); | 1540 | // KOPrefs::instance()->mAdditionalMails.append( item->text(0) ); |
1535 | // item = item->nextSibling(); | 1541 | // item = item->nextSibling(); |
1536 | // } | 1542 | // } |
1537 | KOPrefs::instance()->mAlarmPlayBeeps = mAlarmPlayBeeps->value(); | 1543 | KOPrefs::instance()->mAlarmPlayBeeps = mAlarmPlayBeeps->value(); |
1538 | KOPrefs::instance()->mAlarmSuspendTime = mAlarmSuspendTime->value() ; | 1544 | KOPrefs::instance()->mAlarmSuspendTime = mAlarmSuspendTime->value() ; |
1539 | KOPrefs::instance()->mAlarmSuspendCount= mAlarmSuspendCount->value() ; | 1545 | KOPrefs::instance()->mAlarmSuspendCount= mAlarmSuspendCount->value() ; |
1540 | KOPrefs::instance()->mAlarmBeepInterval= mAlarmBeepInterval->value() ; | 1546 | KOPrefs::instance()->mAlarmBeepInterval= mAlarmBeepInterval->value() ; |
1541 | 1547 | ||
1542 | } | 1548 | } |
1543 | 1549 | ||
1544 | void KOPrefsDialog::updateCategories() | 1550 | void KOPrefsDialog::updateCategories() |
1545 | { | 1551 | { |
1546 | mCategoryCombo->clear(); | 1552 | mCategoryCombo->clear(); |
1547 | mCategoryDict.clear(); | 1553 | mCategoryDict.clear(); |
1548 | mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories); | 1554 | mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories); |
1549 | updateCategoryColor(); | 1555 | updateCategoryColor(); |
1550 | } | 1556 | } |
1551 | 1557 | ||
1552 | void KOPrefsDialog::warningGroupScheduling() | 1558 | void KOPrefsDialog::warningGroupScheduling() |
1553 | { | 1559 | { |
1554 | warningExperimental(mEnableGroupScheduling->checkBox()->isChecked()); | 1560 | warningExperimental(mEnableGroupScheduling->checkBox()->isChecked()); |
1555 | } | 1561 | } |
1556 | 1562 | ||
1557 | void KOPrefsDialog::warningProjectView() | 1563 | void KOPrefsDialog::warningProjectView() |
1558 | { | 1564 | { |
1559 | warningExperimental(mEnableProjectView->checkBox()->isChecked()); | 1565 | warningExperimental(mEnableProjectView->checkBox()->isChecked()); |
1560 | } | 1566 | } |
1561 | 1567 | ||
1562 | void KOPrefsDialog::warningExperimental(bool on) | 1568 | void KOPrefsDialog::warningExperimental(bool on) |
1563 | { | 1569 | { |
1564 | if (on) { | 1570 | if (on) { |
1565 | KMessageBox::information(this,i18n("This is an experimental feature. " | 1571 | KMessageBox::information(this,i18n("This is an experimental feature. " |
1566 | "It may not work, it may do nothing useful and it may cause data loss. " | 1572 | "It may not work, it may do nothing useful and it may cause data loss. " |
1567 | "Use with care.\n" | 1573 | "Use with care.\n" |
1568 | "You have to restart KOrganizer for this setting to take effect.")); | 1574 | "You have to restart KOrganizer for this setting to take effect.")); |
1569 | } else { | 1575 | } else { |
1570 | KMessageBox::information(this, | 1576 | KMessageBox::information(this, |
1571 | i18n("You have to restart KOrganizer for this setting to take effect.")); | 1577 | i18n("You have to restart KOrganizer for this setting to take effect.")); |
1572 | } | 1578 | } |
1573 | } | 1579 | } |
1574 | 1580 | ||
1575 | void KOPrefsDialog::toggleEmailSettings(bool on) | 1581 | void KOPrefsDialog::toggleEmailSettings(bool on) |
1576 | { | 1582 | { |
1577 | if (on) { | 1583 | if (on) { |
1578 | mEmailEdit->setEnabled(false); | 1584 | mEmailEdit->setEnabled(false); |
1579 | mNameEdit->setEnabled(false); | 1585 | mNameEdit->setEnabled(false); |
1580 | mEmailLabel->setEnabled(false); | 1586 | mEmailLabel->setEnabled(false); |
1581 | mNameLabel->setEnabled(false); | 1587 | mNameLabel->setEnabled(false); |
1582 | 1588 | ||
1583 | KEMailSettings settings; | 1589 | KEMailSettings settings; |
1584 | mNameEdit->setText(settings.getSetting(KEMailSettings::RealName)); | 1590 | mNameEdit->setText(settings.getSetting(KEMailSettings::RealName)); |
1585 | mEmailEdit->setText(settings.getSetting(KEMailSettings::EmailAddress)); | 1591 | mEmailEdit->setText(settings.getSetting(KEMailSettings::EmailAddress)); |
1586 | } else { | 1592 | } else { |
1587 | mEmailEdit->setEnabled(true); | 1593 | mEmailEdit->setEnabled(true); |
1588 | mNameEdit->setEnabled(true); | 1594 | mNameEdit->setEnabled(true); |
1589 | mEmailLabel->setEnabled(true); | 1595 | mEmailLabel->setEnabled(true); |
1590 | mNameLabel->setEnabled(true); | 1596 | mNameLabel->setEnabled(true); |
1591 | } | 1597 | } |
1592 | } | 1598 | } |
1593 | 1599 | ||
1594 | void KOPrefsDialog::addItem() | 1600 | void KOPrefsDialog::addItem() |
1595 | { | 1601 | { |
1596 | // aEmailsEdit->setEnabled(true); | 1602 | // aEmailsEdit->setEnabled(true); |
1597 | // QListViewItem *item = new QListViewItem(mAMails); | 1603 | // QListViewItem *item = new QListViewItem(mAMails); |
1598 | // mAMails->insertItem(item); | 1604 | // mAMails->insertItem(item); |
1599 | // mAMails->setSelected(item,true); | 1605 | // mAMails->setSelected(item,true); |
1600 | // aEmailsEdit->setText(i18n("(EmptyEmail)")); | 1606 | // aEmailsEdit->setText(i18n("(EmptyEmail)")); |
1601 | } | 1607 | } |
1602 | 1608 | ||
1603 | void KOPrefsDialog::removeItem() | 1609 | void KOPrefsDialog::removeItem() |
1604 | { | 1610 | { |
1605 | // QListViewItem *item; | 1611 | // QListViewItem *item; |
1606 | // item = mAMails->selectedItem(); | 1612 | // item = mAMails->selectedItem(); |
1607 | // if (!item) return; | 1613 | // if (!item) return; |
1608 | // mAMails->takeItem(item); | 1614 | // mAMails->takeItem(item); |
1609 | // item = mAMails->selectedItem(); | 1615 | // item = mAMails->selectedItem(); |
1610 | // if (!item) { | 1616 | // if (!item) { |
1611 | // aEmailsEdit->setText(""); | 1617 | // aEmailsEdit->setText(""); |
1612 | // aEmailsEdit->setEnabled(false); | 1618 | // aEmailsEdit->setEnabled(false); |
1613 | // } | 1619 | // } |
1614 | // if (mAMails->childCount() == 0) { | 1620 | // if (mAMails->childCount() == 0) { |
1615 | // aEmailsEdit->setEnabled(false); | 1621 | // aEmailsEdit->setEnabled(false); |
1616 | // } | 1622 | // } |
1617 | } | 1623 | } |
1618 | 1624 | ||
1619 | void KOPrefsDialog::updateItem() | 1625 | void KOPrefsDialog::updateItem() |
1620 | { | 1626 | { |
1621 | // QListViewItem *item; | 1627 | // QListViewItem *item; |
1622 | // item = mAMails->selectedItem(); | 1628 | // item = mAMails->selectedItem(); |
1623 | // if (!item) return; | 1629 | // if (!item) return; |
1624 | // item->setText(0,aEmailsEdit->text()); | 1630 | // item->setText(0,aEmailsEdit->text()); |
1625 | } | 1631 | } |
1626 | 1632 | ||
1627 | void KOPrefsDialog::updateInput() | 1633 | void KOPrefsDialog::updateInput() |
1628 | { | 1634 | { |
1629 | // QListViewItem *item; | 1635 | // QListViewItem *item; |
1630 | // item = mAMails->selectedItem(); | 1636 | // item = mAMails->selectedItem(); |
1631 | // if (!item) return; | 1637 | // if (!item) return; |
1632 | // aEmailsEdit->setEnabled(true); | 1638 | // aEmailsEdit->setEnabled(true); |
1633 | // aEmailsEdit->setText(item->text(0)); | 1639 | // aEmailsEdit->setText(item->text(0)); |
1634 | } | 1640 | } |
1635 | void KOPrefsDialog::updateTimezoneOffset( int index ) | 1641 | void KOPrefsDialog::updateTimezoneOffset( int index ) |
1636 | { | 1642 | { |
1637 | /* | 1643 | /* |
1638 | qDebug("updateTimezoneOffset %d ", index); | 1644 | qDebug("updateTimezoneOffset %d ", index); |
1639 | if ( index < 24 ) { | 1645 | if ( index < 24 ) { |
1640 | mTimezoneOffsetSpin->setEnabled ( false ); | 1646 | mTimezoneOffsetSpin->setEnabled ( false ); |
1641 | mTimezoneOffsetSpin->setValue( ( index-11 ) * 60 ); | 1647 | mTimezoneOffsetSpin->setValue( ( index-11 ) * 60 ); |
1642 | 1648 | ||
1643 | 1649 | ||
1644 | } else { | 1650 | } else { |
1645 | if ( index == 24 ) { | 1651 | if ( index == 24 ) { |
1646 | mTimezoneOffsetSpin->setEnabled ( true ); | 1652 | mTimezoneOffsetSpin->setEnabled ( true ); |
1647 | mTimezoneOffsetSpin->setValue( KOPrefs::instance()->mTimeZoneOffset); | 1653 | mTimezoneOffsetSpin->setValue( KOPrefs::instance()->mTimeZoneOffset); |
1648 | 1654 | ||
1649 | } else { | 1655 | } else { |
1650 | mTimezoneOffsetSpin->setEnabled ( false ); | 1656 | mTimezoneOffsetSpin->setEnabled ( false ); |
1651 | mTimezoneOffsetSpin->setValue( 0 ); | 1657 | mTimezoneOffsetSpin->setValue( 0 ); |
1652 | } | 1658 | } |
1653 | } | 1659 | } |
1654 | */ | 1660 | */ |
1655 | } | 1661 | } |
1656 | 1662 | ||
1657 | void KOPrefsDialog::setupTimeZoneTab() | 1663 | void KOPrefsDialog::setupTimeZoneTab() |
1658 | { | 1664 | { |
1659 | #if 0 | 1665 | #if 0 |
1660 | QFrame *topFrame = addPage(i18n("Time Zone"),0,0); | 1666 | QFrame *topFrame = addPage(i18n("Time Zone"),0,0); |
1661 | // DesktopIcon("clock",KIcon::SizeMedium)); | 1667 | // DesktopIcon("clock",KIcon::SizeMedium)); |
1662 | 1668 | ||
1663 | QGridLayout *topLayout = new QGridLayout(topFrame,5,2); | 1669 | QGridLayout *topLayout = new QGridLayout(topFrame,5,2); |
1664 | topLayout->setSpacing(spacingHint()); | 1670 | topLayout->setSpacing(mSpacingHint); |
1665 | topLayout->setMargin(marginHint()); | 1671 | topLayout->setMargin(mMarginHint); |
1666 | 1672 | ||
1667 | QHBox *timeZoneBox = new QHBox( topFrame ); | 1673 | QHBox *timeZoneBox = new QHBox( topFrame ); |
1668 | topLayout->addMultiCellWidget( timeZoneBox, 0, 0, 0, 1 ); | 1674 | topLayout->addMultiCellWidget( timeZoneBox, 0, 0, 0, 1 ); |
1669 | 1675 | ||
1670 | new QLabel( i18n("Timezone:"), timeZoneBox ); | 1676 | new QLabel( i18n("Timezone:"), timeZoneBox ); |
1671 | mTimeZoneCombo = new QComboBox( timeZoneBox ); | 1677 | mTimeZoneCombo = new QComboBox( timeZoneBox ); |
1672 | if ( QApplication::desktop()->width() < 300 ) { | 1678 | if ( QApplication::desktop()->width() < 300 ) { |
1673 | mTimeZoneCombo->setMaximumWidth(150); | 1679 | mTimeZoneCombo->setMaximumWidth(150); |
1674 | } | 1680 | } |
1675 | 1681 | ||
1676 | QStringList list; | 1682 | QStringList list; |
1677 | list = KGlobal::locale()->timeZoneList(); | 1683 | list = KGlobal::locale()->timeZoneList(); |
1678 | mTimeZoneCombo->insertStringList(list); | 1684 | mTimeZoneCombo->insertStringList(list); |
1679 | 1685 | ||
1680 | // find the currently set time zone and select it | 1686 | // find the currently set time zone and select it |
1681 | QString sCurrentlySet = KOPrefs::instance()->mTimeZoneId; | 1687 | QString sCurrentlySet = KOPrefs::instance()->mTimeZoneId; |
1682 | int nCurrentlySet = 11; | 1688 | int nCurrentlySet = 11; |
1683 | for (int i = 0; i < mTimeZoneCombo->count(); i++) | 1689 | for (int i = 0; i < mTimeZoneCombo->count(); i++) |
1684 | { | 1690 | { |
1685 | if (mTimeZoneCombo->text(i) == sCurrentlySet) | 1691 | if (mTimeZoneCombo->text(i) == sCurrentlySet) |
1686 | { | 1692 | { |
1687 | nCurrentlySet = i; | 1693 | nCurrentlySet = i; |
1688 | break; | 1694 | break; |
1689 | } | 1695 | } |
1690 | } | 1696 | } |
1691 | mTimeZoneCombo->setCurrentItem(nCurrentlySet); | 1697 | mTimeZoneCombo->setCurrentItem(nCurrentlySet); |
1692 | int iii = 1; | 1698 | int iii = 1; |
1693 | KPrefsDialogWidBool *sb = | 1699 | KPrefsDialogWidBool *sb = |
1694 | addWidBool(i18n("Timezone has daylight saving"), | 1700 | addWidBool(i18n("Timezone has daylight saving"), |
1695 | &(KOPrefs::instance()->mUseDaylightsaving),topFrame); | 1701 | &(KOPrefs::instance()->mUseDaylightsaving),topFrame); |
1696 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); | 1702 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); |
1697 | ++iii; | 1703 | ++iii; |
1698 | QLabel* lab = new QLabel( i18n("Actual start and end is the\nsunday before this date."), topFrame ); | 1704 | QLabel* lab = new QLabel( i18n("Actual start and end is the\nsunday before this date."), topFrame ); |
1699 | topLayout->addMultiCellWidget(lab, iii,iii,0,1); | 1705 | topLayout->addMultiCellWidget(lab, iii,iii,0,1); |
1700 | ++iii; | 1706 | ++iii; |
1701 | lab = new QLabel( i18n("The year in the date is ignored."), topFrame ); | 1707 | lab = new QLabel( i18n("The year in the date is ignored."), topFrame ); |
1702 | topLayout->addMultiCellWidget(lab, iii,iii,0,1); | 1708 | topLayout->addMultiCellWidget(lab, iii,iii,0,1); |
1703 | ++iii; | 1709 | ++iii; |
1704 | lab = new QLabel( i18n("Daylight start:"), topFrame ); | 1710 | lab = new QLabel( i18n("Daylight start:"), topFrame ); |
1705 | topLayout->addWidget(lab, iii,0); | 1711 | topLayout->addWidget(lab, iii,0); |
1706 | mStartDateSavingEdit = new KDateEdit(topFrame); | 1712 | mStartDateSavingEdit = new KDateEdit(topFrame); |
1707 | topLayout->addWidget(mStartDateSavingEdit, iii,1); | 1713 | topLayout->addWidget(mStartDateSavingEdit, iii,1); |
1708 | ++iii; | 1714 | ++iii; |
1709 | 1715 | ||
1710 | lab = new QLabel( i18n("Daylight end:"), topFrame ); | 1716 | lab = new QLabel( i18n("Daylight end:"), topFrame ); |
1711 | topLayout->addWidget(lab, iii,0); | 1717 | topLayout->addWidget(lab, iii,0); |
1712 | mEndDateSavingEdit = new KDateEdit(topFrame); | 1718 | mEndDateSavingEdit = new KDateEdit(topFrame); |
1713 | topLayout->addWidget(mEndDateSavingEdit, iii,1); | 1719 | topLayout->addWidget(mEndDateSavingEdit, iii,1); |
1714 | ++iii; | 1720 | ++iii; |
1715 | QDate current ( 2001, 1,1); | 1721 | QDate current ( 2001, 1,1); |
1716 | mStartDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingStart-1)); | 1722 | mStartDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingStart-1)); |
1717 | mEndDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingEnd-1)); | 1723 | mEndDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingEnd-1)); |
1718 | #endif | 1724 | #endif |
1719 | 1725 | ||
1720 | } | 1726 | } |
1721 | 1727 | ||
diff --git a/korganizer/koprefsdialog.h b/korganizer/koprefsdialog.h index e20969a..6892028 100644 --- a/korganizer/koprefsdialog.h +++ b/korganizer/koprefsdialog.h | |||
@@ -1,164 +1,166 @@ | |||
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 | #ifndef _KOPREFSDIALOG_H | 23 | #ifndef _KOPREFSDIALOG_H |
24 | #define _KOPREFSDIALOG_H | 24 | #define _KOPREFSDIALOG_H |
25 | 25 | ||
26 | #include <qframe.h> | 26 | #include <qframe.h> |
27 | #include <qdict.h> | 27 | #include <qdict.h> |
28 | #include <qcolor.h> | 28 | #include <qcolor.h> |
29 | #include <qlistview.h> | 29 | #include <qlistview.h> |
30 | 30 | ||
31 | #include <kdialogbase.h> | 31 | #include <kdialogbase.h> |
32 | 32 | ||
33 | #include <libkdepim/kprefsdialog.h> | 33 | #include <libkdepim/kprefsdialog.h> |
34 | #include <libkdepim/kdateedit.h> | 34 | #include <libkdepim/kdateedit.h> |
35 | #include <kcmconfigs/kdepimconfigwidget.h> | 35 | #include <kcmconfigs/kdepimconfigwidget.h> |
36 | 36 | ||
37 | class KColorButton; | 37 | class KColorButton; |
38 | class QSpinBox; | 38 | class QSpinBox; |
39 | class QSlider; | 39 | class QSlider; |
40 | class KURLRequester; | 40 | class KURLRequester; |
41 | class QComboBox; | 41 | class QComboBox; |
42 | class QLineEdit; | 42 | class QLineEdit; |
43 | class QStringList; | 43 | class QStringList; |
44 | 44 | ||
45 | /** Dialog to change the korganizer configuration. | 45 | /** Dialog to change the korganizer configuration. |
46 | */ | 46 | */ |
47 | class KOPrefsDialog : public KPrefsDialog | 47 | class KOPrefsDialog : public KPrefsDialog |
48 | { | 48 | { |
49 | Q_OBJECT | 49 | Q_OBJECT |
50 | public: | 50 | public: |
51 | /** Initialize dialog and pages */ | 51 | /** Initialize dialog and pages */ |
52 | KOPrefsDialog(QWidget *parent=0,char *name=0,bool modal=false); | 52 | KOPrefsDialog(QWidget *parent=0,char *name=0,bool modal=false); |
53 | ~KOPrefsDialog(); | 53 | ~KOPrefsDialog(); |
54 | 54 | ||
55 | public slots: | 55 | public slots: |
56 | void showPrinterTab(); | 56 | void showPrinterTab(); |
57 | 57 | ||
58 | /** Update controls for categories */ | 58 | /** Update controls for categories */ |
59 | void updateCategories(); | 59 | void updateCategories(); |
60 | void showSyncPage(); | 60 | void showSyncPage(); |
61 | protected slots: | 61 | protected slots: |
62 | void selectSoundFile(); | 62 | void selectSoundFile(); |
63 | void setCategoryColor(); | 63 | void setCategoryColor(); |
64 | void updateCategoryColor(); | 64 | void updateCategoryColor(); |
65 | void updateTimezoneOffset( int ); | 65 | void updateTimezoneOffset( int ); |
66 | 66 | ||
67 | 67 | ||
68 | void warningExperimental(bool on); | 68 | void warningExperimental(bool on); |
69 | void warningGroupScheduling(); | 69 | void warningGroupScheduling(); |
70 | void warningProjectView(); | 70 | void warningProjectView(); |
71 | 71 | ||
72 | void toggleEmailSettings(bool); | 72 | void toggleEmailSettings(bool); |
73 | 73 | ||
74 | //additional emails | 74 | //additional emails |
75 | void addItem(); | 75 | void addItem(); |
76 | void removeItem(); | 76 | void removeItem(); |
77 | void updateItem(); | 77 | void updateItem(); |
78 | void updateInput(); | 78 | void updateInput(); |
79 | 79 | ||
80 | protected: | 80 | protected: |
81 | void usrReadConfig(); | 81 | void usrReadConfig(); |
82 | void usrWriteConfig(); | 82 | void usrWriteConfig(); |
83 | void setupGlobalTab(); | 83 | void setupGlobalTab(); |
84 | 84 | ||
85 | void setupMainTab(); | 85 | void setupMainTab(); |
86 | void setupTimeTab(); | 86 | void setupTimeTab(); |
87 | void setupTimeZoneTab(); | 87 | void setupTimeZoneTab(); |
88 | void setupLocaleTab(); | 88 | void setupLocaleTab(); |
89 | void setupLocaleDateTab(); | 89 | void setupLocaleDateTab(); |
90 | void setupFontsTab(); | 90 | void setupFontsTab(); |
91 | void setupColorsTab(); | 91 | void setupColorsTab(); |
92 | void setupViewsTab(); | 92 | void setupViewsTab(); |
93 | void setupDisplayTab(); | 93 | void setupDisplayTab(); |
94 | void setupPrinterTab(); | 94 | void setupPrinterTab(); |
95 | void setupGroupSchedulingTab(); | 95 | void setupGroupSchedulingTab(); |
96 | void setupGroupAutomationTab(); | 96 | void setupGroupAutomationTab(); |
97 | void setupSyncTab(); | 97 | void setupSyncTab(); |
98 | void setupSyncAlgTab(); | 98 | void setupSyncAlgTab(); |
99 | 99 | ||
100 | void setCombo(QComboBox *combo,const QString & text, const QStringList *tags = 0); | 100 | void setCombo(QComboBox *combo,const QString & text, const QStringList *tags = 0); |
101 | 101 | ||
102 | 102 | ||
103 | private: | 103 | private: |
104 | KDEPIMConfigWidget* kdelibcfg; | 104 | KDEPIMConfigWidget* kdelibcfg; |
105 | KPrefsDialogWidBool *mEnableGroupScheduling; | 105 | KPrefsDialogWidBool *mEnableGroupScheduling; |
106 | KPrefsDialogWidBool *mEnableProjectView; | 106 | KPrefsDialogWidBool *mEnableProjectView; |
107 | 107 | ||
108 | QFrame *mPrinterTab; | 108 | QFrame *mPrinterTab; |
109 | 109 | ||
110 | QLineEdit *nameEdit; | 110 | QLineEdit *nameEdit; |
111 | QLineEdit *emailEdit; | 111 | QLineEdit *emailEdit; |
112 | 112 | ||
113 | QComboBox *timeCombo; | 113 | QComboBox *timeCombo; |
114 | QComboBox *tzCombo; | 114 | QComboBox *tzCombo; |
115 | 115 | ||
116 | // widgets holding preferences data | 116 | // widgets holding preferences data |
117 | QLineEdit *mNameEdit; | 117 | QLineEdit *mNameEdit; |
118 | QLineEdit *mEmailEdit; | 118 | QLineEdit *mEmailEdit; |
119 | QLabel *mNameLabel; | 119 | QLabel *mNameLabel; |
120 | QLabel *mEmailLabel; | 120 | QLabel *mEmailLabel; |
121 | QLineEdit *mAdditionalEdit; | 121 | QLineEdit *mAdditionalEdit; |
122 | QSpinBox *mAutoSaveIntervalSpin; | 122 | QSpinBox *mAutoSaveIntervalSpin; |
123 | QSpinBox *mPrioSpin; | 123 | QSpinBox *mPrioSpin; |
124 | // QListView *mAMails; | 124 | // QListView *mAMails; |
125 | QLineEdit *aEmailsEdit; | 125 | QLineEdit *aEmailsEdit; |
126 | 126 | ||
127 | QComboBox *mTimeZoneCombo; | 127 | QComboBox *mTimeZoneCombo; |
128 | QStringList tzonenames; | 128 | QStringList tzonenames; |
129 | QSpinBox *mStartTimeSpin; | 129 | QSpinBox *mStartTimeSpin; |
130 | QSpinBox *mDefaultDurationSpin; | 130 | QSpinBox *mDefaultDurationSpin; |
131 | QComboBox *mAlarmTimeCombo; | 131 | QComboBox *mAlarmTimeCombo; |
132 | 132 | ||
133 | QComboBox *mCategoryCombo; | 133 | QComboBox *mCategoryCombo; |
134 | KColorButton *mCategoryButton; | 134 | KColorButton *mCategoryButton; |
135 | QDict<QColor> mCategoryDict; | 135 | QDict<QColor> mCategoryDict; |
136 | 136 | ||
137 | QSlider *mHourSizeSlider; | 137 | QSlider *mHourSizeSlider; |
138 | 138 | ||
139 | QSpinBox *mNextXDaysSpin; | 139 | QSpinBox *mNextXDaysSpin; |
140 | QSpinBox *mWhatsNextSpin; | 140 | QSpinBox *mWhatsNextSpin; |
141 | 141 | ||
142 | QLineEdit * mRemoteIPEdit; | 142 | QLineEdit * mRemoteIPEdit; |
143 | QLineEdit * mRemoteUser; | 143 | QLineEdit * mRemoteUser; |
144 | QLineEdit * mRemotePassWd; | 144 | QLineEdit * mRemotePassWd; |
145 | QLineEdit * mRemoteFile; | 145 | QLineEdit * mRemoteFile; |
146 | QLineEdit * mLocalTempFile; | 146 | QLineEdit * mLocalTempFile; |
147 | QWidget* mSetupSyncAlgTab; | 147 | QWidget* mSetupSyncAlgTab; |
148 | QLineEdit * mUserDateFormatLong; | 148 | QLineEdit * mUserDateFormatLong; |
149 | QLineEdit * mUserDateFormatShort; | 149 | QLineEdit * mUserDateFormatShort; |
150 | 150 | ||
151 | QSpinBox *mTimezoneOffsetSpin; | 151 | QSpinBox *mTimezoneOffsetSpin; |
152 | QSpinBox *mDaylightsavingStart; | 152 | QSpinBox *mDaylightsavingStart; |
153 | QSpinBox *mDaylightsavingEnd; | 153 | QSpinBox *mDaylightsavingEnd; |
154 | KDateEdit* mStartDateSavingEdit; | 154 | KDateEdit* mStartDateSavingEdit; |
155 | KDateEdit* mEndDateSavingEdit; | 155 | KDateEdit* mEndDateSavingEdit; |
156 | QSpinBox * mAlarmPlayBeeps; | 156 | QSpinBox * mAlarmPlayBeeps; |
157 | QSpinBox * mAlarmSuspendTime; | 157 | QSpinBox * mAlarmSuspendTime; |
158 | QSpinBox * mAlarmSuspendCount; | 158 | QSpinBox * mAlarmSuspendCount; |
159 | QSpinBox * mAlarmBeepInterval; | 159 | QSpinBox * mAlarmBeepInterval; |
160 | 160 | ||
161 | QLineEdit * mDefaultAlarmFile; | 161 | QLineEdit * mDefaultAlarmFile; |
162 | int mSpacingHint; | ||
163 | int mMarginHint; | ||
162 | }; | 164 | }; |
163 | 165 | ||
164 | #endif | 166 | #endif |
diff --git a/korganizer/navigatorbar.cpp b/korganizer/navigatorbar.cpp index 0610d55..b03870f 100644 --- a/korganizer/navigatorbar.cpp +++ b/korganizer/navigatorbar.cpp | |||
@@ -1,279 +1,279 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | 3 | ||
4 | Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org> | 4 | Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org> |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
7 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
8 | the Free Software Foundation; either version 2 of the License, or | 8 | the Free Software Foundation; either version 2 of the License, or |
9 | (at your option) any later version. | 9 | (at your option) any later version. |
10 | 10 | ||
11 | This program is distributed in the hope that it will be useful, | 11 | This program is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public License | 16 | You should have received a copy of the GNU General Public License |
17 | along with this program; if not, write to the Free Software | 17 | along with this program; if not, write to the Free Software |
18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
19 | 19 | ||
20 | As a special exception, permission is given to link this program | 20 | As a special exception, permission is given to link this program |
21 | with any edition of Qt, and distribute the resulting executable, | 21 | with any edition of Qt, and distribute the resulting executable, |
22 | without including the source code for Qt in the source distribution. | 22 | without including the source code for Qt in the source distribution. |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include <qstring.h> | 25 | #include <qstring.h> |
26 | #include <qtooltip.h> | 26 | #include <qtooltip.h> |
27 | #include <qpushbutton.h> | 27 | #include <qpushbutton.h> |
28 | #include <qlayout.h> | 28 | #include <qlayout.h> |
29 | #include <qframe.h> | 29 | #include <qframe.h> |
30 | #include <qlabel.h> | 30 | #include <qlabel.h> |
31 | #include <qpopupmenu.h> | 31 | #include <qpopupmenu.h> |
32 | #include <qapplication.h> | 32 | #include <qapplication.h> |
33 | 33 | ||
34 | #include <kdebug.h> | 34 | #include <kdebug.h> |
35 | #include <klocale.h> | 35 | #include <klocale.h> |
36 | #include <kglobal.h> | 36 | #include <kglobal.h> |
37 | #include <kiconloader.h> | 37 | #include <kiconloader.h> |
38 | #include "libkdepim/kdatepicker.h" | 38 | #include "libkdepim/kdatepicker.h" |
39 | #include <knotifyclient.h> | 39 | #include <knotifyclient.h> |
40 | #include "kdatetbl.h" | 40 | #include "kdatetbl.h" |
41 | 41 | ||
42 | #include "koglobals.h" | 42 | #include "koglobals.h" |
43 | #include <kglobalsettings.h> | 43 | #include <kglobalsettings.h> |
44 | #include "koprefs.h" | 44 | #include "koprefs.h" |
45 | #ifndef KORG_NOPLUGINS | 45 | #ifndef KORG_NOPLUGINS |
46 | #include "kocore.h" | 46 | #include "kocore.h" |
47 | #endif | 47 | #endif |
48 | 48 | ||
49 | #include <kcalendarsystem.h> | 49 | #include <kcalendarsystem.h> |
50 | 50 | ||
51 | #include "navigatorbar.h" | 51 | #include "navigatorbar.h" |
52 | 52 | ||
53 | NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *name ) | 53 | NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *name ) |
54 | : QWidget( parent, name ) | 54 | : QWidget( parent, name ) |
55 | { | 55 | { |
56 | QBoxLayout *topLayout = new QHBoxLayout( this ); | 56 | QBoxLayout *topLayout = new QHBoxLayout( this ); |
57 | 57 | ||
58 | // Set up the control buttons and date label | 58 | // Set up the control buttons and date label |
59 | mCtrlFrame = new QFrame( this ); | 59 | mCtrlFrame = new QFrame( this ); |
60 | mCtrlFrame->setFrameStyle(QFrame::Panel|QFrame::Raised); | 60 | mCtrlFrame->setFrameStyle(QFrame::Panel|QFrame::Raised); |
61 | mCtrlFrame->setLineWidth(1); | 61 | mCtrlFrame->setLineWidth(1); |
62 | 62 | ||
63 | topLayout->addWidget( mCtrlFrame ); | 63 | topLayout->addWidget( mCtrlFrame ); |
64 | 64 | ||
65 | 65 | ||
66 | 66 | ||
67 | bool isRTL = KOGlobals::self()->reverseLayout(); | 67 | bool isRTL = KOGlobals::self()->reverseLayout(); |
68 | #ifndef DESKTOP_VERSION | 68 | #ifndef DESKTOP_VERSION |
69 | bool isDesktop = false; | 69 | bool isDesktop = false; |
70 | #else | 70 | #else |
71 | bool isDesktop = true; | 71 | bool isDesktop = true; |
72 | #endif | 72 | #endif |
73 | if ( QString ( name ) == QString("useBigPixmaps") && QApplication::desktop()->width() > 320 ) | 73 | if ( QString ( name ) == QString("useBigPixmaps") && QApplication::desktop()->width() > 320 ) |
74 | isDesktop = true; | 74 | isDesktop = true; |
75 | // Create backward navigation buttons | 75 | // Create backward navigation buttons |
76 | mPrevYear = new QPushButton( mCtrlFrame ); | 76 | mPrevYear = new QPushButton( mCtrlFrame ); |
77 | mPrevYear->setPixmap( SmallIcon( isDesktop ? "3leftarrowB" : "3leftarrow" ) ); | 77 | mPrevYear->setPixmap( SmallIcon( isDesktop ? "3leftarrowB" : "3leftarrow" ) ); |
78 | QToolTip::add( mPrevYear, i18n("Previous Year") ); | 78 | QToolTip::add( mPrevYear, i18n("Previous Year") ); |
79 | 79 | ||
80 | mPrevMonth = new QPushButton( mCtrlFrame ); | 80 | mPrevMonth = new QPushButton( mCtrlFrame ); |
81 | mPrevMonth->setPixmap( SmallIcon( isDesktop ? "2leftarrowB" : "2leftarrow") ); | 81 | mPrevMonth->setPixmap( SmallIcon( isDesktop ? "2leftarrowB" : "2leftarrow") ); |
82 | QToolTip::add( mPrevMonth, i18n("Previous Month") ); | 82 | QToolTip::add( mPrevMonth, i18n("Previous Month") ); |
83 | 83 | ||
84 | // Create forward navigation buttons | 84 | // Create forward navigation buttons |
85 | mNextMonth = new QPushButton( mCtrlFrame ); | 85 | mNextMonth = new QPushButton( mCtrlFrame ); |
86 | mNextMonth->setPixmap( SmallIcon( isDesktop ? "2rightarrowB" : "2rightarrow") ); | 86 | mNextMonth->setPixmap( SmallIcon( isDesktop ? "2rightarrowB" : "2rightarrow") ); |
87 | QToolTip::add( mNextMonth, i18n("Next Month") ); | 87 | QToolTip::add( mNextMonth, i18n("Next Month") ); |
88 | 88 | ||
89 | mPrevWeek = new QPushButton( mCtrlFrame ); | 89 | mPrevWeek = new QPushButton( mCtrlFrame ); |
90 | mPrevWeek->setPixmap( SmallIcon( isDesktop ? "1leftarrowB" : "1leftarrow") ); | 90 | mPrevWeek->setPixmap( SmallIcon( isDesktop ? "1leftarrowB" : "1leftarrow") ); |
91 | QToolTip::add( mPrevWeek, i18n("Previous Week") ); | 91 | QToolTip::add( mPrevWeek, i18n("Previous Week") ); |
92 | 92 | ||
93 | // Create forward navigation buttons | 93 | // Create forward navigation buttons |
94 | mNextWeek = new QPushButton( mCtrlFrame ); | 94 | mNextWeek = new QPushButton( mCtrlFrame ); |
95 | mNextWeek->setPixmap( SmallIcon( isDesktop ? "1rightarrowB" : "1rightarrow") ); | 95 | mNextWeek->setPixmap( SmallIcon( isDesktop ? "1rightarrowB" : "1rightarrow") ); |
96 | QToolTip::add( mNextWeek, i18n("Next Week") ); | 96 | QToolTip::add( mNextWeek, i18n("Next Week") ); |
97 | 97 | ||
98 | mNextYear = new QPushButton( mCtrlFrame ); | 98 | mNextYear = new QPushButton( mCtrlFrame ); |
99 | mNextYear->setPixmap( SmallIcon( isDesktop ? "3rightarrowB": "3rightarrow") ); | 99 | mNextYear->setPixmap( SmallIcon( isDesktop ? "3rightarrowB": "3rightarrow") ); |
100 | QToolTip::add( mNextYear, i18n("Next Year") ); | 100 | QToolTip::add( mNextYear, i18n("Next Year") ); |
101 | mSelectMonth = new QPushButton( mCtrlFrame ); | 101 | mSelectMonth = new QPushButton( mCtrlFrame ); |
102 | // Create month name label | 102 | // Create month name label |
103 | //selectMonth->setFont( tfont ); | 103 | //selectMonth->setFont( tfont ); |
104 | // selectMonth->setAlignment( AlignCenter ); | 104 | // selectMonth->setAlignment( AlignCenter ); |
105 | //mDateLabel = new QLabel( selectMonth ); | 105 | //mDateLabel = new QLabel( selectMonth ); |
106 | //mDateLabel->setFont( tfont ); | 106 | //mDateLabel->setFont( tfont ); |
107 | //mDateLabel->setAlignment( AlignCenter ); | 107 | //mDateLabel->setAlignment( AlignCenter ); |
108 | if ( QString ( name ) == QString("useBigPixmaps") ) { | 108 | if ( QString ( name ) == QString("useBigPixmaps") ) { |
109 | mNextMonth->setFlat( true); | 109 | mNextMonth->setFlat( true); |
110 | mNextWeek->setFlat( true); | 110 | mNextWeek->setFlat( true); |
111 | mNextYear->setFlat( true); | 111 | mNextYear->setFlat( true); |
112 | mSelectMonth->setFlat( true); | 112 | mSelectMonth->setFlat( true); |
113 | mPrevYear->setFlat( true); | 113 | mPrevYear->setFlat( true); |
114 | mPrevMonth->setFlat( true); | 114 | mPrevMonth->setFlat( true); |
115 | mPrevWeek->setFlat( true); | 115 | mPrevWeek->setFlat( true); |
116 | 116 | ||
117 | mPrevYear->setAutoRepeat( true ); | 117 | mPrevYear->setAutoRepeat( true ); |
118 | mPrevMonth->setAutoRepeat( true ); | 118 | mPrevMonth->setAutoRepeat( true ); |
119 | mNextMonth->setAutoRepeat( true ); | 119 | mNextMonth->setAutoRepeat( true ); |
120 | mPrevWeek->setAutoRepeat( true ); | 120 | mPrevWeek->setAutoRepeat( true ); |
121 | mNextWeek->setAutoRepeat( true ); | 121 | mNextWeek->setAutoRepeat( true ); |
122 | mNextYear->setAutoRepeat( true ); | 122 | mNextYear->setAutoRepeat( true ); |
123 | } else { | 123 | } else { |
124 | mPrevWeek->hide(); | 124 | mPrevWeek->hide(); |
125 | mNextWeek->hide(); | 125 | mNextWeek->hide(); |
126 | } | 126 | } |
127 | 127 | ||
128 | resetFont( font() ); | 128 | resetFont( font() ); |
129 | 129 | ||
130 | 130 | ||
131 | // set up control frame layout | 131 | // set up control frame layout |
132 | QBoxLayout *ctrlLayout = new QHBoxLayout( mCtrlFrame, 1 ); | 132 | QBoxLayout *ctrlLayout = new QHBoxLayout( mCtrlFrame, 1 ); |
133 | ctrlLayout->addWidget( mPrevYear, 3 ); | 133 | ctrlLayout->addWidget( mPrevYear, 3 ); |
134 | ctrlLayout->addWidget( mPrevMonth, 3 ); | 134 | ctrlLayout->addWidget( mPrevMonth, 3 ); |
135 | ctrlLayout->addWidget( mPrevWeek, 3 ); | 135 | ctrlLayout->addWidget( mPrevWeek, 3 ); |
136 | //ctrlLayout->addStretch( 1 ); | 136 | //ctrlLayout->addStretch( 1 ); |
137 | // ctrlLayout->addSpacing( 1 ); | 137 | // ctrlLayout->addSpacing( 1 ); |
138 | // ctrlLayout->addWidget( mDateLabel ); | 138 | // ctrlLayout->addWidget( mDateLabel ); |
139 | ctrlLayout->addWidget( mSelectMonth ); | 139 | ctrlLayout->addWidget( mSelectMonth ); |
140 | // ctrlLayout->addSpacing( 1 ); | 140 | // ctrlLayout->addSpacing( 1 ); |
141 | // ctrlLayout->addStretch( 1 ); | 141 | // ctrlLayout->addStretch( 1 ); |
142 | ctrlLayout->addWidget( mNextWeek, 3 ); | 142 | ctrlLayout->addWidget( mNextWeek, 3 ); |
143 | ctrlLayout->addWidget( mNextMonth, 3 ); | 143 | ctrlLayout->addWidget( mNextMonth, 3 ); |
144 | ctrlLayout->addWidget( mNextYear, 3 ); | 144 | ctrlLayout->addWidget( mNextYear, 3 ); |
145 | 145 | ||
146 | connect( mPrevYear, SIGNAL( clicked() ), SIGNAL( goPrevYear() ) ); | 146 | connect( mPrevYear, SIGNAL( clicked() ), SIGNAL( goPrevYear() ) ); |
147 | connect( mPrevMonth, SIGNAL( clicked() ), SIGNAL( goPrevMonth() ) ); | 147 | connect( mPrevMonth, SIGNAL( clicked() ), SIGNAL( goPrevMonth() ) ); |
148 | connect( mNextMonth, SIGNAL( clicked() ), SIGNAL( goNextMonth() ) ); | 148 | connect( mNextMonth, SIGNAL( clicked() ), SIGNAL( goNextMonth() ) ); |
149 | connect( mPrevWeek, SIGNAL( clicked() ), SIGNAL( goPrevWeek() ) ); | 149 | connect( mPrevWeek, SIGNAL( clicked() ), SIGNAL( goPrevWeek() ) ); |
150 | connect( mNextWeek, SIGNAL( clicked() ), SIGNAL( goNextWeek() ) ); | 150 | connect( mNextWeek, SIGNAL( clicked() ), SIGNAL( goNextWeek() ) ); |
151 | connect( mNextYear, SIGNAL( clicked() ), SIGNAL( goNextYear() ) ); | 151 | connect( mNextYear, SIGNAL( clicked() ), SIGNAL( goNextYear() ) ); |
152 | connect( mSelectMonth, SIGNAL( clicked() ),SLOT( selectMonth() ) ); | 152 | connect( mSelectMonth, SIGNAL( clicked() ),SLOT( selectMonth() ) ); |
153 | mPrevYear->setFocusPolicy(NoFocus); | 153 | mPrevYear->setFocusPolicy(NoFocus); |
154 | mPrevMonth->setFocusPolicy(NoFocus); | 154 | mPrevMonth->setFocusPolicy(NoFocus); |
155 | mNextMonth->setFocusPolicy(NoFocus); | 155 | mNextMonth->setFocusPolicy(NoFocus); |
156 | mPrevWeek->setFocusPolicy(NoFocus); | 156 | mPrevWeek->setFocusPolicy(NoFocus); |
157 | mNextWeek->setFocusPolicy(NoFocus); | 157 | mNextWeek->setFocusPolicy(NoFocus); |
158 | mNextYear->setFocusPolicy(NoFocus); | 158 | mNextYear->setFocusPolicy(NoFocus); |
159 | mSelectMonth->setFocusPolicy(NoFocus); | 159 | mSelectMonth->setFocusPolicy(NoFocus); |
160 | setSizePolicy( QSizePolicy ( QSizePolicy::Expanding ,QSizePolicy::Fixed ) ); | 160 | setSizePolicy( QSizePolicy ( QSizePolicy::Expanding ,QSizePolicy::Fixed ) ); |
161 | 161 | ||
162 | } | 162 | } |
163 | 163 | ||
164 | NavigatorBar::~NavigatorBar() | 164 | NavigatorBar::~NavigatorBar() |
165 | { | 165 | { |
166 | } | 166 | } |
167 | QSize NavigatorBar::sizeHint() const | 167 | QSize NavigatorBar::sizeHint() const |
168 | { | 168 | { |
169 | int wid = mCurrentMinWid ; | 169 | int wid = mCurrentMinWid ; |
170 | if ( mPrevYear->isVisible() ) | 170 | if ( mPrevYear->isVisible() ) |
171 | wid += mCurrentButtonMinWid; | 171 | wid += mCurrentButtonMinWid; |
172 | if ( mPrevMonth->isVisible() ) | 172 | if ( mPrevMonth->isVisible() ) |
173 | wid += mCurrentButtonMinWid; | 173 | wid += mCurrentButtonMinWid; |
174 | if ( mPrevWeek->isVisible() ) | 174 | if ( mPrevWeek->isVisible() ) |
175 | wid += mCurrentButtonMinWid; | 175 | wid += mCurrentButtonMinWid; |
176 | if ( mNextMonth->isVisible() ) | 176 | if ( mNextMonth->isVisible() ) |
177 | wid += mCurrentButtonMinWid; | 177 | wid += mCurrentButtonMinWid; |
178 | if ( mNextWeek->isVisible() ) | 178 | if ( mNextWeek->isVisible() ) |
179 | wid += mCurrentButtonMinWid; | 179 | wid += mCurrentButtonMinWid; |
180 | if ( mNextYear->isVisible() ) | 180 | if ( mNextYear->isVisible() ) |
181 | wid += mCurrentButtonMinWid; | 181 | wid += mCurrentButtonMinWid; |
182 | //qDebug("ret %d %d ", wid, mCurrentHei); | 182 | //qDebug("ret %d %d ", wid, mCurrentHei); |
183 | return QSize ( wid, mCurrentHei ); | 183 | return QSize ( wid, mCurrentHei ); |
184 | } | 184 | } |
185 | QSize NavigatorBar::sizeHintTwoButtons( int butNum ) const | 185 | QSize NavigatorBar::sizeHintTwoButtons( int butNum ) const |
186 | { | 186 | { |
187 | return QSize ( mCurrentMinWid + butNum * mCurrentButtonMinWid , mCurrentHei ); | 187 | return QSize ( mCurrentMinWid + butNum * mCurrentButtonMinWid , mCurrentHei ); |
188 | } | 188 | } |
189 | void NavigatorBar::resetFont ( QFont fo ) | 189 | void NavigatorBar::resetFont ( QFont fo ) |
190 | { | 190 | { |
191 | 191 | ||
192 | QFont tfont = fo; | 192 | QFont tfont = fo; |
193 | if ( QApplication::desktop()->width() >= 480 ) | 193 | if ( QApplication::desktop()->width() >= 480 ) |
194 | tfont.setPointSize(tfont.pointSize()+2); | 194 | tfont.setPointSize(tfont.pointSize()+2); |
195 | tfont.setBold(true); | 195 | tfont.setBold(true); |
196 | 196 | ||
197 | mSelectMonth->setFont( tfont ); | 197 | mSelectMonth->setFont( tfont ); |
198 | // Set minimum width to width of widest month name label | 198 | // Set minimum width to width of widest month name label |
199 | int i; | 199 | int i; |
200 | int maxwidth = 0; | 200 | int maxwidth = 0; |
201 | QFontMetrics fm ( mSelectMonth->font() ); | 201 | QFontMetrics fm ( mSelectMonth->font() ); |
202 | int width = fm.width("September '00" ); | 202 | int width = fm.width("September '00" ); |
203 | maxwidth = width+2; | 203 | maxwidth = width+2; |
204 | int size = fm.height()+2; | 204 | int size = fm.height()+2; |
205 | if ( QApplication::desktop()->width() >= 480 ) { | 205 | if ( QApplication::desktop()->width() >= 480 ) { |
206 | size += 6; | 206 | size += 6; |
207 | maxwidth+= 6; | 207 | maxwidth+= 6; |
208 | } | 208 | } |
209 | mSelectMonth->setMinimumWidth( maxwidth ); | 209 | mSelectMonth->setMinimumWidth( maxwidth ); |
210 | mSelectMonth->setFixedHeight( size ); | 210 | mSelectMonth->setFixedHeight( size ); |
211 | mPrevYear->setFixedHeight( size ); | 211 | mPrevYear->setFixedHeight( size ); |
212 | mPrevMonth->setFixedHeight( size ); | 212 | mPrevMonth->setFixedHeight( size ); |
213 | mPrevWeek->setFixedHeight( size ); | 213 | mPrevWeek->setFixedHeight( size ); |
214 | mNextMonth->setFixedHeight( size ); | 214 | mNextMonth->setFixedHeight( size ); |
215 | mNextWeek->setFixedHeight( size ); | 215 | mNextWeek->setFixedHeight( size ); |
216 | mNextYear->setFixedHeight ( size ); | 216 | mNextYear->setFixedHeight ( size ); |
217 | mCurrentHei = size +2; | 217 | mCurrentHei = size +2; |
218 | mCurrentMinWid = maxwidth+2; | 218 | mCurrentMinWid = maxwidth+2; |
219 | mCurrentButtonMinWid = mPrevYear->sizeHint().width()+2; | 219 | mCurrentButtonMinWid = mPrevYear->sizeHint().width(); |
220 | } | 220 | } |
221 | 221 | ||
222 | void NavigatorBar::showButtons( bool left, bool right ) | 222 | void NavigatorBar::showButtons( bool left, bool right ) |
223 | { | 223 | { |
224 | if ( left ) { | 224 | if ( left ) { |
225 | mPrevYear->show(); | 225 | mPrevYear->show(); |
226 | mPrevMonth->show(); | 226 | mPrevMonth->show(); |
227 | } else { | 227 | } else { |
228 | mPrevYear->hide(); | 228 | mPrevYear->hide(); |
229 | mPrevMonth->hide(); | 229 | mPrevMonth->hide(); |
230 | } | 230 | } |
231 | 231 | ||
232 | if ( right ) { | 232 | if ( right ) { |
233 | mNextYear->show(); | 233 | mNextYear->show(); |
234 | mNextMonth->show(); | 234 | mNextMonth->show(); |
235 | } else { | 235 | } else { |
236 | mNextYear->hide(); | 236 | mNextYear->hide(); |
237 | mNextMonth->hide(); | 237 | mNextMonth->hide(); |
238 | } | 238 | } |
239 | if ( !left && !right ) { | 239 | if ( !left && !right ) { |
240 | //mSelectMonth->setMaximumWidth( 1024 ); | 240 | //mSelectMonth->setMaximumWidth( 1024 ); |
241 | mSelectMonth->setSizePolicy( QSizePolicy ( QSizePolicy::Expanding ,QSizePolicy::Fixed ) ); | 241 | mSelectMonth->setSizePolicy( QSizePolicy ( QSizePolicy::Expanding ,QSizePolicy::Fixed ) ); |
242 | } | 242 | } |
243 | } | 243 | } |
244 | 244 | ||
245 | void NavigatorBar::selectMonth() | 245 | void NavigatorBar::selectMonth() |
246 | { | 246 | { |
247 | 247 | ||
248 | int month; | 248 | int month; |
249 | KPopupFrame* popup = new KPopupFrame(this); | 249 | KPopupFrame* popup = new KPopupFrame(this); |
250 | KDateInternalMonthPicker* picker = new KDateInternalMonthPicker(popup); | 250 | KDateInternalMonthPicker* picker = new KDateInternalMonthPicker(popup); |
251 | // ----- | 251 | // ----- |
252 | picker->resize(picker->sizeHint()); | 252 | picker->resize(picker->sizeHint()); |
253 | popup->setMainWidget(picker); | 253 | popup->setMainWidget(picker); |
254 | picker->setFocus(); | 254 | picker->setFocus(); |
255 | connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); | 255 | connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); |
256 | if(popup->exec(mSelectMonth->mapToGlobal(QPoint(0, mSelectMonth->height())))) | 256 | if(popup->exec(mSelectMonth->mapToGlobal(QPoint(0, mSelectMonth->height())))) |
257 | { | 257 | { |
258 | month = picker->getResult(); | 258 | month = picker->getResult(); |
259 | emit monthSelected ( month ); | 259 | emit monthSelected ( month ); |
260 | } else { | 260 | } else { |
261 | KNotifyClient::beep(); | 261 | KNotifyClient::beep(); |
262 | } | 262 | } |
263 | delete popup; | 263 | delete popup; |
264 | } | 264 | } |
265 | void NavigatorBar::selectDates( const KCal::DateList &dateList ) | 265 | void NavigatorBar::selectDates( const KCal::DateList &dateList ) |
266 | { | 266 | { |
267 | if (dateList.count() > 0) { | 267 | if (dateList.count() > 0) { |
268 | QDate date = dateList.first(); | 268 | QDate date = dateList.first(); |
269 | 269 | ||
270 | const KCalendarSystem *calSys = KOGlobals::self()->calendarSystem(); | 270 | const KCalendarSystem *calSys = KOGlobals::self()->calendarSystem(); |
271 | 271 | ||
272 | // compute the label at the top of the navigator | 272 | // compute the label at the top of the navigator |
273 | QString dtstr = i18n(calSys->monthName( date )) + " '" + | 273 | QString dtstr = i18n(calSys->monthName( date )) + " '" + |
274 | QString::number( calSys->year( date ) ).right(2); | 274 | QString::number( calSys->year( date ) ).right(2); |
275 | 275 | ||
276 | mSelectMonth->setText( dtstr ); | 276 | mSelectMonth->setText( dtstr ); |
277 | } | 277 | } |
278 | } | 278 | } |
279 | 279 | ||