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())); this, SLOT(menuPreviewParent()));
popup->addAction(tr("&Open Parent document/folder"), popup->addAction(tr("&Open Parent document/folder"),
this, SLOT(menuOpenParent())); this, SLOT(menuOpenParent()));
popup->addAction(tr("Open &Snippets window"), if (m_source->snippetsCapable())
this, SLOT(menuOpenSnippets())); popup->addAction(tr("Open &Snippets window"),
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: