Logo Search packages:      
Sourcecode: parley version File versions  Download package

Public Types | Public Slots | Public Member Functions | Properties | Private Attributes

Scripting::Document Class Reference

KEduVocDocument wrapping class for Kross scripts. More...

#include <document.h>

List of all members.

Public Types

enum  ErrorCode {
  NoError = 0, Unknown, InvalidXml, FileTypeUnknown,
  FileCannotWrite, FileWriterFailed, FileCannotRead, FileReaderFailed,
  FileDoesNotExist
}
 

the return code when opening/saving


enum  FileDialogMode { Reading, Writing }
 

used as parameter for pattern


enum  FileType {
  KvdNone, Automatic, Kvtml, Wql,
  Pauker, Vokabeln, Xdxf, Csv,
  Kvtml1
}
 

known vocabulary file types


enum  LessonDeletion { DeleteEmptyLesson, DeleteEntriesAndLesson }
 

delete only empty lessons or also if they have entries


Public Slots

QVariantList allLessons ()
int appendIdentifier (Identifier *identifier)
void appendLesson (QObject *lesson)
void appendNewIdentifier (const QString &name, const QString &locale)
QObject * appendNewLesson (const QString &name, Lesson *parent)
QObject * appendNewLesson (const QString &name)
static KEduVocDocument::FileType detectFileType (const QString &fileName)
static QString errorDescription (int errorCode)
QObject * findLesson (const QString &name)
QObject * identifier (int index)
int identifierCount () const
QVariantList identifiers ()
void merge (Document *docToMerge, bool matchIdentifiers)
QObject * newIdentifier ()
QObject * newLesson (const QString &name)
static QString pattern (KEduVocDocument::FileDialogMode mode)
void removeIdentifier (int index)
int saveAs (const QString &url, KEduVocDocument::FileType ft=KEduVocDocument::Automatic, const QString &generator=QString("Parley"))
void setWordType (QObject *tr, const QString &wordtype)
QStringList wordTypes ()

Public Member Functions

QString author () const
QString authorContact () const
QString category () const
QString csvDelimiter () const
 Document (QObject *parent=0)
 Document (KEduVocDocument *doc)
QString documentComment () const
QString generator () const
KEduVocDocument * kEduVocDocument ()
QString license () const
QObject * rootLesson ()
void setAuthor (const QString &author)
void setAuthorContact (const QString &authorContact)
void setCategory (const QString &category)
void setCsvDelimiter (const QString &delimiter)
void setDocumentComment (const QString &comment)
void setGenerator (const QString &generator)
void setLicense (const QString &license)
void setTitle (const QString &title)
void setUrl (const QString &url)
void setVersion (const QString &ver)
QString title () const
QString url () const
QString version () const
KEduVocWordType * wordTypeFromString (const QString &name)

Properties

QString author
 Document author's name.
QString authorContact
 Author contact info (email)
QString category
 Category that the lesson belongs.
QString csvDelimiter
 Delimiter (separator) used for csv import and export.
QString documentComment
 Comment about the document.
QString generator
 Generator program (which program generates this file)
QString license
 Document license.
QObject rootLesson
 Document's root lesson.
QString title
 Document's title.
QString url
 URL of the XML file.
QString version
 Document version.

Private Attributes

KEduVocDocument * m_doc

Detailed Description

KEduVocDocument wrapping class for Kross scripts.

The Document class provides methods and properties for accessing the document lessons, entries, languages, word types and general document parameters. The easiest way of accessing this class is through the Parley.document (Parley.doc) property like in the example.

 #how to get a reference to the Parley's active document
 import Parley
 doc = Parley.doc
 print doc.title, doc.author, doc.authorContact

You can access document lessons with the following ways:

and add a new lesson with

The document identifiers (see Identifier class) can be set by these functions:

and be accessed by:

The saveAs() function can be used to save into a file a newly created document, or the active document. See Parley::newDocument().

Author:
Avgoustinos Kadis <avgoustinos.kadis@kdemail.net>

Definition at line 66 of file document.h.


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

Generated by  Doxygen 1.6.0   Back to index