mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-13 01:08:45 +00:00
Fix bug 1272 and return relative paths from the file browser if appropriate.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_3_X@9969 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
01bf55b4db
commit
8808781520
@ -1,3 +1,12 @@
|
||||
2005-05-24 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* ControlBibtex.C (browseBib, browseBst): backport 1.4.x code
|
||||
that defines separate interfaces to the file browser for
|
||||
.bib and .bst files.
|
||||
|
||||
* ControlExternal.C (Browse): remove hack that adds a '|' to the
|
||||
list of filters.
|
||||
|
||||
2005-05-23 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* helper_funcs.[Ch] (browseFile, browseRelFile, browseDir): add
|
||||
|
@ -54,14 +54,22 @@ void ControlBibtex::applyParamsNoInset()
|
||||
{}
|
||||
|
||||
|
||||
string const ControlBibtex::Browse(string const & in_name,
|
||||
string const & title,
|
||||
string const & pattern)
|
||||
string const ControlBibtex::browseBib(string const & in_name) const
|
||||
{
|
||||
pair<string, string> dir1(_("Documents|#o#O"),
|
||||
string(lyxrc.document_path));
|
||||
return browseRelFile(&lv_, true, in_name, buffer()->filePath(),
|
||||
title, pattern, false, dir1);
|
||||
_("Select a BibTeX database to add"),
|
||||
"*.bib", false, dir1);
|
||||
}
|
||||
|
||||
|
||||
string const ControlBibtex::browseBst(string const & in_name) const
|
||||
{
|
||||
pair<string, string> dir1(_("Documents|#o#O"),
|
||||
string(lyxrc.document_path));
|
||||
return browseRelFile(&lv_, true, in_name, buffer()->filePath(),
|
||||
_("Select a BibTeX style"), "*.bst", false, dir1);
|
||||
}
|
||||
|
||||
|
||||
|
@ -21,8 +21,10 @@ class ControlBibtex : public ControlCommand {
|
||||
public:
|
||||
///
|
||||
ControlBibtex(LyXView &, Dialogs &);
|
||||
/// Browse for a file
|
||||
string const Browse(string const &, string const &, string const &);
|
||||
/// Browse for a .bib file
|
||||
std::string const browseBib(std::string const & in_name) const;
|
||||
/// Browse for a .bst file
|
||||
std::string const browseBst(std::string const & in_name) const;
|
||||
/// get the list of bst files
|
||||
string const getBibStyles() const;
|
||||
/// build filelists of all availabe bst/cls/sty-files. done through
|
||||
|
@ -144,9 +144,6 @@ string const ControlExternal::Browse(string const & input) const
|
||||
if (pattern.empty())
|
||||
pattern = "*";
|
||||
|
||||
// FIXME: a temporary hack until the FileDialog interface is updated
|
||||
pattern += '|';
|
||||
|
||||
std::pair<string, string> dir1(N_("Documents|#o#O"),
|
||||
string(lyxrc.document_path));
|
||||
|
||||
|
@ -1,3 +1,11 @@
|
||||
2005-05-24 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* QExternalDialog.C (browseClicked):
|
||||
* QBibtexDialog.C (browsePressed, browseBibPressed):
|
||||
* QLPrintDialog.C (browseClicked):
|
||||
backport 1.4.x code to use the controller's browse member function
|
||||
rather than QFileDialog::getOpenFileName
|
||||
|
||||
2005-05-12 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
|
||||
|
||||
* QTabularDialog.C: Fix handling of longtabular lfuns.
|
||||
|
@ -50,39 +50,35 @@ void QBibtexDialog::change_adaptor()
|
||||
|
||||
void QBibtexDialog::browsePressed()
|
||||
{
|
||||
QString const file =
|
||||
QFileDialog::getOpenFileName(QString::null,
|
||||
qt_("BibTeX style files (*.bst)"),
|
||||
this,
|
||||
0,
|
||||
qt_("Select a BibTeX style"));
|
||||
if (!file.isNull()) {
|
||||
string const filen = ChangeExtension(fromqstr(file), "");
|
||||
bool present = false;
|
||||
int pres = 0;
|
||||
string const file = form_->controller().browseBst("");
|
||||
|
||||
for (unsigned int i = 0; i != styleCB->count(); i++) {
|
||||
if (!file.empty()) {
|
||||
string const filen = ChangeExtension(file, "");
|
||||
bool present = false;
|
||||
unsigned int pres = 0;
|
||||
|
||||
for (int i = 0; i != styleCB->count(); ++i) {
|
||||
if (fromqstr(styleCB->text(i)) == filen) {
|
||||
present = true;
|
||||
pres = i;
|
||||
}
|
||||
}
|
||||
|
||||
if (!present)
|
||||
if (!present)
|
||||
styleCB->insertItem(toqstr(filen),0);
|
||||
|
||||
|
||||
styleCB->setCurrentItem(pres);
|
||||
form_->changed();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void QBibtexDialog::browseBibPressed()
|
||||
{
|
||||
QString const file = QFileDialog::getOpenFileName(QString::null,
|
||||
qt_("BibTeX database files (*.bib)"), this, 0, qt_("Select a BibTeX database to add"));
|
||||
string const file = form_->controller().browseBib("");
|
||||
|
||||
if (!file.isNull()) {
|
||||
string const f = ChangeExtension(fromqstr(file), "");
|
||||
if (!file.empty()) {
|
||||
string const f = ChangeExtension(file, "");
|
||||
bool present = false;
|
||||
|
||||
for (unsigned int i = 0; i != databaseLB->count(); i++) {
|
||||
@ -94,9 +90,12 @@ void QBibtexDialog::browseBibPressed()
|
||||
databaseLB->insertItem(toqstr(f));
|
||||
form_->changed();
|
||||
}
|
||||
|
||||
addBibED->setText(toqstr(f));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void QBibtexDialog::addPressed()
|
||||
{
|
||||
QString const file = addBibED->text();
|
||||
|
@ -15,7 +15,6 @@
|
||||
|
||||
#include <qwidget.h>
|
||||
#include <qpushbutton.h>
|
||||
#include <qfiledialog.h>
|
||||
#include <qcombobox.h>
|
||||
#include <qtextview.h>
|
||||
#include <qlineedit.h>
|
||||
@ -80,13 +79,10 @@ void QExternalDialog::updateClicked()
|
||||
|
||||
void QExternalDialog::browseClicked()
|
||||
{
|
||||
QString file =
|
||||
QFileDialog::getOpenFileName(QString::null,
|
||||
qt_("External material (*)"),
|
||||
this, 0,
|
||||
qt_("Select external material"));
|
||||
if (!file.isNull()) {
|
||||
fileED->setText(file);
|
||||
string const str =
|
||||
form_->controller().Browse(fromqstr(fileED->text()));
|
||||
if (!str.empty()) {
|
||||
fileED->setText(toqstr(str));
|
||||
form_->changed();
|
||||
}
|
||||
}
|
||||
|
@ -88,8 +88,10 @@ void QGraphicsDialog::browse_clicked()
|
||||
{
|
||||
string const str =
|
||||
form_->controller().Browse(fromqstr(filename->text()));
|
||||
filename->setText(toqstr(str));
|
||||
form_->changed();
|
||||
if (!str.empty()) {
|
||||
filename->setText(toqstr(str));
|
||||
form_->changed();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -11,9 +11,9 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "controllers/ControlPrint.h"
|
||||
#include "qt_helpers.h"
|
||||
#include "support/filetools.h"
|
||||
#include "support/lstrings.h"
|
||||
|
||||
#include "QPrint.h"
|
||||
#include "QLPrintDialog.h"
|
||||
@ -46,13 +46,9 @@ void QLPrintDialog::change_adaptor()
|
||||
|
||||
void QLPrintDialog::browseClicked()
|
||||
{
|
||||
QString file =
|
||||
QFileDialog::getOpenFileName(QString::null,
|
||||
qt_("PostScript files (*.ps)"),
|
||||
this, 0,
|
||||
qt_("Select a file to print to"));
|
||||
if (!file.isNull()) {
|
||||
fileED->setText(file);
|
||||
string const file = form_->controller().Browse("");
|
||||
if (!file.empty()) {
|
||||
fileED->setText(toqstr(file));
|
||||
form_->changed();
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,8 @@
|
||||
2005-05-24 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* FormBibtex.C (input): use the broseBib() and browseBst() functions
|
||||
in the controller, backported from 1.4.x.
|
||||
|
||||
2005-05-09 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* FormPreferences.C (SpellOptions::build): disable the
|
||||
|
@ -100,10 +100,7 @@ ButtonPolicy::SMInput FormBibtex::input(FL_OBJECT * ob, long)
|
||||
if (ob == dialog_->button_database_browse) {
|
||||
// When browsing, take the first file only
|
||||
string const in_name = getString(dialog_->input_database);
|
||||
string out_name =
|
||||
controller().Browse("",
|
||||
_("Select Database"),
|
||||
_("*.bib| BibTeX Databases (*.bib)"));
|
||||
string out_name = controller().browseBib("");
|
||||
if (!out_name.empty()) {
|
||||
// add the database to any existing ones
|
||||
if (!in_name.empty())
|
||||
@ -114,9 +111,7 @@ ButtonPolicy::SMInput FormBibtex::input(FL_OBJECT * ob, long)
|
||||
|
||||
} else if (ob == dialog_->button_style_browse) {
|
||||
string const in_name = getString(dialog_->input_style);
|
||||
string const style = controller().Browse(in_name,
|
||||
_("Select BibTeX-Style"),
|
||||
_("*.bst| BibTeX Styles (*.bst)"));
|
||||
string const style = controller().browseBst(in_name);
|
||||
if (!style.empty()) {
|
||||
fl_set_input(dialog_->input_style, style.c_str());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user