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 "kptresourcesdialog.h"
00026 #include "kptproject.h"
00027 #include "kptresourcespanel.h"
00028 #include "kptresource.h"
00029
00030 namespace KPlato
00031 {
00032
00033 ResourcesDialog::ResourcesDialog(Project &p, QWidget *parent, const char *name)
00034 : KDialog( parent),
00035 project(p)
00036 {
00037 setCaption( i18n("Resources") );
00038 setButtons( Ok|Cancel );
00039 setDefaultButton( Ok );
00040 showButtonSeparator( true );
00041 panel = new ResourcesPanel(this, &project);
00042
00043 setMainWidget(panel);
00044 enableButtonOk(false);
00045
00046 connect(this, SIGNAL(okClicked()), SLOT(slotOk()));
00047 connect(panel, SIGNAL(changed()), SLOT(slotChanged()));
00048 }
00049
00050
00051 void ResourcesDialog::slotChanged() {
00052 enableButtonOk(true);
00053 }
00054
00055 void ResourcesDialog::slotOk() {
00056 if (!panel->ok())
00057 return;
00058 accept();
00059 }
00060
00061 KCommand *ResourcesDialog::buildCommand(Part *part) {
00062 KMacroCommand *m = 0;
00063 QString c = i18n("Modify resources");
00064 KCommand *cmd = panel->buildCommand(part);
00065 if (cmd) {
00066 if (!m) m = new KMacroCommand(c);
00067 m->addCommand(cmd);
00068 }
00069 return m;
00070 }
00071
00072 }
00073
00074 #include "kptresourcesdialog.moc"