Commit 98ec3fce authored by Giovana Vitor Dionisio Santana's avatar Giovana Vitor Dionisio Santana ✍🏾 Committed by Christoph Cullmann
Browse files

saving the project map

parent 5797f84d
......@@ -370,6 +370,21 @@ KateProject *KateProjectPlugin::createProjectForDirectory(const QDir &dir)
return project;
}
KateProject *KateProjectPlugin::createProjectForDirectory(const QDir &dir, const QVariantMap &projectMap)
{
QVariantMap cnf;
cnf[QStringLiteral("name")] = dir.dirName();
cnf[QStringLiteral("files")] = (QVariantList() << projectMap);
KateProject *project = new KateProject(m_threadPool, this, cnf, dir.canonicalPath());
m_projects.append(project);
Q_EMIT projectCreated(project);
return project;
}
void KateProjectPlugin::setAutoRepository(bool onGit, bool onSubversion, bool onMercurial, bool onFossil)
{
m_autoGit = onGit;
......@@ -578,29 +593,34 @@ void KateProjectPlugin::unregisterVariables()
void KateProjectPlugin::readSessionConfig(const KConfigGroup &config)
{
const QStringList projectList = config.readEntry("projects", QStringList());
const QVariantList projectMapList = config.readEntry("projectsMaps", QVariantList());
for (const QString &project : projectList) {
createProjectForDirectory(QDir(project));
if (!projectMapList.isEmpty()){
int i = 0;
for (const QString &project : projectList) {
createProjectForDirectory(QDir(project), projectMapList.at(i).toMap());
i++;
}
} else {
for (const QString &project : projectList) {
createProjectForDirectory(QDir(project));
}
}
}
void KateProjectPlugin::writeSessionConfig(KConfigGroup &config)
{
QStringList projectList;
QVariantList projectMapList;
for (KateProject *project : projects()) {
if (project->fileName().isEmpty()) {
projectList.push_back(project->baseDir());
projectMapList.push_back(project->projectMap());
}
/**
* setup global attributes in this object
*/
m_projectMap = globalProject;
// emit that we changed stuff
Q_EMIT projectMapChanged();
}
config.writeEntry("projects", projectList);
config.writeEntry("projectsMaps", projectMapList);
}
......@@ -185,6 +185,7 @@ public Q_SLOTS:
private:
KateProject *createProjectForRepository(const QString &type, const QDir &dir);
KateProject *createProjectForDirectory(const QDir &dir);
KateProject *createProjectForDirectory(const QDir &dir, const QVariantMap &projectMap);
KateProject *detectGit(const QDir &dir);
KateProject *detectSubversion(const QDir &dir);
KateProject *detectMercurial(const QDir &dir);
......
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