mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-11 09:32:12 +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(aboutToQuit()), this, SLOT(saveSettings()));
|
||||
|
||||
#ifdef Q_WS_MAC
|
||||
setQuitOnLastWindowClosed(false);
|
||||
|
@ -472,6 +473,25 @@ QupZilla* MainApplication::makeNewWindow(bool tryRestore, const QUrl &startUrl)
|
|||
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()
|
||||
{
|
||||
if (m_databaseConnected) {
|
||||
|
@ -526,18 +546,30 @@ void MainApplication::translateApp()
|
|||
|
||||
void MainApplication::quitApplication()
|
||||
{
|
||||
bool isPrivate = m_websettings->testAttribute(QWebSettings::PrivateBrowsingEnabled);
|
||||
|
||||
if (m_downloadManager && !m_downloadManager->canClose()) {
|
||||
m_downloadManager->show();
|
||||
return;
|
||||
}
|
||||
|
||||
m_isClosing = true;
|
||||
|
||||
if (m_mainWindows.count() > 0) {
|
||||
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.beginGroup("SessionRestore");
|
||||
settings.setValue("isRunning", false);
|
||||
|
@ -547,26 +579,23 @@ void MainApplication::quitApplication()
|
|||
bool deleteCookies = settings.value("Web-Browser-Settings/deleteCookiesOnClose", false).toBool();
|
||||
bool deleteHistory = settings.value("Web-Browser-Settings/deleteHistoryOnClose", false).toBool();
|
||||
|
||||
if (deleteCookies && !isPrivate) {
|
||||
QFile::remove(m_activeProfil + "cookies.dat");
|
||||
if (deleteCookies) {
|
||||
m_cookiejar->clearCookies();
|
||||
}
|
||||
if (deleteHistory) {
|
||||
m_historymodel->clearHistory();
|
||||
}
|
||||
|
||||
m_searchEnginesManager->saveSettings();
|
||||
cookieJar()->saveCookies();
|
||||
m_cookiejar->saveCookies();
|
||||
m_networkmanager->saveCertificates();
|
||||
m_plugins->c2f_saveSettings();
|
||||
m_plugins->speedDial()->saveSettings();
|
||||
AdBlockManager::instance()->save();
|
||||
QFile::remove(getActiveProfilPath() + "WebpageIcons.db");
|
||||
m_iconProvider->saveIconsToDatabase();
|
||||
|
||||
AdBlockManager::instance()->save();
|
||||
QFile::remove(getActiveProfilPath() + "WebpageIcons.db");
|
||||
Settings::syncSettings();
|
||||
|
||||
// qDebug() << "Quitting application...";
|
||||
quit();
|
||||
}
|
||||
|
||||
BrowsingLibrary* MainApplication::browsingLibrary()
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
#define mApp MainApplication::getInstance()
|
||||
|
||||
#include <QEvent>
|
||||
#include <QUrl>
|
||||
#include <QWebSettings>
|
||||
#include <QWeakPointer>
|
||||
|
@ -101,6 +102,10 @@ public:
|
|||
IconProvider* iconProvider() { return m_iconProvider; }
|
||||
DatabaseWriter* dbWriter() { return m_dbWriter; }
|
||||
|
||||
#ifdef Q_WS_MAC
|
||||
bool event(QEvent* e);
|
||||
#endif
|
||||
|
||||
public slots:
|
||||
bool saveStateSlot();
|
||||
void quitApplication();
|
||||
|
@ -117,6 +122,8 @@ private slots:
|
|||
void setupJumpList();
|
||||
void restoreCursor();
|
||||
|
||||
void saveSettings();
|
||||
|
||||
private:
|
||||
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);
|
||||
}
|
||||
|
||||
void CookieJar::clearCookies()
|
||||
{
|
||||
if (m_tempList.isEmpty()) {
|
||||
setAllCookies(QList<QNetworkCookie>());
|
||||
}
|
||||
else {
|
||||
m_tempList.clear();
|
||||
}
|
||||
}
|
||||
|
||||
QList<QNetworkCookie> CookieJar::getAllCookies()
|
||||
{
|
||||
return QNetworkCookieJar::allCookies();
|
||||
|
|
|
@ -33,10 +33,12 @@ public:
|
|||
bool setCookiesFromUrl(const QList<QNetworkCookie> &cookieList, const QUrl &url);
|
||||
QList<QNetworkCookie> getAllCookies();
|
||||
void setAllCookies(const QList<QNetworkCookie> &cookieList);
|
||||
|
||||
void saveCookies();
|
||||
void restoreCookies();
|
||||
void setAllowCookies(bool allow);
|
||||
void clearCookies();
|
||||
|
||||
void setAllowCookies(bool allow);
|
||||
void turnPrivateJar(bool state);
|
||||
|
||||
signals:
|
||||
|
|
17
src/src.pro
17
src/src.pro
|
@ -19,11 +19,8 @@ UI_DIR = ../build
|
|||
#DEFINES += USE_WEBGL
|
||||
#DEFINES += KDE
|
||||
#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
|
||||
!win32: !CONFIG(debug, debug|release): DEFINES += QT_NO_DEBUG_OUTPUT
|
||||
|
||||
|
@ -363,16 +360,28 @@ RESOURCES += \
|
|||
|
||||
OTHER_FILES += \
|
||||
appicon.rc \
|
||||
appicon_os2.rc \
|
||||
Info.plist
|
||||
|
||||
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 {
|
||||
QMAKE_INFO_PLIST = Info.plist
|
||||
ICON = data/icons/exeicons/qupzilla.icns
|
||||
}
|
||||
|
||||
unix {
|
||||
QT += dbus
|
||||
|
||||
d_prefix = $$(QUPZILLA_PREFIX)
|
||||
binary_folder = /usr/bin
|
||||
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>
|
||||
<location filename="../src/other/aboutdialog.cpp" line="78"/>
|
||||
<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>
|
||||
<source><p><b>Main developers:</b><br/>%1 &lt;%2&gt;</p></source>
|
||||
|
@ -3266,12 +3266,12 @@ não foi encontrado!</translation>
|
|||
<message>
|
||||
<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>
|
||||
<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>
|
||||
<location filename="../src/network/qupzillaschemehandler.cpp" line="137"/>
|
||||
<source>Please fill out all required fields!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>Tem que preencher os campos obrigatórios!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<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>
|
||||
<location filename="../src/webview/webview.cpp" line="536"/>
|
||||
<source>&Copy page link</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>&Copiar ligação da página</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/webview/webview.cpp" line="537"/>
|
||||
<source>Send page link...</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>Enviar ligação da página...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/webview/webview.cpp" line="538"/>
|
||||
<source>&Print page</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>Im&primir página</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/webview/webview.cpp" line="545"/>
|
||||
<source>Validate page</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>Validar página</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/webview/webview.cpp" line="561"/>
|
||||
<source>Send text...</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>Enviar texto...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/webview/webview.cpp" line="566"/>
|
||||
<source>Google Translate</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>Google Translate</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/webview/webview.cpp" line="567"/>
|
||||
<source>Dictionary</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>Dicionário</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/webview/webview.cpp" line="578"/>
|
||||
<source>Go to &web address</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>Ir para endereço &web</translation>
|
||||
</message>
|
||||
<message>
|
||||
<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>
|
||||
<location filename="../src/webview/webview.cpp" line="584"/>
|
||||
<source>Search "%1 .." with %2</source>
|
||||
<translation>Procurar "%1 .." com %2</translation>
|
||||
<translation>Procurar "%1 ..." com %2</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/webview/webview.cpp" line="851"/>
|
||||
|
|
Loading…
Reference in New Issue
Block a user