diff --git a/bin/locale/sv_SE.qm b/bin/locale/sv_SE.qm index 86a9eb5e3..0786b1ce8 100644 Binary files a/bin/locale/sv_SE.qm and b/bin/locale/sv_SE.qm differ diff --git a/linux/applications/qupzilla.desktop b/linux/applications/qupzilla.desktop index fc7b9a588..8b6c775a1 100644 --- a/linux/applications/qupzilla.desktop +++ b/linux/applications/qupzilla.desktop @@ -22,6 +22,7 @@ Comment[sr]=Брз и сигуран веб прегледач Comment[sr@ijekavian]=Брз и сигуран веб прегледач Comment[sr@ijekavianlatin]=Brz i siguran veb pregledač Comment[sr@latin]=Brz i siguran veb pregledač +Comment[sv]=En snabb och säker webbläsare GenericName=Web Browser GenericName[cs]=Webový prohlížeč GenericName[de]=Web Browser @@ -38,7 +39,7 @@ GenericName[sr]=Веб прегледач GenericName[sr@ijekavian]=Веб прегледач GenericName[sr@ijekavianlatin]=Veb pregledač GenericName[sr@latin]=Veb pregledač - +GenericName[sv]=Webbläsare Exec=qupzilla %u MimeType=text/html;application/xhtml+xml; Terminal=false @@ -61,6 +62,7 @@ Name[sr]=Отвори у новом језичку Name[sr@ijekavian]=Отвори у новом језичку Name[sr@ijekavianlatin]=Otvori u novom jezičku Name[sr@latin]=Otvori u novom jezičku +Name[sv]=Öppna ny flik Exec=qupzilla --new-tab TargetEnvironment=Unity @@ -82,6 +84,7 @@ Name[sr]=Отвори у новом прозору Name[sr@ijekavian]=Отвори у новом прозору Name[sr@ijekavianlatin]=Otvori u novom prozoru Name[sr@latin]=Otvori u novom prozoru +Name[sv]=Öppna nytt fönster Exec=qupzilla --new-window TargetEnvironment=Unity @@ -102,5 +105,6 @@ Name[sr]=Покрени приватно прегледање Name[sr@ijekavian]=Покрени приватно прегледање Name[sr@ijekavianlatin]=Pokreni privatno pregledanje Name[sr@latin]=Pokreni privatno pregledanje +Name[sv]=Starta privat surfning Exec=qupzilla --private-browsing TargetEnvironment=Unity diff --git a/src/adblock/adblockicon.cpp b/src/adblock/adblockicon.cpp index c425a5835..54e48d3fd 100644 --- a/src/adblock/adblockicon.cpp +++ b/src/adblock/adblockicon.cpp @@ -19,6 +19,8 @@ #include "adblockmanager.h" #include "qupzilla.h" #include "webpage.h" +#include "tabbedwebview.h" +#include "tabwidget.h" AdBlockIcon::AdBlockIcon(QupZilla* mainClass, QWidget* parent) : ClickableLabel(parent) @@ -57,7 +59,7 @@ void AdBlockIcon::showMenu(const QPoint &pos) void AdBlockIcon::learnAboutRules() { - p_QupZilla->tabWidget()->addView(QUrl("http://adblockplus.org/en/filters"), TabWidget::NewSelectedTab); + p_QupZilla->tabWidget()->addView(QUrl("http://adblockplus.org/en/filters"), Qz::NT_SelectedTab); } void AdBlockIcon::setEnabled(bool enabled) diff --git a/src/adblock/adblockmanager.cpp b/src/adblock/adblockmanager.cpp index d6b515975..677614d38 100644 --- a/src/adblock/adblockmanager.cpp +++ b/src/adblock/adblockmanager.cpp @@ -80,7 +80,7 @@ void AdBlockManager::setEnabled(bool enabled) } m_enabled = enabled; emit rulesChanged(); - mApp->sendMessages(MainApplication::SetAdBlockIconEnabled, enabled); + mApp->sendMessages(Qz::AM_SetAdBlockIconEnabled, enabled); } AdBlockNetwork* AdBlockManager::network() diff --git a/src/app/commandlineoptions.cpp b/src/app/commandlineoptions.cpp index cd2ccbbbf..04363b738 100644 --- a/src/app/commandlineoptions.cpp +++ b/src/app/commandlineoptions.cpp @@ -25,6 +25,11 @@ CommandLineOptions::CommandLineOptions(int &argc, char** argv) parseActions(); } +CommandLineOptions::ActionPairList CommandLineOptions::getActions() +{ + return m_actions; +} + void CommandLineOptions::showHelp() { using namespace std; @@ -64,7 +69,7 @@ void CommandLineOptions::parseActions() if (arg == "-h" || arg == "--help") { showHelp(); ActionPair pair; - pair.action = ExitAction; + pair.action = Qz::CL_ExitAction; m_actions.append(pair); break; } @@ -73,7 +78,7 @@ void CommandLineOptions::parseActions() cout << "QupZilla authors: " << endl; cout << " nowrep " << endl; ActionPair pair; - pair.action = ExitAction; + pair.action = Qz::CL_ExitAction; m_actions.append(pair); break; } @@ -86,7 +91,7 @@ void CommandLineOptions::parseActions() << "(build " << QupZilla::BUILDTIME.toUtf8().data() << ")" << endl; ActionPair pair; - pair.action = ExitAction; + pair.action = Qz::CL_ExitAction; m_actions.append(pair); break; } @@ -96,42 +101,42 @@ void CommandLineOptions::parseActions() arg.remove("--profile="); cout << "starting with profile " << arg.toUtf8().data() << endl; ActionPair pair; - pair.action = StartWithProfile; + pair.action = Qz::CL_StartWithProfile; pair.text = arg; m_actions.append(pair); } if (arg.startsWith("-np") || arg.startsWith("--no-plugins")) { ActionPair pair; - pair.action = StartWithoutAddons; + pair.action = Qz::CL_StartWithoutAddons; pair.text = ""; m_actions.append(pair); } if (arg.startsWith("-nt") || arg.startsWith("--new-tab")) { ActionPair pair; - pair.action = NewTab; + pair.action = Qz::CL_NewTab; pair.text = ""; m_actions.append(pair); } if (arg.startsWith("-nw") || arg.startsWith("--new-window")) { ActionPair pair; - pair.action = NewWindow; + pair.action = Qz::CL_NewWindow; pair.text = ""; m_actions.append(pair); } if (arg.startsWith("-dm") || arg.startsWith("--download-manager")) { ActionPair pair; - pair.action = ShowDownloadManager; + pair.action = Qz::CL_ShowDownloadManager; pair.text = ""; m_actions.append(pair); } if (arg.startsWith("-pb") || arg.startsWith("--private-browsing")) { ActionPair pair; - pair.action = StartPrivateBrowsing; + pair.action = Qz::CL_StartPrivateBrowsing; pair.text = ""; m_actions.append(pair); } @@ -141,7 +146,7 @@ void CommandLineOptions::parseActions() if (m_argc > 1 && !url.isEmpty() && !url.startsWith("-")) { cout << "starting with url " << url.toUtf8().data() << endl; ActionPair pair; - pair.action = OpenUrl; + pair.action = Qz::CL_OpenUrl; pair.text = url; m_actions.append(pair); } diff --git a/src/app/commandlineoptions.h b/src/app/commandlineoptions.h index 301a2ffaa..348794ab8 100644 --- a/src/app/commandlineoptions.h +++ b/src/app/commandlineoptions.h @@ -21,21 +21,20 @@ #include #include +#include "qz_namespace.h" + class CommandLineOptions { public: - enum Action { NoAction, OpenUrl, StartWithProfile, StartWithoutAddons, - NewTab, NewWindow, ShowDownloadManager, StartPrivateBrowsing, - ExitAction - }; - struct ActionPair { - Action action; + Qz::CommandLineAction action; QString text; }; + typedef QList ActionPairList; + explicit CommandLineOptions(int &argc, char** argv); - QList getActions() { return m_actions; } + ActionPairList getActions(); private: void showHelp(); @@ -43,7 +42,7 @@ private: int m_argc; char** m_argv; - QList m_actions; + ActionPairList m_actions; }; #endif // COMMANDLINEOPTIONS_H diff --git a/src/app/mainapplication.cpp b/src/app/mainapplication.cpp index f1629141e..ce94ef08a 100644 --- a/src/app/mainapplication.cpp +++ b/src/app/mainapplication.cpp @@ -122,28 +122,28 @@ MainApplication::MainApplication(const QList &cm if (argc > 1) { foreach(CommandLineOptions::ActionPair pair, cmdActions) { switch (pair.action) { - case CommandLineOptions::StartWithoutAddons: + case Qz::CL_StartWithoutAddons: noAddons = true; break; - case CommandLineOptions::StartWithProfile: + case Qz::CL_StartWithProfile: startProfile = pair.text; break; - case CommandLineOptions::NewTab: + case Qz::CL_NewTab: messages.append("ACTION:NewTab"); m_postLaunchActions.append(OpenNewTab); break; - case CommandLineOptions::NewWindow: + case Qz::CL_NewWindow: messages.append("ACTION:NewWindow"); break; - case CommandLineOptions::ShowDownloadManager: + case Qz::CL_ShowDownloadManager: messages.append("ACTION:ShowDownloadManager"); m_postLaunchActions.append(OpenDownloadManager); break; - case CommandLineOptions::StartPrivateBrowsing: + case Qz::CL_StartPrivateBrowsing: messages.append("ACTION:StartPrivateBrowsing"); m_postLaunchActions.append(PrivateBrowsing); break; - case CommandLineOptions::OpenUrl: + case Qz::CL_OpenUrl: startUrl = pair.text; messages.append("URL:" + startUrl.toString()); break; @@ -214,9 +214,9 @@ MainApplication::MainApplication(const QList &cm translateApp(); QWebHistoryInterface::setDefaultInterface(new WebHistoryInterface(this)); - QupZilla* qupzilla = new QupZilla(QupZilla::FirstAppWindow, startUrl); + QupZilla* qupzilla = new QupZilla(Qz::BW_FirstAppWindow, startUrl); m_mainWindows.append(qupzilla); - connect(qupzilla, SIGNAL(message(MainApplication::MessageType, bool)), this, SLOT(sendMessages(MainApplication::MessageType, bool))); + connect(qupzilla, SIGNAL(message(Qz::AppMessageType, bool)), this, SLOT(sendMessages(Qz::AppMessageType, bool))); qupzilla->show(); AutoSaver* saver = new AutoSaver(); @@ -375,7 +375,7 @@ void MainApplication::loadSettings() void MainApplication::reloadSettings() { loadSettings(); - emit message(ReloadSettings, true); + emit message(Qz::AM_ReloadSettings, true); } void MainApplication::restoreCursor() @@ -402,7 +402,7 @@ QupZilla* MainApplication::getWindow() void MainApplication::setStateChanged() { m_isStateChanged = true; - sendMessages(HistoryStateChanged, true); + sendMessages(Qz::AM_HistoryStateChanged, true); } bool MainApplication::isStateChanged() @@ -420,10 +420,10 @@ void MainApplication::togglePrivateBrowsingMode(bool state) history()->setSaving(!state); cookieJar()->turnPrivateJar(state); - emit message(MainApplication::CheckPrivateBrowsing, state); + emit message(Qz::AM_CheckPrivateBrowsing, state); } -void MainApplication::sendMessages(MainApplication::MessageType mes, bool state) +void MainApplication::sendMessages(Qz::AppMessageType mes, bool state) { emit message(mes, state); } @@ -443,20 +443,20 @@ void MainApplication::receiveAppMessage(QString message) actWin = getWindow(); } else if (text == "NewWindow") { - actWin = makeNewWindow(false); + actWin = makeNewWindow(Qz::BW_NewWindow); } else if (text == "ShowDownloadManager") { downManager()->show(); actWin = downManager(); } else if (text == "StartPrivateBrowsing") { - sendMessages(StartPrivateBrowsing, true); + sendMessages(Qz::AM_StartPrivateBrowsing, true); actWin = getWindow(); } } if (!actWin && !isClosing()) { // It can only occur if download manager window was still open - makeNewWindow(true); + makeNewWindow(Qz::BW_NewWindow); return; } @@ -474,22 +474,13 @@ void MainApplication::addNewTab(const QUrl &url) getWindow()->tabWidget()->addView(url); } -QupZilla* MainApplication::makeNewWindow(bool tryRestore, const QUrl &startUrl) +QupZilla* MainApplication::makeNewWindow(Qz::BrowserWindow type, const QUrl &startUrl) { - QupZilla::StartBehaviour behaviour; - if (tryRestore) { - behaviour = QupZilla::OtherRestoredWindow; - } - else { - behaviour = QupZilla::NewWindow; - } - if (m_mainWindows.count() == 0) { - behaviour = QupZilla::FirstAppWindow; + type = Qz::BW_FirstAppWindow; } - QupZilla* newWindow = new QupZilla(behaviour, startUrl); - connect(newWindow, SIGNAL(message(MainApplication::MessageType, bool)), this, SLOT(sendMessages(MainApplication::MessageType, bool))); + QupZilla* newWindow = new QupZilla(type, startUrl); m_mainWindows.append(newWindow); newWindow->show(); @@ -849,16 +840,14 @@ bool MainApplication::restoreStateSlot(QupZilla* window) stream >> tabState; stream >> qMainWindowState; - QupZilla* window = new QupZilla(QupZilla::OtherRestoredWindow); + QupZilla* window = new QupZilla(Qz::BW_OtherRestoredWindow); m_mainWindows.append(window); - connect(window, SIGNAL(message(MainApplication::MessageType, bool)), this, SLOT(sendMessages(MainApplication::MessageType, bool))); QEventLoop eLoop; connect(window, SIGNAL(startingCompleted()), &eLoop, SLOT(quit())); eLoop.exec(); window->tabWidget()->restoreState(tabState); window->restoreState(qMainWindowState); -// window->tabWidget()->closeTab(0); window->show(); } } diff --git a/src/app/mainapplication.h b/src/app/mainapplication.h index d42e05489..12984f562 100644 --- a/src/app/mainapplication.h +++ b/src/app/mainapplication.h @@ -31,6 +31,8 @@ #include "qtsingleapplication.h" #include "commandlineoptions.h" +#include "qz_namespace.h" + class QupZilla; class CookieManager; class BrowsingLibrary; @@ -58,17 +60,13 @@ public: QString TRANSLATIONSDIR; QString THEMESDIR; - explicit MainApplication(const QList &cmdActions, int &argc, char** argv); - - enum MessageType { SetAdBlockIconEnabled, CheckPrivateBrowsing, ReloadSettings, - HistoryStateChanged, BookmarksChanged, StartPrivateBrowsing - }; + explicit MainApplication(const CommandLineOptions::ActionPairList &cmdActions, int &argc, char** argv); void connectDatabase(); void loadSettings(); void reloadSettings(); bool restoreStateSlot(QupZilla* window); - QupZilla* makeNewWindow(bool tryRestore, const QUrl &startUrl = QUrl()); + QupZilla* makeNewWindow(Qz::BrowserWindow type, const QUrl &startUrl = QUrl()); void aboutToCloseWindow(QupZilla* window); bool isStateChanged(); @@ -109,13 +107,13 @@ public: public slots: bool saveStateSlot(); void quitApplication(); - void sendMessages(MainApplication::MessageType mes, bool state); + void sendMessages(Qz::AppMessageType mes, bool state); void receiveAppMessage(QString message); void setStateChanged(); void addNewTab(const QUrl &url = QUrl()); signals: - void message(MainApplication::MessageType mes, bool state); + void message(Qz::AppMessageType mes, bool state); private slots: void postLaunch(); diff --git a/src/app/qupzilla.cpp b/src/app/qupzilla.cpp index c56705e3e..a7ac6143d 100644 --- a/src/app/qupzilla.cpp +++ b/src/app/qupzilla.cpp @@ -62,6 +62,7 @@ #include "webhistorywrapper.h" #include "enhancedmenu.h" #include "settings.h" +#include "webtab.h" const QString QupZilla::VERSION = "1.1.5"; const QString QupZilla::BUILDTIME = __DATE__" "__TIME__; @@ -83,13 +84,13 @@ const QIcon QupZilla::qupzillaIcon() return i; } -QupZilla::QupZilla(StartBehaviour behaviour, QUrl startUrl) +QupZilla::QupZilla(Qz::BrowserWindow type, QUrl startUrl) : QMainWindow(0) , m_historyMenuChanged(true) , m_bookmarksMenuChanged(true) , m_isClosing(false) , m_startingUrl(startUrl) - , m_startBehaviour(behaviour) + , m_startBehaviour(type) , m_menuBookmarksAction(0) #ifdef Q_WS_MAC , m_macMenuBar(new QMenuBar()) @@ -110,14 +111,14 @@ QupZilla::QupZilla(StartBehaviour behaviour, QUrl startUrl) setupMenu(); QTimer::singleShot(0, this, SLOT(postLaunch())); - connect(mApp, SIGNAL(message(MainApplication::MessageType, bool)), this, SLOT(receiveMessage(MainApplication::MessageType, bool))); + connect(mApp, SIGNAL(message(Qz::AppMessageType, bool)), this, SLOT(receiveMessage(Qz::AppMessageType, bool))); } void QupZilla::postLaunch() { loadSettings(); - if (m_startBehaviour == FirstAppWindow) { + if (m_startBehaviour == Qz::BW_FirstAppWindow) { m_tabWidget->restorePinnedTabs(); } @@ -160,17 +161,17 @@ void QupZilla::postLaunch() } switch (m_startBehaviour) { - case FirstAppWindow: + case Qz::BW_FirstAppWindow: if (startingAfterCrash || (addTab && afterLaunch == 3)) { addTab = !mApp->restoreStateSlot(this); } break; - case NewWindow: + case Qz::BW_NewWindow: addTab = true; break; - case OtherRestoredWindow: + case Qz::BW_OtherRestoredWindow: addTab = false; break; } @@ -181,7 +182,7 @@ void QupZilla::postLaunch() } if (addTab) { - int index = m_tabWidget->addView(startUrl, TabWidget::CleanPage); + int index = m_tabWidget->addView(startUrl, Qz::NT_CleanSelectedTab); m_tabWidget->setCurrentIndex(index); if (startUrl.isEmpty() || startUrl.toString() == "qupzilla:speeddial") { @@ -189,7 +190,9 @@ void QupZilla::postLaunch() } } - if (m_tabWidget->getTabBar()->normalTabsCount() <= 0) { //Something went really wrong .. add one tab + if (m_tabWidget->getTabBar()->normalTabsCount() <= 0 && + m_startBehaviour != Qz::BW_OtherRestoredWindow) { + //Something went really wrong .. add one tab m_tabWidget->addView(m_homepage); } @@ -202,6 +205,16 @@ void QupZilla::postLaunch() emit startingCompleted(); } +void QupZilla::goNext() +{ + weView()->forward(); +} + +void QupZilla::goBack() +{ + weView()->back(); +} + void QupZilla::setupUi() { int locationBarWidth; @@ -215,7 +228,7 @@ void QupZilla::setupUi() } else { setGeometry(settings.value("WindowGeometry", QRect(20, 20, 800, 550)).toRect()); - if (m_startBehaviour == NewWindow) { + if (m_startBehaviour == Qz::BW_NewWindow) { // Moving window +40 x,y to be visible that this is new window QPoint p = pos(); p.setX(p.x() + 40); @@ -276,6 +289,26 @@ QMenuBar* QupZilla::menuBar() const #endif } +TabbedWebView* QupZilla::weView() const +{ + return weView(m_tabWidget->currentIndex()); +} + +TabbedWebView* QupZilla::weView(int index) const +{ + WebTab* webTab = qobject_cast(m_tabWidget->widget(index)); + if (!webTab) { + return 0; + } + + return webTab->view(); +} + +LocationBar* QupZilla::locationBar() const +{ + return qobject_cast(m_tabWidget->locationBars()->currentWidget()); +} + void QupZilla::setupMenu() { // Standard actions - needed on Mac to be placed correctly in "application" menu @@ -561,34 +594,34 @@ void QupZilla::setWindowTitle(const QString &t) } } -void QupZilla::receiveMessage(MainApplication::MessageType mes, bool state) +void QupZilla::receiveMessage(Qz::AppMessageType mes, bool state) { switch (mes) { - case MainApplication::SetAdBlockIconEnabled: + case Qz::AM_SetAdBlockIconEnabled: m_adblockIcon->setEnabled(state); break; - case MainApplication::CheckPrivateBrowsing: + case Qz::AM_CheckPrivateBrowsing: m_privateBrowsing->setVisible(state); m_actionPrivateBrowsing->setChecked(state); weView()->titleChanged(); break; - case MainApplication::ReloadSettings: + case Qz::AM_ReloadSettings: loadSettings(); m_tabWidget->loadSettings(); LocationBarSettings::instance()->loadSettings(); break; - case MainApplication::HistoryStateChanged: + case Qz::AM_HistoryStateChanged: m_historyMenuChanged = true; break; - case MainApplication::BookmarksChanged: + case Qz::AM_BookmarksChanged: m_bookmarksMenuChanged = true; break; - case MainApplication::StartPrivateBrowsing: + case Qz::AM_StartPrivateBrowsing: startPrivate(state); break; @@ -965,6 +998,11 @@ void QupZilla::bookmarkAllTabs() mApp->browsingLibrary()->bookmarksManager()->insertAllTabs(); } +void QupZilla::newWindow() +{ + mApp->makeNewWindow(Qz::BW_NewWindow); +} + void QupZilla::goHome() { loadAddress(m_homepage); @@ -977,9 +1015,44 @@ void QupZilla::copy() } } +void QupZilla::selectAll() +{ + weView()->selectAll(); +} + +void QupZilla::zoomIn() +{ + weView()->zoomIn(); +} + +void QupZilla::zoomOut() +{ + weView()->zoomOut(); +} + +void QupZilla::zoomReset() +{ + weView()->zoomReset(); +} + void QupZilla::goHomeInNewTab() { - m_tabWidget->addView(m_homepage, TabWidget::NewSelectedTab); + m_tabWidget->addView(m_homepage, Qz::NT_SelectedTab); +} + +void QupZilla::stop() +{ + weView()->stop(); +} + +void QupZilla::reload() +{ + weView()->reload(); +} + +void QupZilla::reloadByPassCache() +{ + weView()->triggerPageAction(QWebPage::ReloadAndBypassCache); } void QupZilla::loadActionUrl() @@ -999,7 +1072,7 @@ void QupZilla::loadActionUrlInNewTab() void QupZilla::loadActionUrlInNewNotSelectedTab() { if (QAction* action = qobject_cast(sender())) { - m_tabWidget->addView(action->data().toUrl(), TabWidget::NewNotSelectedTab); + m_tabWidget->addView(action->data().toUrl(), Qz::NT_NotSelectedTab); } } @@ -1011,7 +1084,7 @@ void QupZilla::loadFolderBookmarks(Menu* menu) } foreach(Bookmark b, mApp->bookmarksModel()->folderBookmarks(folder)) { - tabWidget()->addView(b.url, b.title, TabWidget::NewNotSelectedTab); + tabWidget()->addView(b.url, b.title, Qz::NT_NotSelectedTab); } } @@ -1251,6 +1324,11 @@ void QupZilla::aboutQupZilla() about.exec(); } +void QupZilla::addTab() +{ + m_tabWidget->addView(QUrl(), Qz::NT_SelectedTab, true); +} + void QupZilla::webSearch() { m_navigationBar->searchLine()->setFocus(); diff --git a/src/app/qupzilla.h b/src/app/qupzilla.h index 388b4f36e..eb704caba 100644 --- a/src/app/qupzilla.h +++ b/src/app/qupzilla.h @@ -41,14 +41,12 @@ #include #include #include +#include #include "qwebkitversion.h" -#include "webtab.h" -#include "tabbedwebview.h" -#include "tabwidget.h" -#include "mainapplication.h" -#include "locationbar.h" +#include "qz_namespace.h" +class Menu; class TabWidget; class TabbedWebView; class LineEdit; @@ -64,7 +62,7 @@ class StatusBarMessage; class NavigationBar; class ClickableLabel; class WebInspectorDockWidget; -class Menu; +class LocationBar; class QupZilla : public QMainWindow { Q_OBJECT @@ -80,8 +78,7 @@ public: static const QIcon qupzillaIcon(); - enum StartBehaviour { FirstAppWindow, OtherRestoredWindow, NewWindow }; - explicit QupZilla(StartBehaviour behaviour = FirstAppWindow, QUrl startUrl = QUrl()); + explicit QupZilla(Qz::BrowserWindow type, QUrl startUrl = QUrl()); ~QupZilla(); void refreshAddressBar(); @@ -98,9 +95,9 @@ public: virtual QMenuBar* menuBar() const; - inline TabbedWebView* weView() const { WebTab* webTab = qobject_cast(m_tabWidget->widget(m_tabWidget->currentIndex())); if (!webTab) return 0; return webTab->view(); } - inline TabbedWebView* weView(int index) const { WebTab* webTab = qobject_cast(m_tabWidget->widget(index)); if (!webTab) return 0; return webTab->view(); } - inline LocationBar* locationBar() { return qobject_cast(m_tabWidget->locationBars()->currentWidget()); } + TabbedWebView* weView() const; + TabbedWebView* weView(int index) const; + LocationBar* locationBar() const; inline TabWidget* tabWidget() { return m_tabWidget; } inline BookmarksToolbar* bookmarksToolbar() { return m_bookmarksToolbar; } inline StatusBarMessage* statusBarMessage() { return m_statusBarMessage; } @@ -122,7 +119,7 @@ public: signals: void loadHistory(); void startingCompleted(); - void message(MainApplication::MessageType mes, bool state); + void message(Qz::AppMessageType mes, bool state); void setWebViewMouseTracking(bool state); public slots: @@ -140,19 +137,19 @@ public slots: void showSource(QWebFrame* frame = 0, const QString &selectedHtml = ""); void printPage(QWebFrame* frame = 0); void showPageInfo(); - void receiveMessage(MainApplication::MessageType mes, bool state); + void receiveMessage(Qz::AppMessageType mes, bool state); private slots: void postLaunch(); - void goNext() { weView()->forward(); } - void goBack() { weView()->back(); } + void goNext(); + void goBack(); void goHome(); void goHomeInNewTab(); - void stop() { weView()->stop(); } - void reload() { weView()->reload(); } - void reloadByPassCache() { weView()->page()->triggerAction(QWebPage::ReloadAndBypassCache); } + void stop(); + void reload(); + void reloadByPassCache(); void aboutQupZilla(); - void addTab() { m_tabWidget->addView(QUrl(), TabWidget::NewTab, true); } + void addTab(); void savePageScreen(); void aboutToShowFileMenu(); @@ -186,7 +183,7 @@ private slots: void refreshHistory(); void bookmarkAllTabs(); - void newWindow() { mApp->makeNewWindow(false); } + void newWindow(); void openLocation(); void openFile(); @@ -195,11 +192,11 @@ private slots: void webSearch(); void copy(); - void selectAll() { weView()->selectAll(); } + void selectAll(); - void zoomIn() { weView()->zoomIn(); } - void zoomOut() { weView()->zoomOut(); } - void zoomReset() { weView()->zoomReset(); } + void zoomIn(); + void zoomOut(); + void zoomReset(); void fullScreen(bool make); void startPrivate(bool state); void changeEncoding(); @@ -223,7 +220,7 @@ private: QUrl m_startingUrl; QUrl m_newtab; QUrl m_homepage; - StartBehaviour m_startBehaviour; + Qz::BrowserWindow m_startBehaviour; QVBoxLayout* m_mainLayout; QSplitter* m_mainSplitter; diff --git a/src/app/qz_namespace.h b/src/app/qz_namespace.h new file mode 100644 index 000000000..1743651d7 --- /dev/null +++ b/src/app/qz_namespace.h @@ -0,0 +1,50 @@ +#ifndef QZ_NAMESPACE_H +#define QZ_NAMESPACE_H + +#include + +namespace Qz +{ + +enum AppMessageType { + AM_SetAdBlockIconEnabled, + AM_CheckPrivateBrowsing, + AM_ReloadSettings, + AM_HistoryStateChanged, + AM_BookmarksChanged, + AM_StartPrivateBrowsing +}; + +enum BrowserWindow { + BW_FirstAppWindow, + BW_OtherRestoredWindow, + BW_NewWindow +}; + +enum CommandLineAction { + CL_NoAction, + CL_OpenUrl, + CL_StartWithProfile, + CL_StartWithoutAddons, + CL_NewTab, + CL_NewWindow, + CL_ShowDownloadManager, + CL_StartPrivateBrowsing, + CL_ExitAction +}; + +enum NewTabPositionFlag { + NT_SelectedTab = 1, + NT_NotSelectedTab = 2, + NT_CleanTab = 4, + + NT_CleanSelectedTab = NT_CleanTab | NT_SelectedTab, + NT_CleanNotSelectedTab = NT_CleanTab | NT_NotSelectedTab +}; + +Q_DECLARE_FLAGS(NewTabPositionFlags, NewTabPositionFlag) +Q_DECLARE_OPERATORS_FOR_FLAGS(Qz::NewTabPositionFlags) + +} + +#endif // QZ_NAMESPACE_H diff --git a/src/bookmarks/bookmarkicon.cpp b/src/bookmarks/bookmarkicon.cpp index 453f7ba57..947b74134 100644 --- a/src/bookmarks/bookmarkicon.cpp +++ b/src/bookmarks/bookmarkicon.cpp @@ -18,6 +18,8 @@ #include "bookmarkicon.h" #include "mainapplication.h" #include "qupzilla.h" +#include "tabbedwebview.h" +#include "locationbar.h" #include "bookmarksmodel.h" #include "bookmarkswidget.h" diff --git a/src/bookmarks/bookmarksmanager.cpp b/src/bookmarks/bookmarksmanager.cpp index 146f1cdd0..e928fc21d 100644 --- a/src/bookmarks/bookmarksmanager.cpp +++ b/src/bookmarks/bookmarksmanager.cpp @@ -27,6 +27,7 @@ #include "browsinglibrary.h" #include "globalfunctions.h" #include "bookmarksimportdialog.h" +#include "webtab.h" BookmarksManager::BookmarksManager(QupZilla* mainClass, QWidget* parent) : QWidget(parent) @@ -168,7 +169,7 @@ void BookmarksManager::itemControlClicked(QTreeWidgetItem* item) void BookmarksManager::loadInNewTab() { if (QAction* action = qobject_cast(sender())) { - getQupZilla()->tabWidget()->addView(action->data().toUrl(), TabWidget::NewNotSelectedTab); + getQupZilla()->tabWidget()->addView(action->data().toUrl(), Qz::NT_NotSelectedTab); } } diff --git a/src/bookmarks/bookmarksmodel.cpp b/src/bookmarks/bookmarksmodel.cpp index 2c3190aae..7f16a326f 100644 --- a/src/bookmarks/bookmarksmodel.cpp +++ b/src/bookmarks/bookmarksmodel.cpp @@ -150,7 +150,7 @@ bool BookmarksModel::saveBookmark(const QUrl &url, const QString &title, const Q bookmark.inSubfolder = isSubfolder(bookmark.folder); emit bookmarkAdded(bookmark); - mApp->sendMessages(MainApplication::BookmarksChanged, true); + mApp->sendMessages(Qz::AM_BookmarksChanged, true); return true; } @@ -182,7 +182,7 @@ bool BookmarksModel::removeBookmark(int id) } emit bookmarkDeleted(bookmark); - mApp->sendMessages(MainApplication::BookmarksChanged, true); + mApp->sendMessages(Qz::AM_BookmarksChanged, true); return true; } @@ -255,7 +255,7 @@ bool BookmarksModel::editBookmark(int id, const QString &title, const QUrl &url, } emit bookmarkEdited(before, after); - mApp->sendMessages(MainApplication::BookmarksChanged, true); + mApp->sendMessages(Qz::AM_BookmarksChanged, true); return true; } @@ -276,7 +276,7 @@ bool BookmarksModel::createFolder(const QString &name) } emit folderAdded(name); - mApp->sendMessages(MainApplication::BookmarksChanged, true); + mApp->sendMessages(Qz::AM_BookmarksChanged, true); return true; } @@ -309,7 +309,7 @@ bool BookmarksModel::removeFolder(const QString &name) } emit folderDeleted(name); - mApp->sendMessages(MainApplication::BookmarksChanged, true); + mApp->sendMessages(Qz::AM_BookmarksChanged, true); return true; } @@ -381,7 +381,7 @@ bool BookmarksModel::createSubfolder(const QString &name) } emit subfolderAdded(name); - mApp->sendMessages(MainApplication::BookmarksChanged, true); + mApp->sendMessages(Qz::AM_BookmarksChanged, true); return true; } diff --git a/src/bookmarks/bookmarkstoolbar.cpp b/src/bookmarks/bookmarkstoolbar.cpp index 4fc26bc3c..0d3a95f2d 100644 --- a/src/bookmarks/bookmarkstoolbar.cpp +++ b/src/bookmarks/bookmarkstoolbar.cpp @@ -17,12 +17,14 @@ * ============================================================ */ #include "bookmarkstoolbar.h" #include "qupzilla.h" +#include "mainapplication.h" #include "bookmarksmodel.h" #include "iconprovider.h" #include "historymodel.h" #include "toolbutton.h" #include "databasewriter.h" #include "enhancedmenu.h" +#include "tabwidget.h" BookmarksToolbar::BookmarksToolbar(QupZilla* mainClass, QWidget* parent) : QWidget(parent) @@ -281,7 +283,7 @@ void BookmarksToolbar::loadFolderBookmarksInTabs() } foreach(Bookmark b, m_bookmarksModel->folderBookmarks(folder)) { - p_QupZilla->tabWidget()->addView(b.url, b.title, TabWidget::NewNotSelectedTab); + p_QupZilla->tabWidget()->addView(b.url, b.title, Qz::NT_NotSelectedTab); } } diff --git a/src/bookmarks/bookmarkstoolbar.h b/src/bookmarks/bookmarkstoolbar.h index d4fbafeb4..ffbadf403 100644 --- a/src/bookmarks/bookmarkstoolbar.h +++ b/src/bookmarks/bookmarkstoolbar.h @@ -24,6 +24,8 @@ #include #include #include +#include +#include #include "bookmarksmodel.h" diff --git a/src/cookies/cookiejar.cpp b/src/cookies/cookiejar.cpp index ded2e1981..5af986ec4 100644 --- a/src/cookies/cookiejar.cpp +++ b/src/cookies/cookiejar.cpp @@ -17,6 +17,7 @@ * ============================================================ */ #include "cookiejar.h" #include "qupzilla.h" +#include "mainapplication.h" #include "settings.h" //#define COOKIE_DEBUG diff --git a/src/downloads/downloaditem.cpp b/src/downloads/downloaditem.cpp index d1e30b4d1..38f458250 100644 --- a/src/downloads/downloaditem.cpp +++ b/src/downloads/downloaditem.cpp @@ -332,16 +332,16 @@ void DownloadItem::goToDownloadPage() QupZilla* qz = mApp->getWindow(); if (qz) { - qz->tabWidget()->addView(m_downloadPage, TabWidget::NewSelectedTab); + qz->tabWidget()->addView(m_downloadPage, Qz::NT_SelectedTab); } else { - mApp->makeNewWindow(true, m_downloadPage); + mApp->makeNewWindow(Qz::BW_NewWindow, m_downloadPage); } } void DownloadItem::copyDownloadLink() { - qApp->clipboard()->setText(m_downUrl.toString()); + QApplication::clipboard()->setText(m_downUrl.toString()); } void DownloadItem::clear() diff --git a/src/downloads/downloaditem.h b/src/downloads/downloaditem.h index 57338bdb0..a38685ba6 100644 --- a/src/downloads/downloaditem.h +++ b/src/downloads/downloaditem.h @@ -32,6 +32,7 @@ #include #include #include +#include namespace Ui { diff --git a/src/downloads/downloadmanager.cpp b/src/downloads/downloadmanager.cpp index 645491f9c..183e9eb03 100644 --- a/src/downloads/downloadmanager.cpp +++ b/src/downloads/downloadmanager.cpp @@ -18,6 +18,7 @@ #include "downloadmanager.h" #include "ui_downloadmanager.h" #include "qupzilla.h" +#include "mainapplication.h" #include "downloadoptionsdialog.h" #include "downloaditem.h" #include "ecwin7.h" diff --git a/src/history/historymanager.cpp b/src/history/historymanager.cpp index df23c991a..f28bd58f3 100644 --- a/src/history/historymanager.cpp +++ b/src/history/historymanager.cpp @@ -18,10 +18,12 @@ #include "historymanager.h" #include "ui_historymanager.h" #include "qupzilla.h" +#include "mainapplication.h" #include "historymodel.h" #include "iconprovider.h" #include "browsinglibrary.h" #include "globalfunctions.h" +#include "tabwidget.h" HistoryManager::HistoryManager(QupZilla* mainClass, QWidget* parent) : QWidget(parent) @@ -81,7 +83,7 @@ void HistoryManager::itemDoubleClicked(QTreeWidgetItem* item) void HistoryManager::loadInNewTab() { if (QAction* action = qobject_cast(sender())) { - getQupZilla()->tabWidget()->addView(action->data().toUrl(), TabWidget::NewNotSelectedTab); + getQupZilla()->tabWidget()->addView(action->data().toUrl(), Qz::NT_NotSelectedTab); } } diff --git a/src/history/historymanager.h b/src/history/historymanager.h index a9c8ef6c8..2f9c831e0 100644 --- a/src/history/historymanager.h +++ b/src/history/historymanager.h @@ -21,6 +21,7 @@ #include #include #include +#include #include "historymodel.h" diff --git a/src/main.cpp b/src/main.cpp index d83204267..7d89d1dfc 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -41,7 +41,7 @@ int main(int argc, char* argv[]) cmdActions = cmd.getActions(); foreach(CommandLineOptions::ActionPair pair, cmdActions) { switch (pair.action) { - case CommandLineOptions::ExitAction: + case Qz::CL_ExitAction: return 0; break; default: diff --git a/src/navigation/locationbar.cpp b/src/navigation/locationbar.cpp index de09001a5..a0f04de5f 100644 --- a/src/navigation/locationbar.cpp +++ b/src/navigation/locationbar.cpp @@ -25,6 +25,7 @@ #include "siteinfowidget.h" #include "rsswidget.h" #include "webpage.h" +#include "tabwidget.h" #include "bookmarkicon.h" #include "progressbar.h" #include "statusbarmessage.h" @@ -392,7 +393,7 @@ void LocationBar::keyPressEvent(QKeyEvent* event) break; case Qt::AltModifier: - p_QupZilla->tabWidget()->addView(createUrl(), TabWidget::NewNotSelectedTab); + p_QupZilla->tabWidget()->addView(createUrl(), Qz::NT_NotSelectedTab); break; default: diff --git a/src/navigation/navigationbar.cpp b/src/navigation/navigationbar.cpp index df80cd649..d64ec396d 100644 --- a/src/navigation/navigationbar.cpp +++ b/src/navigation/navigationbar.cpp @@ -18,11 +18,14 @@ #include "navigationbar.h" #include "toolbutton.h" #include "qupzilla.h" +#include "mainapplication.h" #include "iconprovider.h" #include "websearchbar.h" #include "reloadstopbutton.h" #include "webhistorywrapper.h" #include "enhancedmenu.h" +#include "tabwidget.h" +#include "tabbedwebview.h" QString titleForUrl(QString title, const QUrl &url) { diff --git a/src/navigation/websearchbar.cpp b/src/navigation/websearchbar.cpp index dc311b5c5..a8162d36a 100644 --- a/src/navigation/websearchbar.cpp +++ b/src/navigation/websearchbar.cpp @@ -17,8 +17,10 @@ * ============================================================ */ #include "websearchbar.h" #include "qupzilla.h" +#include "mainapplication.h" #include "tabbedwebview.h" #include "webpage.h" +#include "tabwidget.h" #include "clickablelabel.h" #include "buttonwithmenu.h" #include "searchenginesmanager.h" @@ -145,7 +147,7 @@ void WebSearchBar::search() void WebSearchBar::searchInNewTab() { p_QupZilla->weView()->setFocus(); - p_QupZilla->tabWidget()->addView(m_searchManager->searchUrl(m_activeEngine, text()), TabWidget::NewNotSelectedTab); + p_QupZilla->tabWidget()->addView(m_searchManager->searchUrl(m_activeEngine, text()), Qz::NT_NotSelectedTab); } void WebSearchBar::completeMenuWithAvailableEngines(QMenu* menu) diff --git a/src/network/qupzillaschemehandler.h b/src/network/qupzillaschemehandler.h index 0462e0151..7dd8d81d9 100644 --- a/src/network/qupzillaschemehandler.h +++ b/src/network/qupzillaschemehandler.h @@ -24,6 +24,7 @@ #include #include #include +#include class QupZillaSchemeHandler { diff --git a/src/other/aboutdialog.cpp b/src/other/aboutdialog.cpp index 698a38818..bba38f1e5 100644 --- a/src/other/aboutdialog.cpp +++ b/src/other/aboutdialog.cpp @@ -18,6 +18,7 @@ #include "aboutdialog.h" #include "ui_aboutdialog.h" #include "qupzilla.h" +#include "mainapplication.h" #include "tabbedwebview.h" #include "webpage.h" #include "qtwin.h" diff --git a/src/other/clearprivatedata.cpp b/src/other/clearprivatedata.cpp index 71fc52424..5973cf83b 100644 --- a/src/other/clearprivatedata.cpp +++ b/src/other/clearprivatedata.cpp @@ -17,6 +17,7 @@ * ============================================================ */ #include "clearprivatedata.h" #include "qupzilla.h" +#include "tabwidget.h" #include "cookiejar.h" #include "mainapplication.h" #include "networkmanager.h" diff --git a/src/other/statusbarmessage.cpp b/src/other/statusbarmessage.cpp index ae0f038a0..1ef20fe95 100644 --- a/src/other/statusbarmessage.cpp +++ b/src/other/statusbarmessage.cpp @@ -17,6 +17,8 @@ * ============================================================ */ #include "statusbarmessage.h" #include "qupzilla.h" +#include "tabwidget.h" +#include "tabbedwebview.h" #include "squeezelabelv1.h" TipLabel::TipLabel(QupZilla* parent) diff --git a/src/other/updater.cpp b/src/other/updater.cpp index 40bb9f4fc..c1e42c8b3 100644 --- a/src/other/updater.cpp +++ b/src/other/updater.cpp @@ -17,9 +17,9 @@ * ============================================================ */ #include "updater.h" #include "qupzilla.h" +#include "mainapplication.h" #include "tabwidget.h" #include "desktopnotificationsfactory.h" -#include Updater::Updater(QupZilla* mainClass, QObject* parent) : QObject(parent) @@ -118,7 +118,7 @@ void Updater::downCompleted(QNetworkReply* reply) void Updater::downloadNewVersion() { - p_QupZilla->tabWidget()->addView(QUrl(QupZilla::WWWADDRESS + "/download"), tr("Update"), TabWidget::NewSelectedTab); + p_QupZilla->tabWidget()->addView(QUrl(QupZilla::WWWADDRESS + "/download"), tr("Update"), Qz::NT_NotSelectedTab); } Updater::~Updater() diff --git a/src/plugins/clicktoflash.cpp b/src/plugins/clicktoflash.cpp index 7dbea16d2..3c8728f7f 100644 --- a/src/plugins/clicktoflash.cpp +++ b/src/plugins/clicktoflash.cpp @@ -48,6 +48,7 @@ #include "webpage.h" #include "globalfunctions.h" #include "qupzilla.h" +#include "tabbedwebview.h" QUrl ClickToFlash::acceptedUrl; QStringList ClickToFlash::acceptedArgNames; diff --git a/src/popupwindow/popupwebpage.cpp b/src/popupwindow/popupwebpage.cpp index 18688f3c8..698eda3c3 100644 --- a/src/popupwindow/popupwebpage.cpp +++ b/src/popupwindow/popupwebpage.cpp @@ -19,6 +19,8 @@ #include "popupwebview.h" #include "popupwindow.h" #include "qupzilla.h" +#include "tabwidget.h" +#include "tabbedwebview.h" // Wrapper class to detect whether window is opened from JavaScript window.open method // It has to be done this way, because QtWebKit has really bad API when it comes to opening @@ -118,7 +120,7 @@ void PopupWebPage::checkBehaviour() disconnect(this, SIGNAL(loadFinished(bool)), this, SLOT(slotLoadFinished(bool))); } else { - int index = p_QupZilla->tabWidget()->addView(QUrl(), TabWidget::CleanSelectedPage); + int index = p_QupZilla->tabWidget()->addView(QUrl(), Qz::NT_CleanSelectedTab); TabbedWebView* view = p_QupZilla->weView(index); view->setWebPage(this); if (m_isLoading) { diff --git a/src/preferences/preferences.cpp b/src/preferences/preferences.cpp index d3437dbe1..0220bdf65 100644 --- a/src/preferences/preferences.cpp +++ b/src/preferences/preferences.cpp @@ -40,6 +40,7 @@ #include "globalfunctions.h" #include "autofillmodel.h" #include "settings.h" +#include "tabbedwebview.h" #ifdef Q_WS_WIN #define DEFAULT_CHECK_UPDATES true diff --git a/src/rss/rssmanager.cpp b/src/rss/rssmanager.cpp index b0e3a16af..16f944f7b 100644 --- a/src/rss/rssmanager.cpp +++ b/src/rss/rssmanager.cpp @@ -259,13 +259,13 @@ void RSSManager::controlLoadFeed(QTreeWidgetItem* item) if (item->whatsThis(0).isEmpty()) { return; } - getQupZilla()->tabWidget()->addView(QUrl(item->whatsThis(0)), TabWidget::NewNotSelectedTab); + getQupZilla()->tabWidget()->addView(QUrl(item->whatsThis(0)), Qz::NT_NotSelectedTab); } void RSSManager::loadFeedInNewTab() { if (QAction* action = qobject_cast(sender())) { - getQupZilla()->tabWidget()->addView(action->data().toUrl(), TabWidget::NewNotSelectedTab); + getQupZilla()->tabWidget()->addView(action->data().toUrl(), Qz::NT_NotSelectedTab); } } diff --git a/src/sidebar/bookmarkssidebar.cpp b/src/sidebar/bookmarkssidebar.cpp index b3a2ff3f5..821a5bddb 100644 --- a/src/sidebar/bookmarkssidebar.cpp +++ b/src/sidebar/bookmarkssidebar.cpp @@ -74,7 +74,7 @@ void BookmarksSideBar::itemDoubleClicked(QTreeWidgetItem* item) void BookmarksSideBar::loadInNewTab() { if (QAction* action = qobject_cast(sender())) { - p_QupZilla->tabWidget()->addView(action->data().toUrl(), TabWidget::NewNotSelectedTab); + p_QupZilla->tabWidget()->addView(action->data().toUrl(), Qz::NT_NotSelectedTab); } } diff --git a/src/sidebar/historysidebar.cpp b/src/sidebar/historysidebar.cpp index bac3f5424..030839f35 100644 --- a/src/sidebar/historysidebar.cpp +++ b/src/sidebar/historysidebar.cpp @@ -18,6 +18,8 @@ #include "historysidebar.h" #include "ui_historysidebar.h" #include "qupzilla.h" +#include "tabwidget.h" +#include "mainapplication.h" #include "historymodel.h" #include "iconprovider.h" @@ -61,13 +63,13 @@ void HistorySideBar::itemControlClicked(QTreeWidgetItem* item) } QUrl url = QUrl::fromEncoded(item->text(1).toUtf8()); - p_QupZilla->tabWidget()->addView(url, item->text(0)); + p_QupZilla->tabWidget()->addView(url, item->text(0), Qz::NT_NotSelectedTab); } void HistorySideBar::loadInNewTab() { if (QAction* action = qobject_cast(sender())) { - p_QupZilla->tabWidget()->addView(action->data().toUrl(), TabWidget::NewNotSelectedTab); + p_QupZilla->tabWidget()->addView(action->data().toUrl(), Qz::NT_NotSelectedTab); } } diff --git a/src/sidebar/historysidebar.h b/src/sidebar/historysidebar.h index e2e5812fa..b0cb7853b 100644 --- a/src/sidebar/historysidebar.h +++ b/src/sidebar/historysidebar.h @@ -21,6 +21,7 @@ #include #include #include +#include #include "historymodel.h" diff --git a/src/src.pro b/src/src.pro index 768c92a91..49d8ed154 100644 --- a/src/src.pro +++ b/src/src.pro @@ -323,7 +323,8 @@ HEADERS += \ popupwindow/popupwindow.h \ popupwindow/popuplocationbar.h \ webview/tabbedwebview.h \ - webview/webview.h + webview/webview.h \ + app/qz_namespace.h FORMS += \ preferences/autofillmanager.ui \ diff --git a/src/webview/popupwebview.cpp b/src/webview/popupwebview.cpp index 4c771f085..de62fe818 100644 --- a/src/webview/popupwebview.cpp +++ b/src/webview/popupwebview.cpp @@ -45,7 +45,7 @@ void PopupWebView::closeView() parentWidget()->close(); } -void PopupWebView::contextMenuEvent(QContextMenuEvent *event) +void PopupWebView::contextMenuEvent(QContextMenuEvent* event) { m_menu->clear(); m_clickedFrame = 0; diff --git a/src/webview/siteinfowidget.cpp b/src/webview/siteinfowidget.cpp index 4cfb64283..47d7913bb 100644 --- a/src/webview/siteinfowidget.cpp +++ b/src/webview/siteinfowidget.cpp @@ -19,6 +19,7 @@ #include "ui_siteinfowidget.h" #include "qupzilla.h" #include "webpage.h" +#include "tabbedwebview.h" SiteInfoWidget::SiteInfoWidget(QupZilla* mainClass, QWidget* parent) : QMenu(parent) diff --git a/src/webview/tabbar.cpp b/src/webview/tabbar.cpp index f21cf7aee..a86b4a62c 100644 --- a/src/webview/tabbar.cpp +++ b/src/webview/tabbar.cpp @@ -341,7 +341,7 @@ void TabBar::mouseMoveEvent(QMouseEvent* event) void TabBar::mouseDoubleClickEvent(QMouseEvent* event) { if (event->button() == Qt::LeftButton && tabAt(event->pos()) == -1) { - m_tabWidget->addView(QUrl(), TabWidget::NewSelectedTab, true); + m_tabWidget->addView(QUrl(), Qz::NT_SelectedTab, true); return; } @@ -365,7 +365,7 @@ void TabBar::mouseReleaseEvent(QMouseEvent* event) return; } if (id == -1 && event->button() == Qt::MiddleButton) { - m_tabWidget->addView(QUrl(), TabWidget::NewSelectedTab, true); + m_tabWidget->addView(QUrl(), Qz::NT_SelectedTab, true); return; } diff --git a/src/webview/tabbar.h b/src/webview/tabbar.h index 6693a16ac..fb440f4e3 100644 --- a/src/webview/tabbar.h +++ b/src/webview/tabbar.h @@ -24,6 +24,7 @@ #include #include #include +#include class QupZilla; class TabWidget; diff --git a/src/webview/tabbedwebview.cpp b/src/webview/tabbedwebview.cpp index 850c73807..11f857088 100644 --- a/src/webview/tabbedwebview.cpp +++ b/src/webview/tabbedwebview.cpp @@ -465,14 +465,14 @@ void TabbedWebView::stop() void TabbedWebView::openUrlInNewTab() { if (QAction* action = qobject_cast(sender())) { - m_tabWidget->addView(action->data().toUrl(), TabWidget::NewBackgroundTab); + m_tabWidget->addView(action->data().toUrl(), Qz::NT_NotSelectedTab); } } void TabbedWebView::searchSelectedText() { SearchEngine engine = mApp->searchEnginesManager()->activeEngine(); - m_tabWidget->addView(engine.url.replace("%s", selectedText()), TabWidget::NewBackgroundTab); + m_tabWidget->addView(engine.url.replace("%s", selectedText()), Qz::NT_NotSelectedTab); } void TabbedWebView::bookmarkLink() @@ -578,7 +578,7 @@ void TabbedWebView::mousePressEvent(QMouseEvent* event) switch (event->button()) { case Qt::MiddleButton: if (isUrlValid(QUrl(m_hoveredLink))) { - m_tabWidget->addView(QUrl::fromEncoded(m_hoveredLink.toUtf8()), TabWidget::NewBackgroundTab); + m_tabWidget->addView(QUrl::fromEncoded(m_hoveredLink.toUtf8()), Qz::NT_NotSelectedTab); event->accept(); return; } @@ -592,7 +592,7 @@ void TabbedWebView::mousePressEvent(QMouseEvent* event) case Qt::LeftButton: if (event->modifiers() == Qt::ControlModifier && isUrlValid(QUrl(m_hoveredLink))) { - m_tabWidget->addView(QUrl::fromEncoded(m_hoveredLink.toUtf8()), TabWidget::NewBackgroundTab); + m_tabWidget->addView(QUrl::fromEncoded(m_hoveredLink.toUtf8()), Qz::NT_NotSelectedTab); event->accept(); return; } diff --git a/src/webview/tabwidget.cpp b/src/webview/tabwidget.cpp index d80b0e5f9..d5431795f 100644 --- a/src/webview/tabwidget.cpp +++ b/src/webview/tabwidget.cpp @@ -171,6 +171,22 @@ void TabWidget::resizeEvent(QResizeEvent* e) QTabWidget::resizeEvent(e); } +TabbedWebView *TabWidget::weView() +{ + return weView(currentIndex()); +} + +TabbedWebView *TabWidget::weView(int index) +{ + WebTab* webTab = qobject_cast(widget(index)); + + if (!webTab) { + return 0; + } + + return webTab->view(); +} + void TabWidget::createKeyPressEvent(QKeyEvent* event) { QTabWidget::keyPressEvent(event); @@ -246,20 +262,20 @@ void TabWidget::actionChangeIndex() } } -int TabWidget::addView(const QUrl &url, OpenUrlIn openIn, bool selectLine) +int TabWidget::addView(const QUrl &url, const Qz::NewTabPositionFlags &openFlags, bool selectLine) { - return addView(url, tr("New tab"), openIn, selectLine); + return addView(url, tr("New tab"), openFlags, selectLine); } -int TabWidget::addView(QUrl url, const QString &title, OpenUrlIn openIn, bool selectLine, int position) +int TabWidget::addView(QUrl url, const QString &title, const Qz::NewTabPositionFlags &openFlags, bool selectLine, int position) { m_lastTabIndex = currentIndex(); - if (url.isEmpty() && openIn != CleanPage && openIn != CleanSelectedPage) { + if (url.isEmpty() && !(openFlags & Qz::NT_CleanTab)) { url = m_urlOnNewTab; } - if (openIn == NewBackgroundTab) { + if (openFlags & Qz::NT_NotSelectedTab) { // If we are opening newBgTab from pinned tab, make sure it won't be // opened between other pinned tabs position = qMax(currentIndex() + 1, m_tabBar->pinnedTabsCount()); @@ -283,7 +299,7 @@ int TabWidget::addView(QUrl url, const QString &title, OpenUrlIn openIn, bool se webView->animationLoading(index, true)->movie()->stop(); webView->animationLoading(index, false)->setPixmap(_iconForUrl(url).pixmap(16, 16)); - if (openIn == NewSelectedTab || openIn == CleanSelectedPage) { + if (openFlags & Qz::NT_SelectedTab) { setCurrentIndex(index); } @@ -306,7 +322,7 @@ int TabWidget::addView(QUrl url, const QString &title, OpenUrlIn openIn, bool se p_QupZilla->locationBar()->setFocus(); } - if (openIn == NewSelectedTab || openIn == CleanSelectedPage) { + if (openFlags & Qz::NT_SelectedTab) { m_isClosingToLastTabIndex = true; m_locationBars->setCurrentWidget(locBar); } @@ -380,6 +396,11 @@ void TabWidget::closeTab(int index) webTab->deleteLater(); } +void TabWidget::reloadTab(int index) +{ + weView(index)->reload(); +} + void TabWidget::showTabBar() { if (count() == 1 && m_hideTabBarWithOneTab) { @@ -422,6 +443,21 @@ void TabWidget::reloadAllTabs() } } +void TabWidget::stopTab(int index) +{ + weView(index)->stop(); +} + +void TabWidget::backTab(int index) +{ + weView(index)->back(); +} + +void TabWidget::forwardTab(int index) +{ + weView(index)->forward(); +} + void TabWidget::closeAllButCurrent(int index) { WebTab* akt = qobject_cast(widget(index)); @@ -441,7 +477,7 @@ int TabWidget::duplicateTab(int index) QDataStream tabHistoryStream(&history, QIODevice::WriteOnly); tabHistoryStream << *weView(index)->history(); - int id = addView(url, tabText(index), TabWidget::NewNotSelectedTab); + int id = addView(url, tabText(index), Qz::NT_CleanNotSelectedTab); QDataStream historyStream(history); historyStream >> *weView(id)->history(); @@ -464,7 +500,7 @@ void TabWidget::restoreClosedTab() tab = m_closedTabsManager->getFirstClosedTab(); } - int index = addView(QUrl(), tab.title, TabWidget::NewSelectedTab, false, tab.position); + int index = addView(QUrl(), tab.title, Qz::NT_CleanSelectedTab, false, tab.position); QDataStream historyStream(tab.history); historyStream >> *weView(index)->history(); @@ -479,7 +515,7 @@ void TabWidget::restoreAllClosedTabs() QList closedTabs = m_closedTabsManager->allClosedTabs(); foreach(ClosedTabsManager::Tab tab, closedTabs) { - int index = addView(QUrl(), tab.title); + int index = addView(QUrl(), tab.title, Qz::NT_CleanNotSelectedTab); QDataStream historyStream(tab.history); historyStream >> *weView(index)->history(); @@ -572,7 +608,7 @@ void TabWidget::restorePinnedTabs() QByteArray historyState = tabHistory.value(i); int addedIndex; if (!historyState.isEmpty()) { - addedIndex = addView(QUrl(), CleanPage); + addedIndex = addView(QUrl(), Qz::NT_CleanNotSelectedTab); QDataStream historyStream(historyState); historyStream >> *weView(addedIndex)->history(); weView(addedIndex)->load(url); @@ -648,7 +684,7 @@ bool TabWidget::restoreState(const QByteArray &state) QByteArray historyState = tabHistory.value(i); if (!historyState.isEmpty()) { - int index = addView(QUrl(), CleanPage); + int index = addView(QUrl(), Qz::NT_CleanNotSelectedTab); QDataStream historyStream(historyState); historyStream >> *weView(index)->history(); weView(index)->load(url); diff --git a/src/webview/tabwidget.h b/src/webview/tabwidget.h index 81f351ed9..dad5906b3 100644 --- a/src/webview/tabwidget.h +++ b/src/webview/tabwidget.h @@ -25,9 +25,9 @@ #include #include #include +#include -#include "tabbedwebview.h" -#include "webtab.h" +#include "qz_namespace.h" class QupZilla; class TabbedWebView; @@ -43,7 +43,6 @@ class TabWidget : public QTabWidget public: explicit TabWidget(QupZilla* mainclass, QWidget* parent = 0); ~TabWidget(); - enum OpenUrlIn { CurrentTab, NewSelectedTab, NewNotSelectedTab, NewTab = NewSelectedTab, NewBackgroundTab = NewNotSelectedTab, CleanPage, CleanSelectedPage }; QByteArray saveState(); bool restoreState(const QByteArray &state); @@ -71,16 +70,16 @@ signals: void pinnedTabAdded(); public slots: - int addView(const QUrl &url, OpenUrlIn openIn, bool selectLine = false); - int addView(QUrl url = QUrl(), const QString &title = tr("New tab"), OpenUrlIn openIn = NewTab, bool selectLine = false, int position = -1); + int addView(const QUrl &url, const Qz::NewTabPositionFlags &openFlags, bool selectLine = false); + int addView(QUrl url = QUrl(), const QString &title = tr("New tab"), const Qz::NewTabPositionFlags &openFlags = Qz::NT_SelectedTab, bool selectLine = false, int position = -1); int duplicateTab(int index); void closeTab(int index = -1); - void reloadTab(int index) { weView(index)->reload(); } + void reloadTab(int index); void reloadAllTabs(); - void stopTab(int index) { weView(index)->stop(); } - void backTab(int index) { weView(index)->back(); } - void forwardTab(int index) { weView(index)->forward(); } + void stopTab(int index); + void backTab(int index); + void forwardTab(int index); void closeAllButCurrent(int index); void restoreClosedTab(); void restoreAllClosedTabs(); @@ -98,8 +97,8 @@ private slots: private: void resizeEvent(QResizeEvent* e); - inline TabbedWebView* weView() { WebTab* webTab = qobject_cast(widget(currentIndex())); if (!webTab) return 0; return webTab->view(); } - inline TabbedWebView* weView(int index) { WebTab* webTab = qobject_cast(widget(index)); if (!webTab) return 0; return webTab->view(); } + inline TabbedWebView* weView(); + inline TabbedWebView* weView(int index); bool m_hideTabBarWithOneTab; bool m_dontQuitWithOneTab; diff --git a/src/webview/webtab.cpp b/src/webview/webtab.cpp index 6953da0dc..15490e8bc 100644 --- a/src/webview/webtab.cpp +++ b/src/webview/webtab.cpp @@ -20,6 +20,7 @@ #include "tabbedwebview.h" #include "webpage.h" #include "tabbar.h" +#include "tabwidget.h" #include "locationbar.h" WebTab::WebTab(QupZilla* mainClass, LocationBar* locationBar) diff --git a/src/webview/webview.cpp b/src/webview/webview.cpp index 064505a6a..36f92b927 100644 --- a/src/webview/webview.cpp +++ b/src/webview/webview.cpp @@ -282,7 +282,7 @@ void WebView::slotIconChanged() void WebView::openUrlInNewWindow() { if (QAction* action = qobject_cast(sender())) { - mApp->makeNewWindow(false, action->data().toUrl()); + mApp->makeNewWindow(Qz::BW_NewWindow, action->data().toUrl()); } } diff --git a/tests/forms/form.html b/tests/forms/form.html new file mode 100644 index 000000000..f60bc12da --- /dev/null +++ b/tests/forms/form.html @@ -0,0 +1,17 @@ + + + Form completion test + + +

