From 7fe40a350abfbe5ec194e7c6c740f7099e8704cd Mon Sep 17 00:00:00 2001 From: Sergey Dryabzhinsky Date: Tue, 26 Aug 2014 02:48:05 +0400 Subject: [PATCH] == Version 1.99.3 == * Add persistent cookie storage. Thanks to quinox. * Add 'Backspace' hot-key to go back through page history. * Fix persistent cookies for Qt 4.8 support --- debian/changelog | 7 +++++++ doc/README.md | 2 ++ resources/qt-webkit-kiosk.ini | 4 ++-- src/config.h | 2 +- src/mainwindow.cpp | 3 +++ src/persistentcookiejar.cpp | 22 ++++++++++++---------- src/qt-webkit-kiosk.pro | 16 ++++++++-------- 7 files changed, 35 insertions(+), 21 deletions(-) diff --git a/debian/changelog b/debian/changelog index 26d5eee..184d3dd 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +qt-webkit-kiosk (1.99.3-1sergey1) unstable; urgency=medium + + * Add persistent cookie storage. Thanks to quinox. + * Add 'Backspace' hot-key to go back through page history. + + -- Sergey Dryabzhinsky Mon, 26 Aug 2014 02:13:00 +0400 + qt-webkit-kiosk (1.99.2-1sergey1) unstable; urgency=medium * Fixed dependencies checks for *nix diff --git a/doc/README.md b/doc/README.md index da8ed28..2ee4f32 100644 --- a/doc/README.md +++ b/doc/README.md @@ -48,5 +48,7 @@ PgUp Scroll Page Up PgDown Scroll Page Down Home Scroll to top End Scroll to bottom + Ctrl+Home, HomePage Load home page +Backspace Go back via pages history diff --git a/resources/qt-webkit-kiosk.ini b/resources/qt-webkit-kiosk.ini index 2f476d6..9d26ce1 100644 --- a/resources/qt-webkit-kiosk.ini +++ b/resources/qt-webkit-kiosk.ini @@ -15,7 +15,7 @@ cookiejar=false java=false javascript=true ; handle window.open? -; canch link and follow. no new windows. +; catch link and follow. no new windows. javascript_can_open_windows=true ; handle window.close ? javascript_can_close_windows=false @@ -87,7 +87,7 @@ clean-on-exit=false organization=Organization organization-domain=www.example.com name=QtWebkitKiosk -version=1.99.2 +version=1.99.3 [printing] enable=false diff --git a/src/config.h b/src/config.h index 3408c11..cdc9985 100644 --- a/src/config.h +++ b/src/config.h @@ -14,7 +14,7 @@ #endif #ifndef VERSION - #define VERSION "1.99.2" + #define VERSION "1.99.3" #endif #endif diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index c994f49..213b775 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -399,6 +399,9 @@ void MainWindow::keyPressEvent(QKeyEvent *event) view->scrollHome(); } break; + case Qt::Key_Backspace: + view->page()->triggerAction(QWebPage::Back); + break; case Qt::Key_Q: if (int(event->modifiers()) == Qt::CTRL) { clearCacheOnExit(); diff --git a/src/persistentcookiejar.cpp b/src/persistentcookiejar.cpp index a8e260e..d326b7e 100644 --- a/src/persistentcookiejar.cpp +++ b/src/persistentcookiejar.cpp @@ -12,7 +12,11 @@ const char *PersistentCookieJar::line_separator = "\n"; PersistentCookieJar::PersistentCookieJar(QObject *parent) : QNetworkCookieJar(parent) { - QString cookiejar_path = QStandardPaths::writableLocation(QStandardPaths::DataLocation); +#ifdef QT5 + QString cookiejar_path = QStandardPaths::writableLocation(QStandardPaths::DataLocation); +#else + QString cookiejar_path = QDesktopServices::storageLocation(QDesktopServices::DataLocation); +#endif if (cookiejar_path.length() == 0) { qDebug() << "No data locations available; not storing any cookies."; @@ -25,7 +29,7 @@ PersistentCookieJar::PersistentCookieJar(QObject *parent) : cookiejar_dir.mkpath("."); } - cookiejar_location = cookiejar_path + "/cookiejar.txt"; + cookiejar_location = cookiejar_path + QDir::toNativeSeparators("/cookiejar.txt"); load(); } @@ -49,7 +53,7 @@ void PersistentCookieJar::store() { for (int i=0; i < cookies.length(); i++) { - qDebug() << "Writing cookie " + i; + qDebug() << "Writing cookie " << i; storage.write(cookies[i].toRawForm()); storage.write(line_separator); } @@ -68,16 +72,14 @@ void PersistentCookieJar::load() { QByteArray bytes = storage.readAll(); QList cookies = bytes.split(*line_separator); - int valid_cookies = 0; + QList all_cookies = QNetworkCookie::parseCookies(";"); for (int i=0; i < cookies.length(); i++) { - QList parsed_cookies = QNetworkCookie::parseCookies(cookies[i]); - for (int j=0; j < parsed_cookies.length(); j++) { - insertCookie(parsed_cookies[j]); - valid_cookies++; - } + all_cookies += QNetworkCookie::parseCookies(cookies[i]); } - qDebug() << "Read" << valid_cookies << "valid cookies from the cookiejar."; + setAllCookies(all_cookies); + + qDebug() << "Read" << all_cookies.length() << "valid cookies from the cookiejar."; storage.close(); } diff --git a/src/qt-webkit-kiosk.pro b/src/qt-webkit-kiosk.pro index 92e0915..b76be72 100644 --- a/src/qt-webkit-kiosk.pro +++ b/src/qt-webkit-kiosk.pro @@ -14,7 +14,7 @@ contains(QT_VERSION, ^5\\.[0-9]\\..*) { CONFIG += console link_pkgconfig TARGET = qt-webkit-kiosk TEMPLATE = app -VERSION = 1.99.2 +VERSION = 1.99.3 CONFIG(debug, debug|release) { # here comes debug specific statements @@ -38,12 +38,12 @@ PLAYER = NONE DEFINES += RESOURCES=\\\"$${PREFIX}/share/$${TARGET}/\\\" DEFINES += ICON=\\\"$${ICON}\\\" - PKG_TEST=QtTest - + PKG_TEST=QtTest + contains(QT_VERSION, ^5\\.[0-9]\\..*) { - - PKG_TEST=Qt5Test - + + PKG_TEST=Qt5Test + packagesExist(Qt5Multimedia) { message('Multimedia framework found. Using Multimedia-player.') DEFINES += PLAYER_MULTIMEDIA @@ -53,7 +53,7 @@ contains(QT_VERSION, ^5\\.[0-9]\\..*) { HEADERS += player/multimedia.h } } - + contains(PLAYER, NONE) { packagesExist(phonon) { message('Phonon framework found. Using Phonon-player.') @@ -64,7 +64,7 @@ contains(QT_VERSION, ^5\\.[0-9]\\..*) { HEADERS += player/phonon.h } } - + packagesExist($${PKG_TEST}) { message('Test framework found.') DEFINES += USE_TESTLIB