KSystemTray: The saga continues...

David Faure david at mandrakesoft.com
Sat Apr 13 23:15:40 BST 2002


On Saturday 13 April 2002 23:57, Martijn Klingens wrote:
> On Saturday 13 April 2002 23:34, David Faure wrote:
> > So, how to distinguish between the two? I thought about reimplementing
> > virtual bool close(), but that only distinguishes the X button case from
> > all the others AFAICS - not good. Therefore the only solution I see is an
> > "ugly"  KMainWindow::setClosedBySystemTray() which sets a bool internally,
> > which tells the closeEvent to really close (instead of "hide" when a
> > systray exists). Then the systray code can call setClosedBySystemTray()
> > before calling close(), on the mainwindow, when 'Quit' is selected.

Actually a nicer-looking API could be forceClose() which sets this bool
internally _and_ calls close().
 
> does that mean a two-part patch that also adds the necessary code to 
> KMainWindow, or adding an accessor method closedBySystray() to KMW? Currently 
> the code that hides the window is in kopete's main window and not in kdelibs. 
> I guess it could be moved there, but that's definitely 3.1 code then, it is 
> then more than a few-line fix in a single method that would fit in the 
> branch...

You could reimplement closeEvent() in kopete's mainwindow, and also
add forceClose() there. If the latter was called, the former will call
KMainWindow::closeEvent, otherwise it will just hide().

Once KMainWindow has the same kind of code, you can remove this code
from kopete, but even if it remains, it won't hurt.

-- 
David FAURE, david at mandrakesoft.com, faure at kde.org
http://people.mandrakesoft.com/~david/, http://www.konqueror.org/
KDE, Making The Future of Computing Available Today





More information about the kde-core-devel mailing list