[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdebase/workspace/plasma/scriptengines/qedjescript
From: Artur Duque de Souza <morpheuz () gmail ! com>
Date: 2008-10-01 1:27:10
Message-ID: 1222824430.488974.11762.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 866487 by asouza:
Checking if it's a valid edje file to avoid users installing
invalid files using qedje script engine.
M +1 -1 CMakeLists.txt
M +14 -2 qedje_package.cpp
--- trunk/KDE/kdebase/workspace/plasma/scriptengines/qedjescript/CMakeLists.txt #866486:866487
@@ -16,7 +16,7 @@
kde4_add_plugin(plasma_package_qedje ${package_SRCS})
target_link_libraries(plasma_package_qedje
- plasma ${KDE4_KDEUI_LIBS} ${KDE4_KIO_LIBS})
+ plasma ${QEdje_LIBRARIES} ${KDE4_KDEUI_LIBS} ${KDE4_KIO_LIBS})
install(TARGETS plasma_appletscript_qedje
--- trunk/KDE/kdebase/workspace/plasma/scriptengines/qedjescript/qedje_package.cpp #866486:866487
@@ -9,6 +9,7 @@
#include <plasma/packagemetadata.h>
#include <qedje_package.h>
+#include <qedje.h>
K_EXPORT_PLASMA_PACKAGESTRUCTURE(qedjescripts, QEdjePackage)
@@ -30,6 +31,13 @@
<< archive_path
<< "packageRoot=" << package_root;
+ // check if it's a valid file by trying to load it's groups
+ QStringList groups = groupNamesFromFile(archive_path);
+ if (groups.isEmpty()) {
+ kDebug() << "Invalid file format";
+ return false;
+ }
+
QString file = archive_path.split("/", QString::SkipEmptyParts).last();
QString package_name = file.split(".", QString::SkipEmptyParts).first();
@@ -38,12 +46,16 @@
// Create the directory so we can copy the edje file inside it
QDir contents(dest_dir);
- if (!contents.exists() && !contents.mkpath(dest_dir))
+ if (!contents.exists() && !contents.mkpath(dest_dir)) {
+ kDebug() << "It was not possible to create the destination directory";
return false;
+ }
// Copy the edje file to the package's directory
- if (!QFile::copy(archive_path, QString(dest_dir + "file.edj")))
+ if (!QFile::copy(archive_path, QString(dest_dir + "file.edj"))) {
+ kDebug() << "It was not possible to copy " << archive_path << "to " << dest_dir;
return false;
+ }
setPath(dest_dir);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic