Changeset View
Changeset View
Standalone View
Standalone View
dataengines/devicenotifications/ksolidnotify.cpp
Show First 20 Lines • Show All 122 Lines • ▼ Show 20 Line(s) | 122 | connect(p, static_cast<void (QProcess::*)(QProcess::ProcessError)>(&QProcess::error), [=](QProcess::ProcessError) { | |||
---|---|---|---|---|---|
123 | emit blockingAppsReady({}); | 123 | emit blockingAppsReady({}); | ||
124 | p->deleteLater(); | 124 | p->deleteLater(); | ||
125 | }); | 125 | }); | ||
126 | connect(p, static_cast<void (QProcess::*)(int,QProcess::ExitStatus)>(&QProcess::finished), [=](int,QProcess::ExitStatus) { | 126 | connect(p, static_cast<void (QProcess::*)(int,QProcess::ExitStatus)>(&QProcess::finished), [=](int,QProcess::ExitStatus) { | ||
127 | QStringList blockApps; | 127 | QStringList blockApps; | ||
128 | QString out(p->readAll()); | 128 | QString out(p->readAll()); | ||
129 | const QStringList &pidList = out.split(QRegExp(QStringLiteral("\\s+")), QString::SkipEmptyParts); | 129 | const QStringList &pidList = out.split(QRegExp(QStringLiteral("\\s+")), QString::SkipEmptyParts); | ||
130 | KSysGuard::Processes procs; | 130 | KSysGuard::Processes procs; | ||
131 | Q_FOREACH (const QString &pidStr, pidList) { | 131 | for (const QString &pidStr : pidList) { | ||
132 | int pid = pidStr.toInt(); | 132 | int pid = pidStr.toInt(); | ||
133 | if (!pid) { | 133 | if (!pid) { | ||
134 | continue; | 134 | continue; | ||
135 | } | 135 | } | ||
136 | procs.updateOrAddProcess(pid); | 136 | procs.updateOrAddProcess(pid); | ||
137 | KSysGuard::Process *proc = procs.getProcess(pid); | 137 | KSysGuard::Process *proc = procs.getProcess(pid); | ||
138 | if (!blockApps.contains(proc->name())) { | 138 | if (!blockApps.contains(proc->name())) { | ||
139 | blockApps << proc->name(); | 139 | blockApps << proc->name(); | ||
Show All 40 Lines | 151 | { | |||
180 | case Solid::ErrorType::DeviceBusy: { | 180 | case Solid::ErrorType::DeviceBusy: { | ||
181 | if (type == SolidReplyType::Setup) { // can this even happen? | 181 | if (type == SolidReplyType::Setup) { // can this even happen? | ||
182 | errorMsg = i18n("Could not mount this device as it is busy."); | 182 | errorMsg = i18n("Could not mount this device as it is busy."); | ||
183 | } else { | 183 | } else { | ||
184 | Solid::Device device; | 184 | Solid::Device device; | ||
185 | 185 | | |||
186 | if (type == SolidReplyType::Eject) { | 186 | if (type == SolidReplyType::Eject) { | ||
187 | QString discUdi; | 187 | QString discUdi; | ||
188 | foreach (Solid::Device device, m_devices) { | 188 | for (Solid::Device device : qAsConst(m_devices)) { | ||
189 | if (device.parentUdi() == udi) { | 189 | if (device.parentUdi() == udi) { | ||
190 | discUdi = device.udi(); | 190 | discUdi = device.udi(); | ||
191 | } | 191 | } | ||
192 | } | 192 | } | ||
193 | 193 | | |||
194 | if (discUdi.isNull()) { | 194 | if (discUdi.isNull()) { | ||
195 | // This should not happen, bail out | 195 | // This should not happen, bail out | ||
196 | return; | 196 | return; | ||
▲ Show 20 Lines • Show All 53 Lines • Show Last 20 Lines |