|
a/src/qtgui/respopup.cpp |
|
b/src/qtgui/respopup.cpp |
|
... |
|
... |
40 |
"snippetsCapable" : "not snippetsCapable"));
|
40 |
"snippetsCapable" : "not snippetsCapable"));
|
41 |
|
41 |
|
42 |
string apptag;
|
42 |
string apptag;
|
43 |
doc.getmeta(Rcl::Doc::keyapptg, &apptag);
|
43 |
doc.getmeta(Rcl::Doc::keyapptg, &apptag);
|
44 |
|
44 |
|
45 |
popup->addAction(me->tr("&Preview"), me, SLOT(menuPreview()));
|
45 |
popup->addAction(QWidget::tr("&Preview"), me, SLOT(menuPreview()));
|
46 |
|
46 |
|
47 |
if (!theconfig->getMimeViewerDef(doc.mimetype, apptag, 0).empty()) {
|
47 |
if (!theconfig->getMimeViewerDef(doc.mimetype, apptag, 0).empty()) {
|
48 |
popup->addAction(me->tr("&Open"), me, SLOT(menuEdit()));
|
48 |
popup->addAction(QWidget::tr("&Open"), me, SLOT(menuEdit()));
|
49 |
}
|
49 |
}
|
50 |
|
50 |
|
51 |
bool needopenwith = true;
|
51 |
bool needopenwith = true;
|
52 |
if (!doc.ipath.empty())
|
52 |
if (!doc.ipath.empty())
|
53 |
needopenwith = false;
|
53 |
needopenwith = false;
|
|
... |
|
... |
61 |
if (needopenwith) {
|
61 |
if (needopenwith) {
|
62 |
vector<DesktopDb::AppDef> aps;
|
62 |
vector<DesktopDb::AppDef> aps;
|
63 |
DesktopDb *ddb = DesktopDb::getDb();
|
63 |
DesktopDb *ddb = DesktopDb::getDb();
|
64 |
if (ddb && ddb->appForMime(doc.mimetype, &aps) &&
|
64 |
if (ddb && ddb->appForMime(doc.mimetype, &aps) &&
|
65 |
!aps.empty()) {
|
65 |
!aps.empty()) {
|
66 |
QMenu *sub = popup->addMenu(me->tr("Open With"));
|
66 |
QMenu *sub = popup->addMenu(QWidget::tr("Open With"));
|
67 |
if (sub) {
|
67 |
if (sub) {
|
68 |
for (vector<DesktopDb::AppDef>::const_iterator it = aps.begin();
|
68 |
for (vector<DesktopDb::AppDef>::const_iterator it = aps.begin();
|
69 |
it != aps.end(); it++) {
|
69 |
it != aps.end(); it++) {
|
70 |
QAction *act = new
|
70 |
QAction *act = new
|
71 |
QAction(QString::fromUtf8(it->name.c_str()), me);
|
71 |
QAction(QString::fromUtf8(it->name.c_str()), me);
|
|
... |
|
... |
81 |
// See if there are any desktop files in $RECOLL_CONFDIR/scripts
|
81 |
// See if there are any desktop files in $RECOLL_CONFDIR/scripts
|
82 |
// and possibly create a "run script" menu.
|
82 |
// and possibly create a "run script" menu.
|
83 |
aps.clear();
|
83 |
aps.clear();
|
84 |
ddb = new DesktopDb(path_cat(theconfig->getConfDir(), "scripts"));
|
84 |
ddb = new DesktopDb(path_cat(theconfig->getConfDir(), "scripts"));
|
85 |
if (ddb && ddb->allApps(&aps) && !aps.empty()) {
|
85 |
if (ddb && ddb->allApps(&aps) && !aps.empty()) {
|
86 |
QMenu *sub = popup->addMenu(me->tr("Run Script"));
|
86 |
QMenu *sub = popup->addMenu(QWidget::tr("Run Script"));
|
87 |
if (sub) {
|
87 |
if (sub) {
|
88 |
for (vector<DesktopDb::AppDef>::const_iterator it = aps.begin();
|
88 |
for (vector<DesktopDb::AppDef>::const_iterator it = aps.begin();
|
89 |
it != aps.end(); it++) {
|
89 |
it != aps.end(); it++) {
|
90 |
QAction *act = new
|
90 |
QAction *act = new
|
91 |
QAction(QString::fromUtf8(it->name.c_str()), me);
|
91 |
QAction(QString::fromUtf8(it->name.c_str()), me);
|
|
... |
|
... |
98 |
}
|
98 |
}
|
99 |
}
|
99 |
}
|
100 |
delete ddb;
|
100 |
delete ddb;
|
101 |
}
|
101 |
}
|
102 |
|
102 |
|
103 |
popup->addAction(me->tr("Copy &File Name"), me, SLOT(menuCopyFN()));
|
103 |
popup->addAction(QWidget::tr("Copy &File Name"), me, SLOT(menuCopyFN()));
|
104 |
popup->addAction(me->tr("Copy &URL"), me, SLOT(menuCopyURL()));
|
104 |
popup->addAction(QWidget::tr("Copy &URL"), me, SLOT(menuCopyURL()));
|
105 |
|
105 |
|
106 |
if ((opts&showSaveOne) && !doc.ipath.empty())
|
106 |
if ((opts&showSaveOne) && !doc.ipath.empty())
|
107 |
popup->addAction(me->tr("&Write to File"), me, SLOT(menuSaveToFile()));
|
107 |
popup->addAction(QWidget::tr("&Write to File"), me, SLOT(menuSaveToFile()));
|
108 |
|
108 |
|
109 |
if ((opts&showSaveSel))
|
109 |
if ((opts&showSaveSel))
|
110 |
popup->addAction(me->tr("Save selection to files"),
|
110 |
popup->addAction(QWidget::tr("Save selection to files"),
|
111 |
me, SLOT(menuSaveSelection()));
|
111 |
me, SLOT(menuSaveSelection()));
|
112 |
|
112 |
|
113 |
Rcl::Doc pdoc;
|
113 |
Rcl::Doc pdoc;
|
114 |
if (source.isNotNull() && source->getEnclosing(doc, pdoc)) {
|
114 |
if (source.isNotNull() && source->getEnclosing(doc, pdoc)) {
|
115 |
popup->addAction(me->tr("Preview P&arent document/folder"),
|
115 |
popup->addAction(QWidget::tr("Preview P&arent document/folder"),
|
116 |
me, SLOT(menuPreviewParent()));
|
116 |
me, SLOT(menuPreviewParent()));
|
117 |
}
|
117 |
}
|
118 |
// 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
|
119 |
// the enclosing folder.
|
119 |
// the enclosing folder.
|
120 |
popup->addAction(me->tr("&Open Parent document/folder"),
|
120 |
popup->addAction(QWidget::tr("&Open Parent document/folder"),
|
121 |
me, SLOT(menuOpenParent()));
|
121 |
me, SLOT(menuOpenParent()));
|
122 |
|
122 |
|
123 |
if (opts & showExpand)
|
123 |
if (opts & showExpand)
|
124 |
popup->addAction(me->tr("Find &similar documents"),
|
124 |
popup->addAction(QWidget::tr("Find &similar documents"),
|
125 |
me, SLOT(menuExpand()));
|
125 |
me, SLOT(menuExpand()));
|
126 |
|
126 |
|
127 |
if (doc.haspages && source.isNotNull() && source->snippetsCapable())
|
127 |
if (doc.haspages && source.isNotNull() && source->snippetsCapable())
|
128 |
popup->addAction(me->tr("Open &Snippets window"),
|
128 |
popup->addAction(QWidget::tr("Open &Snippets window"),
|
129 |
me, SLOT(menuShowSnippets()));
|
129 |
me, SLOT(menuShowSnippets()));
|
130 |
|
130 |
|
131 |
if ((opts & showSubs) && rcldb && rcldb->hasSubDocs(doc))
|
131 |
if ((opts & showSubs) && rcldb && rcldb->hasSubDocs(doc))
|
132 |
popup->addAction(me->tr("Show subdocuments / attachments"),
|
132 |
popup->addAction(QWidget::tr("Show subdocuments / attachments"),
|
133 |
me, SLOT(menuShowSubDocs()));
|
133 |
me, SLOT(menuShowSubDocs()));
|
134 |
|
134 |
|
135 |
return popup;
|
135 |
return popup;
|
136 |
}
|
136 |
}
|
137 |
|
137 |
|