mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-24 12:46:35 +01:00
Merge pull request #1364 from pejakm/wof
Implement offline mode. Closes #1241
This commit is contained in:
commit
36d64af403
@ -814,6 +814,15 @@ void BrowserWindow::toggleFullScreen()
|
||||
}
|
||||
}
|
||||
|
||||
void BrowserWindow::toggleOfflineMode()
|
||||
{
|
||||
bool enable = !qzSettings->workOffline;
|
||||
|
||||
Settings().setValue("Web-Browser-Settings/WorkOffline", enable);
|
||||
|
||||
qzSettings->workOffline = enable;
|
||||
}
|
||||
|
||||
void BrowserWindow::showWebInspector()
|
||||
{
|
||||
if (weView() && weView()->webTab()) {
|
||||
|
@ -134,6 +134,7 @@ public slots:
|
||||
|
||||
void toggleCaretBrowsing();
|
||||
void toggleFullScreen();
|
||||
void toggleOfflineMode();
|
||||
|
||||
void loadActionUrl(QObject* obj = 0);
|
||||
void loadActionUrlInNewTab(QObject* obj = 0);
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "mainapplication.h"
|
||||
#include "browsinglibrary.h"
|
||||
#include "clearprivatedata.h"
|
||||
#include "qzsettings.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QMetaObject>
|
||||
@ -103,8 +104,10 @@ void MainMenu::initSuperMenu(QMenu* superMenu) const
|
||||
superMenu->addAction(m_actions[QSL("Help/InfoAboutApp")]);
|
||||
superMenu->addAction(m_actions[QSL("Help/ConfigInfo")]);
|
||||
superMenu->addAction(m_actions[QSL("Help/ReportIssue")]);
|
||||
superMenu->addAction(m_actions[QSL("File/WorkOffline")]);
|
||||
superMenu->addSeparator();
|
||||
superMenu->addAction(m_actions[QSL("Standard/Quit")]);
|
||||
m_actions[QSL("File/WorkOffline")]->setChecked(qzSettings->workOffline);
|
||||
}
|
||||
|
||||
QAction* MainMenu::action(const QString &name) const
|
||||
@ -185,6 +188,11 @@ void MainMenu::printPage()
|
||||
callSlot("printPage");
|
||||
}
|
||||
|
||||
void MainMenu::toggleOfflineMode()
|
||||
{
|
||||
callSlot("toggleOfflineMode");
|
||||
}
|
||||
|
||||
void MainMenu::editUndo()
|
||||
{
|
||||
if (m_window) {
|
||||
@ -529,6 +537,8 @@ void MainMenu::init()
|
||||
ADD_ACTION("File/SendLink", m_menuFile, QIcon::fromTheme(QSL("mail-message-new")), tr("Send Link..."), SLOT(sendLink()), "");
|
||||
ADD_ACTION("File/Print", m_menuFile, QIcon::fromTheme(QSL("document-print")), tr("&Print..."), SLOT(printPage()), "Ctrl+P");
|
||||
m_menuFile->addSeparator();
|
||||
ADD_CHECKABLE_ACTION("File/WorkOffline", m_menuFile, QIcon(), tr("Work &Offline"), SLOT(toggleOfflineMode()), "");
|
||||
m_menuFile->addSeparator();
|
||||
m_menuFile->addAction(m_actions[QSL("Standard/Quit")]);
|
||||
|
||||
// Edit menu
|
||||
|
@ -57,6 +57,7 @@ private slots:
|
||||
void openLocation();
|
||||
void openFile();
|
||||
void closeWindow();
|
||||
void toggleOfflineMode();
|
||||
void savePageAs();
|
||||
void savePageScreen();
|
||||
void sendLink();
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "networkproxyfactory.h"
|
||||
#include "certificateinfowidget.h"
|
||||
#include "qztools.h"
|
||||
#include "qzsettings.h"
|
||||
#include "acceptlanguage.h"
|
||||
#include "cabundleupdater.h"
|
||||
#include "settings.h"
|
||||
@ -512,6 +513,10 @@ QNetworkReply* NetworkManager::createRequest(QNetworkAccessManager::Operation op
|
||||
QNetworkRequest req = request;
|
||||
QNetworkReply* reply = 0;
|
||||
|
||||
if (qzSettings->workOffline) {
|
||||
req.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::AlwaysCache);
|
||||
}
|
||||
|
||||
// SchemeHandlers
|
||||
if (m_schemeHandlers.contains(req.url().scheme())) {
|
||||
reply = m_schemeHandlers[req.url().scheme()]->createRequest(op, req, outgoingData);
|
||||
|
@ -54,6 +54,7 @@ void QzSettings::loadSettings()
|
||||
allowJsHideStatusBar = settings.value("allowJavaScriptHideStatusBar", true).toBool();
|
||||
allowJsHideToolBar = settings.value("allowJavaScriptHideToolBar", true).toBool();
|
||||
enableFormsUndoRedo = settings.value("enableFormsUndoRedo", true).toBool();
|
||||
workOffline = settings.value("WorkOffline", false).toBool();
|
||||
settings.endGroup();
|
||||
|
||||
settings.beginGroup("Browser-Tabs-Settings");
|
||||
|
@ -54,6 +54,7 @@ public:
|
||||
bool allowJsHideStatusBar;
|
||||
bool allowJsHideToolBar;
|
||||
bool enableFormsUndoRedo;
|
||||
bool workOffline;
|
||||
|
||||
QStringList autoOpenProtocols;
|
||||
QStringList blockedProtocols;
|
||||
|
Loading…
Reference in New Issue
Block a user