Detect doc source snippets capability

This commit is contained in:
"Jean-Francois Dockes ext:(%22) 2012-09-25 16:02:41 +02:00
parent b2a0e63370
commit 7a9c435712
3 changed files with 24 additions and 3 deletions

View File

@ -893,8 +893,9 @@ void ResList::createPopupMenu(const QPoint& pos)
this, SLOT(menuPreviewParent()));
popup->addAction(tr("&Open Parent document/folder"),
this, SLOT(menuOpenParent()));
popup->addAction(tr("Open &Snippets window"),
this, SLOT(menuOpenSnippets()));
if (m_source->snippetsCapable())
popup->addAction(tr("Open &Snippets window"),
this, SLOT(menuOpenSnippets()));
popup->popup(mapToGlobal(pos));
}

View File

@ -113,8 +113,16 @@ class DocSequence {
virtual int getResCnt() = 0;
/** 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 */
virtual std::string getDescription() = 0;
@ -171,6 +179,13 @@ public:
return false;
return m_seq->getAbstract(doc, abs);
}
virtual bool snippetsCapable()
{
if (m_seq.isNull())
return false;
return m_seq->snippetsCapable();
}
virtual std::string getDescription()
{
if (m_seq.isNull())

View File

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