Skip to content

Commit

Permalink
fix #1084: Поделиться. Hacker News
Browse files Browse the repository at this point in the history
  • Loading branch information
Funcy-dcm committed Jun 28, 2018
1 parent ad0acb4 commit 196c514
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions QuiteRSS.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -166,5 +166,6 @@
<file>images/share/vk.png</file>
<file>images/share/instapaper.png</file>
<file>images/share/reddit.ico</file>
<file>images/share/hackernews.png</file>
</qresource>
</RCC>
Binary file added images/share/hackernews.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions src/application/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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*)));
Expand Down
1 change: 1 addition & 0 deletions src/application/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ class MainWindow : public QMainWindow
QAction *printfriendlyShareAct_;
QAction *instapaperShareAct_;
QAction *redditShareAct_;
QAction *hackerNewsShareAct_;
QAction *copyLinkAct_;
QAction *pageUpWebViewAct_;
QAction *pageDownWebViewAct_;
Expand Down
11 changes: 11 additions & 0 deletions src/newstabwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 196c514

Please sign in to comment.