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

List:       kde-commits
Subject:    branches/KDE/3.5/kdeadmin/knetworkconf/knetworkconf
From:       Juan Luis Baptiste <juan.baptiste () kdemail ! net>
Date:       2005-09-09 1:23:00
Message-ID: 1126228980.909549.11493.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 458737 by jbaptiste:

- Fixed crash when clicking on the load profile button and there isn't a profile \
                selected on the list.
- Fixed saving of the current configuration for the current loaded profile, it wasn't \
being saved.

 M  +24 -15    knetworkconf.cpp  


--- branches/KDE/3.5/kdeadmin/knetworkconf/knetworkconf/knetworkconf.cpp \
#458736:458737 @@ -953,22 +953,25 @@
 {
   //Get selected profile
   QListViewItem *item = klvProfilesList->currentItem();
-  QString selectedProfile = item->text(0);  
   
-  //And search for it in the profiles list
-  KNetworkInfo *profile = getProfile(netInfo->getProfilesList(),selectedProfile);
-  if (profile != NULL)
-  { 
-    profile->setProfilesList(netInfo->getProfilesList()); 
-    config->saveNetworkInfo(profile);
-    modified = false;
-    //connect( config, SIGNAL(readyLoadingNetworkInfo()), this, \
                SLOT(showSelectedProfile(selectedProfile)) );
-  }
-  else
-    KMessageBox::error(this,
-                        i18n("Could not load the selected Network Profile."),
-                        i18n("Error Reading Profile"));
-        
+  if (item != NULL)
+  {
+    QString selectedProfile = item->text(0);  
+  
+    //And search for it in the profiles list
+    KNetworkInfo *profile = getProfile(netInfo->getProfilesList(),selectedProfile);
+    if (profile != NULL)
+    { 
+      profile->setProfilesList(netInfo->getProfilesList()); 
+      config->saveNetworkInfo(profile);
+      modified = false;
+      //connect( config, SIGNAL(readyLoadingNetworkInfo()), this, \
SLOT(showSelectedProfile(selectedProfile)) ); +    }
+    else
+      KMessageBox::error(this,
+                          i18n("Could not load the selected Network Profile."),
+                          i18n("Error Reading Profile"));
+  }      
 }
 
 KNetworkInfo *KNetworkConf::getProfile(QPtrList<KNetworkInfo> profilesList, QString \
selectedProfile) @@ -1091,7 +1094,13 @@
       QString profileName = profileToUpdate->getProfileName();
       if (profileName == selectedProfile)
       { 
+        qDebug("profile updated");
         profileToUpdate = netInfo;   
+        int curPos = profiles.at();
+        profileToUpdate->setProfileName(profileName);   
+        profiles.remove();
+        profiles.insert(curPos,profileToUpdate);
+        netInfo->setProfilesList(profiles);
         modified = false;        
         enableApplyButtonSlot();
         break;


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

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