kplato

kptcommand.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2004, 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 #ifndef KPTCOMMAND_H
00021 #define KPTCOMMAND_H
00022 
00023 #include <kcommand.h>
00024 
00025 #include "kptappointment.h"
00026 #include "kptnode.h"
00027 #include "kptduration.h"
00028 #include "kptpart.h"
00029 #include "kpttask.h"
00030 
00031 class QString;
00032 
00033 namespace KPlato
00034 {
00035 
00036 class Account;
00037 class Accounts;
00038 class Project;
00039 class Task;
00040 class Calendar;
00041 class CalendarDay;
00042 class Relation;
00043 class ResourceGroupRequest;
00044 class ResourceRequest;
00045 class ResourceGroup;
00046 class Resource;
00047 class Schedule;
00048 class StandardWorktime;
00049 
00050 class NamedCommand : public KNamedCommand
00051 {
00052 public:
00053     NamedCommand(Part *part, QString name)
00054     : KNamedCommand(name), m_part(part)
00055     {}
00056     
00057     void setCommandType(int type);
00058     
00059 protected:
00060     void setSchDeleted();
00061     void setSchDeleted(bool state);
00062     void setSchScheduled();
00063     void setSchScheduled(bool state);
00064     void addSchScheduled(Schedule *sch);
00065     void addSchDeleted(Schedule *sch);
00066     
00067     QMap<Schedule*, bool> m_schedules;
00068 private:
00069     Part *m_part;
00070 };
00071 
00072 class CalendarAddCmd : public NamedCommand
00073 {
00074 public:
00075     CalendarAddCmd(Part *part, Project *project, Calendar *cal, QString name=0);
00076     void execute();
00077     void unexecute();
00078 
00079 private:
00080     Project *m_project;
00081     Calendar *m_cal;
00082     bool m_added;
00083 };
00084 
00085 class CalendarDeleteCmd : public NamedCommand
00086 {
00087 public:
00088     CalendarDeleteCmd(Part *part, Calendar *cal, QString name=0);
00089     void execute();
00090     void unexecute();
00091 
00092 private:
00093     Calendar *m_cal;
00094 };
00095 
00096 class CalendarModifyNameCmd : public NamedCommand
00097 {
00098 public:
00099     CalendarModifyNameCmd(Part *part, Calendar *cal, QString newvalue, QString name=0);
00100     void execute();
00101     void unexecute();
00102 
00103 private:
00104     Calendar *m_cal;
00105     QString m_newvalue;
00106     QString m_oldvalue;
00107 };
00108 
00109 class CalendarModifyParentCmd : public NamedCommand
00110 {
00111 public:
00112     CalendarModifyParentCmd(Part *part, Calendar *cal, Calendar *newvalue, QString name=0);
00113     void execute();
00114     void unexecute();
00115 
00116 private:
00117     Calendar *m_cal;
00118     Calendar *m_newvalue;
00119     Calendar *m_oldvalue;
00120 };
00121 
00122 class CalendarAddDayCmd : public NamedCommand
00123 {
00124 public:
00125     CalendarAddDayCmd(Part *part, Calendar *cal, CalendarDay *newvalue, QString name=0);
00126     ~CalendarAddDayCmd();
00127     void execute();
00128     void unexecute();
00129 
00130 protected:
00131     Calendar *m_cal;
00132     CalendarDay *m_newvalue;
00133     bool m_mine;
00134 };
00135 
00136 class CalendarRemoveDayCmd : public NamedCommand
00137 {
00138 public:
00139     CalendarRemoveDayCmd(Part *part, Calendar *cal, const QDate &day, QString name=0);
00140     void execute();
00141     void unexecute();
00142 
00143 protected:
00144     Calendar *m_cal;
00145     CalendarDay *m_value;
00146     bool m_mine;
00147 };
00148 
00149 class CalendarModifyDayCmd : public NamedCommand
00150 {
00151 public:
00152     CalendarModifyDayCmd(Part *part, Calendar *cal, CalendarDay *value, QString name=0);
00153     ~CalendarModifyDayCmd();
00154     void execute();
00155     void unexecute();
00156 
00157 private:
00158     Calendar *m_cal;
00159     CalendarDay *m_newvalue;
00160     CalendarDay *m_oldvalue;
00161     bool m_mine;
00162 };
00163 
00164 class CalendarModifyWeekdayCmd : public NamedCommand
00165 {
00166 public:
00167     CalendarModifyWeekdayCmd(Part *part, Calendar *cal, int weekday, CalendarDay *value, QString name=0);
00168     ~CalendarModifyWeekdayCmd();
00169     void execute();
00170     void unexecute();
00171 
00172 private:
00173     int m_weekday;
00174     Calendar *m_cal;
00175     CalendarDay *m_value;
00176     bool m_mine;
00177 };
00178 
00179 
00180 class NodeDeleteCmd : public NamedCommand
00181 {
00182 public:
00183     NodeDeleteCmd(Part *part, Node *node, QString name=0);
00184     ~NodeDeleteCmd();
00185     void execute();
00186     void unexecute();
00187 
00188 private:
00189     Node *m_node;
00190     Node *m_parent;
00191     int m_index;
00192     bool m_mine;
00193     QPtrList<Appointment> m_appointments;
00194 
00195 };
00196 
00197 class TaskAddCmd : public NamedCommand
00198 {
00199 public:
00200     TaskAddCmd(Part *part, Project *project, Node *node, Node *after,  QString name=0);
00201     ~TaskAddCmd();
00202     void execute();
00203     void unexecute();
00204 
00205 private:
00206     Project *m_project;
00207     Node *m_node;
00208     Node *m_after;
00209     bool m_added;
00210 };
00211 
00212 class SubtaskAddCmd : public NamedCommand
00213 {
00214 public:
00215     SubtaskAddCmd(Part *part, Project *project, Node *node, Node *parent,  QString name=0);
00216     ~SubtaskAddCmd();
00217     void execute();
00218     void unexecute();
00219 
00220 private:
00221     Project *m_project;
00222     Node *m_node;
00223     Node *m_parent;
00224     bool m_added;
00225 };
00226 
00227 
00228 class NodeModifyNameCmd : public NamedCommand
00229 {
00230 public:
00231     NodeModifyNameCmd(Part *part, Node &node, QString nodename, QString name=0);
00232     void execute();
00233     void unexecute();
00234 
00235 private:
00236     Node &m_node;
00237     QString newName;
00238     QString oldName;
00239 };
00240 
00241 class NodeModifyLeaderCmd : public NamedCommand
00242 {
00243 public:
00244     NodeModifyLeaderCmd(Part *part, Node &node, QString leader, QString name=0);
00245     void execute();
00246     void unexecute();
00247 
00248 private:
00249     Node &m_node;
00250     QString newLeader;
00251     QString oldLeader;
00252 };
00253 
00254 class NodeModifyDescriptionCmd : public NamedCommand
00255 {
00256 public:
00257     NodeModifyDescriptionCmd(Part *part, Node &node, QString description, QString name=0);
00258     void execute();
00259     void unexecute();
00260 
00261 private:
00262     Node &m_node;
00263     QString newDescription;
00264     QString oldDescription;
00265 };
00266 
00267 class NodeModifyConstraintCmd : public NamedCommand
00268 {
00269 public:
00270     NodeModifyConstraintCmd(Part *part, Node &node, Node::ConstraintType c, QString name=0);
00271     void execute();
00272     void unexecute();
00273 
00274 private:
00275     Node &m_node;
00276     Node::ConstraintType newConstraint;
00277     Node::ConstraintType oldConstraint;
00278 
00279 };
00280 
00281 class NodeModifyConstraintStartTimeCmd : public NamedCommand
00282 {
00283 public:
00284     NodeModifyConstraintStartTimeCmd(Part *part, Node &node, QDateTime dt, QString name=0);
00285     void execute();
00286     void unexecute();
00287 
00288 private:
00289     Node &m_node;
00290     QDateTime newTime;
00291     QDateTime oldTime;
00292 
00293 };
00294 class NodeModifyConstraintEndTimeCmd : public NamedCommand
00295 {
00296 public:
00297     NodeModifyConstraintEndTimeCmd(Part *part, Node &node, QDateTime dt, QString name=0);
00298     void execute();
00299     void unexecute();
00300 
00301 private:
00302     Node &m_node;
00303     QDateTime newTime;
00304     QDateTime oldTime;
00305 
00306 };
00307 class NodeModifyStartTimeCmd : public NamedCommand
00308 {
00309 public:
00310     NodeModifyStartTimeCmd(Part *part, Node &node, QDateTime dt, QString name=0);
00311     void execute();
00312     void unexecute();
00313 
00314 private:
00315     Node &m_node;
00316     QDateTime newTime;
00317     QDateTime oldTime;
00318 };
00319 class NodeModifyEndTimeCmd : public NamedCommand
00320 {
00321 public:
00322     NodeModifyEndTimeCmd(Part *part, Node &node, QDateTime dt, QString name=0);
00323     void execute();
00324     void unexecute();
00325 
00326 private:
00327     Node &m_node;
00328     QDateTime newTime;
00329     QDateTime oldTime;
00330 };
00331 class NodeModifyIdCmd : public NamedCommand
00332 {
00333 public:
00334     NodeModifyIdCmd(Part *part, Node &node, QString id, QString name=0);
00335     void execute();
00336     void unexecute();
00337 
00338 private:
00339     Node &m_node;
00340     QString newId;
00341     QString oldId;
00342 };
00343 
00344 class NodeIndentCmd : public NamedCommand
00345 {
00346 public:
00347     NodeIndentCmd(Part *part, Node &node, QString name=0);
00348     void execute();
00349     void unexecute();
00350 
00351 private:
00352     Node &m_node;
00353     Node *m_oldparent, *m_newparent;
00354     int m_oldindex, m_newindex;
00355 };
00356 
00357 class NodeUnindentCmd : public NamedCommand
00358 {
00359 public:
00360     NodeUnindentCmd(Part *part, Node &node, QString name=0);
00361     void execute();
00362     void unexecute();
00363 
00364 private:
00365     Node &m_node;
00366     Node *m_oldparent, *m_newparent;
00367     int m_oldindex, m_newindex;
00368 };
00369 
00370 class NodeMoveUpCmd : public NamedCommand
00371 {
00372 public:
00373     NodeMoveUpCmd(Part *part, Node &node, QString name=0);
00374     void execute();
00375     void unexecute();
00376 
00377 private:
00378     Node &m_node;
00379     int m_oldindex, m_newindex;
00380 };
00381 
00382 class NodeMoveDownCmd : public NamedCommand
00383 {
00384 public:
00385     NodeMoveDownCmd(Part *part, Node &node, QString name=0);
00386     void execute();
00387     void unexecute();
00388 
00389 private:
00390     Node &m_node;
00391     int m_oldindex, m_newindex;
00392 };
00393 
00394 class AddRelationCmd : public NamedCommand
00395 {
00396 public:
00397     AddRelationCmd(Part *part, Relation *rel, QString name=0);
00398     ~AddRelationCmd();
00399     void execute();
00400     void unexecute();
00401 
00402 private:
00403     Relation *m_rel;
00404     bool m_taken;
00405 
00406 };
00407 
00408 class DeleteRelationCmd : public NamedCommand
00409 {
00410 public:
00411     DeleteRelationCmd(Part *part, Relation *rel, QString name=0);
00412     ~DeleteRelationCmd();
00413     void execute();
00414     void unexecute();
00415 
00416 private:
00417     Relation *m_rel;
00418     bool m_taken;
00419 
00420 };
00421 
00422 class ModifyRelationTypeCmd : public NamedCommand
00423 {
00424 public:
00425     ModifyRelationTypeCmd(Part *part, Relation *rel, Relation::Type type, QString name=0);
00426     void execute();
00427     void unexecute();
00428 
00429 private:
00430     Relation *m_rel;
00431     Relation::Type m_newtype;
00432     Relation::Type m_oldtype;
00433 
00434 };
00435 
00436 class ModifyRelationLagCmd : public NamedCommand
00437 {
00438 public:
00439     ModifyRelationLagCmd(Part *part, Relation *rel, Duration lag, QString name=0);
00440     void execute();
00441     void unexecute();
00442 
00443 private:
00444     Relation *m_rel;
00445     Duration m_newlag;
00446     Duration m_oldlag;
00447 
00448 };
00449 
00450 class AddResourceRequestCmd : public NamedCommand
00451 {
00452 public:
00453     AddResourceRequestCmd(Part *part, ResourceGroupRequest *group, ResourceRequest *request, QString name=0);
00454     ~AddResourceRequestCmd();
00455     void execute();
00456     void unexecute();
00457 
00458 private:
00459     ResourceGroupRequest *m_group;
00460     ResourceRequest *m_request;
00461     bool m_mine;
00462 
00463 };
00464 
00465 class RemoveResourceRequestCmd : public NamedCommand
00466 {
00467 public:
00468     RemoveResourceRequestCmd(Part *part, ResourceGroupRequest *group, ResourceRequest *request, QString name=0);
00469     ~RemoveResourceRequestCmd();
00470     void execute();
00471     void unexecute();
00472 
00473 private:
00474     ResourceGroupRequest *m_group;
00475     ResourceRequest *m_request;
00476     bool m_mine;
00477 
00478 };
00479 
00480 class ModifyEffortCmd : public NamedCommand
00481 {
00482 public:
00483     ModifyEffortCmd(Part *part, Effort *effort, Duration oldvalue, Duration newvalue, QString name=0);
00484     void execute();
00485     void unexecute();
00486 
00487 private:
00488     Effort *m_effort;
00489     Duration m_oldvalue, m_newvalue;
00490 
00491 };
00492 
00493 class EffortModifyOptimisticRatioCmd : public NamedCommand
00494 {
00495 public:
00496     EffortModifyOptimisticRatioCmd(Part *part, Effort *effort, int oldvalue, int newvalue, QString name=0);
00497     void execute();
00498     void unexecute();
00499 
00500 private:
00501     Effort *m_effort;
00502     int m_oldvalue, m_newvalue;
00503 
00504 };
00505 
00506 class EffortModifyPessimisticRatioCmd : public NamedCommand
00507 {
00508 public:
00509     EffortModifyPessimisticRatioCmd(Part *part, Effort *effort, int oldvalue, int newvalue, QString name=0);
00510     void execute();
00511     void unexecute();
00512 
00513 private:
00514     Effort *m_effort;
00515     int m_oldvalue, m_newvalue;
00516 
00517 };
00518 
00519 class ModifyEffortTypeCmd : public NamedCommand
00520 {
00521 public:
00522     ModifyEffortTypeCmd(Part *part, Effort *effort, int oldvalue, int newvalue, QString name=0);
00523     void execute();
00524     void unexecute();
00525 
00526 private:
00527     Effort *m_effort;
00528     int m_oldvalue, m_newvalue;
00529 
00530 };
00531 
00532 class AddResourceGroupRequestCmd : public NamedCommand
00533 {
00534 public:
00535     AddResourceGroupRequestCmd(Part *part, Task &task, ResourceGroupRequest *request, QString name=0);
00536     void execute();
00537     void unexecute();
00538 
00539 private:
00540     Task &m_task;
00541     ResourceGroupRequest *m_request;
00542     bool m_mine;
00543 };
00544 
00545 class RemoveResourceGroupRequestCmd : public NamedCommand
00546 {
00547 public:
00548     RemoveResourceGroupRequestCmd(Part *part, ResourceGroupRequest *request, QString name=0);
00549     RemoveResourceGroupRequestCmd(Part *part, Task &task, ResourceGroupRequest *request, QString name=0);
00550     void execute();
00551     void unexecute();
00552 
00553 private:
00554     Task &m_task;
00555     ResourceGroupRequest *m_request;
00556     bool m_mine;
00557 };
00558 
00559 class AddResourceCmd : public NamedCommand
00560 {
00561 public:
00562     AddResourceCmd(Part *part, ResourceGroup *group, Resource *resource, QString name=0);
00563     ~AddResourceCmd();
00564     void execute();
00565     void unexecute();
00566 
00567 protected:
00568 
00569     ResourceGroup *m_group;
00570     Resource *m_resource;
00571     bool m_mine;
00572 };
00573 
00574 class RemoveResourceCmd : public AddResourceCmd
00575 {
00576 public:
00577     RemoveResourceCmd(Part *part, ResourceGroup *group, Resource *resource, QString name=0);
00578     ~RemoveResourceCmd();
00579     void execute();
00580     void unexecute();
00581 
00582 private:
00583     QPtrList<ResourceRequest> m_requests;
00584     QPtrList<Appointment> m_appointments;
00585 };
00586 
00587 class ModifyResourceNameCmd : public NamedCommand
00588 {
00589 public:
00590     ModifyResourceNameCmd(Part *part, Resource *resource, QString value, QString name=0);
00591     void execute();
00592     void unexecute();
00593 
00594 private:
00595 
00596     Resource *m_resource;
00597     QString m_newvalue;
00598     QString m_oldvalue;
00599 };
00600 class ModifyResourceInitialsCmd : public NamedCommand
00601 {
00602 public:
00603     ModifyResourceInitialsCmd(Part *part, Resource *resource, QString value, QString name=0);
00604     void execute();
00605     void unexecute();
00606 
00607 private:
00608     Resource *m_resource;
00609     QString m_newvalue;
00610     QString m_oldvalue;
00611 };
00612 class ModifyResourceEmailCmd : public NamedCommand
00613 {
00614 public:
00615     ModifyResourceEmailCmd(Part *part, Resource *resource, QString value, QString name=0);
00616     void execute();
00617     void unexecute();
00618 
00619 private:
00620     Resource *m_resource;
00621     QString m_newvalue;
00622     QString m_oldvalue;
00623 };
00624 class ModifyResourceTypeCmd : public NamedCommand
00625 {
00626 public:
00627     ModifyResourceTypeCmd(Part *part, Resource *resource, int value, QString name=0);
00628     void execute();
00629     void unexecute();
00630 
00631 private:
00632     Resource *m_resource;
00633     int m_newvalue;
00634     int m_oldvalue;
00635 };
00636 
00637 class ModifyResourceUnitsCmd : public NamedCommand
00638 {
00639 public:
00640     ModifyResourceUnitsCmd(Part *part, Resource *resource, int value, QString name=0);
00641     void execute();
00642     void unexecute();
00643 
00644 private:
00645     Resource *m_resource;
00646     int m_newvalue;
00647     int m_oldvalue;
00648 };
00649 
00650 class ModifyResourceAvailableFromCmd : public NamedCommand
00651 {
00652 public:
00653     ModifyResourceAvailableFromCmd(Part *part, Resource *resource, DateTime value, QString name=0);
00654     void execute();
00655     void unexecute();
00656 
00657 private:
00658     Resource *m_resource;
00659     DateTime m_newvalue;
00660     DateTime m_oldvalue;
00661 };
00662 class ModifyResourceAvailableUntilCmd : public NamedCommand
00663 {
00664 public:
00665     ModifyResourceAvailableUntilCmd(Part *part, Resource *resource, DateTime value, QString name=0);
00666     void execute();
00667     void unexecute();
00668 
00669 private:
00670     Resource *m_resource;
00671     DateTime m_newvalue;
00672     DateTime m_oldvalue;
00673 };
00674 
00675 class ModifyResourceNormalRateCmd : public NamedCommand
00676 {
00677 public:
00678     ModifyResourceNormalRateCmd(Part *part, Resource *resource, double value, QString name=0);
00679     void execute();
00680     void unexecute();
00681 
00682 private:
00683     Resource *m_resource;
00684     double m_newvalue;
00685     double m_oldvalue;
00686 };
00687 class ModifyResourceOvertimeRateCmd : public NamedCommand
00688 {
00689 public:
00690     ModifyResourceOvertimeRateCmd(Part *part, Resource *resource, double value, QString name=0);
00691     void execute();
00692     void unexecute();
00693 
00694 private:
00695     Resource *m_resource;
00696     double m_newvalue;
00697     double m_oldvalue;
00698 };
00699 class ModifyResourceCalendarCmd : public NamedCommand
00700 {
00701 public:
00702     ModifyResourceCalendarCmd(Part *part, Resource *resource, Calendar *value, QString name=0);
00703     void execute();
00704     void unexecute();
00705 
00706 private:
00707     Resource *m_resource;
00708     Calendar *m_newvalue;
00709     Calendar *m_oldvalue;
00710 };
00711 
00712 class RemoveResourceGroupCmd : public NamedCommand
00713 {
00714 public:
00715     RemoveResourceGroupCmd(Part *part, ResourceGroup *group, QString name=0);
00716     ~RemoveResourceGroupCmd();
00717     void execute();
00718     void unexecute();
00719 
00720 protected:
00721 
00722     ResourceGroup *m_group;
00723     bool m_mine;
00724 };
00725 
00726 class AddResourceGroupCmd : public RemoveResourceGroupCmd
00727 {
00728 public:
00729     AddResourceGroupCmd(Part *part, ResourceGroup *group, QString name=0);
00730     void execute();
00731     void unexecute();
00732 };
00733 
00734 class ModifyResourceGroupNameCmd : public NamedCommand
00735 {
00736 public:
00737     ModifyResourceGroupNameCmd(Part *part, ResourceGroup *group, QString value, QString name=0);
00738     void execute();
00739     void unexecute();
00740 
00741 private:
00742     ResourceGroup *m_group;
00743     QString m_newvalue;
00744     QString m_oldvalue;
00745 };
00746 
00747 class TaskModifyProgressCmd : public NamedCommand
00748 {
00749 public:
00750     TaskModifyProgressCmd(Part *part, Task &task, struct Task::Progress &value, QString name=0);
00751     void execute();
00752     void unexecute();
00753 
00754 private:
00755     Task &m_task;
00756     struct Task::Progress m_newvalue;
00757     struct Task::Progress m_oldvalue;
00758 };
00759 
00760 class ProjectModifyBaselineCmd : public NamedCommand
00761 {
00762 public:
00763     ProjectModifyBaselineCmd(Part *part, Project &project, bool value, QString name=0);
00764     void execute();
00765     void unexecute();
00766 
00767 private:
00768     Project &m_project;
00769     bool m_newvalue;
00770     bool m_oldvalue;
00771 };
00772 
00773 class AddAccountCmd : public NamedCommand
00774 {
00775 public:
00776     AddAccountCmd(Part *part, Project &project, Account *account,  Account *parent=0, QString name=0);
00777     AddAccountCmd(Part *part, Project &project, Account *account,  QString parent, QString name=0);
00778     ~AddAccountCmd();
00779     void execute();
00780     void unexecute();
00781 
00782 protected:
00783     bool m_mine;
00784     
00785 private:
00786     Project &m_project;
00787     Account *m_account;
00788     Account *m_parent;
00789     QString m_parentName;
00790 };
00791 
00792 class RemoveAccountCmd : public NamedCommand
00793 {
00794 public:
00795     RemoveAccountCmd(Part *part, Project &project, Account *account, QString name=0);
00796     ~RemoveAccountCmd();
00797     void execute();
00798     void unexecute();
00799     
00800 private:
00801     Project &m_project;
00802     Account *m_account;
00803     bool m_isDefault;
00804     bool m_mine;
00805 
00806 };
00807 
00808 class RenameAccountCmd : public NamedCommand
00809 {
00810 public:
00811     RenameAccountCmd(Part *part, Account *account, QString value, QString name=0);
00812     void execute();
00813     void unexecute();
00814 
00815 private:
00816     Account *m_account;
00817     QString m_oldvalue;
00818     QString m_newvalue;
00819 };
00820 
00821 class ModifyAccountDescriptionCmd : public NamedCommand
00822 {
00823 public:
00824     ModifyAccountDescriptionCmd(Part *part, Account *account, QString value, QString name=0);
00825     void execute();
00826     void unexecute();
00827 
00828 private:
00829     Account *m_account;
00830     QString m_oldvalue;
00831     QString m_newvalue;
00832 };
00833 
00834 class NodeModifyStartupCostCmd : public NamedCommand
00835 {
00836 public:
00837     NodeModifyStartupCostCmd(Part *part, Node &node, double value, QString name=0);
00838     void execute();
00839     void unexecute();
00840 
00841 private:
00842     Node &m_node;
00843     double m_oldvalue;
00844     double m_newvalue;
00845 };
00846 
00847 class NodeModifyShutdownCostCmd : public NamedCommand
00848 {
00849 public:
00850     NodeModifyShutdownCostCmd(Part *part, Node &node, double value, QString name=0);
00851     void execute();
00852     void unexecute();
00853 
00854 private:
00855     Node &m_node;
00856     double m_oldvalue;
00857     double m_newvalue;
00858 };
00859 
00860 class NodeModifyRunningAccountCmd : public NamedCommand
00861 {
00862 public:
00863     NodeModifyRunningAccountCmd(Part *part, Node &node, Account *oldvalue, Account *newvalue, QString name=0);
00864     void execute();
00865     void unexecute();
00866 
00867 private:
00868     Node &m_node;
00869     Account *m_oldvalue;
00870     Account *m_newvalue;
00871 };
00872 
00873 class NodeModifyStartupAccountCmd : public NamedCommand
00874 {
00875 public:
00876     NodeModifyStartupAccountCmd(Part *part, Node &node, Account *oldvalue, Account *newvalue, QString name=0);
00877     void execute();
00878     void unexecute();
00879 
00880 private:
00881     Node &m_node;
00882     Account *m_oldvalue;
00883     Account *m_newvalue;
00884 };
00885 
00886 class NodeModifyShutdownAccountCmd : public NamedCommand
00887 {
00888 public:
00889     NodeModifyShutdownAccountCmd(Part *part, Node &node, Account *oldvalue, Account *newvalue, QString name=0);
00890     void execute();
00891     void unexecute();
00892 
00893 private:
00894     Node &m_node;
00895     Account *m_oldvalue;
00896     Account *m_newvalue;
00897 };
00898 
00899 class ModifyDefaultAccountCmd : public NamedCommand
00900 {
00901 public:
00902     ModifyDefaultAccountCmd(Part *part, Accounts &acc, Account *oldvalue, Account *newvalue, QString name=0);
00903     void execute();
00904     void unexecute();
00905 
00906 private:
00907     Accounts &m_accounts;
00908     Account *m_oldvalue;
00909     Account *m_newvalue;
00910 };
00911 
00912 class ProjectModifyConstraintCmd : public NamedCommand
00913 {
00914 public:
00915     ProjectModifyConstraintCmd(Part *part, Project &node, Node::ConstraintType c, QString name=0);
00916     void execute();
00917     void unexecute();
00918 
00919 private:
00920     Project &m_node;
00921     Node::ConstraintType newConstraint;
00922     Node::ConstraintType oldConstraint;
00923 
00924 };
00925 
00926 class ProjectModifyStartTimeCmd : public NamedCommand
00927 {
00928 public:
00929     ProjectModifyStartTimeCmd(Part *part, Project &node, QDateTime dt, QString name=0);
00930     void execute();
00931     void unexecute();
00932 
00933 private:
00934     Project &m_node;
00935     QDateTime newTime;
00936     QDateTime oldTime;
00937 
00938 };
00939 
00940 class ProjectModifyEndTimeCmd : public NamedCommand
00941 {
00942 public:
00943     ProjectModifyEndTimeCmd(Part *part, Project &project, QDateTime dt, QString name=0);
00944     void execute();
00945     void unexecute();
00946 
00947 private:
00948     Project &m_node;
00949     QDateTime newTime;
00950     QDateTime oldTime;
00951 
00952 };
00953 
00954 
00955 class CalculateProjectCmd : public NamedCommand
00956 {
00957 public:
00958     CalculateProjectCmd(Part *part, Project &project, QString tname, int type, QString name=0);
00959     void execute();
00960     void unexecute();
00961 
00962 private:
00963     Project &m_node;
00964     QString m_typename;
00965     int m_type;
00966     Schedule *newSchedule;
00967     Schedule *oldCurrent;
00968 };
00969 
00970 class RecalculateProjectCmd : public NamedCommand
00971 {
00972 public:
00973     RecalculateProjectCmd(Part *part, Project &project, Schedule &sch, QString name=0);
00974     void execute();
00975     void unexecute();
00976 
00977 private:
00978     Project &m_node;
00979     Schedule &oldSchedule;
00980     Schedule *newSchedule;
00981     bool oldDeleted;
00982     Schedule *oldCurrent;
00983 };
00984 
00985 class ModifyStandardWorktimeYearCmd : public NamedCommand
00986 {
00987 public:
00988     ModifyStandardWorktimeYearCmd(Part *part, StandardWorktime *wt, double oldvalue, double newvalue, QString name=0);
00989     void execute();
00990     void unexecute();
00991 private:
00992     StandardWorktime *swt;
00993     double m_oldvalue;
00994     double m_newvalue;
00995 };
00996 
00997 class ModifyStandardWorktimeMonthCmd : public NamedCommand
00998 {
00999 public:
01000     ModifyStandardWorktimeMonthCmd(Part *part, StandardWorktime *wt, double oldvalue, double newvalue, QString name=0);
01001     void execute();
01002     void unexecute();
01003 private:
01004     StandardWorktime *swt;
01005     double m_oldvalue;
01006     double m_newvalue;
01007 };
01008 
01009 class ModifyStandardWorktimeWeekCmd : public NamedCommand
01010 {
01011 public:
01012     ModifyStandardWorktimeWeekCmd(Part *part, StandardWorktime *wt, double oldvalue, double newvalue, QString name=0);
01013     void execute();
01014     void unexecute();
01015 private:
01016     StandardWorktime *swt;
01017     double m_oldvalue;
01018     double m_newvalue;
01019 };
01020 
01021 class ModifyStandardWorktimeDayCmd : public NamedCommand
01022 {
01023 public:
01024     ModifyStandardWorktimeDayCmd(Part *part, StandardWorktime *wt, double oldvalue, double newvalue, QString name=0);
01025     void execute();
01026     void unexecute();
01027 private:
01028     StandardWorktime *swt;
01029     double m_oldvalue;
01030     double m_newvalue;
01031 };
01032 
01033 
01034 }  //KPlato namespace
01035 
01036 #endif //COMMAND_H
KDE Home | KDE Accessibility Home | Description of Access Keys