reslist menu openParent opens containing folder if not a subdoc
This commit is contained in:
parent
a0bb7a2eee
commit
4bcc29c6e1
@ -1,5 +1,5 @@
|
||||
#ifndef lint
|
||||
static char rcsid[] = "@(#$Id: rclmain_w.cpp,v 1.19 2007-01-08 07:02:25 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||
static char rcsid[] = "@(#$Id: rclmain_w.cpp,v 1.20 2007-01-08 10:01:55 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||
#endif
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -122,9 +122,11 @@ void RclMain::init()
|
||||
this, SLOT(enablePrevPage(bool)));
|
||||
connect(resList, SIGNAL(docEditClicked(int)),
|
||||
this, SLOT(startNativeViewer(int)));
|
||||
connect(resList, SIGNAL(editRequested(Rcl::Doc)),
|
||||
this, SLOT(startNativeViewer(Rcl::Doc)));
|
||||
|
||||
connect(resList, SIGNAL(docPreviewClicked(int, int)),
|
||||
this, SLOT(startPreview(int, int)));
|
||||
|
||||
connect(resList, SIGNAL(previewRequested(Rcl::Doc)),
|
||||
this, SLOT(startPreview(Rcl::Doc)));
|
||||
|
||||
@ -700,7 +702,11 @@ void RclMain::startNativeViewer(int docnum)
|
||||
" from database"));
|
||||
return;
|
||||
}
|
||||
startNativeViewer(doc);
|
||||
}
|
||||
|
||||
void RclMain::startNativeViewer(Rcl::Doc doc)
|
||||
{
|
||||
// Look for appropriate viewer
|
||||
string cmd = rclconfig->getMimeViewerDef(doc.mimetype);
|
||||
if (cmd.length() == 0) {
|
||||
|
||||
@ -90,6 +90,7 @@ public slots:
|
||||
virtual void startPreview(int docnum, int);
|
||||
virtual void startPreview(Rcl::Doc doc);
|
||||
virtual void startNativeViewer(int docnum);
|
||||
virtual void startNativeViewer(Rcl::Doc doc);
|
||||
virtual void previewNextInTab(int sid, int docnum);
|
||||
virtual void previewPrevInTab(int sid, int docnum);
|
||||
virtual void previewExposed(int sid, int docnum);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
#ifndef lint
|
||||
static char rcsid[] = "@(#$Id: reslist.cpp,v 1.17 2007-01-08 07:01:39 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||
static char rcsid[] = "@(#$Id: reslist.cpp,v 1.18 2007-01-08 10:01:55 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||
#endif
|
||||
|
||||
#include <time.h>
|
||||
@ -610,12 +610,8 @@ RCLPOPUP *ResList::createPopupMenu(const QPoint& pos)
|
||||
popup->insertItem(tr("Copy &File Name"), this, SLOT(menuCopyFN()));
|
||||
popup->insertItem(tr("Copy &Url"), this, SLOT(menuCopyURL()));
|
||||
popup->insertItem(tr("Find &similar documents"), this, SLOT(menuExpand()));
|
||||
Rcl::Doc doc;
|
||||
if (getDoc(m_popDoc, doc)) {
|
||||
if (!doc.ipath.empty())
|
||||
popup->insertItem(tr("P&arent document"),
|
||||
this, SLOT(menuSeeParent()));
|
||||
}
|
||||
popup->insertItem(tr("P&arent document/folder"),
|
||||
this, SLOT(menuSeeParent()));
|
||||
return popup;
|
||||
}
|
||||
|
||||
@ -623,31 +619,39 @@ void ResList::menuPreview()
|
||||
{
|
||||
emit docPreviewClicked(m_popDoc, 0);
|
||||
}
|
||||
|
||||
void ResList::menuSeeParent()
|
||||
{
|
||||
Rcl::Doc doc;
|
||||
if (getDoc(m_popDoc, doc)) {
|
||||
if (doc.ipath.empty())
|
||||
return;
|
||||
Rcl::Doc doc1;
|
||||
doc1.url = doc.url;
|
||||
doc1.ipath = doc.ipath;
|
||||
string::size_type colon;
|
||||
LOGDEB(("Ipath: [%s]\n", doc1.ipath.c_str()));
|
||||
if ((colon=doc1.ipath.find_last_of(":")) != string::npos) {
|
||||
doc1.ipath.erase(colon);
|
||||
if (doc.ipath.empty()) {
|
||||
// No parent doc: show enclosing folder with app configured for
|
||||
// directories
|
||||
doc1.url = path_getfather(doc.url);
|
||||
doc1.mimetype = "application/x-fsdirectory";
|
||||
emit editRequested(doc1);
|
||||
} else {
|
||||
doc1.ipath.erase();
|
||||
}
|
||||
LOGDEB(("Ipath after: [%s]\n", doc1.ipath.c_str()));
|
||||
doc1.url = doc.url;
|
||||
doc1.ipath = doc.ipath;
|
||||
string::size_type colon;
|
||||
LOGDEB(("Ipath: [%s]\n", doc1.ipath.c_str()));
|
||||
if ((colon=doc1.ipath.find_last_of(":")) != string::npos) {
|
||||
doc1.ipath.erase(colon);
|
||||
} else {
|
||||
doc1.ipath.erase();
|
||||
}
|
||||
LOGDEB(("Ipath after: [%s]\n", doc1.ipath.c_str()));
|
||||
|
||||
list<string> lipath;
|
||||
stringToTokens(doc.ipath, lipath, ":");
|
||||
if (lipath.size() >= 1)
|
||||
lipath.pop_back();
|
||||
emit previewRequested(doc1);
|
||||
list<string> lipath;
|
||||
stringToTokens(doc.ipath, lipath, ":");
|
||||
if (lipath.size() >= 1)
|
||||
lipath.pop_back();
|
||||
emit previewRequested(doc1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ResList::menuEdit()
|
||||
{
|
||||
emit docEditClicked(m_popDoc);
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#ifndef _RESLIST_H_INCLUDED_
|
||||
#define _RESLIST_H_INCLUDED_
|
||||
/* @(#$Id: reslist.h,v 1.7 2006-12-20 13:55:46 dockes Exp $ (C) 2005 J.F.Dockes */
|
||||
/* @(#$Id: reslist.h,v 1.8 2007-01-08 10:01:55 dockes Exp $ (C) 2005 J.F.Dockes */
|
||||
|
||||
#include <list>
|
||||
|
||||
@ -69,6 +69,7 @@ class ResList : public QTEXTBROWSER
|
||||
void docEditClicked(int);
|
||||
void docPreviewClicked(int, int);
|
||||
void previewRequested(Rcl::Doc);
|
||||
void editRequested(Rcl::Doc);
|
||||
void headerClicked();
|
||||
void docExpand(int);
|
||||
void wordSelect(QString);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user