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"
9using namespace Qt::Literals::StringLiterals;
10
11#include "ui_dialogdesktop.h"
12
13#include <KCalUtils/Stringify>
14
15using namespace IncidenceEditorNG;
16
17IncidenceSecrecy::IncidenceSecrecy(Ui::EventOrTodoDesktop *ui)
18 : mUi(ui)
19{
20 setObjectName("IncidenceSecrecy"_L1);
21 mUi->mSecrecyCombo->addItems(KCalUtils::Stringify::incidenceSecrecyList());
22 connect(mUi->mSecrecyCombo, &QComboBox::currentIndexChanged, this, &IncidenceSecrecy::checkDirtyStatus);
23}
24
25void IncidenceSecrecy::load(const KCalendarCore::Incidence::Ptr &incidence)
26{
27 mLoadedIncidence = incidence;
28 if (mLoadedIncidence) {
29 Q_ASSERT(mUi->mSecrecyCombo->count() == KCalUtils::Stringify::incidenceSecrecyList().count());
30 mUi->mSecrecyCombo->setCurrentIndex(mLoadedIncidence->secrecy());
31 } else {
32 mUi->mSecrecyCombo->setCurrentIndex(0);
33 }
34
35 mWasDirty = false;
36}
37
38void IncidenceSecrecy::save(const KCalendarCore::Incidence::Ptr &incidence)
39{
40 Q_ASSERT(incidence);
41 switch (mUi->mSecrecyCombo->currentIndex()) {
42 case 1:
44 break;
45 case 2:
47 break;
48 default:
50 }
51}
52
53bool IncidenceSecrecy::isDirty() const
54{
55 if (mLoadedIncidence) {
56 if (mLoadedIncidence->secrecy() != mUi->mSecrecyCombo->currentIndex()) {
57 return true;
58 }
59 } else {
60 if (mUi->mSecrecyCombo->currentIndex() != 0) {
61 return true;
62 }
63 }
64
65 return false;
66}
67
68#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
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 Fri Oct 11 2024 12:16:44 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.