1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 01:22:10 +01:00

Introduced mApp macro

This commit is contained in:
nowrep 2011-03-04 13:59:07 +01:00
parent 492659f2ea
commit 0d1548c0b2
45 changed files with 527 additions and 225 deletions

View File

@ -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 \

View File

@ -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

View File

@ -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);

View File

@ -32,7 +32,6 @@
#include <QBasicTimer>
#include <QDebug>
class MainApplication;
class AutoSaver : public QObject
{
Q_OBJECT
@ -46,7 +45,6 @@ public slots:
private:
void timerEvent(QTimerEvent *);
MainApplication* p_mainApp;
QBasicTimer m_timer;
};

View File

@ -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

View File

@ -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()

View File

@ -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;

View File

@ -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;

View File

@ -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();
}

View File

@ -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;
}

View File

@ -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();

View File

@ -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;

View File

@ -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();
}

View File

@ -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()

View File

@ -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();

View File

@ -11,7 +11,7 @@
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
<string notr="true"/>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="topMargin">

View File

@ -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();
}

View File

@ -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;
}

View File

@ -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();
}

View File

@ -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());

View File

@ -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 <http://www.gnu.org/licenses/>.
* ============================================================ */
#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

View File

@ -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 <http://www.gnu.org/licenses/>.
* ============================================================ */
#ifndef LOCATIONPOPUP_H
#define LOCATIONPOPUP_H
#if 0
#include <QAbstractItemView>
#include <QDebug>
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

View File

@ -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);

View File

@ -43,6 +43,7 @@ public:
explicit NetworkManager(QupZilla* mainClass, QObject *parent = 0);
QNetworkReply *createRequest(QNetworkAccessManager::Operation op, const QNetworkRequest &request, QIODevice *outgoingData);
QList<QSslCertificate>& getCertExceptions() { return m_certExceptions; }
void saveCertExceptions();
void loadCertExceptions();
void loadSettings();

View File

@ -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)

View File

@ -51,7 +51,7 @@ void AboutDialog::showAbout()
m_aboutHtml.append(tr("<p>&copy; %1 %2<br/>All rights reserved.<br/>").arg(QupZilla::COPYRIGHT, QupZilla::AUTHOR));
m_aboutHtml.append(tr("Build time: %1 </p>").arg(QupZilla::BUILDTIME));
m_aboutHtml.append(QString("<p><a href=%1>%1</a></p>").arg(QupZilla::WWWADDRESS));
m_aboutHtml.append("<p>"+MainApplication::getInstance()->getWindow()->weView()->getPage()->userAgentForUrl(QUrl())+"</p>");
m_aboutHtml.append("<p>"+mApp->getWindow()->weView()->getPage()->userAgentForUrl(QUrl())+"</p>");
m_aboutHtml.append("</div>");
}
ui->textBrowser->setHtml(m_aboutHtml);

View File

@ -78,14 +78,14 @@ void ClearPrivateData::dialogAccepted()
}
if (m_clearCookies->isChecked()) {
QList<QNetworkCookie> 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();
}

View File

@ -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();
}

View File

@ -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);

View File

@ -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<PluginInterface *>(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);

View File

@ -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;

View File

@ -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();
}

View File

@ -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()

View File

@ -57,6 +57,7 @@ private slots:
void useActualNewTab();
void resetBackground();
void chooseColor();
void openSslManager();
void allowJavaScriptChanged(bool stat);
void saveHistoryChanged(bool stat);

View File

@ -1210,6 +1210,106 @@
</widget>
<widget class="QWidget" name="stackedWidgetPage6">
<layout class="QGridLayout" name="gridLayout_12">
<item row="1" column="0">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="0">
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0" colspan="4">
<widget class="QLabel" name="label_15">
<property name="text">
<string>&lt;b&gt;Web storage&lt;/b&gt;</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="3">
<widget class="QCheckBox" name="storeIcons">
<property name="text">
<string>Allow storing web icons</string>
</property>
</widget>
</item>
<item row="2" column="1" colspan="3">
<widget class="QCheckBox" name="saveHistory">
<property name="text">
<string>Allow saving history</string>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QCheckBox" name="deleteHistoryOnClose">
<property name="text">
<string>Delete history on close</string>
</property>
</widget>
</item>
<item row="3" column="1">
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<spacer name="horizontalSpacer_22">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="3">
<spacer name="horizontalSpacer_23">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="3" column="0">
<spacer name="verticalSpacer_12">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0" colspan="4">
@ -1312,108 +1412,21 @@
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
<item row="5" column="3">
<widget class="QPushButton" name="sslManagerButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="0">
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0" colspan="4">
<widget class="QLabel" name="label_15">
<property name="text">
<string>&lt;b&gt;Web storage&lt;/b&gt;</string>
<string>SSL Manager</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="3">
<widget class="QCheckBox" name="storeIcons">
<property name="text">
<string>Allow storing web icons</string>
</property>
</widget>
</item>
<item row="2" column="1" colspan="3">
<widget class="QCheckBox" name="saveHistory">
<property name="text">
<string>Allow saving history</string>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QCheckBox" name="deleteHistoryOnClose">
<property name="text">
<string>Delete history on close</string>
</property>
</widget>
</item>
<item row="3" column="1">
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<spacer name="horizontalSpacer_22">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="3">
<spacer name="horizontalSpacer_23">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="3" column="0">
<spacer name="verticalSpacer_12">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="page">

View File

@ -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 <http://www.gnu.org/licenses/>.
* ============================================================ */
#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<QSslCertificate> 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;
}

View File

@ -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 <http://www.gnu.org/licenses/>.
* ============================================================ */
#ifndef SSLMANAGER_H
#define SSLMANAGER_H
#include <QWidget>
namespace Ui {
class SSLManager;
}
class SSLManager : public QWidget
{
Q_OBJECT
public:
explicit SSLManager(QWidget *parent = 0);
~SSLManager();
private:
Ui::SSLManager *ui;
};
#endif // SSLMANAGER_H

View File

@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SSLManager</class>
<widget class="QWidget" name="SSLManager">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>473</width>
<height>250</height>
</rect>
</property>
<property name="windowTitle">
<string>SSL Manager</string>
</property>
<property name="windowIcon">
<iconset resource="../data/icons.qrc">
<normaloff>:/icons/qupzilla.png</normaloff>:/icons/qupzilla.png</iconset>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="0">
<widget class="QListWidget" name="list"/>
</item>
<item row="1" column="1">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="infoButton">
<property name="text">
<string>Show info</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="deleteButton">
<property name="text">
<string>Delete</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="0" colspan="2">
<widget class="QCheckBox" name="ignoreAll">
<property name="text">
<string>Ignore all warnings</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="../data/icons.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -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;
}

View File

@ -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()));

View File

@ -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();

View File

@ -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() );

View File

@ -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()) {

View File

@ -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;
}

View File

@ -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<QAction*>(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<QAction*>(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);
}