From 01f27e10bbac962109588fec477ef92237cf569b Mon Sep 17 00:00:00 2001 From: Szymon Tomasz Stefanek Date: Sat, 26 Jun 2010 01:28:32 +0000 Subject: Rework the addon pack dialog. git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@4520 17fca916-40b9-46aa-a4ea-0a15b648b75c --- src/modules/addon/addonfunctions.cpp | 135 ++++++++------------------------ src/modules/addon/addonfunctions.h | 10 --- src/modules/addon/packaddondialog.cpp | 142 +++++++++++++++++----------------- src/modules/addon/packaddondialog.h | 12 +++ src/modules/theme/packthemedialog.cpp | 4 - src/modules/theme/themefunctions.cpp | 31 ++++---- 6 files changed, 131 insertions(+), 203 deletions(-) (limited to 'src/modules') diff --git a/src/modules/addon/addonfunctions.cpp b/src/modules/addon/addonfunctions.cpp index 0505e28f1..f9248e977 100644 --- a/src/modules/addon/addonfunctions.cpp +++ b/src/modules/addon/addonfunctions.cpp @@ -53,6 +53,8 @@ namespace KviAddonFunctions KviPointerHashTable * pInfoFields; QString * pValue; QString szErr; + QPixmap pix; + QByteArray * pByteArray; bool bInstall; KviHtmlDialogData hd; @@ -70,12 +72,17 @@ namespace KviAddonFunctions pInfoFields = r.stringInfoFields(); pValue = pInfoFields->find("PackageType"); + if(!pValue) return notAValidAddonPackage(szError); + + if(!KviQString::equalCI(*pValue,"AddonPack")) + return notAValidAddonPackage(szError); + pValue = pInfoFields->find("AddonPackVersion"); + if(!pValue) return notAValidAddonPackage(szError); - if(!KviQString::equalCI(*pValue,KVI_CURRENT_ADDONS_ENGINE_VERSION))return notAValidAddonPackage(szError); // make sure the default fields exist for(int i=0;i<6;i++) @@ -86,17 +93,28 @@ namespace KviAddonFunctions } // ok.. it should be really valid at this point + // load its picture + pByteArray = r.binaryInfoFields()->find("Image"); + if(pByteArray) + pix.loadFromData(*pByteArray,0,0); + + if(pix.isNull()) + { + // load the default icon + pix = *(g_pIconManager->getBigIcon(KVI_BIGICON_ADDONS)); + } + QString szPackageName; QString szPackageVersion; QString szPackageAuthor; QString szPackageDescription; QString szPackageDate; - QString szPackageAddonEngineVersion; + QString szAddonPackVersion; QString szPackageApplication; QString szAuthor = __tr2qs_ctx("Author","addon"); QString szCreatedAt = __tr2qs_ctx("Created at","addon"); - QString szCreatedOn = __tr2qs_ctx("Created with","Addon"); + QString szCreatedWith = __tr2qs_ctx("Created with","addon"); r.getStringInfoField("Name",szPackageName); r.getStringInfoField("Version",szPackageVersion); @@ -104,63 +122,27 @@ namespace KviAddonFunctions r.getStringInfoField("Description",szPackageDescription); r.getStringInfoField("Application",szPackageApplication); r.getStringInfoField("Date",szPackageDate); + r.getStringInfoField("AddonPackVersion",szAddonPackVersion); QString szWarnings; - QString szDetails = ""; QString szTmp; bool bValid = true; - QString szAddonName; - QString szAddonVersion; - QString szAddonDescription; - QString szAddonDate; - QString szAddonAuthor; - QString szAddonEngineVersion; - QString szAddonApplication; - - r.getStringInfoField("AddonName",szAddonName); - r.getStringInfoField("AddonVersion",szAddonVersion); - r.getStringInfoField("AddonApplication",szAddonApplication); - r.getStringInfoField("AddonDescription",szAddonDescription); - r.getStringInfoField("AddonDate",szAddonDate); - r.getStringInfoField("AddonAuthor",szAddonAuthor); - r.getStringInfoField("AddonAddonEngineVersion",szAddonEngineVersion); - - if(szAddonName.isEmpty() || szAddonVersion.isEmpty() || szAddonEngineVersion.isEmpty()) - bValid = false; - if(KviMiscUtils::compareVersions(szAddonEngineVersion,KVI_CURRENT_ADDONS_ENGINE_VERSION) < 0) + if(szPackageName.isEmpty() || szPackageVersion.isEmpty() || szAddonPackVersion.isEmpty()) bValid = false; - QString szDetailsBuffer; - - getAddonHtmlDescription( - szDetailsBuffer, - szAddonName, - szAddonVersion, - szAddonDescription, - szAddonApplication, - szAddonAuthor, - szAddonDate, - szAddonEngineVersion - ); + if(KviMiscUtils::compareVersions(szAddonPackVersion,KVI_CURRENT_ADDONS_ENGINE_VERSION) < 0) + bValid = false; - szDetails += szDetailsBuffer; if(!bValid) { - szDetails += "

