Changeset View
Changeset View
Standalone View
Standalone View
src/calendar.cpp
Show First 20 Lines • Show All 318 Lines • ▼ Show 20 Line(s) | |||||
319 | } | 319 | } | ||
320 | 320 | | |||
321 | bool Calendar::updateNotebook(const QString ¬ebook, bool isVisible) | 321 | bool Calendar::updateNotebook(const QString ¬ebook, bool isVisible) | ||
322 | { | 322 | { | ||
323 | if (!d->mNotebooks.contains(notebook)) { | 323 | if (!d->mNotebooks.contains(notebook)) { | ||
324 | return false; | 324 | return false; | ||
325 | } else { | 325 | } else { | ||
326 | d->mNotebooks.insert(notebook, isVisible); | 326 | d->mNotebooks.insert(notebook, isVisible); | ||
327 | const QList<Incidence::Ptr> incidences = d->mNotebookIncidences.values(notebook); | ||||
328 | for (Incidence::Ptr incidence : incidences) { | ||||
329 | QHash<Incidence::Ptr, bool>::Iterator it = d->mIncidenceVisibility.find(incidence); | ||||
330 | if (it != d->mIncidenceVisibility.end()) | ||||
331 | *it = isVisible; | ||||
332 | } | ||||
327 | return true; | 333 | return true; | ||
328 | } | 334 | } | ||
329 | } | 335 | } | ||
330 | 336 | | |||
331 | bool Calendar::deleteNotebook(const QString ¬ebook) | 337 | bool Calendar::deleteNotebook(const QString ¬ebook) | ||
332 | { | 338 | { | ||
333 | if (!d->mNotebooks.contains(notebook)) { | 339 | if (!d->mNotebooks.contains(notebook)) { | ||
334 | return false; | 340 | return false; | ||
Show All 34 Lines | 367 | { | |||
369 | } else { | 375 | } else { | ||
370 | // NOTE returns true also for nonexisting notebooks for compatibility | 376 | // NOTE returns true also for nonexisting notebooks for compatibility | ||
371 | rv = true; | 377 | rv = true; | ||
372 | } | 378 | } | ||
373 | d->mIncidenceVisibility[incidence] = rv; | 379 | d->mIncidenceVisibility[incidence] = rv; | ||
374 | return rv; | 380 | return rv; | ||
375 | } | 381 | } | ||
376 | 382 | | |||
383 | bool Calendar::isVisible(const QString ¬ebook) const | ||||
384 | { | ||||
385 | QHash<QString, bool>::ConstIterator it = d->mNotebooks.find(notebook); | ||||
386 | return (it != d->mNotebooks.constEnd()) ? *it : true; | ||||
387 | } | ||||
388 | | ||||
377 | void Calendar::clearNotebookAssociations() | 389 | void Calendar::clearNotebookAssociations() | ||
378 | { | 390 | { | ||
379 | d->mNotebookIncidences.clear(); | 391 | d->mNotebookIncidences.clear(); | ||
380 | d->mUidToNotebook.clear(); | 392 | d->mUidToNotebook.clear(); | ||
381 | d->mIncidenceVisibility.clear(); | 393 | d->mIncidenceVisibility.clear(); | ||
382 | } | 394 | } | ||
383 | 395 | | |||
384 | bool Calendar::setNotebook(const Incidence::Ptr &inc, const QString ¬ebook) | 396 | bool Calendar::setNotebook(const Incidence::Ptr &inc, const QString ¬ebook) | ||
▲ Show 20 Lines • Show All 979 Lines • Show Last 20 Lines |