Warning, /frameworks/kparts/COMMENTS is written in an unsupported language. File is not indexed.

0001 2) provide some way to save/restore the positions of the menu/toolbar(s)
0002    when changing the active part ( I remember Reggie asking for that :)
0003 
0004 (David) Sounds good. I might have a look at that next.
0005 Comment : the menubar is cleared, not destroyed, so it seems we don't have
0006 to do anything for it (it remains where it is). We still need to save
0007 the BarPosition of the toolbars, though (see comment in
0008 KTMainWindowGUIBuilder::createContainer).
0009 (David) : With Torben's idea of inheriting KTMW, the problem of accessing
0010 the BarPosition of the toolbars is solved. Nice :-)
0011 
0012 (David) Not sure we want to save whether the statusbar is shown/hidden.
0013 
0014 (Simon) Another thought: Perhaps we should store the geometry information of
0015         the containers of the KPartHost in the KPart itself?
0016         (something like KPart-Session Management ;-)
0017 (David) Sounds strange (the child taking care of its host's containers...)
0018 In SM, it's the host (the WM) that stores the position of its children (the
0019 windows) :-)
0020 One possible problem (I'm not sure) : are the toolbars shared between the host
0021 and the part, or are there only toolbars for one and toolbars for the others ?
0022 In the first case, there's a problem because the toolbar will remain when
0023 switching part, so shouldn't get moved back when switching back.
0024 In fact we only want to store the position of the toolbars that fully "belong"
0025 to the part, right (i.e. that only contain items from the part) ?
0026 In this case, yes, that could be saved in the part.
0027 
0028 --------------
0029 
0030 4) Perhaps a part wants to know if it got activated, so we might want to
0031    re-introduce that PartActivateEvent from kdelibs/kparts.
0032    Question: Shall this event be sent when the GUI of the part is activated
0033    or shall it be sent when the part "really" got activated (via KPartManager)?
0034 
0035 (David) Any example of usage ?
0036 I think what it wants is "really" activated, no ?
0037 
0038 (Simon) Konqueror for example wants to know when it gets activated, in order to access the KPartHost
0039         and query for the container objects (*bars) .
0040         Hmmmmmm, that sounds like two possible events. A PartActivateEvent and a GUIActivateEvent...
0041         What do you think?
0042 
0043 (David) 1 - I don't see the difference between "the gui of the part gets activated" and "the part
0044 gets activated", in this simple model (no Document/View). The Part gets activated when you can see
0045 its items in the menus/toolbars, there is no "in between" IMO ?
0046         2 - Remind me what konq does with the *bars when a part gets activated ?
0047 I couldn't find anything with a quick grep in the sources...
0048 I'm still looking for an example when it's useful :)
0049 
0050 (Simon) I think that's the whole idea of making KPartManager independent from
0051         the guibuilder. Perhaps some apps wants to embed stuff without showing
0052         the parts a full-fledged gui (remember the part-children thingy in the
0053         old OpenParts? ;-) ) . Konqueror is one example. However I think
0054         KOffice could benefit from this, too, for the inplace editing
0055         (where the part is active, in terms of the KOffice document/view model,
0056         but still has a different gui or even none at all) .
0057 
0058 (David) : I start to see :-)
0059 But what I don't see is how does KPart know whether it's activated
0060 simply or activated with its GUI... i.e. how does it know the way
0061 it is embedded (with or without GUI items). Hmmm..
0062 
0063 
0064 (Simon) Konqueror (2) : When a parts get activated (this is "detected" via
0065         KonqViewManager) , then in general the actions of the view get plugged
0066         into the menus and the main toolbar (which is acccessed via
0067         Shell::viewToolBar() (hmmm, I'm looking forward to the new KParts :-)
0068 (David) Ah yes we don't have that in "example" currently. Dynamic actions.
0069     So you would add an event (or signal) to KPart for that ? Sounds ok to me.
0070 
0071 (Simon) That means that the (old) KParts doesn't know anything about the
0072         embedding in Konqueror.
0073 (David) Didn't get that ?!? :-)
0074 
0075 --------------
0076 
0077         BrowserView inheriting KReadOnlyPart is the way to go, IMHO.
0078 
0079         The question if Konqueror itself should be a KPart is difficult.
0080         All the BrowserViews are embeddable already, so it's "questionable"
0081         if it makes sense to have the embeddable Konqueror shell (KonqMainView) .
0082 
0083 (David) indeed.
0084 
0085         OTOH that shell makes these views "interact", makes them switch. So if
0086         someone wants to embed a browse-all-stuff widget, then embedding Konqueror
0087         would probably be cool, as the mainview handles all the stuff like determining
0088         the correct mimetype, loading the view, receiving and sending openUrl requests, etc.
0089         Something like a shoot-and-forget for embedding ;-) (embed-and-forget ;)
0090         Loading and saving in that case would mean save/load the view profile.
0091 
0092 (David) Hmmm... somebody wanting to embed a full konqy ? Component technology allows
0093 you to avoid duplicate code by embedding a component that does what you want. Like kdevelop
0094 embeds a kedit component. Which app would want to embed a huge component containing
0095 a file maneger + a web browser + a generic viewer + ... ? I think this is not a component,
0096 but an application. Views are components...
0097 
0098 (Simon) Yes, that is true.
0099         What about this: We don't make Konqueror's Mainview a KPart, but still
0100         use the XMLGUI and the pluginaction stuff. (because these two things
0101         are importan and very nice IMHO). (I don't want to miss the action
0102         stuff in Konqueror, neither you I guess :-)
0103 
0104 (David) Sure, actions rock. But KTMainWindowGUIBuilder exists for that exact
0105 reason, no? The mainview would be a KTMainWindow, so its GUI is described in
0106 XML and with actions.
0107 
0108 
0109 ------------
0110 (David) This lib offers :
0111 KReadOnlyPart for viewers
0112 KReadWritePart for editors
0113 KPart for a generic part (?)
0114 
0115 We could easily port BrowserView to inherit KReadOnlyPart, and call it
0116 KBrowserPart.
0117 Proposed changes :
0118 - The action stuff gets ported, of course (structs disappear)
0119 - started/completed/canceled already exist -> removed
0120 - setStatusBarText() -> see below, wondering about status bar
0121 - setLocationBarURL() -> removed - konqueror will set it from url()
0122     [ is that correct ? ]
0123 
0124 (Simon) I think we still need it. When a view gets a redirection signal, then
0125         it wants to change the displayed URL.
0126 (David) Ah right (I think support for redirection is missing from konqueror on
0127 the whole, at other places).
0128 
0129 - openUrlRequest and createNewWindow remain.
0130 
0131 (Simon) <sidenote> We will want to add a serviceType argument to openUrlRequest.
0132         At least we need it to get rid of these changeViewMode() hacks in
0133         konq_htmlview/konq_iconview :P
0134 (David) ok
0135 
0136 - popupMenu remains ?
0137 
0138 (Simon) What about putting that popupMenu into an extension interface,
0139         contained in libkonq? IMHO the popupMenu is very libkonq specific.
0140 (David) Depends how we want to handle the popupmenu in KonqHTMLView, for
0141 instance.
0142 At the moment it's missing, and it will be a problem when that view is moved to
0143 kdelibs : no more libkonq for it. But anyway I agree : the part should
0144 generally take care of its own menu (I'm thinking of KNotePadPart for instance)
0145 Perhaps this would remain in KBrowserPart though (we need it in konqueror).
0146 
0147 ----
0148 
0149 On second thought : why should we make KReadOnlyPart different from
0150 KBrowserPart ?
0151 Any "viewer" should be embeddable in konqueror. The additional signals we
0152 currently have in BrowserView could be simply added to KReadOnlyPart, and
0153 it doesn't make it more complex (kedit can simply not care about the loading
0154 progress, the popupMenu signal, ...)
0155 In fact the loading progress should even be emitted by KReadOnlyPart
0156 itself (it handles the kiojob), for the simple cases. Of course
0157 konqueror views will reimplement openUrl and send the signals themselves.
0158 The main problem I see is that BrowserView is asynchronous
0159 and KReadOnlyPart is .. a bit of both (asynchronous for remote URLs,
0160 synchronous in openFile()). But for konqy, openFile() means nothing
0161 and never gets called (because openUrl is reimplemented).
0162 For the history stuff, we can provide the default implementation
0163 in KReadOnlyPart (just like we did in BrowserView).
0164 About the "offset stuff" - well it even makes sense in kedit
0165 so the host can ask for going to a particular line when opening the
0166 file (hyper cool !). Anyway, for parts which have nothing to do with
0167 offsets, this gets simply ignored.
0168 
0169 In short, we can take advantage of the fact that we have a lib now,
0170 as opposed to an interface alone (BrowserView), and provide default
0171 implementations (when possible, for example the history stuff)
0172 which make every "viewer"-type part a part useable in konqueror
0173 - but also in koffice, and whereever.
0174 
0175 This would reduce the number of "type of parts" and make it simpler
0176 to embed anything into anything. OTOH, it makes KReadOnlyPart a bit more
0177 difficult to understand.
0178 
0179 What do you think ? Did I overlook something ?
0180 
0181 (Simon) I don't think there's a problem with the async stuff
0182         (BrowserView/KReadOnlyPart) . Mosfet's KGhostView browserview or
0183         his dviview are both 100% like KReadOnlyPart (yes, they launch KIOJob::copy()
0184         and copy the file to some local temp) . It works :-) and noone complains :-))
0185         -> I see no problem with that :-)
0186 (David) Sure - but does that answer the question : KReadOnlyPart==KBrowserPart ?
0187     Now that I think of it, it's probably not a good idea - there are many
0188     things that BrowserPart has in addition, finally. I'm still not sure. I
0189     like making it simple, but this might be an over-simplification.
0190 
0191 ------------
0192 
0193 (Simon) About KXMLGUIBuilder<->non-KTMW builder: One possible case coming to my mind are dialogs. If you want to
0194 embed a small "part-applet" ;) (perhaps as embedded preview part for some open-foo-dialog?) , then a non-KTMW
0195 builder might be useful (and might have containers) .
0196 I don't see any problem in having a separate (abstract) interface for the GUI builder. We gain flexibility
0197 IMHO, and taking into account that this KParts stuff should probably be something highly finalized for
0198 KDE 2.0, its worth having as much flexibility as possible (while keeping it easy to use by providing the
0199 easy-to-use KTMW implementation) , IMHO.
0200 
0201 (David) Excellent idea !! A part in a dialog :-) Don't think you can have that in Windows :-))
0202 But .. how can you have containers (menubars, toolbars, ...) in a dialog ? Or were you thinking of
0203 another kind of container ?
0204 
0205 (Simon) Containers in a dialog? See kfd :-))
0206         (altho kfd uses ktmw AFAIK ;)
0207 (David)  ... because there is no support for toolbars in a dialog.
0208     I still think you can't have containers in a QDialog :-)
0209 
0210 (Simon) Another possible thing is perhaps kpropsdlg. IMHO it'd be cool if
0211         it would be very easy and simple to add new props pages for certain
0212         mimetypes dynamically via shlibs.
0213 (David) Sounds good but not very useful. :-)
0214 
0215 ---------------
0216 
0217 (Torben) I did not follow the latest discussions due to a lack of time. However, I made some
0218          small remarks on stuff I did not understand (yet?).
0219 
0220 (Torben) KReadWritePart and KReadOnlyPart use the three signals canceled, started, completed in
0221          two different contexts. One can not see wether a KReadWritePart started loading or
0222          started saving. I would like to introduce
0223          a) three new signals for KReadWritePart
0224          b) A parameter to the signals telling wether this is a read or write operation.
0225          Basically I am in favor for a small API -> b)
0226          And b) is source compatible to the current solution!
0227 (David)  ok
0228 
0229 (Torben) In example.cpp addPart is called twice and each time the active part is changed. Would not it be
0230          more clever to add parts and activate one later instead of activating the last one inserted ?
0231 (David) no no, example.cpp doesn't even know when the active part changes.
0232 Did you try running the example ? It features a part that is dynamically
0233 embedded and de-embedded, the notepadpart. That's why there is an addPart()
0234 call - to add the new part when the user asks for it. Not when the active part
0235 changes.
0236 
0237 (Torben) You guys are busting QDOM. You can NOT assign an element of document A to an element of document B.
0238          That means: There is no way to mix two documents. What you are doing is asking for trouble.
0239          The ownerDocument() function will not work as one might expect after the assignment: The element
0240          of B assigned to A will still claim to be a child of B :-(
0241          And there are few chances that this may change in the Qt implementation in the next few weeks.
0242 (to myself) I tro to fix that in QDom ....
0243 
0244 <weis> Hi
0245 <dfaure> Hi !
0246 <weis> dfaure: Just looked into new kparts
0247 <dfaure> ah ?
0248 <weis> dfaure: You have a major problem: One can NOT mix QDomElements of different documents!
0249 <dfaure> weis: why ?
0250 <weis> dfaure: Because the ownerDocument wont change as one might expect.
0251 <dfaure> weis: not sure I have the full picture (Simon did that part). What should we do instead ?
0252 <weis> dfaure: Either I manage to hack QDom (very hard) or ..... dont know currently ....
0253 <dfaure> the problem is .. memory management, right ?
0254 <weis> dfaure: I just checked in my CVS irc stuff :-)
0255 <dfaure> ok :-)
0256 <weis> dfaure: Can you have a look at kparts/COMMENTS ?
0257 --
0258 <dfaure> weis: you should have come before. coolo is talking about re-writing libkio.
0259 <dfaure> well in fact he started the rewrite
0260  dfaure having a look
0261 <weis> dfaure: Unfortunately I am not paid for KDE but for Qt hacking :-( So I fear I have no time for kio anyway.
0262 <dfaure> weis: I know that, but perhaps a little discussion would help him with the new design :)
0263 <weis> dfaure: So you are not convinced by his design ?
0264 <weis> dfaure: It is about this daemon that forks and loads ioslaves as libs, or ?
0265 <dfaure> yes, this looks fine
0266 <dfaure> but then what about filters, and especially the problem is the API
0267 <dfaure> each slave currently implements stuff like recurse copying
0268 <dfaure> and we would perfer that in a single location, obviously :-)
0269 <weis> dfaure: Thta is true!
0270 <weis> dfaure: The new design would mean: We write an abstract interface for basic IO stuff.
0271 <dfaure> yup
0272 <weis> dfaure: Basically every slave would have to implement usual UNIX IO functions.
0273 <weis> dfaure: Does coolo want to do it that way ?
0274 <dfaure> unix io ?
0275 <dfaure> like read, write, open ?
0276 <weis> dfaure: unix io: open/read/write/opendir ...
0277 <dfaure> that would be great IMHO
0278 <dfaure> I think he didn't realize that - the fact that moving the code to a central place involves switching to a lowlevel unix-like aPI for the slaves
0279 <weis> dfaure: If I have  a nested URL: Are we going to start two processes to get the URL from the net or one (with Coolos approach)
0280 <weis> dfaure: Currently it is two processes. One for file and one for tar, for example.
0281 <dfaure> weis: we're not sure. would one be ok ? (like opening the two libs and connecting signals and slots..)
0282 --
0283 <dfaure> weis : > I think this KPartsMainWindow should inherit KTMainWindow directly
0284 <dfaure> weis: I thought the whole idea was NOT to inherit KTM
0285 <dfaure> so that one could use anything as a KTM child
0286 <weis> dfaure: But this KTMainWindowGUIBuilder is already KTMainWindow dependenat. So why not derive ?
0287 <dfaure> well we're back to the shell, then...
0288 <weis> dfaure: Of course. Excuse me!
0289 <dfaure> > Why should one want to access the parents containers?
0290 <dfaure> know the View and Edit menus in konqueror ?
0291 <dfaure> They are view dependant ...
0292 <dfaure> and dynamically added into the menu
0293 <dfaure> although ... we could use XML instead
0294 <dfaure> can't remember why we don't
0295 <weis> dfaure: Using XML seems to be the clean approach IMHO.
0296 <dfaure> yes ... damn can't remember the reason
0297 <dfaure> lazyness perhaps
0298 <dfaure> :-)
0299 <weis> dfaure: What about me hacking a KPartsMainWindow that resembles the old shell pattern. Since it is useful in many cases and easy to understand/use ?
0300 <dfaure> yes, I guess it's ok to have a KTM child. The difference with the old shell is that the gui building is separate from it, right ?
0301 <dfaure> in fact, do people already inherit KTM, usually ?
0302 <dfaure> hmm ... they would simply inherit KPartMainWindow instead.
0303 <weis> dfaure: Exactly.
0304 <dfaure> so .... what was the problem with the shell ?
0305 <weis> dfaure: The problem was ..... aehmmm .....
0306 <weis> .... there was some problem .....
0307 <dfaure> :-))))))
0308 <weis> dfaure: What about mergeXML? Can it move ? .... still thinking about shell ....
0309 --
0310 <weis> dfaure: I know again! It may happen that the shell uses a widget which in turn uses a component. So the shell does not now that KParts are involved at all!
0311 <weis> s/now/know/
0312 <dfaure> ah - and then the widget would NOT use KPartsMainWindow, right ?
0313 <weis> dfaure: Yep!
0314 <dfaure> ok
0315 --
0316 <weis> dfaure: Another problem are nested KPartManagers. Imagine Widget W1 has some Parts P1 ... Pn. Part Pn has in turn a widget W2 that uses Parts P1_2...Pm_2. Then W1 and W2 would feature a KPartManager ....
0317 <weis> dfaure: The general problem is: A widget may use parts internally but the one who uses the widget does (and should) not know that.
0318 <dfaure> yes - I guess we need to try that,
0319 <dfaure> I'm not sure what's needed for that to work
0320 <weis> dfaure: Currently I am almost shure it wont work.
0321 <weis> dfaure: We must ashure that there is only ONE GUIBuilder per main window. That is one thing to do.
0322 <dfaure> ah yes
0323 <weis> dfaure: If window W1 becomes active (focus) it may activate its KPartManager. If W2 becomes active its KPartManager may do something.
0324 <weis> dfaure: Ooooops, I think I am on the wrong track perhaps.....
0325 <weis> dfaure: I started dealing with kparts like I do with widgets. If a kpart is just a widget that you can load at runtime, then it wont do gui merging anyway. So may above example seems to be very theoretically, perhaps ....
0326 <dfaure> yes, if you have two KPartManager you have a problem anyway (if the parts have a GUI)
0327 <dfaure> you want only ONE part active at a time ... one gui .
0328 <dfaure> so you can't have one part active in each kpartmanager, unless the whole partmanager can be deactivated.
0329 <weis> dfaure: Correct.
0330 <weis> dfaure: BUTTTH: Imagine you embed a browser widget. Would you expect that it suddenly plays around in your MenuBar and ToolBars? No, or ? It should only do so if you ask for it.
0331 <dfaure> well I think _yes_ you would expect its actions to become available to the user, no ?
0332 <weis> dfaure: Imagine you write a report generator that shows database queries using the browser view. Would you as a programmer want to have menu entries like "OpenURL" and "History" in your report generator? I would not.
0333 <dfaure> hmmm ... then it's the HTML widget you're using, not the part...
0334 <dfaure> when kdevelop embeds kwrite, it wants the actions from kwrite...
0335 <dfaure> open file, save file, ...
0336 <weis> dfaure: Well,. why not load a HTML widget at runtime as a part ...
0337 <dfaure> sure, why not :-)
0338 <dfaure> I suppose the answer is, as always : configurable.
0339 <dfaure> as you said.
0340 <weis> dfaure: Yep!
0341 <weis> dfaure: But that luckily voids my above example. If W1 wants that parts of W2 change the GUI then it has to tell W2 about the GUIBuilder. If W1 does not want that, then it does not tell W2 and no GUI merging will be done.
0342 <dfaure> yup
0343 <weis> dfaure: This way we stay with one KPartManager and GUIBuilder and W1 is responsible of propagating it  to W2 :-) Problem solved :-)
0344 
0345 --------------------------
0346 
0347 David wondering about Status Bar
0348 --------------------------------
0349 Should the statusbar be a *bar like toolbar/menubar, handled by the XML GUI building
0350 (soon "KPartsMainWindow"), and shown/hidden depending on the
0351 active part, OR a global statusbar, always shown or hidden, and
0352 made available to the parts, through KPartManager or KPartsMainWindow ?
0353 
0354 Currently it's the first one, but since we removed access to the toplevel
0355 containers, ...
0356 Visually, I think I prefer the statusbar not to show/hide when the active
0357 part changes. But for consistency with toolbars perhaps it should ? Dunno.
0358 
0359 (Simon) IMHO the statusbar should behave like toolbars. A part may "have" (allocate) a statusbar
0360         or just leave out the <StatusBar/> tag. The question IMHO is: How can the part access the
0361         statusbar?
0362         Hmmmmmmmm, I think we should solve this by making use of the xmlgui concept:
0363         (example)
0364         <StatusBar>
0365           <Action name="progressaction"/>
0366           <Label><text>Blah</text></Label>
0367         <StatusBar/>
0368         I think that would solve the problem, and it's what we currently support/implemented.
0369         What do you think?
0370        (update) ahh, grmbl, it won't help much ;-) , as it makes KStatusBar::message() impossible..
0371         hmmmmmmm
0372         *thinking*
0373         I vote for keeping the currently implemented way (as described above) . Perhaps we should add
0374         sth. like KPartManager::statusBarMessage() ? (as that message concept of kstatusbar is really
0375         different to the container concept (which kstatusbar supports aswell...) .
0376 
0377 Torben brainstorming about Nested Parts
0378 ---------------------------------------
0379 
0380 (In the following text I mix the words "components" and "parts". In addition I assume that
0381  KPartManager and KPartHost become one class. )
0382 
0383 
0384 Imagine a very complex situation like this:
0385 
0386 KOfficeMainWindow (a kparts aware shell)
0387  |
0388  |- KWordView/Part (a koffice component)
0389     |
0390     |- KSpreadView/Part (a koffice component)
0391        |
0392        |- KReportGeneratorView/Part (a koffice component)
0393           |
0394           |- KHTMLBrowserView/Part (something like konqui, this is a kpart)
0395 
0396 Imagine all are added to one KPartManager.
0397 Now the user clicks on the report generator and gets the
0398 usual GUI merging.
0399 
0400 Now imagine the user pressed directly on the Browser that is used
0401 by the report generator just to display some HTML. We would get GUI
0402 merging so that the menus of the browser appear.
0403 But that is a mistake! How the report is made visible is an implementation
0404 detail of the report generator. And it is in turn an implementation detail of KWord
0405 that is allows KSpread to play around in the menu/toolbars if activated.
0406 
0407 What we learn from that is the following:
0408 Observation 1) Whether a part - that is the child of some other part - may do GUI merging or
0409                not is determined by the parent part.
0410 
0411 
0412 Another example: We use a widget Kalender which uses KSpread to display a table.
0413                  The KSpreadPart is turned into ReadOnly mode.
0414 
0415 KalenderMainWindow (this is NOT a parts enabled main window)
0416  |
0417  |-KalenderWidget (this is NOT a part)
0418    |
0419    |-KSpreadView (this is a part)
0420 
0421 Here KSpreadView is used like a usual widget. That means it does not get added to some KPartManager
0422 and sees no KGUIBilder or stuff like that. "KalenderMainWindow" constructs the GUI itself.
0423 
0424 Observation 2) It should be possible to use a part just like a usual widget. So it must work without
0425                a KGUIBuilder and without being added to some KPartManager.
0426 
0427 ** (David) : I'll try that now.
0428 
0429 Lets extend the example: KalenderWidget shows a very nice kalender. That means it puts images
0430 inside of KSpread by using KImage.
0431 
0432 KalenderMainWindow (this is NOT a parts enabled main window)
0433  |
0434  |-KalenderWidget (this is NOT a part)
0435    |
0436    |-KSpreadView (this is a part)
0437      |
0438      |- KImage (this is a part)
0439      |
0440      |- KImage (this is a part)
0441 
0442 Somehow KSpread must handle its children. It wants to know which one is active for example.
0443 Usually KSpread would use KPartManager but it did not get one from its shell/parent.
0444 
0445 Observation 3) If a KPart is not added to some KPartManager then it creates its own KPartManager where
0446                it insertes itself and its children (if there are any children).
0447 
0448 That has an impact on Observation 2 - since the KPart will create its own KPartManager, so we rewrite it like this:
0449 
0450 Observation 2b) It should be possible to use a part just like a usual widget. So it must work without a KGUIBuilder.
0451 
0452 This is no problem, since the Part never directly talks to the GUIBuilder anyway.
0453 
0454 
0455 Now imagine someone made a KOffice component out of KalenderWidget and embeds it in KWord:
0456 
0457 KOfficeMainWindow (a kparts aware shell)
0458  |
0459  |- KWordView/Part (a koffice component)
0460     |
0461     |-KalenderWidget (this is NOT a part)
0462       |
0463       |-KSpreadView (this is a part)
0464         |
0465         |- KImage (this is a part)
0466         |
0467         |- KImage (this is a part)
0468 
0469 Do we want GUI merging with KSpread now? No, since the use of KSpread in KalenderWidget is
0470 an implementation detail. In this case we get two KPartManagers. One belongs to the
0471 KofficeMainWindow and is connected to the GUI Builder while the other one belongs to
0472 KSpread and is NOT connected to some GUI builder. This will work magically if we obeye
0473 observation 2b + 3.
0474 
0475 Observation 4) There may be multiple KPartManagers in one toplevel window, but only one is
0476                associated with a GUIBuilder. That means the managers are not really nested. They
0477                dont know about each others.
0478 
0479 
0480 Lets take another look at our first example:
0481 
0482 KOfficeMainWindow (a kparts aware shell)
0483  |
0484  |- KWordView/Part (a koffice component)
0485     |
0486     |- KSpreadView/Part (a koffice component)
0487        |
0488        |- KReportGeneratorView/Part (a koffice component)
0489           |
0490           |- KHTMLBrowserView/Part (something like konqui, this is a kpart)
0491 
0492 The report generator does not want GUI merging of its HTML browser. But it wants to offer an action
0493 called "HTMLSettings" to allow choosing the default font of the HTML Widget. Obviously this action
0494 is offered by the HTMLBrowserView. So instead of reimplementing this action, the report generator
0495 may propagate actions of the html browser. Its KPart::action() method just calls the browsers
0496 action() function if queried for an action named "HTMLSettings".
0497 
0498 Observation 5) In addition to turning GUI building on or off for components one may do partial gui merging.
0499                That means actions of some child component are propagated by the parent component.
0500 
0501 Observation5 does not cause additional code in libkparts. It just shows a possible usage and the flexibility of the
0502 action concept.
0503 
0504 
0505 Something else comes to my mind: We can safely reintroduce the shell pattern. The KPartManager/KHostPart is
0506 split of the shell and that is a MUST.
0507 But it does not make sense to create a KTMainWindow and then a KTMainWindowGUIBuilder to manage menubar/toolbars/statusbar.
0508 Imagine an application that uses KTMainWindow. Either the application programmer knows that he wants to embed
0509 some components and that they should use GUI merging => He can use KPartsMainWindow from the start.
0510 Or the application programmer does not want that any component that it uses directly or indirectly merges in
0511 its GUI. In this case he uses KTMainWindow and does not expect someone to override this decision by installing
0512 a KTMainWindowGUIBuilder.
0513 
0514 Imagine someone is writing a time scheduler which uses a KalenderWidget Version 1.0:
0515 
0516 SchedulerMainWindow ( a KTMainWindow )
0517  |
0518  |- SchedulerCanvas
0519     |
0520     |- KalenderWidget (which uses NO parts currently).
0521 
0522 Here no GUI merging happens. Now someone improves KalenderWidget in Version 2.0 to use
0523 KSpread internally (once again: This is an implementation detail):
0524 
0525 SchedulerMainWindow ( a KTMainWindow )
0526  |
0527  |- SchedulerCanvas
0528     |
0529     |- KalenderWidget (which USES parts now).
0530         |
0531         |- KSpreadView/Part
0532 
0533 When clicking on KSpread: Do you want GUI merging now? No! The GUI of the scheduler should stay
0534 the same. Just the implementation of the KalenderWidget changed.
0535 
0536 Observation 6) The application programmer determines wether he wants GUI merging or not. That means it is his
0537                decision to choose KTMainWindow or a GUI merging enabled KTMainWindow. And that in turn means that we can merge
0538                KTMainWindow and KTMainWindowGUIBuilder in one class called KPartsMainWindow.
0539                KPartsMainWindow will feature its special implementation of KPartManager (with KPartHost already merged with KPartManager).
0540 
0541 If some component wants to offer all of its functionality even in the case that nobody allowed it to do
0542 GUI merging then the component can still put all of its actions in a QPopupMenu instead of the menubar.
0543 
0544 
0545 Conclusion:
0546 I think with this model we can have an object tree that mixes usual widgets and components in any order
0547 and we always get it right. But it is late and I may get things wrong :-)
0548 In addition my approach reduces the amount of classes and the complexity of the API (at least I hope so).
0549 
0550 Lets put the four most important things together:
0551 
0552 Point 1) The application developer decides wether his app (->toplevel window) features GUI merging or not.
0553 Point 2) A part decides wether it allows its child parts to do GUI merging.
0554 Point 3) If one part in the big object tree is not allowed to do GUI merging (that means it is not registered
0555          at the KPartMainWindows KPartManager, but on some additional KPartManager) then none of its direct or
0556          indirect child parts can ever do GUI merging.
0557 Point 4) Wether some custom widget uses parts internally or not is an implementation detail and not visible to
0558          the user of this custom widget.
0559 
0560 
0561 (David) : I obviously agree with all this. This is a very nice derivation of
0562 the few ideas we had on irc - making GUI merging configurable, at both ends in
0563 fact, plus all the issues associated with nesting.
0564 
0565 (Simon) /me too :-)
0566 
0567 (David) Torben : perhaps you could also comment on the KReadOnlyPart ==? KBrowserPart issue ?
0568 Look for "second thought" in this file. Trying to decide between
0569 each read-only part can be embedded in konqueror and only those who implement
0570 KBrowserPart can be embedded in konqueror... I realize in the first case even
0571 ReadWrite parts would be embeddable since they inherit readonly part... A minor
0572 issue compared to what's above though.
0573 
0574 (Torben) When I draw my university education out of the had (and my master thesis :-)) then
0575          I think your problem can not be solved by deriving from some class but by doing
0576          delegation.
0577          It works like this:
0578          We have KReadOnlyPart (short KROP) and KonqyViewerExtension (short KVE). KVE is just
0579          a child of KROP that you can query with the QObject::child method.
0580          Views which are konquy aware feature their own implementation of KVE and konquy is
0581          happy :-)
0582          If a KROP does not feature a KVE then Konqui installs a default KVE that just ignores
0583          offsets etc.
0584          I think the little difficulty is to implement the default KVE, but it should be possible.
0585          With this solution we get both: Konquy can embed all KROPs and some KROPs can be Konquy
0586          aware and we do not bloat the KROP interface.
0587 
0588 (Torben) About the fact that konqy can embed a KReadWritePart (short KRWP):
0589          This is IMHO not a konqy problem but a KRWP design bug. KRWP overloads
0590          KROP and changes the semantics (editing is possible). By default KRWP should
0591          go into ReadOnly mode. Only if one calls rwpart->setEditable( TRUE ) it should
0592          offer editing of the data. It may still happen that some KRWPs dont obeye the
0593          "editable" flag, but that is a bug inside of the KRWP.
0594 
0595 (Simon) I definitely agree with all this :-)
0596 
0597          KROP -- (this is what konqueror embeds)
0598            |
0599            (child qobj) KonqyViewExtension (konqy specific stuff)
0600                         |
0601                         (current browserview extension objects)
0602                         ...
0603 
0604         Can we go for this? :-)
0605