#include "GuiCitation.h"
-#include "support/debug.h"
-#include "support/gettext.h"
#include "qt_helpers.h"
#include "Buffer.h"
#include "BufferParams.h"
-#include "support/lstrings.h"
-#include "support/docstring.h"
-
#include "insets/InsetCommand.h"
-#include <vector>
-#include <string>
+#include "support/debug.h"
+#include "support/docstring.h"
+#include "support/gettext.h"
+#include "support/lstrings.h"
#include <QCloseEvent>
#include <QShowEvent>
+#include <vector>
+#include <string>
+
#undef KeyPress
#include <boost/regex.hpp>
GuiCitation::GuiCitation(GuiView & lv)
- : GuiCommand(lv, "citation")
+ : GuiCommand(lv, "citation", qt_("Citation"))
{
setupUi(this);
- setViewTitle(_("Citation"));
connect(citationStyleCO, SIGNAL(activated(int)),
this, SLOT(on_citationStyleCO_currentIndexChanged(int)));
{
clearSelection();
clearParams();
- GuiDialog::closeEvent(e);
+ e->accept();
}
void GuiCitation::updateFormatting(biblio::CiteStyle currentStyle)
{
- biblio::CiteEngine const engine = getEngine();
+ biblio::CiteEngine const engine = citeEngine();
bool const natbib_engine =
engine == biblio::ENGINE_NATBIB_AUTHORYEAR ||
engine == biblio::ENGINE_NATBIB_NUMERICAL;
//"All Entry Types" is first.
index = entriesCO->currentIndex() - 1;
vector<docstring> const & entries = availableEntries();
- docstring entryType;
+ docstring entry_type;
if (index < 0 || index >= int(entries.size()))
- entryType = from_ascii("");
+ entry_type = from_ascii("");
else
- entryType = entries[index];
+ entry_type = entries[index];
bool const case_sentitive = caseCB->checkState();
bool const reg_exp = regexCB->checkState();
- findKey(text, onlyKeys, field, entryType,
+ findKey(text, onlyKeys, field, entry_type,
case_sentitive, reg_exp, reset);
//FIXME
//It'd be nice to save and restore the current selection in
void GuiCitation::findKey(QString const & str, bool only_keys,
- docstring field, docstring entryType,
+ docstring field, docstring entry_type,
bool case_sensitive, bool reg_exp, bool reset)
{
// Used for optimisation: store last searched string.
QStringList result;
- // First, filter by entryType, which will be faster than
+ // First, filter by entry_type, which will be faster than
// what follows, so we may get to do that on less.
vector<docstring> keyVector = to_docstring_vector(keys);
- filterByEntryType(keyVector, entryType);
+ filterByEntryType(keyVector, entry_type);
if (str.isEmpty())
result = to_qstring_list(keyVector);
bool GuiCitation::initialiseParams(string const & data)
{
- InsetCommandMailer::string2params(lfun_name_, data, params_);
-
- biblio::CiteEngine const engine = buffer().params().getEngine();
-
+ InsetCommand::string2params(lfun_name_, data, params_);
+ biblio::CiteEngine const engine = buffer().params().citeEngine();
bibkeysInfo_.fillWithBibKeys(&buffer());
-
citeStyles_ = biblio::getCiteStyles(engine);
-
return true;
}
}
-vector<docstring> const GuiCitation::availableKeys() const
+vector<docstring> GuiCitation::availableKeys() const
{
return bibkeysInfo_.getKeys();
}
-vector<docstring> const GuiCitation::availableFields() const
+vector<docstring> GuiCitation::availableFields() const
{
return bibkeysInfo_.getFields();
}
-vector<docstring> const GuiCitation::availableEntries() const
+vector<docstring> GuiCitation::availableEntries() const
{
return bibkeysInfo_.getEntries();
}
void GuiCitation::filterByEntryType(
- vector<docstring> & keyVector, docstring entryType)
+ vector<docstring> & keyVector, docstring entry_type)
{
- if (entryType.empty())
+ if (entry_type.empty())
return;
vector<docstring>::iterator it = keyVector.begin();
BiblioInfo::const_iterator cit = bibkeysInfo_.find(key);
if (cit == bibkeysInfo_.end())
continue;
- if (cit->second.entryType == entryType)
+ if (cit->second.entryType() == entry_type)
result.push_back(key);
}
keyVector = result;
}
-biblio::CiteEngine GuiCitation::getEngine() const
+biblio::CiteEngine GuiCitation::citeEngine() const
{
- return buffer().params().getEngine();
+ return buffer().params().citeEngine();
}
if (only_keys)
data = to_utf8(*it);
else if (field.empty())
- data = to_utf8(*it) + ' ' + to_utf8(kvm.allData);
+ data = to_utf8(*it) + ' ' + to_utf8(kvm.allData());
else if (kvm.hasField(field))
data = to_utf8(kvm.getValueForField(field));