1
/***************************************************************************
2
* Copyright (C) 2003 by Alexander Dymo *
3
* cloudtemple@mksat.net *
5
* This program is free software; you can redistribute it and/or modify *
6
* it under the terms of the GNU General Public License as published by *
7
* the Free Software Foundation; either version 2 of the License, or *
8
* (at your option) any later version. *
9
***************************************************************************/
10
#include "kdevcustomimporter.h"
12
#include "settingsdialog.h"
14
#include <qvaluestack.h>
18
#include <kgenericfactory.h>
20
K_EXPORT_COMPONENT_FACTORY( libkdevcustompcsimporter, KGenericFactory<KDevCustomImporter>( "kdevcustompcsimporter" ) )
22
KDevCustomImporter::KDevCustomImporter( QObject* parent, const char* name, const QStringList & // args
24
: KDevPCSImporter( parent, name )
28
KDevCustomImporter::~KDevCustomImporter()
32
QString KDevCustomImporter::dbName() const
34
return m_settings->dbName();
37
QStringList KDevCustomImporter::fileList( const QString& path )
42
QStringList lst = dir.entryList( "*.h;*.H;*.hh;*.hxx;*.hpp;*.tlh" );
44
for ( QStringList::Iterator it = lst.begin(); it != lst.end(); ++it )
46
fileList.push_back( dir.absPath() + "/" + ( *it ) );
51
QStringList KDevCustomImporter::fileList()
56
QStringList lst = m_settings->dirs();
58
for ( QStringList::Iterator it = lst.begin(); it != lst.end(); ++it )
60
if ( !m_settings->recursive() )
61
files += fileList( *it );
63
processDir( *it, files );
69
QStringList KDevCustomImporter::includePaths()
74
return m_settings->dirs();
77
QWidget* KDevCustomImporter::createSettingsPage( QWidget* parent, const char* name )
79
m_settings = new SettingsDialog( parent, name );
83
void KDevCustomImporter::processDir( const QString path, QStringList & files )
85
QValueStack<QString> s;
87
files += fileList( path );
92
dir.setPath( s.pop() );
93
kdDebug( 9015 ) << "Examining: " << dir.path() << endl;
94
const QFileInfoList *dirEntries = dir.entryInfoList();
95
QPtrListIterator<QFileInfo> it( *dirEntries );
96
for ( ; dirEntries && it.current(); ++it )
98
QString fileName = it.current() ->fileName();
99
if ( fileName == "." || fileName == ".." )
101
if ( it.current() ->isDir() )
103
QString tmpPath = it.current() ->absFilePath();
104
kdDebug( 9015 ) << "Pushing: " << tmpPath << endl;
106
files += fileList( tmpPath );
110
while ( !s.isEmpty() );
113
#include "kdevcustomimporter.moc"
114
//kate: indent-mode csands; tab-width 4; space-indent off;