|
a/src/qtgui/respopup.cpp |
|
b/src/qtgui/respopup.cpp |
|
... |
|
... |
27 |
#include "respopup.h"
|
27 |
#include "respopup.h"
|
28 |
#include "appformime.h"
|
28 |
#include "appformime.h"
|
29 |
|
29 |
|
30 |
namespace ResultPopup {
|
30 |
namespace ResultPopup {
|
31 |
|
31 |
|
32 |
QMenu *create(QWidget *me, int opts, RefCntr<DocSequence> source, Rcl::Doc& doc)
|
32 |
QMenu *create(QWidget *me, int opts, STD_SHARED_PTR<DocSequence> source, Rcl::Doc& doc)
|
33 |
{
|
33 |
{
|
34 |
QMenu *popup = new QMenu(me);
|
34 |
QMenu *popup = new QMenu(me);
|
35 |
|
35 |
|
36 |
LOGDEB(("ResultPopup::create: opts %x haspages %d %s %s\n", opts,
|
36 |
LOGDEB(("ResultPopup::create: opts %x haspages %d %s %s\n", opts,
|
37 |
doc.haspages, source.isNull() ?
|
37 |
doc.haspages, source ? "Source not null" : "Source is Null",
|
38 |
"Source is Null" : "Source not null",
|
|
|
39 |
source.isNull() ? "" : source->snippetsCapable() ?
|
38 |
source ? (source->snippetsCapable() ?
|
40 |
"snippetsCapable" : "not snippetsCapable"));
|
39 |
"snippetsCapable" : "not snippetsCapable") : ""));
|
41 |
|
40 |
|
42 |
string apptag;
|
41 |
string apptag;
|
43 |
doc.getmeta(Rcl::Doc::keyapptg, &apptag);
|
42 |
doc.getmeta(Rcl::Doc::keyapptg, &apptag);
|
44 |
|
43 |
|
45 |
popup->addAction(QWidget::tr("&Preview"), me, SLOT(menuPreview()));
|
44 |
popup->addAction(QWidget::tr("&Preview"), me, SLOT(menuPreview()));
|
|
... |
|
... |
110 |
if ((opts&showSaveSel))
|
109 |
if ((opts&showSaveSel))
|
111 |
popup->addAction(QWidget::tr("Save selection to files"),
|
110 |
popup->addAction(QWidget::tr("Save selection to files"),
|
112 |
me, SLOT(menuSaveSelection()));
|
111 |
me, SLOT(menuSaveSelection()));
|
113 |
|
112 |
|
114 |
Rcl::Doc pdoc;
|
113 |
Rcl::Doc pdoc;
|
115 |
if (source.isNotNull() && source->getEnclosing(doc, pdoc)) {
|
114 |
if (source && source->getEnclosing(doc, pdoc)) {
|
116 |
popup->addAction(QWidget::tr("Preview P&arent document/folder"),
|
115 |
popup->addAction(QWidget::tr("Preview P&arent document/folder"),
|
117 |
me, SLOT(menuPreviewParent()));
|
116 |
me, SLOT(menuPreviewParent()));
|
118 |
}
|
117 |
}
|
119 |
// Open parent is useful even if there is no parent because we open
|
118 |
// Open parent is useful even if there is no parent because we open
|
120 |
// the enclosing folder.
|
119 |
// the enclosing folder.
|
|
... |
|
... |
124 |
|
123 |
|
125 |
if (opts & showExpand)
|
124 |
if (opts & showExpand)
|
126 |
popup->addAction(QWidget::tr("Find &similar documents"),
|
125 |
popup->addAction(QWidget::tr("Find &similar documents"),
|
127 |
me, SLOT(menuExpand()));
|
126 |
me, SLOT(menuExpand()));
|
128 |
|
127 |
|
129 |
if (doc.haspages && source.isNotNull() && source->snippetsCapable())
|
128 |
if (doc.haspages && source && source->snippetsCapable())
|
130 |
popup->addAction(QWidget::tr("Open &Snippets window"),
|
129 |
popup->addAction(QWidget::tr("Open &Snippets window"),
|
131 |
me, SLOT(menuShowSnippets()));
|
130 |
me, SLOT(menuShowSnippets()));
|
132 |
|
131 |
|
133 |
if ((opts & showSubs) && rcldb && rcldb->hasSubDocs(doc))
|
132 |
if ((opts & showSubs) && rcldb && rcldb->hasSubDocs(doc))
|
134 |
popup->addAction(QWidget::tr("Show subdocuments / attachments"),
|
133 |
popup->addAction(QWidget::tr("Show subdocuments / attachments"),
|
135 |
me, SLOT(menuShowSubDocs()));
|
134 |
me, SLOT(menuShowSubDocs()));
|
136 |
|
135 |
|
137 |
return popup;
|
136 |
return popup;
|
138 |
}
|
137 |
}
|
139 |
|
138 |
|
140 |
Rcl::Doc getParent(RefCntr<DocSequence> source, Rcl::Doc& doc)
|
139 |
Rcl::Doc getParent(STD_SHARED_PTR<DocSequence> source, Rcl::Doc& doc)
|
141 |
{
|
140 |
{
|
142 |
Rcl::Doc pdoc;
|
141 |
Rcl::Doc pdoc;
|
143 |
if (source.isNull() || !source->getEnclosing(doc, pdoc)) {
|
142 |
if (!source || !source->getEnclosing(doc, pdoc)) {
|
144 |
// No parent doc: show enclosing folder with app configured for
|
143 |
// No parent doc: show enclosing folder with app configured for
|
145 |
// directories
|
144 |
// directories
|
146 |
pdoc.url = url_parentfolder(doc.url);
|
145 |
pdoc.url = url_parentfolder(doc.url);
|
147 |
pdoc.meta[Rcl::Doc::keychildurl] = doc.url;
|
146 |
pdoc.meta[Rcl::Doc::keychildurl] = doc.url;
|
148 |
pdoc.meta[Rcl::Doc::keyapptg] = "parentopen";
|
147 |
pdoc.meta[Rcl::Doc::keyapptg] = "parentopen";
|