Changeset View
Changeset View
Standalone View
Standalone View
src/filewidgets/kurlnavigator.cpp
| Show First 20 Lines • Show All 1043 Lines • ▼ Show 20 Line(s) | 1041 | { | |||
|---|---|---|---|---|---|
| 1044 | } | 1044 | } | ||
| 1045 | 1045 | | |||
| 1046 | QUrl url = newUrl.adjusted(QUrl::NormalizePathSegments); | 1046 | QUrl url = newUrl.adjusted(QUrl::NormalizePathSegments); | ||
| 1047 | 1047 | | |||
| 1048 | // This will be used below; we define it here because in the lower part of the | 1048 | // This will be used below; we define it here because in the lower part of the | ||
| 1049 | // code locationUrl() and url become the same URLs | 1049 | // code locationUrl() and url become the same URLs | ||
| 1050 | QUrl firstChildUrl = KIO::UrlUtil::firstChildUrl(locationUrl(), url); | 1050 | QUrl firstChildUrl = KIO::UrlUtil::firstChildUrl(locationUrl(), url); | ||
| 1051 | 1051 | | |||
| 1052 | if ((url.scheme() == QLatin1String("tar")) || (url.scheme() == QLatin1String("zip"))) { | 1052 | if ((url.scheme() == QLatin1String("tar")) || (url.scheme() == QLatin1String("zip")) || (url.scheme() == QLatin1String("krarc"))) { | ||
| 1053 | // The URL represents a tar- or zip-file. Check whether | 1053 | // The URL represents a tar- or zip-file, or an archive file supported by krarc. | ||
| 1054 | // the URL is really part of the tar- or zip-file, otherwise | 1054 | // Check whether the URL is really part of the archive file, otherwise | ||
| 1055 | // replace it by the local path again. | 1055 | // replace it by the local path again. | ||
| 1056 | bool insideCompressedPath = d->isCompressedPath(url); | 1056 | bool insideCompressedPath = d->isCompressedPath(url); | ||
| 1057 | if (!insideCompressedPath) { | 1057 | if (!insideCompressedPath) { | ||
| 1058 | QUrl prevUrl = url; | 1058 | QUrl prevUrl = url; | ||
| 1059 | QUrl parentUrl = KIO::upUrl(url); | 1059 | QUrl parentUrl = KIO::upUrl(url); | ||
| 1060 | while (parentUrl != prevUrl) { | 1060 | while (parentUrl != prevUrl) { | ||
| 1061 | if (d->isCompressedPath(parentUrl)) { | 1061 | if (d->isCompressedPath(parentUrl)) { | ||
| 1062 | insideCompressedPath = true; | 1062 | insideCompressedPath = true; | ||
| 1063 | break; | 1063 | break; | ||
| 1064 | } | 1064 | } | ||
| 1065 | prevUrl = parentUrl; | 1065 | prevUrl = parentUrl; | ||
| 1066 | parentUrl = KIO::upUrl(parentUrl); | 1066 | parentUrl = KIO::upUrl(parentUrl); | ||
| 1067 | } | 1067 | } | ||
| 1068 | } | 1068 | } | ||
| 1069 | if (!insideCompressedPath) { | 1069 | if (!insideCompressedPath) { | ||
| 1070 | // drop the tar: or zip: protocol since we are not | 1070 | // drop the tar: or zip: or krarc: protocol since we are not | ||
| 1071 | // inside the compressed path | 1071 | // inside the compressed path | ||
| 1072 | url.setScheme(QStringLiteral("file")); | 1072 | url.setScheme(QStringLiteral("file")); | ||
| 1073 | firstChildUrl.setScheme(QStringLiteral("file")); | 1073 | firstChildUrl.setScheme(QStringLiteral("file")); | ||
| 1074 | } | 1074 | } | ||
| 1075 | } | 1075 | } | ||
| 1076 | 1076 | | |||
| 1077 | // Check whether current history element has the same URL. | 1077 | // Check whether current history element has the same URL. | ||
| 1078 | // If this is the case, just ignore setting the URL. | 1078 | // If this is the case, just ignore setting the URL. | ||
| ▲ Show 20 Lines • Show All 252 Lines • Show Last 20 Lines | |||||