Branch: master

699217f5 2014-10-05 16:02:26 Timothy Pearson
If drkonqi launches during logout show it after 30 seconds have elapsed
M ksmserver/server.cpp
M ksmserver/server.h
M ksmserver/shutdown.cpp
M libkonq/konq_dirpart.cc
diff --git a/ksmserver/server.cpp b/ksmserver/server.cpp
index 1d98bc0..257d5f2 100644
--- a/ksmserver/server.cpp
+++ b/ksmserver/server.cpp
@@ -972,6 +972,16 @@
     return (program == "knotify");
 }
 
+bool KSMServer::isCrashHandler( const KSMClient* client ) const
+{
+    return isNotifier( client->program());
+}
+
+bool KSMServer::isCrashHandler( const TQString& program ) const
+{
+    return (program == "drkonqi");
+}
+
 bool KSMServer::defaultSession() const
 {
     return sessionGroup.isEmpty();
diff --git a/ksmserver/server.h b/ksmserver/server.h
index 8f17af2..f5e0d37 100644
--- a/ksmserver/server.h
+++ b/ksmserver/server.h
@@ -161,6 +161,8 @@
     bool isDesktop( const TQString& program ) const;
     bool isNotifier( const KSMClient* client ) const;
     bool isNotifier( const TQString& program ) const;
+    bool isCrashHandler( const KSMClient* client ) const;
+    bool isCrashHandler( const TQString& program ) const;
     bool defaultSession() const; // empty session
     void setupXIOErrorHandler();
 
diff --git a/ksmserver/shutdown.cpp b/ksmserver/shutdown.cpp
index 0dda659..d7eaafb 100644
--- a/ksmserver/shutdown.cpp
+++ b/ksmserver/shutdown.cpp
@@ -484,7 +484,7 @@
             if (c->saveYourselfDone) {
                 continue;
             }
-            if( isWM( c ) || isCM( c ) || isNotifier( c ) ) {
+            if( isWM( c ) || isCM( c ) || isNotifier( c ) || isDesktop( c ) ) {
                 continue;
             }
             waitingClients++;
@@ -814,7 +814,7 @@
             TQDateTime currentDateTime = TQDateTime::currentDateTime();
             TQDateTime oldestFoundDateTime = currentDateTime;
             for( KSMClient* c = clients.first(); c; c = clients.next()) {
-                if( isWM( c ) || isCM( c ) || isNotifier( c ) ) {
+                if( isWM( c ) || isCM( c ) || isNotifier( c ) || isDesktop( c ) ) {
                     continue;
                 }
                 if (c->program() != "") {
@@ -857,8 +857,9 @@
     // kill all clients
     state = Killing;
     for ( KSMClient* c = clients.first(); c; c = clients.next() ) {
-        if( isWM( c ) || isCM( c ) || isNotifier( c ) ) // kill the WM and CM as the last one in order to reduce flicker.  Also wait to kill knotify to avoid logout delays
+        if( isWM( c ) || isCM( c ) || isNotifier( c ) || isDesktop( c ) ) { // kill the WM and CM as the last one in order to reduce flicker.  Also wait to kill knotify to avoid logout delays
             continue;
+        }
         kdDebug( 1218 ) << "completeShutdown: client " << c->program() << "(" << c->clientId() << ")" << endl;
         c->terminationRequestTimeStamp = TQDateTime::currentDateTime();
         SmsDie( c->connection() );
@@ -883,7 +884,7 @@
         TQDateTime currentDateTime = TQDateTime::currentDateTime();
         TQDateTime oldestFoundDateTime = currentDateTime;
         for( KSMClient* c = clients.first(); c; c = clients.next()) {
-            if( isWM( c ) || isCM( c ) || isNotifier( c ) ) {
+            if( isWM( c ) || isCM( c ) || isNotifier( c ) || isDesktop( c ) ) {
                 continue;
             }
             if (c->program() != "") {
@@ -929,6 +930,11 @@
         shutdownNotifierIPDlg=0;
     }
     for ( KSMClient* c = clients.first(); c; c = clients.next() ) {
+        if( isDesktop( c )) {
+            iswm = true;
+            c->terminationRequestTimeStamp = TQDateTime::currentDateTime();
+            SmsDie( c->connection() );
+        }
         if( isNotifier( c )) {
             iswm = true;
             c->terminationRequestTimeStamp = TQDateTime::currentDateTime();
@@ -979,6 +985,11 @@
         if (child != 0) {
             kapp->quit();
         }
+        else if (child == 0) {
+            // If any remaining client(s) do not exit quickly (e.g. drkonqui) terminate so that they can be seen and interacted with
+            sleep(30);
+            exit(0);
+        }
     }
     else {
         kapp->quit();
diff --git a/libkonq/konq_dirpart.cc b/libkonq/konq_dirpart.cc
index ea1b19b..0cd8018 100644
--- a/libkonq/konq_dirpart.cc
+++ b/libkonq/konq_dirpart.cc
@@ -419,9 +419,11 @@
 
     KURL::List lst;
     TQMimeSource *data = TQApplication::clipboard()->data();
-    if ( data->provides( "application/x-tde-cutselection" ) && data->provides( "text/uri-list" ) )
-        if ( KonqDrag::decodeIsCutSelection( data ) )
+    if ( data->provides( "application/x-tde-cutselection" ) && data->provides( "text/uri-list" ) ) {
+        if ( KonqDrag::decodeIsCutSelection( data ) ) {
             (void) KURLDrag::decode( data, lst );
+        }
+    }
 
     disableIcons( lst );
 
@@ -432,8 +434,9 @@
 {
     TQString actionText = TDEIO::pasteActionText();
     bool paste = !actionText.isEmpty();
-    if ( paste )
+    if ( paste ) {
       emit m_extension->setActionText( "paste", actionText );
+    }
     emit m_extension->enableAction( "paste", paste );
 }