[Kbabel] kdesdk/kbabel/catalogmanager

Marco Wegner dubbleu@web.de
Mon, 3 Feb 2003 23:02:22 +0100 (CET)


CVS commit by mwegner: 

CCMAIL: kbabel@kde.org

- Fix: Make 'Update Marked Templates' and 'Commit Marked Templates' work.


  M +2 -2      catalogmanagerview.cpp   1.76
  M +11 -10    libcvs/cvshandler.cpp   1.7
  M +2 -3      libcvs/cvshandler.h   1.4


--- kdesdk/kbabel/catalogmanager/catalogmanagerview.cpp  #1.75:1.76
@@ -935,5 +935,5 @@ void CatalogManagerView::doCVSCommand( C
         fileList << i->poFile( );
     }
-    cvshandler->execCVSCommand( cmd, fileList );
+    cvshandler->execCVSCommand(cmd, fileList, templates);
   } else {
     QString basedir = ( templates ? _settings.potBaseDir : _settings.poBaseDir );
@@ -949,5 +949,5 @@ void CatalogManagerView::doCVSCommand( C
     }
     if ( !cvsItem.isEmpty( ) )
-      cvshandler->execCVSCommand( cmd, cvsItem );
+      cvshandler->execCVSCommand(cmd, cvsItem, templates);
   }
 }

--- kdesdk/kbabel/catalogmanager/libcvs/cvshandler.cpp  #1.6:1.7
@@ -173,10 +173,5 @@ QString CVSHandler::cvsStatus( const QSt
 }
 
-void CVSHandler::execCVSCommand( CVS::Command cmd )
-{
-  execCVSCommand( cmd, _poBaseDir );
-}
-
-void CVSHandler::execCVSCommand( CVS::Command cmd, const QString& filename )
+void CVSHandler::execCVSCommand(CVS::Command cmd, const QString& filename, bool templates)
 {
   if ( !_isPORepository ) {
@@ -189,5 +184,5 @@ void CVSHandler::execCVSCommand( CVS::Co
   QFileInfo info( filename );
   if ( !info.isDir( ) ) {
-    execCVSCommand( cmd, QStringList( filename ) );
+    execCVSCommand(cmd, QStringList( filename ), templates);
     return;
   }
@@ -211,5 +206,5 @@ void CVSHandler::execCVSCommand( CVS::Co
 }
 
-void CVSHandler::execCVSCommand( CVS::Command cmd, const QStringList& files )
+void CVSHandler::execCVSCommand(CVS::Command cmd, const QStringList& files, bool templates)
 {
   if ( !_isPORepository ) {
@@ -221,5 +216,5 @@ void CVSHandler::execCVSCommand( CVS::Co
 
   QStringList::ConstIterator it;
-  QString command( "cd " + _poBaseDir + " && cvs " );
+  QString command("cd " + (templates ? _potBaseDir : _poBaseDir) + " && cvs ");
   switch ( cmd ) {
     case CVS::Update:
@@ -235,7 +230,13 @@ void CVSHandler::execCVSCommand( CVS::Co
   }
 
+  QRegExp rx;
+  if (templates)
+    rx.setPattern(_potBaseDir + "/?");
+  else
+    rx.setPattern(_poBaseDir + "/?");
+
   for ( it = files.begin( ); it != files.end( ); ++it ) {
     QString temp = *it;
-    temp.remove( QRegExp( _poBaseDir + "/?" ) );
+    temp.remove(rx);
     command += " \'" + temp + "\'";
   }

--- kdesdk/kbabel/catalogmanager/libcvs/cvshandler.h  #1.3:1.4
@@ -64,7 +64,6 @@ class CVSHandler : public QObject
     QString cvsStatus( const QString& filename ) const;
 
-    void execCVSCommand( CVS::Command cmd );
-    void execCVSCommand( CVS::Command cmd, const QString& filename );
-    void execCVSCommand( CVS::Command cmd, const QStringList& files );
+    void execCVSCommand(CVS::Command cmd, const QString& filename, bool templates = false);
+    void execCVSCommand(CVS::Command cmd, const QStringList& files, bool templates = false);
     
     void setAutoUpdateTemplates( bool update );