kplato

kpttaskprogressdialog.cc

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     : KDialogBase(Swallow, i18n("Task Progress"), Ok|Cancel, Ok, p, "Task Progress Dialog", true, true)
00033 {
00034     m_panel = new TaskProgressPanel(task, workTime, this);
00035 
00036     setMainWidget(m_panel);
00037     
00038     enableButtonOK(false);
00039     
00040     connect(m_panel, SIGNAL( changed() ), SLOT(slotChanged()));
00041 }
00042 
00043 void TaskProgressDialog::slotChanged() {
00044     enableButtonOK(true);
00045 }
00046 
00047 KCommand *TaskProgressDialog::buildCommand(Part *part) {
00048     KMacroCommand *m = new KMacroCommand(i18n("Modify Task Progress"));
00049     bool modified = false;
00050     KCommand *cmd = m_panel->buildCommand(part);
00051     if (cmd) {
00052         m->addCommand(cmd);
00053         modified = true;
00054     }
00055     if (!modified) {
00056         delete m;
00057         return 0;
00058     }
00059     return m;
00060 }
00061 
00062 void TaskProgressDialog::slotOk() {
00063     if (!m_panel->ok())
00064         return;
00065     accept();
00066 }
00067 
00068 
00069 }  //KPlato namespace
00070 
00071 #include "kpttaskprogressdialog.moc"
KDE Home | KDE Accessibility Home | Description of Access Keys