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

List:       kde-commits
Subject:    kdevelop/parts/appwizard
From:       Sascha Cunz <scunz () ng-projekt ! de>
Date:       2004-06-03 4:15:47
Message-ID: 20040603041547.EAAFDE60 () office ! kde ! org
[Download RAW message or body]

CVS commit by cunz: 

Clean the temporary crap from the substitution map and store it into the project DOM

Jens, if you want to modify the DOM before the new project is loaded, then \
AppWizardDialog::openAfterGeneration() is where it has to go.

CCMAIL: jens.dagerbo@swipnet.se


  M +5 -4      Makefile.am   1.50
  M +33 -4     appwizarddlg.cpp   1.89
  M +1 -1      appwizarddlg.h   1.26


--- kdevelop/parts/appwizard/Makefile.am  #1.49:1.50
@@ -2,6 +2,7 @@
 # Here resides the app wizard part.
 
-SUBDIRS = . imports common licenses
-INCLUDES = -I$(top_srcdir)/lib/interfaces -I$(top_srcdir)/lib/widgets \
-I$(top_srcdir)/lib/sourceinfo $(all_includes) +SUBDIRS = . imports common licenses 
+INCLUDES = -I$(top_srcdir)/lib/interfaces -I$(top_srcdir)/lib/util \
+        -I$(top_srcdir)/lib/widgets -I$(top_srcdir)/lib/sourceinfo $(all_includes) 
 
 kde_module_LTLIBRARIES = libkdevappwizard.la
@@ -13,8 +14,8 @@
 METASOURCES = AUTO
 
-servicedir = $(kde_servicesdir)
+servicedir = $(kde_servicesdir) 
 service_DATA = kdevappwizard.desktop
 
-rcdir = $(kde_datadir)/kdevappwizard
+rcdir = $(kde_datadir)/kdevappwizard 
 rc_DATA = kdevappwizard.rc
 noinst_HEADERS =  autoform.h dataform.h

--- kdevelop/parts/appwizard/appwizarddlg.cpp  #1.88:1.89
@@ -63,4 +63,5 @@
 #include <qlayout.h>
 
+#include "domutil.h"
 #include "kdevversioncontrol.h"
 #include "kdevmakefrontend.h"
@@ -438,4 +439,7 @@ void AppWizardDialog::accept()
         m_pCurrentAppInfo->subMap.insert( "I18N", "i18n" );
 
+        QStringList cleanUpSubstMap;
+        cleanUpSubstMap << "src" << "dest" << "I18N" << "kdevelop";
+        
         // Add template files to the fileList
         installDir templateDir;
@@ -458,5 +462,7 @@ void AppWizardDialog::accept()
                 temps << templateText;
                 f.flush();
-                m_pCurrentAppInfo->subMap.insert( QString( "%1_TEMPLATE" ).arg( \
(*it).suffix ).upper(), KMacroExpander::expandMacros(templateText , \
m_pCurrentAppInfo->subMap)  ); +                QString templateName( QString( \
"%1_TEMPLATE" ).arg( (*it).suffix ).upper() ); +                cleanUpSubstMap << \
templateName; +                m_pCurrentAppInfo->subMap.insert( templateName, \
KMacroExpander::expandMacros(templateText , m_pCurrentAppInfo->subMap)  );  
                 installFile file;
@@ -586,5 +592,11 @@ void AppWizardDialog::accept()
         KMessageBox::information(this, \
KMacroExpander::expandMacros(m_pCurrentAppInfo->message, m_pCurrentAppInfo->subMap)); \
                
-        openAfterGeneration();
+        QStringList::Iterator cleanIt = cleanUpSubstMap.begin();
+        for(;cleanIt != cleanUpSubstMap.end(); ++cleanIt )
+        {
+                m_pCurrentAppInfo->subMap.remove( *cleanIt );
+        }
+
+        openAfterGeneration( m_pCurrentAppInfo->subMap );
         
         QWizard::accept();
@@ -821,5 +833,5 @@ ApplicationInfo *AppWizardDialog::templa
 }
 
-void AppWizardDialog::openAfterGeneration()
+void AppWizardDialog::openAfterGeneration( QMap<QString,QString>& substMap )
 {
         QString prjName( appname_edit->text() );
@@ -827,5 +839,22 @@ void AppWizardDialog::openAfterGeneratio
         QString prjNameUC( prjName.upper() );
         
-        m_part->core()->openProject( finalLoc_label->text() + "/" + prjNameLC + \
".kdevelop" ); +        QString projectFile( finalLoc_label->text() + "/" + prjNameLC \
+ ".kdevelop" ); +        
+        QFile file( projectFile );
+        if( !file.open( IO_ReadOnly ) )
+                return;
+        QDomDocument projectDOM;
+        projectDOM.setContent( &file );
+        file.close();
+        
+        DomUtil::writeMapEntry( projectDOM, "substmap", substMap );
+        
+        if( !file.open( IO_WriteOnly ) )
+                return;
+        QTextStream ts( &file );
+        ts << projectDOM.toString(2);
+        file.close();
+        
+        m_part->core()->openProject( projectFile );
         
         QStringList::Iterator it = \
m_pCurrentAppInfo->openFilesAfterGeneration.begin();

--- kdevelop/parts/appwizard/appwizarddlg.h  #1.25:1.26
@@ -148,5 +148,5 @@ private: //methods
         bool copyFile( const QString &source, const QString &dest, const \
QMap<QString,QString> &subMap, bool process );  QString kdevRoot(const QString \
                &templateName ) const;
-        void openAfterGeneration();
+        void openAfterGeneration( QMap<QString,QString>& substMap );
         
 private: //data


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

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