[pim/incidenceeditor] src: Simplify IncidenceSecrecy::load

Carl Schwan <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit bf65011e1750e67eb8e338b1e108e3c17396cc57 by Carl Schwan, on behalf of Volker Krause.
Committed on 03/08/2026 at 18:34.
Pushed by carlschwan into branch 'master'.

Simplify IncidenceSecrecy::load

* incidence is guaranteed to not be null here (otherwise the first line
  would crash).
* therefore the inner if in the else branch always takes the true branch
* mLoadedIncidence and incidence are the same, so the setCurrentIndex
  calls are also the same.

M  +2    -12   src/incidencesecrecy.cpp

https://invent.kde.org/pim/incidenceeditor/-/commit/bf65011e1750e67eb8e338b1e108e3c17396cc57

diff --git a/src/incidencesecrecy.cpp b/src/incidencesecrecy.cpp
index c33949df..1847a142 100644
--- a/src/incidencesecrecy.cpp
+++ b/src/incidencesecrecy.cpp
@@ -25,19 +25,9 @@ IncidenceSecrecy::IncidenceSecrecy(Ui::EventOrTodoDesktop *ui)
 
 void IncidenceSecrecy::load(const KCalendarCore::Incidence::Ptr &incidence)
 {
-    const bool isTemplate = incidence->customProperty("kdepim", "isTemplate") == "true"_L1;
-
     mLoadedIncidence = incidence;
-    if (isTemplate) {
-        mUi->mSecrecyCombo->setCurrentIndex(incidence->secrecy());
-    } else {
-        if (mLoadedIncidence) {
-            Q_ASSERT(mUi->mSecrecyCombo->count() == KCalUtils::Stringify::incidenceSecrecyList().count());
-            mUi->mSecrecyCombo->setCurrentIndex(mLoadedIncidence->secrecy());
-        } else {
-            mUi->mSecrecyCombo->setCurrentIndex(0);
-        }
-    }
+    Q_ASSERT(mUi->mSecrecyCombo->count() == KCalUtils::Stringify::incidenceSecrecyList().count());
+    mUi->mSecrecyCombo->setCurrentIndex(incidence->secrecy());
     mWasDirty = false;
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.