Skip to content
This repository has been archived by the owner on Nov 11, 2021. It is now read-only.

Commit

Permalink
Merge branch 'visible' into 'master'
Browse files Browse the repository at this point in the history
[kcalcore] export notebook visibility.

See merge request mer-core/kcalcore!17
  • Loading branch information
pvuorela committed Mar 10, 2020
2 parents ed7a28b + b609d56 commit 6ac2b64
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
12 changes: 12 additions & 0 deletions kcalcore/calendar.cpp
Expand Up @@ -463,6 +463,12 @@ bool Calendar::updateNotebook( const QString &notebook, bool isVisible )
return false;
} else {
d->mNotebooks.insert( notebook, isVisible );
const QList<Incidence::Ptr> incidences = d->mNotebookIncidences.values(notebook);
for (Incidence::Ptr incidence : incidences) {
QHash<Incidence::Ptr, bool>::Iterator it = d->mIncidenceVisibility.find(incidence);
if (it != d->mIncidenceVisibility.end())
*it = isVisible;
}
return true;
}
}
Expand Down Expand Up @@ -513,6 +519,12 @@ bool Calendar::isVisible( const Incidence::Ptr &incidence ) const
return rv;
}

bool Calendar::isVisible( const QString &notebook ) const
{
QHash<QString, bool>::ConstIterator it = d->mNotebooks.find(notebook);
return (it != d->mNotebooks.constEnd()) ? *it : true;
}

void Calendar::clearNotebookAssociations()
{
d->mNotebookIncidences.clear();
Expand Down
7 changes: 7 additions & 0 deletions kcalcore/calendar.h
Expand Up @@ -569,6 +569,13 @@ class KCALCORE_EXPORT Calendar : public QObject, public CustomProperties,
*/
bool isVisible( const Incidence::Ptr &incidence ) const;

/**
Check if notebook is visible.
@param notebook notebook uid.
@return true if notebook is visible, false otherwise
*/
bool isVisible( const QString &notebook ) const;

/**
List all notebook incidences in the memory.
Expand Down

0 comments on commit 6ac2b64

Please sign in to comment.