From a33d6a6f8b7b6bb35f542c3b8d7391859e8e4e31 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Tue, 20 Jul 2010 23:13:26 +0000 Subject: [PATCH] - client: don't do two RSS fetches at once - manager: WxWidget's HTML renderer doesn't seem to like \n's. For example, if you try to render foo blah all it shows is foo. Work around this by replacing \n's with
svn path=/trunk/boinc/; revision=22017 --- checkin_notes | 15 ++++++++++ client/cs_notice.cpp | 1 + clientgui/NoticeListCtrl.cpp | 56 ++++++++++++++++++++++++------------ 3 files changed, 53 insertions(+), 19 deletions(-) diff --git a/checkin_notes b/checkin_notes index a2c3e51a9d..339f8dd0f9 100644 --- a/checkin_notes +++ b/checkin_notes @@ -5313,3 +5313,18 @@ David 20 Jul 2010 configure.ac Makefile.am + +David 20 Jul 2010 + - client: don't do two RSS fetches at once + - manager: WxWidget's HTML renderer doesn't seem to like \n's. + For example, if you try to render + foo + + blah + all it shows is foo. + Work around this by replacing \n's with
+ + client/ + cs_notice.cpp + clientgui/ + NoticeListCtrl.cpp diff --git a/client/cs_notice.cpp b/client/cs_notice.cpp index f13bdfd487..bc21c99167 100644 --- a/client/cs_notice.cpp +++ b/client/cs_notice.cpp @@ -602,6 +602,7 @@ bool RSS_FEED_OP::poll() { strcpy(url, rf.url); } gstate.gui_http.do_rpc(this, url, filename); + break; } } return false; diff --git a/clientgui/NoticeListCtrl.cpp b/clientgui/NoticeListCtrl.cpp index 48c9c68f6b..367d715e80 100644 --- a/clientgui/NoticeListCtrl.cpp +++ b/clientgui/NoticeListCtrl.cpp @@ -172,6 +172,22 @@ wxAccStatus CNoticeListCtrlAccessible::DoDefaultAction(int childId) return wxACC_NOT_IMPLEMENTED; } +static void fix_html(const char* in, char* out) { + while (*in) { + switch (*in) { + case '\n': + strcpy(out, "
"); + out += 4; + break; + case '\r': + break; + default: + *out++ = *in; + } + in++; + } + *out = 0; +} // Returns the description for this object or a child. wxAccStatus CNoticeListCtrlAccessible::GetDescription(int childId, wxString* description) @@ -183,26 +199,26 @@ wxAccStatus CNoticeListCtrlAccessible::GetDescription(int childId, wxString* des wxString strProjectName = wxEmptyString; wxString strArrivalTime = wxEmptyString; - if (pDoc && (childId != wxACC_SELF)) - { + if (pDoc && (childId != wxACC_SELF)) { strBuffer = wxEmptyString; - if (pDoc) - { - strDescription = wxString(process_client_message(pDoc->notice(childId-1)->description.c_str()), wxConvUTF8); - strProjectName = wxString(pDoc->notice(childId-1)->project_name, wxConvUTF8); - dtBuffer.Set((time_t)pDoc->notice(childId-1)->arrival_time); - strArrivalTime = dtBuffer.Format(); - if (strProjectName.IsEmpty()) { - strBuffer.Printf(_("%s; received on %s"), strDescription.c_str(), strArrivalTime.c_str()); - } else { - strBuffer.Printf(_("%s; received from %s; on %s"), strDescription.c_str(), strProjectName.c_str(), strArrivalTime.c_str()); - } - - strBuffer = StripHTMLTags(strBuffer); - *description = strBuffer.c_str(); - - return wxACC_OK; + + // WxWidget's HTML renderer gets messed up by \n's. change to
+ char buf[8192]; + fix_html(pDoc->notice(childId-1)->description.c_str(), buf); + strDescription = process_client_message(buf); + strProjectName = wxString(pDoc->notice(childId-1)->project_name, wxConvUTF8); + dtBuffer.Set((time_t)pDoc->notice(childId-1)->arrival_time); + strArrivalTime = dtBuffer.Format(); + if (strProjectName.IsEmpty()) { + strBuffer.Printf(_("%s; received on %s"), strDescription.c_str(), strArrivalTime.c_str()); + } else { + strBuffer.Printf(_("%s; received from %s; on %s"), strDescription.c_str(), strProjectName.c_str(), strArrivalTime.c_str()); } + + strBuffer = StripHTMLTags(strBuffer); + *description = strBuffer.c_str(); + + return wxACC_OK; } // Let the framework handle the other cases. @@ -532,7 +548,9 @@ wxString CNoticeListCtrl::OnGetItem(size_t i) const strProjectName = wxString(np->project_name, wxConvUTF8); strURL = wxString(np->link, wxConvUTF8); strTitle = wxString(process_client_message(np->title), wxConvUTF8); - strDescription = wxString(process_client_message(np->description.c_str()), wxConvUTF8); + char buf[8192]; + fix_html(np->description.c_str(), buf); + strDescription = process_client_message(buf); dtBuffer.Set((time_t)np->arrival_time); strArrivalTime = dtBuffer.Format();