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

utils.cpp - add more info to the calendar collection tooltip

adds some more useful info:
 * if this is the default calendar
 * content type (simplified for user consumption)

Differential Revision: https://phabricator.kde.org/D27768
parent 4e4531d4
...@@ -670,6 +670,9 @@ QString CalendarSupport::toolTipString(const Akonadi::Collection &coll, bool ric ...@@ -670,6 +670,9 @@ QString CalendarSupport::toolTipString(const Akonadi::Collection &coll, bool ric
if (displayName.isEmpty()) { if (displayName.isEmpty()) {
displayName = coll.name(); displayName = coll.name();
} }
if (coll.id() == CalendarSupport::KCalPrefs::instance()->defaultCalendarId()) {
displayName = i18nc("this is the default calendar", "%1 (Default Calendar)", displayName);
}
str += QLatin1String("<b>") + displayName + QLatin1String("</b>"); str += QLatin1String("<b>") + displayName + QLatin1String("</b>");
str += QLatin1String("<hr>"); str += QLatin1String("<hr>");
...@@ -680,11 +683,28 @@ QString CalendarSupport::toolTipString(const Akonadi::Collection &coll, bool ric ...@@ -680,11 +683,28 @@ QString CalendarSupport::toolTipString(const Akonadi::Collection &coll, bool ric
= Akonadi::AgentManager::self()->instance(coll.resource()); = Akonadi::AgentManager::self()->instance(coll.resource());
calendarType = instance.type().name(); calendarType = instance.type().name();
} else { } else {
calendarType = i18nc("unknown calendar type", "unknown"); calendarType = i18nc("a virtual folder type", "Virtual");
} }
str += QLatin1String("<i>") + i18n("Calendar type:") + QLatin1String("</i>"); str += QLatin1String("<i>") + i18n("Folder type:") + QLatin1String("</i>");
str += QLatin1String("&nbsp;") + calendarType; str += QLatin1String("&nbsp;") + calendarType;
// Content Type
QStringList mimeTypes = coll.contentMimeTypes();
mimeTypes.removeAll(QLatin1String("inode/directory"));
QString mimeTypeStr;
if (!mimeTypes.isEmpty()) {
mimeTypeStr = QLocale().createSeparatedList(
mimeTypes.
replaceInStrings(
QLatin1String("application/x-vnd.akonadi.calendar."), QString()));
} else {
mimeTypeStr = i18nc("collection has no mimetypes to show the user", "none");
}
str += QLatin1String("<br>");
str += QLatin1String("<i>") + i18n("Content type:") + QLatin1String("</i>");
str += QLatin1String("&nbsp;") + mimeTypeStr;
str += QLatin1String("</br>");
// Read only? // Read only?
bool isReadOnly = !(coll.rights() & Akonadi::Collection::CanChangeItem); bool isReadOnly = !(coll.rights() & Akonadi::Collection::CanChangeItem);
str += QLatin1String("<br>"); str += QLatin1String("<br>");
......
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