Incidenceeditor

attendeeline.h
1/*
2 SPDX-FileCopyrightText: 2010 Casey Link <unnamedrambler@gmail.com>
3 SPDX-FileCopyrightText: 2009-2010 Klaralvdalens Datakonsult AB, a KDAB Group company <info@kdab.net>
4
5 SPDX-License-Identifier: LGPL-2.0-or-later
6*/
7
8#pragma once
9
10#include <Libkdepim/MultiplyingLine>
11#include <PimCommonAkonadi/AddresseeLineEdit>
12
13#include <KCalendarCore/Attendee>
14
15#include <QCheckBox>
16#include <QToolButton>
17
18class QKeyEvent;
19
20namespace IncidenceEditorNG
21{
22class AttendeeData;
23
24class AttendeeComboBox : public QToolButton
25{
27public:
28 explicit AttendeeComboBox(QWidget *parent);
29
30 void addItem(const QIcon &icon, const QString &text);
31 void addItems(const QStringList &texts);
32
33 [[nodiscard]] int currentIndex() const;
34
36 void rightPressed();
37 void leftPressed();
38 void itemChanged();
39
40public Q_SLOTS:
41 /** Clears the combobox, removing all items. */
42 void clear();
43 void setCurrentIndex(int index);
44
45protected:
46 void keyPressEvent(QKeyEvent *ev) override;
47
48private:
49 void slotActionTriggered();
50 QMenu *mMenu = nullptr;
52 int mCurrentIndex = -1;
53};
54
55class AttendeeLineEdit : public PimCommon::AddresseeLineEdit
56{
57 Q_OBJECT
58public:
59 explicit AttendeeLineEdit(QWidget *parent);
60
61Q_SIGNALS:
62 void deleteMe();
63 void leftPressed();
64 void rightPressed();
65 void upPressed();
66 void downPressed();
67
68protected:
69 void keyPressEvent(QKeyEvent *ev) override;
70};
71
72class AttendeeLine : public KPIM::MultiplyingLine
73{
75public:
76 enum AttendeeActions {
77 EventActions,
78 TodoActions
79 };
80
81 explicit AttendeeLine(QWidget *parent);
82 ~AttendeeLine() override = default;
83
84 void activate() override;
85 [[nodiscard]] bool isActive() const override;
86
87 [[nodiscard]] bool isEmpty() const override;
88 void clear() override;
89
90 [[nodiscard]] bool isModified() const override;
91 void clearModified() override;
92
93 KPIM::MultiplyingLineData::Ptr data() const override;
94 void setData(const KPIM::MultiplyingLineData::Ptr &data) override;
95
96 void fixTabOrder(QWidget *previous) override;
97 QWidget *tabOut() const override;
98
99 void setCompletionMode(KCompletion::CompletionMode) override;
100
101 int setColumnWidth(int w) override;
102
103 void aboutToBeDeleted() override;
104 bool canDeleteLineEdit() const override;
105
106 void setActions(AttendeeActions actions);
107
109 void changed();
110 void changed(const KCalendarCore::Attendee &oldAttendee, const KCalendarCore::Attendee &newAttendee);
111 void editingFinished(KPIM::MultiplyingLine *);
112
113private:
114 void slotTextChanged(const QString &);
115 void slotHandleChange();
116 void slotComboChanged();
117 void dataFromFields();
118 void fieldsFromData();
119
120 AttendeeComboBox *mRoleCombo = nullptr;
121 AttendeeComboBox *mStateCombo = nullptr;
122 AttendeeComboBox *mResponseCombo = nullptr;
123 AttendeeLineEdit *mEdit = nullptr;
125 QString mUid;
126 bool mModified;
127};
128}
Q_OBJECTQ_OBJECT
Q_SIGNALSQ_SIGNALS
Q_SLOTSQ_SLOTS
QObject * parent() const const
QList< QAction * > actions() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:17:22 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.