diff --git a/src/chatviewcommon.cpp b/src/chatviewcommon.cpp index 83fd57e6..e59ed2a3 100644 --- a/src/chatviewcommon.cpp +++ b/src/chatviewcommon.cpp @@ -84,7 +84,7 @@ QString ChatViewCommon::getMucNickColor(const QString &nick, bool isSelf) return nickColors[it.value() % (nickColors.size() - 1)]; } while (false); - return QLatin1String("#000000"); // FIXME it's bad for fallback color + return qApp->palette().color(QPalette::Inactive, QPalette::WindowText).name(); } void ChatViewCommon::addUser(const QString &nickname) { } diff --git a/src/chatviewtheme.cpp b/src/chatviewtheme.cpp index a1854992..e95bbb0b 100644 --- a/src/chatviewtheme.cpp +++ b/src/chatviewtheme.cpp @@ -555,7 +555,10 @@ QVariantMap ChatViewJSLoader::checkFilesExist(const QStringList &files, const QS QStringList ChatViewJSLoader::listFiles() { QScopedPointer loader(Theme(theme).resourceLoader()); - return loader->listAll(); + if (loader) { + return loader->listAll(); + } + return {}; } QString ChatViewJSLoader::getFileContents(const QString &name) const { return QString(Theme(theme).loadData(name)); } diff --git a/src/chatviewthemeprovider.cpp b/src/chatviewthemeprovider.cpp index 60f723dc..fed93523 100644 --- a/src/chatviewthemeprovider.cpp +++ b/src/chatviewthemeprovider.cpp @@ -60,7 +60,8 @@ const QStringList ChatViewThemeProvider::themeIds() const QString typeName = tDirInfo.fileName(); foreach (QFileInfo themeInfo, QDir(tDirInfo.absoluteFilePath()).entryInfoList(QDir::AllDirs | QDir::NoDotAndDotDot) - + QDir(tDirInfo.absoluteFilePath()).entryInfoList(QStringList("*.theme"), QDir::Files)) { + + QDir(tDirInfo.absoluteFilePath()) + .entryInfoList(QStringList { { "*.theme", "*.zip" } }, QDir::Files)) { ret << (QString("%1/%2").arg(typeName, themeInfo.fileName())); // qDebug("found theme: %s", qPrintable(QString("%1/%2").arg(typeName).arg(themeInfo.fileName()))); } diff --git a/src/theme.cpp b/src/theme.cpp index 34ed4b8d..bcf04b6b 100644 --- a/src/theme.cpp +++ b/src/theme.cpp @@ -80,7 +80,8 @@ QWidget *Theme::previewWidget() { return d->previewWidget(); } bool Theme::isCompressed(const QFileInfo &fi) { QString sfx = fi.suffix(); - return fi.isDir() && (sfx == QLatin1String("jisp") || sfx == QLatin1String("zip") || sfx == QLatin1String("theme")); + return fi.isFile() + && (sfx == QLatin1String("jisp") || sfx == QLatin1String("zip") || sfx == QLatin1String("theme")); } bool Theme::isCompressed() const { return isCompressed(QFileInfo(d->filepath)); } @@ -144,9 +145,8 @@ QByteArray Theme::loadData(const QString &fileName, const QString &themePath, bo z.setCaseSensitivity(UnZip::CS_Insensitive); } - QString n = fi.completeBaseName() + '/' + fileName; - if (!z.readFile(n, &ba)) { - n = "/" + fileName; + if (!z.readFile(fileName, &ba)) { + auto n = "/" + fileName; if (loaded) { *loaded = z.readFile(n, &ba); } else { diff --git a/src/theme_p.cpp b/src/theme_p.cpp index 4241ddca..17d4ce0c 100644 --- a/src/theme_p.cpp +++ b/src/theme_p.cpp @@ -172,7 +172,7 @@ Theme::ResourceLoader *ThemePrivate::resourceLoader() const } #ifdef Theme_ZIP else if (Theme::isCompressed(fi)) { - UnZip z; + UnZip z(fi.filePath()); if (z.open()) { if (caseInsensitiveFS) { z.setCaseSensitivity(UnZip::CS_Insensitive); diff --git a/themes/chatview/adium/adapter.js b/themes/chatview/adium/adapter.js index 4f6b5665..0692ca1a 100644 --- a/themes/chatview/adium/adapter.js +++ b/themes/chatview/adium/adapter.js @@ -25,28 +25,36 @@ var adapter = { loadTheme : function(style) { //var chat = chat; var loader = window.srvLoader; + var baseDir = ""; loader.toCache("variant", style); //chat.console("DEBUG: loading " ); loader.setCaseInsensitiveFS(true); loader.setPrepareSessionHtml(true); - loader.setHttpResourcePath("/Contents/Resources"); - //chat.console("DEBUG: loading " + loader.themeId); - var resources = ["FileTransferRequest.html", - "Footer.html", "Header.html", "Status.html", "Topic.html", "Content.html", - "Incoming/Content.html", "Incoming/NextContent.html", - "Incoming/Context.html", "Incoming/NextContext.html", - "Outgoing/Content.html", "Outgoing/NextContent.html", - "Outgoing/Context.html", "Outgoing/NextContext.html"]; - - var toCache = {}; - for (var i=0; i !(path.startsWith("__MACOSX") || path.startsWith(".") || path.endsWith("DS_Store"))); + const value = filesList.find((path)=>path.split("/")[0].toLowerCase().endsWith("adiummessagestyle")); + if (value) { + baseDir = value.split("/")[0] + "/"; + } + loader.setHttpResourcePath("/" + baseDir + "Contents/Resources"); + + //chat.console("DEBUG: loading " + loader.themeId); + var resources = ["FileTransferRequest.html", + "Footer.html", "Header.html", "Status.html", "Topic.html", "Content.html", + "Incoming/Content.html", "Incoming/NextContent.html", + "Incoming/Context.html", "Incoming/NextContext.html", + "Outgoing/Content.html", "Outgoing/NextContent.html", + "Outgoing/Context.html", "Outgoing/NextContext.html"]; + + var toCache = {}; + for (var i=0; i