Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
flatpak-qt-creator
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
fae7dc95
Commit
fae7dc95
authored
Apr 04, 2011
by
Oswald Buddenhagen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add errorString output argument to IFile::reload() & IEditor::open()
add/unify read error handling in all affected classes
parent
f1f9904d
Changes
44
Hide whitespace changes
Inline
Side-by-side
Showing
44 changed files
with
204 additions
and
134 deletions
+204
-134
src/plugins/bineditor/bineditorplugin.cpp
src/plugins/bineditor/bineditorplugin.cpp
+29
-12
src/plugins/cmakeprojectmanager/cmakeproject.cpp
src/plugins/cmakeprojectmanager/cmakeproject.cpp
+3
-1
src/plugins/cmakeprojectmanager/cmakeproject.h
src/plugins/cmakeprojectmanager/cmakeproject.h
+1
-1
src/plugins/coreplugin/editormanager/editormanager.cpp
src/plugins/coreplugin/editormanager/editormanager.cpp
+6
-3
src/plugins/coreplugin/editormanager/ieditor.h
src/plugins/coreplugin/editormanager/ieditor.h
+1
-1
src/plugins/coreplugin/filemanager.cpp
src/plugins/coreplugin/filemanager.cpp
+20
-8
src/plugins/coreplugin/ifile.h
src/plugins/coreplugin/ifile.h
+1
-1
src/plugins/cppeditor/cppeditor.cpp
src/plugins/cppeditor/cppeditor.cpp
+2
-2
src/plugins/cppeditor/cppeditor.h
src/plugins/cppeditor/cppeditor.h
+1
-1
src/plugins/designer/formwindoweditor.cpp
src/plugins/designer/formwindoweditor.cpp
+8
-8
src/plugins/designer/formwindoweditor.h
src/plugins/designer/formwindoweditor.h
+2
-2
src/plugins/designer/formwindowfile.cpp
src/plugins/designer/formwindowfile.cpp
+6
-3
src/plugins/designer/formwindowfile.h
src/plugins/designer/formwindowfile.h
+2
-2
src/plugins/genericprojectmanager/genericproject.cpp
src/plugins/genericprojectmanager/genericproject.cpp
+3
-1
src/plugins/genericprojectmanager/genericproject.h
src/plugins/genericprojectmanager/genericproject.h
+1
-1
src/plugins/glsleditor/glsleditor.cpp
src/plugins/glsleditor/glsleditor.cpp
+2
-2
src/plugins/glsleditor/glsleditoreditable.h
src/plugins/glsleditor/glsleditoreditable.h
+1
-1
src/plugins/imageviewer/imageviewer.cpp
src/plugins/imageviewer/imageviewer.cpp
+5
-2
src/plugins/imageviewer/imageviewer.h
src/plugins/imageviewer/imageviewer.h
+1
-1
src/plugins/imageviewer/imageviewerfile.cpp
src/plugins/imageviewer/imageviewerfile.cpp
+5
-3
src/plugins/imageviewer/imageviewerfile.h
src/plugins/imageviewer/imageviewerfile.h
+1
-1
src/plugins/qmljseditor/qmljseditor.cpp
src/plugins/qmljseditor/qmljseditor.cpp
+2
-2
src/plugins/qmljseditor/qmljseditoreditable.h
src/plugins/qmljseditor/qmljseditoreditable.h
+1
-1
src/plugins/qmlprojectmanager/qmlprojectfile.cpp
src/plugins/qmlprojectmanager/qmlprojectfile.cpp
+3
-1
src/plugins/qmlprojectmanager/qmlprojectfile.h
src/plugins/qmlprojectmanager/qmlprojectfile.h
+1
-1
src/plugins/qt4projectmanager/qt4nodes.cpp
src/plugins/qt4projectmanager/qt4nodes.cpp
+11
-4
src/plugins/qt4projectmanager/qt4nodes.h
src/plugins/qt4projectmanager/qt4nodes.h
+1
-1
src/plugins/qt4projectmanager/qt4project.cpp
src/plugins/qt4projectmanager/qt4project.cpp
+3
-1
src/plugins/qt4projectmanager/qt4project.h
src/plugins/qt4projectmanager/qt4project.h
+1
-1
src/plugins/resourceeditor/resourceeditorw.cpp
src/plugins/resourceeditor/resourceeditorw.cpp
+10
-9
src/plugins/resourceeditor/resourceeditorw.h
src/plugins/resourceeditor/resourceeditorw.h
+2
-2
src/plugins/tasklist/taskfile.cpp
src/plugins/tasklist/taskfile.cpp
+8
-6
src/plugins/tasklist/taskfile.h
src/plugins/tasklist/taskfile.h
+2
-2
src/plugins/tasklist/taskfilefactory.cpp
src/plugins/tasklist/taskfilefactory.cpp
+6
-1
src/plugins/tasklist/tasklistplugin.cpp
src/plugins/tasklist/tasklistplugin.cpp
+7
-4
src/plugins/tasklist/tasklistplugin.h
src/plugins/tasklist/tasklistplugin.h
+1
-1
src/plugins/texteditor/basetextdocument.cpp
src/plugins/texteditor/basetextdocument.cpp
+18
-15
src/plugins/texteditor/basetextdocument.h
src/plugins/texteditor/basetextdocument.h
+4
-4
src/plugins/texteditor/basetexteditor.cpp
src/plugins/texteditor/basetexteditor.cpp
+10
-5
src/plugins/texteditor/basetexteditor.h
src/plugins/texteditor/basetexteditor.h
+2
-2
src/plugins/vcsbase/submiteditorfile.cpp
src/plugins/vcsbase/submiteditorfile.cpp
+3
-1
src/plugins/vcsbase/submiteditorfile.h
src/plugins/vcsbase/submiteditorfile.h
+1
-1
src/plugins/vcsbase/vcsbasesubmiteditor.cpp
src/plugins/vcsbase/vcsbasesubmiteditor.cpp
+5
-11
src/plugins/vcsbase/vcsbasesubmiteditor.h
src/plugins/vcsbase/vcsbasesubmiteditor.h
+1
-1
No files found.
src/plugins/bineditor/bineditorplugin.cpp
View file @
fae7dc95
...
...
@@ -34,6 +34,9 @@
#include "bineditor.h"
#include "bineditorconstants.h"
#include <coreplugin/icore.h>
#include <QtCore/QDir>
#include <QtCore/QFile>
#include <QtCore/QFileInfo>
#include <QtCore/QDebug>
...
...
@@ -43,6 +46,7 @@
#include <QtGui/QMenu>
#include <QtGui/QAction>
#include <QtGui/QMainWindow>
#include <QtGui/QMessageBox>
#include <QtGui/QHBoxLayout>
#include <QtGui/QLineEdit>
#include <QtGui/QRegExpValidator>
...
...
@@ -219,16 +223,23 @@ public:
emit
changed
();
}
bool
open
(
const
QString
&
fileName
,
quint64
offset
=
0
)
{
bool
open
(
QString
*
errorString
,
const
QString
&
fileName
,
quint64
offset
=
0
)
{
QFile
file
(
fileName
);
if
(
offset
<
static_cast
<
quint64
>
(
file
.
size
())
&&
file
.
open
(
QIODevice
::
ReadOnly
))
{
if
(
offset
>=
static_cast
<
quint64
>
(
file
.
size
()))
return
false
;
if
(
file
.
open
(
QIODevice
::
ReadOnly
))
{
m_fileName
=
fileName
;
m_editor
->
setSizes
(
offset
,
file
.
size
());
m_editor
->
editor
()
->
setDisplayName
(
QFileInfo
(
fileName
).
fileName
());
file
.
close
();
return
true
;
}
QString
errStr
=
tr
(
"Cannot open %1: %2"
).
arg
(
QDir
::
toNativeSeparators
(
fileName
),
file
.
errorString
());
if
(
errorString
)
*
errorString
=
errStr
;
else
QMessageBox
::
critical
(
Core
::
ICore
::
instance
()
->
mainWindow
(),
tr
(
"File Error"
),
errStr
);
return
false
;
}
...
...
@@ -246,19 +257,23 @@ private slots:
data
+=
QByteArray
(
blockSize
-
dataSize
,
0
);
m_editor
->
addData
(
block
,
data
);
file
.
close
();
}
else
{
QMessageBox
::
critical
(
Core
::
ICore
::
instance
()
->
mainWindow
(),
tr
(
"File Error"
),
tr
(
"Cannot open %1: %2"
).
arg
(
QDir
::
toNativeSeparators
(
m_fileName
),
file
.
errorString
()));
}
}
void
provideNewRange
(
Core
::
IEditor
*
,
quint64
offset
)
{
open
(
m_fileName
,
offset
);
open
(
0
,
m_fileName
,
offset
);
}
void
handleStartOfFileRequested
(
Core
::
IEditor
*
)
{
open
(
m_fileName
,
0
);
open
(
0
,
m_fileName
,
0
);
}
void
handleEndOfFileRequested
(
Core
::
IEditor
*
)
{
open
(
m_fileName
,
QFileInfo
(
m_fileName
).
size
()
-
1
);
open
(
0
,
m_fileName
,
QFileInfo
(
m_fileName
).
size
()
-
1
);
}
public:
...
...
@@ -295,16 +310,18 @@ public:
return
BehaviorAsk
;
}
void
reload
(
ReloadFlag
flag
,
ChangeType
type
)
{
bool
reload
(
QString
*
errorString
,
ReloadFlag
flag
,
ChangeType
type
)
{
if
(
flag
==
FlagIgnore
)
return
;
return
true
;
if
(
type
==
TypePermissions
)
{
emit
changed
();
}
else
{
emit
aboutToReload
();
if
(
open
(
m_fileName
))
emit
reloaded
();
if
(
!
open
(
errorString
,
m_fileName
))
return
false
;
emit
reloaded
();
}
return
true
;
}
private:
...
...
@@ -357,8 +374,8 @@ public:
m_file
->
setFilename
(
QString
());
return
true
;
}
bool
open
(
const
QString
&
fileName
=
QString
())
{
return
m_file
->
open
(
fileName
);
bool
open
(
QString
*
errorString
,
const
QString
&
fileName
=
QString
())
{
return
m_file
->
open
(
errorString
,
fileName
);
}
Core
::
IFile
*
file
()
{
return
m_file
;
}
QString
id
()
const
{
return
QLatin1String
(
Core
::
Constants
::
K_DEFAULT_BINARY_EDITOR_ID
);
}
...
...
src/plugins/cmakeprojectmanager/cmakeproject.cpp
View file @
fae7dc95
...
...
@@ -794,10 +794,12 @@ Core::IFile::ReloadBehavior CMakeFile::reloadBehavior(ChangeTrigger state, Chang
return
BehaviorSilent
;
}
void
CMakeFile
::
reload
(
ReloadFlag
flag
,
ChangeType
type
)
bool
CMakeFile
::
reload
(
QString
*
errorString
,
ReloadFlag
flag
,
ChangeType
type
)
{
Q_UNUSED
(
errorString
)
Q_UNUSED
(
flag
)
Q_UNUSED
(
type
)
return
true
;
}
CMakeBuildSettingsWidget
::
CMakeBuildSettingsWidget
(
CMakeTarget
*
target
)
...
...
src/plugins/cmakeprojectmanager/cmakeproject.h
View file @
fae7dc95
...
...
@@ -211,7 +211,7 @@ public:
bool
isSaveAsAllowed
()
const
;
ReloadBehavior
reloadBehavior
(
ChangeTrigger
state
,
ChangeType
type
)
const
;
void
reload
(
ReloadFlag
flag
,
ChangeType
type
);
bool
reload
(
QString
*
errorString
,
ReloadFlag
flag
,
ChangeType
type
);
void
rename
(
const
QString
&
newName
);
...
...
src/plugins/coreplugin/editormanager/editormanager.cpp
View file @
fae7dc95
...
...
@@ -1217,9 +1217,10 @@ IEditor *EditorManager::openEditor(Core::Internal::EditorView *view, const QStri
// back to the default editor:
if
(
!
editor
)
editor
=
createEditor
(
QString
(),
fn
);
if
(
!
editor
||
!
editor
->
open
(
fn
))
{
QString
errorString
;
if
(
!
editor
||
!
editor
->
open
(
&
errorString
,
fn
))
{
QApplication
::
restoreOverrideCursor
();
QMessageBox
::
critical
(
m_d
->
m_core
->
mainWindow
(),
tr
(
"
Opening File"
),
tr
(
"Cannot open file %1!"
).
arg
(
QDir
::
toNativeSeparators
(
fn
))
);
QMessageBox
::
critical
(
m_d
->
m_core
->
mainWindow
(),
tr
(
"
File Error"
),
errorString
);
delete
editor
;
editor
=
0
;
return
0
;
...
...
@@ -1843,7 +1844,9 @@ void EditorManager::revertToSaved()
return
;
}
currEditor
->
file
()
->
reload
(
IFile
::
FlagReload
,
IFile
::
TypeContents
);
QString
errorString
;
if
(
!
currEditor
->
file
()
->
reload
(
&
errorString
,
IFile
::
FlagReload
,
IFile
::
TypeContents
))
QMessageBox
::
critical
(
m_d
->
m_core
->
mainWindow
(),
tr
(
"File Error"
),
errorString
);
}
void
EditorManager
::
showEditorInfoBar
(
const
QString
&
id
,
...
...
src/plugins/coreplugin/editormanager/ieditor.h
View file @
fae7dc95
...
...
@@ -50,7 +50,7 @@ public:
virtual
~
IEditor
()
{}
virtual
bool
createNew
(
const
QString
&
contents
=
QString
())
=
0
;
virtual
bool
open
(
const
QString
&
fileName
=
QString
())
=
0
;
virtual
bool
open
(
QString
*
errorString
,
const
QString
&
fileName
=
QString
())
=
0
;
virtual
IFile
*
file
()
=
0
;
virtual
QString
id
()
const
=
0
;
virtual
QString
displayName
()
const
=
0
;
...
...
src/plugins/coreplugin/filemanager.cpp
View file @
fae7dc95
...
...
@@ -912,6 +912,7 @@ void FileManager::checkForReload()
}
// handle the IFiles
QStringList
errorStrings
;
foreach
(
IFile
*
file
,
changedIFiles
)
{
IFile
::
ChangeTrigger
behavior
=
IFile
::
TriggerInternal
;
IFile
::
ChangeType
type
=
IFile
::
TypePermissions
;
...
...
@@ -958,21 +959,23 @@ void FileManager::checkForReload()
// handle it!
d
->
m_blockedIFile
=
file
;
bool
success
=
true
;
QString
errorString
;
// we've got some modification
// check if it's contents or permissions:
if
(
type
==
IFile
::
TypePermissions
)
{
// Only permission change
file
->
reload
(
IFile
::
FlagReload
,
IFile
::
TypePermissions
);
success
=
file
->
reload
(
&
errorString
,
IFile
::
FlagReload
,
IFile
::
TypePermissions
);
// now we know it's a content change or file was removed
}
else
if
(
defaultBehavior
==
IFile
::
ReloadUnmodified
&&
type
==
IFile
::
TypeContents
&&
!
file
->
isModified
())
{
// content change, but unmodified (and settings say to reload in this case)
file
->
reload
(
IFile
::
FlagReload
,
type
);
success
=
file
->
reload
(
&
errorString
,
IFile
::
FlagReload
,
type
);
// file was removed or it's a content change and the default behavior for
// unmodified files didn't kick in
}
else
if
(
defaultBehavior
==
IFile
::
IgnoreAll
)
{
// content change or removed, but settings say ignore
file
->
reload
(
IFile
::
FlagIgnore
,
type
);
success
=
file
->
reload
(
&
errorString
,
IFile
::
FlagIgnore
,
type
);
// either the default behavior is to always ask,
// or the ReloadUnmodified default behavior didn't kick in,
// so do whatever the IFile wants us to do
...
...
@@ -980,27 +983,27 @@ void FileManager::checkForReload()
// check if IFile wants us to ask
if
(
file
->
reloadBehavior
(
behavior
,
type
)
==
IFile
::
BehaviorSilent
)
{
// content change or removed, IFile wants silent handling
file
->
reload
(
IFile
::
FlagReload
,
type
);
success
=
file
->
reload
(
&
errorString
,
IFile
::
FlagReload
,
type
);
// IFile wants us to ask
}
else
if
(
type
==
IFile
::
TypeContents
)
{
// content change, IFile wants to ask user
if
(
previousAnswer
==
Utils
::
ReloadNone
)
{
// answer already given, ignore
file
->
reload
(
IFile
::
FlagIgnore
,
IFile
::
TypeContents
);
success
=
file
->
reload
(
&
errorString
,
IFile
::
FlagIgnore
,
IFile
::
TypeContents
);
}
else
if
(
previousAnswer
==
Utils
::
ReloadAll
)
{
// answer already given, reload
file
->
reload
(
IFile
::
FlagReload
,
IFile
::
TypeContents
);
success
=
file
->
reload
(
&
errorString
,
IFile
::
FlagReload
,
IFile
::
TypeContents
);
}
else
{
// Ask about content change
previousAnswer
=
Utils
::
reloadPrompt
(
file
->
fileName
(),
file
->
isModified
(),
QApplication
::
activeWindow
());
switch
(
previousAnswer
)
{
case
Utils
::
ReloadAll
:
case
Utils
::
ReloadCurrent
:
file
->
reload
(
IFile
::
FlagReload
,
IFile
::
TypeContents
);
success
=
file
->
reload
(
&
errorString
,
IFile
::
FlagReload
,
IFile
::
TypeContents
);
break
;
case
Utils
::
ReloadSkipCurrent
:
case
Utils
::
ReloadNone
:
file
->
reload
(
IFile
::
FlagIgnore
,
IFile
::
TypeContents
);
success
=
file
->
reload
(
&
errorString
,
IFile
::
FlagIgnore
,
IFile
::
TypeContents
);
break
;
}
}
...
...
@@ -1031,12 +1034,21 @@ void FileManager::checkForReload()
}
}
}
if
(
!
success
)
{
if
(
errorString
.
isEmpty
())
errorStrings
<<
tr
(
"Cannot reload %1"
).
arg
(
QDir
::
toNativeSeparators
(
file
->
fileName
()));
else
errorStrings
<<
errorString
;
}
// update file info, also handling if e.g. link target has changed
removeFileInfo
(
file
);
addFileInfo
(
file
);
d
->
m_blockedIFile
=
0
;
}
if
(
!
errorStrings
.
isEmpty
())
QMessageBox
::
critical
(
d
->
m_mainWindow
,
tr
(
"File Error"
),
errorStrings
.
join
(
QLatin1String
(
"
\n
"
)));
// handle deleted files
EditorManager
::
instance
()
->
closeEditors
(
editorsToClose
,
false
);
...
...
src/plugins/coreplugin/ifile.h
View file @
fae7dc95
...
...
@@ -95,7 +95,7 @@ public:
virtual
bool
isSaveAsAllowed
()
const
=
0
;
virtual
ReloadBehavior
reloadBehavior
(
ChangeTrigger
state
,
ChangeType
type
)
const
=
0
;
virtual
void
reload
(
ReloadFlag
flag
,
ChangeType
type
)
=
0
;
virtual
bool
reload
(
QString
*
errorString
,
ReloadFlag
flag
,
ChangeType
type
)
=
0
;
virtual
void
rename
(
const
QString
&
newName
)
=
0
;
virtual
void
checkPermissions
()
{}
...
...
src/plugins/cppeditor/cppeditor.cpp
View file @
fae7dc95
...
...
@@ -1787,9 +1787,9 @@ QString CPPEditor::id() const
return
QLatin1String
(
CppEditor
::
Constants
::
CPPEDITOR_ID
);
}
bool
CPPEditor
::
open
(
const
QString
&
fileName
)
bool
CPPEditor
::
open
(
QString
*
errorString
,
const
QString
&
fileName
)
{
bool
b
=
TextEditor
::
BaseTextEditor
::
open
(
fileName
);
bool
b
=
TextEditor
::
BaseTextEditor
::
open
(
errorString
,
fileName
);
editorWidget
()
->
setMimeType
(
Core
::
ICore
::
instance
()
->
mimeDatabase
()
->
findByFile
(
QFileInfo
(
fileName
)).
type
());
return
b
;
}
...
...
src/plugins/cppeditor/cppeditor.h
View file @
fae7dc95
...
...
@@ -152,7 +152,7 @@ public:
QString
id
()
const
;
bool
isTemporary
()
const
{
return
false
;
}
virtual
bool
open
(
const
QString
&
fileName
);
virtual
bool
open
(
QString
*
errorString
,
const
QString
&
fileName
);
};
class
CPPEditorWidget
:
public
TextEditor
::
BaseTextEditorWidget
...
...
src/plugins/designer/formwindoweditor.cpp
View file @
fae7dc95
...
...
@@ -46,6 +46,7 @@
#include <texteditor/plaintexteditor.h>
#include <utils/qtcassert.h>
#include <utils/fileutils.h>
#include <QtDesigner/QDesignerFormWindowInterface>
...
...
@@ -79,7 +80,7 @@ FormWindowEditor::FormWindowEditor(Internal::DesignerXmlEditor *editor,
connect
(
form
,
SIGNAL
(
changed
()),
this
,
SIGNAL
(
changed
()));
// Revert to saved/load externally modified files.
connect
(
&
d
->
m_file
,
SIGNAL
(
reload
(
QString
)),
this
,
SLOT
(
slotOpen
(
QString
)));
connect
(
&
d
->
m_file
,
SIGNAL
(
reload
(
QString
*
,
QString
)),
this
,
SLOT
(
slotOpen
(
QString
*
,
QString
)));
// Force update of open editors model.
connect
(
&
d
->
m_file
,
SIGNAL
(
saved
()),
this
,
SIGNAL
(
changed
()));
connect
(
&
d
->
m_file
,
SIGNAL
(
changed
()),
this
,
SIGNAL
(
changed
()));
...
...
@@ -126,12 +127,12 @@ bool FormWindowEditor::createNew(const QString &contents)
return
true
;
}
void
FormWindowEditor
::
slotOpen
(
const
QString
&
fileName
)
void
FormWindowEditor
::
slotOpen
(
QString
*
errorString
,
const
QString
&
fileName
)
{
open
(
fileName
);
open
(
errorString
,
fileName
);
}
bool
FormWindowEditor
::
open
(
const
QString
&
fileName
)
bool
FormWindowEditor
::
open
(
QString
*
errorString
,
const
QString
&
fileName
)
{
if
(
Designer
::
Constants
::
Internal
::
debug
)
qDebug
()
<<
"FormWindowEditor::open"
<<
fileName
;
...
...
@@ -147,15 +148,14 @@ bool FormWindowEditor::open(const QString &fileName)
const
QFileInfo
fi
(
fileName
);
const
QString
absfileName
=
fi
.
absoluteFilePath
();
QFile
file
(
absfileName
)
;
if
(
!
file
.
open
(
QIODevice
::
ReadOnly
|
QIODevice
::
Text
))
Utils
::
FileReader
reader
;
if
(
!
reader
.
fetch
(
absfileName
,
QIODevice
::
Text
,
errorString
))
return
false
;
form
->
setFileName
(
absfileName
);
const
QString
contents
=
QString
::
fromUtf8
(
file
.
readAll
());
const
QString
contents
=
QString
::
fromUtf8
(
reader
.
data
());
form
->
setContents
(
contents
);
file
.
close
();
if
(
!
form
->
mainContainer
())
return
false
;
form
->
setDirty
(
false
);
...
...
src/plugins/designer/formwindoweditor.h
View file @
fae7dc95
...
...
@@ -71,7 +71,7 @@ public:
// IEditor
virtual
bool
createNew
(
const
QString
&
contents
=
QString
());
virtual
bool
open
(
const
QString
&
fileName
=
QString
());
virtual
bool
open
(
QString
*
errorString
,
const
QString
&
fileName
=
QString
());
virtual
Core
::
IFile
*
file
();
virtual
QString
id
()
const
;
virtual
QString
displayName
()
const
;
...
...
@@ -100,7 +100,7 @@ public slots:
void
configureXmlEditor
()
const
;
private
slots
:
void
slotOpen
(
const
QString
&
fileName
);
void
slotOpen
(
QString
*
errorString
,
const
QString
&
fileName
);
private:
void
syncXmlEditor
(
const
QString
&
contents
);
...
...
src/plugins/designer/formwindowfile.cpp
View file @
fae7dc95
...
...
@@ -141,17 +141,20 @@ Core::IFile::ReloadBehavior FormWindowFile::reloadBehavior(ChangeTrigger state,
return
BehaviorAsk
;
}
void
FormWindowFile
::
reload
(
ReloadFlag
flag
,
ChangeType
type
)
bool
FormWindowFile
::
reload
(
QString
*
errorString
,
ReloadFlag
flag
,
ChangeType
type
)
{
if
(
flag
==
FlagIgnore
)
return
;
return
true
;
if
(
type
==
TypePermissions
)
{
emit
changed
();
}
else
{
emit
aboutToReload
();
emit
reload
(
m_fileName
);
emit
reload
(
errorString
,
m_fileName
);
if
(
!
errorString
->
isEmpty
())
return
false
;
emit
reloaded
();
}
return
true
;
}
QString
FormWindowFile
::
defaultPath
()
const
...
...
src/plugins/designer/formwindowfile.h
View file @
fae7dc95
...
...
@@ -59,7 +59,7 @@ public:
virtual
bool
isReadOnly
()
const
;
virtual
bool
isSaveAsAllowed
()
const
;
ReloadBehavior
reloadBehavior
(
ChangeTrigger
state
,
ChangeType
type
)
const
;
void
reload
(
ReloadFlag
flag
,
ChangeType
type
);
bool
reload
(
QString
*
errorString
,
ReloadFlag
flag
,
ChangeType
type
);
virtual
QString
defaultPath
()
const
;
virtual
QString
suggestedFileName
()
const
;
virtual
QString
mimeType
()
const
;
...
...
@@ -75,7 +75,7 @@ public:
signals:
// Internal
void
saved
();
void
reload
(
const
QString
&
);
void
reload
(
QString
*
errorString
,
const
QString
&
);
void
setDisplayName
(
const
QString
&
);
public
slots
:
...
...
src/plugins/genericprojectmanager/genericproject.cpp
View file @
fae7dc95
...
...
@@ -619,8 +619,10 @@ Core::IFile::ReloadBehavior GenericProjectFile::reloadBehavior(ChangeTrigger sta
return
BehaviorSilent
;
}
void
GenericProjectFile
::
reload
(
ReloadFlag
flag
,
ChangeType
type
)
bool
GenericProjectFile
::
reload
(
QString
*
errorString
,
ReloadFlag
flag
,
ChangeType
type
)
{
Q_UNUSED
(
errorString
)
Q_UNUSED
(
flag
)
Q_UNUSED
(
type
)
return
true
;
}
src/plugins/genericprojectmanager/genericproject.h
View file @
fae7dc95
...
...
@@ -172,7 +172,7 @@ public:
virtual
void
rename
(
const
QString
&
newName
);
ReloadBehavior
reloadBehavior
(
ChangeTrigger
state
,
ChangeType
type
)
const
;
void
reload
(
ReloadFlag
flag
,
ChangeType
type
);
bool
reload
(
QString
*
errorString
,
ReloadFlag
flag
,
ChangeType
type
);
private:
GenericProject
*
m_project
;
...
...
src/plugins/glsleditor/glsleditor.cpp
View file @
fae7dc95
...
...
@@ -205,10 +205,10 @@ QString GLSLEditorEditable::id() const
return
QLatin1String
(
GLSLEditor
::
Constants
::
C_GLSLEDITOR_ID
);
}
bool
GLSLEditorEditable
::
open
(
const
QString
&
fileName
)
bool
GLSLEditorEditable
::
open
(
QString
*
errorString
,
const
QString
&
fileName
)
{
editorWidget
()
->
setMimeType
(
Core
::
ICore
::
instance
()
->
mimeDatabase
()
->
findByFile
(
QFileInfo
(
fileName
)).
type
());
bool
b
=
TextEditor
::
BaseTextEditor
::
open
(
fileName
);
bool
b
=
TextEditor
::
BaseTextEditor
::
open
(
errorString
,
fileName
);
return
b
;
}
...
...
src/plugins/glsleditor/glsleditoreditable.h
View file @
fae7dc95
...
...
@@ -51,7 +51,7 @@ public:
Core
::
IEditor
*
duplicate
(
QWidget
*
parent
);
QString
id
()
const
;
bool
isTemporary
()
const
{
return
false
;
}
virtual
bool
open
(
const
QString
&
fileName
);
virtual
bool
open
(
QString
*
errorString
,
const
QString
&
fileName
);
virtual
QString
preferredModeType
()
const
;
};
...
...
src/plugins/imageviewer/imageviewer.cpp
View file @
fae7dc95
...
...
@@ -45,6 +45,7 @@
#include <QtCore/QMap>
#include <QtCore/QFileInfo>
#include <QtCore/QDir>
#include <QtGui/QWidget>
#include <QtCore/QtDebug>
...
...
@@ -116,10 +117,12 @@ bool ImageViewer::createNew(const QString &contents)
return
false
;
}
bool
ImageViewer
::
open
(
const
QString
&
fileName
)
bool
ImageViewer
::
open
(
QString
*
errorString
,
const
QString
&
fileName
)
{
if
(
!
d_ptr
->
imageView
->
openFile
(
fileName
))
if
(
!
d_ptr
->
imageView
->
openFile
(
fileName
))
{
*
errorString
=
tr
(
"Cannot open image file %1"
).
arg
(
QDir
::
toNativeSeparators
(
fileName
));
return
false
;
}
setDisplayName
(
QFileInfo
(
fileName
).
fileName
());
d_ptr
->
file
->
setFileName
(
fileName
);
// d_ptr->file->setMimeType
...
...
src/plugins/imageviewer/imageviewer.h
View file @
fae7dc95
...
...
@@ -56,7 +56,7 @@ public:
~
ImageViewer
();
bool
createNew
(
const
QString
&
contents
=
QString
());
bool
open
(
const
QString
&
fileName
=
QString
());
bool
open
(
QString
*
errorString
,
const
QString
&
fileName
=
QString
());
Core
::
IFile
*
file
();
QString
id
()
const
;
QString
displayName
()
const
;
...
...
src/plugins/imageviewer/imageviewerfile.cpp
View file @
fae7dc95
...
...
@@ -74,15 +74,17 @@ Core::IFile::ReloadBehavior ImageViewerFile::reloadBehavior(Core::IFile::ChangeT
return
BehaviorAsk
;
}
void
ImageViewerFile
::
reload
(
Core
::
IFile
::
ReloadFlag
flag
,
bool
ImageViewerFile
::
reload
(
QString
*
errorString
,
Core
::
IFile
::
ReloadFlag
flag
,
Core
::
IFile
::
ChangeType
type
)
{
if
(
flag
==
FlagIgnore
)
return
;
return
true
;
if
(
type
==
TypePermissions
)
{
emit
changed
();
return
true
;
}
else
{
d_ptr
->
editor
->
open
(
d_ptr
->
fileName
);
return
d_ptr
->
editor
->
open
(
errorString
,
d_ptr
->
fileName
);
}
}
...
...
src/plugins/imageviewer/imageviewerfile.h
View file @
fae7dc95
...
...
@@ -62,7 +62,7 @@ public:
bool
isSaveAsAllowed
()
const
;
ReloadBehavior
reloadBehavior
(
ChangeTrigger
state
,
ChangeType
type
)
const
;
void
reload
(
ReloadFlag
flag
,
ChangeType
type
);
bool
reload
(
QString
*
errorString
,
ReloadFlag
flag
,
ChangeType
type
);
void
setMimetype
(
const
QString
&
mimetype
);
void
setFileName
(
const
QString
&
filename
);
...
...
src/plugins/qmljseditor/qmljseditor.cpp
View file @
fae7dc95
...
...
@@ -740,9 +740,9 @@ QString QmlJSEditorEditable::id() const
return
QLatin1String
(
QmlJSEditor
::
Constants
::
C_QMLJSEDITOR_ID
);
}
bool
QmlJSEditorEditable
::
open
(
const
QString
&
fileName
)
bool
QmlJSEditorEditable
::
open
(
QString
*
errorString
,
const
QString
&
fileName
)
{
bool
b
=
TextEditor
::
BaseTextEditor
::
open
(
fileName
);
bool
b
=
TextEditor
::
BaseTextEditor
::
open
(
errorString
,
fileName
);
editorWidget
()
->
setMimeType
(
Core
::
ICore
::
instance
()
->
mimeDatabase
()
->
findByFile
(
QFileInfo
(
fileName
)).
type
());
return
b
;
}
...
...
src/plugins/qmljseditor/qmljseditoreditable.h
View file @
fae7dc95
...
...
@@ -50,7 +50,7 @@ public:
Core
::
IEditor
*
duplicate
(
QWidget
*
parent
);
QString
id
()
const
;
bool
isTemporary
()
const
{
return
false
;
}
virtual
bool
open
(
const
QString
&
fileName
);
virtual
bool
open
(
QString
*
errorString
,
const
QString
&
fileName
);
virtual
QString
preferredModeType
()
const
;
void
setTextCodec
(
QTextCodec
*
codec
,
TextCodecReason
=
TextCodecOtherReason
);
};
...
...
src/plugins/qmlprojectmanager/qmlprojectfile.cpp
View file @
fae7dc95
...
...
@@ -100,10 +100,12 @@ Core::IFile::ReloadBehavior QmlProjectFile::reloadBehavior(ChangeTrigger state,
return
BehaviorSilent
;
}
void
QmlProjectFile
::
reload
(
ReloadFlag
flag
,
ChangeType
type
)
bool
QmlProjectFile
::
reload
(
QString
*
errorString
,
ReloadFlag
flag
,
ChangeType
type
)
{
Q_UNUSED
(
errorString
)
Q_UNUSED
(
flag
)
Q_UNUSED
(
type
)
return
true
;
}
}
// namespace Internal
...
...
src/plugins/qmlprojectmanager/qmlprojectfile.h
View file @
fae7dc95
...
...
@@ -62,7 +62,7 @@ public:
virtual
bool
isSaveAsAllowed
()
const
;
ReloadBehavior
reloadBehavior
(
ChangeTrigger
state
,
ChangeType
type
)
const
;
void
reload
(
ReloadFlag
flag
,
ChangeType
type
);
bool
reload
(
QString
*
errorString
,
ReloadFlag
flag
,
ChangeType
type
);
private:
QmlProject
*
m_project
;
...
...
src/plugins/qt4projectmanager/qt4nodes.cpp
View file @
fae7dc95
...
...
@@ -231,13 +231,14 @@ Core::IFile::ReloadBehavior Qt4PriFile::reloadBehavior(ChangeTrigger state, Chan
return
BehaviorSilent
;
}
void
Qt4PriFile
::
reload
(
ReloadFlag
flag
,
ChangeType
type
)
bool
Qt4PriFile
::
reload
(
QString
*
errorString
,
ReloadFlag
flag
,
ChangeType
type
)
{
Q_UNUSED
(
errorString
)
Q_UNUSED
(
flag
)
Q_UNUSED
(
type
)
if
(
type
==
TypePermissions
)
return
;
return
true
;
m_priFile
->
scheduleUpdate
();
return
true
;
}
/*!
...
...
@@ -1130,11 +1131,17 @@ void Qt4PriFileNode::changeFiles(const FileType fileType,
// So the modification time might not change between those two saves.
// We manually tell each editor to reload it's file.
// (The .pro files are notified by the file system watcher.)
QStringList
errorStrings
;
foreach
(
Core
::
IEditor
*
editor
,
Core
::
ICore
::
instance
()
->
editorManager
()
->
editorsForFileName
(
m_projectFilePath
))
{
if
(
Core
::
IFile
*
editorFile
=
editor
->
file
())
{
editorFile
->
reload
(
Core
::
IFile
::
FlagReload
,
Core
::
IFile
::
TypeContents
);
QString
errorString
;
if
(
!
editorFile
->
reload
(
&
errorString
,
Core
::
IFile
::
FlagReload
,
Core
::
IFile
::
TypeContents
))
errorStrings
<<
errorString
;
}
}
if
(
!
errorStrings
.
isEmpty
())
QMessageBox
::
warning
(
Core
::
ICore
::
instance
()
->
mainWindow
(),
tr
(
"File Error"
),
errorStrings
.
join
(
QLatin1String
(
"
\n
"
)));
includeFile
->
deref
();
}
...
...
src/plugins/qt4projectmanager/qt4nodes.h
View file @
fae7dc95
...
...
@@ -128,7 +128,7 @@ public:
virtual
bool
isSaveAsAllowed
()
const
;
ReloadBehavior
reloadBehavior
(
ChangeTrigger
state
,
ChangeType
type
)
const
;
void
reload
(
ReloadFlag
flag
,
ChangeType
type
);
bool
reload
(
QString
*
errorString
,
ReloadFlag
flag
,
ChangeType
type
);