mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-21 03:06:34 +01:00
Saving settings even without calling quitApplication. Closes #157
This commit is contained in:
parent
9e368775bd
commit
e39ddf5a79
Binary file not shown.
@ -152,6 +152,7 @@ MainApplication::MainApplication(const QList<CommandLineOptions::ActionPair> &cm
|
|||||||
}
|
}
|
||||||
|
|
||||||
connect(this, SIGNAL(messageReceived(QString)), this, SLOT(receiveAppMessage(QString)));
|
connect(this, SIGNAL(messageReceived(QString)), this, SLOT(receiveAppMessage(QString)));
|
||||||
|
connect(this, SIGNAL(aboutToQuit()), this, SLOT(saveSettings()));
|
||||||
|
|
||||||
#ifdef Q_WS_MAC
|
#ifdef Q_WS_MAC
|
||||||
setQuitOnLastWindowClosed(false);
|
setQuitOnLastWindowClosed(false);
|
||||||
@ -472,6 +473,25 @@ QupZilla* MainApplication::makeNewWindow(bool tryRestore, const QUrl &startUrl)
|
|||||||
return newWindow;
|
return newWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef Q_WS_MAC
|
||||||
|
bool MainApplication::event(QEvent* e)
|
||||||
|
{
|
||||||
|
switch (e->type()) {
|
||||||
|
case QEvent::FileOpen: {
|
||||||
|
QString fileName = static_cast<QFileOpenEvent*>(event)->file();
|
||||||
|
addNewTab(QUrl::fromLocalFile(fileName));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return QtSingleApplication::event(e);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void MainApplication::connectDatabase()
|
void MainApplication::connectDatabase()
|
||||||
{
|
{
|
||||||
if (m_databaseConnected) {
|
if (m_databaseConnected) {
|
||||||
@ -526,18 +546,30 @@ void MainApplication::translateApp()
|
|||||||
|
|
||||||
void MainApplication::quitApplication()
|
void MainApplication::quitApplication()
|
||||||
{
|
{
|
||||||
bool isPrivate = m_websettings->testAttribute(QWebSettings::PrivateBrowsingEnabled);
|
|
||||||
|
|
||||||
if (m_downloadManager && !m_downloadManager->canClose()) {
|
if (m_downloadManager && !m_downloadManager->canClose()) {
|
||||||
m_downloadManager->show();
|
m_downloadManager->show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_isClosing = true;
|
m_isClosing = true;
|
||||||
|
|
||||||
if (m_mainWindows.count() > 0) {
|
if (m_mainWindows.count() > 0) {
|
||||||
saveStateSlot();
|
saveStateSlot();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Saving settings in saveSettings() slot called from quit() so
|
||||||
|
// everything gets saved also when quitting application in other
|
||||||
|
// way than clicking Quit action in File menu or closing last window
|
||||||
|
//
|
||||||
|
// * this can occur on Mac OS
|
||||||
|
|
||||||
|
quit();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainApplication::saveSettings()
|
||||||
|
{
|
||||||
|
m_isClosing = true;
|
||||||
|
|
||||||
Settings settings;
|
Settings settings;
|
||||||
settings.beginGroup("SessionRestore");
|
settings.beginGroup("SessionRestore");
|
||||||
settings.setValue("isRunning", false);
|
settings.setValue("isRunning", false);
|
||||||
@ -547,26 +579,23 @@ void MainApplication::quitApplication()
|
|||||||
bool deleteCookies = settings.value("Web-Browser-Settings/deleteCookiesOnClose", false).toBool();
|
bool deleteCookies = settings.value("Web-Browser-Settings/deleteCookiesOnClose", false).toBool();
|
||||||
bool deleteHistory = settings.value("Web-Browser-Settings/deleteHistoryOnClose", false).toBool();
|
bool deleteHistory = settings.value("Web-Browser-Settings/deleteHistoryOnClose", false).toBool();
|
||||||
|
|
||||||
if (deleteCookies && !isPrivate) {
|
if (deleteCookies) {
|
||||||
QFile::remove(m_activeProfil + "cookies.dat");
|
m_cookiejar->clearCookies();
|
||||||
}
|
}
|
||||||
if (deleteHistory) {
|
if (deleteHistory) {
|
||||||
m_historymodel->clearHistory();
|
m_historymodel->clearHistory();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_searchEnginesManager->saveSettings();
|
m_searchEnginesManager->saveSettings();
|
||||||
cookieJar()->saveCookies();
|
m_cookiejar->saveCookies();
|
||||||
m_networkmanager->saveCertificates();
|
m_networkmanager->saveCertificates();
|
||||||
m_plugins->c2f_saveSettings();
|
m_plugins->c2f_saveSettings();
|
||||||
m_plugins->speedDial()->saveSettings();
|
m_plugins->speedDial()->saveSettings();
|
||||||
AdBlockManager::instance()->save();
|
|
||||||
QFile::remove(getActiveProfilPath() + "WebpageIcons.db");
|
|
||||||
m_iconProvider->saveIconsToDatabase();
|
m_iconProvider->saveIconsToDatabase();
|
||||||
|
|
||||||
|
AdBlockManager::instance()->save();
|
||||||
|
QFile::remove(getActiveProfilPath() + "WebpageIcons.db");
|
||||||
Settings::syncSettings();
|
Settings::syncSettings();
|
||||||
|
|
||||||
// qDebug() << "Quitting application...";
|
|
||||||
quit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BrowsingLibrary* MainApplication::browsingLibrary()
|
BrowsingLibrary* MainApplication::browsingLibrary()
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#define mApp MainApplication::getInstance()
|
#define mApp MainApplication::getInstance()
|
||||||
|
|
||||||
|
#include <QEvent>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
#include <QWebSettings>
|
#include <QWebSettings>
|
||||||
#include <QWeakPointer>
|
#include <QWeakPointer>
|
||||||
@ -101,6 +102,10 @@ public:
|
|||||||
IconProvider* iconProvider() { return m_iconProvider; }
|
IconProvider* iconProvider() { return m_iconProvider; }
|
||||||
DatabaseWriter* dbWriter() { return m_dbWriter; }
|
DatabaseWriter* dbWriter() { return m_dbWriter; }
|
||||||
|
|
||||||
|
#ifdef Q_WS_MAC
|
||||||
|
bool event(QEvent* e);
|
||||||
|
#endif
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
bool saveStateSlot();
|
bool saveStateSlot();
|
||||||
void quitApplication();
|
void quitApplication();
|
||||||
@ -117,6 +122,8 @@ private slots:
|
|||||||
void setupJumpList();
|
void setupJumpList();
|
||||||
void restoreCursor();
|
void restoreCursor();
|
||||||
|
|
||||||
|
void saveSettings();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum PostLaunchAction { PrivateBrowsing, OpenDownloadManager, OpenNewTab };
|
enum PostLaunchAction { PrivateBrowsing, OpenDownloadManager, OpenNewTab };
|
||||||
|
|
||||||
|
2
src/appicon_os2.rc
Normal file
2
src/appicon_os2.rc
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
ICON 1 "data\icons\exeicons\qupzilla.ico"
|
||||||
|
ICON 2 "data\icons\exeicons\page.ico"
|
@ -130,6 +130,16 @@ void CookieJar::restoreCookies()
|
|||||||
setAllCookies(restoredCookies);
|
setAllCookies(restoredCookies);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CookieJar::clearCookies()
|
||||||
|
{
|
||||||
|
if (m_tempList.isEmpty()) {
|
||||||
|
setAllCookies(QList<QNetworkCookie>());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
m_tempList.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QList<QNetworkCookie> CookieJar::getAllCookies()
|
QList<QNetworkCookie> CookieJar::getAllCookies()
|
||||||
{
|
{
|
||||||
return QNetworkCookieJar::allCookies();
|
return QNetworkCookieJar::allCookies();
|
||||||
|
@ -33,10 +33,12 @@ public:
|
|||||||
bool setCookiesFromUrl(const QList<QNetworkCookie> &cookieList, const QUrl &url);
|
bool setCookiesFromUrl(const QList<QNetworkCookie> &cookieList, const QUrl &url);
|
||||||
QList<QNetworkCookie> getAllCookies();
|
QList<QNetworkCookie> getAllCookies();
|
||||||
void setAllCookies(const QList<QNetworkCookie> &cookieList);
|
void setAllCookies(const QList<QNetworkCookie> &cookieList);
|
||||||
|
|
||||||
void saveCookies();
|
void saveCookies();
|
||||||
void restoreCookies();
|
void restoreCookies();
|
||||||
void setAllowCookies(bool allow);
|
void clearCookies();
|
||||||
|
|
||||||
|
void setAllowCookies(bool allow);
|
||||||
void turnPrivateJar(bool state);
|
void turnPrivateJar(bool state);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
17
src/src.pro
17
src/src.pro
@ -19,11 +19,8 @@ UI_DIR = ../build
|
|||||||
#DEFINES += USE_WEBGL
|
#DEFINES += USE_WEBGL
|
||||||
#DEFINES += KDE
|
#DEFINES += KDE
|
||||||
#DEFINES += PORTABLE_BUILD
|
#DEFINES += PORTABLE_BUILD
|
||||||
win32:DEFINES += W7API
|
#win32:DEFINES += W7API
|
||||||
|
|
||||||
unix:QT += dbus
|
|
||||||
win32:RC_FILE = appicon.rc
|
|
||||||
win32:LIBS += User32.lib Ole32.lib Shell32.lib ShlWapi.lib Gdi32.lib ComCtl32.lib
|
|
||||||
##It won't compile on windows with this define. Some bug in qtsingleapp / qvector template
|
##It won't compile on windows with this define. Some bug in qtsingleapp / qvector template
|
||||||
!win32: !CONFIG(debug, debug|release): DEFINES += QT_NO_DEBUG_OUTPUT
|
!win32: !CONFIG(debug, debug|release): DEFINES += QT_NO_DEBUG_OUTPUT
|
||||||
|
|
||||||
@ -363,16 +360,28 @@ RESOURCES += \
|
|||||||
|
|
||||||
OTHER_FILES += \
|
OTHER_FILES += \
|
||||||
appicon.rc \
|
appicon.rc \
|
||||||
|
appicon_os2.rc \
|
||||||
Info.plist
|
Info.plist
|
||||||
|
|
||||||
include(3rdparty/qtsingleapplication.pri)
|
include(3rdparty/qtsingleapplication.pri)
|
||||||
|
|
||||||
|
os2 {
|
||||||
|
RC_FILE = appicon_os2.rc
|
||||||
|
}
|
||||||
|
|
||||||
|
win32 {
|
||||||
|
RC_FILE = appicon.rc
|
||||||
|
LIBS += User32.lib Ole32.lib Shell32.lib ShlWapi.lib Gdi32.lib ComCtl32.lib
|
||||||
|
}
|
||||||
|
|
||||||
mac {
|
mac {
|
||||||
QMAKE_INFO_PLIST = Info.plist
|
QMAKE_INFO_PLIST = Info.plist
|
||||||
ICON = data/icons/exeicons/qupzilla.icns
|
ICON = data/icons/exeicons/qupzilla.icns
|
||||||
}
|
}
|
||||||
|
|
||||||
unix {
|
unix {
|
||||||
|
QT += dbus
|
||||||
|
|
||||||
d_prefix = $$(QUPZILLA_PREFIX)
|
d_prefix = $$(QUPZILLA_PREFIX)
|
||||||
binary_folder = /usr/bin
|
binary_folder = /usr/bin
|
||||||
data_folder = /usr/share/qupzilla
|
data_folder = /usr/share/qupzilla
|
||||||
|
24
translations/pt_PT.ts
Executable file → Normal file
24
translations/pt_PT.ts
Executable file → Normal file
@ -48,7 +48,7 @@
|
|||||||
<message>
|
<message>
|
||||||
<location filename="../src/other/aboutdialog.cpp" line="78"/>
|
<location filename="../src/other/aboutdialog.cpp" line="78"/>
|
||||||
<source><p><b>Main developer:</b><br/>%1 &lt;%2&gt;</p></source>
|
<source><p><b>Main developer:</b><br/>%1 &lt;%2&gt;</p></source>
|
||||||
<translation type="unfinished"></translation>
|
<translation><p><b>Programador principal:</b><br/>%1 &lt;%2&gt;</p></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source><p><b>Main developers:</b><br/>%1 &lt;%2&gt;</p></source>
|
<source><p><b>Main developers:</b><br/>%1 &lt;%2&gt;</p></source>
|
||||||
@ -3266,12 +3266,12 @@ não foi encontrado!</translation>
|
|||||||
<message>
|
<message>
|
||||||
<location filename="../src/network/qupzillaschemehandler.cpp" line="130"/>
|
<location filename="../src/network/qupzillaschemehandler.cpp" line="130"/>
|
||||||
<source>If you are experiencing problems with QupZilla, please try to disable all plugins first. <br/>If this does not fix it, then please fill out this form: </source>
|
<source>If you are experiencing problems with QupZilla, please try to disable all plugins first. <br/>If this does not fix it, then please fill out this form: </source>
|
||||||
<translation type="unfinished"></translation>
|
<translation>Se estiverem a ocorrer problemas no QupZilla, experimente desativar os plugins. <br/>Se os erros persistirem, preencha este formulário: </translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/network/qupzillaschemehandler.cpp" line="137"/>
|
<location filename="../src/network/qupzillaschemehandler.cpp" line="137"/>
|
||||||
<source>Please fill out all required fields!</source>
|
<source>Please fill out all required fields!</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation>Tem que preencher os campos obrigatórios!</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/network/qupzillaschemehandler.cpp" line="247"/>
|
<location filename="../src/network/qupzillaschemehandler.cpp" line="247"/>
|
||||||
@ -4322,42 +4322,42 @@ Após adicionar ou remover os caminhos dos certificados, tem que reiniciar o Qup
|
|||||||
<message>
|
<message>
|
||||||
<location filename="../src/webview/webview.cpp" line="536"/>
|
<location filename="../src/webview/webview.cpp" line="536"/>
|
||||||
<source>&Copy page link</source>
|
<source>&Copy page link</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation>&Copiar ligação da página</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/webview/webview.cpp" line="537"/>
|
<location filename="../src/webview/webview.cpp" line="537"/>
|
||||||
<source>Send page link...</source>
|
<source>Send page link...</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation>Enviar ligação da página...</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/webview/webview.cpp" line="538"/>
|
<location filename="../src/webview/webview.cpp" line="538"/>
|
||||||
<source>&Print page</source>
|
<source>&Print page</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation>Im&primir página</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/webview/webview.cpp" line="545"/>
|
<location filename="../src/webview/webview.cpp" line="545"/>
|
||||||
<source>Validate page</source>
|
<source>Validate page</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation>Validar página</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/webview/webview.cpp" line="561"/>
|
<location filename="../src/webview/webview.cpp" line="561"/>
|
||||||
<source>Send text...</source>
|
<source>Send text...</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation>Enviar texto...</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/webview/webview.cpp" line="566"/>
|
<location filename="../src/webview/webview.cpp" line="566"/>
|
||||||
<source>Google Translate</source>
|
<source>Google Translate</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation>Google Translate</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/webview/webview.cpp" line="567"/>
|
<location filename="../src/webview/webview.cpp" line="567"/>
|
||||||
<source>Dictionary</source>
|
<source>Dictionary</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation>Dicionário</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/webview/webview.cpp" line="578"/>
|
<location filename="../src/webview/webview.cpp" line="578"/>
|
||||||
<source>Go to &web address</source>
|
<source>Go to &web address</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation>Ir para endereço &web</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/webview/webview.cpp" line="628"/>
|
<location filename="../src/webview/webview.cpp" line="628"/>
|
||||||
@ -4519,7 +4519,7 @@ Após adicionar ou remover os caminhos dos certificados, tem que reiniciar o Qup
|
|||||||
<message>
|
<message>
|
||||||
<location filename="../src/webview/webview.cpp" line="584"/>
|
<location filename="../src/webview/webview.cpp" line="584"/>
|
||||||
<source>Search "%1 .." with %2</source>
|
<source>Search "%1 .." with %2</source>
|
||||||
<translation>Procurar "%1 .." com %2</translation>
|
<translation>Procurar "%1 ..." com %2</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/webview/webview.cpp" line="851"/>
|
<location filename="../src/webview/webview.cpp" line="851"/>
|
||||||
|
Loading…
Reference in New Issue
Block a user