"; - szDetails += __tr2qs_ctx("Warning: The addon might be incompatible with this version of KVIrc","addon"); - szDetails += "

"; + szWarnings += "

"; + szWarnings += __tr2qs_ctx("Warning: The addon might be incompatible with this version of KVIrc","addon"); + szWarnings += "

"; } - szDetails += "

"; - szDetails += __tr2qs_ctx("Go Back to Package Data","addon"); - szDetails += "

"; - szDetails += ""; - - QString szShowDetails = __tr2qs_ctx("Show Details","addon"); - KviQString::sprintf(hd.szHtmlText, "" \ "" \ @@ -184,9 +166,6 @@ namespace KviAddonFunctions "

" \ "%Q" \ "
" \ - "

" \ - "%Q" \ - "

" \ "" \ "", &szPackageName, @@ -196,13 +175,12 @@ namespace KviAddonFunctions &szPackageAuthor, &szCreatedAt, &szPackageDate, - &szCreatedOn, + &szCreatedWith, &szPackageApplication, - &szWarnings, - &szShowDetails + &szWarnings ); - hd.addHtmlResource("addon_dialog_details",szDetails); + hd.addImageResource("addon_dialog_pack_image",pix); hd.addHtmlResource("addon_dialog_main",hd.szHtmlText); QString beginCenter = "
"; @@ -253,7 +231,7 @@ namespace KviAddonFunctions // Now we have all stuff in ~/.config/KVIrc/tmp/$rand if(! KviKvsScript::run( - QString::fromAscii("parse \"%1\\install.kvs\"") + QString::fromAscii("parse \"%1/install.kvs\"") .arg( szUnpackPath .replace("\\","\\\\") @@ -278,55 +256,6 @@ namespace KviAddonFunctions return true; } - void getAddonHtmlDescription( - QString &szBuffer, - const QString &szAddonName, - const QString &szAddonVersion, - const QString &szAddonDescription, - const QString &szAddonApplication, - const QString &szAddonAuthor, - const QString &szAddonDate, - const QString &szAddonAddonEngineVersion - ) - { - QString szAuthor = __tr2qs_ctx("Author","addon"); - QString szCreatedAt = __tr2qs_ctx("Created at","addon"); - QString szCreatedOn = __tr2qs_ctx("Created with","addon"); - QString szAddonEngineVersion = __tr2qs_ctx("Addon Engine Version","addon"); - QString szSubdirectory = __tr2qs_ctx("Subdirectory","addon"); - - KviQString::sprintf( - szBuffer, - "

" \ - "

%Q %Q

" \ - "

" \ - "

" \ - "%Q" \ - "

" \ - "

" \ - "%Q: %Q
" \ - "%Q: %Q
" \ - "

" \ - "

" \ - "" \ - "%Q: %Q
" \ - "%Q: %Q
" \ - "
" \ - "

", - &szAddonName, - &szAddonVersion, - &szAddonDescription, - &szAuthor, - &szAddonAuthor, - &szCreatedAt, - &szAddonDate, - &szCreatedOn, - &szAddonApplication, - &szAddonAddonEngineVersion, - &szAddonAddonEngineVersion - ); - } - QString createRandomDir() { QString szDirName; diff --git a/src/modules/addon/addonfunctions.h b/src/modules/addon/addonfunctions.h index 4a5296d09..40ddbebd8 100644 --- a/src/modules/addon/addonfunctions.h +++ b/src/modules/addon/addonfunctions.h @@ -36,16 +36,6 @@ namespace KviAddonFunctions { bool notAValidAddonPackage(QString & szError); bool installAddonPackage(const QString & szAddonPackageFileName, QString & szError, QWidget * pDialogParent = 0); - void getAddonHtmlDescription( - QString & szBuffer, - const QString & szAddonName, - const QString & szAddonVersion, - const QString & szAddonDescription, - const QString & szAddonApplication, - const QString & szAddonAuthor, - const QString & szAddonDate, - const QString & szAddonAddonEngineVersion - ); QString createRandomDir(); } diff --git a/src/modules/addon/packaddondialog.cpp b/src/modules/addon/packaddondialog.cpp index 75eebb7be..405a66d1b 100644 --- a/src/modules/addon/packaddondialog.cpp +++ b/src/modules/addon/packaddondialog.cpp @@ -41,6 +41,7 @@ #include #include #include +#include KviPackAddonDialog::KviPackAddonDialog(QWidget * pParent) @@ -146,6 +147,9 @@ bool KviPackAddonDialog::checkDirTree(QString * pszError, QString * pszWarning) return false; } +#if 0 + // These dirs are optional + QDir locale(m_szDirPath + "/locale"); if(!locale.exists()) { @@ -180,20 +184,23 @@ bool KviPackAddonDialog::checkDirTree(QString * pszError, QString * pszWarning) *pszWarning += __tr2qs_ctx("The help directory (help) does not exist.","addon"); *pszWarning += "\n"; } +#endif - QFileInfo init(m_szDirPath + "/init.kvs"); + QFileInfo init(m_szDirPath + "/install.kvs"); if(!init.exists()) { - *pszError = __tr2qs_ctx("The initialization script (init.kvs) does not exist.","addon"); + *pszError = __tr2qs_ctx("The initialization script (install.kvs) does not exist.","addon"); return false; } return true; } +#if 0 bool KviPackAddonDialog::createInstaller(QString * pszError) { - if(pszError) *pszError = ""; + if(pszError) + *pszError = ""; // Start creating install.kvs: header QString szTmp; @@ -226,23 +233,20 @@ bool KviPackAddonDialog::createInstaller(QString * pszError) // install.kvs: copy files szTmp += "# Copy files in each subdirectory\n# the pics\n"; - szTmp += QString("if (!$file.exists($file.localdir(\"pics/%1\"))) file.mkdir $file.localdir(\"pics/%1\")\n\n").arg(m_szName); - szTmp += QString("%installer->$copyFiles(\"%mypath/pics/%1\",\"*.png\",$file.localdir(\"pics/%1\"))\n\n").arg(m_szName); - szTmp += "# the translations\n"; - szTmp += QString("if (!$file.exists($file.localdir(\"locale/%1\"))) file.mkdir $file.localdir(\"locale/%1\")\n\n").arg(m_szName); - szTmp += "%installer->$copyFiles(\"%mypath/locale/%1\",\"*.mo\",$file.localdir(\"locale/%1\"))\n\n"; + szTmp += QString("%installer->$copyFiles(\"%mypath/pics\",\"*.png\",$file.localdir(\"pics\"))\n\n"); + szTmp += "# the translations\n"; + szTmp += "%installer->$copyFiles(\"%mypath/locale\",\"*.mo\",$file.localdir(\"locale\"))\n\n"; szTmp += "# the documentation\n"; - szTmp += QString("if (!$file.exists($file.localdir(\"help/%1\"))) file.mkdir $file.localdir(\"help/en/%1\")\n\n").arg(m_szName); - szTmp += QString("%installer->$copyFiles(\"%mypath/help/en/%1/\",\"*.html\",$file.localdir(\"help/en/%1\"))\n\n").arg(m_szName); + szTmp += QString("%installer->$copyFiles(\"%mypath/help/\",\"*.html\",$file.localdir(\"help/\"))\n\n"); // install.kvs: generate uninstall alias szTmp += "# Generate the uninstall alias\n"; szTmp += QString("%installer->$generateUninstallAlias(\"%1::uninstallfiles\")\n\n") \ .arg(m_szName); - // install.kvs: kill the installer class + // kviinstall.kvs: kill the installer class szTmp += "# Kill the installer helper\n"; szTmp += "delete %installer\n\n"; @@ -293,6 +297,33 @@ bool KviPackAddonDialog::createInstaller(QString * pszError) return true; } +#endif + +bool KviPackAddonDialog::addSubdirectoryIfExists( + KviPackageWriter &pw, + const QString &szAddonPath, + const QString &szSubdir, + const QString &szTargetSubdir + ) +{ + QString szFullPath = QString::fromAscii("%1%2%3") + .arg(szAddonPath).arg(QChar(KVI_PATH_SEPARATOR_CHAR)).arg(szSubdir); + + QDir dir(szFullPath); + if(!dir.exists()) + return true; + + if(!pw.addDirectory(szFullPath,szTargetSubdir)) + { + QString szTmp = __tr2qs_ctx("Packaging failed","addon"); + szTmp += ": "; + szTmp += pw.lastError(); + QMessageBox::critical(this,__tr2qs_ctx("Export Addon - KVIrc","addon"),szTmp,QMessageBox::Ok,QMessageBox::NoButton,QMessageBox::NoButton); + return false; + } + + return true; +} bool KviPackAddonDialog::packAddon() { @@ -302,7 +333,7 @@ bool KviPackAddonDialog::packAddon() m_szVersion = field("packageVersion").toString(); m_szDescription = field("packageDescription").toString(); m_szMinVersion = field("packageMinVersion").toString(); - m_szIcon = field("packageIcon").toString().section("/",-1); + m_szIcon = field("packageIcon").toString(); m_szDirPath = field("packageDirPath").toString(); m_szSavePath = field("packageSavePath").toString(); @@ -331,9 +362,11 @@ bool KviPackAddonDialog::packAddon() m_pPackAddonSummaryFilesWidget->setPath(m_szDirPath); if(m_pPackAddonSummaryFilesWidget->exec() == QDialog::Rejected) { + delete m_pPackAddonSummaryFilesWidget; return false; } +#if 0 // Create the installer file if(!createInstaller(&szError)) { @@ -343,10 +376,10 @@ bool KviPackAddonDialog::packAddon() ); return false; } +#endif - // We need mandatory UNIX like path separators - m_szDirPath.replace("\\","/"); - m_szSavePath.replace("\\","/"); + //m_szDirPath.replace("\\","/"); + //m_szSavePath.replace("\\","/"); QString szTmp; szTmp = QDateTime::currentDateTime().toString(); @@ -361,68 +394,34 @@ bool KviPackAddonDialog::packAddon() pw.addInfoField("Date",szTmp); pw.addInfoField("Application","KVIrc " KVI_VERSION "." KVI_SOURCES_DATE); - // Add source dir - if(!pw.addDirectory(m_szDirPath + "/src","src/")) + QPixmap pix(m_szIcon); + if(!pix.isNull()) { - szTmp = __tr2qs_ctx("Packaging failed","addon"); - szTmp += ": "; - szTmp += pw.lastError(); - QMessageBox::critical(this,__tr2qs_ctx("Export Addon - KVIrc","addon"),szTmp,QMessageBox::Ok,QMessageBox::NoButton,QMessageBox::NoButton); - return false; - } + QByteArray * pba = new QByteArray(); + QBuffer bufferz(pba,0); - // Add config dir - if(!pw.addDirectory(m_szDirPath + "/config","config/scripts/" + m_szName)) - { - szTmp = __tr2qs_ctx("Packaging failed","addon"); - szTmp += ": "; - szTmp += pw.lastError(); - QMessageBox::critical(this,__tr2qs_ctx("Export Addon - KVIrc","addon"),szTmp,QMessageBox::Ok,QMessageBox::NoButton,QMessageBox::NoButton); - return false; + bufferz.open(QIODevice::WriteOnly); + pix.save(&bufferz,"PNG"); + bufferz.close(); + pw.addInfoField("Icon",pba); } - // Add image dir - if(!pw.addDirectory(m_szDirPath + "/pics","pics/" + m_szName)) - { - szTmp = __tr2qs_ctx("Packaging failed","addon"); - szTmp += ": "; - szTmp += pw.lastError(); - QMessageBox::critical(this,__tr2qs_ctx("Export Addon - KVIrc","addon"),szTmp,QMessageBox::Ok,QMessageBox::NoButton,QMessageBox::NoButton); + // Add source dir + if(!addSubdirectoryIfExists(pw,m_szDirPath,"src","src/")) return false; - } - - // Add sound dir - if(!pw.addDirectory(m_szDirPath + "/sounds","sounds/" + m_szName)) - { - szTmp = __tr2qs_ctx("Packaging failed","addon"); - szTmp += ": "; - szTmp += pw.lastError(); - QMessageBox::critical(this,__tr2qs_ctx("Export Addon - KVIrc","addon"),szTmp,QMessageBox::Ok,QMessageBox::NoButton,QMessageBox::NoButton); + if(!addSubdirectoryIfExists(pw,m_szDirPath,"config","config/")) return false; - } - - // Add localization dir - if(!pw.addDirectory(m_szDirPath + "/locale","locale/" + m_szName)) - { - szTmp = __tr2qs_ctx("Packaging failed","addon"); - szTmp += ": "; - szTmp += pw.lastError(); - QMessageBox::critical(this,__tr2qs_ctx("Export Addon - KVIrc","addon"),szTmp,QMessageBox::Ok,QMessageBox::NoButton,QMessageBox::NoButton); + if(!addSubdirectoryIfExists(pw,m_szDirPath,"pics","pics/")) return false; - } - - // Add help dir - if(!pw.addDirectory(m_szDirPath + "/help","help/" + m_szName)) - { - szTmp = __tr2qs_ctx("Packaging failed","addon"); - szTmp += ": "; - szTmp += pw.lastError(); - QMessageBox::critical(this,__tr2qs_ctx("Export Addon - KVIrc","addon"),szTmp,QMessageBox::Ok,QMessageBox::NoButton,QMessageBox::NoButton); + if(!addSubdirectoryIfExists(pw,m_szDirPath,"sounds","sounds/")) + return false; + if(!addSubdirectoryIfExists(pw,m_szDirPath,"locale","locale/")) + return false; + if(!addSubdirectoryIfExists(pw,m_szDirPath,"help","help/")) return false; - } // Add initialization script - if(!pw.addFile(m_szDirPath + "/init.kvs","init.kvs")) + if(!pw.addFile(QString("%1%2%3").arg(m_szDirPath).arg(QChar(KVI_PATH_SEPARATOR_CHAR)).arg("install.kvs"),"install.kvs")) { szTmp = __tr2qs_ctx("Packaging failed","addon"); szTmp += ": "; @@ -430,9 +429,10 @@ bool KviPackAddonDialog::packAddon() QMessageBox::critical(this,__tr2qs_ctx("Export Addon - KVIrc","addon"),szTmp,QMessageBox::Ok,QMessageBox::NoButton,QMessageBox::NoButton); return false; } - + +#if 0 // Add installer script - if(!pw.addFile(m_szDirPath + "/install.kvs","install.kvs")) + if(!pw.addFile(QString("%1%2%3").arg(m_szDirPath).arg(QChar(KVI_PATH_SEPARATOR_CHAR)).arg("install.kvs"),"install.kvs")) { szTmp = __tr2qs_ctx("Packaging failed","addon"); szTmp += ": "; @@ -440,6 +440,7 @@ bool KviPackAddonDialog::packAddon() QMessageBox::critical(this,__tr2qs_ctx("Export Addon - KVIrc","addon"),szTmp,QMessageBox::Ok,QMessageBox::NoButton,QMessageBox::NoButton); return false; } +#endif // Create the addon package if(m_szSavePath.isEmpty()) @@ -461,9 +462,6 @@ bool KviPackAddonDialog::packAddon() return false; } - // Debug purpose - //KviPackageReader pr; - //pr.unpack("/home/ale/Test-2.0.3.kva","/home/ale/unpacked_test_kva"); QMessageBox::information(this,__tr2qs_ctx("Export Addon - KVIrc","addon"),__tr2qs("Package saved successfully in ") + m_szSavePath,QMessageBox::Ok,QMessageBox::NoButton,QMessageBox::NoButton); diff --git a/src/modules/addon/packaddondialog.h b/src/modules/addon/packaddondialog.h index 8123ec0e9..fed8adc61 100644 --- a/src/modules/addon/packaddondialog.h +++ b/src/modules/addon/packaddondialog.h @@ -44,6 +44,8 @@ class QTextEdit; class QLineEdit; class QLabel; +class KviPackageWriter; + class KviPackAddonInfoPackageWidget; class KviPackAddonFileSelectionWidget; class KviPackAddonSaveSelectionWidget; @@ -96,6 +98,16 @@ protected: */ bool packAddon(); + /** + * Helper for packAddon() + */ + bool addSubdirectoryIfExists( + KviPackageWriter &pw, + const QString &szAddonPath, + const QString &szSubdir, + const QString &szTargetSubdir + ); + /** * \brief Ensures the sources directory is complete * \param pszError The buffer containing errors diff --git a/src/modules/theme/packthemedialog.cpp b/src/modules/theme/packthemedialog.cpp index bb68a95c9..b715bb00b 100644 --- a/src/modules/theme/packthemedialog.cpp +++ b/src/modules/theme/packthemedialog.cpp @@ -437,7 +437,6 @@ bool KviPackThemeDialog::packTheme() m_szPackagePath = field("packageSavePath").toString(); //m_szSavePath = field("packageSavePath").toString(); - debug("author: %s, name: %s, version: %s, desc: %s, image: %s, save: %s, engine: %s\n",m_szAuthor.toUtf8().data(),m_szName.toUtf8().data(),m_szVersion.toUtf8().data(),m_szDescription.toUtf8().data(),m_szImagePath.toUtf8().data(),m_szPackagePath.toUtf8().data(),KVI_CURRENT_THEME_ENGINE_VERSION); //return false; QImage pix(m_szImagePath); @@ -537,7 +536,6 @@ bool KviPackThemeDialog::packTheme() if(!f.addDirectory(pInfo->absoluteDirectory(),pInfo->subdirectory())) { - debug("error abs %s - sub %s",pInfo->absoluteDirectory().toUtf8().data(),pInfo->subdirectory().toUtf8().data()); szTmp = __tr2qs_ctx("Packaging failed","theme"); szTmp += ": "; szTmp += f.lastError(); @@ -553,8 +551,6 @@ bool KviPackThemeDialog::packTheme() if(!f.pack(m_szPackagePath)) { - debug("error package path %s",m_szPackagePath.toUtf8().data()); - szTmp = __tr2qs_ctx("Packaging failed","theme"); szTmp += ": "; szTmp += f.lastError(); diff --git a/src/modules/theme/themefunctions.cpp b/src/modules/theme/themefunctions.cpp index 3890ef68d..a1a39a991 100644 --- a/src/modules/theme/themefunctions.cpp +++ b/src/modules/theme/themefunctions.cpp @@ -61,10 +61,9 @@ namespace KviThemeFunctions // check if it is a valid theme file KviPackageReader r; - debug("check file"); + if(!r.readHeader(szThemePackageFileName)) { - debug("Error!"); QString szErr = r.lastError(); KviQString::sprintf(szError,__tr2qs_ctx("The selected file does not seem to be a valid KVIrc package: %Q","theme"),&szErr); return false; @@ -73,16 +72,18 @@ namespace KviThemeFunctions pInfoFields = r.stringInfoFields(); pValue = pInfoFields->find("PackageType"); - if(!pValue)return notAValidThemePackage(szError); - debug("pValue themepack= %s",pValue->toUtf8().data()); - if(!KviQString::equalCI(*pValue,"ThemePack"))return notAValidThemePackage(szError); + if(!pValue) + return notAValidThemePackage(szError); + + if(!KviQString::equalCI(*pValue,"ThemePack")) + return notAValidThemePackage(szError); + pValue = pInfoFields->find("ThemePackVersion"); - debug("pValue theme version %s",pValue->toUtf8().data()); - if(!pValue)return notAValidThemePackage(szError); + if(!pValue) + return notAValidThemePackage(szError); // make sure the default fields exist - debug("check defaults fields"); for(int i=0;i<6;i++) { pValue = pInfoFields->find(check_fields[i]); @@ -90,12 +91,16 @@ namespace KviThemeFunctions } pValue = pInfoFields->find("ThemeCount"); - debug("pValue theme count %s",pValue->toUtf8().data()); - if(!pValue)return notAValidThemePackage(szError); + if(!pValue) + return notAValidThemePackage(szError); + bool bOk; int iThemeCount = pValue->toInt(&bOk); - if(!bOk)return notAValidThemePackage(szError); - if(iThemeCount < 1)return notAValidThemePackage(szError); + if(!bOk) + return notAValidThemePackage(szError); + + if(iThemeCount < 1) + return notAValidThemePackage(szError); // ok.. it should be really valid at this point @@ -283,12 +288,10 @@ namespace KviThemeFunctions hd.iFlags = KviHtmlDialogData::ForceMinimumSize; bInstall = KviHtmlDialog::display(pDialogParent,&hd) == 2; - debug("installint %d",bInstall); if(bInstall) { QString szUnpackPath; g_pApp->getLocalKvircDirectory(szUnpackPath,KviApp::Themes); - debug("unpack theme %s in %s",szThemePackageFileName.toUtf8().data(),szUnpackPath.toUtf8().data()); if(!r.unpack(szThemePackageFileName,szUnpackPath)) { QString szErr2 = r.lastError(); -- cgit v1.3.1-10-gc9f91