Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
build-peb-Desktop_Qt_5_2_1_clang_64bit-Debug/
src/peb.pro.user
peb
8 changes: 4 additions & 4 deletions src/peb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ bool Page::acceptNavigationRequest (QWebFrame *frame,
// Open not allowed web site using default browser:
if (navigationType == QWebPage::NavigationTypeLinkClicked and
request.url().scheme().contains ("http") and
(! (QUrl ("http://perl-executing-browser-pseudodomain/"))
(! (QUrl (PEB_DOMAIN))
.isParentOf (request.url())) and
(! request.url().authority().contains ("localhost")) and
(! request.url().authority().contains ("www.perl.org"))) {
Expand Down Expand Up @@ -668,7 +668,7 @@ bool Page::acceptNavigationRequest (QWebFrame *frame,
// Open local content in a new window
// (with the exception of result from long-running script):
if (frame != Page::currentFrame() and
(QUrl ("http://perl-executing-browser-pseudodomain/"))
(QUrl (PEB_DOMAIN))
.isParentOf (request.url())) {
if (! Page::mainFrame()->childFrames().contains (frame)) {
if (! request.url().path().contains ("longrun")) {
Expand Down Expand Up @@ -702,7 +702,7 @@ bool Page::acceptNavigationRequest (QWebFrame *frame,

// Load local HTML page invoked from hyperlink:
if (navigationType == QWebPage::NavigationTypeLinkClicked and
(QUrl ("http://perl-executing-browser-pseudodomain/"))
(QUrl (PEB_DOMAIN))
.isParentOf (request.url()) and
(request.url().path().contains (".htm"))) {
filepath = request.url()
Expand All @@ -724,7 +724,7 @@ bool Page::acceptNavigationRequest (QWebFrame *frame,

// Execute local long-running script invoked from hyperlink:
if (navigationType == QWebPage::NavigationTypeLinkClicked and
(QUrl ("http://perl-executing-browser-pseudodomain/"))
(QUrl (PEB_DOMAIN))
.isParentOf (request.url()) and
(request.url().path().contains ("longrun"))){
qDebug() << "Long-running script:" << request.url().toString();
Expand Down
13 changes: 9 additions & 4 deletions src/peb.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
#ifndef PEB_H
#define PEB_H

// The domain of Perl Executing Browser
#ifndef PEB_DOMAIN
#define PEB_DOMAIN "http://perl-executing-browser-pseudodomain/"
#endif

#include <qglobal.h>
#if QT_VERSION >= 0x050000
// Qt5 code:
Expand Down Expand Up @@ -128,7 +133,7 @@ class ModifiedNetworkAccessManager : public QNetworkAccessManager
// 2.) script started in a new window,
// 3.) script, which was fed with data from local form using CGI GET method
if (operation == GetOperation and
(QUrl ("http://perl-executing-browser-pseudodomain/"))
(QUrl (PEB_DOMAIN))
.isParentOf(request.url()) and
(!request.url().path().contains ("longrun")) and
(!request.url().toString().contains ("debugger"))) {
Expand Down Expand Up @@ -238,7 +243,7 @@ class ModifiedNetworkAccessManager : public QNetworkAccessManager
// Get data from local form using CGI POST method and
// execute associated local script:
if (operation == PostOperation and
(QUrl("http://perl-executing-browser-pseudodomain/"))
(QUrl(PEB_DOMAIN))
.isParentOf (request.url())) {
QString postData;
QByteArray outgoingByteArray;
Expand Down Expand Up @@ -624,7 +629,7 @@ public slots:
(QApplication::applicationDirPath()+
QDir::separator()+settings.startPage)));
} else {
setUrl (QUrl (QString ("http://perl-executing-browser-pseudodomain/" +
setUrl (QUrl (QString (PEB_DOMAIN +
settings.startPage)));
}
}
Expand Down Expand Up @@ -713,7 +718,7 @@ public slots:
QMenu *menu = mainPage->createStandardContextMenu();
if (!qWebHitTestResult.linkUrl().isEmpty()) {
qWebHitTestURL = qWebHitTestResult.linkUrl();
if (QUrl ("http://perl-executing-browser-pseudodomain/")
if (QUrl (PEB_DOMAIN)
.isParentOf (qWebHitTestURL)) {
menu->addSeparator ();
QAction *editAct = menu->addAction (tr ("&Edit"));
Expand Down