Changeset View
Changeset View
Standalone View
Standalone View
krusader/Panel/panelfunc.cpp
Show First 20 Lines • Show All 480 Lines • ▼ Show 20 Line(s) | 480 | if (!filePath.isEmpty()) { | |||
---|---|---|---|---|---|
481 | editPath = filePath; | 481 | editPath = filePath; | ||
482 | } else { | 482 | } else { | ||
483 | const QString name = panel->getCurrentName(); | 483 | const QString name = panel->getCurrentName(); | ||
484 | if (name.isNull()) | 484 | if (name.isNull()) | ||
485 | return; | 485 | return; | ||
486 | editPath = files()->getUrl(name); | 486 | editPath = files()->getUrl(name); | ||
487 | } | 487 | } | ||
488 | 488 | | |||
489 | const KFileItem fileToEdit = KFileItem(filePath); | 489 | if (editPath.isLocalFile()) { | ||
490 | const KFileItem fileToEdit = KFileItem(editPath); | ||||
490 | 491 | | |||
491 | if (fileToEdit.isDir()) { | 492 | if (fileToEdit.isDir()) { | ||
492 | KMessageBox::sorry(krMainWindow, i18n("You cannot edit a folder")); | 493 | KMessageBox::sorry(krMainWindow, i18n("You cannot edit a folder")); | ||
493 | return; | 494 | return; | ||
494 | } | 495 | } | ||
495 | 496 | | |||
496 | if (!fileToEdit.isReadable()) { | 497 | if (!fileToEdit.isReadable()) { | ||
497 | KMessageBox::sorry(nullptr, i18n("No permissions to edit this file.")); | 498 | KMessageBox::sorry(nullptr, i18n("No permissions to edit this file.")); | ||
498 | return; | 499 | return; | ||
499 | } | 500 | } | ||
500 | 501 | | |||
501 | KrViewer::edit(editPath); | 502 | KrViewer::edit(editPath); | ||
503 | } else { | ||||
504 | KIO::StatJob* statJob = KIO::stat(editPath, KIO::HideProgressInfo); | ||||
505 | connect(statJob, &KIO::StatJob::result, this, &ListPanelFunc::slotStatEdit); | ||||
506 | } | ||||
502 | } | 507 | } | ||
503 | 508 | | |||
504 | void ListPanelFunc::askEditFile() | 509 | void ListPanelFunc::askEditFile() | ||
505 | { | 510 | { | ||
506 | // ask the user for the filename to edit | 511 | // ask the user for the filename to edit | ||
507 | const QUrl filePath = KChooseDir::getFile(i18n("Enter the filename to edit:"), | 512 | const QUrl filePath = KChooseDir::getFile(i18n("Enter the filename to edit:"), | ||
508 | QUrl(panel->getCurrentName()), panel->virtualPath()); | 513 | QUrl(panel->getCurrentName()), panel->virtualPath()); | ||
509 | if (filePath.isEmpty()) { | 514 | if (filePath.isEmpty()) { | ||
▲ Show 20 Lines • Show All 823 Lines • Show Last 20 Lines |