-rw-r--r-- | korganizer/komonthview.cpp | 19 | ||||
-rw-r--r-- | korganizer/komonthview.h | 3 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 26 | ||||
-rw-r--r-- | korganizer/mainwindow.h | 1 |
4 files changed, 46 insertions, 3 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index ca35a86..b9ce4f4 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -1,1886 +1,1903 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <qpopupmenu.h> | 20 | #include <qpopupmenu.h> |
21 | #include <qfont.h> | 21 | #include <qfont.h> |
22 | #include <qfontmetrics.h> | 22 | #include <qfontmetrics.h> |
23 | #include <qkeycode.h> | 23 | #include <qkeycode.h> |
24 | #include <qhbox.h> | 24 | #include <qhbox.h> |
25 | #include <qvbox.h> | 25 | #include <qvbox.h> |
26 | #include <qwidgetstack.h> | 26 | #include <qwidgetstack.h> |
27 | #include <qpushbutton.h> | 27 | #include <qpushbutton.h> |
28 | #include <qtooltip.h> | 28 | #include <qtooltip.h> |
29 | #include <qpainter.h> | 29 | #include <qpainter.h> |
30 | #include <qtimer.h> | 30 | #include <qtimer.h> |
31 | #include <qwhatsthis.h> | 31 | #include <qwhatsthis.h> |
32 | #ifndef DESKTOP_VERSION | 32 | #ifndef DESKTOP_VERSION |
33 | #include <qpe/qpeapplication.h> | 33 | #include <qpe/qpeapplication.h> |
34 | #else | 34 | #else |
35 | #include <qapplication.h> | 35 | #include <qapplication.h> |
36 | #endif | 36 | #endif |
37 | 37 | ||
38 | #include <kdebug.h> | 38 | #include <kdebug.h> |
39 | #include <klocale.h> | 39 | #include <klocale.h> |
40 | #include <kglobal.h> | 40 | #include <kglobal.h> |
41 | #include <kconfig.h> | 41 | #include <kconfig.h> |
42 | #include <kiconloader.h> | 42 | #include <kiconloader.h> |
43 | 43 | ||
44 | #include <kcalendarsystem.h> | 44 | #include <kcalendarsystem.h> |
45 | 45 | ||
46 | #ifndef KORG_NOPRINTER | 46 | #ifndef KORG_NOPRINTER |
47 | #include "calprinter.h" | 47 | #include "calprinter.h" |
48 | #endif | 48 | #endif |
49 | #include "koprefs.h" | 49 | #include "koprefs.h" |
50 | #ifndef KORG_NOPLUGINS | 50 | #ifndef KORG_NOPLUGINS |
51 | #include "kocore.h" | 51 | #include "kocore.h" |
52 | #endif | 52 | #endif |
53 | #include "koglobals.h" | 53 | #include "koglobals.h" |
54 | #include <libkcal/kincidenceformatter.h> | 54 | #include <libkcal/kincidenceformatter.h> |
55 | 55 | ||
56 | #include "komonthview.h" | 56 | #include "komonthview.h" |
57 | 57 | ||
58 | #define PIXMAP_SIZE 5 | 58 | #define PIXMAP_SIZE 5 |
59 | #ifdef DESKTOP_VERSION | 59 | #ifdef DESKTOP_VERSION |
60 | QToolTipGroup *MonthViewCell::mToolTipGroup = 0; | 60 | QToolTipGroup *MonthViewCell::mToolTipGroup = 0; |
61 | #endif | 61 | #endif |
62 | class KNOWhatsThis :public QWhatsThis | 62 | class KNOWhatsThis :public QWhatsThis |
63 | { | 63 | { |
64 | public: | 64 | public: |
65 | KNOWhatsThis( KNoScrollListBox* sbox ) : QWhatsThis( sbox ), _wid( sbox) { }; | 65 | KNOWhatsThis( KNoScrollListBox* sbox ) : QWhatsThis( sbox ), _wid( sbox) { }; |
66 | //~KNOWhatsThis( ) {qDebug("~KNOWhatsThis( ) "); }; | 66 | //~KNOWhatsThis( ) {qDebug("~KNOWhatsThis( ) "); }; |
67 | 67 | ||
68 | protected: | 68 | protected: |
69 | virtual QString text( const QPoint& p) | 69 | virtual QString text( const QPoint& p) |
70 | { | 70 | { |
71 | return _wid->getWhatsThisText(p) ; | 71 | return _wid->getWhatsThisText(p) ; |
72 | }; | 72 | }; |
73 | private: | 73 | private: |
74 | KNoScrollListBox* _wid; | 74 | KNoScrollListBox* _wid; |
75 | 75 | ||
76 | }; | 76 | }; |
77 | 77 | ||
78 | 78 | ||
79 | KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name) | 79 | KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name) |
80 | : QListBox(parent, name, WRepaintNoErase) | 80 | : QListBox(parent, name, WRepaintNoErase) |
81 | { | 81 | { |
82 | #ifndef DESKTOP_VERSION | 82 | #ifndef DESKTOP_VERSION |
83 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); | 83 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); |
84 | #endif | 84 | #endif |
85 | mWT = new KNOWhatsThis(this); | 85 | mWT = new KNOWhatsThis(this); |
86 | } | 86 | } |
87 | KNoScrollListBox::~KNoScrollListBox() | 87 | KNoScrollListBox::~KNoScrollListBox() |
88 | { | 88 | { |
89 | 89 | ||
90 | } | 90 | } |
91 | QString KNoScrollListBox::getWhatsThisText(QPoint p) | 91 | QString KNoScrollListBox::getWhatsThisText(QPoint p) |
92 | { | 92 | { |
93 | QListBoxItem* item = itemAt ( p ); | 93 | QListBoxItem* item = itemAt ( p ); |
94 | if ( ! item ) { | 94 | if ( ! item ) { |
95 | return i18n("Click in the cell\nto add an event!"); | 95 | return i18n("Click in the cell\nto add an event!"); |
96 | } | 96 | } |
97 | return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence(), | 97 | return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence(), |
98 | KOPrefs::instance()->mWTshowDetails, | 98 | KOPrefs::instance()->mWTshowDetails, |
99 | KOPrefs::instance()->mWTshowCreated, | 99 | KOPrefs::instance()->mWTshowCreated, |
100 | KOPrefs::instance()->mWTshowChanged); | 100 | KOPrefs::instance()->mWTshowChanged); |
101 | } | 101 | } |
102 | void KNoScrollListBox::keyPressEvent(QKeyEvent *e) | 102 | void KNoScrollListBox::keyPressEvent(QKeyEvent *e) |
103 | { | 103 | { |
104 | //qDebug("KNoScrollListBox::keyPressEvent "); | 104 | //qDebug("KNoScrollListBox::keyPressEvent "); |
105 | switch(e->key()) { | 105 | switch(e->key()) { |
106 | case Key_Right: | 106 | case Key_Right: |
107 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 107 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
108 | { | 108 | { |
109 | e->ignore(); | 109 | e->ignore(); |
110 | return; | 110 | return; |
111 | } | 111 | } |
112 | scrollBy(10,0); | 112 | scrollBy(10,0); |
113 | break; | 113 | break; |
114 | case Key_Left: | 114 | case Key_Left: |
115 | if (e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 115 | if (e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
116 | { | 116 | { |
117 | e->ignore(); | 117 | e->ignore(); |
118 | return; | 118 | return; |
119 | } | 119 | } |
120 | scrollBy(-10,0); | 120 | scrollBy(-10,0); |
121 | break; | 121 | break; |
122 | case Key_Up: | 122 | case Key_Up: |
123 | if( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { | 123 | if( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { |
124 | e->ignore(); | 124 | e->ignore(); |
125 | break; | 125 | break; |
126 | } | 126 | } |
127 | if ( count() ) { | 127 | if ( count() ) { |
128 | setCurrentItem((currentItem()+count()-1)%count()); | 128 | setCurrentItem((currentItem()+count()-1)%count()); |
129 | if(!itemVisible(currentItem())) { | 129 | if(!itemVisible(currentItem())) { |
130 | if((unsigned int) currentItem() == (count()-1)) { | 130 | if((unsigned int) currentItem() == (count()-1)) { |
131 | setTopItem(currentItem()-numItemsVisible()+1); | 131 | setTopItem(currentItem()-numItemsVisible()+1); |
132 | } else { | 132 | } else { |
133 | setTopItem(topItem()-1); | 133 | setTopItem(topItem()-1); |
134 | } | 134 | } |
135 | } | 135 | } |
136 | } | 136 | } |
137 | break; | 137 | break; |
138 | case Key_Down: | 138 | case Key_Down: |
139 | if(e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { | 139 | if(e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { |
140 | e->ignore(); | 140 | e->ignore(); |
141 | break; | 141 | break; |
142 | } | 142 | } |
143 | if ( count () ) { | 143 | if ( count () ) { |
144 | setCurrentItem((currentItem()+1)%count()); | 144 | setCurrentItem((currentItem()+1)%count()); |
145 | if(!itemVisible(currentItem())) { | 145 | if(!itemVisible(currentItem())) { |
146 | if(currentItem() == 0) { | 146 | if(currentItem() == 0) { |
147 | setTopItem(0); | 147 | setTopItem(0); |
148 | } else { | 148 | } else { |
149 | setTopItem(topItem()+1); | 149 | setTopItem(topItem()+1); |
150 | } | 150 | } |
151 | } | 151 | } |
152 | } | 152 | } |
153 | break; | 153 | break; |
154 | case Key_I: | 154 | case Key_I: |
155 | QTimer::singleShot( 11, this, SLOT ( oneDown() ) ); | 155 | QTimer::singleShot( 11, this, SLOT ( oneDown() ) ); |
156 | e->ignore(); | 156 | e->ignore(); |
157 | break; | 157 | break; |
158 | case Key_Return: | 158 | case Key_Return: |
159 | case Key_Enter: | 159 | case Key_Enter: |
160 | { | 160 | { |
161 | if ( currentItem() >= 0 ) { | 161 | if ( currentItem() >= 0 ) { |
162 | emit doubleClicked( item( currentItem() ) ); | 162 | emit doubleClicked( item( currentItem() ) ); |
163 | e->accept(); | 163 | e->accept(); |
164 | } else { | 164 | } else { |
165 | e->ignore(); | 165 | e->ignore(); |
166 | } | 166 | } |
167 | } | 167 | } |
168 | break; | 168 | break; |
169 | case Key_Shift: | 169 | case Key_Shift: |
170 | emit shiftDown(); | 170 | emit shiftDown(); |
171 | break; | 171 | break; |
172 | default: | 172 | default: |
173 | e->ignore(); | 173 | e->ignore(); |
174 | break; | 174 | break; |
175 | } | 175 | } |
176 | } | 176 | } |
177 | 177 | ||
178 | void KNoScrollListBox::oneDown() | 178 | void KNoScrollListBox::oneDown() |
179 | { | 179 | { |
180 | if ( count () ) { | 180 | if ( count () ) { |
181 | setCurrentItem((currentItem()+1)%count()); | 181 | setCurrentItem((currentItem()+1)%count()); |
182 | if(!itemVisible(currentItem())) { | 182 | if(!itemVisible(currentItem())) { |
183 | if(currentItem() == 0) { | 183 | if(currentItem() == 0) { |
184 | setTopItem(0); | 184 | setTopItem(0); |
185 | } else { | 185 | } else { |
186 | setTopItem(topItem()+1); | 186 | setTopItem(topItem()+1); |
187 | } | 187 | } |
188 | } | 188 | } |
189 | } | 189 | } |
190 | } | 190 | } |
191 | void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e) | 191 | void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e) |
192 | { | 192 | { |
193 | switch(e->key()) { | 193 | switch(e->key()) { |
194 | case Key_Shift: | 194 | case Key_Shift: |
195 | emit shiftUp(); | 195 | emit shiftUp(); |
196 | break; | 196 | break; |
197 | default: | 197 | default: |
198 | break; | 198 | break; |
199 | } | 199 | } |
200 | } | 200 | } |
201 | 201 | ||
202 | void KNoScrollListBox::mousePressEvent(QMouseEvent *e) | 202 | void KNoScrollListBox::mousePressEvent(QMouseEvent *e) |
203 | { | 203 | { |
204 | QListBox::mousePressEvent(e); | 204 | QListBox::mousePressEvent(e); |
205 | 205 | ||
206 | if(e->button() == RightButton) { | 206 | if(e->button() == RightButton) { |
207 | emit rightClick(); | 207 | emit rightClick(); |
208 | } | 208 | } |
209 | } | 209 | } |
210 | 210 | ||
211 | MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s) | 211 | MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s) |
212 | : QListBoxItem() | 212 | : QListBoxItem() |
213 | { | 213 | { |
214 | mblockRepaint = true; | 214 | mblockRepaint = true; |
215 | setText( s ); | 215 | setText( s ); |
216 | mMultiday = 0; | 216 | mMultiday = 0; |
217 | mIncidence = incidence; | 217 | mIncidence = incidence; |
218 | mDate = qd; | 218 | mDate = qd; |
219 | mRecur = false; | 219 | mRecur = false; |
220 | mAlarm = false; | 220 | mAlarm = false; |
221 | mReply = false; | 221 | mReply = false; |
222 | mInfo = false; | 222 | mInfo = false; |
223 | //qDebug("NEWWWWWWWWWWWWW "); | 223 | //qDebug("NEWWWWWWWWWWWWW "); |
224 | } | 224 | } |
225 | void MonthViewItem::recycle( Incidence *incidence, QDate qd, const QString & s) | 225 | void MonthViewItem::recycle( Incidence *incidence, QDate qd, const QString & s) |
226 | { | 226 | { |
227 | setText( s ); | 227 | setText( s ); |
228 | mMultiday = 0; | 228 | mMultiday = 0; |
229 | mIncidence = incidence; | 229 | mIncidence = incidence; |
230 | mDate = qd; | 230 | mDate = qd; |
231 | mRecur = false; | 231 | mRecur = false; |
232 | mAlarm = false; | 232 | mAlarm = false; |
233 | mReply = false; | 233 | mReply = false; |
234 | mInfo = false; | 234 | mInfo = false; |
235 | //qDebug("recucleeeeeeeeeeeeeeeee "); | 235 | //qDebug("recucleeeeeeeeeeeeeeeee "); |
236 | } | 236 | } |
237 | 237 | ||
238 | void MonthViewItem::paint(QPainter *p) | 238 | void MonthViewItem::paint(QPainter *p) |
239 | { | 239 | { |
240 | if ( mblockRepaint ) { | 240 | if ( mblockRepaint ) { |
241 | //qDebug("block "); | 241 | //qDebug("block "); |
242 | return; | 242 | return; |
243 | } | 243 | } |
244 | //qDebug("NON block "); | 244 | //qDebug("NON block "); |
245 | #if QT_VERSION >= 0x030000 | 245 | #if QT_VERSION >= 0x030000 |
246 | bool sel = isSelected(); | 246 | bool sel = isSelected(); |
247 | #else | 247 | #else |
248 | bool sel = selected(); | 248 | bool sel = selected(); |
249 | #endif | 249 | #endif |
250 | 250 | ||
251 | 251 | ||
252 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) | 252 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) |
253 | { | 253 | { |
254 | p->setBackgroundColor( palette().color( QPalette::Normal, \ | 254 | p->setBackgroundColor( palette().color( QPalette::Normal, \ |
255 | sel ? QColorGroup::Highlight : QColorGroup::Background ) ); | 255 | sel ? QColorGroup::Highlight : QColorGroup::Background ) ); |
256 | p->eraseRect( 0, 0, listBox()->maxItemWidth(), height( listBox() ) ); | 256 | p->eraseRect( 0, 0, listBox()->maxItemWidth(), height( listBox() ) ); |
257 | } | 257 | } |
258 | int x = 1; | 258 | int x = 1; |
259 | //int y = 3;//(height() - mRecurPixmap.height()) /2; | 259 | //int y = 3;//(height() - mRecurPixmap.height()) /2; |
260 | int size = PIXMAP_SIZE; | 260 | int size = PIXMAP_SIZE; |
261 | if ( QApplication::desktop()->width() < 300 ) | 261 | if ( QApplication::desktop()->width() < 300 ) |
262 | size = 3; | 262 | size = 3; |
263 | int heihei = height( listBox () ); | 263 | int heihei = height( listBox () ); |
264 | int y = (heihei - size -1 ) /2; | 264 | int y = (heihei - size -1 ) /2; |
265 | 265 | ||
266 | if ( KOPrefs::instance()->mMonthShowIcons ) { | 266 | if ( KOPrefs::instance()->mMonthShowIcons ) { |
267 | if ( mInfo ) { | 267 | if ( mInfo ) { |
268 | p->fillRect ( x, y,size,size, Qt::darkGreen ); | 268 | p->fillRect ( x, y,size,size, Qt::darkGreen ); |
269 | x += size + 1; | 269 | x += size + 1; |
270 | } | 270 | } |
271 | if ( mRecur ) { | 271 | if ( mRecur ) { |
272 | p->fillRect ( x, y,size,size, Qt::blue ); | 272 | p->fillRect ( x, y,size,size, Qt::blue ); |
273 | x += size + 1; | 273 | x += size + 1; |
274 | } | 274 | } |
275 | if ( mAlarm ) { | 275 | if ( mAlarm ) { |
276 | p->fillRect ( x, y,size,size, Qt::red ); | 276 | p->fillRect ( x, y,size,size, Qt::red ); |
277 | x += size + 1; | 277 | x += size + 1; |
278 | } | 278 | } |
279 | if ( mReply ) { | 279 | if ( mReply ) { |
280 | p->fillRect ( x, y,size,size, Qt::yellow ); | 280 | p->fillRect ( x, y,size,size, Qt::yellow ); |
281 | x += size + 1; | 281 | x += size + 1; |
282 | } | 282 | } |
283 | } | 283 | } |
284 | if ( mMultiday ) { | 284 | if ( mMultiday ) { |
285 | int yyy = y+(size/2); | 285 | int yyy = y+(size/2); |
286 | int sizeM = size+2; | 286 | int sizeM = size+2; |
287 | p->setBrush( QBrush::SolidPattern ); | 287 | p->setBrush( QBrush::SolidPattern ); |
288 | p->drawLine ( x+1, yyy, x +sizeM +sizeM/2-1, yyy ) ; | 288 | p->drawLine ( x+1, yyy, x +sizeM +sizeM/2-1, yyy ) ; |
289 | if ( mMultiday == 2 || mMultiday == 3 ) { | 289 | if ( mMultiday == 2 || mMultiday == 3 ) { |
290 | QPointArray pa ( 3 ); | 290 | QPointArray pa ( 3 ); |
291 | pa.setPoint (0, x, yyy ); | 291 | pa.setPoint (0, x, yyy ); |
292 | pa.setPoint (1, x+sizeM/2, yyy+sizeM/2 ); | 292 | pa.setPoint (1, x+sizeM/2, yyy+sizeM/2 ); |
293 | pa.setPoint (2, x+sizeM/2, yyy-sizeM/2 ); | 293 | pa.setPoint (2, x+sizeM/2, yyy-sizeM/2 ); |
294 | p->drawPolygon( pa ); | 294 | p->drawPolygon( pa ); |
295 | } | 295 | } |
296 | if ( mMultiday == 2 || mMultiday == 1 ) { | 296 | if ( mMultiday == 2 || mMultiday == 1 ) { |
297 | QPointArray pa ( 3 ); | 297 | QPointArray pa ( 3 ); |
298 | pa.setPoint (0, x+sizeM +sizeM/2, yyy ); | 298 | pa.setPoint (0, x+sizeM +sizeM/2, yyy ); |
299 | pa.setPoint (1, x+sizeM, yyy+sizeM/2 ); | 299 | pa.setPoint (1, x+sizeM, yyy+sizeM/2 ); |
300 | pa.setPoint (2, x+sizeM, yyy-sizeM/2 ); | 300 | pa.setPoint (2, x+sizeM, yyy-sizeM/2 ); |
301 | p->drawPolygon( pa ); | 301 | p->drawPolygon( pa ); |
302 | } | 302 | } |
303 | if ( mMultiday == 1 ) { | 303 | if ( mMultiday == 1 ) { |
304 | // p->fillRect ( x, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); | 304 | // p->fillRect ( x, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); |
305 | 305 | ||
306 | p->drawLine ( x+1, yyy-sizeM/2, x+1, yyy+sizeM/2 ); | 306 | p->drawLine ( x+1, yyy-sizeM/2, x+1, yyy+sizeM/2 ); |
307 | } | 307 | } |
308 | if ( mMultiday == 3 ) { | 308 | if ( mMultiday == 3 ) { |
309 | // p->fillRect ( x+sizeM, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); | 309 | // p->fillRect ( x+sizeM, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); |
310 | p->drawLine ( x+sizeM +sizeM/2-1, yyy-sizeM/2, x+sizeM +sizeM/2-1, yyy+sizeM/2 ); | 310 | p->drawLine ( x+sizeM +sizeM/2-1, yyy-sizeM/2, x+sizeM +sizeM/2-1, yyy+sizeM/2 ); |
311 | 311 | ||
312 | } | 312 | } |
313 | x += sizeM/2 + 1; | 313 | x += sizeM/2 + 1; |
314 | x += sizeM + 1; | 314 | x += sizeM + 1; |
315 | } | 315 | } |
316 | 316 | ||
317 | if ( mIncidence->type() == "Todo" ){ | 317 | if ( mIncidence->type() == "Todo" ){ |
318 | Todo* td = ( Todo* ) mIncidence; | 318 | Todo* td = ( Todo* ) mIncidence; |
319 | if ( td->isCompleted() ) { | 319 | if ( td->isCompleted() ) { |
320 | int half = size/2; | 320 | int half = size/2; |
321 | p->drawLine ( x, heihei/2, x +half , heihei/2 +half ) ; | 321 | p->drawLine ( x, heihei/2, x +half , heihei/2 +half ) ; |
322 | p->drawLine ( x +half , heihei/2 +half , x +half+half +2 , heihei/2 -2 ) ; | 322 | p->drawLine ( x +half , heihei/2 +half , x +half+half +2 , heihei/2 -2 ) ; |
323 | x += half+half + 4; | 323 | x += half+half + 4; |
324 | 324 | ||
325 | } else { | 325 | } else { |
326 | int val = td->percentComplete()/20; | 326 | int val = td->percentComplete()/20; |
327 | p->fillRect ( x+1, y-2, val ,size+4,Qt::black ); | 327 | p->fillRect ( x+1, y-2, val ,size+4,Qt::black ); |
328 | p->drawRect ( x, y-2,7,size+4); | 328 | p->drawRect ( x, y-2,7,size+4); |
329 | x += size + 3; | 329 | x += size + 3; |
330 | } | 330 | } |
331 | } | 331 | } |
332 | QFontMetrics fm = p->fontMetrics(); | 332 | QFontMetrics fm = p->fontMetrics(); |
333 | int yPos; | 333 | int yPos; |
334 | int pmheight = size; | 334 | int pmheight = size; |
335 | if( pmheight < fm.height() ) | 335 | if( pmheight < fm.height() ) |
336 | yPos = fm.ascent() + fm.leading()/2; | 336 | yPos = fm.ascent() + fm.leading()/2; |
337 | else | 337 | else |
338 | yPos = pmheight/2 - fm.height()/2 + fm.ascent(); | 338 | yPos = pmheight/2 - fm.height()/2 + fm.ascent(); |
339 | p->setPen( palette().color( QPalette::Normal, sel ? \ | 339 | p->setPen( palette().color( QPalette::Normal, sel ? \ |
340 | QColorGroup::HighlightedText : QColorGroup::Foreground ) ); | 340 | QColorGroup::HighlightedText : QColorGroup::Foreground ) ); |
341 | p->drawText( x, yPos, text() ); | 341 | p->drawText( x, yPos, text() ); |
342 | if ( mIncidence->cancelled() ) { | 342 | if ( mIncidence->cancelled() ) { |
343 | int wid = fm.width( text() ); | 343 | int wid = fm.width( text() ); |
344 | p->drawLine( x, heihei/2-1 ,x+wid, heihei/2-1 ); | 344 | p->drawLine( x, heihei/2-1 ,x+wid, heihei/2-1 ); |
345 | } | 345 | } |
346 | 346 | ||
347 | } | 347 | } |
348 | 348 | ||
349 | int MonthViewItem::height(const QListBox *lb) const | 349 | int MonthViewItem::height(const QListBox *lb) const |
350 | { | 350 | { |
351 | int ret = 10; | 351 | int ret = 10; |
352 | if ( lb ) | 352 | if ( lb ) |
353 | ret = lb->fontMetrics().lineSpacing()+1; | 353 | ret = lb->fontMetrics().lineSpacing()+1; |
354 | return ret; | 354 | return ret; |
355 | } | 355 | } |
356 | 356 | ||
357 | int MonthViewItem::width(const QListBox *lb) const | 357 | int MonthViewItem::width(const QListBox *lb) const |
358 | { | 358 | { |
359 | 359 | ||
360 | if( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) { | 360 | if( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) { |
361 | int size = PIXMAP_SIZE; | 361 | int size = PIXMAP_SIZE; |
362 | if ( QApplication::desktop()->width() < 300 ) | 362 | if ( QApplication::desktop()->width() < 300 ) |
363 | size = 3; | 363 | size = 3; |
364 | int x = 1; | 364 | int x = 1; |
365 | if ( KOPrefs::instance()->mMonthShowIcons ) { | 365 | if ( KOPrefs::instance()->mMonthShowIcons ) { |
366 | if ( mInfo ) { | 366 | if ( mInfo ) { |
367 | x += size + 1; | 367 | x += size + 1; |
368 | } | 368 | } |
369 | if( mRecur ) { | 369 | if( mRecur ) { |
370 | x += size+1; | 370 | x += size+1; |
371 | } | 371 | } |
372 | if( mAlarm ) { | 372 | if( mAlarm ) { |
373 | x += size+1; | 373 | x += size+1; |
374 | } | 374 | } |
375 | if( mReply ) { | 375 | if( mReply ) { |
376 | x += size+1; | 376 | x += size+1; |
377 | } | 377 | } |
378 | } | 378 | } |
379 | if( mMultiday ) { | 379 | if( mMultiday ) { |
380 | x += size+1+2+size/2; | 380 | x += size+1+2+size/2; |
381 | } | 381 | } |
382 | return( x + lb->fontMetrics().width( text() ) + 1 ); | 382 | return( x + lb->fontMetrics().width( text() ) + 1 ); |
383 | } | 383 | } |
384 | if ( ! lb ) | 384 | if ( ! lb ) |
385 | return 10; | 385 | return 10; |
386 | //qDebug("ret wid %d ", lb->width()); | 386 | //qDebug("ret wid %d ", lb->width()); |
387 | return lb->width(); | 387 | return lb->width(); |
388 | } | 388 | } |
389 | 389 | ||
390 | 390 | ||
391 | MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par ) | 391 | MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par ) |
392 | : KNoScrollListBox( par ), | 392 | : KNoScrollListBox( par ), |
393 | mMonthView( parent ) | 393 | mMonthView( parent ) |
394 | { | 394 | { |
395 | 395 | ||
396 | mCurrentAvailItem = 0; | 396 | mCurrentAvailItem = 0; |
397 | //QVBoxLayout *topLayout = new QVBoxLayout( this ); | 397 | //QVBoxLayout *topLayout = new QVBoxLayout( this ); |
398 | currentPalette = 0; | 398 | currentPalette = 0; |
399 | // mLabel = new QLabel( this );QPushButton | 399 | // mLabel = new QLabel( this );QPushButton |
400 | mLabel = new QPushButton( this ); | 400 | mLabel = new QPushButton( this ); |
401 | //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain ); | 401 | //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain ); |
402 | //mLabel->setLineWidth( 1 ); | 402 | //mLabel->setLineWidth( 1 ); |
403 | //mLabel->setAlignment( AlignCenter ); | 403 | //mLabel->setAlignment( AlignCenter ); |
404 | mLabel->setFlat( true ); | 404 | mLabel->setFlat( true ); |
405 | mLabel->setFocusPolicy(NoFocus); | 405 | mLabel->setFocusPolicy(NoFocus); |
406 | //mItemList = new KNoScrollListBox( this ); | 406 | //mItemList = new KNoScrollListBox( this ); |
407 | setMinimumSize( 10, 10 ); | 407 | setMinimumSize( 10, 10 ); |
408 | setFrameStyle( QFrame::Panel | QFrame::Plain ); | 408 | setFrameStyle( QFrame::Panel | QFrame::Plain ); |
409 | setLineWidth( 1 ); | 409 | setLineWidth( 1 ); |
410 | //topLayout->addWidget( mItemList ); | 410 | //topLayout->addWidget( mItemList ); |
411 | mLabel->raise(); | 411 | mLabel->raise(); |
412 | // QColor( 0,0,255 ) QColor( 160,1600,255 ) | 412 | // QColor( 0,0,255 ) QColor( 160,1600,255 ) |
413 | mStandardPalette = palette(); | 413 | mStandardPalette = palette(); |
414 | mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) ); | 414 | mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) ); |
415 | 415 | ||
416 | enableScrollBars( false ); | 416 | enableScrollBars( false ); |
417 | updateConfig(); | 417 | updateConfig(); |
418 | //connect( mLabel, SIGNAL( clicked( )), SLOT( newEvent() )); | 418 | //connect( mLabel, SIGNAL( clicked( )), SLOT( newEvent() )); |
419 | connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() )); | 419 | connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() )); |
420 | connect( this , SIGNAL( doubleClicked( QListBoxItem *) ), | 420 | connect( this , SIGNAL( doubleClicked( QListBoxItem *) ), |
421 | SLOT( defaultAction( QListBoxItem * ) ) ); | 421 | SLOT( defaultAction( QListBoxItem * ) ) ); |
422 | connect( this, SIGNAL( rightButtonPressed( QListBoxItem *, | 422 | connect( this, SIGNAL( rightButtonPressed( QListBoxItem *, |
423 | const QPoint &) ), | 423 | const QPoint &) ), |
424 | SLOT( contextMenu( QListBoxItem * ) ) ); | 424 | SLOT( contextMenu( QListBoxItem * ) ) ); |
425 | connect( this, SIGNAL( highlighted( QListBoxItem *) ), | 425 | connect( this, SIGNAL( highlighted( QListBoxItem *) ), |
426 | SLOT( selection( QListBoxItem * ) ) ); | 426 | SLOT( selection( QListBoxItem * ) ) ); |
427 | connect( this, SIGNAL( clicked( QListBoxItem * ) ), | 427 | connect( this, SIGNAL( clicked( QListBoxItem * ) ), |
428 | SLOT( cellClicked( QListBoxItem * ) ) ); | 428 | SLOT( cellClicked( QListBoxItem * ) ) ); |
429 | connect( this, SIGNAL( clicked( QListBoxItem * ) ), | 429 | connect( this, SIGNAL( clicked( QListBoxItem * ) ), |
430 | SLOT( selection( QListBoxItem * ) ) ); | 430 | SLOT( selection( QListBoxItem * ) ) ); |
431 | } | 431 | } |
432 | #ifdef DESKTOP_VERSION | 432 | #ifdef DESKTOP_VERSION |
433 | QToolTipGroup *MonthViewCell::toolTipGroup() | 433 | QToolTipGroup *MonthViewCell::toolTipGroup() |
434 | { | 434 | { |
435 | if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); | 435 | if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); |
436 | return mToolTipGroup; | 436 | return mToolTipGroup; |
437 | } | 437 | } |
438 | #endif | 438 | #endif |
439 | 439 | ||
440 | void MonthViewCell::setDate( const QDate &date ) | 440 | void MonthViewCell::setDate( const QDate &date ) |
441 | { | 441 | { |
442 | // kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl; | 442 | // kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl; |
443 | mDate = date; | 443 | mDate = date; |
444 | 444 | ||
445 | 445 | ||
446 | 446 | ||
447 | //resizeEvent( 0 ); | 447 | //resizeEvent( 0 ); |
448 | } | 448 | } |
449 | 449 | ||
450 | QDate MonthViewCell::date() const | 450 | QDate MonthViewCell::date() const |
451 | { | 451 | { |
452 | return mDate; | 452 | return mDate; |
453 | } | 453 | } |
454 | 454 | ||
455 | void MonthViewCell::setPrimary( bool primary ) | 455 | void MonthViewCell::setPrimary( bool primary ) |
456 | { | 456 | { |
457 | mPrimary = primary; | 457 | mPrimary = primary; |
458 | //setMyPalette(); | 458 | //setMyPalette(); |
459 | } | 459 | } |
460 | void MonthViewCell::setMyPalette() | 460 | void MonthViewCell::setMyPalette() |
461 | { | 461 | { |
462 | 462 | ||
463 | if ( mHoliday) { | 463 | if ( mHoliday) { |
464 | if ( currentPalette == 1 ) return; | 464 | if ( currentPalette == 1 ) return; |
465 | mLabel->setPalette( QPalette ( mHolidayPalette.color( QPalette::Normal,QColorGroup::Base),mHolidayPalette.color(QPalette::Normal,QColorGroup::Base ) )); | 465 | mLabel->setPalette( QPalette ( mHolidayPalette.color( QPalette::Normal,QColorGroup::Base),mHolidayPalette.color(QPalette::Normal,QColorGroup::Base ) )); |
466 | setPalette( mHolidayPalette ); | 466 | setPalette( mHolidayPalette ); |
467 | //mLabel->setPalette( mHolidayPalette ); | 467 | //mLabel->setPalette( mHolidayPalette ); |
468 | currentPalette = 1; | 468 | currentPalette = 1; |
469 | 469 | ||
470 | } else { | 470 | } else { |
471 | if ( mPrimary ) { | 471 | if ( mPrimary ) { |
472 | if ( currentPalette == 2 ) return; | 472 | if ( currentPalette == 2 ) return; |
473 | mLabel->setPalette( QPalette ( mPrimaryPalette.color( QPalette::Normal,QColorGroup::Base),mPrimaryPalette.color(QPalette::Normal,QColorGroup::Base ) )); | 473 | mLabel->setPalette( QPalette ( mPrimaryPalette.color( QPalette::Normal,QColorGroup::Base),mPrimaryPalette.color(QPalette::Normal,QColorGroup::Base ) )); |
474 | //mLabel->setPalette( mPrimaryPalette ); | 474 | //mLabel->setPalette( mPrimaryPalette ); |
475 | setPalette( mPrimaryPalette ); | 475 | setPalette( mPrimaryPalette ); |
476 | currentPalette = 2; | 476 | currentPalette = 2; |
477 | 477 | ||
478 | } else { | 478 | } else { |
479 | if ( currentPalette == 3 ) return; | 479 | if ( currentPalette == 3 ) return; |
480 | setPalette( mNonPrimaryPalette ); | 480 | setPalette( mNonPrimaryPalette ); |
481 | mLabel->setPalette( QPalette ( mNonPrimaryPalette.color( QPalette::Normal,QColorGroup::Base),mNonPrimaryPalette.color(QPalette::Normal,QColorGroup::Base ) )); | 481 | mLabel->setPalette( QPalette ( mNonPrimaryPalette.color( QPalette::Normal,QColorGroup::Base),mNonPrimaryPalette.color(QPalette::Normal,QColorGroup::Base ) )); |
482 | //mLabel->setPalette( mNonPrimaryPalette );; | 482 | //mLabel->setPalette( mNonPrimaryPalette );; |
483 | currentPalette = 3; | 483 | currentPalette = 3; |
484 | } | 484 | } |
485 | } | 485 | } |
486 | //QPalette pal = palette(); | 486 | //QPalette pal = palette(); |
487 | 487 | ||
488 | //mLabel->setPalette( QPalette ( pal.color( QPalette::Normal,QColorGroup::Base),pal.color(QPalette::Normal,QColorGroup::Base ) )); | 488 | //mLabel->setPalette( QPalette ( pal.color( QPalette::Normal,QColorGroup::Base),pal.color(QPalette::Normal,QColorGroup::Base ) )); |
489 | } | 489 | } |
490 | QPalette MonthViewCell::getPalette () | 490 | QPalette MonthViewCell::getPalette () |
491 | { | 491 | { |
492 | if ( !KOPrefs::instance()->mMonthViewUsesDayColors ) | 492 | if ( !KOPrefs::instance()->mMonthViewUsesDayColors ) |
493 | return mStandardPalette; | 493 | return mStandardPalette; |
494 | if ( mHoliday) { | 494 | if ( mHoliday) { |
495 | return mHolidayPalette ; | 495 | return mHolidayPalette ; |
496 | } else { | 496 | } else { |
497 | if ( mPrimary ) { | 497 | if ( mPrimary ) { |
498 | return mPrimaryPalette ; | 498 | return mPrimaryPalette ; |
499 | } | 499 | } |
500 | } | 500 | } |
501 | return mNonPrimaryPalette; | 501 | return mNonPrimaryPalette; |
502 | } | 502 | } |
503 | bool MonthViewCell::isPrimary() const | 503 | bool MonthViewCell::isPrimary() const |
504 | { | 504 | { |
505 | return mPrimary; | 505 | return mPrimary; |
506 | } | 506 | } |
507 | 507 | ||
508 | void MonthViewCell::setHoliday( bool holiday ) | 508 | void MonthViewCell::setHoliday( bool holiday ) |
509 | { | 509 | { |
510 | mHoliday = holiday; | 510 | mHoliday = holiday; |
511 | //setMyPalette(); | 511 | //setMyPalette(); |
512 | } | 512 | } |
513 | 513 | ||
514 | void MonthViewCell::setHoliday( const QString &holiday ) | 514 | void MonthViewCell::setHoliday( const QString &holiday ) |
515 | { | 515 | { |
516 | mHolidayString = holiday; | 516 | mHolidayString = holiday; |
517 | 517 | ||
518 | if ( !holiday.isEmpty() ) { | 518 | if ( !holiday.isEmpty() ) { |
519 | setHoliday( true ); | 519 | setHoliday( true ); |
520 | } | 520 | } |
521 | } | 521 | } |
522 | 522 | ||
523 | void MonthViewCell::startUpdateCell() | 523 | void MonthViewCell::startUpdateCell() |
524 | { | 524 | { |
525 | 525 | ||
526 | setFocusPolicy(NoFocus); | 526 | setFocusPolicy(NoFocus); |
527 | if ( !mMonthView->isUpdatePossible() ) | 527 | if ( !mMonthView->isUpdatePossible() ) |
528 | return; | 528 | return; |
529 | MonthViewItem *mitem = (MonthViewItem*) firstItem (); | 529 | MonthViewItem *mitem = (MonthViewItem*) firstItem (); |
530 | while ( mitem ) { | 530 | while ( mitem ) { |
531 | mitem->setBlockRepaint( true ); | 531 | mitem->setBlockRepaint( true ); |
532 | mitem = (MonthViewItem *)mitem->next(); | 532 | mitem = (MonthViewItem *)mitem->next(); |
533 | } | 533 | } |
534 | if ( mAvailItemList.count() > 20 ) { | 534 | if ( mAvailItemList.count() > 20 ) { |
535 | mAvailItemList.setAutoDelete( true ); | 535 | mAvailItemList.setAutoDelete( true ); |
536 | mAvailItemList.clear(); | 536 | mAvailItemList.clear(); |
537 | mAvailItemList.setAutoDelete( false ); | 537 | mAvailItemList.setAutoDelete( false ); |
538 | } | 538 | } |
539 | /* | 539 | /* |
540 | if ( !isVisible() ){ | 540 | if ( !isVisible() ){ |
541 | return; | 541 | return; |
542 | } | 542 | } |
543 | */ | 543 | */ |
544 | // qDebug("MonthViewCell::updateCell() "); | 544 | // qDebug("MonthViewCell::updateCell() "); |
545 | setPrimary( mDate.month()%2 ); | 545 | setPrimary( mDate.month()%2 ); |
546 | setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays); | 546 | setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays); |
547 | if ( mDate == QDate::currentDate() ) { | 547 | if ( mDate == QDate::currentDate() ) { |
548 | setLineWidth( 3 ); | 548 | setLineWidth( 3 ); |
549 | } else { | 549 | } else { |
550 | setLineWidth( 1 ); | 550 | setLineWidth( 1 ); |
551 | } | 551 | } |
552 | mCurrentAvailItem = (MonthViewItem*) firstItem (); | 552 | mCurrentAvailItem = (MonthViewItem*) firstItem (); |
553 | //clear(); | 553 | //clear(); |
554 | 554 | ||
555 | #ifdef DESKTOP_VERSION | 555 | #ifdef DESKTOP_VERSION |
556 | QToolTip::remove(this); | 556 | QToolTip::remove(this); |
557 | #endif | 557 | #endif |
558 | mToolTip.clear(); | 558 | mToolTip.clear(); |
559 | //qApp->processEvents(); | 559 | //qApp->processEvents(); |
560 | #if 0 | 560 | #if 0 |
561 | if ( !mHolidayString.isEmpty() ) { | 561 | if ( !mHolidayString.isEmpty() ) { |
562 | MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); | 562 | MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); |
563 | item->setPalette( mHolidayPalette ); | 563 | item->setPalette( mHolidayPalette ); |
564 | insertItem( item ); | 564 | insertItem( item ); |
565 | mToolTip.append ( mHolidayString ); | 565 | mToolTip.append ( mHolidayString ); |
566 | } | 566 | } |
567 | #endif | 567 | #endif |
568 | } | 568 | } |
569 | 569 | ||
570 | void MonthViewCell::insertEvent(Event *event) | 570 | void MonthViewCell::insertEvent(Event *event) |
571 | { | 571 | { |
572 | QString mToolTipText; | 572 | QString mToolTipText; |
573 | bool insertNewItem = false; | 573 | bool insertNewItem = false; |
574 | setFocusPolicy(WheelFocus); | 574 | setFocusPolicy(WheelFocus); |
575 | if ( !(event->doesRecur() == Recurrence::rNone) ) { | 575 | if ( !(event->doesRecur() == Recurrence::rNone) ) { |
576 | if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily ) | 576 | if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily ) |
577 | return; | 577 | return; |
578 | else | 578 | else |
579 | if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly ) | 579 | if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly ) |
580 | return; | 580 | return; |
581 | } | 581 | } |
582 | 582 | ||
583 | if ( event->isHoliday()) { | 583 | if ( event->isHoliday()) { |
584 | setHoliday( true ); | 584 | setHoliday( true ); |
585 | if ( mDate.dayOfWeek() == 7 ) | 585 | if ( mDate.dayOfWeek() == 7 ) |
586 | setLineWidth( 3 ); | 586 | setLineWidth( 3 ); |
587 | } | 587 | } |
588 | QString text; | 588 | QString text; |
589 | int multiday = 0;// 1 = start, 2 = midddle, 3 = end day | 589 | int multiday = 0;// 1 = start, 2 = midddle, 3 = end day |
590 | if (event->isMultiDay()) { | 590 | if (event->isMultiDay()) { |
591 | QString prefix = "<->";multiday = 2; | 591 | QString prefix = "<->";multiday = 2; |
592 | QString time; | 592 | QString time; |
593 | if ( event->doesRecur() ) { | 593 | if ( event->doesRecur() ) { |
594 | if ( event->recursOn( mDate) ) { | 594 | if ( event->recursOn( mDate) ) { |
595 | prefix ="->" ;multiday = 1; | 595 | prefix ="->" ;multiday = 1; |
596 | } | 596 | } |
597 | else { | 597 | else { |
598 | int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); | 598 | int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); |
599 | if ( event->recursOn( mDate.addDays( -days)) ) { | 599 | if ( event->recursOn( mDate.addDays( -days)) ) { |
600 | prefix ="<-" ;multiday = 3; | 600 | prefix ="<-" ;multiday = 3; |
601 | } | 601 | } |
602 | } | 602 | } |
603 | 603 | ||
604 | } else { | 604 | } else { |
605 | if (mDate == event->dtStart().date()) { | 605 | if (mDate == event->dtStart().date()) { |
606 | prefix ="->" ;multiday = 1; | 606 | prefix ="->" ;multiday = 1; |
607 | } else if (mDate == event->dtEnd().date()) { | 607 | } else if (mDate == event->dtEnd().date()) { |
608 | prefix ="<-" ;multiday = 3; | 608 | prefix ="<-" ;multiday = 3; |
609 | } | 609 | } |
610 | } | 610 | } |
611 | if ( !event->doesFloat() ) { | 611 | if ( !event->doesFloat() ) { |
612 | if ( mDate == event->dtStart().date () ) | 612 | if ( mDate == event->dtStart().date () ) |
613 | time = KGlobal::locale()->formatTime(event->dtStart().time())+" "; | 613 | time = KGlobal::locale()->formatTime(event->dtStart().time())+" "; |
614 | else if ( mDate == event->dtEnd().date () ) | 614 | else if ( mDate == event->dtEnd().date () ) |
615 | time = KGlobal::locale()->formatTime(event->dtEnd().time())+" "; | 615 | time = KGlobal::locale()->formatTime(event->dtEnd().time())+" "; |
616 | 616 | ||
617 | } | 617 | } |
618 | text = time + event->summary(); | 618 | text = time + event->summary(); |
619 | mToolTipText += prefix + text; | 619 | mToolTipText += prefix + text; |
620 | } else { | 620 | } else { |
621 | if (event->doesFloat()) { | 621 | if (event->doesFloat()) { |
622 | text = event->summary(); | 622 | text = event->summary(); |
623 | mToolTipText += text; | 623 | mToolTipText += text; |
624 | } | 624 | } |
625 | else { | 625 | else { |
626 | text = KGlobal::locale()->formatTime(event->dtStart().time()); | 626 | text = KGlobal::locale()->formatTime(event->dtStart().time()); |
627 | text += " " + event->summary(); | 627 | text += " " + event->summary(); |
628 | mToolTipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); | 628 | mToolTipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); |
629 | } | 629 | } |
630 | } | 630 | } |
631 | MonthViewItem *item ; | 631 | MonthViewItem *item ; |
632 | if ( mCurrentAvailItem ) { | 632 | if ( mCurrentAvailItem ) { |
633 | item = mCurrentAvailItem; | 633 | item = mCurrentAvailItem; |
634 | mCurrentAvailItem = (MonthViewItem*) item->next(); | 634 | mCurrentAvailItem = (MonthViewItem*) item->next(); |
635 | item->recycle( event, mDate, text ); | 635 | item->recycle( event, mDate, text ); |
636 | } else { | 636 | } else { |
637 | if ( mAvailItemList.count() ) { | 637 | if ( mAvailItemList.count() ) { |
638 | item = mAvailItemList.first(); | 638 | item = mAvailItemList.first(); |
639 | mAvailItemList.remove( item ); | 639 | mAvailItemList.remove( item ); |
640 | item->recycle( event, mDate, text ); | 640 | item->recycle( event, mDate, text ); |
641 | insertNewItem = true; | 641 | insertNewItem = true; |
642 | } else { | 642 | } else { |
643 | insertNewItem = true; | 643 | insertNewItem = true; |
644 | item = new MonthViewItem( event, mDate, text ); | 644 | item = new MonthViewItem( event, mDate, text ); |
645 | } | 645 | } |
646 | } | 646 | } |
647 | QPalette pal; | 647 | QPalette pal; |
648 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { | 648 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { |
649 | QStringList categories = event->categories(); | 649 | QStringList categories = event->categories(); |
650 | QString cat = categories.first(); | 650 | QString cat = categories.first(); |
651 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { | 651 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { |
652 | pal = getPalette(); | 652 | pal = getPalette(); |
653 | if (cat.isEmpty()) { | 653 | if (cat.isEmpty()) { |
654 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); | 654 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); |
655 | } else { | 655 | } else { |
656 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); | 656 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); |
657 | } | 657 | } |
658 | 658 | ||
659 | } else { | 659 | } else { |
660 | if (cat.isEmpty()) { | 660 | if (cat.isEmpty()) { |
661 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); | 661 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); |
662 | } else { | 662 | } else { |
663 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); | 663 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); |
664 | } | 664 | } |
665 | } | 665 | } |
666 | 666 | ||
667 | } else { | 667 | } else { |
668 | pal = mStandardPalette ; | 668 | pal = mStandardPalette ; |
669 | } | 669 | } |
670 | item->setPalette( pal ); | 670 | item->setPalette( pal ); |
671 | item->setRecur( event->recurrence()->doesRecur() ); | 671 | item->setRecur( event->recurrence()->doesRecur() ); |
672 | item->setAlarm( event->isAlarmEnabled() && multiday < 2 ); | 672 | item->setAlarm( event->isAlarmEnabled() && multiday < 2 ); |
673 | item->setMoreInfo( event->description().length() > 0 ); | 673 | item->setMoreInfo( event->description().length() > 0 ); |
674 | #ifdef DESKTOP_VERSION | 674 | #ifdef DESKTOP_VERSION |
675 | Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, | 675 | Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, |
676 | KOPrefs::instance()->email()); | 676 | KOPrefs::instance()->email()); |
677 | if ( me != 0 ) { | 677 | if ( me != 0 ) { |
678 | if ( me->status() == Attendee::NeedsAction && me->RSVP()) | 678 | if ( me->status() == Attendee::NeedsAction && me->RSVP()) |
679 | item->setReply(true && multiday < 2); | 679 | item->setReply(true && multiday < 2); |
680 | else | 680 | else |
681 | item->setReply(false); | 681 | item->setReply(false); |
682 | } else | 682 | } else |
683 | item->setReply(false); | 683 | item->setReply(false); |
684 | #endif | 684 | #endif |
685 | item->setMultiDay( multiday ); | 685 | item->setMultiDay( multiday ); |
686 | if ( insertNewItem) | 686 | if ( insertNewItem) |
687 | insertItem( item ); | 687 | insertItem( item ); |
688 | mToolTip.append( mToolTipText ); | 688 | mToolTip.append( mToolTipText ); |
689 | } | 689 | } |
690 | void MonthViewCell::insertTodo(Todo *todo) | 690 | void MonthViewCell::insertTodo(Todo *todo) |
691 | { | 691 | { |
692 | bool insertNewItem = false; | 692 | bool insertNewItem = false; |
693 | setFocusPolicy(WheelFocus); | 693 | setFocusPolicy(WheelFocus); |
694 | QString text; | 694 | QString text; |
695 | if (todo->hasDueDate()) { | 695 | if (todo->hasDueDate()) { |
696 | if (!todo->doesFloat()) { | 696 | if (!todo->doesFloat()) { |
697 | text += KGlobal::locale()->formatTime(todo->dtDue().time()); | 697 | text += KGlobal::locale()->formatTime(todo->dtDue().time()); |
698 | text += " "; | 698 | text += " "; |
699 | } | 699 | } |
700 | } | 700 | } |
701 | text += todo->summary(); | 701 | text += todo->summary(); |
702 | MonthViewItem *item ; | 702 | MonthViewItem *item ; |
703 | if ( mCurrentAvailItem ) { | 703 | if ( mCurrentAvailItem ) { |
704 | item = mCurrentAvailItem; | 704 | item = mCurrentAvailItem; |
705 | mCurrentAvailItem = (MonthViewItem*) item->next(); | 705 | mCurrentAvailItem = (MonthViewItem*) item->next(); |
706 | item->recycle( todo, mDate, text ); | 706 | item->recycle( todo, mDate, text ); |
707 | } else { | 707 | } else { |
708 | if ( mAvailItemList.count() ) { | 708 | if ( mAvailItemList.count() ) { |
709 | item = mAvailItemList.first(); | 709 | item = mAvailItemList.first(); |
710 | mAvailItemList.remove( item ); | 710 | mAvailItemList.remove( item ); |
711 | item->recycle( todo, mDate, text ); | 711 | item->recycle( todo, mDate, text ); |
712 | insertNewItem = true; | 712 | insertNewItem = true; |
713 | } else { | 713 | } else { |
714 | insertNewItem = true; | 714 | insertNewItem = true; |
715 | item = new MonthViewItem( todo, mDate, text ); | 715 | item = new MonthViewItem( todo, mDate, text ); |
716 | } | 716 | } |
717 | } | 717 | } |
718 | //MonthViewItem *item = new MonthViewItem( todo, mDate, text ); | 718 | //MonthViewItem *item = new MonthViewItem( todo, mDate, text ); |
719 | //item->setPalette( mStandardPalette ); | 719 | //item->setPalette( mStandardPalette ); |
720 | QPalette pal; | 720 | QPalette pal; |
721 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { | 721 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { |
722 | QStringList categories = todo->categories(); | 722 | QStringList categories = todo->categories(); |
723 | QString cat = categories.first(); | 723 | QString cat = categories.first(); |
724 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { | 724 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { |
725 | pal = getPalette(); | 725 | pal = getPalette(); |
726 | if (cat.isEmpty()) { | 726 | if (cat.isEmpty()) { |
727 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); | 727 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); |
728 | } else { | 728 | } else { |
729 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); | 729 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); |
730 | } | 730 | } |
731 | 731 | ||
732 | } else { | 732 | } else { |
733 | if (cat.isEmpty()) { | 733 | if (cat.isEmpty()) { |
734 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); | 734 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); |
735 | } else { | 735 | } else { |
736 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); | 736 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); |
737 | } | 737 | } |
738 | } | 738 | } |
739 | 739 | ||
740 | } else { | 740 | } else { |
741 | pal = mStandardPalette ; | 741 | pal = mStandardPalette ; |
742 | } | 742 | } |
743 | item->setPalette( pal ); | 743 | item->setPalette( pal ); |
744 | item->setRecur( todo->recurrence()->doesRecur() ); | 744 | item->setRecur( todo->recurrence()->doesRecur() ); |
745 | item->setAlarm( todo->isAlarmEnabled() ); | 745 | item->setAlarm( todo->isAlarmEnabled() ); |
746 | item->setMoreInfo( todo->description().length() > 0 ); | 746 | item->setMoreInfo( todo->description().length() > 0 ); |
747 | if ( insertNewItem) | 747 | if ( insertNewItem) |
748 | insertItem( item ); | 748 | insertItem( item ); |
749 | mToolTip.append( text ); | 749 | mToolTip.append( text ); |
750 | } | 750 | } |
751 | void MonthViewCell::repaintfinishUpdateCell() | 751 | void MonthViewCell::repaintfinishUpdateCell() |
752 | { | 752 | { |
753 | MonthViewItem *mitem = (MonthViewItem*) firstItem (); | 753 | MonthViewItem *mitem = (MonthViewItem*) firstItem (); |
754 | while ( mitem ) { | 754 | while ( mitem ) { |
755 | mitem->setBlockRepaint( false ); | 755 | mitem->setBlockRepaint( false ); |
756 | updateItem ( mitem ); | 756 | updateItem ( mitem ); |
757 | mitem = (MonthViewItem *)mitem->next(); | 757 | mitem = (MonthViewItem *)mitem->next(); |
758 | } | 758 | } |
759 | } | 759 | } |
760 | void MonthViewCell::finishUpdateCell() | 760 | void MonthViewCell::finishUpdateCell() |
761 | { | 761 | { |
762 | while ( mCurrentAvailItem ) { | 762 | while ( mCurrentAvailItem ) { |
763 | MonthViewItem *item = mCurrentAvailItem; | 763 | MonthViewItem *item = mCurrentAvailItem; |
764 | mCurrentAvailItem = (MonthViewItem *)item->next(); | 764 | mCurrentAvailItem = (MonthViewItem *)item->next(); |
765 | mAvailItemList.append( item ); | 765 | mAvailItemList.append( item ); |
766 | takeItem ( item ); | 766 | takeItem ( item ); |
767 | } | 767 | } |
768 | 768 | ||
769 | 769 | ||
770 | #ifdef DESKTOP_VERSION | 770 | #ifdef DESKTOP_VERSION |
771 | if (mToolTip.count() > 0 ) { | 771 | if (mToolTip.count() > 0 ) { |
772 | mToolTip.sort(); | 772 | mToolTip.sort(); |
773 | QToolTip::add(this,mToolTip.join("\n"),toolTipGroup(),""); | 773 | QToolTip::add(this,mToolTip.join("\n"),toolTipGroup(),""); |
774 | } | 774 | } |
775 | #endif | 775 | #endif |
776 | sort(); | 776 | sort(); |
777 | //setMyPalette(); | 777 | //setMyPalette(); |
778 | setMyPalette(); | 778 | setMyPalette(); |
779 | 779 | ||
780 | resizeEvent( 0 ); | 780 | resizeEvent( 0 ); |
781 | 781 | ||
782 | } | 782 | } |
783 | void MonthViewCell::updateCell() | 783 | void MonthViewCell::updateCell() |
784 | { | 784 | { |
785 | //qDebug("MonthViewCell::updateCell() "); | 785 | //qDebug("MonthViewCell::updateCell() "); |
786 | if ( !mMonthView->isUpdatePossible() ) | 786 | if ( !mMonthView->isUpdatePossible() ) |
787 | return; | 787 | return; |
788 | startUpdateCell(); | 788 | startUpdateCell(); |
789 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); | 789 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); |
790 | QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); | 790 | QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); |
791 | Event *event; | 791 | Event *event; |
792 | for( event = events.first(); event; event = events.next() ) { // for event | 792 | for( event = events.first(); event; event = events.next() ) { // for event |
793 | insertEvent(event); | 793 | insertEvent(event); |
794 | } | 794 | } |
795 | // insert due todos | 795 | // insert due todos |
796 | QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); | 796 | QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); |
797 | Todo *todo; | 797 | Todo *todo; |
798 | for(todo = todos.first(); todo; todo = todos.next()) { | 798 | for(todo = todos.first(); todo; todo = todos.next()) { |
799 | insertTodo( todo ); | 799 | insertTodo( todo ); |
800 | } | 800 | } |
801 | finishUpdateCell(); | 801 | finishUpdateCell(); |
802 | // if ( isVisible()) | 802 | // if ( isVisible()) |
803 | //qApp->processEvents(); | 803 | //qApp->processEvents(); |
804 | } | 804 | } |
805 | 805 | ||
806 | void MonthViewCell::updateConfig( bool bigFont ) // = false | 806 | void MonthViewCell::updateConfig( bool bigFont ) // = false |
807 | { | 807 | { |
808 | 808 | ||
809 | if ( bigFont ) { | 809 | if ( bigFont ) { |
810 | QFont fo = KOPrefs::instance()->mMonthViewFont; | 810 | QFont fo = KOPrefs::instance()->mMonthViewFont; |
811 | int ps = fo.pointSize() + 2; | 811 | int ps = fo.pointSize() + 2; |
812 | if ( ps < 18 ) | 812 | if ( ps < 18 ) |
813 | ps += 2; | 813 | ps += 2; |
814 | fo.setPointSize( ps ); | 814 | fo.setPointSize( ps ); |
815 | setFont( fo ); | 815 | setFont( fo ); |
816 | } else | 816 | } else |
817 | setFont( KOPrefs::instance()->mMonthViewFont ); | 817 | setFont( KOPrefs::instance()->mMonthViewFont ); |
818 | 818 | ||
819 | QFontMetrics fm( font() ); | 819 | QFontMetrics fm( font() ); |
820 | mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 ); | 820 | mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 ); |
821 | mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 ); | 821 | mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 ); |
822 | mHolidayPalette = mStandardPalette; | 822 | mHolidayPalette = mStandardPalette; |
823 | mPrimaryPalette = mStandardPalette; | 823 | mPrimaryPalette = mStandardPalette; |
824 | mNonPrimaryPalette = mStandardPalette; | 824 | mNonPrimaryPalette = mStandardPalette; |
825 | if ( KOPrefs::instance()->mMonthViewUsesDayColors ) { | 825 | if ( KOPrefs::instance()->mMonthViewUsesDayColors ) { |
826 | mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor ); | 826 | mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor ); |
827 | mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor ); | 827 | mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor ); |
828 | mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark()); | 828 | mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark()); |
829 | mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark()); | 829 | mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark()); |
830 | mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor); | 830 | mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor); |
831 | mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor); | 831 | mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor); |
832 | mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark()); | 832 | mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark()); |
833 | mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor); | 833 | mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor); |
834 | mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor); | 834 | mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor); |
835 | } | 835 | } |
836 | //updateCell(); | 836 | //updateCell(); |
837 | } | 837 | } |
838 | 838 | ||
839 | void MonthViewCell::enableScrollBars( bool enabled ) | 839 | void MonthViewCell::enableScrollBars( bool enabled ) |
840 | { | 840 | { |
841 | if ( enabled ) { | 841 | if ( enabled ) { |
842 | QListBoxItem *fi = firstItem (); | 842 | QListBoxItem *fi = firstItem (); |
843 | if (fi ) { | 843 | if (fi ) { |
844 | int ihei = fi->height( this ); | 844 | int ihei = fi->height( this ); |
845 | int hei = numRows () * ihei; | 845 | int hei = numRows () * ihei; |
846 | if ( hei < height() - horizontalScrollBar()->height () ) { | 846 | if ( hei < height() - horizontalScrollBar()->height () ) { |
847 | setVScrollBarMode(QScrollView::AlwaysOff); | 847 | setVScrollBarMode(QScrollView::AlwaysOff); |
848 | } | 848 | } |
849 | else | 849 | else |
850 | setVScrollBarMode(QScrollView::Auto); | 850 | setVScrollBarMode(QScrollView::Auto); |
851 | if ( ihei *3 > height() ) | 851 | if ( ihei *3 > height() ) |
852 | setHScrollBarMode(QScrollView::AlwaysOff); | 852 | setHScrollBarMode(QScrollView::AlwaysOff); |
853 | else | 853 | else |
854 | setHScrollBarMode(QScrollView::Auto); | 854 | setHScrollBarMode(QScrollView::Auto); |
855 | } else { | 855 | } else { |
856 | setVScrollBarMode(QScrollView::Auto); | 856 | setVScrollBarMode(QScrollView::Auto); |
857 | setHScrollBarMode(QScrollView::Auto); | 857 | setHScrollBarMode(QScrollView::Auto); |
858 | } | 858 | } |
859 | } else { | 859 | } else { |
860 | setVScrollBarMode(QScrollView::AlwaysOff); | 860 | setVScrollBarMode(QScrollView::AlwaysOff); |
861 | setHScrollBarMode(QScrollView::AlwaysOff); | 861 | setHScrollBarMode(QScrollView::AlwaysOff); |
862 | } | 862 | } |
863 | } | 863 | } |
864 | 864 | ||
865 | Incidence *MonthViewCell::selectedIncidence() | 865 | Incidence *MonthViewCell::selectedIncidence() |
866 | { | 866 | { |
867 | int index = currentItem(); | 867 | int index = currentItem(); |
868 | if ( index < 0 ) return 0; | 868 | if ( index < 0 ) return 0; |
869 | 869 | ||
870 | MonthViewItem *mitem = | 870 | MonthViewItem *mitem = |
871 | static_cast<MonthViewItem *>( item( index ) ); | 871 | static_cast<MonthViewItem *>( item( index ) ); |
872 | 872 | ||
873 | if ( !mitem ) return 0; | 873 | if ( !mitem ) return 0; |
874 | 874 | ||
875 | return mitem->incidence(); | 875 | return mitem->incidence(); |
876 | } | 876 | } |
877 | 877 | ||
878 | QDate MonthViewCell::selectedIncidenceDate() | 878 | QDate MonthViewCell::selectedIncidenceDate() |
879 | { | 879 | { |
880 | QDate qd; | 880 | QDate qd; |
881 | int index = currentItem(); | 881 | int index = currentItem(); |
882 | if ( index < 0 ) return qd; | 882 | if ( index < 0 ) return qd; |
883 | 883 | ||
884 | MonthViewItem *mitem = | 884 | MonthViewItem *mitem = |
885 | static_cast<MonthViewItem *>( item( index ) ); | 885 | static_cast<MonthViewItem *>( item( index ) ); |
886 | 886 | ||
887 | if ( !mitem ) return qd; | 887 | if ( !mitem ) return qd; |
888 | 888 | ||
889 | return mitem->incidenceDate(); | 889 | return mitem->incidenceDate(); |
890 | } | 890 | } |
891 | 891 | ||
892 | void MonthViewCell::deselect() | 892 | void MonthViewCell::deselect() |
893 | { | 893 | { |
894 | clearSelection(); | 894 | clearSelection(); |
895 | enableScrollBars( false ); | 895 | enableScrollBars( false ); |
896 | // updateCell(); | 896 | // updateCell(); |
897 | } | 897 | } |
898 | void MonthViewCell::select() | 898 | void MonthViewCell::select() |
899 | { | 899 | { |
900 | ;// updateCell(); | 900 | ;// updateCell(); |
901 | } | 901 | } |
902 | 902 | ||
903 | void MonthViewCell::resizeEvent ( QResizeEvent * e ) | 903 | void MonthViewCell::resizeEvent ( QResizeEvent * e ) |
904 | { | 904 | { |
905 | if ( !mMonthView->isUpdatePossible() ) | 905 | if ( !mMonthView->isUpdatePossible() ) |
906 | return; | 906 | return; |
907 | //qDebug("++++++++++++++MonthViewCell::resizeEvent %d %d ", width(), height()); | 907 | //qDebug("++++++++++++++MonthViewCell::resizeEvent %d %d ", width(), height()); |
908 | deselect(); | 908 | deselect(); |
909 | mLabel->setMaximumHeight( height() - lineWidth()*2 ); | 909 | mLabel->setMaximumHeight( height() - lineWidth()*2 ); |
910 | 910 | ||
911 | QString text; | 911 | QString text; |
912 | mLabel->setText( text ); | 912 | mLabel->setText( text ); |
913 | bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; | 913 | bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; |
914 | if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { | 914 | if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { |
915 | text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " "; | 915 | text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " "; |
916 | mLabel->resize( mLabelBigSize ); | 916 | mLabel->resize( mLabelBigSize ); |
917 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); | 917 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); |
918 | } else { | 918 | } else { |
919 | mLabel->resize( mLabelSize ); | 919 | mLabel->resize( mLabelSize ); |
920 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); | 920 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); |
921 | } | 921 | } |
922 | mLabel->setText( text ); | 922 | mLabel->setText( text ); |
923 | 923 | ||
924 | int size = height() - mLabel->height() - lineWidth()-1; | 924 | int size = height() - mLabel->height() - lineWidth()-1; |
925 | //qDebug("LW %d ", lineWidth()); | 925 | //qDebug("LW %d ", lineWidth()); |
926 | if ( size > 0 ) | 926 | if ( size > 0 ) |
927 | verticalScrollBar()->setMaximumHeight( size ); | 927 | verticalScrollBar()->setMaximumHeight( size ); |
928 | size = width() - mLabel->width() -lineWidth()-1; | 928 | size = width() - mLabel->width() -lineWidth()-1; |
929 | if ( size > 0 ) | 929 | if ( size > 0 ) |
930 | horizontalScrollBar()->setMaximumWidth( size ); | 930 | horizontalScrollBar()->setMaximumWidth( size ); |
931 | mLabel->move( width()-lineWidth() - mLabel->width(), height()-lineWidth() - mLabel->height() ); | 931 | mLabel->move( width()-lineWidth() - mLabel->width(), height()-lineWidth() - mLabel->height() ); |
932 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); | 932 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); |
933 | // mItemList->resize ( width(), height () ); | 933 | // mItemList->resize ( width(), height () ); |
934 | if ( e ) | 934 | if ( e ) |
935 | KNoScrollListBox::resizeEvent ( e ); | 935 | KNoScrollListBox::resizeEvent ( e ); |
936 | } | 936 | } |
937 | 937 | ||
938 | void MonthViewCell::defaultAction( QListBoxItem *item ) | 938 | void MonthViewCell::defaultAction( QListBoxItem *item ) |
939 | { | 939 | { |
940 | if ( !item ) return; | 940 | if ( !item ) return; |
941 | 941 | ||
942 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); | 942 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); |
943 | Incidence *incidence = eventItem->incidence(); | 943 | Incidence *incidence = eventItem->incidence(); |
944 | if ( incidence ) mMonthView->defaultAction( incidence ); | 944 | if ( incidence ) mMonthView->defaultAction( incidence ); |
945 | } | 945 | } |
946 | void MonthViewCell::showDay() | 946 | void MonthViewCell::showDay() |
947 | { | 947 | { |
948 | emit showDaySignal( date() ); | 948 | emit showDaySignal( date() ); |
949 | } | 949 | } |
950 | void MonthViewCell::newEvent() | 950 | void MonthViewCell::newEvent() |
951 | { | 951 | { |
952 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); | 952 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); |
953 | emit newEventSignal( dt ); | 953 | emit newEventSignal( dt ); |
954 | } | 954 | } |
955 | void MonthViewCell::cellClicked( QListBoxItem *item ) | 955 | void MonthViewCell::cellClicked( QListBoxItem *item ) |
956 | { | 956 | { |
957 | static QListBoxItem * lastClicked = 0; | 957 | static QListBoxItem * lastClicked = 0; |
958 | if ( item == 0 ) { | 958 | if ( item == 0 ) { |
959 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); | 959 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); |
960 | emit newEventSignal( dt ); | 960 | emit newEventSignal( dt ); |
961 | return; | 961 | return; |
962 | } | 962 | } |
963 | /* | 963 | /* |
964 | if ( lastClicked ) | 964 | if ( lastClicked ) |
965 | if ( ! item ) { | 965 | if ( ! item ) { |
966 | if ( lastClicked->listBox() != item->listBox() ) | 966 | if ( lastClicked->listBox() != item->listBox() ) |
967 | lastClicked->listBox()->clearSelection(); | 967 | lastClicked->listBox()->clearSelection(); |
968 | } | 968 | } |
969 | */ | 969 | */ |
970 | 970 | ||
971 | mMonthView->setSelectedCell( this ); | 971 | mMonthView->setSelectedCell( this ); |
972 | if( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) enableScrollBars( true ); | 972 | if( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) enableScrollBars( true ); |
973 | select(); | 973 | select(); |
974 | } | 974 | } |
975 | 975 | ||
976 | void MonthViewCell::contextMenu( QListBoxItem *item ) | 976 | void MonthViewCell::contextMenu( QListBoxItem *item ) |
977 | { | 977 | { |
978 | if ( !item ) return; | 978 | if ( !item ) return; |
979 | 979 | ||
980 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); | 980 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); |
981 | Incidence *incidence = eventItem->incidence(); | 981 | Incidence *incidence = eventItem->incidence(); |
982 | if ( incidence ) mMonthView->showContextMenu( incidence ); | 982 | if ( incidence ) mMonthView->showContextMenu( incidence ); |
983 | } | 983 | } |
984 | 984 | ||
985 | void MonthViewCell::selection( QListBoxItem *item ) | 985 | void MonthViewCell::selection( QListBoxItem *item ) |
986 | { | 986 | { |
987 | if ( !item ) return; | 987 | if ( !item ) return; |
988 | 988 | ||
989 | mMonthView->setSelectedCell( this ); | 989 | mMonthView->setSelectedCell( this ); |
990 | } | 990 | } |
991 | 991 | ||
992 | 992 | ||
993 | // ******************************************************************************* | 993 | // ******************************************************************************* |
994 | // ******************************************************************************* | 994 | // ******************************************************************************* |
995 | // ******************************************************************************* | 995 | // ******************************************************************************* |
996 | 996 | ||
997 | 997 | ||
998 | KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) | 998 | KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) |
999 | : KOEventView( calendar, parent, name ), | 999 | : KOEventView( calendar, parent, name ), |
1000 | mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), | 1000 | mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), |
1001 | mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) | 1001 | mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) |
1002 | { | 1002 | { |
1003 | mFlagKeyPressed = false; | ||
1003 | mShortDayLabelsM = false; | 1004 | mShortDayLabelsM = false; |
1004 | mShortDayLabelsW = false; | 1005 | mShortDayLabelsW = false; |
1005 | skipResize = false; | 1006 | skipResize = false; |
1006 | clPending = true; | 1007 | clPending = true; |
1007 | mNavigatorBar = new NavigatorBar( QDate::currentDate(), this, "useBigPixmaps" ); | 1008 | mNavigatorBar = new NavigatorBar( QDate::currentDate(), this, "useBigPixmaps" ); |
1008 | mWidStack = new QWidgetStack( this ); | 1009 | mWidStack = new QWidgetStack( this ); |
1009 | QVBoxLayout* hb = new QVBoxLayout( this ); | 1010 | QVBoxLayout* hb = new QVBoxLayout( this ); |
1010 | mMonthView = new QWidget( mWidStack ); | 1011 | mMonthView = new QWidget( mWidStack ); |
1011 | mWeekView = new QWidget( mWidStack ); | 1012 | mWeekView = new QWidget( mWidStack ); |
1012 | #if QT_VERSION >= 0x030000 | 1013 | #if QT_VERSION >= 0x030000 |
1013 | mWidStack->addWidget(mMonthView ); | 1014 | mWidStack->addWidget(mMonthView ); |
1014 | mWidStack->addWidget(mWeekView ); | 1015 | mWidStack->addWidget(mWeekView ); |
1015 | #else | 1016 | #else |
1016 | mWidStack->addWidget( mMonthView, 1 ); | 1017 | mWidStack->addWidget( mMonthView, 1 ); |
1017 | mWidStack->addWidget( mWeekView , 1 ); | 1018 | mWidStack->addWidget( mWeekView , 1 ); |
1018 | #endif | 1019 | #endif |
1019 | hb->addWidget( mNavigatorBar ); | 1020 | hb->addWidget( mNavigatorBar ); |
1020 | hb->addWidget( mWidStack ); | 1021 | hb->addWidget( mWidStack ); |
1021 | mShowWeekView = KOPrefs::instance()->mMonthViewWeek; | 1022 | mShowWeekView = KOPrefs::instance()->mMonthViewWeek; |
1022 | updatePossible = false; | 1023 | updatePossible = false; |
1023 | //updatePossible = true; | 1024 | //updatePossible = true; |
1024 | mCells.setAutoDelete( true ); | 1025 | mCells.setAutoDelete( true ); |
1025 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; | 1026 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; |
1026 | mDayLabels.resize( mDaysPerWeek ); | 1027 | mDayLabels.resize( mDaysPerWeek ); |
1027 | mDayLabelsW.resize( mDaysPerWeek ); | 1028 | mDayLabelsW.resize( mDaysPerWeek ); |
1028 | QFont bfont = font(); | 1029 | QFont bfont = font(); |
1029 | if ( QApplication::desktop()->width() < 650 ) { | 1030 | if ( QApplication::desktop()->width() < 650 ) { |
1030 | bfont.setPointSize( bfont.pointSize() - 2 ); | 1031 | bfont.setPointSize( bfont.pointSize() - 2 ); |
1031 | } | 1032 | } |
1032 | bfont.setBold( true ); | 1033 | bfont.setBold( true ); |
1033 | int i; | 1034 | int i; |
1034 | 1035 | ||
1035 | for( i = 0; i < mDaysPerWeek; i++ ) { | 1036 | for( i = 0; i < mDaysPerWeek; i++ ) { |
1036 | QLabel *label = new QLabel( mMonthView ); | 1037 | QLabel *label = new QLabel( mMonthView ); |
1037 | label->setFont(bfont); | 1038 | label->setFont(bfont); |
1038 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 1039 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
1039 | label->setLineWidth(1); | 1040 | label->setLineWidth(1); |
1040 | label->setAlignment(AlignCenter); | 1041 | label->setAlignment(AlignCenter); |
1041 | mDayLabels.insert( i, label ); | 1042 | mDayLabels.insert( i, label ); |
1042 | label = new QLabel( mWeekView ); | 1043 | label = new QLabel( mWeekView ); |
1043 | label->setFont(bfont); | 1044 | label->setFont(bfont); |
1044 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 1045 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
1045 | label->setLineWidth(1); | 1046 | label->setLineWidth(1); |
1046 | label->setAlignment(AlignCenter); | 1047 | label->setAlignment(AlignCenter); |
1047 | mDayLabelsW.insert( i, label ); | 1048 | mDayLabelsW.insert( i, label ); |
1048 | } | 1049 | } |
1049 | 1050 | ||
1050 | bfont.setBold( false ); | 1051 | bfont.setBold( false ); |
1051 | mWeekLabels.resize( mNumWeeks+1 ); | 1052 | mWeekLabels.resize( mNumWeeks+1 ); |
1052 | mWeekLabelsW.resize( 2 ); | 1053 | mWeekLabelsW.resize( 2 ); |
1053 | for( i = 0; i < mNumWeeks+1; i++ ) { | 1054 | for( i = 0; i < mNumWeeks+1; i++ ) { |
1054 | KOWeekButton *label = new KOWeekButton( mMonthView ); | 1055 | KOWeekButton *label = new KOWeekButton( mMonthView ); |
1055 | label->setFocusPolicy(NoFocus); | 1056 | label->setFocusPolicy(NoFocus); |
1056 | label->setFont(bfont); | 1057 | label->setFont(bfont); |
1057 | connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); | 1058 | connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); |
1058 | label->setFlat(true); | 1059 | label->setFlat(true); |
1059 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); | 1060 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); |
1060 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 1061 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
1061 | //label->setLineWidth(1); | 1062 | //label->setLineWidth(1); |
1062 | //label->setAlignment(AlignCenter); | 1063 | //label->setAlignment(AlignCenter); |
1063 | mWeekLabels.insert( i, label ); | 1064 | mWeekLabels.insert( i, label ); |
1064 | } | 1065 | } |
1065 | mWeekLabels[mNumWeeks]->setText( i18n("W")); | 1066 | mWeekLabels[mNumWeeks]->setText( i18n("W")); |
1066 | mWeekLabels[0]->setFocusPolicy(WheelFocus); | 1067 | mWeekLabels[0]->setFocusPolicy(WheelFocus); |
1067 | QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number")); | 1068 | QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number")); |
1068 | 1069 | ||
1069 | for( i = 0; i < 1+1; i++ ) { | 1070 | for( i = 0; i < 1+1; i++ ) { |
1070 | KOWeekButton *label = new KOWeekButton( mWeekView ); | 1071 | KOWeekButton *label = new KOWeekButton( mWeekView ); |
1071 | label->setFocusPolicy(NoFocus); | 1072 | label->setFocusPolicy(NoFocus); |
1072 | label->setFont(bfont); | 1073 | label->setFont(bfont); |
1073 | connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); | 1074 | connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); |
1074 | label->setFlat(true); | 1075 | label->setFlat(true); |
1075 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); | 1076 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); |
1076 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 1077 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
1077 | //label->setLineWidth(1); | 1078 | //label->setLineWidth(1); |
1078 | //label->setAlignment(AlignCenter); | 1079 | //label->setAlignment(AlignCenter); |
1079 | mWeekLabelsW.insert( i, label ); | 1080 | mWeekLabelsW.insert( i, label ); |
1080 | } | 1081 | } |
1081 | mWeekLabelsW[1]->setText( i18n("W")); | 1082 | mWeekLabelsW[1]->setText( i18n("W")); |
1082 | mWeekLabelsW[0]->setFocusPolicy(WheelFocus); | 1083 | mWeekLabelsW[0]->setFocusPolicy(WheelFocus); |
1083 | 1084 | ||
1084 | 1085 | ||
1085 | int row, col; | 1086 | int row, col; |
1086 | mCells.resize( mNumCells ); | 1087 | mCells.resize( mNumCells ); |
1087 | for( row = 0; row < mNumWeeks; ++row ) { | 1088 | for( row = 0; row < mNumWeeks; ++row ) { |
1088 | for( col = 0; col < mDaysPerWeek; ++col ) { | 1089 | for( col = 0; col < mDaysPerWeek; ++col ) { |
1089 | MonthViewCell *cell = new MonthViewCell( this, mMonthView ); | 1090 | MonthViewCell *cell = new MonthViewCell( this, mMonthView ); |
1090 | mCells.insert( row * mDaysPerWeek + col, cell ); | 1091 | mCells.insert( row * mDaysPerWeek + col, cell ); |
1091 | 1092 | ||
1092 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), | 1093 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), |
1093 | SLOT( defaultAction( Incidence * ) ) ); | 1094 | SLOT( defaultAction( Incidence * ) ) ); |
1094 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), | 1095 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), |
1095 | SIGNAL( newEventSignal( QDateTime ) ) ); | 1096 | SIGNAL( newEventSignal( QDateTime ) ) ); |
1096 | connect( cell, SIGNAL( showDaySignal( QDate ) ), | 1097 | connect( cell, SIGNAL( showDaySignal( QDate ) ), |
1097 | SIGNAL( showDaySignal( QDate ) ) ); | 1098 | SIGNAL( showDaySignal( QDate ) ) ); |
1098 | } | 1099 | } |
1099 | } | 1100 | } |
1100 | mCellsW.resize( mDaysPerWeek ); | 1101 | mCellsW.resize( mDaysPerWeek ); |
1101 | for( col = 0; col < mDaysPerWeek; ++col ) { | 1102 | for( col = 0; col < mDaysPerWeek; ++col ) { |
1102 | MonthViewCell *cell = new MonthViewCell( this, mWeekView ); | 1103 | MonthViewCell *cell = new MonthViewCell( this, mWeekView ); |
1103 | mCellsW.insert( col, cell ); | 1104 | mCellsW.insert( col, cell ); |
1104 | 1105 | ||
1105 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), | 1106 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), |
1106 | SLOT( defaultAction( Incidence * ) ) ); | 1107 | SLOT( defaultAction( Incidence * ) ) ); |
1107 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), | 1108 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), |
1108 | SIGNAL( newEventSignal( QDateTime ) ) ); | 1109 | SIGNAL( newEventSignal( QDateTime ) ) ); |
1109 | connect( cell, SIGNAL( showDaySignal( QDate ) ), | 1110 | connect( cell, SIGNAL( showDaySignal( QDate ) ), |
1110 | SIGNAL( showDaySignal( QDate ) ) ); | 1111 | SIGNAL( showDaySignal( QDate ) ) ); |
1111 | cell->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont ); | 1112 | cell->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont ); |
1112 | } | 1113 | } |
1113 | 1114 | ||
1114 | //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) ); | 1115 | //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) ); |
1115 | mContextMenu = eventPopup(); | 1116 | mContextMenu = eventPopup(); |
1116 | // updateConfig(); //useless here... | 1117 | // updateConfig(); //useless here... |
1117 | // ... but we need mWidthLongDayLabel computed | 1118 | // ... but we need mWidthLongDayLabel computed |
1118 | QFontMetrics fontmetric(mDayLabels[0]->font()); | 1119 | QFontMetrics fontmetric(mDayLabels[0]->font()); |
1119 | mWidthLongDayLabel = 0; | 1120 | mWidthLongDayLabel = 0; |
1120 | for (int i = 0; i < 7; i++) { | 1121 | for (int i = 0; i < 7; i++) { |
1121 | int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); | 1122 | int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); |
1122 | if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; | 1123 | if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; |
1123 | } | 1124 | } |
1124 | 1125 | ||
1125 | //mWeekLabels[mNumWeeks]->setText( i18n("W")); | 1126 | //mWeekLabels[mNumWeeks]->setText( i18n("W")); |
1126 | 1127 | ||
1127 | #if 0 | 1128 | #if 0 |
1128 | if ( mShowWeekView ) | 1129 | if ( mShowWeekView ) |
1129 | mWidStack->raiseWidget( mWeekView ); | 1130 | mWidStack->raiseWidget( mWeekView ); |
1130 | else | 1131 | else |
1131 | mWidStack->raiseWidget( mMonthView ); | 1132 | mWidStack->raiseWidget( mMonthView ); |
1132 | #endif | 1133 | #endif |
1133 | 1134 | ||
1134 | emit incidenceSelected( 0 ); | 1135 | emit incidenceSelected( 0 ); |
1135 | 1136 | ||
1136 | mComputeLayoutTimer = new QTimer( this ); | 1137 | mComputeLayoutTimer = new QTimer( this ); |
1137 | connect (mComputeLayoutTimer ,SIGNAL(timeout()), this, SLOT ( slotComputeLayout())); | 1138 | connect (mComputeLayoutTimer ,SIGNAL(timeout()), this, SLOT ( slotComputeLayout())); |
1138 | 1139 | ||
1139 | 1140 | ||
1140 | #ifndef DESKTOP_VERSION | 1141 | #ifndef DESKTOP_VERSION |
1141 | resize( QApplication::desktop()->size() ); | 1142 | resize( QApplication::desktop()->size() ); |
1142 | #else | 1143 | #else |
1143 | resize(640, 480 ); | 1144 | resize(640, 480 ); |
1144 | updatePossible = true; | 1145 | updatePossible = true; |
1145 | #endif | 1146 | #endif |
1146 | computeLayout(); | 1147 | computeLayout(); |
1147 | 1148 | ||
1148 | if ( mShowWeekView ) | 1149 | if ( mShowWeekView ) |
1149 | mWidStack->raiseWidget( mWeekView ); | 1150 | mWidStack->raiseWidget( mWeekView ); |
1150 | else | 1151 | else |
1151 | mWidStack->raiseWidget( mMonthView ); | 1152 | mWidStack->raiseWidget( mMonthView ); |
1152 | } | 1153 | } |
1153 | 1154 | ||
1154 | KOMonthView::~KOMonthView() | 1155 | KOMonthView::~KOMonthView() |
1155 | { | 1156 | { |
1156 | delete mContextMenu; | 1157 | delete mContextMenu; |
1157 | } | 1158 | } |
1158 | 1159 | ||
1159 | void KOMonthView::selectInternalWeekNum ( int n ) | 1160 | void KOMonthView::selectInternalWeekNum ( int n ) |
1160 | { | 1161 | { |
1161 | switchView(); | 1162 | switchView(); |
1162 | if ( !KOPrefs::instance()->mMonthViewWeek ) | 1163 | if ( !KOPrefs::instance()->mMonthViewWeek ) |
1163 | emit selectMonth (); | 1164 | emit selectMonth (); |
1164 | else | 1165 | else |
1165 | emit selectWeekNum ( n ); | 1166 | emit selectWeekNum ( n ); |
1166 | } | 1167 | } |
1167 | 1168 | ||
1168 | int KOMonthView::currentWeek() | 1169 | int KOMonthView::currentWeek() |
1169 | { | 1170 | { |
1170 | if ( mShowWeekView ) | 1171 | if ( mShowWeekView ) |
1171 | return mWeekLabelsW[0]->getWeekNum(); | 1172 | return mWeekLabelsW[0]->getWeekNum(); |
1172 | return mWeekLabels[0]->getWeekNum(); | 1173 | return mWeekLabels[0]->getWeekNum(); |
1173 | } | 1174 | } |
1174 | void KOMonthView::switchView() | 1175 | void KOMonthView::switchView() |
1175 | { | 1176 | { |
1176 | if ( selectedCell( ) ) | 1177 | if ( selectedCell( ) ) |
1177 | selectedCell()->deselect(); | 1178 | selectedCell()->deselect(); |
1178 | mShowWeekView = !mShowWeekView; | 1179 | mShowWeekView = !mShowWeekView; |
1179 | KOPrefs::instance()->mMonthViewWeek = mShowWeekView; | 1180 | KOPrefs::instance()->mMonthViewWeek = mShowWeekView; |
1180 | if ( clPending ) { | 1181 | if ( clPending ) { |
1181 | computeLayout(); | 1182 | computeLayout(); |
1182 | updateConfig(); | 1183 | updateConfig(); |
1183 | } | 1184 | } |
1184 | if ( mShowWeekView ) | 1185 | if ( mShowWeekView ) |
1185 | mWidStack->raiseWidget( mWeekView ); | 1186 | mWidStack->raiseWidget( mWeekView ); |
1186 | else | 1187 | else |
1187 | mWidStack->raiseWidget( mMonthView ); | 1188 | mWidStack->raiseWidget( mMonthView ); |
1188 | clPending = false; | 1189 | clPending = false; |
1189 | } | 1190 | } |
1190 | 1191 | ||
1191 | int KOMonthView::maxDatesHint() | 1192 | int KOMonthView::maxDatesHint() |
1192 | { | 1193 | { |
1193 | return mNumCells; | 1194 | return mNumCells; |
1194 | } | 1195 | } |
1195 | 1196 | ||
1196 | int KOMonthView::currentDateCount() | 1197 | int KOMonthView::currentDateCount() |
1197 | { | 1198 | { |
1198 | return mNumCells; | 1199 | return mNumCells; |
1199 | } | 1200 | } |
1200 | 1201 | ||
1201 | QPtrList<Incidence> KOMonthView::selectedIncidences() | 1202 | QPtrList<Incidence> KOMonthView::selectedIncidences() |
1202 | { | 1203 | { |
1203 | QPtrList<Incidence> selected; | 1204 | QPtrList<Incidence> selected; |
1204 | 1205 | ||
1205 | if ( mSelectedCell ) { | 1206 | if ( mSelectedCell ) { |
1206 | Incidence *incidence = mSelectedCell->selectedIncidence(); | 1207 | Incidence *incidence = mSelectedCell->selectedIncidence(); |
1207 | if ( incidence ) selected.append( incidence ); | 1208 | if ( incidence ) selected.append( incidence ); |
1208 | } | 1209 | } |
1209 | 1210 | ||
1210 | return selected; | 1211 | return selected; |
1211 | } | 1212 | } |
1212 | 1213 | ||
1213 | DateList KOMonthView::selectedDates() | 1214 | DateList KOMonthView::selectedDates() |
1214 | { | 1215 | { |
1215 | DateList selected; | 1216 | DateList selected; |
1216 | 1217 | ||
1217 | if ( mSelectedCell ) { | 1218 | if ( mSelectedCell ) { |
1218 | QDate qd = mSelectedCell->selectedIncidenceDate(); | 1219 | QDate qd = mSelectedCell->selectedIncidenceDate(); |
1219 | if ( qd.isValid() ) selected.append( qd ); | 1220 | if ( qd.isValid() ) selected.append( qd ); |
1220 | } | 1221 | } |
1221 | 1222 | ||
1222 | return selected; | 1223 | return selected; |
1223 | } | 1224 | } |
1224 | 1225 | ||
1225 | void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd, | 1226 | void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd, |
1226 | const QDate &td) | 1227 | const QDate &td) |
1227 | { | 1228 | { |
1228 | #ifndef KORG_NOPRINTER | 1229 | #ifndef KORG_NOPRINTER |
1229 | calPrinter->preview(CalPrinter::Month, fd, td); | 1230 | calPrinter->preview(CalPrinter::Month, fd, td); |
1230 | #endif | 1231 | #endif |
1231 | } | 1232 | } |
1232 | 1233 | ||
1233 | void KOMonthView::updateConfig() | 1234 | void KOMonthView::updateConfig() |
1234 | { | 1235 | { |
1235 | 1236 | ||
1236 | int mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); | 1237 | int mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); |
1237 | 1238 | ||
1238 | if ( mShowWeekView || KOPrefs::instance()->mMonthViewSatSunTog ) { | 1239 | if ( mShowWeekView || KOPrefs::instance()->mMonthViewSatSunTog ) { |
1239 | mWeekStartsMonday = true; | 1240 | mWeekStartsMonday = true; |
1240 | } | 1241 | } |
1241 | QFontMetrics fontmetric(mDayLabels[0]->font()); | 1242 | QFontMetrics fontmetric(mDayLabels[0]->font()); |
1242 | mWidthLongDayLabel = 0; | 1243 | mWidthLongDayLabel = 0; |
1243 | 1244 | ||
1244 | for (int i = 0; i < 7; i++) { | 1245 | for (int i = 0; i < 7; i++) { |
1245 | int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); | 1246 | int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); |
1246 | if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; | 1247 | if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; |
1247 | } | 1248 | } |
1248 | bool temp = mShowSatSunComp ; | 1249 | bool temp = mShowSatSunComp ; |
1249 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; | 1250 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; |
1250 | if ( ! mShowWeekView ) { | 1251 | if ( ! mShowWeekView ) { |
1251 | if ( temp != KOPrefs::instance()->mMonthViewSatSunTog ) | 1252 | if ( temp != KOPrefs::instance()->mMonthViewSatSunTog ) |
1252 | computeLayout(); | 1253 | computeLayout(); |
1253 | } | 1254 | } |
1254 | updateDayLabels(); | 1255 | updateDayLabels(); |
1255 | //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks); | 1256 | //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks); |
1256 | //int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks; | 1257 | //int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks; |
1257 | //resizeEvent( 0 ); | 1258 | //resizeEvent( 0 ); |
1258 | for (uint i = 0; i < mCells.count(); ++i) { | 1259 | for (uint i = 0; i < mCells.count(); ++i) { |
1259 | mCells[i]->updateConfig(); | 1260 | mCells[i]->updateConfig(); |
1260 | } | 1261 | } |
1261 | 1262 | ||
1262 | for (uint i = 0; i < mCellsW.count(); ++i) { | 1263 | for (uint i = 0; i < mCellsW.count(); ++i) { |
1263 | mCellsW[i]->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont); | 1264 | mCellsW[i]->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont); |
1264 | } | 1265 | } |
1265 | #ifdef DESKTOP_VERSION | 1266 | #ifdef DESKTOP_VERSION |
1266 | MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips); | 1267 | MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips); |
1267 | #endif | 1268 | #endif |
1268 | updateView(); | 1269 | updateView(); |
1269 | } | 1270 | } |
1270 | 1271 | ||
1271 | void KOMonthView::updateDayLabels() | 1272 | void KOMonthView::updateDayLabels() |
1272 | { | 1273 | { |
1273 | 1274 | ||
1274 | QPtrVector<QLabel> *mDayLabelsT; | 1275 | QPtrVector<QLabel> *mDayLabelsT; |
1275 | 1276 | ||
1276 | mDayLabelsT = &mDayLabelsW; | 1277 | mDayLabelsT = &mDayLabelsW; |
1277 | for (int i = 0; i < 7; i++) { | 1278 | for (int i = 0; i < 7; i++) { |
1278 | { | 1279 | { |
1279 | bool show = mShortDayLabelsW; | 1280 | bool show = mShortDayLabelsW; |
1280 | if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) | 1281 | if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) |
1281 | show = true; | 1282 | show = true; |
1282 | (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); | 1283 | (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); |
1283 | } | 1284 | } |
1284 | } | 1285 | } |
1285 | mDayLabelsT = &mDayLabels; | 1286 | mDayLabelsT = &mDayLabels; |
1286 | for (int i = 0; i < 7; i++) { | 1287 | for (int i = 0; i < 7; i++) { |
1287 | if (KGlobal::locale()->weekStartsMonday() || KOPrefs::instance()->mMonthViewSatSunTog ) { | 1288 | if (KGlobal::locale()->weekStartsMonday() || KOPrefs::instance()->mMonthViewSatSunTog ) { |
1288 | bool show = mShortDayLabelsM; | 1289 | bool show = mShortDayLabelsM; |
1289 | if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) | 1290 | if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) |
1290 | show = true; | 1291 | show = true; |
1291 | (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); | 1292 | (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); |
1292 | } else { | 1293 | } else { |
1293 | if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabelsM)); | 1294 | if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabelsM)); |
1294 | else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabelsM)); | 1295 | else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabelsM)); |
1295 | 1296 | ||
1296 | } | 1297 | } |
1297 | } | 1298 | } |
1298 | 1299 | ||
1299 | } | 1300 | } |
1300 | 1301 | ||
1301 | void KOMonthView::showDates(const QDate &start, const QDate &) | 1302 | void KOMonthView::showDates(const QDate &start, const QDate &) |
1302 | { | 1303 | { |
1303 | // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl; | 1304 | // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl; |
1304 | 1305 | ||
1305 | QPtrVector<MonthViewCell> *cells; | 1306 | QPtrVector<MonthViewCell> *cells; |
1306 | QPtrVector<QLabel> *dayLabels; | 1307 | QPtrVector<QLabel> *dayLabels; |
1307 | QPtrVector<KOWeekButton> *weekLabels; | 1308 | QPtrVector<KOWeekButton> *weekLabels; |
1308 | int weekNum = 6; | 1309 | int weekNum = 6; |
1309 | mStartDate = start; | 1310 | mStartDate = start; |
1310 | if ( mShowWeekView ) { | 1311 | if ( mShowWeekView ) { |
1311 | weekNum = 1; | 1312 | weekNum = 1; |
1312 | cells = &mCellsW; | 1313 | cells = &mCellsW; |
1313 | dayLabels = &mDayLabelsW; | 1314 | dayLabels = &mDayLabelsW; |
1314 | weekLabels = &mWeekLabelsW; | 1315 | weekLabels = &mWeekLabelsW; |
1315 | if ( !KGlobal::locale()->weekStartsMonday() ) { | 1316 | if ( !KGlobal::locale()->weekStartsMonday() ) { |
1316 | mStartDate = mStartDate.addDays( 1 ); | 1317 | mStartDate = mStartDate.addDays( 1 ); |
1317 | } | 1318 | } |
1318 | } else { | 1319 | } else { |
1319 | cells = &mCells; | 1320 | cells = &mCells; |
1320 | dayLabels = &mDayLabels; | 1321 | dayLabels = &mDayLabels; |
1321 | weekLabels = &mWeekLabels; | 1322 | weekLabels = &mWeekLabels; |
1322 | } | 1323 | } |
1323 | 1324 | ||
1324 | int mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); | 1325 | int mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); |
1325 | 1326 | ||
1326 | if ( mShowWeekView || KOPrefs::instance()->mMonthViewSatSunTog ) { | 1327 | if ( mShowWeekView || KOPrefs::instance()->mMonthViewSatSunTog ) { |
1327 | mWeekStartsMonday = true; | 1328 | mWeekStartsMonday = true; |
1328 | } | 1329 | } |
1329 | int startWeekDay = mWeekStartsMonday ? 1 : 7; | 1330 | int startWeekDay = mWeekStartsMonday ? 1 : 7; |
1330 | 1331 | ||
1331 | while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) { | 1332 | while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) { |
1332 | mStartDate = mStartDate.addDays( -1 ); | 1333 | mStartDate = mStartDate.addDays( -1 ); |
1333 | } | 1334 | } |
1334 | bool primary = false; | 1335 | bool primary = false; |
1335 | uint i; | 1336 | uint i; |
1336 | for( i = 0; i < (*cells).size(); ++i ) { | 1337 | for( i = 0; i < (*cells).size(); ++i ) { |
1337 | QDate date = mStartDate.addDays( i ); | 1338 | QDate date = mStartDate.addDays( i ); |
1338 | (*cells)[i]->setDate( date ); | 1339 | (*cells)[i]->setDate( date ); |
1339 | 1340 | ||
1340 | #ifndef KORG_NOPLUGINS | 1341 | #ifndef KORG_NOPLUGINS |
1341 | // add holiday, if present | 1342 | // add holiday, if present |
1342 | QString hstring(KOCore::self()->holiday(date)); | 1343 | QString hstring(KOCore::self()->holiday(date)); |
1343 | (*cells)[i]->setHoliday( hstring ); | 1344 | (*cells)[i]->setHoliday( hstring ); |
1344 | #endif | 1345 | #endif |
1345 | 1346 | ||
1346 | } | 1347 | } |
1347 | QDate date = mStartDate.addDays( mWeekStartsMonday ? 3 : 4 ); | 1348 | QDate date = mStartDate.addDays( mWeekStartsMonday ? 3 : 4 ); |
1348 | for( i = 0; i < weekNum; ++i ) { | 1349 | for( i = 0; i < weekNum; ++i ) { |
1349 | int wno; | 1350 | int wno; |
1350 | // remember, according to ISO 8601, the first week of the year is the | 1351 | // remember, according to ISO 8601, the first week of the year is the |
1351 | // first week that contains a thursday. Thus we must subtract off 4, | 1352 | // first week that contains a thursday. Thus we must subtract off 4, |
1352 | // not just 1. | 1353 | // not just 1. |
1353 | int dayOfYear = date.dayOfYear(); | 1354 | int dayOfYear = date.dayOfYear(); |
1354 | if (dayOfYear % 7 != 0) | 1355 | if (dayOfYear % 7 != 0) |
1355 | wno = dayOfYear / 7 + 1; | 1356 | wno = dayOfYear / 7 + 1; |
1356 | else | 1357 | else |
1357 | wno =dayOfYear / 7; | 1358 | wno =dayOfYear / 7; |
1358 | (*weekLabels)[i]->setWeekNum( wno ); | 1359 | (*weekLabels)[i]->setWeekNum( wno ); |
1359 | date = date.addDays( 7 ); | 1360 | date = date.addDays( 7 ); |
1360 | } | 1361 | } |
1361 | updateView(); | 1362 | updateView(); |
1362 | } | 1363 | } |
1363 | 1364 | ||
1364 | void KOMonthView::showEvents(QPtrList<Event>) | 1365 | void KOMonthView::showEvents(QPtrList<Event>) |
1365 | { | 1366 | { |
1366 | qDebug("KOMonthView::selectEvents is not implemented yet. "); | 1367 | qDebug("KOMonthView::selectEvents is not implemented yet. "); |
1367 | } | 1368 | } |
1368 | 1369 | ||
1369 | void KOMonthView::changeEventDisplay(Event *, int) | 1370 | void KOMonthView::changeEventDisplay(Event *, int) |
1370 | { | 1371 | { |
1371 | // this should be re-written to be much more efficient, but this | 1372 | // this should be re-written to be much more efficient, but this |
1372 | // quick-and-dirty-hack gets the job done for right now. | 1373 | // quick-and-dirty-hack gets the job done for right now. |
1373 | updateView(); | 1374 | updateView(); |
1374 | } | 1375 | } |
1375 | 1376 | ||
1376 | void KOMonthView::updateView() | 1377 | void KOMonthView::updateView() |
1377 | { | 1378 | { |
1378 | 1379 | ||
1379 | if ( !updatePossible ) | 1380 | if ( !updatePossible ) |
1380 | return; | 1381 | return; |
1381 | //qDebug("UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU "); | 1382 | //qDebug("UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU "); |
1382 | //QTime ti; | 1383 | //QTime ti; |
1383 | //ti.start(); | 1384 | //ti.start(); |
1384 | clearSelection(); | 1385 | clearSelection(); |
1385 | QPtrVector<MonthViewCell> *cells; | 1386 | QPtrVector<MonthViewCell> *cells; |
1386 | if ( mShowWeekView ) { | 1387 | if ( mShowWeekView ) { |
1387 | cells = &mCellsW; | 1388 | cells = &mCellsW; |
1388 | } else { | 1389 | } else { |
1389 | cells = &mCells; | 1390 | cells = &mCells; |
1390 | } | 1391 | } |
1391 | #if 1 | 1392 | #if 1 |
1392 | int i; | 1393 | int i; |
1393 | int timeSpan = (*cells).size()-1; | 1394 | int timeSpan = (*cells).size()-1; |
1394 | if ( KOPrefs::instance()->mMonthViewWeek ) | 1395 | if ( KOPrefs::instance()->mMonthViewWeek ) |
1395 | timeSpan = 6; | 1396 | timeSpan = 6; |
1396 | for( i = 0; i < timeSpan + 1; ++i ) { | 1397 | for( i = 0; i < timeSpan + 1; ++i ) { |
1397 | (*cells)[i]->startUpdateCell(); | 1398 | (*cells)[i]->startUpdateCell(); |
1398 | } | 1399 | } |
1399 | 1400 | ||
1400 | QPtrList<Event> events = calendar()->events(); | 1401 | QPtrList<Event> events = calendar()->events(); |
1401 | Event *event; | 1402 | Event *event; |
1402 | QDateTime dt; | 1403 | QDateTime dt; |
1403 | bool ok; | 1404 | bool ok; |
1404 | QDate endDate = mStartDate.addDays( timeSpan ); | 1405 | QDate endDate = mStartDate.addDays( timeSpan ); |
1405 | for( event = events.first(); event; event = events.next() ) { // for event | 1406 | for( event = events.first(); event; event = events.next() ) { // for event |
1406 | if ( event->doesRecur() ) { | 1407 | if ( event->doesRecur() ) { |
1407 | bool last; | 1408 | bool last; |
1408 | QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last ); | 1409 | QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last ); |
1409 | QDateTime incidenceEnd; | 1410 | QDateTime incidenceEnd; |
1410 | int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() ); | 1411 | int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() ); |
1411 | bool invalid = false; | 1412 | bool invalid = false; |
1412 | while( true ) { | 1413 | while( true ) { |
1413 | if ( incidenceStart.isValid() ) { | 1414 | if ( incidenceStart.isValid() ) { |
1414 | incidenceEnd = incidenceStart.addDays( eventlen ); | 1415 | incidenceEnd = incidenceStart.addDays( eventlen ); |
1415 | int st = incidenceStart.date().daysTo( endDate ); | 1416 | int st = incidenceStart.date().daysTo( endDate ); |
1416 | if ( st >= 0 ) { // start before timeend | 1417 | if ( st >= 0 ) { // start before timeend |
1417 | int end = mStartDate.daysTo( incidenceEnd.date() ); | 1418 | int end = mStartDate.daysTo( incidenceEnd.date() ); |
1418 | if ( end >= 0 ) { // end after timestart --- got one! | 1419 | if ( end >= 0 ) { // end after timestart --- got one! |
1419 | //normalize | 1420 | //normalize |
1420 | st = timeSpan - st; | 1421 | st = timeSpan - st; |
1421 | if ( st < 0 ) st = 0; | 1422 | if ( st < 0 ) st = 0; |
1422 | if ( end > timeSpan ) end = timeSpan; | 1423 | if ( end > timeSpan ) end = timeSpan; |
1423 | int iii; | 1424 | int iii; |
1424 | //qDebug("found %s %d %d ",event->summary().latin1(), st, end ); | 1425 | //qDebug("found %s %d %d ",event->summary().latin1(), st, end ); |
1425 | for ( iii = st;iii<= end;++iii) | 1426 | for ( iii = st;iii<= end;++iii) |
1426 | (*cells)[iii]->insertEvent( event ); | 1427 | (*cells)[iii]->insertEvent( event ); |
1427 | } | 1428 | } |
1428 | } | 1429 | } |
1429 | } else { | 1430 | } else { |
1430 | if ( invalid ) | 1431 | if ( invalid ) |
1431 | break; | 1432 | break; |
1432 | invalid = true; | 1433 | invalid = true; |
1433 | //qDebug("invalid %s", event->summary().latin1()); | 1434 | //qDebug("invalid %s", event->summary().latin1()); |
1434 | incidenceStart = QDateTime( mStartDate ).addSecs( -2 );; | 1435 | incidenceStart = QDateTime( mStartDate ).addSecs( -2 );; |
1435 | } | 1436 | } |
1436 | if ( last ) | 1437 | if ( last ) |
1437 | break; | 1438 | break; |
1438 | bool ok; | 1439 | bool ok; |
1439 | incidenceStart = event->getNextOccurence( incidenceStart.addSecs( 1 ) ,&ok ); | 1440 | incidenceStart = event->getNextOccurence( incidenceStart.addSecs( 1 ) ,&ok ); |
1440 | if ( ! ok ) | 1441 | if ( ! ok ) |
1441 | break; | 1442 | break; |
1442 | if ( incidenceStart.date() > endDate ) | 1443 | if ( incidenceStart.date() > endDate ) |
1443 | break; | 1444 | break; |
1444 | } | 1445 | } |
1445 | } else { // no recur | 1446 | } else { // no recur |
1446 | int st = event->dtStart().date().daysTo( endDate ); | 1447 | int st = event->dtStart().date().daysTo( endDate ); |
1447 | if ( st >= 0 ) { // start before timeend | 1448 | if ( st >= 0 ) { // start before timeend |
1448 | int end = mStartDate.daysTo( event->dtEnd().date() ); | 1449 | int end = mStartDate.daysTo( event->dtEnd().date() ); |
1449 | if ( end >= 0 ) { // end after timestart --- got one! | 1450 | if ( end >= 0 ) { // end after timestart --- got one! |
1450 | //normalize | 1451 | //normalize |
1451 | st = timeSpan - st; | 1452 | st = timeSpan - st; |
1452 | if ( st < 0 ) st = 0; | 1453 | if ( st < 0 ) st = 0; |
1453 | if ( end > timeSpan ) end = timeSpan; | 1454 | if ( end > timeSpan ) end = timeSpan; |
1454 | int iii; | 1455 | int iii; |
1455 | for ( iii = st;iii<= end;++iii) | 1456 | for ( iii = st;iii<= end;++iii) |
1456 | (*cells)[iii]->insertEvent( event ); | 1457 | (*cells)[iii]->insertEvent( event ); |
1457 | } | 1458 | } |
1458 | } | 1459 | } |
1459 | } | 1460 | } |
1460 | } | 1461 | } |
1461 | // insert due todos | 1462 | // insert due todos |
1462 | QPtrList<Todo> todos = calendar()->todos( ); | 1463 | QPtrList<Todo> todos = calendar()->todos( ); |
1463 | Todo *todo; | 1464 | Todo *todo; |
1464 | for(todo = todos.first(); todo; todo = todos.next()) { | 1465 | for(todo = todos.first(); todo; todo = todos.next()) { |
1465 | //insertTodo( todo ); | 1466 | //insertTodo( todo ); |
1466 | if ( todo->hasDueDate() ) { | 1467 | if ( todo->hasDueDate() ) { |
1467 | int day = mStartDate.daysTo( todo->dtDue().date() ); | 1468 | int day = mStartDate.daysTo( todo->dtDue().date() ); |
1468 | if ( day >= 0 && day < timeSpan + 1) { | 1469 | if ( day >= 0 && day < timeSpan + 1) { |
1469 | (*cells)[day]->insertTodo( todo ); | 1470 | (*cells)[day]->insertTodo( todo ); |
1470 | } | 1471 | } |
1471 | } | 1472 | } |
1472 | } | 1473 | } |
1473 | 1474 | ||
1474 | for( i = 0; i < timeSpan+1; ++i ) { | 1475 | for( i = 0; i < timeSpan+1; ++i ) { |
1475 | (*cells)[i]->finishUpdateCell(); | 1476 | (*cells)[i]->finishUpdateCell(); |
1476 | } | 1477 | } |
1477 | processSelectionChange(); | 1478 | processSelectionChange(); |
1478 | //qApp->processEvents(); | 1479 | //qApp->processEvents(); |
1479 | for( i = 0; i < timeSpan+1; ++i ) { | 1480 | for( i = 0; i < timeSpan+1; ++i ) { |
1480 | (*cells)[i]->repaintfinishUpdateCell(); | 1481 | (*cells)[i]->repaintfinishUpdateCell(); |
1481 | } | 1482 | } |
1482 | setKeyBFocus(); | 1483 | setKeyBFocus(); |
1483 | #else | 1484 | #else |
1484 | // old code | 1485 | // old code |
1485 | //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); | 1486 | //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); |
1486 | int i; | 1487 | int i; |
1487 | for( i = 0; i < (*cells).count(); ++i ) { | 1488 | for( i = 0; i < (*cells).count(); ++i ) { |
1488 | (*cells)[i]->updateCell(); | 1489 | (*cells)[i]->updateCell(); |
1489 | } | 1490 | } |
1490 | 1491 | ||
1491 | //qDebug("KOMonthView::updateView() "); | 1492 | //qDebug("KOMonthView::updateView() "); |
1492 | processSelectionChange(); | 1493 | processSelectionChange(); |
1493 | // qDebug("---------------------------------------------------------------------+ "); | 1494 | // qDebug("---------------------------------------------------------------------+ "); |
1494 | (*cells)[0]->setFocus(); | 1495 | (*cells)[0]->setFocus(); |
1495 | #endif | 1496 | #endif |
1496 | 1497 | ||
1497 | //qDebug("update time %d ", ti.elapsed()); | 1498 | //qDebug("update time %d ", ti.elapsed()); |
1498 | } | 1499 | } |
1499 | 1500 | ||
1500 | void KOMonthView::setKeyBoardFocus() | 1501 | void KOMonthView::setKeyBoardFocus() |
1501 | { | 1502 | { |
1502 | bool shootAgain = false; | 1503 | bool shootAgain = false; |
1503 | if ( mShowWeekView ) { | 1504 | if ( mShowWeekView ) { |
1504 | shootAgain = !mWeekLabelsW[0]->hasFocus(); | 1505 | shootAgain = !mWeekLabelsW[0]->hasFocus(); |
1505 | mWeekLabelsW[0]->setFocus(); | 1506 | mWeekLabelsW[0]->setFocus(); |
1506 | } | 1507 | } |
1507 | else { | 1508 | else { |
1508 | shootAgain = !mWeekLabels[0]->hasFocus(); | 1509 | shootAgain = !mWeekLabels[0]->hasFocus(); |
1509 | mWeekLabels[0]->setFocus(); | 1510 | mWeekLabels[0]->setFocus(); |
1510 | } | 1511 | } |
1511 | if ( shootAgain ) { | 1512 | if ( shootAgain ) { |
1512 | QTimer::singleShot( 0, this, SLOT ( setKeyBFocus() ) ); | 1513 | QTimer::singleShot( 0, this, SLOT ( setKeyBFocus() ) ); |
1513 | } | 1514 | } |
1514 | } | 1515 | } |
1515 | void KOMonthView::setKeyBFocus() | 1516 | void KOMonthView::setKeyBFocus() |
1516 | { | 1517 | { |
1517 | //qDebug("KOMonthView::setKeyBFocus() "); | 1518 | //qDebug("KOMonthView::setKeyBFocus() "); |
1518 | QTimer::singleShot( 0, this, SLOT ( setKeyBoardFocus() ) ); | 1519 | QTimer::singleShot( 0, this, SLOT ( setKeyBoardFocus() ) ); |
1519 | } | 1520 | } |
1520 | void KOMonthView::resizeEvent(QResizeEvent * e) | 1521 | void KOMonthView::resizeEvent(QResizeEvent * e) |
1521 | { | 1522 | { |
1522 | //qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height()); | 1523 | //qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height()); |
1523 | if ( isVisible() ) { | 1524 | if ( isVisible() ) { |
1524 | //qDebug("KOMonthView::isVisible "); | 1525 | //qDebug("KOMonthView::isVisible "); |
1525 | slotComputeLayout(); | 1526 | slotComputeLayout(); |
1526 | } else | 1527 | } else |
1527 | mComputeLayoutTimer->start( 100 ); | 1528 | mComputeLayoutTimer->start( 100 ); |
1528 | } | 1529 | } |
1529 | 1530 | ||
1530 | void KOMonthView::slotComputeLayout() | 1531 | void KOMonthView::slotComputeLayout() |
1531 | { | 1532 | { |
1532 | mComputeLayoutTimer->stop(); | 1533 | mComputeLayoutTimer->stop(); |
1533 | //qDebug("KOMonthView::Post - resizeEvent %d %d ", width(), height() ); | 1534 | //qDebug("KOMonthView::Post - resizeEvent %d %d ", width(), height() ); |
1534 | computeLayout(); | 1535 | computeLayout(); |
1535 | clPending = true; | 1536 | clPending = true; |
1536 | setKeyBFocus(); | 1537 | setKeyBFocus(); |
1537 | } | 1538 | } |
1538 | void KOMonthView::computeLayoutWeek() | 1539 | void KOMonthView::computeLayoutWeek() |
1539 | { | 1540 | { |
1540 | static int lastWid = 0; | 1541 | static int lastWid = 0; |
1541 | static int lastHei = 0; | 1542 | static int lastHei = 0; |
1542 | int daysToShow; | 1543 | int daysToShow; |
1543 | bool combinedSatSun = false; | 1544 | bool combinedSatSun = false; |
1544 | if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { | 1545 | if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { |
1545 | daysToShow = 6; | 1546 | daysToShow = 6; |
1546 | combinedSatSun = true; | 1547 | combinedSatSun = true; |
1547 | } | 1548 | } |
1548 | int tWid = topLevelWidget()->size().width(); | 1549 | int tWid = topLevelWidget()->size().width(); |
1549 | int tHei = topLevelWidget()->size().height(); | 1550 | int tHei = topLevelWidget()->size().height(); |
1550 | 1551 | ||
1551 | int wid = width();//e | 1552 | int wid = width();//e |
1552 | int hei = height()-1-mNavigatorBar->height(); | 1553 | int hei = height()-1-mNavigatorBar->height(); |
1553 | 1554 | ||
1554 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) | 1555 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) |
1555 | return; | 1556 | return; |
1556 | 1557 | ||
1557 | if ( lastWid == width() && lastHei == height() ) { | 1558 | if ( lastWid == width() && lastHei == height() ) { |
1558 | //qDebug("KOListWeekView::No compute layout needed "); | 1559 | //qDebug("KOListWeekView::No compute layout needed "); |
1559 | return; | 1560 | return; |
1560 | } | 1561 | } |
1561 | lastWid = width(); | 1562 | lastWid = width(); |
1562 | lastHei = height(); | 1563 | lastHei = height(); |
1563 | 1564 | ||
1564 | 1565 | ||
1565 | if ( wid < hei ) | 1566 | if ( wid < hei ) |
1566 | daysToShow = 2; | 1567 | daysToShow = 2; |
1567 | else | 1568 | else |
1568 | daysToShow = 3; | 1569 | daysToShow = 3; |
1569 | mShowSatSunComp = true; | 1570 | mShowSatSunComp = true; |
1570 | combinedSatSun = true; | 1571 | combinedSatSun = true; |
1571 | 1572 | ||
1572 | //qDebug("KOMonthView::computeLayout() WWW ------------------------------------ "); | 1573 | //qDebug("KOMonthView::computeLayout() WWW ------------------------------------ "); |
1573 | QFontMetrics fm ( mWeekLabels[0]->font() ); | 1574 | QFontMetrics fm ( mWeekLabels[0]->font() ); |
1574 | int weeklabelwid = fm.width( "888" ); | 1575 | int weeklabelwid = fm.width( "888" ); |
1575 | wid -= weeklabelwid; | 1576 | wid -= weeklabelwid; |
1576 | 1577 | ||
1577 | int colWid = wid / daysToShow; | 1578 | int colWid = wid / daysToShow; |
1578 | int lastCol = wid - ( colWid*6 ); | 1579 | int lastCol = wid - ( colWid*6 ); |
1579 | int dayLabelHei = mDayLabelsW[0]->sizeHint().height(); | 1580 | int dayLabelHei = mDayLabelsW[0]->sizeHint().height(); |
1580 | int cellHei = (hei - (5- daysToShow )*dayLabelHei) /(5- daysToShow ); | 1581 | int cellHei = (hei - (5- daysToShow )*dayLabelHei) /(5- daysToShow ); |
1581 | int colModulo = wid % daysToShow; | 1582 | int colModulo = wid % daysToShow; |
1582 | int rowModulo = (hei- (5- daysToShow )*dayLabelHei) % daysToShow-1; | 1583 | int rowModulo = (hei- (5- daysToShow )*dayLabelHei) % daysToShow-1; |
1583 | //qDebug("rowmod %d ", rowModulo); | 1584 | //qDebug("rowmod %d ", rowModulo); |
1584 | int i; | 1585 | int i; |
1585 | int x,y,w,h; | 1586 | int x,y,w,h; |
1586 | x= 0; | 1587 | x= 0; |
1587 | y= 0; | 1588 | y= 0; |
1588 | w = colWid; | 1589 | w = colWid; |
1589 | h = dayLabelHei ; | 1590 | h = dayLabelHei ; |
1590 | for ( i = 0; i < 7; i++) { | 1591 | for ( i = 0; i < 7; i++) { |
1591 | if ( i && !( i % daysToShow) && i < 6) { | 1592 | if ( i && !( i % daysToShow) && i < 6) { |
1592 | y += hei/(5-daysToShow); | 1593 | y += hei/(5-daysToShow); |
1593 | x = 0; | 1594 | x = 0; |
1594 | w = colWid; | 1595 | w = colWid; |
1595 | } | 1596 | } |
1596 | if ( ((i) % daysToShow) >= daysToShow-colModulo ) { | 1597 | if ( ((i) % daysToShow) >= daysToShow-colModulo ) { |
1597 | ++w; | 1598 | ++w; |
1598 | } | 1599 | } |
1599 | if ( i >= 5 ) { | 1600 | if ( i >= 5 ) { |
1600 | mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,w/2+w%2,h); | 1601 | mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,w/2+w%2,h); |
1601 | x -= (w/2 ); | 1602 | x -= (w/2 ); |
1602 | } | 1603 | } |
1603 | else | 1604 | else |
1604 | mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,w,h); | 1605 | mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,w,h); |
1605 | x += w; | 1606 | x += w; |
1606 | } | 1607 | } |
1607 | x= 0; | 1608 | x= 0; |
1608 | y= dayLabelHei; | 1609 | y= dayLabelHei; |
1609 | w = colWid; | 1610 | w = colWid; |
1610 | h = cellHei; | 1611 | h = cellHei; |
1611 | int max = 0; | 1612 | int max = 0; |
1612 | for ( i = 0; i < mCellsW.count(); ++i) { | 1613 | for ( i = 0; i < mCellsW.count(); ++i) { |
1613 | if ( i > 6 ) { | 1614 | if ( i > 6 ) { |
1614 | mCellsW[i]->hide(); | 1615 | mCellsW[i]->hide(); |
1615 | continue; | 1616 | continue; |
1616 | } | 1617 | } |
1617 | 1618 | ||
1618 | w = colWid; | 1619 | w = colWid; |
1619 | if ( ((i) % daysToShow) >= daysToShow-colModulo ) { | 1620 | if ( ((i) % daysToShow) >= daysToShow-colModulo ) { |
1620 | ++w; | 1621 | ++w; |
1621 | } | 1622 | } |
1622 | if ( i == (daysToShow-1-rowModulo)*7) | 1623 | if ( i == (daysToShow-1-rowModulo)*7) |
1623 | ++h; | 1624 | ++h; |
1624 | 1625 | ||
1625 | if ( i >= 5 ) { | 1626 | if ( i >= 5 ) { |
1626 | if ( i ==5 ) { | 1627 | if ( i ==5 ) { |
1627 | max = h/2; | 1628 | max = h/2; |
1628 | mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,max ); | 1629 | mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,max ); |
1629 | x -= w ;y += h/2; | 1630 | x -= w ;y += h/2; |
1630 | } else { | 1631 | } else { |
1631 | if ( ((i-1) % daysToShow) >= daysToShow-colModulo ) { | 1632 | if ( ((i-1) % daysToShow) >= daysToShow-colModulo ) { |
1632 | ++w; | 1633 | ++w; |
1633 | } | 1634 | } |
1634 | max = h-h/2; | 1635 | max = h-h/2; |
1635 | mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,max ); | 1636 | mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,max ); |
1636 | y -= h/2; | 1637 | y -= h/2; |
1637 | } | 1638 | } |
1638 | } else { | 1639 | } else { |
1639 | max = h; | 1640 | max = h; |
1640 | mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h ); | 1641 | mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h ); |
1641 | } | 1642 | } |
1642 | 1643 | ||
1643 | 1644 | ||
1644 | x += w; | 1645 | x += w; |
1645 | if ( x + w/2 > wid ) { | 1646 | if ( x + w/2 > wid ) { |
1646 | x = 0; | 1647 | x = 0; |
1647 | y += h+dayLabelHei ; | 1648 | y += h+dayLabelHei ; |
1648 | } | 1649 | } |
1649 | //mCellsW[i]->dateLabel()->setMaximumHeight( max - mCellsW[i]->lineWidth()*2 ); | 1650 | //mCellsW[i]->dateLabel()->setMaximumHeight( max - mCellsW[i]->lineWidth()*2 ); |
1650 | } | 1651 | } |
1651 | y= dayLabelHei; | 1652 | y= dayLabelHei; |
1652 | h = cellHei ; | 1653 | h = cellHei ; |
1653 | mWeekLabelsW[0]->setGeometry( 0,y,weeklabelwid,hei-dayLabelHei); | 1654 | mWeekLabelsW[0]->setGeometry( 0,y,weeklabelwid,hei-dayLabelHei); |
1654 | mWeekLabelsW[1]->setGeometry( 0,0,weeklabelwid,dayLabelHei); | 1655 | mWeekLabelsW[1]->setGeometry( 0,0,weeklabelwid,dayLabelHei); |
1655 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); | 1656 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); |
1656 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); | 1657 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); |
1657 | mShortDayLabelsW = mDayLabelsW[0]->width()-2 < mWidthLongDayLabel ; | 1658 | mShortDayLabelsW = mDayLabelsW[0]->width()-2 < mWidthLongDayLabel ; |
1658 | updateDayLabels(); | 1659 | updateDayLabels(); |
1659 | //bool forceUpdate = !updatePossible; | 1660 | //bool forceUpdate = !updatePossible; |
1660 | updatePossible = true; | 1661 | updatePossible = true; |
1661 | //mWeekLabels[mNumWeeks]->setText( i18n("M")); | 1662 | //mWeekLabels[mNumWeeks]->setText( i18n("M")); |
1662 | //if ( forceUpdate ) | 1663 | //if ( forceUpdate ) |
1663 | // updateView(); | 1664 | // updateView(); |
1664 | } | 1665 | } |
1665 | void KOMonthView::computeLayout() | 1666 | void KOMonthView::computeLayout() |
1666 | { | 1667 | { |
1667 | 1668 | ||
1668 | 1669 | ||
1669 | static int lastWid = 0; | 1670 | static int lastWid = 0; |
1670 | static int lastHei = 0; | 1671 | static int lastHei = 0; |
1671 | 1672 | ||
1672 | if ( mShowWeekView ){ | 1673 | if ( mShowWeekView ){ |
1673 | computeLayoutWeek(); | 1674 | computeLayoutWeek(); |
1674 | return; | 1675 | return; |
1675 | } | 1676 | } |
1676 | int daysToShow = 7; | 1677 | int daysToShow = 7; |
1677 | bool combinedSatSun = false; | 1678 | bool combinedSatSun = false; |
1678 | if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { | 1679 | if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { |
1679 | daysToShow = 6; | 1680 | daysToShow = 6; |
1680 | combinedSatSun = true; | 1681 | combinedSatSun = true; |
1681 | } | 1682 | } |
1682 | int tWid = topLevelWidget()->size().width(); | 1683 | int tWid = topLevelWidget()->size().width(); |
1683 | int tHei = topLevelWidget()->size().height(); | 1684 | int tHei = topLevelWidget()->size().height(); |
1684 | 1685 | ||
1685 | int wid = width();//e | 1686 | int wid = width();//e |
1686 | int hei = height()-1-mNavigatorBar->height(); | 1687 | int hei = height()-1-mNavigatorBar->height(); |
1687 | 1688 | ||
1688 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) { | 1689 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) { |
1689 | return; | 1690 | return; |
1690 | } | 1691 | } |
1691 | if ( lastWid == width() && lastHei == height() ){ | 1692 | if ( lastWid == width() && lastHei == height() ){ |
1692 | //qDebug("KOMonthview::No compute layout needed "); | 1693 | //qDebug("KOMonthview::No compute layout needed "); |
1693 | return; | 1694 | return; |
1694 | } | 1695 | } |
1695 | 1696 | ||
1696 | lastWid = width(); | 1697 | lastWid = width(); |
1697 | lastHei = height(); | 1698 | lastHei = height(); |
1698 | //qDebug("KOMonthView::computeLayout() MMM ------------------- "); | 1699 | //qDebug("KOMonthView::computeLayout() MMM ------------------- "); |
1699 | QFontMetrics fm ( mWeekLabels[0]->font() ); | 1700 | QFontMetrics fm ( mWeekLabels[0]->font() ); |
1700 | int weeklabelwid = fm.width( "888" ); | 1701 | int weeklabelwid = fm.width( "888" ); |
1701 | wid -= weeklabelwid; | 1702 | wid -= weeklabelwid; |
1702 | 1703 | ||
1703 | int colWid = wid / daysToShow; | 1704 | int colWid = wid / daysToShow; |
1704 | int lastCol = wid - ( colWid*6 ); | 1705 | int lastCol = wid - ( colWid*6 ); |
1705 | int dayLabelHei = mDayLabels[0]->sizeHint().height(); | 1706 | int dayLabelHei = mDayLabels[0]->sizeHint().height(); |
1706 | int cellHei = (hei - dayLabelHei) /6; | 1707 | int cellHei = (hei - dayLabelHei) /6; |
1707 | int colModulo = wid % daysToShow; | 1708 | int colModulo = wid % daysToShow; |
1708 | int rowModulo = (hei- dayLabelHei) % 6; | 1709 | int rowModulo = (hei- dayLabelHei) % 6; |
1709 | //qDebug("rowmod %d ", rowModulo); | 1710 | //qDebug("rowmod %d ", rowModulo); |
1710 | int i; | 1711 | int i; |
1711 | int x,y,w,h; | 1712 | int x,y,w,h; |
1712 | x= 0; | 1713 | x= 0; |
1713 | y= 0; | 1714 | y= 0; |
1714 | w = colWid; | 1715 | w = colWid; |
1715 | h = dayLabelHei ; | 1716 | h = dayLabelHei ; |
1716 | for ( i = 0; i < 7; i++) { | 1717 | for ( i = 0; i < 7; i++) { |
1717 | if ( i == daysToShow-colModulo ) | 1718 | if ( i == daysToShow-colModulo ) |
1718 | ++w; | 1719 | ++w; |
1719 | if ( combinedSatSun ) { | 1720 | if ( combinedSatSun ) { |
1720 | if ( i >= daysToShow-1 ) { | 1721 | if ( i >= daysToShow-1 ) { |
1721 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h); | 1722 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h); |
1722 | x -= w/2 ; | 1723 | x -= w/2 ; |
1723 | } | 1724 | } |
1724 | else | 1725 | else |
1725 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); | 1726 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); |
1726 | } else | 1727 | } else |
1727 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); | 1728 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); |
1728 | x += w; | 1729 | x += w; |
1729 | } | 1730 | } |
1730 | x= 0; | 1731 | x= 0; |
1731 | y= dayLabelHei; | 1732 | y= dayLabelHei; |
1732 | w = colWid; | 1733 | w = colWid; |
1733 | h = cellHei ; | 1734 | h = cellHei ; |
1734 | int max = 0; | 1735 | int max = 0; |
1735 | for ( i = 0; i < mCells.count(); ++i) { | 1736 | for ( i = 0; i < mCells.count(); ++i) { |
1736 | //qDebug("iii %d ", i); | 1737 | //qDebug("iii %d ", i); |
1737 | w = colWid; | 1738 | w = colWid; |
1738 | if ( ((i) % 7) >= 7-colModulo ) { | 1739 | if ( ((i) % 7) >= 7-colModulo ) { |
1739 | ++w; | 1740 | ++w; |
1740 | } | 1741 | } |
1741 | if ( i == (6-rowModulo)*7) | 1742 | if ( i == (6-rowModulo)*7) |
1742 | ++h; | 1743 | ++h; |
1743 | if ( combinedSatSun ) { | 1744 | if ( combinedSatSun ) { |
1744 | if ( (i)%7 >= daysToShow-1 ) { | 1745 | if ( (i)%7 >= daysToShow-1 ) { |
1745 | if ( (i)%7 == daysToShow-1 ) { | 1746 | if ( (i)%7 == daysToShow-1 ) { |
1746 | max = h/2; | 1747 | max = h/2; |
1747 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,max ); | 1748 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,max ); |
1748 | x -= w ;y += h/2; | 1749 | x -= w ;y += h/2; |
1749 | } else { | 1750 | } else { |
1750 | max = h-h/2; | 1751 | max = h-h/2; |
1751 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,max ); | 1752 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,max ); |
1752 | y -= h/2; | 1753 | y -= h/2; |
1753 | } | 1754 | } |
1754 | } else { | 1755 | } else { |
1755 | max = h; | 1756 | max = h; |
1756 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); | 1757 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); |
1757 | } | 1758 | } |
1758 | 1759 | ||
1759 | } | 1760 | } |
1760 | else { | 1761 | else { |
1761 | max = h; | 1762 | max = h; |
1762 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); | 1763 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); |
1763 | } | 1764 | } |
1764 | x += w; | 1765 | x += w; |
1765 | if ( x + w/2 > wid ) { | 1766 | if ( x + w/2 > wid ) { |
1766 | x = 0; | 1767 | x = 0; |
1767 | y += h; | 1768 | y += h; |
1768 | } | 1769 | } |
1769 | //mCells[i]->dateLabel()->setMaximumHeight( max- mCells[i]->lineWidth()*2 ); | 1770 | //mCells[i]->dateLabel()->setMaximumHeight( max- mCells[i]->lineWidth()*2 ); |
1770 | } | 1771 | } |
1771 | y= dayLabelHei; | 1772 | y= dayLabelHei; |
1772 | h = cellHei ; | 1773 | h = cellHei ; |
1773 | for ( i = 0; i < 6; i++) { | 1774 | for ( i = 0; i < 6; i++) { |
1774 | if ( i == (6-rowModulo)) | 1775 | if ( i == (6-rowModulo)) |
1775 | ++h; | 1776 | ++h; |
1776 | mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h); | 1777 | mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h); |
1777 | y += h; | 1778 | y += h; |
1778 | } | 1779 | } |
1779 | mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); | 1780 | mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); |
1780 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); | 1781 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); |
1781 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); | 1782 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); |
1782 | mShortDayLabelsM = mDayLabels[0]->width()-2 < mWidthLongDayLabel ; | 1783 | mShortDayLabelsM = mDayLabels[0]->width()-2 < mWidthLongDayLabel ; |
1783 | updateDayLabels(); | 1784 | updateDayLabels(); |
1784 | //bool forceUpdate = !updatePossible; | 1785 | //bool forceUpdate = !updatePossible; |
1785 | updatePossible = true; | 1786 | updatePossible = true; |
1786 | //mWeekLabels[mNumWeeks]->setText( i18n("W")); | 1787 | //mWeekLabels[mNumWeeks]->setText( i18n("W")); |
1787 | } | 1788 | } |
1788 | 1789 | ||
1789 | void KOMonthView::showContextMenu( Incidence *incidence ) | 1790 | void KOMonthView::showContextMenu( Incidence *incidence ) |
1790 | { | 1791 | { |
1791 | mContextMenu->showIncidencePopup(incidence); | 1792 | mContextMenu->showIncidencePopup(incidence); |
1792 | /* | 1793 | /* |
1793 | if( incidence && incidence->type() == "Event" ) { | 1794 | if( incidence && incidence->type() == "Event" ) { |
1794 | Event *event = static_cast<Event *>(incidence); | 1795 | Event *event = static_cast<Event *>(incidence); |
1795 | mContextMenu->showEventPopup(event); | 1796 | mContextMenu->showEventPopup(event); |
1796 | } else { | 1797 | } else { |
1797 | kdDebug() << "MonthView::showContextMenu(): cast failed." << endl; | 1798 | kdDebug() << "MonthView::showContextMenu(): cast failed." << endl; |
1798 | } | 1799 | } |
1799 | */ | 1800 | */ |
1800 | } | 1801 | } |
1801 | MonthViewCell * KOMonthView::selectedCell( ) | 1802 | MonthViewCell * KOMonthView::selectedCell( ) |
1802 | { | 1803 | { |
1803 | return mSelectedCell; | 1804 | return mSelectedCell; |
1804 | } | 1805 | } |
1805 | void KOMonthView::setSelectedCell( MonthViewCell *cell ) | 1806 | void KOMonthView::setSelectedCell( MonthViewCell *cell ) |
1806 | { | 1807 | { |
1807 | //qDebug("KOMonthView::setSelectedCell "); | 1808 | //qDebug("KOMonthView::setSelectedCell "); |
1808 | if ( mSelectedCell && mSelectedCell != cell ) { | 1809 | if ( mSelectedCell && mSelectedCell != cell ) { |
1809 | MonthViewCell * mvc = mSelectedCell; | 1810 | MonthViewCell * mvc = mSelectedCell; |
1810 | mSelectedCell = cell; | 1811 | mSelectedCell = cell; |
1811 | mvc->deselect(); | 1812 | mvc->deselect(); |
1812 | } else | 1813 | } else |
1813 | mSelectedCell = cell; | 1814 | mSelectedCell = cell; |
1814 | // if ( mSelectedCell ) | 1815 | // if ( mSelectedCell ) |
1815 | // mSelectedCell->select(); | 1816 | // mSelectedCell->select(); |
1816 | if ( !mSelectedCell ) | 1817 | if ( !mSelectedCell ) |
1817 | emit incidenceSelected( 0 ); | 1818 | emit incidenceSelected( 0 ); |
1818 | else | 1819 | else |
1819 | emit incidenceSelected( mSelectedCell->selectedIncidence() ); | 1820 | emit incidenceSelected( mSelectedCell->selectedIncidence() ); |
1820 | } | 1821 | } |
1821 | 1822 | ||
1822 | void KOMonthView::processSelectionChange() | 1823 | void KOMonthView::processSelectionChange() |
1823 | { | 1824 | { |
1824 | QPtrList<Incidence> incidences = selectedIncidences(); | 1825 | QPtrList<Incidence> incidences = selectedIncidences(); |
1825 | if (incidences.count() > 0) { | 1826 | if (incidences.count() > 0) { |
1826 | emit incidenceSelected( incidences.first() ); | 1827 | emit incidenceSelected( incidences.first() ); |
1827 | } else { | 1828 | } else { |
1828 | emit incidenceSelected( 0 ); | 1829 | emit incidenceSelected( 0 ); |
1829 | clearSelection(); | 1830 | clearSelection(); |
1830 | } | 1831 | } |
1831 | } | 1832 | } |
1832 | 1833 | ||
1833 | void KOMonthView::clearSelection() | 1834 | void KOMonthView::clearSelection() |
1834 | { | 1835 | { |
1835 | if ( mSelectedCell ) { | 1836 | if ( mSelectedCell ) { |
1836 | mSelectedCell->deselect(); | 1837 | mSelectedCell->deselect(); |
1837 | mSelectedCell = 0; | 1838 | mSelectedCell = 0; |
1838 | } | 1839 | } |
1839 | } | 1840 | } |
1841 | |||
1842 | void KOMonthView::keyReleaseEvent ( QKeyEvent * e) | ||
1843 | { | ||
1844 | if ( !e->isAutoRepeat() ) { | ||
1845 | mFlagKeyPressed = false; | ||
1846 | } | ||
1847 | } | ||
1848 | |||
1840 | void KOMonthView::keyPressEvent ( QKeyEvent * e ) | 1849 | void KOMonthView::keyPressEvent ( QKeyEvent * e ) |
1841 | { | 1850 | { |
1842 | //qDebug("KOMonthView::keyPressEvent "); | 1851 | |
1852 | qApp->processEvents(); | ||
1853 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { | ||
1854 | //e->ignore(); | ||
1855 | e->accept(); | ||
1856 | return; | ||
1857 | } | ||
1858 | if (! e->isAutoRepeat() ) | ||
1859 | mFlagKeyPressed = true; | ||
1843 | switch(e->key()) { | 1860 | switch(e->key()) { |
1844 | case Key_Up: | 1861 | case Key_Up: |
1845 | { | 1862 | { |
1846 | if ( mShowWeekView ) { | 1863 | if ( mShowWeekView ) { |
1847 | emit selectWeekNum ( currentWeek() - 1 ); | 1864 | emit selectWeekNum ( currentWeek() - 1 ); |
1848 | } | 1865 | } |
1849 | else { | 1866 | else { |
1850 | emit prevMonth(); | 1867 | emit prevMonth(); |
1851 | } | 1868 | } |
1852 | } | 1869 | } |
1853 | e->accept(); | 1870 | e->accept(); |
1854 | break; | 1871 | break; |
1855 | case Key_Down: | 1872 | case Key_Down: |
1856 | { | 1873 | { |
1857 | if ( mShowWeekView ) { | 1874 | if ( mShowWeekView ) { |
1858 | emit selectWeekNum ( currentWeek() +1); | 1875 | emit selectWeekNum ( currentWeek() +1); |
1859 | } | 1876 | } |
1860 | else { | 1877 | else { |
1861 | emit nextMonth(); | 1878 | emit nextMonth(); |
1862 | } | 1879 | } |
1863 | 1880 | ||
1864 | } | 1881 | } |
1865 | e->accept(); | 1882 | e->accept(); |
1866 | break; | 1883 | break; |
1867 | case Key_Return: | 1884 | case Key_Return: |
1868 | case Key_Enter: | 1885 | case Key_Enter: |
1869 | { | 1886 | { |
1870 | selectInternalWeekNum ( currentWeek() ); | 1887 | selectInternalWeekNum ( currentWeek() ); |
1871 | } | 1888 | } |
1872 | e->accept(); | 1889 | e->accept(); |
1873 | break; | 1890 | break; |
1874 | case Key_D: | 1891 | case Key_D: |
1875 | if ( mSelectedCell ) { | 1892 | if ( mSelectedCell ) { |
1876 | mSelectedCell->showDay(); | 1893 | mSelectedCell->showDay(); |
1877 | e->accept(); | 1894 | e->accept(); |
1878 | } else { | 1895 | } else { |
1879 | e->ignore(); | 1896 | e->ignore(); |
1880 | } | 1897 | } |
1881 | break; | 1898 | break; |
1882 | default: | 1899 | default: |
1883 | e->ignore(); | 1900 | e->ignore(); |
1884 | break; | 1901 | break; |
1885 | } | 1902 | } |
1886 | } | 1903 | } |
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h index c1ca3d4..88050fe 100644 --- a/korganizer/komonthview.h +++ b/korganizer/komonthview.h | |||
@@ -1,320 +1,321 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #ifndef _KOMONTHVIEW_H | 20 | #ifndef _KOMONTHVIEW_H |
21 | #define _KOMONTHVIEW_H | 21 | #define _KOMONTHVIEW_H |
22 | 22 | ||
23 | #include <qlabel.h> | 23 | #include <qlabel.h> |
24 | #include <qframe.h> | 24 | #include <qframe.h> |
25 | #include <qdatetime.h> | 25 | #include <qdatetime.h> |
26 | #include <qlistbox.h> | 26 | #include <qlistbox.h> |
27 | #include <qpoint.h> | 27 | #include <qpoint.h> |
28 | #include <qwidgetstack.h> | 28 | #include <qwidgetstack.h> |
29 | #include <qlayout.h> | 29 | #include <qlayout.h> |
30 | #include <qtimer.h> | 30 | #include <qtimer.h> |
31 | #include <qintdict.h> | 31 | #include <qintdict.h> |
32 | #include <qpushbutton.h> | 32 | #include <qpushbutton.h> |
33 | #include <qvaluelist.h> | 33 | #include <qvaluelist.h> |
34 | #include <qptrvector.h> | 34 | #include <qptrvector.h> |
35 | 35 | ||
36 | #include <libkcal/calendar.h> | 36 | #include <libkcal/calendar.h> |
37 | #include <libkcal/event.h> | 37 | #include <libkcal/event.h> |
38 | 38 | ||
39 | #include "koeventview.h" | 39 | #include "koeventview.h" |
40 | #include "navigatorbar.h" | 40 | #include "navigatorbar.h" |
41 | 41 | ||
42 | #ifdef DESKTOP_VERSION | 42 | #ifdef DESKTOP_VERSION |
43 | class QToolTipGroup; | 43 | class QToolTipGroup; |
44 | #endif | 44 | #endif |
45 | 45 | ||
46 | class KNOWhatsThis; | 46 | class KNOWhatsThis; |
47 | class KOWeekButton : public QPushButton | 47 | class KOWeekButton : public QPushButton |
48 | { | 48 | { |
49 | Q_OBJECT | 49 | Q_OBJECT |
50 | public: | 50 | public: |
51 | KOWeekButton( QWidget *parent=0, const char *name=0 ) : | 51 | KOWeekButton( QWidget *parent=0, const char *name=0 ) : |
52 | QPushButton( parent, name) | 52 | QPushButton( parent, name) |
53 | { | 53 | { |
54 | connect( this, SIGNAL( clicked() ), | 54 | connect( this, SIGNAL( clicked() ), |
55 | SLOT( bottonClicked() )); | 55 | SLOT( bottonClicked() )); |
56 | mNumber = -1; | 56 | mNumber = -1; |
57 | } | 57 | } |
58 | void setWeekNum ( int num ) {mNumber = num; setText( QString::number ( num ));} | 58 | void setWeekNum ( int num ) {mNumber = num; setText( QString::number ( num ));} |
59 | int getWeekNum() { return mNumber;} | 59 | int getWeekNum() { return mNumber;} |
60 | signals: | 60 | signals: |
61 | void selectWeekNum ( int ); | 61 | void selectWeekNum ( int ); |
62 | private: | 62 | private: |
63 | int mNumber; | 63 | int mNumber; |
64 | void keyPressEvent ( QKeyEvent * e ) | 64 | void keyPressEvent ( QKeyEvent * e ) |
65 | { | 65 | { |
66 | e->ignore(); | 66 | e->ignore(); |
67 | } | 67 | } |
68 | 68 | ||
69 | private slots : | 69 | private slots : |
70 | void bottonClicked() { if ( mNumber > 0 ) emit selectWeekNum ( mNumber ); } | 70 | void bottonClicked() { if ( mNumber > 0 ) emit selectWeekNum ( mNumber ); } |
71 | }; | 71 | }; |
72 | 72 | ||
73 | class KNoScrollListBox: public QListBox | 73 | class KNoScrollListBox: public QListBox |
74 | { | 74 | { |
75 | Q_OBJECT | 75 | Q_OBJECT |
76 | public: | 76 | public: |
77 | KNoScrollListBox(QWidget *parent=0, const char *name=0); | 77 | KNoScrollListBox(QWidget *parent=0, const char *name=0); |
78 | ~KNoScrollListBox(); | 78 | ~KNoScrollListBox(); |
79 | QString getWhatsThisText(QPoint p) ; | 79 | QString getWhatsThisText(QPoint p) ; |
80 | 80 | ||
81 | signals: | 81 | signals: |
82 | void shiftDown(); | 82 | void shiftDown(); |
83 | void shiftUp(); | 83 | void shiftUp(); |
84 | void rightClick(); | 84 | void rightClick(); |
85 | 85 | ||
86 | protected slots: | 86 | protected slots: |
87 | void oneDown(); | 87 | void oneDown(); |
88 | void keyPressEvent(QKeyEvent *); | 88 | void keyPressEvent(QKeyEvent *); |
89 | void keyReleaseEvent(QKeyEvent *); | 89 | void keyReleaseEvent(QKeyEvent *); |
90 | void mousePressEvent(QMouseEvent *); | 90 | void mousePressEvent(QMouseEvent *); |
91 | 91 | ||
92 | private: | 92 | private: |
93 | KNOWhatsThis * mWT; | 93 | KNOWhatsThis * mWT; |
94 | }; | 94 | }; |
95 | 95 | ||
96 | 96 | ||
97 | class MonthViewItem: public QListBoxItem | 97 | class MonthViewItem: public QListBoxItem |
98 | { | 98 | { |
99 | public: | 99 | public: |
100 | MonthViewItem( Incidence *, QDate qd, const QString & title ); | 100 | MonthViewItem( Incidence *, QDate qd, const QString & title ); |
101 | void recycle( Incidence *incidence, QDate qd, const QString & s); | 101 | void recycle( Incidence *incidence, QDate qd, const QString & s); |
102 | void setRecur(bool on) { mRecur = on; } | 102 | void setRecur(bool on) { mRecur = on; } |
103 | void setAlarm(bool on) { mAlarm = on; } | 103 | void setAlarm(bool on) { mAlarm = on; } |
104 | void setReply(bool on) { mReply = on; } | 104 | void setReply(bool on) { mReply = on; } |
105 | void setMoreInfo(bool on) { mInfo = on; } | 105 | void setMoreInfo(bool on) { mInfo = on; } |
106 | void setMultiDay(int type) { mMultiday = type; } | 106 | void setMultiDay(int type) { mMultiday = type; } |
107 | void setBlockRepaint(bool on) { mblockRepaint = on; } | 107 | void setBlockRepaint(bool on) { mblockRepaint = on; } |
108 | 108 | ||
109 | 109 | ||
110 | void setPalette(const QPalette &p) { mPalette = p; } | 110 | void setPalette(const QPalette &p) { mPalette = p; } |
111 | QPalette palette() const { return mPalette; } | 111 | QPalette palette() const { return mPalette; } |
112 | 112 | ||
113 | Incidence *incidence() const { return mIncidence; } | 113 | Incidence *incidence() const { return mIncidence; } |
114 | QDate incidenceDate() { return mDate; } | 114 | QDate incidenceDate() { return mDate; } |
115 | 115 | ||
116 | protected: | 116 | protected: |
117 | virtual void paint(QPainter *); | 117 | virtual void paint(QPainter *); |
118 | virtual int height(const QListBox *) const; | 118 | virtual int height(const QListBox *) const; |
119 | virtual int width(const QListBox *) const; | 119 | virtual int width(const QListBox *) const; |
120 | 120 | ||
121 | private: | 121 | private: |
122 | bool mblockRepaint; | 122 | bool mblockRepaint; |
123 | int mMultiday; | 123 | int mMultiday; |
124 | bool mRecur; | 124 | bool mRecur; |
125 | bool mAlarm; | 125 | bool mAlarm; |
126 | bool mReply; | 126 | bool mReply; |
127 | bool mInfo; | 127 | bool mInfo; |
128 | 128 | ||
129 | QPalette mPalette; | 129 | QPalette mPalette; |
130 | QDate mDate; | 130 | QDate mDate; |
131 | 131 | ||
132 | Incidence *mIncidence; | 132 | Incidence *mIncidence; |
133 | }; | 133 | }; |
134 | 134 | ||
135 | 135 | ||
136 | class KOMonthView; | 136 | class KOMonthView; |
137 | 137 | ||
138 | class MonthViewCell : public KNoScrollListBox | 138 | class MonthViewCell : public KNoScrollListBox |
139 | { | 139 | { |
140 | Q_OBJECT | 140 | Q_OBJECT |
141 | public: | 141 | public: |
142 | MonthViewCell(KOMonthView *,QWidget* ); | 142 | MonthViewCell(KOMonthView *,QWidget* ); |
143 | ~MonthViewCell() {mAvailItemList.setAutoDelete( true );} | 143 | ~MonthViewCell() {mAvailItemList.setAutoDelete( true );} |
144 | 144 | ||
145 | void setDate( const QDate & ); | 145 | void setDate( const QDate & ); |
146 | QDate date() const; | 146 | QDate date() const; |
147 | 147 | ||
148 | void setPrimary( bool ); | 148 | void setPrimary( bool ); |
149 | bool isPrimary() const; | 149 | bool isPrimary() const; |
150 | 150 | ||
151 | void setHoliday( bool ); | 151 | void setHoliday( bool ); |
152 | void setHoliday( const QString & ); | 152 | void setHoliday( const QString & ); |
153 | 153 | ||
154 | void updateCell(); | 154 | void updateCell(); |
155 | void startUpdateCell(); | 155 | void startUpdateCell(); |
156 | void finishUpdateCell(); | 156 | void finishUpdateCell(); |
157 | void repaintfinishUpdateCell(); | 157 | void repaintfinishUpdateCell(); |
158 | void insertEvent(Event *); | 158 | void insertEvent(Event *); |
159 | void insertTodo(Todo *); | 159 | void insertTodo(Todo *); |
160 | 160 | ||
161 | void updateConfig( bool bigFont = false ); | 161 | void updateConfig( bool bigFont = false ); |
162 | 162 | ||
163 | void enableScrollBars( bool ); | 163 | void enableScrollBars( bool ); |
164 | 164 | ||
165 | Incidence *selectedIncidence(); | 165 | Incidence *selectedIncidence(); |
166 | QDate selectedIncidenceDate(); | 166 | QDate selectedIncidenceDate(); |
167 | QPushButton * dateLabel() { return mLabel; } | 167 | QPushButton * dateLabel() { return mLabel; } |
168 | 168 | ||
169 | void deselect(); | 169 | void deselect(); |
170 | void select(); | 170 | void select(); |
171 | #ifdef DESKTOP_VERSION | 171 | #ifdef DESKTOP_VERSION |
172 | static QToolTipGroup *toolTipGroup(); | 172 | static QToolTipGroup *toolTipGroup(); |
173 | #endif | 173 | #endif |
174 | signals: | 174 | signals: |
175 | void defaultAction( Incidence * ); | 175 | void defaultAction( Incidence * ); |
176 | void newEventSignal( QDateTime ); | 176 | void newEventSignal( QDateTime ); |
177 | void showDaySignal( QDate ); | 177 | void showDaySignal( QDate ); |
178 | 178 | ||
179 | protected: | 179 | protected: |
180 | QStringList mToolTip; | 180 | QStringList mToolTip; |
181 | void resizeEvent( QResizeEvent * ); | 181 | void resizeEvent( QResizeEvent * ); |
182 | 182 | ||
183 | 183 | ||
184 | public slots: | 184 | public slots: |
185 | void showDay(); | 185 | void showDay(); |
186 | 186 | ||
187 | protected slots: | 187 | protected slots: |
188 | void defaultAction( QListBoxItem * ); | 188 | void defaultAction( QListBoxItem * ); |
189 | void contextMenu( QListBoxItem * ); | 189 | void contextMenu( QListBoxItem * ); |
190 | void selection( QListBoxItem * ); | 190 | void selection( QListBoxItem * ); |
191 | void cellClicked( QListBoxItem * ); | 191 | void cellClicked( QListBoxItem * ); |
192 | void newEvent(); | 192 | void newEvent(); |
193 | 193 | ||
194 | private: | 194 | private: |
195 | MonthViewItem* mCurrentAvailItem; | 195 | MonthViewItem* mCurrentAvailItem; |
196 | QPtrList <MonthViewItem> mAvailItemList; | 196 | QPtrList <MonthViewItem> mAvailItemList; |
197 | KOMonthView *mMonthView; | 197 | KOMonthView *mMonthView; |
198 | int currentPalette; | 198 | int currentPalette; |
199 | 199 | ||
200 | QDate mDate; | 200 | QDate mDate; |
201 | bool mPrimary; | 201 | bool mPrimary; |
202 | bool mHoliday; | 202 | bool mHoliday; |
203 | QString mHolidayString; | 203 | QString mHolidayString; |
204 | 204 | ||
205 | //QLabel *mLabel; | 205 | //QLabel *mLabel; |
206 | QPushButton *mLabel; | 206 | QPushButton *mLabel; |
207 | //QListBox *mItemList; | 207 | //QListBox *mItemList; |
208 | #ifdef DESKTOP_VERSION | 208 | #ifdef DESKTOP_VERSION |
209 | static QToolTipGroup *mToolTipGroup; | 209 | static QToolTipGroup *mToolTipGroup; |
210 | #endif | 210 | #endif |
211 | QSize mLabelSize; | 211 | QSize mLabelSize; |
212 | QSize mLabelBigSize; | 212 | QSize mLabelBigSize; |
213 | QPalette mHolidayPalette; | 213 | QPalette mHolidayPalette; |
214 | QPalette mStandardPalette; | 214 | QPalette mStandardPalette; |
215 | QPalette mPrimaryPalette; | 215 | QPalette mPrimaryPalette; |
216 | QPalette mNonPrimaryPalette; | 216 | QPalette mNonPrimaryPalette; |
217 | void setMyPalette(); | 217 | void setMyPalette(); |
218 | QPalette getPalette (); | 218 | QPalette getPalette (); |
219 | 219 | ||
220 | }; | 220 | }; |
221 | 221 | ||
222 | 222 | ||
223 | class KOMonthView: public KOEventView | 223 | class KOMonthView: public KOEventView |
224 | { | 224 | { |
225 | Q_OBJECT | 225 | Q_OBJECT |
226 | public: | 226 | public: |
227 | KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 ); | 227 | KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 ); |
228 | ~KOMonthView(); | 228 | ~KOMonthView(); |
229 | 229 | ||
230 | /** Returns maximum number of days supported by the komonthview */ | 230 | /** Returns maximum number of days supported by the komonthview */ |
231 | virtual int maxDatesHint(); | 231 | virtual int maxDatesHint(); |
232 | 232 | ||
233 | /** Returns number of currently shown dates. */ | 233 | /** Returns number of currently shown dates. */ |
234 | virtual int currentDateCount(); | 234 | virtual int currentDateCount(); |
235 | 235 | ||
236 | /** returns the currently selected events */ | 236 | /** returns the currently selected events */ |
237 | virtual QPtrList<Incidence> selectedIncidences(); | 237 | virtual QPtrList<Incidence> selectedIncidences(); |
238 | 238 | ||
239 | /** returns dates of the currently selected events */ | 239 | /** returns dates of the currently selected events */ |
240 | virtual DateList selectedDates(); | 240 | virtual DateList selectedDates(); |
241 | 241 | ||
242 | virtual void printPreview(CalPrinter *calPrinter, | 242 | virtual void printPreview(CalPrinter *calPrinter, |
243 | const QDate &, const QDate &); | 243 | const QDate &, const QDate &); |
244 | bool isMonthView() { return !mShowWeekView; } | 244 | bool isMonthView() { return !mShowWeekView; } |
245 | bool isUpdatePossible() { return updatePossible; } | 245 | bool isUpdatePossible() { return updatePossible; } |
246 | 246 | ||
247 | MonthViewCell * selectedCell(); | 247 | MonthViewCell * selectedCell(); |
248 | bool skipResize; | 248 | bool skipResize; |
249 | NavigatorBar* navigatorBar() { return mNavigatorBar ;} | 249 | NavigatorBar* navigatorBar() { return mNavigatorBar ;} |
250 | public slots: | 250 | public slots: |
251 | virtual void updateView(); | 251 | virtual void updateView(); |
252 | virtual void updateConfig(); | 252 | virtual void updateConfig(); |
253 | virtual void showDates(const QDate &start, const QDate &end); | 253 | virtual void showDates(const QDate &start, const QDate &end); |
254 | virtual void showEvents(QPtrList<Event> eventList); | 254 | virtual void showEvents(QPtrList<Event> eventList); |
255 | 255 | ||
256 | void changeEventDisplay(Event *, int); | 256 | void changeEventDisplay(Event *, int); |
257 | 257 | ||
258 | void clearSelection(); | 258 | void clearSelection(); |
259 | 259 | ||
260 | void showContextMenu( Incidence * ); | 260 | void showContextMenu( Incidence * ); |
261 | 261 | ||
262 | void setSelectedCell( MonthViewCell * ); | 262 | void setSelectedCell( MonthViewCell * ); |
263 | void switchView(); | 263 | void switchView(); |
264 | void setKeyBoardFocus(); | 264 | void setKeyBoardFocus(); |
265 | void setKeyBFocus(); | 265 | void setKeyBFocus(); |
266 | 266 | ||
267 | protected slots: | 267 | protected slots: |
268 | void slotComputeLayout(); | 268 | void slotComputeLayout(); |
269 | void selectInternalWeekNum ( int ); | 269 | void selectInternalWeekNum ( int ); |
270 | void processSelectionChange(); | 270 | void processSelectionChange(); |
271 | signals: | 271 | signals: |
272 | void nextMonth(); | 272 | void nextMonth(); |
273 | void prevMonth(); | 273 | void prevMonth(); |
274 | void selectWeekNum ( int ); | 274 | void selectWeekNum ( int ); |
275 | void selectMonth (); | 275 | void selectMonth (); |
276 | void showDaySignal( QDate ); | 276 | void showDaySignal( QDate ); |
277 | protected: | 277 | protected: |
278 | void resizeEvent(QResizeEvent *); | 278 | void resizeEvent(QResizeEvent *); |
279 | void viewChanged(); | 279 | void viewChanged(); |
280 | void updateDayLabels(); | 280 | void updateDayLabels(); |
281 | 281 | ||
282 | private: | 282 | private: |
283 | QTimer* mComputeLayoutTimer; | 283 | QTimer* mComputeLayoutTimer; |
284 | NavigatorBar* mNavigatorBar; | 284 | NavigatorBar* mNavigatorBar; |
285 | int currentWeek(); | 285 | int currentWeek(); |
286 | bool clPending; | 286 | bool clPending; |
287 | QWidgetStack * mWidStack; | 287 | QWidgetStack * mWidStack; |
288 | QWidget* mMonthView; | 288 | QWidget* mMonthView; |
289 | QWidget* mWeekView; | 289 | QWidget* mWeekView; |
290 | bool mShowWeekView; | 290 | bool mShowWeekView; |
291 | bool updatePossible; | 291 | bool updatePossible; |
292 | int mDaysPerWeek; | 292 | int mDaysPerWeek; |
293 | int mNumWeeks; | 293 | int mNumWeeks; |
294 | int mNumCells; | 294 | int mNumCells; |
295 | //bool mWeekStartsMonday; | 295 | //bool mWeekStartsMonday; |
296 | bool mShowSatSunComp; | 296 | bool mShowSatSunComp; |
297 | void computeLayout(); | 297 | void computeLayout(); |
298 | void computeLayoutWeek(); | 298 | void computeLayoutWeek(); |
299 | 299 | ||
300 | QPtrVector<MonthViewCell> mCells; | 300 | QPtrVector<MonthViewCell> mCells; |
301 | QPtrVector<QLabel> mDayLabels; | 301 | QPtrVector<QLabel> mDayLabels; |
302 | QPtrVector<KOWeekButton> mWeekLabels; | 302 | QPtrVector<KOWeekButton> mWeekLabels; |
303 | QPtrVector<MonthViewCell> mCellsW; | 303 | QPtrVector<MonthViewCell> mCellsW; |
304 | QPtrVector<QLabel> mDayLabelsW; | 304 | QPtrVector<QLabel> mDayLabelsW; |
305 | QPtrVector<KOWeekButton> mWeekLabelsW; | 305 | QPtrVector<KOWeekButton> mWeekLabelsW; |
306 | 306 | ||
307 | bool mShortDayLabelsM; | 307 | bool mShortDayLabelsM; |
308 | bool mShortDayLabelsW; | 308 | bool mShortDayLabelsW; |
309 | int mWidthLongDayLabel; | 309 | int mWidthLongDayLabel; |
310 | 310 | ||
311 | QDate mStartDate; | 311 | QDate mStartDate; |
312 | 312 | ||
313 | MonthViewCell *mSelectedCell; | 313 | MonthViewCell *mSelectedCell; |
314 | 314 | bool mFlagKeyPressed; | |
315 | KOEventPopupMenu *mContextMenu; | 315 | KOEventPopupMenu *mContextMenu; |
316 | void keyPressEvent ( QKeyEvent * ) ; | 316 | void keyPressEvent ( QKeyEvent * ) ; |
317 | void keyReleaseEvent ( QKeyEvent * ) ; | ||
317 | 318 | ||
318 | }; | 319 | }; |
319 | 320 | ||
320 | #endif | 321 | #endif |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index ae03a09..09a0880 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -1,2412 +1,2436 @@ | |||
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 "ktoolbar.h" | 60 | #include "ktoolbar.h" |
61 | #include "klocale.h" | 61 | #include "klocale.h" |
62 | #include "kconfig.h" | 62 | #include "kconfig.h" |
63 | #include "simplealarmclient.h" | 63 | #include "simplealarmclient.h" |
64 | #include "externalapphandler.h" | 64 | #include "externalapphandler.h" |
65 | 65 | ||
66 | using namespace KCal; | 66 | using namespace KCal; |
67 | #ifndef _WIN32_ | 67 | #ifndef _WIN32_ |
68 | #include <unistd.h> | 68 | #include <unistd.h> |
69 | #else | 69 | #else |
70 | #ifdef _OL_IMPORT_ | 70 | #ifdef _OL_IMPORT_ |
71 | #include "koimportoldialog.h" | 71 | #include "koimportoldialog.h" |
72 | #endif | 72 | #endif |
73 | #endif | 73 | #endif |
74 | #include "mainwindow.h" | 74 | #include "mainwindow.h" |
75 | 75 | ||
76 | 76 | ||
77 | class KOex2phonePrefs : public QDialog | 77 | class KOex2phonePrefs : public QDialog |
78 | { | 78 | { |
79 | public: | 79 | public: |
80 | KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : | 80 | KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : |
81 | QDialog( parent, name, true ) | 81 | QDialog( parent, name, true ) |
82 | { | 82 | { |
83 | setCaption( i18n("Export to phone options") ); | 83 | setCaption( i18n("Export to phone options") ); |
84 | QVBoxLayout* lay = new QVBoxLayout( this ); | 84 | QVBoxLayout* lay = new QVBoxLayout( this ); |
85 | lay->setSpacing( 3 ); | 85 | lay->setSpacing( 3 ); |
86 | lay->setMargin( 3 ); | 86 | lay->setMargin( 3 ); |
87 | QLabel *lab; | 87 | QLabel *lab; |
88 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); | 88 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); |
89 | lab->setAlignment (AlignHCenter ); | 89 | lab->setAlignment (AlignHCenter ); |
90 | QHBox* temphb; | 90 | QHBox* temphb; |
91 | temphb = new QHBox( this ); | 91 | temphb = new QHBox( this ); |
92 | new QLabel( i18n("I/O device: "), temphb ); | 92 | new QLabel( i18n("I/O device: "), temphb ); |
93 | mPhoneDevice = new QLineEdit( temphb); | 93 | mPhoneDevice = new QLineEdit( temphb); |
94 | lay->addWidget( temphb ); | 94 | lay->addWidget( temphb ); |
95 | temphb = new QHBox( this ); | 95 | temphb = new QHBox( this ); |
96 | new QLabel( i18n("Connection: "), temphb ); | 96 | new QLabel( i18n("Connection: "), temphb ); |
97 | mPhoneConnection = new QLineEdit( temphb); | 97 | mPhoneConnection = new QLineEdit( temphb); |
98 | lay->addWidget( temphb ); | 98 | lay->addWidget( temphb ); |
99 | temphb = new QHBox( this ); | 99 | temphb = new QHBox( this ); |
100 | new QLabel( i18n("Model(opt.): "), temphb ); | 100 | new QLabel( i18n("Model(opt.): "), temphb ); |
101 | mPhoneModel = new QLineEdit( temphb); | 101 | mPhoneModel = new QLineEdit( temphb); |
102 | lay->addWidget( temphb ); | 102 | lay->addWidget( temphb ); |
103 | mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); | 103 | mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); |
104 | mWriteBackFuture->setChecked( true ); | 104 | mWriteBackFuture->setChecked( true ); |
105 | lay->addWidget( mWriteBackFuture ); | 105 | lay->addWidget( mWriteBackFuture ); |
106 | temphb = new QHBox( this ); | 106 | temphb = new QHBox( this ); |
107 | new QLabel( i18n("Max. weeks in future: ") , temphb ); | 107 | new QLabel( i18n("Max. weeks in future: ") , temphb ); |
108 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); | 108 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); |
109 | mWriteBackFutureWeeks->setValue( 8 ); | 109 | mWriteBackFutureWeeks->setValue( 8 ); |
110 | lay->addWidget( temphb ); | 110 | lay->addWidget( temphb ); |
111 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); | 111 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); |
112 | lab->setAlignment (AlignHCenter ); | 112 | lab->setAlignment (AlignHCenter ); |
113 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); | 113 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); |
114 | lay->addWidget( ok ); | 114 | lay->addWidget( ok ); |
115 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 115 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
116 | lay->addWidget( cancel ); | 116 | lay->addWidget( cancel ); |
117 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 117 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
118 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 118 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
119 | resize( 220, 240 ); | 119 | resize( 220, 240 ); |
120 | qApp->processEvents(); | 120 | qApp->processEvents(); |
121 | int dw = QApplication::desktop()->width(); | 121 | int dw = QApplication::desktop()->width(); |
122 | int dh = QApplication::desktop()->height(); | 122 | int dh = QApplication::desktop()->height(); |
123 | move( (dw-width())/2, (dh - height() )/2 ); | 123 | move( (dw-width())/2, (dh - height() )/2 ); |
124 | } | 124 | } |
125 | 125 | ||
126 | public: | 126 | public: |
127 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; | 127 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; |
128 | QCheckBox* mWriteBackFuture; | 128 | QCheckBox* mWriteBackFuture; |
129 | QSpinBox* mWriteBackFutureWeeks; | 129 | QSpinBox* mWriteBackFutureWeeks; |
130 | }; | 130 | }; |
131 | 131 | ||
132 | int globalFlagBlockStartup; | 132 | int globalFlagBlockStartup; |
133 | MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : | 133 | MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : |
134 | QMainWindow( parent, name ) | 134 | QMainWindow( parent, name ) |
135 | { | 135 | { |
136 | 136 | ||
137 | mClosed = false; | 137 | mClosed = false; |
138 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; | 138 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; |
139 | QString confFile = locateLocal("config","korganizerrc"); | 139 | QString confFile = locateLocal("config","korganizerrc"); |
140 | QFileInfo finf ( confFile ); | 140 | QFileInfo finf ( confFile ); |
141 | bool showWarning = !finf.exists(); | 141 | bool showWarning = !finf.exists(); |
142 | setIcon(SmallIcon( "ko24" ) ); | 142 | setIcon(SmallIcon( "ko24" ) ); |
143 | mBlockAtStartup = true; | 143 | mBlockAtStartup = true; |
144 | mFlagKeyPressed = false; | 144 | mFlagKeyPressed = false; |
145 | setCaption("KO/Pi"); | 145 | setCaption("KO/Pi"); |
146 | KOPrefs *p = KOPrefs::instance(); | 146 | KOPrefs *p = KOPrefs::instance(); |
147 | KPimGlobalPrefs::instance()->setGlobalConfig(); | 147 | KPimGlobalPrefs::instance()->setGlobalConfig(); |
148 | if ( p->mHourSize > 22 ) | 148 | if ( p->mHourSize > 22 ) |
149 | p->mHourSize = 22; | 149 | p->mHourSize = 22; |
150 | QMainWindow::ToolBarDock tbd; | 150 | QMainWindow::ToolBarDock tbd; |
151 | if ( p->mToolBarHor ) { | 151 | if ( p->mToolBarHor ) { |
152 | if ( p->mToolBarUp ) | 152 | if ( p->mToolBarUp ) |
153 | tbd = Bottom; | 153 | tbd = Bottom; |
154 | else | 154 | else |
155 | tbd = Top; | 155 | tbd = Top; |
156 | } | 156 | } |
157 | else { | 157 | else { |
158 | if ( p->mToolBarUp ) | 158 | if ( p->mToolBarUp ) |
159 | tbd = Right; | 159 | tbd = Right; |
160 | else | 160 | else |
161 | tbd = Left; | 161 | tbd = Left; |
162 | } | 162 | } |
163 | if ( KOPrefs::instance()->mUseAppColors ) | 163 | if ( KOPrefs::instance()->mUseAppColors ) |
164 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 164 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
165 | globalFlagBlockStartup = 1; | 165 | globalFlagBlockStartup = 1; |
166 | iconToolBar = new QPEToolBar( this ); | 166 | iconToolBar = new QPEToolBar( this ); |
167 | addToolBar (iconToolBar , tbd ); | 167 | addToolBar (iconToolBar , tbd ); |
168 | 168 | ||
169 | if ( KOPrefs::instance()->mShowIconFilter ) { | 169 | #ifdef DESKTOP_VERSION |
170 | if ( KOPrefs::instance()->mShowIconFilter ) | ||
171 | #else | ||
172 | if ( KOPrefs::instance()->mShowIconFilter || !p->mShowIconOnetoolbar ) | ||
173 | #endif | ||
174 | |||
175 | { | ||
170 | if ( p->mToolBarHorF ) { | 176 | if ( p->mToolBarHorF ) { |
171 | if ( p->mToolBarUpF ) | 177 | if ( p->mToolBarUpF ) |
172 | tbd = Bottom; | 178 | tbd = Bottom; |
173 | else | 179 | else |
174 | tbd = Top; | 180 | tbd = Top; |
175 | } | 181 | } |
176 | else { | 182 | else { |
177 | if ( p->mToolBarUpF ) | 183 | if ( p->mToolBarUpF ) |
178 | tbd = Right; | 184 | tbd = Right; |
179 | else | 185 | else |
180 | tbd = Left; | 186 | tbd = Left; |
181 | } | 187 | } |
182 | filterToolBar = new QPEToolBar ( this ); | 188 | filterToolBar = new QPEToolBar ( this ); |
183 | filterMenubar = new QPEMenuBar( filterToolBar ); | 189 | filterMenubar = new QPEMenuBar( filterToolBar ); |
184 | QFontMetrics fm ( filterMenubar->font() ); | 190 | QFontMetrics fm ( filterMenubar->font() ); |
185 | 191 | ||
186 | filterPopupMenu = new QPopupMenu( this ); | 192 | filterPopupMenu = new QPopupMenu( this ); |
187 | filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 ); | 193 | filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 ); |
188 | QString addTest = "Ax"; | 194 | QString addTest = "Ax"; |
189 | #ifdef DESKTOP_VERSION | 195 | #ifdef DESKTOP_VERSION |
190 | addTest = "AAAx"; | 196 | addTest = "AAAx"; |
191 | #endif | 197 | #endif |
192 | filterMenubar->setFixedWidth( fm.width( i18n("No Filter")+addTest ) ); | 198 | filterMenubar->setFixedWidth( fm.width( i18n("No Filter")+addTest ) ); |
193 | addToolBar (filterToolBar , tbd ); | 199 | addToolBar (filterToolBar , tbd ); |
194 | connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) ); | 200 | connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) ); |
195 | connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) ); | 201 | connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) ); |
202 | if ( !KOPrefs::instance()->mShowIconFilter && !p->mShowIconOnetoolbar ) | ||
203 | filterToolBar->hide(); | ||
196 | } else { | 204 | } else { |
197 | filterToolBar = 0; | 205 | filterToolBar = 0; |
198 | filterMenubar = 0; | 206 | filterMenubar = 0; |
199 | filterPopupMenu = 0; | 207 | filterPopupMenu = 0; |
200 | } | 208 | } |
201 | if ( p->mShowIconOnetoolbar ) { | 209 | if ( p->mShowIconOnetoolbar ) { |
202 | viewToolBar = iconToolBar ; | 210 | viewToolBar = iconToolBar ; |
203 | navigatorToolBar = iconToolBar ; | 211 | navigatorToolBar = iconToolBar ; |
204 | } else { | 212 | } else { |
213 | #ifndef DESKTOP_VERSION | ||
214 | setToolBarsMovable( false ); | ||
215 | #endif | ||
205 | if ( p->mToolBarHorV ) { | 216 | if ( p->mToolBarHorV ) { |
206 | if ( p->mToolBarUpV ) | 217 | if ( p->mToolBarUpV ) |
207 | tbd = Bottom; | 218 | tbd = Bottom; |
208 | else | 219 | else |
209 | tbd = Top; | 220 | tbd = Top; |
210 | } | 221 | } |
211 | else { | 222 | else { |
212 | if ( p->mToolBarUpV ) | 223 | if ( p->mToolBarUpV ) |
213 | tbd = Right; | 224 | tbd = Right; |
214 | else | 225 | else |
215 | tbd = Left; | 226 | tbd = Left; |
216 | } | 227 | } |
217 | viewToolBar = new QPEToolBar( this ); | 228 | viewToolBar = new QPEToolBar( this ); |
218 | addToolBar (viewToolBar , tbd ); | 229 | addToolBar (viewToolBar , tbd ); |
219 | if ( p->mToolBarHorN ) { | 230 | if ( p->mToolBarHorN ) { |
220 | if ( p->mToolBarUpN ) | 231 | if ( p->mToolBarUpN ) |
221 | tbd = Bottom; | 232 | tbd = Bottom; |
222 | else | 233 | else |
223 | tbd = Top; | 234 | tbd = Top; |
224 | } | 235 | } |
225 | else { | 236 | else { |
226 | if ( p->mToolBarUpN ) | 237 | if ( p->mToolBarUpN ) |
227 | tbd = Right; | 238 | tbd = Right; |
228 | else | 239 | else |
229 | tbd = Left; | 240 | tbd = Left; |
230 | } | 241 | } |
231 | navigatorToolBar = new QPEToolBar( this ); | 242 | navigatorToolBar = new QPEToolBar( this ); |
232 | addToolBar (navigatorToolBar , tbd ); | 243 | addToolBar (navigatorToolBar , tbd ); |
233 | } | 244 | } |
234 | 245 | ||
235 | 246 | ||
236 | 247 | ||
237 | mCalendarModifiedFlag = false; | 248 | mCalendarModifiedFlag = false; |
238 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); | 249 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); |
239 | splash->setAlignment ( AlignCenter ); | 250 | splash->setAlignment ( AlignCenter ); |
240 | setCentralWidget( splash ); | 251 | setCentralWidget( splash ); |
241 | #ifndef DESKTOP_VERSION | 252 | #ifndef DESKTOP_VERSION |
242 | showMaximized(); | 253 | showMaximized(); |
243 | #endif | 254 | #endif |
244 | 255 | ||
245 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); | 256 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); |
246 | setDefaultPreferences(); | 257 | setDefaultPreferences(); |
247 | mCalendar = new CalendarLocal(); | 258 | mCalendar = new CalendarLocal(); |
248 | mView = new CalendarView( mCalendar, this,"mCalendar " ); | 259 | mView = new CalendarView( mCalendar, this,"mCalendar " ); |
249 | mView->hide(); | 260 | mView->hide(); |
250 | //mView->resize(splash->size() ); | 261 | //mView->resize(splash->size() ); |
251 | initActions(); | 262 | initActions(); |
252 | mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); | 263 | mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); |
253 | mSyncManager->setBlockSave(false); | 264 | mSyncManager->setBlockSave(false); |
254 | mView->setSyncManager(mSyncManager); | 265 | mView->setSyncManager(mSyncManager); |
255 | #ifndef DESKTOP_VERSION | 266 | #ifndef DESKTOP_VERSION |
256 | iconToolBar->show(); | 267 | iconToolBar->show(); |
257 | qApp->processEvents(); | 268 | qApp->processEvents(); |
258 | #endif | 269 | #endif |
259 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); | 270 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); |
260 | int vh = height() ; | 271 | int vh = height() ; |
261 | int vw = width(); | 272 | int vw = width(); |
262 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); | 273 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); |
263 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { | 274 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { |
264 | vh -= iconToolBar->height(); | 275 | vh -= iconToolBar->height(); |
265 | } else { | 276 | } else { |
266 | vw -= iconToolBar->height(); | 277 | vw -= iconToolBar->height(); |
267 | } | 278 | } |
268 | //mView->setMaximumSize( splash->size() ); | 279 | //mView->setMaximumSize( splash->size() ); |
269 | //mView->resize( splash->size() ); | 280 | //mView->resize( splash->size() ); |
270 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 281 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
271 | mView->readSettings(); | 282 | mView->readSettings(); |
272 | bool newFile = false; | 283 | bool newFile = false; |
273 | if( !QFile::exists( defaultFileName() ) ) { | 284 | if( !QFile::exists( defaultFileName() ) ) { |
274 | QFileInfo finfo ( defaultFileName() ); | 285 | QFileInfo finfo ( defaultFileName() ); |
275 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); | 286 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); |
276 | qDebug("oldfile %s ", oldFile.latin1()); | 287 | qDebug("oldfile %s ", oldFile.latin1()); |
277 | 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"; | 288 | 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"; |
278 | finfo.setFile( oldFile ); | 289 | finfo.setFile( oldFile ); |
279 | if (finfo.exists() ) { | 290 | if (finfo.exists() ) { |
280 | KMessageBox::information( this, message); | 291 | KMessageBox::information( this, message); |
281 | mView->openCalendar( oldFile ); | 292 | mView->openCalendar( oldFile ); |
282 | qApp->processEvents(); | 293 | qApp->processEvents(); |
283 | } else { | 294 | } else { |
284 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); | 295 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); |
285 | finfo.setFile( oldFile ); | 296 | finfo.setFile( oldFile ); |
286 | if (finfo.exists() ) { | 297 | if (finfo.exists() ) { |
287 | KMessageBox::information( this, message); | 298 | KMessageBox::information( this, message); |
288 | mView->openCalendar( oldFile ); | 299 | mView->openCalendar( oldFile ); |
289 | qApp->processEvents(); | 300 | qApp->processEvents(); |
290 | } | 301 | } |
291 | } | 302 | } |
292 | mView->saveCalendar( defaultFileName() ); | 303 | mView->saveCalendar( defaultFileName() ); |
293 | newFile = true; | 304 | newFile = true; |
294 | } | 305 | } |
295 | 306 | ||
296 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 307 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
297 | mView->openCalendar( defaultFileName() ); | 308 | mView->openCalendar( defaultFileName() ); |
298 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 309 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
299 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); | 310 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); |
300 | 311 | ||
301 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { | 312 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { |
302 | KOPrefs::instance()->setAllDefaults(); | 313 | KOPrefs::instance()->setAllDefaults(); |
303 | int count = mView->addCategories(); | 314 | int count = mView->addCategories(); |
304 | } | 315 | } |
305 | processIncidenceSelection( 0 ); | 316 | processIncidenceSelection( 0 ); |
306 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), | 317 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), |
307 | SLOT( processIncidenceSelection( Incidence * ) ) ); | 318 | SLOT( processIncidenceSelection( Incidence * ) ) ); |
308 | connect( mView, SIGNAL( modifiedChanged( bool ) ), | 319 | connect( mView, SIGNAL( modifiedChanged( bool ) ), |
309 | SLOT( slotModifiedChanged( bool ) ) ); | 320 | SLOT( slotModifiedChanged( bool ) ) ); |
310 | 321 | ||
311 | 322 | ||
312 | connect( mView, SIGNAL( tempDisableBR(bool) ), | 323 | connect( mView, SIGNAL( tempDisableBR(bool) ), |
313 | SLOT( disableBR(bool) ) ); | 324 | SLOT( disableBR(bool) ) ); |
314 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); | 325 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); |
315 | mView->setModified( false ); | 326 | mView->setModified( false ); |
316 | mBlockAtStartup = false; | 327 | mBlockAtStartup = false; |
317 | mView->setModified( false ); | 328 | mView->setModified( false ); |
318 | setCentralWidget( mView ); | 329 | setCentralWidget( mView ); |
319 | globalFlagBlockStartup = 0; | 330 | globalFlagBlockStartup = 0; |
320 | mView->show(); | 331 | mView->show(); |
321 | delete splash; | 332 | delete splash; |
322 | if ( newFile ) | 333 | if ( newFile ) |
323 | mView->updateConfig(); | 334 | mView->updateConfig(); |
324 | // qApp->processEvents(); | 335 | // qApp->processEvents(); |
325 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 336 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
326 | //fillSyncMenu(); | 337 | //fillSyncMenu(); |
327 | 338 | ||
328 | 339 | ||
329 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); | 340 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); |
330 | connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); | 341 | connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); |
331 | connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); | 342 | connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); |
332 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); | 343 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); |
333 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); | 344 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); |
334 | mSyncManager->setDefaultFileName( sentSyncFile()); | 345 | mSyncManager->setDefaultFileName( sentSyncFile()); |
335 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); | 346 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); |
336 | mSyncManager->fillSyncMenu(); | 347 | mSyncManager->fillSyncMenu(); |
337 | 348 | ||
338 | 349 | ||
339 | 350 | ||
340 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); | 351 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); |
341 | if ( showWarning ) { | 352 | if ( showWarning ) { |
342 | KMessageBox::information( this, | 353 | KMessageBox::information( this, |
343 | "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"); | 354 | "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"); |
344 | qApp->processEvents(); | 355 | qApp->processEvents(); |
345 | mView->dialogManager()->showSyncOptions(); | 356 | mView->dialogManager()->showSyncOptions(); |
346 | } | 357 | } |
347 | 358 | ||
348 | //US listen for result adressed from Ka/Pi | 359 | //US listen for result adressed from Ka/Pi |
349 | #ifndef DESKTOP_VERSION | 360 | #ifndef DESKTOP_VERSION |
350 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); | 361 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); |
351 | #endif | 362 | #endif |
352 | #ifndef DESKTOP_VERSION | 363 | #ifndef DESKTOP_VERSION |
353 | infrared = 0; | 364 | infrared = 0; |
354 | #endif | 365 | #endif |
355 | updateFilterToolbar(); | 366 | updateFilterToolbar(); |
356 | updateWeek( mView->startDate() ); | 367 | updateWeek( mView->startDate() ); |
357 | connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), | 368 | connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), |
358 | SLOT( updateWeekNum( const KCal::DateList & ) ) ); | 369 | SLOT( updateWeekNum( const KCal::DateList & ) ) ); |
359 | mBRdisabled = false; | 370 | mBRdisabled = false; |
360 | //toggleBeamReceive(); | 371 | //toggleBeamReceive(); |
361 | } | 372 | } |
362 | MainWindow::~MainWindow() | 373 | MainWindow::~MainWindow() |
363 | { | 374 | { |
364 | //qDebug("MainWindow::~MainWindow() "); | 375 | //qDebug("MainWindow::~MainWindow() "); |
365 | //save toolbar location | 376 | //save toolbar location |
366 | delete mCalendar; | 377 | delete mCalendar; |
367 | delete mSyncManager; | 378 | delete mSyncManager; |
368 | #ifndef DESKTOP_VERSION | 379 | #ifndef DESKTOP_VERSION |
369 | if ( infrared ) | 380 | if ( infrared ) |
370 | delete infrared; | 381 | delete infrared; |
371 | #endif | 382 | #endif |
372 | 383 | ||
373 | 384 | ||
374 | } | 385 | } |
375 | 386 | ||
376 | void MainWindow::disableBR(bool b) | 387 | void MainWindow::disableBR(bool b) |
377 | { | 388 | { |
378 | #ifndef DESKTOP_VERSION | 389 | #ifndef DESKTOP_VERSION |
379 | if ( b ) { | 390 | if ( b ) { |
380 | if ( infrared ) { | 391 | if ( infrared ) { |
381 | toggleBeamReceive(); | 392 | toggleBeamReceive(); |
382 | mBRdisabled = true; | 393 | mBRdisabled = true; |
383 | } | 394 | } |
384 | mBRdisabled = true; | 395 | mBRdisabled = true; |
385 | } else { | 396 | } else { |
386 | if ( mBRdisabled ) { | 397 | if ( mBRdisabled ) { |
387 | mBRdisabled = false; | 398 | mBRdisabled = false; |
388 | //makes no sense,because other cal ap is probably running | 399 | //makes no sense,because other cal ap is probably running |
389 | // toggleBeamReceive(); | 400 | // toggleBeamReceive(); |
390 | } | 401 | } |
391 | } | 402 | } |
392 | #endif | 403 | #endif |
393 | 404 | ||
394 | } | 405 | } |
395 | bool MainWindow::beamReceiveEnabled() | 406 | bool MainWindow::beamReceiveEnabled() |
396 | { | 407 | { |
397 | #ifndef DESKTOP_VERSION | 408 | #ifndef DESKTOP_VERSION |
398 | return ( infrared != 0 ); | 409 | return ( infrared != 0 ); |
399 | #endif | 410 | #endif |
400 | return false; | 411 | return false; |
401 | } | 412 | } |
402 | 413 | ||
403 | void MainWindow::toggleBeamReceive() | 414 | void MainWindow::toggleBeamReceive() |
404 | { | 415 | { |
405 | if ( mBRdisabled ) | 416 | if ( mBRdisabled ) |
406 | return; | 417 | return; |
407 | #ifndef DESKTOP_VERSION | 418 | #ifndef DESKTOP_VERSION |
408 | if ( infrared ) { | 419 | if ( infrared ) { |
409 | qDebug("disable BeamReceive "); | 420 | qDebug("disable BeamReceive "); |
410 | delete infrared; | 421 | delete infrared; |
411 | infrared = 0; | 422 | infrared = 0; |
412 | brAction->setOn(false); | 423 | brAction->setOn(false); |
413 | return; | 424 | return; |
414 | } | 425 | } |
415 | qDebug("enable BeamReceive "); | 426 | qDebug("enable BeamReceive "); |
416 | brAction->setOn(true); | 427 | brAction->setOn(true); |
417 | infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; | 428 | infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; |
418 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); | 429 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); |
419 | #endif | 430 | #endif |
420 | } | 431 | } |
421 | void MainWindow::showMaximized () | 432 | void MainWindow::showMaximized () |
422 | { | 433 | { |
423 | #ifndef DESKTOP_VERSION | 434 | #ifndef DESKTOP_VERSION |
424 | if ( ! globalFlagBlockStartup ) | 435 | if ( ! globalFlagBlockStartup ) |
425 | if ( mClosed ) | 436 | if ( mClosed ) |
426 | mView->goToday(); | 437 | mView->goToday(); |
427 | #endif | 438 | #endif |
428 | QWidget::showMaximized () ; | 439 | QWidget::showMaximized () ; |
429 | mClosed = false; | 440 | mClosed = false; |
430 | } | 441 | } |
431 | void MainWindow::closeEvent( QCloseEvent* ce ) | 442 | void MainWindow::closeEvent( QCloseEvent* ce ) |
432 | { | 443 | { |
433 | 444 | ||
434 | 445 | ||
435 | 446 | ||
436 | if ( ! KOPrefs::instance()->mAskForQuit ) { | 447 | if ( ! KOPrefs::instance()->mAskForQuit ) { |
437 | saveOnClose(); | 448 | saveOnClose(); |
438 | mClosed = true; | 449 | mClosed = true; |
439 | ce->accept(); | 450 | ce->accept(); |
440 | return; | 451 | return; |
441 | 452 | ||
442 | } | 453 | } |
443 | 454 | ||
444 | switch( QMessageBox::information( this, "KO/Pi", | 455 | switch( QMessageBox::information( this, "KO/Pi", |
445 | i18n("Do you really want\nto close KO/Pi?"), | 456 | i18n("Do you really want\nto close KO/Pi?"), |
446 | i18n("Close"), i18n("No"), | 457 | i18n("Close"), i18n("No"), |
447 | 0, 0 ) ) { | 458 | 0, 0 ) ) { |
448 | case 0: | 459 | case 0: |
449 | saveOnClose(); | 460 | saveOnClose(); |
450 | mClosed = true; | 461 | mClosed = true; |
451 | ce->accept(); | 462 | ce->accept(); |
452 | break; | 463 | break; |
453 | case 1: | 464 | case 1: |
454 | ce->ignore(); | 465 | ce->ignore(); |
455 | break; | 466 | break; |
456 | case 2: | 467 | case 2: |
457 | 468 | ||
458 | default: | 469 | default: |
459 | break; | 470 | break; |
460 | } | 471 | } |
461 | 472 | ||
462 | 473 | ||
463 | } | 474 | } |
464 | 475 | ||
465 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) | 476 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) |
466 | { | 477 | { |
467 | QDataStream stream( data, IO_ReadOnly ); | 478 | QDataStream stream( data, IO_ReadOnly ); |
468 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); | 479 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); |
469 | //QString datamess; | 480 | //QString datamess; |
470 | //qDebug("message "); | 481 | //qDebug("message "); |
471 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); | 482 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); |
472 | 483 | ||
473 | if ( cmsg == "setDocument(QString)" ) { | 484 | if ( cmsg == "setDocument(QString)" ) { |
474 | QDataStream stream( data, IO_ReadOnly ); | 485 | QDataStream stream( data, IO_ReadOnly ); |
475 | QString fileName; | 486 | QString fileName; |
476 | stream >> fileName; | 487 | stream >> fileName; |
477 | //qDebug("filename %s ", fileName.latin1()); | 488 | //qDebug("filename %s ", fileName.latin1()); |
478 | showMaximized(); | 489 | showMaximized(); |
479 | raise(); | 490 | raise(); |
480 | KOPrefs::instance()->mLastSyncedLocalFile = fileName ; | 491 | KOPrefs::instance()->mLastSyncedLocalFile = fileName ; |
481 | mSyncManager->slotSyncMenu( 1002 ); | 492 | mSyncManager->slotSyncMenu( 1002 ); |
482 | return; | 493 | return; |
483 | } | 494 | } |
484 | 495 | ||
485 | if ( cmsg == "-writeFile" ) { | 496 | if ( cmsg == "-writeFile" ) { |
486 | // I made from the "-writeFile" an "-writeAlarm" | 497 | // I made from the "-writeFile" an "-writeAlarm" |
487 | mView->viewManager()->showWhatsNextView(); | 498 | mView->viewManager()->showWhatsNextView(); |
488 | mCalendar->checkAlarmForIncidence( 0, true); | 499 | mCalendar->checkAlarmForIncidence( 0, true); |
489 | showMaximized(); | 500 | showMaximized(); |
490 | raise(); | 501 | raise(); |
491 | return; | 502 | return; |
492 | 503 | ||
493 | } | 504 | } |
494 | if ( cmsg == "-writeFileSilent" ) { | 505 | if ( cmsg == "-writeFileSilent" ) { |
495 | // I made from the "-writeFile" an "-writeAlarm" | 506 | // I made from the "-writeFile" an "-writeAlarm" |
496 | // mView->viewManager()->showWhatsNextView(); | 507 | // mView->viewManager()->showWhatsNextView(); |
497 | mCalendar->checkAlarmForIncidence( 0, true); | 508 | mCalendar->checkAlarmForIncidence( 0, true); |
498 | //showMaximized(); | 509 | //showMaximized(); |
499 | //raise(); | 510 | //raise(); |
500 | hide(); | 511 | hide(); |
501 | return; | 512 | return; |
502 | } | 513 | } |
503 | if ( cmsg == "-newCountdown" ) { | 514 | if ( cmsg == "-newCountdown" ) { |
504 | qDebug("newCountdown "); | 515 | qDebug("newCountdown "); |
505 | 516 | ||
506 | } | 517 | } |
507 | QString msg ; | 518 | QString msg ; |
508 | QString allmsg = cmsg; | 519 | QString allmsg = cmsg; |
509 | while ( allmsg.length() > 0 ) { | 520 | while ( allmsg.length() > 0 ) { |
510 | int nextC = allmsg.find( "-", 1 ); | 521 | int nextC = allmsg.find( "-", 1 ); |
511 | if ( nextC == -1 ) { | 522 | if ( nextC == -1 ) { |
512 | msg = allmsg; | 523 | msg = allmsg; |
513 | allmsg = ""; | 524 | allmsg = ""; |
514 | } else{ | 525 | } else{ |
515 | msg = allmsg.left( nextC ); | 526 | msg = allmsg.left( nextC ); |
516 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); | 527 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); |
517 | } | 528 | } |
518 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); | 529 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); |
519 | if ( msg == "-newEvent" ) { | 530 | if ( msg == "-newEvent" ) { |
520 | mView->newEvent(); | 531 | mView->newEvent(); |
521 | } | 532 | } |
522 | if ( msg == "-newTodo" ) { | 533 | if ( msg == "-newTodo" ) { |
523 | mView->newTodo(); | 534 | mView->newTodo(); |
524 | 535 | ||
525 | } | 536 | } |
526 | if ( msg == "-showWN" ) { | 537 | if ( msg == "-showWN" ) { |
527 | mView->viewManager()->showWhatsNextView(); | 538 | mView->viewManager()->showWhatsNextView(); |
528 | } | 539 | } |
529 | if ( msg == "-showTodo" ) { | 540 | if ( msg == "-showTodo" ) { |
530 | mView->viewManager()->showTodoView(); | 541 | mView->viewManager()->showTodoView(); |
531 | } | 542 | } |
532 | if ( msg == "-showList" ) { | 543 | if ( msg == "-showList" ) { |
533 | mView->viewManager()->showListView(); | 544 | mView->viewManager()->showListView(); |
534 | } | 545 | } |
535 | else if ( msg == "-showDay" ) { | 546 | else if ( msg == "-showDay" ) { |
536 | mView->viewManager()->showDayView(); | 547 | mView->viewManager()->showDayView(); |
537 | } | 548 | } |
538 | else if ( msg == "-showWWeek" ) { | 549 | else if ( msg == "-showWWeek" ) { |
539 | mView->viewManager()->showWorkWeekView(); | 550 | mView->viewManager()->showWorkWeekView(); |
540 | } | 551 | } |
541 | else if ( msg == "-ringSync" ) { | 552 | else if ( msg == "-ringSync" ) { |
542 | mSyncManager->multiSync( false ); | 553 | mSyncManager->multiSync( false ); |
543 | } | 554 | } |
544 | else if ( msg == "-showWeek" ) { | 555 | else if ( msg == "-showWeek" ) { |
545 | mView->viewManager()->showWeekView(); | 556 | mView->viewManager()->showWeekView(); |
546 | } | 557 | } |
547 | else if ( msg == "-showTodo" ) { | 558 | else if ( msg == "-showTodo" ) { |
548 | mView->viewManager()->showTodoView(); | 559 | mView->viewManager()->showTodoView(); |
549 | } | 560 | } |
550 | else if ( msg == "-showJournal" ) { | 561 | else if ( msg == "-showJournal" ) { |
551 | mView->dateNavigator()->selectDates( 1 ); | 562 | mView->dateNavigator()->selectDates( 1 ); |
552 | mView->dateNavigator()->selectToday(); | 563 | mView->dateNavigator()->selectToday(); |
553 | mView->viewManager()->showJournalView(); | 564 | mView->viewManager()->showJournalView(); |
554 | } | 565 | } |
555 | else if ( msg == "-showKO" ) { | 566 | else if ( msg == "-showKO" ) { |
556 | mView->viewManager()->showNextXView(); | 567 | mView->viewManager()->showNextXView(); |
557 | } | 568 | } |
558 | else if ( msg == "-showWNext" ) { | 569 | else if ( msg == "-showWNext" ) { |
559 | mView->viewManager()->showWhatsNextView(); | 570 | mView->viewManager()->showWhatsNextView(); |
560 | } | 571 | } |
561 | else if ( msg == "nextView()" ) { | 572 | else if ( msg == "nextView()" ) { |
562 | mView->viewManager()->showNextView(); | 573 | mView->viewManager()->showNextView(); |
563 | } | 574 | } |
564 | else if ( msg == "-showNextXView" ) { | 575 | else if ( msg == "-showNextXView" ) { |
565 | mView->viewManager()->showNextXView(); | 576 | mView->viewManager()->showNextXView(); |
566 | } | 577 | } |
567 | 578 | ||
568 | 579 | ||
569 | } | 580 | } |
570 | 581 | ||
571 | showMaximized(); | 582 | showMaximized(); |
572 | raise(); | 583 | raise(); |
573 | } | 584 | } |
574 | 585 | ||
575 | QPixmap MainWindow::loadPixmap( QString name ) | 586 | QPixmap MainWindow::loadPixmap( QString name ) |
576 | { | 587 | { |
577 | return SmallIcon( name ); | 588 | return SmallIcon( name ); |
578 | 589 | ||
579 | } | 590 | } |
580 | void MainWindow::initActions() | 591 | void MainWindow::initActions() |
581 | { | 592 | { |
582 | //KOPrefs::instance()->mShowFullMenu | 593 | //KOPrefs::instance()->mShowFullMenu |
583 | iconToolBar->clear(); | 594 | iconToolBar->clear(); |
584 | KOPrefs *p = KOPrefs::instance(); | 595 | KOPrefs *p = KOPrefs::instance(); |
585 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); | 596 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); |
586 | 597 | ||
587 | QPopupMenu *viewMenu = new QPopupMenu( this ); | 598 | QPopupMenu *viewMenu = new QPopupMenu( this ); |
588 | QPopupMenu *actionMenu = new QPopupMenu( this ); | 599 | QPopupMenu *actionMenu = new QPopupMenu( this ); |
589 | QPopupMenu *importMenu = new QPopupMenu( this ); | 600 | QPopupMenu *importMenu = new QPopupMenu( this ); |
590 | QPopupMenu *importMenu_X = new QPopupMenu( this ); | 601 | QPopupMenu *importMenu_X = new QPopupMenu( this ); |
591 | QPopupMenu *exportMenu_X = new QPopupMenu( this ); | 602 | QPopupMenu *exportMenu_X = new QPopupMenu( this ); |
592 | QPopupMenu *beamMenu_X = new QPopupMenu( this ); | 603 | QPopupMenu *beamMenu_X = new QPopupMenu( this ); |
593 | selectFilterMenu = new QPopupMenu( this ); | 604 | selectFilterMenu = new QPopupMenu( this ); |
594 | selectFilterMenu->setCheckable( true ); | 605 | selectFilterMenu->setCheckable( true ); |
595 | syncMenu = new QPopupMenu( this ); | 606 | syncMenu = new QPopupMenu( this ); |
596 | configureAgendaMenu = new QPopupMenu( this ); | 607 | configureAgendaMenu = new QPopupMenu( this ); |
597 | configureToolBarMenu = new QPopupMenu( this ); | 608 | configureToolBarMenu = new QPopupMenu( this ); |
598 | QPopupMenu *helpMenu = new QPopupMenu( this ); | 609 | QPopupMenu *helpMenu = new QPopupMenu( this ); |
599 | QIconSet icon; | 610 | QIconSet icon; |
600 | int pixWid = 22, pixHei = 22; | 611 | int pixWid = 22, pixHei = 22; |
601 | QString pathString = ""; | 612 | QString pathString = ""; |
602 | if ( !p->mToolBarMiniIcons ) { | 613 | if ( !p->mToolBarMiniIcons ) { |
603 | if ( QApplication::desktop()->width() < 480 ) { | 614 | if ( QApplication::desktop()->width() < 480 ) { |
604 | pathString += "icons16/"; | 615 | pathString += "icons16/"; |
605 | pixWid = 18; pixHei = 16; | 616 | pixWid = 18; pixHei = 16; |
606 | } | 617 | } |
607 | } else { | 618 | } else { |
608 | pathString += "iconsmini/"; | 619 | pathString += "iconsmini/"; |
609 | pixWid = 18; pixHei = 16; | 620 | pixWid = 18; pixHei = 16; |
610 | } | 621 | } |
611 | if ( KOPrefs::instance()->mShowFullMenu ) { | 622 | if ( KOPrefs::instance()->mShowFullMenu ) { |
612 | QMenuBar *menuBar1; | 623 | QMenuBar *menuBar1; |
613 | menuBar1 = menuBar(); | 624 | menuBar1 = menuBar(); |
614 | menuBar1->insertItem( i18n("File"), importMenu ); | 625 | menuBar1->insertItem( i18n("File"), importMenu ); |
615 | menuBar1->insertItem( i18n("View"), viewMenu ); | 626 | menuBar1->insertItem( i18n("View"), viewMenu ); |
616 | menuBar1->insertItem( i18n("Actions"), actionMenu ); | 627 | menuBar1->insertItem( i18n("Actions"), actionMenu ); |
617 | #ifdef DESKTOP_VERSION | 628 | #ifdef DESKTOP_VERSION |
618 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); | 629 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); |
619 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 630 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
620 | #else | 631 | #else |
621 | menuBar1->insertItem( i18n("Sync"), syncMenu ); | 632 | menuBar1->insertItem( i18n("Sync"), syncMenu ); |
622 | menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); | 633 | menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); |
623 | #endif | 634 | #endif |
624 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 635 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
625 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); | 636 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); |
626 | menuBar1->insertItem( i18n("Help"), helpMenu ); | 637 | menuBar1->insertItem( i18n("Help"), helpMenu ); |
627 | } else { | 638 | } else { |
628 | QPEMenuBar *menuBar1; | 639 | QPEMenuBar *menuBar1; |
629 | menuBar1 = new QPEMenuBar( iconToolBar ); | 640 | menuBar1 = new QPEMenuBar( iconToolBar ); |
630 | QPopupMenu *menuBar = new QPopupMenu( this ); | 641 | QPopupMenu *menuBar = new QPopupMenu( this ); |
631 | icon = loadPixmap( pathString + "z_menu" ); | 642 | icon = loadPixmap( pathString + "z_menu" ); |
632 | menuBar1->insertItem( icon.pixmap(), menuBar); | 643 | menuBar1->insertItem( icon.pixmap(), menuBar); |
633 | //menuBar1->insertItem( i18n("ME"), menuBar); | 644 | //menuBar1->insertItem( i18n("ME"), menuBar); |
634 | menuBar->insertItem( i18n("File"), importMenu ); | 645 | menuBar->insertItem( i18n("File"), importMenu ); |
635 | menuBar->insertItem( i18n("View"), viewMenu ); | 646 | menuBar->insertItem( i18n("View"), viewMenu ); |
636 | menuBar->insertItem( i18n("Actions"), actionMenu ); | 647 | menuBar->insertItem( i18n("Actions"), actionMenu ); |
637 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); | 648 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); |
638 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 649 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
639 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 650 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
640 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); | 651 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); |
641 | menuBar->insertItem( i18n("Help"), helpMenu ); | 652 | menuBar->insertItem( i18n("Help"), helpMenu ); |
642 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); | 653 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); |
643 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); | 654 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); |
644 | } | 655 | } |
645 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); | 656 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); |
646 | connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); | 657 | connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); |
647 | 658 | ||
648 | 659 | ||
649 | mWeekBgColor = iconToolBar->backgroundColor(); | 660 | mWeekBgColor = iconToolBar->backgroundColor(); |
650 | mWeekPixmap.resize( pixWid , pixHei ); | 661 | mWeekPixmap.resize( pixWid , pixHei ); |
651 | mWeekPixmap.fill( mWeekBgColor ); | 662 | mWeekPixmap.fill( mWeekBgColor ); |
652 | icon = mWeekPixmap; | 663 | icon = mWeekPixmap; |
653 | mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); | 664 | mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); |
654 | if ( p-> mShowIconWeekNum ) | 665 | if ( p-> mShowIconWeekNum ) |
655 | mWeekAction->addTo( iconToolBar ); | 666 | mWeekAction->addTo( iconToolBar ); |
656 | mWeekFont = font(); | 667 | mWeekFont = font(); |
657 | 668 | ||
658 | int fontPoint = mWeekFont.pointSize(); | 669 | int fontPoint = mWeekFont.pointSize(); |
659 | QFontMetrics f( mWeekFont ); | 670 | QFontMetrics f( mWeekFont ); |
660 | int fontWid = f.width( "30" ); | 671 | int fontWid = f.width( "30" ); |
661 | while ( fontWid > pixWid ) { | 672 | while ( fontWid > pixWid ) { |
662 | --fontPoint; | 673 | --fontPoint; |
663 | mWeekFont.setPointSize( fontPoint ); | 674 | mWeekFont.setPointSize( fontPoint ); |
664 | QFontMetrics f( mWeekFont ); | 675 | QFontMetrics f( mWeekFont ); |
665 | fontWid = f.width( "30" ); | 676 | fontWid = f.width( "30" ); |
666 | //qDebug("dec-- "); | 677 | //qDebug("dec-- "); |
667 | } | 678 | } |
668 | 679 | ||
669 | connect( mWeekAction, SIGNAL( activated() ), | 680 | connect( mWeekAction, SIGNAL( activated() ), |
670 | this, SLOT( weekAction() ) ); | 681 | this, SLOT( weekAction() ) ); |
671 | 682 | ||
672 | connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); | 683 | connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); |
673 | if ( p->mShowIconFilterview ) { | 684 | if ( p->mShowIconFilterview ) { |
674 | icon = loadPixmap( pathString + "filter" ); | 685 | icon = loadPixmap( pathString + "filter" ); |
675 | actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this ); | 686 | actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this ); |
676 | connect( actionFilterMenuTB, SIGNAL( activated() ), | 687 | connect( actionFilterMenuTB, SIGNAL( activated() ), |
677 | this, SLOT( fillFilterMenuTB() ) ); | 688 | this, SLOT( fillFilterMenuTB() ) ); |
678 | actionFilterMenuTB->addTo( iconToolBar ); | 689 | actionFilterMenuTB->addTo( iconToolBar ); |
679 | selectFilterMenuTB = new QPopupMenu( this ); | 690 | selectFilterMenuTB = new QPopupMenu( this ); |
680 | selectFilterMenuTB->setCheckable( true ); | 691 | selectFilterMenuTB->setCheckable( true ); |
681 | connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); | 692 | connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); |
682 | } | 693 | } |
683 | 694 | ||
684 | //#endif | 695 | //#endif |
685 | // ****************** | 696 | // ****************** |
686 | QAction *action; | 697 | QAction *action; |
687 | // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); | 698 | // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); |
688 | configureToolBarMenu->setCheckable( true ); | 699 | configureToolBarMenu->setCheckable( true ); |
689 | 700 | ||
690 | 701 | ||
691 | configureAgendaMenu->setCheckable( true ); | 702 | configureAgendaMenu->setCheckable( true ); |
692 | int iii ; | 703 | int iii ; |
693 | for ( iii = 1;iii<= 10 ;++iii ){ | 704 | for ( iii = 1;iii<= 10 ;++iii ){ |
694 | configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); | 705 | configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); |
695 | } | 706 | } |
696 | //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); | 707 | //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); |
697 | 708 | ||
698 | connect( configureAgendaMenu, SIGNAL( aboutToShow()), | 709 | connect( configureAgendaMenu, SIGNAL( aboutToShow()), |
699 | this, SLOT( showConfigureAgenda( ) ) ); | 710 | this, SLOT( showConfigureAgenda( ) ) ); |
700 | 711 | ||
701 | icon = loadPixmap( pathString + "configure" ); | 712 | icon = loadPixmap( pathString + "configure" ); |
702 | action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); | 713 | action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); |
703 | action->addTo( actionMenu ); | 714 | action->addTo( actionMenu ); |
704 | connect( action, SIGNAL( activated() ), | 715 | connect( action, SIGNAL( activated() ), |
705 | mView, SLOT( edit_options() ) ); | 716 | mView, SLOT( edit_options() ) ); |
706 | actionMenu->insertSeparator(); | 717 | actionMenu->insertSeparator(); |
707 | 718 | ||
708 | action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); | 719 | action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); |
709 | action->addTo( actionMenu ); | 720 | action->addTo( actionMenu ); |
710 | connect( action, SIGNAL( activated() ), | 721 | connect( action, SIGNAL( activated() ), |
711 | mView, SLOT( undo_delete() ) ); | 722 | mView, SLOT( undo_delete() ) ); |
712 | actionMenu->insertSeparator(); | 723 | actionMenu->insertSeparator(); |
713 | 724 | ||
714 | icon = loadPixmap( pathString + "newevent" ); | 725 | icon = loadPixmap( pathString + "newevent" ); |
715 | configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); | 726 | configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); |
716 | configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 ); | 727 | configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 ); |
717 | configureToolBarMenu->insertSeparator(); | 728 | configureToolBarMenu->insertSeparator(); |
718 | configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 ); | 729 | configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 ); |
719 | configureToolBarMenu->insertSeparator(); | 730 | configureToolBarMenu->insertSeparator(); |
720 | configureToolBarMenu->insertItem(i18n("Week Number"), 400); | 731 | configureToolBarMenu->insertItem(i18n("Week Number"), 400); |
721 | configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); | 732 | configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); |
722 | QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); | 733 | QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); |
723 | ne_action->addTo( actionMenu ); | 734 | ne_action->addTo( actionMenu ); |
724 | connect( ne_action, SIGNAL( activated() ), | 735 | connect( ne_action, SIGNAL( activated() ), |
725 | mView, SLOT( newEvent() ) ); | 736 | mView, SLOT( newEvent() ) ); |
726 | icon = loadPixmap( pathString + "newtodo" ); | 737 | icon = loadPixmap( pathString + "newtodo" ); |
727 | configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); | 738 | configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); |
728 | QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); | 739 | QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); |
729 | nt_action->addTo( actionMenu ); | 740 | nt_action->addTo( actionMenu ); |
730 | connect( nt_action, SIGNAL( activated() ), | 741 | connect( nt_action, SIGNAL( activated() ), |
731 | mView, SLOT( newTodo() ) ); | 742 | mView, SLOT( newTodo() ) ); |
732 | 743 | ||
733 | icon = loadPixmap( pathString + "today" ); | 744 | icon = loadPixmap( pathString + "today" ); |
734 | QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); | 745 | QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); |
735 | today_action->addTo( viewMenu ); | 746 | today_action->addTo( viewMenu ); |
736 | connect( today_action, SIGNAL( activated() ), | 747 | connect( today_action, SIGNAL( activated() ), |
737 | mView, SLOT( goToday() ) ); | 748 | mView, SLOT( goToday() ) ); |
738 | viewMenu->insertSeparator(); | 749 | viewMenu->insertSeparator(); |
739 | 750 | ||
740 | // *********************** | 751 | // *********************** |
741 | if ( KOPrefs::instance()->mVerticalScreen ) { | 752 | if ( KOPrefs::instance()->mVerticalScreen ) { |
742 | icon = SmallIcon( "1updownarrow" ); | 753 | icon = SmallIcon( "1updownarrow" ); |
743 | } else { | 754 | } else { |
744 | icon = SmallIcon("1leftrightarrow" ); | 755 | icon = SmallIcon("1leftrightarrow" ); |
745 | } | 756 | } |
746 | configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 ); | 757 | configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 ); |
747 | QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this ); | 758 | QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this ); |
748 | FSaction->addTo( viewMenu ); | 759 | FSaction->addTo( viewMenu ); |
749 | connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() )); | 760 | connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() )); |
750 | 761 | ||
751 | icon = loadPixmap( pathString + "navi" ); | 762 | icon = loadPixmap( pathString + "navi" ); |
752 | configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 ); | 763 | configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 ); |
753 | action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); | 764 | action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); |
754 | action->addTo( viewMenu ); | 765 | action->addTo( viewMenu ); |
755 | connect( action, SIGNAL( activated() ), | 766 | connect( action, SIGNAL( activated() ), |
756 | mView, SLOT( toggleDateNavigatorWidget() ) ); | 767 | mView, SLOT( toggleDateNavigatorWidget() ) ); |
757 | mToggleNav = action ; | 768 | mToggleNav = action ; |
758 | icon = loadPixmap( pathString + "filter" ); | 769 | icon = loadPixmap( pathString + "filter" ); |
759 | configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 ); | 770 | configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 ); |
760 | action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); | 771 | action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); |
761 | action->addTo( viewMenu ); | 772 | action->addTo( viewMenu ); |
762 | connect( action, SIGNAL( activated() ), | 773 | connect( action, SIGNAL( activated() ), |
763 | mView, SLOT( toggleFilter() ) ); | 774 | mView, SLOT( toggleFilter() ) ); |
764 | mToggleFilter = action; | 775 | mToggleFilter = action; |
765 | icon = loadPixmap( pathString + "allday" ); | 776 | icon = loadPixmap( pathString + "allday" ); |
766 | configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 ); | 777 | configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 ); |
767 | action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); | 778 | action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); |
768 | action->addTo( viewMenu ); | 779 | action->addTo( viewMenu ); |
769 | connect( action, SIGNAL( activated() ), | 780 | connect( action, SIGNAL( activated() ), |
770 | mView, SLOT( toggleAllDaySize() ) ); | 781 | mView, SLOT( toggleAllDaySize() ) ); |
771 | mToggleAllday = action; | 782 | mToggleAllday = action; |
772 | 783 | ||
773 | 784 | ||
774 | connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), | 785 | connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), |
775 | mToggleNav, SLOT( setEnabled ( bool ) ) ); | 786 | mToggleNav, SLOT( setEnabled ( bool ) ) ); |
776 | connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), | 787 | connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), |
777 | mToggleFilter, SLOT( setEnabled ( bool ) ) ); | 788 | mToggleFilter, SLOT( setEnabled ( bool ) ) ); |
778 | connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), | 789 | connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), |
779 | mToggleAllday, SLOT( setEnabled ( bool ) ) ); | 790 | mToggleAllday, SLOT( setEnabled ( bool ) ) ); |
780 | 791 | ||
781 | viewMenu->insertSeparator(); | 792 | viewMenu->insertSeparator(); |
782 | icon = loadPixmap( pathString + "picker" ); | 793 | icon = loadPixmap( pathString + "picker" ); |
783 | action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); | 794 | action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); |
784 | action->addTo( viewMenu ); | 795 | action->addTo( viewMenu ); |
785 | connect( action, SIGNAL( activated() ), | 796 | connect( action, SIGNAL( activated() ), |
786 | mView, SLOT( showDatePicker() ) ); | 797 | mView, SLOT( showDatePicker() ) ); |
787 | action->addTo( iconToolBar ); | 798 | action->addTo( iconToolBar ); |
788 | viewMenu->insertSeparator(); | 799 | viewMenu->insertSeparator(); |
789 | 800 | ||
790 | if ( p-> mShowIconToggleFull ) | 801 | if ( p-> mShowIconToggleFull ) |
791 | FSaction->addTo( iconToolBar ); | 802 | FSaction->addTo( iconToolBar ); |
792 | if ( p->mShowIconNavigator ) mToggleNav ->addTo( iconToolBar ); | 803 | if ( p->mShowIconNavigator ) mToggleNav ->addTo( iconToolBar ); |
793 | 804 | ||
794 | //******************** | 805 | //******************** |
795 | if ( p->mShowIconAllday ) mToggleAllday->addTo( iconToolBar ); | 806 | if ( p->mShowIconAllday ) mToggleAllday->addTo( iconToolBar ); |
796 | 807 | ||
797 | 808 | ||
798 | icon = loadPixmap( pathString + "whatsnext" ); | 809 | icon = loadPixmap( pathString + "whatsnext" ); |
799 | configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 ); | 810 | configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 ); |
800 | QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); | 811 | QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); |
801 | whatsnext_action->addTo( viewMenu ); | 812 | whatsnext_action->addTo( viewMenu ); |
802 | connect( whatsnext_action, SIGNAL( activated() ), | 813 | connect( whatsnext_action, SIGNAL( activated() ), |
803 | mView->viewManager(), SLOT( showWhatsNextView() ) ); | 814 | mView->viewManager(), SLOT( showWhatsNextView() ) ); |
804 | 815 | ||
805 | icon = loadPixmap( pathString + "xdays" ); | 816 | icon = loadPixmap( pathString + "xdays" ); |
806 | configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 ); | 817 | configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 ); |
807 | QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); | 818 | QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); |
808 | xdays_action->addTo( viewMenu ); | 819 | xdays_action->addTo( viewMenu ); |
809 | connect( xdays_action, SIGNAL( activated() ), | 820 | connect( xdays_action, SIGNAL( activated() ), |
810 | mView->viewManager(), SLOT( showNextXView() ) ); | 821 | mView->viewManager(), SLOT( showNextXView() ) ); |
811 | 822 | ||
812 | 823 | ||
813 | icon = loadPixmap( pathString + "journal" ); | 824 | icon = loadPixmap( pathString + "journal" ); |
814 | configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); | 825 | configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); |
815 | QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); | 826 | QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); |
816 | viewjournal_action->addTo( viewMenu ); | 827 | viewjournal_action->addTo( viewMenu ); |
817 | connect( viewjournal_action, SIGNAL( activated() ), | 828 | connect( viewjournal_action, SIGNAL( activated() ), |
818 | mView->viewManager(), SLOT( showJournalView() ) ); | 829 | mView->viewManager(), SLOT( showJournalView() ) ); |
819 | 830 | ||
820 | 831 | ||
821 | icon = loadPixmap( pathString + "day" ); | 832 | icon = loadPixmap( pathString + "day" ); |
822 | configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); | 833 | configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); |
823 | QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); | 834 | QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); |
824 | day1_action->addTo( viewMenu ); | 835 | day1_action->addTo( viewMenu ); |
825 | // action->addTo( toolBar ); | 836 | // action->addTo( toolBar ); |
826 | connect( day1_action, SIGNAL( activated() ), | 837 | connect( day1_action, SIGNAL( activated() ), |
827 | mView->viewManager(), SLOT( showDayView() ) ); | 838 | mView->viewManager(), SLOT( showDayView() ) ); |
828 | 839 | ||
829 | icon = loadPixmap( pathString + "workweek" ); | 840 | icon = loadPixmap( pathString + "workweek" ); |
830 | configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); | 841 | configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); |
831 | QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); | 842 | QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); |
832 | day5_action->addTo( viewMenu ); | 843 | day5_action->addTo( viewMenu ); |
833 | connect( day5_action, SIGNAL( activated() ), | 844 | connect( day5_action, SIGNAL( activated() ), |
834 | mView->viewManager(), SLOT( showWorkWeekView() ) ); | 845 | mView->viewManager(), SLOT( showWorkWeekView() ) ); |
835 | 846 | ||
836 | icon = loadPixmap( pathString + "week" ); | 847 | icon = loadPixmap( pathString + "week" ); |
837 | configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); | 848 | configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); |
838 | QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); | 849 | QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); |
839 | day7_action->addTo( viewMenu ); | 850 | day7_action->addTo( viewMenu ); |
840 | connect( day7_action, SIGNAL( activated() ), | 851 | connect( day7_action, SIGNAL( activated() ), |
841 | mView->viewManager(), SLOT( showWeekView() ) ); | 852 | mView->viewManager(), SLOT( showWeekView() ) ); |
842 | 853 | ||
843 | icon = loadPixmap( pathString + "workweek2" ); | 854 | icon = loadPixmap( pathString + "workweek2" ); |
844 | configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 ); | 855 | configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 ); |
845 | QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this ); | 856 | QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this ); |
846 | day6_action->addTo( viewMenu ); | 857 | day6_action->addTo( viewMenu ); |
847 | connect( day6_action, SIGNAL( activated() ), | 858 | connect( day6_action, SIGNAL( activated() ), |
848 | mView->viewManager(), SLOT( showMonthViewWeek() ) ); | 859 | mView->viewManager(), SLOT( showMonthViewWeek() ) ); |
849 | 860 | ||
850 | icon = loadPixmap( pathString + "month" ); | 861 | icon = loadPixmap( pathString + "month" ); |
851 | configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); | 862 | configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); |
852 | QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); | 863 | QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); |
853 | month_action->addTo( viewMenu ); | 864 | month_action->addTo( viewMenu ); |
854 | connect( month_action, SIGNAL( activated() ), | 865 | connect( month_action, SIGNAL( activated() ), |
855 | mView->viewManager(), SLOT( showMonthView() ) ); | 866 | mView->viewManager(), SLOT( showMonthView() ) ); |
856 | 867 | ||
857 | icon = loadPixmap( pathString + "list" ); | 868 | icon = loadPixmap( pathString + "list" ); |
858 | configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); | 869 | configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); |
859 | QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); | 870 | QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); |
860 | showlist_action->addTo( viewMenu ); | 871 | showlist_action->addTo( viewMenu ); |
861 | connect( showlist_action, SIGNAL( activated() ), | 872 | connect( showlist_action, SIGNAL( activated() ), |
862 | mView->viewManager(), SLOT( showListView() ) ); | 873 | mView->viewManager(), SLOT( showListView() ) ); |
863 | 874 | ||
864 | icon = loadPixmap( pathString + "todo" ); | 875 | icon = loadPixmap( pathString + "todo" ); |
865 | configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); | 876 | configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); |
866 | QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); | 877 | QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); |
867 | todoview_action->addTo( viewMenu ); | 878 | todoview_action->addTo( viewMenu ); |
868 | connect( todoview_action, SIGNAL( activated() ), | 879 | connect( todoview_action, SIGNAL( activated() ), |
869 | mView->viewManager(), SLOT( showTodoView() ) ); | 880 | mView->viewManager(), SLOT( showTodoView() ) ); |
870 | 881 | ||
871 | 882 | ||
872 | 883 | ||
873 | #if 0 | 884 | #if 0 |
874 | action = new QAction( "view_timespan", "Time Span", 0, this ); | 885 | action = new QAction( "view_timespan", "Time Span", 0, this ); |
875 | action->addTo( viewMenu ); | 886 | action->addTo( viewMenu ); |
876 | connect( action, SIGNAL( activated() ), | 887 | connect( action, SIGNAL( activated() ), |
877 | mView->viewManager(), SLOT( showTimeSpanView() ) ); | 888 | mView->viewManager(), SLOT( showTimeSpanView() ) ); |
878 | #endif | 889 | #endif |
879 | 890 | ||
880 | mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, | 891 | mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, |
881 | this ); | 892 | this ); |
882 | mNewSubTodoAction->addTo( actionMenu ); | 893 | mNewSubTodoAction->addTo( actionMenu ); |
883 | connect( mNewSubTodoAction, SIGNAL( activated() ), | 894 | connect( mNewSubTodoAction, SIGNAL( activated() ), |
884 | mView, SLOT( newSubTodo() ) ); | 895 | mView, SLOT( newSubTodo() ) ); |
885 | 896 | ||
886 | actionMenu->insertSeparator(); | 897 | actionMenu->insertSeparator(); |
887 | 898 | ||
888 | mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); | 899 | mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); |
889 | mShowAction->addTo( actionMenu ); | 900 | mShowAction->addTo( actionMenu ); |
890 | connect( mShowAction, SIGNAL( activated() ), | 901 | connect( mShowAction, SIGNAL( activated() ), |
891 | mView, SLOT( showIncidence() ) ); | 902 | mView, SLOT( showIncidence() ) ); |
892 | 903 | ||
893 | mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); | 904 | mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); |
894 | mEditAction->addTo( actionMenu ); | 905 | mEditAction->addTo( actionMenu ); |
895 | connect( mEditAction, SIGNAL( activated() ), | 906 | connect( mEditAction, SIGNAL( activated() ), |
896 | mView, SLOT( editIncidence() ) ); | 907 | mView, SLOT( editIncidence() ) ); |
897 | 908 | ||
898 | mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); | 909 | mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); |
899 | mDeleteAction->addTo( actionMenu ); | 910 | mDeleteAction->addTo( actionMenu ); |
900 | connect( mDeleteAction, SIGNAL( activated() ), | 911 | connect( mDeleteAction, SIGNAL( activated() ), |
901 | mView, SLOT( deleteIncidence() ) ); | 912 | mView, SLOT( deleteIncidence() ) ); |
902 | 913 | ||
903 | 914 | ||
904 | mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); | 915 | mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); |
905 | mCloneAction->addTo( actionMenu ); | 916 | mCloneAction->addTo( actionMenu ); |
906 | connect( mCloneAction, SIGNAL( activated() ), | 917 | connect( mCloneAction, SIGNAL( activated() ), |
907 | mView, SLOT( cloneIncidence() ) ); | 918 | mView, SLOT( cloneIncidence() ) ); |
908 | mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); | 919 | mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); |
909 | mMoveAction->addTo( actionMenu ); | 920 | mMoveAction->addTo( actionMenu ); |
910 | connect( mMoveAction, SIGNAL( activated() ), | 921 | connect( mMoveAction, SIGNAL( activated() ), |
911 | mView, SLOT( moveIncidence() ) ); | 922 | mView, SLOT( moveIncidence() ) ); |
912 | mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); | 923 | mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); |
913 | mBeamAction->addTo( actionMenu ); | 924 | mBeamAction->addTo( actionMenu ); |
914 | connect( mBeamAction, SIGNAL( activated() ), | 925 | connect( mBeamAction, SIGNAL( activated() ), |
915 | mView, SLOT( beamIncidence() ) ); | 926 | mView, SLOT( beamIncidence() ) ); |
916 | mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); | 927 | mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); |
917 | mCancelAction->addTo( actionMenu ); | 928 | mCancelAction->addTo( actionMenu ); |
918 | connect( mCancelAction, SIGNAL( activated() ), | 929 | connect( mCancelAction, SIGNAL( activated() ), |
919 | mView, SLOT( toggleCancelIncidence() ) ); | 930 | mView, SLOT( toggleCancelIncidence() ) ); |
920 | 931 | ||
921 | actionMenu->insertSeparator(); | 932 | actionMenu->insertSeparator(); |
922 | 933 | ||
923 | action = new QAction( "purge_completed", i18n("Purge Completed"), 0, | 934 | action = new QAction( "purge_completed", i18n("Purge Completed"), 0, |
924 | this ); | 935 | this ); |
925 | action->addTo( actionMenu ); | 936 | action->addTo( actionMenu ); |
926 | connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); | 937 | connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); |
927 | 938 | ||
928 | icon = loadPixmap( pathString + "search" ); | 939 | icon = loadPixmap( pathString + "search" ); |
929 | QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); | 940 | QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); |
930 | configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5); | 941 | configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5); |
931 | search_action->addTo( actionMenu ); | 942 | search_action->addTo( actionMenu ); |
932 | connect( search_action, SIGNAL( activated() ), | 943 | connect( search_action, SIGNAL( activated() ), |
933 | mView->dialogManager(), SLOT( showSearchDialog() ) ); | 944 | mView->dialogManager(), SLOT( showSearchDialog() ) ); |
934 | 945 | ||
935 | 946 | ||
936 | 947 | ||
937 | if ( KOPrefs::instance()->mShowFullMenu ) { | 948 | if ( KOPrefs::instance()->mShowFullMenu ) { |
938 | actionMenu->insertSeparator(); | 949 | actionMenu->insertSeparator(); |
939 | actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); | 950 | actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); |
940 | 951 | ||
941 | } | 952 | } |
942 | // actionMenu->insertSeparator(); | 953 | // actionMenu->insertSeparator(); |
943 | action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, | 954 | action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, |
944 | this ); | 955 | this ); |
945 | action->addTo( importMenu_X ); | 956 | action->addTo( importMenu_X ); |
946 | connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); | 957 | connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); |
947 | action = new QAction( "import_quick", i18n("Import last file"), 0, | 958 | action = new QAction( "import_quick", i18n("Import last file"), 0, |
948 | this ); | 959 | this ); |
949 | action->addTo( importMenu_X ); | 960 | action->addTo( importMenu_X ); |
950 | connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); | 961 | connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); |
951 | importMenu_X->insertSeparator(); | 962 | importMenu_X->insertSeparator(); |
952 | action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, | 963 | action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, |
953 | this ); | 964 | this ); |
954 | action->addTo( importMenu_X ); | 965 | action->addTo( importMenu_X ); |
955 | connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); | 966 | connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); |
956 | //#ifndef DESKTOP_VERSION | 967 | //#ifndef DESKTOP_VERSION |
957 | importMenu_X->insertSeparator(); | 968 | importMenu_X->insertSeparator(); |
958 | action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, | 969 | action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, |
959 | this ); | 970 | this ); |
960 | action->addTo( importMenu_X ); | 971 | action->addTo( importMenu_X ); |
961 | connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); | 972 | connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); |
962 | //#else | 973 | //#else |
963 | #ifdef _OL_IMPORT_ | 974 | #ifdef _OL_IMPORT_ |
964 | importMenu_X->insertSeparator(); | 975 | importMenu_X->insertSeparator(); |
965 | action = new QAction( "import_ol", i18n("Import from OL"), 0, | 976 | action = new QAction( "import_ol", i18n("Import from OL"), 0, |
966 | this ); | 977 | this ); |
967 | action->addTo( importMenu_X ); | 978 | action->addTo( importMenu_X ); |
968 | connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); | 979 | connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); |
969 | #endif | 980 | #endif |
970 | //#endif | 981 | //#endif |
971 | 982 | ||
972 | //importMenu->insertSeparator(); | 983 | //importMenu->insertSeparator(); |
973 | action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, | 984 | action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, |
974 | this ); | 985 | this ); |
975 | action->addTo( importMenu ); | 986 | action->addTo( importMenu ); |
976 | connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); | 987 | connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); |
977 | 988 | ||
978 | action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, | 989 | action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, |
979 | this ); | 990 | this ); |
980 | action->addTo( importMenu ); | 991 | action->addTo( importMenu ); |
981 | connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); | 992 | connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); |
982 | importMenu->insertSeparator(); | 993 | importMenu->insertSeparator(); |
983 | importMenu->insertItem( i18n("Import"), importMenu_X ); | 994 | importMenu->insertItem( i18n("Import"), importMenu_X ); |
984 | //importMenu->insertSeparator(); | 995 | //importMenu->insertSeparator(); |
985 | action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, | 996 | action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, |
986 | this ); | 997 | this ); |
987 | action->addTo( exportMenu_X ); | 998 | action->addTo( exportMenu_X ); |
988 | connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); | 999 | connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); |
989 | 1000 | ||
990 | 1001 | ||
991 | //LR | 1002 | //LR |
992 | QPopupMenu *ex2phone = new QPopupMenu( this ); | 1003 | QPopupMenu *ex2phone = new QPopupMenu( this ); |
993 | ex2phone->insertItem(i18n("Complete calendar..."), 1 ); | 1004 | ex2phone->insertItem(i18n("Complete calendar..."), 1 ); |
994 | ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); | 1005 | ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); |
995 | connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); | 1006 | connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); |
996 | exportMenu_X->insertItem( i18n("Export to phone"), ex2phone ); | 1007 | exportMenu_X->insertItem( i18n("Export to phone"), ex2phone ); |
997 | 1008 | ||
998 | importMenu->insertItem( i18n("Export"), exportMenu_X ); | 1009 | importMenu->insertItem( i18n("Export"), exportMenu_X ); |
999 | #ifndef DESKTOP_VERSION | 1010 | #ifndef DESKTOP_VERSION |
1000 | //importMenu->insertSeparator(); | 1011 | //importMenu->insertSeparator(); |
1001 | brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, | 1012 | brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, |
1002 | this ); | 1013 | this ); |
1003 | brAction->addTo( beamMenu_X ); | 1014 | brAction->addTo( beamMenu_X ); |
1004 | brAction->setToggleAction (true ) ; | 1015 | brAction->setToggleAction (true ) ; |
1005 | connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); | 1016 | connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); |
1006 | 1017 | ||
1007 | action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, | 1018 | action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, |
1008 | this ); | 1019 | this ); |
1009 | action->addTo( beamMenu_X ); | 1020 | action->addTo( beamMenu_X ); |
1010 | connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); | 1021 | connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); |
1011 | 1022 | ||
1012 | action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, | 1023 | action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, |
1013 | this ); | 1024 | this ); |
1014 | action->addTo( beamMenu_X ); | 1025 | action->addTo( beamMenu_X ); |
1015 | connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); | 1026 | connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); |
1016 | importMenu->insertItem( i18n("Beam"), beamMenu_X ); | 1027 | importMenu->insertItem( i18n("Beam"), beamMenu_X ); |
1017 | #else | 1028 | #else |
1018 | //importMenu->insertSeparator(); | 1029 | //importMenu->insertSeparator(); |
1019 | icon = loadPixmap( pathString + "print" ); | 1030 | icon = loadPixmap( pathString + "print" ); |
1020 | action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); | 1031 | action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); |
1021 | action->addTo( beamMenu_X ); | 1032 | action->addTo( beamMenu_X ); |
1022 | connect( action, SIGNAL( activated() ), | 1033 | connect( action, SIGNAL( activated() ), |
1023 | this, SLOT( printCal() ) ); | 1034 | this, SLOT( printCal() ) ); |
1024 | 1035 | ||
1025 | icon = loadPixmap( pathString + "print" ); | 1036 | icon = loadPixmap( pathString + "print" ); |
1026 | action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); | 1037 | action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); |
1027 | action->addTo( beamMenu_X ); | 1038 | action->addTo( beamMenu_X ); |
1028 | connect( action, SIGNAL( activated() ), | 1039 | connect( action, SIGNAL( activated() ), |
1029 | this, SLOT( printSel() ) ); | 1040 | this, SLOT( printSel() ) ); |
1030 | action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); | 1041 | action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); |
1031 | action->addTo( beamMenu_X ); | 1042 | action->addTo( beamMenu_X ); |
1032 | connect( action, SIGNAL( activated() ), | 1043 | connect( action, SIGNAL( activated() ), |
1033 | mView->viewManager(), SLOT( slotprintWNV() ) ); | 1044 | mView->viewManager(), SLOT( slotprintWNV() ) ); |
1034 | 1045 | ||
1035 | action = new QAction( i18n("Print selected event / todo..."),icon,i18n("Print selected event / todo..."), 0, this ); | 1046 | action = new QAction( i18n("Print selected event / todo..."),icon,i18n("Print selected event / todo..."), 0, this ); |
1036 | action->addTo( beamMenu_X ); | 1047 | action->addTo( beamMenu_X ); |
1037 | connect( action, SIGNAL( activated() ), | 1048 | connect( action, SIGNAL( activated() ), |
1038 | mView, SLOT( slotprintSelInc() ) ); | 1049 | mView, SLOT( slotprintSelInc() ) ); |
1039 | 1050 | ||
1040 | 1051 | ||
1041 | importMenu->insertItem( i18n("Print"), beamMenu_X ); | 1052 | importMenu->insertItem( i18n("Print"), beamMenu_X ); |
1042 | #endif | 1053 | #endif |
1043 | importMenu->insertSeparator(); | 1054 | importMenu->insertSeparator(); |
1044 | action = new QAction( "manage cat", i18n("Manage new categories..."), 0, | 1055 | action = new QAction( "manage cat", i18n("Manage new categories..."), 0, |
1045 | this ); | 1056 | this ); |
1046 | action->addTo( importMenu ); | 1057 | action->addTo( importMenu ); |
1047 | connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); | 1058 | connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); |
1048 | importMenu->insertSeparator(); | 1059 | importMenu->insertSeparator(); |
1049 | action = new QAction( "beam all", i18n("Save"), 0, | 1060 | action = new QAction( "beam all", i18n("Save"), 0, |
1050 | this ); | 1061 | this ); |
1051 | action->addTo( importMenu ); | 1062 | action->addTo( importMenu ); |
1052 | connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); | 1063 | connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); |
1053 | action = new QAction( "beam all", i18n("Exit (+save)"), 0, | 1064 | action = new QAction( "beam all", i18n("Exit (+save)"), 0, |
1054 | this ); | 1065 | this ); |
1055 | action->addTo( importMenu ); | 1066 | action->addTo( importMenu ); |
1056 | connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); | 1067 | connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); |
1057 | 1068 | ||
1058 | //menuBar->insertItem( "Configure",configureMenu ); | 1069 | //menuBar->insertItem( "Configure",configureMenu ); |
1059 | //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); | 1070 | //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); |
1060 | icon = loadPixmap( "korganizer/korganizer" ); | 1071 | icon = loadPixmap( "korganizer/korganizer" ); |
1061 | 1072 | ||
1062 | action = new QAction( "Whats New", i18n("What's new?"), 0,this ); | 1073 | action = new QAction( "Whats New", i18n("What's new?"), 0,this ); |
1063 | action->addTo( helpMenu ); | 1074 | action->addTo( helpMenu ); |
1064 | connect( action, SIGNAL( activated() ), | 1075 | connect( action, SIGNAL( activated() ), |
1065 | SLOT( whatsNew() ) ); | 1076 | SLOT( whatsNew() ) ); |
1066 | action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); | 1077 | action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); |
1067 | action->addTo( helpMenu ); | 1078 | action->addTo( helpMenu ); |
1068 | connect( action, SIGNAL( activated() ), | 1079 | connect( action, SIGNAL( activated() ), |
1069 | SLOT( features() ) ); | 1080 | SLOT( features() ) ); |
1070 | action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); | 1081 | action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); |
1071 | action->addTo( helpMenu ); | 1082 | action->addTo( helpMenu ); |
1072 | connect( action, SIGNAL( activated() ), | 1083 | connect( action, SIGNAL( activated() ), |
1073 | SLOT( keyBindings() ) ); | 1084 | SLOT( keyBindings() ) ); |
1074 | action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); | 1085 | action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); |
1075 | action->addTo( helpMenu ); | 1086 | action->addTo( helpMenu ); |
1076 | connect( action, SIGNAL( activated() ), | 1087 | connect( action, SIGNAL( activated() ), |
1077 | SLOT( synchowto() ) ); | 1088 | SLOT( synchowto() ) ); |
1078 | action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); | 1089 | action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); |
1079 | action->addTo( helpMenu ); | 1090 | action->addTo( helpMenu ); |
1080 | connect( action, SIGNAL( activated() ), | 1091 | connect( action, SIGNAL( activated() ), |
1081 | SLOT( kdesynchowto() ) ); | 1092 | SLOT( kdesynchowto() ) ); |
1082 | action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); | 1093 | action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); |
1083 | action->addTo( helpMenu ); | 1094 | action->addTo( helpMenu ); |
1084 | connect( action, SIGNAL( activated() ), | 1095 | connect( action, SIGNAL( activated() ), |
1085 | SLOT( multisynchowto() ) ); | 1096 | SLOT( multisynchowto() ) ); |
1086 | action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); | 1097 | action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); |
1087 | action->addTo( helpMenu ); | 1098 | action->addTo( helpMenu ); |
1088 | connect( action, SIGNAL( activated() ), | 1099 | connect( action, SIGNAL( activated() ), |
1089 | SLOT( aboutAutoSaving() ) ); | 1100 | SLOT( aboutAutoSaving() ) ); |
1090 | action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); | 1101 | action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); |
1091 | action->addTo( helpMenu ); | 1102 | action->addTo( helpMenu ); |
1092 | connect( action, SIGNAL( activated() ), | 1103 | connect( action, SIGNAL( activated() ), |
1093 | SLOT( aboutKnownBugs() ) ); | 1104 | SLOT( aboutKnownBugs() ) ); |
1094 | action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); | 1105 | action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); |
1095 | action->addTo( helpMenu ); | 1106 | action->addTo( helpMenu ); |
1096 | connect( action, SIGNAL( activated() ), | 1107 | connect( action, SIGNAL( activated() ), |
1097 | SLOT( usertrans() ) ); | 1108 | SLOT( usertrans() ) ); |
1098 | action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); | 1109 | action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); |
1099 | action->addTo( helpMenu ); | 1110 | action->addTo( helpMenu ); |
1100 | connect( action, SIGNAL( activated() ), | 1111 | connect( action, SIGNAL( activated() ), |
1101 | SLOT( faq() ) ); | 1112 | SLOT( faq() ) ); |
1102 | action = new QAction( "licence", i18n("Licence..."), 0, this ); | 1113 | action = new QAction( "licence", i18n("Licence..."), 0, this ); |
1103 | action->addTo( helpMenu ); | 1114 | action->addTo( helpMenu ); |
1104 | connect( action, SIGNAL( activated() ), | 1115 | connect( action, SIGNAL( activated() ), |
1105 | SLOT( licence() ) ); | 1116 | SLOT( licence() ) ); |
1106 | action = new QAction( "about", i18n("About..."), 0, this ); | 1117 | action = new QAction( "about", i18n("About..."), 0, this ); |
1107 | action->addTo( helpMenu ); | 1118 | action->addTo( helpMenu ); |
1108 | connect( action, SIGNAL( activated() ), | 1119 | connect( action, SIGNAL( activated() ), |
1109 | SLOT( about() ) ); | 1120 | SLOT( about() ) ); |
1110 | //menuBar->insertSeparator(); | 1121 | //menuBar->insertSeparator(); |
1111 | 1122 | ||
1112 | // ****************************************************** | 1123 | // ****************************************************** |
1113 | // menubar icons | 1124 | // menubar icons |
1114 | 1125 | ||
1115 | 1126 | ||
1116 | 1127 | ||
1117 | //menuBar->insertItem( iconToolBar ); | 1128 | //menuBar->insertItem( iconToolBar ); |
1118 | //xdays_action | 1129 | //xdays_action |
1119 | if (p-> mShowIconNewEvent) | 1130 | if (p-> mShowIconNewEvent) |
1120 | ne_action->addTo( iconToolBar ); | 1131 | ne_action->addTo( iconToolBar ); |
1121 | if (p->mShowIconNewTodo ) | 1132 | if (p->mShowIconNewTodo ) |
1122 | nt_action->addTo( iconToolBar ); | 1133 | nt_action->addTo( iconToolBar ); |
1123 | if (p-> mShowIconSearch) | 1134 | if (p-> mShowIconSearch) |
1124 | search_action->addTo( iconToolBar ); | 1135 | search_action->addTo( iconToolBar ); |
1125 | if (p-> mShowIconWhatsThis) | 1136 | if (p-> mShowIconWhatsThis) |
1126 | QWhatsThis::whatsThisButton ( iconToolBar ); | 1137 | QWhatsThis::whatsThisButton ( iconToolBar ); |
1127 | if (p-> mShowIconNext) | 1138 | if (p-> mShowIconNext) |
1128 | whatsnext_action->addTo( viewToolBar ); | 1139 | whatsnext_action->addTo( viewToolBar ); |
1129 | if (p-> mShowIconNextDays) | 1140 | if (p-> mShowIconNextDays) |
1130 | xdays_action->addTo( viewToolBar ); | 1141 | xdays_action->addTo( viewToolBar ); |
1131 | if (p-> mShowIconJournal) | 1142 | if (p-> mShowIconJournal) |
1132 | viewjournal_action->addTo( viewToolBar ); | 1143 | viewjournal_action->addTo( viewToolBar ); |
1133 | if (p-> mShowIconDay1) | 1144 | if (p-> mShowIconDay1) |
1134 | day1_action->addTo( viewToolBar ); | 1145 | day1_action->addTo( viewToolBar ); |
1135 | if (p-> mShowIconDay5) | 1146 | if (p-> mShowIconDay5) |
1136 | day5_action->addTo( viewToolBar ); | 1147 | day5_action->addTo( viewToolBar ); |
1137 | if (p-> mShowIconDay7) | 1148 | if (p-> mShowIconDay7) |
1138 | day7_action->addTo( viewToolBar ); | 1149 | day7_action->addTo( viewToolBar ); |
1139 | if (p-> mShowIconDay6) | 1150 | if (p-> mShowIconDay6) |
1140 | day6_action->addTo( viewToolBar ); | 1151 | day6_action->addTo( viewToolBar ); |
1141 | if (p-> mShowIconMonth) | 1152 | if (p-> mShowIconMonth) |
1142 | month_action->addTo( viewToolBar ); | 1153 | month_action->addTo( viewToolBar ); |
1143 | if (p-> mShowIconList) | 1154 | if (p-> mShowIconList) |
1144 | showlist_action->addTo( viewToolBar ); | 1155 | showlist_action->addTo( viewToolBar ); |
1145 | if (p-> mShowIconTodoview) | 1156 | if (p-> mShowIconTodoview) |
1146 | todoview_action->addTo( viewToolBar ); | 1157 | todoview_action->addTo( viewToolBar ); |
1147 | 1158 | ||
1148 | icon = loadPixmap( pathString + "2leftarrowB" ); | 1159 | icon = loadPixmap( pathString + "2leftarrowB" ); |
1149 | configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200); | 1160 | configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200); |
1150 | if (p-> mShowIconBackFast) { | 1161 | if (p-> mShowIconBackFast) { |
1151 | action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); | 1162 | action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); |
1152 | connect( action, SIGNAL( activated() ), | 1163 | connect( action, SIGNAL( activated() ), |
1153 | mView, SLOT( goPreviousMonth() ) ); | 1164 | mView, SLOT( goPreviousMonth() ) ); |
1154 | action->addTo( navigatorToolBar ); | 1165 | action->addTo( navigatorToolBar ); |
1155 | } | 1166 | } |
1156 | icon = loadPixmap( pathString + "1leftarrowB" ); | 1167 | icon = loadPixmap( pathString + "1leftarrowB" ); |
1157 | configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210); | 1168 | configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210); |
1158 | if (p-> mShowIconBack) { | 1169 | if (p-> mShowIconBack) { |
1159 | action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); | 1170 | action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); |
1160 | connect( action, SIGNAL( activated() ), | 1171 | connect( action, SIGNAL( activated() ), |
1161 | mView, SLOT( goPrevious() ) ); | 1172 | mView, SLOT( goPrevious() ) ); |
1162 | action->addTo( navigatorToolBar ); | 1173 | action->addTo( navigatorToolBar ); |
1163 | } | 1174 | } |
1164 | icon = loadPixmap( pathString + "today" ); | 1175 | icon = loadPixmap( pathString + "today" ); |
1165 | configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); | 1176 | configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); |
1166 | if (p-> mShowIconToday) | 1177 | if (p-> mShowIconToday) |
1167 | today_action->addTo( navigatorToolBar ); | 1178 | today_action->addTo( navigatorToolBar ); |
1168 | icon = loadPixmap( pathString + "1rightarrowB" ); | 1179 | icon = loadPixmap( pathString + "1rightarrowB" ); |
1169 | configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); | 1180 | configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); |
1170 | if (p-> mShowIconForward) { | 1181 | if (p-> mShowIconForward) { |
1171 | action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); | 1182 | action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); |
1172 | connect( action, SIGNAL( activated() ), | 1183 | connect( action, SIGNAL( activated() ), |
1173 | mView, SLOT( goNext() ) ); | 1184 | mView, SLOT( goNext() ) ); |
1174 | action->addTo( navigatorToolBar ); | 1185 | action->addTo( navigatorToolBar ); |
1175 | } | 1186 | } |
1176 | icon = loadPixmap( pathString + "2rightarrowB" ); | 1187 | icon = loadPixmap( pathString + "2rightarrowB" ); |
1177 | configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); | 1188 | configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); |
1178 | if (p-> mShowIconForwardFast) { | 1189 | if (p-> mShowIconForwardFast) { |
1179 | action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); | 1190 | action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); |
1180 | connect( action, SIGNAL( activated() ), | 1191 | connect( action, SIGNAL( activated() ), |
1181 | mView, SLOT( goNextMonth() ) ); | 1192 | mView, SLOT( goNextMonth() ) ); |
1182 | action->addTo( navigatorToolBar ); | 1193 | action->addTo( navigatorToolBar ); |
1183 | } | 1194 | } |
1184 | 1195 | ||
1185 | 1196 | ||
1186 | configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6); | 1197 | configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6); |
1187 | 1198 | ||
1188 | 1199 | ||
1189 | if ( p->mShowIconNavigator ) configureToolBarMenu->setItemChecked( 22 , true); | 1200 | if ( p->mShowIconNavigator ) configureToolBarMenu->setItemChecked( 22 , true); |
1190 | if ( p->mShowIconAllday ) configureToolBarMenu->setItemChecked( 24 , true); | 1201 | if ( p->mShowIconAllday ) configureToolBarMenu->setItemChecked( 24 , true); |
1191 | if ( p->mShowIconFilterview ) configureToolBarMenu->setItemChecked( 26 , true); | 1202 | if ( p->mShowIconFilterview ) configureToolBarMenu->setItemChecked( 26 , true); |
1192 | if ( p->mShowIconToggleFull ) configureToolBarMenu->setItemChecked( 28 , true); | 1203 | if ( p->mShowIconToggleFull ) configureToolBarMenu->setItemChecked( 28 , true); |
1193 | 1204 | ||
1194 | if (p-> mShowIconNewEvent) | 1205 | if (p-> mShowIconNewEvent) |
1195 | configureToolBarMenu->setItemChecked( 10, true ); | 1206 | configureToolBarMenu->setItemChecked( 10, true ); |
1196 | if (p->mShowIconNewTodo ) | 1207 | if (p->mShowIconNewTodo ) |
1197 | configureToolBarMenu->setItemChecked( 20, true ); | 1208 | configureToolBarMenu->setItemChecked( 20, true ); |
1198 | if (p-> mShowIconSearch) | 1209 | if (p-> mShowIconSearch) |
1199 | configureToolBarMenu->setItemChecked( 120, true ); | 1210 | configureToolBarMenu->setItemChecked( 120, true ); |
1200 | if (p-> mShowIconList) | 1211 | if (p-> mShowIconList) |
1201 | configureToolBarMenu->setItemChecked( 30, true ); | 1212 | configureToolBarMenu->setItemChecked( 30, true ); |
1202 | if (p-> mShowIconDay1) | 1213 | if (p-> mShowIconDay1) |
1203 | configureToolBarMenu->setItemChecked( 40, true ); | 1214 | configureToolBarMenu->setItemChecked( 40, true ); |
1204 | if (p-> mShowIconDay5) | 1215 | if (p-> mShowIconDay5) |
1205 | configureToolBarMenu->setItemChecked( 50, true ); | 1216 | configureToolBarMenu->setItemChecked( 50, true ); |
1206 | if (p-> mShowIconDay6) | 1217 | if (p-> mShowIconDay6) |
1207 | configureToolBarMenu->setItemChecked( 75, true ); | 1218 | configureToolBarMenu->setItemChecked( 75, true ); |
1208 | if (p-> mShowIconDay7) | 1219 | if (p-> mShowIconDay7) |
1209 | configureToolBarMenu->setItemChecked( 60, true ); | 1220 | configureToolBarMenu->setItemChecked( 60, true ); |
1210 | if (p-> mShowIconMonth) | 1221 | if (p-> mShowIconMonth) |
1211 | configureToolBarMenu->setItemChecked( 70, true ); | 1222 | configureToolBarMenu->setItemChecked( 70, true ); |
1212 | if (p-> mShowIconTodoview) | 1223 | if (p-> mShowIconTodoview) |
1213 | configureToolBarMenu->setItemChecked( 80, true ); | 1224 | configureToolBarMenu->setItemChecked( 80, true ); |
1214 | if (p-> mShowIconBackFast) | 1225 | if (p-> mShowIconBackFast) |
1215 | configureToolBarMenu->setItemChecked( 200, true ); | 1226 | configureToolBarMenu->setItemChecked( 200, true ); |
1216 | if (p-> mShowIconBack) | 1227 | if (p-> mShowIconBack) |
1217 | configureToolBarMenu->setItemChecked( 210, true ); | 1228 | configureToolBarMenu->setItemChecked( 210, true ); |
1218 | if (p-> mShowIconToday) | 1229 | if (p-> mShowIconToday) |
1219 | configureToolBarMenu->setItemChecked( 130, true ); | 1230 | configureToolBarMenu->setItemChecked( 130, true ); |
1220 | if (p-> mShowIconForward) | 1231 | if (p-> mShowIconForward) |
1221 | configureToolBarMenu->setItemChecked( 220, true ); | 1232 | configureToolBarMenu->setItemChecked( 220, true ); |
1222 | if (p-> mShowIconForwardFast) | 1233 | if (p-> mShowIconForwardFast) |
1223 | configureToolBarMenu->setItemChecked( 230, true ); | 1234 | configureToolBarMenu->setItemChecked( 230, true ); |
1224 | if (p-> mShowIconNextDays) | 1235 | if (p-> mShowIconNextDays) |
1225 | configureToolBarMenu->setItemChecked( 100, true ); | 1236 | configureToolBarMenu->setItemChecked( 100, true ); |
1226 | if (p-> mShowIconNext) | 1237 | if (p-> mShowIconNext) |
1227 | configureToolBarMenu->setItemChecked( 110, true ); | 1238 | configureToolBarMenu->setItemChecked( 110, true ); |
1228 | if (p-> mShowIconJournal) | 1239 | if (p-> mShowIconJournal) |
1229 | configureToolBarMenu->setItemChecked( 90, true ); | 1240 | configureToolBarMenu->setItemChecked( 90, true ); |
1230 | if (p-> mShowIconWhatsThis) | 1241 | if (p-> mShowIconWhatsThis) |
1231 | configureToolBarMenu->setItemChecked( 300, true ); | 1242 | configureToolBarMenu->setItemChecked( 300, true ); |
1232 | if (p-> mShowIconWeekNum) | 1243 | if (p-> mShowIconWeekNum) |
1233 | configureToolBarMenu->setItemChecked( 400, true ); | 1244 | configureToolBarMenu->setItemChecked( 400, true ); |
1234 | if (!p-> mShowIconStretch) { | 1245 | if (!p-> mShowIconStretch) { |
1235 | QLabel* dummy = new QLabel( iconToolBar ); | 1246 | QLabel* dummy = new QLabel( iconToolBar ); |
1236 | dummy->setBackgroundColor( iconToolBar->backgroundColor() ); | 1247 | dummy->setBackgroundColor( iconToolBar->backgroundColor() ); |
1237 | dummy->setMinimumWidth( 0 ); | 1248 | dummy->setMinimumWidth( 0 ); |
1238 | iconToolBar->setStretchableWidget ( dummy ) ; | 1249 | iconToolBar->setStretchableWidget ( dummy ) ; |
1239 | } | 1250 | } |
1240 | else { | 1251 | else { |
1241 | iconToolBar->setHorizontalStretchable (true ); | 1252 | iconToolBar->setHorizontalStretchable (true ); |
1242 | viewToolBar->setHorizontalStretchable (true ); | 1253 | viewToolBar->setHorizontalStretchable (true ); |
1243 | navigatorToolBar->setHorizontalStretchable (true ); | 1254 | navigatorToolBar->setHorizontalStretchable (true ); |
1244 | iconToolBar->setVerticalStretchable (true ); | 1255 | iconToolBar->setVerticalStretchable (true ); |
1245 | viewToolBar->setVerticalStretchable (true ); | 1256 | viewToolBar->setVerticalStretchable (true ); |
1246 | navigatorToolBar->setVerticalStretchable (true ); | 1257 | navigatorToolBar->setVerticalStretchable (true ); |
1247 | configureToolBarMenu->setItemChecked( 5, true ); | 1258 | configureToolBarMenu->setItemChecked( 5, true ); |
1248 | } | 1259 | } |
1249 | if (p-> mShowIconFilter) | 1260 | if (p-> mShowIconFilter) |
1250 | configureToolBarMenu->setItemChecked( 7, true ); | 1261 | configureToolBarMenu->setItemChecked( 7, true ); |
1251 | if (p-> mShowIconOnetoolbar) | 1262 | if (p-> mShowIconOnetoolbar) |
1252 | configureToolBarMenu->setItemChecked( 6, true ); | 1263 | configureToolBarMenu->setItemChecked( 6, true ); |
1253 | 1264 | ||
1254 | 1265 | ||
1255 | if ( filterMenubar ) | 1266 | if ( filterMenubar ) |
1256 | connect( mView->filterView(), SIGNAL( filterChanged() ), SLOT( updateFilterToolbar() ) ); | 1267 | connect( mView->filterView(), SIGNAL( filterChanged() ), SLOT( updateFilterToolbar() ) ); |
1257 | connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); | 1268 | connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); |
1258 | configureAgenda( p->mHourSize ); | 1269 | configureAgenda( p->mHourSize ); |
1259 | connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); | 1270 | connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); |
1260 | } | 1271 | } |
1261 | 1272 | ||
1262 | void MainWindow::exportToPhone( int mode ) | 1273 | void MainWindow::exportToPhone( int mode ) |
1263 | { | 1274 | { |
1264 | 1275 | ||
1265 | //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); | 1276 | //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); |
1266 | //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); | 1277 | //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); |
1267 | KOex2phonePrefs ex2phone; | 1278 | KOex2phonePrefs ex2phone; |
1268 | 1279 | ||
1269 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); | 1280 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); |
1270 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); | 1281 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); |
1271 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 1282 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
1272 | if ( mode == 1 ) | 1283 | if ( mode == 1 ) |
1273 | ex2phone.setCaption(i18n("Export complete calendar")); | 1284 | ex2phone.setCaption(i18n("Export complete calendar")); |
1274 | if ( mode == 2 ) | 1285 | if ( mode == 2 ) |
1275 | ex2phone.setCaption(i18n("Export filtered calendar")); | 1286 | ex2phone.setCaption(i18n("Export filtered calendar")); |
1276 | 1287 | ||
1277 | if ( !ex2phone.exec() ) { | 1288 | if ( !ex2phone.exec() ) { |
1278 | return; | 1289 | return; |
1279 | } | 1290 | } |
1280 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); | 1291 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); |
1281 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); | 1292 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); |
1282 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); | 1293 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); |
1283 | 1294 | ||
1284 | int inFuture = 0; | 1295 | int inFuture = 0; |
1285 | if ( ex2phone.mWriteBackFuture->isChecked() ) | 1296 | if ( ex2phone.mWriteBackFuture->isChecked() ) |
1286 | inFuture = ex2phone.mWriteBackFutureWeeks->value(); | 1297 | inFuture = ex2phone.mWriteBackFutureWeeks->value(); |
1287 | QPtrList<Incidence> delSel; | 1298 | QPtrList<Incidence> delSel; |
1288 | if ( mode == 1 ) | 1299 | if ( mode == 1 ) |
1289 | delSel = mCalendar->rawIncidences(); | 1300 | delSel = mCalendar->rawIncidences(); |
1290 | if ( mode == 2 ) | 1301 | if ( mode == 2 ) |
1291 | delSel = mCalendar->incidences(); | 1302 | delSel = mCalendar->incidences(); |
1292 | CalendarLocal* cal = new CalendarLocal(); | 1303 | CalendarLocal* cal = new CalendarLocal(); |
1293 | cal->setLocalTime(); | 1304 | cal->setLocalTime(); |
1294 | Incidence *incidence = delSel.first(); | 1305 | Incidence *incidence = delSel.first(); |
1295 | QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); | 1306 | QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); |
1296 | QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); | 1307 | QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); |
1297 | while ( incidence ) { | 1308 | while ( incidence ) { |
1298 | if ( incidence->type() != "Journal" ) { | 1309 | if ( incidence->type() != "Journal" ) { |
1299 | bool add = true; | 1310 | bool add = true; |
1300 | if ( inFuture ) { | 1311 | if ( inFuture ) { |
1301 | QDateTime dt; | 1312 | QDateTime dt; |
1302 | if ( incidence->type() == "Todo" ) { | 1313 | if ( incidence->type() == "Todo" ) { |
1303 | Todo * t = (Todo*)incidence; | 1314 | Todo * t = (Todo*)incidence; |
1304 | if ( t->hasDueDate() ) | 1315 | if ( t->hasDueDate() ) |
1305 | dt = t->dtDue(); | 1316 | dt = t->dtDue(); |
1306 | else | 1317 | else |
1307 | dt = cur.addSecs( 62 ); | 1318 | dt = cur.addSecs( 62 ); |
1308 | } | 1319 | } |
1309 | else { | 1320 | else { |
1310 | bool ok; | 1321 | bool ok; |
1311 | dt = incidence->getNextOccurence( cur, &ok ); | 1322 | dt = incidence->getNextOccurence( cur, &ok ); |
1312 | if ( !ok ) | 1323 | if ( !ok ) |
1313 | dt = cur.addSecs( -62 ); | 1324 | dt = cur.addSecs( -62 ); |
1314 | } | 1325 | } |
1315 | if ( dt < cur || dt > end ) { | 1326 | if ( dt < cur || dt > end ) { |
1316 | add = false; | 1327 | add = false; |
1317 | } | 1328 | } |
1318 | } | 1329 | } |
1319 | if ( add ) { | 1330 | if ( add ) { |
1320 | Incidence *in = incidence->clone(); | 1331 | Incidence *in = incidence->clone(); |
1321 | cal->addIncidence( in ); | 1332 | cal->addIncidence( in ); |
1322 | } | 1333 | } |
1323 | } | 1334 | } |
1324 | incidence = delSel.next(); | 1335 | incidence = delSel.next(); |
1325 | } | 1336 | } |
1326 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, | 1337 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, |
1327 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, | 1338 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, |
1328 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 1339 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
1329 | 1340 | ||
1330 | setCaption( i18n("Writing to phone...")); | 1341 | setCaption( i18n("Writing to phone...")); |
1331 | if ( PhoneFormat::writeToPhone( cal ) ) | 1342 | if ( PhoneFormat::writeToPhone( cal ) ) |
1332 | setCaption( i18n("Export to phone successful!")); | 1343 | setCaption( i18n("Export to phone successful!")); |
1333 | else | 1344 | else |
1334 | setCaption( i18n("Error exporting to phone!")); | 1345 | setCaption( i18n("Error exporting to phone!")); |
1335 | delete cal; | 1346 | delete cal; |
1336 | } | 1347 | } |
1337 | 1348 | ||
1338 | 1349 | ||
1339 | void MainWindow::setDefaultPreferences() | 1350 | void MainWindow::setDefaultPreferences() |
1340 | { | 1351 | { |
1341 | KOPrefs *p = KOPrefs::instance(); | 1352 | KOPrefs *p = KOPrefs::instance(); |
1342 | 1353 | ||
1343 | p->mCompactDialogs = true; | 1354 | p->mCompactDialogs = true; |
1344 | p->mConfirm = true; | 1355 | p->mConfirm = true; |
1345 | // p->mEnableQuickTodo = false; | 1356 | // p->mEnableQuickTodo = false; |
1346 | 1357 | ||
1347 | } | 1358 | } |
1348 | 1359 | ||
1349 | QString MainWindow::resourcePath() | 1360 | QString MainWindow::resourcePath() |
1350 | { | 1361 | { |
1351 | return KGlobal::iconLoader()->iconPath(); | 1362 | return KGlobal::iconLoader()->iconPath(); |
1352 | } | 1363 | } |
1353 | 1364 | ||
1354 | void MainWindow::displayText( QString text ,QString cap ) | 1365 | void MainWindow::displayText( QString text ,QString cap ) |
1355 | { | 1366 | { |
1356 | QDialog dia( this, "name", true ); ; | 1367 | QDialog dia( this, "name", true ); ; |
1357 | dia.setCaption( cap ); | 1368 | dia.setCaption( cap ); |
1358 | QVBoxLayout* lay = new QVBoxLayout( &dia ); | 1369 | QVBoxLayout* lay = new QVBoxLayout( &dia ); |
1359 | lay->setSpacing( 3 ); | 1370 | lay->setSpacing( 3 ); |
1360 | lay->setMargin( 3 ); | 1371 | lay->setMargin( 3 ); |
1361 | QTextBrowser tb ( &dia ); | 1372 | QTextBrowser tb ( &dia ); |
1362 | lay->addWidget( &tb ); | 1373 | lay->addWidget( &tb ); |
1363 | tb.setText( text ); | 1374 | tb.setText( text ); |
1364 | #ifdef DESKTOP_VERSION | 1375 | #ifdef DESKTOP_VERSION |
1365 | dia.resize( 640, 480); | 1376 | dia.resize( 640, 480); |
1366 | #else | 1377 | #else |
1367 | dia.showMaximized(); | 1378 | dia.showMaximized(); |
1368 | #endif | 1379 | #endif |
1369 | dia.exec(); | 1380 | dia.exec(); |
1370 | } | 1381 | } |
1371 | 1382 | ||
1372 | void MainWindow::features() | 1383 | void MainWindow::features() |
1373 | { | 1384 | { |
1374 | 1385 | ||
1375 | KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); | 1386 | KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); |
1376 | } | 1387 | } |
1377 | 1388 | ||
1378 | void MainWindow::usertrans() | 1389 | void MainWindow::usertrans() |
1379 | { | 1390 | { |
1380 | 1391 | ||
1381 | KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); | 1392 | KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); |
1382 | } | 1393 | } |
1383 | 1394 | ||
1384 | void MainWindow::kdesynchowto() | 1395 | void MainWindow::kdesynchowto() |
1385 | { | 1396 | { |
1386 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); | 1397 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); |
1387 | } | 1398 | } |
1388 | void MainWindow::multisynchowto() | 1399 | void MainWindow::multisynchowto() |
1389 | { | 1400 | { |
1390 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); | 1401 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); |
1391 | } | 1402 | } |
1392 | void MainWindow::synchowto() | 1403 | void MainWindow::synchowto() |
1393 | { | 1404 | { |
1394 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); | 1405 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); |
1395 | } | 1406 | } |
1396 | void MainWindow::faq() | 1407 | void MainWindow::faq() |
1397 | { | 1408 | { |
1398 | KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); | 1409 | KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); |
1399 | 1410 | ||
1400 | } | 1411 | } |
1401 | void MainWindow::whatsNew() | 1412 | void MainWindow::whatsNew() |
1402 | { | 1413 | { |
1403 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); | 1414 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); |
1404 | 1415 | ||
1405 | } | 1416 | } |
1406 | void MainWindow::licence() | 1417 | void MainWindow::licence() |
1407 | { | 1418 | { |
1408 | KApplication::showLicence(); | 1419 | KApplication::showLicence(); |
1409 | 1420 | ||
1410 | } | 1421 | } |
1411 | void MainWindow::about() | 1422 | void MainWindow::about() |
1412 | { | 1423 | { |
1413 | QString version; | 1424 | QString version; |
1414 | #include <../version> | 1425 | #include <../version> |
1415 | QMessageBox::about( this, i18n("About KOrganizer/Pi"), | 1426 | QMessageBox::about( this, i18n("About KOrganizer/Pi"), |
1416 | i18n("KOrganizer/Platform-independent\n") + | 1427 | i18n("KOrganizer/Platform-independent\n") + |
1417 | "(KO/Pi) " + version + " - " + | 1428 | "(KO/Pi) " + version + " - " + |
1418 | 1429 | ||
1419 | #ifdef DESKTOP_VERSION | 1430 | #ifdef DESKTOP_VERSION |
1420 | i18n("Desktop Edition\n") + | 1431 | i18n("Desktop Edition\n") + |
1421 | #else | 1432 | #else |
1422 | i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") + | 1433 | i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") + |
1423 | #endif | 1434 | #endif |
1424 | i18n("(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.info --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!") ); | 1435 | i18n("(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.info --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!") ); |
1425 | } | 1436 | } |
1426 | void MainWindow::keyBindings() | 1437 | void MainWindow::keyBindings() |
1427 | { | 1438 | { |
1428 | QString cap = i18n("KO/Pi Keys + Colors"); | 1439 | QString cap = i18n("KO/Pi Keys + Colors"); |
1429 | QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + | 1440 | QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + |
1430 | i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ | 1441 | i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ |
1431 | i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + | 1442 | i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + |
1432 | i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ | 1443 | i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ |
1433 | i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ | 1444 | i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ |
1434 | i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ | 1445 | i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ |
1435 | i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ | 1446 | i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ |
1436 | i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+ | 1447 | i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+ |
1437 | i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ | 1448 | i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ |
1438 | i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ | 1449 | i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ |
1439 | i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ | 1450 | i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ |
1440 | i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+ | 1451 | i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+ |
1441 | i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ | 1452 | i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ |
1442 | i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ | 1453 | i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ |
1443 | i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+ | 1454 | i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+ |
1444 | i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ | 1455 | i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ |
1445 | i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ | 1456 | i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ |
1446 | i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ | 1457 | i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ |
1447 | i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ | 1458 | i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ |
1448 | i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ | 1459 | i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ |
1449 | i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ | 1460 | i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ |
1450 | i18n("<p><h3>In agenda view:</h3></p>\n") + | 1461 | i18n("<p><h3>In agenda view:</h3></p>\n") + |
1451 | i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ | 1462 | i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ |
1452 | i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ | 1463 | i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ |
1453 | i18n("<p><h3>In todo view:</h3></p>\n") + | 1464 | i18n("<p><h3>In todo view:</h3></p>\n") + |
1454 | i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ | 1465 | i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ |
1455 | i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ | 1466 | i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ |
1456 | i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ | 1467 | i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ |
1457 | i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ | 1468 | i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ |
1458 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1469 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1459 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ | 1470 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ |
1460 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ | 1471 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ |
1461 | i18n("<p><h3>In list view:</h3></p>\n") + | 1472 | i18n("<p><h3>In list view:</h3></p>\n") + |
1462 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1473 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1463 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ | 1474 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ |
1464 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ | 1475 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ |
1465 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ | 1476 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ |
1466 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ | 1477 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ |
1467 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ | 1478 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ |
1468 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + | 1479 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + |
1469 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ | 1480 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ |
1470 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ | 1481 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ |
1471 | i18n("<p><b>E</b>: Edit item</p>\n") + | 1482 | i18n("<p><b>E</b>: Edit item</p>\n") + |
1472 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + | 1483 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + |
1473 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + | 1484 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + |
1474 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ | 1485 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ |
1475 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ | 1486 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ |
1476 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ | 1487 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ |
1477 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ | 1488 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ |
1478 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ | 1489 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ |
1479 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + | 1490 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + |
1480 | i18n("<p><b>White</b>: Item readonly</p>\n"); | 1491 | i18n("<p><b>White</b>: Item readonly</p>\n"); |
1481 | displayText( text, cap); | 1492 | displayText( text, cap); |
1482 | } | 1493 | } |
1483 | void MainWindow::aboutAutoSaving() | 1494 | void MainWindow::aboutAutoSaving() |
1484 | { | 1495 | { |
1485 | 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"); | 1496 | 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"); |
1486 | 1497 | ||
1487 | KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); | 1498 | KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); |
1488 | 1499 | ||
1489 | } | 1500 | } |
1490 | void MainWindow::aboutKnownBugs() | 1501 | void MainWindow::aboutKnownBugs() |
1491 | { | 1502 | { |
1492 | QMessageBox* msg; | 1503 | QMessageBox* msg; |
1493 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), | 1504 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), |
1494 | 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")+ | 1505 | 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")+ |
1495 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ | 1506 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ |
1496 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") + | 1507 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") + |
1497 | i18n("\nor report them in the bugtracker on\n") + | 1508 | i18n("\nor report them in the bugtracker on\n") + |
1498 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), | 1509 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), |
1499 | QMessageBox::NoIcon, | 1510 | QMessageBox::NoIcon, |
1500 | QMessageBox::Ok, | 1511 | QMessageBox::Ok, |
1501 | QMessageBox::NoButton, | 1512 | QMessageBox::NoButton, |
1502 | QMessageBox::NoButton); | 1513 | QMessageBox::NoButton); |
1503 | msg->exec(); | 1514 | msg->exec(); |
1504 | delete msg; | 1515 | delete msg; |
1505 | 1516 | ||
1506 | } | 1517 | } |
1507 | 1518 | ||
1508 | QString MainWindow::defaultFileName() | 1519 | QString MainWindow::defaultFileName() |
1509 | { | 1520 | { |
1510 | return locateLocal( "data", "korganizer/mycalendar.ics" ); | 1521 | return locateLocal( "data", "korganizer/mycalendar.ics" ); |
1511 | } | 1522 | } |
1512 | QString MainWindow::syncFileName() | 1523 | QString MainWindow::syncFileName() |
1513 | { | 1524 | { |
1514 | #ifdef DESKTOP_VERSION | 1525 | #ifdef DESKTOP_VERSION |
1515 | return locateLocal( "tmp", "synccalendar.ics" ); | 1526 | return locateLocal( "tmp", "synccalendar.ics" ); |
1516 | #else | 1527 | #else |
1517 | return QString( "/tmp/synccalendar.ics" ); | 1528 | return QString( "/tmp/synccalendar.ics" ); |
1518 | #endif | 1529 | #endif |
1519 | } | 1530 | } |
1520 | #include "koglobals.h" | 1531 | #include "koglobals.h" |
1521 | #include <kcalendarsystem.h> | 1532 | #include <kcalendarsystem.h> |
1522 | void MainWindow::updateWeek(QDate seda) | 1533 | void MainWindow::updateWeek(QDate seda) |
1523 | { | 1534 | { |
1524 | int weekNum = KGlobal::locale()->weekNum ( seda ); | 1535 | int weekNum = KGlobal::locale()->weekNum ( seda ); |
1525 | mWeekPixmap.fill( mWeekBgColor ); | 1536 | mWeekPixmap.fill( mWeekBgColor ); |
1526 | QPainter p ( &mWeekPixmap ); | 1537 | QPainter p ( &mWeekPixmap ); |
1527 | p.setFont( mWeekFont ); | 1538 | p.setFont( mWeekFont ); |
1528 | p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); | 1539 | p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); |
1529 | p.end(); | 1540 | p.end(); |
1530 | QIconSet icon3 ( mWeekPixmap ); | 1541 | QIconSet icon3 ( mWeekPixmap ); |
1531 | mWeekAction->setIconSet ( icon3 ); | 1542 | mWeekAction->setIconSet ( icon3 ); |
1532 | 1543 | ||
1533 | } | 1544 | } |
1534 | void MainWindow::updateWeekNum(const DateList &selectedDates) | 1545 | void MainWindow::updateWeekNum(const DateList &selectedDates) |
1535 | { | 1546 | { |
1536 | updateWeek( selectedDates.first() ); | 1547 | updateWeek( selectedDates.first() ); |
1537 | } | 1548 | } |
1538 | void MainWindow::processIncidenceSelection( Incidence *incidence ) | 1549 | void MainWindow::processIncidenceSelection( Incidence *incidence ) |
1539 | { | 1550 | { |
1540 | 1551 | ||
1541 | if ( !incidence ) { | 1552 | if ( !incidence ) { |
1542 | enableIncidenceActions( false ); | 1553 | enableIncidenceActions( false ); |
1543 | 1554 | ||
1544 | mNewSubTodoAction->setEnabled( false ); | 1555 | mNewSubTodoAction->setEnabled( false ); |
1545 | setCaptionToDates(); | 1556 | setCaptionToDates(); |
1546 | return; | 1557 | return; |
1547 | 1558 | ||
1548 | } | 1559 | } |
1549 | 1560 | ||
1550 | //KGlobal::locale()->formatDateTime(nextA, true); | 1561 | //KGlobal::locale()->formatDateTime(nextA, true); |
1551 | QString startString = ""; | 1562 | QString startString = ""; |
1552 | if ( incidence->type() != "Todo" ) { | 1563 | if ( incidence->type() != "Todo" ) { |
1553 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { | 1564 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { |
1554 | if ( incidence->doesFloat() ) { | 1565 | if ( incidence->doesFloat() ) { |
1555 | startString += ": "+incidence->dtStartDateStr( true ); | 1566 | startString += ": "+incidence->dtStartDateStr( true ); |
1556 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); | 1567 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); |
1557 | 1568 | ||
1558 | } else { | 1569 | } else { |
1559 | startString = ": "+incidence->dtStartStr(true); | 1570 | startString = ": "+incidence->dtStartStr(true); |
1560 | startString += " --- "+((Event*)incidence)->dtEndStr(true); | 1571 | startString += " --- "+((Event*)incidence)->dtEndStr(true); |
1561 | 1572 | ||
1562 | } | 1573 | } |
1563 | 1574 | ||
1564 | } else { | 1575 | } else { |
1565 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) | 1576 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) |
1566 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ | 1577 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ |
1567 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); | 1578 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); |
1568 | if ( incidence->categories().contains( i18n("Birthday") ) || incidence->categories().contains( i18n("Anniversary") ) ) { | 1579 | if ( incidence->categories().contains( i18n("Birthday") ) || incidence->categories().contains( i18n("Anniversary") ) ) { |
1569 | bool ok; | 1580 | bool ok; |
1570 | QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); | 1581 | QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); |
1571 | if ( ok ) { | 1582 | if ( ok ) { |
1572 | int years = noc.date().year() - incidence->dtStart().date().year(); | 1583 | int years = noc.date().year() - incidence->dtStart().date().year(); |
1573 | startString += i18n(" (%1 y.)"). arg( years ); | 1584 | startString += i18n(" (%1 y.)"). arg( years ); |
1574 | } | 1585 | } |
1575 | } | 1586 | } |
1576 | else | 1587 | else |
1577 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); | 1588 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); |
1578 | } | 1589 | } |
1579 | 1590 | ||
1580 | } | 1591 | } |
1581 | else | 1592 | else |
1582 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); | 1593 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); |
1583 | if ( !incidence->location().isEmpty() ) | 1594 | if ( !incidence->location().isEmpty() ) |
1584 | startString += " (" +incidence->location()+")"; | 1595 | startString += " (" +incidence->location()+")"; |
1585 | setCaption( incidence->summary()+startString); | 1596 | setCaption( incidence->summary()+startString); |
1586 | 1597 | ||
1587 | enableIncidenceActions( true ); | 1598 | enableIncidenceActions( true ); |
1588 | 1599 | ||
1589 | if ( incidence->type() == "Event" ) { | 1600 | if ( incidence->type() == "Event" ) { |
1590 | mShowAction->setText( i18n("Show Event...") ); | 1601 | mShowAction->setText( i18n("Show Event...") ); |
1591 | mEditAction->setText( i18n("Edit Event...") ); | 1602 | mEditAction->setText( i18n("Edit Event...") ); |
1592 | mDeleteAction->setText( i18n("Delete Event...") ); | 1603 | mDeleteAction->setText( i18n("Delete Event...") ); |
1593 | 1604 | ||
1594 | mNewSubTodoAction->setEnabled( false ); | 1605 | mNewSubTodoAction->setEnabled( false ); |
1595 | } else if ( incidence->type() == "Todo" ) { | 1606 | } else if ( incidence->type() == "Todo" ) { |
1596 | mShowAction->setText( i18n("Show Todo...") ); | 1607 | mShowAction->setText( i18n("Show Todo...") ); |
1597 | mEditAction->setText( i18n("Edit Todo...") ); | 1608 | mEditAction->setText( i18n("Edit Todo...") ); |
1598 | mDeleteAction->setText( i18n("Delete Todo...") ); | 1609 | mDeleteAction->setText( i18n("Delete Todo...") ); |
1599 | 1610 | ||
1600 | mNewSubTodoAction->setEnabled( true ); | 1611 | mNewSubTodoAction->setEnabled( true ); |
1601 | } else { | 1612 | } else { |
1602 | mShowAction->setText( i18n("Show...") ); | 1613 | mShowAction->setText( i18n("Show...") ); |
1603 | mShowAction->setText( i18n("Edit...") ); | 1614 | mShowAction->setText( i18n("Edit...") ); |
1604 | mShowAction->setText( i18n("Delete...") ); | 1615 | mShowAction->setText( i18n("Delete...") ); |
1605 | 1616 | ||
1606 | mNewSubTodoAction->setEnabled( false ); | 1617 | mNewSubTodoAction->setEnabled( false ); |
1607 | } | 1618 | } |
1608 | } | 1619 | } |
1609 | 1620 | ||
1610 | void MainWindow::enableIncidenceActions( bool enabled ) | 1621 | void MainWindow::enableIncidenceActions( bool enabled ) |
1611 | { | 1622 | { |
1612 | mShowAction->setEnabled( enabled ); | 1623 | mShowAction->setEnabled( enabled ); |
1613 | mEditAction->setEnabled( enabled ); | 1624 | mEditAction->setEnabled( enabled ); |
1614 | mDeleteAction->setEnabled( enabled ); | 1625 | mDeleteAction->setEnabled( enabled ); |
1615 | 1626 | ||
1616 | mCloneAction->setEnabled( enabled ); | 1627 | mCloneAction->setEnabled( enabled ); |
1617 | mMoveAction->setEnabled( enabled ); | 1628 | mMoveAction->setEnabled( enabled ); |
1618 | mBeamAction->setEnabled( enabled ); | 1629 | mBeamAction->setEnabled( enabled ); |
1619 | mCancelAction->setEnabled( enabled ); | 1630 | mCancelAction->setEnabled( enabled ); |
1620 | } | 1631 | } |
1621 | 1632 | ||
1622 | void MainWindow::importOL() | 1633 | void MainWindow::importOL() |
1623 | { | 1634 | { |
1624 | #ifdef _OL_IMPORT_ | 1635 | #ifdef _OL_IMPORT_ |
1625 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); | 1636 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); |
1626 | id->exec(); | 1637 | id->exec(); |
1627 | delete id; | 1638 | delete id; |
1628 | mView->updateView(); | 1639 | mView->updateView(); |
1629 | #endif | 1640 | #endif |
1630 | } | 1641 | } |
1631 | void MainWindow::importBday() | 1642 | void MainWindow::importBday() |
1632 | { | 1643 | { |
1633 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1644 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1634 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), | 1645 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), |
1635 | i18n("Import!"), i18n("Cancel"), 0, | 1646 | i18n("Import!"), i18n("Cancel"), 0, |
1636 | 0, 1 ); | 1647 | 0, 1 ); |
1637 | if ( result == 0 ) { | 1648 | if ( result == 0 ) { |
1638 | mView->importBday(); | 1649 | mView->importBday(); |
1639 | 1650 | ||
1640 | } | 1651 | } |
1641 | 1652 | ||
1642 | 1653 | ||
1643 | } | 1654 | } |
1644 | void MainWindow::importQtopia() | 1655 | void MainWindow::importQtopia() |
1645 | { | 1656 | { |
1646 | //#ifndef DESKTOP_VERSION | 1657 | //#ifndef DESKTOP_VERSION |
1647 | QString mess = i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"); | 1658 | QString mess = i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"); |
1648 | #ifdef DESKTOP_VERSION | 1659 | #ifdef DESKTOP_VERSION |
1649 | mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml"); | 1660 | mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml"); |
1650 | #endif | 1661 | #endif |
1651 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, | 1662 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, |
1652 | i18n("Import!"), i18n("Cancel"), 0, | 1663 | i18n("Import!"), i18n("Cancel"), 0, |
1653 | 0, 1 ); | 1664 | 0, 1 ); |
1654 | if ( result == 0 ) { | 1665 | if ( result == 0 ) { |
1655 | #ifndef DESKTOP_VERSION | 1666 | #ifndef DESKTOP_VERSION |
1656 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); | 1667 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); |
1657 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); | 1668 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); |
1658 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; | 1669 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; |
1659 | #else | 1670 | #else |
1660 | QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml"; | 1671 | QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml"; |
1661 | QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml"; | 1672 | QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml"; |
1662 | QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml"; | 1673 | QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml"; |
1663 | #endif | 1674 | #endif |
1664 | mView->importQtopia( categories, datebook, todolist ); | 1675 | mView->importQtopia( categories, datebook, todolist ); |
1665 | } | 1676 | } |
1666 | #if 0 | 1677 | #if 0 |
1667 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1678 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1668 | i18n("Not supported \non desktop!\n"), | 1679 | i18n("Not supported \non desktop!\n"), |
1669 | i18n("Ok"), i18n("Cancel"), 0, | 1680 | i18n("Ok"), i18n("Cancel"), 0, |
1670 | 0, 1 ); | 1681 | 0, 1 ); |
1671 | 1682 | ||
1672 | #endif | 1683 | #endif |
1673 | } | 1684 | } |
1674 | 1685 | ||
1675 | void MainWindow::saveOnClose() | 1686 | void MainWindow::saveOnClose() |
1676 | { | 1687 | { |
1677 | KOPrefs *p = KOPrefs::instance(); | 1688 | KOPrefs *p = KOPrefs::instance(); |
1678 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); | 1689 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); |
1679 | p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal ); | 1690 | p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal ); |
1680 | p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal ); | 1691 | p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal ); |
1681 | if ( filterToolBar ) { | 1692 | if ( filterToolBar ) { |
1682 | p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal ); | 1693 | p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal ); |
1683 | } | 1694 | } |
1684 | #ifdef DESKTOP_VERSION | 1695 | #ifdef DESKTOP_VERSION |
1685 | 1696 | ||
1686 | QPoint myP; | 1697 | QPoint myP; |
1687 | myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1698 | myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1688 | if ( p->mToolBarHor ) | 1699 | if ( p->mToolBarHor ) |
1689 | p->mToolBarUp = myP.y() > height()/2; | 1700 | p->mToolBarUp = myP.y() > height()/2; |
1690 | else | 1701 | else |
1691 | p->mToolBarUp = myP.x() > width()/2; | 1702 | p->mToolBarUp = myP.x() > width()/2; |
1692 | myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1703 | myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1693 | if ( p->mToolBarHorV ) | 1704 | if ( p->mToolBarHorV ) |
1694 | p->mToolBarUpV = myP.y() > height()/2; | 1705 | p->mToolBarUpV = myP.y() > height()/2; |
1695 | else | 1706 | else |
1696 | p->mToolBarUpV = myP.x() > width()/2 ; | 1707 | p->mToolBarUpV = myP.x() > width()/2 ; |
1697 | myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1708 | myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1698 | if ( p->mToolBarHorN ) | 1709 | if ( p->mToolBarHorN ) |
1699 | p->mToolBarUpN = myP.y() > height()/2; | 1710 | p->mToolBarUpN = myP.y() > height()/2; |
1700 | else | 1711 | else |
1701 | p->mToolBarUpN = myP.x() > width()/2 ; | 1712 | p->mToolBarUpN = myP.x() > width()/2 ; |
1702 | if ( filterToolBar ) { | 1713 | if ( filterToolBar ) { |
1703 | myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1714 | myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1704 | if ( p->mToolBarHorF ) | 1715 | if ( p->mToolBarHorF ) |
1705 | p->mToolBarUpF = myP.y() > height()/2; | 1716 | p->mToolBarUpF = myP.y() > height()/2; |
1706 | else | 1717 | else |
1707 | p->mToolBarUpF = myP.x() > width()/2 ; | 1718 | p->mToolBarUpF = myP.x() > width()/2 ; |
1708 | } | 1719 | } |
1709 | #else | 1720 | #else |
1710 | if ( p->mToolBarHor ) | 1721 | if ( p->mToolBarHor ) |
1711 | p->mToolBarUp = iconToolBar->y() > height()/2; | 1722 | p->mToolBarUp = iconToolBar->y() > height()/2; |
1712 | else | 1723 | else |
1713 | p->mToolBarUp = iconToolBar->x() > width()/2; | 1724 | p->mToolBarUp = iconToolBar->x() > width()/2; |
1714 | if ( p->mToolBarHorV ) | 1725 | if ( p->mToolBarHorV ) |
1715 | p->mToolBarUpV = viewToolBar->y() > height()/2; | 1726 | p->mToolBarUpV = viewToolBar->y() > height()/2; |
1716 | else | 1727 | else |
1717 | p->mToolBarUpV = viewToolBar->x() > width()/2 ; | 1728 | p->mToolBarUpV = viewToolBar->x() > width()/2 ; |
1718 | 1729 | ||
1719 | if ( p->mToolBarHorN ) | 1730 | if ( p->mToolBarHorN ) |
1720 | p->mToolBarUpN = navigatorToolBar->y() > height()/2; | 1731 | p->mToolBarUpN = navigatorToolBar->y() > height()/2; |
1721 | else | 1732 | else |
1722 | p->mToolBarUpN = navigatorToolBar->x() > width()/2 ; | 1733 | p->mToolBarUpN = navigatorToolBar->x() > width()/2 ; |
1723 | if ( filterToolBar ) { | 1734 | if ( filterToolBar ) { |
1724 | if ( p->mToolBarHorF ) | 1735 | if ( p->mToolBarHorF ) |
1725 | p->mToolBarUpF = filterToolBar->y() > height()/2; | 1736 | p->mToolBarUpF = filterToolBar->y() > height()/2; |
1726 | else | 1737 | else |
1727 | p->mToolBarUpF = filterToolBar->x() > width()/2 ; | 1738 | p->mToolBarUpF = filterToolBar->x() > width()/2 ; |
1728 | } | 1739 | } |
1729 | #endif | 1740 | #endif |
1730 | 1741 | ||
1731 | 1742 | ||
1732 | mView->writeSettings(); | 1743 | mView->writeSettings(); |
1733 | if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) | 1744 | if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) |
1734 | save(); | 1745 | save(); |
1735 | } | 1746 | } |
1736 | void MainWindow::slotModifiedChanged( bool changed ) | 1747 | void MainWindow::slotModifiedChanged( bool changed ) |
1737 | { | 1748 | { |
1738 | if ( mBlockAtStartup ) | 1749 | if ( mBlockAtStartup ) |
1739 | return; | 1750 | return; |
1740 | 1751 | ||
1741 | int msec; | 1752 | int msec; |
1742 | // we store the changes after 1 minute, | 1753 | // we store the changes after 1 minute, |
1743 | // and for safety reasons after 10 minutes again | 1754 | // and for safety reasons after 10 minutes again |
1744 | if ( !mSyncManager->blockSave() ) | 1755 | if ( !mSyncManager->blockSave() ) |
1745 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; | 1756 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; |
1746 | else | 1757 | else |
1747 | msec = 1000 * 600; | 1758 | msec = 1000 * 600; |
1748 | mSaveTimer.start( msec, true ); // 1 minute | 1759 | mSaveTimer.start( msec, true ); // 1 minute |
1749 | qDebug("KO: Saving File in %d secs!", msec/1000); | 1760 | qDebug("KO: Saving File in %d secs!", msec/1000); |
1750 | mCalendarModifiedFlag = true; | 1761 | mCalendarModifiedFlag = true; |
1751 | } | 1762 | } |
1752 | void MainWindow::saveStopTimer() | 1763 | void MainWindow::saveStopTimer() |
1753 | { | 1764 | { |
1754 | mSaveTimer.stop(); | 1765 | mSaveTimer.stop(); |
1755 | if (mSaveTimer.isActive() ) | 1766 | if (mSaveTimer.isActive() ) |
1756 | qDebug("ti active "); | 1767 | qDebug("ti active "); |
1757 | else | 1768 | else |
1758 | qDebug("KO: Save timer stopped"); | 1769 | qDebug("KO: Save timer stopped"); |
1759 | } | 1770 | } |
1760 | void MainWindow::save() | 1771 | void MainWindow::save() |
1761 | { | 1772 | { |
1762 | if ( !mCalendarModifiedFlag ) { | 1773 | if ( !mCalendarModifiedFlag ) { |
1763 | qDebug("KO: Calendar not modified. Nothing saved."); | 1774 | qDebug("KO: Calendar not modified. Nothing saved."); |
1764 | return; | 1775 | return; |
1765 | } | 1776 | } |
1766 | if ( mSyncManager->blockSave() ) | 1777 | if ( mSyncManager->blockSave() ) |
1767 | return; | 1778 | return; |
1768 | mSyncManager->setBlockSave(true); | 1779 | mSyncManager->setBlockSave(true); |
1769 | if ( mView->checkFileVersion( defaultFileName()) ) { | 1780 | if ( mView->checkFileVersion( defaultFileName()) ) { |
1770 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 1781 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
1771 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); | 1782 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); |
1772 | qDebug("KO: Start saving data to file!"); | 1783 | qDebug("KO: Start saving data to file!"); |
1773 | mView->saveCalendar( defaultFileName() ); | 1784 | mView->saveCalendar( defaultFileName() ); |
1774 | mCalendarModifiedFlag = false; | 1785 | mCalendarModifiedFlag = false; |
1775 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 1786 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
1776 | qDebug("KO: Needed %d ms for saving.",msNeeded ); | 1787 | qDebug("KO: Needed %d ms for saving.",msNeeded ); |
1777 | QString savemes; | 1788 | QString savemes; |
1778 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); | 1789 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); |
1779 | setCaption(savemes); | 1790 | setCaption(savemes); |
1780 | } else | 1791 | } else |
1781 | setCaption(i18n("Saving cancelled!")); | 1792 | setCaption(i18n("Saving cancelled!")); |
1782 | mSyncManager->setBlockSave( false ); | 1793 | mSyncManager->setBlockSave( false ); |
1783 | } | 1794 | } |
1784 | 1795 | ||
1785 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) | 1796 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) |
1786 | { | 1797 | { |
1787 | if ( !e->isAutoRepeat() ) { | 1798 | if ( !e->isAutoRepeat() ) { |
1788 | mFlagKeyPressed = false; | 1799 | mFlagKeyPressed = false; |
1789 | } | 1800 | } |
1790 | } | 1801 | } |
1791 | void MainWindow::keyPressEvent ( QKeyEvent * e ) | 1802 | void MainWindow::keyPressEvent ( QKeyEvent * e ) |
1792 | { | 1803 | { |
1793 | qApp->processEvents(); | 1804 | qApp->processEvents(); |
1794 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { | 1805 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { |
1795 | e->ignore(); | 1806 | e->ignore(); |
1796 | // qDebug(" ignore %d",e->isAutoRepeat() ); | 1807 | // qDebug(" ignore %d",e->isAutoRepeat() ); |
1797 | return; | 1808 | return; |
1798 | } | 1809 | } |
1799 | if (! e->isAutoRepeat() ) | 1810 | if (! e->isAutoRepeat() ) |
1800 | mFlagKeyPressed = true; | 1811 | mFlagKeyPressed = true; |
1801 | KOPrefs *p = KOPrefs::instance(); | 1812 | KOPrefs *p = KOPrefs::instance(); |
1802 | bool showSelectedDates = false; | 1813 | bool showSelectedDates = false; |
1803 | int size; | 1814 | int size; |
1804 | int pro = 0; | 1815 | int pro = 0; |
1805 | //qDebug("MainWindow::keyPressEvent "); | 1816 | //qDebug("MainWindow::keyPressEvent "); |
1806 | switch ( e->key() ) { | 1817 | switch ( e->key() ) { |
1807 | case Qt::Key_Right: | 1818 | case Qt::Key_Right: |
1808 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 1819 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
1809 | mView->goNextMonth(); | 1820 | mView->goNextMonth(); |
1810 | else | 1821 | else |
1811 | mView->goNext(); | 1822 | mView->goNext(); |
1812 | showSelectedDates = true; | 1823 | showSelectedDates = true; |
1813 | break; | 1824 | break; |
1814 | case Qt::Key_Left: | 1825 | case Qt::Key_Left: |
1815 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1826 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1816 | mView->goPreviousMonth(); | 1827 | mView->goPreviousMonth(); |
1817 | else | 1828 | else |
1818 | mView->goPrevious(); | 1829 | mView->goPrevious(); |
1819 | showSelectedDates = true; | 1830 | showSelectedDates = true; |
1820 | break; | 1831 | break; |
1821 | case Qt::Key_Down: | 1832 | case Qt::Key_Down: |
1822 | mView->viewManager()->agendaView()->scrollOneHourDown(); | 1833 | mView->viewManager()->agendaView()->scrollOneHourDown(); |
1823 | break; | 1834 | break; |
1824 | case Qt::Key_Up: | 1835 | case Qt::Key_Up: |
1825 | mView->viewManager()->agendaView()->scrollOneHourUp(); | 1836 | mView->viewManager()->agendaView()->scrollOneHourUp(); |
1826 | break; | 1837 | break; |
1827 | case Qt::Key_K: | 1838 | case Qt::Key_K: |
1828 | mView->viewManager()->showMonthViewWeek(); | 1839 | mView->viewManager()->showMonthViewWeek(); |
1829 | break; | 1840 | break; |
1830 | case Qt::Key_I: | 1841 | case Qt::Key_I: |
1831 | mView->showIncidence(); | 1842 | mView->showIncidence(); |
1832 | break; | 1843 | break; |
1833 | case Qt::Key_Delete: | 1844 | case Qt::Key_Delete: |
1834 | case Qt::Key_Backspace: | 1845 | case Qt::Key_Backspace: |
1835 | mView->deleteIncidence(); | 1846 | mView->deleteIncidence(); |
1836 | break; | 1847 | break; |
1837 | case Qt::Key_D: | 1848 | case Qt::Key_D: |
1838 | mView->viewManager()->showDayView(); | 1849 | mView->viewManager()->showDayView(); |
1839 | showSelectedDates = true; | 1850 | showSelectedDates = true; |
1840 | break; | 1851 | break; |
1841 | case Qt::Key_O: | 1852 | case Qt::Key_O: |
1842 | mView->toggleFilerEnabled( ); | 1853 | mView->toggleFilerEnabled( ); |
1843 | break; | 1854 | break; |
1844 | case Qt::Key_0: | 1855 | case Qt::Key_0: |
1845 | case Qt::Key_1: | 1856 | case Qt::Key_1: |
1846 | case Qt::Key_2: | 1857 | case Qt::Key_2: |
1847 | case Qt::Key_3: | 1858 | case Qt::Key_3: |
1848 | case Qt::Key_4: | 1859 | case Qt::Key_4: |
1849 | case Qt::Key_5: | 1860 | case Qt::Key_5: |
1850 | case Qt::Key_6: | 1861 | case Qt::Key_6: |
1851 | case Qt::Key_7: | 1862 | case Qt::Key_7: |
1852 | case Qt::Key_8: | 1863 | case Qt::Key_8: |
1853 | case Qt::Key_9: | 1864 | case Qt::Key_9: |
1854 | pro = e->key()-48; | 1865 | pro = e->key()-48; |
1855 | if ( pro == 0 ) | 1866 | if ( pro == 0 ) |
1856 | pro = 10; | 1867 | pro = 10; |
1857 | if ( e->state() == Qt::ControlButton) | 1868 | if ( e->state() == Qt::ControlButton) |
1858 | pro += 10; | 1869 | pro += 10; |
1859 | break; | 1870 | break; |
1860 | case Qt::Key_M: | 1871 | case Qt::Key_M: |
1861 | mView->viewManager()->showMonthView(); | 1872 | mView->viewManager()->showMonthView(); |
1862 | showSelectedDates = true; | 1873 | showSelectedDates = true; |
1863 | break; | 1874 | break; |
1864 | case Qt::Key_Insert: | 1875 | case Qt::Key_Insert: |
1865 | mView->newEvent(); | 1876 | mView->newEvent(); |
1866 | break; | 1877 | break; |
1867 | case Qt::Key_S : | 1878 | case Qt::Key_S : |
1868 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 1879 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
1869 | mView->newSubTodo(); | 1880 | mView->newSubTodo(); |
1870 | else | 1881 | else |
1871 | mView->dialogManager()->showSearchDialog(); | 1882 | mView->dialogManager()->showSearchDialog(); |
1872 | break; | 1883 | break; |
1873 | case Qt::Key_Y : | 1884 | case Qt::Key_Y : |
1874 | case Qt::Key_Z : | 1885 | case Qt::Key_Z : |
1875 | mView->viewManager()->showWorkWeekView(); | 1886 | mView->viewManager()->showWorkWeekView(); |
1876 | showSelectedDates = true; | 1887 | showSelectedDates = true; |
1877 | break; | 1888 | break; |
1878 | case Qt::Key_U : | 1889 | case Qt::Key_U : |
1879 | mView->viewManager()->showWeekView(); | 1890 | mView->viewManager()->showWeekView(); |
1880 | showSelectedDates = true; | 1891 | showSelectedDates = true; |
1881 | break; | 1892 | break; |
1882 | case Qt::Key_H : | 1893 | case Qt::Key_H : |
1883 | keyBindings(); | 1894 | keyBindings(); |
1884 | break; | 1895 | break; |
1885 | case Qt::Key_W: | 1896 | case Qt::Key_W: |
1886 | mView->viewManager()->showWhatsNextView(); | 1897 | mView->viewManager()->showWhatsNextView(); |
1887 | break; | 1898 | break; |
1888 | case Qt::Key_L: | 1899 | case Qt::Key_L: |
1889 | mView->viewManager()->showListView(); | 1900 | mView->viewManager()->showListView(); |
1890 | break; | 1901 | break; |
1891 | case Qt::Key_N: | 1902 | case Qt::Key_N: |
1892 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 1903 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
1893 | mView->viewManager()->showNextView(); | 1904 | mView->viewManager()->showNextView(); |
1894 | else { | 1905 | else { |
1895 | mView->viewManager()->showNextXView(); | 1906 | mView->viewManager()->showNextXView(); |
1896 | showSelectedDates = true; | 1907 | showSelectedDates = true; |
1897 | } | 1908 | } |
1898 | break; | 1909 | break; |
1899 | case Qt::Key_V: | 1910 | case Qt::Key_V: |
1900 | mView->viewManager()->showTodoView(); | 1911 | mView->viewManager()->showTodoView(); |
1901 | break; | 1912 | break; |
1902 | case Qt::Key_C: | 1913 | case Qt::Key_C: |
1903 | mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); | 1914 | mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); |
1904 | break; | 1915 | break; |
1905 | case Qt::Key_P: | 1916 | case Qt::Key_P: |
1906 | mView->showDatePicker( ); | 1917 | mView->showDatePicker( ); |
1907 | break; | 1918 | break; |
1908 | case Qt::Key_F: | 1919 | case Qt::Key_F: |
1909 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1920 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1910 | mView->editFilters(); | 1921 | mView->editFilters(); |
1911 | else | 1922 | else |
1912 | mView->toggleFilter(); | 1923 | mView->toggleFilter(); |
1913 | break; | 1924 | break; |
1914 | case Qt::Key_X: | 1925 | case Qt::Key_X: |
1915 | mView->toggleDateNavigatorWidget(); | 1926 | mView->toggleDateNavigatorWidget(); |
1916 | break; | 1927 | break; |
1917 | case Qt::Key_Space: | 1928 | case Qt::Key_Space: |
1918 | mView->toggleExpand(); | 1929 | mView->toggleExpand(); |
1919 | break; | 1930 | break; |
1920 | case Qt::Key_A: | 1931 | case Qt::Key_A: |
1921 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton ) | 1932 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton ) |
1922 | mView->showNextAlarms(); | 1933 | mView->showNextAlarms(); |
1923 | else | 1934 | else |
1924 | mView->toggleAllDaySize(); | 1935 | mView->toggleAllDaySize(); |
1925 | break; | 1936 | break; |
1926 | case Qt::Key_T: | 1937 | case Qt::Key_T: |
1927 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1938 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1928 | mView->newTodo(); | 1939 | mView->newTodo(); |
1929 | else { | 1940 | else { |
1930 | mView->goToday(); | 1941 | mView->goToday(); |
1931 | showSelectedDates = true; | 1942 | showSelectedDates = true; |
1932 | } | 1943 | } |
1933 | break; | 1944 | break; |
1934 | case Qt::Key_J: | 1945 | case Qt::Key_J: |
1935 | mView->viewManager()->showJournalView(); | 1946 | mView->viewManager()->showJournalView(); |
1936 | break; | 1947 | break; |
1937 | case Qt::Key_B: | 1948 | case Qt::Key_B: |
1938 | mView->editIncidenceDescription();; | 1949 | mView->editIncidenceDescription();; |
1939 | break; | 1950 | break; |
1940 | // case Qt::Key_Return: | 1951 | // case Qt::Key_Return: |
1941 | case Qt::Key_E: | 1952 | case Qt::Key_E: |
1942 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1953 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1943 | mView->newEvent(); | 1954 | mView->newEvent(); |
1944 | else | 1955 | else |
1945 | mView->editIncidence(); | 1956 | mView->editIncidence(); |
1946 | break; | 1957 | break; |
1947 | case Qt::Key_Plus: | 1958 | case Qt::Key_Plus: |
1948 | size = p->mHourSize +2; | 1959 | size = p->mHourSize +2; |
1949 | if ( size <= 22 ) | 1960 | if ( size <= 22 ) |
1950 | configureAgenda( size ); | 1961 | configureAgenda( size ); |
1951 | break; | 1962 | break; |
1952 | case Qt::Key_Minus: | 1963 | case Qt::Key_Minus: |
1953 | size = p->mHourSize - 2; | 1964 | size = p->mHourSize - 2; |
1954 | if ( size >= 4 ) | 1965 | if ( size >= 4 ) |
1955 | configureAgenda( size ); | 1966 | configureAgenda( size ); |
1956 | break; | 1967 | break; |
1957 | 1968 | ||
1958 | 1969 | ||
1959 | default: | 1970 | default: |
1960 | e->ignore(); | 1971 | e->ignore(); |
1961 | } | 1972 | } |
1962 | if ( pro > 0 ) { | 1973 | if ( pro > 0 ) { |
1963 | mView->selectFilter( pro-1 ); | 1974 | mView->selectFilter( pro-1 ); |
1964 | } | 1975 | } |
1965 | if ( showSelectedDates ) { | 1976 | if ( showSelectedDates ) { |
1966 | ;// setCaptionToDates(); | 1977 | ;// setCaptionToDates(); |
1967 | } | 1978 | } |
1968 | 1979 | ||
1969 | } | 1980 | } |
1970 | void MainWindow::fillFilterMenuTB() | 1981 | void MainWindow::fillFilterMenuTB() |
1971 | { | 1982 | { |
1972 | selectFilterMenuTB->clear(); | 1983 | selectFilterMenuTB->clear(); |
1973 | selectFilterMenuTB->insertItem(i18n ( "Edit Filters" ), 0 ); | 1984 | selectFilterMenuTB->insertItem(i18n ( "Edit Filters" ), 0 ); |
1974 | selectFilterMenuTB->insertSeparator(); | 1985 | selectFilterMenuTB->insertSeparator(); |
1975 | selectFilterMenuTB->insertItem(i18n ( "No Filter" ), 1 ); | 1986 | selectFilterMenuTB->insertItem(i18n ( "No Filter" ), 1 ); |
1976 | 1987 | ||
1977 | selectFilterMenuTB->insertSeparator(); | 1988 | selectFilterMenuTB->insertSeparator(); |
1978 | QPtrList<CalFilter> fili = mView->filters(); | 1989 | QPtrList<CalFilter> fili = mView->filters(); |
1979 | CalFilter *curfilter = mView->filterView()->selectedFilter(); | 1990 | CalFilter *curfilter = mView->filterView()->selectedFilter(); |
1980 | CalFilter *filter = fili.first(); | 1991 | CalFilter *filter = fili.first(); |
1981 | int iii = 2; | 1992 | int iii = 2; |
1982 | bool checkitem = mView->filterView()->filtersEnabled(); | 1993 | bool checkitem = mView->filterView()->filtersEnabled(); |
1983 | while(filter) { | 1994 | while(filter) { |
1984 | selectFilterMenuTB->insertItem( filter->name(), iii ); | 1995 | selectFilterMenuTB->insertItem( filter->name(), iii ); |
1985 | if ( filter == curfilter) | 1996 | if ( filter == curfilter) |
1986 | selectFilterMenuTB->setItemChecked( iii, checkitem ); | 1997 | selectFilterMenuTB->setItemChecked( iii, checkitem ); |
1987 | filter = fili.next(); | 1998 | filter = fili.next(); |
1988 | ++iii; | 1999 | ++iii; |
1989 | } | 2000 | } |
1990 | if ( !checkitem ) | 2001 | if ( !checkitem ) |
1991 | selectFilterMenuTB->setItemChecked( 1, true ); | 2002 | selectFilterMenuTB->setItemChecked( 1, true ); |
1992 | 2003 | ||
1993 | int x = 0; | 2004 | int x = 0; |
1994 | int y = iconToolBar->height(); | 2005 | int y = iconToolBar->height(); |
1995 | int dX = 0; | 2006 | int dX = 0; |
1996 | int dY = 0; | 2007 | int dY = 0; |
1997 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { | 2008 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { |
1998 | if ( iconToolBar->y() > height()/2 ) { | 2009 | if ( iconToolBar->y() > height()/2 ) { |
1999 | dY = selectFilterMenuTB->sizeHint().height()+8; | 2010 | dY = selectFilterMenuTB->sizeHint().height()+8; |
2000 | y = 0; | 2011 | y = 0; |
2001 | } | 2012 | } |
2002 | } else { | 2013 | } else { |
2003 | if ( iconToolBar->x() > width()/2 ) { // right side | 2014 | if ( iconToolBar->x() > width()/2 ) { // right side |
2004 | x=0; | 2015 | x=0; |
2005 | dX= selectFilterMenuTB->sizeHint().width()+8; | 2016 | dX= selectFilterMenuTB->sizeHint().width()+8; |
2006 | y = 0; | 2017 | y = 0; |
2007 | } else { | 2018 | } else { |
2008 | x= iconToolBar->width(); | 2019 | x= iconToolBar->width(); |
2009 | y = 0; | 2020 | y = 0; |
2010 | } | 2021 | } |
2011 | } | 2022 | } |
2012 | //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); | 2023 | //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); |
2013 | selectFilterMenuTB->popup(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY))); | 2024 | selectFilterMenuTB->popup(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY))); |
2014 | } | 2025 | } |
2015 | void MainWindow::fillFilterMenu() | 2026 | void MainWindow::fillFilterMenu() |
2016 | { | 2027 | { |
2017 | selectFilterMenu->clear(); | 2028 | selectFilterMenu->clear(); |
2018 | selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); | 2029 | selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); |
2019 | selectFilterMenu->insertSeparator(); | 2030 | selectFilterMenu->insertSeparator(); |
2020 | selectFilterMenu->insertItem(i18n ( "No Filter" ), 1 ); | 2031 | selectFilterMenu->insertItem(i18n ( "No Filter" ), 1 ); |
2021 | 2032 | ||
2022 | selectFilterMenu->insertSeparator(); | 2033 | selectFilterMenu->insertSeparator(); |
2023 | QPtrList<CalFilter> fili = mView->filters(); | 2034 | QPtrList<CalFilter> fili = mView->filters(); |
2024 | CalFilter *curfilter = mView->filterView()->selectedFilter(); | 2035 | CalFilter *curfilter = mView->filterView()->selectedFilter(); |
2025 | CalFilter *filter = fili.first(); | 2036 | CalFilter *filter = fili.first(); |
2026 | int iii = 2; | 2037 | int iii = 2; |
2027 | bool checkitem = mView->filterView()->filtersEnabled(); | 2038 | bool checkitem = mView->filterView()->filtersEnabled(); |
2028 | while(filter) { | 2039 | while(filter) { |
2029 | selectFilterMenu->insertItem( filter->name(), iii ); | 2040 | selectFilterMenu->insertItem( filter->name(), iii ); |
2030 | if ( filter == curfilter) | 2041 | if ( filter == curfilter) |
2031 | selectFilterMenu->setItemChecked( iii, checkitem ); | 2042 | selectFilterMenu->setItemChecked( iii, checkitem ); |
2032 | filter = fili.next(); | 2043 | filter = fili.next(); |
2033 | ++iii; | 2044 | ++iii; |
2034 | } | 2045 | } |
2035 | if ( !checkitem ) | 2046 | if ( !checkitem ) |
2036 | selectFilterMenu->setItemChecked( 1, true ); | 2047 | selectFilterMenu->setItemChecked( 1, true ); |
2037 | } | 2048 | } |
2038 | void MainWindow::fillFilterMenuPopup() | 2049 | void MainWindow::fillFilterMenuPopup() |
2039 | { | 2050 | { |
2040 | filterPopupMenu->clear(); | 2051 | filterPopupMenu->clear(); |
2041 | filterPopupMenu->insertItem(i18n ( "No Filter" ), 0 ); | 2052 | filterPopupMenu->insertItem(i18n ( "No Filter" ), 0 ); |
2042 | 2053 | ||
2043 | filterPopupMenu->insertSeparator(); | 2054 | filterPopupMenu->insertSeparator(); |
2044 | QPtrList<CalFilter> fili = mView->filters(); | 2055 | QPtrList<CalFilter> fili = mView->filters(); |
2045 | CalFilter *curfilter = mView->filterView()->selectedFilter(); | 2056 | CalFilter *curfilter = mView->filterView()->selectedFilter(); |
2046 | CalFilter *filter = fili.first(); | 2057 | CalFilter *filter = fili.first(); |
2047 | int iii = 1; | 2058 | int iii = 1; |
2048 | bool checkitem = mView->filterView()->filtersEnabled(); | 2059 | bool checkitem = mView->filterView()->filtersEnabled(); |
2049 | while(filter) { | 2060 | while(filter) { |
2050 | filterPopupMenu->insertItem( filter->name(), iii ); | 2061 | filterPopupMenu->insertItem( filter->name(), iii ); |
2051 | if ( filter == curfilter) | 2062 | if ( filter == curfilter) |
2052 | filterPopupMenu->setItemChecked( iii, checkitem ); | 2063 | filterPopupMenu->setItemChecked( iii, checkitem ); |
2053 | filter = fili.next(); | 2064 | filter = fili.next(); |
2054 | ++iii; | 2065 | ++iii; |
2055 | } | 2066 | } |
2056 | if ( !checkitem ) | 2067 | if ( !checkitem ) |
2057 | filterPopupMenu->setItemChecked( 0, true ); | 2068 | filterPopupMenu->setItemChecked( 0, true ); |
2058 | } | 2069 | } |
2059 | void MainWindow::selectFilter( int fil ) | 2070 | void MainWindow::selectFilter( int fil ) |
2060 | { | 2071 | { |
2061 | 2072 | ||
2062 | if ( fil == 0 ) { | 2073 | if ( fil == 0 ) { |
2063 | mView->editFilters( ); | 2074 | mView->editFilters( ); |
2064 | } else if ( fil == 1 ){ | 2075 | } else if ( fil == 1 ){ |
2065 | if ( mView->filterView()->filtersEnabled() ) | 2076 | if ( mView->filterView()->filtersEnabled() ) |
2066 | mView->toggleFilerEnabled( ); | 2077 | mView->toggleFilerEnabled( ); |
2067 | } else { | 2078 | } else { |
2068 | if ( !mView->filterView()->filtersEnabled() ) { | 2079 | if ( !mView->filterView()->filtersEnabled() ) { |
2069 | mView->filterView()->blockSignals( true ); | 2080 | mView->filterView()->blockSignals( true ); |
2070 | mView->toggleFilerEnabled( ); | 2081 | mView->toggleFilerEnabled( ); |
2071 | mView->filterView()->blockSignals( false ); | 2082 | mView->filterView()->blockSignals( false ); |
2072 | } | 2083 | } |
2073 | mView->selectFilter( fil-2 ); | 2084 | mView->selectFilter( fil-2 ); |
2074 | } | 2085 | } |
2075 | } | 2086 | } |
2076 | void MainWindow::updateFilterToolbar() | 2087 | void MainWindow::updateFilterToolbar() |
2077 | { | 2088 | { |
2078 | if ( filterMenubar ) { | 2089 | if ( filterMenubar ) { |
2079 | if ( !mView->filterView()->filtersEnabled() ) { | 2090 | if ( !mView->filterView()->filtersEnabled() ) { |
2080 | filterMenubar->changeItem( 0, i18n("No Filter") ); | 2091 | filterMenubar->changeItem( 0, i18n("No Filter") ); |
2081 | } else { | 2092 | } else { |
2082 | CalFilter *curfilter = mView->filterView()->selectedFilter(); | 2093 | CalFilter *curfilter = mView->filterView()->selectedFilter(); |
2083 | if ( curfilter ) { | 2094 | if ( curfilter ) { |
2084 | filterMenubar->changeItem( 0, curfilter->name() ); | 2095 | filterMenubar->changeItem( 0, curfilter->name() ); |
2085 | } | 2096 | } |
2086 | } | 2097 | } |
2087 | } | 2098 | } |
2088 | } | 2099 | } |
2089 | void MainWindow::selectFilterPopup( int fil ) | 2100 | void MainWindow::selectFilterPopup( int fil ) |
2090 | { | 2101 | { |
2091 | selectFilter( fil + 1 ); | 2102 | selectFilter( fil + 1 ); |
2092 | 2103 | ||
2093 | } | 2104 | } |
2094 | void MainWindow::configureToolBar( int item ) | 2105 | void MainWindow::configureToolBar( int item ) |
2095 | { | 2106 | { |
2096 | 2107 | ||
2097 | configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); | 2108 | configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); |
2098 | KOPrefs *p = KOPrefs::instance(); | 2109 | KOPrefs *p = KOPrefs::instance(); |
2099 | p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); | 2110 | p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); |
2100 | p-> mShowIconOnetoolbar = configureToolBarMenu->isItemChecked( 6 ); | 2111 | p-> mShowIconOnetoolbar = configureToolBarMenu->isItemChecked( 6 ); |
2101 | p-> mShowIconFilter = configureToolBarMenu->isItemChecked( 7 ); | 2112 | p-> mShowIconFilter = configureToolBarMenu->isItemChecked( 7 ); |
2102 | p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); | 2113 | p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); |
2103 | p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); | 2114 | p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); |
2104 | p->mShowIconNavigator = configureToolBarMenu->isItemChecked( 22 ); | 2115 | p->mShowIconNavigator = configureToolBarMenu->isItemChecked( 22 ); |
2105 | p->mShowIconAllday = configureToolBarMenu->isItemChecked( 24 ); | 2116 | p->mShowIconAllday = configureToolBarMenu->isItemChecked( 24 ); |
2106 | p->mShowIconFilterview = configureToolBarMenu->isItemChecked( 26 ); | 2117 | p->mShowIconFilterview = configureToolBarMenu->isItemChecked( 26 ); |
2107 | p->mShowIconToggleFull = configureToolBarMenu->isItemChecked( 28 ); | 2118 | p->mShowIconToggleFull = configureToolBarMenu->isItemChecked( 28 ); |
2108 | p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); | 2119 | p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); |
2109 | p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); | 2120 | p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); |
2110 | p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); | 2121 | p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); |
2111 | p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); | 2122 | p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); |
2112 | p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 ); | 2123 | p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 ); |
2113 | p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); | 2124 | p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); |
2114 | p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); | 2125 | p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); |
2115 | p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); | 2126 | p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); |
2116 | p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); | 2127 | p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); |
2117 | p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); | 2128 | p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); |
2118 | p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); | 2129 | p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); |
2119 | p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); | 2130 | p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); |
2120 | p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); | 2131 | p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); |
2121 | p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); | 2132 | p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); |
2122 | p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); | 2133 | p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); |
2123 | p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); | 2134 | p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); |
2124 | p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); | 2135 | p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); |
2125 | p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 ); | 2136 | p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 ); |
2126 | // initActions(); | 2137 | // initActions(); |
2127 | } | 2138 | } |
2128 | void MainWindow::setCaption ( const QString & c ) | 2139 | void MainWindow::setCaption ( const QString & c ) |
2129 | { | 2140 | { |
2130 | QString cap = c; | 2141 | QString cap = c; |
2131 | cap.replace( QRegExp("\n"), " " ); | 2142 | cap.replace( QRegExp("\n"), " " ); |
2132 | cap = cap.stripWhiteSpace(); | 2143 | cap = cap.stripWhiteSpace(); |
2133 | if ( cap.isEmpty() ) | 2144 | if ( cap.isEmpty() ) |
2134 | cap = "KO/Pi"; | 2145 | cap = "KO/Pi"; |
2135 | QWidget::setCaption( cap ); | 2146 | QWidget::setCaption( cap ); |
2136 | } | 2147 | } |
2137 | void MainWindow::setCaptionToDates() | 2148 | void MainWindow::setCaptionToDates() |
2138 | { | 2149 | { |
2139 | QString selDates; | 2150 | QString selDates; |
2140 | QDate date = mView->startDate(); | 2151 | QDate date = mView->startDate(); |
2141 | if ( ! date.isValid() ) { | 2152 | if ( ! date.isValid() ) { |
2142 | setCaption(""); | 2153 | setCaption(""); |
2143 | return; | 2154 | return; |
2144 | } | 2155 | } |
2145 | selDates = KGlobal::locale()->formatDate( date, true); | 2156 | selDates = KGlobal::locale()->formatDate( date, true); |
2146 | if (mView->startDate() < mView->endDate() ) | 2157 | if (mView->startDate() < mView->endDate() ) |
2147 | selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); | 2158 | selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); |
2148 | else { | 2159 | else { |
2149 | QString addString; | 2160 | QString addString; |
2150 | if ( date == QDateTime::currentDateTime().date() ) | 2161 | if ( date == QDateTime::currentDateTime().date() ) |
2151 | addString = i18n("Today"); | 2162 | addString = i18n("Today"); |
2152 | else if ( date == QDateTime::currentDateTime().date().addDays(1) ) | 2163 | else if ( date == QDateTime::currentDateTime().date().addDays(1) ) |
2153 | addString = i18n("Tomorrow"); | 2164 | addString = i18n("Tomorrow"); |
2154 | if ( !addString.isEmpty() ) | 2165 | if ( !addString.isEmpty() ) |
2155 | selDates = addString+", "+selDates ; | 2166 | selDates = addString+", "+selDates ; |
2156 | } | 2167 | } |
2157 | setCaption( i18n("Dates: ") + selDates ); | 2168 | setCaption( i18n("Dates: ") + selDates ); |
2158 | 2169 | ||
2159 | } | 2170 | } |
2160 | void MainWindow::showConfigureAgenda( ) | 2171 | void MainWindow::showConfigureAgenda( ) |
2161 | { | 2172 | { |
2162 | int iii; | 2173 | int iii; |
2163 | for ( iii = 1;iii<= 10 ;++iii ){ | 2174 | for ( iii = 1;iii<= 10 ;++iii ){ |
2164 | configureAgendaMenu->setItemChecked( (iii+1)*2, false ); | 2175 | configureAgendaMenu->setItemChecked( (iii+1)*2, false ); |
2165 | } | 2176 | } |
2166 | configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true ); | 2177 | configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true ); |
2167 | } | 2178 | } |
2168 | void MainWindow::configureAgenda( int item ) | 2179 | void MainWindow::configureAgenda( int item ) |
2169 | { | 2180 | { |
2170 | if ( KOPrefs::instance()->mHourSize == item ) | 2181 | if ( KOPrefs::instance()->mHourSize == item ) |
2171 | return; | 2182 | return; |
2172 | KOPrefs::instance()->mHourSize=item; | 2183 | KOPrefs::instance()->mHourSize=item; |
2173 | mView->viewManager()->agendaView()->updateConfig(); | 2184 | mView->viewManager()->agendaView()->updateConfig(); |
2174 | } | 2185 | } |
2175 | 2186 | ||
2176 | void MainWindow::saveCalendar() | 2187 | void MainWindow::saveCalendar() |
2177 | { | 2188 | { |
2178 | QString fn = KOPrefs::instance()->mLastSaveFile; | 2189 | QString fn = KOPrefs::instance()->mLastSaveFile; |
2179 | fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); | 2190 | fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); |
2180 | 2191 | ||
2181 | if ( fn == "" ) | 2192 | if ( fn == "" ) |
2182 | return; | 2193 | return; |
2183 | QFileInfo info; | 2194 | QFileInfo info; |
2184 | info.setFile( fn ); | 2195 | info.setFile( fn ); |
2185 | QString mes; | 2196 | QString mes; |
2186 | bool createbup = true; | 2197 | bool createbup = true; |
2187 | if ( info. exists() ) { | 2198 | if ( info. exists() ) { |
2188 | mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; | 2199 | mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; |
2189 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, | 2200 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, |
2190 | i18n("Overwrite!"), i18n("Cancel"), 0, | 2201 | i18n("Overwrite!"), i18n("Cancel"), 0, |
2191 | 0, 1 ); | 2202 | 0, 1 ); |
2192 | if ( result != 0 ) { | 2203 | if ( result != 0 ) { |
2193 | createbup = false; | 2204 | createbup = false; |
2194 | } | 2205 | } |
2195 | } | 2206 | } |
2196 | if ( createbup ) { | 2207 | if ( createbup ) { |
2197 | mView->saveCalendar( fn ); | 2208 | mView->saveCalendar( fn ); |
2198 | mes = i18n("KO/Pi:Saved %1").arg(fn); | 2209 | mes = i18n("KO/Pi:Saved %1").arg(fn); |
2199 | KOPrefs::instance()->mLastSaveFile = fn; | 2210 | KOPrefs::instance()->mLastSaveFile = fn; |
2200 | setCaption(mes); | 2211 | setCaption(mes); |
2201 | } | 2212 | } |
2202 | } | 2213 | } |
2203 | void MainWindow::loadCalendar() | 2214 | void MainWindow::loadCalendar() |
2204 | { | 2215 | { |
2205 | 2216 | ||
2206 | QString fn = KOPrefs::instance()->mLastLoadFile; | 2217 | QString fn = KOPrefs::instance()->mLastLoadFile; |
2207 | fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); | 2218 | fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); |
2208 | 2219 | ||
2209 | if ( fn == "" ) | 2220 | if ( fn == "" ) |
2210 | return; | 2221 | return; |
2211 | QFileInfo info; | 2222 | QFileInfo info; |
2212 | info.setFile( fn ); | 2223 | info.setFile( fn ); |
2213 | QString mess; | 2224 | QString mess; |
2214 | bool loadbup = true; | 2225 | bool loadbup = true; |
2215 | if ( info. exists() ) { | 2226 | if ( info. exists() ) { |
2216 | mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); | 2227 | mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); |
2217 | int result = QMessageBox::warning( this, "KO/Pi: Warning!", | 2228 | int result = QMessageBox::warning( this, "KO/Pi: Warning!", |
2218 | mess, | 2229 | mess, |
2219 | i18n("Load!"), i18n("Cancel"), 0, | 2230 | i18n("Load!"), i18n("Cancel"), 0, |
2220 | 0, 1 ); | 2231 | 0, 1 ); |
2221 | if ( result != 0 ) { | 2232 | if ( result != 0 ) { |
2222 | loadbup = false; | 2233 | loadbup = false; |
2223 | } | 2234 | } |
2224 | } else { | 2235 | } else { |
2225 | QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 2236 | QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
2226 | i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, | 2237 | i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, |
2227 | 0, 1 ); | 2238 | 0, 1 ); |
2228 | 2239 | ||
2229 | return; | 2240 | return; |
2230 | } | 2241 | } |
2231 | if ( loadbup ) { | 2242 | if ( loadbup ) { |
2232 | mView->openCalendar( fn ); | 2243 | mView->openCalendar( fn ); |
2233 | KOPrefs::instance()->mLastLoadFile = fn; | 2244 | KOPrefs::instance()->mLastLoadFile = fn; |
2234 | mess = i18n("KO/Pi:Loaded %1").arg(fn) ; | 2245 | mess = i18n("KO/Pi:Loaded %1").arg(fn) ; |
2235 | setCaption(mess); | 2246 | setCaption(mess); |
2236 | } | 2247 | } |
2237 | 2248 | ||
2238 | } | 2249 | } |
2239 | void MainWindow::quickImportIcal() | 2250 | void MainWindow::quickImportIcal() |
2240 | { | 2251 | { |
2241 | importFile( KOPrefs::instance()->mLastImportFile, false ); | 2252 | importFile( KOPrefs::instance()->mLastImportFile, false ); |
2242 | } | 2253 | } |
2243 | void MainWindow::importFile( QString fn, bool quick ) | 2254 | void MainWindow::importFile( QString fn, bool quick ) |
2244 | { | 2255 | { |
2245 | QFileInfo info; | 2256 | QFileInfo info; |
2246 | info.setFile( fn ); | 2257 | info.setFile( fn ); |
2247 | QString mess; | 2258 | QString mess; |
2248 | bool loadbup = true; | 2259 | bool loadbup = true; |
2249 | if ( !info. exists() ) { | 2260 | if ( !info. exists() ) { |
2250 | mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); | 2261 | mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); |
2251 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 2262 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
2252 | mess ); | 2263 | mess ); |
2253 | return; | 2264 | return; |
2254 | } | 2265 | } |
2255 | int result = 0; | 2266 | int result = 0; |
2256 | if ( !quick ) { | 2267 | if ( !quick ) { |
2257 | 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 )); | 2268 | 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 )); |
2258 | result = QMessageBox::warning( this, "KO/Pi: Warning!", | 2269 | result = QMessageBox::warning( this, "KO/Pi: Warning!", |
2259 | mess, | 2270 | mess, |
2260 | "Import", "Cancel", 0, | 2271 | "Import", "Cancel", 0, |
2261 | 0, 1 ); | 2272 | 0, 1 ); |
2262 | } | 2273 | } |
2263 | if ( result == 0 ) { | 2274 | if ( result == 0 ) { |
2264 | if ( mView->openCalendar( fn, true )) { | 2275 | if ( mView->openCalendar( fn, true )) { |
2265 | KOPrefs::instance()->mLastImportFile = fn; | 2276 | KOPrefs::instance()->mLastImportFile = fn; |
2266 | setCaption(i18n("Imported file successfully")); | 2277 | setCaption(i18n("Imported file successfully")); |
2267 | } else { | 2278 | } else { |
2268 | setCaption(i18n("Error importing file")); | 2279 | setCaption(i18n("Error importing file")); |
2269 | } | 2280 | } |
2270 | } | 2281 | } |
2271 | } | 2282 | } |
2272 | 2283 | ||
2273 | void MainWindow::importIcal() | 2284 | void MainWindow::importIcal() |
2274 | { | 2285 | { |
2275 | 2286 | ||
2276 | QString fn =KOPrefs::instance()->mLastImportFile; | 2287 | QString fn =KOPrefs::instance()->mLastImportFile; |
2277 | 2288 | ||
2278 | fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); | 2289 | fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); |
2279 | if ( fn == "" ) | 2290 | if ( fn == "" ) |
2280 | return; | 2291 | return; |
2281 | importFile( fn, true ); | 2292 | importFile( fn, true ); |
2282 | 2293 | ||
2283 | } | 2294 | } |
2284 | 2295 | ||
2285 | void MainWindow::exportVCalendar() | 2296 | void MainWindow::exportVCalendar() |
2286 | { | 2297 | { |
2287 | QString fn = KOPrefs::instance()->mLastVcalFile; | 2298 | QString fn = KOPrefs::instance()->mLastVcalFile; |
2288 | fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); | 2299 | fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); |
2289 | if ( fn == "" ) | 2300 | if ( fn == "" ) |
2290 | return; | 2301 | return; |
2291 | QFileInfo info; | 2302 | QFileInfo info; |
2292 | info.setFile( fn ); | 2303 | info.setFile( fn ); |
2293 | QString mes; | 2304 | QString mes; |
2294 | bool createbup = true; | 2305 | bool createbup = true; |
2295 | if ( info. exists() ) { | 2306 | if ( info. exists() ) { |
2296 | mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); | 2307 | mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); |
2297 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, | 2308 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, |
2298 | i18n("Overwrite!"), i18n("Cancel"), 0, | 2309 | i18n("Overwrite!"), i18n("Cancel"), 0, |
2299 | 0, 1 ); | 2310 | 0, 1 ); |
2300 | if ( result != 0 ) { | 2311 | if ( result != 0 ) { |
2301 | createbup = false; | 2312 | createbup = false; |
2302 | } | 2313 | } |
2303 | } | 2314 | } |
2304 | if ( createbup ) { | 2315 | if ( createbup ) { |
2305 | if ( mView->exportVCalendar( fn ) ) { | 2316 | if ( mView->exportVCalendar( fn ) ) { |
2306 | KOPrefs::instance()->mLastVcalFile = fn; | 2317 | KOPrefs::instance()->mLastVcalFile = fn; |
2307 | if ( fn.length() > 20 ) | 2318 | if ( fn.length() > 20 ) |
2308 | mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; | 2319 | mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; |
2309 | else | 2320 | else |
2310 | mes = i18n("KO/Pi:Exported to %1").arg(fn ); | 2321 | mes = i18n("KO/Pi:Exported to %1").arg(fn ); |
2311 | setCaption(mes); | 2322 | setCaption(mes); |
2312 | } | 2323 | } |
2313 | } | 2324 | } |
2314 | 2325 | ||
2315 | } | 2326 | } |
2316 | QString MainWindow::sentSyncFile() | 2327 | QString MainWindow::sentSyncFile() |
2317 | { | 2328 | { |
2318 | #ifdef DESKTOP_VERSION | 2329 | #ifdef DESKTOP_VERSION |
2319 | return locateLocal( "tmp", "copysynccal.ics" ); | 2330 | return locateLocal( "tmp", "copysynccal.ics" ); |
2320 | #else | 2331 | #else |
2321 | return QString( "/tmp/copysynccal.ics" ); | 2332 | return QString( "/tmp/copysynccal.ics" ); |
2322 | #endif | 2333 | #endif |
2323 | } | 2334 | } |
2324 | 2335 | ||
2325 | void MainWindow::syncFileRequest() | 2336 | void MainWindow::syncFileRequest() |
2326 | { | 2337 | { |
2327 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { | 2338 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { |
2328 | mSyncManager->slotSyncMenu( 999 ); | 2339 | mSyncManager->slotSyncMenu( 999 ); |
2329 | } | 2340 | } |
2330 | 2341 | ||
2331 | setCaption(i18n("Saving Data to temp file ..." )); | 2342 | setCaption(i18n("Saving Data to temp file ..." )); |
2332 | mView->saveCalendar( sentSyncFile() ); | 2343 | mView->saveCalendar( sentSyncFile() ); |
2333 | setCaption(i18n("Data saved to temp file!" )); | 2344 | setCaption(i18n("Data saved to temp file!" )); |
2334 | 2345 | ||
2335 | } | 2346 | } |
2336 | void MainWindow::getFile( bool success ) | 2347 | void MainWindow::getFile( bool success ) |
2337 | { | 2348 | { |
2338 | if ( ! success ) { | 2349 | if ( ! success ) { |
2339 | setCaption( i18n("Error receiving file. Nothing changed!") ); | 2350 | setCaption( i18n("Error receiving file. Nothing changed!") ); |
2340 | return; | 2351 | return; |
2341 | } | 2352 | } |
2342 | mView->openCalendar( sentSyncFile() ); | 2353 | mView->openCalendar( sentSyncFile() ); |
2343 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { | 2354 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { |
2344 | mSyncManager->slotSyncMenu( 999 ); | 2355 | mSyncManager->slotSyncMenu( 999 ); |
2345 | } | 2356 | } |
2346 | setCaption( i18n("Pi-Sync successful!") ); | 2357 | setCaption( i18n("Pi-Sync successful!") ); |
2347 | } | 2358 | } |
2348 | 2359 | ||
2349 | void MainWindow::printSel( ) | 2360 | void MainWindow::printSel( ) |
2350 | { | 2361 | { |
2351 | mView->viewManager()->agendaView()->agenda()->printSelection(); | 2362 | mView->viewManager()->agendaView()->agenda()->printSelection(); |
2352 | } | 2363 | } |
2353 | 2364 | ||
2354 | void MainWindow::printCal() | 2365 | void MainWindow::printCal() |
2355 | { | 2366 | { |
2356 | mView->print();//mCp->showDialog(); | 2367 | mView->print();//mCp->showDialog(); |
2357 | } | 2368 | } |
2358 | 2369 | ||
2359 | 2370 | ||
2360 | #include "libkdepim/kdatepicker.h" | 2371 | #include "libkdepim/kdatepicker.h" |
2361 | #include <kdatetbl.h> | 2372 | #include <kdatetbl.h> |
2362 | 2373 | ||
2363 | void MainWindow::weekAction() | 2374 | void MainWindow::weekAction() |
2364 | { | 2375 | { |
2365 | int month; | 2376 | int month; |
2366 | KPopupFrame* popup = new KPopupFrame(this); | 2377 | KPopupFrame* popup = new KPopupFrame(this); |
2367 | KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup); | 2378 | KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup); |
2368 | // ----- | 2379 | // ----- |
2369 | picker->resize(picker->sizeHint()); | 2380 | picker->resize(picker->sizeHint()); |
2370 | popup->setMainWidget(picker); | 2381 | popup->setMainWidget(picker); |
2371 | picker->setFocus(); | 2382 | picker->setFocus(); |
2372 | connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); | 2383 | connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); |
2373 | int x = 0; | 2384 | int x = 0; |
2374 | int y = iconToolBar->height(); | 2385 | int y = iconToolBar->height(); |
2375 | int dX = 0; | 2386 | int dX = 0; |
2376 | int dY = 0; | 2387 | int dY = 0; |
2377 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { | 2388 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { |
2378 | if ( iconToolBar->y() > height()/2 ) { | 2389 | if ( iconToolBar->y() > height()/2 ) { |
2379 | dY = picker->sizeHint().height()+8; | 2390 | dY = picker->sizeHint().height()+8; |
2380 | y = 0; | 2391 | y = 0; |
2381 | } | 2392 | } |
2382 | } else { | 2393 | } else { |
2383 | if ( iconToolBar->x() > width()/2 ) { // right side | 2394 | if ( iconToolBar->x() > width()/2 ) { // right side |
2384 | x=0; | 2395 | x=0; |
2385 | dX= picker->sizeHint().width()+8; | 2396 | dX= picker->sizeHint().width()+8; |
2386 | y = 0; | 2397 | y = 0; |
2387 | } else { | 2398 | } else { |
2388 | x= iconToolBar->width(); | 2399 | x= iconToolBar->width(); |
2389 | y = 0; | 2400 | y = 0; |
2390 | } | 2401 | } |
2391 | } | 2402 | } |
2392 | //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); | 2403 | //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); |
2393 | if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)))) | 2404 | if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)))) |
2394 | { | 2405 | { |
2395 | month = picker->getResult(); | 2406 | month = picker->getResult(); |
2396 | emit selectWeek ( month ); | 2407 | emit selectWeek ( month ); |
2397 | //qDebug("weekSelected %d ", month); | 2408 | //qDebug("weekSelected %d ", month); |
2398 | } | 2409 | } |
2399 | delete popup; | 2410 | delete popup; |
2400 | } | 2411 | } |
2401 | 2412 | ||
2402 | void MainWindow::hideEvent ( QHideEvent * ) | 2413 | void MainWindow::hideEvent ( QHideEvent * ) |
2403 | { | 2414 | { |
2404 | QString message; | 2415 | QString message; |
2405 | QDateTime nextA = mCalendar->nextAlarmEventDateTime(); | 2416 | QDateTime nextA = mCalendar->nextAlarmEventDateTime(); |
2406 | if ( nextA.isValid() ) { | 2417 | if ( nextA.isValid() ) { |
2407 | QString sum = mCalendar->nextSummary(); | 2418 | QString sum = mCalendar->nextSummary(); |
2408 | 2419 | ||
2409 | message = i18n("%1 %2 - %3 (next event/todo with alarm)").arg( KGlobal::locale()->formatTime(nextA.time() , false)).arg(sum ).arg( KGlobal::locale()->formatDate(nextA.date() , false)); | 2420 | message = i18n("%1 %2 - %3 (next event/todo with alarm)").arg( KGlobal::locale()->formatTime(nextA.time() , false)).arg(sum ).arg( KGlobal::locale()->formatDate(nextA.date() , false)); |
2410 | setCaption( message ); | 2421 | setCaption( message ); |
2411 | } | 2422 | } |
2412 | } | 2423 | } |
2424 | |||
2425 | void MainWindow::resizeEvent( QResizeEvent* e) | ||
2426 | { | ||
2427 | #ifndef DESKTOP_VERSION | ||
2428 | if ( !KOPrefs::instance()->mShowIconFilter && !KOPrefs::instance()->mShowIconOnetoolbar ) { | ||
2429 | if (QApplication::desktop()->width() > QApplication::desktop()->height() ) | ||
2430 | filterToolBar->hide(); | ||
2431 | else | ||
2432 | filterToolBar->show(); | ||
2433 | } | ||
2434 | #endif | ||
2435 | QMainWindow::resizeEvent( e); | ||
2436 | } | ||
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h index 7c16aeb..4d1753f 100644 --- a/korganizer/mainwindow.h +++ b/korganizer/mainwindow.h | |||
@@ -1,172 +1,173 @@ | |||
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 <qmenubar.h> | 8 | #include <qmenubar.h> |
9 | #include <qtextstream.h> | 9 | #include <qtextstream.h> |
10 | #include <qregexp.h> | 10 | #include <qregexp.h> |
11 | 11 | ||
12 | #include <libkcal/incidence.h> | 12 | #include <libkcal/incidence.h> |
13 | #include "simplealarmclient.h" | 13 | #include "simplealarmclient.h" |
14 | #include <ksyncmanager.h> | 14 | #include <ksyncmanager.h> |
15 | #ifndef DESKTOP_VERSION | 15 | #ifndef DESKTOP_VERSION |
16 | #include <qcopchannel_qws.h> | 16 | #include <qcopchannel_qws.h> |
17 | #endif | 17 | #endif |
18 | class QAction; | 18 | class QAction; |
19 | class CalendarView; | 19 | class CalendarView; |
20 | class KSyncProfile; | 20 | class KSyncProfile; |
21 | #ifdef DESKTOP_VERSION | 21 | #ifdef DESKTOP_VERSION |
22 | 22 | ||
23 | #define QPEToolBar QToolBar | 23 | #define QPEToolBar QToolBar |
24 | #define QPEMenuBar QMenuBar | 24 | #define QPEMenuBar QMenuBar |
25 | #endif | 25 | #endif |
26 | class QPEToolBar; | 26 | class QPEToolBar; |
27 | class QPEMenuBar; | 27 | class QPEMenuBar; |
28 | 28 | ||
29 | 29 | ||
30 | namespace KCal { | 30 | namespace KCal { |
31 | class CalendarLocal; | 31 | class CalendarLocal; |
32 | } | 32 | } |
33 | 33 | ||
34 | class KOMenuBar : public QMenuBar | 34 | class KOMenuBar : public QMenuBar |
35 | { | 35 | { |
36 | public: | 36 | public: |
37 | KOMenuBar( QWidget *parent=0 ): QMenuBar (parent ) {;} | 37 | KOMenuBar( QWidget *parent=0 ): QMenuBar (parent ) {;} |
38 | QSize sizeHint () const{ qDebug("sizejint ");return QSize ( 40,25 );} | 38 | QSize sizeHint () const{ qDebug("sizejint ");return QSize ( 40,25 );} |
39 | }; | 39 | }; |
40 | 40 | ||
41 | using namespace KCal; | 41 | using namespace KCal; |
42 | 42 | ||
43 | class MainWindow : public QMainWindow | 43 | class MainWindow : public QMainWindow |
44 | { | 44 | { |
45 | Q_OBJECT | 45 | Q_OBJECT |
46 | public: | 46 | public: |
47 | MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); | 47 | MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); |
48 | ~MainWindow(); | 48 | ~MainWindow(); |
49 | bool beamReceiveEnabled(); | 49 | bool beamReceiveEnabled(); |
50 | static QString defaultFileName(); | 50 | static QString defaultFileName(); |
51 | static QString syncFileName(); | 51 | static QString syncFileName(); |
52 | static QString resourcePath(); | 52 | static QString resourcePath(); |
53 | public slots: | 53 | public slots: |
54 | void setCaption ( const QString & ); | 54 | void setCaption ( const QString & ); |
55 | void updateWeekNum(const KCal::DateList &); | 55 | void updateWeekNum(const KCal::DateList &); |
56 | void updateWeek(QDate); | 56 | void updateWeek(QDate); |
57 | void updateFilterToolbar(); | 57 | void updateFilterToolbar(); |
58 | virtual void showMaximized (); | 58 | virtual void showMaximized (); |
59 | void configureAgenda( int ); | 59 | void configureAgenda( int ); |
60 | void recieve( const QCString& msg, const QByteArray& data ); | 60 | void recieve( const QCString& msg, const QByteArray& data ); |
61 | protected slots: | 61 | protected slots: |
62 | void setCaptionToDates(); | 62 | void setCaptionToDates(); |
63 | void weekAction(); | 63 | void weekAction(); |
64 | void about(); | 64 | void about(); |
65 | void licence(); | 65 | void licence(); |
66 | void faq(); | 66 | void faq(); |
67 | void usertrans(); | 67 | void usertrans(); |
68 | void features(); | 68 | void features(); |
69 | void synchowto(); | 69 | void synchowto(); |
70 | void kdesynchowto(); | 70 | void kdesynchowto(); |
71 | void multisynchowto(); | 71 | void multisynchowto(); |
72 | void whatsNew(); | 72 | void whatsNew(); |
73 | void keyBindings(); | 73 | void keyBindings(); |
74 | void aboutAutoSaving();; | 74 | void aboutAutoSaving();; |
75 | void aboutKnownBugs(); | 75 | void aboutKnownBugs(); |
76 | 76 | ||
77 | void processIncidenceSelection( Incidence * ); | 77 | void processIncidenceSelection( Incidence * ); |
78 | 78 | ||
79 | void importQtopia(); | 79 | void importQtopia(); |
80 | void importBday(); | 80 | void importBday(); |
81 | void importOL(); | 81 | void importOL(); |
82 | void importIcal(); | 82 | void importIcal(); |
83 | void importFile( QString, bool ); | 83 | void importFile( QString, bool ); |
84 | void quickImportIcal(); | 84 | void quickImportIcal(); |
85 | 85 | ||
86 | void slotModifiedChanged( bool ); | 86 | void slotModifiedChanged( bool ); |
87 | 87 | ||
88 | void save(); | 88 | void save(); |
89 | void saveStopTimer(); | 89 | void saveStopTimer(); |
90 | void configureToolBar( int ); | 90 | void configureToolBar( int ); |
91 | void printSel(); | 91 | void printSel(); |
92 | void printCal(); | 92 | void printCal(); |
93 | void saveCalendar(); | 93 | void saveCalendar(); |
94 | void loadCalendar(); | 94 | void loadCalendar(); |
95 | void exportVCalendar(); | 95 | void exportVCalendar(); |
96 | void fillFilterMenu(); | 96 | void fillFilterMenu(); |
97 | void fillFilterMenuTB(); | 97 | void fillFilterMenuTB(); |
98 | void selectFilter( int ); | 98 | void selectFilter( int ); |
99 | void fillFilterMenuPopup(); | 99 | void fillFilterMenuPopup(); |
100 | void selectFilterPopup( int ); | 100 | void selectFilterPopup( int ); |
101 | void exportToPhone( int ); | 101 | void exportToPhone( int ); |
102 | void toggleBeamReceive(); | 102 | void toggleBeamReceive(); |
103 | void disableBR(bool); | 103 | void disableBR(bool); |
104 | signals: | 104 | signals: |
105 | void selectWeek ( int ); | 105 | void selectWeek ( int ); |
106 | private slots: | 106 | private slots: |
107 | void showConfigureAgenda(); | 107 | void showConfigureAgenda(); |
108 | void getFile( bool ); | 108 | void getFile( bool ); |
109 | void syncFileRequest(); | 109 | void syncFileRequest(); |
110 | 110 | ||
111 | protected: | 111 | protected: |
112 | void hideEvent ( QHideEvent * ); | 112 | void hideEvent ( QHideEvent * ); |
113 | QString sentSyncFile(); | 113 | QString sentSyncFile(); |
114 | void displayText( QString, QString); | 114 | void displayText( QString, QString); |
115 | void enableIncidenceActions( bool ); | 115 | void enableIncidenceActions( bool ); |
116 | 116 | ||
117 | private: | 117 | private: |
118 | bool mBRdisabled; | 118 | bool mBRdisabled; |
119 | #ifndef DESKTOP_VERSION | 119 | #ifndef DESKTOP_VERSION |
120 | QCopChannel* infrared; | 120 | QCopChannel* infrared; |
121 | #endif | 121 | #endif |
122 | QAction* brAction; | 122 | QAction* brAction; |
123 | KSyncManager* mSyncManager; | 123 | KSyncManager* mSyncManager; |
124 | bool mClosed; | 124 | bool mClosed; |
125 | void saveOnClose(); | 125 | void saveOnClose(); |
126 | bool mFlagKeyPressed; | 126 | bool mFlagKeyPressed; |
127 | bool mBlockAtStartup; | 127 | bool mBlockAtStartup; |
128 | QPEToolBar *iconToolBar; | 128 | QPEToolBar *iconToolBar; |
129 | QPEToolBar *viewToolBar; | 129 | QPEToolBar *viewToolBar; |
130 | QPEToolBar *navigatorToolBar; | 130 | QPEToolBar *navigatorToolBar; |
131 | QPEToolBar *filterToolBar; | 131 | QPEToolBar *filterToolBar; |
132 | QPEMenuBar *filterMenubar; | 132 | QPEMenuBar *filterMenubar; |
133 | QPopupMenu * filterPopupMenu; | 133 | QPopupMenu * filterPopupMenu; |
134 | void initActions(); | 134 | void initActions(); |
135 | void setDefaultPreferences(); | 135 | void setDefaultPreferences(); |
136 | void resizeEvent( QResizeEvent* e); | ||
136 | void keyPressEvent ( QKeyEvent * ) ; | 137 | void keyPressEvent ( QKeyEvent * ) ; |
137 | void keyReleaseEvent ( QKeyEvent * ) ; | 138 | void keyReleaseEvent ( QKeyEvent * ) ; |
138 | QPopupMenu *configureToolBarMenu; | 139 | QPopupMenu *configureToolBarMenu; |
139 | QPopupMenu *selectFilterMenu; | 140 | QPopupMenu *selectFilterMenu; |
140 | QPopupMenu *selectFilterMenuTB; | 141 | QPopupMenu *selectFilterMenuTB; |
141 | QPopupMenu *configureAgendaMenu, *syncMenu; | 142 | QPopupMenu *configureAgendaMenu, *syncMenu; |
142 | CalendarLocal *mCalendar; | 143 | CalendarLocal *mCalendar; |
143 | CalendarView *mView; | 144 | CalendarView *mView; |
144 | QAction *mNewSubTodoAction; | 145 | QAction *mNewSubTodoAction; |
145 | QAction *mWeekAction; | 146 | QAction *mWeekAction; |
146 | QFont mWeekFont; | 147 | QFont mWeekFont; |
147 | QPixmap mWeekPixmap; | 148 | QPixmap mWeekPixmap; |
148 | QColor mWeekBgColor; | 149 | QColor mWeekBgColor; |
149 | 150 | ||
150 | QAction *mShowAction; | 151 | QAction *mShowAction; |
151 | QAction *mEditAction; | 152 | QAction *mEditAction; |
152 | QAction *mDeleteAction; | 153 | QAction *mDeleteAction; |
153 | QAction *mCloneAction; | 154 | QAction *mCloneAction; |
154 | QAction *mMoveAction; | 155 | QAction *mMoveAction; |
155 | QAction *mBeamAction; | 156 | QAction *mBeamAction; |
156 | QAction *mCancelAction; | 157 | QAction *mCancelAction; |
157 | 158 | ||
158 | QAction *mToggleNav; | 159 | QAction *mToggleNav; |
159 | QAction *mToggleFilter; | 160 | QAction *mToggleFilter; |
160 | QAction *mToggleAllday; | 161 | QAction *mToggleAllday; |
161 | QAction *actionFilterMenuTB; | 162 | QAction *actionFilterMenuTB; |
162 | 163 | ||
163 | void closeEvent( QCloseEvent* ce ); | 164 | void closeEvent( QCloseEvent* ce ); |
164 | SimpleAlarmClient mAlarmClient; | 165 | SimpleAlarmClient mAlarmClient; |
165 | QTimer mSaveTimer; | 166 | QTimer mSaveTimer; |
166 | //bool mBlockSaveFlag; | 167 | //bool mBlockSaveFlag; |
167 | bool mCalendarModifiedFlag; | 168 | bool mCalendarModifiedFlag; |
168 | QPixmap loadPixmap( QString ); | 169 | QPixmap loadPixmap( QString ); |
169 | }; | 170 | }; |
170 | 171 | ||
171 | 172 | ||
172 | #endif | 173 | #endif |