Detect doc source snippets capability

This commit is contained in:
Jean-Francois Dockes 2012-09-25 16:02:41 +02:00
parent 4681ce672a
commit 91a2c5c338
3 changed files with 24 additions and 3 deletions

View file

@ -893,6 +893,7 @@ void ResList::createPopupMenu(const QPoint& pos)
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()));
if (m_source->snippetsCapable())
popup->addAction(tr("Open &Snippets window"), popup->addAction(tr("Open &Snippets window"),
this, SLOT(menuOpenSnippets())); this, SLOT(menuOpenSnippets()));
popup->popup(mapToGlobal(pos)); popup->popup(mapToGlobal(pos));

View file

@ -113,8 +113,16 @@ class DocSequence {
virtual int getResCnt() = 0; virtual int getResCnt() = 0;
/** Get title for result list */ /** Get title for result list */
virtual std::string title() {return m_title;} virtual std::string title()
{
return m_title;
}
/** Can do snippets ? */
virtual bool snippetsCapable()
{
return false;
}
/** Get description for underlying query */ /** Get description for underlying query */
virtual std::string getDescription() = 0; virtual std::string getDescription() = 0;
@ -171,6 +179,13 @@ public:
return false; return false;
return m_seq->getAbstract(doc, abs); return m_seq->getAbstract(doc, abs);
} }
virtual bool snippetsCapable()
{
if (m_seq.isNull())
return false;
return m_seq->snippetsCapable();
}
virtual std::string getDescription() virtual std::string getDescription()
{ {
if (m_seq.isNull()) if (m_seq.isNull())

View file

@ -50,6 +50,11 @@ class DocSequenceDb : public DocSequence {
m_queryBuildAbstract = qba; m_queryBuildAbstract = qba;
m_queryReplaceAbstract = qra; m_queryReplaceAbstract = qra;
} }
virtual bool snippetsCapable()
{
return true;
}
virtual string title(); virtual string title();
private: private: