00001 #include "selectuser.h" 00002 00003 #include <models/usermodel.h> 00004 00005 #include <qstringlist.h> 00006 #include <domain/taskmanagerdata.h> 00007 #include <domain/user.h> 00008 00009 using namespace control; 00010 00011 ControllerInterface::ActionType SelectUser::actionType() const 00012 { 00013 return SelectAction; 00014 } 00015 00016 ControllerInterface::DataType SelectUser::dataType() const 00017 { 00018 return UserData; 00019 } 00020 00021 QString SelectUser::description() const 00022 { 00023 return "Select user"; 00024 } 00025 00026 bool SelectUser::userIsValid() const 00027 { 00028 return true; 00029 } 00030 00031 void SelectUser::execute() 00032 { 00033 UserModel model(data); 00034 data::SelectionData selection = ui->getSelection("Select a user", &model); 00035 00036 if (!selection.processData || selection.selection.size() < 1) 00037 return; 00038 00039 ui->setUser(model.userForIndex(selection.selection.first())); 00040 } 00041 00042 QString SelectUser::name() const 00043 { 00044 return "SelectUser"; 00045 } 00046 00047 Q_EXPORT_PLUGIN2(controller_selectuser, SelectUser)