]> git.lyx.org Git - features.git/commitdiff
Finish VC_COMPARE, connect to compare dialog and run it automatically.
authorPavel Sanda <sanda@lyx.org>
Tue, 7 Sep 2010 11:29:02 +0000 (11:29 +0000)
committerPavel Sanda <sanda@lyx.org>
Tue, 7 Sep 2010 11:29:02 +0000 (11:29 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35307 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/GuiCompare.cpp
src/frontends/qt4/GuiCompare.h
src/frontends/qt4/GuiView.cpp

index 79a6832f0d60ffb8b007a2209caa5dd8e56d3e53..e19f41b78ce407e937589205f207d04255c6a77a 100644 (file)
@@ -116,10 +116,10 @@ void GuiCompare::updateContents()
                newFileCB->addItem(filename);
                oldFileCB->addItem(filename);
        }
-       if (lyxview().documentBufferView())
-               newFileCB->setEditText(toqstr(buffer().absFileName()));
-       else
+       if (!restore_filename1.isEmpty())
                newFileCB->setEditText(restore_filename1);
+       else if (lyxview().documentBufferView())
+               newFileCB->setEditText(toqstr(buffer().absFileName()));
 
        if (!restore_filename2.isEmpty())
                oldFileCB->setEditText(restore_filename2);
@@ -318,6 +318,17 @@ int GuiCompare::run()
        return 1;
 }
 
+bool GuiCompare::initialiseParams(std::string const &par)
+{
+       //just for the sake of parsing arguments
+       FuncRequest cmd(LFUN_UNKNOWN_ACTION, par);
+       if (cmd.getArg(0) == "run") {
+               oldFileCB->setEditText(toqstr(cmd.getArg(1)));
+               newFileCB->setEditText(toqstr(cmd.getArg(2)));
+               slotOK();
+       }
+       return true;
+}
 
 Dialog * createGuiCompare(GuiView & lv) { return new GuiCompare(lv); }
 
index 47f70a12abc9153ff2ebc0441e19a4d041a975d0..aa5f701ebb7e3fb7fd56435632fbd3530f6a4bc7 100644 (file)
@@ -62,7 +62,7 @@ private:
        ///
        bool isValid();
        ///
-       bool initialiseParams(std::string const &) { return true; }
+       bool initialiseParams(std::string const &);
        ///
        bool isBufferDependent() const { return false; }
        ///
index 1e0433800281e6ae98aaabac34358547393daca0..860717bc39d9282f9b2544a112d090a0741a9649 100644 (file)
@@ -2686,20 +2686,8 @@ void GuiView::dispatchVC(FuncRequest const & cmd)
                        if (!buffer->lyxvc().prepareFileRevision(rev2, f2))
                                break;
                }
-               // FIXME We need to call comparison feature here.
-               // This is quick and dirty code for testing VC.
-               // We need that comparison feature has some LFUN_COMPARE <FLAG> file1 file1
-               // where <FLAG> specifies whether we want GUI dialog or just launch
-               // running with defaults.
-               /*
-               FileName initpath(lyxrc.document_path);
-               Buffer * dest = newUnnamedFile(initpath, to_utf8(_("differences")));
-               CompareOptions options;
-               Compare * compare = new Compare(loadIfNeeded(FileName(f1)), loadIfNeeded(FileName(f2)), dest, options);
-               compare->start(QThread::LowPriority);
-               Sleep::millisec(200);
-               lyx::dispatch(FuncRequest(LFUN_BUFFER_SWITCH, dest->absFileName()));
-               */
+               string par = "compare run " + f1 + " " + f2;
+               lyx::dispatch(FuncRequest(LFUN_DIALOG_SHOW, par));
                break;
        }