2006-03-05 17:24:44 +00:00
|
|
|
/**
|
|
|
|
* \file QShowFile.C
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
|
|
|
* \author John Levon
|
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#include "QShowFile.h"
|
|
|
|
#include "QShowFileDialog.h"
|
|
|
|
#include "Qt2BC.h"
|
|
|
|
#include "qt_helpers.h"
|
|
|
|
|
|
|
|
#include "controllers/ControlShowFile.h"
|
|
|
|
|
2006-05-04 07:31:46 +00:00
|
|
|
#include <QTextBrowser>
|
|
|
|
#include <QPushButton>
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
using std::string;
|
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
namespace frontend {
|
|
|
|
|
|
|
|
typedef QController<ControlShowFile, QView<QShowFileDialog> > base_class;
|
|
|
|
|
|
|
|
|
|
|
|
QShowFile::QShowFile(Dialog & parent)
|
2006-09-09 15:27:44 +00:00
|
|
|
: base_class(parent, lyx::to_utf8(_("Show File")))
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QShowFile::build_dialog()
|
|
|
|
{
|
|
|
|
dialog_.reset(new QShowFileDialog(this));
|
|
|
|
|
|
|
|
bcview().setCancel(dialog_->closePB);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QShowFile::update_contents()
|
|
|
|
{
|
2006-08-17 08:59:28 +00:00
|
|
|
dialog_->setWindowTitle(toqstr(controller().getFileName()));
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
string contents = controller().getFileContents();
|
|
|
|
if (contents.empty()) {
|
|
|
|
contents = "Error -> Cannot load file!";
|
|
|
|
}
|
|
|
|
|
2006-05-04 07:31:46 +00:00
|
|
|
dialog_->textTB->setPlainText(toqstr(contents));
|
2006-03-05 17:24:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace frontend
|
|
|
|
} // namespace lyx
|