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

[MouseGestures] Honor to user settings for 'New Tab' url,

- Closes #1380
This commit is contained in:
S. Razi Alavizadeh 2014-06-02 00:28:41 +04:30
parent 59b893075a
commit 0af8f45a5f
7 changed files with 19 additions and 6 deletions

View File

@ -75,6 +75,18 @@ void PopupWebView::loadInNewTab(const LoadRequest &req, Qz::NewTabPositionFlags
} }
} }
void PopupWebView::openNewTab(Qz::NewTabPositionFlags position)
{
Q_UNUSED(position)
BrowserWindow* window = mApp->getWindow();
if (window) {
window->tabWidget()->addView(QUrl(), Qz::NT_SelectedTab);
window->raise();
}
}
void PopupWebView::closeView() void PopupWebView::closeView()
{ {
parentWidget()->close(); parentWidget()->close();

View File

@ -36,6 +36,7 @@ public:
QWidget* overlayWidget(); QWidget* overlayWidget();
void loadInNewTab(const LoadRequest &req, Qz::NewTabPositionFlags position); void loadInNewTab(const LoadRequest &req, Qz::NewTabPositionFlags position);
void openNewTab(Qz::NewTabPositionFlags position);
signals: signals:

View File

@ -107,7 +107,7 @@ public slots:
void openUrlInNewTab(const QUrl &url, Qz::NewTabPositionFlags position); void openUrlInNewTab(const QUrl &url, Qz::NewTabPositionFlags position);
virtual void closeView() = 0; virtual void closeView() = 0;
virtual void openNewTab() { } virtual void openNewTab(Qz::NewTabPositionFlags position) { Q_UNUSED(position) }
virtual void loadInNewTab(const LoadRequest &req, Qz::NewTabPositionFlags position) = 0; virtual void loadInNewTab(const LoadRequest &req, Qz::NewTabPositionFlags position) = 0;
protected slots: protected slots:

View File

@ -214,10 +214,10 @@ void TabbedWebView::closeView()
emit wantsCloseTab(tabIndex()); emit wantsCloseTab(tabIndex());
} }
void TabbedWebView::openNewTab() void TabbedWebView::openNewTab(Qz::NewTabPositionFlags position)
{ {
if (m_window) { if (m_window) {
m_window->tabWidget()->addView(QUrl()); m_window->tabWidget()->addView(QUrl(), position);
} }
} }

View File

@ -59,7 +59,7 @@ public slots:
void userLoadAction(const LoadRequest &req); void userLoadAction(const LoadRequest &req);
void closeView(); void closeView();
void openNewTab(); void openNewTab(Qz::NewTabPositionFlags position);
void loadInNewTab(const LoadRequest &req, Qz::NewTabPositionFlags position); void loadInNewTab(const LoadRequest &req, Qz::NewTabPositionFlags position);
private slots: private slots:

View File

@ -170,7 +170,7 @@ int main(int argc, char* argv[])
// Hack to fix QT_STYLE_OVERRIDE with QProxyStyle // Hack to fix QT_STYLE_OVERRIDE with QProxyStyle
const QByteArray style = qgetenv("QT_STYLE_OVERRIDE"); const QByteArray style = qgetenv("QT_STYLE_OVERRIDE");
if (!style.isEmpty()) { if (!style.isEmpty()) {
char **args = (char**) malloc(sizeof(char*) * (argc + 1)); char** args = (char**) malloc(sizeof(char*) * (argc + 1));
for (int i = 0; i < argc; ++i) for (int i = 0; i < argc; ++i)
args[i] = argv[i]; args[i] = argv[i];

View File

@ -183,7 +183,7 @@ void MouseGestures::downGestured()
return; return;
} }
m_view.data()->openUrlInNewTab(QUrl(), Qz::NT_SelectedNewEmptyTab); m_view.data()->openNewTab(Qz::NT_SelectedNewEmptyTab);
} }
void MouseGestures::leftGestured() void MouseGestures::leftGestured()