!branchesTW->selectedItems().isEmpty();
removePB->setEnabled(have_sel);
renamePB->setEnabled(have_sel);
+ colorPB->setEnabled(have_sel);
+ activatePB->setEnabled(have_sel);
// emit signal
changed();
}
!branchesTW->selectedItems().isEmpty();
removePB->setEnabled(have_sel);
renamePB->setEnabled(have_sel);
+ colorPB->setEnabled(have_sel);
+ activatePB->setEnabled(have_sel);
}
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
changed();
}
sel_index = selItem->text(0);
if (!sel_index.isEmpty()) {
docstring newname;
+ docstring const oldname = qstring_to_ucs4(sel_index);
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);
newIndexLE->clear();
updateView();
}
+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()
{
toggleColor(indicesTW->currentItem());
void GuiIndices::on_multipleIndicesCB_toggled(bool const state)
{
+ bool const have_sel =
+ !indicesTW->selectedItems().isEmpty();
indicesTW->setEnabled(state);
newIndexLE->setEnabled(state);
newIndexLA->setEnabled(state);
addIndexPB->setEnabled(state);
availableLA->setEnabled(state);
- removePB->setEnabled(state);
- colorPB->setEnabled(state);
+ removePB->setEnabled(state && have_sel);
+ colorPB->setEnabled(state && have_sel);
+ renamePB->setEnabled(state && have_sel);
// emit signal
changed();
}
void on_renamePB_clicked();
void on_removePB_pressed();
void on_indicesTW_itemDoubleClicked(QTreeWidgetItem *, int);
+ void on_indicesTW_itemSelectionChanged();
void on_colorPB_clicked();
void on_multipleIndicesCB_toggled(bool);