[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-11 22:49:42
Message-ID: 1173653382.485055.9304.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 641602 by apaku:

Allow to change the filetypes when populating the project filelist, this introduces a \
bug though, if you take long enough with the dialog for some reason the exec() \
returns Fix isProjectFileType()


 M  +35 -15    customprojectpart.cpp  
 M  +1 -0      customprojectpart.h  


--- branches/kdevelop/3.4/buildtools/custommakefiles/customprojectpart.cpp \
#641601:641602 @@ -29,6 +29,7 @@
 #include <kdebug.h>
 #include <kdirwatch.h>
 #include <kdialogbase.h>
+#include <keditlistbox.h>
 #include <kdevgenericfactory.h>
 #include <kiconloader.h>
 #include <klocale.h>
@@ -437,6 +438,16 @@
                 m_sourceFiles << s;
             }
         }
+        QStringList newfiles;
+        findNewFiles(dirName, newfiles);
+
+        if( newfiles.count() > 0 )
+        {
+            m_autoAddFiles = newfiles;
+            addNewFilesToProject();
+        }
+
+        addDirWatches( dirName );
     }
     else
     {
@@ -445,18 +456,10 @@
                                                   "Populate it with all C/C++/Java \
                files below "
                                                   "the project directory?" ), \
QString::null, i18n( "Populate" ), i18n( "Do Not Populate" ) );  if ( r == \
                KMessageBox::Yes )
-            populateProject();
+            QTimer::singleShot(1000, this, SLOT(populateProject()));
     }
 
-    QStringList newfiles;
-    findNewFiles(dirName, newfiles);
 
-    if( newfiles.count() > 0 )
-    {
-        m_autoAddFiles = newfiles;
-        addNewFilesToProject();
-    }
-
     // check if there is an old envvars entry (from old project file with single \
                make environment)
     QString buildtool = DomUtil::readEntry(dom , \
"/kdevcustomproject/build/buildtool" );  QDomElement el =
@@ -468,7 +471,6 @@
         el.setTagName( "default" );
         envs.appendChild( el );
     }
-    addDirWatches( dirName );
     KDevProject::openProject( dirName, projectName );
     dirwatch->startScan();
     dirwatch->blockSignals( false );
@@ -516,8 +518,19 @@
 
 void CustomProjectPart::populateProject()
 {
+
+    KDialogBase* dlg = new KDialogBase(0, "typeselector", true,
+            "Select filetypes of project", KDialogBase::Ok|KDialogBase::Cancel);
+    QVBox* box = dlg->makeVBoxMainWidget();
+    KEditListBox* lb = new KEditListBox("Filetypes in the project", box, \
"selecttypes", +                                        false, \
KEditListBox::Add|KEditListBox::Remove); +    lb->setItems( filetypes() );
+    if( dlg->exec() == QDialog::Accepted )
+    {
+        setFiletypes( lb->items() );
+    }
+
     QApplication::setOverrideCursor( Qt::waitCursor );
-
     removeFiles( m_sourceFiles );
     updateBlacklist( QStringList() );
 
@@ -526,9 +539,9 @@
     findNewFiles( projectDirectory(), newlist );
 
     m_autoAddFiles = newlist;
+    QApplication::restoreOverrideCursor();
     addNewFilesToProject();
-
-    QApplication::restoreOverrideCursor();
+    addDirWatches( m_projectDirectory );
 }
 
 
@@ -1433,8 +1446,10 @@
     QRegExp re("", true, true);
     for( QStringList::const_iterator it = types.begin(); it != types.end(); ++it )
     {
-        re.setPattern( *it+"$" );
-        if ( ( (*it).find("*") != -1 || (*it).find("?") != -1 ) && re.search( \
filename ) != -1 ) +        re.setPattern( *it );
+        int pos = re.search( filename );
+        uint len = re.matchedLength();
+        if ( ( (*it).find("*") != -1 || (*it).find("?") != -1 ) && pos+len == \
filename.length() )  return true;
         else if( filename.find( "/" ) != -1 && filename.find( *it ) != -1 )
             return true;
@@ -1571,6 +1586,11 @@
     }
 }
 
+void CustomProjectPart::setFiletypes( const QStringList& l )
+{
+    DomUtil::writeListEntry( *projectDom(), "kdevcustomproject/filetypes", \
"filetype", l ); +}
+
 #include "customprojectpart.moc"
 
 // kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on
--- branches/kdevelop/3.4/buildtools/custommakefiles/customprojectpart.h \
#641601:641602 @@ -99,6 +99,7 @@
     bool isProjectFileType( const QString& absFile ) const;
     bool isInBlacklist( const QString& ) const;
     void cleanFileList();
+    void setFiletypes( const QStringList& );
     QString relativeToProject( const QString& ) const;
     void addDirWatches( const QString& );
     void findNewFiles( const QString& dir, QStringList& list) const;


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

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