00001 /* This file is part of the KDE project 00002 Copyright (C) 2005 Dag Andersen <danders@get2net.dk> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; 00007 version 2 of the License. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to 00016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00017 Boston, MA 02110-1301, USA. 00018 */ 00019 00020 #include "kptmilestoneprogressdialog.h" 00021 #include "kptmilestoneprogresspanel.h" 00022 00023 #include <kcommand.h> 00024 #include <klocale.h> 00025 00026 #include <kdebug.h> 00027 00028 namespace KPlato 00029 { 00030 00031 MilestoneProgressDialog::MilestoneProgressDialog(Task &task, QWidget *p) 00032 : KDialog(p) 00033 { 00034 setCaption( i18n("Milestone Progress") ); 00035 setButtons( Ok|Cancel ); 00036 setDefaultButton( Ok ); 00037 showButtonSeparator( true ); 00038 m_panel = new MilestoneProgressPanel(task, this); 00039 00040 setMainWidget(m_panel); 00041 00042 enableButtonOk(false); 00043 00044 connect(this, SIGNAL(okClicked()), SLOT(slotOk())); 00045 connect(m_panel, SIGNAL(changed()), SLOT(slotChanged())); 00046 } 00047 00048 void MilestoneProgressDialog::slotChanged() { 00049 enableButtonOk(true); 00050 } 00051 00052 KCommand *MilestoneProgressDialog::buildCommand(Part *part) { 00053 KMacroCommand *m = new KMacroCommand(i18n("Modify Milestone Progress")); 00054 bool modified = false; 00055 KCommand *cmd = m_panel->buildCommand(part); 00056 if (cmd) { 00057 m->addCommand(cmd); 00058 modified = true; 00059 } 00060 if (!modified) { 00061 delete m; 00062 return 0; 00063 } 00064 return m; 00065 } 00066 00067 void MilestoneProgressDialog::slotOk() { 00068 if (!m_panel->ok()) 00069 return; 00070 accept(); 00071 } 00072 00073 00074 } //KPlato namespace 00075 00076 #include "kptmilestoneprogressdialog.moc"