diff options
Diffstat (limited to 'src/libs/kdtools/kdupdaterpackagesinfo.cpp')
-rw-r--r-- | src/libs/kdtools/kdupdaterpackagesinfo.cpp | 98 |
1 files changed, 42 insertions, 56 deletions
diff --git a/src/libs/kdtools/kdupdaterpackagesinfo.cpp b/src/libs/kdtools/kdupdaterpackagesinfo.cpp index 9ac2b8eac..80c96dc5a 100644 --- a/src/libs/kdtools/kdupdaterpackagesinfo.cpp +++ b/src/libs/kdtools/kdupdaterpackagesinfo.cpp @@ -1,26 +1,46 @@ /**************************************************************************** -** Copyright (C) 2001-2010 Klaralvdalens Datakonsult AB. All rights reserved. ** -** This file is part of the KD Tools library. +** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB) +** Contact: http://www.qt-project.org/legal ** -** Licensees holding valid commercial KD Tools licenses may use this file in -** accordance with the KD Tools Commercial License Agreement provided with -** the Software. +** This file is part of the Qt Installer Framework. ** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. ** -** This file may be distributed and/or modified under the terms of the -** GNU Lesser General Public License version 2 and version 3 as published by the -** Free Software Foundation and appearing in the file LICENSE.LGPL included. +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** Contact info@kdab.com if any conditions of this licensing are not -** clear to you. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. ** -**********************************************************************/ +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + #include "kdupdaterpackagesinfo.h" -#include "kdupdaterapplication.h" +#include "globals.h" #include <QFileInfo> #include <QtXml/QDomDocument> @@ -65,7 +85,7 @@ using namespace KDUpdater; */ /*! \var UpdatePackagesInfo::Error UpdatePackagesInfo::InvalidXmlError - * The source file contains invalid XML. + * The source file contains invalid XML. */ /*! \var UpdatePackagesInfo::Error UpdatePackagesInfo::InvalidContentError @@ -75,18 +95,14 @@ using namespace KDUpdater; struct PackagesInfo::PackagesInfoData { PackagesInfoData() : - application(0), error(PackagesInfo::NotYetReadError), - compatLevel(-1), modified(false) {} - Application *application; QString errorMessage; PackagesInfo::Error error; QString fileName; QString applicationName; QString applicationVersion; - int compatLevel; bool modified; QVector<PackageInfo> packageInfoList; @@ -104,11 +120,10 @@ void PackagesInfo::PackagesInfoData::setInvalidContentError(const QString &detai /*! \internal */ -PackagesInfo::PackagesInfo(Application *application) - : QObject(application), +PackagesInfo::PackagesInfo(QObject *parent) + : QObject(parent), d(new PackagesInfoData()) { - d->application = application; } /*! @@ -121,15 +136,6 @@ PackagesInfo::~PackagesInfo() } /*! - Returns a pointer to the application, whose package information this class provides - access to. -*/ -Application *PackagesInfo::application() const -{ - return d->application; -} - -/*! Returns true if the PackagesInfo are valid else false is returned in which case the \a errorString() method can be used to receive a describing error message. */ @@ -233,14 +239,6 @@ PackageInfo PackagesInfo::packageInfo(int index) const } /*! - Returns the compat level of the application. -*/ -int PackagesInfo::compatLevel() const -{ - return d->compatLevel; -} - -/*! This function returns the index of the package whose name is \c pkgName. If no such package was found, this function returns -1. */ @@ -276,7 +274,7 @@ void PackagesInfo::refresh() d->modified = false; QFile file(d->fileName); - + // if the file does not exist then we just skip the reading if (!file.exists()) { d->error = NotYetReadError; @@ -331,8 +329,6 @@ void PackagesInfo::refresh() d->applicationVersion = childNodeE.text(); else if (childNodeE.tagName() == QLatin1String("Package")) d->addPackageFrom(childNodeE); - else if (childNodeE.tagName() == QLatin1String("CompatLevel")) - d->compatLevel = childNodeE.text().toInt(); } d->error = NoError; @@ -341,15 +337,6 @@ void PackagesInfo::refresh() } /*! - Sets the application compat level. -*/ -void PackagesInfo::setCompatLevel(int level) -{ - d->compatLevel = level; - d->modified = true; -} - -/*! Marks the package with \a name as installed in \a version. */ bool PackagesInfo::installPackage(const QString &name, const QString &version, @@ -433,8 +420,6 @@ void PackagesInfo::writeToDisk() addTextChildHelper(&root, QLatin1String("ApplicationName"), d->applicationName); addTextChildHelper(&root, QLatin1String("ApplicationVersion"), d->applicationVersion); - if (d->compatLevel != -1) - addTextChildHelper(&root, QLatin1String( "CompatLevel" ), QString::number(d->compatLevel)); Q_FOREACH (const PackageInfo &info, d->packageInfoList) { QDomElement package = doc.createElement(QLatin1String("Package")); @@ -511,9 +496,10 @@ void PackagesInfo::PackagesInfoData::addPackageFrom(const QDomElement &packageE) info.virtualComp = childNodeE.text().toLower() == QLatin1String("true") ? true : false; else if (childNodeE.tagName() == QLatin1String("Size")) info.uncompressedSize = childNodeE.text().toULongLong(); - else if (childNodeE.tagName() == QLatin1String("Dependencies")) - info.dependencies = childNodeE.text().split(scCommaRegExp, QString::SkipEmptyParts); - else if (childNodeE.tagName() == QLatin1String("ForcedInstallation")) + else if (childNodeE.tagName() == QLatin1String("Dependencies")) { + info.dependencies = childNodeE.text().split(QInstaller::commaRegExp(), + QString::SkipEmptyParts); + } else if (childNodeE.tagName() == QLatin1String("ForcedInstallation")) info.forcedInstallation = childNodeE.text().toLower() == QLatin1String( "true" ) ? true : false; else if (childNodeE.tagName() == QLatin1String("LastUpdateDate")) info.lastUpdateDate = QDate::fromString(childNodeE.text(), Qt::ISODate); |