Commit 37e06c8d authored by Eike Ziller's avatar Eike Ziller
Browse files

HelpViewers: Fix context menu item title and corresponding symbol names



It should be "Open Link as New Page", not "New Window".

Change-Id: Iccfd179370e912028f8d0d2562cfe51e6f7d6ccd
Reviewed-by: default avatarLeena Miettinen <riitta-leena.miettinen@digia.com>
parent b6098da7
......@@ -69,7 +69,7 @@ public:
virtual bool isBackwardAvailable() const = 0;
virtual void addBackHistoryItems(QMenu *backMenu) = 0;
virtual void addForwardHistoryItems(QMenu *forwardMenu) = 0;
virtual void setOpenInNewWindowActionVisible(bool visible) = 0;
virtual void setOpenInNewPageActionVisible(bool visible) = 0;
virtual bool findText(const QString &text, Core::FindFlags flags,
bool incremental, bool fromSearch, bool *wrapped = 0) = 0;
......
......@@ -156,7 +156,7 @@ HelpWidget::HelpWidget(const Core::Context &context, WidgetStyle style, QWidget
QString(), toolBar);
connect(close, SIGNAL(triggered()), this, SIGNAL(closeButtonClicked()));
layout->addWidget(toolButton(close));
m_viewer->setOpenInNewWindowActionVisible(false);
m_viewer->setOpenInNewPageActionVisible(false);
} else if (style == ExternalWindow) {
static int windowId = 0;
Core::ICore::registerWindow(this,
......@@ -165,7 +165,7 @@ HelpWidget::HelpWidget(const Core::Context &context, WidgetStyle style, QWidget
setAttribute(Qt::WA_QuitOnClose, false); // don't prevent Qt Creator from closing
connect(m_viewer, SIGNAL(titleChanged()), this, SLOT(updateWindowTitle()));
updateWindowTitle();
m_viewer->setOpenInNewWindowActionVisible(false);
m_viewer->setOpenInNewPageActionVisible(false);
}
}
......
......@@ -64,7 +64,7 @@ public:
MacWebKitHelpWidget(MacWebKitHelpViewer *parent);
~MacWebKitHelpWidget();
void setOpenInNewWindowActionVisible(bool visible);
void setOpenInNewPageActionVisible(bool visible);
WebView *webView() const;
......@@ -103,7 +103,7 @@ public:
bool isBackwardAvailable() const;
void addBackHistoryItems(QMenu *backMenu);
void addForwardHistoryItems(QMenu *forwardMenu);
void setOpenInNewWindowActionVisible(bool visible);
void setOpenInNewPageActionVisible(bool visible);
bool findText(const QString &text, Core::FindFlags flags,
bool incremental, bool fromSearch, bool *wrapped = 0);
......
......@@ -257,7 +257,7 @@ static void ensureProtocolHandler()
QWidget *widget;
}
@property (assign) BOOL openInNewWindowActionVisible;
@property (assign) BOOL openInNewPageActionVisible;
- (id)initWithWidget:(QWidget *)theWidget;
- (void)webView:(WebView *)sender makeFirstResponder:(NSResponder *)responder;
......@@ -274,7 +274,7 @@ static void ensureProtocolHandler()
self = [super init];
if (self) {
widget = theWidget;
self.openInNewWindowActionVisible = YES;
self.openInNewPageActionVisible = YES;
}
return self;
}
......@@ -312,8 +312,10 @@ static void ensureProtocolHandler()
break;
case WebMenuItemTagOpenLinkInNewWindow:
case WebMenuItemTagOpenImageInNewWindow:
if (self.openInNewWindowActionVisible)
if (self.openInNewPageActionVisible) {
item.title = QCoreApplication::translate("HelpViewer", "Open Link as New Page").toNSString();
[ret addObject:item];
}
default:
break;
}
......@@ -417,9 +419,9 @@ MacWebKitHelpWidget::~MacWebKitHelpWidget()
delete d;
}
void MacWebKitHelpWidget::setOpenInNewWindowActionVisible(bool visible)
void MacWebKitHelpWidget::setOpenInNewPageActionVisible(bool visible)
{
d->m_uiDelegate.openInNewWindowActionVisible = visible;
d->m_uiDelegate.openInNewPageActionVisible = visible;
}
WebView *MacWebKitHelpWidget::webView() const
......@@ -588,9 +590,9 @@ void MacWebKitHelpViewer::addForwardHistoryItems(QMenu *forwardMenu)
}
}
void MacWebKitHelpViewer::setOpenInNewWindowActionVisible(bool visible)
void MacWebKitHelpViewer::setOpenInNewPageActionVisible(bool visible)
{
m_widget->setOpenInNewWindowActionVisible(visible);
m_widget->setOpenInNewPageActionVisible(visible);
}
DOMRange *MacWebKitHelpViewer::findText(NSString *text, bool forward, bool caseSensitive, DOMNode *startNode, int startOffset)
......
......@@ -295,6 +295,11 @@ void QtWebKitHelpWidget::scaleDown()
setZoomFactor(qMax(qreal(0.0), zoomFactor() - qreal(0.1)));
}
void QtWebKitHelpWidget::setOpenInNewPageActionVisible(bool visible)
{
m_openInNewPageActionVisible = visible;
}
// -- public slots
void QtWebKitHelpWidget::copy()
......@@ -345,6 +350,15 @@ void QtWebKitHelpWidget::mouseReleaseEvent(QMouseEvent *event)
QWebView::mouseReleaseEvent(event);
}
void QtWebKitHelpWidget::contextMenuEvent(QContextMenuEvent *event)
{
QAction *newPageAction = pageAction(QWebPage::OpenLinkInNewWindow);
newPageAction->setText(QCoreApplication::translate("HelpViewer", "Open Link as New Page"));
QMenu *menu = page()->createStandardContextMenu();
menu->exec(event->globalPos());
delete menu;
}
// -- private slots
void QtWebKitHelpWidget::actionChanged()
......@@ -541,9 +555,9 @@ void QtWebKitHelpViewer::addForwardHistoryItems(QMenu *forwardMenu)
}
}
void QtWebKitHelpViewer::setOpenInNewWindowActionVisible(bool visible)
void QtWebKitHelpViewer::setOpenInNewPageActionVisible(bool visible)
{
m_webView->pageAction(QWebPage::OpenLinkInNewWindow)->setVisible(visible);
m_webView->setOpenInNewPageActionVisible(visible);
}
bool QtWebKitHelpViewer::findText(const QString &text, Core::FindFlags flags,
......
......@@ -69,7 +69,7 @@ public:
bool isBackwardAvailable() const;
void addBackHistoryItems(QMenu *backMenu);
void addForwardHistoryItems(QMenu *forwardMenu);
void setOpenInNewWindowActionVisible(bool visible);
void setOpenInNewPageActionVisible(bool visible);
bool findText(const QString &text, Core::FindFlags flags,
bool incremental, bool fromSearch, bool *wrapped = 0);
......@@ -108,6 +108,8 @@ public:
void scaleUp();
void scaleDown();
void setOpenInNewPageActionVisible(bool visible);
public slots:
void copy();
......@@ -120,6 +122,7 @@ protected:
void wheelEvent(QWheelEvent *event);
void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
void contextMenuEvent(QContextMenuEvent *event);
private slots:
void actionChanged();
......@@ -129,6 +132,7 @@ private:
bool eventFilter(QObject *obj, QEvent *event);
QtWebKitHelpViewer *m_parent;
bool m_openInNewPageActionVisible;
};
class HelpPage : public QWebPage
......
......@@ -177,9 +177,9 @@ void TextBrowserHelpViewer::addForwardHistoryItems(QMenu *forwardMenu)
}
}
void TextBrowserHelpViewer::setOpenInNewWindowActionVisible(bool visible)
void TextBrowserHelpViewer::setOpenInNewPageActionVisible(bool visible)
{
m_textBrowser->showOpenInNewWindowAction = visible;
m_textBrowser->m_openInNewPageActionVisible = visible;
}
bool TextBrowserHelpViewer::findText(const QString &text, Core::FindFlags flags,
......@@ -287,7 +287,7 @@ TextBrowserHelpWidget::TextBrowserHelpWidget(int zoom, TextBrowserHelpViewer *pa
, zoomCount(zoom)
, forceFont(false)
, lastAnchor(QString())
, showOpenInNewWindowAction(true)
, m_openInNewPageActionVisible(true)
, m_parent(parent)
{
installEventFilter(this);
......@@ -368,8 +368,9 @@ void TextBrowserHelpWidget::contextMenuEvent(QContextMenuEvent *event)
if (link.isRelative())
link = source().resolved(link);
menu.addAction(tr("Open Link"), this, SLOT(openLink()));
if (showOpenInNewWindowAction)
menu.addAction(tr("Open Link as New Page"), this, SLOT(openLinkInNewPage()));
if (m_openInNewPageActionVisible)
menu.addAction(QCoreApplication::translate("HelpViewer", "Open Link as New Page"),
this, SLOT(openLinkInNewPage()));
if (!link.isEmpty() && link.isValid())
copyAnchorAction = menu.addAction(tr("Copy Link"));
......
......@@ -67,7 +67,7 @@ public:
bool isBackwardAvailable() const;
void addBackHistoryItems(QMenu *backMenu);
void addForwardHistoryItems(QMenu *forwardMenu);
void setOpenInNewWindowActionVisible(bool visible);
void setOpenInNewPageActionVisible(bool visible);
bool findText(const QString &text, Core::FindFlags flags,
bool incremental, bool fromSearch, bool *wrapped = 0);
......@@ -120,7 +120,7 @@ public:
int zoomCount;
bool forceFont;
QString lastAnchor;
bool showOpenInNewWindowAction;
bool m_openInNewPageActionVisible;
TextBrowserHelpViewer *m_parent;
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment