diff --git a/CMakeLists.txt b/CMakeLists.txt index 6fd6003d3..23b83f13b 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -299,6 +299,7 @@ set(APP_SOURCES src/gui/widgetwithstatus.cpp src/gui/labelwithstatus.cpp src/gui/messagebox.cpp + src/gui/formupdate.cpp # CORE sources. src/core/debugging.cpp @@ -367,6 +368,7 @@ set(APP_HEADERS src/gui/widgetwithstatus.h src/gui/labelwithstatus.h src/gui/messagebox.h + src/gui/formupdate.h # CORE headers. src/core/settings.h @@ -386,6 +388,7 @@ set(APP_HEADERS # Add form files. set(APP_FORMS + src/gui/formupdate.ui src/gui/formmain.ui src/gui/formsettings.ui src/gui/formwelcome.ui diff --git a/localization/rssguard-cs_CZ.ts b/localization/rssguard-cs_CZ.ts index ed68ce6a0..087e7f19a 100644 --- a/localization/rssguard-cs_CZ.ts +++ b/localization/rssguard-cs_CZ.ts @@ -181,7 +181,7 @@ <b>%8</b><br><b>Version:</b> %1 (build on %2 with CMake %3)<br><b>Revision:</b> %4<br><b>Build date:</b> %5<br><b>Qt:</b> %6 (compiled against %7)<br> - <b>%8</b><br><b>Verze:</b> %1 (OS při sestavování %2 verze CMake %3)<br><b>Revize:</b> %4<br><b>Datum sestavení:</b> %5<br><b>Qt:</b> %6 (při kompilaci %7)<br> + <b>%8</b><br><b>Verze:</b> %1 (při sestavování použit OS %2 a CMake %3)<br><b>Revize:</b> %4<br><b>Datum sestavení:</b> %5<br><b>Qt:</b> %6 (při kompilaci %7)<br> Thanks to page is available only in English language. diff --git a/resources/graphics/icons/mini-kfaenza/check-for-updates.png b/resources/graphics/icons/mini-kfaenza/check-for-updates.png new file mode 100644 index 000000000..14a89fc42 Binary files /dev/null and b/resources/graphics/icons/mini-kfaenza/check-for-updates.png differ diff --git a/src/core/defs.h.in b/src/core/defs.h.in index 2878eab6f..370f0ea3b 100755 --- a/src/core/defs.h.in +++ b/src/core/defs.h.in @@ -23,6 +23,7 @@ #define APP_VERSION "@APP_VERSION@" #define APP_USERAGENT QString("@APP_NAME@/@APP_VERSION@ (@APP_URL@) on @CMAKE_SYSTEM@; Webkit/") + qWebKitVersion() +#define RELEASES_LIST "https://bitbucket.org/skunkos/rssguard/raw/master/resources/text/UPDATES?at=master" #define DEFAULT_LOCALE "en_GB" #define DEFAULT_FEED_ENCODING "UTF-8" #define URL_REGEXP "^(http|https|feed|ftp):\\/\\/[\\w\\-_]+(\\.[\\w\\-_]+)+([\\w\\-\\.,@?^=%&:/~\\+#]*[\\w\\-\\@?^=%&/~\\+#])?$" diff --git a/src/gui/formmain.cpp b/src/gui/formmain.cpp index d1b419e17..d6c989fca 100755 --- a/src/gui/formmain.cpp +++ b/src/gui/formmain.cpp @@ -7,6 +7,7 @@ #include "gui/formabout.h" #include "gui/formsettings.h" #include "gui/feedsview.h" +#include "gui/messagebox.h" #include "gui/webbrowser.h" #include "gui/iconthemefactory.h" #include "gui/systemtrayicon.h" @@ -15,6 +16,10 @@ #include "gui/feedmessageviewer.h" #include "qtsingleapplication/qtsingleapplication.h" +#if defined(Q_OS_WIN) || defined(Q_OS_OS2) +#include "gui/formupdate.h" +#endif + #include #include #include @@ -105,6 +110,14 @@ void FormMain::prepareMenus() { m_trayMenu = new QMenu(APP_NAME, this); #endif +#if defined(Q_OS_WIN) || defined(Q_OS_OS2) + // Add "check for updates" item on some platforms. + m_actionCheckForUpdates = new QAction(tr("Check for updates"), this); + m_actionCheckForUpdates->setIcon(IconThemeFactory::instance()->fromTheme("check-for-updates")); + m_actionCheckForUpdates->setToolTip(tr("Check if new update for the application is available for download.")); + m_ui->m_menuHelp->insertAction(m_ui->m_actionAboutGuard, m_actionCheckForUpdates); +#endif + // Add needed items to the menu. m_trayMenu->addAction(m_ui->m_actionSwitchMainWindow); m_trayMenu->addSeparator(); @@ -328,6 +341,10 @@ void FormMain::createConnections() { // Menu "Help" connections. connect(m_ui->m_actionAboutGuard, SIGNAL(triggered()), this, SLOT(showAbout())); +#if defined(Q_OS_WIN) || defined(Q_OS_OS2) + connect(m_actionCheckForUpdates, SIGNAL(triggered()), this, SLOT(showUpdates())); +#endif + // General connections. connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(onAboutToQuit())); @@ -384,6 +401,30 @@ void FormMain::showAbout() { delete form_pointer.data(); } +#if defined(Q_OS_WIN) || defined(Q_OS_OS2) +void FormMain::showUpdates() { + if (!SystemFactory::instance()->applicationCloseLock()->tryLock()) { + if (SystemTrayIcon::isSystemTrayActivated()) { + SystemTrayIcon::instance()->showMessage(tr("Cannot check for updates"), + tr("You cannot check for updates because feed update is ongoing."), + QSystemTrayIcon::Warning); + } + else { + MessageBox::show(this, + QMessageBox::Warning, + tr("Cannot check for updates"), + tr("You cannot check for updates because feed update is ongoing.")); + } + + return; + } + + QPointer form_update = new FormUpdate(this); + form_update.data()->exec(); + delete form_update.data(); +} +#endif + void FormMain::showSettings() { QPointer form_pointer = new FormSettings(this); form_pointer.data()->exec(); diff --git a/src/gui/formmain.h b/src/gui/formmain.h index 5759784b6..227d5ebd4 100644 --- a/src/gui/formmain.h +++ b/src/gui/formmain.h @@ -93,7 +93,15 @@ class FormMain : public QMainWindow { void showSettings(); void showAbout(); +#if defined(Q_OS_WIN) || defined(Q_OS_OS2) + void showUpdates(); +#endif + private: +#if defined(Q_OS_WIN) || defined(Q_OS_OS2) + QAction *m_actionCheckForUpdates; +#endif + Ui::FormMain *m_ui; QMenu *m_trayMenu; StatusBar *m_statusBar; diff --git a/src/gui/formupdate.cpp b/src/gui/formupdate.cpp new file mode 100644 index 000000000..2233e8e7e --- /dev/null +++ b/src/gui/formupdate.cpp @@ -0,0 +1,12 @@ +#include "formupdate.h" + + +FormUpdate::FormUpdate(QWidget *parent) + : QDialog(parent), m_ui(new Ui::FormUpdate) { + m_ui->setupUi(this); +} + +FormUpdate::~FormUpdate() +{ + delete m_ui; +} diff --git a/src/gui/formupdate.h b/src/gui/formupdate.h new file mode 100644 index 000000000..b8975775c --- /dev/null +++ b/src/gui/formupdate.h @@ -0,0 +1,24 @@ +#ifndef FORMUPDATE_H +#define FORMUPDATE_H + +#include + +#include "ui_formupdate.h" + + +namespace Ui { + class FormUpdate; +} + +class FormUpdate : public QDialog { + Q_OBJECT + + public: + explicit FormUpdate(QWidget *parent = 0); + virtual ~FormUpdate(); + + private: + Ui::FormUpdate *m_ui; +}; + +#endif // FORMUPDATE_H diff --git a/src/gui/formupdate.ui b/src/gui/formupdate.ui new file mode 100644 index 000000000..e1d2cd53e --- /dev/null +++ b/src/gui/formupdate.ui @@ -0,0 +1,71 @@ + + + + + FormUpdate + + + + 0 + 0 + 400 + 300 + + + + Dialog + + + + + 30 + 240 + 341 + 32 + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + buttonBox + accepted() + FormUpdate + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + FormUpdate + reject() + + + 316 + 260 + + + 286 + 274 + + + + +