void UserManagerBackend::addUserToGroup(QString user, QString groupname) { Group *group = getGroup(groupname); group->addMember(user); group->setChanges(); emit groupsChanged(); }
void UserManagerBackend::removeUserFromGroup(QString user, QString groupname) { Group *group = getGroup(groupname); group->removeMember(user); group->setChanges(); emit groupsChanged(); }
void UserManagerBackend::addGroup(QString groupname) { //Find free, invalid id int gid = -1; while (groupList[gid].getStatus() != -1) { gid--; } groupList[gid] = Group(groupname, -1, QStringList(), true); emit groupsChanged(); }
void ContactListModelUpdater::addContact(PsiContact* contact) { // qWarning(">>> addContact: %s", qPrintable(contact->jid())); Q_ASSERT(!monitoredContacts_.contains(contact)); if (monitoredContacts_.contains(contact)) return; monitoredContacts_[contact] = true; // qWarning("updater(%x):addContact: %s", (int)this, qPrintable(contact->jid().full())); addOperation(contact, AddContact); connect(contact, SIGNAL(destroyed(PsiContact*)), SLOT(removeContact(PsiContact*))); connect(contact, SIGNAL(updated()), SLOT(contactUpdated())); connect(contact, SIGNAL(groupsChanged()), SLOT(contactGroupsChanged())); }
TvChannelModel::TvChannelModel(TvChannelList *channelList, QObject *parent) : QAbstractItemModel(parent) , m_channelList(channelList) { connect(channelList, SIGNAL(channelsChanged()), this, SLOT(channelsChanged())); connect(channelList, SIGNAL(hiddenChannelsChanged()), this, SLOT(channelsChanged())); connect(channelList, SIGNAL(channelIconsChanged()), this, SLOT(channelIconsChanged())); connect(channelList, SIGNAL(groupsChanged()), this, SLOT(channelsChanged())); loadVisibleChannels(); }
void UserGroupsDialog::onSaveClicked() { UserGroupList* groups = UserGroupList::getInstance(); UserGroup* g = groups->findGroup(currentName); if (g) { g->name = m_ui->nameLineEdit->text(); g->description = m_ui->descrLineEdit->text(); g->color = currentcolor; g->members = m_ui->membersPlainTextEdit->toPlainText().split(QRegExp("[ ,;]+")); } groups->save(); m_ui->groupsListWidget->clear(); m_ui->groupsListWidget->addItems(groups->getGroupNames()); emit groupsChanged(); groups->updateMappings(); }
void Buddy::Update () { if (Name_ != GetEntryName ()) { Name_ = GetEntryName (); emit nameChanged (Name_); } auto purpleStatus = purple_presence_get_active_status (Buddy_->presence); const auto& status = FromPurpleStatus (Account_->GetPurpleAcc (), purpleStatus); if (status != Status_) { Status_ = status; emit statusChanged (Status_, QString ()); } auto groupNode = purple_buddy_get_group (Buddy_); const auto& newGroup = groupNode ? QString::fromUtf8 (groupNode->name) : QString (); if (newGroup != Group_) { Group_ = newGroup; emit groupsChanged ({ Group_ }); } }
void MRIMBuddy::SetGroup (const QString& group) { Info_.GroupNumber_ = A_->GetGroupManager ()->GetGroupNumber (group); Group_ = group; emit groupsChanged (Groups ()); }
bool UserManagerBackend::commit() { //Process users QMap<QString, User>::Iterator userIt; QStringList args; for ( userIt = userList.begin(); userIt != userList.end(); ++userIt ) { args.clear(); switch(userIt->getStatus()) { case 1: //Modify User qDebug() << "Modifying user " << userIt->getUsername(); if ( ! chroot.isEmpty() ) args << chroot << "pw"; args << "usermod"; args << userIt->getUsername(); // Only change home-dir on non-encrypted users if ( ! userIt->getEnc() ) { args << "-d"; args << userIt->getHome(); } args << "-s"; args << userIt->getShell(); args << "-c"; args << userIt->getFullname(); if ( ! chroot.isEmpty() ) QProcess::execute("chroot", args); else QProcess::execute("pw", args); if (userIt->getPassword() != "") { // Refuse to continue if we are trying to change PW // On an encrypted users homedir if ( userIt->getEnc() ) { qDebug() << "Cannot change encrypted password: "******"Changing password: "******"/tmp/.XXXXXXXX"); if ( rfile.open() ) { QTextStream stream( &rfile ); stream << userIt->getClearPassword(); rfile.close(); } if ( ! chroot.isEmpty() ) system("cat " + rfile.fileName().toLatin1() + " | chroot " + chroot.toLatin1() + " pw usermod " + userIt->getUsername().toLatin1() + " -h 0 "); else system("cat " + rfile.fileName().toLatin1() + " | pw usermod " + userIt->getUsername().toLatin1() + " -h 0 "); rfile.remove(); } break; case 2: { //Add User qDebug() << "Adding user " << userIt->getUsername(); // Create the new home-directory if ( chroot.isEmpty() ) { system("/usr/local/share/pcbsd/scripts/mkzfsdir.sh " + userIt->getHome().toLatin1() ); system("pw groupadd " + userIt->getUsername().toLatin1() ); } else { system("mkdir -p " + chroot.toLatin1() + "/" + userIt->getHome().toLatin1() + " 2>/dev/null" ); system("chroot " + chroot.toLatin1() + " ln -s /usr/home /home 2>/dev/null" ); system("chroot " + chroot.toLatin1() + " pw groupadd " + userIt->getUsername().toLatin1() ); } if ( ! chroot.isEmpty() ) args << chroot << "pw"; args << "useradd"; args << userIt->getUsername(); args << "-c"; args << userIt->getFullname(); args << "-m"; args << "-d"; args << userIt->getHome(); args << "-s"; args << userIt->getShell(); if (userIt->getGid() != -1) { args << "-g"; args << QString::number(userIt->getGid()); } else { args << "-g"; args << userIt->getUsername(); } args << "-G"; args << "operator"; if ( ! chroot.isEmpty() ) QProcess::execute("chroot", args); else QProcess::execute("pw", args); QTemporaryFile nfile("/tmp/.XXXXXXXX"); if ( nfile.open() ) { QTextStream stream( &nfile ); stream << userIt->getClearPassword(); nfile.close(); } if ( ! chroot.isEmpty() ) system("cat " + nfile.fileName().toLatin1() + " | chroot " + chroot.toLatin1() + " pw usermod " + userIt->getUsername().toLatin1() + " -h 0 "); else system("cat " + nfile.fileName().toLatin1() + " | pw usermod " + userIt->getUsername().toLatin1() + " -h 0 "); nfile.remove(); if ( chroot.isEmpty() ) { qDebug() << "Enabling Flash Plugin for " << userIt->getUsername(); QString flashCmd = "su " + userIt->getUsername() + " -c \"flashpluginctl on\""; system(flashCmd.toLatin1()); } // Set permissions if ( chroot.isEmpty() ) system("chown -R " + userIt->getUsername().toLatin1() +":" + userIt->getUsername().toLatin1() + " " + userIt->getHome().toLatin1() ); else system("chroot " + chroot.toLatin1() + " chown -R " + userIt->getUsername().toLatin1() +":" + userIt->getUsername().toLatin1() + " " + userIt->getHome().toLatin1() ); // Are we enabling encryption? if ( userIt->getEnc() ) { QProcess::execute("enable_user_pefs", QStringList() << userIt->getUsername() << userIt->getClearPassword() ); } break; } case 3: //Delete User qDebug() << "Deleting user " << userIt->getUsername(); if(userIt->getEnc()) { // Unmount PEFS system("umount " + userIt->getHome().toLatin1() ); } if ( ! chroot.isEmpty() ) args << chroot << "pw"; args << "userdel"; args << userIt->getUsername(); if(userIt->getDeleteHome()) { args << "-r"; system("/usr/local/share/pcbsd/scripts/rmzfsdir.sh " + userIt->getHome().toLatin1() ); } if ( ! chroot.isEmpty() ) QProcess::execute("chroot", args); else QProcess::execute("pw", args); break; } } refreshUsers(); //Process groups QMap<int, Group>::Iterator groupIt; for ( groupIt = groupList.begin(); groupIt != groupList.end(); ++groupIt ) { args.clear(); switch(groupIt->getStatus()) { case 1: //Modify Group qDebug() << "Modifying group " << groupIt->getGroupname(); if ( ! chroot.isEmpty() ) args << chroot << "pw"; args << "groupmod"; args << groupIt->getGroupname(); args << "-M"; args << groupIt->getMembers().join(","); if ( ! chroot.isEmpty() ) QProcess::execute("chroot", args); else QProcess::execute("pw", args); break; case 2: //Add Group qDebug() << "Adding group " << groupIt->getGroupname(); if ( ! chroot.isEmpty() ) args << chroot << "pw"; args << "groupadd"; args << groupIt->getGroupname(); args << "-M"; args << groupIt->getMembers().join(","); if ( ! chroot.isEmpty() ) QProcess::execute("chroot", args); else QProcess::execute("pw", args); break; case 3: //Delete Group qDebug() << "Deleting group " << groupIt->getGroupname(); if ( ! chroot.isEmpty() ) args << chroot << "pw"; args << "groupdel"; args << groupIt->getGroupname(); if ( ! chroot.isEmpty() ) QProcess::execute("chroot", args); else QProcess::execute("pw", args); break; } } refreshGroups(); emit groupsChanged(); emit usersChanged(); return true; }
void ContactListModel::Private::realAddContact(PsiContact *contact) { ContactListItem *root = static_cast<ContactListItem*>(q->root());; if (accountsEnabled) { PsiAccount *account = contact->account(); ContactListItem *accountItem = root->findAccount(account); if (!accountItem) { accountItem = new ContactListItem(q, ContactListItem::Type::AccountType); accountItem->setAccount(account); accountItem->setExpanded(!collapsed.contains(accountItem->internalName())); connect(account, SIGNAL(accountDestroyed()), SLOT(onAccountDestroyed())); connect(account, SIGNAL(updatedAccount()), SLOT(updateAccount())); root->appendChild(accountItem); } root = accountItem; } if (!contact->isSelf() && groupsEnabled) { ContactListItem::SpecialGroupType specialGroupType = specialGroupFor(contact); QStringList groups = specialGroupType == ContactListItem::SpecialGroupType::NoneSpecialGroupType ? contact->groups() : QStringList{QString()}; for (const QString &groupName: groups) { ContactListItem *groupItem = nullptr; if (specialGroupType == ContactListItem::SpecialGroupType::NoneSpecialGroupType) groupItem = root->findGroup(groupName); else groupItem = root->findGroup(specialGroupType); // No duplicates if (groupItem && groupItem->findContact(contact)) { continue; } ContactListItem *item = new ContactListItem(q, ContactListItem::Type::ContactType); item->setContact(contact); if (!groupItem) { groupItem = new ContactListItem(q, ContactListItem::Type::GroupType, specialGroupType); if (specialGroupType == ContactListItem::SpecialGroupType::NoneSpecialGroupType) groupItem->setName(groupName); root->appendChild(groupItem); groupItem->setExpanded(!collapsed.contains(groupItem->internalName())); groupItem->setHidden(hidden.contains(groupItem->internalName())); } groupItem->appendChild(item); monitoredContacts.insertMulti(contact, q->toModelIndex(item)); } } else { ContactListItem *item = new ContactListItem(q, ContactListItem::Type::ContactType); item->setContact(contact); root->appendChild(item); monitoredContacts.insertMulti(contact, q->toModelIndex(item)); } connect(contact, SIGNAL(destroyed(PsiContact*)), SLOT(removeContact(PsiContact*))); connect(contact, SIGNAL(groupsChanged()), SLOT(contactGroupsChanged())); connect(contact, SIGNAL(updated()), SLOT(contactUpdated())); connect(contact, SIGNAL(alert()), SLOT(contactUpdated())); connect(contact, SIGNAL(anim()), SLOT(contactUpdated())); }
void MetaEntry::SetGroups (const QStringList& groups) { Groups_ = groups; emit groupsChanged (groups); }
void FakeGroupContact::setGroups(QStringList groups) { groups_ = groups; emit groupsChanged(); }
void UserManagerBackend::deleteGroup(QString groupname) { getGroup(groupname)->setDeleted(); emit groupsChanged(); }
void VkEntry::ReemitGroups () { emit groupsChanged (Groups ()); }
void GlooxCLEntry::SetAuthRequested (bool auth) { AuthRequested_ = auth; emit statusChanged (GetStatus (QString ()), QString ()); emit groupsChanged (Groups ()); }
void NotifyQt::notifyListChange(int list, int type) { #ifdef NOTIFY_DEBUG std::cerr << "NotifyQt::notifyListChange()" << std::endl; #endif switch(list) { case NOTIFY_LIST_NEIGHBOURS: #ifdef NOTIFY_DEBUG std::cerr << "received neighbrs changed" << std::endl ; #endif emit neighborsChanged(); break; case NOTIFY_LIST_FRIENDS: #ifdef NOTIFY_DEBUG std::cerr << "received friends changed" << std::endl ; #endif emit friendsChanged() ; break; case NOTIFY_LIST_DIRLIST_LOCAL: #ifdef NOTIFY_DEBUG std::cerr << "received files changed" << std::endl ; #endif emit filesPostModChanged(true) ; /* Local */ break; case NOTIFY_LIST_DIRLIST_FRIENDS: #ifdef NOTIFY_DEBUG std::cerr << "received files changed" << std::endl ; #endif emit filesPostModChanged(false) ; /* Local */ break; case NOTIFY_LIST_SEARCHLIST: break; case NOTIFY_LIST_MESSAGELIST: #ifdef NOTIFY_DEBUG std::cerr << "received msg changed" << std::endl ; #endif emit messagesChanged() ; break; case NOTIFY_LIST_MESSAGE_TAGS: #ifdef NOTIFY_DEBUG std::cerr << "received msg tags changed" << std::endl ; #endif emit messagesTagsChanged(); break; case NOTIFY_LIST_CHANNELLIST: break; case NOTIFY_LIST_TRANSFERLIST: #ifdef NOTIFY_DEBUG std::cerr << "received transfer changed" << std::endl ; #endif emit transfersChanged() ; break; case NOTIFY_LIST_CONFIG: #ifdef NOTIFY_DEBUG std::cerr << "received config changed" << std::endl ; #endif emit configChanged() ; break ; case NOTIFY_LIST_FORUMLIST_LOCKED: #ifdef NOTIFY_DEBUG std::cerr << "received forum msg changed" << std::endl ; #endif emit forumsChanged(); // use connect with Qt::QueuedConnection break; case NOTIFY_LIST_CHANNELLIST_LOCKED: #ifdef NOTIFY_DEBUG std::cerr << "received channel msg changed" << std::endl ; #endif emit channelsChanged(type); // use connect with Qt::QueuedConnection break; case NOTIFY_LIST_PUBLIC_CHAT: #ifdef NOTIFY_DEBUG std::cerr << "received public chat changed" << std::endl ; #endif emit publicChatChanged(type); break; case NOTIFY_LIST_PRIVATE_INCOMING_CHAT: case NOTIFY_LIST_PRIVATE_OUTGOING_CHAT: #ifdef NOTIFY_DEBUG std::cerr << "received private chat changed" << std::endl ; #endif emit privateChatChanged(list, type); break; case NOTIFY_LIST_GROUPLIST: #ifdef NOTIFY_DEBUG std::cerr << "received groups changed" << std::endl ; #endif emit groupsChanged(type); break; default: break; } return; }
void Scene::mousePressEvent( QMouseEvent* e ) { // Regular behavior QGLViewer::mousePressEvent(e); if ((e->button() == Qt::RightButton) && (e->modifiers() == Qt::ShiftModifier)) { QMenu menu( this ); QAction* selectControllerAction = menu.addAction("Select controller"); QAction* selectCurveAction = menu.addAction("Select curve"); menu.addSeparator(); QAction* action = NULL; /*switch (selectMode){ case CONTROLLER: case CONTROLLER_ELEMENT: if(selection.isEmpty()){ print("Please select some controllers."); break; }*/ Controller * ctrl = (Controller *)activeObject()->ptr["controller"]; QAction* symmGrp = menu.addAction("Create Symmetry group.."); QAction* concentricGrp = menu.addAction("Create Concentric group.."); QAction* coplanGrp = menu.addAction("Create Coplanar group.."); menu.addSeparator(); QAction* self1foldSymm = menu.addAction("Create 1-fold Self-Symmetry.."); QAction* self2foldSymm = menu.addAction("Create 2-fold Self-Symmetry.."); menu.addSeparator(); QAction* addFixedPoint = menu.addAction("Add fixed Point"); // == Deformer stuff === menu.addSeparator(); QAction* selectFFD = menu.addAction("FFD"); QAction* selectVoxelDeformer = menu.addAction("Voxel Deformer"); // == end deformer === // == Primitive geometry stuff == menu.addSeparator(); QMenu & mesh_menu = *menu.addMenu("Modify geometry"); QAction* simplifyAction = mesh_menu.addAction("Simplify"); QAction* remeshAction = mesh_menu.addAction("Re-mesh"); QAction* replaceAction = mesh_menu.addAction("Replace geometry..."); mesh_menu.addSeparator(); QAction* loopAction = mesh_menu.addAction("Loop"); QAction* longEdgeAction = mesh_menu.addAction("Longest Edge"); QAction* butterflyAction = mesh_menu.addAction("Modified Butterfly"); mesh_menu.addSeparator(); QAction* laplacianSmoothAction = mesh_menu.addAction("Laplacian smoothing"); QAction* scaleSmoothAction = mesh_menu.addAction("Scale dependent smoothing"); QAction* mcfSmoothAction = mesh_menu.addAction("MCF smoothing"); // == end === action = menu.exec(e->globalPos()); // show menu // Selections if(action == selectControllerAction) setSelectMode(CONTROLLER); if(action == selectCurveAction) setSelectMode(CONTROLLER_ELEMENT); if(action == selectFFD) setSelectMode(FFD_DEFORMER); if(action == selectVoxelDeformer) setSelectMode(VOXEL_DEFORMER); Group* newGroup = NULL; int opt = 0; if(action == symmGrp) newGroup = new SymmetryGroup(SYMMETRY); if(action == self1foldSymm) ctrl->getSelectedPrimitive()->setSymmetryPlanes(1); if(action == self2foldSymm) ctrl->getSelectedPrimitive()->setSymmetryPlanes(2); if(action == addFixedPoint) { Primitive * prim = ctrl->getSelectedPrimitive(); Point pos = prim->getSelectedCurveCenter(); prim->addFixedPoint(pos); } if(newGroup) { newGroup->process(ctrl->getPrimitives(selection)); newGroup->id = QString::number(ctrl->groups.size()); ctrl->groups[newGroup->id] = newGroup; emit(groupsChanged()); print("New group added."); } if(mesh_menu.actions().contains(action)) { Primitive * prim = ctrl->getSelectedPrimitive(); if(prim){ QSurfaceMesh * mesh = prim->getMesh(); double avgEdge = mesh->getAverageEdgeLength(); if(action == simplifyAction) Decimater::simplify(mesh, 0.5); if(action == remeshAction) LaplacianRemesher::remesh(mesh, avgEdge * 0.6); if(action == loopAction) LoopSubdivider().subdivide(*mesh,1); if(action == butterflyAction) ModifiedButterfly().subdivide(*mesh, 1); if(action == longEdgeAction) LongestEdgeSubdivision(avgEdge * 0.5).subdivide(*mesh, 1); if(action == laplacianSmoothAction) Smoother::LaplacianSmoothing(mesh, 1); if(action == scaleSmoothAction) Smoother::ScaleDependentSmoothing(mesh, 1); if(action == mcfSmoothAction) Smoother::MeanCurvatureFlow(mesh, 1); if(action == replaceAction) { QMenu prim_menu( this ); foreach(Primitive * prim, ctrl->getPrimitives()) prim_menu.addAction(prim->id); action = prim_menu.exec(e->globalPos()); // Replace geometry QSurfaceMesh * originalMesh = prim->getMesh(); Primitive * otherPrim = ctrl->getPrimitive(action->text()); if(otherPrim){ QSurfaceMesh * toMesh = otherPrim->getMesh(); originalMesh->setFromOther(toMesh); } } mesh->garbage_collection(); mesh->buildUp(); updateActiveObject(); prim->computeMeshCoordinates(); } } /*break; }*/ } }