Commit b87a8257 authored by Andreas Pakulat's avatar Andreas Pakulat

Reset the root scope when we can't parse the top level .pro file.

@J. Preiss: can you please test wether this change helps? You can get the kdevelop source from svn://anonsvn.kde.org/home/kde/branches/kdevelop/3.5

CCBUG: 145258
parent 8baf2585
......@@ -18,13 +18,15 @@
ChooseSubprojectDlg::ChooseSubprojectDlg(TrollProjectWidget *widget, QWidget* parent, const char* name, bool modal, WFlags fl)
: ChooseSubprojectDlgBase(parent,name, modal,fl), m_widget(widget)
{
ChooseItem *it = new ChooseItem(m_widget->m_rootSubproject, subprojects_view, m_widget->m_rootSubproject->text(0));
it->setPixmap(0, *(m_widget->m_rootSubproject->pixmap(0)));
it->setOpen(true);
fillSubprojectsView(it);
connect(subprojects_view, SIGNAL(selectionChanged(QListViewItem*)), this, SLOT(itemSelected(QListViewItem *)));
subprojects_view->setSelected(it, true);
if( m_widget->m_rootSubproject)
{
ChooseItem *it = new ChooseItem(m_widget->m_rootSubproject, subprojects_view, m_widget->m_rootSubproject->text(0));
it->setPixmap(0, *(m_widget->m_rootSubproject->pixmap(0)));
it->setOpen(true);
fillSubprojectsView(it);
subprojects_view->setSelected(it, true);
}
}
ChooseSubprojectDlg::~ChooseSubprojectDlg()
......
......@@ -342,18 +342,25 @@ void TrollProjectWidget::openProject( const QString &dirName )
kdDebug( 9024 ) << "Parsing " << proname << endl;
m_rootScope = new Scope( proname, m_part );
if( m_rootScope->scopeType() != Scope::InvalidScope )
{
m_rootSubproject = new QMakeScopeItem( overview, m_rootScope->scopeName(), m_rootScope, this );
m_rootSubproject = new QMakeScopeItem( overview, m_rootScope->scopeName(), m_rootScope, this );
m_rootSubproject->setOpen( true );
if ( m_rootSubproject->firstChild() && m_rootSubproject->scope->variableValues( "TEMPLATE" ).findIndex("subdirs") != -1 )
{
overview->setSelected( m_rootSubproject->firstChild(), true );
}
else
m_rootSubproject->setOpen( true );
if ( m_rootSubproject->firstChild() && m_rootSubproject->scope->variableValues( "TEMPLATE" ).findIndex("subdirs") != -1 )
{
overview->setSelected( m_rootSubproject->firstChild(), true );
}
else
{
overview->setSelected( m_rootSubproject, true );
}
}else
{
overview->setSelected( m_rootSubproject, true );
delete m_rootScope;
m_rootScope = 0;
}
// kdDebug(9024) << "Adding " << allFiles().count() << " Files" << endl;
// kdDebug(9024) << allFiles() << endl;
......@@ -375,6 +382,8 @@ void TrollProjectWidget::closeProject()
QStringList TrollProjectWidget::allFiles()
{
if( !m_rootScope )
return QStringList();
if( m_filesCached )
return m_allFilesCache;
m_allFilesCache = m_rootScope->allFiles( m_rootScope->projectDir() );
......@@ -2177,6 +2186,8 @@ void TrollProjectWidget::createMakefileIfMissing( const QString &dir, QMakeScope
QMakeScopeItem* TrollProjectWidget::findSubprojectForPath( const QString& relPath )
{
if( !m_rootSubproject )
return 0;
QStringList dirs = QStringList::split("/", relPath);
QMakeScopeItem* pitem = static_cast<QMakeScopeItem*>(m_rootSubproject);
for( QStringList::iterator it = dirs.begin(); it != dirs.end(); ++it)
......@@ -2204,6 +2215,9 @@ QPtrList<QMakeScopeItem> TrollProjectWidget::findSubprojectForFile( QFileInfo fi
void TrollProjectWidget::findSubprojectForFile( QPtrList<QMakeScopeItem> &list, QMakeScopeItem * item, QString absFilePath )
{
if( !item )
return;
QDir d( item->scope->projectDir() );
QStringList vars = item->scope->variableValues( "SOURCES" );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment