From 196c5145dfa994cc9ba0684e8eab067ea95e7b38 Mon Sep 17 00:00:00 2001 From: Shilyaev Egor Date: Thu, 28 Jun 2018 23:46:20 +0500 Subject: [PATCH] =?UTF-8?q?fix=20#1084:=20=D0=9F=D0=BE=D0=B4=D0=B5=D0=BB?= =?UTF-8?q?=D0=B8=D1=82=D1=8C=D1=81=D1=8F.=20Hacker=20News?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- QuiteRSS.qrc | 1 + images/share/hackernews.png | Bin 0 -> 635 bytes src/application/mainwindow.cpp | 6 ++++++ src/application/mainwindow.h | 1 + src/newstabwidget.cpp | 11 +++++++++++ 5 files changed, 19 insertions(+) create mode 100644 images/share/hackernews.png diff --git a/QuiteRSS.qrc b/QuiteRSS.qrc index 50bb6c4ca..e989565b6 100644 --- a/QuiteRSS.qrc +++ b/QuiteRSS.qrc @@ -166,5 +166,6 @@ images/share/vk.png images/share/instapaper.png images/share/reddit.ico + images/share/hackernews.png diff --git a/images/share/hackernews.png b/images/share/hackernews.png new file mode 100644 index 0000000000000000000000000000000000000000..76b38a79154e172ef3c01c7de74c21649ae8aa82 GIT binary patch literal 635 zcmV->0)+jEP)5JZpdwYG?Yh+m*$TZA48+O)<0#>CqFb;fyX77S#w(U%^wFwEx7Z00wA z-n@Ah;?@CO!WYL+K^jsfcW?$VE;4lb638JYFSk& zU_%k&TZ_1Uc2Gd#0J;W-JE-@cQD>y?mwu=LSSC}@iJOOOAZ9WG z>}@(EEtn6XWOH#)F*cO)mWyaorl(@ZARju;WTfi%0{;N)np{rf|IyvBP{Zqa?jI(P V<|0VanfCwy002ovPDHLkV1nCa6@mZ& literal 0 HcmV?d00001 diff --git a/src/application/mainwindow.cpp b/src/application/mainwindow.cpp index 39a85256b..6b0d3dcf2 100644 --- a/src/application/mainwindow.cpp +++ b/src/application/mainwindow.cpp @@ -1447,6 +1447,12 @@ void MainWindow::createActions() redditShareAct_->setIcon(QIcon(":/share/images/share/reddit.ico")); shareGroup_->addAction(redditShareAct_); + hackerNewsShareAct_ = new QAction(this); + hackerNewsShareAct_->setObjectName("hackerNewsShareAct"); + hackerNewsShareAct_->setText("HackerNews"); + hackerNewsShareAct_->setIcon(QIcon(":/share/images/share/hackernews.png")); + shareGroup_->addAction(hackerNewsShareAct_); + this->addActions(shareGroup_->actions()); connect(shareGroup_, SIGNAL(triggered(QAction*)), this, SLOT(slotShareNews(QAction*))); diff --git a/src/application/mainwindow.h b/src/application/mainwindow.h index 3245a5560..3f538e796 100644 --- a/src/application/mainwindow.h +++ b/src/application/mainwindow.h @@ -164,6 +164,7 @@ class MainWindow : public QMainWindow QAction *printfriendlyShareAct_; QAction *instapaperShareAct_; QAction *redditShareAct_; + QAction *hackerNewsShareAct_; QAction *copyLinkAct_; QAction *pageUpWebViewAct_; QAction *pageDownWebViewAct_; diff --git a/src/newstabwidget.cpp b/src/newstabwidget.cpp index 77d74d3b1..7cf19f478 100644 --- a/src/newstabwidget.cpp +++ b/src/newstabwidget.cpp @@ -2759,6 +2759,17 @@ void NewsTabWidget::slotShareNews(QAction *action) #else url.addQueryItem("url", linkString); url.addQueryItem("title", title); +#endif + } else if (action->objectName() == "hackerNewsShareAct") { + url.setUrl("http://news.ycombinator.com/submitlink"); +#ifdef HAVE_QT5 + QUrlQuery urlQuery; + urlQuery.addQueryItem("u", linkString); + urlQuery.addQueryItem("t", title); + url.setQuery(urlQuery); +#else + url.addQueryItem("u", linkString); + url.addQueryItem("t", title); #endif }