00001 #include "projectinformationdialog.h"
00002
00003 #include "projectinformationhistorydialog.h"
00004 #include "../Data/dataproject.h"
00005 #include "../Data/project.h"
00006
00007 ProjectInformationDialog::ProjectInformationDialog(QWidget *parent, DataProject *project, bool teacher) : QDialog(parent), currentProject(project), historyDialog(NULL), isTeacher(teacher)
00008 {
00009 setupUi(this);
00010 setAttribute(Qt::WA_DeleteOnClose, true);
00011
00012 connect(buttonOk, SIGNAL(clicked()), this, SLOT(ok()));
00013 connect(buttonCancel, SIGNAL(clicked()), this, SLOT(close()));
00014 connect(buttonHistory, SIGNAL(clicked()), this, SLOT(history()));
00015
00016 textName->setText(Project::name());
00017 textDescription->setText(Project::description());
00018 textDateCreation->setText(Project::dateCreation().toString("dd.MM.yyyy hh:mm:ss"));
00019 textDateModification->setText(Project::dateModified().toString("dd.MM.yyyy hh:mm:ss"));
00020 textOwnerName->setText(Project::ownerName());
00021 textOwnerEmail->setText(Project::ownerEmail());
00022
00023 if(!isTeacher)
00024 buttonHistory->hide();
00025 else if(project->getChangeHistory().size() <= 1)
00026 buttonHistory->setEnabled(false);
00027 }
00028
00029 void ProjectInformationDialog::ok()
00030 {
00031 Project::setName(textName->text());
00032 Project::setDescription(textDescription->toPlainText());
00033 Project::setDateCreation(QDateTime::fromString(textDateCreation->text(), "dd.MM.yyyy hh:mm:ss"));
00034 Project::setDateModified(QDateTime::fromString(textDateModification->text(), "dd.MM.yyyy hh:mm:ss"));
00035 Project::setOwnerName(textOwnerName->text());
00036 Project::setOwnerEmail(textOwnerEmail->text());
00037 done(0);
00038 }
00039
00040 void ProjectInformationDialog::history()
00041 {
00042 if(!historyDialog)
00043 historyDialog = new ProjectInformationHistoryDialog(this, currentProject);
00044 historyDialog->show();
00045 }