From 9642ba8f0df42aa5fa78de5e64b6045c10847cf6 Mon Sep 17 00:00:00 2001 From: Pavel Sanda Date: Sat, 15 Aug 2020 22:02:08 +0200 Subject: lyx - add external citation launcher Signed-off-by: Pavel Sanda --- app-office/lyx/Manifest | 2 +- app-office/lyx/files/2.3.patches | 190 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 191 insertions(+), 1 deletion(-) diff --git a/app-office/lyx/Manifest b/app-office/lyx/Manifest index b034667..b77505f 100644 --- a/app-office/lyx/Manifest +++ b/app-office/lyx/Manifest @@ -1,6 +1,6 @@ AUX 2.1-python.patch 1019 BLAKE2B 1ca2692b77850998f49e93f43dc371d05e33438f867c352bdbf085a86a280e11fa5d00d738661875ede0041907683ced98407ce75676d638f35ae0a92cfd0f54 SHA512 039d3521bc1d646669fcccb43d04354dfe7ed32477a338c27a576c77e5ffcf15fcf0419c14df43aa37d727431cce6ab0327aa04199d09ce1749051ab12686df8 AUX 2.3-python.patch 1049 BLAKE2B 94591099e6b0d52429fa1e066475283ae35ba89a5d07f190dd80aa38ad040cbf53dda3f85f4f12894fc39822309aa7b4cc2bf947d8720caf228c734b7fcee8b1 SHA512 8f2fda91c4c35ffdf3325fc6613df1c5ecd87ced88e4d690aef5c7085edda1b66c0ae704e266521627f7a82eb8b4e2f35fed0f14b37feb367422ef1c5693e31d -AUX 2.3.patches 10947 BLAKE2B 55f6a9a5196ea74ebc9a31bd9e052fb878d4858c14756624cfc69b8f75594a194e8662ee0aee8c0d44893851f5d28b799074ac405e104d858219e027d1b29704 SHA512 5792b440cac5e577f3295229dd7933a6a24293a178bb7472f0a50f3686e871cbfbe7269773746a97187dca032ee7bcfeef53891012eb07e8b26d05a85af4baf3 +AUX 2.3.patches 16464 BLAKE2B 6769b2415f15ee0088b81594b801692f5bd8d31e64c46a310ffe3c071d632fc41d250adef820ecba6ae9839512e83f416d7aaa21445bbaee20cc5d24ba1b121f SHA512 7b12ce1a8920ba708bccd88bb8eb5a02c58ccf41b71eda7b031a5dc40a5f053c18ce767676c0490e6eab8603a8884372fcf5d03c9e7c6aa63dd128d221e493b7 AUX legacy.patch 1491 BLAKE2B 0e6164120f436b4620e314b827686b3977ea925f48ce566170228cecb8cd8a3fb97341a30ba80e99b372c38726e7646ee02842bbbb38d086c2faf6aaa952f49a SHA512 c2a02a20f10a24e2c06ce0a1958b62809ec0149f05c875ddff223f2ee12f15e8991ff93f7f7b7672b68d7b2ff27f9320fc181a4a96b1e8ad412fa7948b832e8f DIST lyx-2.2.4.tar.xz 15596628 BLAKE2B f60d1a4ba66d5d42629d02f084ec5a168a4d6f46a88d4f0432fb7a331fdee74c82b42eb62c14d7e11eb3a4146a03b5109619dee9e3f23ffaf5ed627e8e85f092 SHA512 0c3907abedf40a05af2584d4566c805522cd0f3e1d427da982170824944d15a41f0ed0aae2a11204a4c6b61dfc366ea849411a3d718f12f4152e9450fef2c990 EBUILD lyx-2.2.4.ebuild 4369 BLAKE2B 139a8f7198de12dde8b5ac21e185b4ee3ff239e4f7a0bbfbc615585166a15fa7adc346028d2b8ec41c97401a1c359bfed0f72a69a947b21364e780ae52c3e2bd SHA512 5a7e911ff23ff6a3839cc873d6c15fdbb921c6675c8e3ed0e5cd609fcf2316dda1beb0f63dbad4bc898b4c5b6842cbbd269fe84e2ebb07dbcab0407b38b78143 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:"< 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 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 -- cgit v1.2.3-65-gdbad