# HG changeset patch
# User sheepluva
# Date 1363858003 -3600
# Node ID 7450cb9c815b98f12b4c767808921ee8dd23870f
# Parent 688062f1db59942108d59a0a31c6d6eae449acc1
make https links work properly
diff -r 688062f1db59 -r 7450cb9c815b QTfrontend/ui/widget/chatwidget.cpp
--- a/QTfrontend/ui/widget/chatwidget.cpp Thu Mar 21 10:08:30 2013 +0100
+++ b/QTfrontend/ui/widget/chatwidget.cpp Thu Mar 21 10:26:43 2013 +0100
@@ -295,9 +295,9 @@
void HWChatWidget::linkClicked(const QUrl & link)
{
- if (link.scheme() == "http")
+ if ((link.scheme() == "http") or (link.scheme() == "https"))
QDesktopServices::openUrl(link);
- if (link.scheme() == "hwnick")
+ else if (link.scheme() == "hwnick")
{
// decode nick
QString nick = QString::fromUtf8(QByteArray::fromBase64(link.encodedQuery()));
@@ -368,7 +368,7 @@
return QString("%1").arg(Qt::escape(nickname));
}
-const QRegExp HWChatWidget::URLREGEXP = QRegExp("(http://)?(www\\.)?((hedgewars\\.org|code\\.google\\.com|googlecode\\.com|hh\\.unit22\\.org)(/[^ ]*)?)");
+const QRegExp HWChatWidget::URLREGEXP = QRegExp("(http(s)?://)?(www\\.)?((hedgewars\\.org|code\\.google\\.com|googlecode\\.com|hh\\.unit22\\.org)(/[^ ]*)?)");
bool HWChatWidget::containsHighlight(const QString & sender, const QString & message)
{
@@ -389,7 +389,7 @@
{
QString formattedStr = Qt::escape(message);
// link some urls
- formattedStr = formattedStr.replace(URLREGEXP, "\\3");
+ formattedStr = formattedStr.replace(URLREGEXP, "\\4");
return formattedStr;
}