From 9d97d133ccb3c0b091639cf58fd3dcf69fa6e39b Mon Sep 17 00:00:00 2001 From: kh1 Date: Wed, 4 Sep 2013 10:26:39 +0200 Subject: Add binary format autotest. Change-Id: I0e718df1a53ca2f3641e59c7dbca80175814ee02 Reviewed-by: Niels Weber Reviewed-by: Tim Jenssen --- tests/auto/installer/binaryformat/binaryformat.pro | 5 + .../installer/binaryformat/tst_binaryformat.cpp | 115 +++++++++++++++++++++ tests/auto/installer/installer.pro | 3 +- 3 files changed, 122 insertions(+), 1 deletion(-) create mode 100644 tests/auto/installer/binaryformat/binaryformat.pro create mode 100644 tests/auto/installer/binaryformat/tst_binaryformat.cpp diff --git a/tests/auto/installer/binaryformat/binaryformat.pro b/tests/auto/installer/binaryformat/binaryformat.pro new file mode 100644 index 000000000..24a7899ce --- /dev/null +++ b/tests/auto/installer/binaryformat/binaryformat.pro @@ -0,0 +1,5 @@ +include(../../qttest.pri) + +QT -= gui + +SOURCES += tst_binaryformat.cpp diff --git a/tests/auto/installer/binaryformat/tst_binaryformat.cpp b/tests/auto/installer/binaryformat/tst_binaryformat.cpp new file mode 100644 index 000000000..40509fd18 --- /dev/null +++ b/tests/auto/installer/binaryformat/tst_binaryformat.cpp @@ -0,0 +1,115 @@ +/************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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. +** +** 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. +** +** 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. +** +** 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 +#include +#include + +#include +#include + +static const qint64 scTinySize = 51200LL; +static const qint64 scSmallSize = 524288LL; +static const qint64 scLargeSize = 2097152LL; + +class tst_BinaryFormat : public QObject +{ + Q_OBJECT + +private slots: + void findMagicCookieSmallFile() + { + QTemporaryFile file; + file.open(); + + try { + QInstaller::blockingWrite(&file, QByteArray(scSmallSize, '1')); + QInstaller::appendInt64(&file, QInstaller::MagicCookie); + + QCOMPARE(QInstaller::findMagicCookie(&file, QInstaller::MagicCookie), scSmallSize); + } catch (const QInstaller::Error &error) { + QFAIL(qPrintable(error.message())); + } catch (...) { + QFAIL("Unexpected error."); + } + } + + void findMagicCookieLargeFile() + { + QTemporaryFile file; + file.open(); + + try { + QInstaller::blockingWrite(&file, QByteArray(scLargeSize, '1')); + QInstaller::appendInt64(&file, QInstaller::MagicCookie); + QInstaller::blockingWrite(&file, QByteArray(scTinySize, '2')); + + QCOMPARE(QInstaller::findMagicCookie(&file, QInstaller::MagicCookie), scLargeSize); + } catch (const QInstaller::Error &error) { + QFAIL(qPrintable(error.message())); + } catch (...) { + QFAIL("Unexpected error."); + } + } + + void testFindMagicCookieWithError() + { + QTest::ignoreMessage(QtDebugMsg, "create Error-Exception: \"Searched whole file, no marker found\" "); + + QTemporaryFile file; + file.open(); + + try { + QInstaller::blockingWrite(&file, QByteArray(scTinySize, '1')); + + // throws + QInstaller::findMagicCookie(&file, QInstaller::MagicCookie); + } catch (const QInstaller::Error &error) { + QCOMPARE(qPrintable(error.message()), "Searched whole file, no marker found"); + } catch (...) { + QFAIL("Unexpected error."); + } + } +}; + +QTEST_MAIN(tst_BinaryFormat) + +#include "tst_binaryformat.moc" diff --git a/tests/auto/installer/installer.pro b/tests/auto/installer/installer.pro index 5873a8db8..414c952d7 100644 --- a/tests/auto/installer/installer.pro +++ b/tests/auto/installer/installer.pro @@ -12,5 +12,6 @@ SUBDIRS += \ consumeoutputoperationtest \ mkdiroperationtest \ copyoperationtest \ - solver + solver \ + binaryformat -- cgit v1.2.3 From d48ffdd2982999873d9a2bdbe0adbd005659d10b Mon Sep 17 00:00:00 2001 From: kh1 Date: Wed, 4 Sep 2013 12:59:11 +0200 Subject: Rewrite function to use QFile::map(). Once the data is mapped into memory, searching backwards is way faster. Change-Id: I31667095712cfba95a8255e04d217ed9242fd2a8 Reviewed-by: Niels Weber Reviewed-by: Kai Koehne Reviewed-by: Tim Jenssen --- src/libs/installer/binaryformat.cpp | 46 ++++++++++------------ .../installer/binaryformat/tst_binaryformat.cpp | 4 +- 2 files changed, 22 insertions(+), 28 deletions(-) diff --git a/src/libs/installer/binaryformat.cpp b/src/libs/installer/binaryformat.cpp index b07cc90de..8e79e84c3 100644 --- a/src/libs/installer/binaryformat.cpp +++ b/src/libs/installer/binaryformat.cpp @@ -55,6 +55,7 @@ #include #include +#include using namespace QInstaller; using namespace QInstallerCreator; @@ -220,33 +221,26 @@ qint64 QInstaller::findMagicCookie(QFile *in, quint64 magicCookie) Q_ASSERT(in); Q_ASSERT(in->isOpen()); Q_ASSERT(in->isReadable()); - const qint64 oldPos = in->pos(); - const qint64 MAX_SEARCH = 1024 * 1024; // stop searching after one MB - qint64 searched = 0; - try { - while (searched < MAX_SEARCH) { - const qint64 pos = in->size() - searched - sizeof(qint64); - if (pos < 0) - throw Error(QObject::tr("Searched whole file, no marker found")); - if (!in->seek(pos)) { - throw Error(QObject::tr("Could not seek to %1 in file %2: %3").arg(QString::number(pos), - in->fileName(), in->errorString())); - } - const quint64 num = static_cast(retrieveInt64(in)); - if (num == magicCookie) { - in->seek(oldPos); - return pos; - } - searched += 1; - } - throw Error(QObject::tr("No marker found, stopped after %1.").arg(humanReadableSize(MAX_SEARCH))); - } catch (const Error& err) { - in->seek(oldPos); - throw err; - } catch (...) { - in->seek(oldPos); - throw Error(QObject::tr("No marker found, unknown exception caught.")); + + const qint64 fileSize = in->size(); + const size_t markerSize = sizeof(qint64); + + // Search through 1MB, if smaller through the whole file. Note: QFile::map() does not change QFile::pos(). + const qint64 maxSearch = qMin((1024LL * 1024LL), fileSize); + const uchar *const mapped = in->map(fileSize - maxSearch, maxSearch); + if (!mapped) { + throw Error(QObject::tr("Could not map %1 from file %2: %3").arg(QString::number(maxSearch), + in->fileName(), in->errorString())); + } + + qint64 searched = maxSearch - markerSize; + while (searched >= 0) { + if (memcmp(&magicCookie, (mapped + searched), markerSize) == 0) + return (fileSize - maxSearch) + searched; + searched -= markerSize; } + throw Error(QObject::tr("No marker found, stopped after %1.").arg(humanReadableSize(maxSearch))); + return -1; // never reached } diff --git a/tests/auto/installer/binaryformat/tst_binaryformat.cpp b/tests/auto/installer/binaryformat/tst_binaryformat.cpp index 40509fd18..6e520dc3e 100644 --- a/tests/auto/installer/binaryformat/tst_binaryformat.cpp +++ b/tests/auto/installer/binaryformat/tst_binaryformat.cpp @@ -92,7 +92,7 @@ private slots: void testFindMagicCookieWithError() { - QTest::ignoreMessage(QtDebugMsg, "create Error-Exception: \"Searched whole file, no marker found\" "); + QTest::ignoreMessage(QtDebugMsg, "create Error-Exception: \"No marker found, stopped after 50.00 KiB.\" "); QTemporaryFile file; file.open(); @@ -103,7 +103,7 @@ private slots: // throws QInstaller::findMagicCookie(&file, QInstaller::MagicCookie); } catch (const QInstaller::Error &error) { - QCOMPARE(qPrintable(error.message()), "Searched whole file, no marker found"); + QCOMPARE(qPrintable(error.message()), "No marker found, stopped after 50.00 KiB."); } catch (...) { QFAIL("Unexpected error."); } -- cgit v1.2.3 From 36d89808691904fa46ad06e082cb18fe8aa196bd Mon Sep 17 00:00:00 2001 From: Tim Jenssen Date: Wed, 11 Sep 2013 10:05:00 +0200 Subject: improve RepositoryUpdate doc - make clear that there is only one RepositoryUpdate section Change-Id: Ia2c2ea8d97f706c6318747745a327e4c07c9bbeb Reviewed-by: Leena Miettinen Reviewed-by: Niels Weber --- doc/installerfw.qdoc | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/doc/installerfw.qdoc b/doc/installerfw.qdoc index baf6f1261..14aadc19c 100644 --- a/doc/installerfw.qdoc +++ b/doc/installerfw.qdoc @@ -1007,34 +1007,35 @@ Updates.xml file in the current repository. You can add, replace, or remove repositories. + \code + + + + + \endcode + \section2 Adding Repositories - To update a repository, add the following code to Updates.xml: + To update a repository, add the following code to the RepositoryUpdate section: \code - - - \endcode \section2 Removing Repositories - To remove a repository, add the following code to Updates.xml: + To remove a repository, add the following code to the RepositoryUpdate section: \code - - - + \endcode \section2 Replacing repositories - To replace one repository with another, add the following code to Updates.xml: + To replace one repository with another, add the following code to the RepositoryUpdate section: \code - - - + \endcode */ -- cgit v1.2.3 From 3379918d4aeb3efb47a80d6bfa6d87f4313dce77 Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Fri, 13 Sep 2013 09:31:37 +0200 Subject: Minor. Make dynamic pages look alike Force subtitle for dynamic pages Change-Id: If54df3d275bfca1438717c7b2eaa55fac841b788 Reviewed-by: Niels Weber Reviewed-by: Tim Jenssen --- src/libs/installer/packagemanagergui.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/installer/packagemanagergui.cpp b/src/libs/installer/packagemanagergui.cpp index 4ce38a388..9b80e70a3 100644 --- a/src/libs/installer/packagemanagergui.cpp +++ b/src/libs/installer/packagemanagergui.cpp @@ -135,7 +135,7 @@ public: setPixmap(QWizard::BannerPixmap, QPixmap()); setLayout(new QVBoxLayout); - setSubTitle(QString()); + setSubTitle(QLatin1String(" ")); setTitle(widget->windowTitle()); m_widget->setProperty("complete", true); m_widget->setProperty("final", false); -- cgit v1.2.3 From 50f2bf8baf69425b39a68fa9001b6769390deff0 Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Thu, 12 Sep 2013 18:41:34 +0200 Subject: Bugfix ported from 1.5 branch on customer request Remove some superfluous qApp->processEvents(). This shouldn't be there, as it forces event handling in certain situations which break other parts of the UI event handling. We experienced a missing redraw which caused hacky workarounds. Original gerrit id: I2185ecb1b99d1ff20caa9a08637d77100e520445 Change-Id: I46f028838d680ba46183df6d0368811eb041d2e2 Reviewed-by: Tim Jenssen --- src/libs/installer/packagemanagergui.cpp | 3 --- src/sdk/installerbasecommons.cpp | 12 ------------ 2 files changed, 15 deletions(-) diff --git a/src/libs/installer/packagemanagergui.cpp b/src/libs/installer/packagemanagergui.cpp index 9b80e70a3..034b450e6 100644 --- a/src/libs/installer/packagemanagergui.cpp +++ b/src/libs/installer/packagemanagergui.cpp @@ -62,7 +62,6 @@ #include #include -#include #include #include #include @@ -727,8 +726,6 @@ QWidget *PackageManagerPage::findWidget(const QString &objectName) const void PackageManagerPage::setVisible(bool visible) { QWizardPage::setVisible(visible); - qApp->processEvents(); - if (m_fresh && !visible) { // this is only hit once when the page gets added to the wizard m_fresh = false; diff --git a/src/sdk/installerbasecommons.cpp b/src/sdk/installerbasecommons.cpp index 19b76ce7c..d2fb5e27b 100644 --- a/src/sdk/installerbasecommons.cpp +++ b/src/sdk/installerbasecommons.cpp @@ -317,10 +317,6 @@ void IntroductionPageImpl::setPackageManager(bool value) void IntroductionPageImpl::onCoreNetworkSettingsChanged() { - // force a repaint of the ui as after the settings dialog has been closed and the wizard has been - // restarted, the "Next" button looks still disabled. TODO: figure out why this happens at all! - gui()->repaint(); - m_updatesFetched = false; m_allPackagesFetched = false; } @@ -344,8 +340,6 @@ void IntroductionPageImpl::entering() void IntroductionPageImpl::leaving() { - // TODO: force repaint on next page, keeps unpainted after fetch - QTimer::singleShot(100, gui()->page(nextId()), SLOT(repaint())); setButtonText(QWizard::CancelButton, gui()->defaultButtonText(QWizard::CancelButton)); } @@ -442,9 +436,6 @@ bool TargetDirectoryPageImpl::askQuestion(const QString &identifier, const QStri QMessageBox::StandardButton bt = MessageBoxHandler::warning(MessageBoxHandler::currentBestSuitParent(), identifier, TargetDirectoryPageImpl::tr("Warning"), message, QMessageBox::Yes | QMessageBox::No); -#ifndef Q_OS_MAC - QTimer::singleShot(100, wizard()->page(nextId()), SLOT(repaint())); -#endif return bt == QMessageBox::Yes; } @@ -452,9 +443,6 @@ bool TargetDirectoryPageImpl::failWithError(const QString &identifier, const QSt { MessageBoxHandler::critical(MessageBoxHandler::currentBestSuitParent(), identifier, TargetDirectoryPageImpl::tr("Error"), message); -#ifndef Q_OS_MAC - QTimer::singleShot(100, wizard()->page(nextId()), SLOT(repaint())); -#endif return false; } -- cgit v1.2.3 From 8b5184531cda6dadaec55d70921703db6f50f182 Mon Sep 17 00:00:00 2001 From: Niels Weber Date: Thu, 12 Sep 2013 13:21:34 +0200 Subject: Add support to pass a query string when downloading archives. Task-number: QTIFW-329 Change-Id: I645370f03958164905c064d1dcf0be97fd8dc039 Reviewed-by: Tim Jenssen --- Changelog | 3 +++ doc/installerfw.qdoc | 4 ++++ src/libs/installer/downloadarchivesjob.cpp | 9 ++++++--- src/libs/installer/downloadarchivesjob.h | 2 +- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Changelog b/Changelog index 5cb1418c8..afc5799c4 100644 --- a/Changelog +++ b/Changelog @@ -1,3 +1,6 @@ +1.4.1 +- Added support to pass a query string when downloading archives. (QTIFW-329) + 1.4 - Force updating of Essential components. (QTIFW-38, QTIFW-155) - Display release date in Updater and Packagemanager. (QTIFW-25) diff --git a/doc/installerfw.qdoc b/doc/installerfw.qdoc index 14aadc19c..7039fbca0 100644 --- a/doc/installerfw.qdoc +++ b/doc/installerfw.qdoc @@ -265,6 +265,10 @@ \o List of language codes to be used for translating the user interface. To add several language variants, specify several Translation sections that each specify the name of a language variant. Optional. For more information, see \l{Translating Pages}. + \row + \o UrlQueryString + \o This string needs to be in the form "key=value" and will be appended to archive download + requests. This can be used to transmit information to the webserver hosting the repository. \endtable diff --git a/src/libs/installer/downloadarchivesjob.cpp b/src/libs/installer/downloadarchivesjob.cpp index 24fba689a..82f9b365c 100644 --- a/src/libs/installer/downloadarchivesjob.cpp +++ b/src/libs/installer/downloadarchivesjob.cpp @@ -182,7 +182,7 @@ void DownloadArchivesJob::fetchNextArchive() if (m_downloader != 0) m_downloader->deleteLater(); - m_downloader = setupDownloader(); + m_downloader = setupDownloader(QString(), m_core->value(QLatin1String("UrlQueryString"))); if (!m_downloader) { m_archivesToDownload.removeFirst(); QMetaObject::invokeMethod(this, "fetchNextArchive", Qt::QueuedConnection); @@ -292,13 +292,16 @@ void DownloadArchivesJob::finishWithError(const QString &error) emitFinishedWithError(QInstaller::DownloadError, msg.arg(error, m_downloader->url().toString())); } -KDUpdater::FileDownloader *DownloadArchivesJob::setupDownloader(const QString &suffix) +KDUpdater::FileDownloader *DownloadArchivesJob::setupDownloader(const QString &suffix, const QString &queryString) { KDUpdater::FileDownloader *downloader = 0; const QFileInfo fi = QFileInfo(m_archivesToDownload.first().first); const Component *const component = m_core->componentByName(QFileInfo(fi.path()).fileName()); if (component) { - const QUrl url(m_archivesToDownload.first().second + suffix); + QString fullQueryString; + if (!queryString.isEmpty()) + fullQueryString = QLatin1String("?") + queryString; + const QUrl url(m_archivesToDownload.first().second + suffix + fullQueryString); const QString &scheme = url.scheme(); downloader = FileDownloaderFactory::instance().create(scheme, this); diff --git a/src/libs/installer/downloadarchivesjob.h b/src/libs/installer/downloadarchivesjob.h index 9cf904fae..765d2c564 100644 --- a/src/libs/installer/downloadarchivesjob.h +++ b/src/libs/installer/downloadarchivesjob.h @@ -91,7 +91,7 @@ protected Q_SLOTS: void emitDownloadProgress(double progress); private: - KDUpdater::FileDownloader *setupDownloader(const QString &suffix = QString()); + KDUpdater::FileDownloader *setupDownloader(const QString &suffix = QString(), const QString &queryString = QString()); private: PackageManagerCore *m_core; -- cgit v1.2.3 From 6e798a3a7a7e78ecf26ada95876e7672ef681b7f Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Thu, 12 Sep 2013 18:03:58 +0200 Subject: Minor. Fixes unregistered type warning. register QList Change-Id: I1329ccc9c7ad3405b3a995fb40cc77688953744a Reviewed-by: Tim Jenssen --- src/libs/installer/component.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libs/installer/component.cpp b/src/libs/installer/component.cpp index ed815d18a..2fa25204e 100644 --- a/src/libs/installer/component.cpp +++ b/src/libs/installer/component.cpp @@ -211,6 +211,7 @@ Component::Component(PackageManagerCore *core) setPrivate(d); connect(this, SIGNAL(valueChanged(QString, QString)), this, SLOT(updateModelData(QString, QString))); + qRegisterMetaType >("QList"); } /*! -- cgit v1.2.3 From ddf7700108046a2ffc5b04c16a1cd5f6c5918d61 Mon Sep 17 00:00:00 2001 From: Tim Jenssen Date: Fri, 13 Sep 2013 17:38:34 +0200 Subject: convert FinishButton only at isUpdater and is isPackageManger Task-number: QTIFW-362 Change-Id: Ia94e06ba7a5d8126b12935c33642b53bbd4563e9 Reviewed-by: Karsten Heimrich --- src/libs/installer/packagemanagergui.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libs/installer/packagemanagergui.cpp b/src/libs/installer/packagemanagergui.cpp index 034b450e6..ae5300b38 100644 --- a/src/libs/installer/packagemanagergui.cpp +++ b/src/libs/installer/packagemanagergui.cpp @@ -307,8 +307,8 @@ void PackageManagerGui::clickButton(int wb, int delay) { // transform the FinishButton to CancelButton, because of the needed misuse of the // CancelButton as a FinishButton to have some more control of closing the wizard - if (!m_core->isInstaller() && currentId() == PackageManagerCore::InstallationFinished && - wb == QWizard::FinishButton) { + if ((m_core->isUpdater() || m_core->isPackageManager()) && currentId() == + PackageManagerCore::InstallationFinished && wb == QWizard::FinishButton) { wb = QWizard::CancelButton; } if (QAbstractButton *b = button(static_cast(wb) )) @@ -321,8 +321,8 @@ bool PackageManagerGui::isButtonEnabled(int wb) { // transform the FinishButton to CancelButton, because of the needed misuse of the // CancelButton as a FinishButton to have some more control of closing the wizard - if (!m_core->isInstaller() && currentId() == PackageManagerCore::InstallationFinished && - wb == QWizard::FinishButton) { + if ((m_core->isUpdater() || m_core->isPackageManager()) && currentId() == + PackageManagerCore::InstallationFinished && wb == QWizard::FinishButton) { wb = QWizard::CancelButton; } if (QAbstractButton *b = button(static_cast(wb) )) -- cgit v1.2.3 From 5e6d3ee009b96e4613402acc8ba12cd6281ea2d6 Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Fri, 13 Sep 2013 15:57:49 +0200 Subject: Fix starting the app when installation finished Do not pass as arguments empty string, it can break applications which expect for example filename as first argument. Change-Id: I5c7dd1e2fc9b441634507ad651108d2d03416224 Reviewed-by: Niels Weber Reviewed-by: Karsten Heimrich --- src/libs/installer/packagemanagergui.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/installer/packagemanagergui.cpp b/src/libs/installer/packagemanagergui.cpp index ae5300b38..5d5514af9 100644 --- a/src/libs/installer/packagemanagergui.cpp +++ b/src/libs/installer/packagemanagergui.cpp @@ -1910,7 +1910,7 @@ void FinishedPage::handleFinishClicked() { const QString program = packageManagerCore()->replaceVariables(packageManagerCore()->value(scRunProgram)); const QStringList args = packageManagerCore()->replaceVariables( - packageManagerCore()->value(scRunProgramArguments)).split(QLatin1Char(' ')); + packageManagerCore()->value(scRunProgramArguments)).split(QLatin1Char(' '), QString::SkipEmptyParts); if (!m_runItCheckBox->isChecked() || program.isEmpty()) return; -- cgit v1.2.3 From c0783d89b802e6e054ac062480b1fef5272fa274 Mon Sep 17 00:00:00 2001 From: Tim Jenssen Date: Wed, 28 Aug 2013 12:27:15 +0200 Subject: enable redirected downloads at tests/downloadspeed Change-Id: Id44b63f491e90bb956df0aec19e17e9f0b60a158 Reviewed-by: Niels Weber --- tests/downloadspeed/main.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/downloadspeed/main.cpp b/tests/downloadspeed/main.cpp index 5a5b685aa..4edc0d8b6 100644 --- a/tests/downloadspeed/main.cpp +++ b/tests/downloadspeed/main.cpp @@ -164,6 +164,7 @@ int main(int argc, char *argv[]) return EXIT_FAILURE; const QUrl url(a.arguments().value(1)); + KDUpdater::FileDownloaderFactory::setFollowRedirects(true); qDebug() << url.toString(); KDUpdater::FileDownloader *loader = KDUpdater::FileDownloaderFactory::instance().create(url.scheme(), 0); if (loader) { -- cgit v1.2.3 From a82c1bd8dfddf41bd728d297f453cd2fd64faeb4 Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Tue, 17 Sep 2013 09:07:05 +0200 Subject: Fix not moving uninstallation progressBar Set 'component' name value for minimalprogressoperation. Wihout the value sortOperationsBasedOnComponentDependencies puts the operation to execute as the last one. This creates 'freeze' of uninstallation bar Change-Id: I3b894b2c48ed5008d1d265084451da6fc4e3ef86 Reviewed-by: Karsten Heimrich --- src/libs/installer/component.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libs/installer/component.cpp b/src/libs/installer/component.cpp index 2fa25204e..472f269fc 100644 --- a/src/libs/installer/component.cpp +++ b/src/libs/installer/component.cpp @@ -900,6 +900,7 @@ OperationList Component::operations() const if (!d->m_minimumProgressOperation) { d->m_minimumProgressOperation = KDUpdater::UpdateOperationFactory::instance() .create(QLatin1String("MinimumProgress")); + d->m_minimumProgressOperation->setValue(QLatin1String("component"), name()); d->m_operations.append(d->m_minimumProgressOperation); } @@ -907,6 +908,7 @@ OperationList Component::operations() const d->m_licenseOperation = KDUpdater::UpdateOperationFactory::instance() .create(QLatin1String("License")); d->m_licenseOperation->setValue(QLatin1String("installer"), QVariant::fromValue(d->m_core)); + d->m_licenseOperation->setValue(QLatin1String("component"), name()); QVariantMap licenses; const QList > values = d->m_licenses.values(); -- cgit v1.2.3 From 21e9a3689a9f1929fbe952f30b84541e0dac6fd7 Mon Sep 17 00:00:00 2001 From: Niels Weber Date: Fri, 13 Sep 2013 13:36:55 +0200 Subject: Updated Changelog. Change-Id: Ib7da722eba167f35bb24697d18bc131332d49720 Reviewed-by: Karsten Heimrich --- Changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Changelog b/Changelog index afc5799c4..46c1039a4 100644 --- a/Changelog +++ b/Changelog @@ -1,5 +1,10 @@ 1.4.1 - Added support to pass a query string when downloading archives. (QTIFW-329) +- Fixed progress display for redirected HTTP Downloads. (QTIFW-267) +- Add support to repogen to update only newer components. (QTIFW-234) +- Added more autotests. +- Improved documentation. +- Minor bugfixes. 1.4 - Force updating of Essential components. (QTIFW-38, QTIFW-155) @@ -44,6 +49,7 @@ - Minor documentation fixes and additions. - Added more autotests. - Bugfixes +- Added Japanese translation. - Updated translations - Cleaned up the Code. -- cgit v1.2.3 From 0e5fb92564b72c5b1c4aca7960e92ab7a5cb90ca Mon Sep 17 00:00:00 2001 From: Niels Weber Date: Tue, 17 Sep 2013 15:30:45 +0200 Subject: Don't show RunProgram after uninstall. Task-number: QTIFW-366 Change-Id: I34989f184a1d95d7e9aed0e3331c1b4ac8b32b52 Reviewed-by: Tim Jenssen --- src/libs/installer/packagemanagergui.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/installer/packagemanagergui.cpp b/src/libs/installer/packagemanagergui.cpp index 5d5514af9..cececaef4 100644 --- a/src/libs/installer/packagemanagergui.cpp +++ b/src/libs/installer/packagemanagergui.cpp @@ -1877,7 +1877,7 @@ void FinishedPage::entering() if (!finishedText.isEmpty()) m_msgLabel->setText(finishedText); - if (!packageManagerCore()->value(scRunProgram).isEmpty()) { + if (!packageManagerCore()->isUninstaller() && !packageManagerCore()->value(scRunProgram).isEmpty()) { m_runItCheckBox->show(); m_runItCheckBox->setText(packageManagerCore()->value(scRunProgramDescription, tr("Run %1 now.")) .arg(productName())); -- cgit v1.2.3 From 45c1b1adb64e25205c69c160f859ea7656197f78 Mon Sep 17 00:00:00 2001 From: Niels Weber Date: Tue, 17 Sep 2013 14:41:38 +0200 Subject: Clarify wizard usage of Banner and Background. Change-Id: Ia9e994cec8e94a517331c1c2b4b9dc2afde21570 Reviewed-by: Tim Jenssen --- doc/installerfw.qdoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/installerfw.qdoc b/doc/installerfw.qdoc index 7039fbca0..34293ee63 100644 --- a/doc/installerfw.qdoc +++ b/doc/installerfw.qdoc @@ -199,10 +199,10 @@ \o Filename for a watermark used as \a QWizard::WatermarkPixmap. \row \o Banner - \o Filename for a banner used as \a QWizard::BannerPixmap. + \o Filename for a banner used as \a QWizard::BannerPixmap (only used by ModernStyle). \row \o Background - \o Filename for an image used as \a QWizard::BackgroundPixmap. + \o Filename for an image used as \a QWizard::BackgroundPixmap (only used by MacStyle). \row \o RunProgram \o Command executed after the installer is done if the user accepts -- cgit v1.2.3 From f8d48bd39c4d2caef1dc189bd3bd95c5f5010780 Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Tue, 17 Sep 2013 10:21:47 +0200 Subject: Fix incremental builds The missing dependency to installer library causes corrupted incremental builds, installerbase should be rebuild when installer lib is changed. Change-Id: I588577f3d178c70dff2d84747f221d924e5cf38e Reviewed-by: Karsten Heimrich --- installerfw.pri | 6 ++++-- src/libs/7zip/7zip.pro | 3 +-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/installerfw.pri b/installerfw.pri index 4a42d3325..ba24910df 100644 --- a/installerfw.pri +++ b/installerfw.pri @@ -106,6 +106,8 @@ static { LIBS += -l7z win32-g++*: LIBS += -lmpr -luuid - win32:exists($$IFW_LIB_PATH/installer.lib):POST_TARGETDEPS += $$IFW_LIB_PATH/installer.lib - unix:exists($$IFW_LIB_PATH/libinstaller.a):POST_TARGETDEPS += $$IFW_LIB_PATH/libinstaller.a + equals(TEMPLATE, app) { + win32:POST_TARGETDEPS += $$IFW_LIB_PATH/installer.lib $$IFW_LIB_PATH/7z.lib + unix:POST_TARGETDEPS += $$IFW_LIB_PATH/libinstaller.a $$IFW_LIB_PATH/lib7z.a + } } diff --git a/src/libs/7zip/7zip.pro b/src/libs/7zip/7zip.pro index 549778e67..01b69dad2 100644 --- a/src/libs/7zip/7zip.pro +++ b/src/libs/7zip/7zip.pro @@ -1,8 +1,7 @@ -include(../../../installerfw.pri) - QT = core TARGET = 7z TEMPLATE = lib +include(../../../installerfw.pri) INCLUDEPATH += . .. CONFIG += staticlib DESTDIR = $$IFW_LIB_PATH -- cgit v1.2.3 From b240c7de4ecc8a742cae2be5901edae1ec7261b1 Mon Sep 17 00:00:00 2001 From: Tim Jenssen Date: Wed, 28 Aug 2013 12:33:28 +0200 Subject: transform progress misscalculations warnings to debugs Task-number: QTIFW-243 Change-Id: I5314da8ebc41de2e534f320ca3a44603797cfe59 Reviewed-by: Niels Weber --- src/libs/installer/progresscoordinator.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libs/installer/progresscoordinator.cpp b/src/libs/installer/progresscoordinator.cpp index 0850b39d0..7d9a68e9f 100644 --- a/src/libs/installer/progresscoordinator.cpp +++ b/src/libs/installer/progresscoordinator.cpp @@ -138,7 +138,7 @@ void ProgressCoordinator::partProgressChanged(double fraction) } if (qRound(m_currentCompletePercentage) < qRound(newCurrentCompletePercentage)) { - qWarning("This should not happen!"); + qDebug("Something is wrong with the calculation of the progress."); } m_currentCompletePercentage = newCurrentCompletePercentage; @@ -171,7 +171,7 @@ void ProgressCoordinator::partProgressChanged(double fraction) } if (qRound(m_currentCompletePercentage) > qRound(newCurrentCompletePercentage)) { - qWarning("This should not happen!"); + qDebug("Something is wrong with the calculation of the progress."); } m_currentCompletePercentage = newCurrentCompletePercentage; -- cgit v1.2.3 From c9cbd301b19f0b72a918d1b1ee66adf5fdb53bec Mon Sep 17 00:00:00 2001 From: Samuli Piippo Date: Fri, 13 Sep 2013 09:24:12 +0300 Subject: Add separate files-to-patch list for Qt5 in embedded arm This includes .pri and .cmake files which can have original build dir in them. Change-Id: I62120a1233d516dcfd163da531d72285bdc578b0 Reviewed-by: Tim Jenssen Reviewed-by: Iikka Eklund --- .../installer/resources/files-to-patch-linux-emb-arm-qt5 | 12 ++++++++++++ src/libs/installer/resources/patch_file_lists.qrc | 1 + 2 files changed, 13 insertions(+) create mode 100644 src/libs/installer/resources/files-to-patch-linux-emb-arm-qt5 diff --git a/src/libs/installer/resources/files-to-patch-linux-emb-arm-qt5 b/src/libs/installer/resources/files-to-patch-linux-emb-arm-qt5 new file mode 100644 index 000000000..8ea297b50 --- /dev/null +++ b/src/libs/installer/resources/files-to-patch-linux-emb-arm-qt5 @@ -0,0 +1,12 @@ +bin/qmake +bin/lrelease +bin/qdoc +host-bin/qmake +host-bin/lrelease +host-bin/qdoc +%% +*.la +*.prl +*.pc +*.pri +*.cmake diff --git a/src/libs/installer/resources/patch_file_lists.qrc b/src/libs/installer/resources/patch_file_lists.qrc index e898b9b23..7d20c16ac 100644 --- a/src/libs/installer/resources/patch_file_lists.qrc +++ b/src/libs/installer/resources/patch_file_lists.qrc @@ -9,5 +9,6 @@ files-to-patch-linux-emb-arm files-to-patch-windows-emb-arm files-to-patch-macx-emb-arm + files-to-patch-linux-emb-arm-qt5 -- cgit v1.2.3 From 43405ae1ce9016151ac8087d1b3c86574e147350 Mon Sep 17 00:00:00 2001 From: Niels Weber Date: Wed, 18 Sep 2013 14:42:33 +0200 Subject: Add a comment to progress calculation. Change-Id: I16696eaec19a4563f647f4337a863b39868aed4d Reviewed-by: Tim Jenssen --- src/libs/installer/progresscoordinator.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/libs/installer/progresscoordinator.cpp b/src/libs/installer/progresscoordinator.cpp index 7d9a68e9f..7ba2b0912 100644 --- a/src/libs/installer/progresscoordinator.cpp +++ b/src/libs/installer/progresscoordinator.cpp @@ -137,9 +137,9 @@ void ProgressCoordinator::partProgressChanged(double fraction) newCurrentCompletePercentage = 100; } - if (qRound(m_currentCompletePercentage) < qRound(newCurrentCompletePercentage)) { + // In undo mode, the progress has to go backward, new has to be smaller than current + if (qRound(m_currentCompletePercentage) < qRound(newCurrentCompletePercentage)) qDebug("Something is wrong with the calculation of the progress."); - } m_currentCompletePercentage = newCurrentCompletePercentage; if (fraction == 1) { @@ -170,9 +170,10 @@ void ProgressCoordinator::partProgressChanged(double fraction) newCurrentCompletePercentage = 100; } - if (qRound(m_currentCompletePercentage) > qRound(newCurrentCompletePercentage)) { + // In normal mode, the progress has to go forward, new has to be larger than current + if (qRound(m_currentCompletePercentage) > qRound(newCurrentCompletePercentage)) qDebug("Something is wrong with the calculation of the progress."); - } + m_currentCompletePercentage = newCurrentCompletePercentage; if (fraction == 1 || fraction == 0) { -- cgit v1.2.3 From 79c1b8646f4b85c1154d9eca9950cc93b1776732 Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Wed, 18 Sep 2013 17:29:39 +0200 Subject: Check for mingw-gcc vs mingw-msvc when checking dependences Fixes wrong library naiming when running with mingw-gcc Change-Id: Id8bf210f1a119e296a212a9d0570a4c918e780c5 Reviewed-by: Tim Jenssen --- installerfw.pri | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/installerfw.pri b/installerfw.pri index ba24910df..1dfee1e63 100644 --- a/installerfw.pri +++ b/installerfw.pri @@ -107,7 +107,8 @@ static { win32-g++*: LIBS += -lmpr -luuid equals(TEMPLATE, app) { - win32:POST_TARGETDEPS += $$IFW_LIB_PATH/installer.lib $$IFW_LIB_PATH/7z.lib + win32-msvc*:POST_TARGETDEPS += $$IFW_LIB_PATH/installer.lib $$IFW_LIB_PATH/7z.lib + win32-g++*:POST_TARGETDEPS += $$IFW_LIB_PATH/libinstaller.a $$IFW_LIB_PATH/lib7z.a unix:POST_TARGETDEPS += $$IFW_LIB_PATH/libinstaller.a $$IFW_LIB_PATH/lib7z.a } } -- cgit v1.2.3 From 4cc748a04410e40ac4c78ab8c16c56b9d4055516 Mon Sep 17 00:00:00 2001 From: Iikka Eklund Date: Wed, 18 Sep 2013 15:01:15 +0300 Subject: Rename iOS specific files-to-patch file to reflect qt5 content Files without "qt5" are considered qt4 content. Change-Id: I92ddb93374570caab19db26d57b494a8eac50268 Reviewed-by: Tim Jenssen --- src/libs/installer/resources/files-to-patch-macx-emb-arm | 9 --------- src/libs/installer/resources/files-to-patch-macx-emb-arm-qt5 | 9 +++++++++ src/libs/installer/resources/patch_file_lists.qrc | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) delete mode 100644 src/libs/installer/resources/files-to-patch-macx-emb-arm create mode 100644 src/libs/installer/resources/files-to-patch-macx-emb-arm-qt5 diff --git a/src/libs/installer/resources/files-to-patch-macx-emb-arm b/src/libs/installer/resources/files-to-patch-macx-emb-arm deleted file mode 100644 index c01fe17a1..000000000 --- a/src/libs/installer/resources/files-to-patch-macx-emb-arm +++ /dev/null @@ -1,9 +0,0 @@ -bin/qmake -bin/lrelease -bin/qdoc -%% -*.la -*.prl -*.pc - - diff --git a/src/libs/installer/resources/files-to-patch-macx-emb-arm-qt5 b/src/libs/installer/resources/files-to-patch-macx-emb-arm-qt5 new file mode 100644 index 000000000..c01fe17a1 --- /dev/null +++ b/src/libs/installer/resources/files-to-patch-macx-emb-arm-qt5 @@ -0,0 +1,9 @@ +bin/qmake +bin/lrelease +bin/qdoc +%% +*.la +*.prl +*.pc + + diff --git a/src/libs/installer/resources/patch_file_lists.qrc b/src/libs/installer/resources/patch_file_lists.qrc index 7d20c16ac..9ab00f951 100644 --- a/src/libs/installer/resources/patch_file_lists.qrc +++ b/src/libs/installer/resources/patch_file_lists.qrc @@ -8,7 +8,7 @@ files-to-patch-macx-qt5 files-to-patch-linux-emb-arm files-to-patch-windows-emb-arm - files-to-patch-macx-emb-arm + files-to-patch-macx-emb-arm-qt5 files-to-patch-linux-emb-arm-qt5 -- cgit v1.2.3 From e2b967f5d8ba5421cf1a026d498a6de77962362c Mon Sep 17 00:00:00 2001 From: kh1 Date: Mon, 16 Sep 2013 14:21:23 +0200 Subject: Small cleanup. Change-Id: I4c0732ac03dc98bd5ed59b6924d551c2303db407 Reviewed-by: Niels Weber Reviewed-by: Tim Jenssen --- src/libs/installer/fileutils.cpp | 3 +-- src/libs/kdtools/kdupdaterupdateoperations.cpp | 27 +++++++++++--------------- 2 files changed, 12 insertions(+), 18 deletions(-) diff --git a/src/libs/installer/fileutils.cpp b/src/libs/installer/fileutils.cpp index 9fb782fec..1fd5bf35c 100644 --- a/src/libs/installer/fileutils.cpp +++ b/src/libs/installer/fileutils.cpp @@ -282,8 +282,7 @@ void QInstaller::removeDirectory(const QString &path, bool ignoreErrors) QDirIterator it(path, QDir::NoDotAndDotDot | QDir::Dirs | QDir::NoSymLinks | QDir::Hidden, QDirIterator::Subdirectories); while (it.hasNext()) { - it.next(); - dirs.prepend(it.filePath()); + dirs.prepend(it.next()); removeFiles(dirs.at(0), ignoreErrors); } diff --git a/src/libs/kdtools/kdupdaterupdateoperations.cpp b/src/libs/kdtools/kdupdaterupdateoperations.cpp index 5a4296242..854449bc0 100644 --- a/src/libs/kdtools/kdupdaterupdateoperations.cpp +++ b/src/libs/kdtools/kdupdaterupdateoperations.cpp @@ -65,29 +65,24 @@ static QString errnoToQString(int error) #endif } -static bool removeDirectory(const QString &path, QString *errorString, bool force = true) +static bool removeDirectory(const QString &path, QString *errorString, bool force) { Q_ASSERT(errorString); - const QFileInfoList entries = QDir(path).entryInfoList(QDir::NoDotAndDotDot | QDir::AllEntries | QDir::Hidden); - for (QFileInfoList::const_iterator it = entries.constBegin(); it != entries.constEnd(); ++it) { - if (it->isDir() && !it->isSymLink()) { - removeDirectory(it->filePath(), errorString, force); - } else if (force) { - QFile f(it->filePath()); - if (!f.remove()) - return false; - } + + QDir dir = path; + const QFileInfoList entries = dir.entryInfoList(QDir::NoDotAndDotDot | QDir::AllEntries | QDir::Hidden); + foreach (const QFileInfo &entry, entries) { + if (entry.isDir() && (!entry.isSymLink())) + removeDirectory(entry.filePath(), errorString, force); + else if (force && (!QFile(entry.filePath()).remove())) + return false; } // even remove some hidden, OS-created files in there -#if defined Q_OS_MAC - QFile::remove(path + QLatin1String("/.DS_Store")); -#elif defined Q_OS_WIN - QFile::remove(path + QLatin1String("/Thumbs.db")); -#endif + QInstaller::removeSystemGeneratedFiles(path); errno = 0; - const bool success = QDir().rmdir(path); + const bool success = dir.rmdir(path); if (errno) *errorString = errnoToQString(errno); return success; -- cgit v1.2.3 From 7798b3d3e010367be64d975f2337b8019454ccf0 Mon Sep 17 00:00:00 2001 From: kh1 Date: Mon, 16 Sep 2013 15:24:10 +0200 Subject: Fix broken random name generation for temporary directories. Task-number: QTIFW-354 The function was correctly calculating the initial part of the name using QTemporaryFile, though the appended "meta" was not checked and could result in duplicated names later on. Change-Id: I00eeebbb01fbfcc5a626e4bdfe04013f8e520ed5 Reviewed-by: Niels Weber Reviewed-by: Tim Jenssen --- src/libs/installer/fileutils.cpp | 20 ++++++++++++-------- src/libs/installer/fileutils.h | 2 +- src/libs/installer/getrepositorymetainfojob.cpp | 2 +- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/libs/installer/fileutils.cpp b/src/libs/installer/fileutils.cpp index 1fd5bf35c..6f8c44622 100644 --- a/src/libs/installer/fileutils.cpp +++ b/src/libs/installer/fileutils.cpp @@ -453,14 +453,18 @@ QString QInstaller::generateTemporaryFileName(const QString &templ) return f.fileName(); } -QString QInstaller::createTemporaryDirectory(const QString &templ) -{ - const QString t = QDir::tempPath() + QLatin1String("/") + templ + QLatin1String("XXXXXX"); - QTemporaryFile f(t); - if (!f.open()) - throw Error(QObject::tr("Could not create temporary folder for template %1: %2").arg(t, f.errorString())); - const QString path = f.fileName() + QLatin1String("meta"); - qDebug() << "\nCreating meta data directory at" << path; +QString QInstaller::createTemporaryDirectory(const QString &templateName) +{ + QString path = QDir::tempPath() + QLatin1String("/") + templateName + QLatin1String("XXXXXX"); + { + QTemporaryFile f(path); + if (!f.open()) { + throw Error(QObject::tr("Could not create temporary directory %1: %2").arg(f.fileName(), + f.errorString())); + } + path = f.fileName(); + } + qDebug() << "\nCreating temporary directory at:" << path; QInstaller::mkpath(path); return path; diff --git a/src/libs/installer/fileutils.h b/src/libs/installer/fileutils.h index 9bbcec72a..c22aa36b6 100644 --- a/src/libs/installer/fileutils.h +++ b/src/libs/installer/fileutils.h @@ -108,7 +108,7 @@ private: Creates a temporary directory @throws QInstaller::Error if creating the temporary directory fails */ - QString INSTALLER_EXPORT createTemporaryDirectory(const QString &templ=QString()); + QString INSTALLER_EXPORT createTemporaryDirectory(const QString &templateName = QString()); QString INSTALLER_EXPORT generateTemporaryFileName(const QString &templ=QString()); diff --git a/src/libs/installer/getrepositorymetainfojob.cpp b/src/libs/installer/getrepositorymetainfojob.cpp index 1c8d07525..c0fca0b13 100644 --- a/src/libs/installer/getrepositorymetainfojob.cpp +++ b/src/libs/installer/getrepositorymetainfojob.cpp @@ -245,7 +245,7 @@ void GetRepositoryMetaInfoJob::updatesXmlDownloadFinished() Q_ASSERT(QFile::exists(fn)); try { - m_temporaryDirectory = createTemporaryDirectory(QLatin1String("remoterepo")); + m_temporaryDirectory = createTemporaryDirectory(QLatin1String("remoterepo-")); m_tempDirDeleter.add(m_temporaryDirectory); } catch (const QInstaller::Error& e) { finished(QInstaller::ExtractionError, e.message()); -- cgit v1.2.3 From c387e1c226bd2720ef86dada30345d9bd06d36c9 Mon Sep 17 00:00:00 2001 From: Niels Weber Date: Mon, 23 Sep 2013 12:39:08 +0200 Subject: Doc: Add note that root component can't be virtual. Task-Number: QTIFW-274 Change-Id: Ia5558c3ac60d1d01183cb4397f7e2c000b61a1c9 Reviewed-by: Tim Jenssen --- doc/installerfw.qdoc | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/installerfw.qdoc b/doc/installerfw.qdoc index 34293ee63..9cfb94d06 100644 --- a/doc/installerfw.qdoc +++ b/doc/installerfw.qdoc @@ -449,6 +449,7 @@ \row \o Virtual \o Set to \c true to hide the component from the installer. + Note that setting this on a root component does not work. \row \o SortingPriority \o Priority of the component in the tree. The tree is sorted from -- cgit v1.2.3 From ee3ccd452dc245d523497abd0e8e4d4368aa0b69 Mon Sep 17 00:00:00 2001 From: Tim Jenssen Date: Mon, 23 Sep 2013 16:28:53 +0200 Subject: remove unnecessary WindowModal at the gui Task-number: QTIFW-364 Change-Id: Id2bb7cada2386561c2b25b158c68b101382e5cc4 Reviewed-by: Karsten Heimrich --- src/sdk/tabcontroller.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/sdk/tabcontroller.cpp b/src/sdk/tabcontroller.cpp index 720f6f292..770ea8007 100644 --- a/src/sdk/tabcontroller.cpp +++ b/src/sdk/tabcontroller.cpp @@ -150,7 +150,6 @@ int TabController::init() } d->m_gui->restart(); - d->m_gui->setWindowModality(Qt::WindowModal); d->m_gui->show(); onCurrentIdChanged(d->m_gui->currentId()); -- cgit v1.2.3 From f081639d8de1170f018bfad123c65184aee3f862 Mon Sep 17 00:00:00 2001 From: Iikka Eklund Date: Thu, 19 Sep 2013 13:32:43 +0300 Subject: Add Qt5 specific windows-emb-arm-qt5 patch file Keep the current windows-emb-arm for qt4 packages. Change-Id: I6ddbd89bc74b2ee6c42bd0858e32511ed1209e22 Reviewed-by: Sergio Ahumada Reviewed-by: Niels Weber Reviewed-by: Tim Jenssen --- .../installer/resources/files-to-patch-windows-emb-arm-qt5 | 13 +++++++++++++ src/libs/installer/resources/patch_file_lists.qrc | 1 + 2 files changed, 14 insertions(+) create mode 100644 src/libs/installer/resources/files-to-patch-windows-emb-arm-qt5 diff --git a/src/libs/installer/resources/files-to-patch-windows-emb-arm-qt5 b/src/libs/installer/resources/files-to-patch-windows-emb-arm-qt5 new file mode 100644 index 000000000..a43229d18 --- /dev/null +++ b/src/libs/installer/resources/files-to-patch-windows-emb-arm-qt5 @@ -0,0 +1,13 @@ +bin/qmake.exe +bin/lrelease.exe +bin/qdoc.exe +host-bin/qmake.exe +host-bin/lrelease.exe +host-bin/qdoc.exe +%% +*.la +*.prl +*.pc +*.pri +*.cmake + diff --git a/src/libs/installer/resources/patch_file_lists.qrc b/src/libs/installer/resources/patch_file_lists.qrc index 9ab00f951..b300b69ac 100644 --- a/src/libs/installer/resources/patch_file_lists.qrc +++ b/src/libs/installer/resources/patch_file_lists.qrc @@ -8,6 +8,7 @@ files-to-patch-macx-qt5 files-to-patch-linux-emb-arm files-to-patch-windows-emb-arm + files-to-patch-windows-emb-arm-qt5 files-to-patch-macx-emb-arm-qt5 files-to-patch-linux-emb-arm-qt5 -- cgit v1.2.3 From 74f1ba9329f70b9f4b716fa882774de883fbee75 Mon Sep 17 00:00:00 2001 From: Tim Jenssen Date: Mon, 23 Sep 2013 18:48:18 +0200 Subject: add object names as API for RTA to radio buttions Task-number: QTIFW-372 Change-Id: I4b2272d0f7c482bcae2619e46e1ab3df0db77bbc Reviewed-by: Tarja Sundqvist Reviewed-by: Niels Weber --- src/sdk/installerbasecommons.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/sdk/installerbasecommons.cpp b/src/sdk/installerbasecommons.cpp index d2fb5e27b..a4e5047d0 100644 --- a/src/sdk/installerbasecommons.cpp +++ b/src/sdk/installerbasecommons.cpp @@ -75,16 +75,19 @@ IntroductionPageImpl::IntroductionPageImpl(QInstaller::PackageManagerCore *core) QVBoxLayout *layout = new QVBoxLayout(widget); m_packageManager = new QRadioButton(tr("Package manager"), this); + m_packageManager->setObjectName(QLatin1String("PackageManagerRadioButton")); layout->addWidget(m_packageManager); m_packageManager->setChecked(core->isPackageManager()); connect(m_packageManager, SIGNAL(toggled(bool)), this, SLOT(setPackageManager(bool))); m_updateComponents = new QRadioButton(tr("Update components"), this); + m_updateComponents->setObjectName(QLatin1String("UpdaterRadioButton")); layout->addWidget(m_updateComponents); m_updateComponents->setChecked(core->isUpdater()); connect(m_updateComponents, SIGNAL(toggled(bool)), this, SLOT(setUpdater(bool))); m_removeAllComponents = new QRadioButton(tr("Remove all components"), this); + m_removeAllComponents->setObjectName(QLatin1String("UninstallerRadioButton")); layout->addWidget(m_removeAllComponents); m_removeAllComponents->setChecked(core->isUninstaller()); connect(m_removeAllComponents, SIGNAL(toggled(bool)), this, SLOT(setUninstaller(bool))); -- cgit v1.2.3 From fc465784df7893abc180ede9b69b4e27aaa522f7 Mon Sep 17 00:00:00 2001 From: kh1 Date: Tue, 24 Sep 2013 14:14:14 +0200 Subject: We can't expect a multiple of 8 during marker search. Once the marker was on a position not matching a multiple of 8 from the end, the search would fail. Now decrement by 1 byte. Change-Id: Ia703c9074b3bef6b1a300865abfe24dcb2c8d5fd Reviewed-by: Tim Jenssen Reviewed-by: Niels Weber --- src/libs/installer/binaryformat.cpp | 2 +- tests/auto/installer/binaryformat/tst_binaryformat.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libs/installer/binaryformat.cpp b/src/libs/installer/binaryformat.cpp index 8e79e84c3..fe1c61ced 100644 --- a/src/libs/installer/binaryformat.cpp +++ b/src/libs/installer/binaryformat.cpp @@ -237,7 +237,7 @@ qint64 QInstaller::findMagicCookie(QFile *in, quint64 magicCookie) while (searched >= 0) { if (memcmp(&magicCookie, (mapped + searched), markerSize) == 0) return (fileSize - maxSearch) + searched; - searched -= markerSize; + --searched; } throw Error(QObject::tr("No marker found, stopped after %1.").arg(humanReadableSize(maxSearch))); diff --git a/tests/auto/installer/binaryformat/tst_binaryformat.cpp b/tests/auto/installer/binaryformat/tst_binaryformat.cpp index 6e520dc3e..59f0e8e03 100644 --- a/tests/auto/installer/binaryformat/tst_binaryformat.cpp +++ b/tests/auto/installer/binaryformat/tst_binaryformat.cpp @@ -46,7 +46,7 @@ #include #include -static const qint64 scTinySize = 51200LL; +static const qint64 scTinySize = 72704LL; static const qint64 scSmallSize = 524288LL; static const qint64 scLargeSize = 2097152LL; @@ -92,7 +92,7 @@ private slots: void testFindMagicCookieWithError() { - QTest::ignoreMessage(QtDebugMsg, "create Error-Exception: \"No marker found, stopped after 50.00 KiB.\" "); + QTest::ignoreMessage(QtDebugMsg, "create Error-Exception: \"No marker found, stopped after 71.00 KiB.\" "); QTemporaryFile file; file.open(); @@ -103,7 +103,7 @@ private slots: // throws QInstaller::findMagicCookie(&file, QInstaller::MagicCookie); } catch (const QInstaller::Error &error) { - QCOMPARE(qPrintable(error.message()), "No marker found, stopped after 50.00 KiB."); + QCOMPARE(qPrintable(error.message()), "No marker found, stopped after 71.00 KiB."); } catch (...) { QFAIL("Unexpected error."); } -- cgit v1.2.3 From a25620f52693e086b54c09518d4b7a0cab412da1 Mon Sep 17 00:00:00 2001 From: Tim Jenssen Date: Wed, 25 Sep 2013 11:56:39 +0200 Subject: move creating the temp remoterepo dir - in case we are getting a new repository it gets a reset which starts from the beginning. So it is better to create that at the end. Change-Id: I6613ce899fd695e6df8825290a7d945a67d61168 Reviewed-by: Karsten Heimrich --- src/libs/installer/getrepositorymetainfojob.cpp | 26 ++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/libs/installer/getrepositorymetainfojob.cpp b/src/libs/installer/getrepositorymetainfojob.cpp index c0fca0b13..2fd167a4a 100644 --- a/src/libs/installer/getrepositorymetainfojob.cpp +++ b/src/libs/installer/getrepositorymetainfojob.cpp @@ -244,20 +244,7 @@ void GetRepositoryMetaInfoJob::updatesXmlDownloadFinished() Q_ASSERT(!fn.isEmpty()); Q_ASSERT(QFile::exists(fn)); - try { - m_temporaryDirectory = createTemporaryDirectory(QLatin1String("remoterepo-")); - m_tempDirDeleter.add(m_temporaryDirectory); - } catch (const QInstaller::Error& e) { - finished(QInstaller::ExtractionError, e.message()); - return; - } - QFile updatesFile(fn); - if (!updatesFile.rename(m_temporaryDirectory + QLatin1String("/Updates.xml"))) { - finished(QInstaller::DownloadError, tr("Could not move Updates.xml to target location. Error: %1") - .arg(updatesFile.errorString())); - return; - } if (!updatesFile.open(QIODevice::ReadOnly)) { finished(QInstaller::DownloadError, tr("Could not open Updates.xml for reading. Error: %1") @@ -358,6 +345,19 @@ void GetRepositoryMetaInfoJob::updatesXmlDownloadFinished() } } + try { + m_temporaryDirectory = createTemporaryDirectory(QLatin1String("remoterepo-")); + m_tempDirDeleter.add(m_temporaryDirectory); + } catch (const QInstaller::Error& e) { + finished(QInstaller::ExtractionError, e.message()); + return; + } + if (!updatesFile.rename(m_temporaryDirectory + QLatin1String("/Updates.xml"))) { + finished(QInstaller::DownloadError, tr("Could not move Updates.xml to target location. Error: %1") + .arg(updatesFile.errorString())); + return; + } + setTotalAmount(m_packageNames.count() + 1); setProcessedAmount(1); emit infoMessage(this, tr("Finished updating component meta information.")); -- cgit v1.2.3 From 7a5aa97c9bb4a558ae344ca615ce5ed9642388a4 Mon Sep 17 00:00:00 2001 From: Tim Jenssen Date: Fri, 27 Sep 2013 12:14:59 +0200 Subject: remove slotCurrentPageChanged and call it directly - also renamed it to better name: executeControlScript Change-Id: Id2bb7cada2386561c2b25b158c6aa101382e5cc4 Reviewed-by: Karsten Heimrich --- src/libs/installer/packagemanagergui.cpp | 12 +++--------- src/libs/installer/packagemanagergui.h | 3 +-- tests/auto/installer/scriptengine/tst_scriptengine.cpp | 12 +++++------- 3 files changed, 9 insertions(+), 18 deletions(-) diff --git a/src/libs/installer/packagemanagergui.cpp b/src/libs/installer/packagemanagergui.cpp index cececaef4..338e8fad9 100644 --- a/src/libs/installer/packagemanagergui.cpp +++ b/src/libs/installer/packagemanagergui.cpp @@ -254,7 +254,7 @@ PackageManagerGui::PackageManagerGui(PackageManagerCore *core, QWidget *parent) connect(m_core, SIGNAL(installationFinished()), this, SLOT(showFinishedPage()), Qt::QueuedConnection); connect(m_core, SIGNAL(uninstallationFinished()), this, SLOT(showFinishedPage()), Qt::QueuedConnection); - connect(this, SIGNAL(currentIdChanged(int)), this, SLOT(slotCurrentPageChanged(int))); + connect(this, SIGNAL(currentIdChanged(int)), this, SLOT(executeControlScript(int))); connect(this, SIGNAL(currentIdChanged(int)), m_core, SIGNAL(currentPageChanged(int))); connect(button(QWizard::FinishButton), SIGNAL(clicked()), this, SIGNAL(finishButtonClicked())); connect(button(QWizard::FinishButton), SIGNAL(clicked()), m_core, SIGNAL(finishButtonClicked())); @@ -359,12 +359,6 @@ void PackageManagerGui::loadControlScript(const QString &scriptPath) qDebug() << "Loaded control script" << scriptPath; } -void PackageManagerGui::slotCurrentPageChanged(int id) -{ - QMetaObject::invokeMethod(this, "delayedControlScriptExecution", Qt::QueuedConnection, - Q_ARG(int, id)); -} - void PackageManagerGui::callControlScriptMethod(const QString &methodName) { if (!d->m_controlScriptContext.isValid()) @@ -382,9 +376,9 @@ void PackageManagerGui::callControlScriptMethod(const QString &methodName) } } -void PackageManagerGui::delayedControlScriptExecution(int id) +void PackageManagerGui::executeControlScript(int pageId) { - if (PackageManagerPage *const p = qobject_cast (page(id))) + if (PackageManagerPage *const p = qobject_cast (page(pageId))) callControlScriptMethod(p->objectName() + QLatin1String("Callback")); } diff --git a/src/libs/installer/packagemanagergui.h b/src/libs/installer/packagemanagergui.h index 5c428bf87..4f58a077d 100644 --- a/src/libs/installer/packagemanagergui.h +++ b/src/libs/installer/packagemanagergui.h @@ -116,8 +116,7 @@ protected Q_SLOTS: void wizardWidgetInsertionRequested(QWidget *widget, QInstaller::PackageManagerCore::WizardPage page); void wizardWidgetRemovalRequested(QWidget *widget); void wizardPageVisibilityChangeRequested(bool visible, int page); - void slotCurrentPageChanged(int id); - void delayedControlScriptExecution(int id); + void executeControlScript(int pageId); void setValidatorForCustomPageRequested(QInstaller::Component *component, const QString &name, const QString &callbackName); diff --git a/tests/auto/installer/scriptengine/tst_scriptengine.cpp b/tests/auto/installer/scriptengine/tst_scriptengine.cpp index 283d7bdad..b626d5a2e 100644 --- a/tests/auto/installer/scriptengine/tst_scriptengine.cpp +++ b/tests/auto/installer/scriptengine/tst_scriptengine.cpp @@ -26,9 +26,9 @@ public: virtual void init() {} - void callProtectedDelayedControlScriptExecution(int id) + void callProtectedDelayedExecuteControlScript(int id) { - delayedControlScriptExecution(id); + executeControlScript(id); } }; @@ -218,18 +218,16 @@ private slots: testGui.loadControlScript(":///data/auto-install.qs"); QCOMPARE(m_core.value("GuiTestValue"), QString("hello")); - testGui.show(); // show event calls automatically the first callback which does not exist setExpectedScriptOutput("Control script callback \"IntroductionPageCallback\" does not exist. "); - // give some time to the event triggering mechanism - qApp->processEvents(); + testGui.show(); // inside the auto-install script we are clicking the next button, with a not existing button QTest::ignoreMessage(QtWarningMsg, "Button with type: \"unknown button\" not found! "); - testGui.callProtectedDelayedControlScriptExecution(PackageManagerCore::ComponentSelection); + testGui.callProtectedDelayedExecuteControlScript(PackageManagerCore::ComponentSelection); setExpectedScriptOutput("FinishedPageCallback - OK"); - testGui.callProtectedDelayedControlScriptExecution(PackageManagerCore::InstallationFinished); + testGui.callProtectedDelayedExecuteControlScript(PackageManagerCore::InstallationFinished); } catch (const Error &error) { QFAIL(qPrintable(error.message())); } -- cgit v1.2.3 From 047844cddf143ecfddac90040eecd966f2e20b65 Mon Sep 17 00:00:00 2001 From: Tim Jenssen Date: Fri, 27 Sep 2013 12:45:58 +0200 Subject: Fix possible crash. Disable close button during installer run. Change-Id: I6a0affab7394e3ae9669904bbfc48617b5cb1bd5 Reviewed-by: Tim Jenssen --- installerfw.pri | 3 +++ src/sdk/installerbase_p.cpp | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/installerfw.pri b/installerfw.pri index 1dfee1e63..0271433cd 100644 --- a/installerfw.pri +++ b/installerfw.pri @@ -56,6 +56,9 @@ unix:INCLUDEPATH += $$IFW_SOURCE_TREE/src/libs/7zip/unix/CPP LIBS += -L$$IFW_LIB_PATH # The order is important. The linker needs to parse archives in reversed dependency order. equals(TEMPLATE, app):LIBS += -linstaller +win32:equals(TEMPLATE, app) { + LIBS += -luser32 +} unix:!macx:LIBS += -lutil macx:LIBS += -framework Carbon -framework Security diff --git a/src/sdk/installerbase_p.cpp b/src/sdk/installerbase_p.cpp index 6e4002f30..d75aad01c 100644 --- a/src/sdk/installerbase_p.cpp +++ b/src/sdk/installerbase_p.cpp @@ -135,6 +135,11 @@ public: m_oldCerr = std::cerr.rdbuf(); m_newCerr.open("CONOUT$"); std::cerr.rdbuf(m_newCerr.rdbuf()); + + HMENU systemMenu = GetSystemMenu(GetConsoleWindow(), FALSE); + if (systemMenu != NULL) + RemoveMenu(systemMenu, SC_CLOSE, MF_BYCOMMAND); + DrawMenuBar(GetConsoleWindow()); #endif } ~MyApplicationConsole() -- cgit v1.2.3 From 5d8197d3d2d1f36be5046851f22c281e61fb74e9 Mon Sep 17 00:00:00 2001 From: Tim Jenssen Date: Fri, 27 Sep 2013 11:59:15 +0200 Subject: fix that setTemRepository added child repos to the default ones Task-number: QTIFW-373 Change-Id: I30646ef084d9ec6f3a393992a9c96e1f77dbf3d9 Reviewed-by: Karsten Heimrich --- src/libs/installer/getrepositorymetainfojob.cpp | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/libs/installer/getrepositorymetainfojob.cpp b/src/libs/installer/getrepositorymetainfojob.cpp index 2fd167a4a..b163b5e15 100644 --- a/src/libs/installer/getrepositorymetainfojob.cpp +++ b/src/libs/installer/getrepositorymetainfojob.cpp @@ -318,7 +318,28 @@ void GetRepositoryMetaInfoJob::updatesXmlDownloadFinished() } if (!repositoryUpdates.isEmpty()) { - if (m_core->settings().updateDefaultRepositories(repositoryUpdates) == Settings::UpdatesApplied) { + const QSet temporaries = m_core->settings().temporaryRepositories(); + // in case the temp repository introduced something new, we only want that temporary + if (temporaries.contains(m_repository)) { + + QSet childTempRepositories; + typedef QPair RepositoryPair; + + QList values = repositoryUpdates.values(QLatin1String("add")); + foreach (const RepositoryPair &value, values) + childTempRepositories.insert(value.first); + + values = repositoryUpdates.values(QLatin1String("replace")); + foreach (const RepositoryPair &value, values) + childTempRepositories.insert(value.first); + + QSet newChildTempRepositories = childTempRepositories.subtract(temporaries); + if (newChildTempRepositories.count() > 0) { + m_core->settings().addTemporaryRepositories(newChildTempRepositories, true); + finished(QInstaller::RepositoryUpdatesReceived, tr("Repository updates received.")); + return; + } + } else if (m_core->settings().updateDefaultRepositories(repositoryUpdates) == Settings::UpdatesApplied) { if (m_core->isUpdater() || m_core->isPackageManager()) m_core->writeMaintenanceConfigFiles(); finished(QInstaller::RepositoryUpdatesReceived, tr("Repository updates received.")); -- cgit v1.2.3 From 35d4fb114868554ccabe0ff09f015bd29c8530f3 Mon Sep 17 00:00:00 2001 From: Tim Jenssen Date: Fri, 27 Sep 2013 12:01:45 +0200 Subject: ignore filtered repositories as early as possible - we had a recursion if a repository was added which was filtered later again Change-Id: I980a613fa75de42940ec49b941e302f1bf326ca9 Reviewed-by: Iikka Eklund Reviewed-by: Karsten Heimrich --- src/libs/installer/getrepositorymetainfojob.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/libs/installer/getrepositorymetainfojob.cpp b/src/libs/installer/getrepositorymetainfojob.cpp index b163b5e15..309d9aff3 100644 --- a/src/libs/installer/getrepositorymetainfojob.cpp +++ b/src/libs/installer/getrepositorymetainfojob.cpp @@ -49,6 +49,8 @@ #include "kdupdaterfiledownloader.h" #include "kdupdaterfiledownloaderfactory.h" +#include "productkeycheck.h" + #include @@ -289,9 +291,10 @@ void GetRepositoryMetaInfoJob::updatesXmlDownloadFinished() repository.setUsername(el.attribute(QLatin1String("username"))); repository.setPassword(el.attribute(QLatin1String("password"))); repository.setDisplayName(el.attribute(QLatin1String("displayname"))); - repositoryUpdates.insertMulti(action, qMakePair(repository, Repository())); - - qDebug() << "Repository to add:" << repository.url().toString(); + if (ProductKeyCheck::instance()->isValidRepository(repository)) { + repositoryUpdates.insertMulti(action, qMakePair(repository, Repository())); + qDebug() << "Repository to add:" << repository.url().toString(); + } } else if (action == QLatin1String("remove")) { // remove possible default repositories using the given server url Repository repository(el.attribute(QLatin1String("url")), true); @@ -306,10 +309,12 @@ void GetRepositoryMetaInfoJob::updatesXmlDownloadFinished() newRepository.setPassword(el.attribute(QLatin1String("password"))); newRepository.setDisplayName(el.attribute(QLatin1String("displayname"))); - // store the new repository and the one old it replaces - repositoryUpdates.insertMulti(action, qMakePair(newRepository, oldRepository)); - qDebug() << "Replace repository:" << oldRepository.url().toString() << "with:" - << newRepository.url().toString(); + if (ProductKeyCheck::instance()->isValidRepository(newRepository)) { + // store the new repository and the one old it replaces + repositoryUpdates.insertMulti(action, qMakePair(newRepository, oldRepository)); + qDebug() << "Replace repository:" << oldRepository.url().toString() << "with:" + << newRepository.url().toString(); + } } else { qDebug() << "Invalid additional repositories action set in Updates.xml fetched from:" << m_repository.url().toString() << "Line:" << el.lineNumber(); -- cgit v1.2.3 From 33d5230dc70790130d377b2272c71669b6c3acff Mon Sep 17 00:00:00 2001 From: kh1 Date: Mon, 30 Sep 2013 13:32:06 +0200 Subject: Fix compile error. Change-Id: Ibb90804435248541ca8c2ecaaf88e394f9bf403f Reviewed-by: Tim Jenssen --- src/sdk/installerbase_p.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/sdk/installerbase_p.cpp b/src/sdk/installerbase_p.cpp index d75aad01c..d9ac4f9b2 100644 --- a/src/sdk/installerbase_p.cpp +++ b/src/sdk/installerbase_p.cpp @@ -63,7 +63,14 @@ #include #ifdef Q_OS_WIN +# ifdef Q_CC_MINGW +# ifndef _WIN32_WINNT +# define _WIN32_WINNT 0x0501 +# endif +#endif + # include +# include # ifndef ENABLE_INSERT_MODE # define ENABLE_INSERT_MODE 0x0020 -- cgit v1.2.3 From 5ac4ca834fb1f183585c5dbbb13690ebb9a53753 Mon Sep 17 00:00:00 2001 From: Tim Jenssen Date: Fri, 4 Oct 2013 14:03:07 +0200 Subject: remove possible leaks of the real url Change-Id: I630105db27a52b85b8c1da859aa35a2442c8cee2 Reviewed-by: Iikka Eklund Reviewed-by: Karsten Heimrich --- src/libs/installer/getrepositorymetainfojob.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/libs/installer/getrepositorymetainfojob.cpp b/src/libs/installer/getrepositorymetainfojob.cpp index 309d9aff3..14bcf26f2 100644 --- a/src/libs/installer/getrepositorymetainfojob.cpp +++ b/src/libs/installer/getrepositorymetainfojob.cpp @@ -199,14 +199,14 @@ void GetRepositoryMetaInfoJob::startUpdatesXmlDownload() } if (!url.isValid()) { - finished(QInstaller::InvalidUrl, tr("Invalid repository URL: %1").arg(url.toString())); + finished(QInstaller::InvalidUrl, tr("Invalid repository URL: %1").arg(m_repository.displayname())); return; } m_downloader = FileDownloaderFactory::instance().create(url.scheme(), this); if (!m_downloader) { finished(QInstaller::InvalidUrl, tr("URL scheme not supported: %1 (%2)").arg(url.scheme(), - url.toString())); + m_repository.displayname())); return; } @@ -261,7 +261,7 @@ void GetRepositoryMetaInfoJob::updatesXmlDownloadFinished() if (!success) { const QString msg = tr("Could not fetch a valid version of Updates.xml from repository: %1. " - "Error: %2").arg(m_repository.url().toString(), err); + "Error: %2").arg(m_repository.displayname(), err); const QMessageBox::StandardButton b = MessageBoxHandler::critical(MessageBoxHandler::currentBestSuitParent(), @@ -293,14 +293,14 @@ void GetRepositoryMetaInfoJob::updatesXmlDownloadFinished() repository.setDisplayName(el.attribute(QLatin1String("displayname"))); if (ProductKeyCheck::instance()->isValidRepository(repository)) { repositoryUpdates.insertMulti(action, qMakePair(repository, Repository())); - qDebug() << "Repository to add:" << repository.url().toString(); + qDebug() << "Repository to add:" << repository.displayname(); } } else if (action == QLatin1String("remove")) { // remove possible default repositories using the given server url Repository repository(el.attribute(QLatin1String("url")), true); repositoryUpdates.insertMulti(action, qMakePair(repository, Repository())); - qDebug() << "Repository to remove:" << repository.url().toString(); + qDebug() << "Repository to remove:" << repository.displayname(); } else if (action == QLatin1String("replace")) { // replace possible default repositories using the given server url Repository oldRepository(el.attribute(QLatin1String("oldUrl")), true); @@ -312,12 +312,12 @@ void GetRepositoryMetaInfoJob::updatesXmlDownloadFinished() if (ProductKeyCheck::instance()->isValidRepository(newRepository)) { // store the new repository and the one old it replaces repositoryUpdates.insertMulti(action, qMakePair(newRepository, oldRepository)); - qDebug() << "Replace repository:" << oldRepository.url().toString() << "with:" - << newRepository.url().toString(); + qDebug() << "Replace repository:" << oldRepository.displayname() << "with:" + << newRepository.displayname(); } } else { qDebug() << "Invalid additional repositories action set in Updates.xml fetched from:" - << m_repository.url().toString() << "Line:" << el.lineNumber(); + << m_repository.displayname() << "Line:" << el.lineNumber(); } } } @@ -453,7 +453,7 @@ void GetRepositoryMetaInfoJob::fetchNextMetaInfo() if (!m_downloader) { m_currentPackageName.clear(); m_currentPackageVersion.clear(); - qWarning() << "Scheme not supported:" << url.toString(); + qWarning() << "Scheme not supported:" << m_repository.displayname(); QMetaObject::invokeMethod(this, "fetchNextMetaInfo", Qt::QueuedConnection); return; } -- cgit v1.2.3 From 1d090c2899925d03435dc8a160b431b2e57739b9 Mon Sep 17 00:00:00 2001 From: Tim Jenssen Date: Fri, 4 Oct 2013 16:38:19 +0200 Subject: make replacing installer base binary more verbose Change-Id: Ib11b3cfa4121241421d479af23ed0ee111c0069c Reviewed-by: Karsten Heimrich Reviewed-by: Michal Klocek --- src/libs/installer/packagemanagercore_p.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/libs/installer/packagemanagercore_p.cpp b/src/libs/installer/packagemanagercore_p.cpp index a840d6d1e..743e41490 100644 --- a/src/libs/installer/packagemanagercore_p.cpp +++ b/src/libs/installer/packagemanagercore_p.cpp @@ -1265,13 +1265,18 @@ void PackageManagerCorePrivate::writeUninstaller(OperationList performedOperatio bool newBinaryWritten = false; bool replacementExists = false; const QString installerBaseBinary = m_core->replaceVariables(m_installerBaseBinaryUnreplaced); - if (!installerBaseBinary.isEmpty() && QFileInfo(installerBaseBinary).exists()) { + if (!installerBaseBinary.isEmpty() && !QFileInfo(installerBaseBinary).exists()) { + qWarning() << "The current installer base binary could not updated with a not existing '%1'. " + "Please fix the 'installer.setInstallerBaseBinary()' call " + "in your scripts."; + } else if (!installerBaseBinary.isEmpty()) { qDebug() << "Got a replacement installer base binary:" << installerBaseBinary; QFile replacementBinary(installerBaseBinary); try { openForRead(&replacementBinary, replacementBinary.fileName()); writeUninstallerBinary(&replacementBinary, replacementBinary.size(), true); + qDebug() << "Wrote the binary with the new replacement."; m_forceRestart = true; newBinaryWritten = true; @@ -1280,7 +1285,10 @@ void PackageManagerCorePrivate::writeUninstaller(OperationList performedOperatio qDebug() << error.message(); } - if (!replacementBinary.remove()) { + if (replacementBinary.remove()) { + qDebug() << QString::fromLatin1("Removed temporary installer base replacement binary file: %1").arg( + installerBaseBinary); + } else { // Is there anything more sensible we can do with this error? I think not. It's not serious // enough for throwing / aborting the process. qDebug() << QString::fromLatin1("Could not remove installer base binary (%1) after updating " -- cgit v1.2.3 From c8de51cadbc5855ca1e77d038d7f09bf60d059ee Mon Sep 17 00:00:00 2001 From: kh1 Date: Tue, 8 Oct 2013 16:09:01 +0200 Subject: Connect extract operation to progress calculation. Ignore senders which are sending 100% more then once, got that from 7z lib at the extracting step. Task-number: QTIFW-11 Task-number: QTIFW-141 Change-Id: I7750f9e49d5705df91e6c79c7ee2b0530e156e84 Reviewed-by: Karsten Heimrich Reviewed-by: Tim Jenssen --- src/libs/installer/extractarchiveoperation.cpp | 13 ++++++------- src/libs/installer/extractarchiveoperation.h | 3 ++- src/libs/installer/extractarchiveoperation_p.h | 16 +++++++++++----- src/libs/installer/progresscoordinator.cpp | 20 +++++++++++++++++++- 4 files changed, 38 insertions(+), 14 deletions(-) diff --git a/src/libs/installer/extractarchiveoperation.cpp b/src/libs/installer/extractarchiveoperation.cpp index 48c5db2c9..3897de4e4 100644 --- a/src/libs/installer/extractarchiveoperation.cpp +++ b/src/libs/installer/extractarchiveoperation.cpp @@ -75,13 +75,12 @@ bool ExtractArchiveOperation::performOperation() Receiver receiver; Callback callback; - // usually we have to connect it as queued connection but then some blocking work is in the main thread - connect(&callback, SIGNAL(progressChanged(QString)), this, SLOT(slotProgressChanged(QString)), - Qt::DirectConnection); + connect(&callback, SIGNAL(currentFileChanged(QString)), this, SLOT(fileFinished(QString))); + connect(&callback, SIGNAL(progressChanged(double)), this, SIGNAL(progressChanged(double))); if (PackageManagerCore *core = this->value(QLatin1String("installer")).value()) { connect(core, SIGNAL(statusChanged(QInstaller::PackageManagerCore::Status)), &callback, - SLOT(statusChanged(QInstaller::PackageManagerCore::Status)), Qt::QueuedConnection); + SLOT(statusChanged(QInstaller::PackageManagerCore::Status))); } //Runnable is derived from QRunable which will be deleted by the ThreadPool -> no parent is needed @@ -125,8 +124,8 @@ bool ExtractArchiveOperation::undoOperation() const QStringList files = value(QLatin1String("files")).toStringList(); WorkerThread *const thread = new WorkerThread(this, files); - connect(thread, SIGNAL(outputTextChanged(QString)), this, SIGNAL(outputTextChanged(QString)), - Qt::QueuedConnection); + connect(thread, SIGNAL(currentFileChanged(QString)), this, SIGNAL(outputTextChanged(QString))); + connect(thread, SIGNAL(progressChanged(double)), this, SIGNAL(progressChanged(double))); QEventLoop loop; connect(thread, SIGNAL(finished()), &loop, SLOT(quit()), Qt::QueuedConnection); @@ -149,7 +148,7 @@ Operation *ExtractArchiveOperation::clone() const /*! This slot is direct connected to the caller so please don't call it from another thread in the same time. */ -void ExtractArchiveOperation::slotProgressChanged(const QString &filename) +void ExtractArchiveOperation::fileFinished(const QString &filename) { QStringList files = value(QLatin1String("files")).toStringList(); files.prepend(filename); diff --git a/src/libs/installer/extractarchiveoperation.h b/src/libs/installer/extractarchiveoperation.h index 818672fd3..53df81e73 100644 --- a/src/libs/installer/extractarchiveoperation.h +++ b/src/libs/installer/extractarchiveoperation.h @@ -64,9 +64,10 @@ public: Q_SIGNALS: void outputTextChanged(const QString &progress); + void progressChanged(double); private Q_SLOTS: - void slotProgressChanged(const QString &progress); + void fileFinished(const QString &progress); private: class Callback; diff --git a/src/libs/installer/extractarchiveoperation_p.h b/src/libs/installer/extractarchiveoperation_p.h index 4e0632830..c7284d9c2 100644 --- a/src/libs/installer/extractarchiveoperation_p.h +++ b/src/libs/installer/extractarchiveoperation_p.h @@ -71,9 +71,12 @@ public: ExtractArchiveOperation *const op = m_op;//dynamic_cast< ExtractArchiveOperation* >(parent()); Q_ASSERT(op != 0); + int removedCounter = 0; foreach (const QString &file, m_files) { + removedCounter++; const QFileInfo fi(file); - emit outputTextChanged(file); + emit currentFileChanged(file); + emit progressChanged(double(removedCounter) / m_files.count()); if (fi.isFile() || fi.isSymLink()) { op->deleteFileNowOrLater(fi.absoluteFilePath()); } else if (fi.isDir()) { @@ -85,7 +88,8 @@ public: } Q_SIGNALS: - void outputTextChanged(const QString &filename); + void currentFileChanged(const QString &filename); + void progressChanged(double); private: QStringList m_files; @@ -105,7 +109,8 @@ public: Callback() : state(S_OK), createBackups(true) {} Q_SIGNALS: - void progressChanged(const QString &filename); + void currentFileChanged(const QString &filename); + void progressChanged(double progress); public Q_SLOTS: void statusChanged(QInstaller::PackageManagerCore::Status status) @@ -130,7 +135,7 @@ public Q_SLOTS: protected: void setCurrentFile(const QString &filename) { - emit progressChanged(QDir::toNativeSeparators(filename)); + emit currentFileChanged(QDir::toNativeSeparators(filename)); } static QString generateBackupName(const QString &fn) @@ -161,8 +166,9 @@ protected: return true; } - HRESULT setCompleted(quint64 /*completed*/, quint64 /*total*/) + HRESULT setCompleted(quint64 completed, quint64 total) { + emit progressChanged(double(completed) / total); return state; } }; diff --git a/src/libs/installer/progresscoordinator.cpp b/src/libs/installer/progresscoordinator.cpp index 7ba2b0912..e55f4b8bb 100644 --- a/src/libs/installer/progresscoordinator.cpp +++ b/src/libs/installer/progresscoordinator.cpp @@ -103,6 +103,14 @@ void ProgressCoordinator::registerPartProgress(QObject *sender, const char *sign Q_ASSERT(isConnected); } + +/*! + This slot gets the progress changed signals from different tasks. The values 0 and 1 are handled as + special values. + + 0 - is just ignored, so you can use a timer which gives the progress, e.g. like a downloader does. + 1 - means the task is finished, even if there comes another 1 from that task, so it will be ignored. +*/ void ProgressCoordinator::partProgressChanged(double fraction) { if (fraction < 0 || fraction > 1) { @@ -110,6 +118,16 @@ void ProgressCoordinator::partProgressChanged(double fraction) return; } + // no fraction no change + if (fraction == 0) + return; + + // ignore senders sending 100% multiple times + if (fraction == 1 && m_senderPendingCalculatedPercentageHash.contains(sender()) + && m_senderPendingCalculatedPercentageHash.value(sender()) == 0) { + return; + } + double partProgressSize = m_senderPartProgressSizeHash.value(sender(), 0); if (partProgressSize == 0) { qWarning() << "It seems that this sender was not registered in the right way:" << sender(); @@ -176,7 +194,7 @@ void ProgressCoordinator::partProgressChanged(double fraction) m_currentCompletePercentage = newCurrentCompletePercentage; - if (fraction == 1 || fraction == 0) { + if (fraction == 1) { m_currentBasePercentage = m_currentBasePercentage + pendingCalculatedPartPercentage; m_senderPendingCalculatedPercentageHash.insert(sender(), 0); } else { -- cgit v1.2.3 From 8531ff383ba8b9f43da0119f5e9761dd2d98a006 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Fri, 11 Oct 2013 14:41:30 +0200 Subject: Fix target dir for root installations and empty AdminTargetDir Make sure e.g. '@homeDir@' is replaced also in this case. Change-Id: Ife5b2d88e19abdab8b9264c5db09c1d9b5c13916 Reviewed-by: Karsten Heimrich --- src/libs/installer/packagemanagercoredata.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/installer/packagemanagercoredata.cpp b/src/libs/installer/packagemanagercoredata.cpp index 2294a8086..65123efba 100644 --- a/src/libs/installer/packagemanagercoredata.cpp +++ b/src/libs/installer/packagemanagercoredata.cpp @@ -138,7 +138,7 @@ QVariant PackageManagerCoreData::value(const QString &key, const QVariant &_defa if (key == scTargetDir) { QString dir = m_variables.value(key); if (dir.isEmpty()) - dir = m_settings.value(key, _default).toString(); + dir = replaceVariables(m_settings.value(key, _default).toString()); #ifdef Q_OS_WIN return QInstaller::normalizePathName(dir); #else -- cgit v1.2.3 From 160fe9fefda4078538e4719762f76f37121de1d3 Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Fri, 11 Oct 2013 17:48:08 +0200 Subject: Fix broken dependency resolver * dependencies can have versions * remove version before sorting dependecy graph Change-Id: Iceefd7939fffcb5c5ad94d0e915de9e2d6eba172 Reviewed-by: Karsten Heimrich --- src/libs/installer/packagemanagercore_p.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/libs/installer/packagemanagercore_p.cpp b/src/libs/installer/packagemanagercore_p.cpp index 743e41490..a8978bb52 100644 --- a/src/libs/installer/packagemanagercore_p.cpp +++ b/src/libs/installer/packagemanagercore_p.cpp @@ -2397,9 +2397,11 @@ OperationList PackageManagerCorePrivate::sortOperationsBasedOnComponentDependenc // create the complete component graph Graph componentGraph; + const QRegExp dash(QLatin1String("-.*")); foreach (const Component* componentNode, m_core->availableComponents()) { componentGraph.addNode(componentNode->name()); - componentGraph.addEdges(componentNode->name(), componentNode->dependencies()); + const QStringList dependencies = componentNode->dependencies().replaceInStrings(dash,QString()); + componentGraph.addEdges(componentNode->name(), dependencies); } foreach (const QString &componentName, componentGraph.sort()) -- cgit v1.2.3 From bd589a9a297fc16d1370c9de24d04afe9c5254e9 Mon Sep 17 00:00:00 2001 From: kh1 Date: Mon, 14 Oct 2013 14:35:37 +0200 Subject: Compile on mingw. Change-Id: I2a9a85e88dffa62af57c8502533a0c131ecf1b8e Reviewed-by: Christian Stenger --- src/sdk/installerbase_p.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/sdk/installerbase_p.cpp b/src/sdk/installerbase_p.cpp index d9ac4f9b2..4fcbe7b6e 100644 --- a/src/sdk/installerbase_p.cpp +++ b/src/sdk/installerbase_p.cpp @@ -63,14 +63,8 @@ #include #ifdef Q_OS_WIN -# ifdef Q_CC_MINGW -# ifndef _WIN32_WINNT -# define _WIN32_WINNT 0x0501 -# endif -#endif - -# include # include +# include # ifndef ENABLE_INSERT_MODE # define ENABLE_INSERT_MODE 0x0020 @@ -142,11 +136,12 @@ public: m_oldCerr = std::cerr.rdbuf(); m_newCerr.open("CONOUT$"); std::cerr.rdbuf(m_newCerr.rdbuf()); - +# ifndef Q_CC_MINGW HMENU systemMenu = GetSystemMenu(GetConsoleWindow(), FALSE); if (systemMenu != NULL) RemoveMenu(systemMenu, SC_CLOSE, MF_BYCOMMAND); DrawMenuBar(GetConsoleWindow()); +# endif #endif } ~MyApplicationConsole() -- cgit v1.2.3 From 919b434d2c97c13a024baf356d4408c4b05d4b18 Mon Sep 17 00:00:00 2001 From: Tim Jenssen Date: Thu, 10 Oct 2013 10:59:05 +0200 Subject: keep the old patch file list up to date Later we can remove the versions without any version ending, but currently we have some old components which are using this. Change-Id: I593b46a23807b0e64fd86e543b28951e23424a3c Reviewed-by: Iikka Eklund --- src/libs/installer/resources/files-to-patch-linux-emb-arm | 4 ++-- .../installer/resources/files-to-patch-linux-emb-arm-qt4 | 12 ++++++++++++ src/libs/installer/resources/files-to-patch-windows-emb-arm | 2 ++ 3 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 src/libs/installer/resources/files-to-patch-linux-emb-arm-qt4 diff --git a/src/libs/installer/resources/files-to-patch-linux-emb-arm b/src/libs/installer/resources/files-to-patch-linux-emb-arm index f6a4b59b7..8ea297b50 100644 --- a/src/libs/installer/resources/files-to-patch-linux-emb-arm +++ b/src/libs/installer/resources/files-to-patch-linux-emb-arm @@ -8,5 +8,5 @@ host-bin/qdoc *.la *.prl *.pc - - +*.pri +*.cmake diff --git a/src/libs/installer/resources/files-to-patch-linux-emb-arm-qt4 b/src/libs/installer/resources/files-to-patch-linux-emb-arm-qt4 new file mode 100644 index 000000000..f6a4b59b7 --- /dev/null +++ b/src/libs/installer/resources/files-to-patch-linux-emb-arm-qt4 @@ -0,0 +1,12 @@ +bin/qmake +bin/lrelease +bin/qdoc +host-bin/qmake +host-bin/lrelease +host-bin/qdoc +%% +*.la +*.prl +*.pc + + diff --git a/src/libs/installer/resources/files-to-patch-windows-emb-arm b/src/libs/installer/resources/files-to-patch-windows-emb-arm index 674adaff6..a43229d18 100644 --- a/src/libs/installer/resources/files-to-patch-windows-emb-arm +++ b/src/libs/installer/resources/files-to-patch-windows-emb-arm @@ -8,4 +8,6 @@ host-bin/qdoc.exe *.la *.prl *.pc +*.pri +*.cmake -- cgit v1.2.3 From 0b8592fab98e9f8803d469c16146ef910caa6c51 Mon Sep 17 00:00:00 2001 From: kh1 Date: Mon, 14 Oct 2013 19:26:18 +0200 Subject: Make sure we parse and pass arguments as early as possible. Change-Id: I384f036a24e3eb648bde0fa8e40ab8dcb0779e7b Reviewed-by: Michal Klocek Reviewed-by: Tim Jenssen --- src/sdk/installerbase.cpp | 106 +++++++++++++++++++++++----------------------- 1 file changed, 53 insertions(+), 53 deletions(-) diff --git a/src/sdk/installerbase.cpp b/src/sdk/installerbase.cpp index 870182e13..15073cf07 100644 --- a/src/sdk/installerbase.cpp +++ b/src/sdk/installerbase.cpp @@ -296,59 +296,6 @@ int main(int argc, char *argv[]) // instantiate the installer we are actually going to use QInstaller::PackageManagerCore core(content.magicMarker(), content.performedOperations()); - if (QInstaller::isVerbose()) { - qDebug() << "Resource tree after loading the in-binary resource:"; - - QDir dir = QDir(QLatin1String(":/")); - foreach (const QString &i, dir.entryList()) - qDebug() << QString::fromLatin1(" :/%1").arg(i); - - dir = QDir(QLatin1String(":/metadata/")); - foreach (const QString &i, dir.entryList()) - qDebug() << QString::fromLatin1(" :/metadata/%1").arg(i); - - dir = QDir(QLatin1String(":/translations/")); - foreach (const QString &i, dir.entryList()) - qDebug() << QString::fromLatin1(" :/translations/%1").arg(i); - } - - const QString directory = QLatin1String(":/translations"); - const QStringList translations = core.settings().translations(); - - // install the default Qt translator - QScopedPointer translator(new QTranslator(&app)); - foreach (const QLocale locale, QLocale().uiLanguages()) { - // As there is no qt_en.qm, we simply end the search when the next - // preferred language is English. - if (locale.language() == QLocale::English) - break; - if (translator->load(locale, QLatin1String("qt"), QString::fromLatin1("_"), directory)) { - app.installTranslator(translator.take()); - break; - } - } - - translator.reset(new QTranslator(&app)); - // install English translation as fallback so that correct license button text is used - if (translator->load(QLatin1String("en_us"), directory)) - app.installTranslator(translator.take()); - - if (translations.isEmpty()) { - translator.reset(new QTranslator(&app)); - foreach (const QLocale locale, QLocale().uiLanguages()) { - if (translator->load(locale, QLatin1String(""), QLatin1String(""), directory)) { - app.installTranslator(translator.take()); - break; - } - } - } else { - foreach (const QString &translation, translations) { - translator.reset(new QTranslator(&app)); - if (translator->load(translation, QLatin1String(":/translations"))) - app.installTranslator(translator.take()); - } - } - QString controlScript; QHash params; for (int i = 1; i < args.size(); ++i) { @@ -413,6 +360,59 @@ int main(int argc, char *argv[]) } } + if (QInstaller::isVerbose()) { + qDebug() << "Resource tree after loading the in-binary resource:"; + + QDir dir = QDir(QLatin1String(":/")); + foreach (const QString &i, dir.entryList()) + qDebug() << QString::fromLatin1(" :/%1").arg(i); + + dir = QDir(QLatin1String(":/metadata/")); + foreach (const QString &i, dir.entryList()) + qDebug() << QString::fromLatin1(" :/metadata/%1").arg(i); + + dir = QDir(QLatin1String(":/translations/")); + foreach (const QString &i, dir.entryList()) + qDebug() << QString::fromLatin1(" :/translations/%1").arg(i); + } + + const QString directory = QLatin1String(":/translations"); + const QStringList translations = core.settings().translations(); + + // install the default Qt translator + QScopedPointer translator(new QTranslator(&app)); + foreach (const QLocale locale, QLocale().uiLanguages()) { + // As there is no qt_en.qm, we simply end the search when the next + // preferred language is English. + if (locale.language() == QLocale::English) + break; + if (translator->load(locale, QLatin1String("qt"), QString::fromLatin1("_"), directory)) { + app.installTranslator(translator.take()); + break; + } + } + + translator.reset(new QTranslator(&app)); + // install English translation as fallback so that correct license button text is used + if (translator->load(QLatin1String("en_us"), directory)) + app.installTranslator(translator.take()); + + if (translations.isEmpty()) { + translator.reset(new QTranslator(&app)); + foreach (const QLocale locale, QLocale().uiLanguages()) { + if (translator->load(locale, QLatin1String(""), QLatin1String(""), directory)) { + app.installTranslator(translator.take()); + break; + } + } + } else { + foreach (const QString &translation, translations) { + translator.reset(new QTranslator(&app)); + if (translator->load(translation, QLatin1String(":/translations"))) + app.installTranslator(translator.take()); + } + } + // Create the wizard gui TabController controller(0); controller.setManager(&core); -- cgit v1.2.3 From 27a63dd497c25f9cc1c97b4decfacd618114521c Mon Sep 17 00:00:00 2001 From: kh1 Date: Wed, 16 Oct 2013 12:48:21 +0200 Subject: Be more verbose on the resource tree. Change-Id: I1e079f94767d95d997ebb6d758c40e605fd36c75 Reviewed-by: Tim Jenssen --- src/sdk/installerbase.cpp | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/src/sdk/installerbase.cpp b/src/sdk/installerbase.cpp index 15073cf07..e188107f9 100644 --- a/src/sdk/installerbase.cpp +++ b/src/sdk/installerbase.cpp @@ -61,6 +61,7 @@ #include #include +#include #include #include @@ -254,11 +255,10 @@ int main(int argc, char *argv[]) qDebug() << "Resource tree before loading the in-binary resource:"; qDebug() << "Language: " << QLocale().uiLanguages().value(0, QLatin1String("No UI language set")); - QDir dir(QLatin1String(":/")); - foreach (const QString &i, dir.entryList()) { - const QByteArray ba = i.toUtf8(); - qDebug().nospace() << " :/" << ba.constData(); - } + QDirIterator it(QLatin1String(":/"), QDir::NoDotAndDotDot | QDir::AllEntries | QDir::Hidden, + QDirIterator::Subdirectories); + while (it.hasNext()) + qDebug() << QString::fromLatin1(" %1").arg(it.next()); } // register custom operations before reading the binary content cause they may used in @@ -362,18 +362,10 @@ int main(int argc, char *argv[]) if (QInstaller::isVerbose()) { qDebug() << "Resource tree after loading the in-binary resource:"; - - QDir dir = QDir(QLatin1String(":/")); - foreach (const QString &i, dir.entryList()) - qDebug() << QString::fromLatin1(" :/%1").arg(i); - - dir = QDir(QLatin1String(":/metadata/")); - foreach (const QString &i, dir.entryList()) - qDebug() << QString::fromLatin1(" :/metadata/%1").arg(i); - - dir = QDir(QLatin1String(":/translations/")); - foreach (const QString &i, dir.entryList()) - qDebug() << QString::fromLatin1(" :/translations/%1").arg(i); + QDirIterator it(QLatin1String(":/"), QDir::NoDotAndDotDot | QDir::AllEntries | QDir::Hidden, + QDirIterator::Subdirectories); + while (it.hasNext()) + qDebug() << QString::fromLatin1(" %1").arg(it.next()); } const QString directory = QLatin1String(":/translations"); -- cgit v1.2.3 From 0f4ceb1950c18d7de27265504e104a65f2be7628 Mon Sep 17 00:00:00 2001 From: kh1 Date: Wed, 16 Oct 2013 15:04:28 +0200 Subject: Implement a way to replace the default resource. Change-Id: I2e362d255bf2526f216cbb872bbb64d37383d229 Reviewed-by: Tim Jenssen Reviewed-by: Michal Klocek --- src/libs/installer/binaryformat.cpp | 23 +++++++++++++- src/libs/installer/binaryformat.h | 1 + src/libs/installer/packagemanagercore_p.cpp | 49 +++++++++++++++++++---------- src/sdk/installerbase.cpp | 5 +++ tools/binarycreator/binarycreator.cpp | 33 +++++++++++++------ 5 files changed, 84 insertions(+), 27 deletions(-) diff --git a/src/libs/installer/binaryformat.cpp b/src/libs/installer/binaryformat.cpp index fe1c61ced..081555a59 100644 --- a/src/libs/installer/binaryformat.cpp +++ b/src/libs/installer/binaryformat.cpp @@ -796,7 +796,7 @@ BinaryContentPrivate::BinaryContentPrivate(const BinaryContentPrivate &other) BinaryContentPrivate::~BinaryContentPrivate() { foreach (const QByteArray &rccData, m_resourceMappings) - QResource::unregisterResource((const uchar*)rccData.constData()); + QResource::unregisterResource((const uchar*)rccData.constData(), QLatin1String(":/metadata")); m_resourceMappings.clear(); } @@ -1137,6 +1137,27 @@ int BinaryContent::registerEmbeddedQResources() return d->m_resourceMappings.count(); } +/*! + Registers the passed file as default resource content. If the embedded resources are already mapped into + memory, it will replace the first with the new content. +*/ +void BinaryContent::registerAsDefaultQResource(const QString &path) +{ + QFile resource(path); + bool success = resource.open(QIODevice::ReadOnly); + if (success && (d->m_resourceMappings.count() > 0)) { + success = QResource::unregisterResource((const uchar*)d->m_resourceMappings.takeFirst().constData(), + QLatin1String(":/metadata")); + } + + if (success) { + d->m_resourceMappings.prepend(addResourceFromBinary(&resource, Range::fromStartAndEnd(0, + resource.size()))); + } else { + qWarning() << QString::fromLatin1("Could not register '%1' as default resource.").arg(path); + } +} + /*! Returns the binary component index as read from the file. */ diff --git a/src/libs/installer/binaryformat.h b/src/libs/installer/binaryformat.h index d255ea8a9..0abe78030 100644 --- a/src/libs/installer/binaryformat.h +++ b/src/libs/installer/binaryformat.h @@ -242,6 +242,7 @@ public: qint64 magicMarker() const; int registerEmbeddedQResources(); + void registerAsDefaultQResource(const QString &path); QInstallerCreator::ComponentIndex componentIndex() const; private: diff --git a/src/libs/installer/packagemanagercore_p.cpp b/src/libs/installer/packagemanagercore_p.cpp index a8978bb52..7cd2c292c 100644 --- a/src/libs/installer/packagemanagercore_p.cpp +++ b/src/libs/installer/packagemanagercore_p.cpp @@ -1094,7 +1094,25 @@ void PackageManagerCorePrivate::writeUninstallerBinaryData(QIODevice *output, QF const qint64 dataBlockStart = output->pos(); QVector >resourceSegments; - foreach (const Range &segment, layout.metadataResourceSegments) { + QVector >existingResourceSegments = layout.metadataResourceSegments; + + const QString newDefaultResource = m_core->value(QString::fromLatin1("DefaultResourceReplacement")); + if (!newDefaultResource.isEmpty()) { + QFile file(newDefaultResource); + if (file.open(QIODevice::ReadOnly)) { + resourceSegments.append(Range::fromStartAndLength(output->pos(), file.size())); + appendData(output, &file, file.size()); + existingResourceSegments.remove(0); + + file.remove(); // clear all possible leftovers + m_core->setValue(QString::fromLatin1("DefaultResourceReplacement"), QString()); + } else { + qWarning() << QString::fromLatin1("Could not replace default resource with '%1'.") + .arg(newDefaultResource); + } + } + + foreach (const Range &segment, existingResourceSegments) { input->seek(segment.start()); resourceSegments.append(Range::fromStartAndLength(output->pos(), segment.length())); appendData(output, input, segment.length()); @@ -1156,8 +1174,6 @@ void PackageManagerCorePrivate::writeUninstaller(OperationList performedOperatio performedOperations.append(takeOwnedOperation(op)); } - writeMaintenanceConfigFiles(); - #ifdef Q_OS_MAC // if it is a bundle, we need some stuff in it... const QString sourceAppDirPath = QCoreApplication::applicationDirPath(); @@ -1264,12 +1280,8 @@ void PackageManagerCorePrivate::writeUninstaller(OperationList performedOperatio bool newBinaryWritten = false; bool replacementExists = false; - const QString installerBaseBinary = m_core->replaceVariables(m_installerBaseBinaryUnreplaced); - if (!installerBaseBinary.isEmpty() && !QFileInfo(installerBaseBinary).exists()) { - qWarning() << "The current installer base binary could not updated with a not existing '%1'. " - "Please fix the 'installer.setInstallerBaseBinary()' call " - "in your scripts."; - } else if (!installerBaseBinary.isEmpty()) { + const QString installerBaseBinary = replaceVariables(m_installerBaseBinaryUnreplaced); + if (!installerBaseBinary.isEmpty() && QFileInfo(installerBaseBinary).exists()) { qDebug() << "Got a replacement installer base binary:" << installerBaseBinary; QFile replacementBinary(installerBaseBinary); @@ -1285,16 +1297,20 @@ void PackageManagerCorePrivate::writeUninstaller(OperationList performedOperatio qDebug() << error.message(); } - if (replacementBinary.remove()) { - qDebug() << QString::fromLatin1("Removed temporary installer base replacement binary file: %1").arg( - installerBaseBinary); - } else { + if (!replacementBinary.remove()) { // Is there anything more sensible we can do with this error? I think not. It's not serious // enough for throwing / aborting the process. - qDebug() << QString::fromLatin1("Could not remove installer base binary (%1) after updating " + qDebug() << QString::fromLatin1("Could not remove installer base binary '%1' after updating " "the uninstaller: %2").arg(installerBaseBinary, replacementBinary.errorString()); + } else { + qDebug() << QString::fromLatin1("Removed installer base binary '%1' after updating the " + "uninstaller/ maintenance tool.").arg(installerBaseBinary); } m_installerBaseBinaryUnreplaced.clear(); + } else if (!installerBaseBinary.isEmpty() && !QFileInfo(installerBaseBinary).exists()) { + qWarning() << QString::fromLatin1("The current uninstaller/ maintenance tool could not be " + "updated. '%1' does not exist. Please fix the 'setInstallerBaseBinary()' call in your script.").arg(installerBaseBinary); } QFile input; @@ -1338,9 +1354,7 @@ void PackageManagerCorePrivate::writeUninstaller(OperationList performedOperatio #endif } - performedOperations = sortOperationsBasedOnComponentDependencies( - performedOperations); - + performedOperations = sortOperationsBasedOnComponentDependencies(performedOperations); m_core->setValue(QLatin1String("installedOperationAreSorted"), QLatin1String("true")); try { @@ -1371,6 +1385,7 @@ void PackageManagerCorePrivate::writeUninstaller(OperationList performedOperatio appendInt64(&file, MagicCookie); } input.close(); + writeMaintenanceConfigFiles(); deferredRename(dataFile + QLatin1String(".new"), dataFile, false); if (newBinaryWritten) { diff --git a/src/sdk/installerbase.cpp b/src/sdk/installerbase.cpp index e188107f9..8d7518fcf 100644 --- a/src/sdk/installerbase.cpp +++ b/src/sdk/installerbase.cpp @@ -360,6 +360,11 @@ int main(int argc, char *argv[]) } } + // this needs to happen after we parse the arguments, but before we use the actual resources + const QString newDefaultResource = core.value(QString::fromLatin1("DefaultResourceReplacement")); + if (!newDefaultResource.isEmpty()) + content.registerAsDefaultQResource(newDefaultResource); + if (QInstaller::isVerbose()) { qDebug() << "Resource tree after loading the in-binary resource:"; QDirIterator it(QLatin1String(":/"), QDir::NoDotAndDotDot | QDir::AllEntries | QDir::Hidden, diff --git a/tools/binarycreator/binarycreator.cpp b/tools/binarycreator/binarycreator.cpp index 8792eb537..688ecf4db 100644 --- a/tools/binarycreator/binarycreator.cpp +++ b/tools/binarycreator/binarycreator.cpp @@ -400,7 +400,7 @@ private: const QString oldPath; }; -static QString createBinaryResourceFile(const QString &directory) +static QString createBinaryResourceFile(const QString &directory, const QString &binaryName) { QTemporaryFile projectFile(directory + QLatin1String("/rccprojectXXXXXX.qrc")); if (!projectFile.open()) @@ -408,16 +408,19 @@ static QString createBinaryResourceFile(const QString &directory) projectFile.close(); const WorkingDirectoryChange wd(directory); - const QString binaryName = generateTemporaryFileName(); const QString projectFileName = QFileInfo(projectFile.fileName()).absoluteFilePath(); // 1. create the .qrc file - runRcc(QStringList() << QLatin1String("rcc") << QLatin1String("-project") - << QLatin1String("-o") << projectFileName); + if (runRcc(QStringList() << QLatin1String("rcc") << QLatin1String("-project") << QLatin1String("-o") + << projectFileName) != EXIT_SUCCESS) { + throw Error(QString::fromLatin1("Could not create rcc project file.")); + } // 2. create the binary resource file from the .qrc file - runRcc(QStringList() << QLatin1String("rcc") << QLatin1String("-binary") - << QLatin1String("-o") << binaryName << projectFileName); + if (runRcc(QStringList() << QLatin1String("rcc") << QLatin1String("-binary") << QLatin1String("-o") + << binaryName << projectFileName) != EXIT_SUCCESS) { + throw Error(QString::fromLatin1("Could not compile rcc project file.")); + } return binaryName; } @@ -467,6 +470,9 @@ static void printUsage() std::cout << " -r|--resources r1,.,rn include the given resource files into the binary" << std::endl; std::cout << " -v|--verbose Verbose output" << std::endl; + std::cout << " -rcc|--compile-resource Compiles the default resource and outputs the result into" + << std::endl; + std::cout << " 'update.rcc' in the current path." << std::endl; std::cout << std::endl; std::cout << "Packages are to be found in the current working directory and get listed as " "their names" << std::endl << std::endl; @@ -483,6 +489,9 @@ static void printUsage() std::cout << std::endl; std::cout << "Creates an installer for the SDK without qt and qt creator." << std::endl; std::cout << std::endl; + std::cout << "Example update.rcc:" << std::endl; + std::cout << " " << appName << " -c installer-config" << sep << "config.xml -p packages-directory " + "-rcc" << std::endl; } void copyConfigData(const QString &configFile, const QString &targetDir) @@ -578,6 +587,7 @@ int main(int argc, char **argv) QStringList resources; QStringList filteredPackages; QInstallerTools::FilterType ftype = QInstallerTools::Exclude; + bool compileResource = false; const QStringList args = app.arguments().mid(1); for (QStringList::const_iterator it = args.begin(); it != args.end(); ++it) { @@ -663,6 +673,8 @@ int main(int argc, char **argv) } else if (*it == QLatin1String("--ignore-translations") || *it == QLatin1String("--ignore-invalid-packages")) { continue; + } else if (*it == QLatin1String("-rcc") || *it == QLatin1String("--compile-resource")) { + compileResource = true; } else { if (it->startsWith(QLatin1String("-"))) { return printErrorAndUsageAndExit(QString::fromLatin1("Error: Unknown option \"%1\" used. Maybe you " @@ -691,7 +703,7 @@ int main(int argc, char **argv) ftype = QInstallerTools::Include; } - if (target.isEmpty()) + if (target.isEmpty() && compileResource) return printErrorAndUsageAndExit(QString::fromLatin1("Error: Target parameter missing.")); if (configFile.isEmpty()) @@ -722,11 +734,11 @@ int main(int argc, char **argv) if (!target.endsWith(QLatin1String(".app")) && !target.endsWith(QLatin1String(".dmg"))) target += QLatin1String(".app"); #endif - { + if (!compileResource) { Input input; input.outputPath = target; input.installerExePath = templateBinary; - input.binaryResourcePath = createBinaryResourceFile(tmpMetaDir); + input.binaryResourcePath = createBinaryResourceFile(tmpMetaDir, generateTemporaryFileName()); input.binaryResources = createBinaryResourceFiles(resources); QInstallerTools::copyComponentData(packagesDirectory, tmpMetaDir, &packages); @@ -754,6 +766,9 @@ int main(int argc, char **argv) QFile::remove(input.binaryResourcePath); foreach (const QString &resource, input.binaryResources) QFile::remove(resource); + } else { + createBinaryResourceFile(tmpMetaDir, QDir::currentPath() + QLatin1String("/update.rcc")); + exitCode = EXIT_SUCCESS; } } catch (const Error &e) { std::cerr << "Caught exception: " << e.message() << std::endl; -- cgit v1.2.3 From d5db108364fd32fecd39b7c5094eb686b2f3958c Mon Sep 17 00:00:00 2001 From: kh1 Date: Wed, 16 Oct 2013 16:16:08 +0200 Subject: Compile fix. Change-Id: I917cb0da36b6d68df85cbc037602c4abf754ded8 Reviewed-by: Tim Jenssen --- src/libs/installer/binaryformat.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/libs/installer/binaryformat.cpp b/src/libs/installer/binaryformat.cpp index 081555a59..df2366946 100644 --- a/src/libs/installer/binaryformat.cpp +++ b/src/libs/installer/binaryformat.cpp @@ -1146,8 +1146,10 @@ void BinaryContent::registerAsDefaultQResource(const QString &path) QFile resource(path); bool success = resource.open(QIODevice::ReadOnly); if (success && (d->m_resourceMappings.count() > 0)) { - success = QResource::unregisterResource((const uchar*)d->m_resourceMappings.takeFirst().constData(), + success = QResource::unregisterResource((const uchar*)d->m_resourceMappings.first().constData(), QLatin1String(":/metadata")); + if (success) + d->m_resourceMappings.remove(0); } if (success) { -- cgit v1.2.3 From 6e25ca4ec779d500739a91bd8a01b7ad46b9b6bc Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Wed, 16 Oct 2013 17:15:56 +0200 Subject: Option parser, rcc works for current path -> no target expected Change-Id: I93bc6613203e1e879b18e7a8d6ef8849870835ee Reviewed-by: Tim Jenssen --- tools/binarycreator/binarycreator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/binarycreator/binarycreator.cpp b/tools/binarycreator/binarycreator.cpp index 688ecf4db..6a45a3717 100644 --- a/tools/binarycreator/binarycreator.cpp +++ b/tools/binarycreator/binarycreator.cpp @@ -703,7 +703,7 @@ int main(int argc, char **argv) ftype = QInstallerTools::Include; } - if (target.isEmpty() && compileResource) + if (target.isEmpty() && !compileResource) return printErrorAndUsageAndExit(QString::fromLatin1("Error: Target parameter missing.")); if (configFile.isEmpty()) -- cgit v1.2.3 From d6dd1b7a4aa903748139e40cd55ca15d52935fa6 Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Thu, 17 Oct 2013 11:46:21 +0200 Subject: Fix the copy error message Change-Id: I14f46f8567010b3ce8ac3b7e37ff61eed5015d39 Reviewed-by: Petref Saraci Reviewed-by: Tim Jenssen --- src/libs/kdtools/kdupdaterupdateoperations.cpp | 2 +- src/sdk/translations/ja_jp.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libs/kdtools/kdupdaterupdateoperations.cpp b/src/libs/kdtools/kdupdaterupdateoperations.cpp index 854449bc0..be123fe61 100644 --- a/src/libs/kdtools/kdupdaterupdateoperations.cpp +++ b/src/libs/kdtools/kdupdaterupdateoperations.cpp @@ -165,7 +165,7 @@ bool CopyOperation::performOperation() QFile sourceFile(source); if (!sourceFile.exists()) { setError(UserDefinedError); - setErrorString(tr("Could not copy a none existing file: %1").arg(source)); + setErrorString(tr("Could not copy a non-existent file: %1").arg(source)); return false; } // If destination file exists, we cannot use QFile::copy() because it does not overwrite an existing diff --git a/src/sdk/translations/ja_jp.ts b/src/sdk/translations/ja_jp.ts index 5e34e57e6..6af882705 100644 --- a/src/sdk/translations/ja_jp.ts +++ b/src/sdk/translations/ja_jp.ts @@ -99,7 +99,7 @@ 無効な引数: %1個の引数が渡されましたが、必要なのは2個です。 - Could not copy a none existing file: %1 + Could not copy a non-existent file: %1 存在しないファイルはコピーできません: %1 -- cgit v1.2.3 From 76039e40dad87917735c1fec9d33aec6df0f47cd Mon Sep 17 00:00:00 2001 From: Tim Jenssen Date: Fri, 18 Oct 2013 07:41:44 +0200 Subject: rename forceRestart to needsHardRestart Change-Id: Ic3e3b6733f3d4e7bbf7b9a2715fd2d74fb3f9a2d Reviewed-by: Karsten Heimrich --- src/libs/installer/packagemanagercore.cpp | 12 +++++++++--- src/libs/installer/packagemanagercore.h | 3 ++- src/libs/installer/packagemanagercore_p.cpp | 6 +++--- src/libs/installer/packagemanagercore_p.h | 2 +- src/libs/installer/packagemanagergui.cpp | 2 +- 5 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/libs/installer/packagemanagercore.cpp b/src/libs/installer/packagemanagercore.cpp index 007354f5d..5a4deec3d 100644 --- a/src/libs/installer/packagemanagercore.cpp +++ b/src/libs/installer/packagemanagercore.cpp @@ -421,7 +421,7 @@ void PackageManagerCore::writeMaintenanceConfigFiles() void PackageManagerCore::reset(const QHash ¶ms) { d->m_completeUninstall = false; - d->m_forceRestart = false; + d->m_needsHardRestart = false; d->m_status = PackageManagerCore::Unfinished; d->m_installerBaseBinaryUnreplaced.clear(); @@ -596,11 +596,17 @@ int PackageManagerCore::downloadNeededArchives(double partProgressSize) If a component marked as important was installed during update process true is returned. */ -bool PackageManagerCore::needsRestart() const +bool PackageManagerCore::needsHardRestart() const { - return d->m_forceRestart; + return d->m_needsHardRestart; } +void PackageManagerCore::setNeedsHardRestart(bool needsHardRestart) +{ + d->m_needsHardRestart = needsHardRestart; +} + + void PackageManagerCore::rollBackInstallation() { emit titleMessageChanged(tr("Cancelling the Installer")); diff --git a/src/libs/installer/packagemanagercore.h b/src/libs/installer/packagemanagercore.h index 20a3293fa..557c4d9ed 100644 --- a/src/libs/installer/packagemanagercore.h +++ b/src/libs/installer/packagemanagercore.h @@ -248,7 +248,8 @@ public: int downloadNeededArchives(double partProgressSize); - bool needsRestart() const; + bool needsHardRestart() const; + void setNeedsHardRestart(bool needsHardRestart = true); bool finishedWithSuccess() const; public Q_SLOTS: diff --git a/src/libs/installer/packagemanagercore_p.cpp b/src/libs/installer/packagemanagercore_p.cpp index 7cd2c292c..dc6b775f1 100644 --- a/src/libs/installer/packagemanagercore_p.cpp +++ b/src/libs/installer/packagemanagercore_p.cpp @@ -225,7 +225,7 @@ PackageManagerCorePrivate::PackageManagerCorePrivate(PackageManagerCore *core, q , m_updaterApplication(new DummyConfigurationInterface) , m_FSEngineClientHandler(initFSEngineClientHandler()) , m_status(PackageManagerCore::Unfinished) - , m_forceRestart(false) + , m_needsHardRestart(false) , m_testChecksum(false) , m_launchedAsRoot(AdminAuthorization::hasAdminRights()) , m_completeUninstall(false) @@ -1290,7 +1290,7 @@ void PackageManagerCorePrivate::writeUninstaller(OperationList performedOperatio writeUninstallerBinary(&replacementBinary, replacementBinary.size(), true); qDebug() << "Wrote the binary with the new replacement."; - m_forceRestart = true; + m_needsHardRestart = true; newBinaryWritten = true; replacementExists = true; } catch (const Error &error) { @@ -1911,7 +1911,7 @@ void PackageManagerCorePrivate::installComponent(Component *component, double pr throw Error(operation->errorString()); if (component->value(scEssential, scFalse) == scTrue) - m_forceRestart = true; + m_needsHardRestart = true; } registerPathesForUninstallation(component->pathesForUninstallation(), component->name()); diff --git a/src/libs/installer/packagemanagercore_p.h b/src/libs/installer/packagemanagercore_p.h index d5bdc78fd..445235a0d 100644 --- a/src/libs/installer/packagemanagercore_p.h +++ b/src/libs/installer/packagemanagercore_p.h @@ -205,7 +205,7 @@ public: int m_status; QString m_error; - bool m_forceRestart; + bool m_needsHardRestart; bool m_testChecksum; bool m_launchedAsRoot; bool m_completeUninstall; diff --git a/src/libs/installer/packagemanagergui.cpp b/src/libs/installer/packagemanagergui.cpp index 338e8fad9..247872614 100644 --- a/src/libs/installer/packagemanagergui.cpp +++ b/src/libs/installer/packagemanagergui.cpp @@ -1943,7 +1943,7 @@ int RestartPage::nextId() const void RestartPage::entering() { - if (!packageManagerCore()->needsRestart()) { + if (!packageManagerCore()->needsHardRestart()) { if (QAbstractButton *finish = wizard()->button(QWizard::FinishButton)) finish->setVisible(false); QMetaObject::invokeMethod(this, "restart", Qt::QueuedConnection); -- cgit v1.2.3 From 53b999af27bf2272445b882c055aa6cf8335c74a Mon Sep 17 00:00:00 2001 From: Tim Jenssen Date: Mon, 21 Oct 2013 20:25:27 +0200 Subject: fix that restart is only triggered if the user wants it Change-Id: I7814e94819088a4ee82fea9a120d99be6f63d934 Reviewed-by: Karsten Heimrich --- src/libs/installer/packagemanagercore_p.cpp | 3 +-- src/libs/installer/packagemanagergui.cpp | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libs/installer/packagemanagercore_p.cpp b/src/libs/installer/packagemanagercore_p.cpp index dc6b775f1..daa0158e8 100644 --- a/src/libs/installer/packagemanagercore_p.cpp +++ b/src/libs/installer/packagemanagercore_p.cpp @@ -1290,7 +1290,6 @@ void PackageManagerCorePrivate::writeUninstaller(OperationList performedOperatio writeUninstallerBinary(&replacementBinary, replacementBinary.size(), true); qDebug() << "Wrote the binary with the new replacement."; - m_needsHardRestart = true; newBinaryWritten = true; replacementExists = true; } catch (const Error &error) { @@ -1389,7 +1388,7 @@ void PackageManagerCorePrivate::writeUninstaller(OperationList performedOperatio deferredRename(dataFile + QLatin1String(".new"), dataFile, false); if (newBinaryWritten) { - const bool restart = replacementExists && isUpdater() && (!statusCanceledOrFailed()); + const bool restart = replacementExists && isUpdater() && (!statusCanceledOrFailed()) && m_needsHardRestart; deferredRename(uninstallerName() + QLatin1String(".new"), uninstallerName(), restart); qDebug() << "Maintenance tool restart:" << (restart ? "true." : "false."); } diff --git a/src/libs/installer/packagemanagergui.cpp b/src/libs/installer/packagemanagergui.cpp index 247872614..fc81ad9ff 100644 --- a/src/libs/installer/packagemanagergui.cpp +++ b/src/libs/installer/packagemanagergui.cpp @@ -524,6 +524,7 @@ void PackageManagerGui::cancelButtonClicked() QDialog::reject(); } } else { + m_core->setNeedsHardRestart(false); QDialog::reject(); } } -- cgit v1.2.3