]> git.lyx.org Git - features.git/commitdiff
* src/frontends/qt4/GuiBibtex.{cpp,h}:
authorJürgen Spitzmüller <spitz@lyx.org>
Sat, 12 Jan 2008 09:30:21 +0000 (09:30 +0000)
committerJürgen Spitzmüller <spitz@lyx.org>
Sat, 12 Jan 2008 09:30:21 +0000 (09:30 +0000)
* src/frontends/qt4/ui/BibtexUi.ui:
- add buttons to move databases up and down.
  Patch from Horst Schirmeier (permission: http://marc.info/?l=lyx-devel&m=120009631506298&w=2)

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

src/frontends/qt4/GuiBibtex.cpp
src/frontends/qt4/GuiBibtex.h
src/frontends/qt4/ui/BibtexUi.ui

index 56356608369ec33fae6e6ce301dc24f19278e2b0..643469f8f3285459b2eb0dbbbcad4a9397703d2b 100644 (file)
@@ -60,6 +60,10 @@ GuiBibtex::GuiBibtex(GuiView & lv)
                this, SLOT(browsePressed()));
        connect(deletePB, SIGNAL(clicked()),
                this, SLOT(deletePressed()));
+       connect(upPB, SIGNAL(clicked()),
+               this, SLOT(upPressed()));
+       connect(downPB, SIGNAL(clicked()),
+               this, SLOT(downPressed()));
        connect(styleCB, SIGNAL(editTextChanged(QString)),
                this, SLOT(change_adaptor()));
        connect(databaseLW, SIGNAL(itemSelectionChanged()),
@@ -103,6 +107,9 @@ GuiBibtex::GuiBibtex(GuiView & lv)
        bc().addReadOnly(bibtocCB);
        bc().addReadOnly(addBibPB);
        bc().addReadOnly(deletePB);
+
+       // Make sure the delete/up/down buttons are disabled if necessary.
+       databaseChanged();
 }
 
 
@@ -225,15 +232,39 @@ void GuiBibtex::addDatabase()
 
 void GuiBibtex::deletePressed()
 {
-       databaseLW->takeItem(databaseLW->currentRow());
+       QListWidgetItem *cur = databaseLW->takeItem(databaseLW->currentRow());
+       if (cur) {
+               delete cur;
+               changed();
+       }
+}
+
+
+void GuiBibtex::upPressed()
+{
+       int row = databaseLW->currentRow();
+       QListWidgetItem *cur;
+       databaseLW->insertItem(row - 1, cur = databaseLW->takeItem(row));
+       databaseLW->setCurrentItem(cur);
        changed();
 }
 
 
+void GuiBibtex::downPressed()
+{
+       int row = databaseLW->currentRow();
+       QListWidgetItem *cur;
+       databaseLW->insertItem(row + 1, cur = databaseLW->takeItem(row));
+       databaseLW->setCurrentItem(cur);
+       changed();
+}
+
 
 void GuiBibtex::databaseChanged()
 {
        deletePB->setEnabled(!isBufferReadonly() && databaseLW->currentRow() != -1);
+       upPB->setEnabled(!isBufferReadonly() && databaseLW->count() > 1 && databaseLW->currentRow() > 0);
+       downPB->setEnabled(!isBufferReadonly() && databaseLW->count() > 1 && databaseLW->currentRow() < databaseLW->count() - 1);
 }
 
 
index b015cb91b7c4009157153f6e67a0f0ddddbb086b..c2df10317bdee2ad383ef1aa5bef641c4860e1c7 100644 (file)
@@ -53,6 +53,8 @@ private Q_SLOTS:
        void addPressed();
        void addDatabase();
        void deletePressed();
+       void upPressed();
+       void downPressed();
        void databaseChanged();
        void availableChanged();
        void bibEDChanged();
index 84b09ade22afc69792a28f7fe6b08744e479b070..7af0e605e21a45b8e295aacbbc262846c8cc2fe3 100644 (file)
    <property name="spacing" >
     <number>6</number>
    </property>
-   <item rowspan="3" row="1" column="0" colspan="2" >
+   <item rowspan="5" row="1" column="0" colspan="2" >
     <widget class="QListWidget" name="databaseLW" />
    </item>
-   <item row="7" column="0" colspan="2" >
+   <item row="9" column="0" colspan="2" >
     <widget class="QCheckBox" name="bibtocCB" >
      <property name="toolTip" >
       <string>Add bibliography to the table of contents</string>
@@ -38,7 +38,7 @@
      </property>
     </widget>
    </item>
-   <item row="6" column="0" >
+   <item row="8" column="0" >
     <widget class="QLabel" name="btPrintLA" >
      <property name="sizePolicy" >
       <sizepolicy>
@@ -59,7 +59,7 @@
      </property>
     </widget>
    </item>
-   <item row="6" column="1" >
+   <item row="8" column="1" >
     <widget class="QComboBox" name="btPrintCO" >
      <property name="toolTip" >
       <string>This bibliography section contains...</string>
@@ -81,7 +81,7 @@
      </item>
     </widget>
    </item>
-   <item rowspan="2" row="6" column="2" >
+   <item rowspan="2" row="8" column="2" >
     <spacer>
      <property name="orientation" >
       <enum>Qt::Vertical</enum>
@@ -97,7 +97,7 @@
      </property>
     </spacer>
    </item>
-   <item row="5" column="2" >
+   <item row="7" column="2" >
     <widget class="QPushButton" name="stylePB" >
      <property name="toolTip" >
       <string>Choose a style file</string>
      </property>
     </widget>
    </item>
-   <item row="5" column="0" colspan="2" >
+   <item row="7" column="0" colspan="2" >
     <widget class="QComboBox" name="styleCB" >
      <property name="toolTip" >
       <string>Choose a style file</string>
      </property>
     </widget>
    </item>
-   <item rowspan="2" row="3" column="2" >
+   <item rowspan="2" row="5" column="2" >
     <spacer>
      <property name="orientation" >
       <enum>Qt::Vertical</enum>
      </property>
     </widget>
    </item>
-   <item row="8" column="0" colspan="3" >
+   <item row="10" column="0" colspan="3" >
     <layout class="QHBoxLayout" >
      <property name="margin" >
       <number>0</number>
      </item>
     </layout>
    </item>
-   <item row="4" column="0" colspan="2" >
+   <item row="6" column="0" colspan="2" >
     <widget class="QLabel" name="styleLA" >
      <property name="sizePolicy" >
       <sizepolicy>
      </property>
     </widget>
    </item>
+   <item row="3" column="2" >
+    <widget class="QPushButton" name="upPB" >
+     <property name="toolTip" >
+      <string>Move the selected database upwards in the list</string>
+     </property>
+     <property name="text" >
+      <string>&amp;Up</string>
+     </property>
+    </widget>
+   </item>
+   <item row="4" column="2" >
+    <widget class="QPushButton" name="downPB" >
+     <property name="toolTip" >
+      <string>Move the selected database downwards in the list</string>
+     </property>
+     <property name="text" >
+      <string>Do&amp;wn</string>
+     </property>
+    </widget>
+   </item>
   </layout>
  </widget>
  <pixmapfunction></pixmapfunction>