]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt/GuiCitation.cpp
Move Lexer to support/ directory (and lyx::support namespace)
[lyx.git] / src / frontends / qt / GuiCitation.cpp
index 20b4c34dc08b18bc2eb055e3fdded52c69dcc029..de39ce769871fe45d74a415126eeab076632c7e2 100644 (file)
 #include "FancyLineEdit.h"
 #include "GuiApplication.h"
 #include "GuiSelectionManager.h"
+#include "GuiView.h"
 #include "qt_helpers.h"
 
 #include "Buffer.h"
 #include "BufferView.h"
 #include "BufferParams.h"
 #include "Citation.h"
+#include "Cursor.h"
 #include "TextClass.h"
 #include "FuncRequest.h"
 
@@ -96,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);
@@ -141,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()),
@@ -152,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, [=](){ focusAndHighlight(availableLV); });
-#endif
+               availableLV, [this](){ focusAndHighlight(availableLV); });
        connect(regexp_, SIGNAL(triggered()),
                this, SLOT(regexChanged()));
        connect(casesense_, SIGNAL(triggered()),
@@ -166,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."));
@@ -196,6 +188,7 @@ void GuiCitation::applyView()
        QString const after = textAfterED->text();
 
        applyParams(choice, full, force, before, after);
+       connectToNewInset();
 }
 
 
@@ -833,6 +826,10 @@ void GuiCitation::init()
 
        buttonBox->button(QDialogButtonBox::Apply)->setEnabled(false);
        buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
+
+       // apply filter
+       if (!filter_->text().isEmpty())
+               findText(filter_->text(), true);
 }