Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
0344b728
Commit
0344b728
authored
Jun 22, 2010
by
Roberto Raggi
Browse files
Store the time stamp if necessary.
parent
e0d7e7c5
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/plugins/cppeditor/cpprefactoringchanges.cpp
View file @
0344b728
...
...
@@ -42,6 +42,12 @@ CppRefactoringChanges::CppRefactoringChanges(const Snapshot &snapshot)
m_workingCopy
=
m_modelManager
->
workingCopy
();
}
const
CPlusPlus
::
Snapshot
&
CppRefactoringChanges
::
snapshot
()
const
{
return
m_snapshot
;
}
QStringList
CppRefactoringChanges
::
apply
()
{
const
QStringList
changedFiles
=
TextEditor
::
RefactoringChanges
::
apply
();
...
...
@@ -53,6 +59,8 @@ Document::Ptr CppRefactoringChanges::document(const QString &fileName) const
{
QString
source
;
unsigned
editorRevision
=
0
;
QDateTime
lastModified
;
if
(
m_workingCopy
.
contains
(
fileName
))
{
const
QPair
<
QString
,
unsigned
>
workingCopy
=
m_workingCopy
.
get
(
fileName
);
source
=
workingCopy
.
first
;
...
...
@@ -62,13 +70,19 @@ Document::Ptr CppRefactoringChanges::document(const QString &fileName) const
if
(
!
file
.
open
(
QFile
::
ReadOnly
))
return
Document
::
Ptr
();
lastModified
=
QFileInfo
(
file
).
lastModified
();
source
=
QTextStream
(
&
file
).
readAll
();
// ### FIXME read bytes, and remove the convert below
file
.
close
();
}
const
QByteArray
contents
=
m_snapshot
.
preprocessedCode
(
source
,
fileName
);
Document
::
Ptr
doc
=
m_snapshot
.
documentFromSource
(
contents
,
fileName
);
doc
->
setEditorRevision
(
editorRevision
);
if
(
lastModified
.
isValid
())
doc
->
setLastModified
(
lastModified
);
else
doc
->
setEditorRevision
(
editorRevision
);
doc
->
check
();
return
doc
;
}
src/plugins/cppeditor/cpprefactoringchanges.h
View file @
0344b728
...
...
@@ -46,9 +46,7 @@ public:
virtual
QStringList
apply
();
const
CPlusPlus
::
Snapshot
&
snapshot
()
const
{
return
m_snapshot
;
}
const
CPlusPlus
::
Snapshot
&
snapshot
()
const
;
CPlusPlus
::
Document
::
Ptr
document
(
const
QString
&
fileName
)
const
;
private:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment