summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorcon <qtc-committer@nokia.com>2009-03-13 12:10:28 +0100
committercon <qtc-committer@nokia.com>2009-03-13 12:10:28 +0100
commite8161ebd02dc2c274eedf487ecf00b38e95313e0 (patch)
tree1f30bfce227d39f11a023254dbc79a67a2220adf /src/plugins
parentfcc271b616f7159cd30bb44985c83ca04b75824d (diff)
downloadqt-creator-e8161ebd02dc2c274eedf487ecf00b38e95313e0.tar.gz
Fixes: Copy from help sidebar doesn't work
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/coreplugin/icontext.h19
-rw-r--r--src/plugins/help/helpplugin.cpp16
-rw-r--r--src/plugins/help/helpplugin.h9
3 files changed, 40 insertions, 4 deletions
diff --git a/src/plugins/coreplugin/icontext.h b/src/plugins/coreplugin/icontext.h
index 81a6324091..cbdfc36702 100644
--- a/src/plugins/coreplugin/icontext.h
+++ b/src/plugins/coreplugin/icontext.h
@@ -51,6 +51,25 @@ public:
virtual QString contextHelpId() const { return QString(); }
};
+class BaseContext : public Core::IContext
+{
+public:
+ BaseContext(QWidget *widget, const QList<int> &context, QObject *parent = 0)
+ : Core::IContext(parent),
+ m_widget(widget),
+ m_context(context)
+ {
+ }
+
+ QList<int> context() const { return m_context; }
+
+ QWidget *widget() { return m_widget; }
+
+private:
+ QWidget *m_widget;
+ QList<int> m_context;
+};
+
} // namespace Core
#endif //ICONTEXT_H
diff --git a/src/plugins/help/helpplugin.cpp b/src/plugins/help/helpplugin.cpp
index 6e2e881221..55f8690af2 100644
--- a/src/plugins/help/helpplugin.cpp
+++ b/src/plugins/help/helpplugin.cpp
@@ -374,6 +374,17 @@ void HelpPlugin::createRightPaneSideBar()
m_helpViewerForSideBar = new HelpViewer(m_helpEngine, 0);
rightPaneLayout->addWidget(m_helpViewerForSideBar);
+ m_core->addContextObject(new Core::BaseContext(m_helpViewerForSideBar, QList<int>()
+ << m_core->uniqueIDManager()->uniqueIdentifier(Constants::C_HELP_SIDEBAR),
+ this));
+
+ QAction *copyActionSideBar = new QAction(this);
+ Core::Command *cmd = m_core->actionManager()->registerAction(copyActionSideBar,
+ Core::Constants::COPY, QList<int>()
+ << m_core->uniqueIDManager()->uniqueIdentifier(Constants::C_HELP_SIDEBAR));
+ connect(copyActionSideBar, SIGNAL(triggered()), this, SLOT(copyFromSideBar()));
+ copyActionSideBar->setText(cmd->action()->text());
+ copyActionSideBar->setIcon(cmd->action()->icon());
m_rightPaneSideBar = new QWidget;
m_rightPaneSideBar->setLayout(rightPaneLayout);
@@ -381,6 +392,11 @@ void HelpPlugin::createRightPaneSideBar()
addAutoReleasedObject(new Core::BaseRightPaneWidget(m_rightPaneSideBar));
}
+void HelpPlugin::copyFromSideBar()
+{
+ m_helpViewerForSideBar->copy();
+}
+
void HelpPlugin::rightPaneBackward()
{
m_helpViewerForSideBar->backward();
diff --git a/src/plugins/help/helpplugin.h b/src/plugins/help/helpplugin.h
index 05ccf9f8fd..d5a5dd9821 100644
--- a/src/plugins/help/helpplugin.h
+++ b/src/plugins/help/helpplugin.h
@@ -64,10 +64,10 @@ class SideBarItem;
namespace Help {
namespace Constants {
- const char * const HELPVIEWER_KIND = "Qt Help Viewer";
- const char * const C_MODE_HELP = "Help Mode";
- const int P_MODE_HELP = 70;
- const char * const ID_MODE_HELP = "Help";
+ const char * const C_MODE_HELP = "Help Mode";
+ const char * const C_HELP_SIDEBAR = "Help Sidebar";
+ const int P_MODE_HELP = 70;
+ const char * const ID_MODE_HELP = "Help";
}
class HELP_EXPORT HelpManager : public QObject
@@ -124,6 +124,7 @@ private slots:
void switchToHelpMode(const QUrl &source);
void switchToHelpMode(const QMap<QString, QUrl> &urls, const QString &keyword);
void slotHideRightPane();
+ void copyFromSideBar();
void openGettingStarted();