Changeset View
Changeset View
Standalone View
Standalone View
src/dolphinviewcontainer.cpp
Show First 20 Lines • Show All 419 Lines • ▼ Show 20 Line(s) | 414 | { | |||
---|---|---|---|---|---|
420 | } | 420 | } | ||
421 | 421 | | |||
422 | KFilePlacesModel *placesModel = DolphinPlacesModelSingleton::instance().placesModel(); | 422 | KFilePlacesModel *placesModel = DolphinPlacesModelSingleton::instance().placesModel(); | ||
423 | const auto& matchedPlaces = placesModel->match(placesModel->index(0,0), KFilePlacesModel::UrlRole, url(), 1, Qt::MatchExactly); | 423 | const auto& matchedPlaces = placesModel->match(placesModel->index(0,0), KFilePlacesModel::UrlRole, url(), 1, Qt::MatchExactly); | ||
424 | 424 | | |||
425 | if (!matchedPlaces.isEmpty()) { | 425 | if (!matchedPlaces.isEmpty()) { | ||
426 | return placesModel->text(matchedPlaces.first()); | 426 | return placesModel->text(matchedPlaces.first()); | ||
427 | } | 427 | } | ||
428 | | ||||
429 | if (isSearchModeEnabled()) { | ||||
broulik: This condition doesn't work for non-active tabs (`m_searchBox->isVisible()`) but this is a… | |||||
430 | if (currentSearchText().isEmpty()){ | ||||
431 | return i18n("Search"); | ||||
432 | } else { | ||||
433 | return i18n("Search for %1", currentSearchText()); | ||||
434 | } | ||||
435 | } | ||||
436 | | ||||
428 | if (!url().isLocalFile()) { | 437 | if (!url().isLocalFile()) { | ||
429 | QUrl adjustedUrl = url().adjusted(QUrl::StripTrailingSlash); | 438 | QUrl adjustedUrl = url().adjusted(QUrl::StripTrailingSlash); | ||
430 | QString caption; | 439 | QString caption; | ||
431 | if (!adjustedUrl.fileName().isEmpty()) { | 440 | if (!adjustedUrl.fileName().isEmpty()) { | ||
432 | caption = adjustedUrl.fileName(); | 441 | caption = adjustedUrl.fileName(); | ||
433 | } else if (!adjustedUrl.path().isEmpty() && adjustedUrl.path() != "/") { | 442 | } else if (!adjustedUrl.path().isEmpty() && adjustedUrl.path() != "/") { | ||
434 | caption = adjustedUrl.path(); | 443 | caption = adjustedUrl.path(); | ||
435 | } else if (!adjustedUrl.host().isEmpty()) { | 444 | } else if (!adjustedUrl.host().isEmpty()) { | ||
436 | caption = adjustedUrl.host(); | 445 | caption = adjustedUrl.host(); | ||
437 | } else { | 446 | } else { | ||
438 | caption = adjustedUrl.toString(); | 447 | caption = adjustedUrl.toString(); | ||
439 | } | 448 | } | ||
440 | return caption; | 449 | return caption; | ||
441 | } | 450 | } | ||
442 | 451 | | |||
443 | QString fileName = url().adjusted(QUrl::StripTrailingSlash).fileName(); | 452 | QString fileName = url().adjusted(QUrl::StripTrailingSlash).fileName(); | ||
444 | if (fileName.isEmpty()) { | 453 | if (fileName.isEmpty()) { | ||
445 | fileName = '/'; | 454 | fileName = '/'; | ||
446 | } | 455 | } | ||
447 | 456 | | |||
448 | if (isSearchModeEnabled()) { | | |||
449 | if(currentSearchText().isEmpty()){ | | |||
450 | return i18n("Search"); | | |||
451 | } else { | | |||
452 | return i18n("Search for %1", currentSearchText()); | | |||
453 | } | | |||
454 | } | | |||
455 | | ||||
456 | return fileName; | 457 | return fileName; | ||
457 | } | 458 | } | ||
458 | 459 | | |||
459 | void DolphinViewContainer::setUrl(const QUrl& newUrl) | 460 | void DolphinViewContainer::setUrl(const QUrl& newUrl) | ||
460 | { | 461 | { | ||
461 | if (newUrl != m_urlNavigator->locationUrl()) { | 462 | if (newUrl != m_urlNavigator->locationUrl()) { | ||
462 | m_urlNavigator->setLocationUrl(newUrl); | 463 | m_urlNavigator->setLocationUrl(newUrl); | ||
463 | } | 464 | } | ||
▲ Show 20 Lines • Show All 308 Lines • Show Last 20 Lines |
This condition doesn't work for non-active tabs (m_searchBox->isVisible()) but this is a separate bug