summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app-office/lyx/files')
-rw-r--r--app-office/lyx/files/2.3.patches190
1 files changed, 190 insertions, 0 deletions
diff --git a/app-office/lyx/files/2.3.patches b/app-office/lyx/files/2.3.patches
index b5aeabc..216d755 100644
--- a/app-office/lyx/files/2.3.patches
+++ b/app-office/lyx/files/2.3.patches
@@ -302,3 +302,193 @@ index 3bfdf13f26..f46537ef33 100644
/// \return the absolute file name without its .gz, .z, .Z extension
std::string unzippedFileName() const;
+diff --git a/lib/ui/stdcontext.inc b/lib/ui/stdcontext.inc
+index f4f02d2772..4dd53a0555 100644
+--- a/lib/ui/stdcontext.inc
++++ b/lib/ui/stdcontext.inc
+@@ -128,6 +128,7 @@ Menuset
+ CiteStyles
+ Separator
+ Item "Settings...|S" "inset-settings"
++ Item "Find citation|F" "inset-edit"
+ End
+
+
+diff --git a/src/FuncCode.h b/src/FuncCode.h
+index 3565cecaf9..6294258ac9 100644
+--- a/src/FuncCode.h
++++ b/src/FuncCode.h
+@@ -482,6 +482,7 @@ enum FuncCode
+ LFUN_LAYOUT_TOGGLE, // lasgouttes 20180514
+ // 375
+ LFUN_INSET_END_EDIT, // gb/rkh, 20180605
++ LFUN_CITATION_OPEN, // sanda, 20200815
+ LFUN_LASTACTION // end of the table
+ };
+
+diff --git a/src/LyXAction.cpp b/src/LyXAction.cpp
+index a9307c3bc6..daf5d1ce40 100644
+--- a/src/LyXAction.cpp
++++ b/src/LyXAction.cpp
+@@ -1203,6 +1203,7 @@ void LyXAction::init()
+ * \endvar
+ */
+ { LFUN_CITATION_INSERT, "citation-insert", Noop, Edit },
++ { LFUN_CITATION_OPEN, "citation-open", Noop, Edit },
+
+ /*!
+ * \var lyx::FuncCode lyx::LFUN_CLIPBOARD_PASTE
+diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp
+index c4d7e03a0b..120c07b112 100644
+--- a/src/frontends/qt4/GuiView.cpp
++++ b/src/frontends/qt4/GuiView.cpp
+@@ -2225,6 +2225,10 @@ bool GuiView::getStatus(FuncRequest const & cmd, FuncStatus & flag)
+ flag.setOnOff(lyxrc.spellcheck_continuously);
+ break;
+
++ case LFUN_CITATION_OPEN:
++ enable = true;
++ break;
++
+ default:
+ return false;
+ }
+@@ -4345,6 +4349,13 @@ void GuiView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
+ dr.screenUpdate(Update::Force);
+ break;
+
++ case LFUN_CITATION_OPEN: {
++ string arg = cmd.getArg(1) + " " + cmd.getArg(0);
++ //TODO: get url from citation
++ //TODO: get file from citation
++ frontend::showTarget(arg);
++ }
++
+ default:
+ // The LFUN must be for one of BufferView, Buffer or Cursor;
+ // let's try that:
+diff --git a/src/frontends/qt4/qt_helpers.cpp b/src/frontends/qt4/qt_helpers.cpp
+index d23ae9c2f9..11fd9ccc96 100644
+--- a/src/frontends/qt4/qt_helpers.cpp
++++ b/src/frontends/qt4/qt_helpers.cpp
+@@ -21,8 +21,11 @@
+
+ #include "BufferParams.h"
+ #include "FloatList.h"
++#include "FuncRequest.h"
+ #include "Language.h"
+ #include "Length.h"
++#include "LyX.h"
++#include "LyXAction.h"
+ #include "TextClass.h"
+
+ #include "support/convert.h"
+@@ -275,6 +278,13 @@ void setSectionResizeMode(QHeaderView * view, QHeaderView::ResizeMode mode) {
+ view->setResizeMode(mode);
+ #endif
+ }
++
++void showTarget(string const & target){
++ //spot for generic url handling via QUrl && QDesktopServices::openUrl
++ //lyxerr<<"showtarget:"<<target<<"\n";
++ FuncRequest cmd = FuncRequest(LFUN_VC_COMMAND,"U . \"paperview " + target + "\"");
++ lyx::dispatch(cmd);
++}
+ } // namespace frontend
+
+ QString const qt_(char const * str, const char *)
+diff --git a/src/frontends/qt4/qt_helpers.h b/src/frontends/qt4/qt_helpers.h
+index 52057fc494..e81fcf7f90 100644
+--- a/src/frontends/qt4/qt_helpers.h
++++ b/src/frontends/qt4/qt_helpers.h
+@@ -99,6 +99,7 @@ void setSectionResizeMode(QHeaderView * view,
+ int logicalIndex, QHeaderView::ResizeMode mode);
+ void setSectionResizeMode(QHeaderView * view,
+ QHeaderView::ResizeMode mode);
++void showTarget(std::string const & target);
+
+ } // namespace frontend
+
+diff --git a/src/insets/InsetCitation.cpp b/src/insets/InsetCitation.cpp
+index 3e0bd6f05f..2aaeab373f 100644
+--- a/src/insets/InsetCitation.cpp
++++ b/src/insets/InsetCitation.cpp
+@@ -24,6 +24,7 @@
+ #include "FuncRequest.h"
+ #include "FuncStatus.h"
+ #include "LaTeXFeatures.h"
++#include "LyX.h"
+ #include "output_xhtml.h"
+ #include "ParIterator.h"
+ #include "texstream.h"
+@@ -158,13 +159,47 @@ void InsetCitation::doDispatch(Cursor & cur, FuncRequest & cmd)
+ cmd = FuncRequest(LFUN_INSET_MODIFY, "changetype " + newcmdname);
+ }
+ }
+- // fall through
++ case LFUN_INSET_EDIT: {
++ openCitation();
++ }
++ // fall through
+ default:
+ InsetCommand::doDispatch(cur, cmd);
+ }
+ }
+
+
++void InsetCitation::openCitation(){
++ if (buffer_==NULL) return;
++ Buffer const & buf = *buffer_;
++ // Only after the buffer is loaded from file...
++ if (!buf.isFullyLoaded())
++ return;
++
++ BiblioInfo const & bi = buf.masterBibInfo();
++ if (bi.empty())
++ return;
++
++ docstring const & key = getParam("key");
++ if (key.empty())
++ return;
++
++ CiteItem ci;
++ vector<docstring> keys = getVectorFromString(key);
++ docstring year; docstring author;
++
++ int count = 0;
++ for (docstring const & kvar : keys) {
++// docstring const key_info = bi.getInfo(kvar, buffer(), ci);
++ year = bi.getYear(kvar, buffer(), false);
++ author = bi.getAuthorOrEditorList(kvar, buffer());
++ FuncRequest cmd = FuncRequest(LFUN_CITATION_OPEN, year + " " + author);
++ lyx::dispatch(cmd);
++ if (++count > 5) break;
++ }
++}
++
++
+ bool InsetCitation::getStatus(Cursor & cur, FuncRequest const & cmd,
+ FuncStatus & status) const
+ {
+@@ -203,6 +238,8 @@ bool InsetCitation::getStatus(Cursor & cur, FuncRequest const & cmd,
+ }
+ }
+ return true;
++ case LFUN_INSET_EDIT:
++ return true;
+ default:
+ return InsetCommand::getStatus(cur, cmd, status);
+ }
+diff --git a/src/insets/InsetCitation.h b/src/insets/InsetCitation.h
+index 7962809eda..73cca71f31 100644
+--- a/src/insets/InsetCitation.h
++++ b/src/insets/InsetCitation.h
+@@ -92,6 +92,8 @@ public:
+ std::map<docstring, docstring> getQualifiedLists(docstring const p) const;
+ ///
+ static bool last_literal;
++ ///
++ void openCitation();
+
+ private:
+ /// tries to make a pretty label and makes a basic one if not