[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:17:32 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-text-ui.git;a=commitdiff;h=d127a65
The following commit has been merged in the master branch:
commit d127a650542b32da2d2b2fd737726073e5b9f976
Author: David Edmundson <kde at davidedmundson.co.uk>
Date: Sun Sep 19 18:37:44 2010 +0000
Get style name from .plist file and use this in config UI.
svn path=/trunk/playground/network/telepathy-chat-handler/; revision=1177204
---
config/mainwindow.cpp | 36 +++-
config/mainwindow.h | 2 +-
lib/chatstyleplistfilereader.cpp | 16 +-
lib/chatstyleplistfilereader.h | 4 +-
lib/chatview.cpp | 3 -
lib/chatwindowstylemanager.cpp | 394 ++++++++++++++++++++-------------------
lib/chatwindowstylemanager.h | 2 +-
7 files changed, 243 insertions(+), 214 deletions(-)
diff --git a/config/mainwindow.cpp b/config/mainwindow.cpp
index 355732a..8e13bb5 100644
--- a/config/mainwindow.cpp
+++ b/config/mainwindow.cpp
@@ -32,7 +32,7 @@ MainWindow::MainWindow(QWidget *parent) :
ui->showHeader->setChecked(ui->chatView->isHeaderDisplayed());
connect(ui->chatView, SIGNAL(loadFinished(bool)), SLOT(sendDemoMessages()));
- connect(ui->styleComboBox, SIGNAL(activated(QString)), SLOT(onStyleSelected(QString)));
+ connect(ui->styleComboBox, SIGNAL(activated(int)), SLOT(onStyleSelected(int)));
connect(ui->variantComboBox, SIGNAL(activated(QString)), SLOT(onVariantSelected(QString)));
connect(ui->showHeader,SIGNAL(clicked(bool)), SLOT(onShowHeaderChanged(bool)));
}
@@ -59,11 +59,22 @@ void MainWindow::onStylesLoaded()
{
kDebug();
- QStringList styles = ChatWindowStyleManager::self()->getAvailableStyles();
+ QMap<QString, QString> styles = ChatWindowStyleManager::self()->getAvailableStyles();
ChatWindowStyle *currentStyle = ui->chatView->chatStyle();
- ui->styleComboBox->addItems(styles);
- ui->styleComboBox->setCurrentItem(currentStyle->getStyleName());
+ QMap<QString, QString>::const_iterator i = styles.constBegin();
+ while (i != styles.constEnd()) {
+ ui->styleComboBox->addItem(i.value(), i.key());
+
+ if(i.key() == currentStyle->getStyleName())
+ {
+ ui->styleComboBox->setCurrentItem(i.value());
+ }
+
+ ++i;
+ }
+
+ //ui->styleComboBox->setCurrentItem(currentStyle->getStyleName());
updateVariantsList();
//FIXME call onStyleSelected
@@ -83,15 +94,20 @@ void MainWindow::updateVariantsList()
}
-void MainWindow::onStyleSelected(const QString & styleName)
+void MainWindow::onStyleSelected(int index)
{
kDebug();
//load the style.
- ChatWindowStyle* style = ChatWindowStyleManager::self()->getValidStyleFromPool(styleName);
- ui->chatView->setChatStyle(style);
- updateVariantsList();
- ui->showHeader->setEnabled(style->hasHeader());
+ QString styleId = ui->styleComboBox->itemData(index).toString();
+
+ ChatWindowStyle* style = ChatWindowStyleManager::self()->getValidStyleFromPool(styleId);
+ if (style)
+ {
+ ui->chatView->setChatStyle(style);
+ updateVariantsList();
+ ui->showHeader->setEnabled(style->hasHeader());
+ }
}
void MainWindow::onVariantSelected(const QString &variant)
@@ -141,7 +157,7 @@ void MainWindow::accept()
//KConfig config(KGlobal::dirs()->findResource("config","ktelepathyrc"));
KConfigGroup appearanceConfig = config->group("Appearance");
- appearanceConfig.writeEntry("styleName", ui->styleComboBox->currentText());
+ appearanceConfig.writeEntry("styleName", ui->styleComboBox->itemData(ui->styleComboBox->currentIndex()).toString());
appearanceConfig.writeEntry("styleVariant", ui->variantComboBox->currentText());
appearanceConfig.writeEntry("displayHeader", ui->showHeader->isChecked());
diff --git a/config/mainwindow.h b/config/mainwindow.h
index 253fdbe..31c08cb 100644
--- a/config/mainwindow.h
+++ b/config/mainwindow.h
@@ -28,7 +28,7 @@ private slots:
void onStylesLoaded();
void updateVariantsList();
- void onStyleSelected(const QString&);
+ void onStyleSelected(int index);
void onVariantSelected(const QString&);
void onShowHeaderChanged(bool);
};
diff --git a/lib/chatstyleplistfilereader.cpp b/lib/chatstyleplistfilereader.cpp
index f3a21e5..5e77f30 100644
--- a/lib/chatstyleplistfilereader.cpp
+++ b/lib/chatstyleplistfilereader.cpp
@@ -23,6 +23,7 @@
#include <QFile>
#include <QDomDocument>
#include <QVariant>
+#include <QDebug>
ChatStylePlistFileReader::ChatStylePlistFileReader(QString fileName)
{
@@ -32,20 +33,21 @@ ChatStylePlistFileReader::ChatStylePlistFileReader(QString fileName)
void ChatStylePlistFileReader::readFile(QString &fileName)
{
QFile file(fileName);
-
+
QDomDocument document = QDomDocument();
if (!file.open(QIODevice::ReadOnly))
+ {
+ return;
+ }if (!document.setContent(&file)) {
+ file.close();
return;
- if (!document.setContent(&file)) {
- file.close();
- return;
}
file.close();
-
+
QString key, value;
QDomNodeList keyElements = document.elementsByTagName("key");
- for(int i=0;i<keyElements.size();i++) {
- if(keyElements.at(i).nextSibling().toElement().tagName() != "key") {
+ for (int i = 0; i < keyElements.size(); i++) {
+ if (keyElements.at(i).nextSibling().toElement().tagName() != "key") {
key = keyElements.at(i).toElement().text();
value = keyElements.at(i).nextSibling().toElement().text();
data.insert(key, value);
diff --git a/lib/chatstyleplistfilereader.h b/lib/chatstyleplistfilereader.h
index 753cfc6..81a914a 100644
--- a/lib/chatstyleplistfilereader.h
+++ b/lib/chatstyleplistfilereader.h
@@ -41,8 +41,8 @@ public:
int defaultFontSize();
QString defaultVariant();
int messageViewVersion();
-
-
+
+
private:
QMap<QString, QVariant> data;
void readFile(QString& fileName);
diff --git a/lib/chatview.cpp b/lib/chatview.cpp
index eb46fb9..cbe775f 100644
--- a/lib/chatview.cpp
+++ b/lib/chatview.cpp
@@ -100,9 +100,6 @@ void ChatView::initialise(const TelepathyChatInfo &chatInfo)
//hidden HTML debugging mode. Should have no visible way to turn it on.
if (m_webInspector) {
QWebSettings::globalSettings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);
- QWebInspector* inspector = new QWebInspector(0);
- inspector->setPage(page());
- inspector->show();
}
}
diff --git a/lib/chatwindowstylemanager.cpp b/lib/chatwindowstylemanager.cpp
index f3c2c49..3592efa 100644
--- a/lib/chatwindowstylemanager.cpp
+++ b/lib/chatwindowstylemanager.cpp
@@ -16,6 +16,7 @@
*/
#include "chatwindowstylemanager.h"
+#include "chatstyleplistfilereader.h"
// Qt includes
#include <QStack>
@@ -52,9 +53,9 @@ public:
}
KDirLister *styleDirLister;
- QStringList availableStyles;
+ QMap <QString, QString > availableStyles;
- // key = style name, value = ChatWindowStyle instance
+ // key = style id, value = ChatWindowStyle instance
QHash<QString, ChatWindowStyle*> stylePool;
QStack<KUrl> styleDirs;
@@ -101,189 +102,189 @@ void ChatWindowStyleManager::loadStyles()
d->styleDirLister->openUrl(d->styleDirs.pop(), KDirLister::Keep);
}
-QStringList ChatWindowStyleManager::getAvailableStyles() const
+QMap<QString, QString> ChatWindowStyleManager::getAvailableStyles() const
{
return d->availableStyles;
}
int ChatWindowStyleManager::installStyle(const QString &styleBundlePath)
{
- QString localStyleDir;
- QStringList chatStyles = KGlobal::dirs()->findDirs("appdata", QLatin1String("styles"));
- // findDirs returns preferred paths first, let's check if one of them is writable
- foreach(const QString& styleDir, chatStyles) {
- if (QFileInfo(styleDir).isWritable()) {
- localStyleDir = styleDir;
- break;
- }
- }
- if (localStyleDir.isEmpty()) { // none of dirs is writable
- return StyleNoDirectoryValid;
- }
-
- KArchiveEntry *currentEntry = 0L;
- KArchiveDirectory* currentDir = 0L;
- KArchive *archive = 0L;
-
- // Find mimetype for current bundle. ZIP and KTar need separate constructor
- QString currentBundleMimeType = KMimeType::findByPath(styleBundlePath, 0, false)->name();
- if (currentBundleMimeType == "application/zip") {
- archive = new KZip(styleBundlePath);
- } else if (currentBundleMimeType == "application/x-compressed-tar" || currentBundleMimeType == "application/x-bzip-compressed-tar" || currentBundleMimeType == "application/x-gzip" || currentBundleMimeType == "application/x-bzip") {
- archive = new KTar(styleBundlePath);
- } else {
- return StyleCannotOpen;
- }
-
- if (!archive->open(QIODevice::ReadOnly)) {
- delete archive;
-
- 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, entriesItEnd = entries.end();
- 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(QString::fromUtf8("Contents"))) {
-// kDebug() << "Contents found";
- validResult += 1;
- }
- if (currentDir->entry(QString::fromUtf8("Contents/Resources"))) {
-// kDebug() << "Contents/Resources found";
- validResult += 1;
- }
- if (currentDir->entry(QString::fromUtf8("Contents/Resources/Incoming"))) {
-// kDebug() << "Contents/Resources/Incoming found";
- validResult += 1;
- }
- if (currentDir->entry(QString::fromUtf8("Contents/Resources/Outgoing"))) {
-// kDebug() << "Contents/Resources/Outgoing found";
- validResult += 1;
- }
- if (currentDir->entry(QString::fromUtf8("Contents/Resources/main.css"))) {
-// kDebug() << "Contents/Resources/main.css found";
- validResult += 1;
- }
- if (currentDir->entry(QString::fromUtf8("Contents/Resources/Footer.html"))) {
-// kDebug() << "Contents/Resources/Footer.html found";
- validResult += 1;
- }
- if (currentDir->entry(QString::fromUtf8("Contents/Resources/Status.html"))) {
-// kDebug() << "Contents/Resources/Status.html found";
- validResult += 1;
- }
- if (currentDir->entry(QString::fromUtf8("Contents/Resources/Header.html"))) {
-// kDebug() << "Contents/Resources/Header.html found";
- validResult += 1;
- }
- if (currentDir->entry(QString::fromUtf8("Contents/Resources/Incoming/Content.html"))) {
-// kDebug() << "Contents/Resources/Incoming/Content.html found";
- validResult += 1;
- }
- if (currentDir->entry(QString::fromUtf8("Contents/Resources/Outgoing/Content.html"))) {
-// kDebug() << "Contents/Resources/Outgoing/Content.html found";
- validResult += 1;
- }
- }
- }
- }
-// kDebug() << "Valid result: " << QString::number(validResult);
- // The archive is a valid style bundle.
- if (validResult >= 8) {
- 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() == QString::fromUtf8("__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;
-
- return StyleNotValid;
- }
-
- if (archive) {
- archive->close();
- delete archive;
- }
-
- return StyleUnknow;
+// QString localStyleDir;
+// QStringList chatStyles = KGlobal::dirs()->findDirs("appdata", QLatin1String("styles"));
+// // findDirs returns preferred paths first, let's check if one of them is writable
+// foreach(const QString& styleDir, chatStyles) {
+// if (QFileInfo(styleDir).isWritable()) {
+// localStyleDir = styleDir;
+// break;
+// }
+// }
+// if (localStyleDir.isEmpty()) { // none of dirs is writable
+// return StyleNoDirectoryValid;
+// }
+
+// KArchiveEntry *currentEntry = 0L;
+// KArchiveDirectory* currentDir = 0L;
+// KArchive *archive = 0L;
+
+// // Find mimetype for current bundle. ZIP and KTar need separate constructor
+// QString currentBundleMimeType = KMimeType::findByPath(styleBundlePath, 0, false)->name();
+// if (currentBundleMimeType == "application/zip") {
+// archive = new KZip(styleBundlePath);
+// } else if (currentBundleMimeType == "application/x-compressed-tar" || currentBundleMimeType == "application/x-bzip-compressed-tar" || currentBundleMimeType == "application/x-gzip" || currentBundleMimeType == "application/x-bzip") {
+// archive = new KTar(styleBundlePath);
+// } else {
+// return StyleCannotOpen;
+// }
+
+// if (!archive->open(QIODevice::ReadOnly)) {
+// delete archive;
+
+// 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, entriesItEnd = entries.end();
+// 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(QString::fromUtf8("Contents"))) {
+//// kDebug() << "Contents found";
+// validResult += 1;
+// }
+// if (currentDir->entry(QString::fromUtf8("Contents/Resources"))) {
+//// kDebug() << "Contents/Resources found";
+// validResult += 1;
+// }
+// if (currentDir->entry(QString::fromUtf8("Contents/Resources/Incoming"))) {
+//// kDebug() << "Contents/Resources/Incoming found";
+// validResult += 1;
+// }
+// if (currentDir->entry(QString::fromUtf8("Contents/Resources/Outgoing"))) {
+//// kDebug() << "Contents/Resources/Outgoing found";
+// validResult += 1;
+// }
+// if (currentDir->entry(QString::fromUtf8("Contents/Resources/main.css"))) {
+//// kDebug() << "Contents/Resources/main.css found";
+// validResult += 1;
+// }
+// if (currentDir->entry(QString::fromUtf8("Contents/Resources/Footer.html"))) {
+//// kDebug() << "Contents/Resources/Footer.html found";
+// validResult += 1;
+// }
+// if (currentDir->entry(QString::fromUtf8("Contents/Resources/Status.html"))) {
+//// kDebug() << "Contents/Resources/Status.html found";
+// validResult += 1;
+// }
+// if (currentDir->entry(QString::fromUtf8("Contents/Resources/Header.html"))) {
+//// kDebug() << "Contents/Resources/Header.html found";
+// validResult += 1;
+// }
+// if (currentDir->entry(QString::fromUtf8("Contents/Resources/Incoming/Content.html"))) {
+//// kDebug() << "Contents/Resources/Incoming/Content.html found";
+// validResult += 1;
+// }
+// if (currentDir->entry(QString::fromUtf8("Contents/Resources/Outgoing/Content.html"))) {
+//// kDebug() << "Contents/Resources/Outgoing/Content.html found";
+// validResult += 1;
+// }
+// }
+// }
+// }
+//// kDebug() << "Valid result: " << QString::number(validResult);
+// // The archive is a valid style bundle.
+// if (validResult >= 8) {
+// 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() == QString::fromUtf8("__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;
+
+// return StyleNotValid;
+// }
+
+// if (archive) {
+// archive->close();
+// delete archive;
+// }
+
+// return StyleUnknow;
}
-bool ChatWindowStyleManager::removeStyle(const QString &styleName)
+bool ChatWindowStyleManager::removeStyle(const QString &styleId)
{
- kDebug(14000) << styleName;
- // Find for the current style in avaiableStyles map.
- int foundStyleIdx = d->availableStyles.indexOf(styleName);
-
- if (foundStyleIdx != -1) {
- d->availableStyles.removeAt(foundStyleIdx);
-
- // Remove and delete style from pool if needed.
- if (d->stylePool.contains(styleName)) {
- ChatWindowStyle *deletedStyle = d->stylePool[styleName];
- d->stylePool.remove(styleName);
- delete deletedStyle;
- }
-
- QStringList styleDirs = KGlobal::dirs()->findDirs("appdata", QString("styles/%1").arg(styleName));
- if (styleDirs.isEmpty()) {
- kDebug(14000) << "Failed to find style" << styleName;
- return false;
- }
-
- // attempt to delete all dirs with this style
- int numDeleted = 0;
- foreach(const QString& stylePath, styleDirs) {
- KUrl urlStyle(stylePath);
- // Do the actual deletion of the directory style.
- if (KIO::NetAccess::del(urlStyle, 0))
- numDeleted++;
- }
- return numDeleted == styleDirs.count();
- } else {
- return false;
- }
+// kDebug(14000) << styleId;
+// // Find for the current style in avaiableStyles map.
+// int foundStyleIdx = d->availableStyles.indexOf(styleId);
+
+// if (foundStyleIdx != -1) {
+// d->availableStyles.removeAt(foundStyleIdx);
+
+// // Remove and delete style from pool if needed.
+// if (d->stylePool.contains(styleId)) {
+// ChatWindowStyle *deletedStyle = d->stylePool[styleId];
+// d->stylePool.remove(styleId);
+// delete deletedStyle;
+// }
+
+// QStringList styleDirs = KGlobal::dirs()->findDirs("appdata", QString("styles/%1").arg(styleId));
+// if (styleDirs.isEmpty()) {
+// kDebug(14000) << "Failed to find style" << styleId;
+// return false;
+// }
+
+// // attempt to delete all dirs with this style
+// int numDeleted = 0;
+// foreach(const QString& stylePath, styleDirs) {
+// KUrl urlStyle(stylePath);
+// // Do the actual deletion of the directory style.
+// if (KIO::NetAccess::del(urlStyle, 0))
+// numDeleted++;
+// }
+// return numDeleted == styleDirs.count();
+// } else {
+// return false;
+// }
}
-ChatWindowStyle *ChatWindowStyleManager::getValidStyleFromPool(const QString &styleName)
+ChatWindowStyle *ChatWindowStyleManager::getValidStyleFromPool(const QString &styleId)
{
ChatWindowStyle *style = 0;
- style = getStyleFromPool(styleName);
+ style = getStyleFromPool(styleId);
if (style)
return style;
@@ -305,10 +306,10 @@ ChatWindowStyle *ChatWindowStyleManager::getValidStyleFromPool(const QString &st
return 0;
}
-ChatWindowStyle *ChatWindowStyleManager::getStyleFromPool(const QString &styleName)
+ChatWindowStyle *ChatWindowStyleManager::getStyleFromPool(const QString &styleId)
{
- if (d->stylePool.contains(styleName)) {
- kDebug(14000) << styleName << " was on the pool";
+ if (d->stylePool.contains(styleId)) {
+ kDebug(14000) << styleId << " was on the pool";
// NOTE: This is a hidden config switch for style developers
// Check in the config if the cache is disabled.
@@ -316,22 +317,22 @@ ChatWindowStyle *ChatWindowStyleManager::getStyleFromPool(const QString &styleNa
KConfigGroup config(KGlobal::config(), "KopeteStyleDebug");
bool disableCache = config.readEntry("disableStyleCache", false);
if (disableCache) {
- d->stylePool[styleName]->reload();
+ d->stylePool[styleId]->reload();
}
- return d->stylePool[styleName];
+ return d->stylePool[styleId];
}
// Build a chat window style and list its variants, then add it to the pool.
- ChatWindowStyle *style = new ChatWindowStyle(styleName, ChatWindowStyle::StyleBuildNormal);
+ ChatWindowStyle *style = new ChatWindowStyle(styleId, ChatWindowStyle::StyleBuildNormal);
if (!style->isValid()) {
- kDebug(14000) << styleName << " is invalid style!";
+ kDebug(14000) << styleId << " is invalid style!";
delete style;
return 0;
}
- d->stylePool.insert(styleName, style);
- kDebug(14000) << styleName << " is just created";
+ d->stylePool.insert(styleId, style);
+ kDebug(14000) << styleId << " is just created";
return style;
}
@@ -344,18 +345,31 @@ void ChatWindowStyleManager::slotNewStyles(const KFileItemList &dirList)
kDebug(14000) << "Listing: " << item.url().fileName();
// If the style path is already in the pool, that's mean the style was updated on disk
// Reload the style
- QString styleName = item.url().fileName();
- if (d->stylePool.contains(styleName)) {
- kDebug(14000) << "Updating style: " << styleName;
+ QString styleId = item.url().fileName();
+ if (d->stylePool.contains(styleId)) {
+ kDebug(14000) << "Updating style: " << styleId;
+
+ d->stylePool[styleId]->reload();
- d->stylePool[styleName]->reload();
+ // Add to available if required.
+ if (! d->availableStyles.contains(styleId))
+ {
- // Add to avaialble if required.
- if (d->availableStyles.indexOf(styleName) == -1)
- d->availableStyles.append(styleName);
+ //FIXME this code is in two places.. this sucks!!!
+ ChatStylePlistFileReader plistReader(item.url().path().append("/Contents/Info.plist"));
+ QString styleName = plistReader.CFBundleName();
+ if (plistReader.CFBundleName().isEmpty()) {
+ styleName = styleId;
+ }
+ d->availableStyles.insert(styleId, styleName);
+ }
} else {
- // TODO: Use name from Info.plist
- d->availableStyles.append(styleName);
+ ChatStylePlistFileReader plistReader(item.url().path().append("/Contents/Info.plist"));
+ QString styleName = plistReader.CFBundleName();
+ if (plistReader.CFBundleName().isEmpty()) {
+ styleName = styleId;
+ }
+ d->availableStyles.insert(styleId, styleName);
}
}
}
diff --git a/lib/chatwindowstylemanager.h b/lib/chatwindowstylemanager.h
index 83b25f5..350a612 100644
--- a/lib/chatwindowstylemanager.h
+++ b/lib/chatwindowstylemanager.h
@@ -76,7 +76,7 @@ public:
/**
* Get all available styles.
*/
- QStringList getAvailableStyles() const;
+ QMap<QString, QString> getAvailableStyles() const;
public slots:
/**
--
ktp-text-ui packaging
More information about the pkg-kde-commits
mailing list