[Uml-devel] branches/work/kconfiggroup_port/kdesdk

Stephan Kulow coolo at kde.org
Wed Feb 14 11:41:34 UTC 2007


SVN commit 633566 by coolo:

ported


 M  +6 -9      cervisia/cervisiapart.cpp  
 M  +8 -8      umbrello/umbrello/codegenerators/javacodegenerationpolicy.cpp  
 M  +55 -52    umbrello/umbrello/uml.cpp  
 M  +2 -2      umbrello/umbrello/uml.h  


--- branches/work/kconfiggroup_port/kdesdk/cervisia/cervisiapart.cpp #633565:633566
@@ -1707,8 +1707,7 @@
     SettingsDialog *l = new SettingsDialog( conf, widget() );
     l->exec();
 
-    conf->setGroup("LookAndFeel");
-    bool splitHorz = conf->readEntry("SplitHorizontally",true);
+    bool splitHorz = conf->group( "LookAndFeel" ).readEntry("SplitHorizontally",true);
     splitter->setOrientation( splitHorz ?
                               Qt::Vertical :
                               Qt::Horizontal);
@@ -1830,11 +1829,10 @@
     setFilter();
 
     KConfig *conf = config();
-    conf->setGroup("General");
-    bool dostatus = conf->readEntry(repository.contains(":")?
-                                        "StatusForRemoteRepos" :
-                                        "StatusForLocalRepos",
-                                        false);
+    bool dostatus = conf->group( "General" ).readEntry(repository.contains(":")?
+                                                       "StatusForRemoteRepos" :
+                                                       "StatusForLocalRepos",
+                                                       false);
     if (dostatus)
     {
         update->setSelected(update->firstChild(), true);
@@ -1842,8 +1840,7 @@
     }
 
     //load the recentCommits for this app from the KConfig app
-    conf->setGroup( "CommitLogs" );
-    recentCommits = conf->readEntry( sandbox,QStringList(), COMMIT_SPLIT_CHAR );
+    recentCommits = conf->group( "CommitLogs" ).readEntry( sandbox,QStringList(), COMMIT_SPLIT_CHAR );
 
     return true;
 }
--- branches/work/kconfiggroup_port/kdesdk/umbrello/umbrello/codegenerators/javacodegenerationpolicy.cpp #633565:633566
@@ -97,15 +97,15 @@
 {
 
     // write ONLY the Java specific stuff
-    config->setGroup("Java Code Generation");
+    KConfigGroup cg( config, "Java Code Generation" );
 
-    config->writeEntry("autoGenAccessors",getAutoGenerateAttribAccessors());
-    config->writeEntry("autoGenAssocAccessors",getAutoGenerateAssocAccessors());
+    cg.writeEntry("autoGenAccessors",getAutoGenerateAttribAccessors());
+    cg.writeEntry("autoGenAssocAccessors",getAutoGenerateAssocAccessors());
 
     CodeGenerator *codegen = UMLApp::app()->getGenerator();
     JavaCodeGenerator *javacodegen = dynamic_cast<JavaCodeGenerator*>(codegen);
     if (javacodegen)
-        config->writeEntry("buildANTDocument", javacodegen->getCreateANTBuildFile());
+        cg.writeEntry("buildANTDocument", javacodegen->getCreateANTBuildFile());
 
 }
 
@@ -151,15 +151,15 @@
     // needlessly (we can just make one call at the end).
 
     // now do java specific stuff
-    config -> setGroup("Java Code Generation");
+    KConfigGroup cg( config, "Java Code Generation");
 
-    setAutoGenerateAttribAccessors(config->readEntry("autoGenAccessors",DEFAULT_AUTO_GEN_ATTRIB_ACCESSORS));
-    setAutoGenerateAssocAccessors(config->readEntry("autoGenAssocAccessors",DEFAULT_AUTO_GEN_ASSOC_ACCESSORS));
+    setAutoGenerateAttribAccessors(cg.readEntry("autoGenAccessors",DEFAULT_AUTO_GEN_ATTRIB_ACCESSORS));
+    setAutoGenerateAssocAccessors(cg.readEntry("autoGenAssocAccessors",DEFAULT_AUTO_GEN_ASSOC_ACCESSORS));
 
     CodeGenerator *codegen = UMLApp::app()->getGenerator();
     JavaCodeGenerator *javacodegen = dynamic_cast<JavaCodeGenerator*>(codegen);
     if (javacodegen) {
-        bool mkant = config->readEntry("buildANTDocument", JavaCodeGenerator::DEFAULT_BUILD_ANT_DOC);
+        bool mkant = cg.readEntry("buildANTDocument", JavaCodeGenerator::DEFAULT_BUILD_ANT_DOC);
         javacodegen->setCreateANTBuildFile(mkant);
     }
 
