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 "kpttaskprogressdialog.h" 00021 #include "kpttaskprogresspanel.h" 00022 00023 #include <kcommand.h> 00024 #include <klocale.h> 00025 00026 #include <kdebug.h> 00027 00028 namespace KPlato 00029 { 00030 00031 TaskProgressDialog::TaskProgressDialog(Task &task, StandardWorktime *workTime, QWidget *p) 00032 : KDialog( p) 00033 { 00034 setCaption( i18n("Task Progress") ); 00035 setButtons( Ok|Cancel ); 00036 setDefaultButton( Ok ); 00037 showButtonSeparator( true ); 00038 m_panel = new TaskProgressPanel(task, workTime, this); 00039 00040 setMainWidget(m_panel); 00041 00042 enableButtonOk(false); 00043 00044 connect(m_panel, SIGNAL( changed() ), SLOT(slotChanged())); 00045 } 00046 00047 void TaskProgressDialog::slotChanged() { 00048 enableButtonOk(true); 00049 } 00050 00051 KCommand *TaskProgressDialog::buildCommand(Part *part) { 00052 KMacroCommand *m = new KMacroCommand(i18n("Modify Task Progress")); 00053 bool modified = false; 00054 KCommand *cmd = m_panel->buildCommand(part); 00055 if (cmd) { 00056 m->addCommand(cmd); 00057 modified = true; 00058 } 00059 if (!modified) { 00060 delete m; 00061 return 0; 00062 } 00063 return m; 00064 } 00065 00066 void TaskProgressDialog::slotOk() { 00067 if (!m_panel->ok()) 00068 return; 00069 accept(); 00070 } 00071 00072 00073 } //KPlato namespace 00074 00075 #include "kpttaskprogressdialog.moc"