forked from qt-creator/qt-creator
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: Leena Miettinen <riitta-leena.miettinen@digia.com>
This commit is contained in:
@@ -69,7 +69,7 @@ public:
|
|||||||
virtual bool isBackwardAvailable() const = 0;
|
virtual bool isBackwardAvailable() const = 0;
|
||||||
virtual void addBackHistoryItems(QMenu *backMenu) = 0;
|
virtual void addBackHistoryItems(QMenu *backMenu) = 0;
|
||||||
virtual void addForwardHistoryItems(QMenu *forwardMenu) = 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,
|
virtual bool findText(const QString &text, Core::FindFlags flags,
|
||||||
bool incremental, bool fromSearch, bool *wrapped = 0) = 0;
|
bool incremental, bool fromSearch, bool *wrapped = 0) = 0;
|
||||||
|
@@ -156,7 +156,7 @@ HelpWidget::HelpWidget(const Core::Context &context, WidgetStyle style, QWidget
|
|||||||
QString(), toolBar);
|
QString(), toolBar);
|
||||||
connect(close, SIGNAL(triggered()), this, SIGNAL(closeButtonClicked()));
|
connect(close, SIGNAL(triggered()), this, SIGNAL(closeButtonClicked()));
|
||||||
layout->addWidget(toolButton(close));
|
layout->addWidget(toolButton(close));
|
||||||
m_viewer->setOpenInNewWindowActionVisible(false);
|
m_viewer->setOpenInNewPageActionVisible(false);
|
||||||
} else if (style == ExternalWindow) {
|
} else if (style == ExternalWindow) {
|
||||||
static int windowId = 0;
|
static int windowId = 0;
|
||||||
Core::ICore::registerWindow(this,
|
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
|
setAttribute(Qt::WA_QuitOnClose, false); // don't prevent Qt Creator from closing
|
||||||
connect(m_viewer, SIGNAL(titleChanged()), this, SLOT(updateWindowTitle()));
|
connect(m_viewer, SIGNAL(titleChanged()), this, SLOT(updateWindowTitle()));
|
||||||
updateWindowTitle();
|
updateWindowTitle();
|
||||||
m_viewer->setOpenInNewWindowActionVisible(false);
|
m_viewer->setOpenInNewPageActionVisible(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -64,7 +64,7 @@ public:
|
|||||||
MacWebKitHelpWidget(MacWebKitHelpViewer *parent);
|
MacWebKitHelpWidget(MacWebKitHelpViewer *parent);
|
||||||
~MacWebKitHelpWidget();
|
~MacWebKitHelpWidget();
|
||||||
|
|
||||||
void setOpenInNewWindowActionVisible(bool visible);
|
void setOpenInNewPageActionVisible(bool visible);
|
||||||
|
|
||||||
WebView *webView() const;
|
WebView *webView() const;
|
||||||
|
|
||||||
@@ -103,7 +103,7 @@ public:
|
|||||||
bool isBackwardAvailable() const;
|
bool isBackwardAvailable() const;
|
||||||
void addBackHistoryItems(QMenu *backMenu);
|
void addBackHistoryItems(QMenu *backMenu);
|
||||||
void addForwardHistoryItems(QMenu *forwardMenu);
|
void addForwardHistoryItems(QMenu *forwardMenu);
|
||||||
void setOpenInNewWindowActionVisible(bool visible);
|
void setOpenInNewPageActionVisible(bool visible);
|
||||||
|
|
||||||
bool findText(const QString &text, Core::FindFlags flags,
|
bool findText(const QString &text, Core::FindFlags flags,
|
||||||
bool incremental, bool fromSearch, bool *wrapped = 0);
|
bool incremental, bool fromSearch, bool *wrapped = 0);
|
||||||
|
@@ -257,7 +257,7 @@ static void ensureProtocolHandler()
|
|||||||
QWidget *widget;
|
QWidget *widget;
|
||||||
}
|
}
|
||||||
|
|
||||||
@property (assign) BOOL openInNewWindowActionVisible;
|
@property (assign) BOOL openInNewPageActionVisible;
|
||||||
|
|
||||||
- (id)initWithWidget:(QWidget *)theWidget;
|
- (id)initWithWidget:(QWidget *)theWidget;
|
||||||
- (void)webView:(WebView *)sender makeFirstResponder:(NSResponder *)responder;
|
- (void)webView:(WebView *)sender makeFirstResponder:(NSResponder *)responder;
|
||||||
@@ -274,7 +274,7 @@ static void ensureProtocolHandler()
|
|||||||
self = [super init];
|
self = [super init];
|
||||||
if (self) {
|
if (self) {
|
||||||
widget = theWidget;
|
widget = theWidget;
|
||||||
self.openInNewWindowActionVisible = YES;
|
self.openInNewPageActionVisible = YES;
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
@@ -312,8 +312,10 @@ static void ensureProtocolHandler()
|
|||||||
break;
|
break;
|
||||||
case WebMenuItemTagOpenLinkInNewWindow:
|
case WebMenuItemTagOpenLinkInNewWindow:
|
||||||
case WebMenuItemTagOpenImageInNewWindow:
|
case WebMenuItemTagOpenImageInNewWindow:
|
||||||
if (self.openInNewWindowActionVisible)
|
if (self.openInNewPageActionVisible) {
|
||||||
|
item.title = QCoreApplication::translate("HelpViewer", "Open Link as New Page").toNSString();
|
||||||
[ret addObject:item];
|
[ret addObject:item];
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -417,9 +419,9 @@ MacWebKitHelpWidget::~MacWebKitHelpWidget()
|
|||||||
delete d;
|
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
|
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)
|
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)));
|
setZoomFactor(qMax(qreal(0.0), zoomFactor() - qreal(0.1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QtWebKitHelpWidget::setOpenInNewPageActionVisible(bool visible)
|
||||||
|
{
|
||||||
|
m_openInNewPageActionVisible = visible;
|
||||||
|
}
|
||||||
|
|
||||||
// -- public slots
|
// -- public slots
|
||||||
|
|
||||||
void QtWebKitHelpWidget::copy()
|
void QtWebKitHelpWidget::copy()
|
||||||
@@ -345,6 +350,15 @@ void QtWebKitHelpWidget::mouseReleaseEvent(QMouseEvent *event)
|
|||||||
QWebView::mouseReleaseEvent(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
|
// -- private slots
|
||||||
|
|
||||||
void QtWebKitHelpWidget::actionChanged()
|
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,
|
bool QtWebKitHelpViewer::findText(const QString &text, Core::FindFlags flags,
|
||||||
|
@@ -69,7 +69,7 @@ public:
|
|||||||
bool isBackwardAvailable() const;
|
bool isBackwardAvailable() const;
|
||||||
void addBackHistoryItems(QMenu *backMenu);
|
void addBackHistoryItems(QMenu *backMenu);
|
||||||
void addForwardHistoryItems(QMenu *forwardMenu);
|
void addForwardHistoryItems(QMenu *forwardMenu);
|
||||||
void setOpenInNewWindowActionVisible(bool visible);
|
void setOpenInNewPageActionVisible(bool visible);
|
||||||
|
|
||||||
bool findText(const QString &text, Core::FindFlags flags,
|
bool findText(const QString &text, Core::FindFlags flags,
|
||||||
bool incremental, bool fromSearch, bool *wrapped = 0);
|
bool incremental, bool fromSearch, bool *wrapped = 0);
|
||||||
@@ -108,6 +108,8 @@ public:
|
|||||||
void scaleUp();
|
void scaleUp();
|
||||||
void scaleDown();
|
void scaleDown();
|
||||||
|
|
||||||
|
void setOpenInNewPageActionVisible(bool visible);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void copy();
|
void copy();
|
||||||
|
|
||||||
@@ -120,6 +122,7 @@ protected:
|
|||||||
void wheelEvent(QWheelEvent *event);
|
void wheelEvent(QWheelEvent *event);
|
||||||
void mousePressEvent(QMouseEvent *event);
|
void mousePressEvent(QMouseEvent *event);
|
||||||
void mouseReleaseEvent(QMouseEvent *event);
|
void mouseReleaseEvent(QMouseEvent *event);
|
||||||
|
void contextMenuEvent(QContextMenuEvent *event);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void actionChanged();
|
void actionChanged();
|
||||||
@@ -129,6 +132,7 @@ private:
|
|||||||
bool eventFilter(QObject *obj, QEvent *event);
|
bool eventFilter(QObject *obj, QEvent *event);
|
||||||
|
|
||||||
QtWebKitHelpViewer *m_parent;
|
QtWebKitHelpViewer *m_parent;
|
||||||
|
bool m_openInNewPageActionVisible;
|
||||||
};
|
};
|
||||||
|
|
||||||
class HelpPage : public QWebPage
|
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,
|
bool TextBrowserHelpViewer::findText(const QString &text, Core::FindFlags flags,
|
||||||
@@ -287,7 +287,7 @@ TextBrowserHelpWidget::TextBrowserHelpWidget(int zoom, TextBrowserHelpViewer *pa
|
|||||||
, zoomCount(zoom)
|
, zoomCount(zoom)
|
||||||
, forceFont(false)
|
, forceFont(false)
|
||||||
, lastAnchor(QString())
|
, lastAnchor(QString())
|
||||||
, showOpenInNewWindowAction(true)
|
, m_openInNewPageActionVisible(true)
|
||||||
, m_parent(parent)
|
, m_parent(parent)
|
||||||
{
|
{
|
||||||
installEventFilter(this);
|
installEventFilter(this);
|
||||||
@@ -368,8 +368,9 @@ void TextBrowserHelpWidget::contextMenuEvent(QContextMenuEvent *event)
|
|||||||
if (link.isRelative())
|
if (link.isRelative())
|
||||||
link = source().resolved(link);
|
link = source().resolved(link);
|
||||||
menu.addAction(tr("Open Link"), this, SLOT(openLink()));
|
menu.addAction(tr("Open Link"), this, SLOT(openLink()));
|
||||||
if (showOpenInNewWindowAction)
|
if (m_openInNewPageActionVisible)
|
||||||
menu.addAction(tr("Open Link as New Page"), this, SLOT(openLinkInNewPage()));
|
menu.addAction(QCoreApplication::translate("HelpViewer", "Open Link as New Page"),
|
||||||
|
this, SLOT(openLinkInNewPage()));
|
||||||
|
|
||||||
if (!link.isEmpty() && link.isValid())
|
if (!link.isEmpty() && link.isValid())
|
||||||
copyAnchorAction = menu.addAction(tr("Copy Link"));
|
copyAnchorAction = menu.addAction(tr("Copy Link"));
|
||||||
|
@@ -67,7 +67,7 @@ public:
|
|||||||
bool isBackwardAvailable() const;
|
bool isBackwardAvailable() const;
|
||||||
void addBackHistoryItems(QMenu *backMenu);
|
void addBackHistoryItems(QMenu *backMenu);
|
||||||
void addForwardHistoryItems(QMenu *forwardMenu);
|
void addForwardHistoryItems(QMenu *forwardMenu);
|
||||||
void setOpenInNewWindowActionVisible(bool visible);
|
void setOpenInNewPageActionVisible(bool visible);
|
||||||
|
|
||||||
bool findText(const QString &text, Core::FindFlags flags,
|
bool findText(const QString &text, Core::FindFlags flags,
|
||||||
bool incremental, bool fromSearch, bool *wrapped = 0);
|
bool incremental, bool fromSearch, bool *wrapped = 0);
|
||||||
@@ -120,7 +120,7 @@ public:
|
|||||||
int zoomCount;
|
int zoomCount;
|
||||||
bool forceFont;
|
bool forceFont;
|
||||||
QString lastAnchor;
|
QString lastAnchor;
|
||||||
bool showOpenInNewWindowAction;
|
bool m_openInNewPageActionVisible;
|
||||||
TextBrowserHelpViewer *m_parent;
|
TextBrowserHelpViewer *m_parent;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user