Commit 5f108f53 authored by Christoph Cullmann's avatar Christoph Cullmann

allow to use specific type

parent a0d17cd9
......@@ -279,7 +279,7 @@ void KateProject::saveNotesDocument ()
void KateProject::slotModifiedChanged(KTextEditor::Document* document) {
KateProjectItem *item = (KateProjectItem*)itemForFile (document->url().toLocalFile ());
KateProjectItem *item = itemForFile (document->url().toLocalFile ());
if (!item) return;
......@@ -289,7 +289,7 @@ void KateProject::slotModifiedChanged(KTextEditor::Document* document) {
void KateProject::slotModifiedOnDisk (KTextEditor::Document *document,
bool isModified, KTextEditor::ModificationInterface::ModifiedOnDiskReason reason) {
KateProjectItem *item = (KateProjectItem*)itemForFile (document->url().toLocalFile ());
KateProjectItem *item = itemForFile (m_documents.value (document));
if (!item) return;
......@@ -351,7 +351,7 @@ void KateProject::registerDocument (KTextEditor::Document *document)
fileItem->setData (QVariant (true), Qt::UserRole + 3);
if (!m_file2Item)
m_file2Item = KateProjectSharedQMapStringItem (new QMap<QString, QStandardItem *> ());
m_file2Item = KateProjectSharedQMapStringItem (new QMap<QString, KateProjectItem *> ());
(*m_file2Item)[document->url().toLocalFile ()] = fileItem;
}
......
......@@ -27,6 +27,7 @@
#include <QTextDocument>
#include <KTextEditor/ModificationInterface>
#include "kateprojectindex.h"
#include "kateprojectitem.h"
/**
* Shared pointer data types.
......@@ -35,7 +36,7 @@
typedef QSharedPointer<QStandardItem> KateProjectSharedQStandardItem;
Q_DECLARE_METATYPE(KateProjectSharedQStandardItem)
typedef QSharedPointer<QMap<QString, QStandardItem *> > KateProjectSharedQMapStringItem;
typedef QSharedPointer<QMap<QString, KateProjectItem *> > KateProjectSharedQMapStringItem;
Q_DECLARE_METATYPE(KateProjectSharedQMapStringItem)
typedef QSharedPointer<KateProjectIndex> KateProjectSharedProjectIndex;
......@@ -175,7 +176,7 @@ class KateProject : public QObject
* @param file file to get item for
* @return item for given file or 0
*/
QStandardItem *itemForFile (const QString &file)
KateProjectItem *itemForFile (const QString &file)
{
return m_file2Item ? m_file2Item->value (file) : 0;
}
......
......@@ -53,7 +53,7 @@ void KateProjectWorker::loadProject (QString baseDir, QVariantMap projectMap)
* then load the project recursively
*/
KateProjectSharedQStandardItem topLevel (new QStandardItem ());
KateProjectSharedQMapStringItem file2Item (new QMap<QString, QStandardItem *> ());
KateProjectSharedQMapStringItem file2Item (new QMap<QString, KateProjectItem *> ());
loadProject (topLevel.data(), projectMap, file2Item.data());
/**
......@@ -72,7 +72,7 @@ void KateProjectWorker::loadProject (QString baseDir, QVariantMap projectMap)
loadIndex (files);
}
void KateProjectWorker::loadProject (QStandardItem *parent, const QVariantMap &project, QMap<QString, QStandardItem *> *file2Item)
void KateProjectWorker::loadProject (QStandardItem *parent, const QVariantMap &project, QMap<QString, KateProjectItem *> *file2Item)
{
/**
* recurse to sub-projects FIRST
......@@ -157,7 +157,7 @@ static QStandardItem *directoryParent (QMap<QString, QStandardItem *> &dir2Item,
return dir2Item[path];
}
void KateProjectWorker::loadFilesEntry (QStandardItem *parent, const QVariantMap &filesEntry, QMap<QString, QStandardItem *> *file2Item)
void KateProjectWorker::loadFilesEntry (QStandardItem *parent, const QVariantMap &filesEntry, QMap<QString, KateProjectItem *> *file2Item)
{
/**
* get directory to open or skip
......@@ -367,7 +367,7 @@ void KateProjectWorker::loadFilesEntry (QStandardItem *parent, const QVariantMap
* construct the item with right directory prefix
* already hang in directories in tree
*/
QStandardItem *fileItem = new KateProjectItem (KateProjectItem::File, fileInfo.fileName());
KateProjectItem *fileItem = new KateProjectItem (KateProjectItem::File, fileInfo.fileName());
fileItem->setData(filePath,Qt::ToolTipRole);
item2ParentPath.append (QPair<QStandardItem *, QStandardItem *>(fileItem, directoryParent(dir2Item, dir.relativeFilePath (fileInfo.absolutePath()))));
fileItem->setData (filePath, Qt::UserRole);
......
......@@ -38,7 +38,7 @@ class KateProjectWorker : public QObject
/**
* Type for QueuedConnection
*/
typedef QMap<QString, QStandardItem *> MapString2Item;
typedef QMap<QString, KateProjectItem *> MapString2Item;
/**
* construct project worker for given project
......@@ -69,7 +69,7 @@ class KateProjectWorker : public QObject
* @param project variant map for this group
* @param file2Item mapping file => item, will be filled
*/
void loadProject (QStandardItem *parent, const QVariantMap &project, QMap<QString, QStandardItem *> *file2Item);
void loadProject (QStandardItem *parent, const QVariantMap &project, QMap<QString, KateProjectItem *> *file2Item);
/**
* Load one files entry in the current parent item.
......@@ -77,7 +77,7 @@ class KateProjectWorker : public QObject
* @param filesEntry one files entry specification to load
* @param file2Item mapping file => item, will be filled
*/
void loadFilesEntry (QStandardItem *parent, const QVariantMap &filesEntry, QMap<QString, QStandardItem *> *file2Item);
void loadFilesEntry (QStandardItem *parent, const QVariantMap &filesEntry, QMap<QString, KateProjectItem *> *file2Item);
/**
* Load index for whole project.
......
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