kpimidentities
KPIMIdentities::Signature Class Reference
abstraction of a signature (aka "footer"). More...
#include <signature.h>
Public Types | |
enum | Placement { Start, End, AtCursor } |
enum | Type { Disabled = 0, Inlined = 1, FromFile = 2, FromCommand = 3 } |
Public Member Functions | |
void | insertIntoTextEdit (KRichTextEdit *textEdit, Placement placement=End, bool addSeparator=true) |
bool | isInlinedHtml () const |
bool | operator== (const Signature &other) const |
QString | rawText (bool *ok=0) const |
void | setInlinedHtml (bool isHtml) |
void | setText (const QString &text) |
void | setType (Type type) |
void | setUrl (const QString &url, bool isExecutable=false) |
Signature (const QString &url, bool isExecutable) | |
Signature (const QString &text) | |
Signature () | |
QString | text () const |
Type | type () const |
QString | url () const |
QString | withSeparator (bool *ok=0) const |
Static Public Member Functions | |
static void | insertPlainSignatureIntoTextEdit (const QString &signature, KRichTextEdit *textEdit, Placement placement=End, bool isHtml=false) |
Protected Member Functions | |
void | readConfig (const KConfigGroup &config) |
void | writeConfig (KConfigGroup &config) const |
Friends | |
KPIMIDENTITIES_EXPORT QDataStream & | operator<< (QDataStream &stream, const Signature &sig) |
KPIMIDENTITIES_EXPORT QDataStream & | operator>> (QDataStream &stream, Signature &sig) |
Detailed Description
abstraction of a signature (aka "footer").
Definition at line 54 of file signature.h.
Member Enumeration Documentation
Describes the placement of the signature text when it is to be inserted into a text edit.
- Enumerator:
Start The signature is placed at the start of the textedit.
End The signature is placed at the end of the textedit.
AtCursor The signature is placed at the current cursor position.
Definition at line 74 of file signature.h.
Constructor & Destructor Documentation
Signature::Signature | ( | ) |
Constructor for disabled signature.
Definition at line 37 of file signature.cpp.
Signature::Signature | ( | const QString & | text | ) |
Constructor for inline text.
Definition at line 42 of file signature.cpp.
Signature::Signature | ( | const QString & | url, | |
bool | isExecutable | |||
) |
Constructor for text from a file or from output of a command.
Definition at line 48 of file signature.cpp.
Member Function Documentation
void Signature::insertIntoTextEdit | ( | KRichTextEdit * | textEdit, | |
Placement | placement = End , |
|||
bool | addSeparator = true | |||
) |
Inserts this signature into the given text edit.
The cursor position is preserved. A leading or trailing newline is also added automatically, depending on the placement. For undo/redo, this is treated as one operation.
Rich text mode of the text edit will be enabled if the signature is in inlined HTML format.
- Parameters:
-
textEdit the signature will be inserted into this text edit. placement defines where in the text edit the signature should be inserted. addSeparator if true, the separator '--
' will be added in front of the signature
- Since:
- 4.3
Definition at line 232 of file signature.cpp.
void Signature::insertPlainSignatureIntoTextEdit | ( | const QString & | signature, | |
KRichTextEdit * | textEdit, | |||
Signature::Placement | placement = End , |
|||
bool | isHtml = false | |||
) | [static] |
Inserts this given signature into the given text edit.
The cursor position is preserved. A leading or trailing newline is also added automatically, depending on the placement. For undo/redo, this is treated as one operation. A separator is not added.
Use the insertIntoTextEdit() function if possible, as it has support for separators and does HTML detection automatically.
Rich text mode of the text edit will be enabled if isHtml
is true.
- Parameters:
-
signature the signature, either as plain text or as HTML textEdit the text edit to insert the signature into placement defines where in the textedit the signature should be inserted. isHtml defines whether the signature should be inserted as text or html
- Since:
- 4.3
Definition at line 246 of file signature.cpp.
bool Signature::isInlinedHtml | ( | ) | const |
- Returns:
- boolean whether the inlined signature is html
- Since:
- 4.1
Definition at line 175 of file signature.cpp.
bool Signature::operator== | ( | const Signature & | other | ) | const |
Used for comparison.
Definition at line 326 of file signature.cpp.
QString Signature::rawText | ( | bool * | ok = 0 |
) | const |
- Returns:
- the raw signature text as entered resp. read from file.
Definition at line 54 of file signature.cpp.
void Signature::setInlinedHtml | ( | bool | isHtml | ) |
Sets the inlined signature to text or html.
- Parameters:
-
isHtml sets the inlined signature to html
- Since:
- 4.1
Definition at line 170 of file signature.cpp.
void Signature::setText | ( | const QString & | text | ) |
Set the signature text and mark this signature as being of "inline text" type.
Definition at line 363 of file signature.cpp.
void Signature::setUrl | ( | const QString & | url, | |
bool | isExecutable = false | |||
) |
Set the signature URL and mark this signature as being of "from file" resp.
"from output of command" type.
Definition at line 164 of file signature.cpp.
Signature::Type Signature::type | ( | ) | const |
- Returns:
- the type of signature (ie. way to obtain the signature text)
Definition at line 356 of file signature.cpp.
QString Signature::withSeparator | ( | bool * | ok = 0 |
) | const |
- Returns:
- the signature text with a "-- \n" separator added, if necessary. A newline will not be appended or prepended.
Definition at line 142 of file signature.cpp.
The documentation for this class was generated from the following files: