GUI: add save entry to preview popup for subdocs
This commit is contained in:
parent
cd2fe8049f
commit
89e7aee225
@ -330,6 +330,15 @@ PreviewTextEdit *Preview::currentEditor()
|
||||
return edit;
|
||||
}
|
||||
|
||||
// Save current document to file
|
||||
void Preview::emitSaveDocToFile()
|
||||
{
|
||||
PreviewTextEdit *ce = currentEditor();
|
||||
if (ce && !ce->m_dbdoc.url.empty()) {
|
||||
emit saveDocToFile(ce->m_dbdoc);
|
||||
}
|
||||
}
|
||||
|
||||
// Perform text search. If next is true, we look for the next match of the
|
||||
// current search, trying to advance and possibly wrapping around. If next is
|
||||
// false, the search string has been modified, we search for the new string,
|
||||
@ -891,6 +900,7 @@ bool Preview::loadDocInCurrentTab(const Rcl::Doc &idoc, int docnum)
|
||||
if (!textempty)
|
||||
fdoc.text.clear();
|
||||
editor->m_fdoc = fdoc;
|
||||
editor->m_dbdoc = idoc;
|
||||
if (textempty)
|
||||
editor->displayFields();
|
||||
|
||||
@ -998,6 +1008,11 @@ void PreviewTextEdit::createPopupMenu(const QPoint& pos)
|
||||
popup->addAction(tr("Select All"), this, SLOT(selectAll()));
|
||||
popup->addAction(tr("Copy"), this, SLOT(copy()));
|
||||
popup->addAction(tr("Print"), this, SLOT(print()));
|
||||
// Need to check ipath until we fix the internfile bug that always
|
||||
// has it convert to html for top level docs
|
||||
if (!m_dbdoc.url.empty() && !m_dbdoc.ipath.empty())
|
||||
popup->addAction(tr("Save document to file"),
|
||||
m_preview, SLOT(emitSaveDocToFile()));
|
||||
popup->popup(mapToGlobal(pos));
|
||||
}
|
||||
|
||||
|
||||
@ -51,7 +51,9 @@ public slots:
|
||||
virtual void displayImage();
|
||||
virtual void print();
|
||||
virtual void createPopupMenu(const QPoint& pos);
|
||||
|
||||
friend class Preview;
|
||||
|
||||
protected:
|
||||
void mouseDoubleClickEvent(QMouseEvent *);
|
||||
|
||||
@ -65,6 +67,8 @@ private:
|
||||
// doc out of internfile (previous fields come from the index) with
|
||||
// main text erased (for space).
|
||||
Rcl::Doc m_fdoc;
|
||||
// The input doc out of the index/query list
|
||||
Rcl::Doc m_dbdoc;
|
||||
// Saved rich (or plain actually) text: the textedit seems to
|
||||
// sometimes (but not always) return its text stripped of tags, so
|
||||
// this is needed (for printing for example)
|
||||
@ -115,6 +119,7 @@ public slots:
|
||||
virtual void prevPressed();
|
||||
virtual void currentChanged(QWidget *tw);
|
||||
virtual void closeCurrentTab();
|
||||
virtual void emitSaveDocToFile();
|
||||
|
||||
signals:
|
||||
void previewClosed(Preview *);
|
||||
@ -123,6 +128,7 @@ signals:
|
||||
void showPrev(Preview *w, int sid, int docnum);
|
||||
void previewExposed(Preview *w, int sid, int docnum);
|
||||
void printCurrentPreviewRequest();
|
||||
void saveDocToFile(Rcl::Doc);
|
||||
|
||||
private:
|
||||
// Identifier of search in main window. This is used to check that
|
||||
|
||||
@ -808,6 +808,8 @@ void RclMain::startPreview(int docnum, Rcl::Doc doc, int mod)
|
||||
this, SLOT(previewPrevInTab(Preview *, int, int)));
|
||||
connect(curPreview, SIGNAL(previewExposed(Preview *, int, int)),
|
||||
this, SLOT(previewExposed(Preview *, int, int)));
|
||||
connect(curPreview, SIGNAL(saveDocToFile(Rcl::Doc)),
|
||||
this, SLOT(saveDocToFile(Rcl::Doc)));
|
||||
curPreview->setWindowTitle(getQueryDescription());
|
||||
curPreview->show();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user