[SCM] ktp-text-ui packaging branch, master, updated. debian/15.12.1-1-1918-gdf4b0ec

Maximiliano Curia maxy at moszumanska.debian.org
Sat May 28 00:18:19 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-text-ui.git;a=commitdiff;h=b53f4b5

The following commit has been merged in the master branch:
commit b53f4b51ae557abee1c7e61ad750389b4f83ff14
Author: Dominik Schmidt <ich at dominik-schmidt.de>
Date:   Mon Oct 4 00:57:36 2010 +0000

    Add another ctor to the plist file reader, which accepts QByteArray fileContent.
    
    This is needed for bundleName extraction out of archives without the need to unpack them.
    
    svn path=/trunk/playground/network/telepathy-chat-handler/; revision=1182259
---
 lib/chatstyleplistfilereader.cpp | 36 +++++++++++++++++++++++++++++-------
 lib/chatstyleplistfilereader.h   |  7 +++++--
 2 files changed, 34 insertions(+), 9 deletions(-)

diff --git a/lib/chatstyleplistfilereader.cpp b/lib/chatstyleplistfilereader.cpp
index 4c7b7ac..f95f123 100644
--- a/lib/chatstyleplistfilereader.cpp
+++ b/lib/chatstyleplistfilereader.cpp
@@ -25,24 +25,44 @@
 #include <QVariant>
 #include <QDebug>
 
-ChatStylePlistFileReader::ChatStylePlistFileReader(QString fileName)
+ChatStylePlistFileReader::ChatStylePlistFileReader(const QString &fileName)
 {
-    readFile(fileName);
+    QFile bla(fileName);
+
+    readAndParseFile(bla);
+}
+
+ChatStylePlistFileReader::ChatStylePlistFileReader(const QByteArray& fileContent)
+{
+    QDomDocument document;
+    document.setContent(fileContent);
+
+    parse(document);
 }
 
-void ChatStylePlistFileReader::readFile(QString &fileName)
+int ChatStylePlistFileReader::readAndParseFile(QFile& file)
 {
-    QFile file(fileName);
+    QDomDocument document;
 
-    QDomDocument document = QDomDocument();
     if (!file.open(QIODevice::ReadOnly)) {
-        return;
+        return 1;
     } if (!document.setContent(&file)) {
         file.close();
-        return;
+        return 2;
     }
     file.close();
 
+    if(!parse(document)) {
+        // everything ok
+        return 0;
+    } else {
+        // parse failed
+        return 3;
+    }
+}
+
+int ChatStylePlistFileReader::parse(const QDomDocument &document)
+{
     QString key, value;
     QDomNodeList keyElements = document.elementsByTagName("key");
     for (int i = 0; i < keyElements.size(); i++) {
@@ -52,6 +72,8 @@ void ChatStylePlistFileReader::readFile(QString &fileName)
             data.insert(key, value);
         }
     }
+
+    return 0;
 }
 
 ChatStylePlistFileReader::~ChatStylePlistFileReader()
diff --git a/lib/chatstyleplistfilereader.h b/lib/chatstyleplistfilereader.h
index 81a914a..488a940 100644
--- a/lib/chatstyleplistfilereader.h
+++ b/lib/chatstyleplistfilereader.h
@@ -25,13 +25,15 @@
 class QString;
 class QFile;
 class QVariant;
+class QDomDocument;
 
 
 class ChatStylePlistFileReader
 {
 
 public:
-    ChatStylePlistFileReader(QString fileName);
+    ChatStylePlistFileReader(const QString &fileName);
+    ChatStylePlistFileReader(const QByteArray &file);
     virtual ~ChatStylePlistFileReader();
 
     QString CFBundleGetInfoString();
@@ -45,7 +47,8 @@ public:
 
 private:
     QMap<QString, QVariant> data;
-    void readFile(QString& fileName);
+    int readAndParseFile(QFile &file);
+    int parse(const QDomDocument &document);
 };
 
 #endif // CHATSTYLEPLISTFILEREADER_H

-- 
ktp-text-ui packaging



More information about the pkg-kde-commits mailing list