* src/frontends/qt4/QBibtex.{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)

status.15x follows immediately ...

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_5_X@22514 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2008-01-12 11:51:46 +00:00
parent 43ef0e78e7
commit f6da658f94
3 changed files with 70 additions and 12 deletions

View File

@ -71,6 +71,10 @@ QBibtexDialog::QBibtexDialog(QBibtex * form)
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 (const QString &)),
this, SLOT( change_adaptor()));
connect(databaseLW, SIGNAL(itemSelectionChanged()),
@ -110,6 +114,8 @@ QBibtexDialog::QBibtexDialog(QBibtex * form)
connect(add_->closePB, SIGNAL(clicked()),
add_, SLOT(reject()));
// Make sure the delete/up/down buttons are disabled if necessary.
databaseChanged();
}
@ -221,15 +227,43 @@ void QBibtexDialog::addDatabase()
void QBibtexDialog::deletePressed()
{
databaseLW->takeItem(databaseLW->currentRow());
QListWidgetItem *cur = databaseLW->takeItem(databaseLW->currentRow());
if (cur) {
delete cur;
form_->changed();
}
}
void QBibtexDialog::upPressed()
{
int row = databaseLW->currentRow();
QListWidgetItem *cur;
databaseLW->insertItem(row - 1, cur = databaseLW->takeItem(row));
databaseLW->setCurrentItem(cur);
form_->changed();
}
void QBibtexDialog::downPressed()
{
int row = databaseLW->currentRow();
QListWidgetItem *cur;
databaseLW->insertItem(row + 1, cur = databaseLW->takeItem(row));
databaseLW->setCurrentItem(cur);
form_->changed();
}
void QBibtexDialog::databaseChanged()
{
deletePB->setEnabled(!form_->readOnly() && databaseLW->currentRow() != -1);
upPB->setEnabled(!form_->readOnly() &&
databaseLW->count() > 1 &&
databaseLW->currentRow() > 0);
downPB->setEnabled(!form_->readOnly() &&
databaseLW->count() > 1 &&
databaseLW->currentRow() < databaseLW->count() - 1);
}
@ -272,7 +306,9 @@ void QBibtex::build_dialog()
bcview().addReadOnly(dialog_->styleCB);
bcview().addReadOnly(dialog_->bibtocCB);
bcview().addReadOnly(dialog_->addBibPB);
bcview().addReadOnly(dialog_->deletePB);
// Delete/Up/Down are handled with more conditions in
// QBibtexDialog::databaseChanged().
}

View File

@ -55,6 +55,8 @@ protected Q_SLOTS:
virtual void addPressed();
virtual void addDatabase();
virtual void deletePressed();
virtual void upPressed();
virtual void downPressed();
virtual void databaseChanged();
virtual 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>