Bug 356142 - The complex file opening flow: need refactored?
Summary: The complex file opening flow: need refactored?
Status: CONFIRMED
Alias: None
Product: KBibTeX
Classification: Applications
Component: General (other bugs)
Version First Reported In: git (master)
Platform: Other Linux
: NOR wishlist
Target Milestone: ---
Assignee: Thomas Fischer
URL: https://www.sevenmentor.com/ccna-cour...
Keywords:
Depends on:
Blocks:
 
Reported: 2015-12-01 06:10 UTC by Shunsuke Shimizu
Modified: 2023-09-01 08:31 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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