diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-09-26 21:47:37 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-09-26 21:47:37 +0300 |
commit | ed3a977346009c22c30908a9e7b81f409d310b59 (patch) | |
tree | 0101284761788307a5c231fe0f0466810ee651a1 /src/gui/windows/didyouknowwindow.cpp | |
parent | 4b517a69de505e5f3b0eec2e42d2f5bc5d913faa (diff) | |
download | mv-ed3a977346009c22c30908a9e7b81f409d310b59.tar.gz mv-ed3a977346009c22c30908a9e7b81f409d310b59.tar.bz2 mv-ed3a977346009c22c30908a9e7b81f409d310b59.tar.xz mv-ed3a977346009c22c30908a9e7b81f409d310b59.zip |
Add support for links "news" and "copyright".
Use for links in didyouknow window ItemLinkHandler.
Diffstat (limited to 'src/gui/windows/didyouknowwindow.cpp')
-rw-r--r-- | src/gui/windows/didyouknowwindow.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/gui/windows/didyouknowwindow.cpp b/src/gui/windows/didyouknowwindow.cpp index db9352243..04921cac3 100644 --- a/src/gui/windows/didyouknowwindow.cpp +++ b/src/gui/windows/didyouknowwindow.cpp @@ -31,10 +31,12 @@ #include "gui/widgets/button.h" #include "gui/widgets/browserbox.h" #include "gui/widgets/checkbox.h" +#include "gui/widgets/itemlinkhandler.h" #include "gui/widgets/layout.h" #include "gui/widgets/layouttype.h" #include "gui/widgets/scrollarea.h" +#include "utils/delete2.h" #include "utils/gettext.h" #include "utils/process.h" @@ -52,6 +54,7 @@ DidYouKnowWindow::DidYouKnowWindow() : // TRANSLATORS: did you know window name Window(_("Did You Know?"), Modal_false, nullptr, "didyouknow.xml"), ActionListener(), + mItemLinkHandler(new ItemLinkHandler), mBrowserBox(new BrowserBox(this, BrowserBox::AUTO_SIZE, Opaque_true, "browserbox.xml")), mScrollArea(new ScrollArea(this, mBrowserBox, @@ -80,7 +83,7 @@ DidYouKnowWindow::DidYouKnowWindow() : // TRANSLATORS: did you know window button Button *const okButton = new Button(this, _("Close"), "close", this); - mBrowserBox->setLinkHandler(this); + mBrowserBox->setLinkHandler(mItemLinkHandler); if (gui) mBrowserBox->setFont(gui->getHelpFont()); mBrowserBox->setProcessVars(true); @@ -107,6 +110,11 @@ void DidYouKnowWindow::postInit() widgetResized(Event(nullptr)); } +DidYouKnowWindow::~DidYouKnowWindow() +{ + delete2(mItemLinkHandler); +} + void DidYouKnowWindow::action(const ActionEvent &event) { const std::string &eventId = event.getId(); @@ -133,13 +141,6 @@ void DidYouKnowWindow::action(const ActionEvent &event) } } -void DidYouKnowWindow::handleLink(const std::string &link, - MouseEvent *const event A_UNUSED) -{ - if (strStartWith(link, "http://") || strStartWith(link, "https://")) - openBrowser(link); -} - void DidYouKnowWindow::loadData(int num) { mBrowserBox->clearRows(); |