diff --git a/src/QupZilla.pro b/src/QupZilla.pro index b207ab097..129c88dee 100644 --- a/src/QupZilla.pro +++ b/src/QupZilla.pro @@ -84,7 +84,9 @@ SOURCES += main.cpp\ webview/webtab.cpp \ rss/rsswidget.cpp \ autofill/autofillnotification.cpp \ - rss/rssnotification.cpp + rss/rssnotification.cpp \ + navigation/locationpopup.cpp \ + preferences/sslmanager.cpp HEADERS += 3rdparty/squeezelabel.h \ 3rdparty/qtwin.h \ @@ -138,7 +140,9 @@ HEADERS += 3rdparty/squeezelabel.h \ webview/webtab.h \ rss/rsswidget.h \ autofill/autofillnotification.h \ - rss/rssnotification.h + rss/rssnotification.h \ + navigation/locationpopup.h \ + preferences/sslmanager.h FORMS += \ preferences/autofillmanager.ui \ @@ -157,7 +161,8 @@ FORMS += \ downloads/downloadmanager.ui \ rss/rsswidget.ui \ autofill/autofillnotification.ui \ - rss/rssnotification.ui + rss/rssnotification.ui \ + preferences/sslmanager.ui RESOURCES += \ data/icons.qrc \ diff --git a/src/app/appui.cpp b/src/app/appui.cpp index 2b3784213..8aa3cc7cb 100644 --- a/src/app/appui.cpp +++ b/src/app/appui.cpp @@ -53,7 +53,7 @@ void QupZilla::postLaunch() startUrl = m_homepage; if ( startingAfterCrash || (addTab && afterLaunch == 2) ) { - p_mainApp->restoreStateSlot(this); + mApp->restoreStateSlot(this); addTab = false; } } else diff --git a/src/app/autosaver.cpp b/src/app/autosaver.cpp index 51767b7e5..4e594672b 100644 --- a/src/app/autosaver.cpp +++ b/src/app/autosaver.cpp @@ -20,14 +20,13 @@ AutoSaver::AutoSaver(QObject *parent) : QObject(parent) - ,p_mainApp(MainApplication::getInstance()) { m_timer.start(1000*5, this); } void AutoSaver::timerEvent(QTimerEvent *event) { - if (event->timerId() == m_timer.timerId() && p_mainApp->isChanged()) + if (event->timerId() == m_timer.timerId() && mApp->isChanged()) emit saveApp(); else QObject::timerEvent(event); diff --git a/src/app/autosaver.h b/src/app/autosaver.h index ef5e1209d..da9231812 100644 --- a/src/app/autosaver.h +++ b/src/app/autosaver.h @@ -32,7 +32,6 @@ #include #include -class MainApplication; class AutoSaver : public QObject { Q_OBJECT @@ -46,7 +45,6 @@ public slots: private: void timerEvent(QTimerEvent *); - MainApplication* p_mainApp; QBasicTimer m_timer; }; diff --git a/src/app/mainapplication.h b/src/app/mainapplication.h index 2801ee527..2119bf8ab 100644 --- a/src/app/mainapplication.h +++ b/src/app/mainapplication.h @@ -17,6 +17,7 @@ * ============================================================ */ #ifndef MAINAPPLICATION_H #define MAINAPPLICATION_H +#define mApp MainApplication::getInstance() #if defined(QT_NO_DEBUG) & !defined(QT_NO_DEBUG_OUTPUT) #define QT_NO_DEBUG_OUTPUT diff --git a/src/app/qupzilla.cpp b/src/app/qupzilla.cpp index 0ffb0def4..c2a22a288 100644 --- a/src/app/qupzilla.cpp +++ b/src/app/qupzilla.cpp @@ -53,7 +53,6 @@ const QString QupZilla::WEBKITVERSION=qWebKitVersion(); QupZilla::QupZilla(bool tryRestore, QUrl startUrl) : QMainWindow() - ,p_mainApp(MainApplication::getInstance()) ,m_tryRestore(tryRestore) ,m_startingUrl(startUrl) ,m_actionPrivateBrowsing(0) @@ -65,15 +64,15 @@ QupZilla::QupZilla(bool tryRestore, QUrl startUrl) : this->setWindowTitle("QupZilla"); setUpdatesEnabled(false); - m_activeProfil = p_mainApp->getActiveProfil(); - m_activeLanguage = p_mainApp->getActiveLanguage(); + m_activeProfil = mApp->getActiveProfil(); + m_activeLanguage = mApp->getActiveLanguage(); QDesktopServices::setUrlHandler("http", this, "loadAddress"); setupUi(); setupMenu(); QTimer::singleShot(0, this, SLOT(postLaunch())); - connect(p_mainApp, SIGNAL(message(MainApplication::MessageType,bool)), this, SLOT(receiveMessage(MainApplication::MessageType,bool))); + connect(mApp, SIGNAL(message(MainApplication::MessageType,bool)), this, SLOT(receiveMessage(MainApplication::MessageType,bool))); } void QupZilla::loadSettings() @@ -86,7 +85,7 @@ void QupZilla::loadSettings() m_newtab = settings.value("newTabUrl","").toUrl(); settings.endGroup(); - QWebSettings* websettings=p_mainApp->webSettings(); + QWebSettings* websettings=mApp->webSettings(); websettings->setAttribute(QWebSettings::JavascriptCanAccessClipboard, true); //Web browsing settings settings.beginGroup("Web-Browser-Settings"); @@ -127,8 +126,8 @@ void QupZilla::loadSettings() m_buttonNext->setVisible(showBackForwardIcons); //Private browsing - m_actionPrivateBrowsing->setChecked( p_mainApp->webSettings()->testAttribute(QWebSettings::PrivateBrowsingEnabled) ); - m_privateBrowsing->setVisible( p_mainApp->webSettings()->testAttribute(QWebSettings::PrivateBrowsingEnabled) ); + m_actionPrivateBrowsing->setChecked( mApp->webSettings()->testAttribute(QWebSettings::PrivateBrowsingEnabled) ); + m_privateBrowsing->setVisible( mApp->webSettings()->testAttribute(QWebSettings::PrivateBrowsingEnabled) ); if (!makeTransparent) return; @@ -354,7 +353,7 @@ void QupZilla::aboutToShowHelpMenu() m_menuHelp->clear(); m_menuHelp->addAction(tr("Report Bug"), this, SLOT(reportBug())); m_menuHelp->addSeparator(); - p_mainApp->plugins()->populateHelpMenu(m_menuHelp); + mApp->plugins()->populateHelpMenu(m_menuHelp); m_menuHelp->addAction(QIcon(":/icons/menu/qt.png"), tr("About Qt"), qApp, SLOT(aboutQt())); m_menuHelp->addAction(QIcon(":/icons/qupzilla.png"), tr("About QupZilla"), this, SLOT(aboutQupZilla())); } @@ -371,11 +370,11 @@ void QupZilla::aboutToShowToolsMenu() m_menuTools->addAction(QIcon::fromTheme("edit-clear"), tr("Clear Recent History"), this, SLOT(showClearPrivateData())); m_actionPrivateBrowsing = new QAction(tr("Private Browsing"), this); m_actionPrivateBrowsing->setCheckable(true); - m_actionPrivateBrowsing->setChecked(p_mainApp->webSettings()->testAttribute(QWebSettings::PrivateBrowsingEnabled)); + m_actionPrivateBrowsing->setChecked(mApp->webSettings()->testAttribute(QWebSettings::PrivateBrowsingEnabled)); connect(m_actionPrivateBrowsing, SIGNAL(triggered(bool)), this, SLOT(startPrivate(bool))); m_menuTools->addAction(m_actionPrivateBrowsing); m_menuTools->addSeparator(); - p_mainApp->plugins()->populateToolsMenu(m_menuTools); + mApp->plugins()->populateToolsMenu(m_menuTools); m_menuTools->addAction(QIcon(":/icons/faenza/settings.png"), tr("Preferences"), this, SLOT(showPreferences()))->setShortcut(QKeySequence("Ctrl+P")); } @@ -392,17 +391,17 @@ void QupZilla::aboutToShowViewMenu() void QupZilla::bookmarkPage() { - p_mainApp->bookmarksManager()->addBookmark(weView()); + mApp->bookmarksManager()->addBookmark(weView()); } void QupZilla::addBookmark(const QUrl &url, const QString &title) { - p_mainApp->bookmarksManager()->insertBookmark(url, title); + mApp->bookmarksManager()->insertBookmark(url, title); } void QupZilla::bookmarkAllTabs() { - p_mainApp->bookmarksManager()->insertAllTabs(); + mApp->bookmarksManager()->insertAllTabs(); } void QupZilla::loadActionUrl() @@ -422,14 +421,14 @@ void QupZilla::urlEnter() void QupZilla::showCookieManager() { - CookieManager* m = p_mainApp->cookieManager(); + CookieManager* m = mApp->cookieManager(); m->refreshTable(); m->show(); } void QupZilla::showHistoryManager() { - HistoryManager* m = p_mainApp->historyManager(); + HistoryManager* m = mApp->historyManager(); m->refreshTable(); m->setMainWindow(this); m->show(); @@ -437,7 +436,7 @@ void QupZilla::showHistoryManager() void QupZilla::showRSSManager() { - RSSManager* m = p_mainApp->rssManager(); + RSSManager* m = mApp->rssManager(); m->refreshTable(); m->setMainWindow(this); m->show(); @@ -445,7 +444,7 @@ void QupZilla::showRSSManager() void QupZilla::showBookmarksManager() { - BookmarksManager* m = p_mainApp->bookmarksManager(); + BookmarksManager* m = mApp->bookmarksManager(); m->refreshTable(); m->setMainWindow(this); m->show(); @@ -459,7 +458,7 @@ void QupZilla::showClearPrivateData() void QupZilla::showDownloadManager() { - MainApplication::getInstance()->downManager()->show(); + mApp->downManager()->show(); } void QupZilla::showPreferences() @@ -611,7 +610,7 @@ void QupZilla::savePage() { QNetworkRequest request(weView()->url()); - DownloadManager* dManager = MainApplication::getInstance()->downManager(); + DownloadManager* dManager = mApp->downManager(); dManager->download(request); } @@ -644,15 +643,15 @@ void QupZilla::startPrivate(bool state) if (button != QMessageBox::Yes) return; } - p_mainApp->webSettings()->setAttribute(QWebSettings::PrivateBrowsingEnabled, state); - p_mainApp->history()->setSaving(!state); - p_mainApp->cookieJar()->setAllowCookies(!state); + mApp->webSettings()->setAttribute(QWebSettings::PrivateBrowsingEnabled, state); + mApp->history()->setSaving(!state); + mApp->cookieJar()->setAllowCookies(!state); emit message(MainApplication::CheckPrivateBrowsing, state); } void QupZilla::closeEvent(QCloseEvent* event) { - if (p_mainApp->isClosing()) + if (mApp->isClosing()) return; QSettings settings(m_activeProfil+"settings.ini", QSettings::IniFormat); @@ -668,9 +667,9 @@ void QupZilla::closeEvent(QCloseEvent* event) } settings.endGroup(); - p_mainApp->cookieJar()->saveCookies(); - p_mainApp->saveStateSlot(); - p_mainApp->aboutToCloseWindow(this); + mApp->cookieJar()->saveCookies(); + mApp->saveStateSlot(); + mApp->aboutToCloseWindow(this); this->~QupZilla(); event->accept(); @@ -689,7 +688,7 @@ void QupZilla::quitApp() } settings.endGroup(); - p_mainApp->quitApplication(); + mApp->quitApplication(); } QupZilla::~QupZilla() diff --git a/src/app/qupzilla.h b/src/app/qupzilla.h index 739f373d7..06c532d42 100644 --- a/src/app/qupzilla.h +++ b/src/app/qupzilla.h @@ -101,7 +101,6 @@ public: inline LocationBar* locationBar(){ return m_locationBar; } inline TabWidget* tabWidget(){ return m_tabWidget; } inline BookmarksToolbar* bookmarksToolbar(){ return m_bookmarksToolbar; } - inline MainApplication* getMainApp() { return p_mainApp; } inline QAction* buttonStop(){ return m_buttonStop; } inline QAction* buttonReload(){ return m_buttonReload; } @@ -165,7 +164,7 @@ private slots: void showPreferences(); void bookmarkAllTabs(); - void newWindow() { p_mainApp->makeNewWindow(false); } + void newWindow() { mApp->makeNewWindow(false); } void openLocation() { m_locationBar->setFocus(); m_locationBar->selectAll(); } void openFile(); @@ -189,8 +188,6 @@ private: void setupUi(); void setupMenu(); - MainApplication* p_mainApp; - bool m_tryRestore; QUrl m_startingUrl; QUrl m_newtab; diff --git a/src/autofill/autofillmodel.cpp b/src/autofill/autofillmodel.cpp index 2e8b34de9..cf1f8801f 100644 --- a/src/autofill/autofillmodel.cpp +++ b/src/autofill/autofillmodel.cpp @@ -31,7 +31,7 @@ AutoFillModel::AutoFillModel(QupZilla* mainClass, QObject *parent) : void AutoFillModel::loadSettings() { - QSettings settings(MainApplication::getInstance()->getActiveProfil()+"settings.ini", QSettings::IniFormat); + QSettings settings(mApp->getActiveProfil()+"settings.ini", QSettings::IniFormat); settings.beginGroup("Web-Browser-Settings"); m_isStoring = settings.value("AutoFillForms",true).toBool(); settings.endGroup(); @@ -150,7 +150,7 @@ void AutoFillModel::completePage(WebView* view) void AutoFillModel::post(const QNetworkRequest &request, const QByteArray &outgoingData) { //Dont save in private browsing - if (MainApplication::getInstance()->webSettings()->testAttribute(QWebSettings::PrivateBrowsingEnabled)) + if (mApp->webSettings()->testAttribute(QWebSettings::PrivateBrowsingEnabled)) return; m_lastOutgoingData = outgoingData; diff --git a/src/autofill/autofillnotification.cpp b/src/autofill/autofillnotification.cpp index dfcd7f6b6..f379ecbcd 100644 --- a/src/autofill/autofillnotification.cpp +++ b/src/autofill/autofillnotification.cpp @@ -69,13 +69,13 @@ void AutoFillNotification::frameChanged(int frame) void AutoFillNotification::never() { - MainApplication::getInstance()->autoFill()->blockStoringfor(m_url); + mApp->autoFill()->blockStoringfor(m_url); hide(); } void AutoFillNotification::remember() { - MainApplication::getInstance()->autoFill()->addEntry(m_url, m_data, m_pass); + mApp->autoFill()->addEntry(m_url, m_data, m_pass); hide(); } diff --git a/src/bookmarks/bookmarksmanager.cpp b/src/bookmarks/bookmarksmanager.cpp index fd99bb22b..a81caf0b5 100644 --- a/src/bookmarks/bookmarksmanager.cpp +++ b/src/bookmarks/bookmarksmanager.cpp @@ -32,7 +32,7 @@ BookmarksManager::BookmarksManager(QupZilla* mainClass, QWidget *parent) : ,m_isRefreshing(false) ,ui(new Ui::BookmarksManager) ,p_QupZilla(mainClass) - ,m_bookmarksModel(MainApplication::getInstance()->bookmarks()) + ,m_bookmarksModel(mApp->bookmarks()) { ui->setupUi(this); //CENTER on scren @@ -52,7 +52,7 @@ BookmarksManager::BookmarksManager(QupZilla* mainClass, QWidget *parent) : QupZilla* BookmarksManager::getQupZilla() { if (!p_QupZilla) - p_QupZilla = MainApplication::getInstance()->getWindow(); + p_QupZilla = mApp->getWindow(); return p_QupZilla; } diff --git a/src/bookmarks/bookmarksmodel.cpp b/src/bookmarks/bookmarksmodel.cpp index 2d5030088..aa9dfd022 100644 --- a/src/bookmarks/bookmarksmodel.cpp +++ b/src/bookmarks/bookmarksmodel.cpp @@ -31,7 +31,7 @@ BookmarksModel::BookmarksModel() void BookmarksModel::loadSettings() { - QSettings settings(MainApplication::getInstance()->getActiveProfil()+"settings.ini", QSettings::IniFormat); + QSettings settings(mApp->getActiveProfil()+"settings.ini", QSettings::IniFormat); settings.beginGroup("Web-Browser-Settings"); m_showMostVisited = settings.value("showMostVisited",true).toBool(); settings.endGroup(); @@ -39,7 +39,7 @@ void BookmarksModel::loadSettings() void BookmarksModel::setShowingMostVisited(bool state) { - QSettings settings(MainApplication::getInstance()->getActiveProfil()+"settings.ini", QSettings::IniFormat); + QSettings settings(mApp->getActiveProfil()+"settings.ini", QSettings::IniFormat); settings.beginGroup("Web-Browser-Settings"); settings.setValue("showMostVisited",state); settings.endGroup(); diff --git a/src/bookmarks/bookmarkstoolbar.cpp b/src/bookmarks/bookmarkstoolbar.cpp index 68e89a81d..818e2af27 100644 --- a/src/bookmarks/bookmarkstoolbar.cpp +++ b/src/bookmarks/bookmarkstoolbar.cpp @@ -82,7 +82,7 @@ void BookmarksToolbar::hidePanel() void BookmarksToolbar::refreshBookmarks() { if (!m_bookmarksModel) - m_bookmarksModel =MainApplication::getInstance()->bookmarks(); + m_bookmarksModel =mApp->bookmarks(); clear(); QSqlQuery query; diff --git a/src/bookmarks/bookmarkswidget.cpp b/src/bookmarks/bookmarkswidget.cpp index ffdf4b92c..e7d949e66 100644 --- a/src/bookmarks/bookmarkswidget.cpp +++ b/src/bookmarks/bookmarkswidget.cpp @@ -32,7 +32,7 @@ BookmarksWidget::BookmarksWidget(int bookmarkId, QWidget *parent) : connect(ui->removeBookmark, SIGNAL(clicked()), this, SLOT(removeBookmark())); connect(ui->save, SIGNAL(clicked()), this, SLOT(saveBookmark())); - m_bookmarksModel = MainApplication::getInstance()->bookmarks(); + m_bookmarksModel = mApp->bookmarks(); loadBookmark(); } diff --git a/src/cookies/cookiejar.cpp b/src/cookies/cookiejar.cpp index ebc73b5fc..1e607d0f9 100644 --- a/src/cookies/cookiejar.cpp +++ b/src/cookies/cookiejar.cpp @@ -25,8 +25,8 @@ CookieJar::CookieJar(QupZilla* mainClass, QObject *parent) : ,p_QupZilla(mainClass) { loadSettings(); -// activeProfil = MainApplication::getInstance()->getActiveProfil(); - m_activeProfil = MainApplication::getInstance()->getActiveProfil(); +// activeProfil = mApp->getActiveProfil(); + m_activeProfil = mApp->getActiveProfil(); } void CookieJar::loadSettings() diff --git a/src/cookies/cookiemanager.cpp b/src/cookies/cookiemanager.cpp index 1c93a10d4..330c2c343 100644 --- a/src/cookies/cookiemanager.cpp +++ b/src/cookies/cookiemanager.cpp @@ -51,7 +51,7 @@ void CookieManager::removeAll() return; m_cookies.clear(); - MainApplication::getInstance()->cookieJar()->setAllCookies(m_cookies); + mApp->cookieJar()->setAllCookies(m_cookies); ui->cookieTree->clear(); } @@ -69,14 +69,14 @@ void CookieManager::removeCookie() } delete current; - MainApplication::getInstance()->cookieJar()->setAllCookies(m_cookies); + mApp->cookieJar()->setAllCookies(m_cookies); refreshTable(false); return; } int index = current->whatsThis(1).toInt(); m_cookies.removeAt(index); - MainApplication::getInstance()->cookieJar()->setAllCookies(m_cookies); + mApp->cookieJar()->setAllCookies(m_cookies); refreshTable(false); if (!ui->search->text().isEmpty()) @@ -118,7 +118,7 @@ void CookieManager::currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem void CookieManager::refreshTable(bool refreshCookieJar) { if (refreshCookieJar) - m_cookies = MainApplication::getInstance()->cookieJar()->getAllCookies(); + m_cookies = mApp->cookieJar()->getAllCookies(); ui->cookieTree->setUpdatesEnabled(false); ui->cookieTree->clear(); diff --git a/src/downloads/downloaditem.ui b/src/downloads/downloaditem.ui index 2e31f7b7c..defea3692 100644 --- a/src/downloads/downloaditem.ui +++ b/src/downloads/downloaditem.ui @@ -11,7 +11,7 @@ - Form + diff --git a/src/downloads/downloadmanager.cpp b/src/downloads/downloadmanager.cpp index b3f5e96bc..3f2ec978d 100644 --- a/src/downloads/downloadmanager.cpp +++ b/src/downloads/downloadmanager.cpp @@ -37,7 +37,7 @@ DownloadManager::DownloadManager(QWidget *parent) : m_iconProvider = new QFileIconProvider(); m_networkManager = new QNetworkAccessManager(); - QSettings settings(MainApplication::getInstance()->getActiveProfil()+"settings.ini", QSettings::IniFormat); + QSettings settings(mApp->getActiveProfil()+"settings.ini", QSettings::IniFormat); settings.beginGroup("DownloadManager"); m_downloadPath = settings.value("defaultDownloadPath", QDir::homePath()).toString(); m_lastDownloadPath = settings.value("lastDownloadPath","").toString(); @@ -147,7 +147,7 @@ void DownloadManager::handleUnsupportedContent(QNetworkReply *reply) QString _fileName = getFileName(reply); if (m_downloadPath.isEmpty()) - userFileName = QFileDialog::getSaveFileName(MainApplication::getInstance()->getWindow(), tr("Save file as..."),m_lastDownloadPath+_fileName); + userFileName = QFileDialog::getSaveFileName(mApp->getWindow(), tr("Save file as..."),m_lastDownloadPath+_fileName); else userFileName = m_downloadPath+_fileName; @@ -164,7 +164,7 @@ void DownloadManager::handleUnsupportedContent(QNetworkReply *reply) } m_lastDownloadPath = path; - QSettings settings(MainApplication::getInstance()->getActiveProfil()+"settings.ini", QSettings::IniFormat); + QSettings settings(mApp->getActiveProfil()+"settings.ini", QSettings::IniFormat); settings.beginGroup("DownloadManager"); settings.setValue("lastDownloadPath",m_lastDownloadPath); settings.endGroup(); @@ -241,7 +241,7 @@ bool DownloadManager::canClose() void DownloadManager::closeEvent(QCloseEvent *e) { - if (!MainApplication::getInstance()->getWindow()) { // No main windows -> we are going to quit + if (!mApp->getWindow()) { // No main windows -> we are going to quit if (!canClose()){ QMessageBox::StandardButton button = QMessageBox::warning(this, tr("Warning"), tr("Are you sure to quit? All uncompleted downloads will be cancelled!"), QMessageBox::Yes | QMessageBox::No); @@ -251,7 +251,7 @@ void DownloadManager::closeEvent(QCloseEvent *e) } m_isClosing = true; } - MainApplication::getInstance()->quitApplication(); + mApp->quitApplication(); } e->accept(); } diff --git a/src/history/historymanager.cpp b/src/history/historymanager.cpp index 72362cd88..96804123b 100644 --- a/src/history/historymanager.cpp +++ b/src/history/historymanager.cpp @@ -47,7 +47,7 @@ HistoryManager::HistoryManager(QupZilla* mainClass, QWidget *parent) : QupZilla* HistoryManager::getQupZilla() { if (!p_QupZilla) - p_QupZilla = MainApplication::getInstance()->getWindow(); + p_QupZilla = mApp->getWindow(); return p_QupZilla; } diff --git a/src/history/historymodel.cpp b/src/history/historymodel.cpp index f9bb88798..175c3836c 100644 --- a/src/history/historymodel.cpp +++ b/src/history/historymodel.cpp @@ -29,7 +29,7 @@ HistoryModel::HistoryModel(QupZilla *mainClass, QObject *parent) void HistoryModel::loadSettings() { - QSettings settings(MainApplication::getInstance()->getActiveProfil()+"settings.ini", QSettings::IniFormat); + QSettings settings(mApp->getActiveProfil()+"settings.ini", QSettings::IniFormat); settings.beginGroup("Web-Browser-Settings"); m_isSaving = settings.value("allowHistory",true).toBool(); } diff --git a/src/navigation/locationbar.cpp b/src/navigation/locationbar.cpp index 2727c09c8..9d4754d75 100644 --- a/src/navigation/locationbar.cpp +++ b/src/navigation/locationbar.cpp @@ -84,11 +84,12 @@ LocationBar::LocationBar(QupZilla* mainClass, QWidget *parent) m_locationCompleter = new LocationCompleter(); setCompleter(m_locationCompleter); +// LocationPopup* com = new LocationPopup(this); connect(this, SIGNAL(textEdited(QString)), this, SLOT(textEdit())); connect(this, SIGNAL(textEdited(QString)), m_locationCompleter, SLOT(refreshCompleter(QString))); connect(m_locationCompleter->popup(), SIGNAL(clicked(QModelIndex)), p_QupZilla, SLOT(urlEnter())); connect(m_siteIcon, SIGNAL(clicked()), this, SLOT(showSiteInfo())); - connect(down, SIGNAL(clicked(QPoint)), this, SLOT(showPopup())); +// connect(down, SIGNAL(clicked(QPoint)), com, SLOT(show())); connect(m_goButton, SIGNAL(clicked(QPoint)), p_QupZilla, SLOT(urlEnter())); connect(m_bookmarkButton, SIGNAL(clicked(QPoint)), this, SLOT(bookmarkIconClicked())); connect(m_rssIcon, SIGNAL(clicked(QPoint)), this, SLOT(rssIconClicked())); @@ -237,7 +238,7 @@ void LocationBar::showUrl(const QUrl &url, bool empty) hideGoButton(); if (!m_bookmarksModel) - m_bookmarksModel = MainApplication::getInstance()->bookmarks(); + m_bookmarksModel = mApp->bookmarks(); checkBookmark(); m_rssIcon->setVisible(p_QupZilla->weView()->hasRss()); diff --git a/src/navigation/locationpopup.cpp b/src/navigation/locationpopup.cpp new file mode 100644 index 000000000..73f0c9bc4 --- /dev/null +++ b/src/navigation/locationpopup.cpp @@ -0,0 +1,79 @@ +/* ============================================================ +* QupZilla - WebKit based browser +* Copyright (C) 2010-2011 nowrep +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +* ============================================================ */ +#include "locationpopup.h" +#if 0 +LocationPopup::LocationPopup(QWidget *parent) + :QAbstractItemView() + ,m_parent(parent) +{ + setWindowFlags(Qt::Popup); +}r + +void LocationPopup::show() +{ + QPoint p = m_parent->mapToGlobal(QPoint(0, 0)); + move( (p.x() ), (p.y() + m_parent->height())); + resize(m_parent->width(), 100); + QAbstractItemView::show(); +} + +QRect LocationPopup::visualRect(const QModelIndex &index) const +{ + +} + +void LocationPopup::scrollTo(const QModelIndex &index, ScrollHint hint) +{ + +} + +QModelIndex LocationPopup::indexAt(const QPoint &point) const +{ + +} + +QModelIndex LocationPopup::moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers) +{ + +} + +int LocationPopup::horizontalOffset() const +{ + +} + +int LocationPopup::verticalOffset() const +{ + +} + +bool LocationPopup::isIndexHidden(const QModelIndex &index) const +{ + +} + +void LocationPopup::setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags command) +{ + +} + +QRegion LocationPopup::visualRegionForSelection(const QItemSelection &selection) const +{ + +} +#endif diff --git a/src/navigation/locationpopup.h b/src/navigation/locationpopup.h new file mode 100644 index 000000000..3f044e318 --- /dev/null +++ b/src/navigation/locationpopup.h @@ -0,0 +1,49 @@ +/* ============================================================ +* QupZilla - WebKit based browser +* Copyright (C) 2010-2011 nowrep +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +* ============================================================ */ +#ifndef LOCATIONPOPUP_H +#define LOCATIONPOPUP_H +#if 0 +#include +#include + +class LocationPopup : public QAbstractItemView +{ + Q_OBJECT +public: + explicit LocationPopup(QWidget *parent = 0); + +signals: + +public slots: + void show(); +private: + QRect visualRect(const QModelIndex &index) const; + void scrollTo(const QModelIndex &index, ScrollHint hint); + QModelIndex indexAt(const QPoint &point) const; + QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers); + int horizontalOffset() const; + int verticalOffset() const; + bool isIndexHidden(const QModelIndex &index) const; + void setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags command); + QRegion visualRegionForSelection(const QItemSelection &selection) const; + + QWidget* m_parent; +}; + +#endif // LOCATIONPOPUP_H +#endif diff --git a/src/network/networkmanager.cpp b/src/network/networkmanager.cpp index a267ec27a..d82c261aa 100644 --- a/src/network/networkmanager.cpp +++ b/src/network/networkmanager.cpp @@ -33,12 +33,12 @@ NetworkManager::NetworkManager(QupZilla* mainClass, QObject *parent) : void NetworkManager::loadSettings() { - QSettings settings(MainApplication::getInstance()->getActiveProfil()+"settings.ini", QSettings::IniFormat); + QSettings settings(mApp->getActiveProfil()+"settings.ini", QSettings::IniFormat); settings.beginGroup("Web-Browser-Settings"); if (settings.value("AllowLocalCache", true).toBool()) { m_diskCache = new QNetworkDiskCache(this); - m_diskCache->setCacheDirectory(MainApplication::getInstance()->getActiveProfil()+"/networkcache"); + m_diskCache->setCacheDirectory(mApp->getActiveProfil()+"/networkcache"); m_diskCache->setMaximumCacheSize(settings.value("MaximumCacheSize",50).toInt() * 1024*1024); //MegaBytes setCache(m_diskCache); } @@ -118,7 +118,7 @@ void NetworkManager::authentication(QNetworkReply* reply, QAuthenticator* auth) formLa->addRow(save); formLa->addWidget(box); - AutoFillModel* fill = MainApplication::getInstance()->autoFill(); + AutoFillModel* fill = mApp->autoFill(); if (fill->isStored(reply->url())) { save->setChecked(true); user->setText(fill->getUsername(reply->url())); @@ -127,7 +127,7 @@ void NetworkManager::authentication(QNetworkReply* reply, QAuthenticator* auth) emit wantsFocus(reply->url()); //Do not save when private browsing is enabled - if (p_QupZilla->getMainApp()->webSettings()->testAttribute(QWebSettings::PrivateBrowsingEnabled)) + if (mApp->webSettings()->testAttribute(QWebSettings::PrivateBrowsingEnabled)) save->setVisible(false); if (!dialog->exec() == QDialog::Accepted) @@ -143,7 +143,7 @@ QNetworkReply *NetworkManager::createRequest(QNetworkAccessManager::Operation op { if (op == PostOperation && outgoingData) { QByteArray outgoingDataByteArray = outgoingData->peek(1024 * 1024); - MainApplication::getInstance()->autoFill()->post(request, outgoingDataByteArray); + mApp->autoFill()->post(request, outgoingDataByteArray); } QNetworkRequest req = request; @@ -155,7 +155,7 @@ QNetworkReply *NetworkManager::createRequest(QNetworkAccessManager::Operation op void NetworkManager::saveCertExceptions() { - QFile file(MainApplication::getInstance()->getActiveProfil()+"sslexceptions.dat"); + QFile file(mApp->getActiveProfil()+"sslexceptions.dat"); file.open(QIODevice::WriteOnly); QDataStream stream(&file); @@ -171,7 +171,7 @@ void NetworkManager::saveCertExceptions() void NetworkManager::loadCertExceptions() { - QFile file(MainApplication::getInstance()->getActiveProfil()+"sslexceptions.dat"); + QFile file(mApp->getActiveProfil()+"sslexceptions.dat"); file.open(QIODevice::ReadOnly); QDataStream stream(&file); diff --git a/src/network/networkmanager.h b/src/network/networkmanager.h index b5c969efe..6cfe83dc3 100644 --- a/src/network/networkmanager.h +++ b/src/network/networkmanager.h @@ -43,6 +43,7 @@ public: explicit NetworkManager(QupZilla* mainClass, QObject *parent = 0); QNetworkReply *createRequest(QNetworkAccessManager::Operation op, const QNetworkRequest &request, QIODevice *outgoingData); + QList& getCertExceptions() { return m_certExceptions; } void saveCertExceptions(); void loadCertExceptions(); void loadSettings(); diff --git a/src/network/networkmanagerproxy.cpp b/src/network/networkmanagerproxy.cpp index ee2b3df53..36e3fe5b8 100644 --- a/src/network/networkmanagerproxy.cpp +++ b/src/network/networkmanagerproxy.cpp @@ -28,7 +28,7 @@ NetworkManagerProxy::NetworkManagerProxy(QupZilla* mainClass, QObject *parent) : ,m_view(0) ,m_page(0) { - setCookieJar(MainApplication::getInstance()->cookieJar()); + setCookieJar(mApp->cookieJar()); } void NetworkManagerProxy::populateNetworkRequest(QNetworkRequest &request) diff --git a/src/other/aboutdialog.cpp b/src/other/aboutdialog.cpp index a6432b85e..a84fe2daf 100644 --- a/src/other/aboutdialog.cpp +++ b/src/other/aboutdialog.cpp @@ -51,7 +51,7 @@ void AboutDialog::showAbout() m_aboutHtml.append(tr("

© %1 %2
All rights reserved.
").arg(QupZilla::COPYRIGHT, QupZilla::AUTHOR)); m_aboutHtml.append(tr("Build time: %1

").arg(QupZilla::BUILDTIME)); m_aboutHtml.append(QString("

%1

").arg(QupZilla::WWWADDRESS)); - m_aboutHtml.append("

"+MainApplication::getInstance()->getWindow()->weView()->getPage()->userAgentForUrl(QUrl())+"

"); + m_aboutHtml.append("

"+mApp->getWindow()->weView()->getPage()->userAgentForUrl(QUrl())+"

"); m_aboutHtml.append(""); } ui->textBrowser->setHtml(m_aboutHtml); diff --git a/src/other/clearprivatedata.cpp b/src/other/clearprivatedata.cpp index 69501ad94..a81e1cb3b 100644 --- a/src/other/clearprivatedata.cpp +++ b/src/other/clearprivatedata.cpp @@ -78,14 +78,14 @@ void ClearPrivateData::dialogAccepted() } if (m_clearCookies->isChecked()) { QList cookies; - p_QupZilla->getMainApp()->cookieJar()->setAllCookies(cookies); + mApp->cookieJar()->setAllCookies(cookies); } if (m_clearCache->isChecked()) { - p_QupZilla->getMainApp()->webSettings()->clearMemoryCaches(); - p_QupZilla->getMainApp()->networkManager()->cache()->clear(); + mApp->webSettings()->clearMemoryCaches(); + mApp->networkManager()->cache()->clear(); } if (m_clearIcons->isChecked()) { - p_QupZilla->getMainApp()->webSettings()->clearIconDatabase(); + mApp->webSettings()->clearIconDatabase(); } close(); } diff --git a/src/plugins/clicktoflash.cpp b/src/plugins/clicktoflash.cpp index a02d28ed4..84e6d0c69 100644 --- a/src/plugins/clicktoflash.cpp +++ b/src/plugins/clicktoflash.cpp @@ -88,7 +88,7 @@ void ClickToFlash::customContextMenuRequested(const QPoint &pos) void ClickToFlash::toWhitelist() { - MainApplication::getInstance()->plugins()->c2f_addWhitelist(m_url.host()); + mApp->plugins()->c2f_addWhitelist(m_url.host()); load(); } diff --git a/src/plugins/pluginproxy.cpp b/src/plugins/pluginproxy.cpp index 5472a7e3a..a38a50244 100644 --- a/src/plugins/pluginproxy.cpp +++ b/src/plugins/pluginproxy.cpp @@ -70,7 +70,7 @@ void PluginProxy::populateHelpMenu(QMenu *menu) void PluginProxy::c2f_loadSettings() { - QSettings settings(MainApplication::getInstance()->getActiveProfil()+"settings.ini", QSettings::IniFormat); + QSettings settings(mApp->getActiveProfil()+"settings.ini", QSettings::IniFormat); settings.beginGroup("ClickToFlash"); c2f_whitelist = settings.value("whitelist", QStringList()).toStringList(); c2f_enabled = settings.value("Enabled", true).toBool(); @@ -79,7 +79,7 @@ void PluginProxy::c2f_loadSettings() void PluginProxy::c2f_saveSettings() { - QSettings settings(MainApplication::getInstance()->getActiveProfil()+"settings.ini", QSettings::IniFormat); + QSettings settings(mApp->getActiveProfil()+"settings.ini", QSettings::IniFormat); settings.beginGroup("ClickToFlash"); settings.setValue("whitelist", c2f_whitelist); settings.setValue("Enabled", c2f_enabled); diff --git a/src/plugins/plugins.cpp b/src/plugins/plugins.cpp index e1e8a81b2..a01221540 100644 --- a/src/plugins/plugins.cpp +++ b/src/plugins/plugins.cpp @@ -29,7 +29,7 @@ void Plugins::loadSettings() { m_allowedPluginFileNames.clear(); - QSettings settings(MainApplication::getInstance()->getActiveProfil()+"settings.ini", QSettings::IniFormat); + QSettings settings(mApp->getActiveProfil()+"settings.ini", QSettings::IniFormat); settings.beginGroup("Plugin-Settings"); m_pluginsEnabled = settings.value("EnablePlugins", true).toBool(); m_allowedPluginFileNames = settings.value("AllowedPlugins", QStringList()).toStringList(); @@ -44,7 +44,7 @@ void Plugins::loadPlugins() m_availablePluginFileNames.clear(); loadedPlugins.clear(); - QDir pluginsDir = QDir(MainApplication::getInstance()->DATADIR+"plugins/"); + QDir pluginsDir = QDir(mApp->DATADIR+"plugins/"); foreach (QString fileName, pluginsDir.entryList(QDir::Files)) { m_availablePluginFileNames.append(fileName); @@ -56,13 +56,13 @@ void Plugins::loadPlugins() QObject *plugin = loader.instance(); if (plugin) { PluginInterface *iPlugin = qobject_cast(plugin); - iPlugin->init(MainApplication::getInstance()->getActiveProfil()+"plugins.ini"); + iPlugin->init(mApp->getActiveProfil()+"plugins.ini"); if (!iPlugin->testPlugin()) { loader.unload(); continue; } - qApp->installTranslator(iPlugin->getTranslator(MainApplication::getInstance()->getActiveLanguage())); + qApp->installTranslator(iPlugin->getTranslator(mApp->getActiveLanguage())); loadedPlugins.append(iPlugin); m_loadedPluginFileNames.append(fileName); } @@ -72,7 +72,7 @@ void Plugins::loadPlugins() PluginInterface* Plugins::getPlugin(QString pluginFileName) { - QString path = MainApplication::getInstance()->DATADIR+"plugins/"+pluginFileName; + QString path = mApp->DATADIR+"plugins/"+pluginFileName; if (!QFile::exists(path)) return 0; QPluginLoader loader(path); diff --git a/src/plugins/webpluginfactory.cpp b/src/plugins/webpluginfactory.cpp index c9bd37c3b..4f3d99232 100644 --- a/src/plugins/webpluginfactory.cpp +++ b/src/plugins/webpluginfactory.cpp @@ -37,11 +37,11 @@ QObject* WebPluginFactory::create(const QString &mimeType, const QUrl &url, cons return 0; } - if (!MainApplication::getInstance()->plugins()->c2f_isEnabled()) + if (!mApp->plugins()->c2f_isEnabled()) return 0; //Click2Flash whitelist - QStringList whitelist = MainApplication::getInstance()->plugins()->c2f_getWhiteList(); + QStringList whitelist = mApp->plugins()->c2f_getWhiteList(); if (whitelist.contains(url.host()) || whitelist.contains("www."+url.host()) || whitelist.contains(url.host().remove("www."))) return 0; diff --git a/src/preferences/pluginslist.cpp b/src/preferences/pluginslist.cpp index 8ead6c42f..ccdf1952d 100644 --- a/src/preferences/pluginslist.cpp +++ b/src/preferences/pluginslist.cpp @@ -34,7 +34,7 @@ PluginsList::PluginsList(QWidget *parent) : connect(ui->butLoad, SIGNAL(clicked()), this, SLOT(reloadPlugins())); connect(ui->allowAppPlugins, SIGNAL(clicked(bool)), this, SLOT(allowAppPluginsChanged(bool))); - QSettings settings(MainApplication::getInstance()->getActiveProfil()+"settings.ini", QSettings::IniFormat); + QSettings settings(mApp->getActiveProfil()+"settings.ini", QSettings::IniFormat); settings.beginGroup("Plugin-Settings"); ui->allowAppPlugins->setChecked( settings.value("EnablePlugins",true).toBool() ); settings.endGroup(); @@ -46,7 +46,7 @@ PluginsList::PluginsList(QWidget *parent) : connect(ui->allowClick2Flash, SIGNAL(clicked(bool)), this, SLOT(allowC2FChanged(bool))); settings.beginGroup("ClickToFlash"); - QStringList whitelist = MainApplication::getInstance()->plugins()->c2f_getWhiteList(); + QStringList whitelist = mApp->plugins()->c2f_getWhiteList(); ui->allowClick2Flash->setChecked( settings.value("Enable",true).toBool() ); settings.endGroup(); foreach (QString site, whitelist) { @@ -62,7 +62,7 @@ void PluginsList::addWhitelist() if (site.isEmpty()) return; - MainApplication::getInstance()->plugins()->c2f_addWhitelist(site); + mApp->plugins()->c2f_addWhitelist(site); ui->whitelist->insertTopLevelItem(0, new QTreeWidgetItem(QStringList(site))); } @@ -72,13 +72,13 @@ void PluginsList::removeWhitelist() if (!item) return; - MainApplication::getInstance()->plugins()->c2f_removeWhitelist(item->text(0)); + mApp->plugins()->c2f_removeWhitelist(item->text(0)); delete item; } void PluginsList::save() { - QSettings settings(MainApplication::getInstance()->getActiveProfil()+"settings.ini", QSettings::IniFormat); + QSettings settings(mApp->getActiveProfil()+"settings.ini", QSettings::IniFormat); settings.beginGroup("Plugin-Settings"); settings.setValue("EnablePlugins",ui->allowAppPlugins->isChecked()); settings.endGroup(); @@ -88,7 +88,7 @@ void PluginsList::save() void PluginsList::allowAppPluginsChanged(bool state) { - QSettings settings(MainApplication::getInstance()->getActiveProfil()+"settings.ini", QSettings::IniFormat); + QSettings settings(mApp->getActiveProfil()+"settings.ini", QSettings::IniFormat); settings.beginGroup("Plugin-Settings"); settings.setValue("EnablePlugins", state); settings.endGroup(); @@ -98,7 +98,7 @@ void PluginsList::allowAppPluginsChanged(bool state) void PluginsList::allowC2FChanged(bool state) { - QSettings settings(MainApplication::getInstance()->getActiveProfil()+"settings.ini", QSettings::IniFormat); + QSettings settings(mApp->getActiveProfil()+"settings.ini", QSettings::IniFormat); settings.beginGroup("ClickToFlash"); settings.setValue("Enable", state); settings.endGroup(); @@ -107,7 +107,7 @@ void PluginsList::allowC2FChanged(bool state) ui->add->setEnabled(state); ui->remove->setEnabled(state); - MainApplication::getInstance()->plugins()->c2f_setEnabled(state); + mApp->plugins()->c2f_setEnabled(state); } void PluginsList::refresh() @@ -115,10 +115,10 @@ void PluginsList::refresh() ui->list->clear(); ui->butSettings->setEnabled(false); - QStringList availablePlugins = MainApplication::getInstance()->plugins()->getAvailablePlugins(); - QStringList allowedPlugins = MainApplication::getInstance()->plugins()->getAllowedPlugins(); + QStringList availablePlugins = mApp->plugins()->getAvailablePlugins(); + QStringList allowedPlugins = mApp->plugins()->getAllowedPlugins(); foreach (QString fileName, availablePlugins) { - PluginInterface* plugin = MainApplication::getInstance()->plugins()->getPlugin(fileName); + PluginInterface* plugin = mApp->plugins()->getPlugin(fileName); if (!plugin) continue; @@ -164,7 +164,7 @@ void PluginsList::settingsClicked() return; QString name = ui->list->currentItem()->toolTip(); - PluginInterface* plugin = MainApplication::getInstance()->plugins()->getPlugin(name); + PluginInterface* plugin = mApp->plugins()->getPlugin(name); plugin->showSettings(); } @@ -175,13 +175,13 @@ void PluginsList::reloadPlugins() if (ui->list->item(i)->checkState() == Qt::Checked) allowedPlugins.append(ui->list->item(i)->toolTip()); } - QSettings settings(MainApplication::getInstance()->getActiveProfil()+"settings.ini", QSettings::IniFormat); + QSettings settings(mApp->getActiveProfil()+"settings.ini", QSettings::IniFormat); settings.beginGroup("Plugin-Settings"); settings.setValue("AllowedPlugins",allowedPlugins); settings.endGroup(); - MainApplication::getInstance()->plugins()->loadSettings(); - MainApplication::getInstance()->plugins()->loadPlugins(); + mApp->plugins()->loadSettings(); + mApp->plugins()->loadPlugins(); refresh(); } diff --git a/src/preferences/preferences.cpp b/src/preferences/preferences.cpp index 723073e34..f20eb54c5 100644 --- a/src/preferences/preferences.cpp +++ b/src/preferences/preferences.cpp @@ -29,6 +29,7 @@ #include "pluginslist.h" #include "qtwin.h" #include "pluginproxy.h" +#include "sslmanager.h" Preferences::Preferences(QupZilla* mainClass, QWidget *parent) : QDialog(parent) @@ -39,7 +40,7 @@ Preferences::Preferences(QupZilla* mainClass, QWidget *parent) : ui->setupUi(this); m_bgLabelSize = this->sizeHint(); - QSettings settings(MainApplication::getInstance()->getActiveProfil()+"settings.ini", QSettings::IniFormat); + QSettings settings(mApp->getActiveProfil()+"settings.ini", QSettings::IniFormat); //GENERAL URLs settings.beginGroup("Web-URL-Settings"); m_homepage = settings.value("homepage","http://qupzilla.ic.cz/search/").toString(); @@ -146,7 +147,7 @@ Preferences::Preferences(QupZilla* mainClass, QWidget *parent) : //PRIVACY //Web storage ui->storeIcons->setChecked( settings.value("allowPersistentStorage",true).toBool() ); - ui->saveHistory->setChecked( p_QupZilla->getMainApp()->history()->isSaving() ); + ui->saveHistory->setChecked( mApp->history()->isSaving() ); ui->deleteHistoryOnClose->setChecked( settings.value("deleteHistoryOnClose",false).toBool() ); if (!ui->saveHistory->isChecked()) ui->deleteHistoryOnClose->setEnabled(false); @@ -192,7 +193,7 @@ Preferences::Preferences(QupZilla* mainClass, QWidget *parent) : } ui->languages->addItem("English (en_US)"); - QDir lanDir(MainApplication::getInstance()->DATADIR+"locale"); + QDir lanDir(mApp->DATADIR+"locale"); QStringList list = lanDir.entryList(QStringList("*.qm")); foreach(QString name, list) { if (name.startsWith("qt_") || name == activeLanguage) @@ -208,6 +209,7 @@ Preferences::Preferences(QupZilla* mainClass, QWidget *parent) : connect(ui->buttonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(buttonClicked(QAbstractButton*))); connect(ui->cookieManagerBut, SIGNAL(clicked()), this, SLOT(showCookieManager())); + connect(ui->sslManagerButton, SIGNAL(clicked()), this, SLOT(openSslManager())); connect(ui->listWidget, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), this, SLOT(showStackedPage(QListWidgetItem*))); ui->listWidget->setItemSelected(ui->listWidget->itemAt(5,5), true); @@ -248,7 +250,7 @@ void Preferences::useActualNewTab() void Preferences::resetBackground() { QFile::remove(p_QupZilla->activeProfil()+"background.png"); - QFile(MainApplication::getInstance()->DATADIR+"data/default/profiles/default/background.png").copy(p_QupZilla->activeProfil()+"background.png"); + QFile(mApp->DATADIR+"data/default/profiles/default/background.png").copy(p_QupZilla->activeProfil()+"background.png"); m_menuTextColor = QColor(Qt::black); ui->textColor->setStyleSheet("color: "+m_menuTextColor.name()+";"); @@ -323,6 +325,13 @@ void Preferences::showCookieManager() m->show(); } +void Preferences::openSslManager() +{ + SSLManager* m = new SSLManager(); + m->setWindowModality(Qt::WindowModal); + m->show(); +} + void Preferences::cacheValueChanged(int value) { ui->MBlabel->setText(QString::number(value) + " MB"); @@ -369,7 +378,7 @@ void Preferences::buttonClicked(QAbstractButton *button) void Preferences::saveSettings() { - QSettings settings(MainApplication::getInstance()->getActiveProfil()+"settings.ini", QSettings::IniFormat); + QSettings settings(mApp->getActiveProfil()+"settings.ini", QSettings::IniFormat); //GENERAL URLs settings.beginGroup("Web-URL-Settings"); settings.setValue("homepage",ui->homepage->text()); @@ -471,11 +480,11 @@ void Preferences::saveSettings() m_pluginsList->save(); p_QupZilla->loadSettings(); p_QupZilla->tabWidget()->loadSettings(); - p_QupZilla->getMainApp()->cookieJar()->loadSettings(); - p_QupZilla->getMainApp()->history()->loadSettings(); + mApp->cookieJar()->loadSettings(); + mApp->history()->loadSettings(); p_QupZilla->locationBar()->loadSettings(); - MainApplication::getInstance()->loadSettings(); - MainApplication::getInstance()->plugins()->c2f_saveSettings(); + mApp->loadSettings(); + mApp->plugins()->c2f_saveSettings(); } Preferences::~Preferences() diff --git a/src/preferences/preferences.h b/src/preferences/preferences.h index 91818ef68..f2e686c7d 100644 --- a/src/preferences/preferences.h +++ b/src/preferences/preferences.h @@ -57,6 +57,7 @@ private slots: void useActualNewTab(); void resetBackground(); void chooseColor(); + void openSslManager(); void allowJavaScriptChanged(bool stat); void saveHistoryChanged(bool stat); diff --git a/src/preferences/preferences.ui b/src/preferences/preferences.ui index 17e846c2f..55ee8beba 100644 --- a/src/preferences/preferences.ui +++ b/src/preferences/preferences.ui @@ -1210,6 +1210,106 @@ + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + <b>Web storage</b> + + + + + + + Allow storing web icons + + + + + + + Allow saving history + + + + + + + Delete history on close + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + @@ -1312,108 +1412,21 @@
-
- - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - + + + + + 0 + 0 + + - <b>Web storage</b> + SSL Manager - - - - Allow storing web icons - - - - - - - Allow saving history - - - - - - - Delete history on close - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - diff --git a/src/preferences/sslmanager.cpp b/src/preferences/sslmanager.cpp new file mode 100644 index 000000000..01320b6c2 --- /dev/null +++ b/src/preferences/sslmanager.cpp @@ -0,0 +1,41 @@ +/* ============================================================ +* QupZilla - WebKit based browser +* Copyright (C) 2010-2011 nowrep +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +* ============================================================ */ +#include "sslmanager.h" +#include "ui_sslmanager.h" +#include "networkmanager.h" +#include "mainapplication.h" + +SSLManager::SSLManager(QWidget *parent) : + QWidget(parent), + ui(new Ui::SSLManager) +{ + setAttribute(Qt::WA_DeleteOnClose); + ui->setupUi(this); + QList certs = mApp->networkManager()->getCertExceptions(); + foreach (QSslCertificate cert, certs) { + QListWidgetItem* item = new QListWidgetItem(ui->list); + item->setText(cert.serialNumber()); + item->setData(0, certs.indexOf(cert)); + ui->list->addItem(item); + } +} + +SSLManager::~SSLManager() +{ + delete ui; +} diff --git a/src/preferences/sslmanager.h b/src/preferences/sslmanager.h new file mode 100644 index 000000000..1527eb487 --- /dev/null +++ b/src/preferences/sslmanager.h @@ -0,0 +1,41 @@ +/* ============================================================ +* QupZilla - WebKit based browser +* Copyright (C) 2010-2011 nowrep +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +* ============================================================ */ + + +#ifndef SSLMANAGER_H +#define SSLMANAGER_H + +#include + +namespace Ui { + class SSLManager; +} + +class SSLManager : public QWidget +{ + Q_OBJECT + +public: + explicit SSLManager(QWidget *parent = 0); + ~SSLManager(); + +private: + Ui::SSLManager *ui; +}; + +#endif // SSLMANAGER_H diff --git a/src/preferences/sslmanager.ui b/src/preferences/sslmanager.ui new file mode 100644 index 000000000..30730fc53 --- /dev/null +++ b/src/preferences/sslmanager.ui @@ -0,0 +1,68 @@ + + + SSLManager + + + + 0 + 0 + 473 + 250 + + + + SSL Manager + + + + :/icons/qupzilla.png:/icons/qupzilla.png + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Show info + + + + + + + Delete + + + + + + + + + Ignore all warnings + + + + + + + + + + diff --git a/src/rss/rssmanager.cpp b/src/rss/rssmanager.cpp index 874f12b5b..fe657fb93 100644 --- a/src/rss/rssmanager.cpp +++ b/src/rss/rssmanager.cpp @@ -45,7 +45,7 @@ RSSManager::RSSManager(QupZilla* mainClass, QWidget *parent) : QupZilla* RSSManager::getQupZilla() { if (!p_QupZilla) - p_QupZilla = MainApplication::getInstance()->getWindow(); + p_QupZilla = mApp->getWindow(); return p_QupZilla; } diff --git a/src/rss/rssnotification.cpp b/src/rss/rssnotification.cpp index 29b00e9e5..44d3f5a43 100644 --- a/src/rss/rssnotification.cpp +++ b/src/rss/rssnotification.cpp @@ -35,7 +35,7 @@ RSSNotification::RSSNotification(QString host, QWidget *parent) : ); ui->label->setText(tr("You have successfuly added RSS feed \"%1\".").arg(host)); - connect(ui->pushButton, SIGNAL(clicked()), MainApplication::getInstance()->getWindow(), SLOT(showRSSManager())); + connect(ui->pushButton, SIGNAL(clicked()), mApp->getWindow(), SLOT(showRSSManager())); connect(ui->pushButton, SIGNAL(clicked()), this, SLOT(hide())); connect(ui->closeButton, SIGNAL(clicked()), this, SLOT(hide())); diff --git a/src/rss/rsswidget.cpp b/src/rss/rsswidget.cpp index 37fcd16ec..67e501afc 100644 --- a/src/rss/rsswidget.cpp +++ b/src/rss/rsswidget.cpp @@ -77,7 +77,7 @@ void RSSWidget::addRss() else title = button->toolTip(); - if (MainApplication::getInstance()->rssManager()->addRssFeed(urlString, title)) { + if (mApp->rssManager()->addRssFeed(urlString, title)) { RSSNotification* notif = new RSSNotification(title, m_view); m_view->addNotification(notif); close(); diff --git a/src/webview/tabbar.cpp b/src/webview/tabbar.cpp index 32cff80b3..010d3f7e1 100644 --- a/src/webview/tabbar.cpp +++ b/src/webview/tabbar.cpp @@ -37,7 +37,7 @@ TabBar::TabBar(QupZilla* mainClass, QWidget *parent) : void TabBar::loadSettings() { - QSettings settings(MainApplication::getInstance()->getActiveProfil()+"settings.ini", QSettings::IniFormat); + QSettings settings(mApp->getActiveProfil()+"settings.ini", QSettings::IniFormat); settings.beginGroup("Browser-Tabs-Settings"); setMovable( settings.value("makeTabsMovable",true).toBool() ); diff --git a/src/webview/tabwidget.cpp b/src/webview/tabwidget.cpp index 65d8c73c5..604ee4228 100644 --- a/src/webview/tabwidget.cpp +++ b/src/webview/tabwidget.cpp @@ -71,7 +71,7 @@ TabWidget::TabWidget(QupZilla* mainClass, QWidget *parent) : void TabWidget::loadSettings() { - QSettings settings(MainApplication::getInstance()->getActiveProfil()+"settings.ini", QSettings::IniFormat); + QSettings settings(mApp->getActiveProfil()+"settings.ini", QSettings::IniFormat); settings.beginGroup("Browser-Tabs-Settings"); m_hideCloseButtonWithOneTab = settings.value("hideCloseButtonWithOneTab",false).toBool(); m_hideTabBarWithOneTab = settings.value("hideTabsWithOneTab",false).toBool(); @@ -155,7 +155,7 @@ int TabWidget::addView(QUrl url, QString title, OpenUrlIn openIn, bool selectLin connect(weView(index), SIGNAL(siteIconChanged()), p_QupZilla->locationBar(), SLOT(siteIconChanged())); connect(weView(index), SIGNAL(showUrl(QUrl)), p_QupZilla->locationBar(), SLOT(showUrl(QUrl))); connect(weView(index), SIGNAL(wantsCloseTab(int)), this, SLOT(closeTab(int))); - connect(weView(index), SIGNAL(changed()), p_QupZilla->getMainApp(), SLOT(setChanged())); + connect(weView(index), SIGNAL(changed()), mApp, SLOT(setChanged())); connect(weView(index), SIGNAL(ipChanged(QString)), p_QupZilla->ipLabel(), SLOT(setText(QString))); if (url.isValid()) @@ -184,7 +184,7 @@ void TabWidget::closeTab(int index) disconnect(weView(index), SIGNAL(siteIconChanged()), p_QupZilla->locationBar(), SLOT(siteIconChanged())); disconnect(weView(index), SIGNAL(showUrl(QUrl)), p_QupZilla->locationBar(), SLOT(showUrl(QUrl))); disconnect(weView(index), SIGNAL(wantsCloseTab(int)), this, SLOT(closeTab(int))); - disconnect(weView(index), SIGNAL(changed()), p_QupZilla->getMainApp(), SLOT(setChanged())); + disconnect(weView(index), SIGNAL(changed()), mApp, SLOT(setChanged())); disconnect(weView(index), SIGNAL(ipChanged(QString)), p_QupZilla->ipLabel(), SLOT(setText(QString))); //Save last tab url and history if (!weView(index)->url().isEmpty()) { diff --git a/src/webview/webpage.cpp b/src/webview/webpage.cpp index f5883bf05..0f223ae0b 100644 --- a/src/webview/webpage.cpp +++ b/src/webview/webpage.cpp @@ -42,7 +42,7 @@ void WebPage::handleUnsupportedContent(QNetworkReply* reply) switch(reply->error()) { case QNetworkReply::NoError: if (reply->header(QNetworkRequest::ContentTypeHeader).isValid()) { - DownloadManager* dManager = MainApplication::getInstance()->downManager(); + DownloadManager* dManager = mApp->downManager(); dManager->handleUnsupportedContent(reply); return; } diff --git a/src/webview/webview.cpp b/src/webview/webview.cpp index 264f3d2f5..6f8097453 100644 --- a/src/webview/webview.cpp +++ b/src/webview/webview.cpp @@ -42,7 +42,7 @@ WebView::WebView(QupZilla* mainClass, QWidget *parent) //,m_loadingTimer(0) { m_networkProxy = new NetworkManagerProxy(p_QupZilla); - m_networkProxy->setPrimaryNetworkAccessManager(p_QupZilla->getMainApp()->networkManager()); + m_networkProxy->setPrimaryNetworkAccessManager(mApp->networkManager()); m_networkProxy->setPage(m_page); m_networkProxy->setView(this); m_page->setNetworkAccessManager(m_networkProxy); @@ -64,8 +64,8 @@ WebView::WebView(QupZilla* mainClass, QWidget *parent) connect(page(), SIGNAL(windowCloseRequested()), this, SLOT(closeTab())); connect(page(), SIGNAL(downloadRequested(const QNetworkRequest &)), this, SLOT(downloadRequested(const QNetworkRequest &))); - connect(p_QupZilla->getMainApp()->networkManager(), SIGNAL(finishLoading(bool)), this, SLOT(loadFinished(bool))); - connect(p_QupZilla->getMainApp()->networkManager(), SIGNAL(wantsFocus(QUrl)), this, SLOT(getFocus(QUrl))); + connect(mApp->networkManager(), SIGNAL(finishLoading(bool)), this, SLOT(loadFinished(bool))); + connect(mApp->networkManager(), SIGNAL(wantsFocus(QUrl)), this, SLOT(getFocus(QUrl))); //Zoom levels same as in firefox m_zoomLevels << 30 << 50 << 67 << 80 << 90 << 100 << 110 << 120 << 133 << 150 << 170 << 200 << 240 << 300; @@ -188,7 +188,7 @@ void WebView::loadFinished(bool state) if (m_progress>100) qDebug() << "bug"; //cannot be more than 100 m_isLoading = false; - p_QupZilla->getMainApp()->history()->addHistoryEntry(this); + mApp->history()->addHistoryEntry(this); if (isCurrent()) { emit showUrl(url()); } @@ -203,7 +203,7 @@ void WebView::loadFinished(bool state) QTimer::singleShot(1000, this, SLOT(iconChanged())); titleChanged(title()); - MainApplication::getInstance()->autoFill()->completePage(this); + mApp->autoFill()->completePage(this); QHostInfo::lookupHost(url().host(), this, SLOT(setIp(QHostInfo))); } @@ -469,7 +469,7 @@ void WebView::contextMenuEvent(QContextMenuEvent *event) menu->addAction(QIcon::fromTheme("dialog-information"),tr("Show info about site"), this, SLOT(showSiteInfo()))->setData(url()); } - MainApplication::getInstance()->plugins()->populateWebViewMenu(menu, this, r); + mApp->plugins()->populateWebViewMenu(menu, this, r); menu->addAction(tr("Show Web Inspector"), this, SLOT(showInspector())); if (!page()->selectedText().isEmpty()) { @@ -506,7 +506,7 @@ void WebView::openUrlInNewTab() void WebView::openUrlInNewWindow() { if (QAction *action = qobject_cast(sender())) { - p_QupZilla->getMainApp()->makeNewWindow(false, action->data().toString()); + mApp->makeNewWindow(false, action->data().toString()); } } @@ -562,14 +562,14 @@ void WebView::downloadLinkToDisk() { if (QAction *action = qobject_cast(sender())) { QNetworkRequest request(action->data().toUrl()); - DownloadManager* dManager = MainApplication::getInstance()->downManager(); + DownloadManager* dManager = mApp->downManager(); dManager->download(request); } } void WebView::downloadRequested(const QNetworkRequest &request) { - DownloadManager* dManager = MainApplication::getInstance()->downManager(); + DownloadManager* dManager = mApp->downManager(); dManager->download(request); }