SVN commit 996216 by bcooksley: Fix widget focusing problems M +4 -4 app/SettingsBase.cpp M +5 -0 classic/ClassicMode.cpp M +1 -0 classic/ClassicMode.h M +4 -0 core/BaseMode.cpp M +7 -0 core/BaseMode.h M +5 -0 icons/IconMode.cpp M +1 -0 icons/IconMode.h --- trunk/KDE/kdebase/workspace/systemsettings/app/SettingsBase.cpp #996215:996216 @@ -47,6 +47,9 @@ activeView = 0; aboutDialog = 0; configDialog = 0; + // Prepare the view area + stackedWidget = new QStackedWidget( this ); + setCentralWidget(stackedWidget); // Initialise search mainConfigGroup = KGlobal::config()->group( "Main" ); searchText = new KLineEdit( this ); @@ -77,9 +80,6 @@ // Prepare the menu of all modules rootModule = new MenuItem( true, 0 ); initMenuList(rootModule); - // Prepare the view area - stackedWidget = new QStackedWidget( this ); - setCentralWidget(stackedWidget); // Prepare the Base Data BaseData::instance()->setMenuItem( rootModule ); // Load all possible views @@ -285,7 +285,7 @@ stackedWidget->setCurrentWidget(activeView->mainWidget()); updateViewActions(); - activeView->mainWidget()->setFocus(); + activeView->giveFocus(); } void SettingsBase::viewChange(bool state) --- trunk/KDE/kdebase/workspace/systemsettings/classic/ClassicMode.cpp #996215:996216 @@ -211,4 +211,9 @@ d->stackedWidget->setCurrentWidget( d->classicCategory ); } +void ClassicMode::giveFocus() +{ + d->classicTree->setFocus(); +} + #include "ClassicMode.moc" --- trunk/KDE/kdebase/workspace/systemsettings/classic/ClassicMode.h #996215:996216 @@ -46,6 +46,7 @@ void selectModule( const QModelIndex& selectedModule ); void changeModule( const QModelIndex& activeModule ); void saveState(); + void giveFocus(); private Q_SLOTS: void moduleLoaded(); --- trunk/KDE/kdebase/workspace/systemsettings/core/BaseMode.cpp #996215:996216 @@ -121,6 +121,10 @@ { } +void BaseMode::giveFocus() +{ +} + MenuItem * BaseMode::rootItem() const { return d->rootItem; --- trunk/KDE/kdebase/workspace/systemsettings/core/BaseMode.h #996215:996216 @@ -119,6 +119,13 @@ virtual void leaveModuleView(); /** + * Used to give focus to the plugin. Plugin should call setFocus() on the appropriate widget + * + * @note Failure to reimplement will cause keyboard accessibiltity and widget focusing problems + */ + virtual void giveFocus(); + + /** * Provides access to the ModuleView the application uses to display control modules.\n * * @warning Failure to reimplement will cause modules not to be checked for configuration --- trunk/KDE/kdebase/workspace/systemsettings/icons/IconMode.cpp #996215:996216 @@ -196,4 +196,9 @@ backToOverview(); } +void IconMode::giveFocus() +{ + d->iconWidget->currentWidget()->setFocus(); +} + #include "IconMode.moc" --- trunk/KDE/kdebase/workspace/systemsettings/icons/IconMode.h #996215:996216 @@ -36,6 +36,7 @@ ~IconMode(); QWidget * mainWidget(); void initEvent(); + void giveFocus(); void leaveModuleView(); KAboutData * aboutData(); ModuleView * moduleView() const;