forked from qt-creator/qt-creator
Added VCS integration to ResourceEditor.
Made add and remove operations of ResourceEditor VCS-aware. Also, remove operation now can remove files from filesystem. FileUtils::removeFile() and VcsManager::promptToAdd functions were extracted from ProjectExplorer to prevent code duplication. RemoveFileDialog was also moved to coreplugin. Change-Id: Ia51127288030e52ce9475b369e56ea034dfa5d1e Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: Tobias Hunger <tobias.hunger@nokia.com>
This commit is contained in:
committed by
Tobias Hunger
parent
bd7499b896
commit
728579ef52
@@ -33,6 +33,7 @@
|
||||
#include <coreplugin/documentmanager.h>
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/iversioncontrol.h>
|
||||
#include <coreplugin/removefiledialog.h>
|
||||
#include <coreplugin/vcsmanager.h>
|
||||
#include <utils/environment.h>
|
||||
|
||||
@@ -171,6 +172,25 @@ QString FileUtils::msgTerminalAction()
|
||||
#endif
|
||||
}
|
||||
|
||||
void FileUtils::removeFile(const QString &filePath, bool deleteFromFS)
|
||||
{
|
||||
// remove from version control
|
||||
ICore::vcsManager()->promptToDelete(filePath);
|
||||
|
||||
// remove from file system
|
||||
if (deleteFromFS) {
|
||||
QFile file(filePath);
|
||||
|
||||
if (file.exists()) {
|
||||
// could have been deleted by vc
|
||||
if (!file.remove())
|
||||
QMessageBox::warning(ICore::mainWindow(),
|
||||
QApplication::translate("Core::Internal", "Deleting File Failed"),
|
||||
QApplication::translate("Core::Internal", "Could not delete file %1.").arg(filePath));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline bool fileSystemRenameFile(const QString &orgFilePath,
|
||||
const QString &newFilePath)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user