-rw-r--r-- | korganizer/koagendaview.cpp | 8 | ||||
-rw-r--r-- | korganizer/koviewmanager.cpp | 6 | ||||
-rw-r--r-- | korganizer/koviewmanager.h | 2 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 53 | ||||
-rw-r--r-- | korganizer/mainwindow.h | 24 |
5 files changed, 52 insertions, 41 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index 05216a7..f54f7bc 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp | |||
@@ -1,1511 +1,1511 @@ | |||
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 | TimeLabels::TimeLabels(int rows,QWidget *parent,const char *name,WFlags f) : | 79 | TimeLabels::TimeLabels(int rows,QWidget *parent,const char *name,WFlags f) : |
80 | QScrollView(parent,name,f) | 80 | QScrollView(parent,name,f) |
81 | { | 81 | { |
82 | mRows = rows; | 82 | mRows = rows; |
83 | 83 | ||
84 | setMinimumHeight( 20 ); | 84 | setMinimumHeight( 20 ); |
85 | mCellHeight = KOPrefs::instance()->mHourSize*4; | 85 | mCellHeight = KOPrefs::instance()->mHourSize*4; |
86 | 86 | ||
87 | enableClipper(true); | 87 | enableClipper(true); |
88 | 88 | ||
89 | setHScrollBarMode(AlwaysOff); | 89 | setHScrollBarMode(AlwaysOff); |
90 | setVScrollBarMode(AlwaysOff); | 90 | setVScrollBarMode(AlwaysOff); |
91 | 91 | ||
92 | resizeContents(50,mRows * mCellHeight); | 92 | resizeContents(50,mRows * mCellHeight); |
93 | 93 | ||
94 | viewport()->setBackgroundMode( PaletteBackground ); | 94 | viewport()->setBackgroundMode( PaletteBackground ); |
95 | } | 95 | } |
96 | 96 | ||
97 | void TimeLabels::setCellHeight(int height) | 97 | void TimeLabels::setCellHeight(int height) |
98 | { | 98 | { |
99 | mCellHeight = height; | 99 | mCellHeight = height; |
100 | } | 100 | } |
101 | 101 | ||
102 | /* | 102 | /* |
103 | Optimization so that only the "dirty" portion of the scroll view | 103 | Optimization so that only the "dirty" portion of the scroll view |
104 | is redrawn. Unfortunately, this is not called by default paintEvent() method. | 104 | is redrawn. Unfortunately, this is not called by default paintEvent() method. |
105 | */ | 105 | */ |
106 | void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch) | 106 | void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch) |
107 | { | 107 | { |
108 | 108 | ||
109 | // if ( globalFlagBlockAgenda ) | 109 | // if ( globalFlagBlockAgenda ) |
110 | // return; | 110 | // return; |
111 | // bug: the parameters cx, cy, cw, ch are the areas that need to be | 111 | // bug: the parameters cx, cy, cw, ch are the areas that need to be |
112 | // redrawn, not the area of the widget. unfortunately, this | 112 | // redrawn, not the area of the widget. unfortunately, this |
113 | // code assumes the latter... | 113 | // code assumes the latter... |
114 | 114 | ||
115 | // now, for a workaround... | 115 | // now, for a workaround... |
116 | // these two assignments fix the weird redraw bug | 116 | // these two assignments fix the weird redraw bug |
117 | cx = contentsX() + 2; | 117 | cx = contentsX() + 2; |
118 | cw = contentsWidth() - 2; | 118 | cw = contentsWidth() - 2; |
119 | // end of workaround | 119 | // end of workaround |
120 | 120 | ||
121 | int cell = ((int)(cy/mCellHeight)); | 121 | int cell = ((int)(cy/mCellHeight)); |
122 | int y = cell * mCellHeight; | 122 | int y = cell * mCellHeight; |
123 | QFontMetrics fm = fontMetrics(); | 123 | QFontMetrics fm = fontMetrics(); |
124 | QString hour; | 124 | QString hour; |
125 | QString suffix; | 125 | QString suffix; |
126 | QString fullTime; | 126 | QString fullTime; |
127 | int tW = fm.width("24:00i"); | 127 | int tW = fm.width("24:00i"); |
128 | 128 | ||
129 | while (y < cy + ch) { | 129 | while (y < cy + ch) { |
130 | p->drawLine(cx,y,cx+tW,y); | 130 | p->drawLine(cx,y,cx+tW,y); |
131 | hour.setNum(cell); | 131 | hour.setNum(cell); |
132 | suffix = "am"; | 132 | suffix = "am"; |
133 | 133 | ||
134 | // handle 24h and am/pm time formats | 134 | // handle 24h and am/pm time formats |
135 | if (KGlobal::locale()->use12Clock()) { | 135 | if (KGlobal::locale()->use12Clock()) { |
136 | if (cell > 11) suffix = "pm"; | 136 | if (cell > 11) suffix = "pm"; |
137 | if (cell == 0) hour.setNum(12); | 137 | if (cell == 0) hour.setNum(12); |
138 | if (cell > 12) hour.setNum(cell - 12); | 138 | if (cell > 12) hour.setNum(cell - 12); |
139 | } else { | 139 | } else { |
140 | suffix = ":00"; | 140 | suffix = ":00"; |
141 | } | 141 | } |
142 | 142 | ||
143 | // create string in format of "XX:XX" or "XXpm/am" | 143 | // create string in format of "XX:XX" or "XXpm/am" |
144 | fullTime = hour + suffix; | 144 | fullTime = hour + suffix; |
145 | 145 | ||
146 | // center and draw the time label | 146 | // center and draw the time label |
147 | int timeWidth = fm.width(fullTime+"i"); | 147 | int timeWidth = fm.width(fullTime+"i"); |
148 | int offset = this->width() - timeWidth; | 148 | int offset = this->width() - timeWidth; |
149 | int borderWidth = 5; | 149 | int borderWidth = 5; |
150 | int timeHeight = fm.height(); | 150 | int timeHeight = fm.height(); |
151 | timeHeight = timeHeight + 2 - ( timeHeight / 4 ); | 151 | timeHeight = timeHeight + 2 - ( timeHeight / 4 ); |
152 | p->drawText(cx -borderWidth + offset, y+ timeHeight, fullTime); | 152 | p->drawText(cx -borderWidth + offset, y+ timeHeight, fullTime); |
153 | 153 | ||
154 | // increment indices | 154 | // increment indices |
155 | y += mCellHeight; | 155 | y += mCellHeight; |
156 | cell++; | 156 | cell++; |
157 | } | 157 | } |
158 | } | 158 | } |
159 | 159 | ||
160 | /** | 160 | /** |
161 | Calculates the minimum width. | 161 | Calculates the minimum width. |
162 | */ | 162 | */ |
163 | int TimeLabels::minimumWidth() const | 163 | int TimeLabels::minimumWidth() const |
164 | { | 164 | { |
165 | QFontMetrics fm = fontMetrics(); | 165 | QFontMetrics fm = fontMetrics(); |
166 | 166 | ||
167 | //TODO: calculate this value | 167 | //TODO: calculate this value |
168 | int borderWidth = 4; | 168 | int borderWidth = 4; |
169 | 169 | ||
170 | // the maximum width possible | 170 | // the maximum width possible |
171 | int width = fm.width("88:88x") + borderWidth; | 171 | int width = fm.width("88:88x") + borderWidth; |
172 | 172 | ||
173 | return width; | 173 | return width; |
174 | } | 174 | } |
175 | 175 | ||
176 | /** updates widget's internal state */ | 176 | /** updates widget's internal state */ |
177 | void TimeLabels::updateConfig() | 177 | void TimeLabels::updateConfig() |
178 | { | 178 | { |
179 | // set the font | 179 | // set the font |
180 | // config->setGroup("Fonts"); | 180 | // config->setGroup("Fonts"); |
181 | // QFont font = config->readFontEntry("TimeBar Font"); | 181 | // QFont font = config->readFontEntry("TimeBar Font"); |
182 | setFont(KOPrefs::instance()->mTimeBarFont); | 182 | setFont(KOPrefs::instance()->mTimeBarFont); |
183 | 183 | ||
184 | // update geometry restrictions based on new settings | 184 | // update geometry restrictions based on new settings |
185 | setFixedWidth(minimumWidth()); | 185 | setFixedWidth(minimumWidth()); |
186 | 186 | ||
187 | // update HourSize | 187 | // update HourSize |
188 | mCellHeight = KOPrefs::instance()->mHourSize*4; | 188 | mCellHeight = KOPrefs::instance()->mHourSize*4; |
189 | resizeContents(50,mRows * mCellHeight); | 189 | resizeContents(50,mRows * mCellHeight); |
190 | } | 190 | } |
191 | 191 | ||
192 | /** update time label positions */ | 192 | /** update time label positions */ |
193 | void TimeLabels::positionChanged() | 193 | void TimeLabels::positionChanged() |
194 | { | 194 | { |
195 | int adjustment = mAgenda->contentsY(); | 195 | int adjustment = mAgenda->contentsY(); |
196 | setContentsPos(0, adjustment); | 196 | setContentsPos(0, adjustment); |
197 | } | 197 | } |
198 | 198 | ||
199 | /** */ | 199 | /** */ |
200 | void TimeLabels::setAgenda(KOAgenda* agenda) | 200 | void TimeLabels::setAgenda(KOAgenda* agenda) |
201 | { | 201 | { |
202 | mAgenda = agenda; | 202 | mAgenda = agenda; |
203 | } | 203 | } |
204 | 204 | ||
205 | void TimeLabels::contentsMousePressEvent ( QMouseEvent * e) | 205 | void TimeLabels::contentsMousePressEvent ( QMouseEvent * e) |
206 | { | 206 | { |
207 | mMouseDownY = e->pos().y(); | 207 | mMouseDownY = e->pos().y(); |
208 | mOrgCap = topLevelWidget()->caption(); | 208 | mOrgCap = topLevelWidget()->caption(); |
209 | } | 209 | } |
210 | 210 | ||
211 | void TimeLabels::contentsMouseMoveEvent ( QMouseEvent * e ) | 211 | void TimeLabels::contentsMouseMoveEvent ( QMouseEvent * e ) |
212 | { | 212 | { |
213 | int diff = mMouseDownY - e->pos().y(); | 213 | int diff = mMouseDownY - e->pos().y(); |
214 | if ( diff < 10 && diff > -10 ) | 214 | if ( diff < 10 && diff > -10 ) |
215 | return; | 215 | return; |
216 | int tSize = KOPrefs::instance()->mHourSize + (diff/10) ; | 216 | int tSize = KOPrefs::instance()->mHourSize + (diff/10) ; |
217 | if ( tSize < 4 ) | 217 | if ( tSize < 4 ) |
218 | tSize = 4; | 218 | tSize = 4; |
219 | if ( tSize > 18 ) | 219 | if ( tSize > 22 ) |
220 | tSize = 18; | 220 | tSize = 22; |
221 | tSize = (tSize-2)/2; | 221 | tSize = (tSize-2)/2; |
222 | topLevelWidget()->setCaption(i18n("New Agendasize: %1").arg(tSize)); | 222 | topLevelWidget()->setCaption(i18n("New Agendasize: %1").arg(tSize)); |
223 | 223 | ||
224 | } | 224 | } |
225 | void TimeLabels::contentsMouseReleaseEvent ( QMouseEvent * e ) | 225 | void TimeLabels::contentsMouseReleaseEvent ( QMouseEvent * e ) |
226 | { | 226 | { |
227 | topLevelWidget()->setCaption( mOrgCap ); | 227 | topLevelWidget()->setCaption( mOrgCap ); |
228 | int diff = mMouseDownY - e->pos().y(); | 228 | int diff = mMouseDownY - e->pos().y(); |
229 | if ( diff < 10 && diff > -10 ) | 229 | if ( diff < 10 && diff > -10 ) |
230 | return; | 230 | return; |
231 | int tSize = KOPrefs::instance()->mHourSize + (diff/10); | 231 | int tSize = KOPrefs::instance()->mHourSize + (diff/10); |
232 | if ( tSize < 4 ) | 232 | if ( tSize < 4 ) |
233 | tSize = 4; | 233 | tSize = 4; |
234 | if ( tSize > 18 ) | 234 | if ( tSize > 22 ) |
235 | tSize = 18; | 235 | tSize = 22; |
236 | tSize = (tSize/2)*2; | 236 | tSize = (tSize/2)*2; |
237 | if ( tSize == KOPrefs::instance()->mHourSize ) | 237 | if ( tSize == KOPrefs::instance()->mHourSize ) |
238 | return; | 238 | return; |
239 | KOPrefs::instance()->mHourSize = tSize; | 239 | KOPrefs::instance()->mHourSize = tSize; |
240 | emit scaleChanged(); | 240 | emit scaleChanged(); |
241 | } | 241 | } |
242 | 242 | ||
243 | /** This is called in response to repaint() */ | 243 | /** This is called in response to repaint() */ |
244 | void TimeLabels::paintEvent(QPaintEvent*) | 244 | void TimeLabels::paintEvent(QPaintEvent*) |
245 | { | 245 | { |
246 | 246 | ||
247 | // kdDebug() << "paintevent..." << endl; | 247 | // kdDebug() << "paintevent..." << endl; |
248 | // this is another hack! | 248 | // this is another hack! |
249 | // QPainter painter(this); | 249 | // QPainter painter(this); |
250 | //QString c | 250 | //QString c |
251 | repaintContents(contentsX(), contentsY(), visibleWidth(), visibleHeight()); | 251 | repaintContents(contentsX(), contentsY(), visibleWidth(), visibleHeight()); |
252 | } | 252 | } |
253 | 253 | ||
254 | //////////////////////////////////////////////////////////////////////////// | 254 | //////////////////////////////////////////////////////////////////////////// |
255 | 255 | ||
256 | EventIndicator::EventIndicator(Location loc,QWidget *parent,const char *name) | 256 | EventIndicator::EventIndicator(Location loc,QWidget *parent,const char *name) |
257 | : QFrame(parent,name) | 257 | : QFrame(parent,name) |
258 | { | 258 | { |
259 | mColumns = 1; | 259 | mColumns = 1; |
260 | mTopBox = 0; | 260 | mTopBox = 0; |
261 | mLocation = loc; | 261 | mLocation = loc; |
262 | mTopLayout = 0; | 262 | mTopLayout = 0; |
263 | mPaintWidget = 0; | 263 | mPaintWidget = 0; |
264 | mXOffset = 0; | 264 | mXOffset = 0; |
265 | if (mLocation == Top) mPixmap = SmallIcon("1uparrow"); | 265 | if (mLocation == Top) mPixmap = SmallIcon("1uparrow"); |
266 | else mPixmap = SmallIcon("1downarrow"); | 266 | else mPixmap = SmallIcon("1downarrow"); |
267 | mEnabled.resize(mColumns); | 267 | mEnabled.resize(mColumns); |
268 | if (mLocation == Top) | 268 | if (mLocation == Top) |
269 | setMaximumHeight(0); | 269 | setMaximumHeight(0); |
270 | else | 270 | else |
271 | setMinimumHeight(mPixmap.height()); | 271 | setMinimumHeight(mPixmap.height()); |
272 | } | 272 | } |
273 | 273 | ||
274 | EventIndicator::~EventIndicator() | 274 | EventIndicator::~EventIndicator() |
275 | { | 275 | { |
276 | } | 276 | } |
277 | 277 | ||
278 | void EventIndicator::drawContents(QPainter *p) | 278 | void EventIndicator::drawContents(QPainter *p) |
279 | { | 279 | { |
280 | 280 | ||
281 | // kdDebug() << "======== top: " << contentsRect().top() << " bottom " << // contentsRect().bottom() << " left " << contentsRect().left() << " right " << contentsRect().right() << endl; | 281 | // kdDebug() << "======== top: " << contentsRect().top() << " bottom " << // contentsRect().bottom() << " left " << contentsRect().left() << " right " << contentsRect().right() << endl; |
282 | KDGanttSplitterHandle* han = 0; | 282 | KDGanttSplitterHandle* han = 0; |
283 | if ( mPaintWidget ) | 283 | if ( mPaintWidget ) |
284 | han = mPaintWidget->firstHandle(); | 284 | han = mPaintWidget->firstHandle(); |
285 | if ( ! han ) { | 285 | if ( ! han ) { |
286 | int i; | 286 | int i; |
287 | for(i=0;i<mColumns;++i) { | 287 | for(i=0;i<mColumns;++i) { |
288 | if (mEnabled[i]) { | 288 | if (mEnabled[i]) { |
289 | int cellWidth = contentsRect().right()/mColumns; | 289 | int cellWidth = contentsRect().right()/mColumns; |
290 | int xOffset = KOGlobals::self()->reverseLayout() ? | 290 | int xOffset = KOGlobals::self()->reverseLayout() ? |
291 | (mColumns - 1 - i)*cellWidth + cellWidth/2 -mPixmap.width()/2 : | 291 | (mColumns - 1 - i)*cellWidth + cellWidth/2 -mPixmap.width()/2 : |
292 | i*cellWidth + cellWidth/2 -mPixmap.width()/2; | 292 | i*cellWidth + cellWidth/2 -mPixmap.width()/2; |
293 | p->drawPixmap(QPoint(xOffset,0),mPixmap); | 293 | p->drawPixmap(QPoint(xOffset,0),mPixmap); |
294 | } | 294 | } |
295 | } | 295 | } |
296 | } else { | 296 | } else { |
297 | han->repaint(); | 297 | han->repaint(); |
298 | //mPaintWidget->setBackgroundColor( red ); | 298 | //mPaintWidget->setBackgroundColor( red ); |
299 | 299 | ||
300 | QPainter pa( han ); | 300 | QPainter pa( han ); |
301 | int i; | 301 | int i; |
302 | bool setColor = false; | 302 | bool setColor = false; |
303 | for(i=0;i<mColumns;++i) { | 303 | for(i=0;i<mColumns;++i) { |
304 | if (mEnabled[i]) { | 304 | if (mEnabled[i]) { |
305 | setColor = true; | 305 | setColor = true; |
306 | 306 | ||
307 | int cellWidth = contentsRect().right()/mColumns; | 307 | int cellWidth = contentsRect().right()/mColumns; |
308 | int xOffset = KOGlobals::self()->reverseLayout() ? | 308 | int xOffset = KOGlobals::self()->reverseLayout() ? |
309 | (mColumns - 1 - i)*cellWidth + cellWidth/2 -mPixmap.width()/2 : | 309 | (mColumns - 1 - i)*cellWidth + cellWidth/2 -mPixmap.width()/2 : |
310 | i*cellWidth + cellWidth/2 -mPixmap.width()/2; | 310 | i*cellWidth + cellWidth/2 -mPixmap.width()/2; |
311 | pa.drawPixmap(QPoint(mXOffset + xOffset,0),mPixmap); | 311 | pa.drawPixmap(QPoint(mXOffset + xOffset,0),mPixmap); |
312 | //qDebug("222draw pix %d ",xOffset ); | 312 | //qDebug("222draw pix %d ",xOffset ); |
313 | 313 | ||
314 | } | 314 | } |
315 | 315 | ||
316 | } | 316 | } |
317 | pa.end(); | 317 | pa.end(); |
318 | 318 | ||
319 | } | 319 | } |
320 | } | 320 | } |
321 | 321 | ||
322 | void EventIndicator::setXOffset( int x ) | 322 | void EventIndicator::setXOffset( int x ) |
323 | { | 323 | { |
324 | mXOffset = x; | 324 | mXOffset = x; |
325 | } | 325 | } |
326 | void EventIndicator::setPaintWidget( KDGanttMinimizeSplitter * w ) | 326 | void EventIndicator::setPaintWidget( KDGanttMinimizeSplitter * w ) |
327 | { | 327 | { |
328 | mPaintWidget = w; | 328 | mPaintWidget = w; |
329 | } | 329 | } |
330 | void EventIndicator::changeColumns(int columns) | 330 | void EventIndicator::changeColumns(int columns) |
331 | { | 331 | { |
332 | mColumns = columns; | 332 | mColumns = columns; |
333 | mEnabled.resize(mColumns); | 333 | mEnabled.resize(mColumns); |
334 | 334 | ||
335 | update(); | 335 | update(); |
336 | } | 336 | } |
337 | 337 | ||
338 | void EventIndicator::enableColumn(int column, bool enable) | 338 | void EventIndicator::enableColumn(int column, bool enable) |
339 | { | 339 | { |
340 | mEnabled[column] = enable; | 340 | mEnabled[column] = enable; |
341 | } | 341 | } |
342 | 342 | ||
343 | 343 | ||
344 | //////////////////////////////////////////////////////////////////////////// | 344 | //////////////////////////////////////////////////////////////////////////// |
345 | //////////////////////////////////////////////////////////////////////////// | 345 | //////////////////////////////////////////////////////////////////////////// |
346 | //////////////////////////////////////////////////////////////////////////// | 346 | //////////////////////////////////////////////////////////////////////////// |
347 | 347 | ||
348 | KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : | 348 | KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : |
349 | KOEventView (cal,parent,name) | 349 | KOEventView (cal,parent,name) |
350 | { | 350 | { |
351 | mBlockUpdating = true; | 351 | mBlockUpdating = true; |
352 | mStartHour = 8; | 352 | mStartHour = 8; |
353 | mSelectedDates.append(QDate::currentDate()); | 353 | mSelectedDates.append(QDate::currentDate()); |
354 | 354 | ||
355 | mLayoutDayLabels = 0; | 355 | mLayoutDayLabels = 0; |
356 | mDayLabelsFrame = 0; | 356 | mDayLabelsFrame = 0; |
357 | mDayLabels = 0; | 357 | mDayLabels = 0; |
358 | bool isRTL = KOGlobals::self()->reverseLayout(); | 358 | bool isRTL = KOGlobals::self()->reverseLayout(); |
359 | 359 | ||
360 | if ( KOPrefs::instance()->mVerticalScreen ) { | 360 | if ( KOPrefs::instance()->mVerticalScreen ) { |
361 | mExpandedPixmap = SmallIcon( "1downarrow" ); | 361 | mExpandedPixmap = SmallIcon( "1downarrow" ); |
362 | mNotExpandedPixmap = SmallIcon( "1uparrow" ); | 362 | mNotExpandedPixmap = SmallIcon( "1uparrow" ); |
363 | } else { | 363 | } else { |
364 | mExpandedPixmap = SmallIcon( isRTL ? "1leftarrow" : "1rightarrow" ); | 364 | mExpandedPixmap = SmallIcon( isRTL ? "1leftarrow" : "1rightarrow" ); |
365 | mNotExpandedPixmap = SmallIcon( isRTL ? "1rightarrow" : "1leftarrow" ); | 365 | mNotExpandedPixmap = SmallIcon( isRTL ? "1rightarrow" : "1leftarrow" ); |
366 | } | 366 | } |
367 | 367 | ||
368 | QBoxLayout *topLayout = new QVBoxLayout(this); | 368 | QBoxLayout *topLayout = new QVBoxLayout(this); |
369 | 369 | ||
370 | // Create day name labels for agenda columns | 370 | // Create day name labels for agenda columns |
371 | mDayLabelsFrame = new QHBox(this); | 371 | mDayLabelsFrame = new QHBox(this); |
372 | topLayout->addWidget(mDayLabelsFrame); | 372 | topLayout->addWidget(mDayLabelsFrame); |
373 | mDayLabels = new QFrame (mDayLabelsFrame); | 373 | mDayLabels = new QFrame (mDayLabelsFrame); |
374 | mLayoutDayLabels = new QHBoxLayout(mDayLabels); | 374 | mLayoutDayLabels = new QHBoxLayout(mDayLabels); |
375 | // Create agenda splitter | 375 | // Create agenda splitter |
376 | #ifndef KORG_NOSPLITTER | 376 | #ifndef KORG_NOSPLITTER |
377 | mSplitterAgenda = new QSplitter(Vertical,this); | 377 | mSplitterAgenda = new QSplitter(Vertical,this); |
378 | topLayout->addWidget(mSplitterAgenda); | 378 | topLayout->addWidget(mSplitterAgenda); |
379 | mSplitterAgenda->setOpaqueResize(); | 379 | mSplitterAgenda->setOpaqueResize(); |
380 | 380 | ||
381 | mAllDayFrame = new QHBox(mSplitterAgenda); | 381 | mAllDayFrame = new QHBox(mSplitterAgenda); |
382 | 382 | ||
383 | QWidget *agendaFrame = new QWidget(mSplitterAgenda); | 383 | QWidget *agendaFrame = new QWidget(mSplitterAgenda); |
384 | #else | 384 | #else |
385 | #if 0 | 385 | #if 0 |
386 | QWidget *mainBox = new QWidget( this ); | 386 | QWidget *mainBox = new QWidget( this ); |
387 | topLayout->addWidget( mainBox ); | 387 | topLayout->addWidget( mainBox ); |
388 | QBoxLayout *mainLayout = new QVBoxLayout(mainBox); | 388 | QBoxLayout *mainLayout = new QVBoxLayout(mainBox); |
389 | mAllDayFrame = new QHBox(mainBox); | 389 | mAllDayFrame = new QHBox(mainBox); |
390 | mainLayout->addWidget(mAllDayFrame); | 390 | mainLayout->addWidget(mAllDayFrame); |
391 | mainLayout->setStretchFactor( mAllDayFrame, 0 ); | 391 | mainLayout->setStretchFactor( mAllDayFrame, 0 ); |
392 | mAllDayFrame->setFocusPolicy(NoFocus); | 392 | mAllDayFrame->setFocusPolicy(NoFocus); |
393 | QWidget *agendaFrame = new QWidget(mainBox); | 393 | QWidget *agendaFrame = new QWidget(mainBox); |
394 | mainLayout->addWidget(agendaFrame); | 394 | mainLayout->addWidget(agendaFrame); |
395 | mainLayout->setStretchFactor( agendaFrame, 10 ); | 395 | mainLayout->setStretchFactor( agendaFrame, 10 ); |
396 | 396 | ||
397 | agendaFrame->setFocusPolicy(NoFocus); | 397 | agendaFrame->setFocusPolicy(NoFocus); |
398 | #endif | 398 | #endif |
399 | mSplitterAgenda = new KDGanttMinimizeSplitter( Qt::Vertical, this); | 399 | mSplitterAgenda = new KDGanttMinimizeSplitter( Qt::Vertical, this); |
400 | mSplitterAgenda->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); | 400 | mSplitterAgenda->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); |
401 | topLayout->addWidget( mSplitterAgenda ); | 401 | topLayout->addWidget( mSplitterAgenda ); |
402 | mAllDayFrame = new QHBox(mSplitterAgenda); | 402 | mAllDayFrame = new QHBox(mSplitterAgenda); |
403 | mAllDayFrame->setFocusPolicy(NoFocus); | 403 | mAllDayFrame->setFocusPolicy(NoFocus); |
404 | QWidget *agendaFrame = new QWidget(mSplitterAgenda); | 404 | QWidget *agendaFrame = new QWidget(mSplitterAgenda); |
405 | agendaFrame->setFocusPolicy(NoFocus); | 405 | agendaFrame->setFocusPolicy(NoFocus); |
406 | 406 | ||
407 | #endif | 407 | #endif |
408 | 408 | ||
409 | // Create all-day agenda widget | 409 | // Create all-day agenda widget |
410 | mDummyAllDayLeft = new QVBox( mAllDayFrame ); | 410 | mDummyAllDayLeft = new QVBox( mAllDayFrame ); |
411 | 411 | ||
412 | mExpandButton = new QPushButton(mDummyAllDayLeft); | 412 | mExpandButton = new QPushButton(mDummyAllDayLeft); |
413 | mExpandButton->setPixmap( mNotExpandedPixmap ); | 413 | mExpandButton->setPixmap( mNotExpandedPixmap ); |
414 | int widebut = mExpandButton->sizeHint().width(); | 414 | int widebut = mExpandButton->sizeHint().width(); |
415 | if ( QApplication::desktop()->width() < 480 ) | 415 | if ( QApplication::desktop()->width() < 480 ) |
416 | widebut = widebut*2; | 416 | widebut = widebut*2; |
417 | else | 417 | else |
418 | widebut = (widebut*3) / 2; | 418 | widebut = (widebut*3) / 2; |
419 | //mExpandButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, | 419 | //mExpandButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, |
420 | // QSizePolicy::Fixed ) ); | 420 | // QSizePolicy::Fixed ) ); |
421 | mExpandButton->setFixedSize( widebut, widebut); | 421 | mExpandButton->setFixedSize( widebut, widebut); |
422 | connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) ); | 422 | connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) ); |
423 | mExpandButton->setFocusPolicy(NoFocus); | 423 | mExpandButton->setFocusPolicy(NoFocus); |
424 | mAllDayAgenda = new KOAgenda(1,mAllDayFrame); | 424 | mAllDayAgenda = new KOAgenda(1,mAllDayFrame); |
425 | mAllDayAgenda->setFocusPolicy(NoFocus); | 425 | mAllDayAgenda->setFocusPolicy(NoFocus); |
426 | QWidget *dummyAllDayRight = new QWidget(mAllDayFrame); | 426 | QWidget *dummyAllDayRight = new QWidget(mAllDayFrame); |
427 | 427 | ||
428 | // Create event context menu for all day agenda | 428 | // Create event context menu for all day agenda |
429 | mAllDayAgendaPopup = eventPopup(); | 429 | mAllDayAgendaPopup = eventPopup(); |
430 | connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), | 430 | connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), |
431 | mAllDayAgendaPopup,SLOT(showIncidencePopup(Incidence *))); | 431 | mAllDayAgendaPopup,SLOT(showIncidencePopup(Incidence *))); |
432 | 432 | ||
433 | // Create agenda frame | 433 | // Create agenda frame |
434 | QGridLayout *agendaLayout = new QGridLayout(agendaFrame,3,3); | 434 | QGridLayout *agendaLayout = new QGridLayout(agendaFrame,3,3); |
435 | // QHBox *agendaFrame = new QHBox(splitterAgenda); | 435 | // QHBox *agendaFrame = new QHBox(splitterAgenda); |
436 | 436 | ||
437 | // create event indicator bars | 437 | // create event indicator bars |
438 | mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame); | 438 | mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame); |
439 | agendaLayout->addWidget(mEventIndicatorTop,0,1); | 439 | agendaLayout->addWidget(mEventIndicatorTop,0,1); |
440 | mEventIndicatorTop->setPaintWidget( mSplitterAgenda ); | 440 | mEventIndicatorTop->setPaintWidget( mSplitterAgenda ); |
441 | mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom, | 441 | mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom, |
442 | agendaFrame); | 442 | agendaFrame); |
443 | agendaLayout->addWidget(mEventIndicatorBottom,2,1); | 443 | agendaLayout->addWidget(mEventIndicatorBottom,2,1); |
444 | QWidget *dummyAgendaRight = new QWidget(agendaFrame); | 444 | QWidget *dummyAgendaRight = new QWidget(agendaFrame); |
445 | agendaLayout->addWidget(dummyAgendaRight,0,2); | 445 | agendaLayout->addWidget(dummyAgendaRight,0,2); |
446 | 446 | ||
447 | // Create time labels | 447 | // Create time labels |
448 | mTimeLabels = new TimeLabels(24,agendaFrame); | 448 | mTimeLabels = new TimeLabels(24,agendaFrame); |
449 | agendaLayout->addWidget(mTimeLabels,1,0); | 449 | agendaLayout->addWidget(mTimeLabels,1,0); |
450 | connect(mTimeLabels,SIGNAL( scaleChanged()), | 450 | connect(mTimeLabels,SIGNAL( scaleChanged()), |
451 | this,SLOT(updateConfig())); | 451 | this,SLOT(updateConfig())); |
452 | 452 | ||
453 | // Create agenda | 453 | // Create agenda |
454 | mAgenda = new KOAgenda(1,96,KOPrefs::instance()->mHourSize,agendaFrame); | 454 | mAgenda = new KOAgenda(1,96,KOPrefs::instance()->mHourSize,agendaFrame); |
455 | agendaLayout->addMultiCellWidget(mAgenda,1,1,1,2); | 455 | agendaLayout->addMultiCellWidget(mAgenda,1,1,1,2); |
456 | agendaLayout->setColStretch(1,1); | 456 | agendaLayout->setColStretch(1,1); |
457 | mAgenda->setFocusPolicy(NoFocus); | 457 | mAgenda->setFocusPolicy(NoFocus); |
458 | // Create event context menu for agenda | 458 | // Create event context menu for agenda |
459 | mAgendaPopup = eventPopup(); | 459 | mAgendaPopup = eventPopup(); |
460 | 460 | ||
461 | mAgendaPopup->addAdditionalItem(QIconSet(SmallIcon("bell")), | 461 | mAgendaPopup->addAdditionalItem(QIconSet(SmallIcon("bell")), |
462 | i18n("Toggle Alarm"),mAgenda, | 462 | i18n("Toggle Alarm"),mAgenda, |
463 | SLOT(popupAlarm()),true); | 463 | SLOT(popupAlarm()),true); |
464 | 464 | ||
465 | 465 | ||
466 | connect(mAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), | 466 | connect(mAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), |
467 | mAgendaPopup,SLOT(showIncidencePopup(Incidence *))); | 467 | mAgendaPopup,SLOT(showIncidencePopup(Incidence *))); |
468 | 468 | ||
469 | // make connections between dependent widgets | 469 | // make connections between dependent widgets |
470 | mTimeLabels->setAgenda(mAgenda); | 470 | mTimeLabels->setAgenda(mAgenda); |
471 | 471 | ||
472 | // Update widgets to reflect user preferences | 472 | // Update widgets to reflect user preferences |
473 | // updateConfig(); | 473 | // updateConfig(); |
474 | 474 | ||
475 | // createDayLabels(); | 475 | // createDayLabels(); |
476 | 476 | ||
477 | // these blank widgets make the All Day Event box line up with the agenda | 477 | // these blank widgets make the All Day Event box line up with the agenda |
478 | dummyAllDayRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); | 478 | dummyAllDayRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); |
479 | dummyAgendaRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); | 479 | dummyAgendaRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); |
480 | mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); | 480 | mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); |
481 | 481 | ||
482 | // Scrolling | 482 | // Scrolling |
483 | connect(mAgenda->verticalScrollBar(),SIGNAL(valueChanged(int)), | 483 | connect(mAgenda->verticalScrollBar(),SIGNAL(valueChanged(int)), |
484 | mTimeLabels, SLOT(positionChanged())); | 484 | mTimeLabels, SLOT(positionChanged())); |
485 | connect(mTimeLabels->verticalScrollBar(),SIGNAL(valueChanged(int)), | 485 | connect(mTimeLabels->verticalScrollBar(),SIGNAL(valueChanged(int)), |
486 | SLOT(setContentsPos(int))); | 486 | SLOT(setContentsPos(int))); |
487 | 487 | ||
488 | // Create/Show/Edit/Delete Event | 488 | // Create/Show/Edit/Delete Event |
489 | connect(mAgenda,SIGNAL(newEventSignal(int,int)), | 489 | connect(mAgenda,SIGNAL(newEventSignal(int,int)), |
490 | SLOT(newEvent(int,int))); | 490 | SLOT(newEvent(int,int))); |
491 | connect(mAgenda,SIGNAL(newEventSignal(int,int,int,int)), | 491 | connect(mAgenda,SIGNAL(newEventSignal(int,int,int,int)), |
492 | SLOT(newEvent(int,int,int,int))); | 492 | SLOT(newEvent(int,int,int,int))); |
493 | connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int)), | 493 | connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int)), |
494 | SLOT(newEventAllDay(int,int))); | 494 | SLOT(newEventAllDay(int,int))); |
495 | connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int,int,int)), | 495 | connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int,int,int)), |
496 | SLOT(newEventAllDay(int,int))); | 496 | SLOT(newEventAllDay(int,int))); |
497 | connect(mAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), | 497 | connect(mAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), |
498 | SLOT(newTimeSpanSelected(int,int,int,int))); | 498 | SLOT(newTimeSpanSelected(int,int,int,int))); |
499 | connect(mAllDayAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), | 499 | connect(mAllDayAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), |
500 | SLOT(newTimeSpanSelectedAllDay(int,int,int,int))); | 500 | SLOT(newTimeSpanSelectedAllDay(int,int,int,int))); |
501 | connect(mAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); | 501 | connect(mAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); |
502 | connect(mAllDayAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); | 502 | connect(mAllDayAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); |
503 | 503 | ||
504 | connect(mAgenda,SIGNAL(editIncidenceSignal(Incidence *)), | 504 | connect(mAgenda,SIGNAL(editIncidenceSignal(Incidence *)), |
505 | SIGNAL(editIncidenceSignal(Incidence *))); | 505 | SIGNAL(editIncidenceSignal(Incidence *))); |
506 | connect(mAllDayAgenda,SIGNAL(editIncidenceSignal(Incidence *)), | 506 | connect(mAllDayAgenda,SIGNAL(editIncidenceSignal(Incidence *)), |
507 | SIGNAL(editIncidenceSignal(Incidence *))); | 507 | SIGNAL(editIncidenceSignal(Incidence *))); |
508 | connect(mAgenda,SIGNAL(showIncidenceSignal(Incidence *)), | 508 | connect(mAgenda,SIGNAL(showIncidenceSignal(Incidence *)), |
509 | SIGNAL(showIncidenceSignal(Incidence *))); | 509 | SIGNAL(showIncidenceSignal(Incidence *))); |
510 | connect(mAllDayAgenda,SIGNAL(showIncidenceSignal(Incidence *)), | 510 | connect(mAllDayAgenda,SIGNAL(showIncidenceSignal(Incidence *)), |
511 | SIGNAL(showIncidenceSignal(Incidence *))); | 511 | SIGNAL(showIncidenceSignal(Incidence *))); |
512 | connect(mAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), | 512 | connect(mAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), |
513 | SIGNAL(deleteIncidenceSignal(Incidence *))); | 513 | SIGNAL(deleteIncidenceSignal(Incidence *))); |
514 | connect(mAllDayAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), | 514 | connect(mAllDayAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), |
515 | SIGNAL(deleteIncidenceSignal(Incidence *))); | 515 | SIGNAL(deleteIncidenceSignal(Incidence *))); |
516 | 516 | ||
517 | connect(mAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), | 517 | connect(mAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), |
518 | SLOT(updateEventDates(KOAgendaItem *, int ))); | 518 | SLOT(updateEventDates(KOAgendaItem *, int ))); |
519 | connect(mAllDayAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), | 519 | connect(mAllDayAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), |
520 | SLOT(updateEventDates(KOAgendaItem *, int))); | 520 | SLOT(updateEventDates(KOAgendaItem *, int))); |
521 | 521 | ||
522 | // event indicator update | 522 | // event indicator update |
523 | connect(mAgenda,SIGNAL(lowerYChanged(int)), | 523 | connect(mAgenda,SIGNAL(lowerYChanged(int)), |
524 | SLOT(updateEventIndicatorTop(int))); | 524 | SLOT(updateEventIndicatorTop(int))); |
525 | connect(mAgenda,SIGNAL(upperYChanged(int)), | 525 | connect(mAgenda,SIGNAL(upperYChanged(int)), |
526 | SLOT(updateEventIndicatorBottom(int))); | 526 | SLOT(updateEventIndicatorBottom(int))); |
527 | // drag signals | 527 | // drag signals |
528 | /* | 528 | /* |
529 | connect(mAgenda,SIGNAL(startDragSignal(Event *)), | 529 | connect(mAgenda,SIGNAL(startDragSignal(Event *)), |
530 | SLOT(startDrag(Event *))); | 530 | SLOT(startDrag(Event *))); |
531 | connect(mAllDayAgenda,SIGNAL(startDragSignal(Event *)), | 531 | connect(mAllDayAgenda,SIGNAL(startDragSignal(Event *)), |
532 | SLOT(startDrag(Event *))); | 532 | SLOT(startDrag(Event *))); |
533 | */ | 533 | */ |
534 | // synchronize selections | 534 | // synchronize selections |
535 | connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 535 | connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
536 | mAllDayAgenda, SLOT( deselectItem() ) ); | 536 | mAllDayAgenda, SLOT( deselectItem() ) ); |
537 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 537 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
538 | mAgenda, SLOT( deselectItem() ) ); | 538 | mAgenda, SLOT( deselectItem() ) ); |
539 | connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 539 | connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
540 | SIGNAL( incidenceSelected( Incidence * ) ) ); | 540 | SIGNAL( incidenceSelected( Incidence * ) ) ); |
541 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 541 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
542 | SIGNAL( incidenceSelected( Incidence * ) ) ); | 542 | SIGNAL( incidenceSelected( Incidence * ) ) ); |
543 | connect( mAgenda, SIGNAL( resizedSignal() ), | 543 | connect( mAgenda, SIGNAL( resizedSignal() ), |
544 | SLOT( updateConfig( ) ) ); | 544 | SLOT( updateConfig( ) ) ); |
545 | connect( mAgenda, SIGNAL( addToCalSignal(Incidence *, Incidence *) ), | 545 | connect( mAgenda, SIGNAL( addToCalSignal(Incidence *, Incidence *) ), |
546 | SLOT( addToCalSlot(Incidence *, Incidence * ) ) ); | 546 | SLOT( addToCalSlot(Incidence *, Incidence * ) ) ); |
547 | connect( mAllDayAgenda, SIGNAL( addToCalSignal(Incidence * ,Incidence *) ), | 547 | connect( mAllDayAgenda, SIGNAL( addToCalSignal(Incidence * ,Incidence *) ), |
548 | SLOT( addToCalSlot(Incidence * , Incidence *) ) ); | 548 | SLOT( addToCalSlot(Incidence * , Incidence *) ) ); |
549 | // connect( mAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); | 549 | // connect( mAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); |
550 | //connect( mAllDayAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); | 550 | //connect( mAllDayAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); |
551 | 551 | ||
552 | 552 | ||
553 | } | 553 | } |
554 | 554 | ||
555 | void KOAgendaView::toggleAllDay() | 555 | void KOAgendaView::toggleAllDay() |
556 | { | 556 | { |
557 | if ( mSplitterAgenda->firstHandle() ) | 557 | if ( mSplitterAgenda->firstHandle() ) |
558 | mSplitterAgenda->firstHandle()->toggle(); | 558 | mSplitterAgenda->firstHandle()->toggle(); |
559 | } | 559 | } |
560 | void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld ) | 560 | void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld ) |
561 | { | 561 | { |
562 | calendar()->addIncidence( inc ); | 562 | calendar()->addIncidence( inc ); |
563 | 563 | ||
564 | if ( incOld ) { | 564 | if ( incOld ) { |
565 | if ( incOld->type() == "Todo" ) | 565 | if ( incOld->type() == "Todo" ) |
566 | emit todoMoved((Todo*)incOld, KOGlobals::EVENTEDITED ); | 566 | emit todoMoved((Todo*)incOld, KOGlobals::EVENTEDITED ); |
567 | else | 567 | else |
568 | emit incidenceChanged(incOld, KOGlobals::EVENTEDITED); | 568 | emit incidenceChanged(incOld, KOGlobals::EVENTEDITED); |
569 | } | 569 | } |
570 | 570 | ||
571 | } | 571 | } |
572 | 572 | ||
573 | KOAgendaView::~KOAgendaView() | 573 | KOAgendaView::~KOAgendaView() |
574 | { | 574 | { |
575 | delete mAgendaPopup; | 575 | delete mAgendaPopup; |
576 | delete mAllDayAgendaPopup; | 576 | delete mAllDayAgendaPopup; |
577 | delete KOAgendaItem::paintPix(); | 577 | delete KOAgendaItem::paintPix(); |
578 | delete KOAgendaItem::paintPixSel(); | 578 | delete KOAgendaItem::paintPixSel(); |
579 | } | 579 | } |
580 | void KOAgendaView::resizeEvent( QResizeEvent* e ) | 580 | void KOAgendaView::resizeEvent( QResizeEvent* e ) |
581 | { | 581 | { |
582 | //qDebug("KOAgendaView::resizeEvent( QResizeEvent* e ) %d ", e->size().width()); | 582 | //qDebug("KOAgendaView::resizeEvent( QResizeEvent* e ) %d ", e->size().width()); |
583 | bool uc = false; | 583 | bool uc = false; |
584 | int ow = e->oldSize().width(); | 584 | int ow = e->oldSize().width(); |
585 | int oh = e->oldSize().height(); | 585 | int oh = e->oldSize().height(); |
586 | int w = e->size().width(); | 586 | int w = e->size().width(); |
587 | int h = e->size().height(); | 587 | int h = e->size().height(); |
588 | if ( (ow > oh && w< h ) || (ow < oh && w > h ) ) { | 588 | if ( (ow > oh && w< h ) || (ow < oh && w > h ) ) { |
589 | if ( ! mBlockUpdating && !globalFlagBlockStartup && !globalFlagBlockAgenda ) | 589 | if ( ! mBlockUpdating && !globalFlagBlockStartup && !globalFlagBlockAgenda ) |
590 | uc = true; | 590 | uc = true; |
591 | //qDebug("view changed %d %d %d %d ", ow, oh , w , h); | 591 | //qDebug("view changed %d %d %d %d ", ow, oh , w , h); |
592 | } | 592 | } |
593 | mUpcomingWidth = e->size().width() ; | 593 | mUpcomingWidth = e->size().width() ; |
594 | if ( mBlockUpdating || uc ) { | 594 | if ( mBlockUpdating || uc ) { |
595 | mBlockUpdating = false; | 595 | mBlockUpdating = false; |
596 | //mAgenda->setMinimumSize(800 , 600 ); | 596 | //mAgenda->setMinimumSize(800 , 600 ); |
597 | //qDebug("mAgenda->resize+++++++++++++++ "); | 597 | //qDebug("mAgenda->resize+++++++++++++++ "); |
598 | updateConfig(); | 598 | updateConfig(); |
599 | //qDebug("KOAgendaView::Updating now possible "); | 599 | //qDebug("KOAgendaView::Updating now possible "); |
600 | } else | 600 | } else |
601 | createDayLabels(); | 601 | createDayLabels(); |
602 | //qDebug("resizeEvent end "); | 602 | //qDebug("resizeEvent end "); |
603 | 603 | ||
604 | } | 604 | } |
605 | void KOAgendaView::createDayLabels() | 605 | void KOAgendaView::createDayLabels() |
606 | { | 606 | { |
607 | 607 | ||
608 | if ( mBlockUpdating || globalFlagBlockLabel == 1) { | 608 | if ( mBlockUpdating || globalFlagBlockLabel == 1) { |
609 | // qDebug(" KOAgendaView::createDayLabels() blocked "); | 609 | // qDebug(" KOAgendaView::createDayLabels() blocked "); |
610 | return; | 610 | return; |
611 | 611 | ||
612 | } | 612 | } |
613 | int newHight; | 613 | int newHight; |
614 | 614 | ||
615 | // ### Before deleting and recreating we could check if mSelectedDates changed... | 615 | // ### Before deleting and recreating we could check if mSelectedDates changed... |
616 | // It would remove some flickering and gain speed (since this is called by | 616 | // It would remove some flickering and gain speed (since this is called by |
617 | // each updateView() call) | 617 | // each updateView() call) |
618 | 618 | ||
619 | int maxWid = mUpcomingWidth - mTimeLabels->width()- mAgenda->verticalScrollBar()->width() - 2; | 619 | int maxWid = mUpcomingWidth - mTimeLabels->width()- mAgenda->verticalScrollBar()->width() - 2; |
620 | mDayLabelsFrame->setMaximumWidth( mUpcomingWidth ); | 620 | mDayLabelsFrame->setMaximumWidth( mUpcomingWidth ); |
621 | if ( maxWid < 0 ) | 621 | if ( maxWid < 0 ) |
622 | maxWid = 20; | 622 | maxWid = 20; |
623 | 623 | ||
624 | QFont dlf = KOPrefs::instance()->mTimeLabelsFont; | 624 | QFont dlf = KOPrefs::instance()->mTimeLabelsFont; |
625 | QFontMetrics fm ( dlf ); | 625 | QFontMetrics fm ( dlf ); |
626 | int selCount = mSelectedDates.count(); | 626 | int selCount = mSelectedDates.count(); |
627 | QString dayTest = "Mon 20"; | 627 | QString dayTest = "Mon 20"; |
628 | int wid = fm.width( dayTest ); | 628 | int wid = fm.width( dayTest ); |
629 | maxWid -= ( selCount * 3 ); | 629 | maxWid -= ( selCount * 3 ); |
630 | if ( maxWid < 0 ) | 630 | if ( maxWid < 0 ) |
631 | maxWid = 20; | 631 | maxWid = 20; |
632 | int needWid = wid * selCount; | 632 | int needWid = wid * selCount; |
633 | //qDebug("++++++++Needed : %d MaxWidth: %d", needWid, maxWid ); | 633 | //qDebug("++++++++Needed : %d MaxWidth: %d", needWid, maxWid ); |
634 | //if ( needWid > maxWid ) | 634 | //if ( needWid > maxWid ) |
635 | // qDebug("DAYLABELS TOOOOOOO BIG "); | 635 | // qDebug("DAYLABELS TOOOOOOO BIG "); |
636 | while ( needWid > maxWid ) { | 636 | while ( needWid > maxWid ) { |
637 | dayTest = dayTest.left( dayTest.length() - 1 ); | 637 | dayTest = dayTest.left( dayTest.length() - 1 ); |
638 | wid = fm.width( dayTest ); | 638 | wid = fm.width( dayTest ); |
639 | needWid = wid * selCount; | 639 | needWid = wid * selCount; |
640 | } | 640 | } |
641 | int maxLen = dayTest.length(); | 641 | int maxLen = dayTest.length(); |
642 | int fontPoint = dlf.pointSize(); | 642 | int fontPoint = dlf.pointSize(); |
643 | if ( maxLen < 2 ) { | 643 | if ( maxLen < 2 ) { |
644 | int fontPoint = dlf.pointSize(); | 644 | int fontPoint = dlf.pointSize(); |
645 | while ( fontPoint > 4 ) { | 645 | while ( fontPoint > 4 ) { |
646 | --fontPoint; | 646 | --fontPoint; |
647 | dlf.setPointSize( fontPoint ); | 647 | dlf.setPointSize( fontPoint ); |
648 | QFontMetrics f( dlf ); | 648 | QFontMetrics f( dlf ); |
649 | wid = f.width( "20" ); | 649 | wid = f.width( "20" ); |
650 | needWid = wid * selCount; | 650 | needWid = wid * selCount; |
651 | if ( needWid < maxWid ) | 651 | if ( needWid < maxWid ) |
652 | break; | 652 | break; |
653 | } | 653 | } |
654 | maxLen = 2; | 654 | maxLen = 2; |
655 | } | 655 | } |
656 | //qDebug("Max len %d ", dayTest.length() ); | 656 | //qDebug("Max len %d ", dayTest.length() ); |
657 | 657 | ||
658 | QFontMetrics tempF( dlf ); | 658 | QFontMetrics tempF( dlf ); |
659 | newHight = tempF.height(); | 659 | newHight = tempF.height(); |
660 | mDayLabels->setFont( dlf ); | 660 | mDayLabels->setFont( dlf ); |
661 | // mLayoutDayLabels = new QHBoxLayout(mDayLabels);; | 661 | // mLayoutDayLabels = new QHBoxLayout(mDayLabels);; |
662 | // mLayoutDayLabels->addSpacing(mTimeLabels->width()); | 662 | // mLayoutDayLabels->addSpacing(mTimeLabels->width()); |
663 | //mLayoutDayLabels->addSpacing( 2 ); | 663 | //mLayoutDayLabels->addSpacing( 2 ); |
664 | // QFont lFont = dlf; | 664 | // QFont lFont = dlf; |
665 | bool appendLabels = false; | 665 | bool appendLabels = false; |
666 | QLabel *dayLabel; | 666 | QLabel *dayLabel; |
667 | dayLabel = mDayLabelsList.first(); | 667 | dayLabel = mDayLabelsList.first(); |
668 | if ( !dayLabel ) { | 668 | if ( !dayLabel ) { |
669 | appendLabels = true; | 669 | appendLabels = true; |
670 | dayLabel = new QLabel(mDayLabels); | 670 | dayLabel = new QLabel(mDayLabels); |
671 | mDayLabelsList.append( dayLabel ); | 671 | mDayLabelsList.append( dayLabel ); |
672 | mLayoutDayLabels->addWidget(dayLabel); | 672 | mLayoutDayLabels->addWidget(dayLabel); |
673 | } | 673 | } |
674 | dayLabel->setFixedWidth( mTimeLabels->width()+2 ); | 674 | dayLabel->setFixedWidth( mTimeLabels->width()+2 ); |
675 | dayLabel->setFont( dlf ); | 675 | dayLabel->setFont( dlf ); |
676 | dayLabel->setAlignment(QLabel::AlignHCenter); | 676 | dayLabel->setAlignment(QLabel::AlignHCenter); |
677 | dayLabel->setText( KOGlobals::self()->calendarSystem()->monthName( mSelectedDates.first(), true ) ); | 677 | dayLabel->setText( KOGlobals::self()->calendarSystem()->monthName( mSelectedDates.first(), true ) ); |
678 | dayLabel->show(); | 678 | dayLabel->show(); |
679 | DateList::ConstIterator dit; | 679 | DateList::ConstIterator dit; |
680 | bool oneday = (mSelectedDates.first() == mSelectedDates.last() ); | 680 | bool oneday = (mSelectedDates.first() == mSelectedDates.last() ); |
681 | for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) { | 681 | for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) { |
682 | QDate date = *dit; | 682 | QDate date = *dit; |
683 | // QBoxLayout *dayLayout = new QVBoxLayout(mLayoutDayLabels); | 683 | // QBoxLayout *dayLayout = new QVBoxLayout(mLayoutDayLabels); |
684 | if ( ! appendLabels ) { | 684 | if ( ! appendLabels ) { |
685 | dayLabel = mDayLabelsList.next(); | 685 | dayLabel = mDayLabelsList.next(); |
686 | if ( !dayLabel ) | 686 | if ( !dayLabel ) |
687 | appendLabels = true; | 687 | appendLabels = true; |
688 | } | 688 | } |
689 | if ( appendLabels ) { | 689 | if ( appendLabels ) { |
690 | dayLabel = new QLabel(mDayLabels); | 690 | dayLabel = new QLabel(mDayLabels); |
691 | mDayLabelsList.append( dayLabel ); | 691 | mDayLabelsList.append( dayLabel ); |
692 | mLayoutDayLabels->addWidget(dayLabel); | 692 | mLayoutDayLabels->addWidget(dayLabel); |
693 | } | 693 | } |
694 | dayLabel->setMinimumWidth( 1 ); | 694 | dayLabel->setMinimumWidth( 1 ); |
695 | dayLabel->setMaximumWidth( 2048 ); | 695 | dayLabel->setMaximumWidth( 2048 ); |
696 | dayLabel->setFont( dlf ); | 696 | dayLabel->setFont( dlf ); |
697 | dayLabel->show(); | 697 | dayLabel->show(); |
698 | QString str; | 698 | QString str; |
699 | int dW = KOGlobals::self()->calendarSystem()->dayOfWeek(date); | 699 | int dW = KOGlobals::self()->calendarSystem()->dayOfWeek(date); |
700 | QString dayName = KOGlobals::self()->calendarSystem()->weekDayName( dW, true ); | 700 | QString dayName = KOGlobals::self()->calendarSystem()->weekDayName( dW, true ); |
701 | switch ( maxLen ) { | 701 | switch ( maxLen ) { |
702 | case 2: | 702 | case 2: |
703 | str = QString::number( date.day() ); | 703 | str = QString::number( date.day() ); |
704 | break; | 704 | break; |
705 | 705 | ||
706 | case 3: | 706 | case 3: |
707 | str = dayName.left( 1 ) +QString::number( date.day()); | 707 | str = dayName.left( 1 ) +QString::number( date.day()); |
708 | 708 | ||
709 | break; | 709 | break; |
710 | case 4: | 710 | case 4: |
711 | str = dayName.left( 1 ) + " " +QString::number( date.day()); | 711 | str = dayName.left( 1 ) + " " +QString::number( date.day()); |
712 | 712 | ||
713 | break; | 713 | break; |
714 | case 5: | 714 | case 5: |
715 | str = dayName.left( 2 ) + " " +QString::number( date.day()); | 715 | str = dayName.left( 2 ) + " " +QString::number( date.day()); |
716 | 716 | ||
717 | break; | 717 | break; |
718 | case 6: | 718 | case 6: |
719 | str = dayName.left( 3 ) + " " +QString::number( date.day()); | 719 | str = dayName.left( 3 ) + " " +QString::number( date.day()); |
720 | break; | 720 | break; |
721 | 721 | ||
722 | default: | 722 | default: |
723 | break; | 723 | break; |
724 | } | 724 | } |
725 | if ( oneday ) { | 725 | if ( oneday ) { |
726 | QString addString; | 726 | QString addString; |
727 | if ( mSelectedDates.first() == QDateTime::currentDateTime().date() ) | 727 | if ( mSelectedDates.first() == QDateTime::currentDateTime().date() ) |
728 | addString = i18n("Today"); | 728 | addString = i18n("Today"); |
729 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(1) ) | 729 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(1) ) |
730 | addString = i18n("Tomorrow"); | 730 | addString = i18n("Tomorrow"); |
731 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(-1) ) | 731 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(-1) ) |
732 | addString = i18n("Yesterday"); | 732 | addString = i18n("Yesterday"); |
733 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(-2) ) | 733 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(-2) ) |
734 | addString = i18n("Day before yesterday"); | 734 | addString = i18n("Day before yesterday"); |
735 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(2) ) | 735 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(2) ) |
736 | addString = i18n("Day after tomorrow"); | 736 | addString = i18n("Day after tomorrow"); |
737 | if ( !addString.isEmpty() ) { | 737 | if ( !addString.isEmpty() ) { |
738 | str = addString+", " + str; | 738 | str = addString+", " + str; |
739 | } | 739 | } |
740 | } | 740 | } |
741 | dayLabel->setText(str); | 741 | dayLabel->setText(str); |
742 | dayLabel->setAlignment(QLabel::AlignHCenter); | 742 | dayLabel->setAlignment(QLabel::AlignHCenter); |
743 | if (date == QDate::currentDate()) { | 743 | if (date == QDate::currentDate()) { |
744 | QFont bFont = dlf; | 744 | QFont bFont = dlf; |
745 | bFont.setBold( true ); | 745 | bFont.setBold( true ); |
746 | dayLabel->setFont(bFont); | 746 | dayLabel->setFont(bFont); |
747 | } | 747 | } |
748 | //dayLayout->addWidget(dayLabel); | 748 | //dayLayout->addWidget(dayLabel); |
749 | 749 | ||
750 | #ifndef KORG_NOPLUGINS | 750 | #ifndef KORG_NOPLUGINS |
751 | CalendarDecoration::List cds = KOCore::self()->calendarDecorations(); | 751 | CalendarDecoration::List cds = KOCore::self()->calendarDecorations(); |
752 | CalendarDecoration *it; | 752 | CalendarDecoration *it; |
753 | for(it = cds.first(); it; it = cds.next()) { | 753 | for(it = cds.first(); it; it = cds.next()) { |
754 | QString text = it->shortText( date ); | 754 | QString text = it->shortText( date ); |
755 | if ( !text.isEmpty() ) { | 755 | if ( !text.isEmpty() ) { |
756 | QLabel *label = new QLabel(text,mDayLabels); | 756 | QLabel *label = new QLabel(text,mDayLabels); |
757 | label->setAlignment(AlignCenter); | 757 | label->setAlignment(AlignCenter); |
758 | dayLayout->addWidget(label); | 758 | dayLayout->addWidget(label); |
759 | } | 759 | } |
760 | } | 760 | } |
761 | 761 | ||
762 | for(it = cds.first(); it; it = cds.next()) { | 762 | for(it = cds.first(); it; it = cds.next()) { |
763 | QWidget *wid = it->smallWidget(mDayLabels,date); | 763 | QWidget *wid = it->smallWidget(mDayLabels,date); |
764 | if ( wid ) { | 764 | if ( wid ) { |
765 | // wid->setHeight(20); | 765 | // wid->setHeight(20); |
766 | dayLayout->addWidget(wid); | 766 | dayLayout->addWidget(wid); |
767 | } | 767 | } |
768 | } | 768 | } |
769 | #endif | 769 | #endif |
770 | } | 770 | } |
771 | if ( ! appendLabels ) { | 771 | if ( ! appendLabels ) { |
772 | dayLabel = mDayLabelsList.next(); | 772 | dayLabel = mDayLabelsList.next(); |
773 | if ( !dayLabel ) | 773 | if ( !dayLabel ) |
774 | appendLabels = true; | 774 | appendLabels = true; |
775 | } | 775 | } |
776 | if ( appendLabels ) { | 776 | if ( appendLabels ) { |
777 | dayLabel = new QLabel(mDayLabels); | 777 | dayLabel = new QLabel(mDayLabels); |
778 | mDayLabelsList.append( dayLabel ); | 778 | mDayLabelsList.append( dayLabel ); |
779 | mLayoutDayLabels->addWidget(dayLabel); | 779 | mLayoutDayLabels->addWidget(dayLabel); |
780 | } | 780 | } |
781 | //dayLabel->hide();//test only | 781 | //dayLabel->hide();//test only |
782 | 782 | ||
783 | int offset = (mAgenda->width() - mAgenda->verticalScrollBar()->width()-3 ) % mSelectedDates.count() ; | 783 | int offset = (mAgenda->width() - mAgenda->verticalScrollBar()->width()-3 ) % mSelectedDates.count() ; |
784 | if ( offset < 0 ) offset = 0; | 784 | if ( offset < 0 ) offset = 0; |
785 | //qDebug("mLayoutDayLabels->addSpacing %d ", mAgenda->verticalScrollBar()->width()+offset+2 ); | 785 | //qDebug("mLayoutDayLabels->addSpacing %d ", mAgenda->verticalScrollBar()->width()+offset+2 ); |
786 | dayLabel->setText("");//QString::number ( mSelectedDates.first().month() ) ); | 786 | dayLabel->setText("");//QString::number ( mSelectedDates.first().month() ) ); |
787 | dayLabel->show(); | 787 | dayLabel->show(); |
788 | dayLabel->setFixedWidth( mAgenda->verticalScrollBar()->width()+ offset ); | 788 | dayLabel->setFixedWidth( mAgenda->verticalScrollBar()->width()+ offset ); |
789 | //qDebug("setToFixed %d ", mAgenda->verticalScrollBar()->width()+ offset+2); | 789 | //qDebug("setToFixed %d ", mAgenda->verticalScrollBar()->width()+ offset+2); |
790 | //mLayoutDayLabels->addSpacing(mAgenda->verticalScrollBar()->width()+ offset+2); | 790 | //mLayoutDayLabels->addSpacing(mAgenda->verticalScrollBar()->width()+ offset+2); |
791 | if ( !appendLabels ) { | 791 | if ( !appendLabels ) { |
792 | dayLabel = mDayLabelsList.next(); | 792 | dayLabel = mDayLabelsList.next(); |
793 | while ( dayLabel ) { | 793 | while ( dayLabel ) { |
794 | //qDebug("!dayLabel %d",dayLabel ); | 794 | //qDebug("!dayLabel %d",dayLabel ); |
795 | dayLabel->hide(); | 795 | dayLabel->hide(); |
796 | dayLabel = mDayLabelsList.next(); | 796 | dayLabel = mDayLabelsList.next(); |
797 | } | 797 | } |
798 | } | 798 | } |
799 | //mDayLabelsFrame->show(); | 799 | //mDayLabelsFrame->show(); |
800 | //mDayLabels->show(); | 800 | //mDayLabels->show(); |
801 | //qDebug("heigt %d %d %d ",mDayLabelsFrame->height(), mDayLabelsFrame->sizeHint().height(), newHight); | 801 | //qDebug("heigt %d %d %d ",mDayLabelsFrame->height(), mDayLabelsFrame->sizeHint().height(), newHight); |
802 | //mDayLabelsFrame->resize( mAgenda->visibleWidth(), newHight ); | 802 | //mDayLabelsFrame->resize( mAgenda->visibleWidth(), newHight ); |
803 | mDayLabelsFrame->setFixedHeight( newHight ); | 803 | mDayLabelsFrame->setFixedHeight( newHight ); |
804 | } | 804 | } |
805 | 805 | ||
806 | int KOAgendaView::maxDatesHint() | 806 | int KOAgendaView::maxDatesHint() |
807 | { | 807 | { |
808 | // Not sure about the max number of events, so return 0 for now. | 808 | // Not sure about the max number of events, so return 0 for now. |
809 | return 0; | 809 | return 0; |
810 | } | 810 | } |
811 | 811 | ||
812 | int KOAgendaView::currentDateCount() | 812 | int KOAgendaView::currentDateCount() |
813 | { | 813 | { |
814 | return mSelectedDates.count(); | 814 | return mSelectedDates.count(); |
815 | } | 815 | } |
816 | 816 | ||
817 | QPtrList<Incidence> KOAgendaView::selectedIncidences() | 817 | QPtrList<Incidence> KOAgendaView::selectedIncidences() |
818 | { | 818 | { |
819 | QPtrList<Incidence> selected; | 819 | QPtrList<Incidence> selected; |
820 | Incidence *incidence; | 820 | Incidence *incidence; |
821 | 821 | ||
822 | incidence = mAgenda->selectedIncidence(); | 822 | incidence = mAgenda->selectedIncidence(); |
823 | if (incidence) selected.append(incidence); | 823 | if (incidence) selected.append(incidence); |
824 | 824 | ||
825 | incidence = mAllDayAgenda->selectedIncidence(); | 825 | incidence = mAllDayAgenda->selectedIncidence(); |
826 | if (incidence) selected.append(incidence); | 826 | if (incidence) selected.append(incidence); |
827 | 827 | ||
828 | return selected; | 828 | return selected; |
829 | } | 829 | } |
830 | 830 | ||
831 | DateList KOAgendaView::selectedDates() | 831 | DateList KOAgendaView::selectedDates() |
832 | { | 832 | { |
833 | DateList selected; | 833 | DateList selected; |
834 | QDate qd; | 834 | QDate qd; |
835 | 835 | ||
836 | qd = mAgenda->selectedIncidenceDate(); | 836 | qd = mAgenda->selectedIncidenceDate(); |
837 | if (qd.isValid()) selected.append(qd); | 837 | if (qd.isValid()) selected.append(qd); |
838 | 838 | ||
839 | qd = mAllDayAgenda->selectedIncidenceDate(); | 839 | qd = mAllDayAgenda->selectedIncidenceDate(); |
840 | if (qd.isValid()) selected.append(qd); | 840 | if (qd.isValid()) selected.append(qd); |
841 | 841 | ||
842 | return selected; | 842 | return selected; |
843 | } | 843 | } |
844 | 844 | ||
845 | 845 | ||
846 | void KOAgendaView::updateView() | 846 | void KOAgendaView::updateView() |
847 | { | 847 | { |
848 | if ( mBlockUpdating ) | 848 | if ( mBlockUpdating ) |
849 | return; | 849 | return; |
850 | // kdDebug() << "KOAgendaView::updateView()" << endl; | 850 | // kdDebug() << "KOAgendaView::updateView()" << endl; |
851 | fillAgenda(); | 851 | fillAgenda(); |
852 | 852 | ||
853 | } | 853 | } |
854 | 854 | ||
855 | 855 | ||
856 | /* | 856 | /* |
857 | Update configuration settings for the agenda view. This method is not | 857 | Update configuration settings for the agenda view. This method is not |
858 | complete. | 858 | complete. |
859 | */ | 859 | */ |
860 | void KOAgendaView::updateConfig() | 860 | void KOAgendaView::updateConfig() |
861 | { | 861 | { |
862 | if ( mBlockUpdating ) | 862 | if ( mBlockUpdating ) |
863 | return; | 863 | return; |
864 | // kdDebug() << "KOAgendaView::updateConfig()" << endl; | 864 | // kdDebug() << "KOAgendaView::updateConfig()" << endl; |
865 | 865 | ||
866 | // update config for children | 866 | // update config for children |
867 | mTimeLabels->updateConfig(); | 867 | mTimeLabels->updateConfig(); |
868 | mAgenda->storePosition(); | 868 | mAgenda->storePosition(); |
869 | mAgenda->updateConfig(); | 869 | mAgenda->updateConfig(); |
870 | mAllDayAgenda->updateConfig(); | 870 | mAllDayAgenda->updateConfig(); |
871 | // widget synchronization | 871 | // widget synchronization |
872 | //TODO: find a better way, maybe signal/slot | 872 | //TODO: find a better way, maybe signal/slot |
873 | mTimeLabels->positionChanged(); | 873 | mTimeLabels->positionChanged(); |
874 | 874 | ||
875 | // for some reason, this needs to be called explicitly | 875 | // for some reason, this needs to be called explicitly |
876 | mTimeLabels->repaint(); | 876 | mTimeLabels->repaint(); |
877 | 877 | ||
878 | mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); | 878 | mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); |
879 | 879 | ||
880 | // ToolTips displaying summary of events | 880 | // ToolTips displaying summary of events |
881 | KOAgendaItem::toolTipGroup()->setEnabled(KOPrefs::instance() | 881 | KOAgendaItem::toolTipGroup()->setEnabled(KOPrefs::instance() |
882 | ->mEnableToolTips); | 882 | ->mEnableToolTips); |
883 | 883 | ||
884 | //setHolidayMasks(); | 884 | //setHolidayMasks(); |
885 | 885 | ||
886 | //createDayLabels(); called by via updateView(); | 886 | //createDayLabels(); called by via updateView(); |
887 | mEventIndicatorTop->setXOffset(mTimeLabels->width() + mAgenda->frameWidth()); | 887 | mEventIndicatorTop->setXOffset(mTimeLabels->width() + mAgenda->frameWidth()); |
888 | updateView(); | 888 | updateView(); |
889 | mAgenda->restorePosition(); | 889 | mAgenda->restorePosition(); |
890 | } | 890 | } |
891 | 891 | ||
892 | 892 | ||
893 | void KOAgendaView::updateEventDates(KOAgendaItem *item, int type) | 893 | void KOAgendaView::updateEventDates(KOAgendaItem *item, int type) |
894 | { | 894 | { |
895 | // kdDebug() << "KOAgendaView::updateEventDates(): " << item->text() << endl; | 895 | // kdDebug() << "KOAgendaView::updateEventDates(): " << item->text() << endl; |
896 | //qDebug("KOAgendaView::updateEventDates "); | 896 | //qDebug("KOAgendaView::updateEventDates "); |
897 | QDateTime startDt,endDt; | 897 | QDateTime startDt,endDt; |
898 | QDate startDate; | 898 | QDate startDate; |
899 | int lenInSecs; | 899 | int lenInSecs; |
900 | // if ( type == KOAgenda::RESIZETOP ) | 900 | // if ( type == KOAgenda::RESIZETOP ) |
901 | // qDebug("RESIZETOP "); | 901 | // qDebug("RESIZETOP "); |
902 | // if ( type == KOAgenda::RESIZEBOTTOM ) | 902 | // if ( type == KOAgenda::RESIZEBOTTOM ) |
903 | // qDebug("RESIZEBOTTOM "); | 903 | // qDebug("RESIZEBOTTOM "); |
904 | // if ( type == KOAgenda::MOVE ) | 904 | // if ( type == KOAgenda::MOVE ) |
905 | // qDebug("MOVE "); | 905 | // qDebug("MOVE "); |
906 | if ( item->incidence()->type() == "Event" ) { | 906 | if ( item->incidence()->type() == "Event" ) { |
907 | startDt =item->incidence()->dtStart(); | 907 | startDt =item->incidence()->dtStart(); |
908 | endDt = item->incidence()->dtEnd(); | 908 | endDt = item->incidence()->dtEnd(); |
909 | lenInSecs = startDt.secsTo( endDt ); | 909 | lenInSecs = startDt.secsTo( endDt ); |
910 | } | 910 | } |
911 | 911 | ||
912 | // emit incidenceItemChanged( item->incidence(), KOGlobals::EVENTEDITED ); | 912 | // emit incidenceItemChanged( item->incidence(), KOGlobals::EVENTEDITED ); |
913 | 913 | ||
914 | if ( item->incidence()->type()=="Todo" && item->mLastMoveXPos > 0 ) { | 914 | if ( item->incidence()->type()=="Todo" && item->mLastMoveXPos > 0 ) { |
915 | startDate = mSelectedDates[item->mLastMoveXPos]; | 915 | startDate = mSelectedDates[item->mLastMoveXPos]; |
916 | } else { | 916 | } else { |
917 | if (item->cellX() < 0) { | 917 | if (item->cellX() < 0) { |
918 | startDate = (mSelectedDates.first()).addDays(item->cellX()); | 918 | startDate = (mSelectedDates.first()).addDays(item->cellX()); |
919 | } else { | 919 | } else { |
920 | startDate = mSelectedDates[item->cellX()]; | 920 | startDate = mSelectedDates[item->cellX()]; |
921 | } | 921 | } |
922 | } | 922 | } |
923 | startDt.setDate(startDate); | 923 | startDt.setDate(startDate); |
924 | 924 | ||
925 | if (item->incidence()->doesFloat()) { | 925 | if (item->incidence()->doesFloat()) { |
926 | endDt.setDate(startDate.addDays(item->cellWidth() - 1)); | 926 | endDt.setDate(startDate.addDays(item->cellWidth() - 1)); |
927 | } else { | 927 | } else { |
928 | if ( type == KOAgenda::RESIZETOP || type == KOAgenda::MOVE ) | 928 | if ( type == KOAgenda::RESIZETOP || type == KOAgenda::MOVE ) |
929 | startDt.setTime(mAgenda->gyToTime(item->cellYTop())); | 929 | startDt.setTime(mAgenda->gyToTime(item->cellYTop())); |
930 | if ( item->incidence()->type() == "Event" ) { | 930 | if ( item->incidence()->type() == "Event" ) { |
931 | if ( type == KOAgenda::MOVE ) { | 931 | if ( type == KOAgenda::MOVE ) { |
932 | endDt = startDt.addSecs(lenInSecs); | 932 | endDt = startDt.addSecs(lenInSecs); |
933 | 933 | ||
934 | } else if ( type == KOAgenda::RESIZEBOTTOM ) { | 934 | } else if ( type == KOAgenda::RESIZEBOTTOM ) { |
935 | if (item->lastMultiItem()) { | 935 | if (item->lastMultiItem()) { |
936 | endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1)); | 936 | endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1)); |
937 | endDt.setDate(startDate. | 937 | endDt.setDate(startDate. |
938 | addDays(item->lastMultiItem()->cellX() - item->cellX())); | 938 | addDays(item->lastMultiItem()->cellX() - item->cellX())); |
939 | } else { | 939 | } else { |
940 | endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); | 940 | endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); |
941 | endDt.setDate(startDate); | 941 | endDt.setDate(startDate); |
942 | } | 942 | } |
943 | } | 943 | } |
944 | } else { | 944 | } else { |
945 | // todo | 945 | // todo |
946 | if (item->lastMultiItem()) { | 946 | if (item->lastMultiItem()) { |
947 | endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1)); | 947 | endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1)); |
948 | endDt.setDate(startDate. | 948 | endDt.setDate(startDate. |
949 | addDays(item->lastMultiItem()->cellX() - item->cellX())); | 949 | addDays(item->lastMultiItem()->cellX() - item->cellX())); |
950 | } else { | 950 | } else { |
951 | //qDebug("tem->cellYBottom() %d",item->cellYBottom() ); | 951 | //qDebug("tem->cellYBottom() %d",item->cellYBottom() ); |
952 | if ( item->cellYBottom() > 0 ) | 952 | if ( item->cellYBottom() > 0 ) |
953 | endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); | 953 | endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); |
954 | else | 954 | else |
955 | endDt.setTime((static_cast<Todo*>(item->incidence()))->dtDue().time()); | 955 | endDt.setTime((static_cast<Todo*>(item->incidence()))->dtDue().time()); |
956 | endDt.setDate(startDate); | 956 | endDt.setDate(startDate); |
957 | } | 957 | } |
958 | } | 958 | } |
959 | } | 959 | } |
960 | 960 | ||
961 | 961 | ||
962 | if ( item->incidence()->type() == "Event" ) { | 962 | if ( item->incidence()->type() == "Event" ) { |
963 | item->incidence()->setDtStart(startDt); | 963 | item->incidence()->setDtStart(startDt); |
964 | (static_cast<Event*>(item->incidence()))->setDtEnd(endDt); | 964 | (static_cast<Event*>(item->incidence()))->setDtEnd(endDt); |
965 | } else if ( item->incidence()->type() == "Todo" ) { | 965 | } else if ( item->incidence()->type() == "Todo" ) { |
966 | (static_cast<Todo*>(item->incidence()))->setDtDue(endDt); | 966 | (static_cast<Todo*>(item->incidence()))->setDtDue(endDt); |
967 | } | 967 | } |
968 | //qDebug("KOAgendaView::updateEventDates stsart %s end %s ", startDt.toString().latin1(), endDt.toString().latin1() ); | 968 | //qDebug("KOAgendaView::updateEventDates stsart %s end %s ", startDt.toString().latin1(), endDt.toString().latin1() ); |
969 | item->incidence()->setRevision(item->incidence()->revision()+1); | 969 | item->incidence()->setRevision(item->incidence()->revision()+1); |
970 | item->setItemDate(startDt.date()); | 970 | item->setItemDate(startDt.date()); |
971 | //item->updateItem(); | 971 | //item->updateItem(); |
972 | if ( item->incidence()->type() == "Todo" ) { | 972 | if ( item->incidence()->type() == "Todo" ) { |
973 | emit todoMoved((Todo*)item->incidence(), KOGlobals::EVENTEDITED ); | 973 | emit todoMoved((Todo*)item->incidence(), KOGlobals::EVENTEDITED ); |
974 | 974 | ||
975 | } | 975 | } |
976 | else | 976 | else |
977 | emit incidenceChanged(item->incidence(), KOGlobals::EVENTEDITED); | 977 | emit incidenceChanged(item->incidence(), KOGlobals::EVENTEDITED); |
978 | item->updateItem(); | 978 | item->updateItem(); |
979 | } | 979 | } |
980 | 980 | ||
981 | void KOAgendaView::showDates( const QDate &start, const QDate &end ) | 981 | void KOAgendaView::showDates( const QDate &start, const QDate &end ) |
982 | { | 982 | { |
983 | // kdDebug() << "KOAgendaView::selectDates" << endl; | 983 | // kdDebug() << "KOAgendaView::selectDates" << endl; |
984 | 984 | ||
985 | mSelectedDates.clear(); | 985 | mSelectedDates.clear(); |
986 | // qDebug("KOAgendaView::showDates "); | 986 | // qDebug("KOAgendaView::showDates "); |
987 | QDate d = start; | 987 | QDate d = start; |
988 | while (d <= end) { | 988 | while (d <= end) { |
989 | mSelectedDates.append(d); | 989 | mSelectedDates.append(d); |
990 | d = d.addDays( 1 ); | 990 | d = d.addDays( 1 ); |
991 | } | 991 | } |
992 | 992 | ||
993 | // and update the view | 993 | // and update the view |
994 | fillAgenda(); | 994 | fillAgenda(); |
995 | } | 995 | } |
996 | 996 | ||
997 | 997 | ||
998 | void KOAgendaView::showEvents(QPtrList<Event>) | 998 | void KOAgendaView::showEvents(QPtrList<Event>) |
999 | { | 999 | { |
1000 | kdDebug() << "KOAgendaView::showEvents() is not yet implemented" << endl; | 1000 | kdDebug() << "KOAgendaView::showEvents() is not yet implemented" << endl; |
1001 | } | 1001 | } |
1002 | 1002 | ||
1003 | void KOAgendaView::changeEventDisplay(Event *, int) | 1003 | void KOAgendaView::changeEventDisplay(Event *, int) |
1004 | { | 1004 | { |
1005 | // qDebug("KOAgendaView::changeEventDisplay "); | 1005 | // qDebug("KOAgendaView::changeEventDisplay "); |
1006 | // kdDebug() << "KOAgendaView::changeEventDisplay" << endl; | 1006 | // kdDebug() << "KOAgendaView::changeEventDisplay" << endl; |
1007 | // this should be re-written to be MUCH smarter. Right now we | 1007 | // this should be re-written to be MUCH smarter. Right now we |
1008 | // are just playing dumb. | 1008 | // are just playing dumb. |
1009 | fillAgenda(); | 1009 | fillAgenda(); |
1010 | } | 1010 | } |
1011 | 1011 | ||
1012 | void KOAgendaView::fillAgenda(const QDate &) | 1012 | void KOAgendaView::fillAgenda(const QDate &) |
1013 | { | 1013 | { |
1014 | // qDebug("KOAgendaView::fillAgenda "); | 1014 | // qDebug("KOAgendaView::fillAgenda "); |
1015 | fillAgenda(); | 1015 | fillAgenda(); |
1016 | } | 1016 | } |
1017 | 1017 | ||
1018 | void KOAgendaView::fillAgenda() | 1018 | void KOAgendaView::fillAgenda() |
1019 | { | 1019 | { |
1020 | if ( globalFlagBlockStartup ) | 1020 | if ( globalFlagBlockStartup ) |
1021 | return; | 1021 | return; |
1022 | if ( globalFlagBlockAgenda == 1 ) | 1022 | if ( globalFlagBlockAgenda == 1 ) |
1023 | return; | 1023 | return; |
1024 | //if ( globalFlagBlockAgenda == 2 ) | 1024 | //if ( globalFlagBlockAgenda == 2 ) |
1025 | //globalFlagBlockAgenda = 0; | 1025 | //globalFlagBlockAgenda = 0; |
1026 | // globalFlagBlockPainting = false; | 1026 | // globalFlagBlockPainting = false; |
1027 | if ( globalFlagBlockAgenda == 0 ) | 1027 | if ( globalFlagBlockAgenda == 0 ) |
1028 | globalFlagBlockAgenda = 1; | 1028 | globalFlagBlockAgenda = 1; |
1029 | // clearView(); | 1029 | // clearView(); |
1030 | //qDebug("fillAgenda()++++ "); | 1030 | //qDebug("fillAgenda()++++ "); |
1031 | globalFlagBlockAgendaItemPaint = 1; | 1031 | globalFlagBlockAgendaItemPaint = 1; |
1032 | mAllDayAgenda->changeColumns(mSelectedDates.count()); | 1032 | mAllDayAgenda->changeColumns(mSelectedDates.count()); |
1033 | mAgenda->changeColumns(mSelectedDates.count()); | 1033 | mAgenda->changeColumns(mSelectedDates.count()); |
1034 | qApp->processEvents(); | 1034 | qApp->processEvents(); |
1035 | mEventIndicatorTop->changeColumns(mSelectedDates.count()); | 1035 | mEventIndicatorTop->changeColumns(mSelectedDates.count()); |
1036 | mEventIndicatorBottom->changeColumns(mSelectedDates.count()); | 1036 | mEventIndicatorBottom->changeColumns(mSelectedDates.count()); |
1037 | setHolidayMasks(); | 1037 | setHolidayMasks(); |
1038 | 1038 | ||
1039 | //mAgenda->hideUnused(); | 1039 | //mAgenda->hideUnused(); |
1040 | //mAllDayAgenda->hideUnused(); | 1040 | //mAllDayAgenda->hideUnused(); |
1041 | 1041 | ||
1042 | // mAgenda->blockNextRepaint( false ); | 1042 | // mAgenda->blockNextRepaint( false ); |
1043 | // mAgenda->viewport()->repaint(); | 1043 | // mAgenda->viewport()->repaint(); |
1044 | // mAgenda->blockNextRepaint( true ); | 1044 | // mAgenda->blockNextRepaint( true ); |
1045 | mMinY.resize(mSelectedDates.count()); | 1045 | mMinY.resize(mSelectedDates.count()); |
1046 | mMaxY.resize(mSelectedDates.count()); | 1046 | mMaxY.resize(mSelectedDates.count()); |
1047 | 1047 | ||
1048 | QPtrList<Event> dayEvents; | 1048 | QPtrList<Event> dayEvents; |
1049 | 1049 | ||
1050 | // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. | 1050 | // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. |
1051 | // Therefore, get all of them. | 1051 | // Therefore, get all of them. |
1052 | QPtrList<Todo> todos = calendar()->todos(); | 1052 | QPtrList<Todo> todos = calendar()->todos(); |
1053 | 1053 | ||
1054 | mAgenda->setDateList(mSelectedDates); | 1054 | mAgenda->setDateList(mSelectedDates); |
1055 | 1055 | ||
1056 | QDate today = QDate::currentDate(); | 1056 | QDate today = QDate::currentDate(); |
1057 | 1057 | ||
1058 | DateList::ConstIterator dit; | 1058 | DateList::ConstIterator dit; |
1059 | int curCol = 0; | 1059 | int curCol = 0; |
1060 | for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) { | 1060 | for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) { |
1061 | QDate currentDate = *dit; | 1061 | QDate currentDate = *dit; |
1062 | // kdDebug() << "KOAgendaView::fillAgenda(): " << currentDate.toString() | 1062 | // kdDebug() << "KOAgendaView::fillAgenda(): " << currentDate.toString() |
1063 | // << endl; | 1063 | // << endl; |
1064 | 1064 | ||
1065 | dayEvents = calendar()->events(currentDate,true); | 1065 | dayEvents = calendar()->events(currentDate,true); |
1066 | 1066 | ||
1067 | // Default values, which can never be reached | 1067 | // Default values, which can never be reached |
1068 | mMinY[curCol] = mAgenda->timeToY(QTime(23,59)) + 1; | 1068 | mMinY[curCol] = mAgenda->timeToY(QTime(23,59)) + 1; |
1069 | mMaxY[curCol] = mAgenda->timeToY(QTime(0,0)) - 1; | 1069 | mMaxY[curCol] = mAgenda->timeToY(QTime(0,0)) - 1; |
1070 | 1070 | ||
1071 | unsigned int numEvent; | 1071 | unsigned int numEvent; |
1072 | for(numEvent=0;numEvent<dayEvents.count();++numEvent) { | 1072 | for(numEvent=0;numEvent<dayEvents.count();++numEvent) { |
1073 | Event *event = dayEvents.at(numEvent); | 1073 | Event *event = dayEvents.at(numEvent); |
1074 | if ( !KOPrefs::instance()->mShowSyncEvents && event->uid().left(2) == QString("la") ) | 1074 | if ( !KOPrefs::instance()->mShowSyncEvents && event->uid().left(2) == QString("la") ) |
1075 | if ( event->uid().left(15) == QString("last-syncEvent-") ) | 1075 | if ( event->uid().left(15) == QString("last-syncEvent-") ) |
1076 | continue; | 1076 | continue; |
1077 | // kdDebug() << " Event: " << event->summary() << endl; | 1077 | // kdDebug() << " Event: " << event->summary() << endl; |
1078 | 1078 | ||
1079 | int beginX = currentDate.daysTo(event->dtStart().date()) + curCol; | 1079 | int beginX = currentDate.daysTo(event->dtStart().date()) + curCol; |
1080 | int endX = currentDate.daysTo(event->dtEnd().date()) + curCol; | 1080 | int endX = currentDate.daysTo(event->dtEnd().date()) + curCol; |
1081 | 1081 | ||
1082 | // kdDebug() << " beginX: " << beginX << " endX: " << endX << endl; | 1082 | // kdDebug() << " beginX: " << beginX << " endX: " << endX << endl; |
1083 | 1083 | ||
1084 | if (event->doesFloat()) { | 1084 | if (event->doesFloat()) { |
1085 | if (event->recurrence()->doesRecur()) { | 1085 | if (event->recurrence()->doesRecur()) { |
1086 | mAllDayAgenda->insertAllDayItem(event,currentDate,curCol,curCol); | 1086 | mAllDayAgenda->insertAllDayItem(event,currentDate,curCol,curCol); |
1087 | } else { | 1087 | } else { |
1088 | if (beginX <= 0 && curCol == 0) { | 1088 | if (beginX <= 0 && curCol == 0) { |
1089 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); | 1089 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); |
1090 | } else if (beginX == curCol) { | 1090 | } else if (beginX == curCol) { |
1091 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); | 1091 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); |
1092 | } | 1092 | } |
1093 | } | 1093 | } |
1094 | } else if (event->isMultiDay()) { | 1094 | } else if (event->isMultiDay()) { |
1095 | if ( event->doesRecur () ) { | 1095 | if ( event->doesRecur () ) { |
1096 | QDate dateit = currentDate; | 1096 | QDate dateit = currentDate; |
1097 | int count = 0; | 1097 | int count = 0; |
1098 | int max = event->dtStart().daysTo( event->dtEnd() ) +2; | 1098 | int max = event->dtStart().daysTo( event->dtEnd() ) +2; |
1099 | while (! event->recursOn( dateit ) && count <= max ) { | 1099 | while (! event->recursOn( dateit ) && count <= max ) { |
1100 | ++count; | 1100 | ++count; |
1101 | dateit = dateit.addDays( -1 ); | 1101 | dateit = dateit.addDays( -1 ); |
1102 | } | 1102 | } |
1103 | bool ok; | 1103 | bool ok; |
1104 | QDateTime nextOcstart = event->getNextOccurence( QDateTime(dateit) ,&ok ); | 1104 | QDateTime nextOcstart = event->getNextOccurence( QDateTime(dateit) ,&ok ); |
1105 | if ( ok ) | 1105 | if ( ok ) |
1106 | { | 1106 | { |
1107 | int secs = event->dtStart().secsTo( event->dtEnd() ); | 1107 | int secs = event->dtStart().secsTo( event->dtEnd() ); |
1108 | QDateTime nextOcend =nextOcstart.addSecs( secs ); ; | 1108 | QDateTime nextOcend =nextOcstart.addSecs( secs ); ; |
1109 | beginX = currentDate.daysTo(nextOcstart.date()) + curCol; | 1109 | beginX = currentDate.daysTo(nextOcstart.date()) + curCol; |
1110 | endX = currentDate.daysTo(nextOcend.date()) + curCol; | 1110 | endX = currentDate.daysTo(nextOcend.date()) + curCol; |
1111 | 1111 | ||
1112 | } | 1112 | } |
1113 | } | 1113 | } |
1114 | int startY = mAgenda->timeToY(event->dtStart().time()); | 1114 | int startY = mAgenda->timeToY(event->dtStart().time()); |
1115 | int endY = mAgenda->timeToY(event->dtEnd().time()) - 1; | 1115 | int endY = mAgenda->timeToY(event->dtEnd().time()) - 1; |
1116 | //qDebug("insert %d %d %d %d %d ",beginX,endX,startY,endY , curCol ); | 1116 | //qDebug("insert %d %d %d %d %d ",beginX,endX,startY,endY , curCol ); |
1117 | if ((beginX <= 0 && curCol == 0) || beginX == curCol) { | 1117 | if ((beginX <= 0 && curCol == 0) || beginX == curCol) { |
1118 | //qDebug("insert!!! "); | 1118 | //qDebug("insert!!! "); |
1119 | mAgenda->insertMultiItem(event,currentDate,beginX,endX,startY,endY); | 1119 | mAgenda->insertMultiItem(event,currentDate,beginX,endX,startY,endY); |
1120 | } | 1120 | } |
1121 | if (beginX == curCol) { | 1121 | if (beginX == curCol) { |
1122 | mMaxY[curCol] = mAgenda->timeToY(QTime(23,59)); | 1122 | mMaxY[curCol] = mAgenda->timeToY(QTime(23,59)); |
1123 | if (startY < mMinY[curCol]) mMinY[curCol] = startY; | 1123 | if (startY < mMinY[curCol]) mMinY[curCol] = startY; |
1124 | } else if (endX == curCol) { | 1124 | } else if (endX == curCol) { |
1125 | mMinY[curCol] = mAgenda->timeToY(QTime(0,0)); | 1125 | mMinY[curCol] = mAgenda->timeToY(QTime(0,0)); |
1126 | if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; | 1126 | if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; |
1127 | } else { | 1127 | } else { |
1128 | mMinY[curCol] = mAgenda->timeToY(QTime(0,0)); | 1128 | mMinY[curCol] = mAgenda->timeToY(QTime(0,0)); |
1129 | mMaxY[curCol] = mAgenda->timeToY(QTime(23,59)); | 1129 | mMaxY[curCol] = mAgenda->timeToY(QTime(23,59)); |
1130 | } | 1130 | } |
1131 | } else { | 1131 | } else { |
1132 | int startY = mAgenda->timeToY(event->dtStart().time()); | 1132 | int startY = mAgenda->timeToY(event->dtStart().time()); |
1133 | int endY = mAgenda->timeToY(event->dtEnd().time()) - 1; | 1133 | int endY = mAgenda->timeToY(event->dtEnd().time()) - 1; |
1134 | if (endY < startY) endY = startY; | 1134 | if (endY < startY) endY = startY; |
1135 | mAgenda->insertItem(event,currentDate,curCol,startY,endY); | 1135 | mAgenda->insertItem(event,currentDate,curCol,startY,endY); |
1136 | if (startY < mMinY[curCol]) mMinY[curCol] = startY; | 1136 | if (startY < mMinY[curCol]) mMinY[curCol] = startY; |
1137 | if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; | 1137 | if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; |
1138 | } | 1138 | } |
1139 | } | 1139 | } |
1140 | // ---------- [display Todos -------------- | 1140 | // ---------- [display Todos -------------- |
1141 | unsigned int numTodo; | 1141 | unsigned int numTodo; |
1142 | for (numTodo = 0; numTodo < todos.count(); ++numTodo) { | 1142 | for (numTodo = 0; numTodo < todos.count(); ++numTodo) { |
1143 | Todo *todo = todos.at(numTodo); | 1143 | Todo *todo = todos.at(numTodo); |
1144 | 1144 | ||
1145 | if ( ! todo->hasDueDate() ) continue; // todo shall not be displayed if it has no date | 1145 | if ( ! todo->hasDueDate() ) continue; // todo shall not be displayed if it has no date |
1146 | 1146 | ||
1147 | // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. | 1147 | // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. |
1148 | // Already completed items can be displayed on their original due date | 1148 | // Already completed items can be displayed on their original due date |
1149 | //if not KOPrefs::instance()->mShowTodoInAgenda, show overdue in agenda | 1149 | //if not KOPrefs::instance()->mShowTodoInAgenda, show overdue in agenda |
1150 | bool overdue = (!todo->isCompleted()) && (todo->dtDue() < today) && KOPrefs::instance()->mShowTodoInAgenda; | 1150 | bool overdue = (!todo->isCompleted()) && (todo->dtDue() < today) && KOPrefs::instance()->mShowTodoInAgenda; |
1151 | 1151 | ||
1152 | if ( ((todo->dtDue().date() == currentDate) && !overdue) || | 1152 | if ( ((todo->dtDue().date() == currentDate) && !overdue) || |
1153 | ((currentDate == today) && overdue) ) { | 1153 | ((currentDate == today) && overdue) ) { |
1154 | if ( todo->doesFloat() || overdue ) { // Todo has no due-time set or is already overdue | 1154 | if ( todo->doesFloat() || overdue ) { // Todo has no due-time set or is already overdue |
1155 | if ( KOPrefs::instance()->mShowTodoInAgenda ) | 1155 | if ( KOPrefs::instance()->mShowTodoInAgenda ) |
1156 | mAllDayAgenda->insertAllDayItem(todo, currentDate, curCol, curCol); | 1156 | mAllDayAgenda->insertAllDayItem(todo, currentDate, curCol, curCol); |
1157 | } | 1157 | } |
1158 | else { | 1158 | else { |
1159 | 1159 | ||
1160 | int endY = mAgenda->timeToY(todo->dtDue().time()) - 1; | 1160 | int endY = mAgenda->timeToY(todo->dtDue().time()) - 1; |
1161 | int hi = (18/KOPrefs::instance()->mHourSize); | 1161 | int hi = (18/KOPrefs::instance()->mHourSize); |
1162 | //qDebug("hei %d ",KOPrefs::instance()->mHourSize); | 1162 | //qDebug("hei %d ",KOPrefs::instance()->mHourSize); |
1163 | int startY = endY -hi; | 1163 | int startY = endY -hi; |
1164 | 1164 | ||
1165 | mAgenda->insertItem(todo,currentDate,curCol,startY,endY); | 1165 | mAgenda->insertItem(todo,currentDate,curCol,startY,endY); |
1166 | 1166 | ||
1167 | if (startY < mMinY[curCol]) mMinY[curCol] = startY; | 1167 | if (startY < mMinY[curCol]) mMinY[curCol] = startY; |
1168 | if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; | 1168 | if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; |
1169 | } | 1169 | } |
1170 | } | 1170 | } |
1171 | } | 1171 | } |
1172 | // ---------- display Todos] -------------- | 1172 | // ---------- display Todos] -------------- |
1173 | 1173 | ||
1174 | ++curCol; | 1174 | ++curCol; |
1175 | } | 1175 | } |
1176 | mAgenda->hideUnused(); | 1176 | mAgenda->hideUnused(); |
1177 | mAllDayAgenda->hideUnused(); | 1177 | mAllDayAgenda->hideUnused(); |
1178 | mAgenda->checkScrollBoundaries(); | 1178 | mAgenda->checkScrollBoundaries(); |
1179 | 1179 | ||
1180 | deleteSelectedDateTime(); | 1180 | deleteSelectedDateTime(); |
1181 | 1181 | ||
1182 | createDayLabels(); | 1182 | createDayLabels(); |
1183 | emit incidenceSelected( 0 ); | 1183 | emit incidenceSelected( 0 ); |
1184 | 1184 | ||
1185 | if ( globalFlagBlockAgenda == 2 ) { | 1185 | if ( globalFlagBlockAgenda == 2 ) { |
1186 | if ( KOPrefs::instance()->mSetTimeToDayStartAt ) | 1186 | if ( KOPrefs::instance()->mSetTimeToDayStartAt ) |
1187 | setStartHour( KOPrefs::instance()->mDayBegins ); | 1187 | setStartHour( KOPrefs::instance()->mDayBegins ); |
1188 | else if ( KOPrefs::instance()->mCenterOnCurrentTime ) | 1188 | else if ( KOPrefs::instance()->mCenterOnCurrentTime ) |
1189 | setStartHour( QTime::currentTime ().hour() ); | 1189 | setStartHour( QTime::currentTime ().hour() ); |
1190 | // qApp->processEvents(); | 1190 | // qApp->processEvents(); |
1191 | } | 1191 | } |
1192 | qApp->processEvents(); | 1192 | qApp->processEvents(); |
1193 | //qDebug("qApp->processEvents(); END "); | 1193 | //qDebug("qApp->processEvents(); END "); |
1194 | globalFlagBlockAgenda = 0; | 1194 | globalFlagBlockAgenda = 0; |
1195 | 1195 | ||
1196 | // mAgenda->hideUnused(); | 1196 | // mAgenda->hideUnused(); |
1197 | //mAllDayAgenda->hideUnused(); | 1197 | //mAllDayAgenda->hideUnused(); |
1198 | mAllDayAgenda->drawContentsToPainter(); | 1198 | mAllDayAgenda->drawContentsToPainter(); |
1199 | mAgenda->drawContentsToPainter(); | 1199 | mAgenda->drawContentsToPainter(); |
1200 | repaintAgenda(); | 1200 | repaintAgenda(); |
1201 | // mAgenda->finishUpdate(); | 1201 | // mAgenda->finishUpdate(); |
1202 | //mAllDayAgenda->finishUpdate(); | 1202 | //mAllDayAgenda->finishUpdate(); |
1203 | 1203 | ||
1204 | // repaintAgenda(); | 1204 | // repaintAgenda(); |
1205 | //qApp->processEvents(); | 1205 | //qApp->processEvents(); |
1206 | // globalFlagBlockAgenda = 0; | 1206 | // globalFlagBlockAgenda = 0; |
1207 | } | 1207 | } |
1208 | void KOAgendaView::repaintAgenda() | 1208 | void KOAgendaView::repaintAgenda() |
1209 | { | 1209 | { |
1210 | // mAllDayAgenda->drawContentsToPainter(); | 1210 | // mAllDayAgenda->drawContentsToPainter(); |
1211 | // mAllDayAgenda->viewport()->repaint( false ); | 1211 | // mAllDayAgenda->viewport()->repaint( false ); |
1212 | // mAgenda->drawContentsToPainter(); | 1212 | // mAgenda->drawContentsToPainter(); |
1213 | // mAgenda->viewport()->repaint( false ); | 1213 | // mAgenda->viewport()->repaint( false ); |
1214 | // qApp->processEvents(); | 1214 | // qApp->processEvents(); |
1215 | 1215 | ||
1216 | //qDebug("KOAgendaView::repaintAgenda() "); | 1216 | //qDebug("KOAgendaView::repaintAgenda() "); |
1217 | //qApp->processEvents(); | 1217 | //qApp->processEvents(); |
1218 | mAgenda->viewport()->repaint( false ); | 1218 | mAgenda->viewport()->repaint( false ); |
1219 | mAllDayAgenda->viewport()->repaint( false ); | 1219 | mAllDayAgenda->viewport()->repaint( false ); |
1220 | mAgenda->finishUpdate(); | 1220 | mAgenda->finishUpdate(); |
1221 | mAllDayAgenda->finishUpdate(); | 1221 | mAllDayAgenda->finishUpdate(); |
1222 | } | 1222 | } |
1223 | 1223 | ||
1224 | 1224 | ||
1225 | void KOAgendaView::clearView() | 1225 | void KOAgendaView::clearView() |
1226 | { | 1226 | { |
1227 | // kdDebug() << "ClearView" << endl; | 1227 | // kdDebug() << "ClearView" << endl; |
1228 | mAllDayAgenda->clear(); | 1228 | mAllDayAgenda->clear(); |
1229 | mAgenda->clear(); | 1229 | mAgenda->clear(); |
1230 | } | 1230 | } |
1231 | 1231 | ||
1232 | void KOAgendaView::printPreview(CalPrinter *calPrinter, const QDate &fd, | 1232 | void KOAgendaView::printPreview(CalPrinter *calPrinter, const QDate &fd, |
1233 | const QDate &td) | 1233 | const QDate &td) |
1234 | { | 1234 | { |
1235 | #ifndef KORG_NOPRINTER | 1235 | #ifndef KORG_NOPRINTER |
1236 | if (fd == td) | 1236 | if (fd == td) |
1237 | calPrinter->preview(CalPrinter::Day, fd, td); | 1237 | calPrinter->preview(CalPrinter::Day, fd, td); |
1238 | else | 1238 | else |
1239 | calPrinter->preview(CalPrinter::Week, fd, td); | 1239 | calPrinter->preview(CalPrinter::Week, fd, td); |
1240 | #endif | 1240 | #endif |
1241 | } | 1241 | } |
1242 | 1242 | ||
1243 | // void KOAgendaView::updateMovedTodo() | 1243 | // void KOAgendaView::updateMovedTodo() |
1244 | // { | 1244 | // { |
1245 | // // updateConfig(); | 1245 | // // updateConfig(); |
1246 | // // emit updateTodoViews(); | 1246 | // // emit updateTodoViews(); |
1247 | // } | 1247 | // } |
1248 | 1248 | ||
1249 | void KOAgendaView::newEvent(int gx, int gy) | 1249 | void KOAgendaView::newEvent(int gx, int gy) |
1250 | { | 1250 | { |
1251 | if (!mSelectedDates.count()) return; | 1251 | if (!mSelectedDates.count()) return; |
1252 | 1252 | ||
1253 | QDate day = mSelectedDates[gx]; | 1253 | QDate day = mSelectedDates[gx]; |
1254 | 1254 | ||
1255 | QTime time = mAgenda->gyToTime(gy); | 1255 | QTime time = mAgenda->gyToTime(gy); |
1256 | QDateTime dt(day,time); | 1256 | QDateTime dt(day,time); |
1257 | // if ( dt < QDateTime::currentDateTime () ) | 1257 | // if ( dt < QDateTime::currentDateTime () ) |
1258 | // dt = QDateTime::currentDateTime ().addSecs( 3600 ); | 1258 | // dt = QDateTime::currentDateTime ().addSecs( 3600 ); |
1259 | emit newEventSignal(dt); | 1259 | emit newEventSignal(dt); |
1260 | } | 1260 | } |
1261 | 1261 | ||
1262 | void KOAgendaView::newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd) | 1262 | void KOAgendaView::newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd) |
1263 | { | 1263 | { |
1264 | if (!mSelectedDates.count()) return; | 1264 | if (!mSelectedDates.count()) return; |
1265 | 1265 | ||
1266 | QDate dayStart = mSelectedDates[gxStart]; | 1266 | QDate dayStart = mSelectedDates[gxStart]; |
1267 | QDate dayEnd = mSelectedDates[gxEnd]; | 1267 | QDate dayEnd = mSelectedDates[gxEnd]; |
1268 | 1268 | ||
1269 | QTime timeStart = mAgenda->gyToTime(gyStart); | 1269 | QTime timeStart = mAgenda->gyToTime(gyStart); |
1270 | QTime timeEnd = mAgenda->gyToTime( gyEnd + 1 ); | 1270 | QTime timeEnd = mAgenda->gyToTime( gyEnd + 1 ); |
1271 | 1271 | ||
1272 | QDateTime dtStart(dayStart,timeStart); | 1272 | QDateTime dtStart(dayStart,timeStart); |
1273 | QDateTime dtEnd(dayEnd,timeEnd); | 1273 | QDateTime dtEnd(dayEnd,timeEnd); |
1274 | 1274 | ||
1275 | emit newEventSignal(dtStart,dtEnd); | 1275 | emit newEventSignal(dtStart,dtEnd); |
1276 | } | 1276 | } |
1277 | 1277 | ||
1278 | void KOAgendaView::newEventAllDay(int gx, int ) | 1278 | void KOAgendaView::newEventAllDay(int gx, int ) |
1279 | { | 1279 | { |
1280 | if (!mSelectedDates.count()) return; | 1280 | if (!mSelectedDates.count()) return; |
1281 | 1281 | ||
1282 | QDate day = mSelectedDates[gx]; | 1282 | QDate day = mSelectedDates[gx]; |
1283 | 1283 | ||
1284 | emit newEventSignal(day); | 1284 | emit newEventSignal(day); |
1285 | } | 1285 | } |
1286 | 1286 | ||
1287 | void KOAgendaView::updateEventIndicatorTop(int newY) | 1287 | void KOAgendaView::updateEventIndicatorTop(int newY) |
1288 | { | 1288 | { |
1289 | uint i; | 1289 | uint i; |
1290 | for(i=0;i<mMinY.size();++i) { | 1290 | for(i=0;i<mMinY.size();++i) { |
1291 | if (newY >= mMinY.at(i)) mEventIndicatorTop->enableColumn(i,true); | 1291 | if (newY >= mMinY.at(i)) mEventIndicatorTop->enableColumn(i,true); |
1292 | else mEventIndicatorTop->enableColumn(i,false); | 1292 | else mEventIndicatorTop->enableColumn(i,false); |
1293 | } | 1293 | } |
1294 | 1294 | ||
1295 | mEventIndicatorTop->update(); | 1295 | mEventIndicatorTop->update(); |
1296 | } | 1296 | } |
1297 | 1297 | ||
1298 | void KOAgendaView::updateEventIndicatorBottom(int newY) | 1298 | void KOAgendaView::updateEventIndicatorBottom(int newY) |
1299 | { | 1299 | { |
1300 | uint i; | 1300 | uint i; |
1301 | for(i=0;i<mMaxY.size();++i) { | 1301 | for(i=0;i<mMaxY.size();++i) { |
1302 | if (newY <= mMaxY.at(i)) mEventIndicatorBottom->enableColumn(i,true); | 1302 | if (newY <= mMaxY.at(i)) mEventIndicatorBottom->enableColumn(i,true); |
1303 | else mEventIndicatorBottom->enableColumn(i,false); | 1303 | else mEventIndicatorBottom->enableColumn(i,false); |
1304 | } | 1304 | } |
1305 | 1305 | ||
1306 | mEventIndicatorBottom->update(); | 1306 | mEventIndicatorBottom->update(); |
1307 | } | 1307 | } |
1308 | 1308 | ||
1309 | void KOAgendaView::startDrag(Event *event) | 1309 | void KOAgendaView::startDrag(Event *event) |
1310 | { | 1310 | { |
1311 | #ifndef KORG_NODND | 1311 | #ifndef KORG_NODND |
1312 | DndFactory factory( calendar() ); | 1312 | DndFactory factory( calendar() ); |
1313 | ICalDrag *vd = factory.createDrag(event,this); | 1313 | ICalDrag *vd = factory.createDrag(event,this); |
1314 | if (vd->drag()) { | 1314 | if (vd->drag()) { |
1315 | kdDebug() << "KOAgendaView::startDrag(): Delete drag source" << endl; | 1315 | kdDebug() << "KOAgendaView::startDrag(): Delete drag source" << endl; |
1316 | } | 1316 | } |
1317 | #endif | 1317 | #endif |
1318 | } | 1318 | } |
1319 | 1319 | ||
1320 | void KOAgendaView::readSettings() | 1320 | void KOAgendaView::readSettings() |
1321 | { | 1321 | { |
1322 | readSettings(KOGlobals::config()); | 1322 | readSettings(KOGlobals::config()); |
1323 | } | 1323 | } |
1324 | 1324 | ||
1325 | void KOAgendaView::readSettings(KConfig *config) | 1325 | void KOAgendaView::readSettings(KConfig *config) |
1326 | { | 1326 | { |
1327 | // kdDebug() << "KOAgendaView::readSettings()" << endl; | 1327 | // kdDebug() << "KOAgendaView::readSettings()" << endl; |
1328 | 1328 | ||
1329 | config->setGroup("Views"); | 1329 | config->setGroup("Views"); |
1330 | 1330 | ||
1331 | //#ifndef KORG_NOSPLITTER | 1331 | //#ifndef KORG_NOSPLITTER |
1332 | QValueList<int> sizes = config->readIntListEntry("Separator AgendaView"); | 1332 | QValueList<int> sizes = config->readIntListEntry("Separator AgendaView"); |
1333 | if (sizes.count() == 2) { | 1333 | if (sizes.count() == 2) { |
1334 | if ( sizes[0] < 20 ) { | 1334 | if ( sizes[0] < 20 ) { |
1335 | sizes[1] = sizes[1] +20 - sizes[0]; | 1335 | sizes[1] = sizes[1] +20 - sizes[0]; |
1336 | sizes[0] = 20; | 1336 | sizes[0] = 20; |
1337 | } | 1337 | } |
1338 | mSplitterAgenda->setSizes(sizes); | 1338 | mSplitterAgenda->setSizes(sizes); |
1339 | // qDebug("read %d %d ",sizes[0],sizes[1] ); | 1339 | // qDebug("read %d %d ",sizes[0],sizes[1] ); |
1340 | } | 1340 | } |
1341 | //#endif | 1341 | //#endif |
1342 | 1342 | ||
1343 | // updateConfig(); | 1343 | // updateConfig(); |
1344 | } | 1344 | } |
1345 | 1345 | ||
1346 | void KOAgendaView::writeSettings(KConfig *config) | 1346 | void KOAgendaView::writeSettings(KConfig *config) |
1347 | { | 1347 | { |
1348 | // kdDebug() << "KOAgendaView::writeSettings()" << endl; | 1348 | // kdDebug() << "KOAgendaView::writeSettings()" << endl; |
1349 | 1349 | ||
1350 | config->setGroup("Views"); | 1350 | config->setGroup("Views"); |
1351 | 1351 | ||
1352 | //#ifndef KORG_NOSPLITTER | 1352 | //#ifndef KORG_NOSPLITTER |
1353 | QValueList<int> list = mSplitterAgenda->sizes(); | 1353 | QValueList<int> list = mSplitterAgenda->sizes(); |
1354 | config->writeEntry("Separator AgendaView",list); | 1354 | config->writeEntry("Separator AgendaView",list); |
1355 | //qDebug("write %d %d ", list[0],list[1] ); | 1355 | //qDebug("write %d %d ", list[0],list[1] ); |
1356 | //#endif | 1356 | //#endif |
1357 | } | 1357 | } |
1358 | 1358 | ||
1359 | void KOAgendaView::setHolidayMasks() | 1359 | void KOAgendaView::setHolidayMasks() |
1360 | { | 1360 | { |
1361 | mHolidayMask.resize(mSelectedDates.count()); | 1361 | mHolidayMask.resize(mSelectedDates.count()); |
1362 | 1362 | ||
1363 | uint i; | 1363 | uint i; |
1364 | for(i=0;i<mSelectedDates.count();++i) { | 1364 | for(i=0;i<mSelectedDates.count();++i) { |
1365 | QDate date = mSelectedDates[i]; | 1365 | QDate date = mSelectedDates[i]; |
1366 | bool showSaturday = KOPrefs::instance()->mExcludeSaturdays && (date.dayOfWeek() == 6); | 1366 | bool showSaturday = KOPrefs::instance()->mExcludeSaturdays && (date.dayOfWeek() == 6); |
1367 | bool showSunday = KOPrefs::instance()->mExcludeHolidays && (date.dayOfWeek() == 7); | 1367 | bool showSunday = KOPrefs::instance()->mExcludeHolidays && (date.dayOfWeek() == 7); |
1368 | bool showHoliday = false; | 1368 | bool showHoliday = false; |
1369 | if ( KOPrefs::instance()->mExcludeHolidays ) { | 1369 | if ( KOPrefs::instance()->mExcludeHolidays ) { |
1370 | QPtrList<Event> events = calendar()->events( date, true ); | 1370 | QPtrList<Event> events = calendar()->events( date, true ); |
1371 | Event *event; | 1371 | Event *event; |
1372 | for( event = events.first(); event; event = events.next() ) { | 1372 | for( event = events.first(); event; event = events.next() ) { |
1373 | if ( event->categories().contains("Holiday") || | 1373 | if ( event->categories().contains("Holiday") || |
1374 | event->categories().contains(i18n("Holiday"))) { | 1374 | event->categories().contains(i18n("Holiday"))) { |
1375 | showHoliday = true; | 1375 | showHoliday = true; |
1376 | break; | 1376 | break; |
1377 | } | 1377 | } |
1378 | } | 1378 | } |
1379 | 1379 | ||
1380 | } | 1380 | } |
1381 | 1381 | ||
1382 | #ifndef KORG_NOPLUGINS | 1382 | #ifndef KORG_NOPLUGINS |
1383 | bool showHoliday = KOPrefs::instance()->mExcludeHolidays && | 1383 | bool showHoliday = KOPrefs::instance()->mExcludeHolidays && |
1384 | !KOCore::self()->holiday(date).isEmpty(); | 1384 | !KOCore::self()->holiday(date).isEmpty(); |
1385 | #endif | 1385 | #endif |
1386 | bool showDay = showSaturday || showSunday || showHoliday; | 1386 | bool showDay = showSaturday || showSunday || showHoliday; |
1387 | 1387 | ||
1388 | if (showDay) { | 1388 | if (showDay) { |
1389 | mHolidayMask.at(i) = true; | 1389 | mHolidayMask.at(i) = true; |
1390 | } else { | 1390 | } else { |
1391 | mHolidayMask.at(i) = false; | 1391 | mHolidayMask.at(i) = false; |
1392 | } | 1392 | } |
1393 | } | 1393 | } |
1394 | 1394 | ||
1395 | mAgenda->setHolidayMask(&mHolidayMask); | 1395 | mAgenda->setHolidayMask(&mHolidayMask); |
1396 | mAllDayAgenda->setHolidayMask(&mHolidayMask); | 1396 | mAllDayAgenda->setHolidayMask(&mHolidayMask); |
1397 | } | 1397 | } |
1398 | 1398 | ||
1399 | void KOAgendaView::setContentsPos(int y) | 1399 | void KOAgendaView::setContentsPos(int y) |
1400 | { | 1400 | { |
1401 | mAgenda->setContentsPos(0,y); | 1401 | mAgenda->setContentsPos(0,y); |
1402 | } | 1402 | } |
1403 | 1403 | ||
1404 | void KOAgendaView::setExpandedButton( bool expanded ) | 1404 | void KOAgendaView::setExpandedButton( bool expanded ) |
1405 | { | 1405 | { |
1406 | if ( expanded ) { | 1406 | if ( expanded ) { |
1407 | mExpandButton->setPixmap( mExpandedPixmap ); | 1407 | mExpandButton->setPixmap( mExpandedPixmap ); |
1408 | } else { | 1408 | } else { |
1409 | mExpandButton->setPixmap( mNotExpandedPixmap ); | 1409 | mExpandButton->setPixmap( mNotExpandedPixmap ); |
1410 | } | 1410 | } |
1411 | } | 1411 | } |
1412 | 1412 | ||
1413 | void KOAgendaView::clearSelection() | 1413 | void KOAgendaView::clearSelection() |
1414 | { | 1414 | { |
1415 | mAgenda->deselectItem(); | 1415 | mAgenda->deselectItem(); |
1416 | mAllDayAgenda->deselectItem(); | 1416 | mAllDayAgenda->deselectItem(); |
1417 | } | 1417 | } |
1418 | 1418 | ||
1419 | void KOAgendaView::newTimeSpanSelectedAllDay(int gxStart, int gyStart, | 1419 | void KOAgendaView::newTimeSpanSelectedAllDay(int gxStart, int gyStart, |
1420 | int gxEnd, int gyEnd) | 1420 | int gxEnd, int gyEnd) |
1421 | { | 1421 | { |
1422 | mTimeSpanInAllDay = true; | 1422 | mTimeSpanInAllDay = true; |
1423 | newTimeSpanSelected(gxStart,gyStart,gxEnd,gyEnd); | 1423 | newTimeSpanSelected(gxStart,gyStart,gxEnd,gyEnd); |
1424 | } | 1424 | } |
1425 | 1425 | ||
1426 | 1426 | ||
1427 | 1427 | ||
1428 | 1428 | ||
1429 | void KOAgendaView::newTimeSpanSelected(int gxStart, int gyStart, | 1429 | void KOAgendaView::newTimeSpanSelected(int gxStart, int gyStart, |
1430 | int gxEnd, int gyEnd) | 1430 | int gxEnd, int gyEnd) |
1431 | { | 1431 | { |
1432 | if (!mSelectedDates.count()) return; | 1432 | if (!mSelectedDates.count()) return; |
1433 | 1433 | ||
1434 | QDate dayStart = mSelectedDates[gxStart]; | 1434 | QDate dayStart = mSelectedDates[gxStart]; |
1435 | QDate dayEnd = mSelectedDates[gxEnd]; | 1435 | QDate dayEnd = mSelectedDates[gxEnd]; |
1436 | 1436 | ||
1437 | QTime timeStart = mAgenda->gyToTime(gyStart); | 1437 | QTime timeStart = mAgenda->gyToTime(gyStart); |
1438 | QTime timeEnd = mAgenda->gyToTime( gyEnd + 1 ); | 1438 | QTime timeEnd = mAgenda->gyToTime( gyEnd + 1 ); |
1439 | 1439 | ||
1440 | QDateTime dtStart(dayStart,timeStart); | 1440 | QDateTime dtStart(dayStart,timeStart); |
1441 | QDateTime dtEnd(dayEnd,timeEnd); | 1441 | QDateTime dtEnd(dayEnd,timeEnd); |
1442 | 1442 | ||
1443 | mTimeSpanBegin = dtStart; | 1443 | mTimeSpanBegin = dtStart; |
1444 | mTimeSpanEnd = dtEnd; | 1444 | mTimeSpanEnd = dtEnd; |
1445 | 1445 | ||
1446 | } | 1446 | } |
1447 | 1447 | ||
1448 | void KOAgendaView::deleteSelectedDateTime() | 1448 | void KOAgendaView::deleteSelectedDateTime() |
1449 | { | 1449 | { |
1450 | mTimeSpanBegin.setDate(QDate()); | 1450 | mTimeSpanBegin.setDate(QDate()); |
1451 | mTimeSpanEnd.setDate(QDate()); | 1451 | mTimeSpanEnd.setDate(QDate()); |
1452 | mTimeSpanInAllDay = false; | 1452 | mTimeSpanInAllDay = false; |
1453 | } | 1453 | } |
1454 | 1454 | ||
1455 | void KOAgendaView::keyPressEvent ( QKeyEvent * e ) | 1455 | void KOAgendaView::keyPressEvent ( QKeyEvent * e ) |
1456 | { | 1456 | { |
1457 | e->ignore(); | 1457 | e->ignore(); |
1458 | } | 1458 | } |
1459 | 1459 | ||
1460 | void KOAgendaView::scrollOneHourUp() | 1460 | void KOAgendaView::scrollOneHourUp() |
1461 | { | 1461 | { |
1462 | 1462 | ||
1463 | mAgenda->scrollBy ( 0, -mAgenda->contentsHeight () / 24 ); | 1463 | mAgenda->scrollBy ( 0, -mAgenda->contentsHeight () / 24 ); |
1464 | } | 1464 | } |
1465 | void KOAgendaView::scrollOneHourDown() | 1465 | void KOAgendaView::scrollOneHourDown() |
1466 | { | 1466 | { |
1467 | mAgenda->scrollBy ( 0, mAgenda->contentsHeight () / 24 ); | 1467 | mAgenda->scrollBy ( 0, mAgenda->contentsHeight () / 24 ); |
1468 | } | 1468 | } |
1469 | 1469 | ||
1470 | void KOAgendaView::setStartHour( int h ) | 1470 | void KOAgendaView::setStartHour( int h ) |
1471 | { | 1471 | { |
1472 | mAgenda->setStartHour( h ); | 1472 | mAgenda->setStartHour( h ); |
1473 | 1473 | ||
1474 | } | 1474 | } |
1475 | 1475 | ||
1476 | void KOAgendaView::updateTodo( Todo * t, int ) | 1476 | void KOAgendaView::updateTodo( Todo * t, int ) |
1477 | { | 1477 | { |
1478 | 1478 | ||
1479 | bool remove = false; | 1479 | bool remove = false; |
1480 | bool removeAD = false; | 1480 | bool removeAD = false; |
1481 | if ( ! t->hasDueDate() ) { | 1481 | if ( ! t->hasDueDate() ) { |
1482 | remove = true; | 1482 | remove = true; |
1483 | removeAD = true; | 1483 | removeAD = true; |
1484 | } | 1484 | } |
1485 | else { | 1485 | else { |
1486 | bool overdue = (!t->isCompleted()) && (t->dtDue() < QDate::currentDate()) && KOPrefs::instance()->mShowTodoInAgenda ; | 1486 | bool overdue = (!t->isCompleted()) && (t->dtDue() < QDate::currentDate()) && KOPrefs::instance()->mShowTodoInAgenda ; |
1487 | if ( overdue && | 1487 | if ( overdue && |
1488 | QDate::currentDate() >= mSelectedDates.first() && | 1488 | QDate::currentDate() >= mSelectedDates.first() && |
1489 | QDate::currentDate() <= mSelectedDates.last()) { | 1489 | QDate::currentDate() <= mSelectedDates.last()) { |
1490 | removeAD = false; | 1490 | removeAD = false; |
1491 | remove = true; | 1491 | remove = true; |
1492 | } | 1492 | } |
1493 | else { | 1493 | else { |
1494 | if ( t->dtDue().date() < mSelectedDates.first() || | 1494 | if ( t->dtDue().date() < mSelectedDates.first() || |
1495 | t->dtDue().date() > mSelectedDates.last() ) { | 1495 | t->dtDue().date() > mSelectedDates.last() ) { |
1496 | remove = true; | 1496 | remove = true; |
1497 | removeAD = true; | 1497 | removeAD = true; |
1498 | } else { | 1498 | } else { |
1499 | remove = t->doesFloat(); | 1499 | remove = t->doesFloat(); |
1500 | removeAD = !remove; | 1500 | removeAD = !remove; |
1501 | } | 1501 | } |
1502 | } | 1502 | } |
1503 | } | 1503 | } |
1504 | int days = mSelectedDates.first().daysTo( t->dtDue().date() ); | 1504 | int days = mSelectedDates.first().daysTo( t->dtDue().date() ); |
1505 | // qDebug("daysto %d ", days ); | 1505 | // qDebug("daysto %d ", days ); |
1506 | mAgenda->updateTodo( t , days, remove); | 1506 | mAgenda->updateTodo( t , days, remove); |
1507 | if ( KOPrefs::instance()->mShowTodoInAgenda ) | 1507 | if ( KOPrefs::instance()->mShowTodoInAgenda ) |
1508 | mAllDayAgenda->updateTodo( t , days, removeAD); | 1508 | mAllDayAgenda->updateTodo( t , days, removeAD); |
1509 | //qDebug("KOAgendaView::updateTodo( Todo *, int ) "); | 1509 | //qDebug("KOAgendaView::updateTodo( Todo *, int ) "); |
1510 | 1510 | ||
1511 | } | 1511 | } |
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp index e255b83..94c459b 100644 --- a/korganizer/koviewmanager.cpp +++ b/korganizer/koviewmanager.cpp | |||
@@ -1,588 +1,590 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | 3 | ||
4 | Copyright (c) 2001 | 4 | Copyright (c) 2001 |
5 | Cornelius Schumacher <schumacher@kde.org> | 5 | Cornelius Schumacher <schumacher@kde.org> |
6 | 6 | ||
7 | This program is free software; you can redistribute it and/or modify | 7 | This program is free software; you can redistribute it and/or modify |
8 | it under the terms of the GNU General Public License as published by | 8 | it under the terms of the GNU General Public License as published by |
9 | the Free Software Foundation; either version 2 of the License, or | 9 | the Free Software Foundation; either version 2 of the License, or |
10 | (at your option) any later version. | 10 | (at your option) any later version. |
11 | 11 | ||
12 | This program is distributed in the hope that it will be useful, | 12 | This program is distributed in the hope that it will be useful, |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the |
15 | GNU General Public License for more details. | 15 | GNU General Public License for more details. |
16 | 16 | ||
17 | You should have received a copy of the GNU General Public License | 17 | You should have received a copy of the GNU General Public License |
18 | along with this program; if not, write to the Free Software | 18 | along with this program; if not, write to the Free Software |
19 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 19 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
20 | 20 | ||
21 | As a special exception, permission is given to link this program | 21 | As a special exception, permission is given to link this program |
22 | with any edition of Qt, and distribute the resulting executable, | 22 | with any edition of Qt, and distribute the resulting executable, |
23 | without including the source code for Qt in the source distribution. | 23 | without including the source code for Qt in the source distribution. |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include <qwidgetstack.h> | 26 | #include <qwidgetstack.h> |
27 | 27 | ||
28 | #include <kconfig.h> | 28 | #include <kconfig.h> |
29 | #include <kglobal.h> | 29 | #include <kglobal.h> |
30 | #ifndef DESKTOP_VERSION | 30 | #ifndef DESKTOP_VERSION |
31 | #include <qpe/qpeapplication.h> | 31 | #include <qpe/qpeapplication.h> |
32 | #else | 32 | #else |
33 | #include <qapplication.h> | 33 | #include <qapplication.h> |
34 | #endif | 34 | #endif |
35 | #include <qdatetime.h> | 35 | #include <qdatetime.h> |
36 | #include "calendarview.h" | 36 | #include "calendarview.h" |
37 | #include "datenavigator.h" | 37 | #include "datenavigator.h" |
38 | #include "kotodoview.h" | 38 | #include "kotodoview.h" |
39 | #include "koagendaview.h" | 39 | #include "koagendaview.h" |
40 | #include "kodialogmanager.h" | 40 | #include "kodialogmanager.h" |
41 | #include "komonthview.h" | 41 | #include "komonthview.h" |
42 | #include "kolistview.h" | 42 | #include "kolistview.h" |
43 | #include "kowhatsnextview.h" | 43 | #include "kowhatsnextview.h" |
44 | #include "kojournalview.h" | 44 | #include "kojournalview.h" |
45 | #include "kotimespanview.h" | 45 | #include "kotimespanview.h" |
46 | #include "koprefs.h" | 46 | #include "koprefs.h" |
47 | #include "navigatorbar.h" | 47 | #include "navigatorbar.h" |
48 | #include "kdatenavigator.h" | 48 | #include "kdatenavigator.h" |
49 | 49 | ||
50 | #include "koviewmanager.h" | 50 | #include "koviewmanager.h" |
51 | //extern bool externFlagMonthviewBlockPainting; | 51 | //extern bool externFlagMonthviewBlockPainting; |
52 | 52 | ||
53 | //bool globalFlagBlockPainting = false; | 53 | //bool globalFlagBlockPainting = false; |
54 | int globalFlagBlockAgenda = 0; | 54 | int globalFlagBlockAgenda = 0; |
55 | int globalFlagBlockLabel = 0; | 55 | int globalFlagBlockLabel = 0; |
56 | int globalFlagBlockAgendaItemPaint = 1; | 56 | int globalFlagBlockAgendaItemPaint = 1; |
57 | int globalFlagBlockAgendaItemUpdate = 1; | 57 | int globalFlagBlockAgendaItemUpdate = 1; |
58 | 58 | ||
59 | 59 | ||
60 | KOViewManager::KOViewManager( CalendarView *mainView ) : | 60 | KOViewManager::KOViewManager( CalendarView *mainView ) : |
61 | QObject(), mMainView( mainView ) | 61 | QObject(), mMainView( mainView ) |
62 | { | 62 | { |
63 | mCurrentView = 0; | 63 | mCurrentView = 0; |
64 | 64 | ||
65 | mWhatsNextView = 0; | 65 | mWhatsNextView = 0; |
66 | mTodoView = 0; | 66 | mTodoView = 0; |
67 | mAgendaView = 0; | 67 | mAgendaView = 0; |
68 | mMonthView = 0; | 68 | mMonthView = 0; |
69 | mListView = 0; | 69 | mListView = 0; |
70 | mJournalView = 0; | 70 | mJournalView = 0; |
71 | mTimeSpanView = 0; | 71 | mTimeSpanView = 0; |
72 | mCurrentAgendaView = 0 ; | 72 | mCurrentAgendaView = 0 ; |
73 | mFlagShowNextxDays = false; | 73 | mFlagShowNextxDays = false; |
74 | } | 74 | } |
75 | 75 | ||
76 | KOViewManager::~KOViewManager() | 76 | KOViewManager::~KOViewManager() |
77 | { | 77 | { |
78 | } | 78 | } |
79 | 79 | ||
80 | 80 | ||
81 | KOrg::BaseView *KOViewManager::currentView() | 81 | KOrg::BaseView *KOViewManager::currentView() |
82 | { | 82 | { |
83 | return mCurrentView; | 83 | return mCurrentView; |
84 | } | 84 | } |
85 | 85 | ||
86 | void KOViewManager::readSettings(KConfig *config) | 86 | void KOViewManager::readSettings(KConfig *config) |
87 | { | 87 | { |
88 | config->setGroup("General"); | 88 | config->setGroup("General"); |
89 | QString view = config->readEntry("Current View"); | 89 | QString view = config->readEntry("Current View"); |
90 | if (view == "WhatsNext") showWhatsNextView(); | 90 | if (view == "WhatsNext") showWhatsNextView(); |
91 | else if (view == "Month") showMonthView(); | 91 | else if (view == "Month") showMonthView(); |
92 | else if (view == "List") showListView(); | 92 | else if (view == "List") showListView(); |
93 | else if (view == "Journal") showJournalView(); | 93 | else if (view == "Journal") showJournalView(); |
94 | else if (view == "TimeSpan") showTimeSpanView(); | 94 | else if (view == "TimeSpan") showTimeSpanView(); |
95 | else if (view == "Todo") showTodoView(); | 95 | else if (view == "Todo") showTodoView(); |
96 | else { | 96 | else { |
97 | showAgendaView(); | 97 | showAgendaView(); |
98 | } | 98 | } |
99 | } | 99 | } |
100 | 100 | ||
101 | void KOViewManager::writeSettings(KConfig *config) | 101 | void KOViewManager::writeSettings(KConfig *config) |
102 | { | 102 | { |
103 | config->setGroup("General"); | 103 | config->setGroup("General"); |
104 | 104 | ||
105 | QString view; | 105 | QString view; |
106 | if (mCurrentView == mWhatsNextView) view = "WhatsNext"; | 106 | if (mCurrentView == mWhatsNextView) view = "WhatsNext"; |
107 | else if (mCurrentView == mMonthView) view = "Month"; | 107 | else if (mCurrentView == mMonthView) view = "Month"; |
108 | else if (mCurrentView == mListView) view = "List"; | 108 | else if (mCurrentView == mListView) view = "List"; |
109 | else if (mCurrentView == mJournalView) view = "Journal"; | 109 | else if (mCurrentView == mJournalView) view = "Journal"; |
110 | else if (mCurrentView == mTimeSpanView) view = "TimeSpan"; | 110 | else if (mCurrentView == mTimeSpanView) view = "TimeSpan"; |
111 | else if (mCurrentView == mTodoView) view = "Todo"; | 111 | else if (mCurrentView == mTodoView) view = "Todo"; |
112 | else view = "Agenda"; | 112 | else view = "Agenda"; |
113 | 113 | ||
114 | config->writeEntry("Current View",view); | 114 | config->writeEntry("Current View",view); |
115 | 115 | ||
116 | if (mAgendaView) { | 116 | if (mAgendaView) { |
117 | mAgendaView->writeSettings(config); | 117 | mAgendaView->writeSettings(config); |
118 | } | 118 | } |
119 | if (mTimeSpanView) { | 119 | if (mTimeSpanView) { |
120 | mTimeSpanView->writeSettings(config); | 120 | mTimeSpanView->writeSettings(config); |
121 | } | 121 | } |
122 | if (mListView) { | 122 | if (mListView) { |
123 | mListView->writeSettings(config); | 123 | mListView->writeSettings(config); |
124 | } | 124 | } |
125 | if (mTodoView) { | 125 | if (mTodoView) { |
126 | mTodoView->saveLayout(config,"Todo View"); | 126 | mTodoView->saveLayout(config,"Todo View"); |
127 | } | 127 | } |
128 | } | 128 | } |
129 | 129 | ||
130 | void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) | 130 | void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) |
131 | { | 131 | { |
132 | 132 | ||
133 | //mFlagShowNextxDays = false; | 133 | //mFlagShowNextxDays = false; |
134 | //if(view == mCurrentView) return; | 134 | //if(view == mCurrentView) return; |
135 | if ( view == 0 ) { | 135 | if ( view == 0 ) { |
136 | view = mCurrentView; | 136 | view = mCurrentView; |
137 | if ( view == 0 ) | 137 | if ( view == 0 ) |
138 | return; | 138 | return; |
139 | } | 139 | } |
140 | bool full = fullScreen; | 140 | bool full = fullScreen; |
141 | if(view == mCurrentView && view != mWhatsNextView ) { | 141 | if(view == mCurrentView && view != mWhatsNextView ) { |
142 | if ( mCurrentAgendaView < 0 ) | 142 | if ( mCurrentAgendaView < 0 ) |
143 | return; | 143 | return; |
144 | full = mMainView->leftFrame()->isVisible(); | 144 | full = mMainView->leftFrame()->isVisible(); |
145 | } else { | 145 | } else { |
146 | mCurrentView = view; | 146 | mCurrentView = view; |
147 | 147 | ||
148 | // bool full = fullScreen; | 148 | // bool full = fullScreen; |
149 | bool isFull = !mMainView->leftFrame()->isVisible(); | 149 | bool isFull = !mMainView->leftFrame()->isVisible(); |
150 | if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) | 150 | if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) |
151 | full = true; | 151 | full = true; |
152 | if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) | 152 | if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) |
153 | full = false; | 153 | full = false; |
154 | } | 154 | } |
155 | if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); | 155 | if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); |
156 | //raiseCurrentView( full ); | 156 | //raiseCurrentView( full ); |
157 | mMainView->processIncidenceSelection( 0 ); | 157 | mMainView->processIncidenceSelection( 0 ); |
158 | mMainView->updateView(); | 158 | mMainView->updateView(); |
159 | raiseCurrentView( full ); | 159 | raiseCurrentView( full ); |
160 | mMainView->adaptNavigationUnits(); | 160 | mMainView->adaptNavigationUnits(); |
161 | } | 161 | } |
162 | 162 | ||
163 | void KOViewManager::raiseCurrentView( bool fullScreen ) | 163 | void KOViewManager::raiseCurrentView( bool fullScreen ) |
164 | { | 164 | { |
165 | //qDebug("raiseCurrentView "); | 165 | //qDebug("raiseCurrentView "); |
166 | mCurrentAgendaView = 0; | 166 | mCurrentAgendaView = 0; |
167 | int wid = mMainView->width() ; | 167 | int wid = mMainView->width() ; |
168 | int hei = mMainView->height(); | 168 | int hei = mMainView->height(); |
169 | if ( mCurrentView == mMonthView ) { | 169 | if ( mCurrentView == mMonthView ) { |
170 | mMainView->navigatorBar()->show(); | 170 | mMainView->navigatorBar()->show(); |
171 | hei -= mMainView->navigatorBar()->sizeHint().height(); | 171 | hei -= mMainView->navigatorBar()->sizeHint().height(); |
172 | //mMainView->navigatorBar()->hide(); | 172 | //mMainView->navigatorBar()->hide(); |
173 | } else { | 173 | } else { |
174 | mMainView->navigatorBar()->hide(); | 174 | mMainView->navigatorBar()->hide(); |
175 | } | 175 | } |
176 | if ( fullScreen ) { | 176 | if ( fullScreen ) { |
177 | mMainView->leftFrame()->hide(); | 177 | mMainView->leftFrame()->hide(); |
178 | } else { | 178 | } else { |
179 | mMainView->leftFrame()->show(); | 179 | mMainView->leftFrame()->show(); |
180 | if ( KOPrefs::instance()->mVerticalScreen ) | 180 | if ( KOPrefs::instance()->mVerticalScreen ) |
181 | hei -= mMainView->leftFrame()->height(); | 181 | hei -= mMainView->leftFrame()->height(); |
182 | else | 182 | else |
183 | wid -= mMainView->leftFrame()->width(); | 183 | wid -= mMainView->leftFrame()->width(); |
184 | } | 184 | } |
185 | 185 | emit signalFullScreen( !fullScreen ); | |
186 | if ( globalFlagBlockAgenda == 5 ) { | 186 | if ( globalFlagBlockAgenda == 5 ) { |
187 | globalFlagBlockAgenda = 4; | 187 | globalFlagBlockAgenda = 4; |
188 | globalFlagBlockAgendaItemPaint = 1; | 188 | globalFlagBlockAgendaItemPaint = 1; |
189 | } | 189 | } |
190 | mMainView->viewStack()->raiseWidget(mCurrentView); | 190 | mMainView->viewStack()->raiseWidget(mCurrentView); |
191 | if ( globalFlagBlockAgenda == 4 ) { | 191 | if ( globalFlagBlockAgenda == 4 ) { |
192 | if ( mCurrentView == mAgendaView ) { | 192 | if ( mCurrentView == mAgendaView ) { |
193 | //globalFlagBlockAgenda =1 ; | 193 | //globalFlagBlockAgenda =1 ; |
194 | if ( KOPrefs::instance()->mSetTimeToDayStartAt ) | 194 | if ( KOPrefs::instance()->mSetTimeToDayStartAt ) |
195 | mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins ); | 195 | mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins ); |
196 | else if ( KOPrefs::instance()->mCenterOnCurrentTime ) | 196 | else if ( KOPrefs::instance()->mCenterOnCurrentTime ) |
197 | mAgendaView->setStartHour( QTime::currentTime ().hour() ); | 197 | mAgendaView->setStartHour( QTime::currentTime ().hour() ); |
198 | qApp->processEvents(); | 198 | qApp->processEvents(); |
199 | //qDebug("qApp->processEvents() "); | 199 | //qDebug("qApp->processEvents() "); |
200 | globalFlagBlockAgenda = 0; | 200 | globalFlagBlockAgenda = 0; |
201 | mAgendaView->repaintAgenda(); | 201 | mAgendaView->repaintAgenda(); |
202 | 202 | ||
203 | } | 203 | } |
204 | globalFlagBlockAgenda = 0; | 204 | globalFlagBlockAgenda = 0; |
205 | } | 205 | } |
206 | emit signalAgendaView( mCurrentView == mAgendaView ); | ||
206 | //qDebug("raiseCurrentView ende "); | 207 | //qDebug("raiseCurrentView ende "); |
208 | |||
207 | } | 209 | } |
208 | 210 | ||
209 | void KOViewManager::updateView() | 211 | void KOViewManager::updateView() |
210 | { | 212 | { |
211 | // qDebug("KOViewManager::updateView() "); | 213 | // qDebug("KOViewManager::updateView() "); |
212 | // if we are updating mTodoView, we get endless recursion | 214 | // if we are updating mTodoView, we get endless recursion |
213 | if ( mTodoView == mCurrentView ) | 215 | if ( mTodoView == mCurrentView ) |
214 | return; | 216 | return; |
215 | if ( mCurrentView ) mCurrentView->updateView(); | 217 | if ( mCurrentView ) mCurrentView->updateView(); |
216 | 218 | ||
217 | } | 219 | } |
218 | 220 | ||
219 | void KOViewManager::updateView(const QDate &start, const QDate &end) | 221 | void KOViewManager::updateView(const QDate &start, const QDate &end) |
220 | { | 222 | { |
221 | // kdDebug() << "KOViewManager::updateView()" << endl; | 223 | // kdDebug() << "KOViewManager::updateView()" << endl; |
222 | 224 | ||
223 | if (mCurrentView) mCurrentView->showDates(start, end); | 225 | if (mCurrentView) mCurrentView->showDates(start, end); |
224 | 226 | ||
225 | if (mTodoView) mTodoView->updateView(); | 227 | if (mTodoView) mTodoView->updateView(); |
226 | } | 228 | } |
227 | 229 | ||
228 | 230 | ||
229 | void KOViewManager::updateWNview() | 231 | void KOViewManager::updateWNview() |
230 | { | 232 | { |
231 | if ( mCurrentView == mWhatsNextView && mWhatsNextView ) | 233 | if ( mCurrentView == mWhatsNextView && mWhatsNextView ) |
232 | mWhatsNextView->updateView(); | 234 | mWhatsNextView->updateView(); |
233 | 235 | ||
234 | } | 236 | } |
235 | void KOViewManager::showWhatsNextView() | 237 | void KOViewManager::showWhatsNextView() |
236 | { | 238 | { |
237 | if (!mWhatsNextView) { | 239 | if (!mWhatsNextView) { |
238 | mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(), | 240 | mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(), |
239 | "KOViewManager::WhatsNextView"); | 241 | "KOViewManager::WhatsNextView"); |
240 | mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog()); | 242 | mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog()); |
241 | connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig())); | 243 | connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig())); |
242 | addView(mWhatsNextView); | 244 | addView(mWhatsNextView); |
243 | connect(this, SIGNAL( printWNV() ), | 245 | connect(this, SIGNAL( printWNV() ), |
244 | mWhatsNextView, SLOT( printMe() ) ); | 246 | mWhatsNextView, SLOT( printMe() ) ); |
245 | } | 247 | } |
246 | globalFlagBlockAgenda = 1; | 248 | globalFlagBlockAgenda = 1; |
247 | showView(mWhatsNextView, true ); | 249 | showView(mWhatsNextView, true ); |
248 | //mWhatsNextView->updateView(); | 250 | //mWhatsNextView->updateView(); |
249 | 251 | ||
250 | } | 252 | } |
251 | 253 | ||
252 | void KOViewManager::showListView() | 254 | void KOViewManager::showListView() |
253 | { | 255 | { |
254 | if (!mListView) { | 256 | if (!mListView) { |
255 | mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView"); | 257 | mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView"); |
256 | addView(mListView); | 258 | addView(mListView); |
257 | 259 | ||
258 | connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)), | 260 | connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)), |
259 | mMainView, SLOT(showIncidence(Incidence *))); | 261 | mMainView, SLOT(showIncidence(Incidence *))); |
260 | connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)), | 262 | connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)), |
261 | mMainView, SLOT(editIncidence(Incidence *))); | 263 | mMainView, SLOT(editIncidence(Incidence *))); |
262 | connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)), | 264 | connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)), |
263 | mMainView, SLOT(deleteIncidence(Incidence *))); | 265 | mMainView, SLOT(deleteIncidence(Incidence *))); |
264 | connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ), | 266 | connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ), |
265 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 267 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
266 | connect( mListView, SIGNAL( signalNewEvent() ), | 268 | connect( mListView, SIGNAL( signalNewEvent() ), |
267 | mMainView, SLOT( newEvent() ) ); | 269 | mMainView, SLOT( newEvent() ) ); |
268 | connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig())); | 270 | connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig())); |
269 | connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), | 271 | connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), |
270 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); | 272 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); |
271 | connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), | 273 | connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), |
272 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); | 274 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); |
273 | connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ), | 275 | connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ), |
274 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 276 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
275 | connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ), | 277 | connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ), |
276 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 278 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
277 | } | 279 | } |
278 | // bool temp = mFlagShowNextxDays; | 280 | // bool temp = mFlagShowNextxDays; |
279 | //globalFlagBlockPainting = true; | 281 | //globalFlagBlockPainting = true; |
280 | globalFlagBlockAgenda = 1; | 282 | globalFlagBlockAgenda = 1; |
281 | if ( KOPrefs::instance()->mListViewMonthTimespan ) { | 283 | if ( KOPrefs::instance()->mListViewMonthTimespan ) { |
282 | mMainView->setBlockShowDates( true ); | 284 | mMainView->setBlockShowDates( true ); |
283 | mMainView->dateNavigator()->selectMonth(); | 285 | mMainView->dateNavigator()->selectMonth(); |
284 | mMainView->setBlockShowDates( false ); | 286 | mMainView->setBlockShowDates( false ); |
285 | } | 287 | } |
286 | showView(mListView, KOPrefs::instance()->mFullViewTodo); | 288 | showView(mListView, KOPrefs::instance()->mFullViewTodo); |
287 | //mFlagShowNextxDays = temp; | 289 | //mFlagShowNextxDays = temp; |
288 | } | 290 | } |
289 | 291 | ||
290 | void KOViewManager::showAgendaView( bool fullScreen ) | 292 | void KOViewManager::showAgendaView( bool fullScreen ) |
291 | { | 293 | { |
292 | 294 | ||
293 | mMainView->dialogManager()->hideSearchDialog(); | 295 | mMainView->dialogManager()->hideSearchDialog(); |
294 | // qDebug("KOViewManager::showAgendaView "); | 296 | // qDebug("KOViewManager::showAgendaView "); |
295 | bool full; | 297 | bool full; |
296 | full = fullScreen; | 298 | full = fullScreen; |
297 | if (!mAgendaView) { | 299 | if (!mAgendaView) { |
298 | full = false; | 300 | full = false; |
299 | mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView"); | 301 | mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView"); |
300 | addView(mAgendaView); | 302 | addView(mAgendaView); |
301 | #ifndef DESKTOP_VERSION | 303 | #ifndef DESKTOP_VERSION |
302 | QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold ); | 304 | QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold ); |
303 | #endif | 305 | #endif |
304 | connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )), | 306 | connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )), |
305 | mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) )); | 307 | mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) )); |
306 | 308 | ||
307 | // SIGNALS/SLOTS FOR DAY/WEEK VIEW | 309 | // SIGNALS/SLOTS FOR DAY/WEEK VIEW |
308 | connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)), | 310 | connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)), |
309 | mMainView, SLOT(newEvent(QDateTime))); | 311 | mMainView, SLOT(newEvent(QDateTime))); |
310 | // connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)), | 312 | // connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)), |
311 | // mMainView, SLOT(newEvent(QDateTime,QDateTime))); | 313 | // mMainView, SLOT(newEvent(QDateTime,QDateTime))); |
312 | connect(mAgendaView,SIGNAL(newEventSignal(QDate)), | 314 | connect(mAgendaView,SIGNAL(newEventSignal(QDate)), |
313 | mMainView, SLOT(newEvent(QDate))); | 315 | mMainView, SLOT(newEvent(QDate))); |
314 | 316 | ||
315 | connect(mAgendaView, SIGNAL(editIncidenceSignal(Incidence *)), | 317 | connect(mAgendaView, SIGNAL(editIncidenceSignal(Incidence *)), |
316 | mMainView, SLOT(editIncidence(Incidence *))); | 318 | mMainView, SLOT(editIncidence(Incidence *))); |
317 | connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)), | 319 | connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)), |
318 | mMainView, SLOT(showIncidence(Incidence *))); | 320 | mMainView, SLOT(showIncidence(Incidence *))); |
319 | connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)), | 321 | connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)), |
320 | mMainView, SLOT(deleteIncidence(Incidence *))); | 322 | mMainView, SLOT(deleteIncidence(Incidence *))); |
321 | 323 | ||
322 | connect( mAgendaView, SIGNAL( incidenceSelected( Incidence * ) ), | 324 | connect( mAgendaView, SIGNAL( incidenceSelected( Incidence * ) ), |
323 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 325 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
324 | 326 | ||
325 | connect(mAgendaView, SIGNAL( toggleExpand() ), | 327 | connect(mAgendaView, SIGNAL( toggleExpand() ), |
326 | mMainView, SLOT( toggleExpand() ) ); | 328 | mMainView, SLOT( toggleExpand() ) ); |
327 | 329 | ||
328 | connect(mMainView, SIGNAL( calendarViewExpanded( bool ) ), | 330 | connect(mMainView, SIGNAL( calendarViewExpanded( bool ) ), |
329 | mAgendaView, SLOT( setExpandedButton( bool ) ) ); | 331 | mAgendaView, SLOT( setExpandedButton( bool ) ) ); |
330 | connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ), | 332 | connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ), |
331 | mMainView, SLOT(cloneIncidence(Incidence *) ) ) ; | 333 | mMainView, SLOT(cloneIncidence(Incidence *) ) ) ; |
332 | connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ), | 334 | connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ), |
333 | mMainView, SLOT(cancelIncidence(Incidence *) ) ) ; | 335 | mMainView, SLOT(cancelIncidence(Incidence *) ) ) ; |
334 | connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig())); | 336 | connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig())); |
335 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView, | 337 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView, |
336 | SLOT( updateTodo( Todo *, int ) ) ); | 338 | SLOT( updateTodo( Todo *, int ) ) ); |
337 | connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )), | 339 | connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )), |
338 | mMainView, SIGNAL( todoModified( Todo *, int ))); | 340 | mMainView, SIGNAL( todoModified( Todo *, int ))); |
339 | connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ), | 341 | connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ), |
340 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 342 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
341 | connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ), | 343 | connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ), |
342 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 344 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
343 | mAgendaView->readSettings(); | 345 | mAgendaView->readSettings(); |
344 | mAgendaView->updateConfig(); | 346 | mAgendaView->updateConfig(); |
345 | } | 347 | } |
346 | 348 | ||
347 | showView( mAgendaView, full); | 349 | showView( mAgendaView, full); |
348 | 350 | ||
349 | } | 351 | } |
350 | 352 | ||
351 | void KOViewManager::showDayView() | 353 | void KOViewManager::showDayView() |
352 | { | 354 | { |
353 | mFlagShowNextxDays = false; | 355 | mFlagShowNextxDays = false; |
354 | globalFlagBlockLabel = 1; | 356 | globalFlagBlockLabel = 1; |
355 | globalFlagBlockAgenda = 1; | 357 | globalFlagBlockAgenda = 1; |
356 | if ( mCurrentAgendaView != 1 ) | 358 | if ( mCurrentAgendaView != 1 ) |
357 | mCurrentAgendaView = -1; | 359 | mCurrentAgendaView = -1; |
358 | showAgendaView(); | 360 | showAgendaView(); |
359 | qApp->processEvents(); | 361 | qApp->processEvents(); |
360 | globalFlagBlockAgenda = 2; | 362 | globalFlagBlockAgenda = 2; |
361 | globalFlagBlockLabel = 0; | 363 | globalFlagBlockLabel = 0; |
362 | mMainView->dateNavigator()->selectDates( 1 ); | 364 | mMainView->dateNavigator()->selectDates( 1 ); |
363 | mCurrentAgendaView = 1 ; | 365 | mCurrentAgendaView = 1 ; |
364 | 366 | ||
365 | } | 367 | } |
366 | 368 | ||
367 | void KOViewManager::showWorkWeekView() | 369 | void KOViewManager::showWorkWeekView() |
368 | { | 370 | { |
369 | mFlagShowNextxDays = false; | 371 | mFlagShowNextxDays = false; |
370 | globalFlagBlockAgenda = 1; | 372 | globalFlagBlockAgenda = 1; |
371 | globalFlagBlockLabel = 1; | 373 | globalFlagBlockLabel = 1; |
372 | if ( mCurrentAgendaView != 5 ) | 374 | if ( mCurrentAgendaView != 5 ) |
373 | mCurrentAgendaView = -1; | 375 | mCurrentAgendaView = -1; |
374 | showAgendaView(); | 376 | showAgendaView(); |
375 | qApp->processEvents(); | 377 | qApp->processEvents(); |
376 | globalFlagBlockAgenda = 2; | 378 | globalFlagBlockAgenda = 2; |
377 | globalFlagBlockLabel = 0; | 379 | globalFlagBlockLabel = 0; |
378 | mMainView->dateNavigator()->selectWorkWeek(); | 380 | mMainView->dateNavigator()->selectWorkWeek(); |
379 | mCurrentAgendaView = 5 ; | 381 | mCurrentAgendaView = 5 ; |
380 | 382 | ||
381 | } | 383 | } |
382 | 384 | ||
383 | void KOViewManager::showWeekView() | 385 | void KOViewManager::showWeekView() |
384 | { | 386 | { |
385 | /* | 387 | /* |
386 | globalFlagBlockAgenda = 2; | 388 | globalFlagBlockAgenda = 2; |
387 | qDebug("4globalFlagBlockAgenda = 2; "); | 389 | qDebug("4globalFlagBlockAgenda = 2; "); |
388 | //globalFlagBlockPainting = true; | 390 | //globalFlagBlockPainting = true; |
389 | mMainView->dateNavigator()->selectWeek(); | 391 | mMainView->dateNavigator()->selectWeek(); |
390 | showAgendaView(); | 392 | showAgendaView(); |
391 | */ | 393 | */ |
392 | 394 | ||
393 | 395 | ||
394 | mFlagShowNextxDays = false; | 396 | mFlagShowNextxDays = false; |
395 | globalFlagBlockAgenda = 1; | 397 | globalFlagBlockAgenda = 1; |
396 | globalFlagBlockLabel = 1; | 398 | globalFlagBlockLabel = 1; |
397 | if ( mCurrentAgendaView != 7 ) | 399 | if ( mCurrentAgendaView != 7 ) |
398 | mCurrentAgendaView = -1; | 400 | mCurrentAgendaView = -1; |
399 | showAgendaView(); | 401 | showAgendaView(); |
400 | qApp->processEvents(); | 402 | qApp->processEvents(); |
401 | globalFlagBlockAgenda = 2; | 403 | globalFlagBlockAgenda = 2; |
402 | globalFlagBlockLabel = 0; | 404 | globalFlagBlockLabel = 0; |
403 | mMainView->dateNavigator()->selectWeek(); | 405 | mMainView->dateNavigator()->selectWeek(); |
404 | mCurrentAgendaView = 7 ; | 406 | mCurrentAgendaView = 7 ; |
405 | } | 407 | } |
406 | 408 | ||
407 | void KOViewManager::showNextXView() | 409 | void KOViewManager::showNextXView() |
408 | { | 410 | { |
409 | 411 | ||
410 | globalFlagBlockAgenda = 1; | 412 | globalFlagBlockAgenda = 1; |
411 | if ( mCurrentAgendaView != 3 ) | 413 | if ( mCurrentAgendaView != 3 ) |
412 | mCurrentAgendaView = -1; | 414 | mCurrentAgendaView = -1; |
413 | showAgendaView(KOPrefs::instance()->mFullViewMonth); | 415 | showAgendaView(KOPrefs::instance()->mFullViewMonth); |
414 | globalFlagBlockAgenda = 2; | 416 | globalFlagBlockAgenda = 2; |
415 | mMainView->dateNavigator()->selectDates( QDate::currentDate(), | 417 | mMainView->dateNavigator()->selectDates( QDate::currentDate(), |
416 | KOPrefs::instance()->mNextXDays ); | 418 | KOPrefs::instance()->mNextXDays ); |
417 | mFlagShowNextxDays = true; | 419 | mFlagShowNextxDays = true; |
418 | mCurrentAgendaView = 3 ; | 420 | mCurrentAgendaView = 3 ; |
419 | } | 421 | } |
420 | bool KOViewManager::showsNextDays() | 422 | bool KOViewManager::showsNextDays() |
421 | { | 423 | { |
422 | return mFlagShowNextxDays; | 424 | return mFlagShowNextxDays; |
423 | } | 425 | } |
424 | void KOViewManager::showMonthView() | 426 | void KOViewManager::showMonthView() |
425 | { | 427 | { |
426 | if (!mMonthView) { | 428 | if (!mMonthView) { |
427 | mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView"); | 429 | mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView"); |
428 | 430 | ||
429 | addView(mMonthView); | 431 | addView(mMonthView); |
430 | // mMonthView->show(); | 432 | // mMonthView->show(); |
431 | // SIGNALS/SLOTS FOR MONTH VIEW | 433 | // SIGNALS/SLOTS FOR MONTH VIEW |
432 | connect(mMonthView, SIGNAL(newEventSignal(QDateTime)), | 434 | connect(mMonthView, SIGNAL(newEventSignal(QDateTime)), |
433 | mMainView, SLOT(newEvent(QDateTime))); | 435 | mMainView, SLOT(newEvent(QDateTime))); |
434 | 436 | ||
435 | connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)), | 437 | connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)), |
436 | mMainView, SLOT(showIncidence(Incidence *))); | 438 | mMainView, SLOT(showIncidence(Incidence *))); |
437 | connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)), | 439 | connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)), |
438 | mMainView, SLOT(editIncidence(Incidence *))); | 440 | mMainView, SLOT(editIncidence(Incidence *))); |
439 | connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)), | 441 | connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)), |
440 | mMainView, SLOT(deleteIncidence(Incidence *))); | 442 | mMainView, SLOT(deleteIncidence(Incidence *))); |
441 | 443 | ||
442 | connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ), | 444 | connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ), |
443 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 445 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
444 | connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), | 446 | connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), |
445 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); | 447 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); |
446 | connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), | 448 | connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), |
447 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); | 449 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); |
448 | 450 | ||
449 | connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ), | 451 | connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ), |
450 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 452 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
451 | connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ), | 453 | connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ), |
452 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 454 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
453 | connect( mMonthView, SIGNAL( selectWeekNum( int ) ), | 455 | connect( mMonthView, SIGNAL( selectWeekNum( int ) ), |
454 | mMainView, SLOT ( selectWeekNum( int ) ) ); | 456 | mMainView, SLOT ( selectWeekNum( int ) ) ); |
455 | connect( mMonthView, SIGNAL( showDaySignal( QDate ) ), | 457 | connect( mMonthView, SIGNAL( showDaySignal( QDate ) ), |
456 | mMainView, SLOT ( showDay( QDate ) ) ); | 458 | mMainView, SLOT ( showDay( QDate ) ) ); |
457 | connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig())); | 459 | connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig())); |
458 | mMonthView->updateConfig(); | 460 | mMonthView->updateConfig(); |
459 | } | 461 | } |
460 | 462 | ||
461 | globalFlagBlockAgenda = 1; | 463 | globalFlagBlockAgenda = 1; |
462 | //mFlagShowNextxDays = false; | 464 | //mFlagShowNextxDays = false; |
463 | // if(mMonthView == mCurrentView) return; | 465 | // if(mMonthView == mCurrentView) return; |
464 | mMainView->dateNavigator()->selectMonth(); | 466 | mMainView->dateNavigator()->selectMonth(); |
465 | // DateList tmpList = mMainView->dateNavigator()->selectedDates( ); | 467 | // DateList tmpList = mMainView->dateNavigator()->selectedDates( ); |
466 | //mMonthView->showDates(tmpList.first(), tmpList.last()); | 468 | //mMonthView->showDates(tmpList.first(), tmpList.last()); |
467 | 469 | ||
468 | showView(mMonthView, true ); | 470 | showView(mMonthView, true ); |
469 | 471 | ||
470 | } | 472 | } |
471 | 473 | ||
472 | void KOViewManager::showTodoView() | 474 | void KOViewManager::showTodoView() |
473 | { | 475 | { |
474 | //mFlagShowNextxDays = false; | 476 | //mFlagShowNextxDays = false; |
475 | if ( !mTodoView ) { | 477 | if ( !mTodoView ) { |
476 | mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(), | 478 | mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(), |
477 | "KOViewManager::TodoView" ); | 479 | "KOViewManager::TodoView" ); |
478 | 480 | ||
479 | addView( mTodoView ); | 481 | addView( mTodoView ); |
480 | // QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold ); | 482 | // QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold ); |
481 | 483 | ||
482 | // SIGNALS/SLOTS FOR TODO VIEW | 484 | // SIGNALS/SLOTS FOR TODO VIEW |
483 | connect( mTodoView, SIGNAL( newTodoSignal() ), | 485 | connect( mTodoView, SIGNAL( newTodoSignal() ), |
484 | mMainView, SLOT( newTodo() ) ); | 486 | mMainView, SLOT( newTodo() ) ); |
485 | connect( mTodoView, SIGNAL( newSubTodoSignal( Todo * ) ), | 487 | connect( mTodoView, SIGNAL( newSubTodoSignal( Todo * ) ), |
486 | mMainView, SLOT( newSubTodo( Todo *) ) ); | 488 | mMainView, SLOT( newSubTodo( Todo *) ) ); |
487 | connect( mTodoView, SIGNAL( showTodoSignal( Todo *) ), | 489 | connect( mTodoView, SIGNAL( showTodoSignal( Todo *) ), |
488 | mMainView, SLOT( showTodo( Todo * ) ) ); | 490 | mMainView, SLOT( showTodo( Todo * ) ) ); |
489 | connect( mTodoView, SIGNAL( editTodoSignal( Todo * ) ), | 491 | connect( mTodoView, SIGNAL( editTodoSignal( Todo * ) ), |
490 | mMainView, SLOT( editTodo( Todo * ) ) ); | 492 | mMainView, SLOT( editTodo( Todo * ) ) ); |
491 | connect( mTodoView, SIGNAL( deleteTodoSignal( Todo * ) ), | 493 | connect( mTodoView, SIGNAL( deleteTodoSignal( Todo * ) ), |
492 | mMainView, SLOT( deleteTodo( Todo * ) ) ); | 494 | mMainView, SLOT( deleteTodo( Todo * ) ) ); |
493 | connect( mTodoView, SIGNAL( purgeCompletedSignal() ), | 495 | connect( mTodoView, SIGNAL( purgeCompletedSignal() ), |
494 | mMainView, SLOT( purgeCompleted() ) ); | 496 | mMainView, SLOT( purgeCompleted() ) ); |
495 | 497 | ||
496 | connect( mTodoView, SIGNAL( incidenceSelected( Incidence * ) ), | 498 | connect( mTodoView, SIGNAL( incidenceSelected( Incidence * ) ), |
497 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 499 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
498 | 500 | ||
499 | connect( mMainView, SIGNAL( configChanged() ), mTodoView, | 501 | connect( mMainView, SIGNAL( configChanged() ), mTodoView, |
500 | SLOT( updateConfig() ) ); | 502 | SLOT( updateConfig() ) ); |
501 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mTodoView, | 503 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mTodoView, |
502 | SLOT( updateTodo( Todo *, int ) ) ); | 504 | SLOT( updateTodo( Todo *, int ) ) ); |
503 | connect( mTodoView, SIGNAL( todoModifiedSignal( Todo *, int ) ), | 505 | connect( mTodoView, SIGNAL( todoModifiedSignal( Todo *, int ) ), |
504 | mMainView, SIGNAL ( todoModified( Todo *, int ) ) ); | 506 | mMainView, SIGNAL ( todoModified( Todo *, int ) ) ); |
505 | connect( mTodoView, SIGNAL( cloneTodoSignal( Incidence * ) ), | 507 | connect( mTodoView, SIGNAL( cloneTodoSignal( Incidence * ) ), |
506 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); | 508 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); |
507 | connect( mTodoView, SIGNAL( cancelTodoSignal( Incidence * ) ), | 509 | connect( mTodoView, SIGNAL( cancelTodoSignal( Incidence * ) ), |
508 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); | 510 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); |
509 | connect( mTodoView, SIGNAL( unparentTodoSignal( Todo * ) ), | 511 | connect( mTodoView, SIGNAL( unparentTodoSignal( Todo * ) ), |
510 | mMainView, SLOT ( todo_unsub( Todo * ) ) ); | 512 | mMainView, SLOT ( todo_unsub( Todo * ) ) ); |
511 | connect( mTodoView, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), | 513 | connect( mTodoView, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), |
512 | mMainView, SLOT ( todo_resub( Todo *, Todo *) ) ); | 514 | mMainView, SLOT ( todo_resub( Todo *, Todo *) ) ); |
513 | connect( mTodoView, SIGNAL( moveTodoSignal( Incidence * ) ), | 515 | connect( mTodoView, SIGNAL( moveTodoSignal( Incidence * ) ), |
514 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 516 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
515 | connect( mTodoView, SIGNAL( beamTodoSignal( Incidence * ) ), | 517 | connect( mTodoView, SIGNAL( beamTodoSignal( Incidence * ) ), |
516 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 518 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
517 | KConfig *config = KOGlobals::config(); | 519 | KConfig *config = KOGlobals::config(); |
518 | mTodoView->restoreLayout(config,"Todo View"); | 520 | mTodoView->restoreLayout(config,"Todo View"); |
519 | mTodoView->setNavigator( mMainView->dateNavigator() ); | 521 | mTodoView->setNavigator( mMainView->dateNavigator() ); |
520 | } | 522 | } |
521 | 523 | ||
522 | globalFlagBlockAgenda = 1; | 524 | globalFlagBlockAgenda = 1; |
523 | showView( mTodoView, true ); | 525 | showView( mTodoView, true ); |
524 | 526 | ||
525 | } | 527 | } |
526 | 528 | ||
527 | void KOViewManager::showJournalView() | 529 | void KOViewManager::showJournalView() |
528 | { | 530 | { |
529 | //mFlagShowNextxDays = false; | 531 | //mFlagShowNextxDays = false; |
530 | if (!mJournalView) { | 532 | if (!mJournalView) { |
531 | mJournalView = new KOJournalView(mMainView->calendar(),mMainView->viewStack(), | 533 | mJournalView = new KOJournalView(mMainView->calendar(),mMainView->viewStack(), |
532 | "KOViewManager::JournalView"); | 534 | "KOViewManager::JournalView"); |
533 | connect( mMainView, SIGNAL( configChanged() ), mJournalView, | 535 | connect( mMainView, SIGNAL( configChanged() ), mJournalView, |
534 | SLOT( updateConfig() ) ); | 536 | SLOT( updateConfig() ) ); |
535 | connect(mJournalView, SIGNAL(deleteJournal(Journal *) ), mMainView,SLOT(deleteJournal(Journal *)) ); | 537 | connect(mJournalView, SIGNAL(deleteJournal(Journal *) ), mMainView,SLOT(deleteJournal(Journal *)) ); |
536 | addView(mJournalView); | 538 | addView(mJournalView); |
537 | } | 539 | } |
538 | 540 | ||
539 | showView(mJournalView); | 541 | showView(mJournalView); |
540 | } | 542 | } |
541 | 543 | ||
542 | void KOViewManager::showTimeSpanView() | 544 | void KOViewManager::showTimeSpanView() |
543 | { | 545 | { |
544 | //mFlagShowNextxDays = false; | 546 | //mFlagShowNextxDays = false; |
545 | if (!mTimeSpanView) { | 547 | if (!mTimeSpanView) { |
546 | mTimeSpanView = new KOTimeSpanView(mMainView->calendar(),mMainView->viewStack(), | 548 | mTimeSpanView = new KOTimeSpanView(mMainView->calendar(),mMainView->viewStack(), |
547 | "KOViewManager::TimeSpanView"); | 549 | "KOViewManager::TimeSpanView"); |
548 | addView(mTimeSpanView); | 550 | addView(mTimeSpanView); |
549 | 551 | ||
550 | mTimeSpanView->readSettings(); | 552 | mTimeSpanView->readSettings(); |
551 | } | 553 | } |
552 | 554 | ||
553 | showView(mTimeSpanView); | 555 | showView(mTimeSpanView); |
554 | } | 556 | } |
555 | 557 | ||
556 | Incidence *KOViewManager::currentSelection() | 558 | Incidence *KOViewManager::currentSelection() |
557 | { | 559 | { |
558 | if (!mCurrentView) return 0; | 560 | if (!mCurrentView) return 0; |
559 | if ( mCurrentView == mListView ) { | 561 | if ( mCurrentView == mListView ) { |
560 | if ( mListView->currentItem() ) | 562 | if ( mListView->currentItem() ) |
561 | return mListView->currentItem(); | 563 | return mListView->currentItem(); |
562 | } | 564 | } |
563 | return mCurrentView->selectedIncidences().first(); | 565 | return mCurrentView->selectedIncidences().first(); |
564 | } | 566 | } |
565 | 567 | ||
566 | QDate KOViewManager::currentSelectionDate() | 568 | QDate KOViewManager::currentSelectionDate() |
567 | { | 569 | { |
568 | QDate qd; | 570 | QDate qd; |
569 | if (mCurrentView) { | 571 | if (mCurrentView) { |
570 | DateList qvl = mCurrentView->selectedDates(); | 572 | DateList qvl = mCurrentView->selectedDates(); |
571 | if (!qvl.isEmpty()) qd = qvl.first(); | 573 | if (!qvl.isEmpty()) qd = qvl.first(); |
572 | } | 574 | } |
573 | return qd; | 575 | return qd; |
574 | } | 576 | } |
575 | 577 | ||
576 | void KOViewManager::addView(KOrg::BaseView *view) | 578 | void KOViewManager::addView(KOrg::BaseView *view) |
577 | { | 579 | { |
578 | #if QT_VERSION >= 0x030000 | 580 | #if QT_VERSION >= 0x030000 |
579 | mMainView->viewStack()->addWidget( view ); | 581 | mMainView->viewStack()->addWidget( view ); |
580 | #else | 582 | #else |
581 | mMainView->viewStack()->addWidget( view, 1 ); | 583 | mMainView->viewStack()->addWidget( view, 1 ); |
582 | #endif | 584 | #endif |
583 | } | 585 | } |
584 | 586 | ||
585 | void KOViewManager::setDocumentId( const QString &id ) | 587 | void KOViewManager::setDocumentId( const QString &id ) |
586 | { | 588 | { |
587 | if (mTodoView) mTodoView->setDocumentId( id ); | 589 | if (mTodoView) mTodoView->setDocumentId( id ); |
588 | } | 590 | } |
diff --git a/korganizer/koviewmanager.h b/korganizer/koviewmanager.h index 3c251fb..c8c7a7a 100644 --- a/korganizer/koviewmanager.h +++ b/korganizer/koviewmanager.h | |||
@@ -1,115 +1,117 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 | 3 | Copyright (c) 2001 |
4 | Cornelius Schumacher <schumacher@kde.org> | 4 | Cornelius Schumacher <schumacher@kde.org> |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
7 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
8 | the Free Software Foundation; either version 2 of the License, or | 8 | the Free Software Foundation; either version 2 of the License, or |
9 | (at your option) any later version. | 9 | (at your option) any later version. |
10 | 10 | ||
11 | This program is distributed in the hope that it will be useful, | 11 | This program is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public License | 16 | You should have received a copy of the GNU General Public License |
17 | along with this program; if not, write to the Free Software | 17 | along with this program; if not, write to the Free Software |
18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
19 | 19 | ||
20 | As a special exception, permission is given to link this program | 20 | As a special exception, permission is given to link this program |
21 | with any edition of Qt, and distribute the resulting executable, | 21 | with any edition of Qt, and distribute the resulting executable, |
22 | without including the source code for Qt in the source distribution. | 22 | without including the source code for Qt in the source distribution. |
23 | */ | 23 | */ |
24 | #ifndef KOVIEWMANAGER_H | 24 | #ifndef KOVIEWMANAGER_H |
25 | #define KOVIEWMANAGER_H | 25 | #define KOVIEWMANAGER_H |
26 | 26 | ||
27 | #include <qobject.h> | 27 | #include <qobject.h> |
28 | 28 | ||
29 | #include <korganizer/baseview.h> | 29 | #include <korganizer/baseview.h> |
30 | 30 | ||
31 | class CalendarView; | 31 | class CalendarView; |
32 | 32 | ||
33 | class KOListView; | 33 | class KOListView; |
34 | class KOAgendaView; | 34 | class KOAgendaView; |
35 | class KOMonthView; | 35 | class KOMonthView; |
36 | class KOTimeSpanView; | 36 | class KOTimeSpanView; |
37 | class KOTodoView; | 37 | class KOTodoView; |
38 | class KOWhatsNextView; | 38 | class KOWhatsNextView; |
39 | class KOJournalView; | 39 | class KOJournalView; |
40 | 40 | ||
41 | using namespace KCal; | 41 | using namespace KCal; |
42 | 42 | ||
43 | /** | 43 | /** |
44 | This class manages the views of the calendar. It owns the objects and handles | 44 | This class manages the views of the calendar. It owns the objects and handles |
45 | creation and selection. | 45 | creation and selection. |
46 | */ | 46 | */ |
47 | class KOViewManager : public QObject | 47 | class KOViewManager : public QObject |
48 | { | 48 | { |
49 | Q_OBJECT | 49 | Q_OBJECT |
50 | public: | 50 | public: |
51 | KOViewManager( CalendarView * ); | 51 | KOViewManager( CalendarView * ); |
52 | virtual ~KOViewManager(); | 52 | virtual ~KOViewManager(); |
53 | 53 | ||
54 | /** changes the view to be the currently selected view */ | 54 | /** changes the view to be the currently selected view */ |
55 | void showView(KOrg::BaseView *, bool fullScreen = false ); | 55 | void showView(KOrg::BaseView *, bool fullScreen = false ); |
56 | void updateWNview(); | 56 | void updateWNview(); |
57 | void readSettings(KConfig *config); | 57 | void readSettings(KConfig *config); |
58 | void writeSettings(KConfig *config); | 58 | void writeSettings(KConfig *config); |
59 | bool showsNextDays(); | 59 | bool showsNextDays(); |
60 | /** Read which view was shown last from config file */ | 60 | /** Read which view was shown last from config file */ |
61 | void readCurrentView(KConfig *); | 61 | void readCurrentView(KConfig *); |
62 | /** Write which view is currently shown to config file */ | 62 | /** Write which view is currently shown to config file */ |
63 | void writeCurrentView(KConfig *); | 63 | void writeCurrentView(KConfig *); |
64 | 64 | ||
65 | KOrg::BaseView *currentView(); | 65 | KOrg::BaseView *currentView(); |
66 | 66 | ||
67 | void setDocumentId( const QString & ); | 67 | void setDocumentId( const QString & ); |
68 | 68 | ||
69 | void updateView( const QDate &start, const QDate &end ); | 69 | void updateView( const QDate &start, const QDate &end ); |
70 | 70 | ||
71 | void raiseCurrentView( bool fullScreen = false ); | 71 | void raiseCurrentView( bool fullScreen = false ); |
72 | 72 | ||
73 | void addView(KOrg::BaseView *); | 73 | void addView(KOrg::BaseView *); |
74 | 74 | ||
75 | Incidence *currentSelection(); | 75 | Incidence *currentSelection(); |
76 | QDate currentSelectionDate(); | 76 | QDate currentSelectionDate(); |
77 | 77 | ||
78 | KOAgendaView *agendaView() const { return mAgendaView; } | 78 | KOAgendaView *agendaView() const { return mAgendaView; } |
79 | 79 | ||
80 | signals: | 80 | signals: |
81 | void printWNV(); | 81 | void printWNV(); |
82 | void signalFullScreen( bool ); | ||
83 | void signalAgendaView( bool ); | ||
82 | public slots: | 84 | public slots: |
83 | void updateView(); | 85 | void updateView(); |
84 | void showWhatsNextView(); | 86 | void showWhatsNextView(); |
85 | void showListView(); | 87 | void showListView(); |
86 | void showAgendaView( bool fullScreen = false ); | 88 | void showAgendaView( bool fullScreen = false ); |
87 | void showDayView(); | 89 | void showDayView(); |
88 | void showWorkWeekView(); | 90 | void showWorkWeekView(); |
89 | void showWeekView(); | 91 | void showWeekView(); |
90 | void showNextXView(); | 92 | void showNextXView(); |
91 | void showMonthView(); | 93 | void showMonthView(); |
92 | void showTodoView(); | 94 | void showTodoView(); |
93 | void showJournalView(); | 95 | void showJournalView(); |
94 | void showTimeSpanView(); | 96 | void showTimeSpanView(); |
95 | 97 | ||
96 | private: | 98 | private: |
97 | CalendarView *mMainView; | 99 | CalendarView *mMainView; |
98 | 100 | ||
99 | int mCurrentAgendaView; | 101 | int mCurrentAgendaView; |
100 | KOAgendaView *mAgendaView; | 102 | KOAgendaView *mAgendaView; |
101 | KOListView *mListView; | 103 | KOListView *mListView; |
102 | KOMonthView *mMonthView; | 104 | KOMonthView *mMonthView; |
103 | KOTodoView *mTodoView; | 105 | KOTodoView *mTodoView; |
104 | KOWhatsNextView *mWhatsNextView; | 106 | KOWhatsNextView *mWhatsNextView; |
105 | KOJournalView *mJournalView; | 107 | KOJournalView *mJournalView; |
106 | KOTimeSpanView *mTimeSpanView; | 108 | KOTimeSpanView *mTimeSpanView; |
107 | 109 | ||
108 | KOrg::BaseView *mCurrentView; // currently active event view | 110 | KOrg::BaseView *mCurrentView; // currently active event view |
109 | 111 | ||
110 | int mAgendaViewMode; | 112 | int mAgendaViewMode; |
111 | bool mFlagShowNextxDays; | 113 | bool mFlagShowNextxDays; |
112 | 114 | ||
113 | }; | 115 | }; |
114 | 116 | ||
115 | #endif | 117 | #endif |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 877b6f2..145b36c 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -1,1914 +1,1919 @@ | |||
1 | #include <stdlib.h> | 1 | #include <stdlib.h> |
2 | 2 | ||
3 | #include <qaction.h> | 3 | #include <qaction.h> |
4 | #include <qpopupmenu.h> | 4 | #include <qpopupmenu.h> |
5 | #include <qpainter.h> | 5 | #include <qpainter.h> |
6 | #include <qwhatsthis.h> | 6 | #include <qwhatsthis.h> |
7 | #include <qpushbutton.h> | 7 | #include <qpushbutton.h> |
8 | #include <qmessagebox.h> | 8 | #include <qmessagebox.h> |
9 | #include <qlineedit.h> | 9 | #include <qlineedit.h> |
10 | #include <qtextcodec.h> | 10 | #include <qtextcodec.h> |
11 | #include <qfile.h> | 11 | #include <qfile.h> |
12 | #include <qdir.h> | 12 | #include <qdir.h> |
13 | #include <qapp.h> | 13 | #include <qapp.h> |
14 | #include <qfileinfo.h> | 14 | #include <qfileinfo.h> |
15 | #include <qlabel.h> | 15 | #include <qlabel.h> |
16 | #include <qspinbox.h> | 16 | #include <qspinbox.h> |
17 | #include <qcheckbox.h> | 17 | #include <qcheckbox.h> |
18 | #include <qmap.h> | 18 | #include <qmap.h> |
19 | #include <qwmatrix.h> | 19 | #include <qwmatrix.h> |
20 | #include <qtextbrowser.h> | 20 | #include <qtextbrowser.h> |
21 | #include <qtextstream.h> | 21 | #include <qtextstream.h> |
22 | #ifndef DESKTOP_VERSION | 22 | #ifndef DESKTOP_VERSION |
23 | #include <qpe/global.h> | 23 | #include <qpe/global.h> |
24 | #include <qpe/qpemenubar.h> | 24 | #include <qpe/qpemenubar.h> |
25 | #include <qpe/qpetoolbar.h> | 25 | #include <qpe/qpetoolbar.h> |
26 | #include <qpe/resource.h> | 26 | #include <qpe/resource.h> |
27 | #include <qpe/qpeapplication.h> | 27 | #include <qpe/qpeapplication.h> |
28 | #include <qtopia/alarmserver.h> | 28 | #include <qtopia/alarmserver.h> |
29 | #include <qtopia/qcopenvelope_qws.h> | 29 | #include <qtopia/qcopenvelope_qws.h> |
30 | #include <unistd.h> // for sleep | 30 | #include <unistd.h> // for sleep |
31 | #else | 31 | #else |
32 | #include <qmenubar.h> | 32 | #include <qmenubar.h> |
33 | #include <qtoolbar.h> | 33 | #include <qtoolbar.h> |
34 | #include <qapplication.h> | 34 | #include <qapplication.h> |
35 | //#include <resource.h> | 35 | //#include <resource.h> |
36 | 36 | ||
37 | #endif | 37 | #endif |
38 | #include <libkcal/calendarlocal.h> | 38 | #include <libkcal/calendarlocal.h> |
39 | #include <libkcal/todo.h> | 39 | #include <libkcal/todo.h> |
40 | #include <libkcal/phoneformat.h> | 40 | #include <libkcal/phoneformat.h> |
41 | #include <libkdepim/ksyncprofile.h> | 41 | #include <libkdepim/ksyncprofile.h> |
42 | #include <libkdepim/phoneaccess.h> | 42 | #include <libkdepim/phoneaccess.h> |
43 | #include <libkcal/kincidenceformatter.h> | 43 | #include <libkcal/kincidenceformatter.h> |
44 | #include <libkdepim/kpimglobalprefs.h> | 44 | #include <libkdepim/kpimglobalprefs.h> |
45 | 45 | ||
46 | #include "calendarview.h" | 46 | #include "calendarview.h" |
47 | #include "koviewmanager.h" | 47 | #include "koviewmanager.h" |
48 | #include "datenavigator.h" | 48 | #include "datenavigator.h" |
49 | #include "koagendaview.h" | 49 | #include "koagendaview.h" |
50 | #include "koagenda.h" | 50 | #include "koagenda.h" |
51 | #include "kodialogmanager.h" | 51 | #include "kodialogmanager.h" |
52 | #include "kdialogbase.h" | 52 | #include "kdialogbase.h" |
53 | #include "kapplication.h" | 53 | #include "kapplication.h" |
54 | #include "kofilterview.h" | 54 | #include "kofilterview.h" |
55 | #include "kstandarddirs.h" | 55 | #include "kstandarddirs.h" |
56 | #include "koprefs.h" | 56 | #include "koprefs.h" |
57 | #include "kfiledialog.h" | 57 | #include "kfiledialog.h" |
58 | #include "koglobals.h" | 58 | #include "koglobals.h" |
59 | #include "kglobal.h" | 59 | #include "kglobal.h" |
60 | #include "klocale.h" | 60 | #include "klocale.h" |
61 | #include "kconfig.h" | 61 | #include "kconfig.h" |
62 | #include "simplealarmclient.h" | 62 | #include "simplealarmclient.h" |
63 | #include "externalapphandler.h" | 63 | #include "externalapphandler.h" |
64 | 64 | ||
65 | using namespace KCal; | 65 | using namespace KCal; |
66 | #ifndef _WIN32_ | 66 | #ifndef _WIN32_ |
67 | #include <unistd.h> | 67 | #include <unistd.h> |
68 | #else | 68 | #else |
69 | #ifdef _OL_IMPORT_ | 69 | #ifdef _OL_IMPORT_ |
70 | #include "koimportoldialog.h" | 70 | #include "koimportoldialog.h" |
71 | #endif | 71 | #endif |
72 | #endif | 72 | #endif |
73 | #include "mainwindow.h" | 73 | #include "mainwindow.h" |
74 | 74 | ||
75 | class KOex2phonePrefs : public QDialog | 75 | class KOex2phonePrefs : public QDialog |
76 | { | 76 | { |
77 | public: | 77 | public: |
78 | KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : | 78 | KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : |
79 | QDialog( parent, name, true ) | 79 | QDialog( parent, name, true ) |
80 | { | 80 | { |
81 | setCaption( i18n("Export to phone options") ); | 81 | setCaption( i18n("Export to phone options") ); |
82 | QVBoxLayout* lay = new QVBoxLayout( this ); | 82 | QVBoxLayout* lay = new QVBoxLayout( this ); |
83 | lay->setSpacing( 3 ); | 83 | lay->setSpacing( 3 ); |
84 | lay->setMargin( 3 ); | 84 | lay->setMargin( 3 ); |
85 | QLabel *lab; | 85 | QLabel *lab; |
86 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); | 86 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); |
87 | lab->setAlignment (AlignHCenter ); | 87 | lab->setAlignment (AlignHCenter ); |
88 | QHBox* temphb; | 88 | QHBox* temphb; |
89 | temphb = new QHBox( this ); | 89 | temphb = new QHBox( this ); |
90 | new QLabel( i18n("I/O device: "), temphb ); | 90 | new QLabel( i18n("I/O device: "), temphb ); |
91 | mPhoneDevice = new QLineEdit( temphb); | 91 | mPhoneDevice = new QLineEdit( temphb); |
92 | lay->addWidget( temphb ); | 92 | lay->addWidget( temphb ); |
93 | temphb = new QHBox( this ); | 93 | temphb = new QHBox( this ); |
94 | new QLabel( i18n("Connection: "), temphb ); | 94 | new QLabel( i18n("Connection: "), temphb ); |
95 | mPhoneConnection = new QLineEdit( temphb); | 95 | mPhoneConnection = new QLineEdit( temphb); |
96 | lay->addWidget( temphb ); | 96 | lay->addWidget( temphb ); |
97 | temphb = new QHBox( this ); | 97 | temphb = new QHBox( this ); |
98 | new QLabel( i18n("Model(opt.): "), temphb ); | 98 | new QLabel( i18n("Model(opt.): "), temphb ); |
99 | mPhoneModel = new QLineEdit( temphb); | 99 | mPhoneModel = new QLineEdit( temphb); |
100 | lay->addWidget( temphb ); | 100 | lay->addWidget( temphb ); |
101 | mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); | 101 | mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); |
102 | mWriteBackFuture->setChecked( true ); | 102 | mWriteBackFuture->setChecked( true ); |
103 | lay->addWidget( mWriteBackFuture ); | 103 | lay->addWidget( mWriteBackFuture ); |
104 | temphb = new QHBox( this ); | 104 | temphb = new QHBox( this ); |
105 | new QLabel( i18n("Max. weeks in future: ") , temphb ); | 105 | new QLabel( i18n("Max. weeks in future: ") , temphb ); |
106 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); | 106 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); |
107 | mWriteBackFutureWeeks->setValue( 8 ); | 107 | mWriteBackFutureWeeks->setValue( 8 ); |
108 | lay->addWidget( temphb ); | 108 | lay->addWidget( temphb ); |
109 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); | 109 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); |
110 | lab->setAlignment (AlignHCenter ); | 110 | lab->setAlignment (AlignHCenter ); |
111 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); | 111 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); |
112 | lay->addWidget( ok ); | 112 | lay->addWidget( ok ); |
113 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 113 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
114 | lay->addWidget( cancel ); | 114 | lay->addWidget( cancel ); |
115 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 115 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
116 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 116 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
117 | resize( 220, 240 ); | 117 | resize( 220, 240 ); |
118 | qApp->processEvents(); | 118 | qApp->processEvents(); |
119 | int dw = QApplication::desktop()->width(); | 119 | int dw = QApplication::desktop()->width(); |
120 | int dh = QApplication::desktop()->height(); | 120 | int dh = QApplication::desktop()->height(); |
121 | move( (dw-width())/2, (dh - height() )/2 ); | 121 | move( (dw-width())/2, (dh - height() )/2 ); |
122 | } | 122 | } |
123 | 123 | ||
124 | public: | 124 | public: |
125 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; | 125 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; |
126 | QCheckBox* mWriteBackFuture; | 126 | QCheckBox* mWriteBackFuture; |
127 | QSpinBox* mWriteBackFutureWeeks; | 127 | QSpinBox* mWriteBackFutureWeeks; |
128 | }; | 128 | }; |
129 | 129 | ||
130 | int globalFlagBlockStartup; | 130 | int globalFlagBlockStartup; |
131 | MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : | 131 | MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : |
132 | QMainWindow( parent, name ) | 132 | QMainWindow( parent, name ) |
133 | { | 133 | { |
134 | 134 | ||
135 | #ifdef DESKTOP_VERSION | 135 | #ifdef DESKTOP_VERSION |
136 | setFont( QFont("Arial"), 14 ); | 136 | setFont( QFont("Arial"), 14 ); |
137 | #endif | 137 | #endif |
138 | mClosed = false; | 138 | mClosed = false; |
139 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; | 139 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; |
140 | QString confFile = locateLocal("config","korganizerrc"); | 140 | QString confFile = locateLocal("config","korganizerrc"); |
141 | QFileInfo finf ( confFile ); | 141 | QFileInfo finf ( confFile ); |
142 | bool showWarning = !finf.exists(); | 142 | bool showWarning = !finf.exists(); |
143 | setIcon(SmallIcon( "ko24" ) ); | 143 | setIcon(SmallIcon( "ko24" ) ); |
144 | mBlockAtStartup = true; | 144 | mBlockAtStartup = true; |
145 | mFlagKeyPressed = false; | 145 | mFlagKeyPressed = false; |
146 | setCaption("KOrganizer/Pi"); | 146 | setCaption("KOrganizer/Pi"); |
147 | KOPrefs *p = KOPrefs::instance(); | 147 | KOPrefs *p = KOPrefs::instance(); |
148 | KPimGlobalPrefs::instance()->setGlobalConfig(); | 148 | KPimGlobalPrefs::instance()->setGlobalConfig(); |
149 | if ( p->mHourSize > 18 ) | 149 | if ( p->mHourSize > 18 ) |
150 | p->mHourSize = 18; | 150 | p->mHourSize = 18; |
151 | QMainWindow::ToolBarDock tbd; | 151 | QMainWindow::ToolBarDock tbd; |
152 | if ( p->mToolBarHor ) { | 152 | if ( p->mToolBarHor ) { |
153 | if ( p->mToolBarUp ) | 153 | if ( p->mToolBarUp ) |
154 | tbd = Bottom; | 154 | tbd = Bottom; |
155 | else | 155 | else |
156 | tbd = Top; | 156 | tbd = Top; |
157 | } | 157 | } |
158 | else { | 158 | else { |
159 | if ( p->mToolBarUp ) | 159 | if ( p->mToolBarUp ) |
160 | tbd = Right; | 160 | tbd = Right; |
161 | else | 161 | else |
162 | tbd = Left; | 162 | tbd = Left; |
163 | } | 163 | } |
164 | if ( KOPrefs::instance()->mUseAppColors ) | 164 | if ( KOPrefs::instance()->mUseAppColors ) |
165 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 165 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
166 | globalFlagBlockStartup = 1; | 166 | globalFlagBlockStartup = 1; |
167 | iconToolBar = new QPEToolBar( this ); | 167 | iconToolBar = new QPEToolBar( this ); |
168 | addToolBar (iconToolBar , tbd ); | 168 | addToolBar (iconToolBar , tbd ); |
169 | mCalendarModifiedFlag = false; | 169 | mCalendarModifiedFlag = false; |
170 | 170 | ||
171 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); | 171 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); |
172 | splash->setAlignment ( AlignCenter ); | 172 | splash->setAlignment ( AlignCenter ); |
173 | setCentralWidget( splash ); | 173 | setCentralWidget( splash ); |
174 | #ifndef DESKTOP_VERSION | 174 | #ifndef DESKTOP_VERSION |
175 | showMaximized(); | 175 | showMaximized(); |
176 | #endif | 176 | #endif |
177 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); | 177 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); |
178 | setDefaultPreferences(); | 178 | setDefaultPreferences(); |
179 | mCalendar = new CalendarLocal(); | 179 | mCalendar = new CalendarLocal(); |
180 | mView = new CalendarView( mCalendar, this,"mCalendar " ); | 180 | mView = new CalendarView( mCalendar, this,"mCalendar " ); |
181 | mView->hide(); | 181 | mView->hide(); |
182 | //mView->resize(splash->size() ); | 182 | //mView->resize(splash->size() ); |
183 | initActions(); | 183 | initActions(); |
184 | mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); | 184 | mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); |
185 | mSyncManager->setBlockSave(false); | 185 | mSyncManager->setBlockSave(false); |
186 | mView->setSyncManager(mSyncManager); | 186 | mView->setSyncManager(mSyncManager); |
187 | #ifndef DESKTOP_VERSION | 187 | #ifndef DESKTOP_VERSION |
188 | iconToolBar->show(); | 188 | iconToolBar->show(); |
189 | qApp->processEvents(); | 189 | qApp->processEvents(); |
190 | #endif | 190 | #endif |
191 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); | 191 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); |
192 | int vh = height() ; | 192 | int vh = height() ; |
193 | int vw = width(); | 193 | int vw = width(); |
194 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); | 194 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); |
195 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { | 195 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { |
196 | vh -= iconToolBar->height(); | 196 | vh -= iconToolBar->height(); |
197 | } else { | 197 | } else { |
198 | vw -= iconToolBar->height(); | 198 | vw -= iconToolBar->height(); |
199 | } | 199 | } |
200 | //mView->setMaximumSize( splash->size() ); | 200 | //mView->setMaximumSize( splash->size() ); |
201 | //mView->resize( splash->size() ); | 201 | //mView->resize( splash->size() ); |
202 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 202 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
203 | mView->readSettings(); | 203 | mView->readSettings(); |
204 | bool newFile = false; | 204 | bool newFile = false; |
205 | if( !QFile::exists( defaultFileName() ) ) { | 205 | if( !QFile::exists( defaultFileName() ) ) { |
206 | QFileInfo finfo ( defaultFileName() ); | 206 | QFileInfo finfo ( defaultFileName() ); |
207 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); | 207 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); |
208 | qDebug("oldfile %s ", oldFile.latin1()); | 208 | qDebug("oldfile %s ", oldFile.latin1()); |
209 | QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; | 209 | QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; |
210 | finfo.setFile( oldFile ); | 210 | finfo.setFile( oldFile ); |
211 | if (finfo.exists() ) { | 211 | if (finfo.exists() ) { |
212 | KMessageBox::information( this, message); | 212 | KMessageBox::information( this, message); |
213 | mView->openCalendar( oldFile ); | 213 | mView->openCalendar( oldFile ); |
214 | qApp->processEvents(); | 214 | qApp->processEvents(); |
215 | } else { | 215 | } else { |
216 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); | 216 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); |
217 | finfo.setFile( oldFile ); | 217 | finfo.setFile( oldFile ); |
218 | if (finfo.exists() ) { | 218 | if (finfo.exists() ) { |
219 | KMessageBox::information( this, message); | 219 | KMessageBox::information( this, message); |
220 | mView->openCalendar( oldFile ); | 220 | mView->openCalendar( oldFile ); |
221 | qApp->processEvents(); | 221 | qApp->processEvents(); |
222 | } | 222 | } |
223 | } | 223 | } |
224 | mView->saveCalendar( defaultFileName() ); | 224 | mView->saveCalendar( defaultFileName() ); |
225 | newFile = true; | 225 | newFile = true; |
226 | } | 226 | } |
227 | 227 | ||
228 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 228 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
229 | mView->openCalendar( defaultFileName() ); | 229 | mView->openCalendar( defaultFileName() ); |
230 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 230 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
231 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); | 231 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); |
232 | 232 | ||
233 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { | 233 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { |
234 | KOPrefs::instance()->setCategoryDefaults(); | 234 | KOPrefs::instance()->setCategoryDefaults(); |
235 | int count = mView->addCategories(); | 235 | int count = mView->addCategories(); |
236 | } | 236 | } |
237 | processIncidenceSelection( 0 ); | 237 | processIncidenceSelection( 0 ); |
238 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), | 238 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), |
239 | SLOT( processIncidenceSelection( Incidence * ) ) ); | 239 | SLOT( processIncidenceSelection( Incidence * ) ) ); |
240 | connect( mView, SIGNAL( modifiedChanged( bool ) ), | 240 | connect( mView, SIGNAL( modifiedChanged( bool ) ), |
241 | SLOT( slotModifiedChanged( bool ) ) ); | 241 | SLOT( slotModifiedChanged( bool ) ) ); |
242 | 242 | ||
243 | 243 | ||
244 | connect( mView, SIGNAL( tempDisableBR(bool) ), | 244 | connect( mView, SIGNAL( tempDisableBR(bool) ), |
245 | SLOT( disableBR(bool) ) ); | 245 | SLOT( disableBR(bool) ) ); |
246 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); | 246 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); |
247 | mView->setModified( false ); | 247 | mView->setModified( false ); |
248 | mBlockAtStartup = false; | 248 | mBlockAtStartup = false; |
249 | mView->setModified( false ); | 249 | mView->setModified( false ); |
250 | setCentralWidget( mView ); | 250 | setCentralWidget( mView ); |
251 | globalFlagBlockStartup = 0; | 251 | globalFlagBlockStartup = 0; |
252 | mView->show(); | 252 | mView->show(); |
253 | delete splash; | 253 | delete splash; |
254 | if ( newFile ) | 254 | if ( newFile ) |
255 | mView->updateConfig(); | 255 | mView->updateConfig(); |
256 | // qApp->processEvents(); | 256 | // qApp->processEvents(); |
257 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 257 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
258 | //fillSyncMenu(); | 258 | //fillSyncMenu(); |
259 | 259 | ||
260 | 260 | ||
261 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); | 261 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); |
262 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); | 262 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); |
263 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); | 263 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); |
264 | mSyncManager->setDefaultFileName( defaultFileName()); | 264 | mSyncManager->setDefaultFileName( defaultFileName()); |
265 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); | 265 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); |
266 | mSyncManager->fillSyncMenu(); | 266 | mSyncManager->fillSyncMenu(); |
267 | 267 | ||
268 | 268 | ||
269 | 269 | ||
270 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); | 270 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); |
271 | if ( showWarning ) { | 271 | if ( showWarning ) { |
272 | KMessageBox::information( this, | 272 | KMessageBox::information( this, |
273 | "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); | 273 | "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); |
274 | qApp->processEvents(); | 274 | qApp->processEvents(); |
275 | mView->dialogManager()->showSyncOptions(); | 275 | mView->dialogManager()->showSyncOptions(); |
276 | } | 276 | } |
277 | 277 | ||
278 | //US listen for result adressed from Ka/Pi | 278 | //US listen for result adressed from Ka/Pi |
279 | #ifndef DESKTOP_VERSION | 279 | #ifndef DESKTOP_VERSION |
280 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); | 280 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); |
281 | #endif | 281 | #endif |
282 | #ifndef DESKTOP_VERSION | 282 | #ifndef DESKTOP_VERSION |
283 | infrared = 0; | 283 | infrared = 0; |
284 | #endif | 284 | #endif |
285 | 285 | ||
286 | mBRdisabled = false; | 286 | mBRdisabled = false; |
287 | //toggleBeamReceive(); | 287 | //toggleBeamReceive(); |
288 | } | 288 | } |
289 | MainWindow::~MainWindow() | 289 | MainWindow::~MainWindow() |
290 | { | 290 | { |
291 | //qDebug("MainWindow::~MainWindow() "); | 291 | //qDebug("MainWindow::~MainWindow() "); |
292 | //save toolbar location | 292 | //save toolbar location |
293 | delete mCalendar; | 293 | delete mCalendar; |
294 | delete mSyncManager; | 294 | delete mSyncManager; |
295 | #ifndef DESKTOP_VERSION | 295 | #ifndef DESKTOP_VERSION |
296 | if ( infrared ) | 296 | if ( infrared ) |
297 | delete infrared; | 297 | delete infrared; |
298 | #endif | 298 | #endif |
299 | 299 | ||
300 | 300 | ||
301 | } | 301 | } |
302 | 302 | ||
303 | void MainWindow::disableBR(bool b) | 303 | void MainWindow::disableBR(bool b) |
304 | { | 304 | { |
305 | #ifndef DESKTOP_VERSION | 305 | #ifndef DESKTOP_VERSION |
306 | if ( b ) { | 306 | if ( b ) { |
307 | if ( infrared ) { | 307 | if ( infrared ) { |
308 | toggleBeamReceive(); | 308 | toggleBeamReceive(); |
309 | mBRdisabled = true; | 309 | mBRdisabled = true; |
310 | } | 310 | } |
311 | mBRdisabled = true; | 311 | mBRdisabled = true; |
312 | } else { | 312 | } else { |
313 | if ( mBRdisabled ) { | 313 | if ( mBRdisabled ) { |
314 | mBRdisabled = false; | 314 | mBRdisabled = false; |
315 | //makes no sense,because other cal ap is probably running | 315 | //makes no sense,because other cal ap is probably running |
316 | // toggleBeamReceive(); | 316 | // toggleBeamReceive(); |
317 | } | 317 | } |
318 | } | 318 | } |
319 | #endif | 319 | #endif |
320 | 320 | ||
321 | } | 321 | } |
322 | bool MainWindow::beamReceiveEnabled() | 322 | bool MainWindow::beamReceiveEnabled() |
323 | { | 323 | { |
324 | #ifndef DESKTOP_VERSION | 324 | #ifndef DESKTOP_VERSION |
325 | return ( infrared != 0 ); | 325 | return ( infrared != 0 ); |
326 | #endif | 326 | #endif |
327 | return false; | 327 | return false; |
328 | } | 328 | } |
329 | 329 | ||
330 | void MainWindow::toggleBeamReceive() | 330 | void MainWindow::toggleBeamReceive() |
331 | { | 331 | { |
332 | if ( mBRdisabled ) | 332 | if ( mBRdisabled ) |
333 | return; | 333 | return; |
334 | #ifndef DESKTOP_VERSION | 334 | #ifndef DESKTOP_VERSION |
335 | if ( infrared ) { | 335 | if ( infrared ) { |
336 | qDebug("disable BeamReceive "); | 336 | qDebug("disable BeamReceive "); |
337 | delete infrared; | 337 | delete infrared; |
338 | infrared = 0; | 338 | infrared = 0; |
339 | brAction->setOn(false); | 339 | brAction->setOn(false); |
340 | return; | 340 | return; |
341 | } | 341 | } |
342 | qDebug("enable BeamReceive "); | 342 | qDebug("enable BeamReceive "); |
343 | brAction->setOn(true); | 343 | brAction->setOn(true); |
344 | infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; | 344 | infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; |
345 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); | 345 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); |
346 | #endif | 346 | #endif |
347 | } | 347 | } |
348 | void MainWindow::showMaximized () | 348 | void MainWindow::showMaximized () |
349 | { | 349 | { |
350 | #ifndef DESKTOP_VERSION | 350 | #ifndef DESKTOP_VERSION |
351 | if ( ! globalFlagBlockStartup ) | 351 | if ( ! globalFlagBlockStartup ) |
352 | if ( mClosed ) | 352 | if ( mClosed ) |
353 | mView->goToday(); | 353 | mView->goToday(); |
354 | #endif | 354 | #endif |
355 | QWidget::showMaximized () ; | 355 | QWidget::showMaximized () ; |
356 | mClosed = false; | 356 | mClosed = false; |
357 | } | 357 | } |
358 | void MainWindow::closeEvent( QCloseEvent* ce ) | 358 | void MainWindow::closeEvent( QCloseEvent* ce ) |
359 | { | 359 | { |
360 | 360 | ||
361 | 361 | ||
362 | 362 | ||
363 | if ( ! KOPrefs::instance()->mAskForQuit ) { | 363 | if ( ! KOPrefs::instance()->mAskForQuit ) { |
364 | saveOnClose(); | 364 | saveOnClose(); |
365 | mClosed = true; | 365 | mClosed = true; |
366 | ce->accept(); | 366 | ce->accept(); |
367 | return; | 367 | return; |
368 | 368 | ||
369 | } | 369 | } |
370 | 370 | ||
371 | switch( QMessageBox::information( this, "KO/Pi", | 371 | switch( QMessageBox::information( this, "KO/Pi", |
372 | i18n("Do you really want\nto close KO/Pi?"), | 372 | i18n("Do you really want\nto close KO/Pi?"), |
373 | i18n("Close"), i18n("No"), | 373 | i18n("Close"), i18n("No"), |
374 | 0, 0 ) ) { | 374 | 0, 0 ) ) { |
375 | case 0: | 375 | case 0: |
376 | saveOnClose(); | 376 | saveOnClose(); |
377 | mClosed = true; | 377 | mClosed = true; |
378 | ce->accept(); | 378 | ce->accept(); |
379 | break; | 379 | break; |
380 | case 1: | 380 | case 1: |
381 | ce->ignore(); | 381 | ce->ignore(); |
382 | break; | 382 | break; |
383 | case 2: | 383 | case 2: |
384 | 384 | ||
385 | default: | 385 | default: |
386 | break; | 386 | break; |
387 | } | 387 | } |
388 | 388 | ||
389 | 389 | ||
390 | } | 390 | } |
391 | 391 | ||
392 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) | 392 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) |
393 | { | 393 | { |
394 | QDataStream stream( data, IO_ReadOnly ); | 394 | QDataStream stream( data, IO_ReadOnly ); |
395 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); | 395 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); |
396 | //QString datamess; | 396 | //QString datamess; |
397 | //qDebug("message "); | 397 | //qDebug("message "); |
398 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); | 398 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); |
399 | 399 | ||
400 | if ( cmsg == "setDocument(QString)" ) { | 400 | if ( cmsg == "setDocument(QString)" ) { |
401 | QDataStream stream( data, IO_ReadOnly ); | 401 | QDataStream stream( data, IO_ReadOnly ); |
402 | QString fileName; | 402 | QString fileName; |
403 | stream >> fileName; | 403 | stream >> fileName; |
404 | //qDebug("filename %s ", fileName.latin1()); | 404 | //qDebug("filename %s ", fileName.latin1()); |
405 | showMaximized(); | 405 | showMaximized(); |
406 | raise(); | 406 | raise(); |
407 | KOPrefs::instance()->mLastSyncedLocalFile = fileName ; | 407 | KOPrefs::instance()->mLastSyncedLocalFile = fileName ; |
408 | mSyncManager->slotSyncMenu( 1002 ); | 408 | mSyncManager->slotSyncMenu( 1002 ); |
409 | return; | 409 | return; |
410 | } | 410 | } |
411 | 411 | ||
412 | if ( cmsg == "-writeFile" ) { | 412 | if ( cmsg == "-writeFile" ) { |
413 | // I made from the "-writeFile" an "-writeAlarm" | 413 | // I made from the "-writeFile" an "-writeAlarm" |
414 | mView->viewManager()->showWhatsNextView(); | 414 | mView->viewManager()->showWhatsNextView(); |
415 | mCalendar->checkAlarmForIncidence( 0, true); | 415 | mCalendar->checkAlarmForIncidence( 0, true); |
416 | showMaximized(); | 416 | showMaximized(); |
417 | raise(); | 417 | raise(); |
418 | return; | 418 | return; |
419 | 419 | ||
420 | } | 420 | } |
421 | if ( cmsg == "-writeFileSilent" ) { | 421 | if ( cmsg == "-writeFileSilent" ) { |
422 | // I made from the "-writeFile" an "-writeAlarm" | 422 | // I made from the "-writeFile" an "-writeAlarm" |
423 | // mView->viewManager()->showWhatsNextView(); | 423 | // mView->viewManager()->showWhatsNextView(); |
424 | mCalendar->checkAlarmForIncidence( 0, true); | 424 | mCalendar->checkAlarmForIncidence( 0, true); |
425 | //showMaximized(); | 425 | //showMaximized(); |
426 | //raise(); | 426 | //raise(); |
427 | hide(); | 427 | hide(); |
428 | return; | 428 | return; |
429 | } | 429 | } |
430 | if ( cmsg == "-newCountdown" ) { | 430 | if ( cmsg == "-newCountdown" ) { |
431 | qDebug("newCountdown "); | 431 | qDebug("newCountdown "); |
432 | 432 | ||
433 | } | 433 | } |
434 | QString msg ; | 434 | QString msg ; |
435 | QString allmsg = cmsg; | 435 | QString allmsg = cmsg; |
436 | while ( allmsg.length() > 0 ) { | 436 | while ( allmsg.length() > 0 ) { |
437 | int nextC = allmsg.find( "-", 1 ); | 437 | int nextC = allmsg.find( "-", 1 ); |
438 | if ( nextC == -1 ) { | 438 | if ( nextC == -1 ) { |
439 | msg = allmsg; | 439 | msg = allmsg; |
440 | allmsg = ""; | 440 | allmsg = ""; |
441 | } else{ | 441 | } else{ |
442 | msg = allmsg.left( nextC ); | 442 | msg = allmsg.left( nextC ); |
443 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); | 443 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); |
444 | } | 444 | } |
445 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); | 445 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); |
446 | if ( msg == "-newEvent" ) { | 446 | if ( msg == "-newEvent" ) { |
447 | mView->newEvent(); | 447 | mView->newEvent(); |
448 | } | 448 | } |
449 | if ( msg == "-newTodo" ) { | 449 | if ( msg == "-newTodo" ) { |
450 | mView->newTodo(); | 450 | mView->newTodo(); |
451 | 451 | ||
452 | } | 452 | } |
453 | if ( msg == "-showWN" ) { | 453 | if ( msg == "-showWN" ) { |
454 | mView->viewManager()->showWhatsNextView(); | 454 | mView->viewManager()->showWhatsNextView(); |
455 | } | 455 | } |
456 | if ( msg == "-showTodo" ) { | 456 | if ( msg == "-showTodo" ) { |
457 | mView->viewManager()->showTodoView(); | 457 | mView->viewManager()->showTodoView(); |
458 | } | 458 | } |
459 | if ( msg == "-showList" ) { | 459 | if ( msg == "-showList" ) { |
460 | mView->viewManager()->showListView(); | 460 | mView->viewManager()->showListView(); |
461 | } | 461 | } |
462 | else if ( msg == "-showDay" ) { | 462 | else if ( msg == "-showDay" ) { |
463 | mView->viewManager()->showDayView(); | 463 | mView->viewManager()->showDayView(); |
464 | } | 464 | } |
465 | else if ( msg == "-showWWeek" ) { | 465 | else if ( msg == "-showWWeek" ) { |
466 | mView->viewManager()->showWorkWeekView(); | 466 | mView->viewManager()->showWorkWeekView(); |
467 | } | 467 | } |
468 | else if ( msg == "-ringSync" ) { | 468 | else if ( msg == "-ringSync" ) { |
469 | mSyncManager->multiSync( false ); | 469 | mSyncManager->multiSync( false ); |
470 | } | 470 | } |
471 | else if ( msg == "-showWeek" ) { | 471 | else if ( msg == "-showWeek" ) { |
472 | mView->viewManager()->showWeekView(); | 472 | mView->viewManager()->showWeekView(); |
473 | } | 473 | } |
474 | else if ( msg == "-showTodo" ) { | 474 | else if ( msg == "-showTodo" ) { |
475 | mView->viewManager()->showTodoView(); | 475 | mView->viewManager()->showTodoView(); |
476 | } | 476 | } |
477 | else if ( msg == "-showJournal" ) { | 477 | else if ( msg == "-showJournal" ) { |
478 | mView->dateNavigator()->selectDates( 1 ); | 478 | mView->dateNavigator()->selectDates( 1 ); |
479 | mView->dateNavigator()->selectToday(); | 479 | mView->dateNavigator()->selectToday(); |
480 | mView->viewManager()->showJournalView(); | 480 | mView->viewManager()->showJournalView(); |
481 | } | 481 | } |
482 | else if ( msg == "-showKO" ) { | 482 | else if ( msg == "-showKO" ) { |
483 | mView->viewManager()->showNextXView(); | 483 | mView->viewManager()->showNextXView(); |
484 | } | 484 | } |
485 | else if ( msg == "-showWNext" || msg == "nextView()" ) { | 485 | else if ( msg == "-showWNext" || msg == "nextView()" ) { |
486 | mView->viewManager()->showWhatsNextView(); | 486 | mView->viewManager()->showWhatsNextView(); |
487 | } | 487 | } |
488 | else if ( msg == "-showNextXView" ) { | 488 | else if ( msg == "-showNextXView" ) { |
489 | mView->viewManager()->showNextXView(); | 489 | mView->viewManager()->showNextXView(); |
490 | } | 490 | } |
491 | 491 | ||
492 | 492 | ||
493 | } | 493 | } |
494 | 494 | ||
495 | showMaximized(); | 495 | showMaximized(); |
496 | raise(); | 496 | raise(); |
497 | } | 497 | } |
498 | 498 | ||
499 | QPixmap MainWindow::loadPixmap( QString name ) | 499 | QPixmap MainWindow::loadPixmap( QString name ) |
500 | { | 500 | { |
501 | return SmallIcon( name ); | 501 | return SmallIcon( name ); |
502 | 502 | ||
503 | } | 503 | } |
504 | void MainWindow::initActions() | 504 | void MainWindow::initActions() |
505 | { | 505 | { |
506 | //KOPrefs::instance()->mShowFullMenu | 506 | //KOPrefs::instance()->mShowFullMenu |
507 | iconToolBar->clear(); | 507 | iconToolBar->clear(); |
508 | KOPrefs *p = KOPrefs::instance(); | 508 | KOPrefs *p = KOPrefs::instance(); |
509 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); | 509 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); |
510 | 510 | ||
511 | QPopupMenu *viewMenu = new QPopupMenu( this ); | 511 | QPopupMenu *viewMenu = new QPopupMenu( this ); |
512 | QPopupMenu *actionMenu = new QPopupMenu( this ); | 512 | QPopupMenu *actionMenu = new QPopupMenu( this ); |
513 | QPopupMenu *importMenu = new QPopupMenu( this ); | 513 | QPopupMenu *importMenu = new QPopupMenu( this ); |
514 | selectFilterMenu = new QPopupMenu( this ); | 514 | selectFilterMenu = new QPopupMenu( this ); |
515 | selectFilterMenu->setCheckable( true ); | 515 | selectFilterMenu->setCheckable( true ); |
516 | syncMenu = new QPopupMenu( this ); | 516 | syncMenu = new QPopupMenu( this ); |
517 | configureAgendaMenu = new QPopupMenu( this ); | 517 | configureAgendaMenu = new QPopupMenu( this ); |
518 | configureToolBarMenu = new QPopupMenu( this ); | 518 | configureToolBarMenu = new QPopupMenu( this ); |
519 | QPopupMenu *helpMenu = new QPopupMenu( this ); | 519 | QPopupMenu *helpMenu = new QPopupMenu( this ); |
520 | if ( KOPrefs::instance()->mShowFullMenu ) { | 520 | if ( KOPrefs::instance()->mShowFullMenu ) { |
521 | QMenuBar *menuBar1; | 521 | QMenuBar *menuBar1; |
522 | menuBar1 = menuBar(); | 522 | menuBar1 = menuBar(); |
523 | menuBar1->insertItem( i18n("File"), importMenu ); | 523 | menuBar1->insertItem( i18n("File"), importMenu ); |
524 | menuBar1->insertItem( i18n("View"), viewMenu ); | 524 | menuBar1->insertItem( i18n("View"), viewMenu ); |
525 | menuBar1->insertItem( i18n("Actions"), actionMenu ); | 525 | menuBar1->insertItem( i18n("Actions"), actionMenu ); |
526 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); | 526 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); |
527 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 527 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
528 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 528 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
529 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); | 529 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); |
530 | menuBar1->insertItem( i18n("Help"), helpMenu ); | 530 | menuBar1->insertItem( i18n("Help"), helpMenu ); |
531 | } else { | 531 | } else { |
532 | QPEMenuBar *menuBar1; | 532 | QPEMenuBar *menuBar1; |
533 | menuBar1 = new QPEMenuBar( iconToolBar ); | 533 | menuBar1 = new QPEMenuBar( iconToolBar ); |
534 | QPopupMenu *menuBar = new QPopupMenu( this ); | 534 | QPopupMenu *menuBar = new QPopupMenu( this ); |
535 | menuBar1->insertItem( i18n("ME"), menuBar); | 535 | menuBar1->insertItem( i18n("ME"), menuBar); |
536 | menuBar->insertItem( i18n("File"), importMenu ); | 536 | menuBar->insertItem( i18n("File"), importMenu ); |
537 | menuBar->insertItem( i18n("View"), viewMenu ); | 537 | menuBar->insertItem( i18n("View"), viewMenu ); |
538 | menuBar->insertItem( i18n("Actions"), actionMenu ); | 538 | menuBar->insertItem( i18n("Actions"), actionMenu ); |
539 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); | 539 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); |
540 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 540 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
541 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 541 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
542 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); | 542 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); |
543 | menuBar->insertItem( i18n("Help"), helpMenu ); | 543 | menuBar->insertItem( i18n("Help"), helpMenu ); |
544 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); | 544 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); |
545 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); | 545 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); |
546 | } | 546 | } |
547 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); | 547 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); |
548 | connect ( selectFilterMenu, SIGNAL( aboutToShow () ), this, SLOT (fillFilterMenu() ) ); | 548 | connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); |
549 | 549 | ||
550 | // ****************** | 550 | // ****************** |
551 | QAction *action; | 551 | QAction *action; |
552 | QIconSet icon; | 552 | QIconSet icon; |
553 | // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); | 553 | // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); |
554 | configureToolBarMenu->setCheckable( true ); | 554 | configureToolBarMenu->setCheckable( true ); |
555 | 555 | ||
556 | QString pathString = ""; | 556 | QString pathString = ""; |
557 | if ( !p->mToolBarMiniIcons ) { | 557 | if ( !p->mToolBarMiniIcons ) { |
558 | if ( QApplication::desktop()->width() < 480 ) | 558 | if ( QApplication::desktop()->width() < 480 ) |
559 | pathString += "icons16/"; | 559 | pathString += "icons16/"; |
560 | } else | 560 | } else |
561 | pathString += "iconsmini/"; | 561 | pathString += "iconsmini/"; |
562 | configureAgendaMenu->setCheckable( true ); | 562 | configureAgendaMenu->setCheckable( true ); |
563 | configureAgendaMenu->insertItem(i18n("Tiny"), 4 ); | 563 | int iii ; |
564 | configureAgendaMenu->insertItem(i18n("Small"), 6 ); | 564 | for ( iii = 1;iii<= 10 ;++iii ){ |
565 | configureAgendaMenu->insertItem(i18n("Medium"), 8 ); | 565 | configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); |
566 | configureAgendaMenu->insertItem(i18n("Normal"), 10 ); | 566 | } |
567 | configureAgendaMenu->insertItem(i18n("Large"), 12 ); | ||
568 | configureAgendaMenu->insertItem(i18n("Big"), 14 ); | ||
569 | configureAgendaMenu->insertItem(i18n("Bigger"), 16 ); | ||
570 | configureAgendaMenu->insertItem(i18n("Biggest"), 18 ); | ||
571 | //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); | 567 | //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); |
572 | 568 | ||
569 | connect( configureAgendaMenu, SIGNAL( aboutToShow()), | ||
570 | this, SLOT( showConfigureAgenda( ) ) ); | ||
571 | |||
573 | icon = loadPixmap( pathString + "configure" ); | 572 | icon = loadPixmap( pathString + "configure" ); |
574 | action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); | 573 | action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); |
575 | action->addTo( actionMenu ); | 574 | action->addTo( actionMenu ); |
576 | connect( action, SIGNAL( activated() ), | 575 | connect( action, SIGNAL( activated() ), |
577 | mView, SLOT( edit_options() ) ); | 576 | mView, SLOT( edit_options() ) ); |
578 | actionMenu->insertSeparator(); | 577 | actionMenu->insertSeparator(); |
579 | 578 | ||
580 | action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); | 579 | action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); |
581 | action->addTo( actionMenu ); | 580 | action->addTo( actionMenu ); |
582 | connect( action, SIGNAL( activated() ), | 581 | connect( action, SIGNAL( activated() ), |
583 | mView, SLOT( undo_delete() ) ); | 582 | mView, SLOT( undo_delete() ) ); |
584 | actionMenu->insertSeparator(); | 583 | actionMenu->insertSeparator(); |
585 | 584 | ||
586 | icon = loadPixmap( pathString + "newevent" ); | 585 | icon = loadPixmap( pathString + "newevent" ); |
587 | configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); | 586 | configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); |
588 | configureToolBarMenu->insertSeparator(); | 587 | configureToolBarMenu->insertSeparator(); |
589 | configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); | 588 | configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); |
590 | QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); | 589 | QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); |
591 | ne_action->addTo( actionMenu ); | 590 | ne_action->addTo( actionMenu ); |
592 | connect( ne_action, SIGNAL( activated() ), | 591 | connect( ne_action, SIGNAL( activated() ), |
593 | mView, SLOT( newEvent() ) ); | 592 | mView, SLOT( newEvent() ) ); |
594 | icon = loadPixmap( pathString + "newtodo" ); | 593 | icon = loadPixmap( pathString + "newtodo" ); |
595 | configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); | 594 | configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); |
596 | QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); | 595 | QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); |
597 | nt_action->addTo( actionMenu ); | 596 | nt_action->addTo( actionMenu ); |
598 | connect( nt_action, SIGNAL( activated() ), | 597 | connect( nt_action, SIGNAL( activated() ), |
599 | mView, SLOT( newTodo() ) ); | 598 | mView, SLOT( newTodo() ) ); |
600 | icon = loadPixmap( pathString + "navi" ); | 599 | icon = loadPixmap( pathString + "navi" ); |
601 | action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); | 600 | action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); |
602 | action->addTo( viewMenu ); | 601 | action->addTo( viewMenu ); |
603 | connect( action, SIGNAL( activated() ), | 602 | connect( action, SIGNAL( activated() ), |
604 | mView, SLOT( toggleDateNavigatorWidget() ) ); | 603 | mView, SLOT( toggleDateNavigatorWidget() ) ); |
604 | mToggleNav = action ; | ||
605 | icon = loadPixmap( pathString + "filter" ); | 605 | icon = loadPixmap( pathString + "filter" ); |
606 | action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); | 606 | action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); |
607 | action->addTo( viewMenu ); | 607 | action->addTo( viewMenu ); |
608 | connect( action, SIGNAL( activated() ), | 608 | connect( action, SIGNAL( activated() ), |
609 | mView, SLOT( toggleFilter() ) ); | 609 | mView, SLOT( toggleFilter() ) ); |
610 | mToggleFilter = action; | ||
610 | icon = loadPixmap( pathString + "allday" ); | 611 | icon = loadPixmap( pathString + "allday" ); |
611 | action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); | 612 | action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); |
612 | action->addTo( viewMenu ); | 613 | action->addTo( viewMenu ); |
613 | connect( action, SIGNAL( activated() ), | 614 | connect( action, SIGNAL( activated() ), |
614 | mView, SLOT( toggleAllDaySize() ) ); | 615 | mView, SLOT( toggleAllDaySize() ) ); |
616 | mToggleAllday = action; | ||
617 | |||
618 | |||
619 | connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), | ||
620 | mToggleNav, SLOT( setEnabled ( bool ) ) ); | ||
621 | connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), | ||
622 | mToggleFilter, SLOT( setEnabled ( bool ) ) ); | ||
623 | connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), | ||
624 | mToggleAllday, SLOT( setEnabled ( bool ) ) ); | ||
615 | 625 | ||
616 | viewMenu->insertSeparator(); | 626 | viewMenu->insertSeparator(); |
617 | icon = loadPixmap( pathString + "picker" ); | 627 | icon = loadPixmap( pathString + "picker" ); |
618 | action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); | 628 | action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); |
619 | action->addTo( viewMenu ); | 629 | action->addTo( viewMenu ); |
620 | connect( action, SIGNAL( activated() ), | 630 | connect( action, SIGNAL( activated() ), |
621 | mView, SLOT( showDatePicker() ) ); | 631 | mView, SLOT( showDatePicker() ) ); |
622 | action->addTo( iconToolBar ); | 632 | action->addTo( iconToolBar ); |
623 | viewMenu->insertSeparator(); | 633 | viewMenu->insertSeparator(); |
624 | icon = loadPixmap( pathString + "list" ); | 634 | icon = loadPixmap( pathString + "list" ); |
625 | configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); | 635 | configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); |
626 | QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); | 636 | QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); |
627 | showlist_action->addTo( viewMenu ); | 637 | showlist_action->addTo( viewMenu ); |
628 | connect( showlist_action, SIGNAL( activated() ), | 638 | connect( showlist_action, SIGNAL( activated() ), |
629 | mView->viewManager(), SLOT( showListView() ) ); | 639 | mView->viewManager(), SLOT( showListView() ) ); |
630 | 640 | ||
631 | 641 | ||
632 | icon = loadPixmap( pathString + "day" ); | 642 | icon = loadPixmap( pathString + "day" ); |
633 | configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); | 643 | configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); |
634 | QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); | 644 | QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); |
635 | day1_action->addTo( viewMenu ); | 645 | day1_action->addTo( viewMenu ); |
636 | // action->addTo( toolBar ); | 646 | // action->addTo( toolBar ); |
637 | connect( day1_action, SIGNAL( activated() ), | 647 | connect( day1_action, SIGNAL( activated() ), |
638 | mView->viewManager(), SLOT( showDayView() ) ); | 648 | mView->viewManager(), SLOT( showDayView() ) ); |
639 | 649 | ||
640 | icon = loadPixmap( pathString + "workweek" ); | 650 | icon = loadPixmap( pathString + "workweek" ); |
641 | configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); | 651 | configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); |
642 | QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); | 652 | QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); |
643 | day5_action->addTo( viewMenu ); | 653 | day5_action->addTo( viewMenu ); |
644 | connect( day5_action, SIGNAL( activated() ), | 654 | connect( day5_action, SIGNAL( activated() ), |
645 | mView->viewManager(), SLOT( showWorkWeekView() ) ); | 655 | mView->viewManager(), SLOT( showWorkWeekView() ) ); |
646 | 656 | ||
647 | icon = loadPixmap( pathString + "week" ); | 657 | icon = loadPixmap( pathString + "week" ); |
648 | configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); | 658 | configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); |
649 | QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); | 659 | QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); |
650 | day7_action->addTo( viewMenu ); | 660 | day7_action->addTo( viewMenu ); |
651 | connect( day7_action, SIGNAL( activated() ), | 661 | connect( day7_action, SIGNAL( activated() ), |
652 | mView->viewManager(), SLOT( showWeekView() ) ); | 662 | mView->viewManager(), SLOT( showWeekView() ) ); |
653 | 663 | ||
654 | icon = loadPixmap( pathString + "month" ); | 664 | icon = loadPixmap( pathString + "month" ); |
655 | configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); | 665 | configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); |
656 | QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); | 666 | QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); |
657 | month_action->addTo( viewMenu ); | 667 | month_action->addTo( viewMenu ); |
658 | connect( month_action, SIGNAL( activated() ), | 668 | connect( month_action, SIGNAL( activated() ), |
659 | mView->viewManager(), SLOT( showMonthView() ) ); | 669 | mView->viewManager(), SLOT( showMonthView() ) ); |
660 | 670 | ||
661 | icon = loadPixmap( pathString + "todo" ); | 671 | icon = loadPixmap( pathString + "todo" ); |
662 | configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); | 672 | configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); |
663 | QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); | 673 | QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); |
664 | todoview_action->addTo( viewMenu ); | 674 | todoview_action->addTo( viewMenu ); |
665 | connect( todoview_action, SIGNAL( activated() ), | 675 | connect( todoview_action, SIGNAL( activated() ), |
666 | mView->viewManager(), SLOT( showTodoView() ) ); | 676 | mView->viewManager(), SLOT( showTodoView() ) ); |
667 | 677 | ||
668 | icon = loadPixmap( pathString + "journal" ); | 678 | icon = loadPixmap( pathString + "journal" ); |
669 | configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); | 679 | configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); |
670 | QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); | 680 | QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); |
671 | viewjournal_action->addTo( viewMenu ); | 681 | viewjournal_action->addTo( viewMenu ); |
672 | connect( viewjournal_action, SIGNAL( activated() ), | 682 | connect( viewjournal_action, SIGNAL( activated() ), |
673 | mView->viewManager(), SLOT( showJournalView() ) ); | 683 | mView->viewManager(), SLOT( showJournalView() ) ); |
674 | 684 | ||
675 | icon = loadPixmap( pathString + "xdays" ); | 685 | icon = loadPixmap( pathString + "xdays" ); |
676 | configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 ); | 686 | configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 ); |
677 | QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); | 687 | QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); |
678 | xdays_action->addTo( viewMenu ); | 688 | xdays_action->addTo( viewMenu ); |
679 | connect( xdays_action, SIGNAL( activated() ), | 689 | connect( xdays_action, SIGNAL( activated() ), |
680 | mView->viewManager(), SLOT( showNextXView() ) ); | 690 | mView->viewManager(), SLOT( showNextXView() ) ); |
681 | 691 | ||
682 | icon = loadPixmap( pathString + "whatsnext" ); | 692 | icon = loadPixmap( pathString + "whatsnext" ); |
683 | configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 ); | 693 | configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 ); |
684 | QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); | 694 | QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); |
685 | whatsnext_action->addTo( viewMenu ); | 695 | whatsnext_action->addTo( viewMenu ); |
686 | connect( whatsnext_action, SIGNAL( activated() ), | 696 | connect( whatsnext_action, SIGNAL( activated() ), |
687 | mView->viewManager(), SLOT( showWhatsNextView() ) ); | 697 | mView->viewManager(), SLOT( showWhatsNextView() ) ); |
688 | 698 | ||
689 | #if 0 | 699 | #if 0 |
690 | action = new QAction( "view_timespan", "Time Span", 0, this ); | 700 | action = new QAction( "view_timespan", "Time Span", 0, this ); |
691 | action->addTo( viewMenu ); | 701 | action->addTo( viewMenu ); |
692 | connect( action, SIGNAL( activated() ), | 702 | connect( action, SIGNAL( activated() ), |
693 | mView->viewManager(), SLOT( showTimeSpanView() ) ); | 703 | mView->viewManager(), SLOT( showTimeSpanView() ) ); |
694 | #endif | 704 | #endif |
695 | 705 | ||
696 | mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, | 706 | mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, |
697 | this ); | 707 | this ); |
698 | mNewSubTodoAction->addTo( actionMenu ); | 708 | mNewSubTodoAction->addTo( actionMenu ); |
699 | connect( mNewSubTodoAction, SIGNAL( activated() ), | 709 | connect( mNewSubTodoAction, SIGNAL( activated() ), |
700 | mView, SLOT( newSubTodo() ) ); | 710 | mView, SLOT( newSubTodo() ) ); |
701 | 711 | ||
702 | actionMenu->insertSeparator(); | 712 | actionMenu->insertSeparator(); |
703 | 713 | ||
704 | mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); | 714 | mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); |
705 | mShowAction->addTo( actionMenu ); | 715 | mShowAction->addTo( actionMenu ); |
706 | connect( mShowAction, SIGNAL( activated() ), | 716 | connect( mShowAction, SIGNAL( activated() ), |
707 | mView, SLOT( showIncidence() ) ); | 717 | mView, SLOT( showIncidence() ) ); |
708 | 718 | ||
709 | mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); | 719 | mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); |
710 | mEditAction->addTo( actionMenu ); | 720 | mEditAction->addTo( actionMenu ); |
711 | connect( mEditAction, SIGNAL( activated() ), | 721 | connect( mEditAction, SIGNAL( activated() ), |
712 | mView, SLOT( editIncidence() ) ); | 722 | mView, SLOT( editIncidence() ) ); |
713 | 723 | ||
714 | mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); | 724 | mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); |
715 | mDeleteAction->addTo( actionMenu ); | 725 | mDeleteAction->addTo( actionMenu ); |
716 | connect( mDeleteAction, SIGNAL( activated() ), | 726 | connect( mDeleteAction, SIGNAL( activated() ), |
717 | mView, SLOT( deleteIncidence() ) ); | 727 | mView, SLOT( deleteIncidence() ) ); |
718 | 728 | ||
719 | 729 | ||
720 | mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); | 730 | mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); |
721 | mCloneAction->addTo( actionMenu ); | 731 | mCloneAction->addTo( actionMenu ); |
722 | connect( mCloneAction, SIGNAL( activated() ), | 732 | connect( mCloneAction, SIGNAL( activated() ), |
723 | mView, SLOT( cloneIncidence() ) ); | 733 | mView, SLOT( cloneIncidence() ) ); |
724 | mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); | 734 | mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); |
725 | mMoveAction->addTo( actionMenu ); | 735 | mMoveAction->addTo( actionMenu ); |
726 | connect( mMoveAction, SIGNAL( activated() ), | 736 | connect( mMoveAction, SIGNAL( activated() ), |
727 | mView, SLOT( moveIncidence() ) ); | 737 | mView, SLOT( moveIncidence() ) ); |
728 | mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); | 738 | mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); |
729 | mBeamAction->addTo( actionMenu ); | 739 | mBeamAction->addTo( actionMenu ); |
730 | connect( mBeamAction, SIGNAL( activated() ), | 740 | connect( mBeamAction, SIGNAL( activated() ), |
731 | mView, SLOT( beamIncidence() ) ); | 741 | mView, SLOT( beamIncidence() ) ); |
732 | mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); | 742 | mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); |
733 | mCancelAction->addTo( actionMenu ); | 743 | mCancelAction->addTo( actionMenu ); |
734 | connect( mCancelAction, SIGNAL( activated() ), | 744 | connect( mCancelAction, SIGNAL( activated() ), |
735 | mView, SLOT( toggleCancelIncidence() ) ); | 745 | mView, SLOT( toggleCancelIncidence() ) ); |
736 | 746 | ||
737 | actionMenu->insertSeparator(); | 747 | actionMenu->insertSeparator(); |
738 | 748 | ||
739 | action = new QAction( "purge_completed", i18n("Purge Completed"), 0, | 749 | action = new QAction( "purge_completed", i18n("Purge Completed"), 0, |
740 | this ); | 750 | this ); |
741 | action->addTo( actionMenu ); | 751 | action->addTo( actionMenu ); |
742 | connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); | 752 | connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); |
743 | 753 | ||
744 | icon = loadPixmap( pathString + "search" ); | 754 | icon = loadPixmap( pathString + "search" ); |
745 | QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); | 755 | QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); |
746 | configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4); | 756 | configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4); |
747 | search_action->addTo( actionMenu ); | 757 | search_action->addTo( actionMenu ); |
748 | connect( search_action, SIGNAL( activated() ), | 758 | connect( search_action, SIGNAL( activated() ), |
749 | mView->dialogManager(), SLOT( showSearchDialog() ) ); | 759 | mView->dialogManager(), SLOT( showSearchDialog() ) ); |
750 | 760 | ||
751 | icon = loadPixmap( pathString + "today" ); | 761 | icon = loadPixmap( pathString + "today" ); |
752 | configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); | 762 | configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); |
753 | QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); | 763 | QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); |
754 | today_action->addTo( actionMenu ); | 764 | today_action->addTo( actionMenu ); |
755 | connect( today_action, SIGNAL( activated() ), | 765 | connect( today_action, SIGNAL( activated() ), |
756 | mView, SLOT( goToday() ) ); | 766 | mView, SLOT( goToday() ) ); |
757 | 767 | ||
758 | if ( KOPrefs::instance()->mShowFullMenu ) { | 768 | if ( KOPrefs::instance()->mShowFullMenu ) { |
759 | actionMenu->insertSeparator(); | 769 | actionMenu->insertSeparator(); |
760 | actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); | 770 | actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); |
761 | 771 | ||
762 | } | 772 | } |
763 | // actionMenu->insertSeparator(); | 773 | // actionMenu->insertSeparator(); |
764 | action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, | 774 | action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, |
765 | this ); | 775 | this ); |
766 | action->addTo( importMenu ); | 776 | action->addTo( importMenu ); |
767 | connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); | 777 | connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); |
768 | action = new QAction( "import_quick", i18n("Import last file"), 0, | 778 | action = new QAction( "import_quick", i18n("Import last file"), 0, |
769 | this ); | 779 | this ); |
770 | action->addTo( importMenu ); | 780 | action->addTo( importMenu ); |
771 | connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); | 781 | connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); |
772 | importMenu->insertSeparator(); | 782 | importMenu->insertSeparator(); |
773 | action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, | 783 | action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, |
774 | this ); | 784 | this ); |
775 | action->addTo( importMenu ); | 785 | action->addTo( importMenu ); |
776 | connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); | 786 | connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); |
777 | #ifndef DESKTOP_VERSION | 787 | #ifndef DESKTOP_VERSION |
778 | importMenu->insertSeparator(); | 788 | importMenu->insertSeparator(); |
779 | action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, | 789 | action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, |
780 | this ); | 790 | this ); |
781 | action->addTo( importMenu ); | 791 | action->addTo( importMenu ); |
782 | connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); | 792 | connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); |
783 | #else | 793 | #else |
784 | #ifdef _OL_IMPORT_ | 794 | #ifdef _OL_IMPORT_ |
785 | importMenu->insertSeparator(); | 795 | importMenu->insertSeparator(); |
786 | action = new QAction( "import_ol", i18n("Import from OL"), 0, | 796 | action = new QAction( "import_ol", i18n("Import from OL"), 0, |
787 | this ); | 797 | this ); |
788 | action->addTo( importMenu ); | 798 | action->addTo( importMenu ); |
789 | connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); | 799 | connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); |
790 | #endif | 800 | #endif |
791 | #endif | 801 | #endif |
792 | 802 | ||
793 | importMenu->insertSeparator(); | 803 | importMenu->insertSeparator(); |
794 | action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, | 804 | action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, |
795 | this ); | 805 | this ); |
796 | action->addTo( importMenu ); | 806 | action->addTo( importMenu ); |
797 | connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); | 807 | connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); |
798 | 808 | ||
799 | action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, | 809 | action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, |
800 | this ); | 810 | this ); |
801 | action->addTo( importMenu ); | 811 | action->addTo( importMenu ); |
802 | connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); | 812 | connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); |
803 | 813 | ||
804 | importMenu->insertSeparator(); | 814 | importMenu->insertSeparator(); |
805 | action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, | 815 | action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, |
806 | this ); | 816 | this ); |
807 | action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); | 817 | action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); |
808 | 818 | ||
809 | 819 | ||
810 | //LR | 820 | //LR |
811 | QPopupMenu *ex2phone = new QPopupMenu( this ); | 821 | QPopupMenu *ex2phone = new QPopupMenu( this ); |
812 | ex2phone->insertItem(i18n("Complete calendar..."), 1 ); | 822 | ex2phone->insertItem(i18n("Complete calendar..."), 1 ); |
813 | ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); | 823 | ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); |
814 | connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); | 824 | connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); |
815 | importMenu->insertItem( i18n("Export to phone"), ex2phone ); | 825 | importMenu->insertItem( i18n("Export to phone"), ex2phone ); |
816 | 826 | ||
817 | importMenu->insertSeparator(); | 827 | importMenu->insertSeparator(); |
818 | action = new QAction( "manage cat", i18n("Manage new categories..."), 0, | 828 | action = new QAction( "manage cat", i18n("Manage new categories..."), 0, |
819 | this ); | 829 | this ); |
820 | action->addTo( importMenu ); | 830 | action->addTo( importMenu ); |
821 | connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); | 831 | connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); |
822 | #ifndef DESKTOP_VERSION | 832 | #ifndef DESKTOP_VERSION |
823 | importMenu->insertSeparator(); | 833 | importMenu->insertSeparator(); |
824 | brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, | 834 | brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, |
825 | this ); | 835 | this ); |
826 | brAction->addTo( importMenu ); | 836 | brAction->addTo( importMenu ); |
827 | brAction->setToggleAction (true ) ; | 837 | brAction->setToggleAction (true ) ; |
828 | connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); | 838 | connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); |
829 | 839 | ||
830 | action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, | 840 | action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, |
831 | this ); | 841 | this ); |
832 | action->addTo( importMenu ); | 842 | action->addTo( importMenu ); |
833 | connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); | 843 | connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); |
834 | 844 | ||
835 | action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, | 845 | action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, |
836 | this ); | 846 | this ); |
837 | action->addTo( importMenu ); | 847 | action->addTo( importMenu ); |
838 | connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); | 848 | connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); |
839 | #else | 849 | #else |
840 | importMenu->insertSeparator(); | 850 | importMenu->insertSeparator(); |
841 | icon = loadPixmap( pathString + "print" ); | 851 | icon = loadPixmap( pathString + "print" ); |
842 | action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); | 852 | action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); |
843 | action->addTo( importMenu ); | 853 | action->addTo( importMenu ); |
844 | connect( action, SIGNAL( activated() ), | 854 | connect( action, SIGNAL( activated() ), |
845 | this, SLOT( printCal() ) ); | 855 | this, SLOT( printCal() ) ); |
846 | 856 | ||
847 | icon = loadPixmap( pathString + "print" ); | 857 | icon = loadPixmap( pathString + "print" ); |
848 | action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); | 858 | action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); |
849 | action->addTo( importMenu ); | 859 | action->addTo( importMenu ); |
850 | connect( action, SIGNAL( activated() ), | 860 | connect( action, SIGNAL( activated() ), |
851 | this, SLOT( printSel() ) ); | 861 | this, SLOT( printSel() ) ); |
852 | action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); | 862 | action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); |
853 | action->addTo( importMenu ); | 863 | action->addTo( importMenu ); |
854 | connect( action, SIGNAL( activated() ), | 864 | connect( action, SIGNAL( activated() ), |
855 | mView->viewManager(), SIGNAL( printWNV() ) ); | 865 | mView->viewManager(), SIGNAL( printWNV() ) ); |
856 | #endif | 866 | #endif |
857 | importMenu->insertSeparator(); | 867 | importMenu->insertSeparator(); |
858 | action = new QAction( "beam all", i18n("Save"), 0, | 868 | action = new QAction( "beam all", i18n("Save"), 0, |
859 | this ); | 869 | this ); |
860 | action->addTo( importMenu ); | 870 | action->addTo( importMenu ); |
861 | connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); | 871 | connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); |
862 | action = new QAction( "beam all", i18n("Exit (+save)"), 0, | 872 | action = new QAction( "beam all", i18n("Exit (+save)"), 0, |
863 | this ); | 873 | this ); |
864 | action->addTo( importMenu ); | 874 | action->addTo( importMenu ); |
865 | connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); | 875 | connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); |
866 | 876 | ||
867 | //menuBar->insertItem( "Configure",configureMenu ); | 877 | //menuBar->insertItem( "Configure",configureMenu ); |
868 | //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); | 878 | //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); |
869 | icon = loadPixmap( "korganizer/korganizer" ); | 879 | icon = loadPixmap( "korganizer/korganizer" ); |
870 | 880 | ||
871 | action = new QAction( "Whats New", i18n("What's new?"), 0,this ); | 881 | action = new QAction( "Whats New", i18n("What's new?"), 0,this ); |
872 | action->addTo( helpMenu ); | 882 | action->addTo( helpMenu ); |
873 | connect( action, SIGNAL( activated() ), | 883 | connect( action, SIGNAL( activated() ), |
874 | SLOT( whatsNew() ) ); | 884 | SLOT( whatsNew() ) ); |
875 | action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); | 885 | action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); |
876 | action->addTo( helpMenu ); | 886 | action->addTo( helpMenu ); |
877 | connect( action, SIGNAL( activated() ), | 887 | connect( action, SIGNAL( activated() ), |
878 | SLOT( features() ) ); | 888 | SLOT( features() ) ); |
879 | action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); | 889 | action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); |
880 | action->addTo( helpMenu ); | 890 | action->addTo( helpMenu ); |
881 | connect( action, SIGNAL( activated() ), | 891 | connect( action, SIGNAL( activated() ), |
882 | SLOT( keyBindings() ) ); | 892 | SLOT( keyBindings() ) ); |
883 | action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); | 893 | action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); |
884 | action->addTo( helpMenu ); | 894 | action->addTo( helpMenu ); |
885 | connect( action, SIGNAL( activated() ), | 895 | connect( action, SIGNAL( activated() ), |
886 | SLOT( synchowto() ) ); | 896 | SLOT( synchowto() ) ); |
887 | action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); | 897 | action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); |
888 | action->addTo( helpMenu ); | 898 | action->addTo( helpMenu ); |
889 | connect( action, SIGNAL( activated() ), | 899 | connect( action, SIGNAL( activated() ), |
890 | SLOT( kdesynchowto() ) ); | 900 | SLOT( kdesynchowto() ) ); |
891 | action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); | 901 | action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); |
892 | action->addTo( helpMenu ); | 902 | action->addTo( helpMenu ); |
893 | connect( action, SIGNAL( activated() ), | 903 | connect( action, SIGNAL( activated() ), |
894 | SLOT( multisynchowto() ) ); | 904 | SLOT( multisynchowto() ) ); |
895 | action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); | 905 | action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); |
896 | action->addTo( helpMenu ); | 906 | action->addTo( helpMenu ); |
897 | connect( action, SIGNAL( activated() ), | 907 | connect( action, SIGNAL( activated() ), |
898 | SLOT( aboutAutoSaving() ) ); | 908 | SLOT( aboutAutoSaving() ) ); |
899 | action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); | 909 | action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); |
900 | action->addTo( helpMenu ); | 910 | action->addTo( helpMenu ); |
901 | connect( action, SIGNAL( activated() ), | 911 | connect( action, SIGNAL( activated() ), |
902 | SLOT( aboutKnownBugs() ) ); | 912 | SLOT( aboutKnownBugs() ) ); |
903 | action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); | 913 | action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); |
904 | action->addTo( helpMenu ); | 914 | action->addTo( helpMenu ); |
905 | connect( action, SIGNAL( activated() ), | 915 | connect( action, SIGNAL( activated() ), |
906 | SLOT( usertrans() ) ); | 916 | SLOT( usertrans() ) ); |
907 | action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); | 917 | action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); |
908 | action->addTo( helpMenu ); | 918 | action->addTo( helpMenu ); |
909 | connect( action, SIGNAL( activated() ), | 919 | connect( action, SIGNAL( activated() ), |
910 | SLOT( faq() ) ); | 920 | SLOT( faq() ) ); |
911 | action = new QAction( "licence", i18n("Licence..."), 0, this ); | 921 | action = new QAction( "licence", i18n("Licence..."), 0, this ); |
912 | action->addTo( helpMenu ); | 922 | action->addTo( helpMenu ); |
913 | connect( action, SIGNAL( activated() ), | 923 | connect( action, SIGNAL( activated() ), |
914 | SLOT( licence() ) ); | 924 | SLOT( licence() ) ); |
915 | action = new QAction( "about", i18n("About..."), 0, this ); | 925 | action = new QAction( "about", i18n("About..."), 0, this ); |
916 | action->addTo( helpMenu ); | 926 | action->addTo( helpMenu ); |
917 | connect( action, SIGNAL( activated() ), | 927 | connect( action, SIGNAL( activated() ), |
918 | SLOT( about() ) ); | 928 | SLOT( about() ) ); |
919 | //menuBar->insertSeparator(); | 929 | //menuBar->insertSeparator(); |
920 | 930 | ||
921 | // ****************************************************** | 931 | // ****************************************************** |
922 | // menubar icons | 932 | // menubar icons |
923 | 933 | ||
924 | 934 | ||
925 | iconToolBar->setHorizontalStretchable (true ); | 935 | iconToolBar->setHorizontalStretchable (true ); |
926 | //menuBar->insertItem( iconToolBar ); | 936 | //menuBar->insertItem( iconToolBar ); |
927 | //xdays_action | 937 | //xdays_action |
928 | if (p-> mShowIconNewEvent) | 938 | if (p-> mShowIconNewEvent) |
929 | ne_action->addTo( iconToolBar ); | 939 | ne_action->addTo( iconToolBar ); |
930 | if (p->mShowIconNewTodo ) | 940 | if (p->mShowIconNewTodo ) |
931 | nt_action->addTo( iconToolBar ); | 941 | nt_action->addTo( iconToolBar ); |
932 | if (p-> mShowIconSearch) | 942 | if (p-> mShowIconSearch) |
933 | search_action->addTo( iconToolBar ); | 943 | search_action->addTo( iconToolBar ); |
934 | if (p-> mShowIconNext) | 944 | if (p-> mShowIconNext) |
935 | whatsnext_action->addTo( iconToolBar ); | 945 | whatsnext_action->addTo( iconToolBar ); |
936 | if (p-> mShowIconNextDays) | 946 | if (p-> mShowIconNextDays) |
937 | xdays_action->addTo( iconToolBar ); | 947 | xdays_action->addTo( iconToolBar ); |
938 | if (p-> mShowIconList) | 948 | if (p-> mShowIconList) |
939 | showlist_action->addTo( iconToolBar ); | 949 | showlist_action->addTo( iconToolBar ); |
940 | if (p-> mShowIconDay1) | 950 | if (p-> mShowIconDay1) |
941 | day1_action->addTo( iconToolBar ); | 951 | day1_action->addTo( iconToolBar ); |
942 | if (p-> mShowIconDay5) | 952 | if (p-> mShowIconDay5) |
943 | day5_action->addTo( iconToolBar ); | 953 | day5_action->addTo( iconToolBar ); |
944 | if (p-> mShowIconDay7) | 954 | if (p-> mShowIconDay7) |
945 | day7_action->addTo( iconToolBar ); | 955 | day7_action->addTo( iconToolBar ); |
946 | if (p-> mShowIconMonth) | 956 | if (p-> mShowIconMonth) |
947 | month_action->addTo( iconToolBar ); | 957 | month_action->addTo( iconToolBar ); |
948 | if (p-> mShowIconTodoview) | 958 | if (p-> mShowIconTodoview) |
949 | todoview_action->addTo( iconToolBar ); | 959 | todoview_action->addTo( iconToolBar ); |
950 | if (p-> mShowIconJournal) | 960 | if (p-> mShowIconJournal) |
951 | viewjournal_action->addTo( iconToolBar ); | 961 | viewjournal_action->addTo( iconToolBar ); |
952 | icon = loadPixmap( pathString + "2leftarrowB" ); | 962 | icon = loadPixmap( pathString + "2leftarrowB" ); |
953 | configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14); | 963 | configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14); |
954 | if (p-> mShowIconBackFast) { | 964 | if (p-> mShowIconBackFast) { |
955 | action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); | 965 | action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); |
956 | connect( action, SIGNAL( activated() ), | 966 | connect( action, SIGNAL( activated() ), |
957 | mView, SLOT( goPreviousMonth() ) ); | 967 | mView, SLOT( goPreviousMonth() ) ); |
958 | action->addTo( iconToolBar ); | 968 | action->addTo( iconToolBar ); |
959 | } | 969 | } |
960 | icon = loadPixmap( pathString + "1leftarrowB" ); | 970 | icon = loadPixmap( pathString + "1leftarrowB" ); |
961 | configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15); | 971 | configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15); |
962 | if (p-> mShowIconBack) { | 972 | if (p-> mShowIconBack) { |
963 | action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); | 973 | action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); |
964 | connect( action, SIGNAL( activated() ), | 974 | connect( action, SIGNAL( activated() ), |
965 | mView, SLOT( goPrevious() ) ); | 975 | mView, SLOT( goPrevious() ) ); |
966 | action->addTo( iconToolBar ); | 976 | action->addTo( iconToolBar ); |
967 | } | 977 | } |
968 | if (p-> mShowIconToday) | 978 | if (p-> mShowIconToday) |
969 | today_action->addTo( iconToolBar ); | 979 | today_action->addTo( iconToolBar ); |
970 | icon = loadPixmap( pathString + "1rightarrowB" ); | 980 | icon = loadPixmap( pathString + "1rightarrowB" ); |
971 | configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); | 981 | configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); |
972 | if (p-> mShowIconForward) { | 982 | if (p-> mShowIconForward) { |
973 | action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); | 983 | action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); |
974 | connect( action, SIGNAL( activated() ), | 984 | connect( action, SIGNAL( activated() ), |
975 | mView, SLOT( goNext() ) ); | 985 | mView, SLOT( goNext() ) ); |
976 | action->addTo( iconToolBar ); | 986 | action->addTo( iconToolBar ); |
977 | } | 987 | } |
978 | icon = loadPixmap( pathString + "2rightarrowB" ); | 988 | icon = loadPixmap( pathString + "2rightarrowB" ); |
979 | configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); | 989 | configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); |
980 | if (p-> mShowIconForwardFast) { | 990 | if (p-> mShowIconForwardFast) { |
981 | action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); | 991 | action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); |
982 | connect( action, SIGNAL( activated() ), | 992 | connect( action, SIGNAL( activated() ), |
983 | mView, SLOT( goNextMonth() ) ); | 993 | mView, SLOT( goNextMonth() ) ); |
984 | action->addTo( iconToolBar ); | 994 | action->addTo( iconToolBar ); |
985 | } | 995 | } |
986 | 996 | ||
987 | 997 | ||
988 | configureToolBarMenu->insertItem(i18n("What's This?"), 300); | 998 | configureToolBarMenu->insertItem(i18n("What's This?"), 300); |
989 | 999 | ||
990 | if (p-> mShowIconNewEvent) | 1000 | if (p-> mShowIconNewEvent) |
991 | configureToolBarMenu->setItemChecked( 10, true ); | 1001 | configureToolBarMenu->setItemChecked( 10, true ); |
992 | if (p->mShowIconNewTodo ) | 1002 | if (p->mShowIconNewTodo ) |
993 | configureToolBarMenu->setItemChecked( 20, true ); | 1003 | configureToolBarMenu->setItemChecked( 20, true ); |
994 | if (p-> mShowIconSearch) | 1004 | if (p-> mShowIconSearch) |
995 | configureToolBarMenu->setItemChecked( 120, true ); | 1005 | configureToolBarMenu->setItemChecked( 120, true ); |
996 | if (p-> mShowIconList) | 1006 | if (p-> mShowIconList) |
997 | configureToolBarMenu->setItemChecked( 30, true ); | 1007 | configureToolBarMenu->setItemChecked( 30, true ); |
998 | if (p-> mShowIconDay1) | 1008 | if (p-> mShowIconDay1) |
999 | configureToolBarMenu->setItemChecked( 40, true ); | 1009 | configureToolBarMenu->setItemChecked( 40, true ); |
1000 | if (p-> mShowIconDay5) | 1010 | if (p-> mShowIconDay5) |
1001 | configureToolBarMenu->setItemChecked( 50, true ); | 1011 | configureToolBarMenu->setItemChecked( 50, true ); |
1002 | if (p-> mShowIconDay7) | 1012 | if (p-> mShowIconDay7) |
1003 | configureToolBarMenu->setItemChecked( 60, true ); | 1013 | configureToolBarMenu->setItemChecked( 60, true ); |
1004 | if (p-> mShowIconMonth) | 1014 | if (p-> mShowIconMonth) |
1005 | configureToolBarMenu->setItemChecked( 70, true ); | 1015 | configureToolBarMenu->setItemChecked( 70, true ); |
1006 | if (p-> mShowIconTodoview) | 1016 | if (p-> mShowIconTodoview) |
1007 | configureToolBarMenu->setItemChecked( 80, true ); | 1017 | configureToolBarMenu->setItemChecked( 80, true ); |
1008 | if (p-> mShowIconBackFast) | 1018 | if (p-> mShowIconBackFast) |
1009 | configureToolBarMenu->setItemChecked( 200, true ); | 1019 | configureToolBarMenu->setItemChecked( 200, true ); |
1010 | if (p-> mShowIconBack) | 1020 | if (p-> mShowIconBack) |
1011 | configureToolBarMenu->setItemChecked( 210, true ); | 1021 | configureToolBarMenu->setItemChecked( 210, true ); |
1012 | if (p-> mShowIconToday) | 1022 | if (p-> mShowIconToday) |
1013 | configureToolBarMenu->setItemChecked( 130, true ); | 1023 | configureToolBarMenu->setItemChecked( 130, true ); |
1014 | if (p-> mShowIconForward) | 1024 | if (p-> mShowIconForward) |
1015 | configureToolBarMenu->setItemChecked( 220, true ); | 1025 | configureToolBarMenu->setItemChecked( 220, true ); |
1016 | if (p-> mShowIconForwardFast) | 1026 | if (p-> mShowIconForwardFast) |
1017 | configureToolBarMenu->setItemChecked( 230, true ); | 1027 | configureToolBarMenu->setItemChecked( 230, true ); |
1018 | if (p-> mShowIconNextDays) | 1028 | if (p-> mShowIconNextDays) |
1019 | configureToolBarMenu->setItemChecked( 100, true ); | 1029 | configureToolBarMenu->setItemChecked( 100, true ); |
1020 | if (p-> mShowIconNext) | 1030 | if (p-> mShowIconNext) |
1021 | configureToolBarMenu->setItemChecked( 110, true ); | 1031 | configureToolBarMenu->setItemChecked( 110, true ); |
1022 | if (p-> mShowIconJournal) | 1032 | if (p-> mShowIconJournal) |
1023 | configureToolBarMenu->setItemChecked( 90, true ); | 1033 | configureToolBarMenu->setItemChecked( 90, true ); |
1024 | if (p-> mShowIconWhatsThis) | 1034 | if (p-> mShowIconWhatsThis) |
1025 | configureToolBarMenu->setItemChecked( 300, true ); | 1035 | configureToolBarMenu->setItemChecked( 300, true ); |
1026 | 1036 | ||
1027 | QLabel* dummy = new QLabel( iconToolBar ); | 1037 | QLabel* dummy = new QLabel( iconToolBar ); |
1028 | dummy->setBackgroundColor( iconToolBar->backgroundColor() ); | 1038 | dummy->setBackgroundColor( iconToolBar->backgroundColor() ); |
1029 | if (!p-> mShowIconStretch) | 1039 | if (!p-> mShowIconStretch) |
1030 | iconToolBar->setStretchableWidget ( dummy ) ; | 1040 | iconToolBar->setStretchableWidget ( dummy ) ; |
1031 | else | 1041 | else |
1032 | configureToolBarMenu->setItemChecked( 5, true ); | 1042 | configureToolBarMenu->setItemChecked( 5, true ); |
1033 | if (p-> mShowIconWhatsThis) | 1043 | if (p-> mShowIconWhatsThis) |
1034 | QWhatsThis::whatsThisButton ( iconToolBar ); | 1044 | QWhatsThis::whatsThisButton ( iconToolBar ); |
1035 | connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); | 1045 | connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); |
1036 | configureAgenda( p->mHourSize ); | 1046 | configureAgenda( p->mHourSize ); |
1037 | connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); | 1047 | connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); |
1038 | } | 1048 | } |
1039 | 1049 | ||
1040 | void MainWindow::exportToPhone( int mode ) | 1050 | void MainWindow::exportToPhone( int mode ) |
1041 | { | 1051 | { |
1042 | 1052 | ||
1043 | //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); | 1053 | //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); |
1044 | //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); | 1054 | //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); |
1045 | KOex2phonePrefs ex2phone; | 1055 | KOex2phonePrefs ex2phone; |
1046 | 1056 | ||
1047 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); | 1057 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); |
1048 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); | 1058 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); |
1049 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 1059 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
1050 | if ( mode == 1 ) | 1060 | if ( mode == 1 ) |
1051 | ex2phone.setCaption(i18n("Export complete calendar")); | 1061 | ex2phone.setCaption(i18n("Export complete calendar")); |
1052 | if ( mode == 2 ) | 1062 | if ( mode == 2 ) |
1053 | ex2phone.setCaption(i18n("Export filtered calendar")); | 1063 | ex2phone.setCaption(i18n("Export filtered calendar")); |
1054 | 1064 | ||
1055 | if ( !ex2phone.exec() ) { | 1065 | if ( !ex2phone.exec() ) { |
1056 | return; | 1066 | return; |
1057 | } | 1067 | } |
1058 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); | 1068 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); |
1059 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); | 1069 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); |
1060 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); | 1070 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); |
1061 | 1071 | ||
1062 | int inFuture = 0; | 1072 | int inFuture = 0; |
1063 | if ( ex2phone.mWriteBackFuture->isChecked() ) | 1073 | if ( ex2phone.mWriteBackFuture->isChecked() ) |
1064 | inFuture = ex2phone.mWriteBackFutureWeeks->value(); | 1074 | inFuture = ex2phone.mWriteBackFutureWeeks->value(); |
1065 | QPtrList<Incidence> delSel; | 1075 | QPtrList<Incidence> delSel; |
1066 | if ( mode == 1 ) | 1076 | if ( mode == 1 ) |
1067 | delSel = mCalendar->rawIncidences(); | 1077 | delSel = mCalendar->rawIncidences(); |
1068 | if ( mode == 2 ) | 1078 | if ( mode == 2 ) |
1069 | delSel = mCalendar->incidences(); | 1079 | delSel = mCalendar->incidences(); |
1070 | CalendarLocal* cal = new CalendarLocal(); | 1080 | CalendarLocal* cal = new CalendarLocal(); |
1071 | cal->setLocalTime(); | 1081 | cal->setLocalTime(); |
1072 | Incidence *incidence = delSel.first(); | 1082 | Incidence *incidence = delSel.first(); |
1073 | QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); | 1083 | QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); |
1074 | QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); | 1084 | QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); |
1075 | while ( incidence ) { | 1085 | while ( incidence ) { |
1076 | if ( incidence->type() != "Journal" ) { | 1086 | if ( incidence->type() != "Journal" ) { |
1077 | bool add = true; | 1087 | bool add = true; |
1078 | if ( inFuture ) { | 1088 | if ( inFuture ) { |
1079 | QDateTime dt; | 1089 | QDateTime dt; |
1080 | if ( incidence->type() == "Todo" ) { | 1090 | if ( incidence->type() == "Todo" ) { |
1081 | Todo * t = (Todo*)incidence; | 1091 | Todo * t = (Todo*)incidence; |
1082 | if ( t->hasDueDate() ) | 1092 | if ( t->hasDueDate() ) |
1083 | dt = t->dtDue(); | 1093 | dt = t->dtDue(); |
1084 | else | 1094 | else |
1085 | dt = cur.addSecs( 62 ); | 1095 | dt = cur.addSecs( 62 ); |
1086 | } | 1096 | } |
1087 | else { | 1097 | else { |
1088 | bool ok; | 1098 | bool ok; |
1089 | dt = incidence->getNextOccurence( cur, &ok ); | 1099 | dt = incidence->getNextOccurence( cur, &ok ); |
1090 | if ( !ok ) | 1100 | if ( !ok ) |
1091 | dt = cur.addSecs( -62 ); | 1101 | dt = cur.addSecs( -62 ); |
1092 | } | 1102 | } |
1093 | if ( dt < cur || dt > end ) { | 1103 | if ( dt < cur || dt > end ) { |
1094 | add = false; | 1104 | add = false; |
1095 | } | 1105 | } |
1096 | } | 1106 | } |
1097 | if ( add ) { | 1107 | if ( add ) { |
1098 | Incidence *in = incidence->clone(); | 1108 | Incidence *in = incidence->clone(); |
1099 | cal->addIncidence( in ); | 1109 | cal->addIncidence( in ); |
1100 | } | 1110 | } |
1101 | } | 1111 | } |
1102 | incidence = delSel.next(); | 1112 | incidence = delSel.next(); |
1103 | } | 1113 | } |
1104 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, | 1114 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, |
1105 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, | 1115 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, |
1106 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 1116 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
1107 | 1117 | ||
1108 | setCaption( i18n("Writing to phone...")); | 1118 | setCaption( i18n("Writing to phone...")); |
1109 | if ( PhoneFormat::writeToPhone( cal ) ) | 1119 | if ( PhoneFormat::writeToPhone( cal ) ) |
1110 | setCaption( i18n("Export to phone successful!")); | 1120 | setCaption( i18n("Export to phone successful!")); |
1111 | else | 1121 | else |
1112 | setCaption( i18n("Error exporting to phone!")); | 1122 | setCaption( i18n("Error exporting to phone!")); |
1113 | delete cal; | 1123 | delete cal; |
1114 | } | 1124 | } |
1115 | 1125 | ||
1116 | 1126 | ||
1117 | void MainWindow::setDefaultPreferences() | 1127 | void MainWindow::setDefaultPreferences() |
1118 | { | 1128 | { |
1119 | KOPrefs *p = KOPrefs::instance(); | 1129 | KOPrefs *p = KOPrefs::instance(); |
1120 | 1130 | ||
1121 | p->mCompactDialogs = true; | 1131 | p->mCompactDialogs = true; |
1122 | p->mConfirm = true; | 1132 | p->mConfirm = true; |
1123 | // p->mEnableQuickTodo = false; | 1133 | // p->mEnableQuickTodo = false; |
1124 | 1134 | ||
1125 | } | 1135 | } |
1126 | 1136 | ||
1127 | QString MainWindow::resourcePath() | 1137 | QString MainWindow::resourcePath() |
1128 | { | 1138 | { |
1129 | return KGlobal::iconLoader()->iconPath(); | 1139 | return KGlobal::iconLoader()->iconPath(); |
1130 | } | 1140 | } |
1131 | 1141 | ||
1132 | void MainWindow::displayText( QString text ,QString cap ) | 1142 | void MainWindow::displayText( QString text ,QString cap ) |
1133 | { | 1143 | { |
1134 | QDialog dia( this, "name", true ); ; | 1144 | QDialog dia( this, "name", true ); ; |
1135 | dia.setCaption( cap ); | 1145 | dia.setCaption( cap ); |
1136 | QVBoxLayout* lay = new QVBoxLayout( &dia ); | 1146 | QVBoxLayout* lay = new QVBoxLayout( &dia ); |
1137 | lay->setSpacing( 3 ); | 1147 | lay->setSpacing( 3 ); |
1138 | lay->setMargin( 3 ); | 1148 | lay->setMargin( 3 ); |
1139 | QTextBrowser tb ( &dia ); | 1149 | QTextBrowser tb ( &dia ); |
1140 | lay->addWidget( &tb ); | 1150 | lay->addWidget( &tb ); |
1141 | tb.setText( text ); | 1151 | tb.setText( text ); |
1142 | #ifdef DESKTOP_VERSION | 1152 | #ifdef DESKTOP_VERSION |
1143 | dia.resize( 640, 480); | 1153 | dia.resize( 640, 480); |
1144 | #else | 1154 | #else |
1145 | dia.showMaximized(); | 1155 | dia.showMaximized(); |
1146 | #endif | 1156 | #endif |
1147 | dia.exec(); | 1157 | dia.exec(); |
1148 | } | 1158 | } |
1149 | 1159 | ||
1150 | void MainWindow::features() | 1160 | void MainWindow::features() |
1151 | { | 1161 | { |
1152 | 1162 | ||
1153 | KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); | 1163 | KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); |
1154 | } | 1164 | } |
1155 | 1165 | ||
1156 | void MainWindow::usertrans() | 1166 | void MainWindow::usertrans() |
1157 | { | 1167 | { |
1158 | 1168 | ||
1159 | KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); | 1169 | KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); |
1160 | } | 1170 | } |
1161 | 1171 | ||
1162 | void MainWindow::kdesynchowto() | 1172 | void MainWindow::kdesynchowto() |
1163 | { | 1173 | { |
1164 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); | 1174 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); |
1165 | } | 1175 | } |
1166 | void MainWindow::multisynchowto() | 1176 | void MainWindow::multisynchowto() |
1167 | { | 1177 | { |
1168 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); | 1178 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); |
1169 | } | 1179 | } |
1170 | void MainWindow::synchowto() | 1180 | void MainWindow::synchowto() |
1171 | { | 1181 | { |
1172 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); | 1182 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); |
1173 | } | 1183 | } |
1174 | void MainWindow::faq() | 1184 | void MainWindow::faq() |
1175 | { | 1185 | { |
1176 | KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); | 1186 | KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); |
1177 | 1187 | ||
1178 | } | 1188 | } |
1179 | void MainWindow::whatsNew() | 1189 | void MainWindow::whatsNew() |
1180 | { | 1190 | { |
1181 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); | 1191 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); |
1182 | 1192 | ||
1183 | } | 1193 | } |
1184 | void MainWindow::licence() | 1194 | void MainWindow::licence() |
1185 | { | 1195 | { |
1186 | KApplication::showLicence(); | 1196 | KApplication::showLicence(); |
1187 | 1197 | ||
1188 | } | 1198 | } |
1189 | void MainWindow::about() | 1199 | void MainWindow::about() |
1190 | { | 1200 | { |
1191 | QString version; | 1201 | QString version; |
1192 | #include <../version> | 1202 | #include <../version> |
1193 | QMessageBox::about( this, i18n("About KOrganizer/Pi"), | 1203 | QMessageBox::about( this, i18n("About KOrganizer/Pi"), |
1194 | i18n("KOrganizer/Platform-independent\n") + | 1204 | i18n("KOrganizer/Platform-independent\n") + |
1195 | "(KO/Pi) " + version + " - " + | 1205 | "(KO/Pi) " + version + " - " + |
1196 | 1206 | ||
1197 | #ifdef DESKTOP_VERSION | 1207 | #ifdef DESKTOP_VERSION |
1198 | i18n("Desktop Edition\n") + | 1208 | i18n("Desktop Edition\n") + |
1199 | #else | 1209 | #else |
1200 | i18n("PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n") + | 1210 | i18n("PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n") + |
1201 | #endif | 1211 | #endif |
1202 | i18n("(c) 2004 Lutz Rogowski\nEmail:lutz@pi-sync.net\nKO/Pi is based on KOrganizer\n(c) 2002,2003 Cornelius Schumacher\nEmail: schumacher@kde.org\nKOrganizer/Pi is licensed\nunder the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.korganizer.org\nwww.pi-sync.net\n") ); | 1212 | i18n("(c) 2004 Lutz Rogowski\nEmail:lutz@pi-sync.net\nKO/Pi is based on KOrganizer\n(c) 2002,2003 Cornelius Schumacher\nEmail: schumacher@kde.org\nKOrganizer/Pi is licensed\nunder the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.korganizer.org\nwww.pi-sync.net\n") ); |
1203 | } | 1213 | } |
1204 | void MainWindow::keyBindings() | 1214 | void MainWindow::keyBindings() |
1205 | { | 1215 | { |
1206 | QString cap = i18n("KO/Pi Keys + Colors"); | 1216 | QString cap = i18n("KO/Pi Keys + Colors"); |
1207 | QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + | 1217 | QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + |
1208 | i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ | 1218 | i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ |
1209 | i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + | 1219 | i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + |
1210 | i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ | 1220 | i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ |
1211 | i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ | 1221 | i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ |
1212 | i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ | 1222 | i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ |
1213 | i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ | 1223 | i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ |
1214 | i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+ | 1224 | i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+ |
1215 | i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ | 1225 | i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ |
1216 | i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ | 1226 | i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ |
1217 | i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ | 1227 | i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ |
1218 | i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ | 1228 | i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ |
1219 | i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ | 1229 | i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ |
1220 | i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+ | 1230 | i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+ |
1221 | i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ | 1231 | i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ |
1222 | i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ | 1232 | i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ |
1223 | i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ | 1233 | i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ |
1224 | i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ | 1234 | i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ |
1225 | i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ | 1235 | i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ |
1226 | i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ | 1236 | i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ |
1227 | i18n("<p><h3>In agenda view:</h3></p>\n") + | 1237 | i18n("<p><h3>In agenda view:</h3></p>\n") + |
1228 | i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ | 1238 | i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ |
1229 | i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ | 1239 | i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ |
1230 | i18n("<p><h3>In todo view:</h3></p>\n") + | 1240 | i18n("<p><h3>In todo view:</h3></p>\n") + |
1231 | i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ | 1241 | i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ |
1232 | i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ | 1242 | i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ |
1233 | i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ | 1243 | i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ |
1234 | i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ | 1244 | i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ |
1235 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1245 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1236 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ | 1246 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ |
1237 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ | 1247 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ |
1238 | i18n("<p><h3>In list view:</h3></p>\n") + | 1248 | i18n("<p><h3>In list view:</h3></p>\n") + |
1239 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1249 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1240 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ | 1250 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ |
1241 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ | 1251 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ |
1242 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ | 1252 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ |
1243 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ | 1253 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ |
1244 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ | 1254 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ |
1245 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + | 1255 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + |
1246 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ | 1256 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ |
1247 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ | 1257 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ |
1248 | i18n("<p><b>E</b>: Edit item</p>\n") + | 1258 | i18n("<p><b>E</b>: Edit item</p>\n") + |
1249 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + | 1259 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + |
1250 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + | 1260 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + |
1251 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ | 1261 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ |
1252 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ | 1262 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ |
1253 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ | 1263 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ |
1254 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ | 1264 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ |
1255 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ | 1265 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ |
1256 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + | 1266 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + |
1257 | i18n("<p><b>White</b>: Item readonly</p>\n"); | 1267 | i18n("<p><b>White</b>: Item readonly</p>\n"); |
1258 | displayText( text, cap); | 1268 | displayText( text, cap); |
1259 | } | 1269 | } |
1260 | void MainWindow::aboutAutoSaving() | 1270 | void MainWindow::aboutAutoSaving() |
1261 | { | 1271 | { |
1262 | QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"); | 1272 | QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"); |
1263 | 1273 | ||
1264 | KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); | 1274 | KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); |
1265 | 1275 | ||
1266 | } | 1276 | } |
1267 | void MainWindow::aboutKnownBugs() | 1277 | void MainWindow::aboutKnownBugs() |
1268 | { | 1278 | { |
1269 | QMessageBox* msg; | 1279 | QMessageBox* msg; |
1270 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), | 1280 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), |
1271 | i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ | 1281 | i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ |
1272 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ | 1282 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ |
1273 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") + | 1283 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") + |
1274 | i18n("\nor report them in the bugtracker on\n") + | 1284 | i18n("\nor report them in the bugtracker on\n") + |
1275 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), | 1285 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), |
1276 | QMessageBox::NoIcon, | 1286 | QMessageBox::NoIcon, |
1277 | QMessageBox::Ok, | 1287 | QMessageBox::Ok, |
1278 | QMessageBox::NoButton, | 1288 | QMessageBox::NoButton, |
1279 | QMessageBox::NoButton); | 1289 | QMessageBox::NoButton); |
1280 | msg->exec(); | 1290 | msg->exec(); |
1281 | delete msg; | 1291 | delete msg; |
1282 | 1292 | ||
1283 | } | 1293 | } |
1284 | 1294 | ||
1285 | QString MainWindow::defaultFileName() | 1295 | QString MainWindow::defaultFileName() |
1286 | { | 1296 | { |
1287 | return locateLocal( "data", "korganizer/mycalendar.ics" ); | 1297 | return locateLocal( "data", "korganizer/mycalendar.ics" ); |
1288 | } | 1298 | } |
1289 | QString MainWindow::syncFileName() | 1299 | QString MainWindow::syncFileName() |
1290 | { | 1300 | { |
1291 | #ifdef DESKTOP_VERSION | 1301 | #ifdef DESKTOP_VERSION |
1292 | return locateLocal( "tmp", "synccalendar.ics" ); | 1302 | return locateLocal( "tmp", "synccalendar.ics" ); |
1293 | #else | 1303 | #else |
1294 | return QString( "/tmp/synccalendar.ics" ); | 1304 | return QString( "/tmp/synccalendar.ics" ); |
1295 | #endif | 1305 | #endif |
1296 | } | 1306 | } |
1297 | 1307 | ||
1298 | void MainWindow::processIncidenceSelection( Incidence *incidence ) | 1308 | void MainWindow::processIncidenceSelection( Incidence *incidence ) |
1299 | { | 1309 | { |
1300 | if ( !incidence ) { | 1310 | if ( !incidence ) { |
1301 | enableIncidenceActions( false ); | 1311 | enableIncidenceActions( false ); |
1302 | 1312 | ||
1303 | mNewSubTodoAction->setEnabled( false ); | 1313 | mNewSubTodoAction->setEnabled( false ); |
1304 | setCaptionToDates(); | 1314 | setCaptionToDates(); |
1305 | return; | 1315 | return; |
1306 | 1316 | ||
1307 | } | 1317 | } |
1308 | 1318 | ||
1309 | //KGlobal::locale()->formatDateTime(nextA, true); | 1319 | //KGlobal::locale()->formatDateTime(nextA, true); |
1310 | QString startString = ""; | 1320 | QString startString = ""; |
1311 | if ( incidence->type() != "Todo" ) { | 1321 | if ( incidence->type() != "Todo" ) { |
1312 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { | 1322 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { |
1313 | if ( incidence->doesFloat() ) { | 1323 | if ( incidence->doesFloat() ) { |
1314 | startString += ": "+incidence->dtStartDateStr( true ); | 1324 | startString += ": "+incidence->dtStartDateStr( true ); |
1315 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); | 1325 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); |
1316 | 1326 | ||
1317 | } else { | 1327 | } else { |
1318 | startString = ": "+incidence->dtStartStr(true); | 1328 | startString = ": "+incidence->dtStartStr(true); |
1319 | startString += " --- "+((Event*)incidence)->dtEndStr(true); | 1329 | startString += " --- "+((Event*)incidence)->dtEndStr(true); |
1320 | 1330 | ||
1321 | } | 1331 | } |
1322 | 1332 | ||
1323 | } else { | 1333 | } else { |
1324 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) | 1334 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) |
1325 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ | 1335 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ |
1326 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); | 1336 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); |
1327 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); | 1337 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); |
1328 | } | 1338 | } |
1329 | 1339 | ||
1330 | } | 1340 | } |
1331 | else | 1341 | else |
1332 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); | 1342 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); |
1333 | if ( !incidence->location().isEmpty() ) | 1343 | if ( !incidence->location().isEmpty() ) |
1334 | startString += " (" +incidence->location()+")"; | 1344 | startString += " (" +incidence->location()+")"; |
1335 | setCaption( incidence->summary()+startString); | 1345 | setCaption( incidence->summary()+startString); |
1336 | 1346 | ||
1337 | enableIncidenceActions( true ); | 1347 | enableIncidenceActions( true ); |
1338 | 1348 | ||
1339 | if ( incidence->type() == "Event" ) { | 1349 | if ( incidence->type() == "Event" ) { |
1340 | mShowAction->setText( i18n("Show Event...") ); | 1350 | mShowAction->setText( i18n("Show Event...") ); |
1341 | mEditAction->setText( i18n("Edit Event...") ); | 1351 | mEditAction->setText( i18n("Edit Event...") ); |
1342 | mDeleteAction->setText( i18n("Delete Event...") ); | 1352 | mDeleteAction->setText( i18n("Delete Event...") ); |
1343 | 1353 | ||
1344 | mNewSubTodoAction->setEnabled( false ); | 1354 | mNewSubTodoAction->setEnabled( false ); |
1345 | } else if ( incidence->type() == "Todo" ) { | 1355 | } else if ( incidence->type() == "Todo" ) { |
1346 | mShowAction->setText( i18n("Show Todo...") ); | 1356 | mShowAction->setText( i18n("Show Todo...") ); |
1347 | mEditAction->setText( i18n("Edit Todo...") ); | 1357 | mEditAction->setText( i18n("Edit Todo...") ); |
1348 | mDeleteAction->setText( i18n("Delete Todo...") ); | 1358 | mDeleteAction->setText( i18n("Delete Todo...") ); |
1349 | 1359 | ||
1350 | mNewSubTodoAction->setEnabled( true ); | 1360 | mNewSubTodoAction->setEnabled( true ); |
1351 | } else { | 1361 | } else { |
1352 | mShowAction->setText( i18n("Show...") ); | 1362 | mShowAction->setText( i18n("Show...") ); |
1353 | mShowAction->setText( i18n("Edit...") ); | 1363 | mShowAction->setText( i18n("Edit...") ); |
1354 | mShowAction->setText( i18n("Delete...") ); | 1364 | mShowAction->setText( i18n("Delete...") ); |
1355 | 1365 | ||
1356 | mNewSubTodoAction->setEnabled( false ); | 1366 | mNewSubTodoAction->setEnabled( false ); |
1357 | } | 1367 | } |
1358 | } | 1368 | } |
1359 | 1369 | ||
1360 | void MainWindow::enableIncidenceActions( bool enabled ) | 1370 | void MainWindow::enableIncidenceActions( bool enabled ) |
1361 | { | 1371 | { |
1362 | mShowAction->setEnabled( enabled ); | 1372 | mShowAction->setEnabled( enabled ); |
1363 | mEditAction->setEnabled( enabled ); | 1373 | mEditAction->setEnabled( enabled ); |
1364 | mDeleteAction->setEnabled( enabled ); | 1374 | mDeleteAction->setEnabled( enabled ); |
1365 | 1375 | ||
1366 | mCloneAction->setEnabled( enabled ); | 1376 | mCloneAction->setEnabled( enabled ); |
1367 | mMoveAction->setEnabled( enabled ); | 1377 | mMoveAction->setEnabled( enabled ); |
1368 | mBeamAction->setEnabled( enabled ); | 1378 | mBeamAction->setEnabled( enabled ); |
1369 | mCancelAction->setEnabled( enabled ); | 1379 | mCancelAction->setEnabled( enabled ); |
1370 | } | 1380 | } |
1371 | 1381 | ||
1372 | void MainWindow::importOL() | 1382 | void MainWindow::importOL() |
1373 | { | 1383 | { |
1374 | #ifdef _OL_IMPORT_ | 1384 | #ifdef _OL_IMPORT_ |
1375 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); | 1385 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); |
1376 | id->exec(); | 1386 | id->exec(); |
1377 | delete id; | 1387 | delete id; |
1378 | mView->updateView(); | 1388 | mView->updateView(); |
1379 | #endif | 1389 | #endif |
1380 | } | 1390 | } |
1381 | void MainWindow::importBday() | 1391 | void MainWindow::importBday() |
1382 | { | 1392 | { |
1383 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1393 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1384 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), | 1394 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), |
1385 | i18n("Import!"), i18n("Cancel"), 0, | 1395 | i18n("Import!"), i18n("Cancel"), 0, |
1386 | 0, 1 ); | 1396 | 0, 1 ); |
1387 | if ( result == 0 ) { | 1397 | if ( result == 0 ) { |
1388 | mView->importBday(); | 1398 | mView->importBday(); |
1389 | 1399 | ||
1390 | } | 1400 | } |
1391 | 1401 | ||
1392 | 1402 | ||
1393 | } | 1403 | } |
1394 | void MainWindow::importQtopia() | 1404 | void MainWindow::importQtopia() |
1395 | { | 1405 | { |
1396 | #ifndef DESKTOP_VERSION | 1406 | #ifndef DESKTOP_VERSION |
1397 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1407 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1398 | i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"), | 1408 | i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"), |
1399 | i18n("Import!"), i18n("Cancel"), 0, | 1409 | i18n("Import!"), i18n("Cancel"), 0, |
1400 | 0, 1 ); | 1410 | 0, 1 ); |
1401 | if ( result == 0 ) { | 1411 | if ( result == 0 ) { |
1402 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); | 1412 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); |
1403 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); | 1413 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); |
1404 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; | 1414 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; |
1405 | mView->importQtopia( categories, datebook, todolist ); | 1415 | mView->importQtopia( categories, datebook, todolist ); |
1406 | } | 1416 | } |
1407 | #else | 1417 | #else |
1408 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1418 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1409 | i18n("Not supported \non desktop!\n"), | 1419 | i18n("Not supported \non desktop!\n"), |
1410 | i18n("Ok"), i18n("Cancel"), 0, | 1420 | i18n("Ok"), i18n("Cancel"), 0, |
1411 | 0, 1 ); | 1421 | 0, 1 ); |
1412 | 1422 | ||
1413 | #endif | 1423 | #endif |
1414 | } | 1424 | } |
1415 | 1425 | ||
1416 | void MainWindow::saveOnClose() | 1426 | void MainWindow::saveOnClose() |
1417 | { | 1427 | { |
1418 | KOPrefs *p = KOPrefs::instance(); | 1428 | KOPrefs *p = KOPrefs::instance(); |
1419 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); | 1429 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); |
1420 | p->mToolBarUp = iconToolBar->x() > width()/2 || | 1430 | p->mToolBarUp = iconToolBar->x() > width()/2 || |
1421 | iconToolBar->y() > height()/2; | 1431 | iconToolBar->y() > height()/2; |
1422 | mView->writeSettings(); | 1432 | mView->writeSettings(); |
1423 | if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) | 1433 | if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) |
1424 | save(); | 1434 | save(); |
1425 | } | 1435 | } |
1426 | void MainWindow::slotModifiedChanged( bool changed ) | 1436 | void MainWindow::slotModifiedChanged( bool changed ) |
1427 | { | 1437 | { |
1428 | if ( mBlockAtStartup ) | 1438 | if ( mBlockAtStartup ) |
1429 | return; | 1439 | return; |
1430 | int msec; | 1440 | int msec; |
1431 | // we store the changes after 1 minute, | 1441 | // we store the changes after 1 minute, |
1432 | // and for safety reasons after 10 minutes again | 1442 | // and for safety reasons after 10 minutes again |
1433 | if ( !mSyncManager->blockSave() ) | 1443 | if ( !mSyncManager->blockSave() ) |
1434 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; | 1444 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; |
1435 | else | 1445 | else |
1436 | msec = 1000 * 600; | 1446 | msec = 1000 * 600; |
1437 | mSaveTimer.start( msec, true ); // 1 minute | 1447 | mSaveTimer.start( msec, true ); // 1 minute |
1438 | qDebug("KO: Saving File in %d secs!", msec/1000); | 1448 | qDebug("KO: Saving File in %d secs!", msec/1000); |
1439 | mCalendarModifiedFlag = true; | 1449 | mCalendarModifiedFlag = true; |
1440 | } | 1450 | } |
1441 | void MainWindow::save() | 1451 | void MainWindow::save() |
1442 | { | 1452 | { |
1443 | if ( mSyncManager->blockSave() ) | 1453 | if ( mSyncManager->blockSave() ) |
1444 | return; | 1454 | return; |
1445 | mSyncManager->setBlockSave(true); | 1455 | mSyncManager->setBlockSave(true); |
1446 | if ( mView->checkFileVersion( defaultFileName()) ) { | 1456 | if ( mView->checkFileVersion( defaultFileName()) ) { |
1447 | 1457 | ||
1448 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 1458 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
1449 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); | 1459 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); |
1450 | qDebug("KO: Start saving data to file!"); | 1460 | qDebug("KO: Start saving data to file!"); |
1451 | mView->saveCalendar( defaultFileName() ); | 1461 | mView->saveCalendar( defaultFileName() ); |
1452 | 1462 | ||
1453 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 1463 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
1454 | qDebug("KO: Needed %d ms for saving.",msNeeded ); | 1464 | qDebug("KO: Needed %d ms for saving.",msNeeded ); |
1455 | QString savemes; | 1465 | QString savemes; |
1456 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); | 1466 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); |
1457 | setCaption(savemes); | 1467 | setCaption(savemes); |
1458 | } else | 1468 | } else |
1459 | setCaption(i18n("Saving cancelled!")); | 1469 | setCaption(i18n("Saving cancelled!")); |
1460 | mCalendarModifiedFlag = false; | 1470 | mCalendarModifiedFlag = false; |
1461 | mSyncManager->setBlockSave( false ); | 1471 | mSyncManager->setBlockSave( false ); |
1462 | } | 1472 | } |
1463 | 1473 | ||
1464 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) | 1474 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) |
1465 | { | 1475 | { |
1466 | if ( !e->isAutoRepeat() ) { | 1476 | if ( !e->isAutoRepeat() ) { |
1467 | mFlagKeyPressed = false; | 1477 | mFlagKeyPressed = false; |
1468 | } | 1478 | } |
1469 | } | 1479 | } |
1470 | void MainWindow::keyPressEvent ( QKeyEvent * e ) | 1480 | void MainWindow::keyPressEvent ( QKeyEvent * e ) |
1471 | { | 1481 | { |
1472 | qApp->processEvents(); | 1482 | qApp->processEvents(); |
1473 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { | 1483 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { |
1474 | e->ignore(); | 1484 | e->ignore(); |
1475 | // qDebug(" ignore %d",e->isAutoRepeat() ); | 1485 | // qDebug(" ignore %d",e->isAutoRepeat() ); |
1476 | return; | 1486 | return; |
1477 | } | 1487 | } |
1478 | if (! e->isAutoRepeat() ) | 1488 | if (! e->isAutoRepeat() ) |
1479 | mFlagKeyPressed = true; | 1489 | mFlagKeyPressed = true; |
1480 | KOPrefs *p = KOPrefs::instance(); | 1490 | KOPrefs *p = KOPrefs::instance(); |
1481 | bool showSelectedDates = false; | 1491 | bool showSelectedDates = false; |
1482 | int size; | 1492 | int size; |
1483 | int pro = 0; | 1493 | int pro = 0; |
1484 | //qDebug("MainWindow::keyPressEvent "); | 1494 | //qDebug("MainWindow::keyPressEvent "); |
1485 | switch ( e->key() ) { | 1495 | switch ( e->key() ) { |
1486 | case Qt::Key_Right: | 1496 | case Qt::Key_Right: |
1487 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 1497 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
1488 | mView->goNextMonth(); | 1498 | mView->goNextMonth(); |
1489 | else | 1499 | else |
1490 | mView->goNext(); | 1500 | mView->goNext(); |
1491 | showSelectedDates = true; | 1501 | showSelectedDates = true; |
1492 | break; | 1502 | break; |
1493 | case Qt::Key_Left: | 1503 | case Qt::Key_Left: |
1494 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1504 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1495 | mView->goPreviousMonth(); | 1505 | mView->goPreviousMonth(); |
1496 | else | 1506 | else |
1497 | mView->goPrevious(); | 1507 | mView->goPrevious(); |
1498 | showSelectedDates = true; | 1508 | showSelectedDates = true; |
1499 | break; | 1509 | break; |
1500 | case Qt::Key_Down: | 1510 | case Qt::Key_Down: |
1501 | mView->viewManager()->agendaView()->scrollOneHourDown(); | 1511 | mView->viewManager()->agendaView()->scrollOneHourDown(); |
1502 | break; | 1512 | break; |
1503 | case Qt::Key_Up: | 1513 | case Qt::Key_Up: |
1504 | mView->viewManager()->agendaView()->scrollOneHourUp(); | 1514 | mView->viewManager()->agendaView()->scrollOneHourUp(); |
1505 | break; | 1515 | break; |
1506 | case Qt::Key_I: | 1516 | case Qt::Key_I: |
1507 | mView->showIncidence(); | 1517 | mView->showIncidence(); |
1508 | break; | 1518 | break; |
1509 | case Qt::Key_Delete: | 1519 | case Qt::Key_Delete: |
1510 | case Qt::Key_Backspace: | 1520 | case Qt::Key_Backspace: |
1511 | mView->deleteIncidence(); | 1521 | mView->deleteIncidence(); |
1512 | break; | 1522 | break; |
1513 | case Qt::Key_D: | 1523 | case Qt::Key_D: |
1514 | mView->viewManager()->showDayView(); | 1524 | mView->viewManager()->showDayView(); |
1515 | showSelectedDates = true; | 1525 | showSelectedDates = true; |
1516 | break; | 1526 | break; |
1517 | case Qt::Key_O: | 1527 | case Qt::Key_O: |
1518 | mView->toggleFilerEnabled( ); | 1528 | mView->toggleFilerEnabled( ); |
1519 | break; | 1529 | break; |
1520 | case Qt::Key_0: | 1530 | case Qt::Key_0: |
1521 | case Qt::Key_1: | 1531 | case Qt::Key_1: |
1522 | case Qt::Key_2: | 1532 | case Qt::Key_2: |
1523 | case Qt::Key_3: | 1533 | case Qt::Key_3: |
1524 | case Qt::Key_4: | 1534 | case Qt::Key_4: |
1525 | case Qt::Key_5: | 1535 | case Qt::Key_5: |
1526 | case Qt::Key_6: | 1536 | case Qt::Key_6: |
1527 | case Qt::Key_7: | 1537 | case Qt::Key_7: |
1528 | case Qt::Key_8: | 1538 | case Qt::Key_8: |
1529 | case Qt::Key_9: | 1539 | case Qt::Key_9: |
1530 | pro = e->key()-48; | 1540 | pro = e->key()-48; |
1531 | if ( pro == 0 ) | 1541 | if ( pro == 0 ) |
1532 | pro = 10; | 1542 | pro = 10; |
1533 | if ( e->state() == Qt::ControlButton) | 1543 | if ( e->state() == Qt::ControlButton) |
1534 | pro += 10; | 1544 | pro += 10; |
1535 | break; | 1545 | break; |
1536 | case Qt::Key_M: | 1546 | case Qt::Key_M: |
1537 | mView->viewManager()->showMonthView(); | 1547 | mView->viewManager()->showMonthView(); |
1538 | showSelectedDates = true; | 1548 | showSelectedDates = true; |
1539 | break; | 1549 | break; |
1540 | case Qt::Key_Insert: | 1550 | case Qt::Key_Insert: |
1541 | mView->newEvent(); | 1551 | mView->newEvent(); |
1542 | break; | 1552 | break; |
1543 | case Qt::Key_S : | 1553 | case Qt::Key_S : |
1544 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 1554 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
1545 | mView->newSubTodo(); | 1555 | mView->newSubTodo(); |
1546 | else | 1556 | else |
1547 | mView->dialogManager()->showSearchDialog(); | 1557 | mView->dialogManager()->showSearchDialog(); |
1548 | break; | 1558 | break; |
1549 | case Qt::Key_Y : | 1559 | case Qt::Key_Y : |
1550 | case Qt::Key_Z : | 1560 | case Qt::Key_Z : |
1551 | mView->viewManager()->showWorkWeekView(); | 1561 | mView->viewManager()->showWorkWeekView(); |
1552 | showSelectedDates = true; | 1562 | showSelectedDates = true; |
1553 | break; | 1563 | break; |
1554 | case Qt::Key_U : | 1564 | case Qt::Key_U : |
1555 | mView->viewManager()->showWeekView(); | 1565 | mView->viewManager()->showWeekView(); |
1556 | showSelectedDates = true; | 1566 | showSelectedDates = true; |
1557 | break; | 1567 | break; |
1558 | case Qt::Key_H : | 1568 | case Qt::Key_H : |
1559 | keyBindings(); | 1569 | keyBindings(); |
1560 | break; | 1570 | break; |
1561 | case Qt::Key_W: | 1571 | case Qt::Key_W: |
1562 | mView->viewManager()->showWhatsNextView(); | 1572 | mView->viewManager()->showWhatsNextView(); |
1563 | break; | 1573 | break; |
1564 | case Qt::Key_L: | 1574 | case Qt::Key_L: |
1565 | mView->viewManager()->showListView(); | 1575 | mView->viewManager()->showListView(); |
1566 | break; | 1576 | break; |
1567 | case Qt::Key_N: | 1577 | case Qt::Key_N: |
1568 | mView->viewManager()->showNextXView(); | 1578 | mView->viewManager()->showNextXView(); |
1569 | showSelectedDates = true; | 1579 | showSelectedDates = true; |
1570 | break; | 1580 | break; |
1571 | case Qt::Key_V: | 1581 | case Qt::Key_V: |
1572 | mView->viewManager()->showTodoView(); | 1582 | mView->viewManager()->showTodoView(); |
1573 | break; | 1583 | break; |
1574 | case Qt::Key_C: | 1584 | case Qt::Key_C: |
1575 | mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); | 1585 | mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); |
1576 | break; | 1586 | break; |
1577 | case Qt::Key_P: | 1587 | case Qt::Key_P: |
1578 | mView->showDatePicker( ); | 1588 | mView->showDatePicker( ); |
1579 | break; | 1589 | break; |
1580 | case Qt::Key_F: | 1590 | case Qt::Key_F: |
1581 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1591 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1582 | mView->editFilters(); | 1592 | mView->editFilters(); |
1583 | else | 1593 | else |
1584 | mView->toggleFilter(); | 1594 | mView->toggleFilter(); |
1585 | break; | 1595 | break; |
1586 | case Qt::Key_X: | 1596 | case Qt::Key_X: |
1587 | mView->toggleDateNavigatorWidget(); | 1597 | mView->toggleDateNavigatorWidget(); |
1588 | break; | 1598 | break; |
1589 | case Qt::Key_Space: | 1599 | case Qt::Key_Space: |
1590 | mView->toggleExpand(); | 1600 | mView->toggleExpand(); |
1591 | break; | 1601 | break; |
1592 | case Qt::Key_A: | 1602 | case Qt::Key_A: |
1593 | mView->toggleAllDaySize(); | 1603 | mView->toggleAllDaySize(); |
1594 | break; | 1604 | break; |
1595 | case Qt::Key_T: | 1605 | case Qt::Key_T: |
1596 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1606 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1597 | mView->newTodo(); | 1607 | mView->newTodo(); |
1598 | else { | 1608 | else { |
1599 | mView->goToday(); | 1609 | mView->goToday(); |
1600 | showSelectedDates = true; | 1610 | showSelectedDates = true; |
1601 | } | 1611 | } |
1602 | break; | 1612 | break; |
1603 | case Qt::Key_J: | 1613 | case Qt::Key_J: |
1604 | mView->viewManager()->showJournalView(); | 1614 | mView->viewManager()->showJournalView(); |
1605 | break; | 1615 | break; |
1606 | case Qt::Key_B: | 1616 | case Qt::Key_B: |
1607 | mView->editIncidenceDescription();; | 1617 | mView->editIncidenceDescription();; |
1608 | break; | 1618 | break; |
1609 | // case Qt::Key_Return: | 1619 | // case Qt::Key_Return: |
1610 | case Qt::Key_E: | 1620 | case Qt::Key_E: |
1611 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1621 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1612 | mView->newEvent(); | 1622 | mView->newEvent(); |
1613 | else | 1623 | else |
1614 | mView->editIncidence(); | 1624 | mView->editIncidence(); |
1615 | break; | 1625 | break; |
1616 | case Qt::Key_Plus: | 1626 | case Qt::Key_Plus: |
1617 | size = p->mHourSize +2; | 1627 | size = p->mHourSize +2; |
1618 | if ( size <= 18 ) | 1628 | if ( size <= 18 ) |
1619 | configureAgenda( size ); | 1629 | configureAgenda( size ); |
1620 | break; | 1630 | break; |
1621 | case Qt::Key_Minus: | 1631 | case Qt::Key_Minus: |
1622 | size = p->mHourSize - 2; | 1632 | size = p->mHourSize - 2; |
1623 | if ( size >= 4 ) | 1633 | if ( size >= 4 ) |
1624 | configureAgenda( size ); | 1634 | configureAgenda( size ); |
1625 | break; | 1635 | break; |
1626 | 1636 | ||
1627 | 1637 | ||
1628 | default: | 1638 | default: |
1629 | e->ignore(); | 1639 | e->ignore(); |
1630 | } | 1640 | } |
1631 | if ( pro > 0 ) { | 1641 | if ( pro > 0 ) { |
1632 | mView->selectFilter( pro-1 ); | 1642 | mView->selectFilter( pro-1 ); |
1633 | } | 1643 | } |
1634 | if ( showSelectedDates ) { | 1644 | if ( showSelectedDates ) { |
1635 | ;// setCaptionToDates(); | 1645 | ;// setCaptionToDates(); |
1636 | } | 1646 | } |
1637 | 1647 | ||
1638 | } | 1648 | } |
1639 | 1649 | ||
1640 | void MainWindow::fillFilterMenu() | 1650 | void MainWindow::fillFilterMenu() |
1641 | { | 1651 | { |
1642 | selectFilterMenu->clear(); | 1652 | selectFilterMenu->clear(); |
1643 | bool disable = false; | 1653 | bool disable = false; |
1644 | selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); | 1654 | selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); |
1645 | selectFilterMenu->insertSeparator(); | 1655 | selectFilterMenu->insertSeparator(); |
1646 | if ( mView->filterView()->filtersEnabled() ) { | 1656 | if ( mView->filterView()->filtersEnabled() ) { |
1647 | selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 1 ); | 1657 | selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 1 ); |
1648 | } | 1658 | } |
1649 | else { | 1659 | else { |
1650 | selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 1 ); | 1660 | selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 1 ); |
1651 | disable = true; | 1661 | disable = true; |
1652 | } | 1662 | } |
1653 | selectFilterMenu->insertSeparator(); | 1663 | selectFilterMenu->insertSeparator(); |
1654 | QPtrList<CalFilter> fili = mView->filters(); | 1664 | QPtrList<CalFilter> fili = mView->filters(); |
1655 | CalFilter *curfilter = mView->filterView()->selectedFilter(); | 1665 | CalFilter *curfilter = mView->filterView()->selectedFilter(); |
1656 | CalFilter *filter = fili.first(); | 1666 | CalFilter *filter = fili.first(); |
1657 | int iii = 2; | 1667 | int iii = 2; |
1658 | while(filter) { | 1668 | while(filter) { |
1659 | selectFilterMenu->insertItem( filter->name(), iii ); | 1669 | selectFilterMenu->insertItem( filter->name(), iii ); |
1660 | if ( filter == curfilter) | 1670 | if ( filter == curfilter) |
1661 | selectFilterMenu->setItemChecked( iii, true ); | 1671 | selectFilterMenu->setItemChecked( iii, true ); |
1662 | if ( disable ) | 1672 | if ( disable ) |
1663 | selectFilterMenu->setItemEnabled( iii, false ); | 1673 | selectFilterMenu->setItemEnabled( iii, false ); |
1664 | filter = fili.next(); | 1674 | filter = fili.next(); |
1665 | ++iii; | 1675 | ++iii; |
1666 | } | 1676 | } |
1667 | } | 1677 | } |
1668 | void MainWindow::selectFilter( int fil ) | 1678 | void MainWindow::selectFilter( int fil ) |
1669 | { | 1679 | { |
1670 | if ( fil == 0 ) { | 1680 | if ( fil == 0 ) { |
1671 | mView->editFilters( ); | 1681 | mView->editFilters( ); |
1672 | } else if ( fil == 1 ){ | 1682 | } else if ( fil == 1 ){ |
1673 | mView->toggleFilerEnabled( ); | 1683 | mView->toggleFilerEnabled( ); |
1674 | } else { | 1684 | } else { |
1675 | mView->selectFilter( fil-2 ); | 1685 | mView->selectFilter( fil-2 ); |
1676 | } | 1686 | } |
1677 | } | 1687 | } |
1678 | void MainWindow::configureToolBar( int item ) | 1688 | void MainWindow::configureToolBar( int item ) |
1679 | { | 1689 | { |
1680 | 1690 | ||
1681 | configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); | 1691 | configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); |
1682 | KOPrefs *p = KOPrefs::instance(); | 1692 | KOPrefs *p = KOPrefs::instance(); |
1683 | p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); | 1693 | p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); |
1684 | p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); | 1694 | p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); |
1685 | p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); | 1695 | p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); |
1686 | p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); | 1696 | p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); |
1687 | p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); | 1697 | p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); |
1688 | p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); | 1698 | p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); |
1689 | p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); | 1699 | p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); |
1690 | p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); | 1700 | p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); |
1691 | p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); | 1701 | p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); |
1692 | p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); | 1702 | p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); |
1693 | p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); | 1703 | p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); |
1694 | p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); | 1704 | p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); |
1695 | p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); | 1705 | p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); |
1696 | p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); | 1706 | p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); |
1697 | p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); | 1707 | p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); |
1698 | p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); | 1708 | p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); |
1699 | p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); | 1709 | p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); |
1700 | p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); | 1710 | p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); |
1701 | p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); | 1711 | p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); |
1702 | // initActions(); | 1712 | // initActions(); |
1703 | } | 1713 | } |
1704 | 1714 | ||
1705 | void MainWindow::setCaptionToDates() | 1715 | void MainWindow::setCaptionToDates() |
1706 | { | 1716 | { |
1707 | QString selDates; | 1717 | QString selDates; |
1708 | selDates = KGlobal::locale()->formatDate(mView->startDate(), true); | 1718 | selDates = KGlobal::locale()->formatDate(mView->startDate(), true); |
1709 | if (mView->startDate() < mView->endDate() ) | 1719 | if (mView->startDate() < mView->endDate() ) |
1710 | selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); | 1720 | selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); |
1711 | else { | 1721 | else { |
1712 | QString addString; | 1722 | QString addString; |
1713 | if ( mView->startDate() == QDateTime::currentDateTime().date() ) | 1723 | if ( mView->startDate() == QDateTime::currentDateTime().date() ) |
1714 | addString = i18n("Today"); | 1724 | addString = i18n("Today"); |
1715 | else if ( mView->startDate() == QDateTime::currentDateTime().date().addDays(1) ) | 1725 | else if ( mView->startDate() == QDateTime::currentDateTime().date().addDays(1) ) |
1716 | addString = i18n("Tomorrow"); | 1726 | addString = i18n("Tomorrow"); |
1717 | if ( !addString.isEmpty() ) | 1727 | if ( !addString.isEmpty() ) |
1718 | selDates = addString+", "+selDates ; | 1728 | selDates = addString+", "+selDates ; |
1719 | } | 1729 | } |
1720 | setCaption( i18n("Dates: ") + selDates ); | 1730 | setCaption( i18n("Dates: ") + selDates ); |
1721 | 1731 | ||
1722 | } | 1732 | } |
1723 | // parameter item == 0: reinit | 1733 | void MainWindow::showConfigureAgenda( ) |
1734 | { | ||
1735 | int iii; | ||
1736 | for ( iii = 1;iii<= 10 ;++iii ){ | ||
1737 | configureAgendaMenu->setItemChecked( (iii+1)*2, false ); | ||
1738 | } | ||
1739 | configureAgendaMenu->setItemChecked( KOPrefs::instance()->mHourSize, true ); | ||
1740 | } | ||
1724 | void MainWindow::configureAgenda( int item ) | 1741 | void MainWindow::configureAgenda( int item ) |
1725 | { | 1742 | { |
1726 | 1743 | if ( KOPrefs::instance()->mHourSize == item ) | |
1727 | KOPrefs *p = KOPrefs::instance(); | ||
1728 | |||
1729 | int i; | ||
1730 | // do not allow 4 for widgets higher than 480 | ||
1731 | // if ( QApplication::desktop()->height() > 480 ) { | ||
1732 | // if ( item == 4 ) | ||
1733 | // item = 6; | ||
1734 | // } | ||
1735 | for ( i = 4; i <= 18; i= i+2 ) | ||
1736 | configureAgendaMenu->setItemChecked( i, false ); | ||
1737 | configureAgendaMenu->setItemChecked( item, true ); | ||
1738 | if ( p->mHourSize == item ) | ||
1739 | return; | 1744 | return; |
1740 | p->mHourSize=item; | 1745 | KOPrefs::instance()->mHourSize=item; |
1741 | mView->viewManager()->agendaView()->updateConfig(); | 1746 | mView->viewManager()->agendaView()->updateConfig(); |
1742 | } | 1747 | } |
1743 | 1748 | ||
1744 | void MainWindow::saveCalendar() | 1749 | void MainWindow::saveCalendar() |
1745 | { | 1750 | { |
1746 | QString fn = KOPrefs::instance()->mLastSaveFile; | 1751 | QString fn = KOPrefs::instance()->mLastSaveFile; |
1747 | fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); | 1752 | fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); |
1748 | 1753 | ||
1749 | if ( fn == "" ) | 1754 | if ( fn == "" ) |
1750 | return; | 1755 | return; |
1751 | QFileInfo info; | 1756 | QFileInfo info; |
1752 | info.setFile( fn ); | 1757 | info.setFile( fn ); |
1753 | QString mes; | 1758 | QString mes; |
1754 | bool createbup = true; | 1759 | bool createbup = true; |
1755 | if ( info. exists() ) { | 1760 | if ( info. exists() ) { |
1756 | mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; | 1761 | mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; |
1757 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, | 1762 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, |
1758 | i18n("Overwrite!"), i18n("Cancel"), 0, | 1763 | i18n("Overwrite!"), i18n("Cancel"), 0, |
1759 | 0, 1 ); | 1764 | 0, 1 ); |
1760 | if ( result != 0 ) { | 1765 | if ( result != 0 ) { |
1761 | createbup = false; | 1766 | createbup = false; |
1762 | } | 1767 | } |
1763 | } | 1768 | } |
1764 | if ( createbup ) { | 1769 | if ( createbup ) { |
1765 | mView->saveCalendar( fn ); | 1770 | mView->saveCalendar( fn ); |
1766 | mes = i18n("KO/Pi:Saved %1").arg(fn); | 1771 | mes = i18n("KO/Pi:Saved %1").arg(fn); |
1767 | KOPrefs::instance()->mLastSaveFile = fn; | 1772 | KOPrefs::instance()->mLastSaveFile = fn; |
1768 | setCaption(mes); | 1773 | setCaption(mes); |
1769 | } | 1774 | } |
1770 | } | 1775 | } |
1771 | void MainWindow::loadCalendar() | 1776 | void MainWindow::loadCalendar() |
1772 | { | 1777 | { |
1773 | 1778 | ||
1774 | QString fn = KOPrefs::instance()->mLastLoadFile; | 1779 | QString fn = KOPrefs::instance()->mLastLoadFile; |
1775 | fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); | 1780 | fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); |
1776 | 1781 | ||
1777 | if ( fn == "" ) | 1782 | if ( fn == "" ) |
1778 | return; | 1783 | return; |
1779 | QFileInfo info; | 1784 | QFileInfo info; |
1780 | info.setFile( fn ); | 1785 | info.setFile( fn ); |
1781 | QString mess; | 1786 | QString mess; |
1782 | bool loadbup = true; | 1787 | bool loadbup = true; |
1783 | if ( info. exists() ) { | 1788 | if ( info. exists() ) { |
1784 | mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); | 1789 | mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); |
1785 | int result = QMessageBox::warning( this, "KO/Pi: Warning!", | 1790 | int result = QMessageBox::warning( this, "KO/Pi: Warning!", |
1786 | mess, | 1791 | mess, |
1787 | i18n("Load!"), i18n("Cancel"), 0, | 1792 | i18n("Load!"), i18n("Cancel"), 0, |
1788 | 0, 1 ); | 1793 | 0, 1 ); |
1789 | if ( result != 0 ) { | 1794 | if ( result != 0 ) { |
1790 | loadbup = false; | 1795 | loadbup = false; |
1791 | } | 1796 | } |
1792 | } else { | 1797 | } else { |
1793 | QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1798 | QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1794 | i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, | 1799 | i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, |
1795 | 0, 1 ); | 1800 | 0, 1 ); |
1796 | 1801 | ||
1797 | return; | 1802 | return; |
1798 | } | 1803 | } |
1799 | if ( loadbup ) { | 1804 | if ( loadbup ) { |
1800 | mView->openCalendar( fn ); | 1805 | mView->openCalendar( fn ); |
1801 | KOPrefs::instance()->mLastLoadFile = fn; | 1806 | KOPrefs::instance()->mLastLoadFile = fn; |
1802 | mess = i18n("KO/Pi:Loaded %1").arg(fn) ; | 1807 | mess = i18n("KO/Pi:Loaded %1").arg(fn) ; |
1803 | setCaption(mess); | 1808 | setCaption(mess); |
1804 | } | 1809 | } |
1805 | 1810 | ||
1806 | } | 1811 | } |
1807 | void MainWindow::quickImportIcal() | 1812 | void MainWindow::quickImportIcal() |
1808 | { | 1813 | { |
1809 | importFile( KOPrefs::instance()->mLastImportFile, false ); | 1814 | importFile( KOPrefs::instance()->mLastImportFile, false ); |
1810 | } | 1815 | } |
1811 | void MainWindow::importFile( QString fn, bool quick ) | 1816 | void MainWindow::importFile( QString fn, bool quick ) |
1812 | { | 1817 | { |
1813 | QFileInfo info; | 1818 | QFileInfo info; |
1814 | info.setFile( fn ); | 1819 | info.setFile( fn ); |
1815 | QString mess; | 1820 | QString mess; |
1816 | bool loadbup = true; | 1821 | bool loadbup = true; |
1817 | if ( !info. exists() ) { | 1822 | if ( !info. exists() ) { |
1818 | mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); | 1823 | mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); |
1819 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1824 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1820 | mess ); | 1825 | mess ); |
1821 | return; | 1826 | return; |
1822 | } | 1827 | } |
1823 | int result = 0; | 1828 | int result = 0; |
1824 | if ( !quick ) { | 1829 | if ( !quick ) { |
1825 | mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); | 1830 | mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); |
1826 | result = QMessageBox::warning( this, "KO/Pi: Warning!", | 1831 | result = QMessageBox::warning( this, "KO/Pi: Warning!", |
1827 | mess, | 1832 | mess, |
1828 | "Import", "Cancel", 0, | 1833 | "Import", "Cancel", 0, |
1829 | 0, 1 ); | 1834 | 0, 1 ); |
1830 | } | 1835 | } |
1831 | if ( result == 0 ) { | 1836 | if ( result == 0 ) { |
1832 | if ( mView->openCalendar( fn, true )) { | 1837 | if ( mView->openCalendar( fn, true )) { |
1833 | KOPrefs::instance()->mLastImportFile = fn; | 1838 | KOPrefs::instance()->mLastImportFile = fn; |
1834 | setCaption(i18n("Imported file successfully")); | 1839 | setCaption(i18n("Imported file successfully")); |
1835 | } else { | 1840 | } else { |
1836 | setCaption(i18n("Error importing file")); | 1841 | setCaption(i18n("Error importing file")); |
1837 | } | 1842 | } |
1838 | } | 1843 | } |
1839 | } | 1844 | } |
1840 | 1845 | ||
1841 | void MainWindow::importIcal() | 1846 | void MainWindow::importIcal() |
1842 | { | 1847 | { |
1843 | 1848 | ||
1844 | QString fn =KOPrefs::instance()->mLastImportFile; | 1849 | QString fn =KOPrefs::instance()->mLastImportFile; |
1845 | 1850 | ||
1846 | fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); | 1851 | fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); |
1847 | if ( fn == "" ) | 1852 | if ( fn == "" ) |
1848 | return; | 1853 | return; |
1849 | importFile( fn, true ); | 1854 | importFile( fn, true ); |
1850 | 1855 | ||
1851 | } | 1856 | } |
1852 | 1857 | ||
1853 | void MainWindow::exportVCalendar() | 1858 | void MainWindow::exportVCalendar() |
1854 | { | 1859 | { |
1855 | QString fn = KOPrefs::instance()->mLastVcalFile; | 1860 | QString fn = KOPrefs::instance()->mLastVcalFile; |
1856 | fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); | 1861 | fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); |
1857 | if ( fn == "" ) | 1862 | if ( fn == "" ) |
1858 | return; | 1863 | return; |
1859 | QFileInfo info; | 1864 | QFileInfo info; |
1860 | info.setFile( fn ); | 1865 | info.setFile( fn ); |
1861 | QString mes; | 1866 | QString mes; |
1862 | bool createbup = true; | 1867 | bool createbup = true; |
1863 | if ( info. exists() ) { | 1868 | if ( info. exists() ) { |
1864 | mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); | 1869 | mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); |
1865 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, | 1870 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, |
1866 | i18n("Overwrite!"), i18n("Cancel"), 0, | 1871 | i18n("Overwrite!"), i18n("Cancel"), 0, |
1867 | 0, 1 ); | 1872 | 0, 1 ); |
1868 | if ( result != 0 ) { | 1873 | if ( result != 0 ) { |
1869 | createbup = false; | 1874 | createbup = false; |
1870 | } | 1875 | } |
1871 | } | 1876 | } |
1872 | if ( createbup ) { | 1877 | if ( createbup ) { |
1873 | if ( mView->exportVCalendar( fn ) ) { | 1878 | if ( mView->exportVCalendar( fn ) ) { |
1874 | KOPrefs::instance()->mLastVcalFile = fn; | 1879 | KOPrefs::instance()->mLastVcalFile = fn; |
1875 | if ( fn.length() > 20 ) | 1880 | if ( fn.length() > 20 ) |
1876 | mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; | 1881 | mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; |
1877 | else | 1882 | else |
1878 | mes = i18n("KO/Pi:Exported to %1").arg(fn ); | 1883 | mes = i18n("KO/Pi:Exported to %1").arg(fn ); |
1879 | setCaption(mes); | 1884 | setCaption(mes); |
1880 | } | 1885 | } |
1881 | } | 1886 | } |
1882 | 1887 | ||
1883 | } | 1888 | } |
1884 | 1889 | ||
1885 | void MainWindow::syncFileRequest() | 1890 | void MainWindow::syncFileRequest() |
1886 | { | 1891 | { |
1887 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { | 1892 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { |
1888 | mSyncManager->slotSyncMenu( 999 ); | 1893 | mSyncManager->slotSyncMenu( 999 ); |
1889 | } | 1894 | } |
1890 | save(); | 1895 | save(); |
1891 | } | 1896 | } |
1892 | void MainWindow::getFile( bool success ) | 1897 | void MainWindow::getFile( bool success ) |
1893 | { | 1898 | { |
1894 | if ( ! success ) { | 1899 | if ( ! success ) { |
1895 | setCaption( i18n("Error receiving file. Nothing changed!") ); | 1900 | setCaption( i18n("Error receiving file. Nothing changed!") ); |
1896 | return; | 1901 | return; |
1897 | } | 1902 | } |
1898 | mView->openCalendar( defaultFileName() ); | 1903 | mView->openCalendar( defaultFileName() ); |
1899 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { | 1904 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { |
1900 | mSyncManager->slotSyncMenu( 999 ); | 1905 | mSyncManager->slotSyncMenu( 999 ); |
1901 | } | 1906 | } |
1902 | setCaption( i18n("Pi-Sync successful!") ); | 1907 | setCaption( i18n("Pi-Sync successful!") ); |
1903 | } | 1908 | } |
1904 | 1909 | ||
1905 | void MainWindow::printSel( ) | 1910 | void MainWindow::printSel( ) |
1906 | { | 1911 | { |
1907 | mView->viewManager()->agendaView()->agenda()->printSelection(); | 1912 | mView->viewManager()->agendaView()->agenda()->printSelection(); |
1908 | } | 1913 | } |
1909 | 1914 | ||
1910 | void MainWindow::printCal() | 1915 | void MainWindow::printCal() |
1911 | { | 1916 | { |
1912 | mView->print();//mCp->showDialog(); | 1917 | mView->print();//mCp->showDialog(); |
1913 | } | 1918 | } |
1914 | 1919 | ||
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h index 96e627e..6de0543 100644 --- a/korganizer/mainwindow.h +++ b/korganizer/mainwindow.h | |||
@@ -1,139 +1,141 @@ | |||
1 | #ifndef KORGE_MAINWINDOW_H | 1 | #ifndef KORGE_MAINWINDOW_H |
2 | #define KORGE_MAINWINDOW_H | 2 | #define KORGE_MAINWINDOW_H |
3 | 3 | ||
4 | #include <qmainwindow.h> | 4 | #include <qmainwindow.h> |
5 | #include <qtimer.h> | 5 | #include <qtimer.h> |
6 | #include <qdict.h> | 6 | #include <qdict.h> |
7 | #include <qfile.h> | 7 | #include <qfile.h> |
8 | #include <qtextstream.h> | 8 | #include <qtextstream.h> |
9 | #include <qregexp.h> | 9 | #include <qregexp.h> |
10 | 10 | ||
11 | #include <libkcal/incidence.h> | 11 | #include <libkcal/incidence.h> |
12 | #include "simplealarmclient.h" | 12 | #include "simplealarmclient.h" |
13 | #include <ksyncmanager.h> | 13 | #include <ksyncmanager.h> |
14 | #ifndef DESKTOP_VERSION | 14 | #ifndef DESKTOP_VERSION |
15 | #include <qcopchannel_qws.h> | 15 | #include <qcopchannel_qws.h> |
16 | #endif | 16 | #endif |
17 | class QAction; | 17 | class QAction; |
18 | class CalendarView; | 18 | class CalendarView; |
19 | class KSyncProfile; | 19 | class KSyncProfile; |
20 | #ifdef DESKTOP_VERSION | 20 | #ifdef DESKTOP_VERSION |
21 | 21 | ||
22 | #define QPEToolBar QToolBar | 22 | #define QPEToolBar QToolBar |
23 | #define QPEMenuBar QMenuBar | 23 | #define QPEMenuBar QMenuBar |
24 | #endif | 24 | #endif |
25 | class QPEToolBar; | 25 | class QPEToolBar; |
26 | 26 | ||
27 | 27 | ||
28 | namespace KCal { | 28 | namespace KCal { |
29 | class CalendarLocal; | 29 | class CalendarLocal; |
30 | } | 30 | } |
31 | 31 | ||
32 | using namespace KCal; | 32 | using namespace KCal; |
33 | 33 | ||
34 | class MainWindow : public QMainWindow | 34 | class MainWindow : public QMainWindow |
35 | { | 35 | { |
36 | Q_OBJECT | 36 | Q_OBJECT |
37 | public: | 37 | public: |
38 | MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); | 38 | MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); |
39 | ~MainWindow(); | 39 | ~MainWindow(); |
40 | bool beamReceiveEnabled(); | 40 | bool beamReceiveEnabled(); |
41 | static QString defaultFileName(); | ||
42 | static QString syncFileName(); | ||
43 | static QString resourcePath(); | ||
41 | public slots: | 44 | public slots: |
42 | virtual void showMaximized (); | 45 | virtual void showMaximized (); |
43 | void configureAgenda( int ); | 46 | void configureAgenda( int ); |
44 | void recieve( const QCString& msg, const QByteArray& data ); | 47 | void recieve( const QCString& msg, const QByteArray& data ); |
45 | static QString defaultFileName(); | 48 | protected slots: |
46 | static QString syncFileName(); | ||
47 | static QString resourcePath(); | ||
48 | protected slots: | ||
49 | void setCaptionToDates(); | 49 | void setCaptionToDates(); |
50 | void about(); | 50 | void about(); |
51 | void licence(); | 51 | void licence(); |
52 | void faq(); | 52 | void faq(); |
53 | void usertrans(); | 53 | void usertrans(); |
54 | void features(); | 54 | void features(); |
55 | void synchowto(); | 55 | void synchowto(); |
56 | void kdesynchowto(); | 56 | void kdesynchowto(); |
57 | void multisynchowto(); | 57 | void multisynchowto(); |
58 | void whatsNew(); | 58 | void whatsNew(); |
59 | void keyBindings(); | 59 | void keyBindings(); |
60 | void aboutAutoSaving();; | 60 | void aboutAutoSaving();; |
61 | void aboutKnownBugs(); | 61 | void aboutKnownBugs(); |
62 | 62 | ||
63 | void processIncidenceSelection( Incidence * ); | 63 | void processIncidenceSelection( Incidence * ); |
64 | 64 | ||
65 | void importQtopia(); | 65 | void importQtopia(); |
66 | void importBday(); | 66 | void importBday(); |
67 | void importOL(); | 67 | void importOL(); |
68 | void importIcal(); | 68 | void importIcal(); |
69 | void importFile( QString, bool ); | 69 | void importFile( QString, bool ); |
70 | void quickImportIcal(); | 70 | void quickImportIcal(); |
71 | 71 | ||
72 | void slotModifiedChanged( bool ); | 72 | void slotModifiedChanged( bool ); |
73 | 73 | ||
74 | void save(); | 74 | void save(); |
75 | void configureToolBar( int ); | 75 | void configureToolBar( int ); |
76 | void printSel(); | 76 | void printSel(); |
77 | void printCal(); | 77 | void printCal(); |
78 | void saveCalendar(); | 78 | void saveCalendar(); |
79 | void loadCalendar(); | 79 | void loadCalendar(); |
80 | void exportVCalendar(); | 80 | void exportVCalendar(); |
81 | void fillFilterMenu(); | 81 | void fillFilterMenu(); |
82 | void selectFilter( int ); | 82 | void selectFilter( int ); |
83 | void exportToPhone( int ); | 83 | void exportToPhone( int ); |
84 | void toggleBeamReceive(); | 84 | void toggleBeamReceive(); |
85 | void disableBR(bool); | 85 | void disableBR(bool); |
86 | 86 | ||
87 | private slots: | ||
88 | void showConfigureAgenda(); | ||
89 | void getFile( bool ); | ||
90 | void syncFileRequest(); | ||
87 | 91 | ||
88 | protected: | 92 | protected: |
89 | void displayText( QString, QString); | 93 | void displayText( QString, QString); |
90 | |||
91 | void enableIncidenceActions( bool ); | 94 | void enableIncidenceActions( bool ); |
92 | 95 | ||
93 | private slots: | ||
94 | QSocket* piSocket; | ||
95 | QString piFileString; | ||
96 | QTime piTime; | ||
97 | void getFile( bool ); | ||
98 | void syncFileRequest(); | ||
99 | private: | 96 | private: |
100 | bool mBRdisabled; | 97 | bool mBRdisabled; |
101 | #ifndef DESKTOP_VERSION | 98 | #ifndef DESKTOP_VERSION |
102 | QCopChannel* infrared; | 99 | QCopChannel* infrared; |
103 | #endif | 100 | #endif |
104 | QAction* brAction; | 101 | QAction* brAction; |
105 | KSyncManager* mSyncManager; | 102 | KSyncManager* mSyncManager; |
106 | bool mClosed; | 103 | bool mClosed; |
107 | void saveOnClose(); | 104 | void saveOnClose(); |
108 | bool mFlagKeyPressed; | 105 | bool mFlagKeyPressed; |
109 | bool mBlockAtStartup; | 106 | bool mBlockAtStartup; |
110 | QPEToolBar *iconToolBar; | 107 | QPEToolBar *iconToolBar; |
111 | void initActions(); | 108 | void initActions(); |
112 | void setDefaultPreferences(); | 109 | void setDefaultPreferences(); |
113 | void keyPressEvent ( QKeyEvent * ) ; | 110 | void keyPressEvent ( QKeyEvent * ) ; |
114 | void keyReleaseEvent ( QKeyEvent * ) ; | 111 | void keyReleaseEvent ( QKeyEvent * ) ; |
115 | QPopupMenu *configureToolBarMenu; | 112 | QPopupMenu *configureToolBarMenu; |
116 | QPopupMenu *selectFilterMenu; | 113 | QPopupMenu *selectFilterMenu; |
117 | QPopupMenu *configureAgendaMenu, *syncMenu; | 114 | QPopupMenu *configureAgendaMenu, *syncMenu; |
118 | CalendarLocal *mCalendar; | 115 | CalendarLocal *mCalendar; |
119 | CalendarView *mView; | 116 | CalendarView *mView; |
120 | QAction *mNewSubTodoAction; | 117 | QAction *mNewSubTodoAction; |
121 | 118 | ||
122 | QAction *mShowAction; | 119 | QAction *mShowAction; |
123 | QAction *mEditAction; | 120 | QAction *mEditAction; |
124 | QAction *mDeleteAction; | 121 | QAction *mDeleteAction; |
125 | QAction *mCloneAction; | 122 | QAction *mCloneAction; |
126 | QAction *mMoveAction; | 123 | QAction *mMoveAction; |
127 | QAction *mBeamAction; | 124 | QAction *mBeamAction; |
128 | QAction *mCancelAction; | 125 | QAction *mCancelAction; |
129 | 126 | ||
127 | QAction *mToggleNav; | ||
128 | QAction *mToggleFilter; | ||
129 | QAction *mToggleAllday; | ||
130 | |||
131 | |||
130 | void closeEvent( QCloseEvent* ce ); | 132 | void closeEvent( QCloseEvent* ce ); |
131 | SimpleAlarmClient mAlarmClient; | 133 | SimpleAlarmClient mAlarmClient; |
132 | QTimer mSaveTimer; | 134 | QTimer mSaveTimer; |
133 | //bool mBlockSaveFlag; | 135 | //bool mBlockSaveFlag; |
134 | bool mCalendarModifiedFlag; | 136 | bool mCalendarModifiedFlag; |
135 | QPixmap loadPixmap( QString ); | 137 | QPixmap loadPixmap( QString ); |
136 | }; | 138 | }; |
137 | 139 | ||
138 | 140 | ||
139 | #endif | 141 | #endif |