* GuiBranches.cpp:

* GuiIndices.{cpp,h}: more UI polishment.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30462 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2009-07-11 06:29:57 +00:00
parent 5166030174
commit eab8801afe
3 changed files with 29 additions and 3 deletions

View File

@ -112,6 +112,8 @@ void GuiBranches::updateView()
!branchesTW->selectedItems().isEmpty(); !branchesTW->selectedItems().isEmpty();
removePB->setEnabled(have_sel); removePB->setEnabled(have_sel);
renamePB->setEnabled(have_sel); renamePB->setEnabled(have_sel);
colorPB->setEnabled(have_sel);
activatePB->setEnabled(have_sel);
// emit signal // emit signal
changed(); changed();
} }
@ -205,6 +207,8 @@ void GuiBranches::on_branchesTW_itemSelectionChanged()
!branchesTW->selectedItems().isEmpty(); !branchesTW->selectedItems().isEmpty();
removePB->setEnabled(have_sel); removePB->setEnabled(have_sel);
renamePB->setEnabled(have_sel); renamePB->setEnabled(have_sel);
colorPB->setEnabled(have_sel);
activatePB->setEnabled(have_sel);
} }

View File

@ -123,6 +123,11 @@ void GuiIndices::updateView()
indicesTW->setItemSelected(newItem, true); indicesTW->setItemSelected(newItem, true);
} }
} }
bool const have_sel =
!indicesTW->selectedItems().isEmpty();
removePB->setEnabled(have_sel);
renamePB->setEnabled(have_sel);
colorPB->setEnabled(have_sel);
// emit signal // emit signal
changed(); changed();
} }
@ -196,8 +201,11 @@ void GuiIndices::on_renamePB_clicked()
sel_index = selItem->text(0); sel_index = selItem->text(0);
if (!sel_index.isEmpty()) { if (!sel_index.isEmpty()) {
docstring newname; docstring newname;
docstring const oldname = qstring_to_ucs4(sel_index);
bool success = false; bool success = false;
if (Alert::askForText(newname, _("Enter new index name"))) { if (Alert::askForText(newname, _("Enter new index name"), oldname)) {
if (newname.empty() || oldname == newname)
return;
success = indiceslist_.rename(qstring_to_ucs4(sel_index), newname); success = indiceslist_.rename(qstring_to_ucs4(sel_index), newname);
newIndexLE->clear(); newIndexLE->clear();
updateView(); updateView();
@ -216,6 +224,16 @@ void GuiIndices::on_indicesTW_itemDoubleClicked(QTreeWidgetItem * item, int /*co
} }
void GuiIndices::on_indicesTW_itemSelectionChanged()
{
bool const have_sel =
!indicesTW->selectedItems().isEmpty();
removePB->setEnabled(have_sel);
renamePB->setEnabled(have_sel);
colorPB->setEnabled(have_sel);
}
void GuiIndices::on_colorPB_clicked() void GuiIndices::on_colorPB_clicked()
{ {
toggleColor(indicesTW->currentItem()); toggleColor(indicesTW->currentItem());
@ -224,13 +242,16 @@ void GuiIndices::on_colorPB_clicked()
void GuiIndices::on_multipleIndicesCB_toggled(bool const state) void GuiIndices::on_multipleIndicesCB_toggled(bool const state)
{ {
bool const have_sel =
!indicesTW->selectedItems().isEmpty();
indicesTW->setEnabled(state); indicesTW->setEnabled(state);
newIndexLE->setEnabled(state); newIndexLE->setEnabled(state);
newIndexLA->setEnabled(state); newIndexLA->setEnabled(state);
addIndexPB->setEnabled(state); addIndexPB->setEnabled(state);
availableLA->setEnabled(state); availableLA->setEnabled(state);
removePB->setEnabled(state); removePB->setEnabled(state && have_sel);
colorPB->setEnabled(state); colorPB->setEnabled(state && have_sel);
renamePB->setEnabled(state && have_sel);
// emit signal // emit signal
changed(); changed();
} }

View File

@ -50,6 +50,7 @@ protected Q_SLOTS:
void on_renamePB_clicked(); void on_renamePB_clicked();
void on_removePB_pressed(); void on_removePB_pressed();
void on_indicesTW_itemDoubleClicked(QTreeWidgetItem *, int); void on_indicesTW_itemDoubleClicked(QTreeWidgetItem *, int);
void on_indicesTW_itemSelectionChanged();
void on_colorPB_clicked(); void on_colorPB_clicked();
void on_multipleIndicesCB_toggled(bool); void on_multipleIndicesCB_toggled(bool);