Changeset 6287 for trunk/qt4-gui/src/dialogs/adduserdlg.cpp
- Timestamp:
- 06/14/08 04:06:02 (6 months ago)
- Files:
-
- 1 modified
-
trunk/qt4-gui/src/dialogs/adduserdlg.cpp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/qt4-gui/src/dialogs/adduserdlg.cpp
r6252 r6287 31 31 #include "helpers/support.h" 32 32 33 #include "widgets/groupcombobox.h" 33 34 #include "widgets/protocombobox.h" 34 35 … … 55 56 layDialog->addWidget(myProtocol, line++, 1); 56 57 57 QLabel* lblUin = new QLabel(tr("New &User ID:")); 58 myUin = new QLineEdit(); 58 QLabel* lblGroup = new QLabel(tr("&Group:")); 59 myGroup = new GroupComboBox(); 60 myGroup->setCurrentGroupId(gUserManager.NewUserGroup()); 61 lblGroup->setBuddy(myGroup); 62 63 layDialog->addWidget(lblGroup, line, 0); 64 layDialog->addWidget(myGroup, line++, 1); 65 66 QLabel* lblId = new QLabel(tr("New &User ID:")); 67 myId = new QLineEdit(); 59 68 if (!id.isEmpty()) 60 my Uin->setText(id);61 connect(my Uin, SIGNAL(returnPressed()), SLOT(ok()));62 lbl Uin->setBuddy(myUin);69 myId->setText(id); 70 connect(myId, SIGNAL(returnPressed()), SLOT(ok())); 71 lblId->setBuddy(myId); 63 72 64 layDialog->addWidget(lbl Uin, line, 0);65 layDialog->addWidget(my Uin, line++, 1);73 layDialog->addWidget(lblId, line, 0); 74 layDialog->addWidget(myId, line++, 1); 66 75 67 76 myNotify = new QCheckBox(tr("&Notify User")); … … 77 86 layDialog->addWidget(buttons, line++, 0, 1, 2); 78 87 79 my Uin->setFocus();88 myId->setFocus(); 80 89 show(); 81 90 } … … 83 92 void AddUserDlg::ok() 84 93 { 85 QString uin = myUin->text(); 94 QByteArray id = myId->text().trimmed().toLatin1(); 95 unsigned long ppid = myProtocol->currentPpid(); 96 unsigned short group = myGroup->currentGroupId(); 97 bool notify = myNotify->isChecked(); 86 98 87 if (!uin.isEmpty()) 88 gLicqDaemon->AddUserToList(uin.toLatin1(), myProtocol->currentPpid(), 89 myNotify->isChecked()); 99 if (!id.isEmpty()) 100 { 101 ICQUser* u = gUserManager.FetchUser(id, ppid, LOCK_W); 102 103 if (u == NULL) 104 { 105 unsigned short currentNewGroup = gUserManager.NewUserGroup(); 106 gUserManager.SetNewUserGroup(group); 107 gLicqDaemon->AddUserToList(id, ppid, notify); 108 gUserManager.SetNewUserGroup(currentNewGroup); 109 } 110 else 111 { 112 if (u->NotInList()) 113 { 114 u->SetPermanent(); 115 gUserManager.DropUser(u); 116 gUserManager.AddUserToGroup(id.toLatin1()); 117 if (notify && ppid == LICQ_PPID) 118 gLicqDaemon->icqAlertUser(id.toULong()); 119 } 120 else 121 gUserManager.DropUser(u); 122 } 123 } 90 124 91 125 close();
