Skip to content
Snippets Groups Projects
Commit 63db27bc authored by akiraohgaki's avatar akiraohgaki Committed by GitHub
Browse files

Merge pull request #2 from opendesktop/develop

Hotfix
parents ca09da0f 50bb96fd
Branches
Tags
No related merge requests found
......@@ -23,14 +23,14 @@ QJsonObject ConfigHandler::getAppConfigInstallTypes()
{
if (appConfigInstallTypes_.isEmpty()) {
QJsonObject installTypes = appConfig_.get("install_types");
foreach (const QString &key, installTypes.keys()) {
for (const QString &key : installTypes.keys()) {
QJsonObject installtype = installTypes[key].toObject();
installtype["destination"] = convertPathString(installtype["destination"].toString());
installtype["generic_destination"] = convertPathString(installtype["generic_destination"].toString());
installTypes[key] = installtype;
}
QJsonObject installTypesAlias = appConfig_.get("install_types_alias");
foreach (const QString &key, installTypesAlias.keys()) {
for (const QString &key : installTypesAlias.keys()) {
QJsonObject installTypeAlias = installTypesAlias[key].toObject();
QString baseKey = installTypeAlias["base"].toString();
if (installTypes.contains(baseKey)) {
......
......@@ -135,7 +135,7 @@ void ItemHandler::uninstall(const QString &itemKey)
#ifdef QTLIB_UNIX
destDir.setPath(configHandler_->getAppConfigInstallTypes()[installType].toObject()["destination"].toString());
foreach (const QJsonValue &filename, installedItem["files"].toArray()) {
for (const QJsonValue &filename : installedItem["files"].toArray()) {
QFileInfo fileInfo(destDir.path() + "/" + filename.toString());
// plasmapkg: Installation process has should be saved plasmapkg into destination directory
......@@ -180,7 +180,7 @@ void ItemHandler::uninstall(const QString &itemKey)
#else
destDir.setPath(configHandler_->getAppConfigInstallTypes()[installType].toObject()["generic_destination"].toString());
foreach (const QJsonValue &filename, installedItem["files"].toArray()) {
for (const QJsonValue &filename : installedItem["files"].toArray()) {
QFileInfo fileInfo(destDir.path() + "/" + filename.toString());
if (fileInfo.isDir()) {
qtlib::Dir(fileInfo.filePath()).remove();
......@@ -392,7 +392,7 @@ void ItemHandler::installDownloadedFile(qtlib::NetworkResource *resource)
destDir.make();
QJsonArray installedFiles;
foreach (const QFileInfo &fileInfo, tempDestDir.list()) {
for (const QFileInfo &fileInfo : tempDestDir.list()) {
installedFiles.append(QJsonValue(fileInfo.fileName()));
if (fileInfo.isDir()) {
qtlib::Dir(fileInfo.filePath()).move(destDir.path() + "/" + fileInfo.fileName());
......
#include "ocsapihandler.h"
#include <QStringList>
#include <QJsonValue>
#include "qtlib_ocsapi.h"
......@@ -14,7 +15,7 @@ bool OcsApiHandler::addProviders(const QString &providerFileUrl)
{
QJsonArray providers = qtlib::OcsApi::getProviderFile(QUrl(providerFileUrl));
if (!providers.isEmpty()) {
foreach (const QJsonValue &providerValue, providers) {
for (const QJsonValue &providerValue : providers) {
QJsonObject provider = providerValue.toObject();
if (provider.contains("location")) {
// Use location (API base URL) as unique key
......@@ -42,7 +43,7 @@ bool OcsApiHandler::updateAllCategories(bool force)
{
QJsonObject providers = configHandler_->getUsrConfigProviders();
if (!providers.isEmpty()) {
foreach (const QString &providerKey, providers.keys()) {
for (const QString &providerKey : providers.keys()) {
updateCategories(providerKey, force);
}
return true;
......@@ -68,7 +69,7 @@ bool OcsApiHandler::updateCategories(const QString &providerKey, bool force)
// Data type variation workaround, convert object to array
QJsonArray responseData;
if (response["data"].isObject()) {
foreach (const QJsonValue &dataValue, response["data"].toObject()) {
for (const QJsonValue &dataValue : response["data"].toObject()) {
responseData.append(dataValue);
}
}
......@@ -85,7 +86,7 @@ bool OcsApiHandler::updateCategories(const QString &providerKey, bool force)
}
QJsonObject newProviderCategories;
foreach (const QJsonValue &dataValue, responseData) {
for (const QJsonValue &dataValue : responseData) {
QJsonObject data = dataValue.toObject();
// Data type variation workaround, convert int to string
......@@ -152,13 +153,13 @@ QJsonObject OcsApiHandler::getContents(const QString &providerKeys, const QStrin
QJsonObject providers = configHandler_->getUsrConfigProviders();
QJsonObject categories = configHandler_->getUsrConfigCategories();
foreach (const QString &providerKey, providers.keys()) {
for (const QString &providerKey : providers.keys()) {
if (!providerKeyList.isEmpty() && !providerKeyList.contains(providerKey)) {
continue;
}
QStringList categoryIdList;
QJsonObject providerCategories = categories[providerKey].toObject();
foreach (const QString &categoryKey, providerCategories.keys()) {
for (const QString &categoryKey : providerCategories.keys()) {
if (!categoryKeyList.isEmpty() && !categoryKeyList.contains(categoryKey)) {
continue;
}
......
......@@ -346,7 +346,7 @@ void WebSocketServer::sendMessage(const QString &id, const QString &func, const
QByteArray binaryMessage = qtlib::Json(object).toJson();
QString textMessage = QString::fromUtf8(binaryMessage);
foreach (QWebSocket *wsClient, wsClients_) {
for (QWebSocket *wsClient : wsClients_) {
wsClient->sendTextMessage(textMessage);
//wsClient->sendBinaryMessage(binaryMessage);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment