mirror of
https://invent.kde.org/system/dolphin
synced 2024-10-02 14:45:04 +00:00
Update of the patch from Filip Brcic for browsing through ZIP and TAR files. One part of the patch for the URL navigator has not been committed yet (see notes in URL navigator::setUrl() for details).
svn path=/trunk/KDE/kdebase/apps/; revision=641297
This commit is contained in:
parent
85a671291b
commit
16b56261a8
|
@ -638,32 +638,41 @@ void DolphinView::triggerItem(const QModelIndex& index)
|
|||
return;
|
||||
}
|
||||
|
||||
if (item->isDir()) {
|
||||
// Prefer the local path over the URL. This assures that the
|
||||
// volume space information is correct. Assuming that the URL is media:/sda1,
|
||||
// and the local path is /windows/C: For the URL the space info is related
|
||||
// to the root partition (and hence wrong) and for the local path the space
|
||||
// info is related to the windows partition (-> correct).
|
||||
const QString localPath(item->localPath());
|
||||
if (localPath.isEmpty()) {
|
||||
setUrl(item->url());
|
||||
}
|
||||
else {
|
||||
setUrl(KUrl(localPath));
|
||||
}
|
||||
// Prefer the local path over the URL. This assures that the
|
||||
// volume space information is correct. Assuming that the URL is media:/sda1,
|
||||
// and the local path is /windows/C: For the URL the space info is related
|
||||
// to the root partition (and hence wrong) and for the local path the space
|
||||
// info is related to the windows partition (-> correct).
|
||||
const QString localPath(item->localPath());
|
||||
KUrl url;
|
||||
if (localPath.isEmpty()) {
|
||||
url = item->url();
|
||||
}
|
||||
else if (item->isFile() && item->mimeTypePtr()->is("application/x-zip")) {
|
||||
// allow to browse through ZIP files
|
||||
const QString localPath(item->localPath());
|
||||
KUrl url;
|
||||
if (localPath.isEmpty()) {
|
||||
url = item->url();
|
||||
else {
|
||||
url = localPath;
|
||||
}
|
||||
|
||||
if (item->isDir()) {
|
||||
setUrl(url);
|
||||
}
|
||||
else if (item->isFile()) {
|
||||
// allow to browse through ZIP and tar files
|
||||
KMimeType::Ptr mime = item->mimeTypePtr();
|
||||
if (mime->is("application/x-zip")) {
|
||||
url.setProtocol("zip");
|
||||
setUrl(url);
|
||||
}
|
||||
else if (mime->is("application/x-tar") ||
|
||||
mime->is("application/x-tarz") ||
|
||||
mime->is("application/x-tbz") ||
|
||||
mime->is("application/x-tgz") ||
|
||||
mime->is("application/x-tzo")) {
|
||||
url.setProtocol("tar");
|
||||
setUrl(url);
|
||||
}
|
||||
else {
|
||||
url = localPath;
|
||||
item->run();
|
||||
}
|
||||
url.setProtocol("zip");
|
||||
setUrl(url);
|
||||
}
|
||||
else {
|
||||
item->run();
|
||||
|
|
|
@ -246,6 +246,14 @@ void UrlNavigator::dropUrls(const KUrl::List& urls,
|
|||
void UrlNavigator::setUrl(const KUrl& url)
|
||||
{
|
||||
QString urlStr(url.pathOrUrl());
|
||||
|
||||
// TODO: a patch has been submitted by Filip Brcic which adjusts
|
||||
// the URL for tar and zip files. See https://bugs.kde.org/show_bug.cgi?id=142781
|
||||
// for details. The URL navigator part of the patch has not been committed yet,
|
||||
// as the URL navigator will be subject of change and
|
||||
// we might think of a more generic approach to check the protocol + MIME type for
|
||||
// this use case.
|
||||
|
||||
//kDebug() << "setUrl(" << url << ")" << endl;
|
||||
if ( urlStr.length() > 0 && urlStr.at(0) == '~') {
|
||||
// replace '~' by the home directory
|
||||
|
|
Loading…
Reference in a new issue