[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdebase/workspace/systemsettings
From:       Ben Cooksley <sourtooth () gmail ! com>
Date:       2009-05-19 8:42:56
Message-ID: 1242722576.952753.2101.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 969907 by bcooksley:

Fix bug where system settings window caption would not indicate changes \
when canceling changes in a multi icon situation. Remodel signaling so that \
the view can also indicate changes

 M  +10 -17    app/SettingsBase.cpp  
 M  +1 -2      app/SettingsBase.h  
 M  +1 -1      classic/ClassicMode.cpp  
 M  +1 -1      core/BaseMode.cpp  
 M  +5 -4      core/BaseMode.h  
 M  +12 -11    core/ModuleView.cpp  
 M  +5 -10     core/ModuleView.h  
 M  +2 -2      icons/IconMode.cpp  


--- trunk/KDE/kdebase/workspace/systemsettings/app/SettingsBase.cpp \
#969906:969907 @@ -94,8 +94,7 @@
             connect(controller, \
SIGNAL(changeToolBarItems(BaseMode::ToolBarItems)), this, \
                SLOT(changeToolBar(BaseMode::ToolBarItems)));
             connect(controller, SIGNAL(actionsChanged()), this, \
                SLOT(updateViewActions()));
             connect(searchText, SIGNAL(textChanged(const QString&)), \
                controller, SLOT(searchChanged(const QString&)));
-            connect(controller, SIGNAL(viewChanged()), this, \
                SLOT(moduleChanged()));
-            connect(controller->moduleView(), \
SIGNAL(configurationChanged(bool)), this, SLOT(toggleDirtyState(bool))); +  \
connect(controller, SIGNAL(viewChanged(bool)), this, \
SLOT(viewChange(bool)));  } else {
             kWarning() << "View load error: " + error;
         }
@@ -275,7 +274,7 @@
     }
 
     changeAboutMenu( activeView->aboutData(), aboutViewAction, i18n("About \
                Active View") );
-    moduleChanged();
+    viewChange(false);
     activeView->setEnhancedTooltipEnabled( showTooltips );
     stackedWidget->setCurrentWidget(activeView->mainWidget());
     updateViewActions();
@@ -283,11 +282,16 @@
     activeView->mainWidget()->setFocus();
 }
 
-void SettingsBase::toggleDirtyState(bool state)
+void SettingsBase::viewChange(bool state)
 {
-    KCModuleInfo * moduleProxy = activeView->moduleView()->activeModule();
+    KCModuleInfo * moduleInfo = activeView->moduleView()->activeModule();
     configureAction->setDisabled(state);
-    setCaption( moduleProxy->moduleName(), state );
+    if( moduleInfo ) {
+        setCaption( moduleInfo->moduleName(), state );
+    } else {
+        setCaption( QString(), state );
+    }
+    changeAboutMenu( activeView->moduleView()->aboutData(), \
aboutModuleAction, i18n("About Active Module") );  }
 
 void SettingsBase::updateViewActions()
@@ -296,17 +300,6 @@
     guiFactory()->plugActionList( this, "viewActions", \
activeView->actionsList() );  }
 
