Commit 761a9694 authored by Leandro Melo's avatar Leandro Melo

Export the navigation widget and expose activation of subwidgets.

Reviewed-by: hjk
parent 7d135ef0
......@@ -60,6 +60,7 @@ class MessageManager;
class MimeDatabase;
class ModeManager;
class ProgressManager;
class NavigationWidget;
class RightPaneWidget;
class ScriptManager;
class SettingsDatabase;
......@@ -73,7 +74,6 @@ class ActionManagerPrivate;
class CoreImpl;
class FancyTabWidget;
class GeneralSettings;
class NavigationWidget;
class ProgressManagerPrivate;
class ShortcutSettings;
class StatusBarManager;
......
......@@ -233,18 +233,22 @@ NavigationSubWidget *NavigationWidget::insertSubItem(int position,int index)
void NavigationWidget::activateSubWidget()
{
setShown(true);
QShortcut *original = qobject_cast<QShortcut *>(sender());
QString id = m_shortcutMap[original];
activateSubWidget(id);
}
void NavigationWidget::activateSubWidget(const QString &factoryId)
{
setShown(true);
foreach (NavigationSubWidget *subWidget, m_subWidgets) {
if (subWidget->factory()->id() == id) {
if (subWidget->factory()->id() == factoryId) {
subWidget->setFocusWidget();
return;
}
}
int index = factoryIndex(id);
int index = factoryIndex(factoryId);
if (index >= 0) {
m_subWidgets.first()->setFactoryIndex(index);
m_subWidgets.first()->setFocusWidget();
......
......@@ -49,14 +49,11 @@ namespace Core {
class INavigationWidgetFactory;
class IMode;
class Command;
namespace Internal {
class NavigationWidget;
}
class CORE_EXPORT NavigationWidgetPlaceHolder : public QWidget
{
friend class Core::Internal::NavigationWidget;
friend class Core::NavigationWidget;
Q_OBJECT
public:
NavigationWidgetPlaceHolder(Core::IMode *mode, QWidget *parent = 0);
......@@ -71,10 +68,10 @@ private:
};
namespace Internal {
class NavigationSubWidget;
}
class NavigationWidget : public MiniSplitter
class CORE_EXPORT NavigationWidget : public MiniSplitter
{
Q_OBJECT
public:
......@@ -92,6 +89,7 @@ public:
void saveSettings(QSettings *settings);
void restoreSettings(QSettings *settings);
void activateSubWidget(const QString &factoryId);
void closeSubWidgets();
bool isShown() const;
......@@ -120,10 +118,10 @@ private slots:
private:
void updateToggleText();
NavigationSubWidget *insertSubItem(int position, int index);
Internal::NavigationSubWidget *insertSubItem(int position, int index);
int factoryIndex(const QString &id);
QList<NavigationSubWidget *> m_subWidgets;
QList<Internal::NavigationSubWidget *> m_subWidgets;
QHash<QShortcut *, QString> m_shortcutMap;
QHash<QString, Core::Command*> m_commandMap;
QStandardItemModel *m_factoryModel;
......@@ -135,6 +133,8 @@ private:
QAction *m_toggleSideBarAction;
};
namespace Internal {
class NavigationSubWidget : public QWidget
{
Q_OBJECT
......
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