[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:21:33 UTC 2016


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

The following commit has been merged in the master branch:
commit 6bd8af097273c5b5f968a64960541a84e1577ca0
Author: Daniele E. Domenichelli <daniele.domenichelli at gmail.com>
Date:   Tue Mar 13 03:02:30 2012 +0100

    Fix indentation
---
 lib/chat-window-style-manager.cpp | 241 +++++++++++++++++++-------------------
 1 file changed, 120 insertions(+), 121 deletions(-)

diff --git a/lib/chat-window-style-manager.cpp b/lib/chat-window-style-manager.cpp
index 985b8cc..b12f609 100644
--- a/lib/chat-window-style-manager.cpp
+++ b/lib/chat-window-style-manager.cpp
@@ -111,130 +111,129 @@ QMap<QString, QString> ChatWindowStyleManager::getAvailableStyles() const
 
 int ChatWindowStyleManager::installStyle(const QString &styleBundlePath)
 {
-   QString localStyleDir;
-   KStandardDirs::locateLocal("data", QLatin1String("ktelepathy/styles/"));
-   QStringList chatStyles = KGlobal::dirs()->findDirs("data", QLatin1String("ktelepathy/styles"));
-   // findDirs returns preferred paths first, let's check if one of them is writable
-   Q_FOREACH(const QString& styleDir, chatStyles) {
+    QString localStyleDir;
+    KStandardDirs::locateLocal("data", QLatin1String("ktelepathy/styles/"));
+    QStringList chatStyles = KGlobal::dirs()->findDirs("data", QLatin1String("ktelepathy/styles"));
+    // findDirs returns preferred paths first, let's check if one of them is writable
+    Q_FOREACH(const QString& styleDir, chatStyles) {
         kDebug() << styleDir;
-       if (QFileInfo(styleDir).isWritable()) {
-           localStyleDir = styleDir;
-           break;
-       }
-   }
-   if (localStyleDir.isEmpty()) { // none of dirs is writable
-       kDebug()<< "not writable";
-       return StyleNoDirectoryValid;
-   }
-
-   KArchiveEntry *currentEntry = 0L;
-   KArchiveDirectory *currentDir = 0L;
-   KArchive *archive = 0L;
-
-   QString currentBundleMimeType = KMimeType::findByPath(styleBundlePath, 0, false)->name();
-   if (currentBundleMimeType == QLatin1String("application/zip")) {
-       archive = new KZip(styleBundlePath);
-   } else if (currentBundleMimeType == QLatin1String("application/x-compressed-tar") ||
-              currentBundleMimeType == QLatin1String("application/x-bzip-compressed-tar") ||
-              currentBundleMimeType == QLatin1String("application/x-gzip") ||
-              currentBundleMimeType == QLatin1String("application/x-bzip")) {
-       archive = new KTar(styleBundlePath);
-   } else if (currentBundleMimeType == QLatin1String("application/octet-stream")) {
-       archive = new KZip(styleBundlePath);
-       if (!archive->open(QIODevice::ReadOnly)) {
-           delete archive;
-           kDebug() << "!zip";
-           archive = new KTar(styleBundlePath);
-           if (!archive->open(QIODevice::ReadOnly)) {
-               delete archive;
-               kDebug() << "!tar" << styleBundlePath;
-               return StyleCannotOpen;
-           }
-       }
-
-   } else {
-       kDebug() << "unsupported file type" << currentBundleMimeType;
-       kDebug() << styleBundlePath;
-       return StyleUnknow;
-   }
-
-   if (archive == 0 ||  !archive->open(QIODevice::ReadOnly)) {
-       delete archive;
+        if (QFileInfo(styleDir).isWritable()) {
+            localStyleDir = styleDir;
+            break;
+        }
+    }
+    if (localStyleDir.isEmpty()) { // none of dirs is writable
+        kDebug()<< "not writable";
+        return StyleNoDirectoryValid;
+    }
+
+    KArchiveEntry *currentEntry = 0L;
+    KArchiveDirectory *currentDir = 0L;
+    KArchive *archive = 0L;
+
+    QString currentBundleMimeType = KMimeType::findByPath(styleBundlePath, 0, false)->name();
+    if (currentBundleMimeType == QLatin1String("application/zip")) {
+        archive = new KZip(styleBundlePath);
+    } else if (currentBundleMimeType == QLatin1String("application/x-compressed-tar") ||
+               currentBundleMimeType == QLatin1String("application/x-bzip-compressed-tar") ||
+               currentBundleMimeType == QLatin1String("application/x-gzip") ||
+               currentBundleMimeType == QLatin1String("application/x-bzip")) {
+        archive = new KTar(styleBundlePath);
+    } else if (currentBundleMimeType == QLatin1String("application/octet-stream")) {
+        archive = new KZip(styleBundlePath);
+        if (!archive->open(QIODevice::ReadOnly)) {
+            delete archive;
+            kDebug() << "!zip";
+            archive = new KTar(styleBundlePath);
+            if (!archive->open(QIODevice::ReadOnly)) {
+                delete archive;
+                kDebug() << "!tar" << styleBundlePath;
+                return StyleCannotOpen;
+            }
+        }
+    } else {
+        kDebug() << "unsupported file type" << currentBundleMimeType;
+        kDebug() << styleBundlePath;
+        return StyleUnknow;
+    }
+
+    if (archive == 0 ||  !archive->open(QIODevice::ReadOnly)) {
+        delete archive;
         kDebug() << "cannot open theme file";
-       return StyleCannotOpen;
-   }
-
-   const KArchiveDirectory *rootDir = archive->directory();
-
-   // Ok where we go to check if the archive is valid.
-   // Each time we found a correspondance to a theme bundle, we add a point to validResult.
-   // A valid style bundle must have:
-   // -a Contents, Contents/Resources, Co/Res/Incoming, Co/Res/Outgoing dirs
-   // main.css, Footer.html, Header.html, Status.html files in Contents/Resources.
-   // So for a style bundle to be valid, it must have a result greather than 8, because we test for 8 required entry.
-   int validResult = 0;
-   const QStringList entries = rootDir->entries();
-   // Will be reused later.
-   QStringList::ConstIterator entriesIt;
-   for (entriesIt = entries.begin(); entriesIt != entries.end(); ++entriesIt) {
-       currentEntry = const_cast<KArchiveEntry*>(rootDir->entry(*entriesIt));
-   kDebug() << "Current entry name: " << currentEntry->name();
-       if (currentEntry->isDirectory()) {
-           currentDir = dynamic_cast<KArchiveDirectory*>(currentEntry);
-           if (currentDir) {
-               if (currentDir->entry(QLatin1String("Contents"))) {
-                  kDebug() << "Contents found";
-                   validResult += 1;
-               }
-               if (currentDir->entry(QLatin1String("Contents/Resources"))) {
-                  kDebug() << "Contents/Resources found";
+        return StyleCannotOpen;
+    }
+
+    const KArchiveDirectory *rootDir = archive->directory();
+
+    // Ok where we go to check if the archive is valid.
+    // Each time we found a correspondance to a theme bundle, we add a point to validResult.
+    // A valid style bundle must have:
+    // -a Contents, Contents/Resources, Co/Res/Incoming, Co/Res/Outgoing dirs
+    // main.css, Footer.html, Header.html, Status.html files in Contents/Resources.
+    // So for a style bundle to be valid, it must have a result greather than 8, because we test for 8 required entry.
+    int validResult = 0;
+    const QStringList entries = rootDir->entries();
+    // Will be reused later.
+    QStringList::ConstIterator entriesIt;
+    for (entriesIt = entries.begin(); entriesIt != entries.end(); ++entriesIt) {
+        currentEntry = const_cast<KArchiveEntry*>(rootDir->entry(*entriesIt));
+    kDebug() << "Current entry name: " << currentEntry->name();
+        if (currentEntry->isDirectory()) {
+            currentDir = dynamic_cast<KArchiveDirectory*>(currentEntry);
+            if (currentDir) {
+                if (currentDir->entry(QLatin1String("Contents"))) {
+                   kDebug() << "Contents found";
                    validResult += 1;
-               }
-           }
-       }
-   }
-  kDebug() << "Valid result: " << QString::number(validResult);
-   // The archive is a valid style bundle.
-   if (validResult >= 2) {
-       bool installOk = false;
-       for (entriesIt = entries.begin(); entriesIt != entries.end(); ++entriesIt) {
-           currentEntry = const_cast<KArchiveEntry*>(rootDir->entry(*entriesIt));
-           if (currentEntry && currentEntry->isDirectory()) {
-               // Ignore this MacOS X "garbage" directory in zip.
-               if (currentEntry->name() == QLatin1String("__MACOSX")) {
-                   continue;
-               } else {
-                   currentDir = dynamic_cast<KArchiveDirectory*>(currentEntry);
-                   if (currentDir) {
-                       currentDir->copyTo(localStyleDir + currentDir->name());
-                       installOk = true;
-                   }
-               }
-           }
-       }
-
-       archive->close();
-       delete archive;
-
-       if (installOk) {
-           return StyleInstallOk;
-       } else {
-           return StyleUnknow;
-       }
-   } else {
-       archive->close();
-       delete archive;
-
-       kDebug() << "style not valid";
-       return StyleNotValid;
-   }
-
-   if (archive) {
-       archive->close();
-       delete archive;
-   }
-
-   return StyleUnknow;
+                }
+                if (currentDir->entry(QLatin1String("Contents/Resources"))) {
+                    kDebug() << "Contents/Resources found";
+                    validResult += 1;
+                }
+            }
+        }
+    }
+    kDebug() << "Valid result: " << QString::number(validResult);
+    // The archive is a valid style bundle.
+    if (validResult >= 2) {
+        bool installOk = false;
+        for (entriesIt = entries.begin(); entriesIt != entries.end(); ++entriesIt) {
+            currentEntry = const_cast<KArchiveEntry*>(rootDir->entry(*entriesIt));
+            if (currentEntry && currentEntry->isDirectory()) {
+                // Ignore this MacOS X "garbage" directory in zip.
+                if (currentEntry->name() == QLatin1String("__MACOSX")) {
+                    continue;
+                } else {
+                    currentDir = dynamic_cast<KArchiveDirectory*>(currentEntry);
+                    if (currentDir) {
+                        currentDir->copyTo(localStyleDir + currentDir->name());
+                        installOk = true;
+                    }
+                }
+            }
+        }
+
+        archive->close();
+        delete archive;
+
+        if (installOk) {
+            return StyleInstallOk;
+        } else {
+            return StyleUnknow;
+        }
+    } else {
+        archive->close();
+        delete archive;
+
+        kDebug() << "style not valid";
+        return StyleNotValid;
+    }
+
+    if (archive) {
+        archive->close();
+        delete archive;
+    }
+
+    return StyleUnknow;
 }
 
 bool ChatWindowStyleManager::removeStyle(const QString &styleId)

-- 
ktp-text-ui packaging



More information about the pkg-kde-commits mailing list