@@ -20,6 +20,7 @@ public class Layouts.QuickAdd : Adw.Bin {
20
20
21
21
public bool ctrl_pressed { get ; set ; default = false ; }
22
22
public bool shift_pressed { get ; set ; default = false ; }
23
+ public bool create_more { get ; set ; default = Services . Settings . get_default (). settings. get_boolean (" quick-add-create-more" ); }
23
24
24
25
public QuickAdd (bool is_window_quick_add = false ) {
25
26
Object (
@@ -215,7 +216,6 @@ public class Layouts.QuickAdd : Adw.Bin {
215
216
return GLib . Source . REMOVE ;
216
217
});
217
218
218
- content_entry. activate. connect (add_item);
219
219
submit_button. clicked. connect (add_item);
220
220
221
221
project_picker_button. project_change. connect ((project) = > {
@@ -259,6 +259,23 @@ public class Layouts.QuickAdd : Adw.Bin {
259
259
return false ;
260
260
});
261
261
262
+ content_entry. activate. connect (() = > {
263
+ create_more = Services . Settings . get_default (). settings. get_boolean (" quick-add-create-more" );
264
+ add_item ();
265
+ });
266
+
267
+ var content_controller_key = new Gtk .EventControllerKey ();
268
+ content_entry. add_controller (content_controller_key);
269
+ content_controller_key. key_pressed. connect ((keyval, keycode, state) = > {
270
+ if (keyval == 65293 && (ctrl_pressed || shift_pressed)) {
271
+ create_more = true ;
272
+ add_item ();
273
+ return false ;
274
+ }
275
+
276
+ return false ;
277
+ });
278
+
262
279
var description_controller_key = new Gtk .EventControllerKey ();
263
280
description_textview. add_controller (description_controller_key);
264
281
description_controller_key. key_pressed. connect ((keyval, keycode, state) = > {
@@ -306,6 +323,10 @@ public class Layouts.QuickAdd : Adw.Bin {
306
323
if (item. project. backend_type == BackendType . LOCAL ) {
307
324
item. id = Util . get_default (). generate_id ();
308
325
add_item_db (item);
326
+
327
+ if (item. parent_id != " " ) {
328
+ item. parent. collapsed = true ;
329
+ }
309
330
} else if (item. project. backend_type == BackendType . TODOIST ) {
310
331
submit_button. is_loading = true ;
311
332
Services . Todoist . get_default (). add. begin (item, (obj, res) = > {
@@ -315,6 +336,10 @@ public class Layouts.QuickAdd : Adw.Bin {
315
336
if (response. status) {
316
337
item. id = response. data;
317
338
add_item_db (item);
339
+
340
+ if (item. parent_id != " " ) {
341
+ item. parent. collapsed = true ;
342
+ }
318
343
}
319
344
});
320
345
} else if (item. project. backend_type == BackendType . CALDAV ) {
@@ -326,6 +351,10 @@ public class Layouts.QuickAdd : Adw.Bin {
326
351
327
352
if (response. status) {
328
353
add_item_db (item);
354
+
355
+ if (item. parent_id != " " ) {
356
+ item. parent. collapsed = true ;
357
+ }
329
358
}
330
359
});
331
360
}
@@ -336,7 +365,7 @@ public class Layouts.QuickAdd : Adw.Bin {
336
365
added_image. add_css_class (" fancy-turn-animation" );
337
366
338
367
Timeout . add (750 , () = > {
339
- if (Services . Settings . get_default () . settings . get_boolean ( " quick-add-create-more " ) ) {
368
+ if (create_more ) {
340
369
main_stack. visible_child_name = " main" ;
341
370
added_image. remove_css_class (" fancy-turn-animation" );
342
371
0 commit comments