2 Copyright (C) 2010 Casey Link <unnamedrambler@gmail.com>
3 Copyright (C) 2009-2010 Klaralvdalens Datakonsult AB, a KDAB Group company <info@kdab.net>
5 This library is free software; you can redistribute it and/or modify it
6 under the terms of the GNU Library General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or (at your
8 option) any later version.
10 This library is distributed in the hope that it will be useful, but WITHOUT
11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 License for more details.
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to the
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 #include "attendeeeditor.h"
27 using namespace IncidenceEditorsNG
;
29 AttendeeEditor::AttendeeEditor( QWidget
* parent
)
30 : MultiplyingLineEditor( new AttendeeLineFactory( parent
), parent
)
32 connect( this, SIGNAL( lineAdded( KPIM::MultiplyingLine
* ) ), SLOT( slotLineAdded( KPIM::MultiplyingLine
* ) ) );
33 connect( this, SIGNAL( lineDeleted( int ) ), SLOT( slotLineDeleted( int ) ) );
38 void AttendeeEditor::slotLineAdded( KPIM::MultiplyingLine
* line
)
40 AttendeeLine
* att
= qobject_cast
<AttendeeLine
*>( line
);
44 connect( att
, SIGNAL( changed() ), SLOT( slotCalculateTotal() ) );
45 connect( att
, SIGNAL( editingFinished( KPIM::MultiplyingLine
* ) ), SIGNAL( editingFinished( KPIM::MultiplyingLine
* ) ) );
48 void AttendeeEditor::slotLineDeleted( int /*pos*/ )
52 void AttendeeEditor::slotCalculateTotal()
57 foreach( KPIM::MultiplyingLine
*line
, lines() ) {
58 AttendeeLine
* att
= qobject_cast
< AttendeeLine
* >( line
);
66 emit( countChanged( count
) );
67 // We always want at least one empty line
72 AttendeeData::List
AttendeeEditor::attendees() const
74 QList
<KPIM::MultiplyingLineData::Ptr
> dataList
= allData();
75 AttendeeData::List attList
;
76 kDebug() << "num attendees:" << dataList
.size();
77 foreach( KPIM::MultiplyingLineData::Ptr datum
, dataList
) {
78 AttendeeData::Ptr att
= qSharedPointerDynamicCast
<AttendeeData
>( datum
);
86 void AttendeeEditor::addAttendee(const KCal::Attendee
& attendee
)
88 addData( AttendeeData::Ptr( new AttendeeData( attendee
) ) );
91 void AttendeeEditor::setActions( AttendeeLine::AttendeeActions actions
)
93 foreach( KPIM::MultiplyingLine
*line
, lines() ) {
94 AttendeeLine
* att
= qobject_cast
< AttendeeLine
* >( line
);
95 att
->setActions( actions
);