]> git.lyx.org Git - features.git/commitdiff
Fix loading non-lyx child documents with relative path names, change 'Load' to 'Edit...
authorBo Peng <bpeng@lyx.org>
Tue, 7 Aug 2007 18:39:34 +0000 (18:39 +0000)
committerBo Peng <bpeng@lyx.org>
Tue, 7 Aug 2007 18:39:34 +0000 (18:39 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19346 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/controllers/ControlInclude.cpp
src/frontends/controllers/ControlInclude.h
src/frontends/qt4/QInclude.cpp
src/frontends/qt4/QInclude.h
src/frontends/qt4/ui/IncludeUi.ui

index c5a6b94e4058190c14185b9d40eba634389c367e..c42c98eded3e60e609664cc701085f59f0bc95a4 100644 (file)
@@ -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");
 }
 
 
index 441eff069e1ab91ee80a6bff7ce2a8c844e4ff4d..955321de185e83a8dbad9b341a039158218c6818 100644 (file)
@@ -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);
index 9908edd3442930fa26460a0753461d88a3858342..d82284583d635804d043364e641b3128ec462650 100644 (file)
@@ -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);
        }
 }
 
index 6d4a3ba09f6707c0162fe6fbbfa492a6849b1e59..9381d114d85285bd5d26a64d75598eddbc84bbb1 100644 (file)
@@ -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();
index b35ad813d54678a22a1486978b8297ca92ad4eb3..6a9054cb0a822b68dee2513dd323eecbfa851627 100644 (file)
     </widget>
    </item>
    <item row="1" column="4" >
-    <widget class="QPushButton" name="loadPB" >
+    <widget class="QPushButton" name="editPB" >
      <property name="toolTip" >
-      <string>Load the file</string>
+      <string>Edit the file</string>
      </property>
      <property name="text" >
-      <string>&amp;Load</string>
+      <string>&amp;Edit</string>
      </property>
     </widget>
    </item>
   <tabstop>filenameED</tabstop>
   <tabstop>browsePB</tabstop>
   <tabstop>typeCO</tabstop>
-  <tabstop>loadPB</tabstop>
+  <tabstop>editPB</tabstop>
   <tabstop>visiblespaceCB</tabstop>
   <tabstop>previewCB</tabstop>
   <tabstop>captionLE</tabstop>