Sophie

Sophie

distrib > Mandriva > 2010.2 > i586 > by-pkgid > ce2e75decdd057e5c961fad858af3221 > files > 29

kdebase4-workspace-4.4.5-0.2mdv2010.2.src.rpm

#
# Description: prevent closing with alt+f4
# Forwarded: from upstream
# Bug: http://bugs.kde.org/show_bug.cgi?id=232753
# Author: notmart
#

Index: plasma/netbook/shell/plasmaapp.cpp
===================================================================
--- plasma/netbook/shell/plasmaapp.cpp  (révision 1109263)
+++ plasma/netbook/shell/plasmaapp.cpp  (révision 1109264)
@@ -850,7 +850,7 @@
         }
     } else if (watched == m_widgetExplorerView && event->type() == QEvent::Resize) {
          m_widgetExplorer->resize(m_widgetExplorerView->contentsRect().size());
-    } else if (watched == m_mainView && event->type() == QEvent::Close) {
+    } else if (!m_isDesktop && watched == m_mainView && event->type() == QEvent::Close) {
         exit();
     }
     return false;
Index: plasma/netbook/shell/netview.cpp
===================================================================
--- plasma/netbook/shell/netview.cpp    (révision 1109263)
+++ plasma/netbook/shell/netview.cpp    (révision 1109264)
@@ -157,6 +157,17 @@
     emit geometryChanged();
 }
 
+bool NetView::event(QEvent *e)
+{
+    if (e->type() == QEvent::Close) {
+        //prevent ALT+F4 from killing the shell
+        e->ignore();
+        return true;
+    } else {
+        return Plasma::View::event(e);
+    }
+}
+
 void NetView::screenOwnerChanged(int wasScreen, int isScreen, Plasma::Containment* containment)
 {
     kDebug() << "was, is, containment:" << wasScreen << isScreen << (QObject*)containment;
Index: plasma/netbook/shell/netview.h
===================================================================
--- plasma/netbook/shell/netview.h      (révision 1109263)
+++ plasma/netbook/shell/netview.h      (révision 1109264)
@@ -77,6 +77,7 @@
 protected:
     void drawBackground(QPainter *painter, const QRectF &rect);
     void resizeEvent(QResizeEvent *event);
+    bool event(QEvent *e);
 
 private:
     NetPanelController *m_panelController;