From b08540d0d8d78151f1bc75cfe57f0f7790e7e84a Mon Sep 17 00:00:00 2001 From: Bo Peng Date: Tue, 7 Aug 2007 18:37:33 +0000 Subject: [PATCH] Fix loading non-lyx child documents with relative path names, change Load to Edit in the child document dialog. (Bug 4107 and 4111) git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_5_X@19345 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/controllers/ControlInclude.cpp | 6 ++++-- src/frontends/controllers/ControlInclude.h | 5 +++-- src/frontends/qt4/QInclude.cpp | 10 +++++----- src/frontends/qt4/QInclude.h | 7 ++++--- src/frontends/qt4/ui/IncludeUi.ui | 8 ++++---- status.15x | 3 +++ 6 files changed, 23 insertions(+), 16 deletions(-) diff --git a/src/frontends/controllers/ControlInclude.cpp b/src/frontends/controllers/ControlInclude.cpp index c5a6b94e40..c42c98eded 100644 --- a/src/frontends/controllers/ControlInclude.cpp +++ b/src/frontends/controllers/ControlInclude.cpp @@ -100,14 +100,16 @@ docstring const ControlInclude::browse(docstring const & in_name, Type in_type) } -void ControlInclude::load(string const & file) +void ControlInclude::edit(string const & file) { string const ext = support::getExtension(file); if (ext == "lyx") kernel().dispatch(FuncRequest(LFUN_BUFFER_CHILD_OPEN, file)); else // tex file or other text file in verbatim mode - formats.edit(kernel().buffer(), FileName(file), "text"); + formats.edit(kernel().buffer(), + FileName(makeAbsPath(file, onlyPath(kernel().buffer().fileName()))), + "text"); } diff --git a/src/frontends/controllers/ControlInclude.h b/src/frontends/controllers/ControlInclude.h index 441eff069e..955321de18 100644 --- a/src/frontends/controllers/ControlInclude.h +++ b/src/frontends/controllers/ControlInclude.h @@ -58,8 +58,9 @@ public: /// Browse for a file docstring const browse(docstring const &, Type) const; - /// load a file - void load(std::string const & file); + /// edit the child document, .lyx file will be opened in lyx + /// other formats will be edited by external applications. + void edit(std::string const & file); /// test if file exist bool fileExists(std::string const & file); diff --git a/src/frontends/qt4/QInclude.cpp b/src/frontends/qt4/QInclude.cpp index 9908edd344..d82284583d 100644 --- a/src/frontends/qt4/QInclude.cpp +++ b/src/frontends/qt4/QInclude.cpp @@ -56,7 +56,7 @@ QIncludeDialog::QIncludeDialog(QInclude * form) connect(visiblespaceCB, SIGNAL(clicked()), this, SLOT(change_adaptor())); connect(filenameED, SIGNAL(textChanged(const QString &)), this, SLOT(change_adaptor())); - connect(loadPB, SIGNAL(clicked()), this, SLOT(loadClicked())); + connect(editPB, SIGNAL(clicked()), this, SLOT(editClicked())); connect(browsePB, SIGNAL(clicked()), this, SLOT(browseClicked())); connect(typeCO, SIGNAL(activated(int)), this, SLOT(change_adaptor())); connect(typeCO, SIGNAL(activated(int)), this, SLOT(typeChanged(int))); @@ -168,9 +168,9 @@ void QIncludeDialog::typeChanged(int v) } -void QIncludeDialog::loadClicked() +void QIncludeDialog::editClicked() { - form_->load(); + form_->edit(); } @@ -336,12 +336,12 @@ void QInclude::browse() } -void QInclude::load() +void QInclude::edit() { if (isValid()) { string const file = fromqstr(dialog_->filenameED->text()); slotOK(); - controller().load(file); + controller().edit(file); } } diff --git a/src/frontends/qt4/QInclude.h b/src/frontends/qt4/QInclude.h index 6d4a3ba09f..9381d114d8 100644 --- a/src/frontends/qt4/QInclude.h +++ b/src/frontends/qt4/QInclude.h @@ -35,7 +35,7 @@ public: docstring validate_listings_params(); protected Q_SLOTS: virtual void change_adaptor(); - virtual void loadClicked(); + virtual void editClicked(); virtual void browseClicked(); virtual void typeChanged(int v); /// AFAIK, QValidator only works for QLineEdit so @@ -70,8 +70,9 @@ private: /// build the dialog virtual void build_dialog(); - /// load the file - void load(); + /// edit the child document, .lyx file will be opened in lyx + /// other formats will be edited by external applications. + void edit(); /// browse for a file void browse(); diff --git a/src/frontends/qt4/ui/IncludeUi.ui b/src/frontends/qt4/ui/IncludeUi.ui index b35ad813d5..6a9054cb0a 100644 --- a/src/frontends/qt4/ui/IncludeUi.ui +++ b/src/frontends/qt4/ui/IncludeUi.ui @@ -331,12 +331,12 @@ - + - Load the file + Edit the file - &Load + &Edit @@ -346,7 +346,7 @@ filenameED browsePB typeCO - loadPB + editPB visiblespaceCB previewCB captionLE diff --git a/status.15x b/status.15x index 4143fd4ff0..de5a3f2ed6 100644 --- a/status.15x +++ b/status.15x @@ -38,6 +38,9 @@ What's new * USER INTERFACE: +- Fix loading non-lyx child documents with relative path names, change + 'Load' to 'Edit' in the child document dialog. (Bug 4107 and 4111) + * DOCUMENTATION