aboutsummaryrefslogtreecommitdiff
path: root/gui/MainWindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'gui/MainWindow.cpp')
-rw-r--r--gui/MainWindow.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/gui/MainWindow.cpp b/gui/MainWindow.cpp
index 42823fa5..131bb6e6 100644
--- a/gui/MainWindow.cpp
+++ b/gui/MainWindow.cpp
@@ -125,6 +125,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi
newsLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
newsLabel->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
ui->newsToolBar->insertWidget(ui->actionMoreNews, newsLabel);
+ QObject::connect(newsLabel, &QAbstractButton::clicked, this, &MainWindow::newsButtonClicked);
QObject::connect(MMC->newsChecker().get(), &NewsChecker::newsLoaded, this, &MainWindow::updateNewsLabel);
updateNewsLabel();
}
@@ -774,6 +775,15 @@ void MainWindow::on_actionMoreNews_triggered()
openWebPage(QUrl("http://multimc.org/posts.html"));
}
+void MainWindow::newsButtonClicked()
+{
+ QList<NewsEntryPtr> entries = MMC->newsChecker()->getNewsEntries();
+ if (entries.count() > 0)
+ openWebPage(QUrl(entries[0]->link));
+ else
+ openWebPage(QUrl("http://multimc.org/posts.html"));
+}
+
void MainWindow::on_actionAbout_triggered()
{
AboutDialog dialog(this);