]> git.lyx.org Git - features.git/commitdiff
The KDE formcitation patch
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 5 Oct 2000 14:03:45 +0000 (14:03 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 5 Oct 2000 14:03:45 +0000 (14:03 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1086 a592a061-630c-0410-9148-cb99ea01b6c8

ChangeLog
src/frontends/kde/FormCitation.C

index bfec58d0b961a64d636fb3828f77717dbd860819..20c8aac200e19ac106cc21ccd1a3357f4b72ed0d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2000-10-04  John Levon  <moz@compsoc.man.ac.uk>
+
+       * src/frontends/kde/FormCitation.C: make the dialog
+       behave more sensibly
+
 2000-10-03  John Levon  <moz@compsoc.man.ac.uk>
 
        * config/kde.m4: fix consecutive ./configure runs,
index 6abf6726431ad784b2c89f47f59735410dbfd343..609f88727a6032819ff667774ba385fd771423b3 100644 (file)
@@ -72,13 +72,13 @@ void FormCitation::createCitation(string const & arg)
 
 void FormCitation::updateButtons()
 { 
-       bool iskey,ischosenkey;
-
-       iskey = !selectedKey.empty();
-       ischosenkey = !selectedChosenKey.empty();
+       bool ischosenkey = !selectedChosenKey.empty();
  
+       vector<string>::const_iterator iter = 
+               find(chosenkeys.begin(), chosenkeys.end(), selectedKey);
+
+       dialog_->add->setEnabled(!selectedKey.empty() && iter == chosenkeys.end());
        dialog_->remove->setEnabled(ischosenkey);
-       dialog_->add->setEnabled(iskey);
        dialog_->up->setEnabled(ischosenkey);
        dialog_->down->setEnabled(ischosenkey);
 }
@@ -147,13 +147,13 @@ void FormCitation::update()
                dialog_->chosen->setFocusPolicy(QWidget::NoFocus);
                dialog_->after->setFocusPolicy(QWidget::NoFocus);
                dialog_->buttonOk->setEnabled(false);
-               dialog_->buttonCancel->setText(_("Close"));
+               dialog_->buttonCancel->setText(_("&Close"));
        } else {
                dialog_->keys->setFocusPolicy(QWidget::StrongFocus);
                dialog_->chosen->setFocusPolicy(QWidget::StrongFocus);
                dialog_->after->setFocusPolicy(QWidget::StrongFocus);
                dialog_->buttonOk->setEnabled(true);
-               dialog_->buttonCancel->setText(_("Cancel"));
+               dialog_->buttonCancel->setText(_("&Cancel"));
        }
 }
 
@@ -314,6 +314,12 @@ void FormCitation::down()
  
 void FormCitation::select_key(const char *key)
 {
+       vector<string>::const_iterator iter = 
+               find(chosenkeys.begin(), chosenkeys.end(), key);
+
+       if (iter!=chosenkeys.end())
+               return;
+
        selectedKey.erase();
        selectedKey = key;
 
@@ -328,6 +334,12 @@ void FormCitation::highlight_key(const char *key)
        for (unsigned int i=0; i < keys.size(); i++) {
                if (keys[i].first==key) {
                        dialog_->entry->setText(keys[i].second.c_str());
+                       dialog_->chosen->clearFocus();
+                       dialog_->chosen->clearSelection();
+                       dialog_->up->setEnabled(false);
+                       dialog_->down->setEnabled(false);
+                       dialog_->remove->setEnabled(false);
+                       selectedChosenKey.erase();
                        break;
                }
        }
@@ -346,6 +358,10 @@ void FormCitation::highlight_chosen(const char *key)
                if (keys[i].first==key) {
                        if (keys[i].second.compare(dialog_->entry->text()))
                                dialog_->entry->setText(keys[i].second.c_str());
+                       dialog_->keys->clearFocus();
+                       dialog_->keys->clearSelection();
+                       dialog_->add->setEnabled(false);
+                       selectedKey.erase();
                        break;
                }
        }