summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-09-17 01:24:06 (UTC)
committer zautrix <zautrix>2004-09-17 01:24:06 (UTC)
commit35bc43cd453ab3f318e9a551670f6183d3001314 (patch) (unidiff)
tree2f5137a6e5efa8cd5b50cc7d40fe37c403517903
parent0461502d8a19961121206e89ae4bc5b6b8a91a57 (diff)
downloadkdepimpi-35bc43cd453ab3f318e9a551670f6183d3001314.zip
kdepimpi-35bc43cd453ab3f318e9a551670f6183d3001314.tar.gz
kdepimpi-35bc43cd453ab3f318e9a551670f6183d3001314.tar.bz2
include fixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagendaitem.cpp2
-rw-r--r--korganizer/komonthview.cpp2
-rw-r--r--korganizer/mainwindow.cpp2
3 files changed, 3 insertions, 3 deletions
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp
index a39feb1..f027343 100644
--- a/korganizer/koagendaitem.cpp
+++ b/korganizer/koagendaitem.cpp
@@ -1,720 +1,720 @@
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 <qlabel.h> 20#include <qlabel.h>
21#include <qlayout.h> 21#include <qlayout.h>
22#include <qhbox.h> 22#include <qhbox.h>
23#include <qvbox.h> 23#include <qvbox.h>
24#include <qtooltip.h> 24#include <qtooltip.h>
25#include <qwhatsthis.h> 25#include <qwhatsthis.h>
26#include <qdragobject.h> 26#include <qdragobject.h>
27#include <qdrawutil.h> 27#include <qdrawutil.h>
28#include <qpainter.h> 28#include <qpainter.h>
29 29
30#include <kiconloader.h> 30#include <kiconloader.h>
31#include <kdebug.h> 31#include <kdebug.h>
32#include <kglobal.h> 32#include <kglobal.h>
33#include <klocale.h> 33#include <klocale.h>
34#ifndef DESKTOP_VERSION 34#ifndef DESKTOP_VERSION
35#include <qpe/qpeapplication.h> 35#include <qpe/qpeapplication.h>
36#define AGENDA_ICON_SIZE 5 36#define AGENDA_ICON_SIZE 5
37#else 37#else
38#define AGENDA_ICON_SIZE 7 38#define AGENDA_ICON_SIZE 7
39#endif 39#endif
40#include <libkcal/icaldrag.h> 40#include <libkcal/icaldrag.h>
41#include <libkcal/vcaldrag.h> 41#include <libkcal/vcaldrag.h>
42#include <libkdepim/kincidenceformatter.h> 42#include <libkcal/kincidenceformatter.h>
43extern int globalFlagBlockAgenda; 43extern int globalFlagBlockAgenda;
44extern int globalFlagBlockAgendaItemPaint; 44extern int globalFlagBlockAgendaItemPaint;
45extern int globalFlagBlockAgendaItemUpdate; 45extern int globalFlagBlockAgendaItemUpdate;
46 46
47#include "koprefs.h" 47#include "koprefs.h"
48 48
49#include "koagendaitem.h" 49#include "koagendaitem.h"
50//#include "koagendaitem.moc" 50//#include "koagendaitem.moc"
51 51
52 52
53//-------------------------------------------------------------------------- 53//--------------------------------------------------------------------------
54 54
55QToolTipGroup *KOAgendaItem::mToolTipGroup = 0; 55QToolTipGroup *KOAgendaItem::mToolTipGroup = 0;
56 56
57//-------------------------------------------------------------------------- 57//--------------------------------------------------------------------------
58 58
59KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool allday, 59KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool allday,
60 const char *name,WFlags) : 60 const char *name,WFlags) :
61 QWidget(parent, name), mIncidence(incidence), mDate(qd) 61 QWidget(parent, name), mIncidence(incidence), mDate(qd)
62{ 62{
63#ifndef DESKTOP_VERSION 63#ifndef DESKTOP_VERSION
64 QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); 64 QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold );
65#endif 65#endif
66 int wflags = getWFlags() |WRepaintNoErase;// WResizeNoErase 66 int wflags = getWFlags() |WRepaintNoErase;// WResizeNoErase
67 setWFlags ( wflags); 67 setWFlags ( wflags);
68 mAllDay = allday; 68 mAllDay = allday;
69 init ( incidence, qd ); 69 init ( incidence, qd );
70 setMouseTracking(true); 70 setMouseTracking(true);
71 //setAcceptDrops(true); 71 //setAcceptDrops(true);
72 xPaintCoord = -1; 72 xPaintCoord = -1;
73 yPaintCoord = -1; 73 yPaintCoord = -1;
74} 74}
75 75
76void KOAgendaItem::init ( Incidence *incidence, QDate qd ) 76void KOAgendaItem::init ( Incidence *incidence, QDate qd )
77{ 77{
78 mIncidence = incidence; 78 mIncidence = incidence;
79 mDate = qd; 79 mDate = qd;
80 mFirstMultiItem = 0; 80 mFirstMultiItem = 0;
81 mNextMultiItem = 0; 81 mNextMultiItem = 0;
82 mLastMultiItem = 0; 82 mLastMultiItem = 0;
83 computeText(); 83 computeText();
84 84
85 if ( (incidence->type() == "Todo") && 85 if ( (incidence->type() == "Todo") &&
86 ( !((static_cast<Todo*>(incidence))->isCompleted()) && 86 ( !((static_cast<Todo*>(incidence))->isCompleted()) &&
87 ((static_cast<Todo*>(incidence))->dtDue().date() <= QDate::currentDate()) ) ) { 87 ((static_cast<Todo*>(incidence))->dtDue().date() <= QDate::currentDate()) ) ) {
88 if ( (static_cast<Todo*>(incidence))->dtDue() < QDateTime::currentDateTime().date()) 88 if ( (static_cast<Todo*>(incidence))->dtDue() < QDateTime::currentDateTime().date())
89 mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ; 89 mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ;
90 else 90 else
91 mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor; 91 mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor;
92 } 92 }
93 else { 93 else {
94 QStringList categories = mIncidence->categories(); 94 QStringList categories = mIncidence->categories();
95 QString cat = categories.first(); 95 QString cat = categories.first();
96 if (cat.isEmpty()) { 96 if (cat.isEmpty()) {
97 mBackgroundColor =KOPrefs::instance()->mEventColor; 97 mBackgroundColor =KOPrefs::instance()->mEventColor;
98 } else { 98 } else {
99 mBackgroundColor = *KOPrefs::instance()->categoryColor(cat); 99 mBackgroundColor = *KOPrefs::instance()->categoryColor(cat);
100 } 100 }
101 } 101 }
102 mColorGroup = QColorGroup( mBackgroundColor.light(), 102 mColorGroup = QColorGroup( mBackgroundColor.light(),
103 mBackgroundColor.dark(),mBackgroundColor.light(), 103 mBackgroundColor.dark(),mBackgroundColor.light(),
104 mBackgroundColor.dark(),mBackgroundColor, black, mBackgroundColor) ; 104 mBackgroundColor.dark(),mBackgroundColor, black, mBackgroundColor) ;
105 setBackgroundColor( mBackgroundColor ); 105 setBackgroundColor( mBackgroundColor );
106 106
107 setCellXY(0,0,1); 107 setCellXY(0,0,1);
108 setCellXWidth(0); 108 setCellXWidth(0);
109 setSubCell(0); 109 setSubCell(0);
110 setSubCells(1); 110 setSubCells(1);
111 setMultiItem(0,0,0); 111 setMultiItem(0,0,0);
112 startMove(); 112 startMove();
113 mSelected = true; 113 mSelected = true;
114 select(false); 114 select(false);
115 QString tipText = mIncidence->summary(); 115 QString tipText = mIncidence->summary();
116 // QToolTip::add(this,tipText); 116 // QToolTip::add(this,tipText);
117 QWhatsThis::add(this,KIncidenceFormatter::instance()->getFormattedText( mIncidence )); 117 QWhatsThis::add(this,KIncidenceFormatter::instance()->getFormattedText( mIncidence ));
118 if ( !mIncidence->doesFloat() ) 118 if ( !mIncidence->doesFloat() )
119 if ( mIncidence->type() == "Event" ) { 119 if ( mIncidence->type() == "Event" ) {
120 if ( (static_cast<Event*>(mIncidence))->isMultiDay() ) { 120 if ( (static_cast<Event*>(mIncidence))->isMultiDay() ) {
121 tipText += "\n"+i18n("From: ")+mIncidence->dtStartStr(); 121 tipText += "\n"+i18n("From: ")+mIncidence->dtStartStr();
122 tipText += "\n"+i18n("To: ")+(static_cast<Event*>(mIncidence))->dtEndStr(); 122 tipText += "\n"+i18n("To: ")+(static_cast<Event*>(mIncidence))->dtEndStr();
123 } 123 }
124 else { 124 else {
125 tipText += "\n"+i18n("Time: ")+mIncidence->dtStartTimeStr(); 125 tipText += "\n"+i18n("Time: ")+mIncidence->dtStartTimeStr();
126 tipText += " - "+(static_cast<Event*>(mIncidence))->dtEndTimeStr(); 126 tipText += " - "+(static_cast<Event*>(mIncidence))->dtEndTimeStr();
127 } 127 }
128 } 128 }
129 else if ( mIncidence->type() == "Todo" ) { 129 else if ( mIncidence->type() == "Todo" ) {
130 tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueTimeStr(); 130 tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueTimeStr();
131 } 131 }
132 132
133 if (!mIncidence->location().isEmpty()) { 133 if (!mIncidence->location().isEmpty()) {
134 tipText += "\n"+i18n("Location: ")+mIncidence->location(); 134 tipText += "\n"+i18n("Location: ")+mIncidence->location();
135 } 135 }
136 QToolTip::add(this,tipText,toolTipGroup(),""); 136 QToolTip::add(this,tipText,toolTipGroup(),"");
137 QFontMetrics fontinf(KOPrefs::instance()->mAgendaViewFont); 137 QFontMetrics fontinf(KOPrefs::instance()->mAgendaViewFont);
138 mFontPixelSize = fontinf.height();; 138 mFontPixelSize = fontinf.height();;
139 hide(); 139 hide();
140 xPaintCoord = -1; 140 xPaintCoord = -1;
141 yPaintCoord = -1; 141 yPaintCoord = -1;
142} 142}
143 143
144 144
145KOAgendaItem::~KOAgendaItem() 145KOAgendaItem::~KOAgendaItem()
146{ 146{
147 // qDebug("deleteKOAgendaItem::~KOAgendaItem( "); 147 // qDebug("deleteKOAgendaItem::~KOAgendaItem( ");
148 148
149} 149}
150 150
151void KOAgendaItem::recreateIncidence() 151void KOAgendaItem::recreateIncidence()
152{ 152{
153 Incidence* newInc = mIncidence->clone(); 153 Incidence* newInc = mIncidence->clone();
154 newInc->recreate(); 154 newInc->recreate();
155 if ( mIncidence->doesRecur() ) { 155 if ( mIncidence->doesRecur() ) {
156 mIncidence->addExDate( mDate ); 156 mIncidence->addExDate( mDate );
157 newInc->recurrence()->unsetRecurs(); 157 newInc->recurrence()->unsetRecurs();
158 int len = mIncidence->dtStart().secsTo( ((Event*)mIncidence)->dtEnd()); 158 int len = mIncidence->dtStart().secsTo( ((Event*)mIncidence)->dtEnd());
159 QTime tim = mIncidence->dtStart().time(); 159 QTime tim = mIncidence->dtStart().time();
160 newInc->setDtStart( QDateTime(mDate, tim) ); 160 newInc->setDtStart( QDateTime(mDate, tim) );
161 ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); 161 ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) );
162 } 162 }
163 mIncidence = newInc; 163 mIncidence = newInc;
164} 164}
165bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout) 165bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout)
166{ 166{
167 int size = AGENDA_ICON_SIZE; 167 int size = AGENDA_ICON_SIZE;
168 168
169 int yOff = 0; 169 int yOff = 0;
170 int xOff = 0; 170 int xOff = 0;
171 int x = pos().x() +3; 171 int x = pos().x() +3;
172 int y; 172 int y;
173 if ( mAllDay ) 173 if ( mAllDay )
174 y = pos().y()+3; 174 y = pos().y()+3;
175 else 175 else
176 y = mCellYTop * ( height() / cellHeight() ) +3; 176 y = mCellYTop * ( height() / cellHeight() ) +3;
177 if (mIncidence->cancelled()) { 177 if (mIncidence->cancelled()) {
178 int xpos = xOff*( 1 +AGENDA_ICON_SIZE )+x; 178 int xpos = xOff*( 1 +AGENDA_ICON_SIZE )+x;
179 int ypos = yOff*( 1 +AGENDA_ICON_SIZE)+y; 179 int ypos = yOff*( 1 +AGENDA_ICON_SIZE)+y;
180 p->drawLine( xpos, ypos, xpos+AGENDA_ICON_SIZE-1, ypos+AGENDA_ICON_SIZE-1 ); 180 p->drawLine( xpos, ypos, xpos+AGENDA_ICON_SIZE-1, ypos+AGENDA_ICON_SIZE-1 );
181 p->drawLine( xpos, ypos+AGENDA_ICON_SIZE-1, xpos+AGENDA_ICON_SIZE-1, ypos ); 181 p->drawLine( xpos, ypos+AGENDA_ICON_SIZE-1, xpos+AGENDA_ICON_SIZE-1, ypos );
182 if ( horLayout ) 182 if ( horLayout )
183 ++xOff; 183 ++xOff;
184 else 184 else
185 ++yOff; 185 ++yOff;
186 } 186 }
187 if (mIncidence->isAlarmEnabled()) { 187 if (mIncidence->isAlarmEnabled()) {
188 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, red ); 188 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, red );
189 if ( horLayout ) 189 if ( horLayout )
190 ++xOff; 190 ++xOff;
191 else 191 else
192 ++yOff; 192 ++yOff;
193 } 193 }
194 if (mIncidence->recurrence()->doesRecur()) { 194 if (mIncidence->recurrence()->doesRecur()) {
195 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, blue ); 195 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, blue );
196 if ( horLayout ) 196 if ( horLayout )
197 ++xOff; 197 ++xOff;
198 else 198 else
199 ++yOff; 199 ++yOff;
200 } 200 }
201 if (mIncidence->description().length() > 0) { 201 if (mIncidence->description().length() > 0) {
202 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkGreen ); 202 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkGreen );
203 if ( horLayout ) 203 if ( horLayout )
204 ++xOff; 204 ++xOff;
205 else 205 else
206 ++yOff; 206 ++yOff;
207 } 207 }
208 if (mIncidence->isReadOnly()) { 208 if (mIncidence->isReadOnly()) {
209 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, white ); 209 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, white );
210 if ( horLayout ) 210 if ( horLayout )
211 ++xOff; 211 ++xOff;
212 else 212 else
213 ++yOff; 213 ++yOff;
214 } 214 }
215 215
216 if (mIncidence->attendeeCount()>0) { 216 if (mIncidence->attendeeCount()>0) {
217 217
218 if (mIncidence->organizer() == KOPrefs::instance()->email()) { 218 if (mIncidence->organizer() == KOPrefs::instance()->email()) {
219 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, black ); 219 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, black );
220 if ( horLayout ) 220 if ( horLayout )
221 ++xOff; 221 ++xOff;
222 else 222 else
223 ++yOff; 223 ++yOff;
224 } else { 224 } else {
225 Attendee *me = mIncidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); 225 Attendee *me = mIncidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email());
226 if (me!=0) { 226 if (me!=0) {
227 227
228 228
229 } else { 229 } else {
230 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, yellow ); 230 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, yellow );
231 if ( horLayout ) 231 if ( horLayout )
232 ++xOff; 232 ++xOff;
233 else 233 else
234 ++yOff; 234 ++yOff;
235 235
236 } 236 }
237 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkYellow ); 237 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkYellow );
238 if ( horLayout ) 238 if ( horLayout )
239 ++xOff; 239 ++xOff;
240 else 240 else
241 ++yOff; 241 ++yOff;
242 242
243 } 243 }
244 244
245 } 245 }
246 return ( yOff || xOff ); 246 return ( yOff || xOff );
247} 247}
248 248
249 249
250void KOAgendaItem::select(bool selected) 250void KOAgendaItem::select(bool selected)
251{ 251{
252 //qDebug("select %d %d",firstMultiItem(), nextMultiItem() ); 252 //qDebug("select %d %d",firstMultiItem(), nextMultiItem() );
253 if (mSelected == selected) return; 253 if (mSelected == selected) return;
254 mSelected = selected; 254 mSelected = selected;
255 if ( ! isVisible() ) 255 if ( ! isVisible() )
256 return; 256 return;
257 if ( firstMultiItem() ) 257 if ( firstMultiItem() )
258 firstMultiItem()->select( selected ); 258 firstMultiItem()->select( selected );
259 if ( !firstMultiItem() && nextMultiItem() ) { 259 if ( !firstMultiItem() && nextMultiItem() ) {
260 KOAgendaItem * placeItem = nextMultiItem(); 260 KOAgendaItem * placeItem = nextMultiItem();
261 while ( placeItem ) { 261 while ( placeItem ) {
262 placeItem->select( selected ); 262 placeItem->select( selected );
263 placeItem = placeItem->nextMultiItem(); 263 placeItem = placeItem->nextMultiItem();
264 } 264 }
265 } 265 }
266 globalFlagBlockAgendaItemUpdate = 0; 266 globalFlagBlockAgendaItemUpdate = 0;
267 paintMe( selected ); 267 paintMe( selected );
268 globalFlagBlockAgendaItemUpdate = 1; 268 globalFlagBlockAgendaItemUpdate = 1;
269 repaint( false ); 269 repaint( false );
270} 270}
271 271
272 272
273/* 273/*
274 The eventFilter has to filter the mouse events of the agenda item childs. The 274 The eventFilter has to filter the mouse events of the agenda item childs. The
275 events are fed into the event handling method of KOAgendaItem. This allows the 275 events are fed into the event handling method of KOAgendaItem. This allows the
276 KOAgenda to handle the KOAgendaItems by using an eventFilter. 276 KOAgenda to handle the KOAgendaItems by using an eventFilter.
277*/ 277*/
278bool KOAgendaItem::eventFilter ( QObject *object, QEvent *e ) 278bool KOAgendaItem::eventFilter ( QObject *object, QEvent *e )
279{ 279{
280 if (e->type() == QEvent::MouseButtonPress || 280 if (e->type() == QEvent::MouseButtonPress ||
281 e->type() == QEvent::MouseButtonDblClick || 281 e->type() == QEvent::MouseButtonDblClick ||
282 e->type() == QEvent::MouseButtonRelease || 282 e->type() == QEvent::MouseButtonRelease ||
283 e->type() == QEvent::MouseMove) { 283 e->type() == QEvent::MouseMove) {
284 QMouseEvent *me = (QMouseEvent *)e; 284 QMouseEvent *me = (QMouseEvent *)e;
285 QPoint itemPos = this->mapFromGlobal(((QWidget *)object)-> 285 QPoint itemPos = this->mapFromGlobal(((QWidget *)object)->
286 mapToGlobal(me->pos())); 286 mapToGlobal(me->pos()));
287 QMouseEvent returnEvent (e->type(),itemPos,me->button(),me->state()); 287 QMouseEvent returnEvent (e->type(),itemPos,me->button(),me->state());
288 return event(&returnEvent); 288 return event(&returnEvent);
289 } else { 289 } else {
290 return false; 290 return false;
291 } 291 }
292} 292}
293void KOAgendaItem::repaintMe( ) 293void KOAgendaItem::repaintMe( )
294{ 294{
295 paintMe ( mSelected ); 295 paintMe ( mSelected );
296} 296}
297void KOAgendaItem::paintMe( bool selected, QPainter* paint ) 297void KOAgendaItem::paintMe( bool selected, QPainter* paint )
298{ 298{
299 if ( globalFlagBlockAgendaItemUpdate && ! selected) 299 if ( globalFlagBlockAgendaItemUpdate && ! selected)
300 return; 300 return;
301 QPainter pa; 301 QPainter pa;
302 302
303 if ( mSelected ) { 303 if ( mSelected ) {
304 pa.begin( paintPixSel() ); 304 pa.begin( paintPixSel() );
305 } else { 305 } else {
306 if ( mAllDay ) 306 if ( mAllDay )
307 pa.begin( paintPixAllday() ); 307 pa.begin( paintPixAllday() );
308 else 308 else
309 pa.begin( paintPix() ); 309 pa.begin( paintPix() );
310 } 310 }
311 int x, yy, w, h; 311 int x, yy, w, h;
312 float nfh; 312 float nfh;
313 x = pos().x(); w = width(); h = height (); 313 x = pos().x(); w = width(); h = height ();
314 if ( mAllDay ) 314 if ( mAllDay )
315 yy = y(); 315 yy = y();
316 else 316 else
317 yy = mCellYTop * ( height() / cellHeight() ); 317 yy = mCellYTop * ( height() / cellHeight() );
318 xPaintCoord= x; 318 xPaintCoord= x;
319 yPaintCoord = yy; 319 yPaintCoord = yy;
320 wPaintCoord = width(); 320 wPaintCoord = width();
321 hPaintCoord = height(); 321 hPaintCoord = height();
322 //qDebug("paintMe %s %d %d %d %d",incidence()->summary().latin1(), x, yy, width(), height()); 322 //qDebug("paintMe %s %d %d %d %d",incidence()->summary().latin1(), x, yy, width(), height());
323 if ( paint == 0 ) 323 if ( paint == 0 )
324 paint = &pa; 324 paint = &pa;
325 bool horLayout = ( w < h ); 325 bool horLayout = ( w < h );
326 int maxhei = mFontPixelSize+4; 326 int maxhei = mFontPixelSize+4;
327 if ( horLayout ) 327 if ( horLayout )
328 maxhei += AGENDA_ICON_SIZE -4; 328 maxhei += AGENDA_ICON_SIZE -4;
329 bool small = ( h < maxhei ); 329 bool small = ( h < maxhei );
330 if ( ! small ) 330 if ( ! small )
331 paint->setFont(KOPrefs::instance()->mAgendaViewFont); 331 paint->setFont(KOPrefs::instance()->mAgendaViewFont);
332 else { 332 else {
333 QFont f = KOPrefs::instance()->mAgendaViewFont; 333 QFont f = KOPrefs::instance()->mAgendaViewFont;
334 f.setBold( false ); 334 f.setBold( false );
335 int fh = f.pointSize(); 335 int fh = f.pointSize();
336 nfh = (((float)height())/(float)(mFontPixelSize+4))*fh; 336 nfh = (((float)height())/(float)(mFontPixelSize+4))*fh;
337 if ( nfh < 6 ) 337 if ( nfh < 6 )
338 nfh = 6; 338 nfh = 6;
339 f.setPointSize( nfh ); 339 f.setPointSize( nfh );
340 paint->setFont(f); 340 paint->setFont(f);
341 } 341 }
342 paint->fillRect ( x, yy, w, h, mBackgroundColor ); 342 paint->fillRect ( x, yy, w, h, mBackgroundColor );
343 static const QPixmap completedPxmp = SmallIcon("greenhook16"); 343 static const QPixmap completedPxmp = SmallIcon("greenhook16");
344 static const QPixmap overduePxmp = SmallIcon("redcross16"); 344 static const QPixmap overduePxmp = SmallIcon("redcross16");
345 if ( mIncidence->type() == "Todo" ) { 345 if ( mIncidence->type() == "Todo" ) {
346 Todo* tempTodo = static_cast<Todo*>(mIncidence); 346 Todo* tempTodo = static_cast<Todo*>(mIncidence);
347 int xx = pos().x()+(width()-completedPxmp.width()-3 ); 347 int xx = pos().x()+(width()-completedPxmp.width()-3 );
348 int yyy = yy+3; 348 int yyy = yy+3;
349 if ( tempTodo->isCompleted() ) 349 if ( tempTodo->isCompleted() )
350 paint->drawPixmap ( xx, yyy, completedPxmp ); 350 paint->drawPixmap ( xx, yyy, completedPxmp );
351 else { 351 else {
352 paint->drawPixmap ( xx, yyy, overduePxmp ); 352 paint->drawPixmap ( xx, yyy, overduePxmp );
353 353
354 } 354 }
355 } 355 }
356 bool addIcon = false; 356 bool addIcon = false;
357 if ( ! small || w > 3 * h || h > 3* w ) 357 if ( ! small || w > 3 * h || h > 3* w )
358 addIcon = updateIcons( paint, horLayout ); 358 addIcon = updateIcons( paint, horLayout );
359 359
360 qDrawShadePanel (paint, x, yy, w, h, mColorGroup, selected , 2, 0); 360 qDrawShadePanel (paint, x, yy, w, h, mColorGroup, selected , 2, 0);
361 //qDebug("draw rect %d %d %d %d ",x, yy, w, h ); 361 //qDebug("draw rect %d %d %d %d ",x, yy, w, h );
362 if ( ! small ) { 362 if ( ! small ) {
363 x += 3; yy += 3;w -= 6; h-= 5; 363 x += 3; yy += 3;w -= 6; h-= 5;
364 } else { 364 } else {
365 x += 2; yy += 1;w -= 4; h-= 4; 365 x += 2; yy += 1;w -= 4; h-= 4;
366 if ( nfh < 6.01 ) { 366 if ( nfh < 6.01 ) {
367 yy -= 2; 367 yy -= 2;
368 h += 4; 368 h += 4;
369 } 369 }
370 else 370 else
371 if ( nfh < h -2 ) 371 if ( nfh < h -2 )
372 ++yy; 372 ++yy;
373 } 373 }
374 int align; 374 int align;
375#ifndef DESKTOP_VERSION 375#ifndef DESKTOP_VERSION
376 align = ( AlignLeft|WordBreak|AlignTop); 376 align = ( AlignLeft|WordBreak|AlignTop);
377#else 377#else
378 align = ( AlignLeft|BreakAnywhere|WordBreak|AlignTop); 378 align = ( AlignLeft|BreakAnywhere|WordBreak|AlignTop);
379#endif 379#endif
380 if ( addIcon ) { 380 if ( addIcon ) {
381 if ( ! horLayout ) { 381 if ( ! horLayout ) {
382 x += AGENDA_ICON_SIZE+3; 382 x += AGENDA_ICON_SIZE+3;
383 w -= (AGENDA_ICON_SIZE+3); 383 w -= (AGENDA_ICON_SIZE+3);
384 } 384 }
385 else { 385 else {
386 yy+= AGENDA_ICON_SIZE+2; 386 yy+= AGENDA_ICON_SIZE+2;
387 h -=(AGENDA_ICON_SIZE+3); 387 h -=(AGENDA_ICON_SIZE+3);
388 } 388 }
389 } 389 }
390 int colsum = mBackgroundColor.red() + mBackgroundColor.green() + mBackgroundColor.blue(); 390 int colsum = mBackgroundColor.red() + mBackgroundColor.green() + mBackgroundColor.blue();
391 if ( colsum < 250 ) 391 if ( colsum < 250 )
392 paint->setPen ( white); 392 paint->setPen ( white);
393 if ( x < 0 ) { 393 if ( x < 0 ) {
394 w = w+x-3; 394 w = w+x-3;
395 x = 3; 395 x = 3;
396 if ( w > parentWidget()->width() ){ 396 if ( w > parentWidget()->width() ){
397 w = parentWidget()->width() - 6; 397 w = parentWidget()->width() - 6;
398#ifndef DESKTOP_VERSION 398#ifndef DESKTOP_VERSION
399 align = ( AlignCenter|WordBreak); 399 align = ( AlignCenter|WordBreak);
400#else 400#else
401 align = ( AlignCenter|BreakAnywhere|WordBreak); 401 align = ( AlignCenter|BreakAnywhere|WordBreak);
402#endif 402#endif
403 403
404 } 404 }
405 } 405 }
406 QRect dr; 406 QRect dr;
407 paint->drawText ( x, yy, w, h, align, mDisplayedText, -1, &dr ); 407 paint->drawText ( x, yy, w, h, align, mDisplayedText, -1, &dr );
408 if ( mIncidence->cancelled() ){ 408 if ( mIncidence->cancelled() ){
409 if ( ! small ) { 409 if ( ! small ) {
410 QFontMetrics fm ( paint->font() ); 410 QFontMetrics fm ( paint->font() );
411 paint->drawLine(dr.left(), yy+fm.height()/2, dr.right()-2, yy+fm.height()/2); 411 paint->drawLine(dr.left(), yy+fm.height()/2, dr.right()-2, yy+fm.height()/2);
412 } 412 }
413 413
414 } 414 }
415 pa.end(); 415 pa.end();
416 416
417} 417}
418void KOAgendaItem::resizePixmap( int w , int h ) 418void KOAgendaItem::resizePixmap( int w , int h )
419{ 419{
420 paintPix()->resize( w, h ); 420 paintPix()->resize( w, h );
421 paintPixSel()->resize( w, h ); 421 paintPixSel()->resize( w, h );
422 422
423} 423}
424QPixmap * KOAgendaItem::paintPix() 424QPixmap * KOAgendaItem::paintPix()
425{ 425{
426 static QPixmap* mPaintPix = 0; 426 static QPixmap* mPaintPix = 0;
427 if ( ! mPaintPix ) 427 if ( ! mPaintPix )
428 mPaintPix = new QPixmap(); 428 mPaintPix = new QPixmap();
429 return mPaintPix ; 429 return mPaintPix ;
430} 430}
431QPixmap * KOAgendaItem::paintPixAllday() 431QPixmap * KOAgendaItem::paintPixAllday()
432{ 432{
433 static QPixmap* mPaintPixA = 0; 433 static QPixmap* mPaintPixA = 0;
434 if ( ! mPaintPixA ) 434 if ( ! mPaintPixA )
435 mPaintPixA = new QPixmap(); 435 mPaintPixA = new QPixmap();
436 return mPaintPixA ; 436 return mPaintPixA ;
437} 437}
438QPixmap * KOAgendaItem::paintPixSel() 438QPixmap * KOAgendaItem::paintPixSel()
439{ 439{
440 static QPixmap* mPaintPixSel = 0; 440 static QPixmap* mPaintPixSel = 0;
441 if ( ! mPaintPixSel ) 441 if ( ! mPaintPixSel )
442 mPaintPixSel = new QPixmap(); 442 mPaintPixSel = new QPixmap();
443 return mPaintPixSel ; 443 return mPaintPixSel ;
444} 444}
445void KOAgendaItem::paintEvent ( QPaintEvent *e ) 445void KOAgendaItem::paintEvent ( QPaintEvent *e )
446{ 446{
447 447
448 if ( globalFlagBlockAgendaItemPaint ) 448 if ( globalFlagBlockAgendaItemPaint )
449 return; 449 return;
450 if ( globalFlagBlockAgenda > 0 && globalFlagBlockAgenda < 5 ) 450 if ( globalFlagBlockAgenda > 0 && globalFlagBlockAgenda < 5 )
451 return; 451 return;
452 int yy; 452 int yy;
453 if ( mAllDay ) 453 if ( mAllDay )
454 yy = y(); 454 yy = y();
455 else 455 else
456 yy = mCellYTop * ( height() / cellHeight() ); 456 yy = mCellYTop * ( height() / cellHeight() );
457 int xx = x(); 457 int xx = x();
458 if ( xPaintCoord != xx || yPaintCoord != yy || 458 if ( xPaintCoord != xx || yPaintCoord != yy ||
459 wPaintCoord != width() || hPaintCoord != height()) { 459 wPaintCoord != width() || hPaintCoord != height()) {
460 xPaintCoord= xx; 460 xPaintCoord= xx;
461 yPaintCoord = yy; 461 yPaintCoord = yy;
462 wPaintCoord = width(); 462 wPaintCoord = width();
463 hPaintCoord = height(); 463 hPaintCoord = height();
464 globalFlagBlockAgendaItemUpdate = 0; 464 globalFlagBlockAgendaItemUpdate = 0;
465 paintMe( mSelected ); 465 paintMe( mSelected );
466 //qDebug("calling paintMe "); 466 //qDebug("calling paintMe ");
467 globalFlagBlockAgendaItemUpdate = 1; 467 globalFlagBlockAgendaItemUpdate = 1;
468 } 468 }
469 int rx, ry, rw, rh; 469 int rx, ry, rw, rh;
470 rx = e->rect().x(); 470 rx = e->rect().x();
471 ry = e->rect().y(); 471 ry = e->rect().y();
472 rw = e->rect().width(); 472 rw = e->rect().width();
473 rh = e->rect().height(); 473 rh = e->rect().height();
474 //qDebug(" paintevent %s %d %d %d %d", mIncidence->summary().latin1(), x(), yy, width(), height()); 474 //qDebug(" paintevent %s %d %d %d %d", mIncidence->summary().latin1(), x(), yy, width(), height());
475 475
476 QPixmap* paintFrom ; 476 QPixmap* paintFrom ;
477 if ( mSelected ) { 477 if ( mSelected ) {
478 paintFrom = paintPixSel(); 478 paintFrom = paintPixSel();
479 } else { 479 } else {
480 if ( mAllDay ) 480 if ( mAllDay )
481 paintFrom = paintPixAllday(); 481 paintFrom = paintPixAllday();
482 else 482 else
483 paintFrom = paintPix(); 483 paintFrom = paintPix();
484 } 484 }
485 bitBlt (this, rx, ry, paintFrom, x()+rx ,yPaintCoord+ry, rw, rh ,CopyROP); 485 bitBlt (this, rx, ry, paintFrom, x()+rx ,yPaintCoord+ry, rw, rh ,CopyROP);
486} 486}
487void KOAgendaItem::computeText() 487void KOAgendaItem::computeText()
488{ 488{
489 mDisplayedText = mIncidence->summary(); 489 mDisplayedText = mIncidence->summary();
490 if ( (mIncidence->type() == "Todo") ) { 490 if ( (mIncidence->type() == "Todo") ) {
491 if ( static_cast<Todo*>(mIncidence)->dtDue().date() < QDate::currentDate() ) 491 if ( static_cast<Todo*>(mIncidence)->dtDue().date() < QDate::currentDate() )
492 mDisplayedText += i18n(" (") +KGlobal::locale()->formatDate((static_cast<Todo*>(mIncidence))->dtDue().date(), true)+")"; 492 mDisplayedText += i18n(" (") +KGlobal::locale()->formatDate((static_cast<Todo*>(mIncidence))->dtDue().date(), true)+")";
493 else if ( !(mIncidence->doesFloat())) 493 else if ( !(mIncidence->doesFloat()))
494 mDisplayedText += i18n(" (") +KGlobal::locale()->formatTime((static_cast<Todo*>(mIncidence))->dtDue().time())+")"; 494 mDisplayedText += i18n(" (") +KGlobal::locale()->formatTime((static_cast<Todo*>(mIncidence))->dtDue().time())+")";
495 495
496 496
497 497
498 } else { 498 } else {
499 if ( !(mIncidence->doesFloat())) 499 if ( !(mIncidence->doesFloat()))
500 mDisplayedText += ": " +KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtStart().time()) + "-" + KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtEnd().time()) ; 500 mDisplayedText += ": " +KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtStart().time()) + "-" + KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtEnd().time()) ;
501 501
502 if ( mAllDay ) { 502 if ( mAllDay ) {
503 if ( mIncidence->dtStart().date().addDays(3) < mIncidence->dtEnd().date() ) { 503 if ( mIncidence->dtStart().date().addDays(3) < mIncidence->dtEnd().date() ) {
504 mDisplayedText += ": " +KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtStart().date(), true) + " - " + KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtEnd().date(), true) ; 504 mDisplayedText += ": " +KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtStart().date(), true) + " - " + KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtEnd().date(), true) ;
505 } 505 }
506 } 506 }
507 507
508 } 508 }
509 509
510 if ( !mIncidence->location().isEmpty() ) { 510 if ( !mIncidence->location().isEmpty() ) {
511 if ( mAllDay ) 511 if ( mAllDay )
512 mDisplayedText += " ("; 512 mDisplayedText += " (";
513 else 513 else
514 mDisplayedText += "\n("; 514 mDisplayedText += "\n(";
515 mDisplayedText += mIncidence->location() +")"; 515 mDisplayedText += mIncidence->location() +")";
516 } 516 }
517} 517}
518void KOAgendaItem::updateItem() 518void KOAgendaItem::updateItem()
519{ 519{
520 computeText(); 520 computeText();
521 521
522 //qDebug("KOAgendaItem:: updateItem() %s %d %d ",incidence()->summary().latin1(), x(), y()); 522 //qDebug("KOAgendaItem:: updateItem() %s %d %d ",incidence()->summary().latin1(), x(), y());
523 paintMe( mSelected ); 523 paintMe( mSelected );
524 repaint( false); 524 repaint( false);
525} 525}
526 526
527void KOAgendaItem::resizeEvent ( QResizeEvent *ev ) 527void KOAgendaItem::resizeEvent ( QResizeEvent *ev )
528{ 528{
529 //qDebug("KOAgendaItem::resizeEvent %s ", mIncidence->summary().latin1()); 529 //qDebug("KOAgendaItem::resizeEvent %s ", mIncidence->summary().latin1());
530 paintMe( mSelected ); 530 paintMe( mSelected );
531 repaint( false ); 531 repaint( false );
532} 532}
533 533
534/* 534/*
535 Return height of item in units of agenda cells 535 Return height of item in units of agenda cells
536*/ 536*/
537int KOAgendaItem::cellHeight() 537int KOAgendaItem::cellHeight()
538{ 538{
539 int ret = mCellYBottom - mCellYTop + 1; 539 int ret = mCellYBottom - mCellYTop + 1;
540 if ( ret <= 0 ) { 540 if ( ret <= 0 ) {
541 ret = 1; 541 ret = 1;
542 mCellYBottom = 0; 542 mCellYBottom = 0;
543 mCellYTop = 0; 543 mCellYTop = 0;
544 } 544 }
545 return ret; 545 return ret;
546} 546}
547 547
548/* 548/*
549 Return height of item in units of agenda cells 549 Return height of item in units of agenda cells
550*/ 550*/
551int KOAgendaItem::cellWidth() 551int KOAgendaItem::cellWidth()
552{ 552{
553 return mCellXWidth - mCellX + 1; 553 return mCellXWidth - mCellX + 1;
554} 554}
555 555
556void KOAgendaItem::setItemDate(QDate qd) 556void KOAgendaItem::setItemDate(QDate qd)
557{ 557{
558 mDate = qd; 558 mDate = qd;
559} 559}
560 560
561void KOAgendaItem::setCellXY(int X, int YTop, int YBottom) 561void KOAgendaItem::setCellXY(int X, int YTop, int YBottom)
562{ 562{
563 mCellX = X; 563 mCellX = X;
564 mCellYTop = YTop; 564 mCellYTop = YTop;
565 mCellYBottom = YBottom; 565 mCellYBottom = YBottom;
566} 566}
567 567
568void KOAgendaItem::setCellXWidth(int xwidth) 568void KOAgendaItem::setCellXWidth(int xwidth)
569{ 569{
570 mCellXWidth = xwidth; 570 mCellXWidth = xwidth;
571} 571}
572 572
573void KOAgendaItem::setCellX(int XLeft, int XRight) 573void KOAgendaItem::setCellX(int XLeft, int XRight)
574{ 574{
575 mCellX = XLeft; 575 mCellX = XLeft;
576 mCellXWidth = XRight; 576 mCellXWidth = XRight;
577} 577}
578 578
579void KOAgendaItem::setCellY(int YTop, int YBottom) 579void KOAgendaItem::setCellY(int YTop, int YBottom)
580{ 580{
581 mCellYTop = YTop; 581 mCellYTop = YTop;
582 mCellYBottom = YBottom; 582 mCellYBottom = YBottom;
583} 583}
584 584
585void KOAgendaItem::setSubCell(int subCell) 585void KOAgendaItem::setSubCell(int subCell)
586{ 586{
587 mSubCell = subCell; 587 mSubCell = subCell;
588} 588}
589 589
590void KOAgendaItem::setSubCells(int subCells) 590void KOAgendaItem::setSubCells(int subCells)
591{ 591{
592 mSubCells = subCells; 592 mSubCells = subCells;
593} 593}
594 594
595void KOAgendaItem::setMultiItem(KOAgendaItem *first,KOAgendaItem *next, 595void KOAgendaItem::setMultiItem(KOAgendaItem *first,KOAgendaItem *next,
596 KOAgendaItem *last) 596 KOAgendaItem *last)
597{ 597{
598 mFirstMultiItem = first; 598 mFirstMultiItem = first;
599 mNextMultiItem = next; 599 mNextMultiItem = next;
600 mLastMultiItem = last; 600 mLastMultiItem = last;
601} 601}
602 602
603void KOAgendaItem::startMove() 603void KOAgendaItem::startMove()
604{ 604{
605 mStartCellX = mCellX; 605 mStartCellX = mCellX;
606 mStartCellXWidth = mCellXWidth; 606 mStartCellXWidth = mCellXWidth;
607 mStartCellYTop = mCellYTop; 607 mStartCellYTop = mCellYTop;
608 mStartCellYBottom = mCellYBottom; 608 mStartCellYBottom = mCellYBottom;
609} 609}
610 610
611void KOAgendaItem::resetMove() 611void KOAgendaItem::resetMove()
612{ 612{
613 mCellX = mStartCellX; 613 mCellX = mStartCellX;
614 mCellXWidth = mStartCellXWidth; 614 mCellXWidth = mStartCellXWidth;
615 mCellYTop = mStartCellYTop; 615 mCellYTop = mStartCellYTop;
616 mCellYBottom = mStartCellYBottom; 616 mCellYBottom = mStartCellYBottom;
617} 617}
618 618
619void KOAgendaItem::moveRelative(int dx, int dy) 619void KOAgendaItem::moveRelative(int dx, int dy)
620{ 620{
621 int newX = cellX() + dx; 621 int newX = cellX() + dx;
622 int newXWidth = cellXWidth() + dx; 622 int newXWidth = cellXWidth() + dx;
623 int newYTop = cellYTop() + dy; 623 int newYTop = cellYTop() + dy;
624 int newYBottom = cellYBottom() + dy; 624 int newYBottom = cellYBottom() + dy;
625 setCellXY(newX,newYTop,newYBottom); 625 setCellXY(newX,newYTop,newYBottom);
626 setCellXWidth(newXWidth); 626 setCellXWidth(newXWidth);
627} 627}
628 628
629void KOAgendaItem::expandTop(int dy) 629void KOAgendaItem::expandTop(int dy)
630{ 630{
631 int newYTop = cellYTop() + dy; 631 int newYTop = cellYTop() + dy;
632 int newYBottom = cellYBottom(); 632 int newYBottom = cellYBottom();
633 if (newYTop > newYBottom) newYTop = newYBottom; 633 if (newYTop > newYBottom) newYTop = newYBottom;
634 setCellY(newYTop, newYBottom); 634 setCellY(newYTop, newYBottom);
635} 635}
636 636
637void KOAgendaItem::expandBottom(int dy) 637void KOAgendaItem::expandBottom(int dy)
638{ 638{
639 int newYTop = cellYTop(); 639 int newYTop = cellYTop();
640 int newYBottom = cellYBottom() + dy; 640 int newYBottom = cellYBottom() + dy;
641 if (newYBottom < newYTop) newYBottom = newYTop; 641 if (newYBottom < newYTop) newYBottom = newYTop;
642 setCellY(newYTop, newYBottom); 642 setCellY(newYTop, newYBottom);
643} 643}
644 644
645void KOAgendaItem::expandLeft(int dx) 645void KOAgendaItem::expandLeft(int dx)
646{ 646{
647 int newX = cellX() + dx; 647 int newX = cellX() + dx;
648 int newXWidth = cellXWidth(); 648 int newXWidth = cellXWidth();
649 if (newX > newXWidth) newX = newXWidth; 649 if (newX > newXWidth) newX = newXWidth;
650 setCellX(newX,newXWidth); 650 setCellX(newX,newXWidth);
651} 651}
652 652
653void KOAgendaItem::expandRight(int dx) 653void KOAgendaItem::expandRight(int dx)
654{ 654{
655 int newX = cellX(); 655 int newX = cellX();
656 int newXWidth = cellXWidth() + dx; 656 int newXWidth = cellXWidth() + dx;
657 if (newXWidth < newX) newXWidth = newX; 657 if (newXWidth < newX) newXWidth = newX;
658 setCellX(newX,newXWidth); 658 setCellX(newX,newXWidth);
659} 659}
660 660
661QToolTipGroup *KOAgendaItem::toolTipGroup() 661QToolTipGroup *KOAgendaItem::toolTipGroup()
662{ 662{
663 if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); 663 if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0);
664 return mToolTipGroup; 664 return mToolTipGroup;
665} 665}
666 666
667void KOAgendaItem::dragEnterEvent( QDragEnterEvent *e ) 667void KOAgendaItem::dragEnterEvent( QDragEnterEvent *e )
668{ 668{
669#ifndef KORG_NODND 669#ifndef KORG_NODND
670 if ( ICalDrag::canDecode( e ) || VCalDrag::canDecode( e ) || 670 if ( ICalDrag::canDecode( e ) || VCalDrag::canDecode( e ) ||
671 !QTextDrag::canDecode( e ) ) { 671 !QTextDrag::canDecode( e ) ) {
672 e->ignore(); 672 e->ignore();
673 return; 673 return;
674 } 674 }
675 e->accept(); 675 e->accept();
676#endif 676#endif
677} 677}
678 678
679void KOAgendaItem::dropEvent( QDropEvent *e ) 679void KOAgendaItem::dropEvent( QDropEvent *e )
680{ 680{
681#ifndef KORG_NODND 681#ifndef KORG_NODND
682 QString text; 682 QString text;
683 if(QTextDrag::decode(e,text)) 683 if(QTextDrag::decode(e,text))
684 { 684 {
685 kdDebug() << "Dropped : " << text << endl; 685 kdDebug() << "Dropped : " << text << endl;
686 QStringList emails = QStringList::split(",",text); 686 QStringList emails = QStringList::split(",",text);
687 for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) { 687 for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) {
688 kdDebug() << " Email: " << (*it) << endl; 688 kdDebug() << " Email: " << (*it) << endl;
689 int pos = (*it).find("<"); 689 int pos = (*it).find("<");
690 QString name = (*it).left(pos); 690 QString name = (*it).left(pos);
691 QString email = (*it).mid(pos); 691 QString email = (*it).mid(pos);
692 if (!email.isEmpty()) { 692 if (!email.isEmpty()) {
693 mIncidence->addAttendee(new Attendee(name,email)); 693 mIncidence->addAttendee(new Attendee(name,email));
694 } 694 }
695 } 695 }
696 } 696 }
697#endif 697#endif
698} 698}
699 699
700 700
701QPtrList<KOAgendaItem> KOAgendaItem::conflictItems() 701QPtrList<KOAgendaItem> KOAgendaItem::conflictItems()
702{ 702{
703 return mConflictItems; 703 return mConflictItems;
704} 704}
705 705
706void KOAgendaItem::setConflictItems(QPtrList<KOAgendaItem> ci) 706void KOAgendaItem::setConflictItems(QPtrList<KOAgendaItem> ci)
707{ 707{
708 mConflictItems = ci; 708 mConflictItems = ci;
709 KOAgendaItem *item; 709 KOAgendaItem *item;
710 for ( item=mConflictItems.first(); item != 0; 710 for ( item=mConflictItems.first(); item != 0;
711 item=mConflictItems.next() ) { 711 item=mConflictItems.next() ) {
712 item->addConflictItem(this); 712 item->addConflictItem(this);
713 } 713 }
714} 714}
715 715
716void KOAgendaItem::addConflictItem(KOAgendaItem *ci) 716void KOAgendaItem::addConflictItem(KOAgendaItem *ci)
717{ 717{
718 if (mConflictItems.find(ci)<0) 718 if (mConflictItems.find(ci)<0)
719 mConflictItems.append(ci); 719 mConflictItems.append(ci);
720} 720}
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index df60564..688d9e1 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -1,820 +1,820 @@
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 <qpushbutton.h> 26#include <qpushbutton.h>
27#include <qtooltip.h> 27#include <qtooltip.h>
28#include <qpainter.h> 28#include <qpainter.h>
29#include <qwhatsthis.h> 29#include <qwhatsthis.h>
30#ifndef DESKTOP_VERSION 30#ifndef DESKTOP_VERSION
31#include <qpe/qpeapplication.h> 31#include <qpe/qpeapplication.h>
32#else 32#else
33#include <qapplication.h> 33#include <qapplication.h>
34#endif 34#endif
35 35
36#include <kdebug.h> 36#include <kdebug.h>
37#include <klocale.h> 37#include <klocale.h>
38#include <kglobal.h> 38#include <kglobal.h>
39#include <kconfig.h> 39#include <kconfig.h>
40#include <kiconloader.h> 40#include <kiconloader.h>
41 41
42#include <kcalendarsystem.h> 42#include <kcalendarsystem.h>
43 43
44#ifndef KORG_NOPRINTER 44#ifndef KORG_NOPRINTER
45#include "calprinter.h" 45#include "calprinter.h"
46#endif 46#endif
47#include "koprefs.h" 47#include "koprefs.h"
48#ifndef KORG_NOPLUGINS 48#ifndef KORG_NOPLUGINS
49#include "kocore.h" 49#include "kocore.h"
50#endif 50#endif
51#include "koglobals.h" 51#include "koglobals.h"
52#include <libkdepim/kincidenceformatter.h> 52#include <libkcal/kincidenceformatter.h>
53 53
54#include "komonthview.h" 54#include "komonthview.h"
55 55
56#define PIXMAP_SIZE 5 56#define PIXMAP_SIZE 5
57 57
58class KNOWhatsThis :public QWhatsThis 58class KNOWhatsThis :public QWhatsThis
59{ 59{
60public: 60public:
61 KNOWhatsThis( KNoScrollListBox* sbox ) : QWhatsThis( sbox ), _wid( sbox) { }; 61 KNOWhatsThis( KNoScrollListBox* sbox ) : QWhatsThis( sbox ), _wid( sbox) { };
62 62
63protected: 63protected:
64 virtual QString text( const QPoint& p) 64 virtual QString text( const QPoint& p)
65 { 65 {
66 return _wid->getWhatsThisText(p) ; 66 return _wid->getWhatsThisText(p) ;
67 }; 67 };
68private: 68private:
69 KNoScrollListBox* _wid; 69 KNoScrollListBox* _wid;
70 70
71}; 71};
72 72
73 73
74KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name) 74KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name)
75 : QListBox(parent, name) 75 : QListBox(parent, name)
76{ 76{
77#ifndef DESKTOP_VERSION 77#ifndef DESKTOP_VERSION
78 QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); 78 QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold );
79#endif 79#endif
80 new KNOWhatsThis(this); 80 new KNOWhatsThis(this);
81} 81}
82 82
83QString KNoScrollListBox::getWhatsThisText(QPoint p) 83QString KNoScrollListBox::getWhatsThisText(QPoint p)
84{ 84{
85 QListBoxItem* item = itemAt ( p ); 85 QListBoxItem* item = itemAt ( p );
86 if ( ! item ) { 86 if ( ! item ) {
87 return i18n("Click in the cell or\non the date label\nto add an event!"); 87 return i18n("Click in the cell or\non the date label\nto add an event!");
88 } 88 }
89 return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence()); 89 return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence());
90} 90}
91void KNoScrollListBox::keyPressEvent(QKeyEvent *e) 91void KNoScrollListBox::keyPressEvent(QKeyEvent *e)
92{ 92{
93 93
94 switch(e->key()) { 94 switch(e->key()) {
95 case Key_Right: 95 case Key_Right:
96 // if ( e->state() == Qt::ControlButton ) 96 // if ( e->state() == Qt::ControlButton )
97 { 97 {
98 e->ignore(); 98 e->ignore();
99 return; 99 return;
100 } 100 }
101 scrollBy(4,0); 101 scrollBy(4,0);
102 break; 102 break;
103 case Key_Left: 103 case Key_Left:
104 // if ( e->state() == Qt::ControlButton ) 104 // if ( e->state() == Qt::ControlButton )
105 { 105 {
106 e->ignore(); 106 e->ignore();
107 return; 107 return;
108 } 108 }
109 scrollBy(-4,0); 109 scrollBy(-4,0);
110 break; 110 break;
111 case Key_Up: 111 case Key_Up:
112 if(!count()) break; 112 if(!count()) break;
113 setCurrentItem((currentItem()+count()-1)%count()); 113 setCurrentItem((currentItem()+count()-1)%count());
114 if(!itemVisible(currentItem())) { 114 if(!itemVisible(currentItem())) {
115 if((unsigned int) currentItem() == (count()-1)) { 115 if((unsigned int) currentItem() == (count()-1)) {
116 setTopItem(currentItem()-numItemsVisible()+1); 116 setTopItem(currentItem()-numItemsVisible()+1);
117 } else { 117 } else {
118 setTopItem(topItem()-1); 118 setTopItem(topItem()-1);
119 } 119 }
120 } 120 }
121 break; 121 break;
122 case Key_Down: 122 case Key_Down:
123 if(!count()) break; 123 if(!count()) break;
124 setCurrentItem((currentItem()+1)%count()); 124 setCurrentItem((currentItem()+1)%count());
125 if(!itemVisible(currentItem())) { 125 if(!itemVisible(currentItem())) {
126 if(currentItem() == 0) { 126 if(currentItem() == 0) {
127 setTopItem(0); 127 setTopItem(0);
128 } else { 128 } else {
129 setTopItem(topItem()+1); 129 setTopItem(topItem()+1);
130 } 130 }
131 } 131 }
132 break; 132 break;
133 case Key_Shift: 133 case Key_Shift:
134 emit shiftDown(); 134 emit shiftDown();
135 break; 135 break;
136 default: 136 default:
137 e->ignore(); 137 e->ignore();
138 break; 138 break;
139 } 139 }
140} 140}
141 141
142void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e) 142void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e)
143{ 143{
144 switch(e->key()) { 144 switch(e->key()) {
145 case Key_Shift: 145 case Key_Shift:
146 emit shiftUp(); 146 emit shiftUp();
147 break; 147 break;
148 default: 148 default:
149 break; 149 break;
150 } 150 }
151} 151}
152 152
153void KNoScrollListBox::mousePressEvent(QMouseEvent *e) 153void KNoScrollListBox::mousePressEvent(QMouseEvent *e)
154{ 154{
155 QListBox::mousePressEvent(e); 155 QListBox::mousePressEvent(e);
156 156
157 if(e->button() == RightButton) { 157 if(e->button() == RightButton) {
158 emit rightClick(); 158 emit rightClick();
159 } 159 }
160} 160}
161 161
162MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s) 162MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s)
163 : QListBoxItem() 163 : QListBoxItem()
164{ 164{
165 setText( s ); 165 setText( s );
166 166
167 mIncidence = incidence; 167 mIncidence = incidence;
168 mDate = qd; 168 mDate = qd;
169 // QWhatsThis::add(this,KIncidenceFormatter::instance()->getFormattedText( mIncidence )); 169 // QWhatsThis::add(this,KIncidenceFormatter::instance()->getFormattedText( mIncidence ));
170 mRecur = false; 170 mRecur = false;
171 mAlarm = false; 171 mAlarm = false;
172 mReply = false; 172 mReply = false;
173 mInfo = false; 173 mInfo = false;
174} 174}
175 175
176void MonthViewItem::paint(QPainter *p) 176void MonthViewItem::paint(QPainter *p)
177{ 177{
178#if QT_VERSION >= 0x030000 178#if QT_VERSION >= 0x030000
179 bool sel = isSelected(); 179 bool sel = isSelected();
180#else 180#else
181 bool sel = selected(); 181 bool sel = selected();
182#endif 182#endif
183 183
184 184
185 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) 185 if (KOPrefs::instance()->mMonthViewUsesCategoryColor)
186 { 186 {
187 p->setBackgroundColor( palette().color( QPalette::Normal, \ 187 p->setBackgroundColor( palette().color( QPalette::Normal, \
188 sel ? QColorGroup::Highlight : QColorGroup::Background ) ); 188 sel ? QColorGroup::Highlight : QColorGroup::Background ) );
189 p->eraseRect( 0, 0, listBox()->maxItemWidth(), height( listBox() ) ); 189 p->eraseRect( 0, 0, listBox()->maxItemWidth(), height( listBox() ) );
190 } 190 }
191 int x = 1; 191 int x = 1;
192 int y = 3;//(height() - mRecurPixmap.height()) /2; 192 int y = 3;//(height() - mRecurPixmap.height()) /2;
193 int size = PIXMAP_SIZE; 193 int size = PIXMAP_SIZE;
194 if ( QApplication::desktop()->width() < 300 ) 194 if ( QApplication::desktop()->width() < 300 )
195 size = 3; 195 size = 3;
196 if ( KOPrefs::instance()->mMonthShowIcons ) { 196 if ( KOPrefs::instance()->mMonthShowIcons ) {
197 if ( mInfo ) { 197 if ( mInfo ) {
198 p->fillRect ( x, y,size,size, Qt::darkGreen ); 198 p->fillRect ( x, y,size,size, Qt::darkGreen );
199 x += size + 1; 199 x += size + 1;
200 } 200 }
201 if ( mRecur ) { 201 if ( mRecur ) {
202 p->fillRect ( x, y,size,size, Qt::blue ); 202 p->fillRect ( x, y,size,size, Qt::blue );
203 x += size + 1; 203 x += size + 1;
204 } 204 }
205 if ( mAlarm ) { 205 if ( mAlarm ) {
206 p->fillRect ( x, y,size,size, Qt::red ); 206 p->fillRect ( x, y,size,size, Qt::red );
207 x += size + 1; 207 x += size + 1;
208 } 208 }
209 if ( mReply ) { 209 if ( mReply ) {
210 p->fillRect ( x, y,size,size, Qt::yellow ); 210 p->fillRect ( x, y,size,size, Qt::yellow );
211 x += size + 1; 211 x += size + 1;
212 } 212 }
213 } 213 }
214 QFontMetrics fm = p->fontMetrics(); 214 QFontMetrics fm = p->fontMetrics();
215 int yPos; 215 int yPos;
216 int pmheight = size; 216 int pmheight = size;
217 if( pmheight < fm.height() ) 217 if( pmheight < fm.height() )
218 yPos = fm.ascent() + fm.leading()/2; 218 yPos = fm.ascent() + fm.leading()/2;
219 else 219 else
220 yPos = pmheight/2 - fm.height()/2 + fm.ascent(); 220 yPos = pmheight/2 - fm.height()/2 + fm.ascent();
221 p->setPen( palette().color( QPalette::Normal, sel ? \ 221 p->setPen( palette().color( QPalette::Normal, sel ? \
222 QColorGroup::HighlightedText : QColorGroup::Foreground ) ); 222 QColorGroup::HighlightedText : QColorGroup::Foreground ) );
223 p->drawText( x, yPos, text() ); 223 p->drawText( x, yPos, text() );
224 if ( mIncidence->cancelled() ) { 224 if ( mIncidence->cancelled() ) {
225 int wid = fm.width( text() ); 225 int wid = fm.width( text() );
226 p->drawLine( x, yPos- fm.height()/2+2,x+wid, yPos- fm.height()/2 +2); 226 p->drawLine( x, yPos- fm.height()/2+2,x+wid, yPos- fm.height()/2 +2);
227 } 227 }
228 228
229} 229}
230 230
231int MonthViewItem::height(const QListBox *lb) const 231int MonthViewItem::height(const QListBox *lb) const
232{ 232{
233 return lb->fontMetrics().lineSpacing()+1; 233 return lb->fontMetrics().lineSpacing()+1;
234} 234}
235 235
236int MonthViewItem::width(const QListBox *lb) const 236int MonthViewItem::width(const QListBox *lb) const
237{ 237{
238 int size = PIXMAP_SIZE; 238 int size = PIXMAP_SIZE;
239 if ( QApplication::desktop()->width() < 300 ) 239 if ( QApplication::desktop()->width() < 300 )
240 size = 3; 240 size = 3;
241 int x = 1; 241 int x = 1;
242 if ( mInfo ) { 242 if ( mInfo ) {
243 x += size + 1; 243 x += size + 1;
244 } 244 }
245 if( mRecur ) { 245 if( mRecur ) {
246 x += size+1; 246 x += size+1;
247 } 247 }
248 if( mAlarm ) { 248 if( mAlarm ) {
249 x += size+1; 249 x += size+1;
250 } 250 }
251 if( mReply ) { 251 if( mReply ) {
252 x += size+1; 252 x += size+1;
253 } 253 }
254 254
255 return( x + lb->fontMetrics().width( text() ) + 1 ); 255 return( x + lb->fontMetrics().width( text() ) + 1 );
256} 256}
257 257
258 258
259MonthViewCell::MonthViewCell( KOMonthView *parent) 259MonthViewCell::MonthViewCell( KOMonthView *parent)
260 : QWidget( parent ), 260 : QWidget( parent ),
261 mMonthView( parent ) 261 mMonthView( parent )
262{ 262{
263 263
264 QVBoxLayout *topLayout = new QVBoxLayout( this ); 264 QVBoxLayout *topLayout = new QVBoxLayout( this );
265 265
266 // mLabel = new QLabel( this );QPushButton 266 // mLabel = new QLabel( this );QPushButton
267 mLabel = new QPushButton( this ); 267 mLabel = new QPushButton( this );
268 //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain ); 268 //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain );
269 //mLabel->setLineWidth( 1 ); 269 //mLabel->setLineWidth( 1 );
270 //mLabel->setAlignment( AlignCenter ); 270 //mLabel->setAlignment( AlignCenter );
271 mLabel->setFlat( true ); 271 mLabel->setFlat( true );
272 mItemList = new KNoScrollListBox( this ); 272 mItemList = new KNoScrollListBox( this );
273 mItemList->setMinimumSize( 10, 10 ); 273 mItemList->setMinimumSize( 10, 10 );
274 mItemList->setFrameStyle( QFrame::Panel | QFrame::Plain ); 274 mItemList->setFrameStyle( QFrame::Panel | QFrame::Plain );
275 mItemList->setLineWidth( 1 ); 275 mItemList->setLineWidth( 1 );
276 topLayout->addWidget( mItemList ); 276 topLayout->addWidget( mItemList );
277 mLabel->raise(); 277 mLabel->raise();
278 // QColor( 0,0,255 ) QColor( 160,1600,255 ) 278 // QColor( 0,0,255 ) QColor( 160,1600,255 )
279 mStandardPalette = palette(); 279 mStandardPalette = palette();
280 mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) ); 280 mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) );
281 281
282 enableScrollBars( false ); 282 enableScrollBars( false );
283 updateConfig(); 283 updateConfig();
284 connect( mLabel, SIGNAL( clicked( )), 284 connect( mLabel, SIGNAL( clicked( )),
285 SLOT( newEvent() )); 285 SLOT( newEvent() ));
286 connect( mItemList, SIGNAL( doubleClicked( QListBoxItem *) ), 286 connect( mItemList, SIGNAL( doubleClicked( QListBoxItem *) ),
287 SLOT( defaultAction( QListBoxItem * ) ) ); 287 SLOT( defaultAction( QListBoxItem * ) ) );
288 connect( mItemList, SIGNAL( rightButtonPressed( QListBoxItem *, 288 connect( mItemList, SIGNAL( rightButtonPressed( QListBoxItem *,
289 const QPoint &) ), 289 const QPoint &) ),
290 SLOT( contextMenu( QListBoxItem * ) ) ); 290 SLOT( contextMenu( QListBoxItem * ) ) );
291 connect( mItemList, SIGNAL( highlighted( QListBoxItem *) ), 291 connect( mItemList, SIGNAL( highlighted( QListBoxItem *) ),
292 SLOT( selection( QListBoxItem * ) ) ); 292 SLOT( selection( QListBoxItem * ) ) );
293 connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), 293 connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ),
294 SLOT( cellClicked( QListBoxItem * ) ) ); 294 SLOT( cellClicked( QListBoxItem * ) ) );
295 connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), 295 connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ),
296 SLOT( selection( QListBoxItem * ) ) ); 296 SLOT( selection( QListBoxItem * ) ) );
297} 297}
298 298
299void MonthViewCell::setDate( const QDate &date ) 299void MonthViewCell::setDate( const QDate &date )
300{ 300{
301// kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl; 301// kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl;
302 302
303 mDate = date; 303 mDate = date;
304 304
305 QString text; 305 QString text;
306 bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; 306 bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog;
307 if ( KOGlobals::self()->calendarSystem()->day( date ) == 1 || (date.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { 307 if ( KOGlobals::self()->calendarSystem()->day( date ) == 1 || (date.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) {
308 text = KOGlobals::self()->calendarSystem()->monthName( date, true ) + " "; 308 text = KOGlobals::self()->calendarSystem()->monthName( date, true ) + " ";
309 mLabel->resize( mLabelBigSize ); 309 mLabel->resize( mLabelBigSize );
310 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); 310 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) );
311 } else { 311 } else {
312 mLabel->resize( mLabelSize ); 312 mLabel->resize( mLabelSize );
313 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); 313 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) );
314 } 314 }
315 mLabel->setText( text ); 315 mLabel->setText( text );
316 316
317 //resizeEvent( 0 ); 317 //resizeEvent( 0 );
318} 318}
319 319
320QDate MonthViewCell::date() const 320QDate MonthViewCell::date() const
321{ 321{
322 return mDate; 322 return mDate;
323} 323}
324 324
325void MonthViewCell::setPrimary( bool primary ) 325void MonthViewCell::setPrimary( bool primary )
326{ 326{
327 mPrimary = primary; 327 mPrimary = primary;
328 //setMyPalette(); 328 //setMyPalette();
329} 329}
330void MonthViewCell::setMyPalette() 330void MonthViewCell::setMyPalette()
331{ 331{
332 332
333 if ( mHoliday) { 333 if ( mHoliday) {
334 setPalette( mHolidayPalette ); 334 setPalette( mHolidayPalette );
335 } else { 335 } else {
336 if ( mPrimary ) { 336 if ( mPrimary ) {
337 setPalette( mPrimaryPalette ); 337 setPalette( mPrimaryPalette );
338 } else { 338 } else {
339 setPalette( mNonPrimaryPalette ); 339 setPalette( mNonPrimaryPalette );
340 } 340 }
341 } 341 }
342 QPalette pal = palette(); 342 QPalette pal = palette();
343 343
344 mLabel->setPalette( QPalette ( pal.color( QPalette::Normal,QColorGroup::Base),pal.color(QPalette::Normal,QColorGroup::Base ) )); 344 mLabel->setPalette( QPalette ( pal.color( QPalette::Normal,QColorGroup::Base),pal.color(QPalette::Normal,QColorGroup::Base ) ));
345} 345}
346QPalette MonthViewCell::getPalette () 346QPalette MonthViewCell::getPalette ()
347{ 347{
348 if ( !KOPrefs::instance()->mMonthViewUsesDayColors ) 348 if ( !KOPrefs::instance()->mMonthViewUsesDayColors )
349 return mStandardPalette; 349 return mStandardPalette;
350 if ( mHoliday) { 350 if ( mHoliday) {
351 return mHolidayPalette ; 351 return mHolidayPalette ;
352 } else { 352 } else {
353 if ( mPrimary ) { 353 if ( mPrimary ) {
354 return mPrimaryPalette ; 354 return mPrimaryPalette ;
355 } 355 }
356 } 356 }
357 return mNonPrimaryPalette; 357 return mNonPrimaryPalette;
358} 358}
359bool MonthViewCell::isPrimary() const 359bool MonthViewCell::isPrimary() const
360{ 360{
361 return mPrimary; 361 return mPrimary;
362} 362}
363 363
364void MonthViewCell::setHoliday( bool holiday ) 364void MonthViewCell::setHoliday( bool holiday )
365{ 365{
366 mHoliday = holiday; 366 mHoliday = holiday;
367 //setMyPalette(); 367 //setMyPalette();
368} 368}
369 369
370void MonthViewCell::setHoliday( const QString &holiday ) 370void MonthViewCell::setHoliday( const QString &holiday )
371{ 371{
372 mHolidayString = holiday; 372 mHolidayString = holiday;
373 373
374 if ( !holiday.isEmpty() ) { 374 if ( !holiday.isEmpty() ) {
375 setHoliday( true ); 375 setHoliday( true );
376 } 376 }
377} 377}
378void MonthViewCell::keyPressEvent ( QKeyEvent * e ) 378void MonthViewCell::keyPressEvent ( QKeyEvent * e )
379{ 379{
380 380
381 e->ignore(); 381 e->ignore();
382 382
383} 383}
384void MonthViewCell::updateCell() 384void MonthViewCell::updateCell()
385{ 385{
386 386
387 setPrimary( mDate.month()%2 ); 387 setPrimary( mDate.month()%2 );
388 setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() ); 388 setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() );
389 if ( mDate == QDate::currentDate() ) { 389 if ( mDate == QDate::currentDate() ) {
390 mItemList->setLineWidth( 3 ); 390 mItemList->setLineWidth( 3 );
391 } else { 391 } else {
392 mItemList->setLineWidth( 1 ); 392 mItemList->setLineWidth( 1 );
393 } 393 }
394 mItemList->clear(); 394 mItemList->clear();
395 //qApp->processEvents(); 395 //qApp->processEvents();
396 if ( !mHolidayString.isEmpty() ) { 396 if ( !mHolidayString.isEmpty() ) {
397 MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); 397 MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString );
398 item->setPalette( mHolidayPalette ); 398 item->setPalette( mHolidayPalette );
399 mItemList->insertItem( item ); 399 mItemList->insertItem( item );
400 } 400 }
401 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); 401 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2);
402 QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); 402 QPtrList<Event> events = mMonthView->calendar()->events( mDate, true );
403 Event *event; 403 Event *event;
404 for( event = events.first(); event; event = events.next() ) { 404 for( event = events.first(); event; event = events.next() ) {
405 if ( event->categories().contains("Holiday") || 405 if ( event->categories().contains("Holiday") ||
406 event->categories().contains(i18n("Holiday"))) { 406 event->categories().contains(i18n("Holiday"))) {
407 setHoliday( true ); 407 setHoliday( true );
408 if ( mDate.dayOfWeek() == 7 ) 408 if ( mDate.dayOfWeek() == 7 )
409 mItemList->setLineWidth( 3 ); 409 mItemList->setLineWidth( 3 );
410 } 410 }
411 QString text; 411 QString text;
412 if (event->isMultiDay()) { 412 if (event->isMultiDay()) {
413 QString prefix = "<->"; 413 QString prefix = "<->";
414 if ( event->doesRecur() ) { 414 if ( event->doesRecur() ) {
415 if ( event->recursOn( mDate) ) 415 if ( event->recursOn( mDate) )
416 prefix ="->" ; 416 prefix ="->" ;
417 else { 417 else {
418 int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); 418 int days = event->dtStart().date().daysTo ( event->dtEnd().date() );
419 if ( event->recursOn( mDate.addDays( -days)) ) 419 if ( event->recursOn( mDate.addDays( -days)) )
420 prefix ="<-" ; 420 prefix ="<-" ;
421 } 421 }
422 422
423 } else { 423 } else {
424 if (mDate == event->dtStart().date()) { 424 if (mDate == event->dtStart().date()) {
425 prefix ="->" ; 425 prefix ="->" ;
426 } else if (mDate == event->dtEnd().date()) { 426 } else if (mDate == event->dtEnd().date()) {
427 prefix ="<-" ; 427 prefix ="<-" ;
428 } 428 }
429 } 429 }
430 text = prefix + event->summary(); 430 text = prefix + event->summary();
431 } else { 431 } else {
432 if (event->doesFloat()) 432 if (event->doesFloat())
433 text = event->summary(); 433 text = event->summary();
434 else { 434 else {
435 text = KGlobal::locale()->formatTime(event->dtStart().time()); 435 text = KGlobal::locale()->formatTime(event->dtStart().time());
436 text += " " + event->summary(); 436 text += " " + event->summary();
437 } 437 }
438 } 438 }
439 439
440 MonthViewItem *item = new MonthViewItem( event, mDate, text ); 440 MonthViewItem *item = new MonthViewItem( event, mDate, text );
441 QPalette pal; 441 QPalette pal;
442 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { 442 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) {
443 QStringList categories = event->categories(); 443 QStringList categories = event->categories();
444 QString cat = categories.first(); 444 QString cat = categories.first();
445 if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { 445 if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) {
446 pal = getPalette(); 446 pal = getPalette();
447 if (cat.isEmpty()) { 447 if (cat.isEmpty()) {
448 pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); 448 pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor);
449 } else { 449 } else {
450 pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); 450 pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat)));
451 } 451 }
452 452
453 } else { 453 } else {
454 if (cat.isEmpty()) { 454 if (cat.isEmpty()) {
455 pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); 455 pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor);
456 } else { 456 } else {
457 pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); 457 pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat)));
458 } 458 }
459 } 459 }
460 460
461 } else { 461 } else {
462 pal = mStandardPalette ; 462 pal = mStandardPalette ;
463 } 463 }
464 item->setPalette( pal ); 464 item->setPalette( pal );
465 item->setRecur( event->recurrence()->doesRecur() ); 465 item->setRecur( event->recurrence()->doesRecur() );
466 item->setAlarm( event->isAlarmEnabled() ); 466 item->setAlarm( event->isAlarmEnabled() );
467 item->setMoreInfo( event->description().length() > 0 ); 467 item->setMoreInfo( event->description().length() > 0 );
468 Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, 468 Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails,
469 KOPrefs::instance()->email()); 469 KOPrefs::instance()->email());
470 if ( me != 0 ) { 470 if ( me != 0 ) {
471 if ( me->status() == Attendee::NeedsAction && me->RSVP()) 471 if ( me->status() == Attendee::NeedsAction && me->RSVP())
472 item->setReply(true); 472 item->setReply(true);
473 else 473 else
474 item->setReply(false); 474 item->setReply(false);
475 } else 475 } else
476 item->setReply(false); 476 item->setReply(false);
477 bool insert = true; 477 bool insert = true;
478 if ( !(event->doesRecur() == Recurrence::rNone) ) { 478 if ( !(event->doesRecur() == Recurrence::rNone) ) {
479 if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily ) 479 if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily )
480 insert = false; 480 insert = false;
481 else 481 else
482 if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly ) 482 if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly )
483 insert = false; 483 insert = false;
484 484
485 } 485 }
486 if ( insert ) 486 if ( insert )
487 mItemList->insertItem( item ); 487 mItemList->insertItem( item );
488 } 488 }
489 489
490 // insert due todos 490 // insert due todos
491 QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); 491 QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate );
492 Todo *todo; 492 Todo *todo;
493 for(todo = todos.first(); todo; todo = todos.next()) { 493 for(todo = todos.first(); todo; todo = todos.next()) {
494 QString text; 494 QString text;
495 if (todo->hasDueDate()) { 495 if (todo->hasDueDate()) {
496 if (!todo->doesFloat()) { 496 if (!todo->doesFloat()) {
497 text += KGlobal::locale()->formatTime(todo->dtDue().time()); 497 text += KGlobal::locale()->formatTime(todo->dtDue().time());
498 text += " "; 498 text += " ";
499 } 499 }
500 } 500 }
501 text += i18n("To-Do: %1").arg(todo->summary()); 501 text += i18n("To-Do: %1").arg(todo->summary());
502 502
503 MonthViewItem *item = new MonthViewItem( todo, mDate, text ); 503 MonthViewItem *item = new MonthViewItem( todo, mDate, text );
504 //item->setPalette( mStandardPalette ); 504 //item->setPalette( mStandardPalette );
505 QPalette pal; 505 QPalette pal;
506 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { 506 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) {
507 QStringList categories = todo->categories(); 507 QStringList categories = todo->categories();
508 QString cat = categories.first(); 508 QString cat = categories.first();
509 if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { 509 if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) {
510 pal = getPalette(); 510 pal = getPalette();
511 if (cat.isEmpty()) { 511 if (cat.isEmpty()) {
512 pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); 512 pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor);
513 } else { 513 } else {
514 pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); 514 pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat)));
515 } 515 }
516 516
517 } else { 517 } else {
518 if (cat.isEmpty()) { 518 if (cat.isEmpty()) {
519 pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); 519 pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor);
520 } else { 520 } else {
521 pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); 521 pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat)));
522 } 522 }
523 } 523 }
524 524
525 } else { 525 } else {
526 pal = mStandardPalette ; 526 pal = mStandardPalette ;
527 } 527 }
528 item->setPalette( pal ); 528 item->setPalette( pal );
529 mItemList->insertItem( item ); 529 mItemList->insertItem( item );
530 } 530 }
531 //setMyPalette(); 531 //setMyPalette();
532 setMyPalette(); 532 setMyPalette();
533 resizeEvent( 0 ); 533 resizeEvent( 0 );
534 // if ( isVisible()) 534 // if ( isVisible())
535 // qApp->processEvents(); 535 // qApp->processEvents();
536} 536}
537 537
538void MonthViewCell::updateConfig() 538void MonthViewCell::updateConfig()
539{ 539{
540 540
541 setFont( KOPrefs::instance()->mMonthViewFont ); 541 setFont( KOPrefs::instance()->mMonthViewFont );
542 542
543 QFontMetrics fm( font() ); 543 QFontMetrics fm( font() );
544 mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 ); 544 mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 );
545 mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 ); 545 mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 );
546 mHolidayPalette = mStandardPalette; 546 mHolidayPalette = mStandardPalette;
547 mPrimaryPalette = mStandardPalette; 547 mPrimaryPalette = mStandardPalette;
548 mNonPrimaryPalette = mStandardPalette; 548 mNonPrimaryPalette = mStandardPalette;
549 if ( KOPrefs::instance()->mMonthViewUsesDayColors ) { 549 if ( KOPrefs::instance()->mMonthViewUsesDayColors ) {
550 mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor ); 550 mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor );
551 mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor ); 551 mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor );
552 mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark()); 552 mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark());
553 mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark()); 553 mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark());
554 mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor); 554 mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor);
555 mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor); 555 mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor);
556 mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark()); 556 mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark());
557 mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor); 557 mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor);
558 mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor); 558 mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor);
559 } 559 }
560 updateCell(); 560 updateCell();
561} 561}
562 562
563void MonthViewCell::enableScrollBars( bool enabled ) 563void MonthViewCell::enableScrollBars( bool enabled )
564{ 564{
565 if ( enabled ) { 565 if ( enabled ) {
566 mItemList->setVScrollBarMode(QScrollView::Auto); 566 mItemList->setVScrollBarMode(QScrollView::Auto);
567 mItemList->setHScrollBarMode(QScrollView::Auto); 567 mItemList->setHScrollBarMode(QScrollView::Auto);
568 } else { 568 } else {
569 mItemList->setVScrollBarMode(QScrollView::AlwaysOff); 569 mItemList->setVScrollBarMode(QScrollView::AlwaysOff);
570 mItemList->setHScrollBarMode(QScrollView::AlwaysOff); 570 mItemList->setHScrollBarMode(QScrollView::AlwaysOff);
571 } 571 }
572} 572}
573 573
574Incidence *MonthViewCell::selectedIncidence() 574Incidence *MonthViewCell::selectedIncidence()
575{ 575{
576 int index = mItemList->currentItem(); 576 int index = mItemList->currentItem();
577 if ( index < 0 ) return 0; 577 if ( index < 0 ) return 0;
578 578
579 MonthViewItem *item = 579 MonthViewItem *item =
580 static_cast<MonthViewItem *>( mItemList->item( index ) ); 580 static_cast<MonthViewItem *>( mItemList->item( index ) );
581 581
582 if ( !item ) return 0; 582 if ( !item ) return 0;
583 583
584 return item->incidence(); 584 return item->incidence();
585} 585}
586 586
587QDate MonthViewCell::selectedIncidenceDate() 587QDate MonthViewCell::selectedIncidenceDate()
588{ 588{
589 QDate qd; 589 QDate qd;
590 int index = mItemList->currentItem(); 590 int index = mItemList->currentItem();
591 if ( index < 0 ) return qd; 591 if ( index < 0 ) return qd;
592 592
593 MonthViewItem *item = 593 MonthViewItem *item =
594 static_cast<MonthViewItem *>( mItemList->item( index ) ); 594 static_cast<MonthViewItem *>( mItemList->item( index ) );
595 595
596 if ( !item ) return qd; 596 if ( !item ) return qd;
597 597
598 return item->incidenceDate(); 598 return item->incidenceDate();
599} 599}
600 600
601void MonthViewCell::deselect() 601void MonthViewCell::deselect()
602{ 602{
603 mItemList->clearSelection(); 603 mItemList->clearSelection();
604 enableScrollBars( false ); 604 enableScrollBars( false );
605 // updateCell(); 605 // updateCell();
606} 606}
607void MonthViewCell::select() 607void MonthViewCell::select()
608{ 608{
609 ;// updateCell(); 609 ;// updateCell();
610} 610}
611 611
612void MonthViewCell::resizeEvent ( QResizeEvent * ) 612void MonthViewCell::resizeEvent ( QResizeEvent * )
613{ 613{
614 int size = height() - mLabel->height(); 614 int size = height() - mLabel->height();
615 if ( size > 0 ) 615 if ( size > 0 )
616 mItemList->verticalScrollBar()->setMaximumHeight( size ); 616 mItemList->verticalScrollBar()->setMaximumHeight( size );
617 size = width() - mLabel->width(); 617 size = width() - mLabel->width();
618 if ( size > 0 ) 618 if ( size > 0 )
619 mItemList->horizontalScrollBar()->setMaximumWidth( size ); 619 mItemList->horizontalScrollBar()->setMaximumWidth( size );
620 mLabel->move( width()-mItemList->lineWidth() - mLabel->width(), height()-mItemList->lineWidth() - mLabel->height() ); 620 mLabel->move( width()-mItemList->lineWidth() - mLabel->width(), height()-mItemList->lineWidth() - mLabel->height() );
621 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); 621 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2);
622} 622}
623 623
624void MonthViewCell::defaultAction( QListBoxItem *item ) 624void MonthViewCell::defaultAction( QListBoxItem *item )
625{ 625{
626 if ( !item ) return; 626 if ( !item ) return;
627 627
628 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); 628 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item );
629 Incidence *incidence = eventItem->incidence(); 629 Incidence *incidence = eventItem->incidence();
630 if ( incidence ) mMonthView->defaultAction( incidence ); 630 if ( incidence ) mMonthView->defaultAction( incidence );
631} 631}
632void MonthViewCell::newEvent() 632void MonthViewCell::newEvent()
633{ 633{
634 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); 634 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
635 emit newEventSignal( dt ); 635 emit newEventSignal( dt );
636} 636}
637void MonthViewCell::cellClicked( QListBoxItem *item ) 637void MonthViewCell::cellClicked( QListBoxItem *item )
638{ 638{
639 static QListBoxItem * lastClicked = 0; 639 static QListBoxItem * lastClicked = 0;
640 if ( item == 0 ) { 640 if ( item == 0 ) {
641 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); 641 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
642 emit newEventSignal( dt ); 642 emit newEventSignal( dt );
643 return; 643 return;
644 } 644 }
645 /* 645 /*
646 if ( lastClicked ) 646 if ( lastClicked )
647 if ( ! item ) { 647 if ( ! item ) {
648 if ( lastClicked->listBox() != item->listBox() ) 648 if ( lastClicked->listBox() != item->listBox() )
649 lastClicked->listBox()->clearSelection(); 649 lastClicked->listBox()->clearSelection();
650 } 650 }
651 */ 651 */
652 652
653 mMonthView->setSelectedCell( this ); 653 mMonthView->setSelectedCell( this );
654 if( KOPrefs::instance()->mEnableMonthScroll ) enableScrollBars( true ); 654 if( KOPrefs::instance()->mEnableMonthScroll ) enableScrollBars( true );
655 select(); 655 select();
656} 656}
657 657
658void MonthViewCell::contextMenu( QListBoxItem *item ) 658void MonthViewCell::contextMenu( QListBoxItem *item )
659{ 659{
660 if ( !item ) return; 660 if ( !item ) return;
661 661
662 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); 662 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item );
663 Incidence *incidence = eventItem->incidence(); 663 Incidence *incidence = eventItem->incidence();
664 if ( incidence ) mMonthView->showContextMenu( incidence ); 664 if ( incidence ) mMonthView->showContextMenu( incidence );
665} 665}
666 666
667void MonthViewCell::selection( QListBoxItem *item ) 667void MonthViewCell::selection( QListBoxItem *item )
668{ 668{
669 if ( !item ) return; 669 if ( !item ) return;
670 670
671 mMonthView->setSelectedCell( this ); 671 mMonthView->setSelectedCell( this );
672} 672}
673 673
674 674
675// ******************************************************************************* 675// *******************************************************************************
676// ******************************************************************************* 676// *******************************************************************************
677// ******************************************************************************* 677// *******************************************************************************
678 678
679 679
680KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) 680KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
681 : KOEventView( calendar, parent, name ), 681 : KOEventView( calendar, parent, name ),
682 mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), 682 mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ),
683 mShortDayLabels( false ), mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) 683 mShortDayLabels( false ), mWidthLongDayLabel( 0 ), mSelectedCell( 0 )
684{ 684{
685 mCells.setAutoDelete( true ); 685 mCells.setAutoDelete( true );
686 mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; 686 mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ;
687 // mDayLayout = new QGridLayout( this ); 687 // mDayLayout = new QGridLayout( this );
688 // create the day of the week labels (Sun, Mon, etc) and add them to 688 // create the day of the week labels (Sun, Mon, etc) and add them to
689 // the layout. 689 // the layout.
690 mDayLabels.resize( mDaysPerWeek ); 690 mDayLabels.resize( mDaysPerWeek );
691 QFont bfont = font(); 691 QFont bfont = font();
692 if ( QApplication::desktop()->width() < 650 ) { 692 if ( QApplication::desktop()->width() < 650 ) {
693 bfont.setPointSize( bfont.pointSize() - 2 ); 693 bfont.setPointSize( bfont.pointSize() - 2 );
694 } 694 }
695 bfont.setBold( true ); 695 bfont.setBold( true );
696 int i; 696 int i;
697 697
698 for( i = 0; i < mDaysPerWeek; i++ ) { 698 for( i = 0; i < mDaysPerWeek; i++ ) {
699 QLabel *label = new QLabel( this ); 699 QLabel *label = new QLabel( this );
700 label->setFont(bfont); 700 label->setFont(bfont);
701 label->setFrameStyle(QFrame::Panel|QFrame::Raised); 701 label->setFrameStyle(QFrame::Panel|QFrame::Raised);
702 label->setLineWidth(1); 702 label->setLineWidth(1);
703 label->setAlignment(AlignCenter); 703 label->setAlignment(AlignCenter);
704 mDayLabels.insert( i, label ); 704 mDayLabels.insert( i, label );
705 } 705 }
706 706
707 bfont.setBold( false ); 707 bfont.setBold( false );
708 mWeekLabels.resize( mNumWeeks+1 ); 708 mWeekLabels.resize( mNumWeeks+1 );
709 for( i = 0; i < mNumWeeks+1; i++ ) { 709 for( i = 0; i < mNumWeeks+1; i++ ) {
710 KOWeekButton *label = new KOWeekButton( this ); 710 KOWeekButton *label = new KOWeekButton( this );
711 label->setFont(bfont); 711 label->setFont(bfont);
712 connect( label, SIGNAL( selectWeekNum ( int )),this, SIGNAL( selectWeekNum ( int )) ); 712 connect( label, SIGNAL( selectWeekNum ( int )),this, SIGNAL( selectWeekNum ( int )) );
713 label->setFlat(true); 713 label->setFlat(true);
714 QWhatsThis::add(label,i18n("Click on the week number to\nshow week in agenda view")); 714 QWhatsThis::add(label,i18n("Click on the week number to\nshow week in agenda view"));
715 //label->setFrameStyle(QFrame::Panel|QFrame::Raised); 715 //label->setFrameStyle(QFrame::Panel|QFrame::Raised);
716 //label->setLineWidth(1); 716 //label->setLineWidth(1);
717 //label->setAlignment(AlignCenter); 717 //label->setAlignment(AlignCenter);
718 mWeekLabels.insert( i, label ); 718 mWeekLabels.insert( i, label );
719 } 719 }
720 mWeekLabels[mNumWeeks]->setText( i18n("W")); 720 mWeekLabels[mNumWeeks]->setText( i18n("W"));
721 int row, col; 721 int row, col;
722 mCells.resize( mNumCells ); 722 mCells.resize( mNumCells );
723 for( row = 0; row < mNumWeeks; ++row ) { 723 for( row = 0; row < mNumWeeks; ++row ) {
724 for( col = 0; col < mDaysPerWeek; ++col ) { 724 for( col = 0; col < mDaysPerWeek; ++col ) {
725 MonthViewCell *cell = new MonthViewCell( this ); 725 MonthViewCell *cell = new MonthViewCell( this );
726 mCells.insert( row * mDaysPerWeek + col, cell ); 726 mCells.insert( row * mDaysPerWeek + col, cell );
727 727
728 connect( cell, SIGNAL( defaultAction( Incidence * ) ), 728 connect( cell, SIGNAL( defaultAction( Incidence * ) ),
729 SLOT( defaultAction( Incidence * ) ) ); 729 SLOT( defaultAction( Incidence * ) ) );
730 connect( cell, SIGNAL( newEventSignal( QDateTime ) ), 730 connect( cell, SIGNAL( newEventSignal( QDateTime ) ),
731 SIGNAL( newEventSignal( QDateTime ) ) ); 731 SIGNAL( newEventSignal( QDateTime ) ) );
732 } 732 }
733 } 733 }
734 734
735 mContextMenu = eventPopup(); 735 mContextMenu = eventPopup();
736 // updateConfig(); //useless here 736 // updateConfig(); //useless here
737 737
738 emit incidenceSelected( 0 ); 738 emit incidenceSelected( 0 );
739} 739}
740 740
741KOMonthView::~KOMonthView() 741KOMonthView::~KOMonthView()
742{ 742{
743 delete mContextMenu; 743 delete mContextMenu;
744} 744}
745 745
746int KOMonthView::maxDatesHint() 746int KOMonthView::maxDatesHint()
747{ 747{
748 return mNumCells; 748 return mNumCells;
749} 749}
750 750
751int KOMonthView::currentDateCount() 751int KOMonthView::currentDateCount()
752{ 752{
753 return mNumCells; 753 return mNumCells;
754} 754}
755 755
756QPtrList<Incidence> KOMonthView::selectedIncidences() 756QPtrList<Incidence> KOMonthView::selectedIncidences()
757{ 757{
758 QPtrList<Incidence> selected; 758 QPtrList<Incidence> selected;
759 759
760 if ( mSelectedCell ) { 760 if ( mSelectedCell ) {
761 Incidence *incidence = mSelectedCell->selectedIncidence(); 761 Incidence *incidence = mSelectedCell->selectedIncidence();
762 if ( incidence ) selected.append( incidence ); 762 if ( incidence ) selected.append( incidence );
763 } 763 }
764 764
765 return selected; 765 return selected;
766} 766}
767 767
768DateList KOMonthView::selectedDates() 768DateList KOMonthView::selectedDates()
769{ 769{
770 DateList selected; 770 DateList selected;
771 771
772 if ( mSelectedCell ) { 772 if ( mSelectedCell ) {
773 QDate qd = mSelectedCell->selectedIncidenceDate(); 773 QDate qd = mSelectedCell->selectedIncidenceDate();
774 if ( qd.isValid() ) selected.append( qd ); 774 if ( qd.isValid() ) selected.append( qd );
775 } 775 }
776 776
777 return selected; 777 return selected;
778} 778}
779 779
780void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd, 780void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd,
781 const QDate &td) 781 const QDate &td)
782{ 782{
783#ifndef KORG_NOPRINTER 783#ifndef KORG_NOPRINTER
784 calPrinter->preview(CalPrinter::Month, fd, td); 784 calPrinter->preview(CalPrinter::Month, fd, td);
785#endif 785#endif
786} 786}
787 787
788void KOMonthView::updateConfig() 788void KOMonthView::updateConfig()
789{ 789{
790 790
791 mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); 791 mWeekStartsMonday = KGlobal::locale()->weekStartsMonday();
792 792
793 QFontMetrics fontmetric(mDayLabels[0]->font()); 793 QFontMetrics fontmetric(mDayLabels[0]->font());
794 mWidthLongDayLabel = 0; 794 mWidthLongDayLabel = 0;
795 795
796 for (int i = 0; i < 7; i++) { 796 for (int i = 0; i < 7; i++) {
797 int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); 797 int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1));
798 if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; 798 if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width;
799 } 799 }
800 bool temp = mShowSatSunComp ; 800 bool temp = mShowSatSunComp ;
801 mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; 801 mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ;
802 if ( temp != KOPrefs::instance()->mMonthViewSatSunTog ) 802 if ( temp != KOPrefs::instance()->mMonthViewSatSunTog )
803 computeLayout(); 803 computeLayout();
804 updateDayLabels(); 804 updateDayLabels();
805 //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks); 805 //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks);
806 int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks; 806 int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks;
807 //resizeEvent( 0 ); 807 //resizeEvent( 0 );
808 for (uint i = 0; i < mCells.count(); ++i) { 808 for (uint i = 0; i < mCells.count(); ++i) {
809 mCells[i]->updateConfig(); 809 mCells[i]->updateConfig();
810 } 810 }
811} 811}
812 812
813void KOMonthView::updateDayLabels() 813void KOMonthView::updateDayLabels()
814{ 814{
815 815
816 for (int i = 0; i < 7; i++) { 816 for (int i = 0; i < 7; i++) {
817 if (mWeekStartsMonday) { 817 if (mWeekStartsMonday) {
818 bool show = mShortDayLabels; 818 bool show = mShortDayLabels;
819 if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > mDayLabels[i]->width() ) 819 if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > mDayLabels[i]->width() )
820 show = true; 820 show = true;
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 3bc6081..b1c7709 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1,804 +1,804 @@
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 <qmessagebox.h> 7#include <qmessagebox.h>
8#include <qlineedit.h> 8#include <qlineedit.h>
9#include <qfile.h> 9#include <qfile.h>
10#include <qdir.h> 10#include <qdir.h>
11#include <qapp.h> 11#include <qapp.h>
12#include <qfileinfo.h> 12#include <qfileinfo.h>
13#include <qlabel.h> 13#include <qlabel.h>
14#include <qmap.h> 14#include <qmap.h>
15#include <qwmatrix.h> 15#include <qwmatrix.h>
16#include <qtextbrowser.h> 16#include <qtextbrowser.h>
17#include <qtextstream.h> 17#include <qtextstream.h>
18#ifndef DESKTOP_VERSION 18#ifndef DESKTOP_VERSION
19#include <qpe/global.h> 19#include <qpe/global.h>
20#include <qpe/qpemenubar.h> 20#include <qpe/qpemenubar.h>
21#include <qpe/qpetoolbar.h> 21#include <qpe/qpetoolbar.h>
22#include <qpe/resource.h> 22#include <qpe/resource.h>
23#include <qpe/qpeapplication.h> 23#include <qpe/qpeapplication.h>
24#include <qtopia/alarmserver.h> 24#include <qtopia/alarmserver.h>
25#include <qtopia/qcopenvelope_qws.h> 25#include <qtopia/qcopenvelope_qws.h>
26#else 26#else
27#include <qmenubar.h> 27#include <qmenubar.h>
28#include <qtoolbar.h> 28#include <qtoolbar.h>
29#include <qapplication.h> 29#include <qapplication.h>
30//#include <resource.h> 30//#include <resource.h>
31 31
32#endif 32#endif
33#include <libkcal/calendarlocal.h> 33#include <libkcal/calendarlocal.h>
34#include <libkcal/todo.h> 34#include <libkcal/todo.h>
35#include <libkdepim/ksyncprofile.h> 35#include <libkdepim/ksyncprofile.h>
36#include <libkdepim/kincidenceformatter.h> 36#include <libkcal/kincidenceformatter.h>
37 37
38#include "calendarview.h" 38#include "calendarview.h"
39#include "koviewmanager.h" 39#include "koviewmanager.h"
40#include "datenavigator.h" 40#include "datenavigator.h"
41#include "koagendaview.h" 41#include "koagendaview.h"
42#include "koagenda.h" 42#include "koagenda.h"
43#include "kodialogmanager.h" 43#include "kodialogmanager.h"
44#include "kdialogbase.h" 44#include "kdialogbase.h"
45#include "kapplication.h" 45#include "kapplication.h"
46#include "kofilterview.h" 46#include "kofilterview.h"
47#include "kstandarddirs.h" 47#include "kstandarddirs.h"
48#include "koprefs.h" 48#include "koprefs.h"
49#include "kfiledialog.h" 49#include "kfiledialog.h"
50#include "koglobals.h" 50#include "koglobals.h"
51#include "kglobal.h" 51#include "kglobal.h"
52#include "klocale.h" 52#include "klocale.h"
53#include "kconfig.h" 53#include "kconfig.h"
54#include "simplealarmclient.h" 54#include "simplealarmclient.h"
55#include "externalapphandler.h" 55#include "externalapphandler.h"
56 56
57using namespace KCal; 57using namespace KCal;
58#ifndef _WIN32_ 58#ifndef _WIN32_
59#include <unistd.h> 59#include <unistd.h>
60#else 60#else
61#include "koimportoldialog.h" 61#include "koimportoldialog.h"
62#endif 62#endif
63#include "mainwindow.h" 63#include "mainwindow.h"
64 64
65int globalFlagBlockStartup; 65int globalFlagBlockStartup;
66MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : 66MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
67 QMainWindow( parent, name ) 67 QMainWindow( parent, name )
68{ 68{
69 69
70#ifdef DESKTOP_VERSION 70#ifdef DESKTOP_VERSION
71 setFont( QFont("Arial"), 14 ); 71 setFont( QFont("Arial"), 14 );
72#endif 72#endif
73 73
74 mClosed = false; 74 mClosed = false;
75 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; 75 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc";
76 QString confFile = locateLocal("config","korganizerrc"); 76 QString confFile = locateLocal("config","korganizerrc");
77 QFileInfo finf ( confFile ); 77 QFileInfo finf ( confFile );
78 bool showWarning = !finf.exists(); 78 bool showWarning = !finf.exists();
79 setIcon(SmallIcon( "ko24" ) ); 79 setIcon(SmallIcon( "ko24" ) );
80 mBlockAtStartup = true; 80 mBlockAtStartup = true;
81 mFlagKeyPressed = false; 81 mFlagKeyPressed = false;
82 setCaption("KOrganizer/Pi"); 82 setCaption("KOrganizer/Pi");
83 KOPrefs *p = KOPrefs::instance(); 83 KOPrefs *p = KOPrefs::instance();
84 // if ( QApplication::desktop()->height() > 480 ) { 84 // if ( QApplication::desktop()->height() > 480 ) {
85// if ( p->mHourSize == 4 ) 85// if ( p->mHourSize == 4 )
86// p->mHourSize = 6; 86// p->mHourSize = 6;
87// } 87// }
88 if ( p->mHourSize > 18 ) 88 if ( p->mHourSize > 18 )
89 p->mHourSize = 18; 89 p->mHourSize = 18;
90 QMainWindow::ToolBarDock tbd; 90 QMainWindow::ToolBarDock tbd;
91 if ( p->mToolBarHor ) { 91 if ( p->mToolBarHor ) {
92 if ( p->mToolBarUp ) 92 if ( p->mToolBarUp )
93 tbd = Bottom; 93 tbd = Bottom;
94 else 94 else
95 tbd = Top; 95 tbd = Top;
96 } 96 }
97 else { 97 else {
98 if ( p->mToolBarUp ) 98 if ( p->mToolBarUp )
99 tbd = Right; 99 tbd = Right;
100 else 100 else
101 tbd = Left; 101 tbd = Left;
102 } 102 }
103 if ( KOPrefs::instance()->mUseAppColors ) 103 if ( KOPrefs::instance()->mUseAppColors )
104 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 104 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
105 globalFlagBlockStartup = 1; 105 globalFlagBlockStartup = 1;
106 iconToolBar = new QPEToolBar( this ); 106 iconToolBar = new QPEToolBar( this );
107 addToolBar (iconToolBar , tbd ); 107 addToolBar (iconToolBar , tbd );
108 mBlockSaveFlag = false; 108 mBlockSaveFlag = false;
109 mCalendarModifiedFlag = false; 109 mCalendarModifiedFlag = false;
110 110
111 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); 111 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this );
112 splash->setAlignment ( AlignCenter ); 112 splash->setAlignment ( AlignCenter );
113 setCentralWidget( splash ); 113 setCentralWidget( splash );
114#ifndef DESKTOP_VERSION 114#ifndef DESKTOP_VERSION
115 showMaximized(); 115 showMaximized();
116#endif 116#endif
117 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); 117 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ());
118 setDefaultPreferences(); 118 setDefaultPreferences();
119 mCalendar = new CalendarLocal(); 119 mCalendar = new CalendarLocal();
120 mView = new CalendarView( mCalendar, this,"mCalendar " ); 120 mView = new CalendarView( mCalendar, this,"mCalendar " );
121 mView->hide(); 121 mView->hide();
122 //mView->resize(splash->size() ); 122 //mView->resize(splash->size() );
123 initActions(); 123 initActions();
124#ifndef DESKTOP_VERSION 124#ifndef DESKTOP_VERSION
125 iconToolBar->show(); 125 iconToolBar->show();
126 qApp->processEvents(); 126 qApp->processEvents();
127#endif 127#endif
128 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); 128 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ());
129 int vh = height() ; 129 int vh = height() ;
130 int vw = width(); 130 int vw = width();
131 //qDebug("Toolbar hei %d ",iconToolBar->height() ); 131 //qDebug("Toolbar hei %d ",iconToolBar->height() );
132 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 132 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
133 vh -= iconToolBar->height(); 133 vh -= iconToolBar->height();
134 } else { 134 } else {
135 vw -= iconToolBar->height(); 135 vw -= iconToolBar->height();
136 } 136 }
137 //mView->setMaximumSize( splash->size() ); 137 //mView->setMaximumSize( splash->size() );
138 //mView->resize( splash->size() ); 138 //mView->resize( splash->size() );
139 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 139 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
140 mView->readSettings(); 140 mView->readSettings();
141 bool oldOpened = false; 141 bool oldOpened = false;
142 bool newFile = false; 142 bool newFile = false;
143 if( !QFile::exists( defaultFileName() ) ) { 143 if( !QFile::exists( defaultFileName() ) ) {
144 QFileInfo finfo ( defaultFileName() ); 144 QFileInfo finfo ( defaultFileName() );
145 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); 145 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics");
146 qDebug("oldfile %s ", oldFile.latin1()); 146 qDebug("oldfile %s ", oldFile.latin1());
147 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"; 147 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";
148 finfo.setFile( oldFile ); 148 finfo.setFile( oldFile );
149 if (finfo.exists() ) { 149 if (finfo.exists() ) {
150 KMessageBox::information( this, message); 150 KMessageBox::information( this, message);
151 mView->openCalendar( oldFile ); 151 mView->openCalendar( oldFile );
152 qApp->processEvents(); 152 qApp->processEvents();
153 } else { 153 } else {
154 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); 154 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics");
155 finfo.setFile( oldFile ); 155 finfo.setFile( oldFile );
156 if (finfo.exists() ) { 156 if (finfo.exists() ) {
157 KMessageBox::information( this, message); 157 KMessageBox::information( this, message);
158 mView->openCalendar( oldFile ); 158 mView->openCalendar( oldFile );
159 qApp->processEvents(); 159 qApp->processEvents();
160 } 160 }
161 } 161 }
162 mView->saveCalendar( defaultFileName() ); 162 mView->saveCalendar( defaultFileName() );
163 newFile = true; 163 newFile = true;
164 } 164 }
165 165
166 QTime neededSaveTime = QDateTime::currentDateTime().time(); 166 QTime neededSaveTime = QDateTime::currentDateTime().time();
167 if ( ! oldOpened ) 167 if ( ! oldOpened )
168 mView->openCalendar( defaultFileName() ); 168 mView->openCalendar( defaultFileName() );
169 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 169 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
170 qDebug("KO: Calendar loading time: %d ms",msNeeded ); 170 qDebug("KO: Calendar loading time: %d ms",msNeeded );
171 171
172 if ( KOPrefs::instance()->mLanguageChanged ) { 172 if ( KOPrefs::instance()->mLanguageChanged ) {
173 KOPrefs::instance()->setCategoryDefaults(); 173 KOPrefs::instance()->setCategoryDefaults();
174 int count = mView->addCategories(); 174 int count = mView->addCategories();
175 KOPrefs::instance()->mLanguageChanged = false; 175 KOPrefs::instance()->mLanguageChanged = false;
176 } 176 }
177 processIncidenceSelection( 0 ); 177 processIncidenceSelection( 0 );
178 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), 178 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ),
179 SLOT( processIncidenceSelection( Incidence * ) ) ); 179 SLOT( processIncidenceSelection( Incidence * ) ) );
180 connect( mView, SIGNAL( modifiedChanged( bool ) ), 180 connect( mView, SIGNAL( modifiedChanged( bool ) ),
181 SLOT( slotModifiedChanged( bool ) ) ); 181 SLOT( slotModifiedChanged( bool ) ) );
182 182
183 183
184 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); 184 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) );
185 mView->setModified( false ); 185 mView->setModified( false );
186 mBlockAtStartup = false; 186 mBlockAtStartup = false;
187 mView->setModified( false ); 187 mView->setModified( false );
188 setCentralWidget( mView ); 188 setCentralWidget( mView );
189 globalFlagBlockStartup = 0; 189 globalFlagBlockStartup = 0;
190 mView->show(); 190 mView->show();
191 delete splash; 191 delete splash;
192 if ( newFile ) 192 if ( newFile )
193 mView->updateConfig(); 193 mView->updateConfig();
194 // qApp->processEvents(); 194 // qApp->processEvents();
195 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 195 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
196 fillSyncMenu(); 196 fillSyncMenu();
197 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); 197 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins );
198 if ( showWarning ) { 198 if ( showWarning ) {
199 KMessageBox::information( this, 199 KMessageBox::information( this,
200 "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"); 200 "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");
201 qApp->processEvents(); 201 qApp->processEvents();
202 mView->dialogManager()->showSyncOptions(); 202 mView->dialogManager()->showSyncOptions();
203 } 203 }
204 204
205 //US listen for result adressed from Ka/Pi 205 //US listen for result adressed from Ka/Pi
206#ifndef DESKTOP_VERSION 206#ifndef DESKTOP_VERSION
207 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 207 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
208#endif 208#endif
209} 209}
210MainWindow::~MainWindow() 210MainWindow::~MainWindow()
211{ 211{
212 //qDebug("MainWindow::~MainWindow() "); 212 //qDebug("MainWindow::~MainWindow() ");
213 //save toolbar location 213 //save toolbar location
214 214
215 delete mCalendar; 215 delete mCalendar;
216 delete KOPrefs::instance(); 216 delete KOPrefs::instance();
217 delete KIncidenceFormatter::instance(); 217 delete KIncidenceFormatter::instance();
218 218
219 219
220} 220}
221void MainWindow::showMaximized () 221void MainWindow::showMaximized ()
222{ 222{
223#ifndef DESKTOP_VERSION 223#ifndef DESKTOP_VERSION
224 if ( ! globalFlagBlockStartup ) 224 if ( ! globalFlagBlockStartup )
225 if ( mClosed ) 225 if ( mClosed )
226 mView->goToday(); 226 mView->goToday();
227#endif 227#endif
228 QWidget::showMaximized () ; 228 QWidget::showMaximized () ;
229 mClosed = false; 229 mClosed = false;
230} 230}
231void MainWindow::closeEvent( QCloseEvent* ce ) 231void MainWindow::closeEvent( QCloseEvent* ce )
232{ 232{
233 233
234 234
235 235
236 if ( ! KOPrefs::instance()->mAskForQuit ) { 236 if ( ! KOPrefs::instance()->mAskForQuit ) {
237 saveOnClose(); 237 saveOnClose();
238 mClosed = true; 238 mClosed = true;
239 ce->accept(); 239 ce->accept();
240 return; 240 return;
241 241
242 } 242 }
243 243
244 switch( QMessageBox::information( this, "KO/Pi", 244 switch( QMessageBox::information( this, "KO/Pi",
245 i18n("Do you really want\nto close KO/Pi?"), 245 i18n("Do you really want\nto close KO/Pi?"),
246 i18n("Close"), i18n("No"), 246 i18n("Close"), i18n("No"),
247 0, 0 ) ) { 247 0, 0 ) ) {
248 case 0: 248 case 0:
249 saveOnClose(); 249 saveOnClose();
250 mClosed = true; 250 mClosed = true;
251 ce->accept(); 251 ce->accept();
252 break; 252 break;
253 case 1: 253 case 1:
254 ce->ignore(); 254 ce->ignore();
255 break; 255 break;
256 case 2: 256 case 2:
257 257
258 default: 258 default:
259 break; 259 break;
260 } 260 }
261 261
262 262
263} 263}
264 264
265void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) 265void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
266{ 266{
267 QDataStream stream( data, IO_ReadOnly ); 267 QDataStream stream( data, IO_ReadOnly );
268 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); 268 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" );
269 //QString datamess; 269 //QString datamess;
270 //qDebug("message "); 270 //qDebug("message ");
271 qDebug("KO: QCOP message received: %s ", cmsg.data() ); 271 qDebug("KO: QCOP message received: %s ", cmsg.data() );
272 272
273 if ( cmsg == "-writeFile" ) { 273 if ( cmsg == "-writeFile" ) {
274 // I made from the "-writeFile" an "-writeAlarm" 274 // I made from the "-writeFile" an "-writeAlarm"
275 mView->viewManager()->showWhatsNextView(); 275 mView->viewManager()->showWhatsNextView();
276 mCalendar->checkAlarmForIncidence( 0, true); 276 mCalendar->checkAlarmForIncidence( 0, true);
277 showMaximized(); 277 showMaximized();
278 raise(); 278 raise();
279 return; 279 return;
280 } 280 }
281 281
282 if ( cmsg == "-writeFile" ) { 282 if ( cmsg == "-writeFile" ) {
283 // I made from the "-writeFile" an "-writeAlarm" 283 // I made from the "-writeFile" an "-writeAlarm"
284 mView->viewManager()->showWhatsNextView(); 284 mView->viewManager()->showWhatsNextView();
285 mCalendar->checkAlarmForIncidence( 0, true); 285 mCalendar->checkAlarmForIncidence( 0, true);
286 showMaximized(); 286 showMaximized();
287 raise(); 287 raise();
288 return; 288 return;
289 289
290 } 290 }
291 if ( cmsg == "-writeFileSilent" ) { 291 if ( cmsg == "-writeFileSilent" ) {
292 // I made from the "-writeFile" an "-writeAlarm" 292 // I made from the "-writeFile" an "-writeAlarm"
293 // mView->viewManager()->showWhatsNextView(); 293 // mView->viewManager()->showWhatsNextView();
294 mCalendar->checkAlarmForIncidence( 0, true); 294 mCalendar->checkAlarmForIncidence( 0, true);
295 //showMaximized(); 295 //showMaximized();
296 //raise(); 296 //raise();
297 hide(); 297 hide();
298 return; 298 return;
299 } 299 }
300 if ( cmsg == "-newCountdown" ) { 300 if ( cmsg == "-newCountdown" ) {
301 qDebug("newCountdown "); 301 qDebug("newCountdown ");
302 302
303 } 303 }
304 QString msg ; 304 QString msg ;
305 QString allmsg = cmsg; 305 QString allmsg = cmsg;
306 while ( allmsg.length() > 0 ) { 306 while ( allmsg.length() > 0 ) {
307 int nextC = allmsg.find( "-", 1 ); 307 int nextC = allmsg.find( "-", 1 );
308 if ( nextC == -1 ) { 308 if ( nextC == -1 ) {
309 msg = allmsg; 309 msg = allmsg;
310 allmsg = ""; 310 allmsg = "";
311 } else{ 311 } else{
312 msg = allmsg.left( nextC ); 312 msg = allmsg.left( nextC );
313 allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); 313 allmsg = allmsg.mid( nextC, allmsg.length()-nextC );
314 } 314 }
315 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); 315 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() );
316 if ( msg == "-newEvent" ) { 316 if ( msg == "-newEvent" ) {
317 mView->newEvent(); 317 mView->newEvent();
318 } 318 }
319 if ( msg == "-newTodo" ) { 319 if ( msg == "-newTodo" ) {
320 mView->newTodo(); 320 mView->newTodo();
321 321
322 } 322 }
323 if ( msg == "-showWN" ) { 323 if ( msg == "-showWN" ) {
324 mView->viewManager()->showWhatsNextView(); 324 mView->viewManager()->showWhatsNextView();
325 } 325 }
326 if ( msg == "-showTodo" ) { 326 if ( msg == "-showTodo" ) {
327 mView->viewManager()->showTodoView(); 327 mView->viewManager()->showTodoView();
328 } 328 }
329 if ( msg == "-showList" ) { 329 if ( msg == "-showList" ) {
330 mView->viewManager()->showListView(); 330 mView->viewManager()->showListView();
331 } 331 }
332 else if ( msg == "-showDay" ) { 332 else if ( msg == "-showDay" ) {
333 mView->viewManager()->showDayView(); 333 mView->viewManager()->showDayView();
334 } 334 }
335 else if ( msg == "-showWWeek" ) { 335 else if ( msg == "-showWWeek" ) {
336 mView->viewManager()->showWorkWeekView(); 336 mView->viewManager()->showWorkWeekView();
337 } 337 }
338 else if ( msg == "-ringSync" ) { 338 else if ( msg == "-ringSync" ) {
339 multiSync( false ); 339 multiSync( false );
340 } 340 }
341 else if ( msg == "-showWeek" ) { 341 else if ( msg == "-showWeek" ) {
342 mView->viewManager()->showWeekView(); 342 mView->viewManager()->showWeekView();
343 } 343 }
344 else if ( msg == "-showTodo" ) { 344 else if ( msg == "-showTodo" ) {
345 mView->viewManager()->showTodoView(); 345 mView->viewManager()->showTodoView();
346 } 346 }
347 else if ( msg == "-showJournal" ) { 347 else if ( msg == "-showJournal" ) {
348 mView->dateNavigator()->selectDates( 1 ); 348 mView->dateNavigator()->selectDates( 1 );
349 mView->dateNavigator()->selectToday(); 349 mView->dateNavigator()->selectToday();
350 mView->viewManager()->showJournalView(); 350 mView->viewManager()->showJournalView();
351 } 351 }
352 else if ( msg == "-showKO" ) { 352 else if ( msg == "-showKO" ) {
353 mView->viewManager()->showNextXView(); 353 mView->viewManager()->showNextXView();
354 } 354 }
355 else if ( msg == "-showWNext" || msg == "nextView()" ) { 355 else if ( msg == "-showWNext" || msg == "nextView()" ) {
356 mView->viewManager()->showWhatsNextView(); 356 mView->viewManager()->showWhatsNextView();
357 } 357 }
358 else if ( msg == "-showNextXView" ) { 358 else if ( msg == "-showNextXView" ) {
359 mView->viewManager()->showNextXView(); 359 mView->viewManager()->showNextXView();
360 } 360 }
361 361
362 362
363 } 363 }
364 364
365 showMaximized(); 365 showMaximized();
366 raise(); 366 raise();
367} 367}
368 368
369QPixmap MainWindow::loadPixmap( QString name ) 369QPixmap MainWindow::loadPixmap( QString name )
370{ 370{
371 return SmallIcon( name ); 371 return SmallIcon( name );
372 372
373} 373}
374void MainWindow::initActions() 374void MainWindow::initActions()
375{ 375{
376 //KOPrefs::instance()->mShowFullMenu 376 //KOPrefs::instance()->mShowFullMenu
377 iconToolBar->clear(); 377 iconToolBar->clear();
378 KOPrefs *p = KOPrefs::instance(); 378 KOPrefs *p = KOPrefs::instance();
379 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); 379 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar );
380 380
381 QPopupMenu *viewMenu = new QPopupMenu( this ); 381 QPopupMenu *viewMenu = new QPopupMenu( this );
382 QPopupMenu *actionMenu = new QPopupMenu( this ); 382 QPopupMenu *actionMenu = new QPopupMenu( this );
383 QPopupMenu *importMenu = new QPopupMenu( this ); 383 QPopupMenu *importMenu = new QPopupMenu( this );
384 selectFilterMenu = new QPopupMenu( this ); 384 selectFilterMenu = new QPopupMenu( this );
385 selectFilterMenu->setCheckable( true ); 385 selectFilterMenu->setCheckable( true );
386 syncMenu = new QPopupMenu( this ); 386 syncMenu = new QPopupMenu( this );
387 configureAgendaMenu = new QPopupMenu( this ); 387 configureAgendaMenu = new QPopupMenu( this );
388 configureToolBarMenu = new QPopupMenu( this ); 388 configureToolBarMenu = new QPopupMenu( this );
389 QPopupMenu *helpMenu = new QPopupMenu( this ); 389 QPopupMenu *helpMenu = new QPopupMenu( this );
390 if ( KOPrefs::instance()->mShowFullMenu ) { 390 if ( KOPrefs::instance()->mShowFullMenu ) {
391 QMenuBar *menuBar1; 391 QMenuBar *menuBar1;
392 menuBar1 = menuBar(); 392 menuBar1 = menuBar();
393 menuBar1->insertItem( i18n("File"), importMenu ); 393 menuBar1->insertItem( i18n("File"), importMenu );
394 menuBar1->insertItem( i18n("View"), viewMenu ); 394 menuBar1->insertItem( i18n("View"), viewMenu );
395 menuBar1->insertItem( i18n("Actions"), actionMenu ); 395 menuBar1->insertItem( i18n("Actions"), actionMenu );
396 menuBar1->insertItem( i18n("Synchronize"), syncMenu ); 396 menuBar1->insertItem( i18n("Synchronize"), syncMenu );
397 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 397 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu );
398 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); 398 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu );
399 menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); 399 menuBar1->insertItem( i18n("Filter"),selectFilterMenu );
400 menuBar1->insertItem( i18n("Help"), helpMenu ); 400 menuBar1->insertItem( i18n("Help"), helpMenu );
401 } else { 401 } else {
402 QPEMenuBar *menuBar1; 402 QPEMenuBar *menuBar1;
403 menuBar1 = new QPEMenuBar( iconToolBar ); 403 menuBar1 = new QPEMenuBar( iconToolBar );
404 QPopupMenu *menuBar = new QPopupMenu( this ); 404 QPopupMenu *menuBar = new QPopupMenu( this );
405 menuBar1->insertItem( i18n("ME"), menuBar); 405 menuBar1->insertItem( i18n("ME"), menuBar);
406 menuBar->insertItem( i18n("File"), importMenu ); 406 menuBar->insertItem( i18n("File"), importMenu );
407 menuBar->insertItem( i18n("View"), viewMenu ); 407 menuBar->insertItem( i18n("View"), viewMenu );
408 menuBar->insertItem( i18n("Actions"), actionMenu ); 408 menuBar->insertItem( i18n("Actions"), actionMenu );
409 menuBar->insertItem( i18n("Synchronize"), syncMenu ); 409 menuBar->insertItem( i18n("Synchronize"), syncMenu );
410 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 410 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu );
411 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); 411 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu );
412 menuBar->insertItem( i18n("Filter"),selectFilterMenu ); 412 menuBar->insertItem( i18n("Filter"),selectFilterMenu );
413 menuBar->insertItem( i18n("Help"), helpMenu ); 413 menuBar->insertItem( i18n("Help"), helpMenu );
414 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); 414 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() );
415 menuBar1->setMaximumSize( menuBar1->sizeHint( )); 415 menuBar1->setMaximumSize( menuBar1->sizeHint( ));
416 } 416 }
417 connect ( syncMenu, SIGNAL( activated ( int ) ), this, SLOT (slotSyncMenu( int ) ) ); 417 connect ( syncMenu, SIGNAL( activated ( int ) ), this, SLOT (slotSyncMenu( int ) ) );
418 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 418 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
419 connect ( selectFilterMenu, SIGNAL( aboutToShow () ), this, SLOT (fillFilterMenu() ) ); 419 connect ( selectFilterMenu, SIGNAL( aboutToShow () ), this, SLOT (fillFilterMenu() ) );
420 420
421 // ****************** 421 // ******************
422 QAction *action; 422 QAction *action;
423 QIconSet icon; 423 QIconSet icon;
424 // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); 424 // QPopupMenu *configureMenu= new QPopupMenu( menuBar );
425 configureToolBarMenu->setCheckable( true ); 425 configureToolBarMenu->setCheckable( true );
426 426
427 QString pathString = ""; 427 QString pathString = "";
428 if ( !p->mToolBarMiniIcons ) { 428 if ( !p->mToolBarMiniIcons ) {
429 if ( QApplication::desktop()->width() < 480 ) 429 if ( QApplication::desktop()->width() < 480 )
430 pathString += "icons16/"; 430 pathString += "icons16/";
431 } else 431 } else
432 pathString += "iconsmini/"; 432 pathString += "iconsmini/";
433 configureAgendaMenu->setCheckable( true ); 433 configureAgendaMenu->setCheckable( true );
434 configureAgendaMenu->insertItem(i18n("Toggle Allday"), 1 ); 434 configureAgendaMenu->insertItem(i18n("Toggle Allday"), 1 );
435 configureAgendaMenu->insertSeparator(); 435 configureAgendaMenu->insertSeparator();
436 configureAgendaMenu->insertItem(i18n("Tiny"), 4 ); 436 configureAgendaMenu->insertItem(i18n("Tiny"), 4 );
437 configureAgendaMenu->insertItem(i18n("Small"), 6 ); 437 configureAgendaMenu->insertItem(i18n("Small"), 6 );
438 configureAgendaMenu->insertItem(i18n("Medium"), 8 ); 438 configureAgendaMenu->insertItem(i18n("Medium"), 8 );
439 configureAgendaMenu->insertItem(i18n("Normal"), 10 ); 439 configureAgendaMenu->insertItem(i18n("Normal"), 10 );
440 configureAgendaMenu->insertItem(i18n("Large"), 12 ); 440 configureAgendaMenu->insertItem(i18n("Large"), 12 );
441 configureAgendaMenu->insertItem(i18n("Big"), 14 ); 441 configureAgendaMenu->insertItem(i18n("Big"), 14 );
442 configureAgendaMenu->insertItem(i18n("Bigger"), 16 ); 442 configureAgendaMenu->insertItem(i18n("Bigger"), 16 );
443 configureAgendaMenu->insertItem(i18n("Biggest"), 18 ); 443 configureAgendaMenu->insertItem(i18n("Biggest"), 18 );
444 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); 444 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu );
445 445
446 icon = loadPixmap( pathString + "configure" ); 446 icon = loadPixmap( pathString + "configure" );
447 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); 447 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this );
448 action->addTo( actionMenu ); 448 action->addTo( actionMenu );
449 connect( action, SIGNAL( activated() ), 449 connect( action, SIGNAL( activated() ),
450 mView, SLOT( edit_options() ) ); 450 mView, SLOT( edit_options() ) );
451 actionMenu->insertSeparator(); 451 actionMenu->insertSeparator();
452 icon = loadPixmap( pathString + "newevent" ); 452 icon = loadPixmap( pathString + "newevent" );
453 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); 453 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 );
454 configureToolBarMenu->insertSeparator(); 454 configureToolBarMenu->insertSeparator();
455 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); 455 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 );
456 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); 456 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this );
457 ne_action->addTo( actionMenu ); 457 ne_action->addTo( actionMenu );
458 connect( ne_action, SIGNAL( activated() ), 458 connect( ne_action, SIGNAL( activated() ),
459 mView, SLOT( newEvent() ) ); 459 mView, SLOT( newEvent() ) );
460 icon = loadPixmap( pathString + "newtodo" ); 460 icon = loadPixmap( pathString + "newtodo" );
461 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); 461 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 );
462 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); 462 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this );
463 nt_action->addTo( actionMenu ); 463 nt_action->addTo( actionMenu );
464 connect( nt_action, SIGNAL( activated() ), 464 connect( nt_action, SIGNAL( activated() ),
465 mView, SLOT( newTodo() ) ); 465 mView, SLOT( newTodo() ) );
466 icon = loadPixmap( pathString + "navi" ); 466 icon = loadPixmap( pathString + "navi" );
467 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); 467 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this );
468 action->addTo( viewMenu ); 468 action->addTo( viewMenu );
469 connect( action, SIGNAL( activated() ), 469 connect( action, SIGNAL( activated() ),
470 mView, SLOT( toggleDateNavigatorWidget() ) ); 470 mView, SLOT( toggleDateNavigatorWidget() ) );
471 icon = loadPixmap( pathString + "filter" ); 471 icon = loadPixmap( pathString + "filter" );
472 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); 472 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this );
473 action->addTo( viewMenu ); 473 action->addTo( viewMenu );
474 connect( action, SIGNAL( activated() ), 474 connect( action, SIGNAL( activated() ),
475 mView, SLOT( toggleFilter() ) ); 475 mView, SLOT( toggleFilter() ) );
476 476
477 477
478 viewMenu->insertSeparator(); 478 viewMenu->insertSeparator();
479 icon = loadPixmap( pathString + "picker" ); 479 icon = loadPixmap( pathString + "picker" );
480 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); 480 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this );
481 action->addTo( viewMenu ); 481 action->addTo( viewMenu );
482 connect( action, SIGNAL( activated() ), 482 connect( action, SIGNAL( activated() ),
483 mView, SLOT( showDatePicker() ) ); 483 mView, SLOT( showDatePicker() ) );
484 action->addTo( iconToolBar ); 484 action->addTo( iconToolBar );
485 viewMenu->insertSeparator(); 485 viewMenu->insertSeparator();
486 icon = loadPixmap( pathString + "list" ); 486 icon = loadPixmap( pathString + "list" );
487 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); 487 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 );
488 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); 488 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this );
489 showlist_action->addTo( viewMenu ); 489 showlist_action->addTo( viewMenu );
490 connect( showlist_action, SIGNAL( activated() ), 490 connect( showlist_action, SIGNAL( activated() ),
491 mView->viewManager(), SLOT( showListView() ) ); 491 mView->viewManager(), SLOT( showListView() ) );
492 492
493 493
494 icon = loadPixmap( pathString + "day" ); 494 icon = loadPixmap( pathString + "day" );
495 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); 495 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 );
496 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); 496 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this );
497 day1_action->addTo( viewMenu ); 497 day1_action->addTo( viewMenu );
498 // action->addTo( toolBar ); 498 // action->addTo( toolBar );
499 connect( day1_action, SIGNAL( activated() ), 499 connect( day1_action, SIGNAL( activated() ),
500 mView->viewManager(), SLOT( showDayView() ) ); 500 mView->viewManager(), SLOT( showDayView() ) );
501 501
502 icon = loadPixmap( pathString + "workweek" ); 502 icon = loadPixmap( pathString + "workweek" );
503 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); 503 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 );
504 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); 504 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this );
505 day5_action->addTo( viewMenu ); 505 day5_action->addTo( viewMenu );
506 connect( day5_action, SIGNAL( activated() ), 506 connect( day5_action, SIGNAL( activated() ),
507 mView->viewManager(), SLOT( showWorkWeekView() ) ); 507 mView->viewManager(), SLOT( showWorkWeekView() ) );
508 508
509 icon = loadPixmap( pathString + "week" ); 509 icon = loadPixmap( pathString + "week" );
510 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); 510 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 );
511 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); 511 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this );
512 day7_action->addTo( viewMenu ); 512 day7_action->addTo( viewMenu );
513 connect( day7_action, SIGNAL( activated() ), 513 connect( day7_action, SIGNAL( activated() ),
514 mView->viewManager(), SLOT( showWeekView() ) ); 514 mView->viewManager(), SLOT( showWeekView() ) );
515 515
516 icon = loadPixmap( pathString + "month" ); 516 icon = loadPixmap( pathString + "month" );
517 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); 517 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 );
518 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); 518 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this );
519 month_action->addTo( viewMenu ); 519 month_action->addTo( viewMenu );
520 connect( month_action, SIGNAL( activated() ), 520 connect( month_action, SIGNAL( activated() ),
521 mView->viewManager(), SLOT( showMonthView() ) ); 521 mView->viewManager(), SLOT( showMonthView() ) );
522 522
523 icon = loadPixmap( pathString + "todo" ); 523 icon = loadPixmap( pathString + "todo" );
524 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); 524 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 );
525 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); 525 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this );
526 todoview_action->addTo( viewMenu ); 526 todoview_action->addTo( viewMenu );
527 connect( todoview_action, SIGNAL( activated() ), 527 connect( todoview_action, SIGNAL( activated() ),
528 mView->viewManager(), SLOT( showTodoView() ) ); 528 mView->viewManager(), SLOT( showTodoView() ) );
529 529
530 icon = loadPixmap( pathString + "journal" ); 530 icon = loadPixmap( pathString + "journal" );
531 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); 531 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 );
532 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); 532 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this );
533 viewjournal_action->addTo( viewMenu ); 533 viewjournal_action->addTo( viewMenu );
534 connect( viewjournal_action, SIGNAL( activated() ), 534 connect( viewjournal_action, SIGNAL( activated() ),
535 mView->viewManager(), SLOT( showJournalView() ) ); 535 mView->viewManager(), SLOT( showJournalView() ) );
536 536
537 icon = loadPixmap( pathString + "xdays" ); 537 icon = loadPixmap( pathString + "xdays" );
538 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 ); 538 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 );
539 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); 539 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this );
540 xdays_action->addTo( viewMenu ); 540 xdays_action->addTo( viewMenu );
541 connect( xdays_action, SIGNAL( activated() ), 541 connect( xdays_action, SIGNAL( activated() ),
542 mView->viewManager(), SLOT( showNextXView() ) ); 542 mView->viewManager(), SLOT( showNextXView() ) );
543 543
544 icon = loadPixmap( pathString + "whatsnext" ); 544 icon = loadPixmap( pathString + "whatsnext" );
545 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 ); 545 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 );
546 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); 546 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this );
547 whatsnext_action->addTo( viewMenu ); 547 whatsnext_action->addTo( viewMenu );
548 connect( whatsnext_action, SIGNAL( activated() ), 548 connect( whatsnext_action, SIGNAL( activated() ),
549 mView->viewManager(), SLOT( showWhatsNextView() ) ); 549 mView->viewManager(), SLOT( showWhatsNextView() ) );
550 550
551#if 0 551#if 0
552 action = new QAction( "view_timespan", "Time Span", 0, this ); 552 action = new QAction( "view_timespan", "Time Span", 0, this );
553 action->addTo( viewMenu ); 553 action->addTo( viewMenu );
554 connect( action, SIGNAL( activated() ), 554 connect( action, SIGNAL( activated() ),
555 mView->viewManager(), SLOT( showTimeSpanView() ) ); 555 mView->viewManager(), SLOT( showTimeSpanView() ) );
556#endif 556#endif
557 557
558 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, 558 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0,
559 this ); 559 this );
560 mNewSubTodoAction->addTo( actionMenu ); 560 mNewSubTodoAction->addTo( actionMenu );
561 connect( mNewSubTodoAction, SIGNAL( activated() ), 561 connect( mNewSubTodoAction, SIGNAL( activated() ),
562 mView, SLOT( newSubTodo() ) ); 562 mView, SLOT( newSubTodo() ) );
563 563
564 actionMenu->insertSeparator(); 564 actionMenu->insertSeparator();
565 565
566 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); 566 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this );
567 mShowAction->addTo( actionMenu ); 567 mShowAction->addTo( actionMenu );
568 connect( mShowAction, SIGNAL( activated() ), 568 connect( mShowAction, SIGNAL( activated() ),
569 mView, SLOT( showIncidence() ) ); 569 mView, SLOT( showIncidence() ) );
570 570
571 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); 571 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this );
572 mEditAction->addTo( actionMenu ); 572 mEditAction->addTo( actionMenu );
573 connect( mEditAction, SIGNAL( activated() ), 573 connect( mEditAction, SIGNAL( activated() ),
574 mView, SLOT( editIncidence() ) ); 574 mView, SLOT( editIncidence() ) );
575 575
576 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); 576 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this );
577 mDeleteAction->addTo( actionMenu ); 577 mDeleteAction->addTo( actionMenu );
578 connect( mDeleteAction, SIGNAL( activated() ), 578 connect( mDeleteAction, SIGNAL( activated() ),
579 mView, SLOT( deleteIncidence() ) ); 579 mView, SLOT( deleteIncidence() ) );
580 580
581 actionMenu->insertSeparator(); 581 actionMenu->insertSeparator();
582 582
583 action = new QAction( "purge_completed", i18n("Purge Completed"), 0, 583 action = new QAction( "purge_completed", i18n("Purge Completed"), 0,
584 this ); 584 this );
585 action->addTo( actionMenu ); 585 action->addTo( actionMenu );
586 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); 586 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) );
587 587
588 icon = loadPixmap( pathString + "search" ); 588 icon = loadPixmap( pathString + "search" );
589 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); 589 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this );
590 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4); 590 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4);
591 search_action->addTo( actionMenu ); 591 search_action->addTo( actionMenu );
592 connect( search_action, SIGNAL( activated() ), 592 connect( search_action, SIGNAL( activated() ),
593 mView->dialogManager(), SLOT( showSearchDialog() ) ); 593 mView->dialogManager(), SLOT( showSearchDialog() ) );
594 594
595 icon = loadPixmap( pathString + "today" ); 595 icon = loadPixmap( pathString + "today" );
596 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); 596 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130);
597 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); 597 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this );
598 today_action->addTo( actionMenu ); 598 today_action->addTo( actionMenu );
599 connect( today_action, SIGNAL( activated() ), 599 connect( today_action, SIGNAL( activated() ),
600 mView, SLOT( goToday() ) ); 600 mView, SLOT( goToday() ) );
601 601
602 if ( KOPrefs::instance()->mShowFullMenu ) { 602 if ( KOPrefs::instance()->mShowFullMenu ) {
603 actionMenu->insertSeparator(); 603 actionMenu->insertSeparator();
604 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); 604 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu );
605 605
606 } 606 }
607 // actionMenu->insertSeparator(); 607 // actionMenu->insertSeparator();
608 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, 608 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0,
609 this ); 609 this );
610 action->addTo( importMenu ); 610 action->addTo( importMenu );
611 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); 611 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) );
612 action = new QAction( "import_quick", i18n("Import last file"), 0, 612 action = new QAction( "import_quick", i18n("Import last file"), 0,
613 this ); 613 this );
614 action->addTo( importMenu ); 614 action->addTo( importMenu );
615 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); 615 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) );
616 importMenu->insertSeparator(); 616 importMenu->insertSeparator();
617 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, 617 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0,
618 this ); 618 this );
619 action->addTo( importMenu ); 619 action->addTo( importMenu );
620 connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); 620 connect( action, SIGNAL( activated() ), SLOT( importBday() ) );
621#ifndef DESKTOP_VERSION 621#ifndef DESKTOP_VERSION
622 importMenu->insertSeparator(); 622 importMenu->insertSeparator();
623 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, 623 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0,
624 this ); 624 this );
625 action->addTo( importMenu ); 625 action->addTo( importMenu );
626 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); 626 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) );
627#else 627#else
628#ifdef _WIN32_ 628#ifdef _WIN32_
629 importMenu->insertSeparator(); 629 importMenu->insertSeparator();
630 action = new QAction( "import_ol", i18n("Import from OL"), 0, 630 action = new QAction( "import_ol", i18n("Import from OL"), 0,
631 this ); 631 this );
632 action->addTo( importMenu ); 632 action->addTo( importMenu );
633 connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); 633 connect( action, SIGNAL( activated() ), SLOT( importOL() ) );
634#endif 634#endif
635#endif 635#endif
636 636
637 importMenu->insertSeparator(); 637 importMenu->insertSeparator();
638 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, 638 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0,
639 this ); 639 this );
640 action->addTo( importMenu ); 640 action->addTo( importMenu );
641 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); 641 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) );
642 642
643 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, 643 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0,
644 this ); 644 this );
645 action->addTo( importMenu ); 645 action->addTo( importMenu );
646 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); 646 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) );
647 647
648 importMenu->insertSeparator(); 648 importMenu->insertSeparator();
649 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, 649 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0,
650 this ); 650 this );
651 action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); 651 action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) );
652 importMenu->insertSeparator(); 652 importMenu->insertSeparator();
653 action = new QAction( "manage cat", i18n("Manage new categories..."), 0, 653 action = new QAction( "manage cat", i18n("Manage new categories..."), 0,
654 this ); 654 this );
655 action->addTo( importMenu ); 655 action->addTo( importMenu );
656 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); 656 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) );
657#ifndef DESKTOP_VERSION 657#ifndef DESKTOP_VERSION
658 importMenu->insertSeparator(); 658 importMenu->insertSeparator();
659 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, 659 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0,
660 this ); 660 this );
661 action->addTo( importMenu ); 661 action->addTo( importMenu );
662 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); 662 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) );
663 663
664 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, 664 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0,
665 this ); 665 this );
666 action->addTo( importMenu ); 666 action->addTo( importMenu );
667 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); 667 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) );
668#else 668#else
669 importMenu->insertSeparator(); 669 importMenu->insertSeparator();
670 icon = loadPixmap( pathString + "print" ); 670 icon = loadPixmap( pathString + "print" );
671 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); 671 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this );
672 action->addTo( importMenu ); 672 action->addTo( importMenu );
673 connect( action, SIGNAL( activated() ), 673 connect( action, SIGNAL( activated() ),
674 this, SLOT( printCal() ) ); 674 this, SLOT( printCal() ) );
675 675
676 icon = loadPixmap( pathString + "print" ); 676 icon = loadPixmap( pathString + "print" );
677 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); 677 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this );
678 action->addTo( importMenu ); 678 action->addTo( importMenu );
679 connect( action, SIGNAL( activated() ), 679 connect( action, SIGNAL( activated() ),
680 this, SLOT( printSel() ) ); 680 this, SLOT( printSel() ) );
681#endif 681#endif
682 importMenu->insertSeparator(); 682 importMenu->insertSeparator();
683 action = new QAction( "beam all", i18n("Save"), 0, 683 action = new QAction( "beam all", i18n("Save"), 0,
684 this ); 684 this );
685 action->addTo( importMenu ); 685 action->addTo( importMenu );
686 connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); 686 connect( action, SIGNAL( activated() ), this, SLOT( save() ) );
687 action = new QAction( "beam all", i18n("Exit (+save)"), 0, 687 action = new QAction( "beam all", i18n("Exit (+save)"), 0,
688 this ); 688 this );
689 action->addTo( importMenu ); 689 action->addTo( importMenu );
690 connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); 690 connect( action, SIGNAL( activated() ), this, SLOT( close() ) );
691 691
692 //menuBar->insertItem( "Configure",configureMenu ); 692 //menuBar->insertItem( "Configure",configureMenu );
693 //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); 693 //configureMenu->insertItem( "Toolbar",configureToolBarMenu );
694 icon = loadPixmap( "korganizer/korganizer" ); 694 icon = loadPixmap( "korganizer/korganizer" );
695 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); 695 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this );
696 action->addTo( helpMenu ); 696 action->addTo( helpMenu );
697 connect( action, SIGNAL( activated() ), 697 connect( action, SIGNAL( activated() ),
698 SLOT( keyBindings() ) ); 698 SLOT( keyBindings() ) );
699 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); 699 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this );
700 action->addTo( helpMenu ); 700 action->addTo( helpMenu );
701 connect( action, SIGNAL( activated() ), 701 connect( action, SIGNAL( activated() ),
702 SLOT( features() ) ); 702 SLOT( features() ) );
703 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); 703 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this );
704 action->addTo( helpMenu ); 704 action->addTo( helpMenu );
705 connect( action, SIGNAL( activated() ), 705 connect( action, SIGNAL( activated() ),
706 SLOT( aboutAutoSaving() ) ); 706 SLOT( aboutAutoSaving() ) );
707 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); 707 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this );
708 action->addTo( helpMenu ); 708 action->addTo( helpMenu );
709 connect( action, SIGNAL( activated() ), 709 connect( action, SIGNAL( activated() ),
710 SLOT( aboutKnownBugs() ) ); 710 SLOT( aboutKnownBugs() ) );
711 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); 711 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this );
712 action->addTo( helpMenu ); 712 action->addTo( helpMenu );
713 connect( action, SIGNAL( activated() ), 713 connect( action, SIGNAL( activated() ),
714 SLOT( usertrans() ) ); 714 SLOT( usertrans() ) );
715 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); 715 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this );
716 action->addTo( helpMenu ); 716 action->addTo( helpMenu );
717 connect( action, SIGNAL( activated() ), 717 connect( action, SIGNAL( activated() ),
718 SLOT( synchowto() ) ); 718 SLOT( synchowto() ) );
719 action = new QAction( "Whats New", i18n("What's new?"), 0,this ); 719 action = new QAction( "Whats New", i18n("What's new?"), 0,this );
720 action->addTo( helpMenu ); 720 action->addTo( helpMenu );
721 connect( action, SIGNAL( activated() ), 721 connect( action, SIGNAL( activated() ),
722 SLOT( whatsNew() ) ); 722 SLOT( whatsNew() ) );
723 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); 723 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this );
724 action->addTo( helpMenu ); 724 action->addTo( helpMenu );
725 connect( action, SIGNAL( activated() ), 725 connect( action, SIGNAL( activated() ),
726 SLOT( faq() ) ); 726 SLOT( faq() ) );
727 727
728 728
729 action = new QAction( "about", i18n("About..."), 0, this ); 729 action = new QAction( "about", i18n("About..."), 0, this );
730 action->addTo( helpMenu ); 730 action->addTo( helpMenu );
731 connect( action, SIGNAL( activated() ), 731 connect( action, SIGNAL( activated() ),
732 SLOT( about() ) ); 732 SLOT( about() ) );
733 action = new QAction( "licence", i18n("Licence..."), 0, this ); 733 action = new QAction( "licence", i18n("Licence..."), 0, this );
734 action->addTo( helpMenu ); 734 action->addTo( helpMenu );
735 connect( action, SIGNAL( activated() ), 735 connect( action, SIGNAL( activated() ),
736 SLOT( licence() ) ); 736 SLOT( licence() ) );
737 //menuBar->insertSeparator(); 737 //menuBar->insertSeparator();
738 738
739 // ****************************************************** 739 // ******************************************************
740 // menubar icons 740 // menubar icons
741 741
742 742
743 iconToolBar->setHorizontalStretchable (true ); 743 iconToolBar->setHorizontalStretchable (true );
744 //menuBar->insertItem( iconToolBar ); 744 //menuBar->insertItem( iconToolBar );
745 //xdays_action 745 //xdays_action
746 if (p-> mShowIconNewEvent) 746 if (p-> mShowIconNewEvent)
747 ne_action->addTo( iconToolBar ); 747 ne_action->addTo( iconToolBar );
748 if (p->mShowIconNewTodo ) 748 if (p->mShowIconNewTodo )
749 nt_action->addTo( iconToolBar ); 749 nt_action->addTo( iconToolBar );
750 if (p-> mShowIconSearch) 750 if (p-> mShowIconSearch)
751 search_action->addTo( iconToolBar ); 751 search_action->addTo( iconToolBar );
752 if (p-> mShowIconNext) 752 if (p-> mShowIconNext)
753 whatsnext_action->addTo( iconToolBar ); 753 whatsnext_action->addTo( iconToolBar );
754 if (p-> mShowIconNextDays) 754 if (p-> mShowIconNextDays)
755 xdays_action->addTo( iconToolBar ); 755 xdays_action->addTo( iconToolBar );
756 if (p-> mShowIconList) 756 if (p-> mShowIconList)
757 showlist_action->addTo( iconToolBar ); 757 showlist_action->addTo( iconToolBar );
758 if (p-> mShowIconDay1) 758 if (p-> mShowIconDay1)
759 day1_action->addTo( iconToolBar ); 759 day1_action->addTo( iconToolBar );
760 if (p-> mShowIconDay5) 760 if (p-> mShowIconDay5)
761 day5_action->addTo( iconToolBar ); 761 day5_action->addTo( iconToolBar );
762 if (p-> mShowIconDay7) 762 if (p-> mShowIconDay7)
763 day7_action->addTo( iconToolBar ); 763 day7_action->addTo( iconToolBar );
764 if (p-> mShowIconMonth) 764 if (p-> mShowIconMonth)
765 month_action->addTo( iconToolBar ); 765 month_action->addTo( iconToolBar );
766 if (p-> mShowIconTodoview) 766 if (p-> mShowIconTodoview)
767 todoview_action->addTo( iconToolBar ); 767 todoview_action->addTo( iconToolBar );
768 if (p-> mShowIconJournal) 768 if (p-> mShowIconJournal)
769 viewjournal_action->addTo( iconToolBar ); 769 viewjournal_action->addTo( iconToolBar );
770 icon = loadPixmap( pathString + "2leftarrowB" ); 770 icon = loadPixmap( pathString + "2leftarrowB" );
771 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14); 771 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14);
772 if (p-> mShowIconBackFast) { 772 if (p-> mShowIconBackFast) {
773 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); 773 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this );
774 connect( action, SIGNAL( activated() ), 774 connect( action, SIGNAL( activated() ),
775 mView, SLOT( goPreviousMonth() ) ); 775 mView, SLOT( goPreviousMonth() ) );
776 action->addTo( iconToolBar ); 776 action->addTo( iconToolBar );
777 } 777 }
778 icon = loadPixmap( pathString + "1leftarrowB" ); 778 icon = loadPixmap( pathString + "1leftarrowB" );
779 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15); 779 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15);
780 if (p-> mShowIconBack) { 780 if (p-> mShowIconBack) {
781 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); 781 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this );
782 connect( action, SIGNAL( activated() ), 782 connect( action, SIGNAL( activated() ),
783 mView, SLOT( goPrevious() ) ); 783 mView, SLOT( goPrevious() ) );
784 action->addTo( iconToolBar ); 784 action->addTo( iconToolBar );
785 } 785 }
786 if (p-> mShowIconToday) 786 if (p-> mShowIconToday)
787 today_action->addTo( iconToolBar ); 787 today_action->addTo( iconToolBar );
788 icon = loadPixmap( pathString + "1rightarrowB" ); 788 icon = loadPixmap( pathString + "1rightarrowB" );
789 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); 789 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220);
790 if (p-> mShowIconForward) { 790 if (p-> mShowIconForward) {
791 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); 791 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this );
792 connect( action, SIGNAL( activated() ), 792 connect( action, SIGNAL( activated() ),
793 mView, SLOT( goNext() ) ); 793 mView, SLOT( goNext() ) );
794 action->addTo( iconToolBar ); 794 action->addTo( iconToolBar );
795 } 795 }
796 icon = loadPixmap( pathString + "2rightarrowB" ); 796 icon = loadPixmap( pathString + "2rightarrowB" );
797 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); 797 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230);
798 if (p-> mShowIconForwardFast) { 798 if (p-> mShowIconForwardFast) {
799 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); 799 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this );
800 connect( action, SIGNAL( activated() ), 800 connect( action, SIGNAL( activated() ),
801 mView, SLOT( goNextMonth() ) ); 801 mView, SLOT( goNextMonth() ) );
802 action->addTo( iconToolBar ); 802 action->addTo( iconToolBar );
803 } 803 }
804 804