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