summaryrefslogtreecommitdiffstats
path: root/installerbuilder/libinstaller
diff options
context:
space:
mode:
authorkh1 <qt-info@nokia.com>2011-07-06 13:55:50 +0200
committerkh1 <qt-info@nokia.com>2011-07-06 13:55:50 +0200
commitd8e582c9ecbec939a14e20702592e408acd4a5d8 (patch)
tree037d22b0015bb58366dd06f331b265316e8a32be /installerbuilder/libinstaller
parentc82f0912f653d99527eeaf6f23e2f307160ca268 (diff)
Cleanup. Use typedef. No functional change.
Diffstat (limited to 'installerbuilder/libinstaller')
-rw-r--r--installerbuilder/libinstaller/createdesktopentryoperation.cpp23
-rw-r--r--installerbuilder/libinstaller/createdesktopentryoperation.h6
-rw-r--r--installerbuilder/libinstaller/createshortcutoperation.cpp56
-rw-r--r--installerbuilder/libinstaller/createshortcutoperation.h6
-rw-r--r--installerbuilder/libinstaller/elevatedexecuteoperation.cpp49
-rw-r--r--installerbuilder/libinstaller/elevatedexecuteoperation.h10
-rw-r--r--installerbuilder/libinstaller/environmentvariablesoperation.cpp48
-rw-r--r--installerbuilder/libinstaller/environmentvariablesoperation.h11
-rw-r--r--installerbuilder/libinstaller/fakestopprocessforupdateoperation.cpp65
-rw-r--r--installerbuilder/libinstaller/fakestopprocessforupdateoperation.h7
-rw-r--r--installerbuilder/libinstaller/globalsettingsoperation.cpp5
-rw-r--r--installerbuilder/libinstaller/globalsettingsoperation.h6
-rw-r--r--installerbuilder/libinstaller/licenseoperation.cpp2
-rw-r--r--installerbuilder/libinstaller/licenseoperation.h11
-rw-r--r--installerbuilder/libinstaller/macreplaceinstallnamesoperation.cpp2
-rw-r--r--installerbuilder/libinstaller/macreplaceinstallnamesoperation.h7
-rw-r--r--installerbuilder/libinstaller/qtpatchoperation.cpp110
-rw-r--r--installerbuilder/libinstaller/qtpatchoperation.h9
-rw-r--r--installerbuilder/libinstaller/registerdefaultdebuggeroperation.cpp2
-rw-r--r--installerbuilder/libinstaller/registerdefaultdebuggeroperation.h8
-rw-r--r--installerbuilder/libinstaller/registerdocumentationoperation.cpp2
-rw-r--r--installerbuilder/libinstaller/registerdocumentationoperation.h6
-rw-r--r--installerbuilder/libinstaller/registerqtoperation.cpp2
-rw-r--r--installerbuilder/libinstaller/registerqtoperation.h6
-rw-r--r--installerbuilder/libinstaller/registerqtv2operation.cpp2
-rw-r--r--installerbuilder/libinstaller/registerqtv2operation.h6
26 files changed, 232 insertions, 235 deletions
diff --git a/installerbuilder/libinstaller/createdesktopentryoperation.cpp b/installerbuilder/libinstaller/createdesktopentryoperation.cpp
index 37f429400..6de8987ab 100644
--- a/installerbuilder/libinstaller/createdesktopentryoperation.cpp
+++ b/installerbuilder/libinstaller/createdesktopentryoperation.cpp
@@ -58,8 +58,10 @@ QString CreateDesktopEntryOperation::absoluteFileName()
return QDir(value(QLatin1String("directory")).toString()).absoluteFilePath(filename);
const QProcessEnvironment env;
- QStringList XDG_DATA_DIRS = env.value(QLatin1String("XDG_DATA_DIRS")).split(QLatin1Char(':'), QString::SkipEmptyParts);
- QStringList XDG_DATA_HOME = env.value(QLatin1String("XDG_DATA_HOME")).split(QLatin1Char(':'), QString::SkipEmptyParts);
+ QStringList XDG_DATA_DIRS = env.value(QLatin1String("XDG_DATA_DIRS")).split(QLatin1Char(':'),
+ QString::SkipEmptyParts);
+ QStringList XDG_DATA_HOME = env.value(QLatin1String("XDG_DATA_HOME")).split(QLatin1Char(':'),
+ QString::SkipEmptyParts);
XDG_DATA_DIRS.push_back(QLatin1String("/usr/share")); // default path
XDG_DATA_HOME.push_back(QDir::home().absoluteFilePath(QLatin1String(".local/share"))); // default path
@@ -132,14 +134,14 @@ bool CreateDesktopEntryOperation::performOperation()
const QStringList args = arguments();
if(args.count() != 2) {
setError(InvalidArguments);
- setErrorString(tr("Invalid arguments in %0: %1 arguments given, 2 expected.")
- .arg(name()).arg(args.count()));
+ setErrorString(tr("Invalid arguments in %0: %1 arguments given, 2 expected.").arg(name()).arg(args
+ .count()));
return false;
}
const QString filename = absoluteFileName();
const QString& values = args[1];
-
+
if (QFile::exists(filename) && !deleteFileNowOrLater(filename)) {
setError(UserDefinedError);
setErrorString(tr("Failed to overwrite %1").arg(filename));
@@ -153,7 +155,8 @@ bool CreateDesktopEntryOperation::performOperation()
return false;
}
- QFile::setPermissions(filename, QFile::ReadOwner | QFile::WriteOwner | QFile::ReadUser | QFile::ReadGroup | QFile::ReadOther);
+ QFile::setPermissions(filename, QFile::ReadOwner | QFile::WriteOwner | QFile::ReadUser | QFile::ReadGroup
+ | QFile::ReadOther);
QTextStream stream(&file);
stream.setCodec("UTF-8");
@@ -162,9 +165,8 @@ bool CreateDesktopEntryOperation::performOperation()
// Type=Application\nExec=qtcreator\nPath=...
const QStringList pairs = values.split(QLatin1Char('\n'));
- for (QStringList::const_iterator it = pairs.begin(); it != pairs.end(); ++it) {
+ for (QStringList::const_iterator it = pairs.begin(); it != pairs.end(); ++it)
stream << *it << endl;
- }
return true;
}
@@ -183,7 +185,8 @@ bool CreateDesktopEntryOperation::undoOperation()
return true;
const QString backupOfExistingDesktopEntry = value(QLatin1String("backupOfExistingDesktopEntry")).toString();
- const bool success = QFile::copy(backupOfExistingDesktopEntry, filename) && deleteFileNowOrLater(backupOfExistingDesktopEntry);
+ const bool success = QFile::copy(backupOfExistingDesktopEntry, filename)
+ && deleteFileNowOrLater(backupOfExistingDesktopEntry);
if (!success)
setErrorString(QObject::tr("Could not restore backup file into %1").arg(filename));
@@ -195,7 +198,7 @@ bool CreateDesktopEntryOperation::testOperation()
return true;
}
-CreateDesktopEntryOperation* CreateDesktopEntryOperation::clone() const
+Operation* CreateDesktopEntryOperation::clone() const
{
return new CreateDesktopEntryOperation();
}
diff --git a/installerbuilder/libinstaller/createdesktopentryoperation.h b/installerbuilder/libinstaller/createdesktopentryoperation.h
index 853c96c2d..8e623bce8 100644
--- a/installerbuilder/libinstaller/createdesktopentryoperation.h
+++ b/installerbuilder/libinstaller/createdesktopentryoperation.h
@@ -26,11 +26,11 @@
#ifndef CREATEDESKTOPENTRYOPERATION_H
#define CREATEDESKTOPENTRYOPERATION_H
-#include <KDUpdater/UpdateOperation>
+#include "qinstallerglobal.h"
namespace QInstaller {
-class CreateDesktopEntryOperation : public KDUpdater::UpdateOperation
+class INSTALLER_EXPORT CreateDesktopEntryOperation : public Operation
{
public:
CreateDesktopEntryOperation();
@@ -40,7 +40,7 @@ public:
bool performOperation();
bool undoOperation();
bool testOperation();
- CreateDesktopEntryOperation* clone() const;
+ Operation* clone() const;
QString absoluteFileName();
};
diff --git a/installerbuilder/libinstaller/createshortcutoperation.cpp b/installerbuilder/libinstaller/createshortcutoperation.cpp
index a91f5c578..1b2fcf1c4 100644
--- a/installerbuilder/libinstaller/createshortcutoperation.cpp
+++ b/installerbuilder/libinstaller/createshortcutoperation.cpp
@@ -78,7 +78,7 @@ static bool createLink(QString fileName, QString linkName, QString workingDir, Q
if (SUCCEEDED(hres)) {
hres = psl->SetPath((wchar_t *)fileName.utf16());
- if(SUCCEEDED(hres) && !arguments.isNull())
+ if (SUCCEEDED(hres) && !arguments.isNull())
hres = psl->SetArguments((wchar_t*)arguments.utf16());
if (SUCCEEDED(hres)) {
hres = psl->SetWorkingDirectory((wchar_t *)workingDir.utf16());
@@ -121,14 +121,16 @@ CreateShortcutOperation::~CreateShortcutOperation()
deleteFileNowOrLater(value(QLatin1String("backupOfExistingShortcut")).toString());
}
-static bool isWorkingDirOption(const QString& s) {
+static bool isWorkingDirOption(const QString& s)
+{
return s.startsWith(QLatin1String("workingDirectory="));
}
-static QString getWorkingDir(QStringList& args) {
+static QString getWorkingDir(QStringList& args)
+{
QString workingDir;
// if the args contain an option in the form "workingDirectory=...", find it and consume it
- QStringList::iterator wdiropt = std::find_if(args.begin(), args.end(), isWorkingDirOption);
+ QStringList::iterator wdiropt = std::find_if (args.begin(), args.end(), isWorkingDirOption);
if (wdiropt != args.end()) {
workingDir = wdiropt->mid(QString::fromLatin1("workingDirectory=").size());
args.erase(wdiropt);
@@ -155,11 +157,12 @@ void CreateShortcutOperation::backup()
createdDir = QDir(p);
if (!createdDir.exists()) {
directoriesToCreate.push_back(QDir::toNativeSeparators(createdDir.absolutePath()));
- verbose() << " backup created dir_pre " << QDir::toNativeSeparators(createdDir.absolutePath()) << std::endl;
+ verbose() << " backup created dir_pre " << QDir::toNativeSeparators(createdDir.absolutePath())
+ << std::endl;
if (p == path)
break;
- } else if(p == path) {
+ } else if (p == path) {
// everything did already exist -> nothing to do for us (nothing to revert then, either)
createdDir = QDir::root();
break;
@@ -193,7 +196,8 @@ bool CreateShortcutOperation::performOperation()
if (args.count() != 2 && args.count() != 3) {
setError(InvalidArguments);
- setErrorString(QObject::tr("Invalid arguments: %1 arguments given, 2 or 3 expected (optional: \"workingDirectory=...\").").arg(args.count()));
+ setErrorString(QObject::tr("Invalid arguments: %1 arguments given, 2 or 3 expected (optional: "
+ "\"workingDirectory=...\").").arg(args.count()));
return false;
}
@@ -212,7 +216,8 @@ bool CreateShortcutOperation::performOperation()
if (!created) {
setError(UserDefinedError);
- setErrorString(tr("Could not create folder %1: %2.").arg(QDir::toNativeSeparators(dirName), QLatin1String(strerror(errno))));
+ setErrorString(tr("Could not create folder %1: %2.").arg(QDir::toNativeSeparators(dirName),
+ QLatin1String(strerror(errno))));
return false;
}
@@ -221,30 +226,34 @@ bool CreateShortcutOperation::performOperation()
if (dirAlreadyExists)
deleter.releaseAll();
-#if 0 // disabled for now, isDir() also returns true if the link exists and points to a folder, then removing it fails
+ // disabled for now, isDir() also returns true if the link exists and points to a folder, then removing it
+ // fails
+#if 0
// link creation
if (QFileInfo(linkLocation).isDir()) {
errno = 0;
if (!QDir().rmdir(linkLocation)) {
setError(UserDefinedError);
- setErrorString(QObject::tr("Could not create link: failed to remove folder %1: %2").arg(QDir::toNativeSeparators(linkLocation), QLatin1String(strerror(errno))));
+ setErrorString(QObject::tr("Could not create link: failed to remove folder %1: %2")
+ .arg(QDir::toNativeSeparators(linkLocation), QLatin1String(strerror(errno))));
return false;
}
}
#endif
QString errorString;
-
if (QFile::exists(linkLocation) && !deleteFileNowOrLater(linkLocation, &errorString)) {
setError(UserDefinedError);
- setErrorString(QObject::tr("Failed to overwrite %1: %2").arg(QDir::toNativeSeparators(linkLocation),errorString));
+ setErrorString(QObject::tr("Failed to overwrite %1: %2").arg(QDir::toNativeSeparators(linkLocation),
+ errorString));
return false;
}
const bool linked = createLink(linkTarget, linkLocation, workingDir, targetArguments);
if (!linked) {
setError(UserDefinedError);
- setErrorString(tr("Could not create link %1: %2").arg(QDir::toNativeSeparators(linkLocation), qt_error_string()));
+ setErrorString(tr("Could not create link %1: %2").arg(QDir::toNativeSeparators(linkLocation),
+ qt_error_string()));
return false;
}
deleter.releaseAll();
@@ -252,7 +261,7 @@ bool CreateShortcutOperation::performOperation()
}
bool CreateShortcutOperation::undoOperation()
-{
+{
const QString linkLocation = arguments()[ 1 ];
const QStringList args = this->arguments();
verbose() << " undo Shortcutoperation with arguments ";
@@ -269,7 +278,8 @@ bool CreateShortcutOperation::undoOperation()
if (hasValue(QLatin1String("backupOfExistingShortcut"))) {
const QString backupOfExistingShortcut = value(QLatin1String("backupOfExistingShortcut")).toString();
- const bool success = QFile::copy(backupOfExistingShortcut, linkLocation) && deleteFileNowOrLater(backupOfExistingShortcut);
+ const bool success = QFile::copy(backupOfExistingShortcut, linkLocation)
+ && deleteFileNowOrLater(backupOfExistingShortcut);
if (!success) {
setErrorString(QObject::tr("Could not restore backup file into %1").arg(linkLocation));
return success;
@@ -277,8 +287,9 @@ bool CreateShortcutOperation::undoOperation()
}
verbose() << " got behin backup " << std::endl;
+ // no dir to delete (QDir(createdDirPath) would return the current working directory -> never do that
const QStringList createdDirsPaths = value(QLatin1String("createddirs")).toStringList();
- if (createdDirsPaths.isEmpty()) //no dir to delete (QDir(createdDirPath) would return the current working directory -> never do that
+ if (createdDirsPaths.isEmpty())
return true;
const bool forceremoval = QVariant(value(QLatin1String("forceremoval"))).toBool();
@@ -310,10 +321,13 @@ bool CreateShortcutOperation::undoOperation()
verbose() << " removal of path " << createdDir.path() << std::endl;
const bool result = QDir::root().rmdir(createdDir.path());
if (!result) {
- if (errorString.isEmpty())
- setError(UserDefinedError, tr("Cannot remove directory %1: %2").arg(createdDir.path(), errorString));
- else
- setError(UserDefinedError, tr("Cannot remove directory %1: %2").arg(createdDir.path(), QLatin1String(strerror(errno))));
+ if (errorString.isEmpty()) {
+ setError(UserDefinedError, tr("Cannot remove directory %1: %2").arg(createdDir.path(),
+ errorString));
+ } else {
+ setError(UserDefinedError, tr("Cannot remove directory %1: %2").arg(createdDir.path(),
+ QLatin1String(strerror(errno))));
+ }
return result;
}
}
@@ -326,7 +340,7 @@ bool CreateShortcutOperation::testOperation()
return true;
}
-CreateShortcutOperation* CreateShortcutOperation::clone() const
+Operation *CreateShortcutOperation::clone() const
{
return new CreateShortcutOperation();
}
diff --git a/installerbuilder/libinstaller/createshortcutoperation.h b/installerbuilder/libinstaller/createshortcutoperation.h
index f479a5529..f5bfcbcf9 100644
--- a/installerbuilder/libinstaller/createshortcutoperation.h
+++ b/installerbuilder/libinstaller/createshortcutoperation.h
@@ -26,11 +26,11 @@
#ifndef CREATESHORTCUTOPERATION_H
#define CREATESHORTCUTOPERATION_H
-#include <KDUpdater/UpdateOperation>
+#include "qinstallerglobal.h"
namespace QInstaller {
-class CreateShortcutOperation : public KDUpdater::UpdateOperation
+class INSTALLER_EXPORT CreateShortcutOperation : public Operation
{
public:
CreateShortcutOperation();
@@ -40,7 +40,7 @@ public:
bool performOperation();
bool undoOperation();
bool testOperation();
- CreateShortcutOperation* clone() const;
+ Operation* clone() const;
};
}
diff --git a/installerbuilder/libinstaller/elevatedexecuteoperation.cpp b/installerbuilder/libinstaller/elevatedexecuteoperation.cpp
index 7389e6621..73eb1f661 100644
--- a/installerbuilder/libinstaller/elevatedexecuteoperation.cpp
+++ b/installerbuilder/libinstaller/elevatedexecuteoperation.cpp
@@ -79,10 +79,10 @@ bool ElevatedExecuteOperation::performOperation()
{
// This operation receives only one argument. It is the complete
// command line of the external program to execute.
- if (arguments().isEmpty())
- {
+ if (arguments().isEmpty()) {
setError(InvalidArguments);
- setErrorString(tr("Invalid arguments in %1: %2 arguments given, at least 1 expected.").arg(name(), QString::number(arguments().count())));
+ setErrorString(tr("Invalid arguments in %1: %2 arguments given, at least 1 expected.").arg(name(),
+ QString::number(arguments().count())));
return false;
}
QStringList args;
@@ -100,7 +100,8 @@ bool ElevatedExecuteOperation::Private::run(const QStringList& arguments)
{
QStringList args = arguments;
QString workingDirectory;
- QStringList filteredWorkingDirectoryArgs = args.filter(QLatin1String("workingdirectory="), Qt::CaseInsensitive);
+ QStringList filteredWorkingDirectoryArgs = args.filter(QLatin1String("workingdirectory="),
+ Qt::CaseInsensitive);
if (!filteredWorkingDirectoryArgs.isEmpty()) {
QString workingDirectoryArgument = filteredWorkingDirectoryArgs.at(0);
workingDirectory = workingDirectoryArgument;
@@ -115,25 +116,21 @@ bool ElevatedExecuteOperation::Private::run(const QStringList& arguments)
}
QList< int > allowedExitCodes;
-
+
QRegExp re(QLatin1String("^\\{((-?\\d+,)*-?\\d+)\\}$"));
- if (re.exactMatch(args.first()))
- {
+ if (re.exactMatch(args.first())) {
const QStringList numbers = re.cap(1).split(QLatin1Char(','));
for(QStringList::const_iterator it = numbers.constBegin(); it != numbers.constEnd(); ++it)
allowedExitCodes.push_back(it->toInt());
args.pop_front();
- }
- else
- {
+ } else {
allowedExitCodes.push_back(0);
}
const QString callstr = args.join(QLatin1String(" "));
// unix style: when there's an ampersand after the command, it's started detached
- if (args.count() >= 2 && args.last() == QLatin1String("&"))
- {
+ if (args.count() >= 2 && args.last() == QLatin1String("&")) {
args.pop_back();
const bool success = QProcessWrapper::startDetached(args.front(), args.mid(1));
if (!success) {
@@ -146,7 +143,8 @@ bool ElevatedExecuteOperation::Private::run(const QStringList& arguments)
process = new QProcessWrapper();
if (!workingDirectory.isEmpty()) {
process->setWorkingDirectory(workingDirectory);
- QInstaller::verbose() << " ElevatedExecuteOperation setWorkingDirectory: " << workingDirectory << std::endl;
+ QInstaller::verbose() << " ElevatedExecuteOperation setWorkingDirectory: " << workingDirectory
+ << std::endl;
}
QProcessEnvironment penv;
@@ -169,12 +167,14 @@ bool ElevatedExecuteOperation::Private::run(const QStringList& arguments)
#ifdef Q_OS_WIN
if (args.count() == 1) {
process->setNativeArguments(args.front());
- QInstaller::verbose() << " ElevatedExecuteOperation setNativeArguments to start: " << args.front() << std::endl;
+ QInstaller::verbose() << " ElevatedExecuteOperation setNativeArguments to start: " << args.front()
+ << std::endl;
process->start(QString(), QStringList());
} else
#endif
process->start(args.front(), args.mid(1));
- QInstaller::verbose() << args.front() << " started, arguments: " << QStringList(args.mid(1)).join(QLatin1String(" ")) << std::endl;
+ QInstaller::verbose() << args.front() << " started, arguments: " << QStringList(args.mid(1))
+ .join(QLatin1String(" ")) << std::endl;
bool success = false;
//we still like the none blocking possibility to perform this operation without threads
@@ -185,8 +185,7 @@ bool ElevatedExecuteOperation::Private::run(const QStringList& arguments)
}
bool returnValue = true;
- if (!success)
- {
+ if (!success) {
q->setError(UserDefinedError);
//TODO: pass errorString() through the wrapper */
q->setErrorString(tr("Execution failed: Could not start: \"%1\"").arg(callstr));
@@ -202,17 +201,16 @@ bool ElevatedExecuteOperation::Private::run(const QStringList& arguments)
q->setValue(QLatin1String("ExitCode"), process->exitCode());
- if (process->exitStatus() == QProcessWrapper::CrashExit)
- {
+ if (process->exitStatus() == QProcessWrapper::CrashExit) {
q->setError(UserDefinedError);
q->setErrorString(tr("Execution failed(Crash): \"%1\"").arg(callstr));
returnValue = false;
}
- if (!allowedExitCodes.contains(process->exitCode()))
- {
+ if (!allowedExitCodes.contains(process->exitCode())) {
q->setError(UserDefinedError);
- q->setErrorString(tr("Execution failed(Unexpected exit code: %1): \"%2\"").arg(QString::number(process->exitCode()), callstr));
+ q->setErrorString(tr("Execution failed(Unexpected exit code: %1): \"%2\"")
+ .arg(QString::number(process->exitCode()), callstr));
returnValue = false;
}
@@ -237,7 +235,8 @@ void ElevatedExecuteOperation::Private::readProcessOutput()
Q_ASSERT(process);
Q_ASSERT(QThread::currentThread() == process->thread());
if (QThread::currentThread() != process->thread()) {
- QInstaller::verbose() << Q_FUNC_INFO << QLatin1String(" can only be called from the same thread as the process is.") << std::endl;
+ QInstaller::verbose() << Q_FUNC_INFO << QLatin1String(" can only be called from the same thread as "
+ "the process is.") << std::endl;
}
const QByteArray output = process->readAll();
if (!output.isEmpty()) {
@@ -251,7 +250,7 @@ bool ElevatedExecuteOperation::undoOperation()
{
QStringList args;
bool found = false;
- foreach(const QString &argument, arguments()) {
+ foreach (const QString &argument, arguments()) {
if (found)
args.append(argument);
else
@@ -269,7 +268,7 @@ bool ElevatedExecuteOperation::testOperation()
return true;
}
-ElevatedExecuteOperation* ElevatedExecuteOperation::clone() const
+Operation* ElevatedExecuteOperation::clone() const
{
return new ElevatedExecuteOperation;
}
diff --git a/installerbuilder/libinstaller/elevatedexecuteoperation.h b/installerbuilder/libinstaller/elevatedexecuteoperation.h
index e99b873aa..50218ee9d 100644
--- a/installerbuilder/libinstaller/elevatedexecuteoperation.h
+++ b/installerbuilder/libinstaller/elevatedexecuteoperation.h
@@ -26,16 +26,16 @@
#ifndef ELEVATEDEXECUTEOPERATION_H
#define ELEVATEDEXECUTEOPERATION_H
-#include <KDUpdater/kdupdaterupdateoperations.h>
-#include <KDToolsCore/pimpl_ptr.h>
+#include "qinstallerglobal.h"
-#include "installer_global.h"
+#include <KDToolsCore/pimpl_ptr.h>
namespace QInstaller {
-class INSTALLER_EXPORT ElevatedExecuteOperation : public QObject, public KDUpdater::UpdateOperation
+class INSTALLER_EXPORT ElevatedExecuteOperation : public QObject, public Operation
{
Q_OBJECT
+
public:
ElevatedExecuteOperation();
~ElevatedExecuteOperation();
@@ -44,7 +44,7 @@ public:
virtual bool performOperation();
virtual bool undoOperation();
virtual bool testOperation();
- virtual ElevatedExecuteOperation* clone() const;
+ virtual Operation* clone() const;
Q_SIGNALS:
void cancelProcess();
diff --git a/installerbuilder/libinstaller/environmentvariablesoperation.cpp b/installerbuilder/libinstaller/environmentvariablesoperation.cpp
index 96446f748..aa00bc3df 100644
--- a/installerbuilder/libinstaller/environmentvariablesoperation.cpp
+++ b/installerbuilder/libinstaller/environmentvariablesoperation.cpp
@@ -68,10 +68,10 @@ static bool broadcastChange() {
// running applications. This is needed to activate the changes done above without logout+login.
// Note that cmd.exe does not respond to any WM_SETTINGCHANGE messages...
DWORD aResult = 0;
- LRESULT sendresult = SendMessageTimeout( HWND_BROADCAST, WM_SETTINGCHANGE,
- 0, (LPARAM) "Environment", SMTO_BLOCK | SMTO_ABORTIFHUNG, 5000, &aResult );
- if( sendresult == 0 || aResult != 0 ) {
- qWarning( "Failed to broadcast a WM_SETTINGCHANGE message\n" );
+ LRESULT sendresult = SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE,
+ 0, (LPARAM) "Environment", SMTO_BLOCK | SMTO_ABORTIFHUNG, 5000, &aResult);
+ if (sendresult == 0 || aResult != 0) {
+ qWarning("Failed to broadcast a WM_SETTINGCHANGE message\n");
return false;
}
@@ -86,7 +86,8 @@ UpdateOperation::Error writeSetting(const QString &regPath,
const QString &name,
const QString &value,
QString *errorString,
- QString *oldValue) {
+ QString *oldValue)
+{
oldValue->clear();
SettingsType registry(regPath, QSettingsWrapper::NativeFormat);
if (!registry.isWritable()) {
@@ -101,7 +102,7 @@ UpdateOperation::Error writeSetting(const QString &regPath,
registry.setValue(name, value);
registry.sync();
- if(registry.status() != QSettingsWrapper::NoError) {
+ if (registry.status() != QSettingsWrapper::NoError) {
*errorString = QObject::tr("Could not write to registry path %1").arg(regPath);
return UpdateOperation::UserDefinedError;
}
@@ -114,7 +115,8 @@ UpdateOperation::Error undoSetting(const QString &regPath,
const QString &name,
const QString &value,
const QString &oldValue,
- QString *errorString) {
+ QString *errorString)
+{
QString actual;
{
SettingsType registry(regPath, QSettingsWrapper::NativeFormat);
@@ -135,7 +137,7 @@ bool EnvironmentVariableOperation::performOperation()
if (arguments().count() < 2 || arguments().count() > 4) {
setError(InvalidArguments);
setErrorString(tr("Invalid arguments in %0: %1 arguments given, 2-3 expected.")
- .arg(name()).arg( arguments().count()));
+ .arg(name()).arg(arguments().count()));
return false;
}
@@ -148,8 +150,8 @@ bool EnvironmentVariableOperation::performOperation()
const bool isSystemWide = arguments().count() >= 4 ? arguments().at(3) == QLatin1String("true") : false;
QString oldvalue;
if (isPersistent) {
- const QString regPath = isSystemWide ? QLatin1String( "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment" )
- : QLatin1String( "HKEY_CURRENT_USER\\Environment" );
+ const QString regPath = isSystemWide ? QLatin1String("HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet"
+ "\\Control\\Session Manager\\Environment") : QLatin1String("HKEY_CURRENT_USER\\Environment");
// write the name=value pair to the global environment
QString errorString;
@@ -166,15 +168,15 @@ bool EnvironmentVariableOperation::performOperation()
}
const bool bret = broadcastChange();
Q_UNUSED(bret); // this is not critical, so fall-through
- setValue( QLatin1String( "oldvalue" ), oldvalue );
+ setValue(QLatin1String("oldvalue"), oldvalue);
return true;
}
#endif
- Q_ASSERT( !isPersistent );
+ Q_ASSERT(!isPersistent);
Q_UNUSED(isPersistent)
- setValue( QLatin1String( "oldvalue" ), Environment::instance().value( name ) );
- Environment::instance().setTemporaryValue( name, value );
+ setValue(QLatin1String("oldvalue"), Environment::instance().value(name));
+ Environment::instance().setTemporaryValue(name, value);
return true;
}
@@ -186,7 +188,7 @@ bool EnvironmentVariableOperation::undoOperation()
const QString name = arguments().at(0);
const QString value = arguments().at(1);
- const QString oldvalue = this->value( QLatin1String("oldvalue") ).toString();
+ const QString oldvalue = this->value(QLatin1String("oldvalue")).toString();
#ifdef Q_WS_WIN
const bool isPersistent = arguments().count() >= 3 ? arguments().at(2) == QLatin1String("true") : true;
@@ -194,19 +196,19 @@ bool EnvironmentVariableOperation::undoOperation()
const bool isPersistent = false;
#endif
- if ( !isPersistent ) {
- const QString actual = Environment::instance().value( name );
+ if (!isPersistent) {
+ const QString actual = Environment::instance().value(name);
const bool doUndo = actual == value;
- if ( doUndo )
- Environment::instance().setTemporaryValue( name, oldvalue );
+ if (doUndo)
+ Environment::instance().setTemporaryValue(name, oldvalue);
return doUndo;
}
#ifdef Q_WS_WIN
const bool isSystemWide = arguments().count() >= 4 ? arguments().at(3) == QLatin1String("true") : false;
- const QString regPath = isSystemWide ? QLatin1String( "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment" )
- : QLatin1String( "HKEY_CURRENT_USER\\Environment" );
+ const QString regPath = isSystemWide ? QLatin1String("HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\"
+ "Control\\Session Manager\\Environment") : QLatin1String("HKEY_CURRENT_USER\\Environment");
QString errorString;
@@ -214,7 +216,7 @@ bool EnvironmentVariableOperation::undoOperation()
? undoSetting<QSettingsWrapper>(regPath, name, value, oldvalue, &errorString)
: undoSetting<QSettingsWrapper>(regPath, name, value, oldvalue, &errorString);
- if (err != NoError) {
+ if (err != NoError) {
setError(err);
setErrorString(errorString);
return false;
@@ -229,7 +231,7 @@ bool EnvironmentVariableOperation::testOperation()
return true;
}
-EnvironmentVariableOperation* EnvironmentVariableOperation::clone() const
+Operation* EnvironmentVariableOperation::clone() const
{
return new EnvironmentVariableOperation();
}
diff --git a/installerbuilder/libinstaller/environmentvariablesoperation.h b/installerbuilder/libinstaller/environmentvariablesoperation.h
index dedfa095d..8af871aeb 100644
--- a/installerbuilder/libinstaller/environmentvariablesoperation.h
+++ b/installerbuilder/libinstaller/environmentvariablesoperation.h
@@ -26,17 +26,12 @@
#ifndef ENVIRONMENTVARIABLESOPERATION_H
#define ENVIRONMENTVARIABLESOPERATION_H
-#include "installer_global.h"
-
-#include <KDUpdater/UpdateOperation>
-#include <QtCore/QObject>
-#include <QtCore/QString>
+#include "qinstallerglobal.h"
namespace QInstaller {
-class INSTALLER_EXPORT EnvironmentVariableOperation : public QObject, public KDUpdater::UpdateOperation
+class INSTALLER_EXPORT EnvironmentVariableOperation : public Operation
{
- Q_OBJECT
public:
EnvironmentVariableOperation();
~EnvironmentVariableOperation();
@@ -45,7 +40,7 @@ public:
bool performOperation();
bool undoOperation();
bool testOperation();
- EnvironmentVariableOperation* clone() const;
+ Operation* clone() const;
};
}
diff --git a/installerbuilder/libinstaller/fakestopprocessforupdateoperation.cpp b/installerbuilder/libinstaller/fakestopprocessforupdateoperation.cpp
index 1457a48b6..9d486819a 100644
--- a/installerbuilder/libinstaller/fakestopprocessforupdateoperation.cpp
+++ b/installerbuilder/libinstaller/fakestopprocessforupdateoperation.cpp
@@ -38,29 +38,28 @@
#include <algorithm>
/*!
- Copied from QInstaller with some adjustments
- Return true, if a process with \a name is running. On Windows, the comparision is case-insensitive.
- */
-static bool isProcessRunning( const QString& name, const QList< KDSysInfo::ProcessInfo > &processes )
+ Copied from QInstaller with some adjustments
+ Return true, if a process with \a name is running. On Windows, the comparision is case-insensitive.
+*/
+static bool isProcessRunning(const QString& name, const QList< KDSysInfo::ProcessInfo > &processes)
{
- for( QList< KDSysInfo::ProcessInfo >::const_iterator it = processes.constBegin(); it != processes.constEnd(); ++it )
- {
- if (it->name.isEmpty()) {
+ for(QList< KDSysInfo::ProcessInfo >::const_iterator it = processes.constBegin(); it != processes.constEnd(); ++it) {
+ if (it->name.isEmpty())
continue;
- }
+
#ifndef Q_WS_WIN
- if( it->name == name )
+ if(it->name == name)
return true;
- const QFileInfo fi( it->name );
- if( fi.fileName() == name || fi.baseName() == name )
+ const QFileInfo fi(it->name);
+ if(fi.fileName() == name || fi.baseName() == name)
return true;
#else
- if( it->name.toLower() == name.toLower() )
+ if(it->name.toLower() == name.toLower())
return true;
- if( it->name.toLower() == QDir::toNativeSeparators(name.toLower()) )
+ if(it->name.toLower() == QDir::toNativeSeparators(name.toLower()))
return true;
- const QFileInfo fi( it->name );
- if( fi.fileName().toLower() == name.toLower() || fi.baseName().toLower() == name.toLower() )
+ const QFileInfo fi(it->name);
+ if(fi.fileName().toLower() == name.toLower() || fi.baseName().toLower() == name.toLower())
return true;
#endif
}
@@ -71,10 +70,9 @@ static QStringList checkRunningProcessesFromList(const QStringList &processList)
{
const QList< KDSysInfo::ProcessInfo > allProcesses = KDSysInfo::runningProcesses();
QStringList stillRunningProcesses;
- foreach(const QString process, processList) {
- if (!process.isEmpty() && isProcessRunning(process, allProcesses)) {
+ foreach (const QString process, processList) {
+ if (!process.isEmpty() && isProcessRunning(process, allProcesses))
stillRunningProcesses.append(process);
- }
}
return stillRunningProcesses;
}
@@ -83,7 +81,7 @@ using namespace QInstaller;
FakeStopProcessForUpdateOperation::FakeStopProcessForUpdateOperation()
{
- setName( QLatin1String( "FakeStopProcessForUpdate" ) );
+ setName(QLatin1String("FakeStopProcessForUpdate"));
}
FakeStopProcessForUpdateOperation::~FakeStopProcessForUpdateOperation()
@@ -103,24 +101,21 @@ bool FakeStopProcessForUpdateOperation::performOperation()
bool FakeStopProcessForUpdateOperation::undoOperation()
{
- setError( KDUpdater::UpdateOperation::NoError );
- if ( arguments().size() != 1)
- {
- setError( KDUpdater::UpdateOperation::InvalidArguments, QObject::tr( "Number of arguments does not match : one is required" ) );
+ setError(KDUpdater::UpdateOperation::NoError);
+ if (arguments().size() != 1) {
+ setError(KDUpdater::UpdateOperation::InvalidArguments, QObject::tr("Number of arguments does not "
+ "match : one is required"));
return false;
}
- QStringList processList = arguments()[0].split( QLatin1String( "," ), QString::SkipEmptyParts );
- qSort( processList );
- processList.erase( std::unique( processList.begin(), processList.end() ), processList.end() );
- if ( !processList.isEmpty() )
- {
- const QStringList processes = checkRunningProcessesFromList( processList );
- if ( !processes.isEmpty() )
- {
- setError( KDUpdater::UpdateOperation::UserDefinedError,
- tr( "These processes should be stopped to continue:\n\n%1" )
- .arg( QDir::toNativeSeparators( processes.join( QLatin1String("\n") ) ) ) );
+ QStringList processList = arguments()[0].split(QLatin1String(","), QString::SkipEmptyParts);
+ qSort(processList);
+ processList.erase(std::unique(processList.begin(), processList.end()), processList.end());
+ if (!processList.isEmpty()) {
+ const QStringList processes = checkRunningProcessesFromList(processList);
+ if (!processes.isEmpty()) {
+ setError(KDUpdater::UpdateOperation::UserDefinedError, tr("These processes should be stopped to "
+ "continue:\n\n%1").arg(QDir::toNativeSeparators(processes.join(QLatin1String("\n")))));
}
return false;
}
@@ -132,7 +127,7 @@ bool FakeStopProcessForUpdateOperation::testOperation()
return true;
}
-FakeStopProcessForUpdateOperation* FakeStopProcessForUpdateOperation::clone() const
+Operation* FakeStopProcessForUpdateOperation::clone() const
{
return new FakeStopProcessForUpdateOperation();
}
diff --git a/installerbuilder/libinstaller/fakestopprocessforupdateoperation.h b/installerbuilder/libinstaller/fakestopprocessforupdateoperation.h
index f7a6a8e60..2874a8cec 100644
--- a/installerbuilder/libinstaller/fakestopprocessforupdateoperation.h
+++ b/installerbuilder/libinstaller/fakestopprocessforupdateoperation.h
@@ -25,11 +25,12 @@
**************************************************************************/
#ifndef FAKESTOPPROCESSFORUPDATEOPERATION_H
#define FAKESTOPPROCESSFORUPDATEOPERATION_H
-#include <KDUpdater/UpdateOperation>
+
+#include "qinstallerglobal.h"
namespace QInstaller {
-class FakeStopProcessForUpdateOperation : public KDUpdater::UpdateOperation
+class FakeStopProcessForUpdateOperation : public Operation
{
public:
@@ -40,7 +41,7 @@ public:
bool performOperation();
bool undoOperation();
bool testOperation();
- FakeStopProcessForUpdateOperation* clone() const;
+ Operation* clone() const;
};
diff --git a/installerbuilder/libinstaller/globalsettingsoperation.cpp b/installerbuilder/libinstaller/globalsettingsoperation.cpp
index e3eb35885..163de80a1 100644
--- a/installerbuilder/libinstaller/globalsettingsoperation.cpp
+++ b/installerbuilder/libinstaller/globalsettingsoperation.cpp
@@ -100,13 +100,12 @@ bool GlobalSettingsOperation::testOperation()
return true;
}
-KDUpdater::UpdateOperation* GlobalSettingsOperation::clone() const
+Operation* GlobalSettingsOperation::clone() const
{
return new GlobalSettingsOperation();
}
-QSettingsWrapper* GlobalSettingsOperation::setup(QString *key, QString *value,
- const QStringList &arguments)
+QSettingsWrapper* GlobalSettingsOperation::setup(QString *key, QString *value, const QStringList &arguments)
{
if (arguments.count() == 4) {
const QString &company = arguments.at(0);
diff --git a/installerbuilder/libinstaller/globalsettingsoperation.h b/installerbuilder/libinstaller/globalsettingsoperation.h
index 82cf3cd2f..051d50cba 100644
--- a/installerbuilder/libinstaller/globalsettingsoperation.h
+++ b/installerbuilder/libinstaller/globalsettingsoperation.h
@@ -26,13 +26,13 @@
#ifndef GLOBALSETTINGSOPERATION_H
#define GLOBALSETTINGSOPERATION_H
-#include <KDUpdater/UpdateOperation>
+#include "qinstallerglobal.h"
class QSettingsWrapper;
namespace QInstaller {
-class GlobalSettingsOperation : public KDUpdater::UpdateOperation
+class INSTALLER_EXPORT GlobalSettingsOperation : public Operation
{
public:
GlobalSettingsOperation();
@@ -42,7 +42,7 @@ public:
bool performOperation();
bool undoOperation();
bool testOperation();
- KDUpdater::UpdateOperation* clone() const;
+ Operation* clone() const;
private:
QSettingsWrapper* setup(QString *key, QString *value, const QStringList &args);
diff --git a/installerbuilder/libinstaller/licenseoperation.cpp b/installerbuilder/libinstaller/licenseoperation.cpp
index 6c6e5e39b..a7b6e2e1a 100644
--- a/installerbuilder/libinstaller/licenseoperation.cpp
+++ b/installerbuilder/libinstaller/licenseoperation.cpp
@@ -117,7 +117,7 @@ bool LicenseOperation::testOperation()
return true;
}
-LicenseOperation* LicenseOperation::clone() const
+Operation* LicenseOperation::clone() const
{
return new LicenseOperation();
}
diff --git a/installerbuilder/libinstaller/licenseoperation.h b/installerbuilder/libinstaller/licenseoperation.h
index 4444bcf3c..9b78f0157 100644
--- a/installerbuilder/libinstaller/licenseoperation.h
+++ b/installerbuilder/libinstaller/licenseoperation.h
@@ -26,17 +26,12 @@
#ifndef LICENSEOPERATION_H
#define LICENSEOPERATION_H
-#include <KDUpdater/UpdateOperation>
-
-#include "installer_global.h"
-#include <QtCore/QObject>
+#include "qinstallerglobal.h"
namespace QInstaller {
-class INSTALLER_EXPORT LicenseOperation : public QObject, public KDUpdater::UpdateOperation
+class INSTALLER_EXPORT LicenseOperation : public Operation
{
- Q_OBJECT
-
public:
LicenseOperation();
~LicenseOperation();
@@ -45,7 +40,7 @@ public:
bool performOperation();
bool undoOperation();
bool testOperation();
- LicenseOperation* clone() const;
+ Operation* clone() const;
};
diff --git a/installerbuilder/libinstaller/macreplaceinstallnamesoperation.cpp b/installerbuilder/libinstaller/macreplaceinstallnamesoperation.cpp
index 3f33e18a0..ac2d761fd 100644
--- a/installerbuilder/libinstaller/macreplaceinstallnamesoperation.cpp
+++ b/installerbuilder/libinstaller/macreplaceinstallnamesoperation.cpp
@@ -90,7 +90,7 @@ bool MacReplaceInstallNamesOperation::testOperation()
return true;
}
-KDUpdater::UpdateOperation* MacReplaceInstallNamesOperation::clone() const
+Operation* MacReplaceInstallNamesOperation::clone() const
{
return new MacReplaceInstallNamesOperation;
}
diff --git a/installerbuilder/libinstaller/macreplaceinstallnamesoperation.h b/installerbuilder/libinstaller/macreplaceinstallnamesoperation.h
index 3f8b03f1a..6fc271043 100644
--- a/installerbuilder/libinstaller/macreplaceinstallnamesoperation.h
+++ b/installerbuilder/libinstaller/macreplaceinstallnamesoperation.h
@@ -26,12 +26,11 @@
#ifndef MACREPLACEINSTALLNAMEOPERATION_H
#define MACREPLACEINSTALLNAMEOPERATION_H
-#include <KDUpdater/UpdateOperation>
-
+#include "qinstallerglobal.h"
namespace QInstaller {
-class MacReplaceInstallNamesOperation : public KDUpdater::UpdateOperation
+class INSTALLER_EXPORT MacReplaceInstallNamesOperation : public Operation
{
public:
MacReplaceInstallNamesOperation();
@@ -40,7 +39,7 @@ public:
bool performOperation();
bool undoOperation();
bool testOperation();
- KDUpdater::UpdateOperation *clone() const;
+ Operation *clone() const;
bool apply(const QString &oldString, const QString &newString, const QString &frameworkDir);
diff --git a/installerbuilder/libinstaller/qtpatchoperation.cpp b/installerbuilder/libinstaller/qtpatchoperation.cpp
index 6cebb630e..2f17933c7 100644
--- a/installerbuilder/libinstaller/qtpatchoperation.cpp
+++ b/installerbuilder/libinstaller/qtpatchoperation.cpp
@@ -54,7 +54,7 @@ using namespace QInstaller;
//"anonymous" namespace to make clear that this is only for inside use
namespace {
QMap<QByteArray, QByteArray> generatePatchValueMap(const QByteArray & newQtPath,
- const QHash<QString, QByteArray> & qmakeValueHash)
+ const QHash<QString, QByteArray> & qmakeValueHash)
{
QMap<QByteArray, QByteArray> replaceMap; //first == searchstring: second == replace string
char nativeSeperator = QDir::separator().toAscii();
@@ -62,54 +62,54 @@ namespace {
oldValue = qmakeValueHash.value(QLatin1String("QT_INSTALL_PREFIX"));
replaceMap.insert(QByteArray("qt_prfxpath=%1").replace("%1", oldValue),
- QByteArray("qt_prfxpath=%1/").replace("%1/", newQtPath));
+ QByteArray("qt_prfxpath=%1/").replace("%1/", newQtPath));
oldValue = qmakeValueHash.value(QLatin1String("QT_INSTALL_DOCS"));
replaceMap.insert(QByteArray("qt_docspath=%1").replace("%1", oldValue),
- QByteArray("qt_docspath=%1/doc").replace("%1/", newQtPath + nativeSeperator));
+ QByteArray("qt_docspath=%1/doc").replace("%1/", newQtPath + nativeSeperator));
oldValue = qmakeValueHash.value(QLatin1String("QT_INSTALL_HEADERS"));
replaceMap.insert(QByteArray("qt_hdrspath=%1").replace("%1", oldValue),
- QByteArray("qt_hdrspath=%1/include").replace("%1/", newQtPath + nativeSeperator));
+ QByteArray("qt_hdrspath=%1/include").replace("%1/", newQtPath + nativeSeperator));
oldValue = qmakeValueHash.value(QLatin1String("QT_INSTALL_LIBS"));
replaceMap.insert(QByteArray("qt_libspath=%1").replace("%1", oldValue),
- QByteArray("qt_libspath=%1/lib").replace("%1/", newQtPath + nativeSeperator));
+ QByteArray("qt_libspath=%1/lib").replace("%1/", newQtPath + nativeSeperator));
oldValue = qmakeValueHash.value(QLatin1String("QT_INSTALL_BINS"));
replaceMap.insert(QByteArray("qt_binspath=%1").replace("%1", oldValue),
- QByteArray("qt_binspath=%1/bin").replace("%1/", newQtPath + nativeSeperator));
+ QByteArray("qt_binspath=%1/bin").replace("%1/", newQtPath + nativeSeperator));
oldValue = qmakeValueHash.value(QLatin1String("QT_INSTALL_PLUGINS"));
replaceMap.insert(QByteArray("qt_plugpath=%1").replace("%1", oldValue),
- QByteArray("qt_plugpath=%1/plugins").replace("%1/", newQtPath + nativeSeperator));
+ QByteArray("qt_plugpath=%1/plugins").replace("%1/", newQtPath + nativeSeperator));
oldValue = qmakeValueHash.value(QLatin1String("QT_INSTALL_IMPORTS"));
replaceMap.insert(QByteArray("qt_impspath=%1").replace("%1", oldValue),
- QByteArray("qt_impspath=%1/imports").replace("%1/", newQtPath + nativeSeperator));
+ QByteArray("qt_impspath=%1/imports").replace("%1/", newQtPath + nativeSeperator));
oldValue = qmakeValueHash.value(QLatin1String("QT_INSTALL_DATA"));
replaceMap.insert( QByteArray("qt_datapath=%1").replace("%1", oldValue),
- QByteArray("qt_datapath=%1/").replace("%1/", newQtPath + nativeSeperator));
+ QByteArray("qt_datapath=%1/").replace("%1/", newQtPath + nativeSeperator));
oldValue = qmakeValueHash.value(QLatin1String("QT_INSTALL_TRANSLATIONS"));
replaceMap.insert( QByteArray("qt_trnspath=%1").replace("%1", oldValue),
- QByteArray("qt_trnspath=%1/translations").replace("%1/", newQtPath + nativeSeperator));
+ QByteArray("qt_trnspath=%1/translations").replace("%1/", newQtPath + nativeSeperator));
-// This must not be patched. Commenting out to fix QTSDK-429
-// oldValue = qmakeValueHash.value(QLatin1String("QT_INSTALL_CONFIGURATION"));
-// replaceMap.insert( QByteArray("qt_stngpath=%1").replace("%1", oldValue),
-// QByteArray("qt_stngpath=%1").replace("%1", newQtPath));
+ // This must not be patched. Commenting out to fix QTSDK-429
+ // oldValue = qmakeValueHash.value(QLatin1String("QT_INSTALL_CONFIGURATION"));
+ // replaceMap.insert( QByteArray("qt_stngpath=%1").replace("%1", oldValue),
+ // QByteArray("qt_stngpath=%1").replace("%1", newQtPath));
//examples and demoes can patched outside separately,
//but for cosmetic reasons - if the qt version gets no examples later.
oldValue = qmakeValueHash.value(QLatin1String("QT_INSTALL_EXAMPLES"));
replaceMap.insert( QByteArray("qt_xmplpath=%1").replace("%1", oldValue),
- QByteArray("qt_xmplpath=%1/examples").replace("%1/", newQtPath + nativeSeperator));
+ QByteArray("qt_xmplpath=%1/examples").replace("%1/", newQtPath + nativeSeperator));
oldValue = qmakeValueHash.value(QLatin1String("QT_INSTALL_DEMOS"));
replaceMap.insert( QByteArray("qt_demopath=%1").replace("%1", oldValue),
- QByteArray("qt_demopath=%1/demos").replace("%1/", newQtPath + nativeSeperator));
+ QByteArray("qt_demopath=%1/demos").replace("%1/", newQtPath + nativeSeperator));
return replaceMap;
}
@@ -135,24 +135,24 @@ bool QtPatchOperation::performOperation()
// 1. type
// 2. new/target qtpath
- if(arguments().count() != 2) {
+ if (arguments().count() != 2) {
setError(InvalidArguments);
- setErrorString(tr("Invalid arguments in %0: %1 arguments given, 2 expected.")
- .arg(name()).arg(arguments().count()));
+ setErrorString(tr("Invalid arguments in %0: %1 arguments given, 2 expected.").arg(name())
+ .arg(arguments().count()));
return false;
}
QString type = arguments().at(0);
-
- bool isPlatformSupported = type.contains(QLatin1String("linux"), Qt::CaseInsensitive) ||
- type.contains(QLatin1String("windows"), Qt::CaseInsensitive) ||
- type.contains(QLatin1String("mac"), Qt::CaseInsensitive);
- if (!isPlatformSupported)
- {
+ bool isPlatformSupported = type.contains(QLatin1String("linux"), Qt::CaseInsensitive)
+ || type.contains(QLatin1String("windows"), Qt::CaseInsensitive)
+ || type.contains(QLatin1String("mac"), Qt::CaseInsensitive);
+ if (!isPlatformSupported) {
setError(InvalidArguments);
- setErrorString(tr("First argument should be 'linux', 'mac' or 'windows'. No other type is supported at this time."));
+ setErrorString(tr("First argument should be 'linux', 'mac' or 'windows'. No other type is supported "
+ "at this time."));
return false;
}
+
const QString newQtPathStr = QDir::toNativeSeparators(arguments().at(1));
const QByteArray newQtPath = newQtPathStr.toUtf8();
@@ -161,24 +161,21 @@ bool QtPatchOperation::performOperation()
qmakePath = qmakePath + QLatin1String(".exe");
#endif
- if (!QFile::exists(qmakePath))
- {
+ if (!QFile::exists(qmakePath)) {
setError(UserDefinedError);
- setErrorString(tr("QMake from the current Qt version \n(%1)" \
- "is not existing. Please make a bugreport with this dialog at http://bugreports.qt.nokia.com.\n" \
- ).arg(QDir::toNativeSeparators(qmakePath)));
+ setErrorString(tr("QMake from the current Qt version \n(%1)is not existing. Please file a bugreport "
+ "with this dialog at http://bugreports.qt.nokia.com.").arg(QDir::toNativeSeparators(qmakePath)));
return false;
}
QByteArray qmakeOutput;
QHash<QString, QByteArray> qmakeValueHash = QtPatch::qmakeValues(qmakePath, &qmakeOutput);
- if (qmakeValueHash.isEmpty())
- {
+ if (qmakeValueHash.isEmpty()) {
setError(UserDefinedError);
- setErrorString(tr("The output of \n%1 -query\n" \
- "is not parseable. Please make a bugreport with this dialog http://bugreports.qt.nokia.com.\n" \
- "output: \"%2\"").arg(QDir::toNativeSeparators(qmakePath), QString::fromUtf8(qmakeOutput)));
+ setErrorString(tr("The output of \n%1 -query\nis not parseable. Please file a bugreport with this "
+ "dialog http://bugreports.qt.nokia.com.\noutput: \"%2\"").arg(QDir::toNativeSeparators(qmakePath),
+ QString::fromUtf8(qmakeOutput)));
return false;
}
@@ -188,15 +185,15 @@ bool QtPatchOperation::performOperation()
//maybe we don't need this, but I 255 should be a rational limit
if (255 < newQtPath.size()) {
setError(UserDefinedError);
- setErrorString(tr("Qt patch error: new Qt dir(%1)\n" \
- "needs to be less than 255 characters.").arg(newQtPathStr));
+ setErrorString(tr("Qt patch error: new Qt dir(%1)\nneeds to be less than 255 characters.")
+ .arg(newQtPathStr));
return false;
}
QFile patchFileListFile;
- if(type == QLatin1String("windows"))
+ if (type == QLatin1String("windows"))
patchFileListFile.setFileName(QLatin1String(":/files-to-patch-windows"));
- else if(type == QLatin1String("linux"))
+ else if (type == QLatin1String("linux"))
patchFileListFile.setFileName(QLatin1String(":/files-to-patch-linux"));
else if (type == QLatin1String("mac"))
patchFileListFile.setFileName(QLatin1String(":/files-to-patch-macx"));
@@ -252,16 +249,18 @@ bool QtPatchOperation::performOperation()
if (!QtPatch::openFileForPatching(&file)) {
setError(UserDefinedError);
- setErrorString(tr("Qt patch error: Can not open %1(%2).").arg(file.fileName()).arg(file.errorString()));
+ setErrorString(tr("Qt patch error: Can not open %1(%2).").arg(file.fileName())
+ .arg(file.errorString()));
return false;
}
QMapIterator<QByteArray, QByteArray> it(patchValueMap);
- while(it.hasNext()) {
+ while (it.hasNext()) {
it.next();
bool isPatched = QtPatch::patchBinaryFile(&file, it.key(), it.value());
if (!isPatched) {
- QInstaller::verbose() << "qpatch: warning: file '" << qPrintable(fileName) << "' could not patched" << std::endl;
+ QInstaller::verbose() << "qpatch: warning: file '" << qPrintable(fileName)
+ << "' could not patched" << std::endl;
}
}
} //foreach (QString fileName, filesToPatch)
@@ -281,16 +280,17 @@ bool QtPatchOperation::performOperation()
searchReplacePairs.insert(QByteArray(oldQtPath).replace("\\", "\\\\"), newQtPathWithDoubleBackSlashes);
//this is checking for a possible drive letter, which could be upper or lower
- if (oldQtPath.mid(1,1) == ":")
- {
+ if (oldQtPath.mid(1,1) == ":") {
QHash<QByteArray, QByteArray> tempSearchReplacePairs;
QHashIterator<QByteArray, QByteArray> it(searchReplacePairs);
QByteArray driveLetter = oldQtPath.left(1);
- while(it.hasNext()) {
+ while (it.hasNext()) {
it.next();
QByteArray currentPossibleSearchByteArrayWithoutDriveLetter = QByteArray(it.key()).remove(0, 1);
- tempSearchReplacePairs.insert(driveLetter.toLower() + currentPossibleSearchByteArrayWithoutDriveLetter, it.value());
- tempSearchReplacePairs.insert(driveLetter.toUpper() + currentPossibleSearchByteArrayWithoutDriveLetter, it.value());
+ tempSearchReplacePairs.insert(driveLetter.toLower()
+ + currentPossibleSearchByteArrayWithoutDriveLetter, it.value());
+ tempSearchReplacePairs.insert(driveLetter.toUpper()
+ + currentPossibleSearchByteArrayWithoutDriveLetter, it.value());
}
searchReplacePairs = tempSearchReplacePairs;
}
@@ -317,8 +317,7 @@ bool QtPatchOperation::performOperation()
}
Q_CHECK_PTR(core);
successMacRelocating = relocator.apply(newQtPathStr, core->value(scTargetDir));
- if (!successMacRelocating)
- {
+ if (!successMacRelocating) {
setError(UserDefinedError);
setErrorString(tr("Error while relocating Qt: %1").arg(relocator.errorMessage()));
return false;
@@ -326,11 +325,10 @@ bool QtPatchOperation::performOperation()
#endif
if (oldQtPathFromQMakeIsEmpty) {
setError(UserDefinedError);
- setErrorString(tr("The installer was not able to get the unpatched path from \n%1.(maybe it is broken or removed)\n" \
- "It tried to patch the Qt binaries, but all other files in Qt are unpatched.\n" \
- "This could result in a broken Qt version.\n" \
- "Sometimes it helps to restart the installer with a switched off antivirus software."
- ).arg(QDir::toNativeSeparators(qmakePath)));
+ setErrorString(tr("The installer was not able to get the unpatched path from \n%1.(maybe it is "
+ "broken or removed)\nIt tried to patch the Qt binaries, but all other files in Qt are unpatched."
+ "\nThis could result in a broken Qt version.\nSometimes it helps to restart the installer with a "
+ "switched off antivirus software.").arg(QDir::toNativeSeparators(qmakePath)));
return false;
}
@@ -347,7 +345,7 @@ bool QtPatchOperation::testOperation()
return true;
}
-KDUpdater::UpdateOperation* QtPatchOperation::clone() const
+Operation* QtPatchOperation::clone() const
{
return new QtPatchOperation();
}
diff --git a/installerbuilder/libinstaller/qtpatchoperation.h b/installerbuilder/libinstaller/qtpatchoperation.h
index 61a8a691f..73cc53808 100644
--- a/installerbuilder/libinstaller/qtpatchoperation.h
+++ b/installerbuilder/libinstaller/qtpatchoperation.h
@@ -25,14 +25,13 @@
**************************************************************************/
#ifndef QTPATCHOPERATION_H
#define QTPATCHOPERATION_H
-#include <KDUpdater/UpdateOperation>
-#include <QtCore/QObject>
+
+#include "qinstallerglobal.h"
namespace QInstaller {
-class QtPatchOperation : public QObject, public KDUpdater::UpdateOperation
+class QtPatchOperation : public Operation
{
- Q_OBJECT
public:
QtPatchOperation();
~QtPatchOperation();
@@ -41,7 +40,7 @@ public:
bool performOperation();
bool undoOperation();
bool testOperation();
- KDUpdater::UpdateOperation* clone() const;
+ Operation* clone() const;
};
} // namespace
diff --git a/installerbuilder/libinstaller/registerdefaultdebuggeroperation.cpp b/installerbuilder/libinstaller/registerdefaultdebuggeroperation.cpp
index 33f6839ea..fce7f2ef0 100644
--- a/installerbuilder/libinstaller/registerdefaultdebuggeroperation.cpp
+++ b/installerbuilder/libinstaller/registerdefaultdebuggeroperation.cpp
@@ -148,7 +148,7 @@ bool RegisterDefaultDebuggerOperation::testOperation()
return true;
}
-KDUpdater::UpdateOperation* RegisterDefaultDebuggerOperation::clone() const
+Operation* RegisterDefaultDebuggerOperation::clone() const
{
return new RegisterDefaultDebuggerOperation();
}
diff --git a/installerbuilder/libinstaller/registerdefaultdebuggeroperation.h b/installerbuilder/libinstaller/registerdefaultdebuggeroperation.h
index 3e7f44ea2..fbfc1be0c 100644
--- a/installerbuilder/libinstaller/registerdefaultdebuggeroperation.h
+++ b/installerbuilder/libinstaller/registerdefaultdebuggeroperation.h
@@ -26,14 +26,12 @@
#ifndef REGISTERDEFAULTDEBUGGEROPERATION_H
#define REGISTERDEFAULTDEBUGGEROPERATION_H
-#include <KDUpdater/UpdateOperation>
+#include "qinstallerglobal.h"
-#include <QObject>
-#include <QStringList>
namespace QInstaller {
-class RegisterDefaultDebuggerOperation : public KDUpdater::UpdateOperation
+class RegisterDefaultDebuggerOperation : public Operation
{
public:
RegisterDefaultDebuggerOperation();
@@ -43,7 +41,7 @@ public:
bool performOperation();
bool undoOperation();
bool testOperation();
- KDUpdater::UpdateOperation* clone() const;
+ Operation* clone() const;
};
} // namespace
diff --git a/installerbuilder/libinstaller/registerdocumentationoperation.cpp b/installerbuilder/libinstaller/registerdocumentationoperation.cpp
index c240cee1d..ffd314fd6 100644
--- a/installerbuilder/libinstaller/registerdocumentationoperation.cpp
+++ b/installerbuilder/libinstaller/registerdocumentationoperation.cpp
@@ -153,7 +153,7 @@ bool RegisterDocumentationOperation::testOperation()
return true;
}
-KDUpdater::UpdateOperation* RegisterDocumentationOperation::clone() const
+Operation* RegisterDocumentationOperation::clone() const
{
return new RegisterDocumentationOperation();
}
diff --git a/installerbuilder/libinstaller/registerdocumentationoperation.h b/installerbuilder/libinstaller/registerdocumentationoperation.h
index 7b35184a3..0f9abe55d 100644
--- a/installerbuilder/libinstaller/registerdocumentationoperation.h
+++ b/installerbuilder/libinstaller/registerdocumentationoperation.h
@@ -26,11 +26,11 @@
#ifndef REGISTERDOCUMENTATIONOPERATION_H
#define REGISTERDOCUMENTATIONOPERATION_H
-#include <KDUpdater/UpdateOperation>
+#include "qinstallerglobal.h"
namespace QInstaller {
-class RegisterDocumentationOperation : public KDUpdater::UpdateOperation
+class RegisterDocumentationOperation : public Operation
{
public:
RegisterDocumentationOperation();
@@ -40,7 +40,7 @@ public:
bool performOperation();
bool undoOperation();
bool testOperation();
- KDUpdater::UpdateOperation* clone() const;
+ Operation* clone() const;
};
} // namespace
diff --git a/installerbuilder/libinstaller/registerqtoperation.cpp b/installerbuilder/libinstaller/registerqtoperation.cpp
index 3e1d22a6c..18656a3a3 100644
--- a/installerbuilder/libinstaller/registerqtoperation.cpp
+++ b/installerbuilder/libinstaller/registerqtoperation.cpp
@@ -222,7 +222,7 @@ bool RegisterQtInCreatorOperation::testOperation()
return true;
}
-KDUpdater::UpdateOperation* RegisterQtInCreatorOperation::clone() const
+Operation* RegisterQtInCreatorOperation::clone() const
{
return new RegisterQtInCreatorOperation();
}
diff --git a/installerbuilder/libinstaller/registerqtoperation.h b/installerbuilder/libinstaller/registerqtoperation.h
index 0caa0f5aa..0c63fd8ac 100644
--- a/installerbuilder/libinstaller/registerqtoperation.h
+++ b/installerbuilder/libinstaller/registerqtoperation.h
@@ -26,11 +26,11 @@
#ifndef REGISTERQTINCREATOROPERATION_H
#define REGISTERQTINCREATOROPERATION_H
-#include <KDUpdater/UpdateOperation>
+#include "qinstallerglobal.h"
namespace QInstaller {
-class RegisterQtInCreatorOperation : public KDUpdater::UpdateOperation
+class RegisterQtInCreatorOperation : public Operation
{
public:
RegisterQtInCreatorOperation();
@@ -40,7 +40,7 @@ public:
bool performOperation();
bool undoOperation();
bool testOperation();
- KDUpdater::UpdateOperation* clone() const;
+ Operation* clone() const;
};
}; // namespace
diff --git a/installerbuilder/libinstaller/registerqtv2operation.cpp b/installerbuilder/libinstaller/registerqtv2operation.cpp
index 5626a3e38..e5a5a41fb 100644
--- a/installerbuilder/libinstaller/registerqtv2operation.cpp
+++ b/installerbuilder/libinstaller/registerqtv2operation.cpp
@@ -199,7 +199,7 @@ bool RegisterQtInCreatorV2Operation::testOperation()
return true;
}
-KDUpdater::UpdateOperation* RegisterQtInCreatorV2Operation::clone() const
+Operation* RegisterQtInCreatorV2Operation::clone() const
{
return new RegisterQtInCreatorV2Operation();
}
diff --git a/installerbuilder/libinstaller/registerqtv2operation.h b/installerbuilder/libinstaller/registerqtv2operation.h
index 9abb12459..ef0f50a8e 100644
--- a/installerbuilder/libinstaller/registerqtv2operation.h
+++ b/installerbuilder/libinstaller/registerqtv2operation.h
@@ -26,11 +26,11 @@
#ifndef REGISTERQTINCREATORV2OPERATION_H
#define REGISTERQTINCREATORV2OPERATION_H
-#include <KDUpdater/UpdateOperation>
+#include "qinstallerglobal.h"
namespace QInstaller {
-class RegisterQtInCreatorV2Operation : public KDUpdater::UpdateOperation
+class RegisterQtInCreatorV2Operation : public Operation
{
public:
RegisterQtInCreatorV2Operation();
@@ -40,7 +40,7 @@ public:
bool performOperation();
bool undoOperation();
bool testOperation();
- KDUpdater::UpdateOperation* clone() const;
+ Operation* clone() const;
};
} // namespace