Incidenceeditor

incidencesecrecy.cpp
1/*
2 SPDX-FileCopyrightText: 2010 Bertjan Broeksema <broeksema@kde.org>
3 SPDX-FileCopyrightText: 2010 Klaralvdalens Datakonsult AB, a KDAB Group company <info@kdab.net>
4
5 SPDX-License-Identifier: LGPL-2.0-or-later
6*/
7
8#include "incidencesecrecy.h"
9#include "ui_dialogdesktop.h"
10
11#include <KCalUtils/Stringify>
12
13using namespace IncidenceEditorNG;
14
15IncidenceSecrecy::IncidenceSecrecy(Ui::EventOrTodoDesktop *ui)
16 : mUi(ui)
17{
18 setObjectName(QLatin1StringView("IncidenceSecrecy"));
19 mUi->mSecrecyCombo->addItems(KCalUtils::Stringify::incidenceSecrecyList());
20 connect(mUi->mSecrecyCombo, &QComboBox::currentIndexChanged, this, &IncidenceSecrecy::checkDirtyStatus);
21}
22
23void IncidenceSecrecy::load(const KCalendarCore::Incidence::Ptr &incidence)
24{
25 mLoadedIncidence = incidence;
26 if (mLoadedIncidence) {
27 Q_ASSERT(mUi->mSecrecyCombo->count() == KCalUtils::Stringify::incidenceSecrecyList().count());
28 mUi->mSecrecyCombo->setCurrentIndex(mLoadedIncidence->secrecy());
29 } else {
30 mUi->mSecrecyCombo->setCurrentIndex(0);
31 }
32
33 mWasDirty = false;
34}
35
36void IncidenceSecrecy::save(const KCalendarCore::Incidence::Ptr &incidence)
37{
39 switch (mUi->mSecrecyCombo->currentIndex()) {
40 case 1:
42 break;
43 case 2:
45 break;
46 default:
48 }
49}
50
51bool IncidenceSecrecy::isDirty() const
52{
53 if (mLoadedIncidence) {
54 if (mLoadedIncidence->secrecy() != mUi->mSecrecyCombo->currentIndex()) {
55 return true;
56 }
57 } else {
58 if (mUi->mSecrecyCombo->currentIndex() != 0) {
59 return true;
60 }
61 }
62
63 return false;
64}
65
66#include "moc_incidencesecrecy.cpp"
QSharedPointer< IncidenceT > incidence() const
Convenience method to get a pointer for a specific const Incidence Type.
KCALUTILS_EXPORT QStringList incidenceSecrecyList()
void currentIndexChanged(int index)
qsizetype count() const const
T qobject_cast(QObject *object)
QFuture< ArgsType< Signal > > connect(Sender *sender, Signal signal)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:19:37 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.