[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/kdevelop/3.4/buildtools/custommakefiles
From: Andreas Pakulat <apaku () gmx ! de>
Date: 2007-03-02 14:49:02
Message-ID: 1172846942.066507.15758.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 638573 by apaku:
Use a dirwatcher to get notified when files are removed from the project directory. \
This prevents clutter of the .filelist file
M +27 -2 customprojectpart.cpp
M +3 -0 customprojectpart.h
--- branches/kdevelop/3.4/buildtools/custommakefiles/customprojectpart.cpp \
#638572:638573 @@ -27,6 +27,7 @@
#include <kaction.h>
#include <kdebug.h>
+#include <kdirwatch.h>
#include <kdialogbase.h>
#include <kdevgenericfactory.h>
#include <kiconloader.h>
@@ -62,7 +63,7 @@
CustomProjectPart::CustomProjectPart( QObject *parent, const char *name, const \
QStringList & )
: KDevBuildTool( &data, parent, name ? name : "CustomProjectPart" )
- , m_lastCompilationFailed( false )
+ , m_lastCompilationFailed( false ), dirwatch(new KDirWatch(this))
{
setInstance( CustomProjectFactory::instance() );
setXMLFile( "kdevcustomproject.rc" );
@@ -170,7 +171,9 @@
this, SLOT( slotCommandFinished( const QString& ) ) );
connect( makeFrontend(), SIGNAL( commandFailed( const QString& ) ),
this, SLOT( slotCommandFailed( const QString& ) ) );
-}
+ connect( dirwatch, SIGNAL( dirty( const QString&) ),
+ this, SLOT( slotDirDirty( const QString& ) ) );
+ }
CustomProjectPart::~CustomProjectPart()
@@ -391,10 +394,13 @@
path += *it;
if( m_sourceFiles.find( path ) == m_sourceFiles.end() )
{
+ dirwatch->addDir( projectDirectory() + "/"+ path );
m_sourceFiles << path;
}
path += "/";
}
+ if( QFileInfo( projectDirectory() + "/" +s ).isDir() )
+ dirwatch->addDir( projectDirectory() + "/"+ s );
m_sourceFiles << s;
}
}
@@ -654,6 +660,7 @@
for ( QStringList::iterator subit = subentries.begin(); subit != \
subentries.end(); ++subit ) if ( *subit != "." && *subit != ".." )
*subit = QDir::cleanDirPath(( relpath ) + "/" + ( *subit ) );
+ dirwatch->addDir( projectDirectory()+"/"+relpath );
addFiles( subentries );
addedFiles << QDir::cleanDirPath( relpath );
m_sourceFiles.append( QDir::cleanDirPath( relpath ) );
@@ -669,6 +676,7 @@
path += *it;
if( m_sourceFiles.find( path ) == m_sourceFiles.end() )
{
+ dirwatch->addDir( projectDirectory() + "/" + path );
addedFiles << path;
m_sourceFiles << path;
}
@@ -1391,6 +1399,23 @@
return result;
}
+void CustomProjectPart::slotDirDirty( const QString& dir )
+{
+ QStringList remove;
+ QString reldir = URLUtil::relativePathToFile( projectDirectory(), dir);
+ for( QStringList::const_iterator it = m_sourceFiles.begin(); it !=
+ m_sourceFiles.end(); ++it)
+ {
+ if( (*it).startsWith(reldir) )
+ {
+ QString lastpart = (*it).mid(reldir.length()+1);
+ if( !QFileInfo(dir+"/"+lastpart).exists() )
+ remove << (*it);
+ }
+ }
+ removeFiles(remove);
+}
+
#include "customprojectpart.moc"
// kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on
--- branches/kdevelop/3.4/buildtools/custommakefiles/customprojectpart.h \
#638572:638573 @@ -26,6 +26,7 @@
class QPopupMenu;
class QStringList;
class KDialogBase;
+class KDirWatch;
class CustomProjectWidget;
class Context;
class KSelectAction;
@@ -66,6 +67,7 @@
private slots:
void populateProject();
+ void slotDirDirty( const QString& dir );
void projectConfigWidget( KDialogBase *dlg );
void contextMenu( QPopupMenu *popup, const Context *context );
void slotAddToProject();
@@ -127,6 +129,7 @@
QMap<QString, QString> m_makefileVars;
bool m_recursive;
bool m_first_recursive;
+ KDirWatch* dirwatch;
};
#endif
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic