Hello community, here is the log from the commit of package libkdeedu4 for openSUSE:Factory checked in at 2015-02-11 16:40:28 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libkdeedu4 (Old) and /work/SRC/openSUSE:Factory/.libkdeedu4.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libkdeedu4" Changes: -------- --- /work/SRC/openSUSE:Factory/libkdeedu4/libkdeedu4.changes 2015-01-21 22:12:47.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.libkdeedu4.new/libkdeedu4.changes 2015-02-11 16:40:29.000000000 +0100 @@ -1,0 +2,7 @@ +Sun Feb 1 11:08:05 UTC 2015 - [email protected] + +- Update to KDE Applications 14.12.2 + * KDE Applications 14.12.2 + * See https://www.kde.org/announcements/announce-applications-14.12.2.php + +------------------------------------------------------------------- Old: ---- libkdeedu-14.12.1.tar.xz New: ---- libkdeedu-14.12.2.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libkdeedu4.spec ++++++ --- /var/tmp/diff_new_pack.1tcwU8/_old 2015-02-11 16:40:30.000000000 +0100 +++ /var/tmp/diff_new_pack.1tcwU8/_new 2015-02-11 16:40:30.000000000 +0100 @@ -1,7 +1,7 @@ # # spec file for package libkdeedu4 # -# Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,7 +17,7 @@ Name: libkdeedu4 -Version: 14.12.1 +Version: 14.12.2 Release: 0 Summary: Library for KDE Education Applications License: GPL-2.0+ ++++++ libkdeedu-14.12.1.tar.xz -> libkdeedu-14.12.2.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libkdeedu-14.12.1/keduvocdocument/CMakeLists.txt new/libkdeedu-14.12.2/keduvocdocument/CMakeLists.txt --- old/libkdeedu-14.12.1/keduvocdocument/CMakeLists.txt 2014-11-06 22:31:12.000000000 +0100 +++ new/libkdeedu-14.12.2/keduvocdocument/CMakeLists.txt 2015-01-20 18:20:18.000000000 +0100 @@ -1,4 +1,4 @@ -add_subdirectory(tests) +#add_subdirectory(tests) ########### next target ############### diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libkdeedu-14.12.1/keduvocdocument/keduvoccontainer.cpp new/libkdeedu-14.12.2/keduvocdocument/keduvoccontainer.cpp --- old/libkdeedu-14.12.1/keduvocdocument/keduvoccontainer.cpp 2014-11-06 22:31:12.000000000 +0100 +++ new/libkdeedu-14.12.2/keduvocdocument/keduvoccontainer.cpp 2015-01-20 18:20:18.000000000 +0100 @@ -16,6 +16,7 @@ #include "keduvoccontainer.h" +#include "keduvocdocument.h" #include "keduvocexpression.h" #include <KDebug> @@ -31,6 +32,11 @@ QString m_name; bool m_inPractice; + // The containing document. This is only set for the top lesson, so to + // get to the document, you need to follow the parent pointer to the top + // container. + KEduVocDocument *m_document; + // other lessons in the tree KEduVocContainer *m_parentContainer; QList < KEduVocContainer * > m_childContainers; @@ -49,6 +55,23 @@ qDeleteAll(m_childContainers); } + +// This is a private constructor only used by KEduVocDocument when creating +// the top level lesson. +KEduVocContainer::KEduVocContainer(const QString& name, EnumContainerType type, + KEduVocDocument *document) + : d( new Private ) +{ + d->m_parentContainer = 0; + d->m_name = name; + d->m_inPractice = true; + d->m_type = type; + d->m_childLessonEntriesValid = false; + + d->m_document = document; +} + + KEduVocContainer::KEduVocContainer(const QString& name, EnumContainerType type, KEduVocContainer *parent) : d( new Private ) { @@ -57,6 +80,8 @@ d->m_inPractice = true; d->m_type = type; d->m_childLessonEntriesValid = false; + + d->m_document = 0; } KEduVocContainer::KEduVocContainer( const KEduVocContainer &other ) @@ -74,6 +99,17 @@ delete d; } +KEduVocDocument *KEduVocContainer::document() const +{ + KEduVocContainer *cont = (KEduVocContainer *)this; + while (cont->d->m_parentContainer) { + cont = cont->d->m_parentContainer; + } + + Q_ASSERT(cont->d->m_document); + return cont->d->m_document; +} + void KEduVocContainer::appendChildContainer(KEduVocContainer * child) { d->m_childContainers.append(child); @@ -280,4 +316,6 @@ foreach (KEduVocExpression *entry, entries(recursive)) { entry->resetGrades(translation); } + + document()->setModified(true); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libkdeedu-14.12.1/keduvocdocument/keduvoccontainer.h new/libkdeedu-14.12.2/keduvocdocument/keduvoccontainer.h --- old/libkdeedu-14.12.1/keduvocdocument/keduvoccontainer.h 2014-11-06 22:31:12.000000000 +0100 +++ new/libkdeedu-14.12.2/keduvocdocument/keduvoccontainer.h 2015-01-20 18:20:18.000000000 +0100 @@ -24,6 +24,7 @@ #include <KDE/KUrl> #include <QtCore/QList> +class KEduVocDocument; class KEduVocExpression; /** class to store information about a container - that can be a lesson or word types */ @@ -45,7 +46,8 @@ }; /** default constructor */ - explicit KEduVocContainer(const QString& name, EnumContainerType type, KEduVocContainer *parent = 0); + explicit KEduVocContainer(const QString& name, EnumContainerType type, + KEduVocContainer *parent = 0); void appendChildContainer(KEduVocContainer *child); void insertChildContainer(int row, KEduVocContainer *child); @@ -84,6 +86,9 @@ /** assignment operator */ KEduVocContainer& operator= ( const KEduVocContainer& ); + /** @return the containing KEduVocDocument */ + KEduVocDocument *document() const; + /** set the container name * @param name text to set for the name */ @@ -155,6 +160,9 @@ */ void updateChildLessonEntries(); + // Used by KEduVocLesson when the Document creates the top level lesson. + explicit KEduVocContainer(const QString& name, EnumContainerType type, + KEduVocDocument *document); private: class Private; Private * const d; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libkdeedu-14.12.1/keduvocdocument/keduvocdocument.cpp new/libkdeedu-14.12.2/keduvocdocument/keduvocdocument.cpp --- old/libkdeedu-14.12.1/keduvocdocument/keduvocdocument.cpp 2014-11-06 22:31:12.000000000 +0100 +++ new/libkdeedu-14.12.2/keduvocdocument/keduvocdocument.cpp 2015-01-20 18:20:18.000000000 +0100 @@ -77,6 +77,7 @@ KAutoSaveFile *m_autosave; bool m_dirty; ///<dirty bit + bool m_isReadOnly; // save these to document QList<KEduVocIdentifier> m_identifiers; ///<list of identifiers @@ -117,7 +118,9 @@ * @param flags Describes how to deal with locked file etc. * @return ErrorCode where NoError is success * */ - KEduVocDocument::ErrorCode initializeKAutoSave(KAutoSaveFile &autosave, QString const &fpath, FileHandlingFlags flags) const; + KEduVocDocument::ErrorCode initializeKAutoSave(KAutoSaveFile &autosave, + QString const &fpath, + FileHandlingFlags flags) const; }; KEduVocDocument::KEduVocDocumentPrivate::~KEduVocDocumentPrivate() @@ -133,7 +136,9 @@ void KEduVocDocument::KEduVocDocumentPrivate::init() { delete m_lessonContainer; - m_lessonContainer = new KEduVocLesson(i18nc("The top level lesson which contains all other lessons of the document.", "Document Lesson")); + m_lessonContainer = new KEduVocLesson(i18nc("The top level lesson which contains all other lessons of the document.", + "Document Lesson"), + q); m_lessonContainer->setContainerType(KEduVocLesson::Lesson); delete m_wordTypeContainer; m_wordTypeContainer = new KEduVocWordType(i18n( "Word types" )); @@ -146,6 +151,7 @@ m_extraSizeHints.clear(); m_sizeHints.clear(); m_dirty = false; + m_isReadOnly = false; m_queryorg = ""; m_querytrans = ""; m_autosave->setManagedFile( i18n( "Untitled" ) ); @@ -188,7 +194,8 @@ KEduVocDocument::KEduVocDocument( QObject *parent ) - : QObject( parent ), d( new KEduVocDocumentPrivate( this ) ) + : QObject(parent) + , d(new KEduVocDocumentPrivate(this)) { } @@ -243,9 +250,17 @@ return FileDoesNotExist; } - ErrorCode autosaveError = d->initializeKAutoSave( *d->m_autosave, temporaryFile, flags ); - if ( autosaveError != NoError) { - return autosaveError; + if (flags & FileOpenReadOnly) { + d->m_isReadOnly = true; + } + + ErrorCode autosaveError = NoError; + + if (!d->m_isReadOnly) { + autosaveError = d->initializeKAutoSave( *d->m_autosave, temporaryFile, flags ); + if ( autosaveError != NoError) { + return autosaveError; + } } QIODevice * f = KFilterDev::deviceForFile( temporaryFile ); @@ -275,8 +290,11 @@ return errStatus; } -void KEduVocDocument::close() { - d->m_autosave->releaseLock(); +void KEduVocDocument::close() +{ + if (!d->m_isReadOnly) { + d->m_autosave->releaseLock(); + } } /// @todo When the API major version number increments remove this function @@ -292,8 +310,12 @@ return err; } -KEduVocDocument::ErrorCode KEduVocDocument::saveAs( const KUrl & url, FileType ft, FileHandlingFlags flags) +KEduVocDocument::ErrorCode KEduVocDocument::saveAs( const KUrl & url, FileType ft, + FileHandlingFlags flags) { + if (d->m_isReadOnly) { + return FileIsReadOnly; + } KUrl tmp( url ); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libkdeedu-14.12.1/keduvocdocument/keduvocdocument.h new/libkdeedu-14.12.2/keduvocdocument/keduvocdocument.h --- old/libkdeedu-14.12.1/keduvocdocument/keduvocdocument.h 2014-11-06 22:31:12.000000000 +0100 +++ new/libkdeedu-14.12.2/keduvocdocument/keduvocdocument.h 2015-01-20 18:20:18.000000000 +0100 @@ -74,14 +74,16 @@ 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 + 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 + FileIgnoreLock = 0x1, ///< Ignore the file lock + FileOpenReadOnly = 0x2 ///< Open without any intention to change and save back later. }; /// used as parameter for pattern diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libkdeedu-14.12.1/keduvocdocument/keduvoclesson.cpp new/libkdeedu-14.12.2/keduvocdocument/keduvoclesson.cpp --- old/libkdeedu-14.12.1/keduvocdocument/keduvoclesson.cpp 2014-11-06 22:31:12.000000000 +0100 +++ new/libkdeedu-14.12.2/keduvocdocument/keduvoclesson.cpp 2015-01-20 18:20:18.000000000 +0100 @@ -34,6 +34,13 @@ { } +// Private constructor only used by KEduVocDocument when creating the top level lesson. +KEduVocLesson::KEduVocLesson(const QString& name, KEduVocDocument *document) + : KEduVocContainer(name, Lesson, document) + , d(new Private) +{ +} + KEduVocLesson::KEduVocLesson( const KEduVocLesson &other ) : KEduVocContainer(other), d( new Private ) @@ -48,6 +55,8 @@ delete d; } + + QList<KEduVocExpression*> KEduVocLesson::entries(EnumEntriesRecursive recursive) { if (recursive == Recursive) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libkdeedu-14.12.1/keduvocdocument/keduvoclesson.h new/libkdeedu-14.12.2/keduvocdocument/keduvoclesson.h --- old/libkdeedu-14.12.1/keduvocdocument/keduvoclesson.h 2014-11-06 22:31:12.000000000 +0100 +++ new/libkdeedu-14.12.2/keduvocdocument/keduvoclesson.h 2015-01-20 18:20:18.000000000 +0100 @@ -75,6 +75,11 @@ void removeEntry(KEduVocExpression* entry); private: + friend class KEduVocDocument; + // This constructor is used by KEduVocDocument when creating the top level lesson. + explicit KEduVocLesson(const QString& name, KEduVocDocument *document); + +private: class Private; Private * const d; }; -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
