diff --git a/kplato/kptresourcesdialog.cc b/kplato/kptresourcesdialog.cc new file mode 100644 index 00000000000..54e362c64d0 --- /dev/null +++ b/kplato/kptresourcesdialog.cc @@ -0,0 +1,71 @@ +/* This file is part of the KDE project + Copyright (C) 2005 Dag Andersen + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; + version 2 of the License. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include + +#include +#include + +#include + +#include "kptresourcesdialog.h" +#include "kptproject.h" +#include "kptresourcespanel.h" +#include "kptresource.h" + +namespace KPlato +{ + +KPTResourcesDialog::KPTResourcesDialog(KPTProject &p, QWidget *parent, const char *name) + : KDialogBase( Swallow, i18n("Resources"), Ok|Cancel, Ok, parent, name, true, true), + project(p) +{ + panel = new KPTResourcesPanel(this, &project); + + setMainWidget(panel); + enableButtonOK(false); + + connect(panel, SIGNAL(changed()), SLOT(slotChanged())); +} + + +void KPTResourcesDialog::slotChanged() { + enableButtonOK(true); +} + +void KPTResourcesDialog::slotOk() { + if (!panel->ok()) + return; + accept(); +} + +KCommand *KPTResourcesDialog::buildCommand(KPTPart *part) { + KMacroCommand *m = 0; + QString c = i18n("Modify resources"); + KCommand *cmd = panel->buildCommand(part); + if (cmd) { + if (!m) m = new KMacroCommand(c); + m->addCommand(cmd); + } + return m; +} + +} //KPlato namespace + +#include "kptresourcesdialog.moc" diff --git a/kplato/kptresourcesdialog.h b/kplato/kptresourcesdialog.h new file mode 100644 index 00000000000..b7586129398 --- /dev/null +++ b/kplato/kptresourcesdialog.h @@ -0,0 +1,53 @@ +/* This file is part of the KDE project + Copyright (C) 2005 Dag Andersen + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; + version 2 of the License + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef KPTRESOURCESDIALOG_H +#define KPTRESOURCESDIALOG_H + +#include + +class KCommand; + +namespace KPlato +{ + +class KPTProject; +class KPTResourcesPanel; +class KPTPart; + + +class KPTResourcesDialog : public KDialogBase { + Q_OBJECT +public: + KPTResourcesDialog(KPTProject &project, QWidget *parent=0, const char *name=0); + + KCommand *buildCommand(KPTPart *part); + +protected slots: + void slotChanged(); + void slotOk(); + +private: + KPTProject &project; + KPTResourcesPanel *panel; +}; + +} //KPlato namespace + +#endif // KPTRESOURCESDIALOG_H