]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt/GuiCitation.cpp
Make string-widget combination more l7n friendly
[lyx.git] / src / frontends / qt / GuiCitation.cpp
index e6df31084f52ad3e36b621d8136feb04fe177a1b..c5fa26631098b17c331d78b0fc71ea603b2b0c45 100644 (file)
@@ -98,10 +98,7 @@ GuiCitation::GuiCitation(GuiView & lv)
 
        // The filter bar
        filter_ = new FancyLineEdit(this);
-       filter_->setButtonPixmap(FancyLineEdit::Right, getPixmap("images/", "editclear", "svgz,png"));
-       filter_->setButtonVisible(FancyLineEdit::Right, true);
-       filter_->setButtonToolTip(FancyLineEdit::Right, qt_("Clear text"));
-       filter_->setAutoHideButton(FancyLineEdit::Right, true);
+       filter_->setClearButton(true);
        filter_->setPlaceholderText(qt_("All avail. citations"));
 
        filterBarL->addWidget(filter_, 0);
@@ -143,6 +140,8 @@ GuiCitation::GuiCitation(GuiView & lv)
                        addPB, deletePB, upPB, downPB, &available_model_, &selected_model_, 1);
        connect(selectionManager, SIGNAL(selectionChanged()),
                this, SLOT(setCitedKeys()));
+       connect(selectionManager, SIGNAL(updateHook()),
+               this, SLOT(setCitedKeys()));
        connect(selectionManager, SIGNAL(updateHook()),
                this, SLOT(updateControls()));
        connect(selectionManager, SIGNAL(okHook()),
@@ -154,13 +153,8 @@ GuiCitation::GuiCitation(GuiView & lv)
                this, SLOT(filterChanged(QString)));
        connect(filter_, SIGNAL(returnPressed()),
                this, SLOT(filterPressed()));
-#if (QT_VERSION < 0x050000)
-       connect(filter_, SIGNAL(downPressed()),
-               availableLV, SLOT(setFocus()));
-#else
        connect(filter_, &FancyLineEdit::downPressed,
                availableLV, [this](){ focusAndHighlight(availableLV); });
-#endif
        connect(regexp_, SIGNAL(triggered()),
                this, SLOT(regexChanged()));
        connect(casesense_, SIGNAL(triggered()),
@@ -168,11 +162,7 @@ GuiCitation::GuiCitation(GuiView & lv)
        connect(instant_, SIGNAL(triggered(bool)),
                this, SLOT(instantChanged(bool)));
 
-#if (QT_VERSION < 0x050000)
-       selectedLV->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
-#else
        selectedLV->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
-#endif
 
        selectedLV->setToolTip(qt_("Ordered list of all cited references.\n"
                                   "You can reorder, add and remove references with the buttons on the left."));
@@ -198,25 +188,7 @@ void GuiCitation::applyView()
        QString const after = textAfterED->text();
 
        applyParams(choice, full, force, before, after);
-
-       // If we have just created a citation inset, then we want to attach the
-       // dialog to it. This (i) allows further modification of that inset and
-       // (ii) prevents an additional click on Apply or OK from unexpectedly
-       // creating another inset. (See #3964.)
-       GuiView & view = const_cast<GuiView &>(lyxview());
-       BufferView * bv = view.currentBufferView();
-       // should have one, but just to be safe...
-       if (bv) {
-               // are we attached to an inset already?
-               Inset * ins = bv->editedInset("citation");
-               if (!ins) {
-                       // no, so we just inserted one, and now we are behind it.
-                       Cursor const & cur = bv->cursor();
-                       ins = cur.prevInset();
-                       if (ins)
-                               bv->editInset("citation", ins);
-               }
-       }
+       connectToNewInset();
 }