]> git.lyx.org Git - features.git/commitdiff
Fix bug 4656 (OK and Cancel buttons for Paragraph dialog).
authorJürgen Spitzmüller <spitz@lyx.org>
Sat, 19 Apr 2008 16:56:40 +0000 (16:56 +0000)
committerJürgen Spitzmüller <spitz@lyx.org>
Sat, 19 Apr 2008 16:56:40 +0000 (16:56 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24364 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/GuiParagraph.cpp
src/frontends/qt4/GuiParagraph.h
src/frontends/qt4/ui/ParagraphUi.ui

index 49668942083464142f35adf5bbceada905462b3d..b73a5f53ae7285ae7d48d84720671d1d400f0485 100644 (file)
@@ -64,6 +64,7 @@ GuiParagraph::GuiParagraph(GuiView & lv)
        // foreground and are hidden when the main window is not focused.
        setWindowFlags(Qt::Tool);
        synchronizedViewCB->setChecked(true);
+       closePB->setText(qt_("&Cancel"));
 #else
        synchronizedViewCB->setChecked(false);
 #endif
@@ -151,6 +152,11 @@ void GuiParagraph::on_synchronizedViewCB_toggled()
        bool in_sync = synchronizedViewCB->isChecked();
        restorePB->setEnabled(!in_sync);
        applyPB->setEnabled(!in_sync);
+       okPB->setEnabled(!in_sync);
+       if (!in_sync)
+               closePB->setText(qt_("&Cancel"));
+       else
+               closePB->setText(qt_("&Close"));
 }
 
 
@@ -162,6 +168,31 @@ void GuiParagraph::changed()
 
 
 void GuiParagraph::on_applyPB_clicked()
+{
+       applyView();
+}
+
+
+void GuiParagraph::on_okPB_clicked()
+{
+       applyView();
+       hide();
+}
+
+
+void GuiParagraph::on_closePB_clicked()
+{
+       hide();
+}
+
+
+void GuiParagraph::on_restorePB_clicked()
+{
+       updateView();
+}
+
+
+void GuiParagraph::applyView()
 {
        ParagraphParameters & pp = params();
 
@@ -201,12 +232,6 @@ void GuiParagraph::on_applyPB_clicked()
 }
 
 
