Fix bug 4656 (OK and Cancel buttons for Paragraph dialog).

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24364 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2008-04-19 16:56:40 +00:00
parent 879e7c8b84
commit 6790221b2b
3 changed files with 174 additions and 128 deletions

View 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();

View 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:
///

View 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" >
@ -22,6 +22,142 @@
<property name="spacing" >
<number>6</number>
</property>
<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>I&amp;mmediate Apply</string>
</property>
</widget>
</item>
<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>Alignment</string>
</property>
<property name="flat" >
<bool>true</bool>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="0" column="0" >
<widget class="QRadioButton" name="alignDefaultRB" >
<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="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>C&amp;enter</string>
</property>
</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 row="2" column="0" >
<widget class="QCheckBox" name="indentCB" >
<property name="text" >
@ -70,73 +206,6 @@
</layout>
</widget>
</item>
<item rowspan="3" row="0" column="1" >
<widget class="QGroupBox" name="aligmentGB" >
<property name="title" >
<string>Alignment</string>
</property>
<property name="flat" >
<bool>true</bool>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>9</number>
</property>
<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>
<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>
</property>
</widget>
</item>
<item row="2" column="0" >
<widget class="QRadioButton" name="alignLeftRB" >
<property name="text" >
<string>&amp;Left</string>
</property>
</widget>
</item>
<item row="3" column="0" >
<widget class="QRadioButton" name="alignCenterRB" >
<property name="text" >
<string>&amp;Center</string>
</property>
</widget>
</item>
<item row="4" column="0" >
<widget class="QRadioButton" name="alignRightRB" >
<property name="text" >
<string>Ri&amp;ght</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="0" >
<widget class="QGroupBox" name="groupBox" >
<property name="title" >
@ -191,59 +260,6 @@
</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>