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

List:       kde-commits
Subject:    kdevelop/vcs/cvs
From:       Mario Scalas <mario.scalas () libero ! it>
Date:       2003-10-29 20:40:38
[Download RAW message or body]

CVS commit by marios: 

* Fixed recognizing if a project dir is a CVS sandbox: if not, do not bother the user \
asking to add/remove files to cvs repository. 


  M +29 -0     cvspart.cpp   1.67
  M +5 -0      cvspart.h   1.29


--- kdevelop/vcs/cvs/cvspart.cpp  #1.66:1.67
@@ -1034,4 +1034,11 @@ void CvsPart::slotProjectOpened()
     kdDebug(9000) << "CvsPart::slotProjectOpened() here!" << endl;
 
+    // Avoid bothering the user if this project has no support for CVS
+    if (!isValidDirectory( project()->projectDirectory() ))
+    {
+        kdDebug(9006) << "Project has no CVS Support: too bad!! :-(" << endl;
+        return;
+    }
+
     CvsOptions *options = CvsOptions::instance();
     options->load( *projectDom() );
@@ -1057,7 +1064,29 @@ void CvsPart::slotProjectClosed()
     kdDebug(9000) << "CvsPart::slotProjectClosed() here!" << endl;
 
+    // Avoid bothering the user if this project has no support for CVS
+    if (!isValidDirectory( project()->projectDirectory() ))
+    {
+        kdDebug(9006) << "Project has no CVS Support: too bad!! :-(" << endl;
+        return;
+    }
+
     CvsOptions *options = CvsOptions::instance();
     options->save( *projectDom() );
     delete options;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+bool CvsPart::isValidDirectory( const QString &dirPath ) const
+{
+    QDir cvsdir( dirPath );
+    QString entriesFileName = dirPath + QDir::separator() + "Entries";
+    QString rootFileName = dirPath + QDir::separator()  + "Entries";
+    QString repoFileName = dirPath + QDir::separator()  + "Repository";
+
+    return cvsdir.exists() &&
+        QFile::exists( entriesFileName ) &&
+        QFile::exists( rootFileName ) &&
+        QFile::exists( repoFileName );
 }
 

--- kdevelop/vcs/cvs/cvspart.h  #1.28:1.29
@@ -54,4 +54,9 @@ public:
     virtual void createNewProject( const QString& dir );
 
+    /**
+    * Check if the directory is valid for the project
+    */
+    virtual bool isValidDirectory( const QString &dirPath ) const;
+
 private slots:
     //! Add menu items binded to cvs operations' slots to @p popup, using


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

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