#include "support/gettext.h"
#include "support/lstrings.h"
+#include <QDialogButtonBox>
#include <QPushButton>
#include <QListWidget>
#include <QCheckBox>
QDialog::setModal(true);
setWindowModality(Qt::WindowModal);
- connect(okPB, SIGNAL(clicked()),
- this, SLOT(slotOK()));
- connect(closePB, SIGNAL(clicked()),
- this, SLOT(slotClose()));
+ connect(buttonBox, SIGNAL(clicked(QAbstractButton *)),
+ this, SLOT(slotButtonBox(QAbstractButton *)));
connect(stylePB, SIGNAL(clicked()),
this, SLOT(browsePressed()));
connect(deletePB, SIGNAL(clicked()),
add_ = new GuiBibtexAddDialog(this);
add_bc_.setPolicy(ButtonPolicy::OkCancelPolicy);
- add_bc_.setOK(add_->addPB);
- add_bc_.setCancel(add_->closePB);
+ add_bc_.setOK(add_->buttonBox->button(QDialogButtonBox::Ok));
+ add_bc_.setCancel(add_->buttonBox->button(QDialogButtonBox::Cancel));
add_bc_.addCheckedLineEdit(add_->bibED, 0);
connect(add_->bibED, SIGNAL(textChanged(QString)),
this, SLOT(bibEDChanged()));
- connect(add_->addPB, SIGNAL(clicked()),
- this, SLOT(addDatabase()));
- connect(add_->addPB, SIGNAL(clicked()),
- add_, SLOT(accept()));
+ connect(add_->buttonBox, SIGNAL(clicked(QAbstractButton *)),
+ this, SLOT(addBBClicked(QAbstractButton *)));
connect(add_->rescanPB, SIGNAL(clicked()),
this, SLOT(rescanClicked()));
connect(add_->bibLW, SIGNAL(itemActivated(QListWidgetItem *)),
this, SLOT(availableChanged()));
connect(add_->browsePB, SIGNAL(clicked()),
this, SLOT(browseBibPressed()));
- connect(add_->closePB, SIGNAL(clicked()),
- add_, SLOT(reject()));
add_->bibLW->setToolTip(formatToolTip(qt_("This list consists of all databases that are indexed by LaTeX and thus are found without a file path. "
"This is usually everything in the bib/ subdirectory of LaTeX's texmf tree. "
"If you want to reuse your own database, this is the place you should store it.")));
bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy);
- bc().setOK(okPB);
- bc().setCancel(closePB);
+ bc().setOK(buttonBox->button(QDialogButtonBox::Ok));
+ bc().setApply(buttonBox->button(QDialogButtonBox::Apply));
+ bc().setCancel(buttonBox->button(QDialogButtonBox::Cancel));
bc().addReadOnly(databaseLW);
bc().addReadOnly(stylePB);
bc().addReadOnly(styleCB);
}
+void GuiBibtex::addBBClicked(QAbstractButton * button)
+{
+ switch (add_->buttonBox->standardButton(button)) {
+ case QDialogButtonBox::Ok:
+ addDatabase();
+ add_->accept();
+ break;
+ case QDialogButtonBox::Cancel:
+ add_->reject();
+ break;
+ default:
+ break;
+ }
+}
+
+
void GuiBibtex::bibEDChanged()
{
// Indicate to the button controller that the contents have
biblatexOptsLE->setVisible(biblatex);
// only useful for BibTeX
- styleCB->setVisible(!biblatex);
- styleLA->setVisible(!biblatex);
- stylePB->setVisible(!biblatex);
+ bstGB->setVisible(!biblatex);
if (!biblatex) {
styleCB->clear();