]> Git trees. - libqmvoc.git/commitdiff
Add an author contact info field - this will ease the creation of kns2 meta data...
authorFrederik Gladhorn <gladhorn@kde.org>
Mon, 21 Apr 2008 12:12:07 +0000 (12:12 +0000)
committerFrederik Gladhorn <gladhorn@kde.org>
Mon, 21 Apr 2008 12:12:07 +0000 (12:12 +0000)
svn path=/trunk/KDE/kdeedu/libkdeedu/; revision=799379

keduvocdocument/keduvocdocument.cpp
keduvocdocument/keduvocdocument.h
keduvocdocument/keduvockvtml2reader.cpp
keduvocdocument/keduvockvtml2writer.cpp
keduvocdocument/kvtml2defs.h

index 1c386cc89928a7d147915bdcf3a630096c2e997a..6bb747a24baa65b9ae19e0244fc236740feb38bb 100644 (file)
@@ -85,6 +85,7 @@ public:
 
     QString                   m_title;
     QString                   m_author;
+    QString                   m_authorContact;
     QString                   m_license;
     QString                   m_comment;
     QString                   m_version;
@@ -746,25 +747,37 @@ void KEduVocDocument::setUrl( const KUrl& url )
 
 QString KEduVocDocument::title() const
 {
-    if ( d->m_lessonContainer->name().isEmpty() )
+    if ( d->m_title.isEmpty() )
         return d->m_url.fileName();
     else
         return d->m_title;
 }
 
-
 void KEduVocDocument::setTitle( const QString & title )
 {
     d->m_title = title;
     d->m_lessonContainer->setName(title);
 }
 
-
 QString KEduVocDocument::author() const
 {
     return d->m_author;
 }
 
+void KEduVocDocument::setAuthor( const QString & s )
+{
+    d->m_author = s.simplified();
+}
+
+QString KEduVocDocument::authorContact() const
+{
+    return d->m_authorContact;
+}
+
+void KEduVocDocument::setAuthorContact( const QString & s )
+{
+    d->m_authorContact = s.simplified();
+}
 
 QString KEduVocDocument::license() const
 {
@@ -802,10 +815,7 @@ void KEduVocDocument::setQueryIdentifier( const QString &org, const QString &tra
 }
 
 
-void KEduVocDocument::setAuthor( const QString & s )
-{
-    d->m_author = s.simplified();
-}
+
 
 
 void KEduVocDocument::setLicense( const QString & s )
index 5e05a1a42169c0e3431c7634d50d91bd3cfbfba9..a2067283ca08b5befe9847a1a634c49012d925e5 100644 (file)
@@ -159,6 +159,13 @@ public:
     /** @returns the author of the file */
     QString author() const;
 
+    /** set the author contact info
+     * @param 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 );
index 789c83edd55e42c3556d79baf2b74032236709f7..d3801d450503e91a9ebf628dcb110382571d71a0 100644 (file)
@@ -114,6 +114,11 @@ bool KEduVocKvtml2Reader::readInformation( QDomElement &informationElement )
         m_doc->setAuthor( currentElement.text() );
     }
 
+    currentElement = informationElement.firstChildElement( KVTML_AUTHORCONTACT );
+    if ( !currentElement.isNull() ) {
+        m_doc->setAuthorContact( currentElement.text() );
+    }
+
     // read the license
     currentElement = informationElement.firstChildElement( KVTML_LICENSE );
     if ( !currentElement.isNull() ) {
index 4a1b30e7157b39a002565f5b30c9dc8b3c14004d..64ee0c45a40853ed99a345b688b87f5695447d1a 100644 (file)
@@ -112,6 +112,11 @@ bool KEduVocKvtml2Writer::writeInformation( QDomElement &informationElement, con
         informationElement.appendChild( newTextElement( KVTML_AUTHOR, m_doc->author() ) );
     }
 
+    // author contact (mail/homepage)
+    if ( !m_doc->authorContact().isEmpty() ) {
+        informationElement.appendChild( newTextElement( KVTML_AUTHORCONTACT, m_doc->authorContact() ) );
+    }
+
     // license
     if ( !m_doc->license().isEmpty() ) {
         informationElement.appendChild( newTextElement( KVTML_LICENSE, m_doc->license() ) );
index ac816a2be991d5eb36eb4634188141e774cda393..c4dd6177d5334a7b74efa4643f5a801c64a4cc60 100644 (file)
@@ -26,6 +26,7 @@
 #define KVTML_GENERATOR         "generator"
 #define KVTML_TITLE             "title"
 #define KVTML_AUTHOR            "author"
+#define KVTML_AUTHORCONTACT     "contact"
 #define KVTML_LICENSE           "license"
 #define KVTML_COMMENT           "comment"
 #define KVTML_CATEGORY          "category"