Changeset View
Changeset View
Standalone View
Standalone View
src/widgets/jobuidelegate.cpp
Context not available. | |||||
271 | return true; | 271 | return true; | ||
---|---|---|---|---|---|
272 | } | 272 | } | ||
273 | 273 | | |||
274 | bool KIO::JobUiDelegate::askPrivilegeOpConfirmation(const QList<QUrl> &urls, | ||||
275 | PrivilegeConfType privilegeConfType) | ||||
276 | { | ||||
277 | QStringList prettyList; | ||||
278 | Q_FOREACH (const QUrl &url, urls) { | ||||
279 | prettyList.append(url.toDisplayString(QUrl::PreferLocalFile)); | ||||
280 | } | ||||
281 | | ||||
282 | int result; | ||||
283 | QWidget *widget = window(); | ||||
284 | const KMessageBox::Options options(KMessageBox::Notify | KMessageBox::WindowModal); | ||||
285 | switch (privilegeConfType) | ||||
286 | { | ||||
287 | case PrivilegeDelete: | ||||
288 | result = KMessageBox::warningContinueCancelList( | ||||
289 | widget, | ||||
290 | i18np("This item is write-protected. Deleting it might break the system. Do you really want to delete this item?", | ||||
291 | "These items are write-protected. Deleting them might break the system. Do you really want to delete these %1 items?", prettyList.count()), | ||||
292 | prettyList, | ||||
293 | i18n("Delete Write-Protected Files"), | ||||
294 | KStandardGuiItem::del(), | ||||
295 | KStandardGuiItem::cancel(), | ||||
296 | QString(), options); | ||||
297 | break; | ||||
298 | case PrivilegeRename: | ||||
299 | result = KMessageBox::warningContinueCancelList( | ||||
300 | widget, | ||||
301 | i18np("The item is in a write-protected location. Do you really want to rename this item?", | ||||
302 | "The items are in a write-protected location. Do you really want to rename these %1 items?", prettyList.count()), | ||||
303 | prettyList, | ||||
304 | i18n("Rename"), | ||||
305 | KGuiItem(i18nc("Verb", "&Rename"), QStringLiteral("edit-rename")), | ||||
306 | KStandardGuiItem::cancel(), | ||||
307 | QString(), options); | ||||
308 | break; | ||||
309 | case PrivilegeMkDir: | ||||
310 | result = KMessageBox::warningContinueCancel( | ||||
311 | widget, | ||||
312 | i18n("This is a read only directory. Do you really want to create a folder here?"), | ||||
313 | i18n("Create Dir"), | ||||
314 | KGuiItem(i18n("Create Folder"), QStringLiteral("folder-new")), | ||||
315 | KStandardGuiItem::cancel(), | ||||
316 | QString(), options); | ||||
317 | break; | ||||
318 | case PrivilegeSymlink: | ||||
319 | result = KMessageBox::warningContinueCancel( | ||||
320 | widget, | ||||
321 | i18n("This is a read only directory. Do you really want to create a symlink here?"), | ||||
322 | i18n("Create symlink"), | ||||
323 | KGuiItem(i18n("Create Symlink"), QStringLiteral("emblem-symbolic-link")), | ||||
324 | KStandardGuiItem::cancel(), | ||||
325 | QString(), options); | ||||
326 | break; | ||||
327 | default: | ||||
328 | result = -1; | ||||
329 | break; | ||||
330 | } | ||||
331 | return (result == KMessageBox::Continue); | ||||
332 | } | ||||
333 | | ||||
274 | int KIO::JobUiDelegate::requestMessageBox(KIO::JobUiDelegate::MessageBoxType type, | 334 | int KIO::JobUiDelegate::requestMessageBox(KIO::JobUiDelegate::MessageBoxType type, | ||
275 | const QString &text, const QString &caption, | 335 | const QString &text, const QString &caption, | ||
276 | const QString &buttonYes, const QString &buttonNo, | 336 | const QString &buttonYes, const QString &buttonNo, | ||
Context not available. |