Fix JS alerts for msg state switching. Also make some github transfer tweaking.

This commit is contained in:
Martin Rotter 2016-06-22 09:38:28 +02:00
parent 3cba64fa56
commit 7ecda6be4d
7 changed files with 39 additions and 36 deletions

View File

@ -82,10 +82,10 @@
#define DEFAULT_ZOOM_FACTOR 1.0f #define DEFAULT_ZOOM_FACTOR 1.0f
#define ZOOM_FACTOR_STEP 0.1f #define ZOOM_FACTOR_STEP 0.1f
#define INTERNAL_URL_MESSAGE "rssguard.message" #define INTERNAL_URL_MESSAGE "http://rssguard.message"
#define INTERNAL_URL_BLANK "rssguard.blank" #define INTERNAL_URL_BLANK "http://rssguard.blank"
#define INTERNAL_URL_MESSAGE_HOST "message" #define INTERNAL_URL_MESSAGE_HOST "rssguard.message"
#define INTERNAL_URL_BLANK_HOST "blank" #define INTERNAL_URL_BLANK_HOST "rssguard.blank"
#define FEED_INITIAL_OPML_PATTERN "feeds-%1.opml" #define FEED_INITIAL_OPML_PATTERN "feeds-%1.opml"

View File

@ -334,7 +334,7 @@ void FormMain::setupIcons() {
m_ui->m_actionAboutGuard->setIcon(icon_theme_factory->fromTheme(QSL("help-about"))); m_ui->m_actionAboutGuard->setIcon(icon_theme_factory->fromTheme(QSL("help-about")));
m_ui->m_actionCheckForUpdates->setIcon(icon_theme_factory->fromTheme(QSL("applications-internet"))); m_ui->m_actionCheckForUpdates->setIcon(icon_theme_factory->fromTheme(QSL("applications-internet")));
m_ui->m_actionCleanupDatabase->setIcon(icon_theme_factory->fromTheme(QSL("edit-clear"))); m_ui->m_actionCleanupDatabase->setIcon(icon_theme_factory->fromTheme(QSL("edit-clear")));
m_ui->m_actionReportBugGitHub->setIcon(icon_theme_factory->fromTheme(QSL("call-start"))); m_ui->m_actionReportBug->setIcon(icon_theme_factory->fromTheme(QSL("call-start")));
m_ui->m_actionBackupDatabaseSettings->setIcon(icon_theme_factory->fromTheme(QSL("document-export"))); m_ui->m_actionBackupDatabaseSettings->setIcon(icon_theme_factory->fromTheme(QSL("document-export")));
m_ui->m_actionRestoreDatabaseSettings->setIcon(icon_theme_factory->fromTheme(QSL("document-import"))); m_ui->m_actionRestoreDatabaseSettings->setIcon(icon_theme_factory->fromTheme(QSL("document-import")));
m_ui->m_actionDonate->setIcon(icon_theme_factory->fromTheme(QSL("applications-office"))); m_ui->m_actionDonate->setIcon(icon_theme_factory->fromTheme(QSL("applications-office")));
@ -478,7 +478,7 @@ void FormMain::createConnections() {
// Menu "Help" connections. // Menu "Help" connections.
connect(m_ui->m_actionAboutGuard, SIGNAL(triggered()), this, SLOT(showAbout())); connect(m_ui->m_actionAboutGuard, SIGNAL(triggered()), this, SLOT(showAbout()));
connect(m_ui->m_actionCheckForUpdates, SIGNAL(triggered()), this, SLOT(showUpdates())); connect(m_ui->m_actionCheckForUpdates, SIGNAL(triggered()), this, SLOT(showUpdates()));
connect(m_ui->m_actionReportBugGitHub, SIGNAL(triggered()), this, SLOT(reportABugOnGitHub())); connect(m_ui->m_actionReportBug, SIGNAL(triggered()), this, SLOT(reportABug()));
connect(m_ui->m_actionDonate, SIGNAL(triggered()), this, SLOT(donate())); connect(m_ui->m_actionDonate, SIGNAL(triggered()), this, SLOT(donate()));
connect(m_ui->m_actionDisplayWiki, SIGNAL(triggered()), this, SLOT(showWiki())); connect(m_ui->m_actionDisplayWiki, SIGNAL(triggered()), this, SLOT(showWiki()));
@ -543,8 +543,8 @@ void FormMain::showAddAccountDialog() {
form_update->exec(); form_update->exec();
} }
void FormMain::reportABugOnGitHub() { void FormMain::reportABug() {
if (!WebFactory::instance()->openUrlInExternalBrowser(STRFY(APP_URL_ISSUES_NEW_GITHUB))) { if (!WebFactory::instance()->openUrlInExternalBrowser(STRFY(APP_URL_ISSUES_NEW))) {
qApp->showGuiMessage(tr("Cannot open external browser"), qApp->showGuiMessage(tr("Cannot open external browser"),
tr("Cannot open external browser. Navigate to application website manually."), tr("Cannot open external browser. Navigate to application website manually."),
QSystemTrayIcon::Warning, this, true); QSystemTrayIcon::Warning, this, true);

View File

@ -86,7 +86,7 @@ class FormMain : public QMainWindow {
void showUpdates(); void showUpdates();
void showWiki(); void showWiki();
void showAddAccountDialog(); void showAddAccountDialog();
void reportABugOnGitHub(); void reportABug();
void donate(); void donate();
private: private:

View File

@ -62,7 +62,7 @@
<string>&amp;Help</string> <string>&amp;Help</string>
</property> </property>
<addaction name="m_actionCheckForUpdates"/> <addaction name="m_actionCheckForUpdates"/>
<addaction name="m_actionReportBugGitHub"/> <addaction name="m_actionReportBug"/>
<addaction name="m_actionDisplayWiki"/> <addaction name="m_actionDisplayWiki"/>
<addaction name="m_actionDonate"/> <addaction name="m_actionDonate"/>
<addaction name="m_actionAboutGuard"/> <addaction name="m_actionAboutGuard"/>
@ -481,13 +481,10 @@
<string notr="true">M</string> <string notr="true">M</string>
</property> </property>
</action> </action>
<action name="m_actionReportBugGitHub"> <action name="m_actionReportBug">
<property name="text"> <property name="text">
<string>Report a &amp;bug...</string> <string>Report a &amp;bug...</string>
</property> </property>
<property name="shortcut">
<string notr="true"/>
</property>
</action> </action>
<action name="m_actionSwitchToolBars"> <action name="m_actionSwitchToolBars">
<property name="checkable"> <property name="checkable">

View File

@ -44,7 +44,8 @@ bool WebViewer::canDecreaseZoom() {
} }
void WebViewer::displayMessage() { void WebViewer::displayMessage() {
setHtml(m_messageContents, QUrl(INTERNAL_URL_MESSAGE)); load(QUrl(INTERNAL_URL_MESSAGE));
//setHtml(m_messageContents, QUrl::fromUserInput("aa"));
} }
bool WebViewer::increaseWebPageZoom() { bool WebViewer::increaseWebPageZoom() {

View File

@ -33,6 +33,10 @@ class WebViewer : public QWebEngineView {
bool canIncreaseZoom(); bool canIncreaseZoom();
bool canDecreaseZoom(); bool canDecreaseZoom();
inline QString messageContents() {
return m_messageContents;
}
public slots: public slots:
// Page zoom modifiers. // Page zoom modifiers.
bool increaseWebPageZoom(); bool increaseWebPageZoom();

View File

@ -32,7 +32,6 @@ WebViewer *WebPage::view() const {
} }
void WebPage::javaScriptAlert(const QUrl &securityOrigin, const QString &msg) { void WebPage::javaScriptAlert(const QUrl &securityOrigin, const QString &msg) {
if (securityOrigin.isEmpty()) {
QStringList parts = msg.split(QL1C('-')); QStringList parts = msg.split(QL1C('-'));
if (parts.size() == 2) { if (parts.size() == 2) {
@ -58,12 +57,14 @@ void WebPage::javaScriptAlert(const QUrl &securityOrigin, const QString &msg) {
else { else {
QWebEnginePage::javaScriptAlert(securityOrigin, msg); QWebEnginePage::javaScriptAlert(securityOrigin, msg);
} }
}
else {
QWebEnginePage::javaScriptAlert(securityOrigin, msg);
}
} }
bool WebPage::acceptNavigationRequest(const QUrl &url, NavigationType type, bool isMainFrame) { bool WebPage::acceptNavigationRequest(const QUrl &url, NavigationType type, bool isMainFrame) {
if (url.host() == INTERNAL_URL_MESSAGE_HOST) {
setHtml(view()->messageContents(), QUrl(INTERNAL_URL_MESSAGE));
return true;
}
else {
return QWebEnginePage::acceptNavigationRequest(url, type, isMainFrame); return QWebEnginePage::acceptNavigationRequest(url, type, isMainFrame);
}
} }