[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-panel-devel
Subject:    =?ISO-8859-1?B?UEFUQ0ggZm9yIGltcHJvdmUgdGhlIHBhbmVsIGFjdGlvbihidWcgbnVtOjE3NzIxOSk=?=
From:       "=?ISO-8859-1?B?emhhbmdxaWFuZw==?=" <zhangqiang () redflag-linux ! com>
Date:       2008-12-08 12:40:37
Message-ID: 20081208124037.170B713773B () mail ! redflag-linux ! com
[Download RAW message or body]

This is a MIME-formatted message.  If you see this text it means that your
mail software cannot handle MIME-formatted messages.

[Attachment #2 (text/html)]

In order to help general users.I make a patch.I don't know whether it is needed
and suitable.That is, if the user deletes the last panel,give the tip "This is
the last panel! Make sure you know how to add it.",that is unlike the usual tip
"Do you really want to remove the panel ?" I do it in the containment, and my
patch attached. Thanks very much.


["containment-h.patch" (containment-h.patch)]

--- kdebase/workspace/libs/plasma/containment.h	2008-12-07 19:06:26.000000000 +0800
+++ kdebase-new/workspace/libs/plasma/containment.h	2008-12-07 19:10:24.000000000 +0800
@@ -425,6 +425,7 @@
         friend class Applet;
         friend class ContainmentPrivate;
         ContainmentPrivate* const d;
+		static int panelNum;
 };
 
 } // Plasma namespace

["containment-cpp.patch" (containment-cpp.patch)]

--- kdebase/workspace/libs/plasma/containment.cpp	2008-12-07 18:58:14.000000000 +0800
+++ kdebase-new/workspace/libs/plasma/containment.cpp	2008-12-07 19:01:26.000000000 \
+0800 @@ -51,7 +51,7 @@
 #include "desktoptoolbox_p.h"
 #include "paneltoolbox_p.h"
 #include "svg.h"
-
+int Plasma::Containment:: panelNum=0;
 namespace Plasma
 {
 
@@ -228,6 +228,10 @@
         return;
     }
 
+    QString name=group.readEntry("plugin",QString());
+    if(name=="panel"){
+		Plasma::Containment::panelNum++;
+	}
     QRectF geo = group.readEntry("geometry", geometry());
     //override max/min
     //this ensures panels are set to their saved size even when they have max & min \
set to prevent @@ -256,13 +260,13 @@
     if (!group.isValid()) {
         group = config();
     }
-
     // locking is saved in Applet::save
     Applet::save(group);
     group.writeEntry("screen", d->screen);
     group.writeEntry("formfactor", (int)d->formFactor);
     group.writeEntry("location", (int)d->location);
     saveContents(group);
+    Plasma::Containment::panelNum++;
 }
 
 void Containment::saveContents(KConfigGroup &group) const
@@ -1035,11 +1039,23 @@
             return;
         }
 
+	if(Plasma::Containment::panelNum<=1){
+		 if (KMessageBox::warningContinueCancel(view(), i18n("This is the last panel! Make \
sure you know how to add it."),                      i18n("Remove %1", name()), \
KStandardGuiItem::remove()) == KMessageBox::Cancel ){ +			 return;
+		 }
+	     else {
+			 Applet::destroy();
+			 Plasma::Containment::panelNum--;
+			 return;
+		 }
+     }
+
         //FIXME maybe that %1 should be the containment type not the name
         if (KMessageBox::warningContinueCancel(view(), i18n("Do you really want to \
                remove this %1?", name()),
                     i18n("Remove %1", name()), KStandardGuiItem::remove()) == \
                KMessageBox::Continue ) {
-            //clearApplets();
+            //clearApplets();		
             Applet::destroy();
+			Plasma::Containment::panelNum--;
         }
     } else {
         Applet::destroy();



_______________________________________________
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic