- fix: editor's modified state not correctly initiated

- fix: project's modified state not correctly initiated
This commit is contained in:
royqh1979@gmail.com 2021-09-18 11:08:30 +08:00
parent 88ac399b4e
commit deabf1e847
5 changed files with 22 additions and 17 deletions

Binary file not shown.

View File

@ -2791,12 +2791,12 @@ Are you really want to continue?</source>
<message>
<location filename="mainwindow.ui" line="1703"/>
<source>Open Folder in Explorer</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="1712"/>
<source>Open In Terminal</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="98"/>
@ -2975,33 +2975,33 @@ Are you really want to continue?</source>
<message>
<location filename="mainwindow.cpp" line="1479"/>
<source>Rename File</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1487"/>
<location filename="mainwindow.cpp" line="1506"/>
<source>Add Folder</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1503"/>
<source>New folder</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1507"/>
<source>Folder name:</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1521"/>
<source>Rename Folder</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1529"/>
<source>Remove Folder</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="1612"/>
@ -3647,24 +3647,24 @@ Are you really want to continue?</source>
<message>
<location filename="project.cpp" line="1848"/>
<source>File exists</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="project.cpp" line="1849"/>
<source>File &apos;%1&apos; already exists. Delete it now?</source>
<translation type="unfinished"></translation>
<translation>&apos;%1&apos;</translation>
</message>
<message>
<location filename="project.cpp" line="1867"/>
<location filename="project.cpp" line="1887"/>
<source>Remove failed</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="project.cpp" line="1868"/>
<location filename="project.cpp" line="1888"/>
<source>Failed to remove file &apos;%1&apos;</source>
<translation type="unfinished"></translation>
<translation>&apos;%1&apos;</translation>
</message>
</context>
<context>

View File

@ -2003,7 +2003,7 @@ void MainWindow::closeEvent(QCloseEvent *event) {
}
if (mProject) {
mProject = nullptr;
closeProject(false);
}
delete mEditorList;
@ -2991,7 +2991,9 @@ void MainWindow::on_actionOpen_Containing_Folder_triggered()
if (editor) {
QFileInfo info(editor->filename());
if (!info.path().isEmpty()) {
QDesktopServices::openUrl(info.path());
QDesktopServices::openUrl(
QUrl("file:///"+
includeTrailingPathDelimiter(info.path()),QUrl::TolerantMode));
}
}
}
@ -3293,7 +3295,8 @@ void MainWindow::on_actionProject_Open_Folder_In_Explorer_triggered()
{
if (!mProject)
return;
QDesktopServices::openUrl(mProject->directory());
QDesktopServices::openUrl(
QUrl("file:///"+includeTrailingPathDelimiter(mProject->directory()),QUrl::TolerantMode));
}

View File

@ -29,9 +29,10 @@ Project::Project(const QString &filename, const QString &name, QObject *parent)
&EditorList::getContentFromOpenedEditor,pMainWindow->editorList(),
std::placeholders::_1, std::placeholders::_2));
resetCppParser(mParser);
if (name == DEV_INTERNAL_OPEN)
if (name == DEV_INTERNAL_OPEN) {
open();
else {
mModified = false;
} else {
mName = name;
SimpleIni ini;
ini.SetValue("Project","filename", toByteArray(extractRelativePath(directory(),mFilename)));

View File

@ -20,6 +20,7 @@
SynEdit::SynEdit(QWidget *parent) : QAbstractScrollArea(parent)
{
mModified = false;
mPaintLock = 0;
mPainterLock = 0;
mPainting = false;