forked from qt-creator/qt-creator
Rename IFile->IDocument and FileManager->DocumentManager
And adapt the other API respectively. Change-Id: I1e04e555409be09242db6890f9e013396f83aeed Reviewed-by: Bill King <bill.king@nokia.com> Reviewed-by: Eike Ziller <eike.ziller@nokia.com>
This commit is contained in:
@@ -41,7 +41,7 @@ using namespace TaskList::Internal;
|
||||
// TaskFile
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
TaskFile::TaskFile(QObject *parent) : Core::IFile(parent),
|
||||
TaskFile::TaskFile(QObject *parent) : Core::IDocument(parent),
|
||||
m_context(0)
|
||||
{ }
|
||||
|
||||
@@ -86,7 +86,7 @@ bool TaskFile::isSaveAsAllowed() const
|
||||
return false;
|
||||
}
|
||||
|
||||
Core::IFile::ReloadBehavior TaskFile::reloadBehavior(ChangeTrigger state, ChangeType type) const
|
||||
Core::IDocument::ReloadBehavior TaskFile::reloadBehavior(ChangeTrigger state, ChangeType type) const
|
||||
{
|
||||
Q_UNUSED(state);
|
||||
Q_UNUSED(type);
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#ifndef TASKFILE_H
|
||||
#define TASKFILE_H
|
||||
|
||||
#include <coreplugin/ifile.h>
|
||||
#include <coreplugin/idocument.h>
|
||||
|
||||
namespace ProjectExplorer {
|
||||
class Project;
|
||||
@@ -42,7 +42,7 @@ class Project;
|
||||
namespace TaskList {
|
||||
namespace Internal {
|
||||
|
||||
class TaskFile : public Core::IFile
|
||||
class TaskFile : public Core::IDocument
|
||||
{
|
||||
public:
|
||||
TaskFile(QObject *parent);
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/id.h>
|
||||
#include <coreplugin/filemanager.h>
|
||||
#include <coreplugin/documentmanager.h>
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QMessageBox>
|
||||
@@ -49,7 +49,7 @@ using namespace TaskList::Internal;
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
TaskFileFactory::TaskFileFactory(QObject * parent) :
|
||||
Core::IFileFactory(parent),
|
||||
Core::IDocumentFactory(parent),
|
||||
m_mimeTypes(QStringList() << QLatin1String("text/x-tasklist"))
|
||||
{ }
|
||||
|
||||
@@ -71,13 +71,13 @@ QString TaskFileFactory::displayName() const
|
||||
return tr("Task file reader");
|
||||
}
|
||||
|
||||
Core::IFile *TaskFileFactory::open(const QString &fileName)
|
||||
Core::IDocument *TaskFileFactory::open(const QString &fileName)
|
||||
{
|
||||
ProjectExplorer::Project *context = ProjectExplorer::ProjectExplorerPlugin::currentProject();
|
||||
return open(context, fileName);
|
||||
}
|
||||
|
||||
Core::IFile *TaskFileFactory::open(ProjectExplorer::Project *context, const QString &fileName)
|
||||
Core::IDocument *TaskFileFactory::open(ProjectExplorer::Project *context, const QString &fileName)
|
||||
{
|
||||
TaskFile *file = new TaskFile(this);
|
||||
file->setContext(context);
|
||||
@@ -92,14 +92,14 @@ Core::IFile *TaskFileFactory::open(ProjectExplorer::Project *context, const QStr
|
||||
m_openFiles.append(file);
|
||||
|
||||
// Register with filemanager:
|
||||
Core::FileManager::addFile(file);
|
||||
Core::DocumentManager::addDocument(file);
|
||||
|
||||
return file;
|
||||
}
|
||||
|
||||
void TaskFileFactory::closeAllFiles()
|
||||
{
|
||||
foreach(Core::IFile *file, m_openFiles)
|
||||
file->deleteLater();
|
||||
foreach (Core::IDocument *document, m_openFiles)
|
||||
document->deleteLater();
|
||||
m_openFiles.clear();
|
||||
}
|
||||
|
||||
@@ -33,8 +33,8 @@
|
||||
#ifndef TASKFILEFACTORY_H
|
||||
#define TASKFILEFACTORY_H
|
||||
|
||||
#include <coreplugin/ifilefactory.h>
|
||||
#include <coreplugin/ifile.h>
|
||||
#include <coreplugin/idocumentfactory.h>
|
||||
#include <coreplugin/idocument.h>
|
||||
|
||||
#include <QStringList>
|
||||
|
||||
@@ -45,7 +45,7 @@ class Project;
|
||||
namespace TaskList {
|
||||
namespace Internal {
|
||||
|
||||
class TaskFileFactory : public Core::IFileFactory
|
||||
class TaskFileFactory : public Core::IDocumentFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
@@ -57,14 +57,14 @@ public:
|
||||
Core::Id id() const;
|
||||
QString displayName() const;
|
||||
|
||||
Core::IFile *open(const QString &fileName);
|
||||
Core::IFile *open(ProjectExplorer::Project *context, const QString &fileName);
|
||||
Core::IDocument *open(const QString &fileName);
|
||||
Core::IDocument *open(ProjectExplorer::Project *context, const QString &fileName);
|
||||
|
||||
void closeAllFiles();
|
||||
|
||||
private:
|
||||
QStringList m_mimeTypes;
|
||||
QList<Core::IFile *> m_openFiles;
|
||||
QList<Core::IDocument *> m_openFiles;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
Reference in New Issue
Block a user