Fix akonadimodel.cpp:1: warning: unterminated character constant
[kdepim.git] / incidenceeditor-ng / attendeeline.h
blob8311276307f3810dbb022c74767706fa8bf914ab
1 /*
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
18 02110-1301, USA.
21 #ifndef ATTENDEELINE_H
22 #define ATTENDEELINE_H
24 #include "attendeedata.h"
26 #include <libkdepim/multiplyingline.h>
27 #include <libkdepim/addresseelineedit.h>
29 #include <KComboBox>
30 #include <KGlobalSettings>
32 #include <QCheckBox>
33 #include <QKeyEvent>
34 #include <QToolButton>
36 class QMenu;
38 namespace IncidenceEditorsNG {
40 class Attendee;
42 class AttendeeComboBox : public QToolButton
44 Q_OBJECT
45 public:
46 explicit AttendeeComboBox( QWidget *parent );
48 void addItem( const QIcon & icon, const QString & text );
49 void addItems( const QStringList & texts );
51 int currentIndex() const;
53 signals:
54 void rightPressed();
55 void leftPressed();
56 void itemChanged();
58 public slots:
59 /** Clears the combobox, removing all items. */
60 void clear();
61 void setCurrentIndex( int index );
63 protected:
64 void keyPressEvent( QKeyEvent *ev );
65 private slots:
66 void slotActionTriggered();
67 private:
68 QMenu *mMenu;
69 QList<QPair<QString, QIcon> > mList;
70 int mCurrentIndex;
73 class AttendeeCheckBox : public QCheckBox
75 Q_OBJECT
76 public:
77 explicit AttendeeCheckBox( QWidget *parent );
79 signals:
80 void leftPressed();
81 void rightPressed();
83 protected:
84 void keyPressEvent( QKeyEvent *ev );
87 class AttendeeLineEdit : public KPIM::AddresseeLineEdit
89 Q_OBJECT
90 public:
91 explicit AttendeeLineEdit( QWidget * parent );
93 signals:
94 void deleteMe();
95 void leftPressed();
96 void rightPressed();
97 void upPressed();
98 void downPressed();
100 protected:
101 void keyPressEvent( QKeyEvent *ev );
104 class AttendeeLine : public KPIM::MultiplyingLine
106 Q_OBJECT
107 public:
108 enum AttendeeActions {
109 EventActions,
110 TodoActions
113 AttendeeLine( QWidget* parent );
114 virtual ~AttendeeLine(){}
116 virtual void activate();
117 virtual bool isActive() const;
119 virtual bool isEmpty() const;
120 virtual void clear();
122 virtual bool isModified() const;
123 virtual void clearModified();
125 virtual KPIM::MultiplyingLineData::Ptr data() const;
126 virtual void setData( const KPIM::MultiplyingLineData::Ptr &data );
128 virtual void fixTabOrder( QWidget* previous );
129 virtual QWidget* tabOut() const;
131 virtual void moveCompletionPopup();
132 virtual void setCompletionMode( KGlobalSettings::Completion );
134 virtual int setColumnWidth( int w );
136 void setActions( AttendeeActions actions );
138 signals:
139 void changed();
140 void editingFinished( KPIM::MultiplyingLine * );
142 private slots:
143 void slotTextChanged( const QString & );
144 void slotEditingFinished();
145 void slotComboChanged();
146 private:
147 void dataFromFields();
148 void fieldsFromData();
150 AttendeeComboBox *mRoleCombo;
151 AttendeeComboBox *mStateCombo;
152 AttendeeCheckBox *mResponseCheck;
153 AttendeeLineEdit *mEdit;
154 QSharedPointer<AttendeeData> mData;
155 QString mUid;
156 bool mModified;
164 #endif // ATTENDEELINE_H