aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui/widgets/EditorPage.cpp
diff options
context:
space:
mode:
authorSaturneric <[email protected]>2021-12-02 22:44:09 +0000
committerSaturneric <[email protected]>2021-12-04 19:28:28 +0000
commitea7c0113486f336f3fe14435e1ce5eb55ad4eca9 (patch)
tree8f1c5c61be4d55df5e7efad79e16f9c0212510db /src/ui/widgets/EditorPage.cpp
parentFixed (diff)
downloadGpgFrontend-ea7c0113486f336f3fe14435e1ce5eb55ad4eca9.tar.gz
GpgFrontend-ea7c0113486f336f3fe14435e1ce5eb55ad4eca9.zip
Fixed
1. Ci Fixed for New Version. 2. Bugs fixed for cross-platform. 3. Bugs fixed for i18n.
Diffstat (limited to '')
-rw-r--r--src/ui/widgets/EditorPage.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/ui/widgets/EditorPage.cpp b/src/ui/widgets/EditorPage.cpp
index eeedfaf5..94c98036 100644
--- a/src/ui/widgets/EditorPage.cpp
+++ b/src/ui/widgets/EditorPage.cpp
@@ -107,9 +107,11 @@ void EditorPage::slotFormatGpgHeader() {
cursor.setCharFormat(signFormat);
}
-void EditorPage::readFile() {
+void EditorPage::ReadFile() {
LOG(INFO) << "Called";
+ readDone = false;
+
auto text_page = this->getTextPage();
text_page->setReadOnly(true);
auto thread = new FileReadThread(this->fullFilePath.toStdString());
@@ -126,19 +128,27 @@ void EditorPage::readFile() {
connect(thread, &FileReadThread::finished, this, [=]() {
LOG(INFO) << "Thread finished";
thread->deleteLater();
+ readDone = true;
+ readThread = nullptr;
});
- connect(this, &FileReadThread::destroyed, [=]() {
+ connect(this, &EditorPage::destroyed, [=]() {
LOG(INFO) << "RequestInterruption for readThread";
thread->requestInterruption();
- thread->deleteLater();
+ readThread = nullptr;
});
-
+ this->readThread = thread;
thread->start();
}
void EditorPage::slotInsertText(const QString& text) {
this->getTextPage()->insertPlainText(text);
}
+void EditorPage::PrepareToDestroy() {
+ if (readThread) {
+ readThread->requestInterruption();
+ readThread = nullptr;
+ }
+}
} // namespace GpgFrontend::UI