summaryrefslogtreecommitdiffstats
path: root/examples/updater
diff options
context:
space:
mode:
Diffstat (limited to 'examples/updater')
-rw-r--r--examples/updater/components.xml409
-rw-r--r--examples/updater/config.xml29
-rw-r--r--examples/updater/main.cpp60
-rw-r--r--examples/updater/updater.cpp174
-rw-r--r--examples/updater/updater.h45
-rw-r--r--examples/updater/updater.pro12
-rw-r--r--examples/updater/updater.qrc5
7 files changed, 734 insertions, 0 deletions
diff --git a/examples/updater/components.xml b/examples/updater/components.xml
new file mode 100644
index 000000000..6d45206a7
--- /dev/null
+++ b/examples/updater/components.xml
@@ -0,0 +1,409 @@
+<Packages>
+ <ApplicationName>Qt SDK</ApplicationName>
+ <ApplicationVersion>1.0.0</ApplicationVersion>
+ <Package>
+ <Name>com.nokia.ndk</Name>
+ <Pixmap></Pixmap>
+ <Title></Title>
+ <Description></Description>
+ <Version>0.2.0</Version>
+ <LastUpdateDate></LastUpdateDate>
+ <InstallDate>2010-03-29</InstallDate>
+ </Package>
+ <Package>
+ <Name>com.nokia.ndk.api</Name>
+ <Pixmap></Pixmap>
+ <Title></Title>
+ <Description></Description>
+ <Version>0.0.1</Version>
+ <LastUpdateDate></LastUpdateDate>
+ <InstallDate>2010-03-29</InstallDate>
+ </Package>
+ <Package>
+ <Name>com.nokia.ndk.api.qtmobility</Name>
+ <Pixmap></Pixmap>
+ <Title></Title>
+ <Description></Description>
+ <Version>0.0.1</Version>
+ <LastUpdateDate></LastUpdateDate>
+ <InstallDate>2010-03-29</InstallDate>
+ </Package>
+ <Package>
+ <Name>com.nokia.ndk.api.qtmobility.maemo</Name>
+ <Pixmap></Pixmap>
+ <Title></Title>
+ <Description></Description>
+ <Version>0.0.1</Version>
+ <LastUpdateDate></LastUpdateDate>
+ <InstallDate>2010-03-29</InstallDate>
+ </Package>
+ <Package>
+ <Name>com.nokia.ndk.tools.symbian.readme</Name>
+ <Pixmap></Pixmap>
+ <Title></Title>
+ <Description></Description>
+ <Version>0.0.2</Version>
+ <LastUpdateDate></LastUpdateDate>
+ <InstallDate>2010-03-29</InstallDate>
+ </Package>
+ <Package>
+ <Name>com.nokia.ndk.misc.vcredist_x86</Name>
+ <Pixmap></Pixmap>
+ <Title></Title>
+ <Description></Description>
+ <Version>0.0.1</Version>
+ <LastUpdateDate></LastUpdateDate>
+ <InstallDate>2010-03-29</InstallDate>
+ </Package>
+ <Package>
+ <Name>com.nokia.ndk.api.qtmobility.simulator2008</Name>
+ <Pixmap></Pixmap>
+ <Title></Title>
+ <Description></Description>
+ <Version>0.0.1</Version>
+ <LastUpdateDate></LastUpdateDate>
+ <InstallDate>2010-03-29</InstallDate>
+ </Package>
+ <Package>
+ <Name>com.nokia.ndk.tools.simulator.qtmingw</Name>
+ <Pixmap></Pixmap>
+ <Title></Title>
+ <Description></Description>
+ <Version>0.0.2</Version>
+ <LastUpdateDate></LastUpdateDate>
+ <InstallDate>2010-03-29</InstallDate>
+ </Package>
+ <Package>
+ <Name>com.nokia.ndk.api.qtmobility.simulatormingw</Name>
+ <Pixmap></Pixmap>
+ <Title></Title>
+ <Description></Description>
+ <Version>0.0.1</Version>
+ <LastUpdateDate></LastUpdateDate>
+ <InstallDate>2010-03-29</InstallDate>
+ </Package>
+ <Package>
+ <Name>com.nokia.ndk.api.qtmobility.symbian</Name>
+ <Pixmap></Pixmap>
+ <Title></Title>
+ <Description></Description>
+ <Version>0.0.1</Version>
+ <LastUpdateDate></LastUpdateDate>
+ <InstallDate>2010-03-29</InstallDate>
+ </Package>
+ <Package>
+ <Name>com.nokia.ndk.api.qtmobility.symbian.462</Name>
+ <Pixmap></Pixmap>
+ <Title></Title>
+ <Description></Description>
+ <Version>0.0.1</Version>
+ <LastUpdateDate></LastUpdateDate>
+ <InstallDate>2010-03-29</InstallDate>
+ </Package>
+ <Package>
+ <Name>com.nokia.ndk.documentation</Name>
+ <Pixmap></Pixmap>
+ <Title></Title>
+ <Description></Description>
+ <Version>0.2.0</Version>
+ <LastUpdateDate></LastUpdateDate>
+ <InstallDate>2010-03-29</InstallDate>
+ </Package>
+ <Package>
+ <Name>com.nokia.ndk.documentation.qmake</Name>
+ <Pixmap></Pixmap>
+ <Title></Title>
+ <Description></Description>
+ <Version>0.0.2</Version>
+ <LastUpdateDate></LastUpdateDate>
+ <InstallDate>2010-03-29</InstallDate>
+ </Package>
+ <Package>
+ <Name>com.nokia.ndk.documentation.qt</Name>
+ <Pixmap></Pixmap>
+ <Title></Title>
+ <Description></Description>
+ <Version>0.0.2</Version>
+ <LastUpdateDate></LastUpdateDate>
+ <InstallDate>2010-03-29</InstallDate>
+ </Package>
+ <Package>
+ <Name>com.nokia.ndk.documentation.qtcreator</Name>
+ <Pixmap></Pixmap>
+ <Title></Title>
+ <Description></Description>
+ <Version>0.0.2</Version>
+ <LastUpdateDate></LastUpdateDate>
+ <InstallDate>2010-03-29</InstallDate>
+ </Package>
+ <Package>
+ <Name>com.nokia.ndk.documentation.qtdesigner</Name>
+ <Pixmap></Pixmap>
+ <Title></Title>
+ <Description></Description>
+ <Version>0.0.2</Version>
+ <LastUpdateDate></LastUpdateDate>
+ <InstallDate>2010-03-29</InstallDate>
+ </Package>
+ <Package>
+ <Name>com.nokia.ndk.documentation.qtlinguist</Name>
+ <Pixmap></Pixmap>
+ <Title></Title>
+ <Description></Description>
+ <Version>0.0.2</Version>
+ <LastUpdateDate></LastUpdateDate>
+ <InstallDate>2010-03-29</InstallDate>
+ </Package>
+ <Package>
+ <Name>com.nokia.ndk.documentation.qtmobility</Name>
+ <Pixmap></Pixmap>
+ <Title></Title>
+ <Description></Description>
+ <Version>0.0.1</Version>
+ <LastUpdateDate></LastUpdateDate>
+ <InstallDate>2010-03-29</InstallDate>
+ </Package>
+ <Package>
+ <Name>com.nokia.ndk.documentation.simulator</Name>
+ <Pixmap></Pixmap>
+ <Title></Title>
+ <Description></Description>
+ <Version>0.0.2</Version>
+ <LastUpdateDate></LastUpdateDate>
+ <InstallDate>2010-03-29</InstallDate>
+ </Package>
+ <Package>
+ <Name>com.nokia.ndk.misc</Name>
+ <Pixmap></Pixmap>
+ <Title></Title>
+ <Description></Description>
+ <Version>0.0.2</Version>
+ <LastUpdateDate></LastUpdateDate>
+ <InstallDate>2010-03-29</InstallDate>
+ </Package>
+ <Package>
+ <Name>com.nokia.ndk.misc.examples</Name>
+ <Pixmap></Pixmap>
+ <Title></Title>
+ <Description></Description>
+ <Version>0.0.3</Version>
+ <LastUpdateDate>2010-03-30</LastUpdateDate>
+ <InstallDate>2010-03-29</InstallDate>
+ </Package>
+ <Package>
+ <Name>com.nokia.ndk.misc.examples.46</Name>
+ <Pixmap></Pixmap>
+ <Title></Title>
+ <Description></Description>
+ <Version>0.0.4</Version>
+ <LastUpdateDate>2010-03-30</LastUpdateDate>
+ <InstallDate>2010-03-29</InstallDate>
+ </Package>
+ <Package>
+ <Name>com.nokia.ndk.misc.mingw</Name>
+ <Pixmap></Pixmap>
+ <Title></Title>
+ <Description></Description>
+ <Version>4.4.0</Version>
+ <LastUpdateDate></LastUpdateDate>
+ <InstallDate>2010-03-29</InstallDate>
+ </Package>
+ <Package>
+ <Name>com.nokia.ndk.misc.qtsources</Name>
+ <Pixmap></Pixmap>
+ <Title></Title>
+ <Description></Description>
+ <Version>0.0.1</Version>
+ <LastUpdateDate></LastUpdateDate>
+ <InstallDate>2010-03-29</InstallDate>
+ </Package>
+ <Package>
+ <Name>com.nokia.ndk.misc.qtsources.462</Name>
+ <Pixmap></Pixmap>
+ <Title></Title>
+ <Description></Description>
+ <Version>0.0.1</Version>
+ <LastUpdateDate></LastUpdateDate>
+ <InstallDate>2010-03-29</InstallDate>
+ </Package>
+ <Package>
+ <Name>com.nokia.ndk.tools</Name>
+ <Pixmap></Pixmap>
+ <Title></Title>
+ <Description></Description>
+ <Version>0.0.1</Version>
+ <LastUpdateDate></LastUpdateDate>
+ <InstallDate>2010-03-29</InstallDate>
+ </Package>
+ <Package>
+ <Name>com.nokia.ndk.tools.qtcreator.application</Name>
+ <Pixmap></Pixmap>
+ <Title></Title>
+ <Description></Description>
+ <Version>1.3.80</Version>
+ <LastUpdateDate></LastUpdateDate>
+ <InstallDate>2010-03-29</InstallDate>
+ </Package>
+ <Package>
+ <Name>com.nokia.ndk.tools.linguist</Name>
+ <Pixmap></Pixmap>
+ <Title></Title>
+ <Description></Description>
+ <Version>4.7.0</Version>
+ <LastUpdateDate></LastUpdateDate>
+ <InstallDate>2010-03-29</InstallDate>
+ </Package>
+ <Package>
+ <Name>com.nokia.ndk.tools.maemo</Name>
+ <Pixmap></Pixmap>
+ <Title></Title>
+ <Description></Description>
+ <Version>0.0.2</Version>
+ <LastUpdateDate></LastUpdateDate>
+ <InstallDate>2010-03-29</InstallDate>
+ </Package>
+ <Package>
+ <Name>com.nokia.ndk.tools.maemo.462</Name>
+ <Pixmap></Pixmap>
+ <Title></Title>
+ <Description></Description>
+ <Version>0.0.2</Version>
+ <LastUpdateDate></LastUpdateDate>
+ <InstallDate>2010-03-29</InstallDate>
+ </Package>
+ <Package>
+ <Name>com.nokia.ndk.tools.maemo.readme</Name>
+ <Pixmap></Pixmap>
+ <Title></Title>
+ <Description></Description>
+ <Version>0.0.2</Version>
+ <LastUpdateDate></LastUpdateDate>
+ <InstallDate>2010-03-29</InstallDate>
+ </Package>
+ <Package>
+ <Name>com.nokia.ndk.tools.maemo.usbdriver</Name>
+ <Pixmap></Pixmap>
+ <Title></Title>
+ <Description></Description>
+ <Version>0.0.2</Version>
+ <LastUpdateDate></LastUpdateDate>
+ <InstallDate>2010-03-29</InstallDate>
+ </Package>
+ <Package>
+ <Name>com.nokia.ndk.tools.qtcreator</Name>
+ <Pixmap></Pixmap>
+ <Title></Title>
+ <Description></Description>
+ <Version>0.0.4</Version>
+ <LastUpdateDate>2010-03-30</LastUpdateDate>
+ <InstallDate>2010-03-29</InstallDate>
+ </Package>
+ <Package>
+ <Name>com.nokia.ndk.tools.qtcreator.gdb</Name>
+ <Pixmap></Pixmap>
+ <Title></Title>
+ <Description></Description>
+ <Version>0.0.1</Version>
+ <LastUpdateDate></LastUpdateDate>
+ <InstallDate>2010-03-29</InstallDate>
+ </Package>
+ <Package>
+ <Name>com.nokia.ndk.tools.qtcreator.jom</Name>
+ <Pixmap></Pixmap>
+ <Title></Title>
+ <Description></Description>
+ <Version>0.8.0</Version>
+ <LastUpdateDate></LastUpdateDate>
+ <InstallDate>2010-03-29</InstallDate>
+ </Package>
+ <Package>
+ <Name>com.nokia.ndk.tools.simulator</Name>
+ <Pixmap></Pixmap>
+ <Title></Title>
+ <Description></Description>
+ <Version>0.0.2</Version>
+ <LastUpdateDate></LastUpdateDate>
+ <InstallDate>2010-03-29</InstallDate>
+ </Package>
+ <Package>
+ <Name>com.nokia.ndk.tools.simulator.application</Name>
+ <Pixmap></Pixmap>
+ <Title></Title>
+ <Description></Description>
+ <Version>0.0.3</Version>
+ <LastUpdateDate></LastUpdateDate>
+ <InstallDate>2010-03-29</InstallDate>
+ </Package>
+ <Package>
+ <Name>com.nokia.ndk.tools.simulator.qt2008</Name>
+ <Pixmap></Pixmap>
+ <Title></Title>
+ <Description></Description>
+ <Version>0.0.2</Version>
+ <LastUpdateDate></LastUpdateDate>
+ <InstallDate>2010-03-29</InstallDate>
+ </Package>
+ <Package>
+ <Name>com.nokia.ndk.tools.symbian</Name>
+ <Pixmap></Pixmap>
+ <Title></Title>
+ <Description></Description>
+ <Version>0.0.2</Version>
+ <LastUpdateDate></LastUpdateDate>
+ <InstallDate>2010-03-29</InstallDate>
+ </Package>
+ <Package>
+ <Name>com.nokia.ndk.tools.symbian.462</Name>
+ <Pixmap></Pixmap>
+ <Title></Title>
+ <Description></Description>
+ <Version>0.0.2</Version>
+ <LastUpdateDate></LastUpdateDate>
+ <InstallDate>2010-03-29</InstallDate>
+ </Package>
+ <Package>
+ <Name>com.nokia.ndk.tools.symbian.462.devicefiles</Name>
+ <Pixmap></Pixmap>
+ <Title></Title>
+ <Description></Description>
+ <Version>0.0.1</Version>
+ <LastUpdateDate></LastUpdateDate>
+ <InstallDate>2010-03-29</InstallDate>
+ </Package>
+ <Package>
+ <Name>com.nokia.ndk.tools.symbian.462.gcce</Name>
+ <Pixmap></Pixmap>
+ <Title></Title>
+ <Description></Description>
+ <Version>4.3.3</Version>
+ <LastUpdateDate></LastUpdateDate>
+ <InstallDate>2010-03-29</InstallDate>
+ </Package>
+ <Package>
+ <Name>com.nokia.ndk.tools.symbian.462.sdk</Name>
+ <Pixmap></Pixmap>
+ <Title></Title>
+ <Description></Description>
+ <Version>0.0.2</Version>
+ <LastUpdateDate></LastUpdateDate>
+ <InstallDate>2010-03-29</InstallDate>
+ </Package>
+ <Package>
+ <Name>com.nokia.ndk.tools.maemo.462.madde</Name>
+ <Pixmap></Pixmap>
+ <Title></Title>
+ <Description></Description>
+ <Version>0.5.0</Version>
+ <LastUpdateDate></LastUpdateDate>
+ <InstallDate>2010-03-29</InstallDate>
+ </Package>
+ <Package>
+ <Name>com.nokia.ndk.api.qtmobility.maemo.462</Name>
+ <Pixmap></Pixmap>
+ <Title></Title>
+ <Description></Description>
+ <Version>0.0.2</Version>
+ <LastUpdateDate></LastUpdateDate>
+ <InstallDate>2010-03-29</InstallDate>
+ </Package>
+</Packages>
diff --git a/examples/updater/config.xml b/examples/updater/config.xml
new file mode 100644
index 000000000..c024c941e
--- /dev/null
+++ b/examples/updater/config.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0"?>
+<Installer>
+ <Name>Qt SDK</Name>
+ <Version>0.9.0</Version>
+ <Title>Qt SDK</Title>
+ <MaintenanceTitle>Maintain Qt SDK</MaintenanceTitle>
+ <Publisher>Nokia</Publisher>
+ <Logo>logo.png</Logo>
+ <LogoSmall>logo-small.png</LogoSmall>
+ <Icon>logo-small</Icon>
+ <License>license.txt</License>
+ <Watermark>watermark.png</Watermark>
+ <RunProgram></RunProgram>
+ <StartMenuDir>Qt SDK - Release Candidate</StartMenuDir>
+ <UninstallerName>SDKMaintenanceTool</UninstallerName>
+
+ <!-- @homeDir@ and @rootDir@ are some of the supported vars -->
+ <TargetDir>@homeDir@/NokiaQtSDK</TargetDir>
+
+ <RemoteRepositories>
+ <Repository>
+<!--
+ <Url>http://schnappie.nokia.troll.no/alpha/onlinendk</Url>
+-->
+ <Url>http://hegel.europe.nokia.com/projects/ndk/installers/linux/x64/online_nokiaqtsdk_repo</Url>
+ <Required>true</Required>
+ </Repository>
+ </RemoteRepositories>
+</Installer>
diff --git a/examples/updater/main.cpp b/examples/updater/main.cpp
new file mode 100644
index 000000000..687ef7855
--- /dev/null
+++ b/examples/updater/main.cpp
@@ -0,0 +1,60 @@
+/**************************************************************************
+**
+** This file is part of Qt SDK**
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).*
+**
+** Contact: Nokia Corporation qt-info@nokia.com**
+**
+** No Commercial Usage
+**
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+**
+** 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.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception version
+** 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you are unsure which license is appropriate for your use, please contact
+** (qt-info@nokia.com).
+**
+**************************************************************************/
+#include <QApplication>
+#include <QStringList>
+
+#include "updater.h"
+#include "common/utils.h"
+
+int main( int argc, char* argv[] )
+{
+ bool checkonly = false;
+ {
+ QCoreApplication app( argc, argv );
+ checkonly = app.arguments().contains( QLatin1String( "--check-only" ) );
+ QInstaller::setVerbose( app.arguments().contains( QLatin1String( "--verbose" ) ) );
+ }
+
+ if( checkonly )
+ {
+ QCoreApplication app( argc, argv );
+ Updater u;
+ return u.checkForUpdates( true ) ? 0 : 1;
+ }
+ else
+ {
+ QApplication app( argc, argv );
+ Updater u;
+ return u.checkForUpdates( false ) ? 0 : 1;
+ }
+}
diff --git a/examples/updater/updater.cpp b/examples/updater/updater.cpp
new file mode 100644
index 000000000..c5a75ebbb
--- /dev/null
+++ b/examples/updater/updater.cpp
@@ -0,0 +1,174 @@
+/**************************************************************************
+**
+** This file is part of Qt SDK**
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).*
+**
+** Contact: Nokia Corporation qt-info@nokia.com**
+**
+** No Commercial Usage
+**
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+**
+** 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.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception version
+** 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you are unsure which license is appropriate for your use, please contact
+** (qt-info@nokia.com).
+**
+**************************************************************************/
+#include "updater.h"
+
+#include <QDateTime>
+#include <QDomDocument>
+#include <QProgressDialog>
+
+#include "common/binaryformat.h"
+#include "common/binaryformatenginehandler.h"
+#include "common/errors.h"
+
+#include "componentselectiondialog.h"
+#include "qinstaller.h"
+#include "qinstallercomponent.h"
+#include "qinstallercomponentmodel.h"
+#include "updatesettings.h"
+#include "init.h"
+
+#include <KDUpdater/Application>
+#include <KDUpdater/PackagesInfo>
+
+#include <KDToolsCore/KDAutoPointer>
+
+#include <iostream>
+
+using namespace QInstaller;
+
+class Updater::Private
+{
+public:
+ KDUpdater::Application updaterapp;
+ Installer installer;
+};
+
+Updater::Updater( QObject* parent )
+ : QObject( parent )
+{
+ QInstaller::init();
+}
+
+Updater::~Updater()
+{
+}
+
+bool Updater::checkForUpdates( bool checkonly )
+{
+ d->installer.setLinearComponentList( true );
+
+ std::auto_ptr< QInstallerCreator::BinaryFormatEngineHandler > handler( new QInstallerCreator::BinaryFormatEngineHandler( QInstallerCreator::ComponentIndex() ) );
+ handler->setComponentIndex( QInstallerCreator::ComponentIndex() );
+
+ UpdateSettings settings;
+ KDAutoPointer< ComponentSelectionDialog > dialog( checkonly ? 0 : new ComponentSelectionDialog( &d->installer ) );
+ if( !checkonly )
+ dialog->show();
+
+ ComponentModel::setVirtualComponentsVisible( true );
+
+ try
+ {
+ KDAutoPointer< QProgressDialog > progress( checkonly ? 0 : new QProgressDialog( dialog.get() ) );
+ if( !checkonly )
+ {
+ progress->setLabelText( tr( "Checking for updates..." ) );
+ progress->setRange( 0, 0 );
+ progress->show();
+ }
+
+ settings.setLastCheck( QDateTime::currentDateTime() );
+ d->installer.setRemoteRepositories( settings.repositories() );
+ d->installer.setValue( QLatin1String( "TargetDir" ), QFileInfo( d->updaterapp.packagesInfo()->fileName() ).absolutePath() );
+ }
+ catch( const Error& error )
+ {
+ if( !checkonly )
+ QMessageBox::critical( dialog.get(), tr( "Check for Updates" ), tr( "Error while checking for updates:\n%1" ).arg( error.what() ) );
+ settings.setLastResult( tr( "Software Update failed." ) );
+ return false;
+ }
+ catch( ... )
+ {
+ if( !checkonly )
+ QMessageBox::critical( dialog.get(), tr( "Check for Updates" ), tr( "Unknown error while checking for updates." ) );
+ settings.setLastResult( tr( "Software Update failed." ) );
+ return false;
+ }
+
+ const QList< Component* > components = d->installer.components( true );
+
+ // no updates for us
+ if( components.isEmpty() && !checkonly )
+ {
+ QMessageBox::information( dialog.get(), tr( "Check for Updates" ), tr( "There are currently no updates available for you." ) );
+ return false;
+ }
+
+ if( checkonly )
+ {
+ QDomDocument doc;
+ QDomElement root = doc.createElement( QLatin1String( "updates" ) );
+ doc.appendChild( root );
+ for( QList< Component* >::const_iterator it = components.begin(); it != components.end(); ++it )
+ {
+ QDomElement update = doc.createElement( QLatin1String( "update" ) );
+ update.setAttribute( QLatin1String( "name" ), (*it)->value( QLatin1String( "DisplayName" ) ) );
+ update.setAttribute( QLatin1String( "version" ), (*it)->value( QLatin1String( "Version" ) ) );
+ update.setAttribute( QLatin1String( "size" ), (*it)->value( QLatin1String( "UncompressedSize" ) ) );
+ root.appendChild( update );
+ }
+ std::cout << doc.toString( 4 ).toStdString() << std::endl;
+ return true;
+ }
+
+ if( dialog->exec() == QDialog::Rejected )
+ return false;
+
+ try
+ {
+ QProgressDialog dialog;
+ dialog.setRange( 0, 100 );
+ dialog.show();
+ connect( &dialog, SIGNAL( canceled() ), &d->installer, SLOT( interrupt() ) );
+ connect( &d->installer, SIGNAL( installationProgressTextChanged( QString ) ), &dialog, SLOT( setLabelText( QString ) ) );
+ connect( &d->installer, SIGNAL( installationProgressChanged( int ) ), &dialog, SLOT( setValue( int ) ) );
+ d->installer.installSelectedComponents();
+ }
+ catch( const Error& error )
+ {
+ QMessageBox::critical( dialog.get(), tr( "Check for Updates" ), tr( "Error while installing updates:\n%1" ).arg( error.what() ) );
+ d->installer.rollBackInstallation();
+ settings.setLastResult( tr( "Software Update failed." ) );
+ return false;
+ }
+ catch( ... )
+ {
+ QMessageBox::critical( dialog.get(), tr( "Check for Updates" ), tr( "Unknown error while installing updates." ) );
+ d->installer.rollBackInstallation();
+ settings.setLastResult( tr( "Software Update failed." ) );
+ return false;
+ }
+
+ return true;
+}
diff --git a/examples/updater/updater.h b/examples/updater/updater.h
new file mode 100644
index 000000000..e4e42059b
--- /dev/null
+++ b/examples/updater/updater.h
@@ -0,0 +1,45 @@
+/**************************************************************************
+**
+** This file is part of Qt SDK**
+**
+** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).*
+**
+** Contact: Nokia Corporation qt-info@nokia.com**
+**
+** GNU Lesser General Public License Usage
+**
+** 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.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception version
+** 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you are unsure which license is appropriate for your use, please contact
+** (qt-info@nokia.com).
+**
+**************************************************************************/
+#ifndef UPDATER_H
+#define UPDATER_H
+
+#include <QtCore/QObject>
+#include <KDToolsCore/pimpl_ptr.h>
+
+class Updater : public QObject
+{
+public:
+ explicit Updater( QObject* parent = 0 );
+ ~Updater();
+
+ bool checkForUpdates( bool checkonly = false );
+
+private:
+ class Private;
+ kdtools::pimpl_ptr< Private > d;
+};
+
+#endif
diff --git a/examples/updater/updater.pro b/examples/updater/updater.pro
new file mode 100644
index 000000000..c4662b3fd
--- /dev/null
+++ b/examples/updater/updater.pro
@@ -0,0 +1,12 @@
+TEMPLATE = app
+TARGET = Updater
+
+include( ../../installerbuilder/libinstaller/libinstaller.pri )
+LIBS = -L$$OUT_PWD/../../installerbuilder/lib -linstaller $$LIBS
+
+QT += gui
+
+CONFIG += uitools
+
+SOURCES += main.cpp
+RESOURCES += updater.qrc
diff --git a/examples/updater/updater.qrc b/examples/updater/updater.qrc
new file mode 100644
index 000000000..962b28d51
--- /dev/null
+++ b/examples/updater/updater.qrc
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/metadata/installer-config">
+ <file>config.xml</file>
+ </qresource>
+</RCC>