Blokkal
an Extendable KDE Blogging Client
SourceForge.net Logo

Blokkal::Ui::FormattingBackend Class Reference

Entry point for custom formating options. More...

#include <formattingbackend.h>

Inheritance diagram for Blokkal::Ui::FormattingBackend:

List of all members.


Public Member Functions

Blokkal::Ui::EditEntryWidgeteditEntryWidget (void) const
virtual QString & formatForPreview (QString &richText) const
 FormattingBackend (Blokkal::Ui::EditEntryWidget *parent)
virtual ~FormattingBackend (void)

Protected Member Functions

QString & formatLineBreaks (QString &richText) const
QString & formatLinks (QString &richText) const
void frameSelection (const QString &front, const QString &tail)
void insertTextAtCursor (const QString &text)

Friends

class EditEntryWidget

Detailed Description

Entry point for custom formating options.

This class can be used by plugins to add custom (HTML) tags to the standard options offered by EditEntryWidget. This class is a child of KXMLGUIClient, so you may merge your actions into the menu of the entry view. Use

 setXMLFile( "youruifile.rc" );
in the constructor to do so. A sample ui file looks like this:
 <!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
 <kpartgui name="blokkal_yourprotocol_edit" version="1">
 <MenuBar>
 <Menu name="edit"><text>&amp;Edit</text>
 <Action name="edit_yourprotocol_customaction1" />
 <Action name="edit_yourprotocol_customaction2" />
 </Menu>
 </MenuBar>
 <ToolBar name="editToolBar"><Text>Edit Toolbar</Text>
 <Action name="edit_yourprotocol_customaction3" />
 </ToolBar>
Author:
Martin Mueller <orvio@orvio.de>

Definition at line 62 of file formattingbackend.h.


Constructor & Destructor Documentation

Blokkal::Ui::FormattingBackend::FormattingBackend ( Blokkal::Ui::EditEntryWidget parent  ) 

Constructor. Use editEntryWidget() to access the EditEntryWidget and do not cast parent widget, as the parent widget may change after the backend has been constructed.

Parameters:
parent owning EditEntryWidget

Definition at line 40 of file formattingbackend.cpp.

Blokkal::Ui::FormattingBackend::~FormattingBackend ( void   )  [virtual]

Destructor

Definition at line 46 of file formattingbackend.cpp.


Member Function Documentation

Blokkal::Ui::EditEntryWidget * Blokkal::Ui::FormattingBackend::editEntryWidget ( void   )  const

Returns a pointer to the owning widget.

Returns:
a pointer to the owning widget

Definition at line 79 of file formattingbackend.cpp.

QString & Blokkal::Ui::FormattingBackend::formatForPreview ( QString &  richText  )  const [virtual]

If your protocol provides tags, that will be formatted in a special way by the server you may emulate that behaviour in this method. richText will be used for preview purposes only, so you may do whatever necessary for the correct appearance. The default implementation just passed richText as return value.

Note:
You must pass richText as the return value of this method.
Parameters:
richText rich text string you may apply special formatting to
Returns:
a reference to richText

Definition at line 74 of file formattingbackend.cpp.

QString & Blokkal::Ui::FormattingBackend::formatLineBreaks ( QString &  richText  )  const [protected]

Replaces "\n" with "<br/>"

Definition at line 113 of file formattingbackend.cpp.

QString & Blokkal::Ui::FormattingBackend::formatLinks ( QString &  richText  )  const [protected]

Makes links, that are not clickable clickable

Definition at line 84 of file formattingbackend.cpp.

void Blokkal::Ui::FormattingBackend::frameSelection ( const QString &  front,
const QString &  tail 
) [protected]

If some text is selected, the selected text is framed by front and tail. If no text is selected the current cursor position is used instead.

Note:
Calling this method in the constructor will do nothing.
Parameters:
front text to place in front of the selection
tail text to place after the selection

Definition at line 65 of file formattingbackend.cpp.

void Blokkal::Ui::FormattingBackend::insertTextAtCursor ( const QString &  text  )  [protected]

Inserts text at the current cursor position.

Note:
Calling this method in the constructor will do nothing.
Parameters:
text text to insert

Definition at line 56 of file formattingbackend.cpp.


The documentation for this class was generated from the following files: