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

List:       kde-commits
Subject:    kdevelop/parts/fileview
From:       Jens Dagerbo <jens.dagerbo () swipnet ! se>
Date:       2003-04-15 20:08:20
[Download RAW message or body]

CVS commit by dagerbo: 

Don't maintain a local copy of the project files list, that is bound to go wrong. \
(Less than optimal fix, but also less broken than before.)


  M +16 -12    filetreewidget.cpp   1.20
  M +2 -1      filetreewidget.h   1.5


--- kdevelop/parts/fileview/filetreewidget.cpp  #1.19:1.20
@@ -58,4 +58,5 @@ void MyFileTreeViewItem::hideOrShow()
 {
     setVisible( listView()->shouldBeShown( this ) );
+    repaint();
 
     MyFileTreeViewItem* item = static_cast<MyFileTreeViewItem*>(firstChild());
@@ -69,6 +70,7 @@ void MyFileTreeViewItem::paintCell(QPain
                              int column, int width, int alignment)
 {
-    if ( listView()->m_showNonProjectFiles &&
-         listView()->m_projectFiles.contains( path() ) ) {
+    QString prunedPath = path().replace( QRegExp( listView()->projectDirectory() + \
"/" ), "" ); +    if ( listView()->m_showNonProjectFiles && \
listView()->projectFiles().contains( prunedPath ) ) +    {
         QFont font(p->font());
         font.setBold(true);
@@ -157,13 +159,4 @@ FileTreeWidget::~FileTreeWidget()
 void FileTreeWidget::openDirectory( const QString& dirName )
 {
-        QStringList::iterator it;
-
-        QStringList fileList = m_part->project()->allFiles();
-
-        for ( it = fileList.begin(); it != fileList.end(); ++it )
-        {
-        m_projectFiles.append ( m_part->project()->projectDirectory() + "/" + ( *it \
                ) );
-        }
-
     KURL url;
     url.setPath( dirName );
@@ -174,5 +167,6 @@ void FileTreeWidget::openDirectory( cons
 bool FileTreeWidget::shouldBeShown( KFileTreeViewItem* item )
 {
-    return( (m_showNonProjectFiles || item->isDir() || m_projectFiles.contains( \
item->path() )) +    QString prunedItemPath = item->path().replace( QRegExp( \
projectDirectory() + "/" ), "" ); +    return( (m_showNonProjectFiles || \
item->isDir() || projectFiles().contains( prunedItemPath ))  && !matchesHidePattern( \
item->text(0) ) );  }
@@ -239,4 +233,14 @@ void FileTreeWidget::slotToggleShowNonPr
     m_showNonProjectFiles = !m_showNonProjectFiles;
     hideOrShow();
+}
+
+QString FileTreeWidget::projectDirectory()
+{
+    return m_part->project()->projectDirectory();
+}
+
+QStringList FileTreeWidget::projectFiles()
+{
+    return m_part->project()->allFiles();
 }
 

--- kdevelop/parts/fileview/filetreewidget.h  #1.4:1.5
@@ -29,4 +29,6 @@ public:
     void openDirectory(const QString &dirName);
     bool shouldBeShown( KFileTreeViewItem* item );
+    QString projectDirectory();
+    QStringList projectFiles();
     
 public slots:
@@ -43,5 +45,4 @@ private:
     FileViewPart *m_part;
     QStringList m_hidePatterns;
-    QStringList m_projectFiles;
     bool m_showNonProjectFiles;
 };


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

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