A helper class derived from QString to conveniently read HTML files, replace translatable texts and replace parameter tags.
More...
#include <bpsmdehtml.h>
List of all members.
Public Member Functions |
| | BpsMdeHtml (const QString &aString) |
| | Construct a HTML object from a QString.
|
| | BpsMdeHtml (const char *aFile) |
| | Construct by reading the HTML template from a file.
|
| BpsMdeHtml | set (const QString &aTag, const QString &aValue) |
| | Replace parameter tags marked in the HTML with {{aTag}} by another value.
|
| BpsMdeHtml | set (const QString &aTag, bool aValue) |
| | Replace parameter tags marked in the HTML with {{aTag}} by another value.
|
| BpsMdeHtml | set (const QString &aTag, int aValue) |
| | Replace parameter tags marked in the HTML with {{aTag}} by another value.
|
| BpsMdeHtml | set (const QString &aTag, qlonglong aValue) |
| | Replace parameter tags marked in the HTML with {{aTag}} by another value.
|
| BpsMdeHtml | set (const QString &aTag, qulonglong aValue) |
| | Replace parameter tags marked in the HTML with {{aTag}} by another value.
|
| BpsMdeHtml | trn (const QString &aText, const QString &aTranslated) |
| | Replace translation texts marked in the HTML with [[aText]] by a translated text.
|
Static Public Member Functions |
| static void | errorPage (BpsMdeRequest *aRequest, BpsMdeSession *aSession, const QString &aTitle, const QString &aMessage, const QString &aUrl=QString()) |
| | Shows the standard error page of the MDE server.
|
| static QString | escapeHtml (const QString &aText) |
| | Escapes special chars by their html entity: less than, greater than, ampersand.
|
| static void | menuPage (BpsMdeRequest *aRequest, BpsMdeSession *aSession, const QString &aTitle, const QList< BpsMdeApplication * > &aApplications) |
| | Shows a standard menu page of the MDE server.
|
| static QString | nbsp () |
| static QString | toHtml (const QString &aText) |
| | Convert a normal text to HTML.
|
Detailed Description
A helper class derived from QString to conveniently read HTML files, replace translatable texts and replace parameter tags.
An extra collection of static methods provide convenience in using core html pages and other items.
Constructor & Destructor Documentation
| BpsMdeHtml::BpsMdeHtml |
( |
const QString & |
aString | ) |
|
Construct a HTML object from a QString.
- Parameters:
-
| [in] | aString | The string to use. |
| BpsMdeHtml::BpsMdeHtml |
( |
const char * |
aFile | ) |
|
Construct by reading the HTML template from a file.
- Parameters:
-
| [in] | aFile | The file name to read from. |
Member Function Documentation
| static void BpsMdeHtml::errorPage |
( |
BpsMdeRequest * |
aRequest, |
|
|
BpsMdeSession * |
aSession, |
|
|
const QString & |
aTitle, |
|
|
const QString & |
aMessage, |
|
|
const QString & |
aUrl = QString() |
|
) |
| [static] |
Shows the standard error page of the MDE server.
- Parameters:
-
| [in] | aRequest | The request handled. |
| [in] | aSession | The session handled. |
| [in] | aTitle | The page title. |
| [in] | aMessage | The error message. |
| [in] | aUrl | The URL (local page) to call after confirmation. |
| static QString BpsMdeHtml::escapeHtml |
( |
const QString & |
aText | ) |
[static] |
Escapes special chars by their html entity: less than, greater than, ampersand.
- Parameters:
-
| [in] | aText | The text maybe holding special chars with html markup meaning. |
- Returns:
- The text with the problematic characters escaped.
Shows a standard menu page of the MDE server.
Only applications with non-empty text and icon, and having access are taken into the menu. The menu is first populated with the applications having a fixed position, and then filled up with the others. The applications with not fixed position are ordered by text() ascending (case-insensitive compare).
- Parameters:
-
| [in] | aRequest | The request handled. |
| [in] | aSession | The session handled. |
| [in] | aTitle | A page title (sent in HTML header only). |
| [in] | aApplications | The list of applications as source. |
| static QString BpsMdeHtml::nbsp |
( |
| ) |
[static] |
- Returns:
- The HTML entity for non breaking space.
| BpsMdeHtml BpsMdeHtml::set |
( |
const QString & |
aTag, |
|
|
const QString & |
aValue |
|
) |
| |
Replace parameter tags marked in the HTML with {{aTag}} by another value.
Basically this does exactly what trn() does, only with curly braces in place of square brackets.
- Parameters:
-
| [in] | aTag | The template tag, without the curly braces. |
| [in] | aValue | The value to insert instead of the tag. |
- Returns:
- Returns a new object with the tags replaced.
| BpsMdeHtml BpsMdeHtml::set |
( |
const QString & |
aTag, |
|
|
bool |
aValue |
|
) |
| |
Replace parameter tags marked in the HTML with {{aTag}} by another value.
- Parameters:
-
| [in] | aTag | The template tag, without the curly braces. |
| [in] | aValue | The value to insert instead of the tag (true="1", false="0"). |
- Returns:
- Returns a new object with the tags replaced.
| BpsMdeHtml BpsMdeHtml::set |
( |
const QString & |
aTag, |
|
|
int |
aValue |
|
) |
| |
Replace parameter tags marked in the HTML with {{aTag}} by another value.
- Parameters:
-
| [in] | aTag | The template tag, without the curly braces. |
| [in] | aValue | The value to insert instead of the tag. |
- Returns:
- Returns a new object with the tags replaced.
| BpsMdeHtml BpsMdeHtml::set |
( |
const QString & |
aTag, |
|
|
qlonglong |
aValue |
|
) |
| |
Replace parameter tags marked in the HTML with {{aTag}} by another value.
- Parameters:
-
| [in] | aTag | The template tag, without the curly braces. |
| [in] | aValue | The value to insert instead of the tag. |
- Returns:
- Returns a new object with the tags replaced.
| BpsMdeHtml BpsMdeHtml::set |
( |
const QString & |
aTag, |
|
|
qulonglong |
aValue |
|
) |
| |
Replace parameter tags marked in the HTML with {{aTag}} by another value.
- Parameters:
-
| [in] | aTag | The template tag, without the curly braces. |
| [in] | aValue | The value to insert instead of the tag. |
- Returns:
- Returns a new object with the tags replaced.
| static QString BpsMdeHtml::toHtml |
( |
const QString & |
aText | ) |
[static] |
Convert a normal text to HTML.
Newlines get replaced by BR tags, ampersands are replaced by the html entity.
- Parameters:
-
| [in] | aText | The regular text. |
- Returns:
- The HTML code.
| BpsMdeHtml BpsMdeHtml::trn |
( |
const QString & |
aText, |
|
|
const QString & |
aTranslated |
|
) |
| |
Replace translation texts marked in the HTML with [[aText]] by a translated text.
Basically this does exactly what set() does, only with square brackets in place of curly braces.
- Parameters:
-
| [in] | aText | The template text, without the brackets. |
| [in] | aTranslated | The translated text be inserted instead of the template text replace. |
- Returns:
- Returns a new object with the templates replaced.
The documentation for this class was generated from the following file: