* src/frontends/qt4/GuiBibtex.{cpp,h}:

* src/frontends/qt4/ui/BibtexUi.ui:
	- add buttons to move databases up and down.
	  Patch from Horst Schirmeier (permission: http://marc.info/?l=lyx-devel&m=120009631506298&w=2)

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22507 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2008-01-12 09:30:21 +00:00
parent df4634968a
commit fcf47395c5
3 changed files with 64 additions and 11 deletions

View File

@ -60,6 +60,10 @@ GuiBibtex::GuiBibtex(GuiView & lv)
this, SLOT(browsePressed()));
connect(deletePB, SIGNAL(clicked()),
this, SLOT(deletePressed()));
connect(upPB, SIGNAL(clicked()),
this, SLOT(upPressed()));
connect(downPB, SIGNAL(clicked()),
this, SLOT(downPressed()));
connect(styleCB, SIGNAL(editTextChanged(QString)),
this, SLOT(change_adaptor()));
connect(databaseLW, SIGNAL(itemSelectionChanged()),
@ -103,6 +107,9 @@ GuiBibtex::GuiBibtex(GuiView & lv)
bc().addReadOnly(bibtocCB);
bc().addReadOnly(addBibPB);
bc().addReadOnly(deletePB);
// Make sure the delete/up/down buttons are disabled if necessary.
databaseChanged();
}
@ -225,15 +232,39 @@ void GuiBibtex::addDatabase()
void GuiBibtex::deletePressed()
{
databaseLW->takeItem(databaseLW->currentRow());
QListWidgetItem *cur = databaseLW->takeItem(databaseLW->currentRow());
if (cur) {
delete cur;
changed();
}
}
void GuiBibtex::upPressed()
{
int row = databaseLW->currentRow();
QListWidgetItem *cur;
databaseLW->insertItem(row - 1, cur = databaseLW->takeItem(row));
databaseLW->setCurrentItem(cur);
changed();
}
void GuiBibtex::downPressed()
{
int row = databaseLW->currentRow();
QListWidgetItem *cur;
databaseLW->insertItem(row + 1, cur = databaseLW->takeItem(row));
databaseLW->setCurrentItem(cur);
changed();
}
void GuiBibtex::databaseChanged()
{
deletePB->setEnabled(!isBufferReadonly() && databaseLW->currentRow() != -1);
upPB->setEnabled(!isBufferReadonly() && databaseLW->count() > 1 && databaseLW->currentRow() > 0);
downPB->setEnabled(!isBufferReadonly() && databaseLW->count() > 1 && databaseLW->currentRow() < databaseLW->count() - 1);
}

View File

@ -53,6 +53,8 @@ private Q_SLOTS:
void addPressed();
void addDatabase();
void deletePressed();
void upPressed();
void downPressed();
void databaseChanged();
void availableChanged();
void bibEDChanged();

View File

@ -25,10 +25,10 @@
<property name="spacing" >
<number>6</number>
</property>
<item rowspan="3" row="1" column="0" colspan="2" >
<item rowspan="5" row="1" column="0" colspan="2" >
<widget class="QListWidget" name="databaseLW" />
</item>
<item row="7" column="0" colspan="2" >
<item row="9" column="0" colspan="2" >
<widget class="QCheckBox" name="bibtocCB" >
<property name="toolTip" >
<string>Add bibliography to the table of contents</string>
@ -38,7 +38,7 @@
</property>
</widget>
</item>
<item row="6" column="0" >
<item row="8" column="0" >
<widget class="QLabel" name="btPrintLA" >
<property name="sizePolicy" >
<sizepolicy>
@ -59,7 +59,7 @@
</property>
</widget>
</item>
<item row="6" column="1" >
<item row="8" column="1" >
<widget class="QComboBox" name="btPrintCO" >
<property name="toolTip" >
<string>This bibliography section contains...</string>
@ -81,7 +81,7 @@
</item>
</widget>
</item>
<item rowspan="2" row="6" column="2" >
<item rowspan="2" row="8" column="2" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
@ -97,7 +97,7 @@
</property>
</spacer>
</item>
<item row="5" column="2" >
<item row="7" column="2" >
<widget class="QPushButton" name="stylePB" >
<property name="toolTip" >
<string>Choose a style file</string>
@ -110,7 +110,7 @@
</property>
</widget>
</item>
<item row="5" column="0" colspan="2" >
<item row="7" column="0" colspan="2" >
<widget class="QComboBox" name="styleCB" >
<property name="toolTip" >
<string>Choose a style file</string>
@ -126,7 +126,7 @@
</property>
</widget>
</item>
<item rowspan="2" row="3" column="2" >
<item rowspan="2" row="5" column="2" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
@ -186,7 +186,7 @@
</property>
</widget>
</item>
<item row="8" column="0" colspan="3" >
<item row="10" column="0" colspan="3" >
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
@ -235,7 +235,7 @@
</item>
</layout>
</item>
<item row="4" column="0" colspan="2" >
<item row="6" column="0" colspan="2" >
<widget class="QLabel" name="styleLA" >
<property name="sizePolicy" >
<sizepolicy>
@ -256,6 +256,26 @@
</property>
</widget>
</item>
<item row="3" column="2" >
<widget class="QPushButton" name="upPB" >
<property name="toolTip" >
<string>Move the selected database upwards in the list</string>
</property>
<property name="text" >
<string>&amp;Up</string>
</property>
</widget>
</item>
<item row="4" column="2" >
<widget class="QPushButton" name="downPB" >
<property name="toolTip" >
<string>Move the selected database downwards in the list</string>
</property>
<property name="text" >
<string>Do&amp;wn</string>
</property>
</widget>
</item>
</layout>
</widget>
<pixmapfunction></pixmapfunction>