-void SettingsBase::moduleChanged()
-{
-    KCModuleInfo * moduleInfo = activeView->moduleView()->activeModule();
-    if( moduleInfo ) {
-        setCaption( moduleInfo->moduleName() );
-    } else {
-        setCaption( QString(), false );
-    }
-    changeAboutMenu( activeView->moduleView()->aboutData(), \
                aboutModuleAction, i18n("About Active Module") );
-}
-
 void SettingsBase::changeToolBar( BaseMode::ToolBarItems toolbar )
 {
     if( sender() != activeView ) {
--- trunk/KDE/kdebase/workspace/systemsettings/app/SettingsBase.h \
#969906:969907 @@ -60,9 +60,8 @@
     void configShow();
     void about();
     void changePlugin();
-    void toggleDirtyState(bool state);
+    void viewChange(bool state);
     void updateViewActions();
-    void moduleChanged();
     void changeToolBar( BaseMode::ToolBarItems toolbar );
     void changeAboutMenu( const KAboutData * menuAbout, KAction * \
menuItem, QString fallback );  
--- trunk/KDE/kdebase/workspace/systemsettings/classic/ClassicMode.cpp \
#969906:969907 @@ -157,7 +157,7 @@
     if( d->proxyModel->rowCount(activeModule) > 0 ) {
         d->stackedWidget->setCurrentWidget( d->classicCategory );
         d->classicCategory->changeModule(activeModule);
-        emit viewChanged();
+        emit viewChanged( false );
     } else {
         MenuItem *menuItem = d->proxyModel->data( activeModule, \
Qt::UserRole ).value<MenuItem*>();  d->moduleView->loadModule( menuItem );
--- trunk/KDE/kdebase/workspace/systemsettings/core/BaseMode.cpp \
#969906:969907 @@ -58,7 +58,7 @@
     d->service = modeService;
     d->config = BaseData::instance()->configGroup( modeService->name() );
     initEvent();
-    connect( moduleView(), SIGNAL( moduleSwitched() ), this, SIGNAL( \
viewChanged() ) ); +    connect( moduleView(), SIGNAL( moduleChanged( bool \
) ), this, SIGNAL( viewChanged( bool ) ) );  }
 
 void BaseMode::initEvent()
--- trunk/KDE/kdebase/workspace/systemsettings/core/BaseMode.h \
#969906:969907 @@ -38,7 +38,7 @@
  * their own interface to KDE control modules.\n
  *
  * The developer need only ensure that they perform all initialization of \
                their plugin in
- * initEvent() to ensure that the plugin is displayed, and initial actions \
are loaded.  + * initEvent() to ensure that the plugin is displayed, and \
                initial actions are loaded.
  *
  * @author Ben Cooksley <ben@eclipse.endoftheinternet.org>
  * @author Mathias Soeken <msoeken@informatik.uni-bremen.de>
@@ -169,10 +169,11 @@
      * Should be emitted when the type ( list of modules / display of \
                module )
      * of displayed view is changed.
      *
+     * @param state Determines whether changes have been made in the view.
      * @warning Failure to emit this will result in inconsistent \
                application headers and change state.
-     */ 
-    void viewChanged();
-    
+     */
+    void viewChanged( bool state );
+
     /**
      * Causes System Settings to hide / show the toolbar items specified.
      * This is used to control the display of the Configure and Search \
                actions
--- trunk/KDE/kdebase/workspace/systemsettings/core/ModuleView.cpp \
#969906:969907 @@ -86,7 +86,7 @@
     connect( d->mDefault, SIGNAL(clicked()), this, SLOT(moduleDefaults()) \
                );
     connect( d->mPageWidget, SIGNAL(currentPageChanged(KPageWidgetItem*, \
                KPageWidgetItem*)),
              this, SLOT(activeModuleChanged(KPageWidgetItem*, \
                KPageWidgetItem*)) );
-    connect( this, SIGNAL(moduleSwitched()), this, SLOT(updateButtons()) \
); +    connect( this, SIGNAL(moduleChanged(bool)), this, \
SLOT(updateButtons()) );  }
 
 ModuleView::~ModuleView()
@@ -136,7 +136,7 @@
     foreach ( KCModuleInfo *module, modules ) {
         addModule(module);
     }
-    emit moduleSwitched();
+    emit moduleChanged( false );
 }
 
 void ModuleView::addModule( KCModuleInfo *module )
@@ -172,7 +172,7 @@
     page->setIcon( KIcon( module->service()->icon() ) );
     page->setHeader( module->service()->comment() );
     // Allow it to signal properly
-    connect( moduleProxy, SIGNAL(changed(bool)), this, \
SLOT(moduleChanged(bool))); +    connect( moduleProxy, \
SIGNAL(changed(bool)), this, SIGNAL(moduleChanged(bool)));  // Set it to be \
shown and signal that  d->mPageWidget->addPage( page );
     d->mPages.insert( page, moduleProxy );
@@ -281,13 +281,6 @@
     QProcess::startDetached("khelpcenter", QStringList() << url.url());
 }
 
-void ModuleView::moduleChanged(bool change)
-{
-    d->mApply->setEnabled(change);
-    d->mReset->setEnabled(change);
-    emit configurationChanged(change);
-}
-
 void ModuleView::activeModuleChanged(KPageWidgetItem * current, \
KPageWidgetItem * previous)  {
     d->mPageWidget->blockSignals(true);
@@ -297,7 +290,15 @@
         d->mPageWidget->setCurrentPage(current);
     }
     d->mPageWidget->blockSignals(false);
-    emit moduleSwitched();
+    // We need to get the state of the now active module
+    KCModuleProxy * activeModule = d->mPages.value( \
d->mPageWidget->currentPage() ); +    bool change = false;
+    if( activeModule ) {
+        change = activeModule->changed();
+    }
+    d->mApply->setEnabled(change);
+    d->mReset->setEnabled(change);
+    emit moduleChanged( change );
 }
 
 void ModuleView::keyPressEvent ( QKeyEvent * event )
--- trunk/KDE/kdebase/workspace/systemsettings/core/ModuleView.h \
#969906:969907 @@ -39,7 +39,7 @@
  *
  * It also provides checking for when a module has changed its \
                configuration, and will prompt
  * if the user tries to change module or view if BaseMode is reimplemented \
                correctly
- * 
+ *
  * It also provides signals for active module changes, configuration \
                changes and for when it has
  * been requested to close by button press
  *
@@ -123,7 +123,7 @@
      */
     void moduleDefaults();
 
-    /** 
+    /**
      * Reimplemented for internal reasons.\n
      */
     void keyPressEvent( QKeyEvent * event );
@@ -135,19 +135,14 @@
 private Q_SLOTS:
     void activeModuleChanged( KPageWidgetItem* current, KPageWidgetItem* \
previous);  void updateButtons();
-    void moduleChanged( bool change );
 
 Q_SIGNALS:
     /**
-     * Emitted when the currently active module is switched. Currently \
used to update the window caption +     * Emitted when the currently active \
module is changed. This occurs whenever the active module or +     * its \
                configuration changes. This causes the window caption to \
                update.
      */
-    void moduleSwitched();
+    void moduleChanged( bool state );
 
-    /** 
-     * Emitted when the currently active module configuration changes. \
                Also updates the window caption
-     */
-    void configurationChanged( bool change );
-
     /**
      * Emitted when the ModuleView is asked to close.\n
      */
--- trunk/KDE/kdebase/workspace/systemsettings/icons/IconMode.cpp \
#969906:969907 @@ -119,7 +119,7 @@
 
     d->mainWidget = new QStackedWidget();
     d->moduleView = new ModuleView( d->mainWidget );
-    connect( d->moduleView, SIGNAL( moduleSwitched() ), this, SLOT( \
moduleLoaded() ) ); +    connect( d->moduleView, SIGNAL( \
                moduleChanged(bool) ), this, SLOT( moduleLoaded() ) );
     connect( d->moduleView, SIGNAL( closeRequest() ), this, SLOT( \
backToOverview() ) );  d->iconWidget = 0;
 }
@@ -152,7 +152,7 @@
         d->mainWidget->setCurrentWidget( d->iconWidget );
         d->backAction->setEnabled( false );
         emit changeToolBarItems( BaseMode::Search | BaseMode::Configure );
-        emit viewChanged();
+        emit viewChanged( false );
     }
 }
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic