mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 18:08:10 +00:00
GuiBibtex: add button to edit individual databases externally
This complements the inset context menu function, which only allows for editing all databases externally
This commit is contained in:
parent
02974ff2a9
commit
c12190b5e5
@ -185,6 +185,7 @@ void GuiBibtex::setButtons()
|
|||||||
void GuiBibtex::selUpdated()
|
void GuiBibtex::selUpdated()
|
||||||
{
|
{
|
||||||
selectionManager->update();
|
selectionManager->update();
|
||||||
|
editPB->setEnabled(deletePB->isEnabled());
|
||||||
changed();
|
changed();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -240,6 +241,19 @@ void GuiBibtex::browseBibPressed()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GuiBibtex::on_editPB_clicked()
|
||||||
|
{
|
||||||
|
QModelIndexList selIdx =
|
||||||
|
selectedLV->selectionModel()->selectedIndexes();
|
||||||
|
if (selIdx.isEmpty())
|
||||||
|
return;
|
||||||
|
QModelIndex idx = selIdx.first();
|
||||||
|
QString sel = idx.data().toString();
|
||||||
|
FuncRequest fr(LFUN_INSET_EDIT, fromqstr(sel));
|
||||||
|
dispatch(fr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void GuiBibtex::rescanClicked()
|
void GuiBibtex::rescanClicked()
|
||||||
{
|
{
|
||||||
rescanBibStyles();
|
rescanBibStyles();
|
||||||
@ -297,6 +311,7 @@ void GuiBibtex::setSelectedBibs(QStringList const sl)
|
|||||||
"encoding than specified below, set it here"));
|
"encoding than specified below, set it here"));
|
||||||
selectedLV->setIndexWidget(selected_model_.index(i, 1), cb);
|
selectedLV->setIndexWidget(selected_model_.index(i, 1), cb);
|
||||||
}
|
}
|
||||||
|
editPB->setEnabled(deletePB->isEnabled());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -392,6 +407,7 @@ void GuiBibtex::updateContents()
|
|||||||
biblatexOptsLE->setText(toqstr(params_["biblatexopts"]));
|
biblatexOptsLE->setText(toqstr(params_["biblatexopts"]));
|
||||||
|
|
||||||
setFileEncodings(getVectorFromString(params_["file_encodings"], from_ascii("\t")));
|
setFileEncodings(getVectorFromString(params_["file_encodings"], from_ascii("\t")));
|
||||||
|
editPB->setEnabled(deletePB->isEnabled());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -399,8 +415,8 @@ void GuiBibtex::applyView()
|
|||||||
{
|
{
|
||||||
docstring dbs;
|
docstring dbs;
|
||||||
|
|
||||||
unsigned int maxCount = selected_bibs_.count();
|
int maxCount = selected_bibs_.count();
|
||||||
for (unsigned int i = 0; i < maxCount; i++) {
|
for (int i = 0; i < maxCount; i++) {
|
||||||
if (i != 0)
|
if (i != 0)
|
||||||
dbs += ',';
|
dbs += ',';
|
||||||
QString item = selected_bibs_.at(i);
|
QString item = selected_bibs_.at(i);
|
||||||
|
@ -39,6 +39,7 @@ private Q_SLOTS:
|
|||||||
void on_buttonBox_accepted();
|
void on_buttonBox_accepted();
|
||||||
void browseBstPressed();
|
void browseBstPressed();
|
||||||
void browseBibPressed();
|
void browseBibPressed();
|
||||||
|
void on_editPB_clicked();
|
||||||
void databaseChanged();
|
void databaseChanged();
|
||||||
void rescanClicked();
|
void rescanClicked();
|
||||||
void selUpdated();
|
void selUpdated();
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>523</width>
|
<width>523</width>
|
||||||
<height>576</height>
|
<height>617</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@ -141,6 +141,33 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="editPB">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Edit selected database externally</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>&Edit...</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset>
|
||||||
|
<normaloff>.</normaloff>.</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="verticalSpacer">
|
<spacer name="verticalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
@ -85,7 +85,7 @@ void InsetBibtex::doDispatch(Cursor & cur, FuncRequest & cmd)
|
|||||||
switch (cmd.action()) {
|
switch (cmd.action()) {
|
||||||
|
|
||||||
case LFUN_INSET_EDIT:
|
case LFUN_INSET_EDIT:
|
||||||
editDatabases();
|
editDatabases(cmd.argument());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_INSET_MODIFY: {
|
case LFUN_INSET_MODIFY: {
|
||||||
@ -132,7 +132,7 @@ bool InsetBibtex::getStatus(Cursor & cur, FuncRequest const & cmd,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetBibtex::editDatabases() const
|
void InsetBibtex::editDatabases(docstring const db) const
|
||||||
{
|
{
|
||||||
vector<docstring> bibfilelist = getVectorFromString(getParam("bibfiles"));
|
vector<docstring> bibfilelist = getVectorFromString(getParam("bibfiles"));
|
||||||
|
|
||||||
@ -140,7 +140,7 @@ void InsetBibtex::editDatabases() const
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
size_t nr_databases = bibfilelist.size();
|
size_t nr_databases = bibfilelist.size();
|
||||||
if (nr_databases > 1) {
|
if (nr_databases > 1 && db.empty()) {
|
||||||
docstring const engine = usingBiblatex() ? _("Biblatex") : _("BibTeX");
|
docstring const engine = usingBiblatex() ? _("Biblatex") : _("BibTeX");
|
||||||
docstring message = bformat(_("The %1$s[[BibTeX/Biblatex]] inset includes %2$s databases.\n"
|
docstring message = bformat(_("The %1$s[[BibTeX/Biblatex]] inset includes %2$s databases.\n"
|
||||||
"If you proceed, all of them will be opened."),
|
"If you proceed, all of them will be opened."),
|
||||||
@ -155,6 +155,8 @@ void InsetBibtex::editDatabases() const
|
|||||||
vector<docstring>::const_iterator it = bibfilelist.begin();
|
vector<docstring>::const_iterator it = bibfilelist.begin();
|
||||||
vector<docstring>::const_iterator en = bibfilelist.end();
|
vector<docstring>::const_iterator en = bibfilelist.end();
|
||||||
for (; it != en; ++it) {
|
for (; it != en; ++it) {
|
||||||
|
if (!db.empty() && db != *it)
|
||||||
|
continue;
|
||||||
FileName const bibfile = buffer().getBibfilePath(*it);
|
FileName const bibfile = buffer().getBibfilePath(*it);
|
||||||
theFormats().edit(buffer(), bibfile,
|
theFormats().edit(buffer(), bibfile,
|
||||||
theFormats().getFormatFromFile(bibfile));
|
theFormats().getFormatFromFile(bibfile));
|
||||||
|
@ -82,7 +82,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
///
|
///
|
||||||
void editDatabases() const;
|
void editDatabases(docstring const db = docstring()) const;
|
||||||
///
|
///
|
||||||
void parseBibTeXFiles(support::FileNameList &) const;
|
void parseBibTeXFiles(support::FileNameList &) const;
|
||||||
///
|
///
|
||||||
|
Loading…
Reference in New Issue
Block a user