aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/theme/ThemeFunctions.cpp
diff options
context:
space:
mode:
authorGravatar Szymon Tomasz Stefanek2015-08-27 04:16:03 +0200
committerGravatar Szymon Tomasz Stefanek2015-08-27 04:16:03 +0200
commitb59a43f57ecc290d6798a29402256c169f5b1bd2 (patch)
tree33a115a647c2a8acdf38181026b141407dc12ffd /src/modules/theme/ThemeFunctions.cpp
parentMerge branch 'master' of https://github.com/kvirc/KVIrc (diff)
downloadKVIrc-b59a43f57ecc290d6798a29402256c169f5b1bd2.tar.gz
KVIrc-b59a43f57ecc290d6798a29402256c169f5b1bd2.tar.bz2
KVIrc-b59a43f57ecc290d6798a29402256c169f5b1bd2.zip
More work on theme packing
Diffstat (limited to 'src/modules/theme/ThemeFunctions.cpp')
-rw-r--r--src/modules/theme/ThemeFunctions.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/modules/theme/ThemeFunctions.cpp b/src/modules/theme/ThemeFunctions.cpp
index d4b349be4..ecd2c880a 100644
--- a/src/modules/theme/ThemeFunctions.cpp
+++ b/src/modules/theme/ThemeFunctions.cpp
@@ -402,7 +402,6 @@ namespace ThemeFunctions
QString &szError
)
{
-
if(szPackagePath.isEmpty())
{
szError = __tr2qs_ctx("Invalid empty package path","theme");
@@ -463,6 +462,20 @@ namespace ThemeFunctions
int iIdx = 0;
for(KviThemeInfo * pInfo = lThemeInfoList.first();pInfo;pInfo = lThemeInfoList.next())
{
+ if(pInfo->name().isEmpty())
+ {
+ szError = __tr2qs_ctx("Invalid theme name","theme");
+ return false;
+ }
+ if(pInfo->version().isEmpty())
+ {
+ szError = __tr2qs_ctx("Invalid theme version","theme");
+ return false;
+ }
+
+ QString szSubdir = pInfo->name() + QString("-") + pInfo->version();
+ szSubdir.replace(QRegExp("[^a-zA-Z0-9_\\-.][^a-zA-Z0-9_\\-.]*"),"_");
+
szTmp = QString("Theme%1Name").arg(iIdx);
f.addInfoField(szTmp,pInfo->name());
szTmp = QString("Theme%1Version").arg(iIdx);
@@ -472,7 +485,7 @@ namespace ThemeFunctions
szTmp = QString("Theme%1Date").arg(iIdx);
f.addInfoField(szTmp,pInfo->date());
szTmp = QString("Theme%1Subdirectory").arg(iIdx);
- f.addInfoField(szTmp,pInfo->subdirectory());
+ f.addInfoField(szTmp,szSubdir);
szTmp = QString("Theme%1Author").arg(iIdx);
f.addInfoField(szTmp,pInfo->author());
szTmp = QString("Theme%1Application").arg(iIdx);
@@ -492,7 +505,7 @@ namespace ThemeFunctions
f.addInfoField(szTmp,pba);
}
- if(!f.addDirectory(pInfo->directory(),pInfo->subdirectory()))
+ if(!f.addDirectory(pInfo->directory(),szSubdir))
{
szError = __tr2qs_ctx("Packaging failed","theme");
szError += ": ";