/usr/include/libkdeedu/keduvocdocument.h is in libkdeedu-dev 4:15.12.3-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 | /***************************************************************************
Vocabulary Document for KDE Edu
-----------------------------------------------------------------------
copyright : (C) 1999-2001 Ewald Arnold <kvoctrain@ewald-arnold.de>
(C) 2005, 2007 Peter Hedlund <peter.hedlund@kdemail.net>
(C) 2007 Frederik Gladhorn <frederik.gladhorn@kdemail.net>
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef KEDUVOCDOCUMENT_H
#define KEDUVOCDOCUMENT_H
#include "libkeduvocdocument_export.h"
#include "keduvocidentifier.h"
#include "keduvocarticle.h"
#include "keduvocconjugation.h"
#include <QtCore/QObject>
#include <QtCore/QList>
#include <QtCore/QMap>
#include <KDE/KUrl>
class QStringList;
class KEduVocExpression;
class KEduVocLesson;
class KEduVocWordType;
class KEduVocLeitnerBox;
/**
* @brief The primary entry point to the hierarchy of objects describing vocabularies.
* @details This class contains the expressions of your vocabulary
* as well as other information about the vocabulary.
*/
class KEDUVOCDOCUMENT_EXPORT KEduVocDocument : public QObject
{
Q_OBJECT
public:
///@todo in new API change enums to QFlags
/// known vocabulary file types
enum FileType {
KvdNone, ///< handles nothing
Automatic, ///< try to automatically determine file type
Kvtml, ///< Kvtml 2.0
Wql, ///< Word Quiz format
Pauker, ///< Pauker format
Vokabeln, ///< Vokabeln format
Xdxf, ///< XDXF format @see https://github.com/soshial/xdxf_makedict/blob/master/format_standard/xdxf_strict.dtd
Csv, ///< Command separated values
Kvtml1 ///< KVTML 1.0
};
/// the return code when opening/saving
enum ErrorCode {
NoError = 0, ///< no error
Unknown, ///< unspecified error
InvalidXml, ///< malformed xml or bad file formatting
FileTypeUnknown, ///< unknown file type
FileCannotWrite, ///< unwritable file
FileWriterFailed, ///< file writer failed
FileCannotRead, ///< unreadable file
FileReaderFailed, ///< file reader failed
FileDoesNotExist, ///< unknown file type
FileLocked, ///< An autosave file exists for this document
FileCannotLock, ///< Can't create an autosave file for this document
FileIsReadOnly ///< Can't save this file because it was opened read-only
};
/// indicates file open/save status locking or readonly
enum FileHandlingFlags
{
FileDefaultHandling = 0x0, ///< Default status
FileIgnoreLock = 0x1, ///< Ignore the file lock
FileOpenReadOnly = 0x2 ///< Open without any intention to change and save back later. This also implies FileIgnoreLock.
};
/// used as parameter for pattern
enum FileDialogMode
{
Reading,
Writing
};
/// delete only empty lessons or also if they have entries
enum LessonDeletion
{
DeleteEmptyLesson,
DeleteEntriesAndLesson
};
/**
* Constructor for a KDEEdu vocabulary document
*
* @param parent calling object
*/
explicit KEduVocDocument( QObject* parent = 0 );
/**
* Destructor
*/
~KEduVocDocument();
/** @name Whole Document Methods
* Methods related to saving/loading and locating the document
* @nosubgrouping
*/
///@{
/**
* Opens and locks a document file
*
* @param url url to file to open
* @returns ErrorCode
*/
int open( const KUrl& url );
/**
* Opens and locks a document file
*
* Note: This is intended to be preserve binary compatible with int open(const KUrl&)
* When the API increments the major version number, then merge them
*
* @param url url to file to open
* @param flags How to handle expected unusual conditions (i.e. locking)
* @returns ErrorCode
*/
ErrorCode open( const KUrl& url, FileHandlingFlags flags /*= FileDefaultHandling*/);
/**
* Close a document file and release the lock on the file
*
*/
void close();
/**
* Saves the data under the given name
*
* This does not set the generator of the document, just writes it to file.
*
* @param url if url is empty (or NULL) actual name is preserved
* @param ft the filetype to be used when saving the document
* @param generator the name of the application saving the document
* @returns ErrorCode
*/
int saveAs( const KUrl & url, FileType ft, const QString & generator );
/**
* Saves the data under the given name
*
* @pre generator is set.
*
* Note: This is intended to be preserve binary compatible with
* int saveAs(const KUrl&, FileType ft, const QString & generator );
* When the API increments the major version number, then merge them
*
* @param url if url is empty (or NULL) actual name is preserved
* @param ft the filetype to be used when saving the document
* @param flags How to handle expected unusual conditions (i.e. locking)
* @returns ErrorCode
*/
ErrorCode saveAs( const KUrl & url, FileType ft, FileHandlingFlags flags /*= FileDefaultHandling*/);
/** @details returns a QByteArray KVTML2 representation of this doc
* @param generator name of the application creating the QByteArray
* @return KVTML2 XML
* @todo in new API if this should be part of save*/
QByteArray toByteArray(const QString &generator);
/**
* Merges data from another document (UNIMPLEMENTED)
*
* @param docToMerge document containing the data to be merged
* @param matchIdentifiers if true only entries having identifiers present in the
* current document will be mergedurl is empty (or NULL) actual name is preserved
*/
void merge( KEduVocDocument *docToMerge, bool matchIdentifiers );
/**
* Indicates if the document is modified
*
* @param dirty new state
*/
void setModified( bool dirty = true );
/** @returns the modification state of the doc */
bool isModified() const;
/**
* Sets the URL of the XML file
* @param url URL
*/
void setUrl( const KUrl& url );
/** @returns the URL of the XML file */
KUrl url() const;
///@}
/** @name General Document Properties
*
*/
///@{
/** Set the title of the file
* @param title title to set */
void setTitle( const QString & title );
/** @returns the title of the file */
QString title() const;
/** Set the author of the file
* @param author author to set */
void setAuthor( const QString & author );
/** @returns the author of the file */
QString author() const;
/** Set the author contact info
* @param authorContact contact email/contact info to set */
void setAuthorContact( const QString & authorContact );
/** @returns the author contact information */
QString authorContact() const;
/** Set the license of the file
* @param license license to set */
void setLicense( const QString & license );
/** @returns the license of the file */
QString license() const;
/** Set the comment of the file
* @param comment comment to set */
void setDocumentComment( const QString & comment );
/** @return the comment of the file */
QString documentComment() const;
/** Set the category of the file
* @param category category to set */
void setCategory( const QString & category );
/** @return the category of the file */
QString category() const;
/**
* Sets the generator of the file
* @param generator name of the application generating the file
*/
void setGenerator( const QString & generator );
/** @returns the generator of the file */
QString generator() const;
/** Sets version of the loaded file
* @param ver the new version */
void setVersion( const QString & ver );
/** @returns the version of the loaded file */
QString version() const;
///@}
/** @name Identifier Methods
*
*/
///@{
/**
* @returns the number of different identifiers (usually languages)
*/
int identifierCount() const;
/**
* Appends a new identifier (usually a language)
*
* @param identifier the identifier to append. If empty default names are used.
* @returns the identifier number
*/
int appendIdentifier( const KEduVocIdentifier & identifier = KEduVocIdentifier());
/**
* Sets the identifier of translation
*
* @param index number of translation 0..x
* @param lang the language identifier: en=english, de=german, ...
*/
void setIdentifier( int index, const KEduVocIdentifier& lang );
/**
* Returns the identifier of translation @p index
*
* @param index number of translation 0..x
* @returns the language identifier: en=english, de=german, ...
*/
KEduVocIdentifier& identifier( int index );
/**
* Const overload of identifier(int);
* @param index of the identifier
* @return reference to the identifier
*/
const KEduVocIdentifier& identifier( int index ) const;
/**
* Removes identifier and the according translation in all entries
*
* @param index number of translation 0..x
*/
void removeIdentifier( int index );
/**
* Determines the index of a given identifier
*
* @param name identifier of language
* @returns index of identifier, 0 = original, 1..n = translation, -1 = not found
*/
int indexOfIdentifier( const QString &name ) const;
///@}
/** @name Grade Methods
*
*/
///@{
/**
* Retrieves the identifiers for the current query
* not written in the new version!
*
* @param org identifier for original
* @param trans identifier for translation
*/
KDE_DEPRECATED void queryIdentifier( QString &org, QString &trans ) const;
/**
* Sets the identifiers for the current query
* not written in the new version!
*
* @param org identifier for original
* @param trans identifier for translation
*/
KDE_DEPRECATED void setQueryIdentifier( const QString &org, const QString &trans );
///@}
/** @name Lesson Methods
*
*/
///@{
/** @brief Get the lesson root object
* @returns a pointer to the lesson object
*/
KEduVocLesson * lesson();
/** @brief Returns the root word type object
@return poitner to the internal word type object */
KEduVocWordType * wordTypeContainer();
/** @brief Returns the root Leitner container
@return poitner to the internal Leitner container object
@todo in new API determine if this is used */
KEduVocLeitnerBox * leitnerContainer();
///@}
/** @name File Format Specific Methods
*
*/
///@{
/**
* Returns the delimiter (separator) used for csv import and export.
* The default is a single tab character
*
* @returns the delimiter used
*/
QString csvDelimiter() const;
/**
* Sets the delimiter (separator) used for csv import and export
*
* @param delimiter the delimiter to use
*/
void setCsvDelimiter( const QString &delimiter );
///@}
/**
* @details Detects the file type
* @param fileName filename
* @return enum of filetype
*/
static FileType detectFileType( const QString &fileName );
/**
* Create a string with the supported document types, that can be used
* as filter in KFileDialog. It includes also an entry to match all the
* supported types.
*
* @param mode the mode for the supported document types
* @returns the filter string
*/
static QString pattern( FileDialogMode mode );
/**
* @brief Returns a QString description of the errorCode
* @param errorCode the code
* @returns a user useful error string.
*/
static QString errorDescription( int errorCode );
Q_SIGNALS:
/**
* @brief never used
* @param curr_percent
*/
void progressChanged( KEduVocDocument *, int curr_percent );
/**
* @brief Emitted when the document becomes modified or saved.
* @param mod the current modified/dirty state
* @returns state (true=modified)
*/
void docModified( bool mod );
private:
// The private data of this - see KEduVocDocument::Private, implemented in keduvocdocument.cpp
class KEduVocDocumentPrivate;
KEduVocDocumentPrivate* const d; ///< d pointer to private class
Q_DISABLE_COPY( KEduVocDocument )
};
#endif // KEDUVOCDOCUMENT_H
|