Form completion test

+
+ Username:
+ Password: + +
+

+ + + + + diff --git a/tests/link_tests.html b/tests/link_tests.html new file mode 100644 index 000000000..8d7b4c065 --- /dev/null +++ b/tests/link_tests.html @@ -0,0 +1,63 @@ + + + Link Tests + + + +

MAILTO Link Tests

+ Email link #1 +
+ Email link #2 +
+ +

HTTP Link Tests

+ Web site link (new window) +
+ Web site link with bogus username +
+ Web site link with different bogus username +
+ PDF link +
+ PDF link (new window) +
+ Movie link +
+ Movie link (new window) +
+ Text Document Link +
+ Bogus link +
+

Javascript Link Tests

+ Open dialog like window link #1 +
+ Open new window link #2 (might be opened as Tab) +
+ Open PDF Document (new window) +
+ Open form test (new window) +
+ Close window +
+

Form Tests

+
+ Choose file to upload:
+
+ + +
+ + diff --git a/translations/sv_SE.ts b/translations/sv_SE.ts index b8898e7f7..9110cc371 100644 --- a/translations/sv_SE.ts +++ b/translations/sv_SE.ts @@ -17,7 +17,7 @@ Authors and Contributors - Utvecklare och bidragande + Utvecklare och bidragare @@ -33,7 +33,7 @@ <b>WebKit version %1</b></p> - <b>Webkitversion %1</b></p> + <b>Webkit-version %1</b></p> @@ -105,7 +105,7 @@ Enable AdBlock - Aktivera AdBlock + Aktivera reklamblockering @@ -174,7 +174,7 @@ Show AdBlock &Settings - Visa AdBlock & Inställningar + Visa AdBlock &inställningar @@ -216,7 +216,7 @@ Personal definition: - + Egen definition: @@ -875,12 +875,12 @@ <b>Issued By</b> - + <b>Utfärdat av</b> <b>Validity</b> - + <b>Validitet</b> @@ -1106,7 +1106,7 @@ <cookie not selected> - + <ingen kaka vald> @@ -1152,7 +1152,7 @@ Session cookie - + Sessionskaka @@ -1427,7 +1427,7 @@ <b>Note: </b>%s in url represent searched string - + <b>Observera: </b>%s iurl'en representerar söksträngen @@ -1802,7 +1802,7 @@ Authorization required - + Autentisering krävs @@ -1829,7 +1829,7 @@ Proxy authorization required - + Proxyautentisering krävs @@ -1995,7 +1995,7 @@ &Reload - + &Hämta om @@ -2060,7 +2060,7 @@ Select &all - Välj &allt + Markera &allt @@ -2116,12 +2116,12 @@ <b>Launching</b> - <b>Startar</b> + <b>Uppstart</b> After launch: - Efter start: + Vid start: @@ -2195,7 +2195,7 @@ Note: You cannot delete active profile. - Obs: Du kan inte ta bort aktiv profil. + Observera: Du kan inte ta bort aktiv profil. @@ -2230,7 +2230,7 @@ Show Navigation ToolBar on start - Visa Navigeringsverktygsraden vid start + Visa navigeringsverktygsraden vid start @@ -2310,7 +2310,7 @@ Web Configuration - + Webbinställningar @@ -2394,7 +2394,7 @@ lines on page - + rader på sidan @@ -2409,7 +2409,7 @@ Local Storage - + Lokal lagring @@ -2424,7 +2424,7 @@ Allow storing network cache on disk - + Tillåt att nätverkscache lagras på hårddisken @@ -2439,12 +2439,12 @@ Allow storing web icons - + Tillåt att webbikoner lagras Allow saving history - + Tillåt att historik sparas @@ -2494,7 +2494,7 @@ System proxy configuration - + Global proxyinställning @@ -2559,7 +2559,7 @@ Ask everytime for download location - Fråga varje gång för nedladdningsdestination + Fråga efter nedladdningsdestination varje gång @@ -2597,7 +2597,7 @@ Allow saving passwords from sites - + Tillåt att lösenord lagras på sidor @@ -2612,7 +2612,7 @@ Allow storing of cookies - + Tillåt lagring av kakor @@ -2672,7 +2672,7 @@ <b>Note: </b>You can change position of OSD Notification by dragging it on the screen. - <b>Obs:</b>Du kan ändra notifikationernas placering genom att dra runt dem på skärmen. + <b>Observera:</b>Du kan ändra notifikationernas placering genom att dra runt dem på skärmen. @@ -2808,7 +2808,7 @@ Cannot create profile directory! - + Kan inte skapa profilensökväg! @@ -2828,16 +2828,16 @@ The file is not an OpenSearch 1.1 file. Denna fil är inte en OpenSearch1.1 fil. - - - <not set in certificate> - - Native System Notification Systemets egna notifikationer + + + <not set in certificate> + + QtWin @@ -2881,7 +2881,7 @@ Private Browsing Enabled - Privat surf aktiverat + Privat surfning aktiverat @@ -3066,12 +3066,12 @@ &Reload - &Läs om + &Hämta om Character &Encoding - + &Teckenkodning @@ -3126,7 +3126,7 @@ (Private Browsing) - (Privat surf) + (Privat surfning) @@ -3212,7 +3212,7 @@ Page &Info - Sidoinfo + Sidinformation @@ -3242,7 +3242,7 @@ &Private Browsing - &Privat surf + &Privat surfning @@ -3272,7 +3272,7 @@ When private browsing is turned on, some actions concerning your privacy will be disabled: - När privat surf aktiveras stängs vissa integritetsrelaterade funktioner av: + När privat surfning aktiveras stängs vissa integritetsrelaterade funktioner av: @@ -3297,7 +3297,7 @@ Start Private Browsing - Aktivera privat surf + Aktivera privat surfning @@ -3382,7 +3382,7 @@ Paths - + Sökvägar @@ -3552,7 +3552,7 @@ E-mail is optional<br/><b>Note: </b>Please use English language only. - E-post är valfritt<br/><b>Obs:</b>Använd endast Engelska. + E-post är valfritt<br/><b>Observera:</b>Använd endast Engelska. @@ -3572,7 +3572,7 @@ Reload - Ladda om + Hämta om @@ -3606,7 +3606,7 @@ Reload - Ladda om + Hämta om @@ -3643,8 +3643,8 @@ You don't have any RSS Feeds.<br/> Please add some with RSS icon in navigation bar on site which offers feeds. - Du har inga RSS-flöden.-br/> -Lägg till flöden med RSS-ikonen i navigeringsraden på sidor som tillhandahåller flöden. + Du har inga RSS-flöden.<br/> +Lägg till flöden med RSS-ikonen i navigeringsraden från sidor som tillhandahåller flöden. @@ -3664,12 +3664,12 @@ Lägg till flöden med RSS-ikonen i navigeringsraden på sidor som tillhandahål Fill title and URL of a feed: - + Fyll i titel och url för ett flöde: Feed title: - Flödets titel: + Flödets titel: @@ -3749,7 +3749,7 @@ Lägg till flöden med RSS-ikonen i navigeringsraden på sidor som tillhandahål Reload - Ladda om + Hämta om @@ -3773,7 +3773,7 @@ Lägg till flöden med RSS-ikonen i navigeringsraden på sidor som tillhandahål This is a list of CA Authorities Certificates stored in the standard system path and in user specified paths. - + Detta är en lista på CA Authorities-certifikat lagrade i systemets standardsökväg och användarspecificerade sökvägar. @@ -3789,7 +3789,7 @@ Lägg till flöden med RSS-ikonen i navigeringsraden på sidor som tillhandahål This is a list of Local Certificates stored in your user profile. It also contains all certificates, that have received an exception. - + Detta är en lista på lokala certifikat lagrade i din användarprofil. Den innehåller också alla certifikat som erhållit ett undantag. @@ -3804,12 +3804,12 @@ Lägg till flöden med RSS-ikonen i navigeringsraden på sidor som tillhandahål If CA Authorities Certificates were not automatically loaded from the system, you can specify paths manually where the certificates are stored. - + Om CA Authorities-certifikat inte laddades automatiskt kan du manuellt ställa in var certifikaten finns lagrade. <b>NOTE:</b> Setting this option is a high security risk! - <b>Obs:</b>Denna inställningen är en hög säkerhetsrisk! + <b>Observera:</b> Denna inställningen är en hög säkerhetsrisk! @@ -3820,7 +3820,8 @@ Lägg till flöden med RSS-ikonen i navigeringsraden på sidor som tillhandahål All certificates must have .crt suffix. After adding or removing certificate paths, it is neccessary to restart QupZilla in order to take effect the changes. - + Alla certifikat måste ha .crt-suffix. +Efter att ha lagt till eller tagit bort certifikats sökvägar måste QupZilla startas om för att ändringarna ska ha effekt. @@ -3975,7 +3976,7 @@ After adding or removing certificate paths, it is neccessary to restart QupZilla Site Info - Sidinfo + Sidinformation @@ -4070,7 +4071,7 @@ After adding or removing certificate paths, it is neccessary to restart QupZilla <b>Your connection to this page is not secured!</b> - <b>Din anslutning till denna sidan är osäkrad!</b> + <b>Din anslutning till denna sidan är osäker!</b> @@ -4218,7 +4219,7 @@ After adding or removing certificate paths, it is neccessary to restart QupZilla Select All - Välj allt + Markera allt @@ -4239,7 +4240,7 @@ After adding or removing certificate paths, it is neccessary to restart QupZilla Reload - Ladda om + Hämta om @@ -4525,7 +4526,7 @@ After adding or removing certificate paths, it is neccessary to restart QupZilla &Reload - + &Hämta om @@ -4600,12 +4601,12 @@ After adding or removing certificate paths, it is neccessary to restart QupZilla Select &all - Välj &allt + Markera &allt Validate page - + Validera sida @@ -4615,7 +4616,7 @@ After adding or removing certificate paths, it is neccessary to restart QupZilla Show Web &Inspector - + Visa webbinspektören @@ -4673,7 +4674,7 @@ After adding or removing certificate paths, it is neccessary to restart QupZilla License Viewer - + Licensvisare @@ -4686,7 +4687,7 @@ After adding or removing certificate paths, it is neccessary to restart QupZilla Reload - Ladda om + Hämta om @@ -4713,7 +4714,7 @@ After adding or removing certificate paths, it is neccessary to restart QupZilla Web Inspector - + Webinspektör @@ -4786,7 +4787,7 @@ After adding or removing certificate paths, it is neccessary to restart QupZilla Proxy authentication required - + Proxyautentisering krävs @@ -4894,6 +4895,10 @@ After adding or removing certificate paths, it is neccessary to restart QupZilla &Print page &Skriv ut sida + + Validate page + Validera sida + Send text... Skicka text... @@ -5016,7 +5021,7 @@ After adding or removing certificate paths, it is neccessary to restart QupZilla Select &all - Välj &allt + Markera &allt Show so&urce code @@ -5026,6 +5031,10 @@ After adding or removing certificate paths, it is neccessary to restart QupZilla Show info ab&out site Visa &information om denna sida + + Show Web &Inspector + Visa webbinspektören + Search "%1 .." with %2 Sök efter"%1 .."på %2