Commit cea869f3 authored by Allen Winter's avatar Allen Winter
Browse files

incidencedialog.cpp - ask to set a default events folder.

Summary:
When saving a new event, nag the user to set a default
calendar collection if they don't already have one.
Don't bother if they only have 1 events calendar folder.

{F8317182}

Test Plan:
- unset my default calendar.
- set my default calendar.
so far works as expected.

Reviewers: vkrause, dvratil, dfaure, mlaurent

Reviewed By: mlaurent

Subscribers: kde-pim

Tags: #kde_pim

Differential Revision: https://phabricator.kde.org/D29725
parent f0fa6438
......@@ -521,6 +521,28 @@ void IncidenceDialogPrivate::handleItemSaveFinish(EditorItemManager::SaveAction
{
Q_Q(IncidenceDialog);
if ((mEditor->type() == KCalendarCore::Incidence::TypeEvent) &&
(mCalSelector->count() > 1) &&
(CalendarSupport::KCalPrefs::instance()->defaultCalendarId() == -1)) {
const QString collectionName = mCalSelector->currentText();
const QString message =
xi18nc("@info",
"<para>You have not set a default calendar for your events yet.</para>"
"<para>Setting a default calendar will make creating new events faster and "
"easier with less chance of filing them into the wrong folder.</para>"
"<para>Would you like to set your default events calendar to "
"<resource>%1</resource>?</para>",
collectionName);
if (KMessageBox::questionYesNo(q,
message,
i18nc("@title:window", "Set Default Calendar?"),
KStandardGuiItem::yes(), // Make collectionName My Default Calendar
KStandardGuiItem::no(), // Do Not Set a Default Calendar at this Time"
QLatin1String("setDefaultCalendarCollection")) == KMessageBox::Yes) {
CalendarSupport::KCalPrefs::instance()->setDefaultCalendarId(mItem.storageCollectionId());
}
}
if (mCloseOnSave) {
q->accept();
} else {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment