New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Protect against notebook storage changes for runtime only notebooks and other clean ups #34
Conversation
|
@pvuorela, I've added a commit where I stopped using |
src/notebook.cpp
Outdated
| @@ -249,7 +250,7 @@ QString Notebook::color() const | |||
| void Notebook::setColor(const QString &color) | |||
| { | |||
| d->mModifiedDate = QDateTime::currentDateTimeUtc(); | |||
| d->mColor = color; | |||
| d->mColor = color.isEmpty() ? QString::fromLatin1("#0000FF") : color; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now the 0000FF seems to get used for all the notebooks that don't set a color when earlier it was just the default notebook. Allowing and defaulting the user created notebooks to empty value might still make sense, kind of interpreted as not defined?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, I've reverted this change and I assign the default colour in sqlitestorage, on initialisation.
|
Seems good overall. Couple possibly final remarks:
Suppose this should be already fine to merge alone. The birthday calendar sync etc should still work, but just good to update to the new behavior, right? |
Two major modifications: - ensure that runtime notebooks are not touching the database, - consider the read-only notebook flag as an indication for downstream. The database becomes always writable for non-runtime notebook. Like that external changes can be synced without having to flip the read-only flag on and off.
|
Thanks for the comments. I've added a runtime warning when calling I've reword the read-only commit and I've added the JB tag also to the commit. Having it in should not impact the existing usage of flipping the read-only flag. Just that it's useless now. I'll create PRs for birthday and buteo plugins as soon as this PR is accepted. |
|
From default notebook commit: "Notice: deprecated since 0.6.10. Instead, create a notebook with the default constructor and call setDefaultNotebook()." Being specific, this won't get the same result as there's no name or color on that code path. There was a question earlier was this used somewhere, think I've maybe answered in irc at some point(?) but fwiw there's a couple instances in buteo-sync-plugins. Suppose that could be dead code. Before fully removing the method, maybe could now just adjust the text as ~ "create a notebook and call..." without specifying the notebook details. |
Since 2532e2e, modifying a read-only notebook is permitted without changing the read-only flag which is treated as a hint only.
Yeh, you're right, not the default constructor, but the (name, description, color) one. For simplicity, I've removed the "with the default constructor" part of the sentence, as you suggested. |
I'll make a PR there to change it for the "create and setDefault" pattern. |
@pvuorela, this is a selection of commits from #30, commits that don't change the API and may be reviewed independently.
Once we agree on this I'll make another commit with (simple) API break, like:
isValidNotebook()as we discussed in Rework ExtendedStorage API and service plugin API to remove any Notebook::Ptr #30. It requires a fix in the contact birthday plugin and in the nemo QML calendar plugin, as far as I know.deleteNotebook()API to use a notebook uid and not a notebook pointer.defaultNotebook()andsetDefaultNotebook()to use uid instead of a notebook pointer.These API breaks are still less invasive than completely suppressing the ::Ptr part for Notebooks, but they make the ExtendedStorage API simpler and don't require to load Notebook::Ptr from outside mKCal when uids are enough.
What do you think ?