diff options
author | Yusuf Keten <ketenyusuf@gmail.com> | 2020-07-19 20:22:23 +0300 |
---|---|---|
committer | Muhammet Kara <muhammet.kara@collabora.com> | 2020-07-21 22:25:13 +0200 |
commit | 6e50e03262aa12921f108b502d3c76ce983d54f1 (patch) | |
tree | f39f736608778299607de1ab259c146cdeba6302 /cui | |
parent | 0587c88e23b4d3d1a0504cd4c6cf1d51fa9ff498 (diff) |
tdf#133026: Additions - Parameter support to UNO Command
After this patch, parameter support to uno command(.uno:AdditionsDialog) will be available.
To use parameter, add "?AdditionsTag:string=YourParameter" to UNO command. Parameters are the tags of extensions on webpage.
Change-Id: I0072c7340bda14ee13c21c347e06a04545cba69a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99007
Tested-by: Jenkins
Reviewed-by: Muhammet Kara <muhammet.kara@collabora.com>
Diffstat (limited to 'cui')
-rw-r--r-- | cui/inc/strings.hrc | 2 | ||||
-rw-r--r-- | cui/source/dialogs/AdditionsDialog.cxx | 26 | ||||
-rw-r--r-- | cui/source/factory/dlgfact.cxx | 6 | ||||
-rw-r--r-- | cui/source/factory/dlgfact.hxx | 2 | ||||
-rw-r--r-- | cui/source/inc/AdditionsDialog.hxx | 3 |
5 files changed, 27 insertions, 12 deletions
diff --git a/cui/inc/strings.hrc b/cui/inc/strings.hrc index be9c3f7d3a3e..d1b39a67e541 100644 --- a/cui/inc/strings.hrc +++ b/cui/inc/strings.hrc @@ -398,7 +398,7 @@ #define RID_SVXSTR_ADDITIONS_SEARCHING NC_("RID_SVXSTR_ADDITIONS_SEARCHING", "Searching...") #define RID_SVXSTR_ADDITIONS_LOADING NC_("RID_SVXSTR_ADDITIONS_LOADING", "Loading...") #define RID_SVXSTR_ADDITIONS_NORESULTS NC_("ID_SVXSTR_ADDITIONS_NORESULTS", "No results found") - +#define RID_SVXSTR_ADDITIONS_DIALOG_TITLE_PREFIX NC_("RID_SVXSTR_ADDITIONS_DIALOG_TITLE_PREFIX", "Extensions") #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/AdditionsDialog.cxx b/cui/source/dialogs/AdditionsDialog.cxx index 73b0247b8b0a..975fa57415fd 100644 --- a/cui/source/dialogs/AdditionsDialog.cxx +++ b/cui/source/dialogs/AdditionsDialog.cxx @@ -207,7 +207,7 @@ void parseResponse(const std::string& rResponse, std::vector<AdditionInfo>& aAdd RTL_TEXTENCODING_UTF8), OStringToOUString(OString(arrayElement.child("author").string_value().get()), RTL_TEXTENCODING_UTF8), - OStringToOUString(OString(arrayElement.child("URL").string_value().get()), + OStringToOUString(OString(arrayElement.child("url").string_value().get()), RTL_TEXTENCODING_UTF8), OStringToOUString(OString(arrayElement.child("screenshotURL").string_value().get()), RTL_TEXTENCODING_UTF8), @@ -219,13 +219,13 @@ void parseResponse(const std::string& rResponse, std::vector<AdditionInfo>& aAdd RTL_TEXTENCODING_UTF8), OStringToOUString(OString(arrayElement.child("releases") .child(0) - .child("compatibleVersion") + .child("compatibility") .string_value() .get()), RTL_TEXTENCODING_UTF8), OStringToOUString(OString(arrayElement.child("releases") .child(0) - .child("releaseNumber") + .child("releaseName") .string_value() .get()), RTL_TEXTENCODING_UTF8), @@ -414,7 +414,7 @@ void SearchAndParseThread::execute() m_pAdditionsDialog->SetProgress(sProgress); } -AdditionsDialog::AdditionsDialog(weld::Window* pParent) +AdditionsDialog::AdditionsDialog(weld::Window* pParent, const OUString& sAdditionsTag) : GenericDialogController(pParent, "cui/ui/additionsdialog.ui", "AdditionsDialog") , m_aSearchDataTimer("SearchDataTimer") , m_xEntrySearch(m_xBuilder->weld_entry("entrySearch")) @@ -430,8 +430,22 @@ AdditionsDialog::AdditionsDialog(weld::Window* pParent) m_xEntrySearch->connect_changed(LINK(this, AdditionsDialog, SearchUpdateHdl)); m_xEntrySearch->connect_focus_out(LINK(this, AdditionsDialog, FocusOut_Impl)); - // TODO - Temporary URL - OString rURL = "https://yusufketen.com/extensionTest.json"; + m_sTag = OUStringToOString(sAdditionsTag, RTL_TEXTENCODING_UTF8); + + OUString titlePrefix = CuiResId(RID_SVXSTR_ADDITIONS_DIALOG_TITLE_PREFIX); + if (!m_sTag.isEmpty()) + { + this->set_title(titlePrefix + ": " + sAdditionsTag); + } + else + { + this->set_title(titlePrefix); + m_sTag = "allextensions"; // Means empty parameter + } + //FIXME: Temporary URL + OString sPrefixURL = "https://yusufketen.com/api/"; + OString sSuffixURL = ".json"; + OString rURL = sPrefixURL + m_sTag + sSuffixURL; m_pSearchThread = new SearchAndParseThread(this, OStringToOUString(rURL, RTL_TEXTENCODING_UTF8), true); diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx index a31e987202eb..d1cd0a14c9f5 100644 --- a/cui/source/factory/dlgfact.cxx +++ b/cui/source/factory/dlgfact.cxx @@ -1684,14 +1684,14 @@ VclPtr<AbstractQrCodeGenDialog> AbstractDialogFactory_Impl::CreateQrCodeGenDialo } VclPtr<AbstractAdditionsDialog> AbstractDialogFactory_Impl::CreateAdditionsDialog( - weld::Window* pParent) + weld::Window* pParent, const OUString& sAdditionsTag) { #if HAVE_FEATURE_EXTENSIONS return VclPtr<AbstractAdditionsDialog_Impl>::Create( - std::make_unique<AdditionsDialog>(pParent)); + std::make_unique<AdditionsDialog>(pParent, sAdditionsTag)); #else (void) pParent; - return VclPtr<AbstractAdditionsDialog>(nullptr); + return VclPtr<AbstractAdditionsDialog>(nullptr, sAdditionsTag); #endif } diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx index 3c0655f30c08..cc4f90bd82ea 100644 --- a/cui/source/factory/dlgfact.hxx +++ b/cui/source/factory/dlgfact.hxx @@ -982,7 +982,7 @@ public: const css::uno::Reference<css::frame::XModel> xModel, bool bEditExisting) override; virtual VclPtr<AbstractAdditionsDialog> - CreateAdditionsDialog(weld::Window* pParent) override; + CreateAdditionsDialog(weld::Window* pParent, const OUString& sAdditionsTag) override; virtual VclPtr<AbstractAboutDialog> CreateAboutDialog(weld::Window* pParent) override; diff --git a/cui/source/inc/AdditionsDialog.hxx b/cui/source/inc/AdditionsDialog.hxx index 7983c1a0438a..be73c78d96d0 100644 --- a/cui/source/inc/AdditionsDialog.hxx +++ b/cui/source/inc/AdditionsDialog.hxx @@ -75,7 +75,8 @@ public: std::unique_ptr<weld::Label> m_xLabelProgress; ::rtl::Reference<SearchAndParseThread> m_pSearchThread; - AdditionsDialog(weld::Window* pParent); + OString m_sTag; + AdditionsDialog(weld::Window* pParent, const OUString& sAdditionsTag); ~AdditionsDialog() override; void SetProgress(const OUString& rProgress); |