]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiCompare.cpp
QDialogButtonBox for the remaining dialogs.
[lyx.git] / src / frontends / qt4 / GuiCompare.cpp
index 4ea7f3578440668e2a052a964f5b50d553db86f9..d282df95263ae6c568d7e05ef026113ed7f65928 100644 (file)
@@ -29,6 +29,7 @@
 #include "support/FileName.h"
 #include "support/gettext.h"
 
+#include <QDialogButtonBox>
 #include <QThread>
 
 
@@ -46,8 +47,8 @@ GuiCompare::GuiCompare(GuiView & lv)
        setupUi(this);
        setModal(Qt::WindowModal);
 
-       connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
-       connect(closePB, SIGNAL(clicked()), this, SLOT(slotCancel()));
+       connect(buttonBox, SIGNAL(clicked(QAbstractButton *)),
+               this, SLOT(slotButtonBox(QAbstractButton *)));
 
        connect(newFilePB, SIGNAL(clicked()), this, SLOT(selectNewFile()));
        connect(oldFilePB, SIGNAL(clicked()), this, SLOT(selectOldFile()));
@@ -64,10 +65,10 @@ GuiCompare::GuiCompare(GuiView & lv)
        newSettingsRB->setChecked(true);
        trackingCB->setChecked(true);
 
-       closePB->setCursor(Qt::ArrowCursor);
+       buttonBox->button(QDialogButtonBox::Ok)->setCursor(Qt::ArrowCursor);
 
        bc().setPolicy(ButtonPolicy::OkApplyCancelPolicy);
-       bc().setOK(okPB);
+       bc().setOK(buttonBox->button(QDialogButtonBox::Ok));
 }
 
 GuiCompare::~GuiCompare()
@@ -159,11 +160,11 @@ QString GuiCompare::browse(QString const & in_name) const
        if (lyxview().documentBufferView()) {
                QString path = bufferFilePath();
                filename = browseRelToParent(in_name, path, title, filters, false,
-                       qt_("Documents|#o#O"), toqstr(lyxrc.document_path));
+                       qt_("D&ocuments"), toqstr(lyxrc.document_path));
        } else {
                QString path = toqstr(lyxrc.document_path);
                QString rel_filename = browseRelToParent(in_name, path, title, filters, false,
-                       qt_("Documents|#o#O"), toqstr(lyxrc.document_path));
+                       qt_("D&ocuments"), toqstr(lyxrc.document_path));
                filename = makeAbsPath(rel_filename, path);
        }
        return filename;
@@ -182,14 +183,14 @@ void GuiCompare::enableControls(bool enable)
        oldFileLA->setEnabled(enable);
        oldFilePB->setEnabled(enable);
        oldFileCB->setEnabled(enable);
-       okPB->setEnabled(enable);
+       buttonBox->button(QDialogButtonBox::Ok)->setEnabled(enable);
        groupBox->setEnabled(enable);
        progressBar->setEnabled(!enable);
 
        if (enable)
-               closePB->setText(qt_("Close"));
+               buttonBox->button(QDialogButtonBox::Cancel)->setText(qt_("Close"));
        else
-               closePB->setText(qt_("Cancel"));
+               buttonBox->button(QDialogButtonBox::Cancel)->setText(qt_("Cancel"));
 }
 
 
@@ -270,6 +271,21 @@ void GuiCompare::slotCancel()
 }
 
 
+void GuiCompare::slotButtonBox(QAbstractButton * button)
+{
+       switch (buttonBox->standardButton(button)) {
+       case QDialogButtonBox::Ok:
+               slotOK();
+               break;
+       case QDialogButtonBox::Cancel:
+               slotCancel();
+               break;
+       default:
+               break;
+       }
+}
+
+
 Buffer const * GuiCompare::bufferFromFileName(string const & file) const
 {
        FileName fname;