--- branches/work/kconfiggroup_port/kdesdk/umbrello/umbrello/uml.cpp #633565:633566
@@ -588,70 +588,73 @@
 
 
 void UMLApp::saveOptions() {
-    toolBar("mainToolBar")->saveSettings(m_config.data(), "toolbar");
-    toolsbar->saveSettings(m_config.data(), "workbar");
-    m_alignToolBar->saveSettings(m_config.data(), "aligntoolbar");
-    fileOpenRecent->saveEntries(m_config.data(),"Recent Files");
-    m_config->setGroup( "General Options" );
-    m_config->writeEntry( "Geometry", size() );
+    KConfigGroup cg( m_config, "toolbar" );
+    toolBar("mainToolBar")->saveSettings( cg );
+    cg.changeGroup( "workbar" );
+    toolsbar->saveSettings(cg );
+    cg.changeGroup( "aligntoolbar" );
+    m_alignToolBar->saveSettings( cg );
+    fileOpenRecent->saveEntries( m_config->group( "Recent Files") );
+    cg.changeGroup( "General Options" );
+    cg.writeEntry( "Geometry", size() );
 
     Settings::OptionState& optionState = Settings::getOptionState();
-    m_config->writeEntry( "undo", optionState.generalState.undo );
-    m_config->writeEntry( "tabdiagrams", optionState.generalState.tabdiagrams );
-    m_config->writeEntry( "newcodegen", optionState.generalState.newcodegen );
-    m_config->writeEntry( "angularlines", optionState.generalState.angularlines );
-    m_config->writeEntry( "autosave", optionState.generalState.autosave );
-    m_config->writeEntry( "time", optionState.generalState.time );
-    m_config->writeEntry( "autosavetime", optionState.generalState.autosavetime );
-    m_config->writeEntry( "autosavesuffix", optionState.generalState.autosavesuffix );
+    cg.writeEntry( "undo", optionState.generalState.undo );
+    cg.writeEntry( "tabdiagrams", optionState.generalState.tabdiagrams );
+    cg.writeEntry( "newcodegen", optionState.generalState.newcodegen );
+    cg.writeEntry( "angularlines", optionState.generalState.angularlines );
+    cg.writeEntry( "autosave", optionState.generalState.autosave );
+    cg.writeEntry( "time", optionState.generalState.time );
+    cg.writeEntry( "autosavetime", optionState.generalState.autosavetime );
+    cg.writeEntry( "autosavesuffix", optionState.generalState.autosavesuffix );
 
-    m_config->writeEntry( "logo", optionState.generalState.logo );
-    m_config->writeEntry( "loadlast", optionState.generalState.loadlast );
+    cg.writeEntry( "logo", optionState.generalState.logo );
+    cg.writeEntry( "loadlast", optionState.generalState.loadlast );
 
-    m_config->writeEntry( "diagram", (int)optionState.generalState.diagram );
+    cg.writeEntry( "diagram", (int)optionState.generalState.diagram );
     if( m_doc->url().fileName() == i18n( "Untitled" ) ) {
         m_config -> writeEntry( "lastFile", "" );
     } else {
         m_config -> writePathEntry( "lastFile", m_doc -> url().prettyUrl() );
     }
-    m_config->writeEntry( "imageMimeType", getImageMimeType() );
+    cg.writeEntry( "imageMimeType", getImageMimeType() );
 
-    m_config->setGroup( "TipOfDay");
+    cg.changeGroup( "TipOfDay");
     optionState.generalState.tip = m_config -> readEntry( "RunOnStart", true );
-    m_config->writeEntry( "RunOnStart", optionState.generalState.tip );
+    cg.writeEntry( "RunOnStart", optionState.generalState.tip );
 
-    m_config->setGroup( "UI Options" );
-    m_config->writeEntry( "useFillColor", optionState.uiState.useFillColor );
-    m_config->writeEntry( "fillColor", optionState.uiState.fillColor );
-    m_config->writeEntry( "lineColor", optionState.uiState.lineColor );
-    m_config->writeEntry( "lineWidth", optionState.uiState.lineWidth );
-    m_config->writeEntry( "showDocWindow", m_documentationDock->isVisible() );
-    m_config->writeEntry( "font", optionState.uiState.font );
+    cg.changeGroup( "UI Options" );
+    cg.writeEntry( "useFillColor", optionState.uiState.useFillColor );
+    cg.writeEntry( "fillColor", optionState.uiState.fillColor );
+    cg.writeEntry( "lineColor", optionState.uiState.lineColor );
+    cg.writeEntry( "lineWidth", optionState.uiState.lineWidth );
+    cg.writeEntry( "showDocWindow", m_documentationDock->isVisible() );
+    cg.writeEntry( "font", optionState.uiState.font );
 
-    m_config->setGroup( "Class Options" );
-    m_config->writeEntry( "showVisibility", optionState.classState.showVisibility );
-    m_config->writeEntry( "showAtts", optionState.classState.showAtts);
-    m_config->writeEntry( "showOps", optionState.classState.showOps );
-    m_config->writeEntry( "showStereoType", optionState.classState.showStereoType );
-    m_config->writeEntry( "showAttSig", optionState.classState.showAttSig );
-    m_config->writeEntry( "ShowOpSig", optionState.classState.showOpSig );
-    m_config->writeEntry( "showPackage", optionState.classState.showPackage );
-    m_config->writeEntry( "defaultAttributeScope", (int)optionState.classState.defaultAttributeScope);
-    m_config->writeEntry( "defaultOperationScope", (int)optionState.classState.defaultOperationScope);
+    cg.changeGroup( "Class Options" );
+    cg.writeEntry( "showVisibility", optionState.classState.showVisibility );
+    cg.writeEntry( "showAtts", optionState.classState.showAtts);
+    cg.writeEntry( "showOps", optionState.classState.showOps );
+    cg.writeEntry( "showStereoType", optionState.classState.showStereoType );
+    cg.writeEntry( "showAttSig", optionState.classState.showAttSig );
+    cg.writeEntry( "ShowOpSig", optionState.classState.showOpSig );
+    cg.writeEntry( "showPackage", optionState.classState.showPackage );
+    cg.writeEntry( "defaultAttributeScope", (int)optionState.classState.defaultAttributeScope);
+    cg.writeEntry( "defaultOperationScope", (int)optionState.classState.defaultOperationScope);
 
-    m_config -> setGroup( "Code Viewer Options" );
-    m_config->writeEntry( "height", optionState.codeViewerState.height );
-    m_config->writeEntry( "width", optionState.codeViewerState.width);
-    m_config->writeEntry( "font", optionState.codeViewerState.font);
-    m_config->writeEntry( "fontColor", optionState.codeViewerState.fontColor);
-    m_config->writeEntry( "paperColor", optionState.codeViewerState.paperColor);
-    m_config->writeEntry( "selectedColor", optionState.codeViewerState.selectedColor);
-    m_config->writeEntry( "editBlockColor", optionState.codeViewerState.editBlockColor);
-    m_config->writeEntry( "nonEditBlockColor", optionState.codeViewerState.nonEditBlockColor);
-    m_config->writeEntry( "umlObjectBlockColor", optionState.codeViewerState.umlObjectColor);
-    m_config->writeEntry( "blocksAreHighlighted", optionState.codeViewerState.blocksAreHighlighted);
-    m_config->writeEntry( "showHiddenBlocks", optionState.codeViewerState.showHiddenBlocks);
-    m_config->writeEntry( "hiddenColor", optionState.codeViewerState.hiddenColor);
+    cg.changeGroup( "Code Viewer Options" );
+    cg.writeEntry( "height", optionState.codeViewerState.height );
+    cg.writeEntry( "width", optionState.codeViewerState.width);
+    cg.writeEntry( "font", optionState.codeViewerState.font);
+    cg.writeEntry( "fontColor", optionState.codeViewerState.fontColor);
+    cg.writeEntry( "paperColor", optionState.codeViewerState.paperColor);
+    cg.writeEntry( "selectedColor", optionState.codeViewerState.selectedColor);
+    cg.writeEntry( "editBlockColor", optionState.codeViewerState.editBlockColor);
+    cg.writeEntry( "nonEditBlockColor", optionState.codeViewerState.nonEditBlockColor);
+    cg.writeEntry( "umlObjectBlockColor", optionState.codeViewerState.umlObjectColor);
+    cg.writeEntry( "blocksAreHighlighted", optionState.codeViewerState.blocksAreHighlighted);
+    cg.writeEntry( "showHiddenBlocks", optionState.codeViewerState.showHiddenBlocks);
+    cg.writeEntry( "hiddenColor", optionState.codeViewerState.hiddenColor);
 
     // write the config for a language-specific code gen policy
     if (m_policyext)
@@ -662,8 +665,8 @@
 
     // next, we record the activeLanguage in the Code Generation Group
     if (m_codegen) {
-        m_config->setGroup("Code Generation");
-        m_config->writeEntry("activeLanguage", Model_Utils::progLangToString(m_codegen->getLanguage()));
+        cg.changeGroup("Code Generation");
+        cg.writeEntry("activeLanguage", Model_Utils::progLangToString(m_codegen->getLanguage()));
     }
 }
 
--- branches/work/kconfiggroup_port/kdesdk/umbrello/umbrello/uml.h #633565:633566
@@ -404,7 +404,7 @@
      * temporary filename provided by KApplication.
      * @see KMainWindow#saveProperties
      */
-    virtual void saveProperties(KConfig *_cfg);
+    virtual void saveProperties(KConfigGroup &_cfg);
 
     /**
      * Reads the session config file and restores the
@@ -413,7 +413,7 @@
      * saveProperties()
      * @see KMainWindow#readProperties
      */
-    virtual void readProperties(KConfig *_cfg);
+    virtual void readProperties(const KConfigGroup &_cfg);
 
     CodeGenerationPolicy * m_commoncodegenpolicy;
 




More information about the umbrello-devel mailing list