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

List:       kde-commits
Subject:    KDE/kdebase/workspace/libs/plasma
From:       Rob Scheepmaker <r.scheepmaker () student ! utwente ! nl>
Date:       2008-10-29 17:01:18
Message-ID: 1225299678.914131.11987.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 877485 by scheepmaker:

Store the title and icon in extenderitem's config so applets don't have to \
store/restore this info manually.



 M  +8 -4      extenderitem.cpp  
 M  +7 -3      extenderitem.h  


--- trunk/KDE/kdebase/workspace/libs/plasma/extenderitem.cpp #877484:877485
@@ -72,15 +72,19 @@
 
     uint sourceAppletId = dg.readEntry("sourceAppletId", 0);
 
-    //TODO: automatically load title and icon.
+    //check if we're creating a new item or reinstantiating an existing one.
     if (!sourceAppletId) {
         //The item is new
         dg.writeEntry("sourceAppletPluginName", \
hostExtender->d->applet->pluginName());  dg.writeEntry("sourceAppletId", \
hostExtender->d->applet->id()); +        dg.writeEntry("sourceIconName", \
hostExtender->d->applet->icon());  d->sourceApplet = hostExtender->d->applet;
+        d->collapseIcon = new Icon(KIcon(hostExtender->d->applet->icon()), "", \
this);  } else {
         //The item already exists.
         d->name = dg.readEntry("extenderItemName", "");
+        d->title = dg.readEntry("extenderTitle", "");
+        d->collapseIcon = new Icon(KIcon(dg.readEntry("extenderIconName", "")), "", \
this);  
         //Find the sourceapplet.
         Corona *corona = hostExtender->d->applet->containment()->corona();
@@ -97,15 +101,13 @@
     //make sure we keep monitoring if the source applet still exists, so the return \
to source icon  //can be hidden if it is removed.
     connect(d->sourceApplet, SIGNAL(destroyed()), this, \
SLOT(sourceAppletRemoved())); +    connect(d->collapseIcon, SIGNAL(clicked()), this, \
SLOT(toggleCollapse()));  
     //create the toolbox.
     d->toolbox = new QGraphicsWidget(this);
     d->toolboxLayout = new QGraphicsLinearLayout(d->toolbox);
     d->toolbox->setLayout(d->toolboxLayout);
 
-    //create the collapse/applet icon.
-    d->collapseIcon = new Icon(KIcon(hostExtender->d->applet->icon()), "", this);
-    connect(d->collapseIcon, SIGNAL(clicked()), this, SLOT(toggleCollapse()));
 
     //set the extender we want to move to.
     setExtender(hostExtender);
@@ -135,6 +137,7 @@
 void ExtenderItem::setTitle(const QString &title)
 {
     d->title = title;
+    config().writeEntry("extenderTitle", title);
     update();
 }
 
@@ -180,6 +183,7 @@
 void ExtenderItem::setIcon(const QString &icon)
 {
     d->collapseIcon->setIcon(icon);
+    config().writeEntry("extenderIconName", icon);
 }
 
 QIcon ExtenderItem::icon() const
--- trunk/KDE/kdebase/workspace/libs/plasma/extenderitem.h #877484:877485
@@ -112,7 +112,8 @@
 
         /**
          * @param title the title that will be shown in the extender item's dragger. \
                Default is
-         * no title.
+         * no title. This title will also be stored in the item's configuration, so \
you don't have +         * to manually store/restore this information for your \
                extender items.
          */
         void setTitle(const QString &title);
 
@@ -123,7 +124,8 @@
 
         /**
          * You can assign names to extender items to look them up through the item() \
                function.
-         * Make sure you only use unique names.
+         * Make sure you only use unique names. This name will be stored in the \
item's +         * configuration.
          * @param name the name of the item. Defaults to an empty string.
          */
         void setName(const QString &name);
@@ -135,7 +137,9 @@
 
         /**
          * @param icon the icon name to display in the extender item's
-         * drag handle. Defaults to the source applet's icon.
+         * drag handle. Defaults to the source applet's icon. This icon name will \
also be stored +         * in the item's configuration, so you don't have to manually \
store/restore this +         * information.
          */
         void setIcon(const QString &icon);
 


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

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