kplato
kpttaskdialog.cc00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include "kpttaskdialog.h"
00022 #include "kpttaskcostpanel.h"
00023 #include "kpttaskgeneralpanel.h"
00024 #include "kptrequestresourcespanel.h"
00025
00026 #include <klocale.h>
00027 #include <kcommand.h>
00028
00029 #include <qvbox.h>
00030 #include <kdebug.h>
00031
00032 namespace KPlato
00033 {
00034
00035 TaskDialog::TaskDialog(Task &task, Accounts &accounts, StandardWorktime *workTime, bool baseline, QWidget *p)
00036 : KDialogBase(Tabbed, i18n("Task Settings"), Ok|Cancel, Ok, p, "Task Settings Dialog", true, true)
00037 {
00038 QVBox *page;
00039
00040
00041 page = addVBoxPage(i18n("&General"));
00042 m_generalTab = new TaskGeneralPanel(task, workTime, baseline, page);
00043
00044 page = addVBoxPage(i18n("&Resources"));
00045 m_resourcesTab = new RequestResourcesPanel(page, task, baseline);
00046
00047 page = addVBoxPage(i18n("&Cost"));
00048 m_costTab = new TaskCostPanel(task, accounts, page);
00049
00050
00051 enableButtonOK(false);
00052
00053 connect(m_generalTab, SIGNAL( obligatedFieldsFilled(bool) ), this, SLOT( enableButtonOK(bool) ));
00054 connect(m_resourcesTab, SIGNAL( changed() ), m_generalTab, SLOT( checkAllFieldsFilled() ));
00055 connect(m_costTab, SIGNAL( changed() ), m_generalTab, SLOT( checkAllFieldsFilled() ));
00056 }
00057
00058
00059 KCommand *TaskDialog::buildCommand(Part *part) {
00060 KMacroCommand *m = new KMacroCommand(i18n("Modify Task"));
00061 bool modified = false;
00062 KCommand *cmd = m_generalTab->buildCommand(part);
00063 if (cmd) {
00064 m->addCommand(cmd);
00065 modified = true;
00066 }
00067 cmd = m_resourcesTab->buildCommand(part);
00068 if (cmd) {
00069 m->addCommand(cmd);
00070 modified = true;
00071 }
00072 cmd = m_costTab->buildCommand(part);
00073 if (cmd) {
00074 m->addCommand(cmd);
00075 modified = true;
00076 }
00077 if (!modified) {
00078 delete m;
00079 return 0;
00080 }
00081 return m;
00082 }
00083
00084 void TaskDialog::slotOk() {
00085 if (!m_generalTab->ok())
00086 return;
00087 if (!m_resourcesTab->ok())
00088 return;
00089
00090 accept();
00091 }
00092
00093
00094 }
00095
00096 #include "kpttaskdialog.moc"
|