RE: [patch] fix document settings branches GUI behavior
From: Vincent van Ravesteijn [v...@lyx.org] Sent: Friday, March 02, 2012 8:09 AM The attached implements this (part 1). Part 2 also implements the behaviour of GuiSelectionManager that Ctrl+Enter does quit the dialog. OK, I will study this to see how you did it. Thanks for the help and explanations. I have a few issues after applying both of your patches. Note that I am using Ubuntu 11.10 64-bit. (1) empty strings can be added by pressing enter. fix: remove the following part of branches_part1.diff: - if (!new_branch.isEmpty()) { - branchlist_.add(qstring_to_ucs4(new_branch)); - newBranchLE-clear(); - updateView(); - } + branchlist_.add(qstring_to_ucs4(new_branch)); + newBranchLE-clear(); + addBranchPB-setEnabled(false); + updateView(); (2) Ctrl+Enter does not quit the dialog for me. (3) The main Enter button does what it is supposed to, but the Enter button on the number pad quits the dialog. it seems to be doing what you say Ctrl+Enter should do. I find it strange that they perform different actions despite both being labeled Enter. I will look at my bindings. Can you send an e-mail to lyx-devel list like the following to grant your permission to use your contributions: OK. Scott
Re: [patch] fix document settings branches GUI behavior
Op 3-3-2012 9:09, Scott Kostyshak schreef: From: Vincent van Ravesteijn [v...@lyx.org] Sent: Friday, March 02, 2012 8:09 AM The attached implements this (part 1). Part 2 also implements the behaviour of GuiSelectionManager that Ctrl+Enter does quit the dialog. OK, I will study this to see how you did it. Thanks for the help and explanations. I have a few issues after applying both of your patches. Note that I am using Ubuntu 11.10 64-bit. (1) empty strings can be added by pressing enter. fix: remove the following part of branches_part1.diff: - if (!new_branch.isEmpty()) { - branchlist_.add(qstring_to_ucs4(new_branch)); - newBranchLE-clear(); - updateView(); - } + branchlist_.add(qstring_to_ucs4(new_branch)); + newBranchLE-clear(); + addBranchPB-setEnabled(false); + updateView(); Ok, I fixed this. (2) Ctrl+Enter does not quit the dialog for me. Strange.. (3) The main Enter button does what it is supposed to, but the Enter button on the number pad quits the dialog. it seems to be doing what you say Ctrl+Enter should do. I find it strange that they perform different actions despite both being labeled Enter. I will look at my bindings. This seems to be the intention of the author of the code in GuiSelectionManager. I'm afraid noone ever found out about this feature to immediately quit the dialog, so I don't want to change the current behaviour. Can you send an e-mail to lyx-devel list like the following to grant your permission to use your contributions: OK. Thank you. I added you to the credits. Vincent
Re: [patch] fix document settings branches GUI behavior
I have a few issues after applying both of your patches. Note that I am using Ubuntu 11.10 64-bit. (2) Ctrl+Enter does not quit the dialog for me. I tried myself now on Ubuntu 11.10 64-bits. For me it works. Vincent
RE: [patch] fix document settings branches GUI behavior
From: Vincent van Ravesteijn [v...@lyx.org] Sent: Saturday, March 03, 2012 9:10 AM I have a few issues after applying both of your patches. Note that I am using Ubuntu 11.10 64-bit. (1) empty strings can be added by pressing enter. fix: remove the following part of branches_part1.diff: - if (!new_branch.isEmpty()) { - branchlist_.add(qstring_to_ucs4(new_branch)); - newBranchLE-clear(); - updateView(); - } + branchlist_.add(qstring_to_ucs4(new_branch)); + newBranchLE-clear(); + addBranchPB-setEnabled(false); + updateView(); Ok, I fixed this. Confirmed. (2) Ctrl+Enter does not quit the dialog for me. I tried myself now on Ubuntu 11.10 64-bits. For me it works. This works for me also now. Thanks, Scott
RE: [patch] fix document settings > branches GUI behavior
From: Vincent van Ravesteijn [v...@lyx.org] Sent: Friday, March 02, 2012 8:09 AM >The attached implements this (part 1). Part 2 also implements the >behaviour of GuiSelectionManager that Ctrl+Enter does quit the dialog. OK, I will study this to see how you did it. Thanks for the help and explanations. I have a few issues after applying both of your patches. Note that I am using Ubuntu 11.10 64-bit. (1) empty strings can be added by pressing enter. fix: remove the following part of branches_part1.diff: - if (!new_branch.isEmpty()) { - branchlist_.add(qstring_to_ucs4(new_branch)); - newBranchLE->clear(); - updateView(); - } + branchlist_.add(qstring_to_ucs4(new_branch)); + newBranchLE->clear(); + addBranchPB->setEnabled(false); + updateView(); (2) Ctrl+Enter does not quit the dialog for me. (3) The "main" Enter button does what it is supposed to, but the Enter button on the number pad quits the dialog. it seems to be doing what you say Ctrl+Enter should do. I find it strange that they perform different actions despite both being labeled "Enter". I will look at my bindings. >Can you send an e-mail to lyx-devel list like the following to grant >your permission to use your contributions: OK. Scott
Re: [patch] fix document settings > branches GUI behavior
Op 3-3-2012 9:09, Scott Kostyshak schreef: From: Vincent van Ravesteijn [v...@lyx.org] Sent: Friday, March 02, 2012 8:09 AM The attached implements this (part 1). Part 2 also implements the behaviour of GuiSelectionManager that Ctrl+Enter does quit the dialog. OK, I will study this to see how you did it. Thanks for the help and explanations. I have a few issues after applying both of your patches. Note that I am using Ubuntu 11.10 64-bit. (1) empty strings can be added by pressing enter. fix: remove the following part of branches_part1.diff: - if (!new_branch.isEmpty()) { - branchlist_.add(qstring_to_ucs4(new_branch)); - newBranchLE->clear(); - updateView(); - } + branchlist_.add(qstring_to_ucs4(new_branch)); + newBranchLE->clear(); + addBranchPB->setEnabled(false); + updateView(); Ok, I fixed this. (2) Ctrl+Enter does not quit the dialog for me. Strange.. (3) The "main" Enter button does what it is supposed to, but the Enter button on the number pad quits the dialog. it seems to be doing what you say Ctrl+Enter should do. I find it strange that they perform different actions despite both being labeled "Enter". I will look at my bindings. This seems to be the intention of the author of the code in GuiSelectionManager. I'm afraid noone ever found out about this feature to immediately quit the dialog, so I don't want to change the current behaviour. Can you send an e-mail to lyx-devel list like the following to grant your permission to use your contributions: OK. Thank you. I added you to the credits. Vincent
Re: [patch] fix document settings > branches GUI behavior
I have a few issues after applying both of your patches. Note that I am using Ubuntu 11.10 64-bit. (2) Ctrl+Enter does not quit the dialog for me. I tried myself now on Ubuntu 11.10 64-bits. For me it works. Vincent
RE: [patch] fix document settings > branches GUI behavior
From: Vincent van Ravesteijn [v...@lyx.org] Sent: Saturday, March 03, 2012 9:10 AM >> I have a few issues after applying both of your patches. Note that I am >> using Ubuntu 11.10 64-bit. >> (1) empty strings can be added by pressing enter. >> fix: remove the following part of branches_part1.diff: >> - if (!new_branch.isEmpty()) { >> - branchlist_.add(qstring_to_ucs4(new_branch)); >> - newBranchLE->clear(); >> - updateView(); >> - } >> + branchlist_.add(qstring_to_ucs4(new_branch)); >> + newBranchLE->clear(); >> + addBranchPB->setEnabled(false); >> + updateView(); >Ok, I fixed this. Confirmed. >> (2) Ctrl+Enter does not quit the dialog for me. >> >> >I tried myself now on Ubuntu 11.10 64-bits. For me it works. This works for me also now. Thanks, Scott
Re: [patch] fix document settings branches GUI behavior
Op 21-2-2012 22:49, Scott Kostyshak schreef: From: lyx-devel@lists.lyx.org [lyx-devel@lists.lyx.org] on behalf of Jean-Marc Lasgouttes [lasgout...@lyx.org] Sent: Tuesday, February 21, 2012 3:55 AM What I would do is to study the code of the Insert-Citation dialog, which has the correct behaviour in the search (find?) field, if I understand correctly. Ah, I was wondering why my grepping for setDefault didn't return many results. I'm getting closer. I realize that I need to connect the signal returnPressed from newBranchLE to on_addBranchPB_pressed. I did this, and it seems to have partially done what I want, but when I enter text into the LE and press return the dialog goes away. The branch is correctly entered (which can be seen by going back to document settings branches). What did I do wrong? Why is it closing? Is updateView() doing that? It is because the Ok button is the default button of the dialog. This button will be 'pressed' if the user presses return in the dialog. See: https://qt-project.org/doc/qt-4.8/qpushbutton.html#autoDefault-prop https://qt-project.org/doc/qt-4.8/qpushbutton.html#default-prop The only way to prevent the default button to be pressed is to add an eventFilter. See GuiSelectionManager::eventFilter(). The attached implements this (part 1). Part 2 also implements the behaviour of GuiSelectionManager that Ctrl+Enter does quit the dialog. Can you send an e-mail to lyx-devel list like the following to grant your permission to use your contributions: http://marc.info/?l=lyx-develm=130523685427995 ? Vincent diff --git a/src/frontends/qt4/GuiBranches.cpp b/src/frontends/qt4/GuiBranches.cpp index 7759be2..d0ba467 100644 --- a/src/frontends/qt4/GuiBranches.cpp +++ b/src/frontends/qt4/GuiBranches.cpp @@ -76,15 +76,25 @@ GuiBranches::GuiBranches(QWidget * parent) newBranchLE-setValidator(new NoNewLineValidator(newBranchLE)); } -bool GuiBranches::eventFilter(QObject * obj, QEvent * event) +bool GuiBranches::eventFilter(QObject * obj, QEvent * event) { QEvent::Type etype = event-type(); if (etype == QEvent::KeyPress obj == newBranchLE) { QKeyEvent * keyEvent = static_castQKeyEvent *(event); int const keyPressed = keyEvent-key(); + Qt::KeyboardModifiers const keyModifiers = keyEvent-modifiers(); if (keyPressed == Qt::Key_Enter || keyPressed == Qt::Key_Return) { - on_addBranchPB_pressed(); + if (!keyModifiers) { + on_addBranchPB_pressed(); + } else if (keyModifiers == Qt::ControlModifier + || keyModifiers == Qt::KeypadModifier + || keyModifiers == (Qt::ControlModifier | Qt::KeypadModifier)) { + if (addBranchPB-isEnabled()) { + on_addBranchPB_pressed(); + okPressed(); + } + } event-accept(); return true; } diff --git a/src/frontends/qt4/GuiBranches.h b/src/frontends/qt4/GuiBranches.h index 3801f5c..fc29167 100644 --- a/src/frontends/qt4/GuiBranches.h +++ b/src/frontends/qt4/GuiBranches.h @@ -54,6 +54,7 @@ public: Q_SIGNALS: void changed(); void renameBranches(docstring const , docstring const ); + void okPressed(); protected: void toggleBranch(QTreeWidgetItem *); diff --git a/src/frontends/qt4/GuiDocument.cpp b/src/frontends/qt4/GuiDocument.cpp index a388a86..aa33c8f 100644 --- a/src/frontends/qt4/GuiDocument.cpp +++ b/src/frontends/qt4/GuiDocument.cpp @@ -1289,6 +1289,7 @@ GuiDocument::GuiDocument(GuiView lv) this, SLOT(change_adaptor())); connect(branchesModule, SIGNAL(renameBranches(docstring const , docstring const )), this, SLOT(branchesRename(docstring const , docstring const ))); + connect(branchesModule, SIGNAL(okPressed()), this, SLOT(slotOK())); updateUnknownBranches(); diff --git a/src/frontends/qt4/GuiBranches.cpp b/src/frontends/qt4/GuiBranches.cpp index c79a42d..7759be2 100644 --- a/src/frontends/qt4/GuiBranches.cpp +++ b/src/frontends/qt4/GuiBranches.cpp @@ -28,6 +28,7 @@ #include support/gettext.h #include support/lstrings.h +#include QKeyEvent #include QListWidget #include QTreeWidget #include QTreeWidgetItem @@ -71,9 +72,26 @@ GuiBranches::GuiBranches(QWidget * parent) connect(undef_-cancelPB, SIGNAL(clicked()), undef_, SLOT(reject())); + newBranchLE-installEventFilter(this); newBranchLE-setValidator(new NoNewLineValidator(newBranchLE)); } +bool GuiBranches::eventFilter(QObject * obj, QEvent * event) +{ + QEvent::Type etype = event-type(); + if (etype == QEvent::KeyPress obj == newBranchLE) { +
Re: [patch] fix document settings > branches GUI behavior
Op 21-2-2012 22:49, Scott Kostyshak schreef: From: lyx-devel@lists.lyx.org [lyx-devel@lists.lyx.org] on behalf of Jean-Marc Lasgouttes [lasgout...@lyx.org] Sent: Tuesday, February 21, 2012 3:55 AM What I would do is to study the code of the Insert->Citation dialog, which has the correct behaviour in the search (find?) field, if I understand correctly. Ah, I was wondering why my grepping for setDefault didn't return many results. I'm getting closer. I realize that I need to connect the signal returnPressed from newBranchLE to on_addBranchPB_pressed. I did this, and it seems to have partially done what I want, but when I enter text into the LE and press return the dialog goes away. The branch is correctly entered (which can be seen by going back to document settings> branches). What did I do wrong? Why is it closing? Is updateView() doing that? It is because the Ok button is the default button of the dialog. This button will be 'pressed' if the user presses return in the dialog. See: https://qt-project.org/doc/qt-4.8/qpushbutton.html#autoDefault-prop https://qt-project.org/doc/qt-4.8/qpushbutton.html#default-prop The only way to prevent the default button to be pressed is to add an eventFilter. See GuiSelectionManager::eventFilter(). The attached implements this (part 1). Part 2 also implements the behaviour of GuiSelectionManager that Ctrl+Enter does quit the dialog. Can you send an e-mail to lyx-devel list like the following to grant your permission to use your contributions: http://marc.info/?l=lyx-devel=130523685427995 ? Vincent diff --git a/src/frontends/qt4/GuiBranches.cpp b/src/frontends/qt4/GuiBranches.cpp index 7759be2..d0ba467 100644 --- a/src/frontends/qt4/GuiBranches.cpp +++ b/src/frontends/qt4/GuiBranches.cpp @@ -76,15 +76,25 @@ GuiBranches::GuiBranches(QWidget * parent) newBranchLE->setValidator(new NoNewLineValidator(newBranchLE)); } -bool GuiBranches::eventFilter(QObject * obj, QEvent * event) +bool GuiBranches::eventFilter(QObject * obj, QEvent * event) { QEvent::Type etype = event->type(); if (etype == QEvent::KeyPress && obj == newBranchLE) { QKeyEvent * keyEvent = static_cast(event); int const keyPressed = keyEvent->key(); + Qt::KeyboardModifiers const keyModifiers = keyEvent->modifiers(); if (keyPressed == Qt::Key_Enter || keyPressed == Qt::Key_Return) { - on_addBranchPB_pressed(); + if (!keyModifiers) { + on_addBranchPB_pressed(); + } else if (keyModifiers == Qt::ControlModifier + || keyModifiers == Qt::KeypadModifier + || keyModifiers == (Qt::ControlModifier | Qt::KeypadModifier)) { + if (addBranchPB->isEnabled()) { + on_addBranchPB_pressed(); + okPressed(); + } + } event->accept(); return true; } diff --git a/src/frontends/qt4/GuiBranches.h b/src/frontends/qt4/GuiBranches.h index 3801f5c..fc29167 100644 --- a/src/frontends/qt4/GuiBranches.h +++ b/src/frontends/qt4/GuiBranches.h @@ -54,6 +54,7 @@ public: Q_SIGNALS: void changed(); void renameBranches(docstring const &, docstring const &); + void okPressed(); protected: void toggleBranch(QTreeWidgetItem *); diff --git a/src/frontends/qt4/GuiDocument.cpp b/src/frontends/qt4/GuiDocument.cpp index a388a86..aa33c8f 100644 --- a/src/frontends/qt4/GuiDocument.cpp +++ b/src/frontends/qt4/GuiDocument.cpp @@ -1289,6 +1289,7 @@ GuiDocument::GuiDocument(GuiView & lv) this, SLOT(change_adaptor())); connect(branchesModule, SIGNAL(renameBranches(docstring const &, docstring const &)), this, SLOT(branchesRename(docstring const &, docstring const &))); + connect(branchesModule, SIGNAL(okPressed()), this, SLOT(slotOK())); updateUnknownBranches(); diff --git a/src/frontends/qt4/GuiBranches.cpp b/src/frontends/qt4/GuiBranches.cpp index c79a42d..7759be2 100644 --- a/src/frontends/qt4/GuiBranches.cpp +++ b/src/frontends/qt4/GuiBranches.cpp @@ -28,6 +28,7 @@ #include "support/gettext.h" #include "support/lstrings.h" +#include #include #include #include @@ -71,9 +72,26 @@ GuiBranches::GuiBranches(QWidget * parent) connect(undef_->cancelPB, SIGNAL(clicked()), undef_, SLOT(reject())); + newBranchLE->installEventFilter(this); newBranchLE->setValidator(new NoNewLineValidator(newBranchLE)); } +bool GuiBranches::eventFilter(QObject * obj, QEvent * event) +{ + QEvent::Type etype = event->type(); + if (etype == QEvent::KeyPress && obj == newBranchLE) { + QKeyEvent * keyEvent =
RE: [patch] fix document settings branches GUI behavior
From: Scott Kostyshak Sent: Tuesday, February 21, 2012 4:49 PM I'm getting closer. I realize that I need to connect the signal returnPressed from newBranchLE to on_addBranchPB_pressed. I did this, and it seems to have partially done what I want, but when I enter text into the LE and press return the dialog goes away. The branch is correctly entered (which can be seen by going back to document settings branches). What did I do wrong? Why is it closing? Is updateView() doing that? The new patch is attached. I still can't figure this out. Can anyone help? Thanks, Scott
RE: [patch] fix document settings > branches GUI behavior
From: Scott Kostyshak Sent: Tuesday, February 21, 2012 4:49 PM >I'm getting closer. I realize that I need to connect the signal returnPressed >from newBranchLE to >on_addBranchPB_pressed. I did this, and it seems to have >partially done what I want, but when I enter text into the >LE and press >return the dialog goes away. The branch is correctly entered (which can be >seen by going back to >document settings > branches). What did I do wrong? Why >is it closing? Is updateView() doing that? >The new patch is attached. I still can't figure this out. Can anyone help? Thanks, Scott
Re: [patch] fix document settings branches GUI behavior
Le 21/02/2012 09:29, Scott Kostyshak a écrit : my fix for bug 1: 1. disable the add button (BranchesUi.ui) 2. enable the add button when there is text in the text box (GuiBranches.cpp) my (partially implemented) idea for bug 2: set the add button as default when there is text in the text box (GuiBranches.cpp) --That works fine, but I can't figure out how to set the OK button back to default (which it was before) because okPB is not in the scope of GuiBranches.cpp. This has a global affect on the dialog because even after the panel is switched okPB does not have default enabled. What should I do about this? What I would do is to study the code of the Insert-Citation dialog, which has the correct behaviour in the search (find?) field, if I understand correctly. JMarc
RE: [patch] fix document settings branches GUI behavior
From: lyx-devel@lists.lyx.org [lyx-devel@lists.lyx.org] on behalf of Jean-Marc Lasgouttes [lasgout...@lyx.org] Sent: Tuesday, February 21, 2012 3:55 AM What I would do is to study the code of the Insert-Citation dialog, which has the correct behaviour in the search (find?) field, if I understand correctly. OK, I will do that. Thank you, Scott
RE: [patch] fix document settings branches GUI behavior
From: lyx-devel@lists.lyx.org [lyx-devel@lists.lyx.org] on behalf of Jean-Marc Lasgouttes [lasgout...@lyx.org] Sent: Tuesday, February 21, 2012 3:55 AM What I would do is to study the code of the Insert-Citation dialog, which has the correct behaviour in the search (find?) field, if I understand correctly. Ah, I was wondering why my grepping for setDefault didn't return many results. I'm getting closer. I realize that I need to connect the signal returnPressed from newBranchLE to on_addBranchPB_pressed. I did this, and it seems to have partially done what I want, but when I enter text into the LE and press return the dialog goes away. The branch is correctly entered (which can be seen by going back to document settings branches). What did I do wrong? Why is it closing? Is updateView() doing that? The new patch is attached. ScottIndex: src/frontends/qt4/GuiBranches.cpp === --- src/frontends/qt4/GuiBranches.cpp (revision 40790) +++ src/frontends/qt4/GuiBranches.cpp (working copy) @@ -70,6 +70,8 @@ undef_, SLOT(accept())); connect(undef_-cancelPB, SIGNAL(clicked()), undef_, SLOT(reject())); + connect(newBranchLE, SIGNAL(returnPressed()), + this, SLOT(on_addBranchPB_pressed())); newBranchLE-setValidator(new NoNewLineValidator(newBranchLE)); } @@ -132,17 +134,25 @@ } -void GuiBranches::on_addBranchPB_pressed() +void GuiBranches::on_newBranchLE_textChanged(QString) { QString const new_branch = newBranchLE-text(); if (!new_branch.isEmpty()) { - branchlist_.add(qstring_to_ucs4(new_branch)); - newBranchLE-clear(); - updateView(); + addBranchPB-setEnabled(TRUE); } } +void GuiBranches::on_addBranchPB_pressed() +{ + QString const new_branch = newBranchLE-text(); + branchlist_.add(qstring_to_ucs4(new_branch)); + newBranchLE-clear(); + addBranchPB-setEnabled(FALSE); + updateView(); +} + + void GuiBranches::on_removePB_pressed() { QTreeWidgetItem * selItem = branchesTW-currentItem(); Index: src/frontends/qt4/GuiBranches.h === --- src/frontends/qt4/GuiBranches.h (revision 40790) +++ src/frontends/qt4/GuiBranches.h (working copy) @@ -60,6 +60,7 @@ void updateView(); protected Q_SLOTS: + void on_newBranchLE_textChanged(QString); void on_addBranchPB_pressed(); void on_removePB_pressed(); void on_renamePB_pressed(); Index: src/frontends/qt4/ui/BranchesUi.ui === --- src/frontends/qt4/ui/BranchesUi.ui (revision 40790) +++ src/frontends/qt4/ui/BranchesUi.ui (working copy) @@ -103,6 +103,9 @@ /item item row=0 column=3 widget class=QPushButton name=addBranchPB + property name=enabled + boolfalse/bool + /property property name=toolTip stringAdd a new branch to the list/string /property
Re: [patch] fix document settings > branches GUI behavior
Le 21/02/2012 09:29, Scott Kostyshak a écrit : my fix for bug 1: 1. disable the add button (BranchesUi.ui) 2. enable the add button when there is text in the text box (GuiBranches.cpp) my (partially implemented) idea for bug 2: set the add button as default when there is text in the text box (GuiBranches.cpp) --That works fine, but I can't figure out how to set the OK button back to default (which it was before) because okPB is not in the scope of GuiBranches.cpp. This has a global affect on the dialog because even after the panel is switched okPB does not have default enabled. What should I do about this? What I would do is to study the code of the Insert->Citation dialog, which has the correct behaviour in the search (find?) field, if I understand correctly. JMarc
RE: [patch] fix document settings > branches GUI behavior
From: lyx-devel@lists.lyx.org [lyx-devel@lists.lyx.org] on behalf of Jean-Marc Lasgouttes [lasgout...@lyx.org] Sent: Tuesday, February 21, 2012 3:55 AM >What I would do is to study the code of the Insert->Citation dialog, >which has the correct behaviour in the search (find?) field, if I >understand correctly. OK, I will do that. Thank you, Scott
RE: [patch] fix document settings > branches GUI behavior
From: lyx-devel@lists.lyx.org [lyx-devel@lists.lyx.org] on behalf of Jean-Marc Lasgouttes [lasgout...@lyx.org] Sent: Tuesday, February 21, 2012 3:55 AM >What I would do is to study the code of the Insert->Citation dialog, >which has the correct behaviour in the search (find?) field, if I >understand correctly. Ah, I was wondering why my grepping for setDefault didn't return many results. I'm getting closer. I realize that I need to connect the signal returnPressed from newBranchLE to on_addBranchPB_pressed. I did this, and it seems to have partially done what I want, but when I enter text into the LE and press return the dialog goes away. The branch is correctly entered (which can be seen by going back to document settings > branches). What did I do wrong? Why is it closing? Is updateView() doing that? The new patch is attached. ScottIndex: src/frontends/qt4/GuiBranches.cpp === --- src/frontends/qt4/GuiBranches.cpp (revision 40790) +++ src/frontends/qt4/GuiBranches.cpp (working copy) @@ -70,6 +70,8 @@ undef_, SLOT(accept())); connect(undef_->cancelPB, SIGNAL(clicked()), undef_, SLOT(reject())); + connect(newBranchLE, SIGNAL(returnPressed()), + this, SLOT(on_addBranchPB_pressed())); newBranchLE->setValidator(new NoNewLineValidator(newBranchLE)); } @@ -132,17 +134,25 @@ } -void GuiBranches::on_addBranchPB_pressed() +void GuiBranches::on_newBranchLE_textChanged(QString) { QString const new_branch = newBranchLE->text(); if (!new_branch.isEmpty()) { - branchlist_.add(qstring_to_ucs4(new_branch)); - newBranchLE->clear(); - updateView(); + addBranchPB->setEnabled(TRUE); } } +void GuiBranches::on_addBranchPB_pressed() +{ + QString const new_branch = newBranchLE->text(); + branchlist_.add(qstring_to_ucs4(new_branch)); + newBranchLE->clear(); + addBranchPB->setEnabled(FALSE); + updateView(); +} + + void GuiBranches::on_removePB_pressed() { QTreeWidgetItem * selItem = branchesTW->currentItem(); Index: src/frontends/qt4/GuiBranches.h === --- src/frontends/qt4/GuiBranches.h (revision 40790) +++ src/frontends/qt4/GuiBranches.h (working copy) @@ -60,6 +60,7 @@ void updateView(); protected Q_SLOTS: + void on_newBranchLE_textChanged(QString); void on_addBranchPB_pressed(); void on_removePB_pressed(); void on_renamePB_pressed(); Index: src/frontends/qt4/ui/BranchesUi.ui === --- src/frontends/qt4/ui/BranchesUi.ui (revision 40790) +++ src/frontends/qt4/ui/BranchesUi.ui (working copy) @@ -103,6 +103,9 @@ + + false + Add a new branch to the list