00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include <klocale.h>
00021 #include <kcommand.h>
00022
00023 #include <kdebug.h>
00024
00025 #include "kptmainprojectdialog.h"
00026 #include "kptproject.h"
00027 #include "kptmainprojectpanel.h"
00028
00029 namespace KPlato
00030 {
00031
00032 MainProjectDialog::MainProjectDialog(Project &p, QWidget *parent, const char *name)
00033 : KDialog( parent),
00034 project(p)
00035 {
00036 setCaption( i18n("Project Settings") );
00037 setButtons( Ok|Cancel );
00038 setDefaultButton( Ok );
00039 showButtonSeparator( true );
00040 panel = new MainProjectPanel(project, this);
00041
00042 setMainWidget(panel);
00043 enableButtonOk(false);
00044 resize( QSize(500, 410).expandedTo(minimumSizeHint()));
00045
00046 connect(this, SIGNAL(okClicked()), SLOT(slotOk()));
00047 connect(panel, SIGNAL(obligatedFieldsFilled(bool)), SLOT(enableButtonOk(bool)));
00048 }
00049
00050
00051 void MainProjectDialog::slotOk() {
00052 if (!panel->ok())
00053 return;
00054
00055 accept();
00056 }
00057
00058 KCommand *MainProjectDialog::buildCommand(Part *part) {
00059 KMacroCommand *m = 0;
00060 QString c = i18n("Modify main project");
00061 KCommand *cmd = panel->buildCommand(part);
00062 if (cmd) {
00063 if (!m) m = new KMacroCommand(c);
00064 m->addCommand(cmd);
00065 }
00066 return m;
00067 }
00068
00069 }
00070
00071 #include "kptmainprojectdialog.moc"