Changeset View
Changeset View
Standalone View
Standalone View
src/urifilters/shorturi/kshorturifilter.cpp
Show First 20 Lines • Show All 503 Lines • ▼ Show 20 Line(s) | 503 | { | |||
---|---|---|---|---|---|
504 | setFilteredUri(data, data.uri()); | 504 | setFilteredUri(data, data.uri()); | ||
505 | setUriType(data, KUriFilterData::Error); | 505 | setUriType(data, KUriFilterData::Error); | ||
506 | } | 506 | } | ||
507 | return true; | 507 | return true; | ||
508 | } | 508 | } | ||
509 | } | 509 | } | ||
510 | 510 | | |||
511 | // If we previously determined that the URL might be a file, | 511 | // If we previously determined that the URL might be a file, | ||
512 | // and if it doesn't exist, then error | 512 | // and if it doesn't exist... we'll pretend it exists. | ||
513 | // This allows to use it for completion purposes. | ||||
514 | // (If you change this logic again, look at the commit that was testing | ||||
515 | // for KUrlAuthorized::authorizeUrlAction("open")) | ||||
513 | if( isLocalFullPath && !exists ) | 516 | if( isLocalFullPath && !exists ) | ||
514 | { | 517 | { | ||
515 | QUrl u = QUrl::fromLocalFile(path); | 518 | QUrl u = QUrl::fromLocalFile(path); | ||
516 | u.setFragment(ref); | 519 | u.setFragment(ref); | ||
517 | | ||||
518 | if (!KUrlAuthorized::authorizeUrlAction( QStringLiteral("open"), QUrl(), u)) | | |||
519 | { | | |||
520 | // No authorization, we pretend it exists and will get | | |||
521 | // an access denied error later on. | | |||
522 | setFilteredUri( data, u ); | 520 | setFilteredUri(data, u); | ||
523 | setUriType( data, KUriFilterData::LocalFile ); | 521 | setUriType(data, KUriFilterData::LocalFile); | ||
524 | return true; | 522 | return true; | ||
525 | } | 523 | } | ||
526 | qCDebug(category) << "fileNotFound -> ERROR"; | | |||
527 | setErrorMsg( data, i18n( "<qt>The file or folder <b>%1</b> does not exist.</qt>", data.uri().toDisplayString() ) ); | | |||
528 | setUriType( data, KUriFilterData::Error ); | | |||
529 | return true; | | |||
530 | } | | |||
531 | 524 | | |||
532 | // If we reach this point, we cannot filter this thing so simply return false | 525 | // If we reach this point, we cannot filter this thing so simply return false | ||
533 | // so that other filters, if present, can take a crack at it. | 526 | // so that other filters, if present, can take a crack at it. | ||
534 | return false; | 527 | return false; | ||
535 | } | 528 | } | ||
536 | 529 | | |||
537 | KCModule* KShortUriFilter::configModule( QWidget*, const char* ) const | 530 | KCModule* KShortUriFilter::configModule( QWidget*, const char* ) const | ||
538 | { | 531 | { | ||
Show All 36 Lines |