/* Lliurex homework harvester Copyright (C) 2019 Enrique Medina Gremaldos This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #include "harvesterstudentplugin.hpp" #include "locale.hpp" #include #include #include #include #include #include using namespace std; using namespace edupals::system; using namespace lliurex::locale; HarvesterStudentPlugin::HarvesterStudentPlugin(QObject* parent, const QVariantList& list) : KAbstractFileItemActionPlugin(parent) { lliurex::locale::domain("lliurex-homework-harvester"); icon=QIcon::fromTheme("document-send"); actionSend=new QAction(this); actionSend->setText(T("Send file to teacher")); actionSend->setIcon(icon); connect(actionSend,&QAction::triggered,this,&HarvesterStudentPlugin::triggered); } HarvesterStudentPlugin::~HarvesterStudentPlugin() { } void HarvesterStudentPlugin::triggered(bool checked) { /* populate argument list */ QStringList args; for (auto t:target) { args< HarvesterStudentPlugin::actions(const KFileItemListProperties& fileItemInfos, QWidget* parentWidget) { QList list; try { vector groups = User::me().groups(); bool isStudent=false; for (Group& group : groups) { if (group.name=="students") { isStudent=true; break; } } if (isStudent) { KFileItemList files = fileItemInfos.items(); target.clear(); list.append(actionSend); for (int n=0;n();) #include