void TreeArea::groupsItemClicked(const QPoint& pos){ // We assume that if the item clicked does not have any child, it is a group QTreeWidgetItem* item = this->groupsTree->currentItem(); if (item->parent() == NULL){ // Add a menu QMenu menu(this->groupsTree); // Add the actions to the menu QAction* actionHide = menu.addAction("Hide Group"); QAction* actionShow = menu.addAction("Show Group"); QAction* actionColor = menu.addAction("Change Group Color"); // Connect the actions created with their slots QObject::connect(actionHide, SIGNAL(triggered()), this, SLOT(hideGroup())); QObject::connect(actionShow, SIGNAL(triggered()), this, SLOT(showGroup())); QObject::connect(actionColor, SIGNAL(triggered()), this, SLOT(changeGroupColor())); // Show the menu at the current position menu.exec(QCursor::pos()); } else { // Add a menu QMenu menu(this->groupsTree); // Add the actions to the menu QAction* actionHide = menu.addAction("Hide Sort"); QAction* actionShow = menu.addAction("Show Sort"); QAction* actionColor = menu.addAction("Change Sort Color"); // Connect the actions created with their slots QObject::connect(actionHide, SIGNAL(triggered()), this, SLOT(hideSortClickedFromGroup())); QObject::connect(actionShow, SIGNAL(triggered()), this, SLOT(showSortClickedFromGroup())); QObject::connect(actionColor, SIGNAL(triggered()), this, SLOT(changeSortColorClickedFromGroup())); // Show the menu at the current position menu.exec(QCursor::pos()); } }
void PolkaView::cloneGroup( const Polka::Identity &group ) { bool ok; QString name = KInputDialog::getText( i18n("Clone Group"), i18n("Enter name of new group"), i18n("Clone of %1").arg( group.name().value() ), &ok ); if ( ok ) { Polka::Identity identity; identity.setType( "group" ); Polka::Name n; n.setValue( name ); identity.setName( n ); Polka::Identity new_group = m_model->insert( identity, i18n("Clone group '%1' to '%2'").arg( group.name().value() ) .arg( name ) ); Polka::Identity::List members = m_model->identitiesOfGroup( group ); foreach( Polka::Identity member, members ) { m_model->addIdentity( member, new_group ); } m_model->addIdentity( new_group, m_group ); showGroup( new_group ); }
viewGroupIscrived::viewGroupIscrived(account* acc, legami* boss, QWidget *parent) : QWidget(parent), accToShow(acc), Boss(boss) { showGr=0; groupList=Boss->groupSearchbyUsern(accToShow->user()->user()); layout= new QGridLayout(this); groupsListView= new QListView(this); layout->addWidget(groupsListView, 0, 0); scrollRightArea= new QScrollArea(this); layout->addWidget(scrollRightArea, 1, 0); QStandardItemModel* model= new QStandardItemModel(this); QStandardItem* parentItem= model->invisibleRootItem(); QVector<group*>::iterator it=groupList.begin(); for(;it<groupList.end();++it){ QStandardItem* item= new QStandardItem((*it)->name()); item->setEditable(false); parentItem->appendRow(item); } groupsListView->setModel(model); connect(groupsListView, SIGNAL(clicked(QModelIndex)), this, SLOT(showGroup(QModelIndex))); setLayout(layout); }
void Gui_AdminWindow::createGroupList() { list<Group*> l = _admin->listGroups(); for(list<Group*>::iterator it = l.begin(); it != l.end(); ++it) { QListWidgetItem* item = new QListWidgetItem; item->setData(Qt::DisplayRole, QString::fromStdString((*it)->name())); item->setData(Qt::UserRole + 1, QString::fromStdString((*it)->admin().login())); _groupList->addItem(item); } connect(_groupList, SIGNAL(clicked(QModelIndex)), this, SLOT(showGroup())); }
/* handle a command, return code is 0 if the command was (at least partially) valid, -1 for quitting, -2 for if invalid -3 if empty. */ int doCommand(char *cmdToken[]) { if (strcmp(cmdToken[0],"help")==0 || strcmp(cmdToken[0],"h") == 0) { usage(cmdToken[1]); return(0); } if (strcmp(cmdToken[0],"quit")==0 || strcmp(cmdToken[0],"q") == 0) { return(-1); } if (strcmp(cmdToken[0],"lg") == 0) { showGroup(cmdToken[1]); return(0); } if (strcmp(cmdToken[0],"mkuser") == 0) { userAdmin("mkuser", cmdToken[1], setScrambledPw(cmdToken[2]), cmdToken[3], "", "", "", ""); return(0); } if (strcmp(cmdToken[0],"atg") == 0) { userAdmin("modify", "group", cmdToken[1], "add", cmdToken[2], cmdToken[3], "", ""); return(0); } if (strcmp(cmdToken[0],"mkgroup") == 0) { userAdmin("mkgroup", cmdToken[1], "rodsgroup", myZone, "", "", "", ""); return(0); } if (strcmp(cmdToken[0],"rfg") == 0) { userAdmin("modify", "group", cmdToken[1], "remove", cmdToken[2], cmdToken[3], "", ""); return(0); } if (*cmdToken[0] != '\0') { printf("unrecognized command, try 'help'\n"); return(-2); } return(-3); }
void PolkaView::readData() { if ( !m_model->readData() ) { KMessageBox::error( this, i18n("Error reading data file") ); return; } m_groupListView->setItemModel( m_model->itemModel() ); m_history = Settings::history(); if ( m_history.isEmpty() ) { showRoot(); } else { Polka::Identity group = m_model->findIdentity( m_history.last() ); showGroup( group ); } if ( Settings::remoteSyncingEnabled() ) { m_model->gitRemote()->pull(); } m_groupGraphicsView->setAdderGroup( m_model->rootGroup() ); }
void viewGroupIscrived::groupDeleted(){ QMessageBox::information(this, tr("Done"), tr("Group deleted."), QMessageBox::Ok, QMessageBox::Ok); delete showGr; showGr=0; delete groupsListView; groupList=Boss->groupSearchbyUsern(accToShow->user()->user()); groupsListView= new QListView(this); layout->addWidget(groupsListView, 0, 0); QStandardItemModel* model= new QStandardItemModel(this); QStandardItem* parentItem= model->invisibleRootItem(); QVector<group*>::iterator it=groupList.begin(); for(;it<groupList.end();++it){ QStandardItem* item= new QStandardItem((*it)->name()); parentItem->appendRow(item); } groupsListView->setModel(model); connect(groupsListView, SIGNAL(clicked(QModelIndex)), this, SLOT(showGroup(QModelIndex))); }
Gui_Groups::Gui_Groups(LinqClient* c, QWidget* parent) : QGridLayout(parent), _client(c) { Gui_Avatar* portrait = new Gui_Avatar(QString::fromStdString(_client->avatar())); QPushButton* create = new QPushButton("CREATE"); QLabel* title = new QLabel("NEW GROUP"); showgrp = new Gui_DisplayInfo; newpost = new QTextEdit; newgrp = new QLineEdit; search = new QLineEdit; newbox = new QGroupBox; memlbl = new QLabel("Members"); memlbl->setMaximumSize(80,20); grpname = new QLineEdit; newgrplayout = new QFormLayout; newgrplayout->setSpacing(15); newgrplayout->addRow(title); newgrplayout->addRow("Group name:", grpname); newgrplayout->addRow("Group description:", newgrp); newgrplayout->addRow(create); newbox->setLayout(newgrplayout); if(_client->level() < executive) newbox->hide(); search->setPlaceholderText("Search group.."); search->hide(); connect(search, SIGNAL(returnPressed()), this, SLOT(searchGroup())); post = new QPushButton("POST"); grplist = new QListWidget; memlist = new QListWidget; QLabel* grplbl = new QLabel("Groups"); grplbl->setMaximumSize(120,20); createGroups(); QFormLayout* frm = new QFormLayout; mbuttons[0] = new QPushButton; mbuttons[0]->setIcon(QPixmap("img/document185.png")); mbuttons[0]->setToolTip("New group"); mbuttons[1] = new QPushButton; mbuttons[1]->setIcon(QPixmap("img/cross108.png")); mbuttons[1]->setToolTip("Delete group"); mbuttons[2] = new QPushButton; mbuttons[2]->setIcon(QPixmap("img/mop2.png")); mbuttons[2]->setToolTip("Delete all posts"); mbuttons[3] = new QPushButton; mbuttons[3]->setIcon(QPixmap("img/exit6.png")); mbuttons[3]->setToolTip("Leave this group"); mbuttons[4] = new QPushButton; mbuttons[4]->setIcon(QPixmap("img/enter3.png")); mbuttons[4]->setToolTip("Join this group"); frm->addRow(mbuttons[0]); frm->addRow(mbuttons[3]); frm->addRow(mbuttons[4]); frm->addRow(mbuttons[1]); frm->addRow(mbuttons[2]); connect(mbuttons[0], SIGNAL(clicked()), this, SLOT(showNewGroup())); connect(create, SIGNAL(clicked()), this, SLOT(newGroup())); connect(mbuttons[1], SIGNAL(clicked()), this, SLOT(deleteGroup())); connect(mbuttons[2], SIGNAL(clicked()), this, SLOT(clearPosts())); connect(mbuttons[3], SIGNAL(clicked()), this, SLOT(leaveGroup())); connect(mbuttons[4], SIGNAL(clicked()), this, SLOT(addGroup())); mbuttons[0]->hide(); mbuttons[1]->hide(); mbuttons[2]->hide(); mbuttons[3]->hide(); mbuttons[4]->hide(); if(_client->level() >= executive) mbuttons[0]->show(); tbar = new QToolBar; tbuttons[0] = new QToolButton(tbar); tbuttons[0]->setIcon(QPixmap("img/cross108.png")); tbar->addWidget(tbuttons[0]); newpost->setStyleSheet("background: #1a1a1a; font-weight:400"); newpost->setPlaceholderText("Insert new post into this group."); newpost->hide(); post->hide(); showgrp->hide(); memlbl->hide(); memlist->hide(); memlist->setContextMenuPolicy(Qt::CustomContextMenu); connect(memlist, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(memListMenu(const QPoint&))); addWidget(newbox, 0, 1, 1, 1); addWidget(portrait, 0, 0, 1, 1, Qt::AlignTop); addWidget(showgrp, 0, 1, 3, 1); addLayout(frm, 0, 2, 1, 1, Qt::AlignRight); addWidget(newpost, 3, 1, 2, 3); addWidget(post, 5, 4, 1, 1, Qt::AlignRight); addWidget(grplbl, 1, 0, 1, 1); addWidget(grplist, 2, 0, 1, 1); addWidget(memlbl, 3, 0, 1, 1); addWidget(memlist, 4, 0, 1, 1); addWidget(search, 5, 0, 1, 1); setRowStretch(0, 0); setRowStretch(1, 10); setColumnStretch(0, 1); setColumnStretch(1, 5); connect(grplist, SIGNAL(clicked(QModelIndex)), this, SLOT(showGroup())); connect(post, SIGNAL(clicked()), this, SLOT(sendPost())); connect(this, SIGNAL(created(int)), this, SLOT(refresh(int))); }