00001 #include "overviewshower.h" 00002 00003 #include <domain/taskmanagerdata.h> 00004 00005 #include <models/invitationmodel.h> 00006 #include <models/taskmodel.h> 00007 #include <models/usermodel.h> 00008 #include <models/reservationmodel.h> 00009 #include <models/resourcemodel.h> 00010 #include <models/projectmodel.h> 00011 00012 #include <tools/functions.h> 00013 00014 using namespace control; 00015 00016 OverviewShower::~OverviewShower() 00017 { 00018 delete tasks; 00019 delete invitations; 00020 delete users; 00021 delete reservations; 00022 delete resources; 00023 delete projects; 00024 } 00025 00026 ControllerInterface::ActionType OverviewShower::actionType() const 00027 { 00028 return ViewAction; 00029 } 00030 00031 ControllerInterface::DataType OverviewShower::dataType() const 00032 { 00033 return NoData; 00034 } 00035 00036 QString OverviewShower::description() const 00037 { 00038 return "Show data overview"; 00039 } 00040 00041 QString OverviewShower::name() const 00042 { 00043 return "OverviewShower"; 00044 } 00045 00046 bool OverviewShower::userIsValid() const 00047 { 00048 return true; 00049 } 00050 00051 00052 bool OverviewShower::userCanExecute() const 00053 { 00054 return false; 00055 } 00056 00057 void OverviewShower::init(domain::TaskManagerData* data, ui::UiInterface* ui, 00058 ControllerFactory* factory) 00059 { 00060 ControllerInterface::init(data, ui, factory); 00061 00062 tasks = new TaskModel(data); 00063 invitations = new InvitationModel(data); 00064 users = new UserModel(data); 00065 reservations = new ReservationModel(data); 00066 resources = new ResourceModel(data); 00067 projects = new ProjectModel(data); 00068 } 00069 00070 void OverviewShower::execute() 00071 { 00072 data::OverviewDetails details; 00073 details.tasks = tasks; 00074 details.invitations = invitations; 00075 details.reservations = reservations; 00076 details.resources = resources; 00077 details.users = users; 00078 details.projects = projects; 00079 ui->setOverview(details); 00080 } 00081 00082 Q_EXPORT_PLUGIN2(controller_overviewshower, OverviewShower)