Bug 356142

Summary: The complex file opening flow: need refactored?
Product: [Applications] KBibTeX Reporter: Shunsuke Shimizu <grafi>
Component: GeneralAssignee: Thomas Fischer <fischer>
Status: CONFIRMED ---    
Severity: wishlist CC: syevale
Priority: NOR    
Version First Reported In: git (master)   
Target Milestone: ---   
Platform: Other   
OS: Linux   
URL: https://www.sevenmentor.com/ccna-course-in-pune-area.php
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Shunsuke Shimizu 2015-12-01 06:10:36 UTC
The flow of opening a file is too complex and seems to be required refactoring.
As I understand the current procedure is roughly following:

1. `openDocument` defined in `mainwindow.cpp` is called
2. `setCurrentFile` defined in `openfileinfo.cpp` is tail-called
3. `currentChanged` is tail-emitted 
4. `setFile` defined in `mdiwidget.cpp` recieves
5. `setFile` calls `part` defined in `openfileinfo.cpp`
6. `setFile` does complex process
7. `activePartChanged` is emitted
8. `createGUI` in `mainwindow.cpp` recieves

I thing the all 2-7 can be done in `openfileinfo.cpp` straightforwardly. Just following:

2. `setCurrentFile` defined in `openfileinfo.cpp` is tail-called
3. `setCurrentFile` calls `part` defined in `openfileinfo.cpp`
4. `setCurrentFile` does complex process
5. `activePartChanged` is emitted (from `setCurrentFile`)
6. `createGUI` in `mainwindow.cpp` and `partChanged` (or so) in `mdiwidget.cpp`  receive
7.  In `mdiwidget.cpp`, `partChanged` (or so) calls `addWidget`(widget)

After all, it seems currently mdiWidget does too many jobs. It shouldn't create or validate parts.
The definition of MDIWidget is also combined with the welcome widget. It can be separated, as I understand.

In addition, seemingly it is assumed that the parent of KPart may vary, with checking of the parent. However it isn't always mdiWidget?

I think I can patch them (if time permits), however first of all I don't know whether those are: actually required for intended functionality, kept so as just working, historical thing, or meaningless. I would appreciate your comments.

Shunsuke


Reproducible: Always
Comment 1 Thomas Fischer 2016-12-11 20:33:57 UTC
Yes, this flow is overly complex. Originally, it started with a simple design, which organically grow to its current state.
Right now, I am prioritizing bugs blocking a release of version 0.6, thus I have to postpone this bug for now ...
Comment 2 Shunsuke Shimizu 2016-12-12 00:40:39 UTC
Thanks. Looking forward to see the release of version 0.6!
Comment 3 syevale 2023-09-01 08:31:40 UTC
You may get details on https://www.sevenmentor.com/ccna-course-in-pune-area.php