Commit 21c0cdee authored by hjk's avatar hjk
Browse files

Core::Filemanager: make some methods static



This follows suit to the ICore changes.

Change-Id: Iba2de1b1e3f2574fd1459892eae702e6af1cc7dc
Reviewed-by: default avatarDaniel Teske <daniel.teske@nokia.com>
parent 828139a7
......@@ -335,7 +335,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
connect(d->m_welcomePage, SIGNAL(manageSessions()), this, SLOT(showSessionManager()));
addObject(d->m_welcomePage);
connect(Core::ICore::fileManager(), SIGNAL(currentFileChanged(QString)),
connect(Core::FileManager::instance(), SIGNAL(currentFileChanged(QString)),
this, SLOT(setCurrentFile(QString)));
d->m_session = new SessionManager(this);
......@@ -515,7 +515,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
d->m_openWithMenu->setTitle(tr("Open With"));
connect(d->m_openWithMenu, SIGNAL(triggered(QAction *)),
Core::FileManager::instance(), SLOT(executeOpenWithMenuAction(QAction*)));
Core::FileManager::instance(), SLOT(slotExecuteOpenWithMenuAction(QAction*)));
//
// Separators
......@@ -1084,9 +1084,9 @@ void ProjectExplorerPlugin::unloadProject()
bool success = false;
if (readonlycount > 0)
success = Core::ICore::fileManager()->saveModifiedFiles(filesToSave).isEmpty();
success = Core::FileManager::saveModifiedFiles(filesToSave).isEmpty();
else
success = Core::ICore::fileManager()->saveModifiedFilesSilently(filesToSave).isEmpty();
success = Core::FileManager::saveModifiedFilesSilently(filesToSave).isEmpty();
if (!success)
return;
......@@ -1656,7 +1656,7 @@ void ProjectExplorerPlugin::setCurrent(Project *project, QString filePath, Node
updateActions();
}
Core::ICore::fileManager()->setCurrentFile(filePath);
Core::FileManager::setCurrentFile(filePath);
}
void ProjectExplorerPlugin::updateActions()
......@@ -1754,19 +1754,17 @@ bool ProjectExplorerPlugin::saveModifiedFiles()
if (debug)
qDebug() << "ProjectExplorerPlugin::saveModifiedFiles";
QList<Core::IFile *> filesToSave = Core::ICore::fileManager()->modifiedFiles();
QList<Core::IFile *> filesToSave = Core::FileManager::modifiedFiles();
if (!filesToSave.isEmpty()) {
if (d->m_projectExplorerSettings.saveBeforeBuild) {
bool cancelled = false;
Core::ICore::fileManager()->saveModifiedFilesSilently(filesToSave, &cancelled);
Core::FileManager::saveModifiedFilesSilently(filesToSave, &cancelled);
if (cancelled)
return false;
} else {
bool cancelled = false;
bool alwaysSave = false;
Core::FileManager *fm = Core::ICore::fileManager();
fm->saveModifiedFiles(filesToSave, &cancelled, QString(),
Core::FileManager::saveModifiedFiles(filesToSave, &cancelled, QString(),
tr("Always save files before build"), &alwaysSave);
if (cancelled)
......@@ -2727,7 +2725,7 @@ void ProjectExplorerPlugin::deleteFile()
projectNode->deleteFiles(fileNode->fileType(), QStringList(filePath));
Core::ICore::fileManager()->expectFileChange(filePath);
Core::FileManager::expectFileChange(filePath);
if (Core::IVersionControl *vc =
Core::ICore::vcsManager()->findVersionControlForDirectory(QFileInfo(filePath).absolutePath())) {
vc->vcsDelete(filePath);
......@@ -2738,7 +2736,7 @@ void ProjectExplorerPlugin::deleteFile()
QMessageBox::warning(Core::ICore::mainWindow(), tr("Deleting File Failed"),
tr("Could not delete file %1.").arg(filePath));
}
Core::ICore::fileManager()->unexpectFileChange(filePath);
Core::FileManager::unexpectFileChange(filePath);
}
void ProjectExplorerPlugin::renameFile()
......@@ -2783,7 +2781,7 @@ void ProjectExplorerPlugin::renameFile(Node *node, const QString &to)
}
if (result) {
// yeah we moved, tell the filemanager about it
Core::ICore::fileManager()->renamedFile(orgFilePath, newFilePath);
Core::FileManager::renamedFile(orgFilePath, newFilePath);
// Tell the project plugin about it
ProjectNode *projectNode = fileNode->projectNode();
projectNode->renameFile(fileNode->fileType(), orgFilePath, newFilePath);
......@@ -2850,9 +2848,8 @@ QStringList ProjectExplorerPlugin::projectFilePatterns()
void ProjectExplorerPlugin::openOpenProjectDialog()
{
Core::FileManager *fileMananger = Core::ICore::fileManager();
const QString path = fileMananger->useProjectsDirectory() ? fileMananger->projectsDirectory() : QString();
const QStringList files = fileMananger->getOpenFileNames(d->m_projectFilterString, path);
const QString path = Core::FileManager::useProjectsDirectory() ? Core::FileManager::projectsDirectory() : QString();
const QStringList files = Core::FileManager::getOpenFileNames(d->m_projectFilterString, path);
if (!files.isEmpty())
Core::ICore::openFiles(files, Core::ICore::SwitchMode);
}
......
......@@ -185,9 +185,8 @@ QWidget *ProjectExplorerSettingsPage::createPage(QWidget *parent)
{
m_widget = new ProjectExplorerSettingsWidget(parent);
m_widget->setSettings(ProjectExplorerPlugin::instance()->projectExplorerSettings());
const Core::FileManager *fm = Core::ICore::fileManager();
m_widget->setProjectsDirectory(fm->projectsDirectory());
m_widget->setUseProjectsDirectory(fm->useProjectsDirectory());
m_widget->setProjectsDirectory(Core::FileManager::projectsDirectory());
m_widget->setUseProjectsDirectory(Core::FileManager::useProjectsDirectory());
if (m_searchKeywords.isEmpty())
m_searchKeywords = m_widget->searchKeywords();
return m_widget;
......@@ -197,9 +196,8 @@ void ProjectExplorerSettingsPage::apply()
{
if (m_widget) {
ProjectExplorerPlugin::instance()->setProjectExplorerSettings(m_widget->settings());
Core::FileManager *fm = Core::ICore::fileManager();
fm->setProjectsDirectory(m_widget->projectsDirectory());
fm->setUseProjectsDirectory(m_widget->useProjectsDirectory());
Core::FileManager::setProjectsDirectory(m_widget->projectsDirectory());
Core::FileManager::setUseProjectsDirectory(m_widget->useProjectsDirectory());
}
}
......
......@@ -72,7 +72,7 @@ QmlProject::QmlProject(Internal::Manager *manager, const QString &fileName)
m_file = new Internal::QmlProjectFile(this, fileName);
m_rootNode = new Internal::QmlProjectNode(this, m_file);
Core::FileManager::instance()->addFile(m_file, true);
Core::FileManager::addFile(m_file, true);
m_manager->registerProject(this);
}
......@@ -81,7 +81,7 @@ QmlProject::~QmlProject()
{
m_manager->unregisterProject(this);
Core::FileManager::instance()->removeFile(m_file);
Core::FileManager::removeFile(m_file);
delete m_projectItem.data();
delete m_rootNode;
......
......@@ -255,7 +255,7 @@ Qt4PriFileNode::Qt4PriFileNode(Qt4Project *project, Qt4ProFileNode* qt4ProFileNo
{
Q_ASSERT(project);
m_qt4PriFile = new Qt4PriFile(this);
Core::ICore::fileManager()->addFile(m_qt4PriFile);
Core::FileManager::addFile(m_qt4PriFile);
setDisplayName(QFileInfo(filePath).completeBaseName());
......@@ -1039,7 +1039,7 @@ bool Qt4PriFileNode::saveModifiedEditors()
if (!modifiedFileHandles.isEmpty()) {
bool cancelled;
Core::ICore::fileManager()->saveModifiedFiles(modifiedFileHandles, &cancelled,
Core::FileManager::saveModifiedFiles(modifiedFileHandles, &cancelled,
tr("There are unsaved changes for project file %1.").arg(m_projectFilePath));
if (cancelled)
return false;
......@@ -1146,9 +1146,9 @@ void Qt4PriFileNode::changeFiles(const FileType fileType,
}
// save file
Core::ICore::fileManager()->expectFileChange(m_projectFilePath);
Core::FileManager::expectFileChange(m_projectFilePath);
save(lines);
Core::ICore::fileManager()->unexpectFileChange(m_projectFilePath);
Core::FileManager::unexpectFileChange(m_projectFilePath);
// This is a hack.
// We are saving twice in a very short timeframe, once the editor and once the ProFile.
......
......@@ -92,7 +92,7 @@ ResourceEditorW::ResourceEditorW(const Core::Context &context,
// (That is because this editor instance is deleted in executeOpenWithMenuAction
// in that case.)
connect(m_openWithMenu, SIGNAL(triggered(QAction*)),
Core::FileManager::instance(), SLOT(executeOpenWithMenuAction(QAction*)),
Core::FileManager::instance(), SLOT(slotExecuteOpenWithMenuAction(QAction*)),
Qt::QueuedConnection);
connect(m_resourceEditor, SIGNAL(dirtyChanged(bool)), this, SLOT(dirtyChanged(bool)));
......
......@@ -512,7 +512,7 @@ bool SubversionPlugin::submitEditorAboutToClose(VcsBase::VcsBaseSubmitEditor *su
bool closeEditor = true;
if (!fileList.empty()) {
// get message & commit
closeEditor = Core::ICore::fileManager()->saveFile(fileIFace);
closeEditor = Core::FileManager::saveFile(fileIFace);
if (closeEditor)
closeEditor = commit(m_commitMessageFileName, fileList);
}
......
......@@ -92,7 +92,7 @@ Core::IFile *TaskFileFactory::open(ProjectExplorer::Project *context, const QStr
m_openFiles.append(file);
// Register with filemanager:
Core::ICore::fileManager()->addFile(file);
Core::FileManager::addFile(file);
return file;
}
......
......@@ -180,7 +180,7 @@ void BaseFileFind::doReplace(const QString &text,
{
QStringList files = replaceAll(text, items);
if (!files.isEmpty()) {
Core::ICore::fileManager()->notifyFilesChangedInternally(files);
Core::FileManager::notifyFilesChangedInternally(files);
Find::SearchResultWindow::instance()->hide();
}
}
......
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