+ if (Client::isCoreFeatureEnabled(Quassel::Feature::AwayFormatTimestamp)) {
+ // Core allows formatting %%timestamp%% messages in away strings. Update tooltips.
+ QString strFormatTooltip;
+ QTextStream formatTooltip(&strFormatTooltip, QIODevice::WriteOnly);
+ formatTooltip << "<qt><style>.bold { font-weight: bold; } "
+ ".italic { font-style: italic; }</style>";
+
+ // Function to add a row to the tooltip table
+ auto addRow = [&](const QString& key, const QString& value, bool condition) {
+ if (condition) {
+ formatTooltip << "<tr><td class='bold' align='right'>" << key << "</td><td>" << value << "</td></tr>";
+ }
+ };
+
+ // Original tooltip goes here
+ formatTooltip << "<p>%1</p>";
+ // New timestamp formatting guide here
+ formatTooltip << "<p>"
+ << tr("You can add date/time to this message "
+ "using the syntax: "
+ "<br/>%%<span class='italic'><format></span>%%, where "
+ "<span class='italic'><format></span> is:")
+ << "</p>";
+ formatTooltip << "<table cellspacing='5' cellpadding='0'>";
+ addRow("hh", tr("the hour"), true);
+ addRow("mm", tr("the minutes"), true);
+ addRow("ss", tr("seconds"), true);
+ addRow("AP", tr("AM/PM"), true);
+ addRow("dd", tr("day"), true);
+ addRow("MM", tr("month"), true);
+ addRow("t", tr("current timezone"), true);
+ formatTooltip << "</table>";
+ formatTooltip << "<p>" << tr("Example: Away since %%hh:mm%% on %%dd.MM%%.") << "</p>";
+ formatTooltip << "<p>"
+ << tr("%%%% without anything inside represents %%. Other format "
+ "codes are available.")
+ << "</p>";
+ formatTooltip << "</qt>";
+
+ // Split up the message to allow re-using translations:
+ // [Original tool-tip] [Timestamp format message]
+ ui.awayReason->setToolTip(strFormatTooltip.arg(ui.awayReason->toolTip()));
+ ui.detachAwayEnabled->setToolTip(strFormatTooltip.arg(ui.detachAwayEnabled->toolTip()));
+ } // else: Do nothing, leave the original translated string
+}