]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiInclude.cpp
On Linux show in crash message box the backtrace
[lyx.git] / src / frontends / qt4 / GuiInclude.cpp
index 989509878a39ebe449bdca2050f55d37ba4cc37f..fe8cc3ba5bb086e2cb9bdcbb534d1a0c6935815c 100644 (file)
@@ -64,9 +64,9 @@ GuiInclude::GuiInclude(GuiView & lv)
        connect(captionLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
        connect(labelLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
        connect(listingsED, SIGNAL(textChanged()), this, SLOT(change_adaptor()));
-       connect(listingsED, SIGNAL(textChanged()), this, SLOT(set_listings_msg()));
+       connect(listingsED, SIGNAL(textChanged()), this, SLOT(setListingsMsg()));
        connect(bypassCB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
-       connect(bypassCB, SIGNAL(clicked()), this, SLOT(set_listings_msg()));
+       connect(bypassCB, SIGNAL(clicked()), this, SLOT(setListingsMsg()));
 
        setFocusProxy(filenameED);
 
@@ -93,6 +93,7 @@ docstring GuiInclude::validate_listings_params()
 {
        // use a cache here to avoid repeated validation
        // of the same parameters
+       // FIXME THREAD
        static string param_cache = string();
        static docstring msg_cache = docstring();
        
@@ -108,8 +109,9 @@ docstring GuiInclude::validate_listings_params()
 }
 
 
-void GuiInclude::set_listings_msg()
+void GuiInclude::setListingsMsg()
 {
+       // FIXME THREAD
        static bool isOK = true;
        docstring msg = validate_listings_params();
        if (msg.empty()) {
@@ -232,6 +234,10 @@ void GuiInclude::paramsToDialog(InsetCommandParams const & params_)
                string extra = getStringFromVector(pars);
                listingsED->setPlainText(toqstr(InsetListingsParams(extra).separatedParams()));
        }
+
+       // Make sure that the bc is in the INITIAL state
+       if (bc().policy().buttonStatus(ButtonPolicy::OKAY))
+               bc().restore();
 }
 
 
@@ -291,8 +297,11 @@ void GuiInclude::edit()
        if (!isValid())
                return;
        string const file = fromqstr(filenameED->text());
-       slotOK();
-       applyView();
+       if (bc().policy().buttonStatus(ButtonPolicy::OKAY)) {
+               slotOK();
+               applyView();
+       } else
+               hideView();
        dispatch(FuncRequest(LFUN_INSET_EDIT));
 }
 
@@ -316,19 +325,20 @@ QString GuiInclude::browse(QString const & in_name, Type in_type) const
                break;
        case VERBATIM:
        case LISTINGS:
+               filters = fileFilters(QString());
                break;
        }
 
        QString const docpath = toqstr(support::onlyPath(buffer().absFileName()));
 
-       return browseRelFile(in_name, docpath, title, filters, false, 
+       return browseRelToParent(in_name, docpath, title, filters, false,
                qt_("Documents|#o#O"), toqstr(lyxrc.document_path));
 }
 
 
 bool GuiInclude::initialiseParams(std::string const & data)
 {
-       InsetCommand::string2params("include", data, params_);
+       InsetCommand::string2params(data, params_);
        paramsToDialog(params_);
        return true;
 }
@@ -336,7 +346,7 @@ bool GuiInclude::initialiseParams(std::string const & data)
 
 void GuiInclude::dispatchParams()
 {
-       std::string const lfun = InsetCommand::params2string("include", params_);
+       std::string const lfun = InsetCommand::params2string(params_);
        dispatch(FuncRequest(getLfun(), lfun));
 }