-void GuiParagraph::on_restorePB_clicked()
-{
-       updateView();
-}
-
-
 void GuiParagraph::updateView()
 {
        on_synchronizedViewCB_toggled();
index 949fcc868bee6d46d5d4f471e9cd1ff4a1ff2871..328acfe54763f947e8ded3793a4bb653cfaf7dcb 100644 (file)
@@ -41,6 +41,7 @@ public:
 
        /// Dialog inherited methods
        //@{
+       void applyView();
        void updateView();
        void dispatchParams();
        void enableView(bool enable);
@@ -79,6 +80,10 @@ private Q_SLOTS:
        void on_linespacing_activated(int);
        /// Apply changes
        void on_applyPB_clicked();
+       /// Apply changes and close
+       void on_okPB_clicked();
+       /// Close/Cancel dialog
+       void on_closePB_clicked();
 
 private:
        ///
index eeb03e5dd96691674875a29580cd10b1ef1d8beb..5916f36aa085eae209abd2fa68ae31f97158b86a 100644 (file)
@@ -5,8 +5,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>310</width>
-    <height>201</height>
+    <width>375</width>
+    <height>241</height>
    </rect>
   </property>
   <property name="focusPolicy" >
    <property name="spacing" >
     <number>6</number>
    </property>
-   <item row="2" column="0" >
-    <widget class="QCheckBox" name="indentCB" >
+   <item rowspan="2" row="3" column="0" >
+    <spacer>
+     <property name="orientation" >
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="sizeHint" >
+      <size>
+       <width>231</width>
+       <height>20</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item row="4" column="2" >
+    <widget class="QCheckBox" name="synchronizedViewCB" >
+     <property name="layoutDirection" >
+      <enum>Qt::RightToLeft</enum>
+     </property>
      <property name="text" >
-      <string>&amp;Indent Paragraph</string>
+      <string>I&amp;mmediate Apply</string>
      </property>
     </widget>
    </item>
-   <item row="1" column="0" >
-    <widget class="QGroupBox" name="labelwidthGB" >
-     <property name="enabled" >
-      <bool>false</bool>
+   <item row="5" column="0" colspan="3" >
+    <layout class="QHBoxLayout" >
+     <property name="margin" >
+      <number>0</number>
+     </property>
+     <property name="spacing" >
+      <number>6</number>
      </property>
+     <item>
+      <widget class="QPushButton" name="restorePB" >
+       <property name="text" >
+        <string>&amp;Restore</string>
+       </property>
+       <property name="autoDefault" >
+        <bool>false</bool>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <spacer>
+       <property name="orientation" >
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeHint" >
+        <size>
+         <width>31</width>
+         <height>27</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+     <item>
+      <widget class="QPushButton" name="okPB" >
+       <property name="text" >
+        <string>&amp;OK</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QPushButton" name="applyPB" >
+       <property name="text" >
+        <string>&amp;Apply</string>
+       </property>
+       <property name="autoDefault" >
+        <bool>false</bool>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QPushButton" name="closePB" >
+       <property name="text" >
+        <string>&amp;Close</string>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+   <item rowspan="4" row="0" column="1" colspan="2" >
+    <widget class="QGroupBox" name="aligmentGB" >
      <property name="title" >
-      <string>Label Width</string>
+      <string>Alignment</string>
      </property>
      <property name="flat" >
       <bool>true</bool>
       <property name="spacing" >
        <number>6</number>
       </property>
-      <item row="0" column="1" >
-       <widget class="QLineEdit" name="labelWidth" >
+      <item row="0" column="0" >
+       <widget class="QRadioButton" name="alignDefaultRB" >
         <property name="toolTip" >
-         <string>This text defines the width of the paragraph label</string>
+         <string>Use the default alignment for this paragraph, whatever it is.</string>
+        </property>
+        <property name="text" >
+         <string>Paragraph's &amp;Default</string>
         </property>
        </widget>
       </item>
-      <item row="0" column="0" >
-       <widget class="QLabel" name="TextLabel2" >
-        <property name="toolTip" >
-         <string>This text defines the width of the paragraph label</string>
+      <item row="4" column="0" >
+       <widget class="QRadioButton" name="alignRightRB" >
+        <property name="text" >
+         <string>Ri&amp;ght</string>
         </property>
+       </widget>
+      </item>
+      <item row="3" column="0" >
+       <widget class="QRadioButton" name="alignCenterRB" >
         <property name="text" >
-         <string>Lo&amp;ngest label</string>
+         <string>C&amp;enter</string>
         </property>
-        <property name="buddy" >
-         <cstring>labelWidth</cstring>
+       </widget>
+      </item>
+      <item row="2" column="0" >
+       <widget class="QRadioButton" name="alignLeftRB" >
+        <property name="text" >
+         <string>&amp;Left</string>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="0" >
+       <widget class="QRadioButton" name="alignJustRB" >
+        <property name="text" >
+         <string>&amp;Justified</string>
         </property>
        </widget>
       </item>
      </layout>
     </widget>
    </item>
-   <item rowspan="3" row="0" column="1" >
-    <widget class="QGroupBox" name="aligmentGB" >
+   <item row="2" column="0" >
+    <widget class="QCheckBox" name="indentCB" >
+     <property name="text" >
+      <string>&amp;Indent Paragraph</string>
+     </property>
+    </widget>
+   </item>
+   <item row="1" column="0" >
+    <widget class="QGroupBox" name="labelwidthGB" >
+     <property name="enabled" >
+      <bool>false</bool>
+     </property>
      <property name="title" >
-      <string>Alignment</string>
+      <string>Label Width</string>
      </property>
      <property name="flat" >
       <bool>true</bool>
       <property name="spacing" >
        <number>6</number>
       </property>
-      <item row="0" column="0" >
-       <widget class="QRadioButton" name="alignDefaultRB" >
-        <property name="font" >
-         <font>
-          <family>MS Shell Dlg 2</family>
-          <pointsize>8</pointsize>
-          <weight>50</weight>
-          <italic>false</italic>
-          <bold>false</bold>
-          <underline>false</underline>
-          <strikeout>false</strikeout>
-         </font>
-        </property>
+      <item row="0" column="1" >
+       <widget class="QLineEdit" name="labelWidth" >
         <property name="toolTip" >
-         <string>Use the default alignment for this paragraph, whatever it is.</string>
-        </property>
-        <property name="text" >
-         <string>Paragraph's &amp;Default</string>
-        </property>
-       </widget>
-      </item>
-      <item row="1" column="0" >
-       <widget class="QRadioButton" name="alignJustRB" >
-        <property name="text" >
-         <string>&amp;Justified</string>
+         <string>This text defines the width of the paragraph label</string>
         </property>
        </widget>
       </item>
-      <item row="2" column="0" >
-       <widget class="QRadioButton" name="alignLeftRB" >
-        <property name="text" >
-         <string>&amp;Left</string>
+      <item row="0" column="0" >
+       <widget class="QLabel" name="TextLabel2" >
+        <property name="toolTip" >
+         <string>This text defines the width of the paragraph label</string>
         </property>
-       </widget>
-      </item>
-      <item row="3" column="0" >
-       <widget class="QRadioButton" name="alignCenterRB" >
         <property name="text" >
-         <string>&amp;Center</string>
+         <string>Lo&amp;ngest label</string>
         </property>
-       </widget>
-      </item>
-      <item row="4" column="0" >
-       <widget class="QRadioButton" name="alignRightRB" >
-        <property name="text" >
-         <string>Ri&amp;ght</string>
+        <property name="buddy" >
+         <cstring>labelWidth</cstring>
         </property>
        </widget>
       </item>
      </layout>
     </widget>
    </item>
-   <item row="3" column="0" colspan="2" >
-    <layout class="QHBoxLayout" >
-     <property name="margin" >
-      <number>0</number>
-     </property>
-     <property name="spacing" >
-      <number>6</number>
-     </property>
-     <item>
-      <widget class="QPushButton" name="restorePB" >
-       <property name="text" >
-        <string>&amp;Restore</string>
-       </property>
-       <property name="autoDefault" >
-        <bool>false</bool>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <spacer>
-       <property name="orientation" >
-        <enum>Qt::Horizontal</enum>
-       </property>
-       <property name="sizeHint" >
-        <size>
-         <width>40</width>
-         <height>20</height>
-        </size>
-       </property>
-      </spacer>
-     </item>
-     <item>
-      <widget class="QCheckBox" name="synchronizedViewCB" >
-       <property name="layoutDirection" >
-        <enum>Qt::RightToLeft</enum>
-       </property>
-       <property name="text" >
-        <string>I&amp;mmediate Apply</string>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <widget class="QPushButton" name="applyPB" >
-       <property name="text" >
-        <string>&amp;Apply</string>
-       </property>
-       <property name="autoDefault" >
-        <bool>false</bool>
-       </property>
-      </widget>
-     </item>
-    </layout>
-   </item>
   </layout>
  </widget>
  <tabstops>