Blokkal::Entry Class Reference
This class is a base for all protocol implementations of a blog entry. More...
#include <blokkalentry.h>
Public Types | |
enum | JobType { PostJob = 1, DeleteJob = 2, UserJob = 10 } |
Public Slots | |
void | deref (void) |
void | ref (void) |
Signals | |
void | entryDestroyed (Blokkal::Entry *entry) |
Public Member Functions | |
Blokkal::Blog * | blog (void) const |
QStringList | categories (void) const |
virtual Blokkal::Ui::EntryExtensionWidget * | createExtensionWidget (Ui::EntryExtensionWidget::ExtensionWidget extension, Blokkal::Ui::EditEntryWidget *parent) |
virtual Blokkal::Io::EntryJob * | createJob (Blokkal::Entry::JobType type)=0 |
QDateTime | date (void) const |
QString | fileName (bool check=FALSE) const |
virtual KIcon | icon (void) const |
QString | id (void) const |
bool | isDirty (void) const |
virtual void | merge (const Blokkal::Entry *entry) |
virtual QString | preview (void) const |
bool | saveAs (const QString &fileName) |
void | setCategories (const QStringList &ids) |
void | setDate (const QDateTime &date) |
void | setDirty (bool dirty) |
void | setSubject (const QString &subject) |
void | setText (const QString &text) |
virtual QString | subject (void) const |
virtual QString | text (void) const |
KUrl | url (void) const |
Blokkal::Ui::View * | view (void) |
virtual | ~Entry (void) |
Static Public Member Functions | |
static Blokkal::Entry * | open (const QString &fileName, bool *canceled=0, bool neverAsk=FALSE) |
Protected Member Functions | |
Entry (Blog *parentBlog, const QString &id=QString::null, const KUrl &url=KUrl()) | |
virtual void | readProperties (void) |
virtual void | saveProperties (void) |
void | setFileName (const QString &fileName) const |
Detailed Description
This class is a base for all protocol implementations of a blog entry.This class is a base for all protocol implementations of a blog entry.
Definition at line 47 of file blokkalentry.h.
Member Enumeration Documentation
Enumeration for Job types.
- Enumerator:
-
PostJob Id for a job that posts or edits an entry. DeleteJob Id for a job that deletes an entry. UserJob First type available for custom purposes.
Definition at line 54 of file blokkalentry.h.
Constructor & Destructor Documentation
Blokkal::Entry::~Entry | ( | void | ) | [virtual] |
Destroys the entry object. If a view does still exist, it will be deleted.
- Note:
- Do not delete the entry directly, use ref() and deref() instead. Also, the entry will delete itself when its view has been destroyed and it is not waiting for calls to deref().
Definition at line 71 of file blokkalentry.cpp.
Blokkal::Entry::Entry | ( | Blog * | parentBlog, | |
const QString & | id = QString::null , |
|||
const KUrl & | url = KUrl() | |||
) | [protected] |
Creates a new Entry object. id specifies the id of this entry. QString::null is considered an invalid id, given to entries that have not yet been posted to the server. This is the only check performed on this value, so you are free to use anything as an id for an entry.
- Parameters:
-
parentBlog the blog this entry belongs to id the id of the entry url url of this entry
Definition at line 55 of file blokkalentry.cpp.
Member Function Documentation
Blokkal::Blog * Blokkal::Entry::blog | ( | void | ) | const |
Returns a pointer to the parent blog object.
- Returns:
- the parent blog
Definition at line 82 of file blokkalentry.cpp.
QStringList Blokkal::Entry::categories | ( | void | ) | const |
Returns the ids of the categories this entry belongs to.
- Returns:
- ids of the categories this entry belongs to
Definition at line 319 of file blokkalentry.cpp.
Blokkal::Ui::EntryExtensionWidget * Blokkal::Entry::createExtensionWidget | ( | Ui::EntryExtensionWidget::ExtensionWidget | extension, | |
Blokkal::Ui::EditEntryWidget * | parent | |||
) | [virtual] |
Returns the widget associated with extension. The default implementation returns 0 for all values of extension
- Parameters:
-
extension the identifier for the widget to create parent the parent widget
- Returns:
- the widget associated with extension.
Definition at line 314 of file blokkalentry.cpp.
virtual Blokkal::Io::EntryJob* Blokkal::Entry::createJob | ( | Blokkal::Entry::JobType | type | ) | [pure virtual] |
Creates and returns a job of type
- Returns:
- a job of type
QDateTime Blokkal::Entry::date | ( | void | ) | const |
This method returns the date of the entry.
- Returns:
- the date
Definition at line 150 of file blokkalentry.cpp.
void Blokkal::Entry::deref | ( | void | ) | [slot] |
Decresases te reference counter. If it reaches 0 and no view is active for this entry, this entry is deleted.
Definition at line 177 of file blokkalentry.cpp.
void Blokkal::Entry::entryDestroyed | ( | Blokkal::Entry * | entry | ) | [signal] |
This signal is emitted, when an entry is beeing deleted.
- Parameters:
-
entry the entry about to be destroyed
QString Blokkal::Entry::fileName | ( | bool | check = FALSE |
) | const |
Returns the name of the file this entry has been loaded from or the name of the last file this entry has been saved to. This method returns QString::null if this entry has never been saved to or loaded from a file. This method also returns QString::null if the file this entry has been saved to has been removed or cannot be found for some other reason if check is TRUE
- Parameters:
-
check if TRUE, checks if the file really exists
- Returns:
- the filename
Definition at line 185 of file blokkalentry.cpp.
KIcon Blokkal::Entry::icon | ( | void | ) | const [virtual] |
This method returns the icon of the entry.
- Returns:
- the entry icon
Definition at line 87 of file blokkalentry.cpp.
QString Blokkal::Entry::id | ( | void | ) | const |
bool Blokkal::Entry::isDirty | ( | void | ) | const |
This method returns TRUE if it has been marked with setDirty() to be in a state where it needs to be saved to a file or to be posted to the server
- Returns:
- TRUE if contents is dirty
Definition at line 374 of file blokkalentry.cpp.
void Blokkal::Entry::merge | ( | const Blokkal::Entry * | entry | ) | [virtual] |
Merges the content of entry into this entry. This method copies the basic attributes of an entry: date, subject, text, categories. This method will not copy the id or the categories of entry. If you want to iverride this method, make sure you call this implementation to make sure the basic properties are merged properly.
- Parameters:
-
entry source entry
Definition at line 367 of file blokkalentry.cpp.
Blokkal::Entry * Blokkal::Entry::open | ( | const QString & | fileName, | |
bool * | canceled = 0 , |
|||
bool | neverAsk = FALSE | |||
) | [static] |
Loads an entry from the file fileName. If an error occured, this method returns 0. This method attempts to find the correct blog of this entry according to the information found in the file. If this fails, a dialog will ask the user to specify the correct blog. The entry object will be created by the parent blog, that was picked either by the user or according to the information stored in the file.
- Parameters:
-
fileName name of the file to read the entry from canceled if this parameter is not 0, it will be set to TRUE if the user cancels the process and to FALSE otherwise neverAsk nerver ask the user to specify the correct blog
- Returns:
- the entry or 0 if an error occured.
Definition at line 220 of file blokkalentry.cpp.
QString Blokkal::Entry::preview | ( | void | ) | const [virtual] |
This method returns a prieview of the event. The default implementation returns subject() unless the returned string is empty. In that case the first 100 characters of text() are taken. If the event text is empty as well, i18n( ">No Subject>" ) is returned.
Definition at line 115 of file blokkalentry.cpp.
void Blokkal::Entry::readProperties | ( | void | ) | [protected, virtual] |
This method is called right after the entry has been loaded and restored from disk. You do not need to reimplement this method if you access all relevant data with readEntry(). The default implementation does nothing.
Definition at line 393 of file blokkalentry.cpp.
void Blokkal::Entry::ref | ( | void | ) | [slot] |
Increases the reference counter. Do not forget to call deref() for every ref()
Definition at line 172 of file blokkalentry.cpp.
bool Blokkal::Entry::saveAs | ( | const QString & | fileName | ) |
Saves this entry to the fileName.
- Parameters:
-
fileName the name of the target file
- Returns:
- FALSE if the document could not be saved
Definition at line 201 of file blokkalentry.cpp.
void Blokkal::Entry::saveProperties | ( | void | ) | [protected, virtual] |
This method is called right before this entry is saved to disk. You do not need to reimplement this method if you store all relevant properties with writeEntry() and readEntry(). The default implementation does nothing.
Definition at line 389 of file blokkalentry.cpp.
void Blokkal::Entry::setCategories | ( | const QStringList & | ids | ) |
Sets the ids of the categories this entry belongs to.
- Parameters:
-
ids ids of the categories this entry belongs to
Definition at line 339 of file blokkalentry.cpp.
void Blokkal::Entry::setDate | ( | const QDateTime & | date | ) |
This method sets the date of the entry.
- Parameters:
-
date the new date
Definition at line 162 of file blokkalentry.cpp.
void Blokkal::Entry::setDirty | ( | bool | dirty | ) |
Marks this entry as dirty.
- See also:
- isDirty()
- Parameters:
-
dirty TRUE to mark this entry as dirty
Definition at line 379 of file blokkalentry.cpp.
void Blokkal::Entry::setFileName | ( | const QString & | fileName | ) | const [protected] |
Sets the filename, this method is used internally when an entry is being saved to or loaded from a file.
- Parameters:
-
fileName the file name
Definition at line 196 of file blokkalentry.cpp.
void Blokkal::Entry::setSubject | ( | const QString & | subject | ) |
This method sets the subject of the entry.
- Parameters:
-
subject the new subject
Definition at line 137 of file blokkalentry.cpp.
void Blokkal::Entry::setText | ( | const QString & | text | ) |
This method sets the text of the entry.
- Parameters:
-
text the new text
Definition at line 97 of file blokkalentry.cpp.
QString Blokkal::Entry::subject | ( | void | ) | const [virtual] |
This method returns the subject of the entry.
- Returns:
- the subject
Definition at line 109 of file blokkalentry.cpp.
QString Blokkal::Entry::text | ( | void | ) | const [virtual] |
This method returns the text of the entry
- Returns:
- the text of the entry
Definition at line 92 of file blokkalentry.cpp.
KUrl Blokkal::Entry::url | ( | void | ) | const |
Returns the url of this entry This method is used by BrowseEntryView.
- See also:
- Blog::supportedBrowseModes()
- Returns:
- the Url of this entry
Definition at line 384 of file blokkalentry.cpp.
Blokkal::Ui::View * Blokkal::Entry::view | ( | void | ) |
Returns the view for this entry.
Definition at line 167 of file blokkalentry.cpp.
The documentation for this class was generated from the following files: