diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2009-02-15 15:35:47 +0100 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2009-02-15 15:35:47 +0100 |
commit | f7792e37654fb9d0509171d946d53e7697ad53e8 (patch) | |
tree | b96edcfceaa8695b81219402abb144038d3aea25 /src | |
parent | Renamed Application class files (diff) | |
download | rekonq-f7792e37654fb9d0509171d946d53e7697ad53e8.tar.xz |
BrowserApplication --> Application
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/application.cpp | 49 | ||||
-rw-r--r-- | src/application.h | 15 | ||||
-rw-r--r-- | src/history.cpp | 8 | ||||
-rw-r--r-- | src/main.cpp | 4 |
5 files changed, 38 insertions, 40 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b18f6275..6a7c5c2d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,6 +1,6 @@ SET( rekonq_SRCS autosaver.cpp - browserapplication.cpp + application.cpp mainwindow.cpp mainview.cpp tabbar.cpp diff --git a/src/application.cpp b/src/application.cpp index a82b095c..40addcac 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -2,7 +2,6 @@ * * This file is a part of the rekonq project * - * Copyright (C) 2007-2008 Trolltech ASA. All rights reserved * Copyright (C) 2008 by Andrea Diamantini <adjam7 at gmail dot com> * * @@ -20,7 +19,7 @@ // Local Includes -#include "browserapplication.h" +#include "application.h" #include "rekonq.h" @@ -53,12 +52,12 @@ -HistoryManager *BrowserApplication::s_historyManager = 0; -NetworkAccessManager *BrowserApplication::s_networkAccessManager = 0; +HistoryManager *Application::s_historyManager = 0; +NetworkAccessManager *Application::s_networkAccessManager = 0; -BrowserApplication::BrowserApplication(KCmdLineArgs *args, const QString &serverName) +Application::Application(KCmdLineArgs *args, const QString &serverName) : KApplication() , m_localServer(0) { @@ -104,23 +103,23 @@ BrowserApplication::BrowserApplication(KCmdLineArgs *args, const QString &server } -BrowserApplication::~BrowserApplication() +Application::~Application() { qDeleteAll(m_mainWindows); delete s_networkAccessManager; } -BrowserApplication *BrowserApplication::instance() +Application *Application::instance() { - return (static_cast<BrowserApplication *>(QCoreApplication::instance())); + return (static_cast<Application *>(QCoreApplication::instance())); } /*! Any actions that can be delayed until the window is visible */ -void BrowserApplication::postLaunch() +void Application::postLaunch() { QString directory = QDesktopServices::storageLocation(QDesktopServices::DataLocation); if ( directory.isEmpty() ) @@ -144,17 +143,17 @@ void BrowserApplication::postLaunch() mainWindow()->slotHome(); } } - BrowserApplication::historyManager(); + Application::historyManager(); } -void BrowserApplication::downloadUrl(const KUrl &srcUrl, const KUrl &destUrl) +void Application::downloadUrl(const KUrl &srcUrl, const KUrl &destUrl) { new Download( srcUrl, destUrl ); } -QList<MainWindow*> BrowserApplication::mainWindows() +QList<MainWindow*> Application::mainWindows() { clean(); QList<MainWindow*> list; @@ -166,7 +165,7 @@ QList<MainWindow*> BrowserApplication::mainWindows() } -void BrowserApplication::clean() +void Application::clean() { // cleanup any deleted main windows first for (int i = m_mainWindows.count() - 1; i >= 0; --i) @@ -179,7 +178,7 @@ void BrowserApplication::clean() } -void BrowserApplication::saveSession() +void Application::saveSession() { QWebSettings *globalSettings = QWebSettings::globalSettings(); if ( globalSettings->testAttribute( QWebSettings::PrivateBrowsingEnabled ) ) @@ -204,13 +203,13 @@ void BrowserApplication::saveSession() } -bool BrowserApplication::canRestoreSession() const +bool Application::canRestoreSession() const { return !m_lastSession.isEmpty(); } -void BrowserApplication::restoreLastSession() +void Application::restoreLastSession() { QList<QByteArray> windows; QBuffer buffer(&m_lastSession); @@ -243,20 +242,20 @@ void BrowserApplication::restoreLastSession() -bool BrowserApplication::isTheOnlyBrowser() const +bool Application::isTheOnlyBrowser() const { return (m_localServer != 0); } -void BrowserApplication::openUrl(const KUrl &url) +void Application::openUrl(const KUrl &url) { mainWindow()->loadUrl(url); } -MainWindow *BrowserApplication::newMainWindow() +MainWindow *Application::newMainWindow() { MainWindow *browser = new MainWindow(); m_mainWindows.prepend(browser); @@ -265,7 +264,7 @@ MainWindow *BrowserApplication::newMainWindow() } -MainWindow *BrowserApplication::mainWindow() +MainWindow *Application::mainWindow() { clean(); if (m_mainWindows.isEmpty()) @@ -274,7 +273,7 @@ MainWindow *BrowserApplication::mainWindow() } -void BrowserApplication::newLocalSocketConnection() +void Application::newLocalSocketConnection() { QLocalSocket *socket = m_localServer->nextPendingConnection(); if (!socket) @@ -295,13 +294,13 @@ void BrowserApplication::newLocalSocketConnection() -CookieJar *BrowserApplication::cookieJar() +CookieJar *Application::cookieJar() { return (CookieJar*)networkAccessManager()->cookieJar(); } -NetworkAccessManager *BrowserApplication::networkAccessManager() +NetworkAccessManager *Application::networkAccessManager() { if (!s_networkAccessManager) { @@ -313,7 +312,7 @@ NetworkAccessManager *BrowserApplication::networkAccessManager() -HistoryManager *BrowserApplication::historyManager() +HistoryManager *Application::historyManager() { if (!s_historyManager) { @@ -326,7 +325,7 @@ HistoryManager *BrowserApplication::historyManager() -KIcon BrowserApplication::icon(const KUrl &url) const +KIcon Application::icon(const KUrl &url) const { KIcon icon = KIcon( QWebSettings::iconForUrl(url) ); if (!icon.isNull()) diff --git a/src/application.h b/src/application.h index 9b47bfcc..05fc008e 100644 --- a/src/application.h +++ b/src/application.h @@ -2,7 +2,6 @@ * * This file is a part of the rekonq project * - * Copyright (C) 2007-2008 Trolltech ASA. All rights reserved * Copyright (C) 2008 by Andrea Diamantini <adjam7 at gmail dot com> * * @@ -19,8 +18,8 @@ * ============================================================ */ -#ifndef BROWSERAPPLICATION_H -#define BROWSERAPPLICATION_H +#ifndef REKONQ_APPLICATION_H +#define REKONQ_APPLICATION_H // KDE Includes #include <KApplication> @@ -43,14 +42,14 @@ class CookieJar; class HistoryManager; class NetworkAccessManager; -class BrowserApplication : public KApplication +class Application : public KApplication { Q_OBJECT public: - BrowserApplication(KCmdLineArgs*, const QString &); - ~BrowserApplication(); - static BrowserApplication *instance(); + Application(KCmdLineArgs*, const QString &); + ~Application(); + static Application *instance(); bool isTheOnlyBrowser() const; MainWindow *mainWindow(); @@ -86,5 +85,5 @@ private: mutable KIcon m_defaultIcon; }; -#endif // BROWSERAPPLICATION_H +#endif // REKONQ_APPLICATION_H diff --git a/src/history.cpp b/src/history.cpp index 652ee962..9813d438 100644 --- a/src/history.cpp +++ b/src/history.cpp @@ -27,7 +27,7 @@ // Local Includes #include "autosaver.h" -#include "browserapplication.h" +#include "application.h" // KDE Includes #include <KDebug> @@ -465,7 +465,7 @@ QVariant HistoryModel::data(const QModelIndex &index, int role) const } case Qt::DecorationRole: if (index.column() == 0) { - return BrowserApplication::instance()->icon(item.url); + return Application::instance()->icon(item.url); } } return QVariant(); @@ -643,7 +643,7 @@ bool HistoryMenu::prePopulated() { if (!m_history) { - m_history = BrowserApplication::historyManager(); + m_history = Application::historyManager(); m_historyMenuModel = new HistoryMenuModel(m_history->historyTreeModel(), this); setModel(m_historyMenuModel); } @@ -712,7 +712,7 @@ HistoryDialog::HistoryDialog(QWidget *parent, HistoryManager *setHistory) : QDia { HistoryManager *history = setHistory; if (!history) - history = BrowserApplication::historyManager(); + history = Application::historyManager(); setupUi(this); tree->setUniformRowHeights(true); tree->setSelectionBehavior(QAbstractItemView::SelectRows); diff --git a/src/main.cpp b/src/main.cpp index e53eef3c..c3ac0c00 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -19,7 +19,7 @@ * ============================================================ */ -#include "browserapplication.h" +#include "application.h" #include <KAboutData> #include <KCmdLineArgs> @@ -56,7 +56,7 @@ int main(int argc, char **argv) KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); - BrowserApplication app(args, "rekonq"); + Application app(args, "rekonq"); if (!app.isTheOnlyBrowser()) return 0; app.newMainWindow(); |