Sophie

Sophie

distrib > Mageia > 1 > i586 > media > core-updates-src > by-pkgid > 83ecf8f3cf39318860f0dc9917c84068 > files > 14

kdebase4-workspace-4.6.5-1.4.mga1.src.rpm

Index: plasma/desktop/applets/trash/trash.cpp
===================================================================
--- plasma/desktop/applets/trash/trash.cpp	(revision 1202613)
+++ plasma/desktop/applets/trash/trash.cpp	(working copy)
@@ -203,15 +203,37 @@
     }

     emit releaseVisualFocus();
-    const QString text(i18nc("@info", "Do you really want to empty the trash? All items will be deleted."));
-    //FIXME: should use KMessageBox::createKMessageBox so that it doesn't block the whole app!
-    const bool del = KMessageBox::warningContinueCancel(&m_menu,
+    bool del = true ;
+    QString keyName = "ConfirmEmptyTrash" ;
+    KSharedConfigPtr kioConfig = KSharedConfig::openConfig("kiorc", KConfig::NoGlobals);
+    bool ask = kioConfig->group("Confirmations").readEntry(keyName, true);
+
+    if (ask) {
+        const QString text(i18nc("@info", "Do you really want to empty the trash? All items will be deleted."));
+        //FIXME: should use KMessageBox::createKMessageBox so that it doesn't block the whole app!
+        del = KMessageBox::warningContinueCancel(&m_menu,
                                                         text,
                                                         QString(),
                                                         KGuiItem(i18nc("@action:button", "Empty Trash"),
-                                                                  KIcon("user-trash"))
+                                                        KIcon("user-trash")),
+                                                        KStandardGuiItem::cancel(),
+                                                        keyName, KMessageBox::Notify
                                                         ) == KMessageBox::Continue;

+
+        if (!keyName.isEmpty()) {
+            // Check kmessagebox setting... erase & copy to konquerorrc.
+            KSharedConfig::Ptr config = KGlobal::config();
+            KConfigGroup notificationGroup(config, "Notification Messages");
+            if (!notificationGroup.readEntry(keyName, true)) {
+                notificationGroup.writeEntry(keyName, true);
+                notificationGroup.sync();
+
+                KSharedConfigPtr kioConfig = KSharedConfig::openConfig("kiorc", KConfig::NoGlobals);
+                kioConfig->group("Confirmations").writeEntry(keyName, false);
+            }
+        }
+    }
     if (del) {
          // We can't use KonqOperations here. To avoid duplicating its code (small, though),
         // we can simply call ktrash.