Bug 89951

Summary: Authorization dialog focus handling broken when opening a protected website through Alt+F2
Product: [Plasma] kwin Reporter: Martin Piskernig <martin.piskernig>
Component: generalAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: faure, joerg, Marcin.Kasperski, missive
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Debian testing   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Martin Piskernig 2004-09-21 14:07:23 UTC
Version:            (using KDE KDE 3.3.0)
Installed from:    Debian testing/unstable Packages
OS:                Linux

How to reproduce this:
1. Press Alt+F2 to open the Execute Command dialog.
2. Enter a website for which you need HTTP authorization.
3. Now two windows open: one is the authorization dialog itself, the other one is a progress bar for the website.
4. In about every second case the progress window gets the input focus and when I begin to type in my user/password data nothing happens (no surprise). Seems like the window that pops up last gets the focus.

I think the correct handling should be that always the authorization gets the focus. 

I don't know whether it is possible to fix this but it sure is an irritating behaviour.

Oh, and I have focus-follows-click (not mouse-move), so this can't be the reason.
Comment 1 Michael Prokop 2005-05-07 11:43:40 UTC
This bug still happens with:

Qt: 3.3.4
KDE: 3.3.2

Qt: 3.3.4
KDE: 3.4.0
Comment 2 David Faure 2005-05-08 21:22:32 UTC
Lubos: is this a matter of parent window IDs (note that this is cross-process)?
or some window flags? (should kpasswdserver.cpp use KeepAbove like kwalletd.cpp does?)
Comment 3 Lubos Lunak 2005-05-10 15:09:04 UTC
This will need some work.
Comment 4 Lubos Lunak 2005-05-10 15:17:13 UTC
*** Bug 100817 has been marked as a duplicate of this bug. ***
Comment 5 Lubos Lunak 2005-05-10 15:18:25 UTC
*** Bug 104670 has been marked as a duplicate of this bug. ***
Comment 6 Lubos Lunak 2005-05-10 15:19:02 UTC
*** Bug 101850 has been marked as a duplicate of this bug. ***
Comment 7 Lubos Lunak 2005-05-10 15:20:20 UTC
NOTE TO SELF: Check all duplicates.
Comment 8 Marcin Kasperski 2005-05-10 16:54:08 UTC
Hmm, is seems to me that bug 104670 I reported is not exactly
the same as this one (although maybe there is the same background for both of them).
Comment 9 Lubos Lunak 2006-03-06 14:12:46 UTC
Window relationship should be now fixed, so part of this problem should be fixed. The only remaining thing is the fact that the progress window steals focus from the dialog.
Comment 10 pete scott 2006-08-09 18:12:30 UTC
Note that this behavior also occurs when an authorization dialog is opened from knetattach (Network Folders Applet)... or seemingly anytime KDE triggers an authentication and a progress dialog.

I couldn't even fix the issue by setting forcing focus and setting the focus stealing prevention level of the authorization dialog.
Comment 11 David Faure 2006-10-17 20:15:51 UTC
SVN commit 596498 by dfaure:

Hide the progress dialog while displaying the password dialog
BUG: 89951


 M  +1 -0      job.cpp  
 M  +15 -3     slavebase.cpp  


--- branches/KDE/3.5/kdelibs/kio/kio/job.cpp #596497:596498
@@ -110,6 +110,7 @@
     if ( showProgressInfo )
     {
         m_progressId = Observer::self()->newJob( this, true );
+        addMetaData("progress-id", QString::number(m_progressId));
         //kdDebug(7007) << "Created job " << this << " with progress info -- m_progressId=" << m_progressId << endl;
         // Connect global progress info signals
         connect( this, SIGNAL( percent( KIO::Job*, unsigned long ) ),
--- branches/KDE/3.5/kdelibs/kio/kio/slavebase.cpp #596497:596498
@@ -58,6 +58,8 @@
 #include "kio/ioslave_defaults.h"
 #include "kio/slaveinterface.h"
 
+#include "uiserver_stub.h"
+
 #ifndef NDEBUG
 #ifdef HAVE_BACKTRACE
 #include <execinfo.h>
@@ -821,11 +823,16 @@
     QByteArray reply;
     AuthInfo authResult;
     long windowId = metaData("window-id").toLong();
+    long progressId = metaData("progress-id").toLong();
 
-    kdDebug(7019) << "SlaveBase::openPassDlg window-id=" << windowId << endl;
+    kdDebug(7019) << "SlaveBase::openPassDlg window-id=" << windowId << " progress-id=" << progressId << endl;
 
     (void) dcopClient(); // Make sure to have a dcop client.
 
+    UIServer_stub uiserver( "kio_uiserver", "UIServer" );
+    if (progressId)
+      uiserver.setJobVisible( progressId, false );
+
     QDataStream stream(params, IO_WriteOnly);
 
     if (metaData("no-auth-prompt").lower() == "true")
@@ -833,8 +840,13 @@
     else
        stream << info << errorMsg << windowId << s_seqNr;
 
-    if (!d->dcopClient->call( "kded", "kpasswdserver", "queryAuthInfo(KIO::AuthInfo, QString, long int, long int)",
-                               params, replyType, reply ) )
+    bool callOK = d->dcopClient->call( "kded", "kpasswdserver", "queryAuthInfo(KIO::AuthInfo, QString, long int, long int)",
+                                        params, replyType, reply );
+
+    if (progressId)
+      uiserver.setJobVisible( progressId, true );
+
+    if (!callOK)
     {
        kdWarning(7019) << "Can't communicate with kded_kpasswdserver!" << endl;
        return false;