Treat the "open parent" link click more like the right-click menu entry for open parent. The latter is still different because it opens the enclosing document, not necessarily a folder if the doc result is embedded. But they now behave the same if the parent is a folder

This commit is contained in:
Jean-Francois Dockes 2014-07-19 15:31:03 +02:00
parent 73f15d134b
commit c11453fc27
4 changed files with 12 additions and 9 deletions

View File

@ -885,10 +885,8 @@ void ResList::linkWasClicked(const QUrl &url)
LOGERR(("ResList::linkWasClicked: can't get doc for %d\n", i)); LOGERR(("ResList::linkWasClicked: can't get doc for %d\n", i));
return; return;
} }
Rcl::Doc pdoc; emit editRequested(ResultPopup::getParent(RefCntr<DocSequence>(),
pdoc.url = url_parentfolder(doc.url); doc));
pdoc.mimetype = "inode/directory";
emit editRequested(pdoc);
} }
break; break;

View File

@ -120,7 +120,7 @@ Rcl::Doc getParent(RefCntr<DocSequence> source, Rcl::Doc& doc)
if (source.isNull() || !source->getEnclosing(doc, pdoc)) { if (source.isNull() || !source->getEnclosing(doc, pdoc)) {
// No parent doc: show enclosing folder with app configured for // No parent doc: show enclosing folder with app configured for
// directories // directories
pdoc.url = path_getfather(doc.url); pdoc.url = url_parentfolder(doc.url);
pdoc.meta[Rcl::Doc::keychildurl] = doc.url; pdoc.meta[Rcl::Doc::keychildurl] = doc.url;
pdoc.meta[Rcl::Doc::keyapptg] = "parentopen"; pdoc.meta[Rcl::Doc::keyapptg] = "parentopen";
pdoc.mimetype = "inode/directory"; pdoc.mimetype = "inode/directory";

View File

@ -767,10 +767,8 @@ void ResTable::linkWasClicked(const QUrl &url)
// Open parent folder // Open parent folder
case 'F': case 'F':
{ {
Rcl::Doc pdoc; emit editRequested(ResultPopup::getParent(RefCntr<DocSequence>(),
pdoc.url = url_parentfolder(m_detaildoc.url); m_detaildoc));
pdoc.mimetype = "inode/directory";
emit editRequested(pdoc);
} }
break; break;

View File

@ -179,7 +179,14 @@ void ResListPager::displayDoc(RclConfig *config, int i, Rcl::Doc& doc,
titleOrFilename = utf8fn; titleOrFilename = utf8fn;
} }
// Url for the parent directory. We strip the file:// part for local
// paths
string parenturl = url_parentfolder(url); string parenturl = url_parentfolder(url);
{
string localpath = fileurltolocalpath(parenturl);
if (!localpath.empty())
parenturl = localpath;
}
// Result number // Result number
char numbuf[20]; char numbuf[20];