summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/datenavigatorcontainer.cpp22
-rw-r--r--korganizer/koeditordetails.cpp4
2 files changed, 12 insertions, 14 deletions
diff --git a/korganizer/datenavigatorcontainer.cpp b/korganizer/datenavigatorcontainer.cpp
index f9c8b73..ea510f1 100644
--- a/korganizer/datenavigatorcontainer.cpp
+++ b/korganizer/datenavigatorcontainer.cpp
@@ -1,442 +1,440 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 3
4 Copyright (c) 2001,2002,2003 Cornelius Schumacher <schumacher@kde.org> 4 Copyright (c) 2001,2002,2003 Cornelius Schumacher <schumacher@kde.org>
5 Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com> 5 Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
6 6
7 This program is free software; you can redistribute it and/or modify 7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by 8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or 9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version. 10 (at your option) any later version.
11 11
12 This program is distributed in the hope that it will be useful, 12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details. 15 GNU General Public License for more details.
16 16
17 You should have received a copy of the GNU General Public License 17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software 18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 20
21 As a special exception, permission is given to link this program 21 As a special exception, permission is given to link this program
22 with any edition of Qt, and distribute the resulting executable, 22 with any edition of Qt, and distribute the resulting executable,
23 without including the source code for Qt in the source distribution. 23 without including the source code for Qt in the source distribution.
24*/ 24*/
25 25
26#include <kdebug.h> 26#include <kdebug.h>
27#include <klocale.h> 27#include <klocale.h>
28 28
29//#include "koglobals.h" 29//#include "koglobals.h"
30#include "navigatorbar.h" 30#include "navigatorbar.h"
31#include "kdatenavigator.h" 31#include "kdatenavigator.h"
32 32
33#include <kcalendarsystem.h> 33#include <kcalendarsystem.h>
34 34
35#include "datenavigatorcontainer.h" 35#include "datenavigatorcontainer.h"
36#include "koprefs.h" 36#include "koprefs.h"
37 37
38DateNavigatorContainer::DateNavigatorContainer( QWidget *parent, 38DateNavigatorContainer::DateNavigatorContainer( QWidget *parent,
39 const char *name ) 39 const char *name )
40 : QWidget( parent, name ), mCalendar( 0 ), 40 : QWidget( parent, name ), mCalendar( 0 ),
41 mHorizontalCount( 1 ), mVerticalCount( 1 ) 41 mHorizontalCount( 1 ), mVerticalCount( 1 )
42{ 42{
43 mResizeEnabled = false; 43 mResizeEnabled = false;
44 mExtraViews.setAutoDelete( true ); 44 mExtraViews.setAutoDelete( true );
45 45
46 mNavigatorView = new KDateNavigator( this, name ); 46 mNavigatorView = new KDateNavigator( this, name );
47 mNavigatorView->hide(); 47 mNavigatorView->hide();
48 connectNavigatorView( mNavigatorView ); 48 connectNavigatorView( mNavigatorView );
49 //setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) ); 49 //setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) );
50 mLastDisplayedDN = 0; 50 mLastDisplayedDN = 0;
51 mUpdateTimer;
52 mUpdateTimer = new QTimer( this ); 51 mUpdateTimer = new QTimer( this );
53 connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( checkUpdateDayMatrixDates() )); 52 connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( checkUpdateDayMatrixDates() ));
54 mFirstSelectedDate = QDate::currentDate(); 53 mFirstSelectedDate = QDate::currentDate();
55 mSelectedDateCount = 1; 54 mSelectedDateCount = 1;
56} 55}
57 56
58DateNavigatorContainer::~DateNavigatorContainer() 57DateNavigatorContainer::~DateNavigatorContainer()
59{ 58{
60} 59}
61 60
62void DateNavigatorContainer::connectNavigatorView( KDateNavigator *v ) 61void DateNavigatorContainer::connectNavigatorView( KDateNavigator *v )
63{ 62{
64 connect( v, SIGNAL( datesSelected( const KCal::DateList & ) ), 63 connect( v, SIGNAL( datesSelected( const KCal::DateList & ) ),
65 SIGNAL( datesSelected( const KCal::DateList & ) ) ); 64 SIGNAL( datesSelected( const KCal::DateList & ) ) );
66#if 0 65#if 0
67 connect( v, SIGNAL( incidenceDropped( Incidence *, const QDate & ) ), 66 connect( v, SIGNAL( incidenceDropped( Incidence *, const QDate & ) ),
68 SIGNAL( incidenceDropped( Incidence *, const QDate & ) ) ); 67 SIGNAL( incidenceDropped( Incidence *, const QDate & ) ) );
69 connect( v, SIGNAL( incidenceDroppedMove( Incidence *, const QDate & ) ), 68 connect( v, SIGNAL( incidenceDroppedMove( Incidence *, const QDate & ) ),
70 SIGNAL( incidenceDroppedMove( Incidence *, const QDate & ) ) ); 69 SIGNAL( incidenceDroppedMove( Incidence *, const QDate & ) ) );
71#endif 70#endif
72 connect( v, SIGNAL( weekClicked( const QDate & ) ), 71 connect( v, SIGNAL( weekClicked( const QDate & ) ),
73 SIGNAL( weekClicked( const QDate & ) ) ); 72 SIGNAL( weekClicked( const QDate & ) ) );
74 connect( v, SIGNAL( showMonth( const QDate & ) ), 73 connect( v, SIGNAL( showMonth( const QDate & ) ),
75 SIGNAL( showMonth( const QDate & ) ) ); 74 SIGNAL( showMonth( const QDate & ) ) );
76 75
77 connect( v, SIGNAL( goPrevious() ), SIGNAL( goPrevious() ) ); 76 connect( v, SIGNAL( goPrevious() ), SIGNAL( goPrevious() ) );
78 connect( v, SIGNAL( goNext() ), SIGNAL( goNext() ) ); 77 connect( v, SIGNAL( goNext() ), SIGNAL( goNext() ) );
79 78
80 connect( v, SIGNAL( goNextMonth() ), SLOT( slotgoNextMonth() ) ); 79 connect( v, SIGNAL( goNextMonth() ), SLOT( slotgoNextMonth() ) );
81 connect( v, SIGNAL( goPrevMonth() ), SLOT( slotgoPrevMonth() ) ); 80 connect( v, SIGNAL( goPrevMonth() ), SLOT( slotgoPrevMonth() ) );
82 connect( v, SIGNAL( goNextYear() ), SLOT( slotgoNextYear() ) ); 81 connect( v, SIGNAL( goNextYear() ), SLOT( slotgoNextYear() ) );
83 connect( v, SIGNAL( goPrevYear() ), SLOT( slotgoPrevYear() ) ); 82 connect( v, SIGNAL( goPrevYear() ), SLOT( slotgoPrevYear() ) );
84 83
85 connect( v, SIGNAL( monthSelected( int ) ), SLOT( slotMonthSelected( int ) ) ); 84 connect( v, SIGNAL( monthSelected( int ) ), SLOT( slotMonthSelected( int ) ) );
86} 85}
87void DateNavigatorContainer::slotgoNextYear() 86void DateNavigatorContainer::slotgoNextYear()
88{ 87{
89 jumpMonth( 12 ); 88 jumpMonth( 12 );
90 emit goNextYear(); 89 emit goNextYear();
91 90
92} 91}
93void DateNavigatorContainer::slotgoPrevYear() 92void DateNavigatorContainer::slotgoPrevYear()
94{ 93{
95 jumpMonth( -12 ); 94 jumpMonth( -12 );
96 emit goPrevYear(); 95 emit goPrevYear();
97 96
98} 97}
99void DateNavigatorContainer::slotgoPrevMonth() 98void DateNavigatorContainer::slotgoPrevMonth()
100{ 99{
101 jumpMonth( -1 ); 100 jumpMonth( -1 );
102 emit goPrevMonth(); 101 emit goPrevMonth();
103 102
104} 103}
105void DateNavigatorContainer::slotgoNextMonth() 104void DateNavigatorContainer::slotgoNextMonth()
106{ 105{
107 jumpMonth( 1 ); 106 jumpMonth( 1 );
108 emit goNextMonth(); 107 emit goNextMonth();
109} 108}
110void DateNavigatorContainer::jumpMonth( int month ) 109void DateNavigatorContainer::jumpMonth( int month )
111{ 110{
112 111
113 QDate baseDate = mNavigatorView->baseDate(); 112 QDate baseDate = mNavigatorView->baseDate();
114 computeMonthSelected( baseDate.month() + month, false ); 113 computeMonthSelected( baseDate.month() + month, false );
115} 114}
116void DateNavigatorContainer::slotMonthSelected( int month ) 115void DateNavigatorContainer::slotMonthSelected( int month )
117{ 116{
118 computeMonthSelected( month, true ); 117 computeMonthSelected( month, true );
119} 118}
120void DateNavigatorContainer::computeMonthSelected( int month , bool forceEmit ) 119void DateNavigatorContainer::computeMonthSelected( int month , bool forceEmit )
121{ 120{
122 //qDebug("slotMonthSelected %d ", month); 121 //qDebug("slotMonthSelected %d ", month);
123 QDate baseDate = mNavigatorView->baseDate(); 122 QDate baseDate = mNavigatorView->baseDate();
124 if ( baseDate.month() == month ) 123 if ( baseDate.month() == month )
125 return; 124 return;
126 //qDebug("month %d %d ",baseDate.month(),month); 125 //qDebug("month %d %d ",baseDate.month(),month);
127 QDate date = QDate ( baseDate.year(), baseDate.month() , 15 ); 126 QDate date = QDate ( baseDate.year(), baseDate.month() , 15 );
128 date = date.addDays( -(baseDate.month()-month ) *30 ); 127 date = date.addDays( -(baseDate.month()-month ) *30 );
129 QDate newBase = QDate ( date.year(), date.month() ,1 ); 128 QDate newBase = QDate ( date.year(), date.month() ,1 );
130 129
131 //qDebug("NEW BASE %s", newBase.toString().latin1()); 130 //qDebug("NEW BASE %s", newBase.toString().latin1());
132 mNavigatorView->setBaseDate( newBase ); 131 mNavigatorView->setBaseDate( newBase );
133 QDate last = lastAvailableDate(); 132 QDate last = lastAvailableDate();
134 QDate first = firstAvailableDate(); 133 QDate first = firstAvailableDate();
135 QDate selFirst = mFirstSelectedDate; 134 QDate selFirst = mFirstSelectedDate;
136 QDate selLast = selFirst.addDays( mSelectedDateCount-1 ); 135 QDate selLast = selFirst.addDays( mSelectedDateCount-1 );
137 if ( selFirst >= first && selLast <= last ) { 136 if ( selFirst >= first && selLast <= last ) {
138 setBaseDates(); 137 setBaseDates();
139 if ( forceEmit ) 138 if ( forceEmit )
140 updateDayMatrixDates(); 139 updateDayMatrixDates();
141 } 140 }
142 else { 141 else {
143 setBaseDates(); 142 setBaseDates();
144 if ( forceEmit ) 143 if ( forceEmit )
145 updateDayMatrixDates(); 144 updateDayMatrixDates();
146 if ( forceEmit ) 145 if ( forceEmit )
147 emit monthSelected( month ); 146 emit monthSelected( month );
148 } 147 }
149} 148}
150void DateNavigatorContainer::setCalendar( Calendar *cal ) 149void DateNavigatorContainer::setCalendar( Calendar *cal )
151{ 150{
152 mCalendar = cal; 151 mCalendar = cal;
153 mNavigatorView->setCalendar( cal ); 152 mNavigatorView->setCalendar( cal );
154 for( uint i = 0; i < mLastDisplayedDN; ++i ) { 153 for( int i = 0; i < mLastDisplayedDN; ++i ) {
155 KDateNavigator *n = mExtraViews.at( i ); 154 KDateNavigator *n = mExtraViews.at( i );
156 n->setCalendar( cal ); 155 n->setCalendar( cal );
157 } 156 }
158} 157}
159void DateNavigatorContainer::checkUpdateDayMatrixDates() 158void DateNavigatorContainer::checkUpdateDayMatrixDates()
160{ 159{
161 //qDebug("KODNC: wid %d hei %d ", width(), height()); 160 //qDebug("KODNC: wid %d hei %d ", width(), height());
162 mUpdateTimer->stop(); 161 mUpdateTimer->stop();
163 //return; 162 //return;
164 if ( width() < 3 || height() < 3 ) 163 if ( width() < 3 || height() < 3 )
165 return; 164 return;
166 static int lastWid = 0; 165 static int lastWid = 0;
167 static int lastHei = 0; 166 static int lastHei = 0;
168 if ( lastWid == width() && height() == lastHei ) { 167 if ( lastWid == width() && height() == lastHei ) {
169 qDebug("KODNC: No layout computing needed. "); 168 qDebug("KODNC: No layout computing needed. ");
170 } else { 169 } else {
171 lastWid = width(); 170 lastWid = width();
172 lastHei = height(); 171 lastHei = height();
173 172
174 QSize minSize = mNavigatorView->yourSizeHint(); 173 QSize minSize = mNavigatorView->yourSizeHint();
175 174
176 int verticalCount = size().height() / minSize.height(); 175 int verticalCount = size().height() / minSize.height();
177 int horizontalCount = size().width() / minSize.width(); 176 int horizontalCount = size().width() / minSize.width();
178 //qDebug(" wattdatt %d new %d %d ", size().width() ,e->size().width() , minSize.width() ); 177 //qDebug(" wattdatt %d new %d %d ", size().width() ,e->size().width() , minSize.width() );
179 //qDebug("COUNT %d %d %d %d ", verticalCount, horizontalCount , mVerticalCount, mHorizontalCount ); 178 //qDebug("COUNT %d %d %d %d ", verticalCount, horizontalCount , mVerticalCount, mHorizontalCount );
180 bool fontchange = false; 179 bool fontchange = false;
181 if ( horizontalCount == 1) 180 if ( horizontalCount == 1)
182 horizontalCount = size().width() / mNavigatorView->yourFullSizeHint().width(); 181 horizontalCount = size().width() / mNavigatorView->yourFullSizeHint().width();
183 QFont fo; 182 QFont fo;
184 if ( horizontalCount != mHorizontalCount || 183 if ( horizontalCount != mHorizontalCount ||
185 verticalCount != mVerticalCount ) { 184 verticalCount != mVerticalCount ) {
186 uint count = horizontalCount * verticalCount; 185 uint count = horizontalCount * verticalCount;
187 if ( count == 0 ) { 186 if ( count == 0 ) {
188 bool ok; 187 bool ok;
189 fo = mNavigatorView->yourFontHint( size() , &ok ); 188 fo = mNavigatorView->yourFontHint( size() , &ok );
190 //mNavigatorView->resize( size() ); 189 //mNavigatorView->resize( size() );
191 //if ( ! ok ) 190 //if ( ! ok )
192 // return; 191 // return;
193 int butt = 2;
194 horizontalCount = size().width() / mNavigatorView->sizeHintTwoButtons( ).width(); 192 horizontalCount = size().width() / mNavigatorView->sizeHintTwoButtons( ).width();
195 if ( horizontalCount <= 1 ) 193 if ( horizontalCount <= 1 )
196 minSize = mNavigatorView->sizeHintTwoButtons( 4 ); 194 minSize = mNavigatorView->sizeHintTwoButtons( 4 );
197 else 195 else
198 minSize = mNavigatorView->sizeHintTwoButtons(); 196 minSize = mNavigatorView->sizeHintTwoButtons();
199 verticalCount = size().height() / minSize.height(); 197 verticalCount = size().height() / minSize.height();
200 horizontalCount = size().width() / minSize.width(); 198 horizontalCount = size().width() / minSize.width();
201 if ( horizontalCount == 0 ) 199 if ( horizontalCount == 0 )
202 horizontalCount = 1; 200 horizontalCount = 1;
203 if ( verticalCount == 0 ) 201 if ( verticalCount == 0 )
204 verticalCount = 1; 202 verticalCount = 1;
205 fontchange = true; 203 fontchange = true;
206 count = horizontalCount * verticalCount; 204 count = horizontalCount * verticalCount;
207 } else { 205 } else {
208 if ( mNavigatorView->fontChanged() ) { 206 if ( mNavigatorView->fontChanged() ) {
209 fontchange = true; 207 fontchange = true;
210 fo = KOPrefs::instance()->mDateNavigatorFont; 208 fo = KOPrefs::instance()->mDateNavigatorFont;
211 mNavigatorView->changeFont( fo ); 209 mNavigatorView->changeFont( fo );
212 mNavigatorView->unsetFontChanged(); 210 mNavigatorView->unsetFontChanged();
213 } 211 }
214 } 212 }
215 mLastDisplayedDN = horizontalCount*verticalCount-1; 213 mLastDisplayedDN = horizontalCount*verticalCount-1;
216 while ( count > ( mExtraViews.count() + 1 ) ) { 214 while ( count > ( mExtraViews.count() + 1 ) ) {
217 KDateNavigator *n = new KDateNavigator( this ); 215 KDateNavigator *n = new KDateNavigator( this );
218 n->setMonthSignalOffset ( mExtraViews.count()+1 ); 216 n->setMonthSignalOffset ( mExtraViews.count()+1 );
219 mExtraViews.append( n ); 217 mExtraViews.append( n );
220 n->setCalendar( mCalendar ); 218 n->setCalendar( mCalendar );
221 connectNavigatorView( n ); 219 connectNavigatorView( n );
222 // n->show(); 220 // n->show();
223 } 221 }
224 222
225 setBaseDates(); 223 setBaseDates();
226 if ( fontchange ) { 224 if ( fontchange ) {
227 //mNavigatorView->changeFont( fo ); 225 //mNavigatorView->changeFont( fo );
228 uint i; 226 uint i;
229 for( i = 0; i < mExtraViews.count(); ++i ) { 227 for( i = 0; i < mExtraViews.count(); ++i ) {
230 KDateNavigator *view = mExtraViews.at( i ); 228 KDateNavigator *view = mExtraViews.at( i );
231 view->changeFont( fo ); 229 view->changeFont( fo );
232 } 230 }
233 } 231 }
234 mHorizontalCount = horizontalCount; 232 mHorizontalCount = horizontalCount;
235 mVerticalCount = verticalCount; 233 mVerticalCount = verticalCount;
236 234
237 } 235 }
238 if ( mNavigatorView->fontChanged() && ! fontchange ) { 236 if ( mNavigatorView->fontChanged() && ! fontchange ) {
239 qDebug("KDNC: Resetting all fonts "); 237 qDebug("KDNC: Resetting all fonts ");
240 fo = KOPrefs::instance()->mDateNavigatorFont; 238 fo = KOPrefs::instance()->mDateNavigatorFont;
241 mNavigatorView->changeFont( fo ); 239 mNavigatorView->changeFont( fo );
242 mNavigatorView->unsetFontChanged(); 240 mNavigatorView->unsetFontChanged();
243 uint i; 241 uint i;
244 for( i = 0; i < mExtraViews.count(); ++i ) { 242 for( i = 0; i < mExtraViews.count(); ++i ) {
245 KDateNavigator *view = mExtraViews.at( i ); 243 KDateNavigator *view = mExtraViews.at( i );
246 view->changeFont( fo ); 244 view->changeFont( fo );
247 } 245 }
248 } 246 }
249 int theight = height() / mVerticalCount; 247 int theight = height() / mVerticalCount;
250 int twidth = width() / mHorizontalCount; 248 int twidth = width() / mHorizontalCount;
251 249
252 NavigatorBar *bar = mNavigatorView->navigatorBar(); 250 NavigatorBar *bar = mNavigatorView->navigatorBar();
253 if ( mHorizontalCount > 1 ) bar->showButtons( true, false ); 251 if ( mHorizontalCount > 1 ) bar->showButtons( true, false );
254 else bar->showButtons( true, true ); 252 else bar->showButtons( true, true );
255 253
256 mNavigatorView->setGeometry(0, 254 mNavigatorView->setGeometry(0,
257 0, twidth, theight ); 255 0, twidth, theight );
258 for( uint i = 0; i < mLastDisplayedDN; ++i ) { 256 for( int i = 0; i < mLastDisplayedDN; ++i ) {
259 int x = ( i + 1 ) % mHorizontalCount; 257 int x = ( i + 1 ) % mHorizontalCount;
260 int y = ( i + 1 ) / mHorizontalCount; 258 int y = ( i + 1 ) / mHorizontalCount;
261 259
262 KDateNavigator *view = mExtraViews.at( i ); 260 KDateNavigator *view = mExtraViews.at( i );
263 bar = view->navigatorBar(); 261 bar = view->navigatorBar();
264 if ( y > 0 ) bar->showButtons( false, false ); 262 if ( y > 0 ) bar->showButtons( false, false );
265 else { 263 else {
266 if ( x + 1 == mHorizontalCount ) bar->showButtons( false, true ); 264 if ( x + 1 == mHorizontalCount ) bar->showButtons( false, true );
267 else bar->showButtons( false, false ); 265 else bar->showButtons( false, false );
268 } 266 }
269 view->setGeometry( x * twidth, 267 view->setGeometry( x * twidth,
270 y * theight, twidth, theight ); 268 y * theight, twidth, theight );
271 } 269 }
272 int iii = 0; 270 uint iii = 0;
273 int ccc = mHorizontalCount * mVerticalCount; 271 uint ccc = mHorizontalCount * mVerticalCount;
274 mNavigatorView->show(); 272 mNavigatorView->show();
275 while ( iii < ( mExtraViews.count() ) ) { 273 while ( iii < ( mExtraViews.count() ) ) {
276 if ( iii < ccc-1 ) 274 if ( iii < ccc-1 )
277 mExtraViews.at( iii )->show(); 275 mExtraViews.at( iii )->show();
278 else 276 else
279 mExtraViews.at( iii )->hide(); 277 mExtraViews.at( iii )->hide();
280 ++iii; 278 ++iii;
281 } 279 }
282 } 280 }
283 281
284 QDate last = lastAvailableDate(); 282 QDate last = lastAvailableDate();
285 QDate first = firstAvailableDate(); 283 QDate first = firstAvailableDate();
286 284
287 QDate selFirst = mFirstSelectedDate; 285 QDate selFirst = mFirstSelectedDate;
288 QDate selLast = selFirst.addDays( mSelectedDateCount-1 ); 286 QDate selLast = selFirst.addDays( mSelectedDateCount-1 );
289 if ( selFirst >= first && selLast <= last ) { 287 if ( selFirst >= first && selLast <= last ) {
290 updateDayMatrixDates(); 288 updateDayMatrixDates();
291 } 289 }
292 else { 290 else {
293 updateDayMatrixDates(); 291 updateDayMatrixDates();
294 emit monthSelected( mFirstSelectedDate.month() ); 292 emit monthSelected( mFirstSelectedDate.month() );
295 } 293 }
296} 294}
297void DateNavigatorContainer::updateDayMatrixDates() 295void DateNavigatorContainer::updateDayMatrixDates()
298{ 296{
299 QDate fDate = mFirstSelectedDate; 297 QDate fDate = mFirstSelectedDate;
300 QDate lDate = fDate.addDays( mSelectedDateCount - 1 ); 298 QDate lDate = fDate.addDays( mSelectedDateCount - 1 );
301 mNavigatorView->dayMatrix()->setSelectedDaysFrom( fDate , lDate ); 299 mNavigatorView->dayMatrix()->setSelectedDaysFrom( fDate , lDate );
302 mNavigatorView->dayMatrix()->repaint( false ); 300 mNavigatorView->dayMatrix()->repaint( false );
303 for( uint i = 0; i < mLastDisplayedDN; ++i ) { 301 for( int i = 0; i < mLastDisplayedDN; ++i ) {
304 KDateNavigator *n = mExtraViews.at( i ); 302 KDateNavigator *n = mExtraViews.at( i );
305 if ( n->dayMatrix()->setSelectedDaysFrom( fDate , lDate ) ) { 303 if ( n->dayMatrix()->setSelectedDaysFrom( fDate , lDate ) ) {
306 n->dayMatrix()->repaint( false ); 304 n->dayMatrix()->repaint( false );
307 } 305 }
308 } 306 }
309} 307}
310 308
311void DateNavigatorContainer::updateDayMatrix() 309void DateNavigatorContainer::updateDayMatrix()
312{ 310{
313 mNavigatorView->updateDayMatrix(); 311 mNavigatorView->updateDayMatrix();
314 for( uint i = 0; i < mLastDisplayedDN; ++i ) { 312 for( int i = 0; i < mLastDisplayedDN; ++i ) {
315 KDateNavigator *n = mExtraViews.at( i ); 313 KDateNavigator *n = mExtraViews.at( i );
316 n->updateDayMatrix(); 314 n->updateDayMatrix();
317 } 315 }
318} 316}
319 317
320void DateNavigatorContainer::updateToday() 318void DateNavigatorContainer::updateToday()
321{ 319{
322 qDebug("DateNavigatorContainer::updateToday() NOT IMPL "); 320 qDebug("DateNavigatorContainer::updateToday() NOT IMPL ");
323#if 0 321#if 0
324 mNavigatorView->updateToday(); 322 mNavigatorView->updateToday();
325 KDateNavigator *n; 323 KDateNavigator *n;
326 for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { 324 for( n = mExtraViews.first(); n; n = mExtraViews.next() ) {
327 n->updateToday(); 325 n->updateToday();
328 } 326 }
329#endif 327#endif
330} 328}
331 329
332void DateNavigatorContainer::updateView() 330void DateNavigatorContainer::updateView()
333{ 331{
334 mNavigatorView->updateView(); 332 mNavigatorView->updateView();
335 for( uint i = 0; i < mLastDisplayedDN; ++i ) { 333 for( int i = 0; i < mLastDisplayedDN; ++i ) {
336 KDateNavigator *n = mExtraViews.at( i ); 334 KDateNavigator *n = mExtraViews.at( i );
337 n->updateView(); 335 n->updateView();
338 } 336 }
339} 337}
340 338
341void DateNavigatorContainer::updateConfig() 339void DateNavigatorContainer::updateConfig()
342{ 340{
343 mNavigatorView->updateConfig(); 341 mNavigatorView->updateConfig();
344 for( uint i = 0; i < mLastDisplayedDN; ++i ) { 342 for( int i = 0; i < mLastDisplayedDN; ++i ) {
345 KDateNavigator *n = mExtraViews.at( i ); 343 KDateNavigator *n = mExtraViews.at( i );
346 n->updateConfig(); 344 n->updateConfig();
347 } 345 }
348} 346}
349QDate DateNavigatorContainer::lastAvailableDate() const 347QDate DateNavigatorContainer::lastAvailableDate() const
350{ 348{
351 QDate date = mNavigatorView->baseDate(); 349 QDate date = mNavigatorView->baseDate();
352 QDate last = QDate ( date.year(), date.month(), date.daysInMonth() ); 350 QDate last = QDate ( date.year(), date.month(), date.daysInMonth() );
353 int iii = mLastDisplayedDN; 351 int iii = mLastDisplayedDN;
354 if ( mLastDisplayedDN ) 352 if ( mLastDisplayedDN )
355 last = last.addDays( 1); 353 last = last.addDays( 1);
356 while ( iii ) { 354 while ( iii ) {
357 last = last.addDays( last.daysInMonth ()); 355 last = last.addDays( last.daysInMonth ());
358 //qDebug("DATE %s ", last.toString().latin1() ); 356 //qDebug("DATE %s ", last.toString().latin1() );
359 --iii; 357 --iii;
360 } 358 }
361 if ( mLastDisplayedDN ) 359 if ( mLastDisplayedDN )
362 last = last.addDays( -1); 360 last = last.addDays( -1);
363 return last; 361 return last;
364} 362}
365QDate DateNavigatorContainer::firstAvailableDate() const 363QDate DateNavigatorContainer::firstAvailableDate() const
366{ 364{
367 return QDate ( mNavigatorView->baseDate().year(), mNavigatorView->baseDate().month(), 1 ); 365 return QDate ( mNavigatorView->baseDate().year(), mNavigatorView->baseDate().month(), 1 );
368} 366}
369void DateNavigatorContainer::selectDates( const DateList &dateList ) 367void DateNavigatorContainer::selectDates( const DateList &dateList )
370{ 368{
371 mFirstSelectedDate = dateList.first() ; 369 mFirstSelectedDate = dateList.first() ;
372 mSelectedDateCount = dateList.count() ; 370 mSelectedDateCount = dateList.count() ;
373 if ( !mLastDisplayedDN ) { 371 if ( !mLastDisplayedDN ) {
374 mNavigatorView->selectDates( dateList ); 372 mNavigatorView->selectDates( dateList );
375 return; 373 return;
376 } 374 }
377 QDate fDate = dateList.first(); 375 QDate fDate = dateList.first();
378 QDate lDate = dateList.last(); 376 QDate lDate = dateList.last();
379 //qDebug("%s %s ", lastAvailableDate().toString().latin1(), firstAvailableDate().toString().latin1() ); 377 //qDebug("%s %s ", lastAvailableDate().toString().latin1(), firstAvailableDate().toString().latin1() );
380 //qDebug("End %s %s ",lDate.toString().latin1(),curEnd.toString().latin1() ); 378 //qDebug("End %s %s ",lDate.toString().latin1(),curEnd.toString().latin1() );
381 if ( lDate <= lastAvailableDate() && firstAvailableDate() <= fDate) { 379 if ( lDate <= lastAvailableDate() && firstAvailableDate() <= fDate) {
382 updateDayMatrixDates(); 380 updateDayMatrixDates();
383 return; 381 return;
384 } 382 }
385 mNavigatorView->selectDates( dateList ); 383 mNavigatorView->selectDates( dateList );
386 setBaseDates(); 384 setBaseDates();
387 if ( mLastDisplayedDN ) { 385 if ( mLastDisplayedDN ) {
388 KDateNavigator *view = mExtraViews.at( 0 ); 386 KDateNavigator *view = mExtraViews.at( 0 );
389 view->dayMatrix()->setSelectedDaysFrom(*(dateList.begin()), *(--dateList.end())); 387 view->dayMatrix()->setSelectedDaysFrom(*(dateList.begin()), *(--dateList.end()));
390 view->dayMatrix()->repaint( false ); 388 view->dayMatrix()->repaint( false );
391 if ( mLastDisplayedDN > 1 ) { 389 if ( mLastDisplayedDN > 1 ) {
392 KDateNavigator *view = mExtraViews.at( 1 ); 390 KDateNavigator *view = mExtraViews.at( 1 );
393 view->dayMatrix()->setSelectedDaysFrom(*(dateList.begin()), *(--dateList.end())); 391 view->dayMatrix()->setSelectedDaysFrom(*(dateList.begin()), *(--dateList.end()));
394 view->dayMatrix()->repaint( false ); 392 view->dayMatrix()->repaint( false );
395 } 393 }
396 } 394 }
397} 395}
398 396
399void DateNavigatorContainer::setBaseDates() 397void DateNavigatorContainer::setBaseDates()
400{ 398{
401 QDate baseDate = mNavigatorView->baseDate(); 399 QDate baseDate = mNavigatorView->baseDate();
402 bool doRepaint = true; 400 bool doRepaint = true;
403 for( uint i = 0; i < mLastDisplayedDN; ++i ) { 401 for( int i = 0; i < mLastDisplayedDN; ++i ) {
404 KDateNavigator *n = mExtraViews.at( i ); 402 KDateNavigator *n = mExtraViews.at( i );
405 baseDate = baseDate.addDays( baseDate.daysInMonth () - baseDate.day() +1 ); 403 baseDate = baseDate.addDays( baseDate.daysInMonth () - baseDate.day() +1 );
406 n->setBaseDate( baseDate, doRepaint ); 404 n->setBaseDate( baseDate, doRepaint );
407 } 405 }
408} 406}
409void DateNavigatorContainer::setResizeEnabled() 407void DateNavigatorContainer::setResizeEnabled()
410{ 408{
411 mResizeEnabled = true; 409 mResizeEnabled = true;
412 //qDebug("DateNavigatorContainer::setResizeEnabled "); 410 //qDebug("DateNavigatorContainer::setResizeEnabled ");
413 checkUpdateDayMatrixDates(); 411 checkUpdateDayMatrixDates();
414} 412}
415void DateNavigatorContainer::resizeEvent( QResizeEvent * e ) 413void DateNavigatorContainer::resizeEvent( QResizeEvent * )
416{ 414{
417 415
418 //qDebug("DateNavigatorContainer::resizeEvent %d %d ", width(), height()); 416 //qDebug("DateNavigatorContainer::resizeEvent %d %d ", width(), height());
419 //qDebug("COUNT %d ", mExtraViews.count()); 417 //qDebug("COUNT %d ", mExtraViews.count());
420 if ( ! mResizeEnabled ) { 418 if ( ! mResizeEnabled ) {
421 //qDebug("NOT ResizeEnabled"); 419 //qDebug("NOT ResizeEnabled");
422 return; 420 return;
423 } 421 }
424 else 422 else
425#ifdef DESKTOP_VERSION 423#ifdef DESKTOP_VERSION
426 mUpdateTimer->start( 100 ); 424 mUpdateTimer->start( 100 );
427#else 425#else
428 mUpdateTimer->start( 50 ); 426 mUpdateTimer->start( 50 );
429#endif 427#endif
430 428
431 //updateDayMatrixDates(); 429 //updateDayMatrixDates();
432} 430}
433 431
434QSize DateNavigatorContainer::minimumSizeHint() const 432QSize DateNavigatorContainer::minimumSizeHint() const
435{ 433{
436 return mNavigatorView->minimumSizeHint(); 434 return mNavigatorView->minimumSizeHint();
437} 435}
438 436
439QSize DateNavigatorContainer::sizeHint() const 437QSize DateNavigatorContainer::sizeHint() const
440{ 438{
441 return mNavigatorView->yourSizeHint(); 439 return mNavigatorView->yourSizeHint();
442} 440}
diff --git a/korganizer/koeditordetails.cpp b/korganizer/koeditordetails.cpp
index b90b9eb..9a4b4ec 100644
--- a/korganizer/koeditordetails.cpp
+++ b/korganizer/koeditordetails.cpp
@@ -1,480 +1,480 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in thse hope that it will be useful, 10 This program is distributed in thse hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qtooltip.h> 24#include <qtooltip.h>
25#include <qfiledialog.h> 25#include <qfiledialog.h>
26#include <qlayout.h> 26#include <qlayout.h>
27#include <qvbox.h> 27#include <qvbox.h>
28#include <qbuttongroup.h> 28#include <qbuttongroup.h>
29#include <qvgroupbox.h> 29#include <qvgroupbox.h>
30#include <qwidgetstack.h> 30#include <qwidgetstack.h>
31#include <qdatetime.h> 31#include <qdatetime.h>
32#include <qapp.h> 32#include <qapp.h>
33 33
34#include <klocale.h> 34#include <klocale.h>
35#include <kglobal.h> 35#include <kglobal.h>
36#include <kdialog.h> 36#include <kdialog.h>
37#include <kiconloader.h> 37#include <kiconloader.h>
38#include <kstandarddirs.h> 38#include <kstandarddirs.h>
39#include <kmessagebox.h> 39#include <kmessagebox.h>
40#ifndef KORG_NOKABC 40#ifndef KORG_NOKABC
41 41
42#ifdef DESKTOP_VERSION 42#ifdef DESKTOP_VERSION
43#include <kabc/addresseedialog.h> 43#include <kabc/addresseedialog.h>
44#else //DESKTOP_VERSION 44#else //DESKTOP_VERSION
45#include <externalapphandler.h> 45#include <externalapphandler.h>
46#endif //DESKTOP_VERSION 46#endif //DESKTOP_VERSION
47 47
48#endif 48#endif
49 49
50#include <libkcal/incidence.h> 50#include <libkcal/incidence.h>
51 51
52#include "koprefs.h" 52#include "koprefs.h"
53 53
54#include "koeditordetails.h" 54#include "koeditordetails.h"
55 55
56template <> 56template <>
57CustomListViewItem<class Attendee *>::~CustomListViewItem() 57CustomListViewItem<Attendee *>::~CustomListViewItem()
58{ 58{
59 delete mData; 59 delete mData;
60} 60}
61 61
62template <> 62template <>
63void CustomListViewItem<class Attendee *>::updateItem() 63void CustomListViewItem<Attendee *>::updateItem()
64{ 64{
65 setText(0,mData->name()); 65 setText(0,mData->name());
66 setText(1,mData->email()); 66 setText(1,mData->email());
67 setText(2,mData->roleStr()); 67 setText(2,mData->roleStr());
68 setText(3,mData->statusStr()); 68 setText(3,mData->statusStr());
69 if (mData->RSVP() && !mData->email().isEmpty()) { 69 if (mData->RSVP() && !mData->email().isEmpty()) {
70 setPixmap(4,SmallIcon("mailappt")); 70 setPixmap(4,SmallIcon("mailappt"));
71 setSortKey(4,"j"); 71 setSortKey(4,"j");
72 } 72 }
73 else { 73 else {
74 setPixmap(4,SmallIcon("nomailappt")); 74 setPixmap(4,SmallIcon("nomailappt"));
75 setSortKey(4,"n"); 75 setSortKey(4,"n");
76 } 76 }
77} 77}
78 78
79 79
80KOEditorDetails::KOEditorDetails (int spacing,QWidget* parent,const char* name) 80KOEditorDetails::KOEditorDetails (int spacing,QWidget* parent,const char* name)
81 : QWidget( parent, name), mDisableItemUpdate( false ) 81 : QWidget( parent, name), mDisableItemUpdate( false )
82{ 82{
83 QGridLayout *topLayout = new QGridLayout(this); 83 QGridLayout *topLayout = new QGridLayout(this);
84 topLayout->setSpacing(spacing); 84 topLayout->setSpacing(spacing);
85 topLayout->setMargin(KDialog::marginHint()-2); 85 topLayout->setMargin(KDialog::marginHint()-2);
86 86
87 QString organizer = KOPrefs::instance()->email(); 87 QString organizer = KOPrefs::instance()->email();
88 mOrganizerLabel = new QLabel(i18n("Organizer: %1").arg(organizer),this); 88 mOrganizerLabel = new QLabel(i18n("Organizer: %1").arg(organizer),this);
89 89
90 mListView = new KListView(this,"mListView"); 90 mListView = new KListView(this,"mListView");
91 mListView->addColumn(i18n("Name"),180); 91 mListView->addColumn(i18n("Name"),180);
92 mListView->addColumn(i18n("Email"),180); 92 mListView->addColumn(i18n("Email"),180);
93 mListView->addColumn(i18n("Role"),60); 93 mListView->addColumn(i18n("Role"),60);
94 mListView->addColumn(i18n("Status"),100); 94 mListView->addColumn(i18n("Status"),100);
95 mListView->addColumn(i18n("RSVP"),35); 95 mListView->addColumn(i18n("RSVP"),35);
96 if ( QApplication::desktop()->width() <= 320 || QApplication::desktop()->height() <= 240) { 96 if ( QApplication::desktop()->width() <= 320 || QApplication::desktop()->height() <= 240) {
97 int hei = 80; 97 int hei = 80;
98 if ( QApplication::desktop()->height() <= 240 ) 98 if ( QApplication::desktop()->height() <= 240 )
99 hei = 60; 99 hei = 60;
100 mListView->setFixedHeight(hei); 100 mListView->setFixedHeight(hei);
101 } 101 }
102 mListView->setAllColumnsShowFocus (true ); 102 mListView->setAllColumnsShowFocus (true );
103 //mListView->setSingleClick( true ); 103 //mListView->setSingleClick( true );
104 connect(mListView,SIGNAL(selectionChanged(QListViewItem *)), 104 connect(mListView,SIGNAL(selectionChanged(QListViewItem *)),
105 SLOT(updateAttendeeInput())); 105 SLOT(updateAttendeeInput()));
106 106
107 connect(mListView,SIGNAL(executed(QListViewItem * ,const QPoint&, int )), 107 connect(mListView,SIGNAL(executed(QListViewItem * ,const QPoint&, int )),
108 SLOT(itemClicked(QListViewItem * ,const QPoint& , int ))); 108 SLOT(itemClicked(QListViewItem * ,const QPoint& , int )));
109 109
110 mRsvpButton = new QCheckBox(this); 110 mRsvpButton = new QCheckBox(this);
111 mRsvpButton->setText(i18n("Request response")); 111 mRsvpButton->setText(i18n("Request response"));
112 mAddressBookButton = new QPushButton(i18n("Address &Book..."),this); 112 mAddressBookButton = new QPushButton(i18n("Address &Book..."),this);
113 QLabel *attendeeLabel = new QLabel(this); 113 QLabel *attendeeLabel = new QLabel(this);
114 attendeeLabel->setText(i18n("Name:")); 114 attendeeLabel->setText(i18n("Name:"));
115 attendeeLabel->setFixedSize( attendeeLabel->sizeHint() ); 115 attendeeLabel->setFixedSize( attendeeLabel->sizeHint() );
116 mNameEdit = new QLineEdit(this); 116 mNameEdit = new QLineEdit(this);
117 connect(mNameEdit,SIGNAL(textChanged(const QString &)), 117 connect(mNameEdit,SIGNAL(textChanged(const QString &)),
118 SLOT(updateAttendeeItem())); 118 SLOT(updateAttendeeItem()));
119 119
120 120
121 QLabel *emailLabel = new QLabel(this); 121 QLabel *emailLabel = new QLabel(this);
122 emailLabel->setText(i18n("Email:")); 122 emailLabel->setText(i18n("Email:"));
123 mEmailEdit = new QLineEdit(this); 123 mEmailEdit = new QLineEdit(this);
124 connect(mEmailEdit,SIGNAL(textChanged(const QString &)), 124 connect(mEmailEdit,SIGNAL(textChanged(const QString &)),
125 SLOT(updateAttendeeItem())); 125 SLOT(updateAttendeeItem()));
126 126
127 QLabel *attendeeRoleLabel = new QLabel(this); 127 QLabel *attendeeRoleLabel = new QLabel(this);
128 attendeeRoleLabel->setText(i18n("Role:")); 128 attendeeRoleLabel->setText(i18n("Role:"));
129 mRoleCombo = new QComboBox(false,this); 129 mRoleCombo = new QComboBox(false,this);
130 mRoleCombo->insertStringList(Attendee::roleList()); 130 mRoleCombo->insertStringList(Attendee::roleList());
131 connect(mRoleCombo,SIGNAL(activated(int)),SLOT(updateAttendeeItem())); 131 connect(mRoleCombo,SIGNAL(activated(int)),SLOT(updateAttendeeItem()));
132 132
133 QLabel *statusLabel = new QLabel(this); 133 QLabel *statusLabel = new QLabel(this);
134 statusLabel->setText( i18n("Status:") ); 134 statusLabel->setText( i18n("Status:") );
135 135
136 mStatusCombo = new QComboBox(false,this); 136 mStatusCombo = new QComboBox(false,this);
137 mStatusCombo->insertStringList(Attendee::statusList()); 137 mStatusCombo->insertStringList(Attendee::statusList());
138 connect(mStatusCombo,SIGNAL(activated(int)),SLOT(updateAttendeeItem())); 138 connect(mStatusCombo,SIGNAL(activated(int)),SLOT(updateAttendeeItem()));
139 139
140 140
141 connect(mRsvpButton,SIGNAL(clicked()),SLOT(updateAttendeeItem())); 141 connect(mRsvpButton,SIGNAL(clicked()),SLOT(updateAttendeeItem()));
142 QWidget *buttonBox = new QWidget(this); 142 QWidget *buttonBox = new QWidget(this);
143 QVBoxLayout *buttonLayout = new QVBoxLayout(buttonBox); 143 QVBoxLayout *buttonLayout = new QVBoxLayout(buttonBox);
144 144
145 QPushButton *newButton = new QPushButton(i18n("&New"),buttonBox); 145 QPushButton *newButton = new QPushButton(i18n("&New"),buttonBox);
146 buttonLayout->addWidget(newButton); 146 buttonLayout->addWidget(newButton);
147 connect(newButton,SIGNAL(clicked()),SLOT(addNewAttendee())); 147 connect(newButton,SIGNAL(clicked()),SLOT(addNewAttendee()));
148 148
149 mRemoveButton = new QPushButton(i18n("&Remove"),buttonBox); 149 mRemoveButton = new QPushButton(i18n("&Remove"),buttonBox);
150 buttonLayout->addWidget(mRemoveButton); 150 buttonLayout->addWidget(mRemoveButton);
151 connect(mRemoveButton, SIGNAL(clicked()),SLOT(removeAttendee())); 151 connect(mRemoveButton, SIGNAL(clicked()),SLOT(removeAttendee()));
152 152
153 // buttonLayout->addWidget(mAddressBookButton); 153 // buttonLayout->addWidget(mAddressBookButton);
154 connect(mAddressBookButton,SIGNAL(clicked()),SLOT(openAddressBook())); 154 connect(mAddressBookButton,SIGNAL(clicked()),SLOT(openAddressBook()));
155 //mRoleCombo->setFixedSize( mRoleCombo->sizeHint () ); 155 //mRoleCombo->setFixedSize( mRoleCombo->sizeHint () );
156 if ( QApplication::desktop()->height() <= 240 ) { 156 if ( QApplication::desktop()->height() <= 240 ) {
157 mRoleCombo->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Minimum ,FALSE) ); 157 mRoleCombo->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Minimum ,FALSE) );
158 mStatusCombo->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Minimum ,FALSE) ); 158 mStatusCombo->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Minimum ,FALSE) );
159 topLayout->addMultiCellWidget(mOrganizerLabel,0,0,0,5); 159 topLayout->addMultiCellWidget(mOrganizerLabel,0,0,0,5);
160 topLayout->addMultiCellWidget(mListView,1,1,0,5); 160 topLayout->addMultiCellWidget(mListView,1,1,0,5);
161 topLayout->addWidget(attendeeLabel,3,0); 161 topLayout->addWidget(attendeeLabel,3,0);
162 topLayout->addMultiCellWidget(mNameEdit,3,3,1,4); 162 topLayout->addMultiCellWidget(mNameEdit,3,3,1,4);
163 topLayout->addWidget(emailLabel,4,0); 163 topLayout->addWidget(emailLabel,4,0);
164 topLayout->addMultiCellWidget(mEmailEdit,4,4,1,4); 164 topLayout->addMultiCellWidget(mEmailEdit,4,4,1,4);
165 topLayout->addWidget(attendeeRoleLabel,5,0); 165 topLayout->addWidget(attendeeRoleLabel,5,0);
166 topLayout->addMultiCellWidget(mRoleCombo,5,5,1,2); 166 topLayout->addMultiCellWidget(mRoleCombo,5,5,1,2);
167 topLayout->addWidget(statusLabel,5,3); 167 topLayout->addWidget(statusLabel,5,3);
168 topLayout->addMultiCellWidget(mStatusCombo,5,5,4,5); 168 topLayout->addMultiCellWidget(mStatusCombo,5,5,4,5);
169 topLayout->addMultiCellWidget(mAddressBookButton,2,2,2,5); 169 topLayout->addMultiCellWidget(mAddressBookButton,2,2,2,5);
170 topLayout->addMultiCellWidget(mRsvpButton,2,2,0,1); 170 topLayout->addMultiCellWidget(mRsvpButton,2,2,0,1);
171 topLayout->addMultiCellWidget(buttonBox,3,4,5,5); 171 topLayout->addMultiCellWidget(buttonBox,3,4,5,5);
172 topLayout->setRowStretch(1,5); 172 topLayout->setRowStretch(1,5);
173 topLayout->setColStretch(0,0); 173 topLayout->setColStretch(0,0);
174 } else { 174 } else {
175 if (qApp->desktop()->width() < 640 ) { 175 if (qApp->desktop()->width() < 640 ) {
176 if ( qApp->desktop()->width() < 300 ) 176 if ( qApp->desktop()->width() < 300 )
177 topLayout->setSpacing(1); 177 topLayout->setSpacing(1);
178 ;//mListView->setFixedHeight(80); 178 ;//mListView->setFixedHeight(80);
179 topLayout->addMultiCellWidget(mOrganizerLabel,0,0,0,3); 179 topLayout->addMultiCellWidget(mOrganizerLabel,0,0,0,3);
180 topLayout->addMultiCellWidget(mListView,1,1,0,3); 180 topLayout->addMultiCellWidget(mListView,1,1,0,3);
181 topLayout->addWidget(attendeeLabel,3,0); 181 topLayout->addWidget(attendeeLabel,3,0);
182 topLayout->addMultiCellWidget(mNameEdit,3,3,1,2); 182 topLayout->addMultiCellWidget(mNameEdit,3,3,1,2);
183 topLayout->addWidget(emailLabel,4,0); 183 topLayout->addWidget(emailLabel,4,0);
184 topLayout->addMultiCellWidget(mEmailEdit,4,4,1,2); 184 topLayout->addMultiCellWidget(mEmailEdit,4,4,1,2);
185 topLayout->addWidget(attendeeRoleLabel,5,0); 185 topLayout->addWidget(attendeeRoleLabel,5,0);
186 topLayout->addMultiCellWidget(mRoleCombo,5,5,1,3); 186 topLayout->addMultiCellWidget(mRoleCombo,5,5,1,3);
187 topLayout->addWidget(statusLabel,6,0); 187 topLayout->addWidget(statusLabel,6,0);
188 topLayout->addMultiCellWidget(mStatusCombo,6,6,1,3); 188 topLayout->addMultiCellWidget(mStatusCombo,6,6,1,3);
189 topLayout->addMultiCellWidget(mAddressBookButton,2,2,2,3); 189 topLayout->addMultiCellWidget(mAddressBookButton,2,2,2,3);
190 topLayout->addMultiCellWidget(mRsvpButton,2,2,0,1); 190 topLayout->addMultiCellWidget(mRsvpButton,2,2,0,1);
191 topLayout->addMultiCellWidget(buttonBox,3,4,3,3); 191 topLayout->addMultiCellWidget(buttonBox,3,4,3,3);
192 topLayout->setRowStretch(1,2); 192 topLayout->setRowStretch(1,2);
193 topLayout->setColStretch(0,0); 193 topLayout->setColStretch(0,0);
194 topLayout->setColStretch(1,2); 194 topLayout->setColStretch(1,2);
195 topLayout->setColStretch(2,1); 195 topLayout->setColStretch(2,1);
196 topLayout->setColStretch(3,1); 196 topLayout->setColStretch(3,1);
197 } else { 197 } else {
198 topLayout->addMultiCellWidget(mOrganizerLabel,0,0,0,5); 198 topLayout->addMultiCellWidget(mOrganizerLabel,0,0,0,5);
199 topLayout->addMultiCellWidget(mListView,1,1,0,5); 199 topLayout->addMultiCellWidget(mListView,1,1,0,5);
200 topLayout->addWidget(attendeeLabel,3,0); 200 topLayout->addWidget(attendeeLabel,3,0);
201 topLayout->addMultiCellWidget(mNameEdit,3,3,1,4); 201 topLayout->addMultiCellWidget(mNameEdit,3,3,1,4);
202 topLayout->addWidget(emailLabel,4,0); 202 topLayout->addWidget(emailLabel,4,0);
203 topLayout->addMultiCellWidget(mEmailEdit,4,4,1,4); 203 topLayout->addMultiCellWidget(mEmailEdit,4,4,1,4);
204 topLayout->addWidget(attendeeRoleLabel,5,0); 204 topLayout->addWidget(attendeeRoleLabel,5,0);
205 topLayout->addMultiCellWidget(mRoleCombo,5,5,1,2); 205 topLayout->addMultiCellWidget(mRoleCombo,5,5,1,2);
206 topLayout->addWidget(statusLabel,5,3); 206 topLayout->addWidget(statusLabel,5,3);
207 topLayout->addMultiCellWidget(mStatusCombo,5,5,4,5); 207 topLayout->addMultiCellWidget(mStatusCombo,5,5,4,5);
208 topLayout->addMultiCellWidget(mAddressBookButton,2,2,4,5); 208 topLayout->addMultiCellWidget(mAddressBookButton,2,2,4,5);
209 topLayout->addMultiCellWidget(mRsvpButton,2,2,0,1); 209 topLayout->addMultiCellWidget(mRsvpButton,2,2,0,1);
210 topLayout->addMultiCellWidget(buttonBox,3,4,5,5); 210 topLayout->addMultiCellWidget(buttonBox,3,4,5,5);
211 topLayout->setRowStretch(1,5); 211 topLayout->setRowStretch(1,5);
212 topLayout->setColStretch(0,0); 212 topLayout->setColStretch(0,0);
213 } 213 }
214 } 214 }
215// #if 0 215// #if 0
216// topLayout->setColStretch(2,1); 216// topLayout->setColStretch(2,1);
217// topLayout->addWidget(statusLabel,3,3); 217// topLayout->addWidget(statusLabel,3,3);
218// topLayout->addWidget(mStatusCombo,3,4); 218// topLayout->addWidget(mStatusCombo,3,4);
219// #else 219// #else
220// topLayout->addWidget(statusLabel,4,3); 220// topLayout->addWidget(statusLabel,4,3);
221// // topLayout->addWidget(mStatusCombo,4,3); 221// // topLayout->addWidget(mStatusCombo,4,3);
222// topLayout->addMultiCellWidget(mStatusCombo,4,4,4,5); 222// topLayout->addMultiCellWidget(mStatusCombo,4,4,4,5);
223 223
224// #endif 224// #endif
225// // topLayout->setRowStretch(5,1); 225// // topLayout->setRowStretch(5,1);
226// topLayout->addMultiCellWidget(mRsvpButton,5,5,0,1); 226// topLayout->addMultiCellWidget(mRsvpButton,5,5,0,1);
227// topLayout->addMultiCellWidget(buttonBox,2,3,5,5); 227// topLayout->addMultiCellWidget(buttonBox,2,3,5,5);
228// topLayout->setRowStretch(1,5); 228// topLayout->setRowStretch(1,5);
229// topLayout->setColStretch(0,0); 229// topLayout->setColStretch(0,0);
230 230
231#ifdef KORG_NOKABC 231#ifdef KORG_NOKABC
232 mAddressBookButton->hide(); 232 mAddressBookButton->hide();
233#endif 233#endif
234 234
235 updateAttendeeInput(); 235 updateAttendeeInput();
236#ifndef DESKTOP_VERSION 236#ifndef DESKTOP_VERSION
237//US listen for arriving address resultsets 237//US listen for arriving address resultsets
238 connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)), 238 connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)),
239 this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&))); 239 this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&)));
240#endif 240#endif
241 241
242} 242}
243 243
244KOEditorDetails::~KOEditorDetails() 244KOEditorDetails::~KOEditorDetails()
245{ 245{
246} 246}
247 247
248void KOEditorDetails::removeAttendee() 248void KOEditorDetails::removeAttendee()
249{ 249{
250 AttendeeListItem *aItem = (AttendeeListItem *)mListView->selectedItem(); 250 AttendeeListItem *aItem = (AttendeeListItem *)mListView->selectedItem();
251 if (!aItem) return; 251 if (!aItem) return;
252 252
253 Attendee *delA = new Attendee(aItem->data()->name(),aItem->data()->email(), 253 Attendee *delA = new Attendee(aItem->data()->name(),aItem->data()->email(),
254 aItem->data()->RSVP(),aItem->data()->status(),aItem->data()->role(), 254 aItem->data()->RSVP(),aItem->data()->status(),aItem->data()->role(),
255 aItem->data()->uid()); 255 aItem->data()->uid());
256 mdelAttendees.append(delA); 256 mdelAttendees.append(delA);
257 257
258 delete aItem; 258 delete aItem;
259 259
260 updateAttendeeInput(); 260 updateAttendeeInput();
261} 261}
262 262
263 263
264void KOEditorDetails::openAddressBook() 264void KOEditorDetails::openAddressBook()
265{ 265{
266#ifndef KORG_NOKABC 266#ifndef KORG_NOKABC
267 267
268#ifdef DESKTOP_VERSION 268#ifdef DESKTOP_VERSION
269 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); 269 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this);
270 uint i=0; 270 uint i=0;
271 for (i=0; i < list.count(); i++) { 271 for (i=0; i < list.count(); i++) {
272 insertAttendee( new Attendee( list[i].realName(), list[i].preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,list[i].uid()) ); 272 insertAttendee( new Attendee( list[i].realName(), list[i].preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,list[i].uid()) );
273 } 273 }
274#else 274#else
275 bool res = ExternalAppHandler::instance()->requestNameEmailUidListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); 275 bool res = ExternalAppHandler::instance()->requestNameEmailUidListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/);
276 // the result should now arrive through method insertAttendees 276 // the result should now arrive through method insertAttendees
277#endif 277#endif
278 278
279 279
280#if 0 280#if 0
281 KABC::Addressee a = KABC::AddresseeDialog::getAddressee(this); 281 KABC::Addressee a = KABC::AddresseeDialog::getAddressee(this);
282 if (!a.isEmpty()) { 282 if (!a.isEmpty()) {
283 insertAttendee( new Attendee( a.realName(), a.preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,a.uid()) ); 283 insertAttendee( new Attendee( a.realName(), a.preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,a.uid()) );
284 } 284 }
285#endif 285#endif
286#endif 286#endif
287} 287}
288 288
289 289
290void KOEditorDetails::addNewAttendee() 290void KOEditorDetails::addNewAttendee()
291{ 291{
292#if 0 292#if 0
293 // this is cool. If they didn't enter an email address, 293 // this is cool. If they didn't enter an email address,
294 // try to look it up in the address book and fill it in for them. 294 // try to look it up in the address book and fill it in for them.
295 if (QString(mEmailEdit->text()).stripWhiteSpace().isEmpty()) { 295 if (QString(mEmailEdit->text()).stripWhiteSpace().isEmpty()) {
296 KabAPI addrBook; 296 KabAPI addrBook;
297 QString name; 297 QString name;
298 std::list<AddressBook::Entry> entries; 298 std::list<AddressBook::Entry> entries;
299 name = mNameEdit->text(); 299 name = mNameEdit->text();
300 if (addrBook.init() == AddressBook::NoError) { 300 if (addrBook.init() == AddressBook::NoError) {
301 if (addrBook.getEntryByName(name, entries, 1) == AddressBook::NoError) { 301 if (addrBook.getEntryByName(name, entries, 1) == AddressBook::NoError) {
302 kdDebug() << "positive match" << endl; 302 kdDebug() << "positive match" << endl;
303 // take first email address 303 // take first email address
304 if (!entries.front().emails.isEmpty() && 304 if (!entries.front().emails.isEmpty() &&
305 entries.front().emails.first().length()>0) 305 entries.front().emails.first().length()>0)
306 mEmailEdit->setText(entries.front().emails.first()); 306 mEmailEdit->setText(entries.front().emails.first());
307 } 307 }
308 } 308 }
309 } 309 }
310#endif 310#endif
311 311
312 Attendee *a = new Attendee(i18n("(EmptyName)"),i18n("(EmptyEmail)")); 312 Attendee *a = new Attendee(i18n("(EmptyName)"),i18n("(EmptyEmail)"));
313 insertAttendee(a); 313 insertAttendee(a);
314} 314}
315 315
316//the map includes name/email pairs, that comes from Ka/Pi 316//the map includes name/email pairs, that comes from Ka/Pi
317void KOEditorDetails::insertAttendees(const QString& uid,const QStringList& nameList,const QStringList& emailList,const QStringList& uidList) 317void KOEditorDetails::insertAttendees(const QString& uid,const QStringList& nameList,const QStringList& emailList,const QStringList& uidList)
318{ 318{
319 if (uid == this->name()) 319 if (uid == this->name())
320 { 320 {
321 for ( int i = 0; i < nameList.count(); i++) 321 for ( int i = 0; i < nameList.count(); i++)
322 { 322 {
323 QString _name = nameList[i]; 323 QString _name = nameList[i];
324 QString _email = emailList[i]; 324 QString _email = emailList[i];
325 QString _uid = uidList[i]; 325 QString _uid = uidList[i];
326 326
327 Attendee *a = new Attendee(_name,_email,false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant, _uid); 327 Attendee *a = new Attendee(_name,_email,false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant, _uid);
328 insertAttendee(a); 328 insertAttendee(a);
329 } 329 }
330 } 330 }
331 331
332} 332}
333 333
334void KOEditorDetails::insertAttendee(Attendee *a) 334void KOEditorDetails::insertAttendee(Attendee *a)
335{ 335{
336 AttendeeListItem *first = (AttendeeListItem*) mListView->firstChild(); 336 AttendeeListItem *first = (AttendeeListItem*) mListView->firstChild();
337 while (first) { 337 while (first) {
338 if ( first->data()->name() == a->name() && first->data()->email() == a->email() ) 338 if ( first->data()->name() == a->name() && first->data()->email() == a->email() )
339 return; 339 return;
340 first = (AttendeeListItem*) first->nextSibling(); 340 first = (AttendeeListItem*) first->nextSibling();
341 } 341 }
342 342
343 AttendeeListItem *item = new AttendeeListItem(a,mListView); 343 AttendeeListItem *item = new AttendeeListItem(a,mListView);
344 mListView->setSelected( item, true ); 344 mListView->setSelected( item, true );
345} 345}
346 346
347void KOEditorDetails::setDefaults() 347void KOEditorDetails::setDefaults()
348{ 348{
349 mRsvpButton->setChecked(true); 349 mRsvpButton->setChecked(true);
350 mListView->clear(); 350 mListView->clear();
351 mdelAttendees.clear(); 351 mdelAttendees.clear();
352 clearAttendeeInput(); 352 clearAttendeeInput();
353 mOrganizerLabel->setText(i18n("Organizer: %1").arg(KOPrefs::instance()->email())); 353 mOrganizerLabel->setText(i18n("Organizer: %1").arg(KOPrefs::instance()->email()));
354 354
355 mNameEdit->setText(""); 355 mNameEdit->setText("");
356 mUidEdit = ""; 356 mUidEdit = "";
357 mEmailEdit->setText(""); 357 mEmailEdit->setText("");
358 mRoleCombo->setCurrentItem( 0 ); 358 mRoleCombo->setCurrentItem( 0 );
359 mStatusCombo->setCurrentItem( 0 ); 359 mStatusCombo->setCurrentItem( 0 );
360 360
361} 361}
362 362
363void KOEditorDetails::readEvent(Incidence *event) 363void KOEditorDetails::readEvent(Incidence *event)
364{ 364{
365 setDefaults(); 365 setDefaults();
366 //mListView->clear(); 366 //mListView->clear();
367 //mdelAttendees.clear(); 367 //mdelAttendees.clear();
368 QPtrList<Attendee> tmpAList = event->attendees(); 368 QPtrList<Attendee> tmpAList = event->attendees();
369 Attendee *a; 369 Attendee *a;
370 for (a = tmpAList.first(); a; a = tmpAList.next()) 370 for (a = tmpAList.first(); a; a = tmpAList.next())
371 insertAttendee(new Attendee(*a)); 371 insertAttendee(new Attendee(*a));
372 372
373 mListView->setSelected( mListView->firstChild(), true ); 373 mListView->setSelected( mListView->firstChild(), true );
374 mOrganizerLabel->setText(i18n("Organizer: %1").arg(event->organizer())); 374 mOrganizerLabel->setText(i18n("Organizer: %1").arg(event->organizer()));
375} 375}
376 376
377void KOEditorDetails::writeEvent(Incidence *event) 377void KOEditorDetails::writeEvent(Incidence *event)
378{ 378{
379 event->clearAttendees(); 379 event->clearAttendees();
380 QListViewItem *item; 380 QListViewItem *item;
381 AttendeeListItem *a; 381 AttendeeListItem *a;
382 for (item = mListView->firstChild(); item; 382 for (item = mListView->firstChild(); item;
383 item = item->nextSibling()) { 383 item = item->nextSibling()) {
384 a = (AttendeeListItem *)item; 384 a = (AttendeeListItem *)item;
385 event->addAttendee(new Attendee(*(a->data()))); 385 event->addAttendee(new Attendee(*(a->data())));
386 } 386 }
387 event->setOrganizer(KOPrefs::instance()->email()); 387 event->setOrganizer(KOPrefs::instance()->email());
388} 388}
389 389
390void KOEditorDetails::cancelAttendeeEvent(Incidence *event) 390void KOEditorDetails::cancelAttendeeEvent(Incidence *event)
391{ 391{
392 event->clearAttendees(); 392 event->clearAttendees();
393 Attendee * att; 393 Attendee * att;
394 for (att=mdelAttendees.first();att;att=mdelAttendees.next()) { 394 for (att=mdelAttendees.first();att;att=mdelAttendees.next()) {
395 event->addAttendee(new Attendee(*att)); 395 event->addAttendee(new Attendee(*att));
396 } 396 }
397 mdelAttendees.clear(); 397 mdelAttendees.clear();
398} 398}
399 399
400bool KOEditorDetails::validateInput() 400bool KOEditorDetails::validateInput()
401{ 401{
402 return true; 402 return true;
403} 403}
404 404
405void KOEditorDetails::updateAttendeeInput() 405void KOEditorDetails::updateAttendeeInput()
406{ 406{
407 QListViewItem *item = mListView->selectedItem(); 407 QListViewItem *item = mListView->selectedItem();
408 AttendeeListItem *aItem = static_cast<AttendeeListItem *>( item ); 408 AttendeeListItem *aItem = static_cast<AttendeeListItem *>( item );
409 if (aItem) { 409 if (aItem) {
410 fillAttendeeInput( aItem ); 410 fillAttendeeInput( aItem );
411 } else { 411 } else {
412 clearAttendeeInput(); 412 clearAttendeeInput();
413 } 413 }
414} 414}
415 415
416void KOEditorDetails::clearAttendeeInput() 416void KOEditorDetails::clearAttendeeInput()
417{ 417{
418 mNameEdit->setText(""); 418 mNameEdit->setText("");
419 mUidEdit = ""; 419 mUidEdit = "";
420 mEmailEdit->setText(""); 420 mEmailEdit->setText("");
421 mRoleCombo->setCurrentItem(0); 421 mRoleCombo->setCurrentItem(0);
422 mStatusCombo->setCurrentItem(0); 422 mStatusCombo->setCurrentItem(0);
423 mRsvpButton->setChecked(true); 423 mRsvpButton->setChecked(true);
424 setEnabledAttendeeInput( false ); 424 setEnabledAttendeeInput( false );
425} 425}
426 426
427void KOEditorDetails::fillAttendeeInput( AttendeeListItem *aItem ) 427void KOEditorDetails::fillAttendeeInput( AttendeeListItem *aItem )
428{ 428{
429 Attendee *a = aItem->data(); 429 Attendee *a = aItem->data();
430 mDisableItemUpdate = true; 430 mDisableItemUpdate = true;
431 mNameEdit->setText(a->name()); 431 mNameEdit->setText(a->name());
432 mUidEdit = a->uid(); 432 mUidEdit = a->uid();
433 mEmailEdit->setText(a->email()); 433 mEmailEdit->setText(a->email());
434 mRoleCombo->setCurrentItem(a->role()); 434 mRoleCombo->setCurrentItem(a->role());
435 mStatusCombo->setCurrentItem(a->status()); 435 mStatusCombo->setCurrentItem(a->status());
436 mRsvpButton->setChecked(a->RSVP()); 436 mRsvpButton->setChecked(a->RSVP());
437 437
438 mDisableItemUpdate = false; 438 mDisableItemUpdate = false;
439 439
440 setEnabledAttendeeInput( true ); 440 setEnabledAttendeeInput( true );
441} 441}
442 442
443void KOEditorDetails::setEnabledAttendeeInput( bool enabled ) 443void KOEditorDetails::setEnabledAttendeeInput( bool enabled )
444{ 444{
445 mNameEdit->setEnabled( enabled ); 445 mNameEdit->setEnabled( enabled );
446 mEmailEdit->setEnabled( enabled ); 446 mEmailEdit->setEnabled( enabled );
447 mRoleCombo->setEnabled( enabled ); 447 mRoleCombo->setEnabled( enabled );
448 mStatusCombo->setEnabled( enabled ); 448 mStatusCombo->setEnabled( enabled );
449 mRsvpButton->setEnabled( enabled ); 449 mRsvpButton->setEnabled( enabled );
450 450
451 mRemoveButton->setEnabled( enabled ); 451 mRemoveButton->setEnabled( enabled );
452} 452}
453 453
454void KOEditorDetails::itemClicked(QListViewItem * item ,const QPoint & pnt, int c ) 454void KOEditorDetails::itemClicked(QListViewItem * item ,const QPoint & pnt, int c )
455{ 455{
456 if ( item && c == 4 ) { 456 if ( item && c == 4 ) {
457 mRsvpButton->setChecked( !mRsvpButton->isChecked() ); 457 mRsvpButton->setChecked( !mRsvpButton->isChecked() );
458 updateAttendeeItem(); 458 updateAttendeeItem();
459 } 459 }
460} 460}
461void KOEditorDetails::updateAttendeeItem() 461void KOEditorDetails::updateAttendeeItem()
462{ 462{
463 if (mDisableItemUpdate) return; 463 if (mDisableItemUpdate) return;
464 464
465 QListViewItem *item = mListView->selectedItem(); 465 QListViewItem *item = mListView->selectedItem();
466 AttendeeListItem *aItem = static_cast<AttendeeListItem *>( item ); 466 AttendeeListItem *aItem = static_cast<AttendeeListItem *>( item );
467 if ( !aItem ) return; 467 if ( !aItem ) return;
468 468
469 Attendee *a = aItem->data(); 469 Attendee *a = aItem->data();
470 470
471 a->setName( mNameEdit->text() ); 471 a->setName( mNameEdit->text() );
472 a->setUid( mUidEdit ); 472 a->setUid( mUidEdit );
473 a->setEmail( mEmailEdit->text() ); 473 a->setEmail( mEmailEdit->text() );
474 if ( mEmailEdit->text().isEmpty() ) 474 if ( mEmailEdit->text().isEmpty() )
475 mRsvpButton->setChecked( false ); 475 mRsvpButton->setChecked( false );
476 a->setRSVP( mRsvpButton->isChecked() ); 476 a->setRSVP( mRsvpButton->isChecked() );
477 a->setRole( Attendee::Role( mRoleCombo->currentItem() ) ); 477 a->setRole( Attendee::Role( mRoleCombo->currentItem() ) );
478 a->setStatus( Attendee::PartStat( mStatusCombo->currentItem() ) ); 478 a->setStatus( Attendee::PartStat( mStatusCombo->currentItem() ) );
479 aItem->updateItem(); 479 aItem->updateItem();
480} 480}