1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 18:56:34 +01:00

Plugins: Calling unload() on app shutdown.

This commit is contained in:
nowrep 2012-07-08 14:03:50 +02:00
parent 7fee7053d4
commit ac36261549
8 changed files with 19 additions and 7 deletions

View File

@ -61,7 +61,7 @@ void AdBlockIcon::popupBlocked(const QString &ruleString, const QUrl &url)
pair.second = url; pair.second = url;
m_blockedPopups.append(pair); m_blockedPopups.append(pair);
mApp->desktopNotifications()->showNotifications(QPixmap(":html/adblock_big.png"), tr("Blocked popup window"), tr("AdBlock blocked unwanted popup window.")); mApp->desktopNotifications()->showNotification(QPixmap(":html/adblock_big.png"), tr("Blocked popup window"), tr("AdBlock blocked unwanted popup window."));
if (!m_flashTimer) { if (!m_flashTimer) {
m_flashTimer = new QTimer(this); m_flashTimer = new QTimer(this);

View File

@ -619,8 +619,7 @@ void MainApplication::saveSettings()
m_searchEnginesManager->saveSettings(); m_searchEnginesManager->saveSettings();
m_networkmanager->saveCertificates(); m_networkmanager->saveCertificates();
m_plugins->c2f_saveSettings(); m_plugins->shutdown();
m_plugins->speedDial()->saveSettings();
qIconProvider->saveIconsToDatabase(); qIconProvider->saveIconsToDatabase();
AdBlockManager::instance()->save(); AdBlockManager::instance()->save();

View File

@ -49,7 +49,7 @@ void DesktopNotificationsFactory::loadSettings()
settings.endGroup(); settings.endGroup();
} }
void DesktopNotificationsFactory::showNotifications(const QPixmap &icon, const QString &heading, const QString &text) void DesktopNotificationsFactory::showNotification(const QPixmap &icon, const QString &heading, const QString &text)
{ {
if (!m_enabled) { if (!m_enabled) {
return; return;

View File

@ -37,7 +37,7 @@ public:
void loadSettings(); void loadSettings();
void showNotifications(const QPixmap &icon, const QString &heading, const QString &text); void showNotification(const QPixmap &icon, const QString &heading, const QString &text);
void nativeNotificationPreview(); void nativeNotificationPreview();
private: private:

View File

@ -257,7 +257,7 @@ void DownloadManager::downloadFinished(bool success)
if (downloadingAllFilesFinished) { if (downloadingAllFilesFinished) {
if (success && qApp->activeWindow() != this) { if (success && qApp->activeWindow() != this) {
mApp->desktopNotifications()->showNotifications(QIcon::fromTheme("mail-inbox", QIcon(":icons/notifications/download.png")).pixmap(48), tr("Download Finished"), tr("All files have been successfully downloaded.")); mApp->desktopNotifications()->showNotification(QIcon::fromTheme("mail-inbox", QIcon(":icons/notifications/download.png")).pixmap(48), tr("Download Finished"), tr("All files have been successfully downloaded."));
if (!m_closeOnFinish) { if (!m_closeOnFinish) {
raise(); raise();
activateWindow(); activateWindow();

View File

@ -112,7 +112,7 @@ void Updater::downCompleted(QNetworkReply* reply)
Version current = parseVersionFromString(QupZilla::VERSION); Version current = parseVersionFromString(QupZilla::VERSION);
Version updated = parseVersionFromString(html); Version updated = parseVersionFromString(html);
if (current < updated) { if (current < updated) {
mApp->desktopNotifications()->showNotifications(QPixmap(":icons/qupzillaupdate.png"), tr("Update available"), tr("New version of QupZilla is ready to download.")); mApp->desktopNotifications()->showNotification(QPixmap(":icons/qupzillaupdate.png"), tr("Update available"), tr("New version of QupZilla is ready to download."));
// QAction* action = new QAction(QIcon(":icons/qupzillaupdate.png"), "Update", this); // QAction* action = new QAction(QIcon(":icons/qupzillaupdate.png"), "Update", this);
// connect(action, SIGNAL(triggered()), this, SLOT(downloadNewVersion())); // connect(action, SIGNAL(triggered()), this, SLOT(downloadNewVersion()));
// p_QupZilla->menuBar()->addAction(action); // p_QupZilla->menuBar()->addAction(action);

View File

@ -89,6 +89,16 @@ void Plugins::loadSettings()
c2f_loadSettings(); c2f_loadSettings();
} }
void Plugins::shutdown()
{
c2f_saveSettings();
m_speedDial->saveSettings();
foreach(PluginInterface * iPlugin, m_loadedPlugins) {
iPlugin->unload();
}
}
void Plugins::c2f_loadSettings() void Plugins::c2f_loadSettings()
{ {
Settings settings; Settings settings;

View File

@ -64,6 +64,8 @@ public:
bool loadPlugin(Plugin* plugin); bool loadPlugin(Plugin* plugin);
void unloadPlugin(Plugin* plugin); void unloadPlugin(Plugin* plugin);
void shutdown();
// CLick2Flash // CLick2Flash
void c2f_loadSettings(); void c2f_loadSettings();
void c2f_saveSettings(); void c2f_saveSettings();
@ -78,6 +80,7 @@ public:
public slots: public slots:
void loadSettings(); void loadSettings();
void loadPlugins(); void loadPlugins();
protected: protected: