/**
* \file QTexinfoDialog.C
- * Copyright 2002 the LyX Team
- * Read the file COPYING
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
*
- * \author Edwin Leuven <leuven@fee.uva.nl>
+ * \author Edwin Leuven
+ *
+ * Full author contact details are available in file CREDITS
*/
#include <config.h>
-#include <vector>
-#include "LString.h"
-
-#include "ControlTexinfo.h"
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+#include "LString.h"
+
+#include "ControlTexinfo.h"
#include "QTexinfoDialog.h"
-#include "Dialogs.h"
#include "QTexinfo.h"
#include <qlistbox.h>
#include <qpushbutton.h>
#include <qcombobox.h>
+#include <vector>
+
+
QTexinfoDialog::QTexinfoDialog(QTexinfo * form)
: QTexinfoDialogBase(0, 0, false, 0),
form_(form)
form, SLOT(slotClose()));
}
-
+
void QTexinfoDialog::change_adaptor()
{
form_->changed();
}
-
+
void QTexinfoDialog::closeEvent(QCloseEvent * e)
{
form_->slotWMHide();
e->accept();
}
-void QTexinfoDialog::helpClicked()
-{
- form_->controller().help();
-}
void QTexinfoDialog::rescanClicked()
{
// build new *Files.lst
form_->controller().rescanStyles();
form_->updateStyles();
+ enableViewPB();
}
+
void QTexinfoDialog::viewClicked()
{
- string const sel(fileList->currentText());
+ int const fitem = fileList->currentItem();
+
+ string sel;
+ switch (whatStyle->currentItem()) {
+ case 0:
+ sel = form_->cls_[fitem];
+ break;
+ case 1:
+ sel = form_->sty_[fitem];
+ break;
+ case 2:
+ sel = form_->bst_[fitem];
+ break;
+ default:
+ break;
+ }
+
// a valid entry?
if (!sel.empty()) {
form_->controller().viewFile(sel.c_str());
}
}
+
void QTexinfoDialog::update()
{
- int item = whatStyle->currentItem();
-
- switch (item) {
+ switch (whatStyle->currentItem()) {
case 0:
form_->updateStyles(ControlTexinfo::cls);
break;
default:
break;
}
-
+
+ enableViewPB();
+}
+
+
+void QTexinfoDialog::enableViewPB()
+{
+ viewPB->setEnabled(fileList->currentItem() > -1);
}