]> git.lyx.org Git - features.git/commitdiff
* GuiBranches.cpp:
authorJürgen Spitzmüller <spitz@lyx.org>
Sat, 11 Jul 2009 06:29:57 +0000 (06:29 +0000)
committerJürgen Spitzmüller <spitz@lyx.org>
Sat, 11 Jul 2009 06:29:57 +0000 (06:29 +0000)
* GuiIndices.{cpp,h}: more UI polishment.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30462 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/GuiBranches.cpp
src/frontends/qt4/GuiIndices.cpp
src/frontends/qt4/GuiIndices.h

index 08bca169840d263a87013bf30ef16fad1af9c134..9f73cd4c7c2a94ccc03d6366655e1a780860dd02 100644 (file)
@@ -112,6 +112,8 @@ void GuiBranches::updateView()
                !branchesTW->selectedItems().isEmpty();
        removePB->setEnabled(have_sel);
        renamePB->setEnabled(have_sel);
+       colorPB->setEnabled(have_sel);
+       activatePB->setEnabled(have_sel);
        // emit signal
        changed();
 }
@@ -205,6 +207,8 @@ void GuiBranches::on_branchesTW_itemSelectionChanged()
                !branchesTW->selectedItems().isEmpty();
        removePB->setEnabled(have_sel);
        renamePB->setEnabled(have_sel);
+       colorPB->setEnabled(have_sel);
+       activatePB->setEnabled(have_sel);
 }
 
 
index 5e8c1b3d91aa14adae0f24e32916fe63213c6963..5ab141c70cd05a376f7e15835510b417515d3204 100644 (file)
@@ -123,6 +123,11 @@ void GuiIndices::updateView()
                        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();
 }
@@ -196,8 +201,11 @@ void GuiIndices::on_renamePB_clicked()
                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();
@@ -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()
 {
        toggleColor(indicesTW->currentItem());
@@ -224,13 +242,16 @@ void GuiIndices::on_colorPB_clicked()
 
 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();
 }
index 66cea923ef15b1b812d906806719ae3a3b4465b0..bd318ff72fc9f1511189e23ba7b9b41af1452493 100644 (file)
@@ -50,6 +50,7 @@ protected Q_SLOTS:
        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);