reslist: only create an Open popup menu entry if we would create an Open link (doc type has a viewer).

This commit is contained in:
Jean-Francois Dockes 2012-05-04 09:46:20 +02:00
parent 630b9400d2
commit b435dd8cc3

View file

@ -809,11 +809,19 @@ void ResList::createPopupMenu(const QPoint& pos)
return; return;
QMenu *popup = new QMenu(this); QMenu *popup = new QMenu(this);
popup->addAction(tr("&Preview"), this, SLOT(menuPreview())); popup->addAction(tr("&Preview"), this, SLOT(menuPreview()));
popup->addAction(tr("&Open"), this, SLOT(menuEdit()));
Rcl::Doc doc;
bool havedoc = getDoc(m_popDoc, doc);
string apptag;
if (havedoc)
doc.getmeta(Rcl::Doc::keyapptg, &apptag);
if (havedoc && !theconfig->getMimeViewerDef(doc.mimetype, apptag).empty()) {
popup->addAction(tr("&Open"), this, SLOT(menuEdit()));
}
popup->addAction(tr("Copy &File Name"), this, SLOT(menuCopyFN())); popup->addAction(tr("Copy &File Name"), this, SLOT(menuCopyFN()));
popup->addAction(tr("Copy &URL"), this, SLOT(menuCopyURL())); popup->addAction(tr("Copy &URL"), this, SLOT(menuCopyURL()));
Rcl::Doc doc; if (havedoc && !doc.ipath.empty()) {
if (getDoc(m_popDoc, doc) && !doc.ipath.empty()) {
popup->addAction(tr("&Write to File"), this, SLOT(menuSaveToFile())); popup->addAction(tr("&Write to File"), this, SLOT(menuSaveToFile()));
} }
@ -821,7 +829,7 @@ void ResList::createPopupMenu(const QPoint& pos)
popup->addAction(tr("Preview P&arent document/folder"), popup->addAction(tr("Preview P&arent document/folder"),
this, SLOT(menuPreviewParent())); this, SLOT(menuPreviewParent()));
popup->addAction(tr("&Open Parent document/folder"), popup->addAction(tr("&Open Parent document/folder"),
this, SLOT(menuOpenParent())); this, SLOT(menuOpenParent()));
popup->popup(mapToGlobal(pos)); popup->popup(mapToGlobal(pos));
} }