summaryrefslogtreecommitdiffstats
path: root/src/libs
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs')
-rw-r--r--src/libs/installer/binaryformat.cpp2
-rw-r--r--src/libs/installer/binaryformatengine.cpp2
-rw-r--r--src/libs/installer/binaryformatenginehandler.cpp2
-rw-r--r--src/libs/installer/component_p.cpp12
-rw-r--r--src/libs/installer/componentmodel.cpp4
-rw-r--r--src/libs/installer/componentselectionpage_p.cpp39
-rw-r--r--src/libs/installer/componentselectionpage_p.h3
-rw-r--r--src/libs/installer/copyfiletask.cpp2
-rw-r--r--src/libs/installer/createdesktopentryoperation.cpp6
-rw-r--r--src/libs/installer/createlocalrepositoryoperation.cpp2
-rw-r--r--src/libs/installer/createshortcutoperation.cpp8
-rw-r--r--src/libs/installer/downloadarchivesjob.cpp14
-rw-r--r--src/libs/installer/elevatedexecuteoperation.cpp4
-rw-r--r--src/libs/installer/environmentvariablesoperation.cpp4
-rw-r--r--src/libs/installer/fileutils.cpp22
-rw-r--r--src/libs/installer/globalsettingsoperation.cpp4
-rw-r--r--src/libs/installer/init.cpp2
-rw-r--r--src/libs/installer/installiconsoperation.cpp10
-rw-r--r--src/libs/installer/keepaliveobject.cpp4
-rw-r--r--src/libs/installer/lib7z_facade.cpp16
-rw-r--r--src/libs/installer/link.cpp14
-rw-r--r--src/libs/installer/messageboxhandler.cpp12
-rw-r--r--src/libs/installer/metadatajob.cpp13
-rw-r--r--src/libs/installer/packagemanagercore.cpp16
-rw-r--r--src/libs/installer/packagemanagercore_p.cpp72
-rw-r--r--src/libs/installer/packagemanagercore_p.h2
-rw-r--r--src/libs/installer/packagemanagercoredata.cpp2
-rw-r--r--src/libs/installer/packagemanagergui.cpp49
-rw-r--r--src/libs/installer/performinstallationform.cpp12
-rw-r--r--src/libs/installer/progresscoordinator.cpp4
-rw-r--r--src/libs/installer/qprocesswrapper.cpp2
-rw-r--r--src/libs/installer/registerfiletypeoperation.cpp4
-rw-r--r--src/libs/installer/remoteclient.cpp4
-rw-r--r--src/libs/installer/remoteobject.cpp6
-rw-r--r--src/libs/installer/remoteserverconnection.cpp10
-rw-r--r--src/libs/installer/repository.cpp3
-rw-r--r--src/libs/installer/repositorycategory.cpp13
-rw-r--r--src/libs/installer/repositorycategory.h4
-rw-r--r--src/libs/installer/scriptengine.cpp2
-rw-r--r--src/libs/installer/settings.cpp28
-rw-r--r--src/libs/installer/settings.h1
-rw-r--r--src/libs/installer/sysinfo_win.cpp6
-rw-r--r--src/libs/installer/unziptask.cpp6
-rw-r--r--src/libs/installer/utils.cpp20
-rw-r--r--src/libs/kdtools/filedownloader.cpp14
-rw-r--r--src/libs/kdtools/filedownloader.h1
46 files changed, 273 insertions, 209 deletions
diff --git a/src/libs/installer/binaryformat.cpp b/src/libs/installer/binaryformat.cpp
index 42c94ab1d..9a46095ce 100644
--- a/src/libs/installer/binaryformat.cpp
+++ b/src/libs/installer/binaryformat.cpp
@@ -293,7 +293,7 @@ void ResourceCollection::setName(const QByteArray &name)
void ResourceCollection::appendResource(const QSharedPointer<Resource>& resource)
{
Q_ASSERT(resource);
- resource->setParent(0);
+ resource->setParent(nullptr);
m_resources.append(resource);
}
diff --git a/src/libs/installer/binaryformatengine.cpp b/src/libs/installer/binaryformatengine.cpp
index 1100bcf08..ec6926031 100644
--- a/src/libs/installer/binaryformatengine.cpp
+++ b/src/libs/installer/binaryformatengine.cpp
@@ -81,7 +81,7 @@ namespace QInstaller {
*/
BinaryFormatEngine::BinaryFormatEngine(const QHash<QByteArray, ResourceCollection> &collections,
const QString &fileName)
- : m_resource(0)
+ : m_resource(nullptr)
, m_collections(collections)
{
setFileName(fileName);
diff --git a/src/libs/installer/binaryformatenginehandler.cpp b/src/libs/installer/binaryformatenginehandler.cpp
index fffb248b9..885888912 100644
--- a/src/libs/installer/binaryformatenginehandler.cpp
+++ b/src/libs/installer/binaryformatenginehandler.cpp
@@ -48,7 +48,7 @@ namespace QInstaller {
QAbstractFileEngine *BinaryFormatEngineHandler::create(const QString &fileName) const
{
return fileName.startsWith(QLatin1String("installer://"), Qt::CaseInsensitive )
- ? new BinaryFormatEngine(m_resources, fileName) : 0;
+ ? new BinaryFormatEngine(m_resources, fileName) : nullptr;
}
/*!
diff --git a/src/libs/installer/component_p.cpp b/src/libs/installer/component_p.cpp
index 5f44f83a4..5a5284a4b 100644
--- a/src/libs/installer/component_p.cpp
+++ b/src/libs/installer/component_p.cpp
@@ -41,9 +41,9 @@ namespace QInstaller {
ComponentPrivate::ComponentPrivate(PackageManagerCore *core, Component *qq)
: q(qq)
, m_core(core)
- , m_parentComponent(0)
- , m_licenseOperation(0)
- , m_minimumProgressOperation(0)
+ , m_parentComponent(nullptr)
+ , m_licenseOperation(nullptr)
+ , m_minimumProgressOperation(nullptr)
, m_newlyInstalled (false)
, m_operationsCreated(false)
, m_autoCreateOperations(true)
@@ -98,11 +98,11 @@ int ComponentModelHelper::childCount() const
Component *ComponentModelHelper::childAt(int index) const
{
if (index < 0 && index >= childCount())
- return 0;
+ return nullptr;
if (m_componentPrivate->m_core->virtualComponentsVisible())
- return m_componentPrivate->m_allChildComponents.value(index, 0);
- return m_componentPrivate->m_childComponents.value(index, 0);
+ return m_componentPrivate->m_allChildComponents.value(index, nullptr);
+ return m_componentPrivate->m_childComponents.value(index, nullptr);
}
/*!
diff --git a/src/libs/installer/componentmodel.cpp b/src/libs/installer/componentmodel.cpp
index e729f3088..69c709060 100644
--- a/src/libs/installer/componentmodel.cpp
+++ b/src/libs/installer/componentmodel.cpp
@@ -378,7 +378,7 @@ Component *ComponentModel::componentFromIndex(const QModelIndex &index) const
{
if (index.isValid())
return static_cast<Component*>(index.internalPointer());
- return 0;
+ return nullptr;
}
@@ -585,7 +585,7 @@ QSet<QModelIndex> ComponentModel::updateCheckedState(const ComponentSet &compone
checkable = false;
}
- if ((!node->isCheckable() && checkable) || !node->isEnabled() || !node->autoDependencies().isEmpty())
+ if ((!node->isCheckable() && checkable) || !node->isEnabled() || !node->autoDependencies().isEmpty() || node->isUnstable())
continue;
Qt::CheckState newState = state;
diff --git a/src/libs/installer/componentselectionpage_p.cpp b/src/libs/installer/componentselectionpage_p.cpp
index 22c478beb..4e7acc837 100644
--- a/src/libs/installer/componentselectionpage_p.cpp
+++ b/src/libs/installer/componentselectionpage_p.cpp
@@ -193,17 +193,19 @@ void ComponentSelectionPagePrivate::setupCategoryLayout()
m_categoryGroupBox->setTitle(m_core->settings().repositoryCategoryDisplayName());
m_categoryGroupBox->setObjectName(QLatin1String("CategoryGroupBox"));
QVBoxLayout *categoryLayout = new QVBoxLayout(m_categoryGroupBox);
- QPushButton *fetchCategoryButton = new QPushButton(tr("Fetch"));
+ QPushButton *fetchCategoryButton = new QPushButton(tr("Refresh"));
fetchCategoryButton->setObjectName(QLatin1String("FetchCategoryButton"));
connect(fetchCategoryButton, &QPushButton::clicked, this,
&ComponentSelectionPagePrivate::fetchRepositoryCategories);
- foreach (RepositoryCategory repository, m_core->settings().repositoryCategories()) {
+ foreach (RepositoryCategory repository, m_core->settings().organizedRepositoryCategories()) {
QCheckBox *checkBox = new QCheckBox;
checkBox->setObjectName(repository.displayname());
+ checkBox->setChecked(repository.isEnabled());
connect(checkBox, &QCheckBox::stateChanged, this,
&ComponentSelectionPagePrivate::checkboxStateChanged);
checkBox->setText(repository.displayname());
+ checkBox->setToolTip(repository.tooltip());
categoryLayout->addWidget(checkBox);
}
@@ -213,6 +215,15 @@ void ComponentSelectionPagePrivate::setupCategoryLayout()
m_mainHLayout->insertWidget(0, m_categoryWidget);
}
+void ComponentSelectionPagePrivate::showCategoryLayout(bool show)
+{
+ if (show) {
+ setupCategoryLayout();
+ }
+ if (m_categoryWidget)
+ m_categoryWidget->setVisible(show);
+}
+
void ComponentSelectionPagePrivate::updateTreeView()
{
m_checkDefault->setVisible(m_core->isInstaller() || m_core->isPackageManager());
@@ -315,8 +326,17 @@ void ComponentSelectionPagePrivate::checkboxStateChanged()
}
}
-void ComponentSelectionPagePrivate::enableRepositoryCategory(int index, bool enable) {
- RepositoryCategory repoCategory = m_core->settings().repositoryCategories().toList().at(index);
+void ComponentSelectionPagePrivate::enableRepositoryCategory(const QString &repositoryName, bool enable)
+{
+ QMap<QString, RepositoryCategory> organizedRepositoryCategories = m_core->settings().organizedRepositoryCategories();
+
+ QMap<QString, RepositoryCategory>::iterator i = organizedRepositoryCategories.find(repositoryName);
+ RepositoryCategory repoCategory;
+ while (i != organizedRepositoryCategories.end() && i.key() == repositoryName) {
+ repoCategory = i.value();
+ i++;
+ }
+
RepositoryCategory replacement = repoCategory;
replacement.setEnabled(enable);
QSet<RepositoryCategory> tmpRepoCategories = m_core->settings().repositoryCategories();
@@ -334,10 +354,15 @@ void ComponentSelectionPagePrivate::updateWidgetVisibility(bool show)
QSizePolicy::Expanding);
m_treeViewVLayout->addSpacerItem(verticalSpacer2);
m_mainHLayout->removeItem(m_descriptionVLayout);
+ //Hide next button during category fetch
+ QPushButton *const b = qobject_cast<QPushButton *>(q->gui()->button(QWizard::NextButton));
+ b->setEnabled(!show);
} else {
QSpacerItem *item = m_treeViewVLayout->spacerItem();
m_treeViewVLayout->removeItem(item);
m_mainHLayout->addLayout(m_descriptionVLayout, 2);
+ //Call completeChanged() to determine if NextButton should be shown or not after category fetch.
+ q->completeChanged();
}
if (m_categoryWidget)
m_categoryWidget->setDisabled(show);
@@ -350,8 +375,6 @@ void ComponentSelectionPagePrivate::updateWidgetVisibility(bool show)
m_uncheckAll->setVisible(!show);
m_descriptionLabel->setVisible(!show);
m_sizeLabel->setVisible(!show);
- QPushButton *const b = qobject_cast<QPushButton *>(q->gui()->button(QWizard::NextButton));
- b->setEnabled(!show);
if (QAbstractButton *bspButton = q->gui()->button(QWizard::CustomButton2))
bspButton->setEnabled(!show);
@@ -365,7 +388,7 @@ void ComponentSelectionPagePrivate::fetchRepositoryCategories()
QList<QCheckBox*> checkboxes = m_categoryGroupBox->findChildren<QCheckBox *>();
for (int i = 0; i < checkboxes.count(); i++) {
checkbox = checkboxes.at(i);
- enableRepositoryCategory(i, checkbox->isChecked());
+ enableRepositoryCategory(checkbox->objectName(), checkbox->isChecked());
}
if (!m_core->fetchRemotePackagesTree()) {
@@ -380,7 +403,7 @@ void ComponentSelectionPagePrivate::customButtonClicked(int which)
if (QWizard::WizardButton(which) == QWizard::CustomButton2) {
QString defaultDownloadDirectory =
QStandardPaths::writableLocation(QStandardPaths::DownloadLocation);
- QStringList fileNames = QFileDialog::getOpenFileNames(NULL,
+ QStringList fileNames = QFileDialog::getOpenFileNames(nullptr,
ComponentSelectionPage::tr("Open File"),defaultDownloadDirectory,
QLatin1String("QBSP or 7z Files (*.qbsp *.7z)"));
diff --git a/src/libs/installer/componentselectionpage_p.h b/src/libs/installer/componentselectionpage_p.h
index bc1e6ed7a..9ebec834a 100644
--- a/src/libs/installer/componentselectionpage_p.h
+++ b/src/libs/installer/componentselectionpage_p.h
@@ -64,6 +64,7 @@ public:
void showCompressedRepositoryButton();
void hideCompressedRepositoryButton();
void setupCategoryLayout();
+ void showCategoryLayout(bool show);
void updateTreeView();
public slots:
@@ -71,7 +72,7 @@ public slots:
void selectAll();
void deselectAll();
void checkboxStateChanged();
- void enableRepositoryCategory(int index, bool enable);
+ void enableRepositoryCategory(const QString &repositoryName, bool enable);
void updateWidgetVisibility(bool show);
void fetchRepositoryCategories();
void customButtonClicked(int which);
diff --git a/src/libs/installer/copyfiletask.cpp b/src/libs/installer/copyfiletask.cpp
index fdde9b15d..50626b682 100644
--- a/src/libs/installer/copyfiletask.cpp
+++ b/src/libs/installer/copyfiletask.cpp
@@ -104,7 +104,7 @@ void CopyFileTask::doTask(QFutureInterface<FileTaskResult> &fi)
}
observer.addSample(read);
- observer.timerEvent(NULL);
+ observer.timerEvent(nullptr);
observer.addBytesTransfered(read);
observer.addCheckSumData(buffer.data(), read);
diff --git a/src/libs/installer/createdesktopentryoperation.cpp b/src/libs/installer/createdesktopentryoperation.cpp
index d2e71b14f..17e165777 100644
--- a/src/libs/installer/createdesktopentryoperation.cpp
+++ b/src/libs/installer/createdesktopentryoperation.cpp
@@ -49,17 +49,13 @@ QString CreateDesktopEntryOperation::absoluteFileName()
if (hasValue(QLatin1String("directory")))
return QDir(value(QLatin1String("directory")).toString()).absoluteFilePath(filename);
- QStringList XDG_DATA_DIRS = QString::fromLocal8Bit(qgetenv("XDG_DATA_DIRS"))
- .split(QLatin1Char(':'),
- QString::SkipEmptyParts);
QStringList XDG_DATA_HOME = QString::fromLocal8Bit(qgetenv("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
- const QStringList directories = XDG_DATA_DIRS + XDG_DATA_HOME;
+ const QStringList directories = XDG_DATA_HOME;
QString directory;
for (QStringList::const_iterator it = directories.begin(); it != directories.end(); ++it) {
if (it->isEmpty())
diff --git a/src/libs/installer/createlocalrepositoryoperation.cpp b/src/libs/installer/createlocalrepositoryoperation.cpp
index 8f6ab2eaa..a2f7806a3 100644
--- a/src/libs/installer/createlocalrepositoryoperation.cpp
+++ b/src/libs/installer/createlocalrepositoryoperation.cpp
@@ -251,7 +251,7 @@ bool CreateLocalRepositoryOperation::performOperation()
// start to read the binary layout
ResourceCollectionManager manager;
- BinaryContent::readBinaryContent(&file, 0, &manager, 0, BinaryContent::MagicCookie);
+ BinaryContent::readBinaryContent(&file, nullptr, &manager, 0, BinaryContent::MagicCookie);
emit progressChanged(0.65);
diff --git a/src/libs/installer/createshortcutoperation.cpp b/src/libs/installer/createshortcutoperation.cpp
index 2c2e96eff..bbe3feba1 100644
--- a/src/libs/installer/createshortcutoperation.cpp
+++ b/src/libs/installer/createshortcutoperation.cpp
@@ -50,7 +50,7 @@ typedef ITEMIDLIST *PIDLIST_ABSOLUTE;
struct DeCoInitializer
{
DeCoInitializer()
- : neededCoInit(CoInitialize(NULL) == S_OK)
+ : neededCoInit(CoInitialize(nullptr) == S_OK)
{
}
~DeCoInitializer()
@@ -100,12 +100,12 @@ static bool createLink(const QString &fileName, const QString &linkName, QString
// CoInitialize cleanup object
DeCoInitializer _;
- IUnknown *iunkn = NULL;
+ IUnknown *iunkn = nullptr;
if (fileName.toLower().startsWith(QLatin1String("http:"))
|| fileName.toLower().startsWith(QLatin1String("ftp:"))) {
- IUniformResourceLocator *iurl = NULL;
- if (FAILED(CoCreateInstance(CLSID_InternetShortcut, NULL, CLSCTX_INPROC_SERVER,
+ IUniformResourceLocator *iurl = nullptr;
+ if (FAILED(CoCreateInstance(CLSID_InternetShortcut, nullptr, CLSCTX_INPROC_SERVER,
IID_IUniformResourceLocator, (LPVOID*)&iurl))) {
return false;
}
diff --git a/src/libs/installer/downloadarchivesjob.cpp b/src/libs/installer/downloadarchivesjob.cpp
index 80c094ae0..102783133 100644
--- a/src/libs/installer/downloadarchivesjob.cpp
+++ b/src/libs/installer/downloadarchivesjob.cpp
@@ -49,7 +49,7 @@ using namespace KDUpdater;
DownloadArchivesJob::DownloadArchivesJob(PackageManagerCore *core)
: Job(core)
, m_core(core)
- , m_downloader(0)
+ , m_downloader(nullptr)
, m_archivesDownloaded(0)
, m_archivesToDownloadCount(0)
, m_canceled(false)
@@ -93,7 +93,7 @@ void DownloadArchivesJob::doStart()
void DownloadArchivesJob::doCancel()
{
m_canceled = true;
- if (m_downloader != 0)
+ if (m_downloader != nullptr)
m_downloader->cancelDownload();
}
@@ -130,7 +130,7 @@ void DownloadArchivesJob::fetchNextArchiveHash()
void DownloadArchivesJob::finishedHashDownload()
{
- Q_ASSERT(m_downloader != 0);
+ Q_ASSERT(m_downloader != nullptr);
QFile sha1HashFile(m_downloader->downloadedFileName());
if (sha1HashFile.open(QFile::ReadOnly)) {
@@ -156,7 +156,7 @@ void DownloadArchivesJob::fetchNextArchive()
return;
}
- if (m_downloader != 0)
+ if (m_downloader != nullptr)
m_downloader->deleteLater();
m_downloader = setupDownloader(QString(), m_core->value(scUrlQueryString));
@@ -202,7 +202,7 @@ void DownloadArchivesJob::timerEvent(QTimerEvent *event)
*/
void DownloadArchivesJob::registerFile()
{
- Q_ASSERT(m_downloader != 0);
+ Q_ASSERT(m_downloader != nullptr);
if (m_canceled)
return;
@@ -259,7 +259,7 @@ void DownloadArchivesJob::finishWithError(const QString &error)
{
const FileDownloader *const dl = qobject_cast<const FileDownloader*> (sender());
const QString msg = tr("Cannot fetch archives: %1\nError while loading %2");
- if (dl != 0)
+ if (dl != nullptr)
emitFinishedWithError(QInstaller::DownloadError, msg.arg(error, dl->url().toString()));
else
emitFinishedWithError(QInstaller::DownloadError, msg.arg(error, m_downloader->url().toString()));
@@ -267,7 +267,7 @@ void DownloadArchivesJob::finishWithError(const QString &error)
KDUpdater::FileDownloader *DownloadArchivesJob::setupDownloader(const QString &suffix, const QString &queryString)
{
- KDUpdater::FileDownloader *downloader = 0;
+ KDUpdater::FileDownloader *downloader = nullptr;
const QFileInfo fi = QFileInfo(m_archivesToDownload.first().first);
const Component *const component = m_core->componentByName(PackageManagerCore::checkableName(QFileInfo(fi.path()).fileName()));
if (component) {
diff --git a/src/libs/installer/elevatedexecuteoperation.cpp b/src/libs/installer/elevatedexecuteoperation.cpp
index 2cc988a4d..aa88f0398 100644
--- a/src/libs/installer/elevatedexecuteoperation.cpp
+++ b/src/libs/installer/elevatedexecuteoperation.cpp
@@ -43,7 +43,7 @@ class ElevatedExecuteOperation::Private
public:
explicit Private(ElevatedExecuteOperation *qq)
: q(qq)
- , process(0)
+ , process(nullptr)
, showStandardError(false)
{
}
@@ -221,7 +221,7 @@ bool ElevatedExecuteOperation::Private::run(const QStringList &arguments)
Q_ASSERT(process);
Q_ASSERT(process->state() == QProcessWrapper::NotRunning);
delete process;
- process = 0;
+ process = nullptr;
return returnValue;
}
diff --git a/src/libs/installer/environmentvariablesoperation.cpp b/src/libs/installer/environmentvariablesoperation.cpp
index 7a8dbfb5a..006ea3762 100644
--- a/src/libs/installer/environmentvariablesoperation.cpp
+++ b/src/libs/installer/environmentvariablesoperation.cpp
@@ -83,8 +83,8 @@ bool handleRegExpandSz(const QString &regPath, const QString &name,
if (res == ERROR_SUCCESS) {
DWORD dataType;
DWORD dataSize;
- res = RegQueryValueEx(handle, reinterpret_cast<const wchar_t *>(name.utf16()), 0,
- &dataType, 0, &dataSize);
+ res = RegQueryValueEx(handle, reinterpret_cast<const wchar_t *>(name.utf16()), nullptr,
+ &dataType, nullptr, &dataSize);
setAsExpandSZ = (res == ERROR_SUCCESS) && (dataType == REG_EXPAND_SZ);
if (setAsExpandSZ) {
RegCloseKey(handle);
diff --git a/src/libs/installer/fileutils.cpp b/src/libs/installer/fileutils.cpp
index c142b55f1..4347c67da 100644
--- a/src/libs/installer/fileutils.cpp
+++ b/src/libs/installer/fileutils.cpp
@@ -130,14 +130,14 @@ QString QInstaller::humanReadableSize(const qint64 &size, int precision)
static QStringList measures;
if (measures.isEmpty())
measures << QCoreApplication::translate("QInstaller", "bytes")
- << QCoreApplication::translate("QInstaller", "KiB")
- << QCoreApplication::translate("QInstaller", "MiB")
- << QCoreApplication::translate("QInstaller", "GiB")
- << QCoreApplication::translate("QInstaller", "TiB")
- << QCoreApplication::translate("QInstaller", "PiB")
- << QCoreApplication::translate("QInstaller", "EiB")
- << QCoreApplication::translate("QInstaller", "ZiB")
- << QCoreApplication::translate("QInstaller", "YiB");
+ << QCoreApplication::translate("QInstaller", "KB")
+ << QCoreApplication::translate("QInstaller", "MB")
+ << QCoreApplication::translate("QInstaller", "GB")
+ << QCoreApplication::translate("QInstaller", "TB")
+ << QCoreApplication::translate("QInstaller", "PB")
+ << QCoreApplication::translate("QInstaller", "EB")
+ << QCoreApplication::translate("QInstaller", "ZB")
+ << QCoreApplication::translate("QInstaller", "YB");
QStringListIterator it(measures);
QString measure(it.next());
@@ -239,7 +239,7 @@ void QInstaller::removeDirectory(const QString &path, bool ignoreErrors)
class RemoveDirectoryThread : public QThread
{
public:
- explicit RemoveDirectoryThread(const QString &path, bool ignoreErrors = false, QObject *parent = 0)
+ explicit RemoveDirectoryThread(const QString &path, bool ignoreErrors = false, QObject *parent = nullptr)
: QThread(parent)
, p(path)
, ignore(ignoreErrors)
@@ -411,7 +411,7 @@ QString QInstaller::getShortPathName(const QString &name)
// Determine length, then convert.
const LPCTSTR nameC = reinterpret_cast<LPCTSTR>(name.utf16()); // MinGW
- const DWORD length = GetShortPathName(nameC, NULL, 0);
+ const DWORD length = GetShortPathName(nameC, nullptr, 0);
if (length == 0)
return name;
QScopedArrayPointer<TCHAR> buffer(new TCHAR[length]);
@@ -427,7 +427,7 @@ QString QInstaller::getLongPathName(const QString &name)
// Determine length, then convert.
const LPCTSTR nameC = reinterpret_cast<LPCTSTR>(name.utf16()); // MinGW
- const DWORD length = GetLongPathName(nameC, NULL, 0);
+ const DWORD length = GetLongPathName(nameC, nullptr, 0);
if (length == 0)
return name;
QScopedArrayPointer<TCHAR> buffer(new TCHAR[length]);
diff --git a/src/libs/installer/globalsettingsoperation.cpp b/src/libs/installer/globalsettingsoperation.cpp
index f8f7c112d..0840cecf2 100644
--- a/src/libs/installer/globalsettingsoperation.cpp
+++ b/src/libs/installer/globalsettingsoperation.cpp
@@ -96,7 +96,7 @@ bool GlobalSettingsOperation::testOperation()
QSettingsWrapper *GlobalSettingsOperation::setup(QString *key, QString *value, const QStringList &arguments)
{
if (!checkArgumentCount(3, 5))
- return 0;
+ return nullptr;
if (arguments.count() == 5) {
QSettingsWrapper::Scope scope = QSettingsWrapper::UserScope;
@@ -120,5 +120,5 @@ QSettingsWrapper *GlobalSettingsOperation::setup(QString *key, QString *value, c
return new QSettingsWrapper(filename, QSettingsWrapper::NativeFormat);
}
- return 0;
+ return nullptr;
}
diff --git a/src/libs/installer/init.cpp b/src/libs/installer/init.cpp
index 285c7ebc9..8a13119b0 100644
--- a/src/libs/installer/init.cpp
+++ b/src/libs/installer/init.cpp
@@ -130,7 +130,7 @@ void messageHandler(QtMsgType type, const QMessageLogContext &context, const QSt
std::cout << qPrintable(ba) << std::endl;
if (type == QtFatalMsg) {
- QtMessageHandler oldMsgHandler = qInstallMessageHandler(0);
+ QtMessageHandler oldMsgHandler = qInstallMessageHandler(nullptr);
qt_message_output(type, context, msg);
qInstallMessageHandler(oldMsgHandler);
}
diff --git a/src/libs/installer/installiconsoperation.cpp b/src/libs/installer/installiconsoperation.cpp
index 4b8346e18..15d47c72a 100644
--- a/src/libs/installer/installiconsoperation.cpp
+++ b/src/libs/installer/installiconsoperation.cpp
@@ -42,20 +42,18 @@ QString InstallIconsOperation::targetDirectory()
if (hasValue(QLatin1String("targetdirectory")))
return value(QLatin1String("targetdirectory")).toString();
- QStringList XDG_DATA_DIRS = QString::fromLocal8Bit(qgetenv("XDG_DATA_DIRS"))
+ QStringList XDG_DATA_HOME = QString::fromLocal8Bit(qgetenv("XDG_DATA_HOME"))
.split(QLatin1Char(':'),
QString::SkipEmptyParts);
- XDG_DATA_DIRS.push_back(QLatin1String("/usr/share/pixmaps")); // default path
- XDG_DATA_DIRS.push_back(QDir::home().absoluteFilePath(QLatin1String(".local/share/icons"))); // default path
- XDG_DATA_DIRS.push_back(QDir::home().absoluteFilePath(QLatin1String(".icons"))); // default path
+ XDG_DATA_HOME.push_back(QDir::home().absoluteFilePath(QLatin1String(".local/share/icons"))); // default path
QString directory;
- const QStringList& directories = XDG_DATA_DIRS;
+ const QStringList& directories = XDG_DATA_HOME;
for (QStringList::const_iterator it = directories.begin(); it != directories.end(); ++it) {
if (it->isEmpty())
continue;
- // our default dirs are correct, XDG_DATA_DIRS set via env need "icon" at the end
+ // our default dirs are correct, XDG_DATA_HOME set via env needs "icon" at the end
if ((it + 1 == directories.end()) || (it + 2 == directories.end()) || (it + 3 == directories.end()))
directory = QDir(*it).absolutePath();
else
diff --git a/src/libs/installer/keepaliveobject.cpp b/src/libs/installer/keepaliveobject.cpp
index 6f56d7823..f3b4e7779 100644
--- a/src/libs/installer/keepaliveobject.cpp
+++ b/src/libs/installer/keepaliveobject.cpp
@@ -35,8 +35,8 @@
namespace QInstaller {
KeepAliveObject::KeepAliveObject()
- : m_timer(0)
- , m_socket(0)
+ : m_timer(nullptr)
+ , m_socket(nullptr)
{
}
diff --git a/src/libs/installer/lib7z_facade.cpp b/src/libs/installer/lib7z_facade.cpp
index f5561af2f..b3b3319e8 100644
--- a/src/libs/installer/lib7z_facade.cpp
+++ b/src/libs/installer/lib7z_facade.cpp
@@ -64,7 +64,7 @@
#include <memory>
#ifdef Q_OS_WIN
-HINSTANCE g_hInstance = 0;
+HINSTANCE g_hInstance = nullptr;
# define S_IFMT 00170000
# define S_IFLNK 0120000
@@ -353,16 +353,16 @@ static quint32 getUInt32Property(IInArchive *archive, int index, int propId, qui
static QFile::Permissions getPermissions(IInArchive *archive, int index, bool *hasPermissions)
{
quint32 attributes = getUInt32Property(archive, index, kpidAttrib, 0);
- QFile::Permissions permissions = 0;
+ QFile::Permissions permissions = nullptr;
if (attributes & FILE_ATTRIBUTE_UNIX_EXTENSION) {
- if (hasPermissions != 0)
+ if (hasPermissions != nullptr)
*hasPermissions = true;
// filter the Unix permissions
attributes = (attributes >> 16) & 0777;
permissions |= static_cast<QFile::Permissions>((attributes & 0700) << 2); // owner rights
permissions |= static_cast<QFile::Permissions>((attributes & 0070) << 1); // group
permissions |= static_cast<QFile::Permissions>((attributes & 0007) << 0); // and world rights
- } else if (hasPermissions != 0) {
+ } else if (hasPermissions != nullptr) {
*hasPermissions = false;
}
return permissions;
@@ -536,7 +536,7 @@ QVector<File> listArchive(QFileDevice *archive)
f.archiveIndex.setY(item);
f.path = UString2QString(s).replace(QLatin1Char('\\'), QLatin1Char('/'));
Archive_IsItem_Folder(arch, item, f.isDirectory);
- f.permissions = getPermissions(arch, item, 0);
+ f.permissions = getPermissions(arch, item, nullptr);
getDateTimeProperty(arch, item, kpidMTime, &(f.utcTime));
f.uncompressedSize = getUInt64Property(arch, item, kpidSize, 0);
f.compressedSize = getUInt64Property(arch, item, kpidPackSize, 0);
@@ -579,7 +579,7 @@ STDMETHODIMP ExtractCallback::SetCompleted(const UInt64 *c)
// CDecoder::CodeSpec extracted content to an output stream.
STDMETHODIMP ExtractCallback::GetStream(UInt32 index, ISequentialOutStream **outStream, Int32 /*askExtractMode*/)
{
- *outStream = 0;
+ *outStream = nullptr;
if (targetDir.isEmpty())
return E_FAIL;
@@ -790,14 +790,14 @@ HRESULT UpdateCallback::OpenFileError(const wchar_t*, DWORD)
HRESULT UpdateCallback::CryptoGetTextPassword2(Int32 *passwordIsDefined, BSTR *password)
{
- *password = 0;
+ *password = nullptr;
*passwordIsDefined = false;
return S_OK;
}
HRESULT UpdateCallback::CryptoGetTextPassword(BSTR *password)
{
- *password = 0;
+ *password = nullptr;
return E_NOTIMPL;
}
diff --git a/src/libs/installer/link.cpp b/src/libs/installer/link.cpp
index ef91828ce..62ba06cb2 100644
--- a/src/libs/installer/link.cpp
+++ b/src/libs/installer/link.cpp
@@ -84,8 +84,8 @@ public:
: m_dirHandle(INVALID_HANDLE_VALUE)
{
QString normalizedPath = QString(path).replace(QLatin1Char('/'), QLatin1Char('\\'));
- m_dirHandle = CreateFile((wchar_t*)normalizedPath.utf16(), GENERIC_READ | GENERIC_WRITE, 0, 0,
- OPEN_EXISTING, FILE_FLAG_OPEN_REPARSE_POINT | FILE_FLAG_BACKUP_SEMANTICS, 0);
+ m_dirHandle = CreateFile((wchar_t*)normalizedPath.utf16(), GENERIC_READ | GENERIC_WRITE, 0, nullptr,
+ OPEN_EXISTING, FILE_FLAG_OPEN_REPARSE_POINT | FILE_FLAG_BACKUP_SEMANTICS, nullptr);
if (m_dirHandle == INVALID_HANDLE_VALUE) {
qWarning() << "Cannot open" << path << ":" << QInstaller::windowsErrorString(GetLastError());
@@ -112,7 +112,7 @@ QString readWindowsSymLink(const QString &path)
if (dirHandle.handle() != INVALID_HANDLE_VALUE) {
REPARSE_DATA_BUFFER* reparseStructData = (REPARSE_DATA_BUFFER*)calloc(1, MAXIMUM_REPARSE_DATA_BUFFER_SIZE);
DWORD bytesReturned = 0;
- if (::DeviceIoControl(dirHandle.handle(), FSCTL_GET_REPARSE_POINT, 0, 0, reparseStructData,
+ if (::DeviceIoControl(dirHandle.handle(), FSCTL_GET_REPARSE_POINT, nullptr, 0, reparseStructData,
MAXIMUM_REPARSE_DATA_BUFFER_SIZE, &bytesReturned, 0)) {
if (reparseStructData->ReparseTag == IO_REPARSE_TAG_MOUNT_POINT) {
int length = reparseStructData->MountPointReparseBuffer.SubstituteNameLength / sizeof(wchar_t);
@@ -170,8 +170,8 @@ Link createJunction(const QString &linkPath, const QString &targetPath)
DWORD bytesReturned;
if (!::DeviceIoControl(dirHandle.handle(), FSCTL_SET_REPARSE_POINT, reparseStructData,
- reparseStructData->ReparseDataLength + REPARSE_DATA_BUFFER_HEADER_SIZE, 0, 0,
- &bytesReturned, 0)) {
+ reparseStructData->ReparseDataLength + REPARSE_DATA_BUFFER_HEADER_SIZE, nullptr, 0,
+ &bytesReturned, nullptr)) {
qWarning() << "Cannot set the reparse point for" << linkPath << "to" << targetPath
<< ":" << QInstaller::windowsErrorString(GetLastError());
}
@@ -191,8 +191,8 @@ bool removeJunction(const QString &path)
DWORD bytesReturned;
if (!::DeviceIoControl(dirHandle.handle(), FSCTL_DELETE_REPARSE_POINT, reparseStructData,
- REPARSE_GUID_DATA_BUFFER_HEADER_SIZE, 0, 0,
- &bytesReturned, 0)) {
+ REPARSE_GUID_DATA_BUFFER_HEADER_SIZE, nullptr, 0,
+ &bytesReturned, nullptr)) {
qWarning() << "Cannot remove the reparse point" << path << ":" << QInstaller::windowsErrorString(GetLastError());
return false;
diff --git a/src/libs/installer/messageboxhandler.cpp b/src/libs/installer/messageboxhandler.cpp
index fcdee4a5f..286009e21 100644
--- a/src/libs/installer/messageboxhandler.cpp
+++ b/src/libs/installer/messageboxhandler.cpp
@@ -107,7 +107,7 @@ using namespace QInstaller;
Reports non-critical errors.
*/
-MessageBoxHandler *MessageBoxHandler::m_instance = 0;
+MessageBoxHandler *MessageBoxHandler::m_instance = nullptr;
MessageBoxHandler::MessageBoxHandler(QObject *parent)
: QObject(parent)
@@ -120,7 +120,7 @@ MessageBoxHandler::MessageBoxHandler(QObject *parent)
*/
MessageBoxHandler *MessageBoxHandler::instance()
{
- if (m_instance == 0)
+ if (m_instance == nullptr)
m_instance = new MessageBoxHandler(qApp);
return m_instance;
}
@@ -131,8 +131,8 @@ MessageBoxHandler *MessageBoxHandler::instance()
*/
QWidget *MessageBoxHandler::currentBestSuitParent()
{
- if (qobject_cast<QApplication*> (qApp) == 0)
- return 0;
+ if (qobject_cast<QApplication*> (qApp) == nullptr)
+ return nullptr;
if (qApp->activeModalWidget())
return qApp->activeModalWidget();
@@ -363,7 +363,7 @@ static QMessageBox::StandardButton showNewMessageBox(QWidget *parent, QMessageBo
{
QMessageBox msgBox(icon, title, text, QMessageBox::NoButton, parent);
QDialogButtonBox *buttonBox = msgBox.findChild<QDialogButtonBox *>();
- Q_ASSERT(buttonBox != 0);
+ Q_ASSERT(buttonBox != nullptr);
uint mask = QMessageBox::FirstButton;
while (mask <= QMessageBox::LastButton) {
@@ -404,7 +404,7 @@ QMessageBox::StandardButton MessageBoxHandler::showMessageBox(MessageType messag
qDebug().nospace() << "Created " << messageTypeHash.value(messageType).toUtf8().constData()
<< " message box " << identifier << ": " << title << ", " << text;
- if (qobject_cast<QApplication*> (qApp) == 0)
+ if (qobject_cast<QApplication*> (qApp) == nullptr)
return defaultButton;
if (m_automaticAnswers.contains(identifier))
diff --git a/src/libs/installer/metadatajob.cpp b/src/libs/installer/metadatajob.cpp
index cb1579756..3beda7ef2 100644
--- a/src/libs/installer/metadatajob.cpp
+++ b/src/libs/installer/metadatajob.cpp
@@ -53,7 +53,7 @@ static QUrl resolveUrl(const FileTaskResult &result, const QString &url)
MetadataJob::MetadataJob(QObject *parent)
: Job(parent)
- , m_core(0)
+ , m_core(nullptr)
, m_addCompressedPackages(false)
, m_downloadableChunkSize(1000)
, m_taskNumber(0)
@@ -102,6 +102,8 @@ Repository MetadataJob::repositoryForDirectory(const QString &directory) const
void MetadataJob::doStart()
{
+ setError(Job::NoError);
+ setErrorString(QString());
if (!m_core) {
emitFinishedWithError(Job::Canceled, tr("Missing package manager core engine."));
return; // We can't do anything here without core, so avoid tons of !m_core checks.
@@ -606,7 +608,14 @@ MetadataJob::Status MetadataJob::parseUpdatesXml(const QList<FileTaskResult> &re
item.insert(TaskRole::Checksum, packageHash.toLatin1());
item.insert(TaskRole::Authenticator, QVariant::fromValue(authenticator));
item.insert(TaskRole::Name, packageName);
+
m_packages.append(item);
+ } else {
+ QString fileName = metadata.directory + QLatin1Char('/') + packageName;
+ QDir directory(fileName);
+ if (!directory.exists()) {
+ directory.mkdir(fileName);
+ }
}
}
}
@@ -691,11 +700,13 @@ MetadataJob::Status MetadataJob::parseUpdatesXml(const QList<FileTaskResult> &re
if (tmpRepositories.count() > 0) {
s.addTemporaryRepositories(tmpRepositories, true);
QFile::remove(result.target());
+ m_metaFromDefaultRepositories.clear();
return XmlDownloadRetry;
}
} else if (s.updateDefaultRepositories(repositoryUpdates) == Settings::UpdatesApplied) {
if (m_core->isMaintainer())
m_core->writeMaintenanceConfigFiles();
+ m_metaFromDefaultRepositories.clear();
QFile::remove(result.target());
return XmlDownloadRetry;
}
diff --git a/src/libs/installer/packagemanagercore.cpp b/src/libs/installer/packagemanagercore.cpp
index 0c814288e..78198156e 100644
--- a/src/libs/installer/packagemanagercore.cpp
+++ b/src/libs/installer/packagemanagercore.cpp
@@ -392,7 +392,7 @@ using namespace QInstaller;
Q_GLOBAL_STATIC(QMutex, globalModelMutex);
-static QFont *sVirtualComponentsFont = 0;
+static QFont *sVirtualComponentsFont = nullptr;
Q_GLOBAL_STATIC(QMutex, globalVirtualComponentsFontMutex);
static bool sNoForceInstallation = false;
@@ -697,7 +697,7 @@ void PackageManagerCore::rollBackInstallation()
// reregister all the undo operations with the new size to the ProgressCoordinator
foreach (Operation *const operation, d->m_performedOperationsCurrentSession) {
QObject *const operationObject = dynamic_cast<QObject*> (operation);
- if (operationObject != 0) {
+ if (operationObject != nullptr) {
const QMetaObject* const mo = operationObject->metaObject();
if (mo->indexOfSignal(QMetaObject::normalizedSignature("progressChanged(double)")) > -1) {
ProgressCoordinator::instance()->registerPartProgress(operationObject,
@@ -939,7 +939,7 @@ PackageManagerCore::~PackageManagerCore()
QMutexLocker _(globalVirtualComponentsFontMutex());
delete sVirtualComponentsFont;
- sVirtualComponentsFont = 0;
+ sVirtualComponentsFont = nullptr;
}
/* static */
@@ -1220,17 +1220,17 @@ bool PackageManagerCore::fetchPackagesTree(const PackagesList &packages, const L
const QString name = update->data(scName).toString();
if (!installedPackages.contains(name)) {
success = false;
- break; // unusual, the maintenance tool should always be available
+ continue; // unusual, the maintenance tool should always be available
}
const LocalPackage localPackage = installedPackages.value(name);
const QString updateVersion = update->data(scVersion).toString();
if (KDUpdater::compareVersion(updateVersion, localPackage.version) <= 0)
- break; // remote version equals or is less than the installed maintenance tool
+ continue; // remote version equals or is less than the installed maintenance tool
const QDate updateDate = update->data(scReleaseDate).toDate();
if (localPackage.lastUpdateDate >= updateDate)
- break; // remote release date equals or is less than the installed maintenance tool
+ continue; // remote release date equals or is less than the installed maintenance tool
success = false;
break; // we found a newer version of the maintenance tool
@@ -1549,7 +1549,7 @@ Component *PackageManagerCore::componentByName(const QString &name) const
Component *PackageManagerCore::componentByName(const QString &name, const QList<Component *> &components)
{
if (name.isEmpty())
- return 0;
+ return nullptr;
QString fixedVersion;
QString fixedName;
@@ -1561,7 +1561,7 @@ Component *PackageManagerCore::componentByName(const QString &name, const QList<
return component;
}
- return 0;
+ return nullptr;
}
/*!
diff --git a/src/libs/installer/packagemanagercore_p.cpp b/src/libs/installer/packagemanagercore_p.cpp
index ccb80306e..c67480737 100644
--- a/src/libs/installer/packagemanagercore_p.cpp
+++ b/src/libs/installer/packagemanagercore_p.cpp
@@ -36,6 +36,7 @@
#include "componentmodel.h"
#include "errors.h"
#include "fileio.h"
+#include "remotefileengine.h"
#include "graph.h"
#include "messageboxhandler.h"
#include "packagemanagercore.h"
@@ -81,7 +82,7 @@ namespace QInstaller {
class OperationTracer
{
public:
- OperationTracer(Operation *operation) : m_operation(0)
+ OperationTracer(Operation *operation) : m_operation(nullptr)
{
// don't create output for that hacky pseudo operation
if (operation->name() != QLatin1String("MinimumProgress"))
@@ -197,29 +198,30 @@ static void deferredRename(const QString &oldName, const QString &newName, bool
// -- PackageManagerCorePrivate
PackageManagerCorePrivate::PackageManagerCorePrivate(PackageManagerCore *core)
- : m_updateFinder(0)
- , m_compressedFinder(0)
+ : m_updateFinder(nullptr)
+ , m_compressedFinder(nullptr)
, m_localPackageHub(std::make_shared<LocalPackageHub>())
, m_core(core)
, m_updates(false)
, m_repoFetched(false)
, m_updateSourcesAdded(false)
, m_componentsToInstallCalculated(false)
- , m_componentScriptEngine(0)
- , m_controlScriptEngine(0)
- , m_installerCalculator(0)
- , m_uninstallerCalculator(0)
- , m_proxyFactory(0)
- , m_defaultModel(0)
- , m_updaterModel(0)
- , m_guiObject(0)
+ , m_componentScriptEngine(nullptr)
+ , m_controlScriptEngine(nullptr)
+ , m_installerCalculator(nullptr)
+ , m_uninstallerCalculator(nullptr)
+ , m_proxyFactory(nullptr)
+ , m_defaultModel(nullptr)
+ , m_updaterModel(nullptr)
+ , m_guiObject(nullptr)
+ , m_remoteFileEngineHandler(nullptr)
{
}
PackageManagerCorePrivate::PackageManagerCorePrivate(PackageManagerCore *core, qint64 magicInstallerMaker,
const QList<OperationBlob> &performedOperations)
- : m_updateFinder(0)
- , m_compressedFinder(0)
+ : m_updateFinder(nullptr)
+ , m_compressedFinder(nullptr)
, m_localPackageHub(std::make_shared<LocalPackageHub>())
, m_status(PackageManagerCore::Unfinished)
, m_needsHardRestart(false)
@@ -234,14 +236,15 @@ PackageManagerCorePrivate::PackageManagerCorePrivate(PackageManagerCore *core, q
, m_updateSourcesAdded(false)
, m_magicBinaryMarker(magicInstallerMaker)
, m_componentsToInstallCalculated(false)
- , m_componentScriptEngine(0)
- , m_controlScriptEngine(0)
- , m_installerCalculator(0)
- , m_uninstallerCalculator(0)
- , m_proxyFactory(0)
- , m_defaultModel(0)
- , m_updaterModel(0)
- , m_guiObject(0)
+ , m_componentScriptEngine(nullptr)
+ , m_controlScriptEngine(nullptr)
+ , m_installerCalculator(nullptr)
+ , m_uninstallerCalculator(nullptr)
+ , m_proxyFactory(nullptr)
+ , m_defaultModel(nullptr)
+ , m_updaterModel(nullptr)
+ , m_guiObject(nullptr)
+ , m_remoteFileEngineHandler(new RemoteFileEngineHandler)
{
foreach (const OperationBlob &operation, performedOperations) {
QScopedPointer<QInstaller::Operation> op(KDUpdater::UpdateOperationFactory::instance()
@@ -363,7 +366,7 @@ bool PackageManagerCorePrivate::buildComponentTree(QHash<QString, Component*> &c
for (it = components.constBegin(); it != components.constEnd(); ++it) {
QString id = it.key();
QInstaller::Component *component = it.value();
- while (!id.isEmpty() && component->parentComponent() == 0) {
+ while (!id.isEmpty() && component->parentComponent() == nullptr) {
id = id.section(QLatin1Char('.'), 0, -2);
if (components.contains(id))
components[id]->appendComponent(component);
@@ -372,7 +375,7 @@ bool PackageManagerCorePrivate::buildComponentTree(QHash<QString, Component*> &c
// append all components w/o parent to the direct list
foreach (QInstaller::Component *component, components) {
- if (component->parentComponent() == 0)
+ if (component->parentComponent() == nullptr)
m_core->appendRootComponent(component);
}
@@ -443,7 +446,7 @@ void PackageManagerCorePrivate::cleanUpComponentEnvironment()
// there could be still some references to already deleted components,
// so we need to remove the current component script engine
delete m_componentScriptEngine;
- m_componentScriptEngine = 0;
+ m_componentScriptEngine = nullptr;
}
ScriptEngine *PackageManagerCorePrivate::componentScriptEngine() const
@@ -517,7 +520,7 @@ QHash<QString, QPair<Component*, Component*> > &PackageManagerCorePrivate::compo
void PackageManagerCorePrivate::clearInstallerCalculator()
{
delete m_installerCalculator;
- m_installerCalculator = 0;
+ m_installerCalculator = nullptr;
}
InstallerCalculator *PackageManagerCorePrivate::installerCalculator() const
@@ -533,7 +536,7 @@ InstallerCalculator *PackageManagerCorePrivate::installerCalculator() const
void PackageManagerCorePrivate::clearUninstallerCalculator()
{
delete m_uninstallerCalculator;
- m_uninstallerCalculator = 0;
+ m_uninstallerCalculator = nullptr;
}
UninstallerCalculator *PackageManagerCorePrivate::uninstallerCalculator() const
@@ -685,7 +688,7 @@ Operation *PackageManagerCorePrivate::createOwnedOperation(const QString &type)
Operation *PackageManagerCorePrivate::takeOwnedOperation(Operation *operation)
{
if (!m_ownedOperations.contains(operation))
- return 0;
+ return nullptr;
m_ownedOperations.removeAll(operation);
return operation;
@@ -939,7 +942,7 @@ void PackageManagerCorePrivate::connectOperationToInstaller(Operation *const ope
{
Q_ASSERT(operationPartSize);
QObject *const operationObject = dynamic_cast< QObject*> (operation);
- if (operationObject != 0) {
+ if (operationObject != nullptr) {
const QMetaObject *const mo = operationObject->metaObject();
if (mo->indexOfSignal(QMetaObject::normalizedSignature("outputTextChanged(QString)")) > -1) {
connect(operationObject, SIGNAL(outputTextChanged(QString)), ProgressCoordinator::instance(),
@@ -1653,7 +1656,7 @@ bool PackageManagerCorePrivate::runPackageUpdater()
// build a list of undo operations based on the checked state of the component
foreach (Operation *operation, performedOperationsOld) {
const QString &name = operation->value(QLatin1String("component")).toString();
- Component *component = componentsByName.value(name, 0);
+ Component *component = componentsByName.value(name, nullptr);
if (!component)
component = m_core->componentByName(PackageManagerCore::checkableName(name));
if (component)
@@ -2354,8 +2357,13 @@ void PackageManagerCorePrivate::restoreCheckState()
if (m_coreCheckedHash.isEmpty())
return;
- foreach (Component *component, m_coreCheckedHash.keys())
+ foreach (Component *component, m_coreCheckedHash.keys()) {
component->setCheckState(m_coreCheckedHash.value(component));
+ // Never allow component to be checked when it is unstable
+ // and not installed
+ if (component->isUnstable() && !component->isInstalled())
+ component->setCheckState(Qt::Unchecked);
+ }
m_coreCheckedHash.clear();
m_componentsToInstallCalculated = false;
@@ -2374,7 +2382,7 @@ void PackageManagerCorePrivate::storeCheckState()
void PackageManagerCorePrivate::connectOperationCallMethodRequest(Operation *const operation)
{
QObject *const operationObject = dynamic_cast<QObject *> (operation);
- if (operationObject != 0) {
+ if (operationObject != nullptr) {
const QMetaObject *const mo = operationObject->metaObject();
if (mo->indexOfSignal(QMetaObject::normalizedSignature("requestBlockingExecution(QString)")) > -1) {
connect(operationObject, SIGNAL(requestBlockingExecution(QString)),
@@ -2417,7 +2425,7 @@ OperationList PackageManagerCorePrivate::sortOperationsBasedOnComponentDependenc
void PackageManagerCorePrivate::handleMethodInvocationRequest(const QString &invokableMethodName)
{
QObject *obj = QObject::sender();
- if (obj != 0)
+ if (obj != nullptr)
QMetaObject::invokeMethod(obj, qPrintable(invokableMethodName));
}
diff --git a/src/libs/installer/packagemanagercore_p.h b/src/libs/installer/packagemanagercore_p.h
index 6f43caf3b..21ab3fc40 100644
--- a/src/libs/installer/packagemanagercore_p.h
+++ b/src/libs/installer/packagemanagercore_p.h
@@ -58,6 +58,7 @@ class ComponentModel;
class TempDirDeleter;
class InstallerCalculator;
class UninstallerCalculator;
+class RemoteFileEngineHandler;
class PackageManagerCorePrivate : public QObject
{
@@ -262,6 +263,7 @@ private:
ComponentModel *m_updaterModel;
QObject *m_guiObject;
+ QScopedPointer<RemoteFileEngineHandler> m_remoteFileEngineHandler;
private:
// remove once we deprecate isSelected, setSelected etc...
diff --git a/src/libs/installer/packagemanagercoredata.cpp b/src/libs/installer/packagemanagercoredata.cpp
index 3b35794cf..ebacbf938 100644
--- a/src/libs/installer/packagemanagercoredata.cpp
+++ b/src/libs/installer/packagemanagercoredata.cpp
@@ -108,7 +108,7 @@ void PackageManagerCoreData::setDynamicPredefinedVariables()
QString dir = QLatin1String("/opt");
#ifdef Q_OS_WIN
TCHAR buffer[MAX_PATH + 1] = { 0 };
- SHGetFolderPath(0, CSIDL_PROGRAM_FILES, 0, 0, buffer);
+ SHGetFolderPath(nullptr, CSIDL_PROGRAM_FILES, nullptr, 0, buffer);
dir = QString::fromWCharArray(buffer);
#elif defined (Q_OS_OSX)
dir = QStandardPaths::standardLocations(QStandardPaths::ApplicationsLocation).value(0);
diff --git a/src/libs/installer/packagemanagergui.cpp b/src/libs/installer/packagemanagergui.cpp
index 0e2577850..a053e9bff 100644
--- a/src/libs/installer/packagemanagergui.cpp
+++ b/src/libs/installer/packagemanagergui.cpp
@@ -95,7 +95,7 @@ class DynamicInstallerPage : public PackageManagerPage
Q_PROPERTY(bool complete READ isComplete WRITE setComplete)
public:
- explicit DynamicInstallerPage(QWidget *widget, PackageManagerCore *core = 0)
+ explicit DynamicInstallerPage(QWidget *widget, PackageManagerCore *core = nullptr)
: PackageManagerPage(core)
, m_widget(widget)
{
@@ -398,7 +398,7 @@ void PackageManagerGui::setMaxSize()
*/
PackageManagerGui::~PackageManagerGui()
{
- m_core->setGuiObject(0);
+ m_core->setGuiObject(nullptr);
delete d;
}
@@ -665,7 +665,7 @@ void PackageManagerGui::wizardPageInsertionRequested(QWidget *widget,
wizardPageRemovalRequested(widget);
int pageId = static_cast<int>(page) - 1;
- while (QWizard::page(pageId) != 0)
+ while (QWizard::page(pageId) != nullptr)
--pageId;
// add it
@@ -679,7 +679,7 @@ void PackageManagerGui::wizardPageRemovalRequested(QWidget *widget)
{
foreach (int pageId, pageIds()) {
DynamicInstallerPage *const dynamicPage = qobject_cast<DynamicInstallerPage*>(page(pageId));
- if (dynamicPage == 0)
+ if (dynamicPage == nullptr)
continue;
if (dynamicPage->widget() != widget)
continue;
@@ -710,7 +710,7 @@ void PackageManagerGui::wizardWidgetInsertionRequested(QWidget *widget,
void PackageManagerGui::wizardWidgetRemovalRequested(QWidget *widget)
{
Q_ASSERT(widget);
- widget->setParent(0);
+ widget->setParent(nullptr);
packageManagerCore()->controlScriptEngine()->removeFromGlobalObject(widget);
packageManagerCore()->componentScriptEngine()->removeFromGlobalObject(widget);
}
@@ -721,9 +721,9 @@ void PackageManagerGui::wizardWidgetRemovalRequested(QWidget *widget)
*/
void PackageManagerGui::wizardPageVisibilityChangeRequested(bool visible, int p)
{
- if (visible && page(p) == 0) {
+ if (visible && page(p) == nullptr) {
setPage(p, d->m_defaultPages[p]);
- } else if (!visible && page(p) != 0) {
+ } else if (!visible && page(p) != nullptr) {
d->m_defaultPages[p] = page(p);
removePage(p);
}
@@ -753,7 +753,7 @@ QWidget *PackageManagerGui::pageByObjectName(const QString &name) const
return p;
}
qWarning() << "No page found for object name" << name;
- return 0;
+ return nullptr;
}
/*!
@@ -781,7 +781,7 @@ QWidget *PackageManagerGui::pageWidgetByObjectName(const QString &name) const
return p;
}
qWarning() << "No page found for object name" << name;
- return 0;
+ return nullptr;
}
/*!
@@ -1057,7 +1057,7 @@ PackageManagerPage::PackageManagerPage(PackageManagerCore *core)
: m_complete(true)
, m_needsSettingsButton(false)
, m_core(core)
- , validatorComponent(0)
+ , validatorComponent(nullptr)
{
if (!m_core->settings().titleColor().isEmpty()) {
m_titleColor = m_core->settings().titleColor();
@@ -1192,8 +1192,8 @@ bool PackageManagerPage::validatePage()
void PackageManagerPage::insertWidget(QWidget *widget, const QString &siblingName, int offset)
{
QWidget *sibling = findChild<QWidget *>(siblingName);
- QWidget *parent = sibling ? sibling->parentWidget() : 0;
- QLayout *layout = parent ? parent->layout() : 0;
+ QWidget *parent = sibling ? sibling->parentWidget() : nullptr;
+ QLayout *layout = parent ? parent->layout() : nullptr;
QBoxLayout *blayout = qobject_cast<QBoxLayout *>(layout);
if (blayout) {
@@ -1264,13 +1264,13 @@ IntroductionPage::IntroductionPage(PackageManagerCore *core)
: PackageManagerPage(core)
, m_updatesFetched(false)
, m_allPackagesFetched(false)
- , m_label(0)
- , m_msgLabel(0)
- , m_errorLabel(0)
- , m_progressBar(0)
- , m_packageManager(0)
- , m_updateComponents(0)
- , m_removeAllComponents(0)
+ , m_label(nullptr)
+ , m_msgLabel(nullptr)
+ , m_errorLabel(nullptr)
+ , m_progressBar(nullptr)
+ , m_packageManager(nullptr)
+ , m_updateComponents(nullptr)
+ , m_removeAllComponents(nullptr)
{
setObjectName(QLatin1String("IntroductionPage"));
setColoredTitle(tr("Setup - %1").arg(productName()));
@@ -1347,7 +1347,7 @@ IntroductionPage::IntroductionPage(PackageManagerCore *core)
connect(core, &PackageManagerCore::metaJobProgress,
m_taskButton->progress(), &QWinTaskbarProgress::setValue);
} else {
- m_taskButton = 0;
+ m_taskButton = nullptr;
}
#endif
}
@@ -1912,7 +1912,10 @@ void ComponentSelectionPage::entering()
setModified(isComplete());
if (core->settings().repositoryCategories().count() > 0 && !core->isOfflineOnly()
&& !core->isUpdater()) {
- d->setupCategoryLayout();
+ d->showCategoryLayout(true);
+ core->settings().setAllowUnstableComponents(true);
+ } else {
+ d->showCategoryLayout(false);
}
d->showCompressedRepositoryButton();
}
@@ -2802,7 +2805,7 @@ void PerformInstallationPage::toggleDetailsWereChanged()
*/
FinishedPage::FinishedPage(PackageManagerCore *core)
: PackageManagerPage(core)
- , m_commitButton(0)
+ , m_commitButton(nullptr)
{
setObjectName(QLatin1String("FinishedPage"));
setColoredTitle(tr("Completing the %1 Wizard").arg(productName()));
@@ -2835,7 +2838,7 @@ void FinishedPage::entering()
if (m_commitButton) {
disconnect(m_commitButton, &QAbstractButton::clicked, this, &FinishedPage::handleFinishClicked);
- m_commitButton = 0;
+ m_commitButton = nullptr;
}
if (packageManagerCore()->isMaintainer()) {
diff --git a/src/libs/installer/performinstallationform.cpp b/src/libs/installer/performinstallationform.cpp
index b66cbb5bd..28506bcde 100644
--- a/src/libs/installer/performinstallationform.cpp
+++ b/src/libs/installer/performinstallationform.cpp
@@ -76,18 +76,18 @@ using namespace QInstaller;
*/
PerformInstallationForm::PerformInstallationForm(QObject *parent)
: QObject(parent)
- , m_progressBar(0)
- , m_progressLabel(0)
- , m_detailsButton(0)
- , m_detailsBrowser(0)
- , m_updateTimer(0)
+ , m_progressBar(nullptr)
+ , m_progressLabel(nullptr)
+ , m_detailsButton(nullptr)
+ , m_detailsBrowser(nullptr)
+ , m_updateTimer(nullptr)
{
#ifdef Q_OS_WIN
if (QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS7) {
m_taskButton = new QWinTaskbarButton(this);
m_taskButton->progress()->setVisible(true);
} else {
- m_taskButton = 0;
+ m_taskButton = nullptr;
}
#endif
}
diff --git a/src/libs/installer/progresscoordinator.cpp b/src/libs/installer/progresscoordinator.cpp
index 1a3f4e33f..d3fbd764f 100644
--- a/src/libs/installer/progresscoordinator.cpp
+++ b/src/libs/installer/progresscoordinator.cpp
@@ -59,8 +59,8 @@ ProgressCoordinator::~ProgressCoordinator()
ProgressCoordinator *ProgressCoordinator::instance()
{
- static ProgressCoordinator *instance = 0;
- if (instance == 0)
+ static ProgressCoordinator *instance =nullptr;
+ if (instance == nullptr)
instance = new ProgressCoordinator(qApp);
return instance;
}
diff --git a/src/libs/installer/qprocesswrapper.cpp b/src/libs/installer/qprocesswrapper.cpp
index 1bf60ead2..7cd5ad7d1 100644
--- a/src/libs/installer/qprocesswrapper.cpp
+++ b/src/libs/installer/qprocesswrapper.cpp
@@ -109,7 +109,7 @@ bool QProcessWrapper::startDetached(const QString &program, const QStringList &a
const QPair<bool, qint64> result =
w.callRemoteMethod<QPair<bool, qint64> >(QLatin1String(Protocol::QProcessStartDetached),
program, arguments, workingDirectory);
- if (pid != 0)
+ if (pid != nullptr)
*pid = result.second;
w.processSignals();
return result.first;
diff --git a/src/libs/installer/registerfiletypeoperation.cpp b/src/libs/installer/registerfiletypeoperation.cpp
index bcae422d7..27794652f 100644
--- a/src/libs/installer/registerfiletypeoperation.cpp
+++ b/src/libs/installer/registerfiletypeoperation.cpp
@@ -133,7 +133,7 @@ bool RegisterFileTypeOperation::performOperation()
setValue(QLatin1String("newType"), readHive(&settings, classesFileType));
// force the shell to invalidate its cache
- SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, NULL, NULL);
+ SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, nullptr, nullptr);
return true;
#else
@@ -192,7 +192,7 @@ bool RegisterFileTypeOperation::undoOperation()
settings.remove(classesApplications);
// force the shell to invalidate its cache
- SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, NULL, NULL);
+ SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, nullptr, nullptr);
return true;
#else
diff --git a/src/libs/installer/remoteclient.cpp b/src/libs/installer/remoteclient.cpp
index c6f5e535f..e208620cb 100644
--- a/src/libs/installer/remoteclient.cpp
+++ b/src/libs/installer/remoteclient.cpp
@@ -31,7 +31,7 @@
namespace QInstaller {
-RemoteClient *RemoteClient::s_instance = 0;
+RemoteClient *RemoteClient::s_instance = nullptr;
RemoteClient::RemoteClient()
: d_ptr(new RemoteClientPrivate(this))
@@ -88,7 +88,7 @@ void RemoteClient::shutdown()
void RemoteClient::destroy()
{
delete s_instance;
- s_instance = 0;
+ s_instance = nullptr;
}
bool RemoteClient::isActive() const
diff --git a/src/libs/installer/remoteobject.cpp b/src/libs/installer/remoteobject.cpp
index 49c111610..c9c822299 100644
--- a/src/libs/installer/remoteobject.cpp
+++ b/src/libs/installer/remoteobject.cpp
@@ -39,9 +39,9 @@ namespace QInstaller {
RemoteObject::RemoteObject(const QString &wrappedType, QObject *parent)
: QObject(parent)
- , dummy(0)
+ , dummy(nullptr)
, m_type(wrappedType)
- , m_socket(0)
+ , m_socket(nullptr)
{
Q_ASSERT_X(!m_type.isEmpty(), Q_FUNC_INFO, "The wrapped Qt type needs to be passed as "
"argument and cannot be empty.");
@@ -78,7 +78,7 @@ bool RemoteObject::authorize()
return true;
}
delete m_socket;
- m_socket = 0;
+ m_socket = nullptr;
return false;
}
diff --git a/src/libs/installer/remoteserverconnection.cpp b/src/libs/installer/remoteserverconnection.cpp
index 61bacc0c5..5a47bc472 100644
--- a/src/libs/installer/remoteserverconnection.cpp
+++ b/src/libs/installer/remoteserverconnection.cpp
@@ -44,10 +44,10 @@ RemoteServerConnection::RemoteServerConnection(qintptr socketDescriptor, const Q
QObject *parent)
: QThread(parent)
, m_socketDescriptor(socketDescriptor)
- , m_process(0)
- , m_engine(0)
+ , m_process(nullptr)
+ , m_engine(nullptr)
, m_authorizationKey(key)
- , m_signalReceiver(0)
+ , m_signalReceiver(nullptr)
{
setObjectName(QString::fromLatin1("RemoteServerConnection(%1)").arg(socketDescriptor));
}
@@ -146,10 +146,10 @@ void RemoteServerConnection::run()
} else if (type == QLatin1String(Protocol::QProcess)) {
m_signalReceiver->m_receivedSignals.clear();
m_process->deleteLater();
- m_process = 0;
+ m_process = nullptr;
} else if (type == QLatin1String(Protocol::QAbstractFileEngine)) {
delete m_engine;
- m_engine = 0;
+ m_engine = nullptr;
}
return;
}
diff --git a/src/libs/installer/repository.cpp b/src/libs/installer/repository.cpp
index 249012786..5e31d81e2 100644
--- a/src/libs/installer/repository.cpp
+++ b/src/libs/installer/repository.cpp
@@ -279,7 +279,8 @@ void Repository::registerMetaType()
QDataStream &operator>>(QDataStream &istream, Repository &repository)
{
QByteArray url, username, password, displayname, compressed;
- istream >> url >> repository.m_default >> repository.m_enabled >> username >> password >> displayname;
+ istream >> url >> repository.m_default >> repository.m_enabled >> username >> password
+ >> displayname >> repository.m_archivename;
repository.setUrl(QUrl::fromEncoded(QByteArray::fromBase64(url)));
repository.setUsername(QString::fromUtf8(QByteArray::fromBase64(username)));
repository.setPassword(QString::fromUtf8(QByteArray::fromBase64(password)));
diff --git a/src/libs/installer/repositorycategory.cpp b/src/libs/installer/repositorycategory.cpp
index af7f6e818..42fb41c99 100644
--- a/src/libs/installer/repositorycategory.cpp
+++ b/src/libs/installer/repositorycategory.cpp
@@ -58,7 +58,8 @@ RepositoryCategory::RepositoryCategory()
Constructs a new category by using all fields of the given category \a other.
*/
RepositoryCategory::RepositoryCategory(const RepositoryCategory &other)
- : m_displayname(other.m_displayname), m_data(other.m_data), m_enabled(other.m_enabled)
+ : m_displayname(other.m_displayname), m_data(other.m_data), m_enabled(other.m_enabled),
+ m_tooltip(other.m_tooltip)
{
registerMetaType();
}
@@ -86,6 +87,16 @@ void RepositoryCategory::setDisplayName(const QString &displayname)
m_displayname = displayname;
}
+QString RepositoryCategory::tooltip() const
+{
+ return m_tooltip;
+}
+
+void RepositoryCategory::setTooltip(const QString &tooltip)
+{
+ m_tooltip = tooltip;
+}
+
/*!
Returns the list of repositories the category has.
*/
diff --git a/src/libs/installer/repositorycategory.h b/src/libs/installer/repositorycategory.h
index 315af761b..98d5df7bd 100644
--- a/src/libs/installer/repositorycategory.h
+++ b/src/libs/installer/repositorycategory.h
@@ -50,6 +50,9 @@ public:
QString displayname() const;
void setDisplayName(const QString &displayname);
+ QString tooltip() const;
+ void setTooltip(const QString &tooltip);
+
QSet<Repository> repositories() const;
void setRepositories(const QSet<Repository> repositories);
void addRepository(const Repository repository);
@@ -68,6 +71,7 @@ public:
private:
QVariantHash m_data;
QString m_displayname;
+ QString m_tooltip;
bool m_enabled;
};
diff --git a/src/libs/installer/scriptengine.cpp b/src/libs/installer/scriptengine.cpp
index bea1e8e75..994fa1406 100644
--- a/src/libs/installer/scriptengine.cpp
+++ b/src/libs/installer/scriptengine.cpp
@@ -97,7 +97,7 @@ void QDesktopServicesProxy::findRecursion(const QString &path, const QString &pa
GuiProxy::GuiProxy(ScriptEngine *engine, QObject *parent) :
QObject(parent),
m_engine(engine),
- m_gui(0)
+ m_gui(nullptr)
{
}
diff --git a/src/libs/installer/settings.cpp b/src/libs/installer/settings.cpp
index 21bbe8b4c..13eb2ce40 100644
--- a/src/libs/installer/settings.cpp
+++ b/src/libs/installer/settings.cpp
@@ -135,9 +135,10 @@ static QStringList readArgumentAttributes(QXmlStreamReader &reader, Settings::Pa
return arguments;
}
-static QSet<Repository> readRepositories(QXmlStreamReader &reader, bool isDefault, Settings::ParseMode parseMode, QString *displayName = 0)
+static QSet<Repository> readRepositories(QXmlStreamReader &reader, bool isDefault, Settings::ParseMode parseMode,
+ QString *displayName = nullptr, bool *preselected = nullptr,
+ QString *tooltip = nullptr)
{
- qDebug()<<__FUNCTION__;
QSet<Repository> set;
while (reader.readNextStartElement()) {
if (reader.name() == QLatin1String("DisplayName")) {
@@ -169,6 +170,10 @@ static QSet<Repository> readRepositories(QXmlStreamReader &reader, bool isDefaul
if (displayName && !displayName->isEmpty())
repo.setArchiveName(*displayName);
set.insert(repo);
+ } else if (reader.name() == QLatin1String("Tooltip")) {
+ *tooltip = reader.readElementText();
+ } else if (reader.name() == QLatin1String("Preselected")) {
+ *preselected = (reader.readElementText() == QLatin1String("true") ? true : false);
} else {
raiseError(reader, QString::fromLatin1("Unexpected element \"%1\".").arg(reader.name().toString()),
parseMode);
@@ -190,8 +195,13 @@ static QSet<RepositoryCategory> readRepositoryCategories(QXmlStreamReader &reade
if (reader.name() == QLatin1String("RemoteRepositories")) {
RepositoryCategory archiveRepo;
QString displayName;
- archiveRepo.setRepositories(readRepositories(reader, isDefault, parseMode, &displayName));
+ QString tooltip;
+ bool preselected = false;
+ archiveRepo.setRepositories(readRepositories(reader, isDefault, parseMode,
+ &displayName, &preselected, &tooltip));
archiveRepo.setDisplayName(displayName);
+ archiveRepo.setTooltip(tooltip);
+ archiveRepo.setEnabled(preselected);
archiveSet.insert(archiveRepo);
} else if (reader.name() == QLatin1String("RepositoryCategoryDisplayname")) {
*repositoryCategoryName = reader.readElementText();
@@ -584,6 +594,16 @@ QSet<RepositoryCategory> Settings::repositoryCategories() const
return variantListToSet<RepositoryCategory>(d->m_data.values(scRepositoryCategories));
}
+QMap<QString, RepositoryCategory> Settings::organizedRepositoryCategories() const
+{
+ QSet<RepositoryCategory> categories = repositoryCategories();
+ QMap<QString, RepositoryCategory> map;
+ foreach (const RepositoryCategory &category, categories) {
+ map.insert(category.displayname(), category);
+ }
+ return map;
+}
+
void Settings::setDefaultRepositories(const QSet<Repository> &repositories)
{
d->m_data.remove(scRepositories);
@@ -812,7 +832,7 @@ void Settings::setSaveDefaultRepositories(bool save)
QString Settings::repositoryCategoryDisplayName() const
{
QString displayName = d->m_data.value(QLatin1String(scRepositoryCategoryDisplayName)).toString();
- return displayName.isEmpty() ? tr("Package categories") : displayName;
+ return displayName.isEmpty() ? tr("Show package categories") : displayName;
}
void Settings::setRepositoryCategoryDisplayName(const QString& name)
diff --git a/src/libs/installer/settings.h b/src/libs/installer/settings.h
index 0ee58639d..55b94d745 100644
--- a/src/libs/installer/settings.h
+++ b/src/libs/installer/settings.h
@@ -116,6 +116,7 @@ public:
QSet<Repository> defaultRepositories() const;
QSet<RepositoryCategory> repositoryCategories() const;
+ QMap<QString, RepositoryCategory> organizedRepositoryCategories() const;
void setDefaultRepositories(const QSet<Repository> &repositories);
void addDefaultRepositories(const QSet<Repository> &repositories);
void addRepositoryCategories(const QSet<RepositoryCategory> &repositories);
diff --git a/src/libs/installer/sysinfo_win.cpp b/src/libs/installer/sysinfo_win.cpp
index 69c1744ca..508ce7a6e 100644
--- a/src/libs/installer/sysinfo_win.cpp
+++ b/src/libs/installer/sysinfo_win.cpp
@@ -57,7 +57,7 @@ VolumeInfo updateVolumeSizeInformation(const VolumeInfo &info)
ULARGE_INTEGER freeBytesPerUser;
VolumeInfo update = info;
- if (GetDiskFreeSpaceExA(qPrintable(info.volumeDescriptor()), &freeBytesPerUser, &bytesTotal, NULL)) {
+ if (GetDiskFreeSpaceExA(qPrintable(info.volumeDescriptor()), &freeBytesPerUser, &bytesTotal, nullptr)) {
update.setSize(bytesTotal.QuadPart);
update.setAvailableSize(freeBytesPerUser.QuadPart);
}
@@ -197,7 +197,7 @@ bool killProcess(const ProcessInfo &process, int msecs)
// If we can't open the process with PROCESS_TERMINATE rights, then we give up immediately.
HANDLE hProc = OpenProcess(SYNCHRONIZE | PROCESS_TERMINATE, false, process.id);
- if (hProc == 0)
+ if (hProc == nullptr)
return false;
// TerminateAppEnum() posts WM_CLOSE to all windows whose PID matches your process's.
@@ -212,4 +212,4 @@ bool killProcess(const ProcessInfo &process, int msecs)
return returnValue;
}
-} \ No newline at end of file
+}
diff --git a/src/libs/installer/unziptask.cpp b/src/libs/installer/unziptask.cpp
index f1f0dd0a1..e0fb5449a 100644
--- a/src/libs/installer/unziptask.cpp
+++ b/src/libs/installer/unziptask.cpp
@@ -89,7 +89,7 @@ public:
m_futureInterface->waitForResume();
COM_TRY_BEGIN
- *outStream = 0;
+ *outStream = nullptr;
m_currentIndex = index;
if (askExtractMode != NArchive::NExtract::NAskMode::kExtract)
return E_FAIL;
@@ -160,8 +160,8 @@ public:
const bool writeCreationTime = GetTime(kpidCTime, &creationTime);
const bool writeModificationTime = GetTime(kpidMTime, &modificationTime);
- m_outFileStream->SetTime((writeCreationTime ? &creationTime : NULL),
- (writeAccessTime ? &accessTime : NULL), (writeModificationTime ? &modificationTime : NULL));
+ m_outFileStream->SetTime((writeCreationTime ? &creationTime : nullptr),
+ (writeAccessTime ? &accessTime : nullptr), (writeModificationTime ? &modificationTime : nullptr));
m_totalUnpacked += m_outFileStream->ProcessedSize;
m_outFileStream->Close();
diff --git a/src/libs/installer/utils.cpp b/src/libs/installer/utils.cpp
index a11ac774e..e4e3212ac 100644
--- a/src/libs/installer/utils.cpp
+++ b/src/libs/installer/utils.cpp
@@ -85,16 +85,16 @@ bool QInstaller::startDetached(const QString &program, const QStringList &argume
bool success = false;
#ifdef Q_OS_WIN
PROCESS_INFORMATION pinfo;
- STARTUPINFOW startupInfo = { sizeof(STARTUPINFO), 0, 0, 0,
+ STARTUPINFOW startupInfo = { sizeof(STARTUPINFO), nullptr, nullptr, nullptr,
static_cast<ulong>(CW_USEDEFAULT), static_cast<ulong>(CW_USEDEFAULT),
static_cast<ulong>(CW_USEDEFAULT), static_cast<ulong>(CW_USEDEFAULT),
- 0, 0, 0, STARTF_USESHOWWINDOW, SW_HIDE, 0, 0, 0, 0, 0
+ 0, 0, 0, STARTF_USESHOWWINDOW, SW_HIDE, 0, nullptr, nullptr, nullptr, nullptr
}; // That's the difference over QProcess::startDetached(): STARTF_USESHOWWINDOW, SW_HIDE.
const QString commandline = QInstaller::createCommandline(program, arguments);
- if (CreateProcessW(0, (wchar_t*) commandline.utf16(),
- 0, 0, false, CREATE_UNICODE_ENVIRONMENT | CREATE_NEW_CONSOLE,
- 0, workingDirectory.isEmpty() ? 0 : (wchar_t*) workingDirectory.utf16(),
+ if (CreateProcessW(nullptr, (wchar_t*) commandline.utf16(),
+ nullptr, nullptr, false, CREATE_UNICODE_ENVIRONMENT | CREATE_NEW_CONSOLE,
+ nullptr, workingDirectory.isEmpty() ? nullptr : (wchar_t*) workingDirectory.utf16(),
&startupInfo, &pinfo)) {
success = true;
CloseHandle(pinfo.hThread);
@@ -244,7 +244,7 @@ bool QInstaller::VerboseWriter::flush(VerboseWriterOutput *output)
if (output->write(logFileName, QIODevice::ReadWrite | QIODevice::Append | QIODevice::Text, buffer.data())) {
preFileBuffer.close();
- stream.setDevice(0);
+ stream.setDevice(nullptr);
return true;
}
return false;
@@ -341,7 +341,7 @@ static QVector<Char*> qWinCmdLine(Char *cmdParam, int length, int &argc)
argv[argc++] = start;
}
}
- argv[argc] = 0;
+ argv[argc] = nullptr;
return argv;
}
@@ -419,14 +419,14 @@ QString QInstaller::createCommandline(const QString &program, const QStringList
QString QInstaller::windowsErrorString(int errorCode)
{
QString ret;
- wchar_t *string = 0;
+ wchar_t *string = nullptr;
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
- NULL,
+ nullptr,
errorCode,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPWSTR) &string,
0,
- NULL);
+ nullptr);
ret = QString::fromWCharArray(string);
LocalFree((HLOCAL) string);
diff --git a/src/libs/kdtools/filedownloader.cpp b/src/libs/kdtools/filedownloader.cpp
index 5574a3af6..fce1a6208 100644
--- a/src/libs/kdtools/filedownloader.cpp
+++ b/src/libs/kdtools/filedownloader.cpp
@@ -661,18 +661,6 @@ void KDUpdater::FileDownloader::resetCheckSumData()
}
/*!
- Creates a directory structure for \a fileName if it does not exist.
-*/
-void KDUpdater::FileDownloader::createDirectoryForFile(const QString fileName)
-{
- QFileInfo fileInfo(fileName);
- if (!fileInfo.absoluteDir().exists()) {
- QDir filePath = fileInfo.absoluteDir();
- filePath.mkdir(filePath.absolutePath());
- }
-}
-
-/*!
Returns a copy of the proxy factory that this FileDownloader object is using to determine the
proxies to be used for requests.
*/
@@ -825,7 +813,6 @@ void KDUpdater::LocalFileDownloader::doDownload()
file->open();
d->destination = file;
} else {
- createDirectoryForFile(d->destFileName);
d->destination = new QFile(d->destFileName, this);
d->destination->open(QIODevice::ReadWrite | QIODevice::Truncate);
}
@@ -1478,7 +1465,6 @@ void KDUpdater::HttpDownloader::startDownload(const QUrl &url)
file->open();
d->destination = file;
} else {
- createDirectoryForFile(d->destFileName);
d->destination = new QFile(d->destFileName, this);
d->destination->open(QIODevice::ReadWrite | QIODevice::Truncate);
}
diff --git a/src/libs/kdtools/filedownloader.h b/src/libs/kdtools/filedownloader.h
index 10a041fba..ede20dcfa 100644
--- a/src/libs/kdtools/filedownloader.h
+++ b/src/libs/kdtools/filedownloader.h
@@ -140,7 +140,6 @@ protected:
void addCheckSumData(const QByteArray &data);
void addCheckSumData(const char *data, int length);
void resetCheckSumData();
- void createDirectoryForFile(const QString fileName);
private Q_SLOTS:
virtual void doDownload() = 0;