projects
/
wxWidgets.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix for assert when setting tooltip for a readonly combo
[wxWidgets.git]
/
src
/
html
/
htmlfilt.cpp
diff --git
a/src/html/htmlfilt.cpp
b/src/html/htmlfilt.cpp
index c0a56d98918b500ccffc20c391b52d657c8d722b..874ccaf991efaa3eb8e3be91093ae9c2cfa343e8 100644
(file)
--- a/
src/html/htmlfilt.cpp
+++ b/
src/html/htmlfilt.cpp
@@
-14,7
+14,8
@@
#include "wx/wxprec.h"
#include "wx/wxprec.h"
-#if wxUSE_HTML
+#include "wx/defs.h"
+#if wxUSE_HTML && wxUSE_STREAMS
#ifdef __BORDLANDC__
#pragma hdrstop
#ifdef __BORDLANDC__
#pragma hdrstop
@@
-63,8
+64,8
@@
wxString wxHtmlFilterPlainText::ReadFile(const wxFSFile& file) const
doc = src;
delete [] src;
doc = src;
delete [] src;
- doc.Replace(
"<", "<"
, TRUE);
- doc.Replace(
">", ">"
, TRUE);
+ doc.Replace(
wxT("<"), wxT("<")
, TRUE);
+ doc.Replace(
wxT(">"), wxT(">")
, TRUE);
doc2 = "<HTML><BODY><PRE>\n" + doc + "\n</PRE></BODY></HTML>";
return doc2;
}
doc2 = "<HTML><BODY><PRE>\n" + doc + "\n</PRE></BODY></HTML>";
return doc2;
}
@@
-93,7
+94,7
@@
IMPLEMENT_DYNAMIC_CLASS(wxHtmlFilterImage, wxHtmlFilter)
bool wxHtmlFilterImage::CanRead(const wxFSFile& file) const
{
bool wxHtmlFilterImage::CanRead(const wxFSFile& file) const
{
- return (file.GetMimeType().Left(6) ==
"image/"
);
+ return (file.GetMimeType().Left(6) ==
wxT("image/")
);
}
}
@@
-129,7
+130,7
@@
bool wxHtmlFilterHTML::CanRead(const wxFSFile& file) const
// This is true in most case but some page can return:
// "text/html; char-encoding=...."
// So we use Find instead
// This is true in most case but some page can return:
// "text/html; char-encoding=...."
// So we use Find instead
- return (file.GetMimeType().Find(T("text/html")) == 0);
+ return (file.GetMimeType().Find(
wx
T("text/html")) == 0);
}
}
@@
-140,13
+141,25
@@
wxString wxHtmlFilterHTML::ReadFile(const wxFSFile& file) const
char *src;
wxString doc;
char *src;
wxString doc;
- if (s == NULL) return wxEmptyString;
+ if (s == NULL)
+ {
+ wxLogError(_("Cannot open HTML document: %s"), file.GetLocation().c_str());
+ return wxEmptyString;
+ }
src = new char[s -> GetSize() + 1];
src[s -> GetSize()] = 0;
s -> Read(src, s -> GetSize());
doc = src;
delete[] src;
src = new char[s -> GetSize() + 1];
src[s -> GetSize()] = 0;
s -> Read(src, s -> GetSize());
doc = src;
delete[] src;
+ // add meta tag if we obtained this through http:
+ if (file.GetMimeType().Find(_T("; charset=")) == 0)
+ {
+ wxString s(_T("<meta http-equiv=\"Content-Type\" content=\""));
+ s << file.GetMimeType() << _T("\">");
+ return s;
+ }
+
return doc;
}
return doc;
}