Commit 7ac9bc57 authored by Marco Martin's avatar Marco Martin

reset toolbar items when the module shows

repopulate (or depopulate) the toolbar when the active view
changes (but its instance was already loaded)
BUG:380083
parent c72349a8
......@@ -224,6 +224,15 @@ void ClassicMode::initWidget()
defaultSizes << 250 << 500;
d->classicWidget->setSizes( config().readEntry( "viewLayout", defaultSizes ) );
emit changeToolBarItems( BaseMode::Search | BaseMode::Configure | BaseMode::Quit );
d->classicWidget->installEventFilter(this);
}
bool ClassicMode::eventFilter(QObject* watched, QEvent* event)
{
if (watched == d->classicWidget && event->type() == QEvent::Show) {
emit changeToolBarItems( BaseMode::Search | BaseMode::Configure | BaseMode::Quit );
}
return BaseMode::eventFilter(watched, event);
}
void ClassicMode::leaveModuleView()
......
......@@ -40,6 +40,7 @@ public:
protected:
QList<QAbstractItemView*> views() const Q_DECL_OVERRIDE;
bool eventFilter(QObject* watched, QEvent* event) Q_DECL_OVERRIDE;
public Q_SLOTS:
void expandColumns();
......
......@@ -186,6 +186,15 @@ void IconMode::initWidget()
d->mainWidget->addWidget( d->moduleView );
d->mainWidget->setCurrentWidget( d->categoryView );
emit changeToolBarItems( BaseMode::Search | BaseMode::Configure | BaseMode::Quit );
d->mainWidget->installEventFilter(this);
}
bool IconMode::eventFilter(QObject* watched, QEvent* event)
{
if (watched == d->mainWidget && event->type() == QEvent::Show) {
emit changeToolBarItems( BaseMode::Search | BaseMode::Configure | BaseMode::Quit );
}
return BaseMode::eventFilter(watched, event);
}
void IconMode::leaveModuleView()
......
......@@ -43,6 +43,7 @@ public:
protected:
QList<QAbstractItemView*> views() const Q_DECL_OVERRIDE;
bool eventFilter(QObject* watched, QEvent* event) Q_DECL_OVERRIDE;
public Q_SLOTS:
void searchChanged( const QString& text ) Q_DECL_OVERRIDE;
......
......@@ -375,7 +375,6 @@ void SidebarMode::moduleLoaded()
{
d->placeHolderWidget->hide();
d->moduleView->show();
emit changeToolBarItems(BaseMode::NoItems);
}
int SidebarMode::activeCategory() const
......@@ -484,6 +483,8 @@ bool SidebarMode::eventFilter(QObject* watched, QEvent* event)
QCoreApplication::sendEvent(d->quickWidget->quickWindow(), event);
} else if (watched == d->mainWidget && event->type() == QEvent::Resize) {
emit widthChanged();
} else if (watched == d->mainWidget && event->type() == QEvent::Show) {
emit changeToolBarItems(BaseMode::NoItems);
}
return BaseMode::eventFilter(watched, event);
}
......
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