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

List:       kde-commits
Subject:    playground/base/attica/plasma/opendesktop
From:       Sebastian Kügler <sebas () kde ! org>
Date:       2009-04-29 2:47:41
Message-ID: 1240973261.294653.26591.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 960773 by sebas:

Make setting the maximum number work

 M  +13 -11    opendesktop.cpp  
 M  +1 -2      opendesktop.h  


--- trunk/playground/base/attica/plasma/opendesktop/opendesktop.cpp #960772:960773
@@ -57,14 +57,13 @@
     : Plasma::PopupApplet(parent, args),
         id(0),
         m_tabs(0),
-        m_icon(0),
         m_friendsScroll(0),
         m_friendsWidget(0),
         m_friendsLayout(0),
         m_nearScroll(0),
         m_nearWidget(0),
         m_nearLayout(0),
-        m_maxContacts(0)
+        m_maximumItems(0)
 {
     KGlobal::locale()->insertCatalog("plasma_applet_opendesktop");
     setBackgroundHints(StandardBackground);
@@ -101,7 +100,8 @@
 {
     kDebug() << "init: opendesktop";
     KConfigGroup cg = config();
-    m_maxContacts = cg.readEntry("maxContacts", 999);
+    m_maximumItems = cg.readEntry("maxContacts", 64);
+    dataEngine("ocs")->connectSource("MaximumItems-" + QString::number(m_maximumItems), this);
     if (!id) {
         id = cg.readEntry("currentId", 0);
     } else {
@@ -134,6 +134,7 @@
 
 void OpenDesktop::connectFriends(const QString &name)
 {
+    kDebug() << "URL" << dataEngine("ocs")->sources();
     QString src = QString("Friends-%1").arg(name);
     dataEngine("ocs")->connectSource(src, this);
     connect(dataEngine("ocs"), SIGNAL(sourceAdded(QString)),
@@ -232,12 +233,12 @@
     }
 
     // just show the first couple of widgets
-    if ( m_friends.count() > m_maxContacts ) {
+    if ( m_friends.count() > m_maximumItems ) {
         return;
     }
 
     // or 'scroll' through the and end with the last
-    if ( m_friends.count() > m_maxContacts ) {
+    if ( m_friends.count() > m_maximumItems ) {
         ContactWidget *widget = m_friends.values().takeFirst();
         m_friendsLayout->removeItem( widget );
         widget->deleteLater();
@@ -278,12 +279,12 @@
     }
 
     // just show the first couple of widgets
-    if ( m_near.count() > m_maxContacts ) {
+    if ( m_near.count() > m_maximumItems ) {
         return;
     }
 
     // or 'scroll' through the and end with the last
-    if ( m_near.count() > m_maxContacts ) {
+    if ( m_near.count() > m_maximumItems ) {
         ContactWidget *widget = m_near.values().takeFirst();
         m_nearLayout->removeItem( widget );
         widget->deleteLater();
@@ -430,7 +431,7 @@
     connect(parent, SIGNAL(okClicked()), this, SLOT(configAccepted()));
     connect(ui.registerButton, SIGNAL(clicked()), this, SLOT(registerAccount()));
     connect(locationUi.publishLocation, SIGNAL(clicked()), this, SLOT(publishGeoLocation()));
-    ui.maxitems->setValue(m_maxContacts);
+    ui.maxitems->setValue(m_maximumItems);
     ui.username->setText(m_username);
 
     locationUi.city->setText(m_geolocation->city);
@@ -476,10 +477,11 @@
         setConfigurationRequired(false);
     }
     int cmax = ui.maxitems->value();
-    if (m_maxContacts != cmax) {
-        m_maxContacts = cmax;
-        cg.writeEntry("maxContacts", m_maxContacts);
+    if (m_maximumItems != cmax) {
+        m_maximumItems = cmax;
+        cg.writeEntry("maxContacts", m_maximumItems);
         emit configNeedsSaving();
+        dataEngine("ocs")->connectSource("MaximumItems-" + QString::number(m_maximumItems), this);
     }
 
     syncGeoLocation();
--- trunk/playground/base/attica/plasma/opendesktop/opendesktop.h #960772:960773
@@ -86,7 +86,6 @@
 
         qlonglong id;
         Plasma::TabBar* m_tabs;
-        Plasma::IconWidget* m_icon;
 
         QGraphicsLinearLayout* m_layout;
         
@@ -108,7 +107,7 @@
         QGraphicsLinearLayout* m_nearLayout;
 
         // Config values
-        int m_maxContacts;
+        int m_maximumItems;
         QString m_username;
         QString m_displayedUser;
         struct GeoLocation *m_geolocation;
[prev in list] [next in list] [prev in thread] [next in thread] 

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