]> git.lyx.org Git - features.git/commitdiff
Fix bug 4121. The cause was the empty on_available_entered method. Not sure why
authorRichard Heck <rgheck@comcast.net>
Mon, 13 Aug 2007 23:25:47 +0000 (23:25 +0000)
committerRichard Heck <rgheck@comcast.net>
Mon, 13 Aug 2007 23:25:47 +0000 (23:25 +0000)
that caused the bug, but it does.
Also fix some other UI bugs, relating to resets of the selection models. These
look gratuitous and cause problems in the current code.

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

src/frontends/qt4/QCitationDialog.cpp
src/frontends/qt4/QCitationDialog.h

index 86e8c013f90e6678c49ae88a4737fd0ba886d5b7..0d8d60b50c11c3ff10d6d3e1181e20052bb05fe4 100644 (file)
@@ -320,17 +320,19 @@ bool QCitationDialog::isSelected(const QModelIndex & idx)
 void QCitationDialog::setButtons()
 {
        int const arows = availableLV->model()->rowCount();
+       QModelIndexList const availSels = 
+                       availableLV->selectionModel()->selectedIndexes();
        addPB->setEnabled(arows > 0 &&
-               availableLV->currentIndex().isValid() &&
-               !isSelected(availableLV->currentIndex()));
+                       !availSels.isEmpty() &&
+                       !isSelected(availSels.first()));
 
        int const srows = selectedLV->model()->rowCount();
-       int const sel_nr = selectedLV->currentIndex().row();
+       QModelIndexList const selSels = 
+                       selectedLV->selectionModel()->selectedIndexes();
+       int const sel_nr =      selSels.empty() ? -1 : selSels.first().row();
        deletePB->setEnabled(sel_nr >= 0);
        upPB->setEnabled(sel_nr > 0);
        downPB->setEnabled(sel_nr >= 0 && sel_nr < srows - 1);
-       applyPB->setEnabled(srows > 0);
-       okPB->setEnabled(srows > 0);
 }
 
 
@@ -346,7 +348,6 @@ void QCitationDialog::updateInfo(const QModelIndex & idx)
 
 void QCitationDialog::on_selectedLV_clicked(const QModelIndex &)
 {
-       availableLV->selectionModel()->reset();
        update();
 }
 
@@ -355,15 +356,12 @@ void QCitationDialog::selectedChanged(const QModelIndex & idx, const QModelIndex
 {
        if (!idx.isValid())
                return;
-
-       availableLV->selectionModel()->reset();
        update();
 }
 
 
 void QCitationDialog::on_availableLV_clicked(const QModelIndex &)
 {
-       selectedLV->selectionModel()->reset();
        update();
 }
 
@@ -372,8 +370,6 @@ void QCitationDialog::availableChanged(const QModelIndex & idx, const QModelInde
 {
        if (!idx.isValid())
                return;
-
-       selectedLV->selectionModel()->reset();
        update();
 }
 
@@ -382,17 +378,10 @@ void QCitationDialog::on_availableLV_doubleClicked(const QModelIndex & idx)
 {
        if (isSelected(idx))
                return;
-
-       selectedLV->selectionModel()->reset();
        on_addPB_clicked();
 }
 
 
-void QCitationDialog::on_availableLV_entered(const QModelIndex &)
-{
-}
-
-
 namespace {
 //helper function for next two
 QModelIndex getSelectedIndex(QListView * lv) {
@@ -416,7 +405,6 @@ void QCitationDialog::on_addPB_clicked()
        form_->addKey(idxToAdd);
        if (idx.isValid())
                selectedLV->setCurrentIndex(idx);
-       selectedLV->selectionModel()->reset();
        update();
 }
 
@@ -436,7 +424,6 @@ void QCitationDialog::on_deletePB_clicked()
        if (nrows>1)
                selectedLV->setCurrentIndex(idx);
 
-       availableLV->selectionModel()->reset();
        update();
 }
 
index 02db24dd39257d136e7b03e8cbd850410aaa90e2..17875a7d96ef226eafa1c72e36dfef4c63fc9e0b 100644 (file)
@@ -73,7 +73,6 @@ protected Q_SLOTS:
        void selectedChanged(const QModelIndex &, const QModelIndex &);
        void on_availableLV_clicked(const QModelIndex &);
        void on_availableLV_doubleClicked(const QModelIndex &);
-       void on_availableLV_entered(const QModelIndex &);
        void availableChanged(const QModelIndex &, const QModelIndex &);
        virtual void changed();
        /// check whether key is already selected