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

List:       kde-commits
Subject:    KDE/kdebase/workspace/systemsettings
From:       Laurent Montel <montel () kde ! org>
Date:       2009-06-20 16:44:47
Message-ID: 1245516287.667810.28390.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 984372 by mlaurent:

Minor optimization
const'ify


 M  +12 -11    app/SettingsBase.cpp  
 M  +5 -5      classic/CategoryList.cpp  
 M  +1 -1      core/BaseData.cpp  
 M  +1 -1      core/BaseData.h  
 M  +1 -1      core/MenuItem.cpp  
 M  +4 -4      core/ModuleView.cpp  
 M  +2 -2      core/ToolTipManager.cpp  
 M  +1 -1      core/ToolTips/KToolTipDelegate.cpp  


--- trunk/KDE/kdebase/workspace/systemsettings/app/SettingsBase.cpp \
#984371:984372 @@ -83,8 +83,9 @@
     // Prepare the Base Data
     BaseData::instance()->setMenuItem( rootModule );
     // Load all possible views
-    KService::List pluginObjects = KServiceTypeTrader::self()->query( \
                "SystemSettingsView" );
-    for( int pluginsDone = 0; pluginsDone < pluginObjects.count(); \
pluginsDone = pluginsDone + 1 ) { +    const KService::List pluginObjects = \
KServiceTypeTrader::self()->query( "SystemSettingsView" ); +    const int \
nbPlugins = pluginObjects.count(); +    for( int pluginsDone = 0; \
pluginsDone < nbPlugins ; ++pluginsDone ) {  KService::Ptr activeService = \
pluginObjects.at( pluginsDone );  QString error;
         BaseMode * controller = \
activeService->createInstance<BaseMode>(this, QVariantList(), &error); @@ \
-165,8 +166,8 @@  {
     // look for any categories inside this level, and recurse into them
     for (int i = 0; i < categories.size(); ++i) {
-        KService::Ptr entry = categories.at(i);
-        QString parentCategory = \
entry->property("X-KDE-System-Settings-Parent-Category").toString(); +      \
const KService::Ptr entry = categories.at(i); +        const QString \
parentCategory = entry->property("X-KDE-System-Settings-Parent-Category").toString();
  if ( parentCategory == parent->name() ) {
             MenuItem * menuItem = new MenuItem(true, parent);
             menuItem->setService( entry );
@@ -176,8 +177,8 @@
 
     // scan for any modules at this level and add them
     for (int i = 0; i < modules.size(); ++i) {
-        KService::Ptr entry = modules.at(i);
-        QString category = \
entry->property("X-KDE-System-Settings-Parent-Category").toString(); +      \
const KService::Ptr entry = modules.at(i); +        const QString category \
= entry->property("X-KDE-System-Settings-Parent-Category").toString();  \
if(!parent->name().isEmpty() && category == parent->name() ) {  // Add the \
module info to the menu  MenuItem * infoItem = new MenuItem(false, parent);
@@ -191,7 +192,7 @@
 {
     KConfigGroup dialogConfig = KGlobal::config()->group("ConfigDialog");
     configDialog->saveDialogSize( dialogConfig );
-    int currentIndex = configWidget.CbPlugins->currentIndex();
+    const int currentIndex = configWidget.CbPlugins->currentIndex();
     mainConfigGroup.writeEntry( "ActiveView", \
possibleViews.keys().at(currentIndex) );  showTooltips = \
configWidget.ChTooltips->isChecked();  mainConfigGroup.writeEntry( \
"ShowTooltips", showTooltips ); @@ -208,15 +209,15 @@
         return; // It shouldn't be triggering anyway, since the action is \
disabled  }
 
-    QStringList pluginList = possibleViews.keys();
-    int configIndex = pluginList.indexOf(mainConfigGroup.readEntry( \
"ActiveView", "icon_mode" )); +    const QStringList pluginList = \
possibleViews.keys(); +    const int configIndex = \
pluginList.indexOf(mainConfigGroup.readEntry( "ActiveView", "icon_mode" )); \
if( configIndex == -1 ) {  configWidget.CbPlugins->setCurrentIndex( 0 );
     } else {
         configWidget.CbPlugins->setCurrentIndex( configIndex );
     }
     configWidget.ChTooltips->setChecked( showTooltips );
-    if( pluginList.count() == 0 ) {
+    if( pluginList.isEmpty() ) {
         KMessageBox::error(this, i18n("System Settings was unable to find \
any views, and hence nothing is available to configure."), i18n("No views \
found"));  } else {
         configDialog->show();
@@ -266,7 +267,7 @@
         activeView->leaveModuleView();
     }
 
-    QString viewToUse = mainConfigGroup.readEntry( "ActiveView", \
"icon_mode" ); +    const QString viewToUse = mainConfigGroup.readEntry( \
                "ActiveView", "icon_mode" );
     if( possibleViews.keys().contains(viewToUse) ) { // First the \
configuration entry  activeView = possibleViews.value(viewToUse);
     }
--- trunk/KDE/kdebase/workspace/systemsettings/classic/CategoryList.cpp \
#984371:984372 @@ -78,7 +78,7 @@
     KIconLoader * iconL = KIconLoader::global();
     d->itemMap.clear();
 
-    QString templatePath = KStandardDirs::locate( "data", \
"systemsettings/classic/main.html" ); +    const QString templatePath = \
KStandardDirs::locate( "data", "systemsettings/classic/main.html" );  QFile \
templateFile( templatePath );  templateFile.open( QIODevice::ReadOnly );
     QTextStream templateText( &templateFile );
@@ -97,14 +97,14 @@
     }
     content += "<div id=\"tableTitle\">" + moduleName + "</div>";
     content += "<table class=\"kc_table\">\n";
-    for( int done = 0;  d->itemModel->rowCount( d->categoryMenu ) > done; \
done = 1 + done ) { +    for( int done = 0;  d->itemModel->rowCount( \
                d->categoryMenu ) > done; ++done ) {
         QModelIndex childIndex = d->itemModel->index( done, 0, \
                d->categoryMenu );
         MenuItem *childItem = d->itemModel->data( childIndex, Qt::UserRole \
                ).value<MenuItem*>();
         content += "<tr><td class=\"kc_leftcol\"><img src=\"%1\" \
                width=\"24\" height=\"24\"></td><td \
                class=\"kc_middlecol\">";
-        QString szName = childItem->service()->name();
-        QString szComment = childItem->service()->comment();
+        const QString szName = childItem->service()->name();
+        const QString szComment = childItem->service()->comment();
         content += "<a href=\"%2\">" + szName + "</a></td><td \
                class=\"kc_rightcol\">" + szComment;
-        QString linkURL( "kcm://" + childItem->item().fileName() );
+        const QString linkURL( "kcm://" + childItem->item().fileName() );
         KUrl link( linkURL );
         content = content.arg( \
iconL->iconPath(childItem->service()->icon(), - \
KIconLoader::SizeSmallMedium ) );  content = content.arg( link.url() );
--- trunk/KDE/kdebase/workspace/systemsettings/core/BaseData.cpp \
#984371:984372 @@ -62,7 +62,7 @@
     rootMenu = item;
 }
 
-KConfigGroup BaseData::configGroup( QString pluginName )
+KConfigGroup BaseData::configGroup( const QString& pluginName )
 {
     return KGlobal::config()->group( pluginName );
 }
--- trunk/KDE/kdebase/workspace/systemsettings/core/BaseData.h \
#984371:984372 @@ -78,7 +78,7 @@
     * @param pluginName the name of the group that is required.
     * @returns The configuration group that is required.
     */
-    KConfigGroup configGroup( QString pluginName );
+    KConfigGroup configGroup( const QString& pluginName );
 
 private:
     MenuItem * rootMenu;
--- trunk/KDE/kdebase/workspace/systemsettings/core/MenuItem.cpp \
#984371:984372 @@ -122,7 +122,7 @@
     d->service = service;
     d->name = service->property("X-KDE-System-Settings-Category").toString();
  d->item = KCModuleInfo( service->entryPath() );
-    QVariant itemWeight = d->service->property( "X-KDE-Weight", \
QVariant::Int ); +    const QVariant itemWeight = d->service->property( \
"X-KDE-Weight", QVariant::Int );  if( itemWeight.isValid() ) {
         d->weight = itemWeight.toInt();
     } else {
--- trunk/KDE/kdebase/workspace/systemsettings/core/ModuleView.cpp \
#984371:984372 @@ -192,7 +192,7 @@
     }
 
     // Let the user decide
-    int queryUser = KMessageBox::warningYesNoCancel(
+    const int queryUser = KMessageBox::warningYesNoCancel(
         this,
         i18n("The settings of the current module have changed.\n"
              "Do you want to apply the changes or discard them?"),
@@ -225,11 +225,11 @@
     QMap<KPageWidgetItem*, KCModuleProxy*>::iterator pageIterator;
     QMap<KPageWidgetItem*, KCModuleProxy*>::iterator endIterator = \
                d->mPages.end();
     // These two MUST be kept separate in order to ensure modules aren't \
                loaded during the closing procedure
-    for ( pageIterator = d->mPages.begin(); pageIterator != endIterator; \
pageIterator = pageIterator + 1 ) { +    for ( pageIterator = \
d->mPages.begin(); pageIterator != endIterator; ++pageIterator ) {  delete \
pageIterator.value();  pageIterator.value() = 0;
     }
-    for ( pageIterator = d->mPages.begin(); pageIterator != endIterator; \
pageIterator = pageIterator + 1 ) { +    for ( pageIterator = \
d->mPages.begin(); pageIterator != endIterator; ++pageIterator ) {  \
d->mPageWidget->removePage( pageIterator.key() );  }
     d->mPages.clear();
@@ -327,7 +327,7 @@
         return;
     }
 
-    int buttons = activeModule->buttons();
+    const int buttons = activeModule->buttons();
 
     d->mApply->setShown(buttons & KCModule::Apply );
     d->mReset->setShown(buttons & KCModule::Apply );
--- trunk/KDE/kdebase/workspace/systemsettings/core/ToolTipManager.cpp \
#984371:984372 @@ -115,13 +115,13 @@
 {
     QAbstractItemModel * itemModel = d->view->model();
     MenuItem * m_Menu = itemModel->data( d->item, Qt::UserRole \
                ).value<MenuItem*>();
-    QString text = generateToolTipContent( d->item, m_Menu );
+    const QString text = generateToolTipContent( d->item, m_Menu );
     SystemSettingsToolTipItem* toolTip = new \
SystemSettingsToolTipItem(KIcon( m_Menu->service()->icon() ), text);  
     for ( int done = 0; itemModel->rowCount( d->item ) > done; done = 1 + \
done ) {  QModelIndex childIndex = itemModel->index( done, 0, d->item );
         MenuItem * child = itemModel->data( childIndex, Qt::UserRole \
                ).value<MenuItem*>();
-        QString text = QString( "%1<br />" ).arg( child->service()->name() \
); +        const QString text = QString( "%1<br />" ).arg( \
child->service()->name() );  toolTip->addLine( KIcon( \
child->service()->icon() ), text );  }
 
--- trunk/KDE/kdebase/workspace/systemsettings/core/ToolTips/KToolTipDelegate.cpp \
#984371:984372 @@ -51,7 +51,7 @@
 void KToolTipDelegate::paint(QPainter *painter, const KStyleOptionToolTip \
*option,  const KToolTipItem *item) const
 {
-    bool haveAlpha = haveAlphaChannel();
+    const bool haveAlpha = haveAlphaChannel();
     painter->setRenderHint(QPainter::Antialiasing);
 
     QPainterPath path;


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

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