[education/rkward/devel/workspace_output] /: Actually clean up output dirs on exit.
Thomas Friedrichsmeier
null at kde.org
Tue Jan 12 08:20:13 GMT 2021
Git commit 03b02963c7bfac48f3896bc6684db72a6e661cc1 by Thomas Friedrichsmeier.
Committed on 12/01/2021 at 08:19.
Pushed by tfry into branch 'devel/workspace_output'.
Actually clean up output dirs on exit.
M +1 -2 ChangeLog
M +4 -10 rkward/misc/rkoutputdirectory.cpp
M +1 -1 rkward/misc/rkoutputdirectory.h
https://invent.kde.org/education/rkward/commit/03b02963c7bfac48f3896bc6684db72a6e661cc1
diff --git a/ChangeLog b/ChangeLog
index 0e9684a5..c712d88b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,9 +1,8 @@
TODOS for autotests:
- - Check an update the standards.
+ - Check and update the standards files
- Use options(warn=1), in order to get warnings into the test?
TODOS for output directories:
- - Make sure not to activate default output while quitting (abouttoquit is too late)
- save outputs to .rkworkplace and restore them
- UI
diff --git a/rkward/misc/rkoutputdirectory.cpp b/rkward/misc/rkoutputdirectory.cpp
index 9e299a3f..7b8beb9e 100644
--- a/rkward/misc/rkoutputdirectory.cpp
+++ b/rkward/misc/rkoutputdirectory.cpp
@@ -307,7 +307,7 @@ QString RKOutputDirectory::caption() const {
return i18n("Unsaved output");
}
-GenericRRequestResult RKOutputDirectory::purge(RKOutputDirectory::OverwriteBehavior discard, RCommandChain* chain) {
+GenericRRequestResult RKOutputDirectory::purge(RKOutputDirectory::OverwriteBehavior discard, RCommandChain* chain, bool activate_other) {
RK_TRACE(APP);
if (isModified()) {
@@ -326,19 +326,13 @@ GenericRRequestResult RKOutputDirectory::purge(RKOutputDirectory::OverwriteBehav
}
}
- bool active = isActive();
+ bool activate = activate_other && isActive();
QDir dir(work_dir);
dir.removeRecursively();
outputs.remove(id);
deleteLater();
GenericRRequestResult messages;
- if (active) {
- if (RKQuitAgent::quittingInProgress()) {
- RK_DEBUG(APP, DL_DEBUG, "Skipping activation of new output file: quitting in progress");
- } else {
- getCurrentOutput(chain, &messages)->activate(chain);
- }
- }
+ if (activate) getCurrentOutput(chain, &messages);
return messages;
}
@@ -347,7 +341,7 @@ void RKOutputDirectory::purgeAllNoAsk() {
auto outputs_copy = outputs;
for (auto it = outputs_copy.constBegin(); it != outputs_copy.constEnd(); ++it) {
- auto res = outputs.constBegin().value()->purge(Force);
+ auto res = outputs.constBegin().value()->purge(Force, nullptr, false);
RK_ASSERT(!res.failed());
}
}
diff --git a/rkward/misc/rkoutputdirectory.h b/rkward/misc/rkoutputdirectory.h
index 8d0d125e..6e558927 100644
--- a/rkward/misc/rkoutputdirectory.h
+++ b/rkward/misc/rkoutputdirectory.h
@@ -43,7 +43,7 @@ public:
GenericRRequestResult save(const QString& dest=QString(), OverwriteBehavior overwrite=Ask);
GenericRRequestResult exportAs(const QString& dest=QString(), OverwriteBehavior overwrite=Ask);
GenericRRequestResult clear(OverwriteBehavior discard=Ask);
- GenericRRequestResult purge(OverwriteBehavior discard=Ask, RCommandChain* chain=0);
+ GenericRRequestResult purge(OverwriteBehavior discard=Ask, RCommandChain* chain=0, bool activate_other=true);
QString getId() const { return id; };
bool isEmpty() const;
bool isActive() const;
More information about the rkward-tracker
mailing list