A Qt replacement for KGlobal::ref and deref

Thiago Macieira thiago at kde.org
Thu Feb 10 15:36:53 GMT 2011

Em quinta-feira, 10 de fevereiro de 2011, às 12:45:58, David Faure escreveu:
> > I certainly don't expect it to continue
> > running in the background until certain services finish running, in the
> > background.
> I can tell you, users definitely expect their download to finish, their mail
> to be sent [this has hit my wife a few times in kmail!]. And if a systray

I don't dispute that. I'm simply asking that there is some kind of feedback 
*while* that is happening.

Imagine you send an email, close the kmail, and now you want to suspend your 
computer. How do I know that the email sending has finished?

> > There are two problems with this: imagine the case of trying
> > to upload my file to a server while my connection is down. First of all,
> > the application continues running after I told it to quit. Second, I
> > don't see the fact that there's an important upload running.
> I don't understand this example. If your connection is down, the job will
> fail quickly and the app will exit fast.

Only if it's down when you start the job. If the connection goes down while 
the transfer is in progress, there's at least 30 seconds timeout -- and that's 
if there's a timeout at all.

> > The correct way to solve this problem is to show another window
> > indicating that it is doing something and tell me what. We solve both
> > problems at once: there is a window open, so it's not yet a quit from
> > QCoreApplication's sense, and the user gets feedback.
> You assume the progress window is in-process, but this leads to ugly
> unorganized popups all the time so in KDE nowadays we show progress in
> kuiserver / plasma instead. So you can't use the window as a "don't quit now
> refcounting", you need the job for that.

Right, but there's no API for doing that from Qt. So today any Qt application 
requires a window to display its progress. Therefore, the API for refcounting 
isn't needed.

> > They already do. The KGlobal::ref()/deref() function is already separate
> > and all libraries need to use it.
> But KMainWindow, KJob and KSystemTrayIcon use it, so for the application
> developer, it's all transparent.

And that's fine.

> If this is added to Qt, then QMainWindow and QSystemTrayIcon should use it,
> otherwise people will just forget.


> I don't understand the problem. Instead of just counting open windows, you
> also count other things which ask to be counted - systray icon and jobs.

Systray icon, yes. Jobs with visual feedback (even if out-of-process), yes. 
Jobs with no visual feedback, no.

So the way I see it, ref/unref is just a way to increase and decrease the 
number of windows this process has when the window is actually out-of-process. 
Abuse of that will lead to bad usability.

Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Senior Product Manager - Nokia, Qt Development Frameworks
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20110210/1082a1a9/attachment.sig>

More information about the kde-core-devel mailing list