[PC-BSD Commits] r146 - pcbsd/trunk/pcbsdusermanager

svn at pcbsd.org svn at pcbsd.org
Tue Mar 27 12:11:07 PST 2007


Author: tim
Date: 2007-03-27 21:11:07 +0100 (Tue, 27 Mar 2007)
New Revision: 146

Modified:
   pcbsd/trunk/pcbsdusermanager/maindlgcode.cpp
   pcbsd/trunk/pcbsdusermanager/usermanagerback.cpp
Log:
Fixed issue where primary group would be incorrectly reported after committing changes in the user tab of the advanced dialog.
Fixed issue where the a new group would be lost if a new user was added to it, before either were committed to the system.


Modified: pcbsd/trunk/pcbsdusermanager/maindlgcode.cpp
===================================================================
--- pcbsd/trunk/pcbsdusermanager/maindlgcode.cpp	2007-03-22 18:50:07 UTC (rev 145)
+++ pcbsd/trunk/pcbsdusermanager/maindlgcode.cpp	2007-03-27 20:11:07 UTC (rev 146)
@@ -58,7 +58,6 @@
     setEnabled(true);
     
     //Make connections
-    connect(userList, SIGNAL(highlighted( const QString & )), this, SLOT(getUserDetails( const QString& )));
     connect(groupList, SIGNAL(highlighted( const QString & )), this, SLOT(getGroupDetails( const QString& )));
     connect(newButton, SIGNAL(clicked()), this, SLOT(showAddDlg()));
     connect(back, SIGNAL(usersChanged()), this, SLOT(usersChanged()));
@@ -78,6 +77,9 @@
 
 void mainDlgCode::updateUserList()
 {
+    qDebug("MainDlg: Updating user list");
+    disconnect(userList, SIGNAL(highlighted( const QString & )), 0, 0);
+    
     userListPointer = userList->currentItem();
     if (userListPointer < 0) { userListPointer = 0; }
     QStringList users = back->getAllUsers(-1, -1);
@@ -88,6 +90,8 @@
     userList->ensureCurrentVisible();
     getUserDetails(userList->currentText());
     
+    connect(userList, SIGNAL(highlighted( const QString & )), this, SLOT(getUserDetails( const QString& )));
+    
     //These won't always invoke first time without these lines
     fullnameChanged();
     homeChanged();
@@ -95,6 +99,7 @@
 
 void mainDlgCode::updateShellList()
 {
+    qDebug("MainDlg: Updating shell list");
     QStringList shells = back->getShells();
     shells.sort();
     shellBox->clear();
@@ -103,6 +108,7 @@
 
 void mainDlgCode::updateGroupList()
 {
+    qDebug("MainDlg: Updating group list");
     groupListPointer = groupList->currentItem();
     if (groupListPointer < 0) { groupListPointer = 0; }
     QStringList groups = back->getAllGroups(-1, -1);
@@ -188,8 +194,8 @@
 
 void mainDlgCode::usersChanged()
 {
+    updateGroupList();
     updateUserList();
-    updateGroupList();
     emit changed(true);
 }
 

Modified: pcbsd/trunk/pcbsdusermanager/usermanagerback.cpp
===================================================================
--- pcbsd/trunk/pcbsdusermanager/usermanagerback.cpp	2007-03-22 18:50:07 UTC (rev 145)
+++ pcbsd/trunk/pcbsdusermanager/usermanagerback.cpp	2007-03-27 20:11:07 UTC (rev 146)
@@ -314,50 +314,7 @@
 
 bool UserManagerBackend::commit()
 {
-    //Process groups
-    QMap<int, Group>::Iterator groupIt;
     
-    for ( groupIt = groupList.begin(); groupIt != groupList.end(); ++groupIt )
-    {
-        pw = new QProcess(0);
-        switch(groupIt.data().getStatus())
-        {
-            case 1:
-                //Modify Group
-                qDebug("Modifying group '%s'", groupIt.data().getGroupname().ascii());
-                pw->addArgument("pw");
-                pw->addArgument("groupmod");
-                pw->addArgument(groupIt.data().getGroupname());
-                pw->addArgument("-M");
-                pw->addArgument(groupIt.data().getMembers().join(","));
-                pw->start();
-                while(pw->isRunning());
-                break;
-            case 2:
-                //Add Group
-                qDebug("Adding group '%s'", groupIt.data().getGroupname().ascii());
-                pw->addArgument("pw");
-                pw->addArgument("groupadd");
-                pw->addArgument(groupIt.data().getGroupname());
-                pw->addArgument("-M");
-                pw->addArgument(groupIt.data().getMembers().join(","));
-                pw->start();
-                while(pw->isRunning());
-                break;
-            case 3:
-                //Delete Group
-                qDebug("Deleting group '%s'", groupIt.data().getGroupname().ascii());
-                pw->addArgument("pw");
-                pw->addArgument("groupdel");
-                pw->addArgument(groupIt.data().getGroupname());
-                pw->start();
-                while(pw->isRunning());
-                break;
-	}
-    }
-    refreshGroups();
-    emit groupsChanged();
-    
     //Process users
     QMap<QString, User>::Iterator userIt;
     
@@ -434,6 +391,50 @@
         }
     }
     refreshUsers();
+    
+    //Process groups
+    QMap<int, Group>::Iterator groupIt;
+    
+    for ( groupIt = groupList.begin(); groupIt != groupList.end(); ++groupIt )
+    {
+        pw = new QProcess(0);
+        switch(groupIt.data().getStatus())
+        {
+            case 1:
+                //Modify Group
+                qDebug("Modifying group '%s'", groupIt.data().getGroupname().ascii());
+                pw->addArgument("pw");
+                pw->addArgument("groupmod");
+                pw->addArgument(groupIt.data().getGroupname());
+                pw->addArgument("-M");
+                pw->addArgument(groupIt.data().getMembers().join(","));
+                pw->start();
+                while(pw->isRunning());
+                break;
+            case 2:
+                //Add Group
+                qDebug("Adding group '%s'", groupIt.data().getGroupname().ascii());
+                pw->addArgument("pw");
+                pw->addArgument("groupadd");
+                pw->addArgument(groupIt.data().getGroupname());
+                pw->addArgument("-M");
+                pw->addArgument(groupIt.data().getMembers().join(","));
+                pw->start();
+                while(pw->isRunning());
+                break;
+            case 3:
+                //Delete Group
+                qDebug("Deleting group '%s'", groupIt.data().getGroupname().ascii());
+                pw->addArgument("pw");
+                pw->addArgument("groupdel");
+                pw->addArgument(groupIt.data().getGroupname());
+                pw->start();
+                while(pw->isRunning());
+                break;
+	}
+    }
+    refreshGroups();
+    emit groupsChanged();
     emit usersChanged();
     
     return true;



More information about the Commits mailing list