Changeset View
Changeset View
Standalone View
Standalone View
kcms/desktoptheme/kcm.cpp
Show First 20 Lines • Show All 184 Lines • ▼ Show 20 Line(s) | 184 | { | |||
---|---|---|---|---|---|
185 | qCDebug(KCM_DESKTOP_THEME) << "Installing ... " << path; | 185 | qCDebug(KCM_DESKTOP_THEME) << "Installing ... " << path; | ||
186 | 186 | | |||
187 | const QString program = QStringLiteral("kpackagetool5"); | 187 | const QString program = QStringLiteral("kpackagetool5"); | ||
188 | const QStringList arguments = { QStringLiteral("--type"), QStringLiteral("Plasma/Theme"), QStringLiteral("--install"), path}; | 188 | const QStringList arguments = { QStringLiteral("--type"), QStringLiteral("Plasma/Theme"), QStringLiteral("--install"), path}; | ||
189 | 189 | | |||
190 | qCDebug(KCM_DESKTOP_THEME) << program << arguments.join(QLatin1Char(' ')); | 190 | qCDebug(KCM_DESKTOP_THEME) << program << arguments.join(QLatin1Char(' ')); | ||
191 | QProcess *myProcess = new QProcess(this); | 191 | QProcess *myProcess = new QProcess(this); | ||
192 | connect(myProcess, static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished), | 192 | connect(myProcess, static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished), | ||
193 | this, [this, myProcess](int exitCode, QProcess::ExitStatus exitStatus) { | 193 | this, [this](int exitCode, QProcess::ExitStatus exitStatus) { | ||
194 | Q_UNUSED(exitStatus); | 194 | Q_UNUSED(exitStatus) | ||
195 | if (exitCode == 0) { | 195 | if (exitCode == 0) { | ||
196 | emit showSuccessMessage(i18n("Theme installed successfully.")); | 196 | emit showSuccessMessage(i18n("Theme installed successfully.")); | ||
197 | load(); | 197 | load(); | ||
198 | } else { | 198 | } else { | ||
199 | Q_EMIT showErrorMessage(i18n("Theme installation failed.")); | 199 | Q_EMIT showErrorMessage(i18n("Theme installation failed.")); | ||
200 | 200 | | |||
201 | } | 201 | } | ||
202 | }); | 202 | }); | ||
▲ Show 20 Lines • Show All 141 Lines • ▼ Show 20 Line(s) | 341 | for (const QPersistentModelIndex &idx : persistentPendingDeletions) { | |||
344 | 344 | | |||
345 | Q_ASSERT(pluginName != m_selectedPlugin); | 345 | Q_ASSERT(pluginName != m_selectedPlugin); | ||
346 | 346 | | |||
347 | const QStringList arguments = {QStringLiteral("-t"), QStringLiteral("theme"), QStringLiteral("-r"), pluginName}; | 347 | const QStringList arguments = {QStringLiteral("-t"), QStringLiteral("theme"), QStringLiteral("-r"), pluginName}; | ||
348 | 348 | | |||
349 | QProcess *process = new QProcess(this); | 349 | QProcess *process = new QProcess(this); | ||
350 | connect(process, static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished), this, | 350 | connect(process, static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished), this, | ||
351 | [this, process, idx, pluginName, displayName](int exitCode, QProcess::ExitStatus exitStatus) { | 351 | [this, process, idx, pluginName, displayName](int exitCode, QProcess::ExitStatus exitStatus) { | ||
352 | Q_UNUSED(exitStatus); | 352 | Q_UNUSED(exitStatus) | ||
353 | if (exitCode == 0) { | 353 | if (exitCode == 0) { | ||
354 | m_model->removeRow(idx.row()); | 354 | m_model->removeRow(idx.row()); | ||
355 | } else { | 355 | } else { | ||
356 | emit showErrorMessage(i18n("Removing theme failed: %1", | 356 | emit showErrorMessage(i18n("Removing theme failed: %1", | ||
357 | QString::fromLocal8Bit(process->readAllStandardOutput().trimmed()))); | 357 | QString::fromLocal8Bit(process->readAllStandardOutput().trimmed()))); | ||
358 | m_model->setData(idx, false, PendingDeletionRole); | 358 | m_model->setData(idx, false, PendingDeletionRole); | ||
359 | } | 359 | } | ||
360 | process->deleteLater(); | 360 | process->deleteLater(); | ||
361 | }); | 361 | }); | ||
362 | 362 | | |||
363 | process->start(program, arguments); | 363 | process->start(program, arguments); | ||
364 | process->waitForFinished(); // needed so it deletes fine when "OK" is clicked and the dialog destroyed | 364 | process->waitForFinished(); // needed so it deletes fine when "OK" is clicked and the dialog destroyed | ||
365 | } | 365 | } | ||
366 | } | 366 | } | ||
367 | 367 | | |||
368 | #include "kcm.moc" | 368 | #include "kcm.moc" |