summaryrefslogtreecommitdiffstats
path: root/src/fbgui
diff options
context:
space:
mode:
authorJonathan Bauer2012-05-10 13:30:51 +0200
committerJonathan Bauer2012-05-10 13:30:51 +0200
commit65767e1cad8975bccf64a8ede887ee813c49b611 (patch)
tree6b2d06be3e94a54ff4e8ee1bde88d01f0cf74109 /src/fbgui
parentpbs2 clear cookies extension (tofix: multiple loaded URLs messages) (diff)
downloadfbgui-65767e1cad8975bccf64a8ede887ee813c49b611.tar.gz
fbgui-65767e1cad8975bccf64a8ede887ee813c49b611.tar.xz
fbgui-65767e1cad8975bccf64a8ede887ee813c49b611.zip
clearing cookies + fix for multiple loadURLDone connects
Diffstat (limited to 'src/fbgui')
-rw-r--r--src/fbgui/fbgui.cpp30
1 files changed, 19 insertions, 11 deletions
diff --git a/src/fbgui/fbgui.cpp b/src/fbgui/fbgui.cpp
index c4f5f22..2881a30 100644
--- a/src/fbgui/fbgui.cpp
+++ b/src/fbgui/fbgui.cpp
@@ -77,6 +77,9 @@ void fbgui::init() {
dm->moveToThread(&dmThread);
dmThread.start();
+ // connect to handler for loaded URLs
+ QObject::connect(_webView, SIGNAL(loadFinished(bool)), this, SLOT(loadURLDone(bool)));
+
loadURL();
showFullScreen();
@@ -127,8 +130,7 @@ void fbgui::loadURL() {
// show cursor again since user is about to interact.
req.setHeader(QNetworkRequest::ContentTypeHeader,
"application/x-www-form-urlencoded");
- QObject::connect(_webView, SIGNAL(loadFinished(bool)), this,
- SLOT(loadURLDone(bool)));
+
_webView->load(req, QNetworkAccessManager::PostOperation, postData);
}
// TODO: error page if no host.
@@ -147,7 +149,7 @@ void fbgui::loadURLDone(bool success) {
}
//-------------------------------------------------------------------------------------------
/**
- * This method clears all cookies aside from the ones sent by baseURL.
+ * This method clears all cookies and starts a new pbs-session.
*
*/
@@ -155,16 +157,18 @@ void fbgui::clearAllCookies() {
LOG4CXX_DEBUG(coreLogger, "Clearing cookies...");
- // persist pbs cookies and delete the rest.
- QUrl currentURL(_webView->page()->mainFrame()->url());
+ // delete all cookies.
QNetworkCookieJar* cookieJar = new QNetworkCookieJar();
- QList<QNetworkCookie> cookieList = _webView->page()->networkAccessManager()->cookieJar()->cookiesForUrl(currentURL);
_webView->page()->networkAccessManager()->setCookieJar(cookieJar);
- // restart the session with pbs
+ // start new session with pbs
loadURL();
}
-
+//-------------------------------------------------------------------------------------------
+/**
+ * This method prints cookies [DEBUGGING]
+ *
+ */
void fbgui::printCookies() {
QList<QNetworkCookie> cookieList = _webView->page()->networkAccessManager()->cookieJar()->cookiesForUrl(_webView->page()->mainFrame()->url());
@@ -183,10 +187,14 @@ void fbgui::printCookies() {
}
}
}
-
}
+//-------------------------------------------------------------------------------------------
+/**
+ * This method prints site history [DEBUGGING]
+ *
+ */
void fbgui::printHistory() {
- LOG4CXX_DEBUG(coreLogger, "--------------------------------------------------");
+ LOG4CXX_DEBUG(coreLogger, "-----------------------------------------------------------------------------------");
QList<QUrl> urls;
QList<QWebHistoryItem> history = _webView->history()->backItems(10);
QList<QWebHistoryItem>::iterator n;
@@ -217,7 +225,7 @@ void fbgui::printHistory() {
}
}
}
- LOG4CXX_DEBUG(coreLogger, "--------------------------------------------------");
+ LOG4CXX_DEBUG(coreLogger, "-----------------------------------------------------------------------------------");
}
//-------------------------------------------------------------------------------------------