Hi Team,
First patch in a long time ;) hope this is an ok way to do it since I do not have repo rights. Anyway, here it is. See attached screenshot
This allows you to click through links in events in description fields
wherever the description field is displayed from libkcal.
This is useful since links to virtual meetings are often attached in the
description field in recent years.
See attached image for example.
Thanks,
Calvin
From 2efc423f98af3e4187698127faee2bf38c2ceb92 Mon Sep 17 00:00:00 2001 From: Calvin Morrison <calvin@xxxxxxxxx> Date: Sat, 16 Nov 2024 12:59:04 -0500 Subject: [PATCH] Format links in event descriptions for a nice QoL This allows you to click through links in events in description fields wherever the description field is displayed from libkcal. This is useful since links to virtual meetings are often attached in the description field in recent years. --- libkcal/incidenceformatter.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/libkcal/incidenceformatter.cpp b/libkcal/incidenceformatter.cpp index 785a681bd..853094caf 100644 --- a/libkcal/incidenceformatter.cpp +++ b/libkcal/incidenceformatter.cpp @@ -575,9 +575,22 @@ static TQString displayViewFormatEvent( Calendar *calendar, Event *event, } if ( !event->description().isEmpty() ) { + TQString description = event->description(); + + // Regular expression to match URLs + TQRegExp urlRegex("(https?://[^\\s]+)"); + + int pos = 0; + while ((pos = urlRegex.search(description, pos)) != -1) { + TQString url = urlRegex.cap(0); + TQString link = "<a href=\"" + url + "\">" + url + "</a>"; + description.replace(pos, url.length(), link); + pos += link.length(); + } + tmpStr += "<tr>"; tmpStr += "<td><b>" + i18n( "Description:" ) + "</b></td>"; - tmpStr += "<td>" + event->description() + "</td>"; + tmpStr += "<td>" + description + "</td>"; tmpStr += "</tr>"; } -- 2.39.2
Attachment:
2024-11-16-130925_741x378_scrot.png
Description: PNG image
____________________________________________________ tde-devels mailing list -- devels@xxxxxxxxxxxxxxxxxx To unsubscribe send an email to devels-leave@xxxxxxxxxxxxxxxxxx Web mail archive available at https://mail.trinitydesktop.org/mailman3/hyperkitty/list/devels@xxxxxxxxxxxxxxxxxx