Commit 375d8116 authored by Kevin Michel's avatar Kevin Michel Committed by Thorbjørn Lindeijer
Browse files

Allow adding files in generic project



Merge-request: 736
Reviewed-by: default avatarThorbjørn Lindeijer <thorbjorn.lindeijer@nokia.com>
parent ec996300
......@@ -168,6 +168,21 @@ static QStringList readLines(const QString &absoluteFileName)
return lines;
}
bool GenericProject::addFiles(const QStringList &filePaths)
{
QFile file(filesFileName());
if (file.open(QFile::Append)) {
QTextStream stream(&file);
QDir baseDir(QFileInfo(m_fileName).dir());
foreach (const QString &filePath, filePaths) {
stream << baseDir.relativeFilePath(filePath) << "\n";
}
file.close();
refresh(GenericProject::Files);
return true;
}
return false;
}
void GenericProject::parseProject(RefreshOptions options)
{
......
......@@ -94,6 +94,8 @@ public:
QString buildParser(const QString &buildConfiguration) const;
ProjectExplorer::ToolChain *toolChain() const;
bool addFiles(const QStringList &filePaths);
enum RefreshOptions {
Files = 0x01,
Configuration = 0x02,
......
......@@ -165,7 +165,8 @@ bool GenericProjectNode::hasTargets() const
QList<ProjectExplorer::ProjectNode::ProjectAction> GenericProjectNode::supportedActions() const
{
return QList<ProjectAction>();
return QList<ProjectAction>()
<< AddFile;
}
bool GenericProjectNode::addSubProjects(const QStringList &proFilePaths)
......@@ -184,9 +185,9 @@ bool GenericProjectNode::addFiles(const ProjectExplorer::FileType fileType,
const QStringList &filePaths, QStringList *notAdded)
{
Q_UNUSED(fileType);
Q_UNUSED(filePaths);
Q_UNUSED(notAdded);
return false;
return m_project->addFiles(filePaths);
}
bool GenericProjectNode::removeFiles(const ProjectExplorer::FileType fileType,
......
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