Changeset 6287 for trunk/qt4-gui/src/dialogs
- Timestamp:
- 06/14/08 04:06:02 (6 months ago)
- Location:
- trunk/qt4-gui/src/dialogs
- Files:
-
- 4 modified
-
adduserdlg.cpp (modified) (4 diffs)
-
adduserdlg.h (modified) (2 diffs)
-
searchuserdlg.cpp (modified) (5 diffs)
-
searchuserdlg.h (modified) (3 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(); -
trunk/qt4-gui/src/dialogs/adduserdlg.h
r6221 r6287 29 29 namespace LicqQtGui 30 30 { 31 class GroupComboBox; 31 32 class ProtoComboBox; 32 33 … … 40 41 private: 41 42 QCheckBox* myNotify; 42 QLineEdit* myUin; 43 QLineEdit* myId; 44 GroupComboBox* myGroup; 43 45 ProtoComboBox* myProtocol; 44 46 -
trunk/qt4-gui/src/dialogs/searchuserdlg.cpp
r6249 r6287 46 46 #include "core/signalmanager.h" 47 47 48 #include "dialogs/adduserdlg.h" 49 48 50 #include "helpers/support.h" 49 51 … … 52 54 53 55 SearchUserDlg::SearchUserDlg() 54 : searchTag(0) 56 : ppid(LICQ_PPID), 57 searchTag(0) 55 58 { 56 59 Support::setWidgetProps(this, "SearchUserDialog"); … … 178 181 grp_lay->addWidget(foundView, 0, 0, 1, 4); 179 182 180 chkAlertUser = new QCheckBox(tr("A&lert User"));181 chkAlertUser->setChecked(true);182 grp_lay->addWidget(chkAlertUser, 1, 0);183 184 183 btnInfo = new QPushButton(tr("View &Info")); 185 184 btnInfo->setEnabled(false); 186 185 connect(btnInfo, SIGNAL(clicked()), SLOT(viewInfo())); 187 grp_lay->addWidget(btnInfo, 1, 2);186 grp_lay->addWidget(btnInfo, 1, 1); 188 187 189 188 btnAdd = new QPushButton(tr("&Add User")); 190 189 btnAdd->setEnabled(false); 191 190 connect(btnAdd, SIGNAL(clicked()), SLOT(addUser())); 192 grp_lay->addWidget(btnAdd, 1, 3);191 grp_lay->addWidget(btnAdd, 1, 2); 193 192 194 193 grp_lay->setRowStretch(0, 1); 195 grp_lay->setColumnStretch( 1, 1);194 grp_lay->setColumnStretch(0, 1); 196 195 lay->addWidget(grpResult, 1); 197 196 … … 445 444 foreach (QTreeWidgetItem* current, foundView->selectedItems()) 446 445 { 447 QString szId = current->data(0, Qt::UserRole).toString(); 448 449 if (!gUserManager.IsOnList(szId.toLatin1(), LICQ_PPID)) 450 gLicqDaemon->AddUserToList( 451 szId.toLatin1(), LICQ_PPID, false, true); 452 453 LicqGui::instance()->showInfoDialog(mnuUserGeneral, szId, LICQ_PPID, false, true); 446 QByteArray id = current->data(0, Qt::UserRole).toString().toLatin1(); 447 448 if (!gUserManager.IsOnList(id, ppid)) 449 gLicqDaemon->AddUserToList(id, ppid, false, true); 450 451 LicqGui::instance()->showInfoDialog(mnuUserGeneral, id, ppid, false, true); 454 452 } 455 453 } … … 459 457 foreach (QTreeWidgetItem* current, foundView->selectedItems()) 460 458 { 461 unsigned long uin = current->data(0, Qt::UserRole).toString().toULong(); 462 463 if (gLicqDaemon->AddUserToList(uin) && 464 chkAlertUser->isChecked()) 465 gLicqDaemon->icqAlertUser(uin); 459 QString id = current->data(0, Qt::UserRole).toString(); 460 461 new AddUserDlg(id, ppid, this); 466 462 } 467 463 -
trunk/qt4-gui/src/dialogs/searchuserdlg.h
r6180 r6287 40 40 namespace LicqQtGui 41 41 { 42 class TabWidget;43 44 42 //TODO for protocol plugin support 45 43 … … 55 53 56 54 private: 55 unsigned long ppid; 57 56 unsigned long searchTag; 58 57 … … 80 79 81 80 QCheckBox* chkOnlineOnly; 82 QCheckBox* chkAlertUser;83 81 84 82 QPushButton* btnSearch;
