1 | /* This file is part of the KDE project |
2 | Copyright (C) 2004-2007 Dag Andersen <danders@get2net.dk> |
3 | Copyright (C) 2011 Dag Andersen <danders@get2net.dk> |
4 | |
5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. |
9 | |
10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. |
14 | |
15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
18 | * Boston, MA 02110-1301, USA. |
19 | */ |
20 | |
21 | #ifndef KPTCOMMAND_H |
22 | #define KPTCOMMAND_H |
23 | |
24 | #include "kplatokernel_export.h" |
25 | |
26 | #include <kundo2command.h> |
27 | #include <QPointer> |
28 | |
29 | #include "kptappointment.h" |
30 | #include "kptnode.h" |
31 | #include "kptduration.h" |
32 | #include "kpttask.h" |
33 | #include "kptwbsdefinition.h" |
34 | |
35 | class QString; |
36 | /** |
37 | * @file |
38 | * This file includes undo/redo commands for kernel data structures |
39 | */ |
40 | |
41 | /// The main namespace |
42 | namespace KPlato |
43 | { |
44 | |
45 | class Account; |
46 | class Accounts; |
47 | class Project; |
48 | class Task; |
49 | class Calendar; |
50 | class CalendarDay; |
51 | class Relation; |
52 | class ResourceGroupRequest; |
53 | class ResourceRequest; |
54 | class ResourceGroup; |
55 | class Resource; |
56 | class Schedule; |
57 | class StandardWorktime; |
58 | |
59 | class KPLATOKERNEL_EXPORT NamedCommand : public KUndo2Command |
60 | { |
61 | public: |
62 | explicit NamedCommand( const KUndo2MagicString& name ) |
63 | : KUndo2Command( name ) |
64 | {} |
65 | virtual void redo() { execute(); } |
66 | virtual void undo() { unexecute(); } |
67 | |
68 | virtual void execute() = 0; |
69 | virtual void unexecute() = 0; |
70 | |
71 | protected: |
72 | /// Set all scheduled in the m_schedules map to their original scheduled state |
73 | void setSchScheduled(); |
74 | /// Set all schedules in the m_schedules map to scheduled state @p state |
75 | void setSchScheduled( bool state ); |
76 | /// Add a schedule to the m_schedules map along with its current scheduled state |
77 | void addSchScheduled( Schedule *sch ); |
78 | |
79 | QMap<Schedule*, bool> m_schedules; |
80 | |
81 | }; |
82 | |
83 | class KPLATOKERNEL_EXPORT MacroCommand : public KUndo2Command |
84 | { |
85 | public: |
86 | explicit MacroCommand( const KUndo2MagicString& name = KUndo2MagicString() ) |
87 | : KUndo2Command( name ) |
88 | {} |
89 | ~MacroCommand(); |
90 | |
91 | void addCommand( KUndo2Command *cmd ); |
92 | |
93 | virtual void redo() { execute(); } |
94 | virtual void undo() { unexecute(); } |
95 | |
96 | virtual void execute(); |
97 | virtual void unexecute(); |
98 | |
99 | bool isEmpty() const { return cmds.isEmpty(); } |
100 | |
101 | protected: |
102 | QList<KUndo2Command*> cmds; |
103 | }; |
104 | |
105 | |
106 | class KPLATOKERNEL_EXPORT CalendarAddCmd : public NamedCommand |
107 | { |
108 | public: |
109 | CalendarAddCmd( Project *project, Calendar *cal, int pos, Calendar *parent, const KUndo2MagicString& name = KUndo2MagicString() ); |
110 | ~CalendarAddCmd(); |
111 | void execute(); |
112 | void unexecute(); |
113 | |
114 | private: |
115 | Project *m_project; |
116 | Calendar *m_cal; |
117 | int m_pos; |
118 | Calendar *m_parent; |
119 | bool m_mine; |
120 | }; |
121 | |
122 | class KPLATOKERNEL_EXPORT CalendarRemoveCmd : public NamedCommand |
123 | { |
124 | public: |
125 | CalendarRemoveCmd( Project *project, Calendar *cal, const KUndo2MagicString& name = KUndo2MagicString() ); |
126 | ~CalendarRemoveCmd(); |
127 | void execute(); |
128 | void unexecute(); |
129 | |
130 | private: |
131 | Project *m_project; |
132 | Calendar *m_parent; |
133 | Calendar *m_cal; |
134 | int m_index; |
135 | bool m_mine; |
136 | MacroCommand *m_cmd; |
137 | }; |
138 | |
139 | class KPLATOKERNEL_EXPORT CalendarMoveCmd : public NamedCommand |
140 | { |
141 | public: |
142 | CalendarMoveCmd( Project *project, Calendar *cal, int position, Calendar *parent, const KUndo2MagicString& name = KUndo2MagicString() ); |
143 | void execute(); |
144 | void unexecute(); |
145 | |
146 | private: |
147 | Project *m_project; |
148 | Calendar *m_cal; |
149 | int m_newpos; |
150 | int m_oldpos; |
151 | Calendar *m_newparent; |
152 | Calendar *m_oldparent; |
153 | }; |
154 | |
155 | class KPLATOKERNEL_EXPORT CalendarModifyNameCmd : public NamedCommand |
156 | { |
157 | public: |
158 | CalendarModifyNameCmd( Calendar *cal, const QString& newvalue, const KUndo2MagicString& name = KUndo2MagicString() ); |
159 | void execute(); |
160 | void unexecute(); |
161 | |
162 | private: |
163 | Calendar *m_cal; |
164 | QString m_newvalue; |
165 | QString m_oldvalue; |
166 | }; |
167 | |
168 | class KPLATOKERNEL_EXPORT CalendarModifyParentCmd : public NamedCommand |
169 | { |
170 | public: |
171 | CalendarModifyParentCmd( Project *project, Calendar *cal, Calendar *newvalue, const KUndo2MagicString& name = KUndo2MagicString() ); |
172 | ~CalendarModifyParentCmd(); |
173 | void execute(); |
174 | void unexecute(); |
175 | |
176 | private: |
177 | Project *m_project; |
178 | Calendar *m_cal; |
179 | Calendar *m_newvalue; |
180 | Calendar *m_oldvalue; |
181 | MacroCommand *m_cmd; |
182 | |
183 | int m_oldindex; |
184 | int m_newindex; |
185 | }; |
186 | |
187 | class KPLATOKERNEL_EXPORT CalendarModifyTimeZoneCmd : public NamedCommand |
188 | { |
189 | public: |
190 | CalendarModifyTimeZoneCmd( Calendar *cal, const KTimeZone &value, const KUndo2MagicString& name = KUndo2MagicString() ); |
191 | ~CalendarModifyTimeZoneCmd(); |
192 | void execute(); |
193 | void unexecute(); |
194 | |
195 | private: |
196 | Calendar *m_cal; |
197 | KTimeZone m_newvalue; |
198 | KTimeZone m_oldvalue; |
199 | MacroCommand *m_cmd; |
200 | }; |
201 | |
202 | class KPLATOKERNEL_EXPORT CalendarAddDayCmd : public NamedCommand |
203 | { |
204 | public: |
205 | CalendarAddDayCmd( Calendar *cal, CalendarDay *newvalue, const KUndo2MagicString& name = KUndo2MagicString() ); |
206 | ~CalendarAddDayCmd(); |
207 | void execute(); |
208 | void unexecute(); |
209 | |
210 | protected: |
211 | Calendar *m_cal; |
212 | CalendarDay *m_newvalue; |
213 | bool m_mine; |
214 | }; |
215 | |
216 | class KPLATOKERNEL_EXPORT CalendarRemoveDayCmd : public NamedCommand |
217 | { |
218 | public: |
219 | CalendarRemoveDayCmd( Calendar *cal, CalendarDay *day, const KUndo2MagicString& name = KUndo2MagicString() ); |
220 | CalendarRemoveDayCmd( Calendar *cal, const QDate &day, const KUndo2MagicString& name = KUndo2MagicString() ); |
221 | void execute(); |
222 | void unexecute(); |
223 | |
224 | protected: |
225 | Calendar *m_cal; |
226 | CalendarDay *m_value; |
227 | bool m_mine; |
228 | |
229 | private: |
230 | void init(); |
231 | }; |
232 | |
233 | class KPLATOKERNEL_EXPORT CalendarModifyDayCmd : public NamedCommand |
234 | { |
235 | public: |
236 | CalendarModifyDayCmd( Calendar *cal, CalendarDay *value, const KUndo2MagicString& name = KUndo2MagicString() ); |
237 | ~CalendarModifyDayCmd(); |
238 | void execute(); |
239 | void unexecute(); |
240 | |
241 | private: |
242 | Calendar *m_cal; |
243 | CalendarDay *m_newvalue; |
244 | CalendarDay *m_oldvalue; |
245 | bool m_mine; |
246 | }; |
247 | |
248 | class KPLATOKERNEL_EXPORT CalendarModifyStateCmd : public NamedCommand |
249 | { |
250 | public: |
251 | CalendarModifyStateCmd( Calendar *calendar, CalendarDay *day, CalendarDay::State value, const KUndo2MagicString& name = KUndo2MagicString() ); |
252 | ~CalendarModifyStateCmd(); |
253 | void execute(); |
254 | void unexecute(); |
255 | |
256 | private: |
257 | Calendar *m_calendar; |
258 | CalendarDay *m_day; |
259 | CalendarDay::State m_newvalue; |
260 | CalendarDay::State m_oldvalue; |
261 | MacroCommand *m_cmd; |
262 | }; |
263 | |
264 | class KPLATOKERNEL_EXPORT CalendarModifyTimeIntervalCmd : public NamedCommand |
265 | { |
266 | public: |
267 | CalendarModifyTimeIntervalCmd( Calendar *calendar, TimeInterval &newvalue, TimeInterval *value, const KUndo2MagicString& name = KUndo2MagicString() ); |
268 | void execute(); |
269 | void unexecute(); |
270 | |
271 | private: |
272 | Calendar *m_calendar; |
273 | TimeInterval *m_value; |
274 | TimeInterval m_newvalue; |
275 | TimeInterval m_oldvalue; |
276 | }; |
277 | |
278 | class KPLATOKERNEL_EXPORT CalendarAddTimeIntervalCmd : public NamedCommand |
279 | { |
280 | public: |
281 | CalendarAddTimeIntervalCmd( Calendar *calendar, CalendarDay *day, TimeInterval *value, const KUndo2MagicString& name = KUndo2MagicString() ); |
282 | ~CalendarAddTimeIntervalCmd(); |
283 | void execute(); |
284 | void unexecute(); |
285 | |
286 | protected: |
287 | Calendar *m_calendar; |
288 | CalendarDay *m_day; |
289 | TimeInterval *m_value; |
290 | bool m_mine; |
291 | }; |
292 | |
293 | class KPLATOKERNEL_EXPORT CalendarRemoveTimeIntervalCmd : public CalendarAddTimeIntervalCmd |
294 | { |
295 | public: |
296 | CalendarRemoveTimeIntervalCmd( Calendar *calendar, CalendarDay *day, TimeInterval *value, const KUndo2MagicString& name = KUndo2MagicString() ); |
297 | |
298 | void execute(); |
299 | void unexecute(); |
300 | }; |
301 | |
302 | class KPLATOKERNEL_EXPORT CalendarModifyWeekdayCmd : public NamedCommand |
303 | { |
304 | public: |
305 | CalendarModifyWeekdayCmd( Calendar *cal, int weekday, CalendarDay *value, const KUndo2MagicString& name = KUndo2MagicString() ); |
306 | ~CalendarModifyWeekdayCmd(); |
307 | void execute(); |
308 | void unexecute(); |
309 | |
310 | private: |
311 | int m_weekday; |
312 | Calendar *m_cal; |
313 | CalendarDay *m_value; |
314 | CalendarDay m_orig; |
315 | }; |
316 | |
317 | class KPLATOKERNEL_EXPORT CalendarModifyDateCmd : public NamedCommand |
318 | { |
319 | public: |
320 | CalendarModifyDateCmd( Calendar *cal, CalendarDay *day, const QDate &value, const KUndo2MagicString& name = KUndo2MagicString() ); |
321 | void execute(); |
322 | void unexecute(); |
323 | |
324 | private: |
325 | Calendar *m_cal; |
326 | CalendarDay *m_day; |
327 | QDate m_newvalue, m_oldvalue; |
328 | }; |
329 | |
330 | class KPLATOKERNEL_EXPORT ProjectModifyDefaultCalendarCmd : public NamedCommand |
331 | { |
332 | public: |
333 | ProjectModifyDefaultCalendarCmd( Project *project, Calendar *cal, const KUndo2MagicString& name = KUndo2MagicString() ); |
334 | void execute(); |
335 | void unexecute(); |
336 | |
337 | private: |
338 | Project *m_project; |
339 | Calendar *m_newvalue, *m_oldvalue; |
340 | }; |
341 | |
342 | |
343 | class KPLATOKERNEL_EXPORT NodeDeleteCmd : public NamedCommand |
344 | { |
345 | public: |
346 | explicit NodeDeleteCmd( Node *node, const KUndo2MagicString& name = KUndo2MagicString() ); |
347 | ~NodeDeleteCmd(); |
348 | void execute(); |
349 | void unexecute(); |
350 | |
351 | private: |
352 | Node *m_node; |
353 | Node *m_parent; |
354 | Project *m_project; |
355 | int m_index; |
356 | bool m_mine; |
357 | QList<Appointment*> m_appointments; |
358 | MacroCommand *m_cmd; |
359 | MacroCommand m_relCmd; |
360 | }; |
361 | |
362 | class KPLATOKERNEL_EXPORT TaskAddCmd : public NamedCommand |
363 | { |
364 | public: |
365 | TaskAddCmd( Project *project, Node *node, Node *after, const KUndo2MagicString& name = KUndo2MagicString() ); |
366 | ~TaskAddCmd(); |
367 | void execute(); |
368 | void unexecute(); |
369 | |
370 | private: |
371 | Project *m_project; |
372 | Node *m_node; |
373 | Node *m_after; |
374 | bool m_added; |
375 | }; |
376 | |
377 | class KPLATOKERNEL_EXPORT SubtaskAddCmd : public NamedCommand |
378 | { |
379 | public: |
380 | SubtaskAddCmd( Project *project, Node *node, Node *parent, const KUndo2MagicString& name = KUndo2MagicString() ); |
381 | ~SubtaskAddCmd(); |
382 | void execute(); |
383 | void unexecute(); |
384 | |
385 | private: |
386 | Project *m_project; |
387 | Node *m_node; |
388 | Node *m_parent; |
389 | bool m_added; |
390 | MacroCommand *m_cmd; |
391 | }; |
392 | |
393 | |
394 | class KPLATOKERNEL_EXPORT NodeModifyNameCmd : public NamedCommand |
395 | { |
396 | public: |
397 | NodeModifyNameCmd( Node &node, const QString& nodename, const KUndo2MagicString& name = KUndo2MagicString() ); |
398 | void execute(); |
399 | void unexecute(); |
400 | |
401 | private: |
402 | Node &m_node; |
403 | QString newName; |
404 | QString oldName; |
405 | }; |
406 | |
407 | class KPLATOKERNEL_EXPORT NodeModifyLeaderCmd : public NamedCommand |
408 | { |
409 | public: |
410 | NodeModifyLeaderCmd( Node &node, const QString& leader, const KUndo2MagicString& name = KUndo2MagicString() ); |
411 | void execute(); |
412 | void unexecute(); |
413 | |
414 | private: |
415 | Node &m_node; |
416 | QString newLeader; |
417 | QString oldLeader; |
418 | }; |
419 | |
420 | class KPLATOKERNEL_EXPORT NodeModifyDescriptionCmd : public NamedCommand |
421 | { |
422 | public: |
423 | NodeModifyDescriptionCmd( Node &node, const QString& description, const KUndo2MagicString& name = KUndo2MagicString() ); |
424 | void execute(); |
425 | void unexecute(); |
426 | |
427 | private: |
428 | Node &m_node; |
429 | QString newDescription; |
430 | QString oldDescription; |
431 | }; |
432 | |
433 | class KPLATOKERNEL_EXPORT NodeModifyConstraintCmd : public NamedCommand |
434 | { |
435 | public: |
436 | NodeModifyConstraintCmd( Node &node, Node::ConstraintType c, const KUndo2MagicString& name = KUndo2MagicString() ); |
437 | void execute(); |
438 | void unexecute(); |
439 | |
440 | private: |
441 | Node &m_node; |
442 | Node::ConstraintType newConstraint; |
443 | Node::ConstraintType oldConstraint; |
444 | |
445 | }; |
446 | |
447 | class KPLATOKERNEL_EXPORT NodeModifyConstraintStartTimeCmd : public NamedCommand |
448 | { |
449 | public: |
450 | NodeModifyConstraintStartTimeCmd( Node &node, const QDateTime& dt, const KUndo2MagicString& name = KUndo2MagicString() ); |
451 | void execute(); |
452 | void unexecute(); |
453 | |
454 | private: |
455 | Node &m_node; |
456 | QDateTime newTime; |
457 | DateTime oldTime; |
458 | KDateTime::Spec m_spec; |
459 | }; |
460 | class KPLATOKERNEL_EXPORT NodeModifyConstraintEndTimeCmd : public NamedCommand |
461 | { |
462 | public: |
463 | NodeModifyConstraintEndTimeCmd( Node &node, const QDateTime& dt, const KUndo2MagicString& name = KUndo2MagicString() ); |
464 | void execute(); |
465 | void unexecute(); |
466 | |
467 | private: |
468 | Node &m_node; |
469 | QDateTime newTime; |
470 | DateTime oldTime; |
471 | KDateTime::Spec m_spec; |
472 | }; |
473 | class KPLATOKERNEL_EXPORT NodeModifyStartTimeCmd : public NamedCommand |
474 | { |
475 | public: |
476 | NodeModifyStartTimeCmd( Node &node, const QDateTime& dt, const KUndo2MagicString& name = KUndo2MagicString() ); |
477 | void execute(); |
478 | void unexecute(); |
479 | |
480 | private: |
481 | Node &m_node; |
482 | QDateTime newTime; |
483 | DateTime oldTime; |
484 | KDateTime::Spec m_spec; |
485 | }; |
486 | class KPLATOKERNEL_EXPORT NodeModifyEndTimeCmd : public NamedCommand |
487 | { |
488 | public: |
489 | NodeModifyEndTimeCmd( Node &node, const QDateTime& dt, const KUndo2MagicString& name = KUndo2MagicString() ); |
490 | void execute(); |
491 | void unexecute(); |
492 | |
493 | private: |
494 | Node &m_node; |
495 | QDateTime newTime; |
496 | DateTime oldTime; |
497 | KDateTime::Spec m_spec; |
498 | }; |
499 | class KPLATOKERNEL_EXPORT NodeModifyIdCmd : public NamedCommand |
500 | { |
501 | public: |
502 | NodeModifyIdCmd( Node &node, const QString& id, const KUndo2MagicString& name = KUndo2MagicString() ); |
503 | void execute(); |
504 | void unexecute(); |
505 | |
506 | private: |
507 | Node &m_node; |
508 | QString newId; |
509 | QString oldId; |
510 | }; |
511 | |
512 | class KPLATOKERNEL_EXPORT NodeIndentCmd : public NamedCommand |
513 | { |
514 | public: |
515 | explicit NodeIndentCmd( Node &node, const KUndo2MagicString& name = KUndo2MagicString() ); |
516 | ~NodeIndentCmd(); |
517 | void execute(); |
518 | void unexecute(); |
519 | |
520 | private: |
521 | Node &m_node; |
522 | Node *m_oldparent, *m_newparent; |
523 | int m_oldindex, m_newindex; |
524 | MacroCommand *m_cmd; |
525 | }; |
526 | |
527 | class KPLATOKERNEL_EXPORT NodeUnindentCmd : public NamedCommand |
528 | { |
529 | public: |
530 | explicit NodeUnindentCmd( Node &node, const KUndo2MagicString& name = KUndo2MagicString() ); |
531 | void execute(); |
532 | void unexecute(); |
533 | |
534 | private: |
535 | Node &m_node; |
536 | Node *m_oldparent, *m_newparent; |
537 | int m_oldindex, m_newindex; |
538 | }; |
539 | |
540 | class KPLATOKERNEL_EXPORT NodeMoveUpCmd : public NamedCommand |
541 | { |
542 | public: |
543 | explicit NodeMoveUpCmd( Node &node, const KUndo2MagicString& name = KUndo2MagicString() ); |
544 | void execute(); |
545 | void unexecute(); |
546 | |
547 | private: |
548 | Node &m_node; |
549 | Project *m_project; |
550 | bool m_moved; |
551 | }; |
552 | |
553 | class KPLATOKERNEL_EXPORT NodeMoveDownCmd : public NamedCommand |
554 | { |
555 | public: |
556 | explicit NodeMoveDownCmd( Node &node, const KUndo2MagicString& name = KUndo2MagicString() ); |
557 | void execute(); |
558 | void unexecute(); |
559 | |
560 | private: |
561 | Node &m_node; |
562 | Project *m_project; |
563 | bool m_moved; |
564 | }; |
565 | |
566 | class KPLATOKERNEL_EXPORT NodeMoveCmd : public NamedCommand |
567 | { |
568 | public: |
569 | NodeMoveCmd( Project *project, Node *node, Node *newParent, int newPos, const KUndo2MagicString& name = KUndo2MagicString() ); |
570 | void execute(); |
571 | void unexecute(); |
572 | |
573 | private: |
574 | Project *m_project; |
575 | Node *m_node; |
576 | Node *m_newparent; |
577 | Node *m_oldparent; |
578 | int m_newpos; |
579 | int m_oldpos; |
580 | bool m_moved; |
581 | MacroCommand m_cmd; |
582 | }; |
583 | |
584 | class KPLATOKERNEL_EXPORT AddRelationCmd : public NamedCommand |
585 | { |
586 | public: |
587 | AddRelationCmd( Project &project, Relation *rel, const KUndo2MagicString& name = KUndo2MagicString() ); |
588 | ~AddRelationCmd(); |
589 | void execute(); |
590 | void unexecute(); |
591 | |
592 | private: |
593 | Relation *m_rel; |
594 | Project &m_project; |
595 | bool m_taken; |
596 | |
597 | }; |
598 | |
599 | class KPLATOKERNEL_EXPORT DeleteRelationCmd : public NamedCommand |
600 | { |
601 | public: |
602 | DeleteRelationCmd( Project &project, Relation *rel, const KUndo2MagicString& name = KUndo2MagicString() ); |
603 | ~DeleteRelationCmd(); |
604 | void execute(); |
605 | void unexecute(); |
606 | |
607 | private: |
608 | Relation *m_rel; |
609 | Project &m_project; |
610 | bool m_taken; |
611 | |
612 | }; |
613 | |
614 | class KPLATOKERNEL_EXPORT ModifyRelationTypeCmd : public NamedCommand |
615 | { |
616 | public: |
617 | ModifyRelationTypeCmd( Relation *rel, Relation::Type type, const KUndo2MagicString& name = KUndo2MagicString() ); |
618 | void execute(); |
619 | void unexecute(); |
620 | |
621 | private: |
622 | Project *m_project; |
623 | Relation *m_rel; |
624 | Relation::Type m_newtype; |
625 | Relation::Type m_oldtype; |
626 | |
627 | }; |
628 | |
629 | class KPLATOKERNEL_EXPORT ModifyRelationLagCmd : public NamedCommand |
630 | { |
631 | public: |
632 | ModifyRelationLagCmd( Relation *rel, Duration lag, const KUndo2MagicString& name = KUndo2MagicString() ); |
633 | void execute(); |
634 | void unexecute(); |
635 | |
636 | private: |
637 | Project *m_project; |
638 | Relation *m_rel; |
639 | Duration m_newlag; |
640 | Duration m_oldlag; |
641 | |
642 | }; |
643 | |
644 | class KPLATOKERNEL_EXPORT AddResourceRequestCmd : public NamedCommand |
645 | { |
646 | public: |
647 | AddResourceRequestCmd( ResourceGroupRequest *group, ResourceRequest *request, const KUndo2MagicString& name = KUndo2MagicString() ); |
648 | ~AddResourceRequestCmd(); |
649 | void execute(); |
650 | void unexecute(); |
651 | |
652 | private: |
653 | ResourceGroupRequest *m_group; |
654 | ResourceRequest *m_request; |
655 | bool m_mine; |
656 | |
657 | }; |
658 | |
659 | class KPLATOKERNEL_EXPORT RemoveResourceRequestCmd : public NamedCommand |
660 | { |
661 | public: |
662 | RemoveResourceRequestCmd( ResourceGroupRequest *group, ResourceRequest *request, const KUndo2MagicString& name = KUndo2MagicString() ); |
663 | ~RemoveResourceRequestCmd(); |
664 | void execute(); |
665 | void unexecute(); |
666 | |
667 | private: |
668 | ResourceGroupRequest *m_group; |
669 | ResourceRequest *m_request; |
670 | bool m_mine; |
671 | |
672 | }; |
673 | |
674 | class KPLATOKERNEL_EXPORT ModifyResourceRequestUnitsCmd : public NamedCommand |
675 | { |
676 | public: |
677 | ModifyResourceRequestUnitsCmd( ResourceRequest *request, int oldvalue, int newvalue, const KUndo2MagicString& name = KUndo2MagicString() ); |
678 | void execute(); |
679 | void unexecute(); |
680 | |
681 | private: |
682 | ResourceRequest *m_request; |
683 | int m_oldvalue, m_newvalue; |
684 | |
685 | }; |
686 | |
687 | class KPLATOKERNEL_EXPORT ModifyResourceRequestRequiredCmd : public NamedCommand |
688 | { |
689 | public: |
690 | ModifyResourceRequestRequiredCmd( ResourceRequest *request, const QList<Resource*> &value, const KUndo2MagicString& name = KUndo2MagicString() ); |
691 | void execute(); |
692 | void unexecute(); |
693 | |
694 | private: |
695 | ResourceRequest *m_request; |
696 | QList<Resource*> m_oldvalue, m_newvalue; |
697 | |
698 | }; |
699 | |
700 | class KPLATOKERNEL_EXPORT ModifyResourceGroupRequestUnitsCmd : public NamedCommand |
701 | { |
702 | public: |
703 | ModifyResourceGroupRequestUnitsCmd( ResourceGroupRequest *request, int oldvalue, int newvalue, const KUndo2MagicString& name = KUndo2MagicString() ); |
704 | void execute(); |
705 | void unexecute(); |
706 | |
707 | private: |
708 | ResourceGroupRequest *m_request; |
709 | int m_oldvalue, m_newvalue; |
710 | |
711 | }; |
712 | |
713 | class KPLATOKERNEL_EXPORT ModifyEstimateCmd : public NamedCommand |
714 | { |
715 | public: |
716 | ModifyEstimateCmd( Node &node, double oldvalue, double newvalue, const KUndo2MagicString& name = KUndo2MagicString() ); |
717 | ~ModifyEstimateCmd(); |
718 | void execute(); |
719 | void unexecute(); |
720 | |
721 | private: |
722 | Estimate *m_estimate; |
723 | double m_oldvalue, m_newvalue; |
724 | int m_optimistic, m_pessimistic; |
725 | MacroCommand *m_cmd; |
726 | |
727 | }; |
728 | |
729 | class KPLATOKERNEL_EXPORT EstimateModifyOptimisticRatioCmd : public NamedCommand |
730 | { |
731 | public: |
732 | EstimateModifyOptimisticRatioCmd( Node &node, int oldvalue, int newvalue, const KUndo2MagicString& name = KUndo2MagicString() ); |
733 | void execute(); |
734 | void unexecute(); |
735 | |
736 | private: |
737 | Estimate *m_estimate; |
738 | int m_oldvalue, m_newvalue; |
739 | |
740 | }; |
741 | |
742 | class KPLATOKERNEL_EXPORT EstimateModifyPessimisticRatioCmd : public NamedCommand |
743 | { |
744 | public: |
745 | EstimateModifyPessimisticRatioCmd( Node &node, int oldvalue, int newvalue, const KUndo2MagicString& name = KUndo2MagicString() ); |
746 | void execute(); |
747 | void unexecute(); |
748 | |
749 | private: |
750 | Estimate *m_estimate; |
751 | int m_oldvalue, m_newvalue; |
752 | |
753 | }; |
754 | |
755 | class KPLATOKERNEL_EXPORT ModifyEstimateTypeCmd : public NamedCommand |
756 | { |
757 | public: |
758 | ModifyEstimateTypeCmd( Node &node, int oldvalue, int newvalue, const KUndo2MagicString& name = KUndo2MagicString() ); |
759 | void execute(); |
760 | void unexecute(); |
761 | |
762 | private: |
763 | Estimate *m_estimate; |
764 | int m_oldvalue, m_newvalue; |
765 | |
766 | }; |
767 | |
768 | class KPLATOKERNEL_EXPORT ModifyEstimateUnitCmd : public NamedCommand |
769 | { |
770 | public: |
771 | ModifyEstimateUnitCmd( Node &node, Duration::Unit oldvalue, Duration::Unit newvalue, const KUndo2MagicString& name = KUndo2MagicString() ); |
772 | void execute(); |
773 | void unexecute(); |
774 | |
775 | private: |
776 | Estimate *m_estimate; |
777 | Duration::Unit m_oldvalue, m_newvalue; |
778 | }; |
779 | |
780 | class KPLATOKERNEL_EXPORT EstimateModifyRiskCmd : public NamedCommand |
781 | { |
782 | public: |
783 | EstimateModifyRiskCmd( Node &node, int oldvalue, int newvalue, const KUndo2MagicString& name = KUndo2MagicString() ); |
784 | void execute(); |
785 | void unexecute(); |
786 | |
787 | private: |
788 | Estimate *m_estimate; |
789 | int m_oldvalue, m_newvalue; |
790 | |
791 | }; |
792 | |
793 | class KPLATOKERNEL_EXPORT ModifyEstimateCalendarCmd : public NamedCommand |
794 | { |
795 | public: |
796 | ModifyEstimateCalendarCmd( Node &node, Calendar *oldvalue, Calendar *newvalue, const KUndo2MagicString& name = KUndo2MagicString() ); |
797 | void execute(); |
798 | void unexecute(); |
799 | |
800 | private: |
801 | Estimate *m_estimate; |
802 | Calendar *m_oldvalue, *m_newvalue; |
803 | |
804 | }; |
805 | |
806 | |
807 | class KPLATOKERNEL_EXPORT AddResourceGroupRequestCmd : public NamedCommand |
808 | { |
809 | public: |
810 | AddResourceGroupRequestCmd( Task &task, ResourceGroupRequest *request, const KUndo2MagicString& name = KUndo2MagicString() ); |
811 | void execute(); |
812 | void unexecute(); |
813 | |
814 | private: |
815 | Task &m_task; |
816 | ResourceGroupRequest *m_request; |
817 | bool m_mine; |
818 | }; |
819 | |
820 | class KPLATOKERNEL_EXPORT RemoveResourceGroupRequestCmd : public NamedCommand |
821 | { |
822 | public: |
823 | explicit RemoveResourceGroupRequestCmd( ResourceGroupRequest *request, const KUndo2MagicString& name = KUndo2MagicString() ); |
824 | RemoveResourceGroupRequestCmd( Task &task, ResourceGroupRequest *request, const KUndo2MagicString& name = KUndo2MagicString() ); |
825 | void execute(); |
826 | void unexecute(); |
827 | |
828 | private: |
829 | Task &m_task; |
830 | ResourceGroupRequest *m_request; |
831 | bool m_mine; |
832 | }; |
833 | |
834 | class KPLATOKERNEL_EXPORT AddResourceCmd : public NamedCommand |
835 | { |
836 | public: |
837 | AddResourceCmd( ResourceGroup *group, Resource *resource, const KUndo2MagicString& name = KUndo2MagicString() ); |
838 | ~AddResourceCmd(); |
839 | void execute(); |
840 | void unexecute(); |
841 | |
842 | protected: |
843 | |
844 | ResourceGroup *m_group; |
845 | Resource *m_resource; |
846 | int m_index; |
847 | bool m_mine; |
848 | }; |
849 | |
850 | class KPLATOKERNEL_EXPORT RemoveResourceCmd : public AddResourceCmd |
851 | { |
852 | public: |
853 | RemoveResourceCmd( ResourceGroup *group, Resource *resource, const KUndo2MagicString& name = KUndo2MagicString() ); |
854 | ~RemoveResourceCmd(); |
855 | void execute(); |
856 | void unexecute(); |
857 | |
858 | private: |
859 | QList<ResourceRequest*> m_requests; |
860 | QList<Appointment*> m_appointments; |
861 | MacroCommand m_cmd; |
862 | }; |
863 | |
864 | class KPLATOKERNEL_EXPORT MoveResourceCmd : public NamedCommand |
865 | { |
866 | public: |
867 | MoveResourceCmd( ResourceGroup *group, Resource *resource, const KUndo2MagicString& name = KUndo2MagicString() ); |
868 | void execute(); |
869 | void unexecute(); |
870 | |
871 | private: |
872 | Project &m_project; |
873 | Resource *m_resource; |
874 | ResourceGroup *m_oldvalue, *m_newvalue; |
875 | MacroCommand cmd; |
876 | }; |
877 | |
878 | class KPLATOKERNEL_EXPORT ModifyResourceNameCmd : public NamedCommand |
879 | { |
880 | public: |
881 | ModifyResourceNameCmd( Resource *resource, const QString& value, const KUndo2MagicString& name = KUndo2MagicString() ); |
882 | void execute(); |
883 | void unexecute(); |
884 | |
885 | private: |
886 | |
887 | Resource *m_resource; |
888 | QString m_newvalue; |
889 | QString m_oldvalue; |
890 | }; |
891 | class KPLATOKERNEL_EXPORT ModifyResourceInitialsCmd : public NamedCommand |
892 | { |
893 | public: |
894 | ModifyResourceInitialsCmd( Resource *resource, const QString& value, const KUndo2MagicString& name = KUndo2MagicString() ); |
895 | void execute(); |
896 | void unexecute(); |
897 | |
898 | private: |
899 | Resource *m_resource; |
900 | QString m_newvalue; |
901 | QString m_oldvalue; |
902 | }; |
903 | class KPLATOKERNEL_EXPORT ModifyResourceEmailCmd : public NamedCommand |
904 | { |
905 | public: |
906 | ModifyResourceEmailCmd( Resource *resource, const QString& value, const KUndo2MagicString& name = KUndo2MagicString() ); |
907 | void execute(); |
908 | void unexecute(); |
909 | |
910 | private: |
911 | Resource *m_resource; |
912 | QString m_newvalue; |
913 | QString m_oldvalue; |
914 | }; |
915 | class KPLATOKERNEL_EXPORT ModifyResourceAutoAllocateCmd : public NamedCommand |
916 | { |
917 | public: |
918 | ModifyResourceAutoAllocateCmd( Resource *resource, bool value, const KUndo2MagicString& name = KUndo2MagicString() ); |
919 | void execute(); |
920 | void unexecute(); |
921 | |
922 | private: |
923 | Resource *m_resource; |
924 | bool m_newvalue; |
925 | bool m_oldvalue; |
926 | }; |
927 | class KPLATOKERNEL_EXPORT ModifyResourceTypeCmd : public NamedCommand |
928 | { |
929 | public: |
930 | ModifyResourceTypeCmd( Resource *resource, int value, const KUndo2MagicString& name = KUndo2MagicString() ); |
931 | void execute(); |
932 | void unexecute(); |
933 | |
934 | private: |
935 | Resource *m_resource; |
936 | int m_newvalue; |
937 | int m_oldvalue; |
938 | }; |
939 | |
940 | class KPLATOKERNEL_EXPORT ModifyResourceUnitsCmd : public NamedCommand |
941 | { |
942 | public: |
943 | ModifyResourceUnitsCmd( Resource *resource, int value, const KUndo2MagicString& name = KUndo2MagicString() ); |
944 | void execute(); |
945 | void unexecute(); |
946 | |
947 | private: |
948 | Resource *m_resource; |
949 | int m_newvalue; |
950 | int m_oldvalue; |
951 | }; |
952 | |
953 | class KPLATOKERNEL_EXPORT ModifyResourceAvailableFromCmd : public NamedCommand |
954 | { |
955 | public: |
956 | ModifyResourceAvailableFromCmd( Resource *resource, const QDateTime& value, const KUndo2MagicString& name = KUndo2MagicString() ); |
957 | void execute(); |
958 | void unexecute(); |
959 | |
960 | private: |
961 | Resource *m_resource; |
962 | QDateTime m_newvalue; |
963 | DateTime m_oldvalue; |
964 | KDateTime::Spec m_spec; |
965 | }; |
966 | class KPLATOKERNEL_EXPORT ModifyResourceAvailableUntilCmd : public NamedCommand |
967 | { |
968 | public: |
969 | ModifyResourceAvailableUntilCmd( Resource *resource, const QDateTime& value, const KUndo2MagicString& name = KUndo2MagicString() ); |
970 | void execute(); |
971 | void unexecute(); |
972 | |
973 | private: |
974 | Resource *m_resource; |
975 | QDateTime m_newvalue; |
976 | DateTime m_oldvalue; |
977 | KDateTime::Spec m_spec; |
978 | }; |
979 | |
980 | class KPLATOKERNEL_EXPORT ModifyResourceNormalRateCmd : public NamedCommand |
981 | { |
982 | public: |
983 | ModifyResourceNormalRateCmd( Resource *resource, double value, const KUndo2MagicString& name = KUndo2MagicString() ); |
984 | void execute(); |
985 | void unexecute(); |
986 | |
987 | private: |
988 | Resource *m_resource; |
989 | double m_newvalue; |
990 | double m_oldvalue; |
991 | }; |
992 | class KPLATOKERNEL_EXPORT ModifyResourceOvertimeRateCmd : public NamedCommand |
993 | { |
994 | public: |
995 | ModifyResourceOvertimeRateCmd( Resource *resource, double value, const KUndo2MagicString& name = KUndo2MagicString() ); |
996 | void execute(); |
997 | void unexecute(); |
998 | |
999 | private: |
1000 | Resource *m_resource; |
1001 | double m_newvalue; |
1002 | double m_oldvalue; |
1003 | }; |
1004 | class KPLATOKERNEL_EXPORT ModifyResourceCalendarCmd : public NamedCommand |
1005 | { |
1006 | public: |
1007 | ModifyResourceCalendarCmd( Resource *resource, Calendar *value, const KUndo2MagicString& name = KUndo2MagicString() ); |
1008 | void execute(); |
1009 | void unexecute(); |
1010 | |
1011 | private: |
1012 | Resource *m_resource; |
1013 | Calendar *m_newvalue; |
1014 | Calendar *m_oldvalue; |
1015 | }; |
1016 | class KPLATOKERNEL_EXPORT ModifyRequiredResourcesCmd : public NamedCommand |
1017 | { |
1018 | public: |
1019 | ModifyRequiredResourcesCmd( Resource *resource, const QStringList &value, const KUndo2MagicString& name = KUndo2MagicString() ); |
1020 | void execute(); |
1021 | void unexecute(); |
1022 | |
1023 | private: |
1024 | Resource *m_resource; |
1025 | QStringList m_newvalue; |
1026 | QStringList m_oldvalue; |
1027 | }; |
1028 | class KPLATOKERNEL_EXPORT ModifyResourceAccountCmd : public NamedCommand |
1029 | { |
1030 | public: |
1031 | ModifyResourceAccountCmd( Resource *resource, Account *account, const KUndo2MagicString& name = KUndo2MagicString() ); |
1032 | void execute(); |
1033 | void unexecute(); |
1034 | |
1035 | private: |
1036 | Resource *m_resource; |
1037 | Account *m_newvalue; |
1038 | Account *m_oldvalue; |
1039 | }; |
1040 | class KPLATOKERNEL_EXPORT AddResourceTeamCmd : public NamedCommand |
1041 | { |
1042 | public: |
1043 | AddResourceTeamCmd( Resource *team, const QString &member, const KUndo2MagicString& name = KUndo2MagicString() ); |
1044 | void execute(); |
1045 | void unexecute(); |
1046 | |
1047 | private: |
1048 | Resource *m_team; |
1049 | QString m_member; |
1050 | }; |
1051 | class KPLATOKERNEL_EXPORT RemoveResourceTeamCmd : public NamedCommand |
1052 | { |
1053 | public: |
1054 | RemoveResourceTeamCmd( Resource *team, const QString &member, const KUndo2MagicString& name = KUndo2MagicString() ); |
1055 | void execute(); |
1056 | void unexecute(); |
1057 | |
1058 | private: |
1059 | Resource *m_team; |
1060 | QString m_member; |
1061 | }; |
1062 | |
1063 | class KPLATOKERNEL_EXPORT RemoveResourceGroupCmd : public NamedCommand |
1064 | { |
1065 | public: |
1066 | RemoveResourceGroupCmd( Project *project, ResourceGroup *group, const KUndo2MagicString& name = KUndo2MagicString() ); |
1067 | ~RemoveResourceGroupCmd(); |
1068 | void execute(); |
1069 | void unexecute(); |
1070 | |
1071 | protected: |
1072 | |
1073 | ResourceGroup *m_group; |
1074 | Project *m_project; |
1075 | int m_index; |
1076 | bool m_mine; |
1077 | MacroCommand *m_cmd; |
1078 | }; |
1079 | |
1080 | class KPLATOKERNEL_EXPORT AddResourceGroupCmd : public RemoveResourceGroupCmd |
1081 | { |
1082 | public: |
1083 | AddResourceGroupCmd( Project *project, ResourceGroup *group, const KUndo2MagicString& name = KUndo2MagicString() ); |
1084 | void execute(); |
1085 | void unexecute(); |
1086 | }; |
1087 | |
1088 | class KPLATOKERNEL_EXPORT ModifyResourceGroupNameCmd : public NamedCommand |
1089 | { |
1090 | public: |
1091 | ModifyResourceGroupNameCmd( ResourceGroup *group, const QString& value, const KUndo2MagicString& name = KUndo2MagicString() ); |
1092 | void execute(); |
1093 | void unexecute(); |
1094 | |
1095 | private: |
1096 | ResourceGroup *m_group; |
1097 | QString m_newvalue; |
1098 | QString m_oldvalue; |
1099 | }; |
1100 | |
1101 | class KPLATOKERNEL_EXPORT ModifyResourceGroupTypeCmd : public NamedCommand |
1102 | { |
1103 | public: |
1104 | ModifyResourceGroupTypeCmd( ResourceGroup *group, int value, const KUndo2MagicString& name = KUndo2MagicString() ); |
1105 | void execute(); |
1106 | void unexecute(); |
1107 | |
1108 | private: |
1109 | ResourceGroup *m_group; |
1110 | int m_newvalue; |
1111 | int m_oldvalue; |
1112 | }; |
1113 | |
1114 | class KPLATOKERNEL_EXPORT ModifyCompletionEntrymodeCmd : public NamedCommand |
1115 | { |
1116 | public: |
1117 | ModifyCompletionEntrymodeCmd( Completion &completion, Completion::Entrymode value, const KUndo2MagicString& name = KUndo2MagicString() ); |
1118 | void execute(); |
1119 | void unexecute(); |
1120 | |
1121 | private: |
1122 | Completion &m_completion; |
1123 | Completion::Entrymode oldvalue; |
1124 | Completion::Entrymode newvalue; |
1125 | }; |
1126 | |
1127 | class KPLATOKERNEL_EXPORT ModifyCompletionStartedCmd : public NamedCommand |
1128 | { |
1129 | public: |
1130 | ModifyCompletionStartedCmd( Completion &completion, bool value, const KUndo2MagicString& name = KUndo2MagicString() ); |
1131 | void execute(); |
1132 | void unexecute(); |
1133 | |
1134 | private: |
1135 | Completion &m_completion; |
1136 | bool oldvalue; |
1137 | bool newvalue; |
1138 | }; |
1139 | |
1140 | class KPLATOKERNEL_EXPORT ModifyCompletionFinishedCmd : public NamedCommand |
1141 | { |
1142 | public: |
1143 | ModifyCompletionFinishedCmd( Completion &completion, bool value, const KUndo2MagicString& name = KUndo2MagicString() ); |
1144 | void execute(); |
1145 | void unexecute(); |
1146 | |
1147 | private: |
1148 | Completion &m_completion; |
1149 | bool oldvalue; |
1150 | bool newvalue; |
1151 | }; |
1152 | |
1153 | class KPLATOKERNEL_EXPORT ModifyCompletionStartTimeCmd : public NamedCommand |
1154 | { |
1155 | public: |
1156 | ModifyCompletionStartTimeCmd( Completion &completion, const QDateTime &value, const KUndo2MagicString& name = KUndo2MagicString() ); |
1157 | void execute(); |
1158 | void unexecute(); |
1159 | |
1160 | private: |
1161 | Completion &m_completion; |
1162 | DateTime oldvalue; |
1163 | QDateTime newvalue; |
1164 | KDateTime::Spec m_spec; |
1165 | }; |
1166 | |
1167 | class KPLATOKERNEL_EXPORT ModifyCompletionFinishTimeCmd : public NamedCommand |
1168 | { |
1169 | public: |
1170 | ModifyCompletionFinishTimeCmd( Completion &completion, const QDateTime &value, const KUndo2MagicString& name = KUndo2MagicString() ); |
1171 | void execute(); |
1172 | void unexecute(); |
1173 | |
1174 | private: |
1175 | Completion &m_completion; |
1176 | DateTime oldvalue; |
1177 | QDateTime newvalue; |
1178 | KDateTime::Spec m_spec; |
1179 | }; |
1180 | |
1181 | class KPLATOKERNEL_EXPORT AddCompletionEntryCmd : public NamedCommand |
1182 | { |
1183 | public: |
1184 | AddCompletionEntryCmd( Completion &completion, const QDate &date, Completion::Entry *value, const KUndo2MagicString& name = KUndo2MagicString() ); |
1185 | ~AddCompletionEntryCmd(); |
1186 | void execute(); |
1187 | void unexecute(); |
1188 | |
1189 | private: |
1190 | Completion &m_completion; |
1191 | QDate m_date; |
1192 | Completion::Entry *newvalue; |
1193 | bool m_newmine; |
1194 | }; |
1195 | |
1196 | class KPLATOKERNEL_EXPORT RemoveCompletionEntryCmd : public NamedCommand |
1197 | { |
1198 | public: |
1199 | RemoveCompletionEntryCmd( Completion &completion, const QDate& date, const KUndo2MagicString& name = KUndo2MagicString() ); |
1200 | ~RemoveCompletionEntryCmd(); |
1201 | void execute(); |
1202 | void unexecute(); |
1203 | |
1204 | private: |
1205 | Completion &m_completion; |
1206 | QDate m_date; |
1207 | Completion::Entry *value; |
1208 | bool m_mine; |
1209 | }; |
1210 | |
1211 | class KPLATOKERNEL_EXPORT ModifyCompletionEntryCmd : public NamedCommand |
1212 | { |
1213 | public: |
1214 | ModifyCompletionEntryCmd( Completion &completion, const QDate &date, Completion::Entry *value, const KUndo2MagicString& name = KUndo2MagicString() ); |
1215 | ~ModifyCompletionEntryCmd(); |
1216 | void execute(); |
1217 | void unexecute(); |
1218 | |
1219 | private: |
1220 | MacroCommand *cmd; |
1221 | }; |
1222 | |
1223 | class KPLATOKERNEL_EXPORT ModifyCompletionPercentFinishedCmd : public NamedCommand |
1224 | { |
1225 | public: |
1226 | ModifyCompletionPercentFinishedCmd( Completion &completion, const QDate &date, int value, const KUndo2MagicString& name = KUndo2MagicString() ); |
1227 | |
1228 | void execute(); |
1229 | void unexecute(); |
1230 | |
1231 | private: |
1232 | Completion &m_completion; |
1233 | QDate m_date; |
1234 | int m_newvalue, m_oldvalue; |
1235 | MacroCommand cmd; |
1236 | }; |
1237 | |
1238 | class KPLATOKERNEL_EXPORT ModifyCompletionRemainingEffortCmd : public NamedCommand |
1239 | { |
1240 | public: |
1241 | ModifyCompletionRemainingEffortCmd( Completion &completion, const QDate &date, const Duration &value, const KUndo2MagicString &name = KUndo2MagicString() ); |
1242 | |
1243 | void execute(); |
1244 | void unexecute(); |
1245 | |
1246 | private: |
1247 | Completion &m_completion; |
1248 | QDate m_date; |
1249 | Duration m_newvalue, m_oldvalue; |
1250 | MacroCommand cmd; |
1251 | }; |
1252 | |
1253 | class KPLATOKERNEL_EXPORT ModifyCompletionActualEffortCmd : public NamedCommand |
1254 | { |
1255 | public: |
1256 | ModifyCompletionActualEffortCmd( Completion &completion, const QDate &date, const Duration &value, const KUndo2MagicString &name = KUndo2MagicString() ); |
1257 | |
1258 | void execute(); |
1259 | void unexecute(); |
1260 | |
1261 | private: |
1262 | Completion &m_completion; |
1263 | QDate m_date; |
1264 | Duration m_newvalue, m_oldvalue; |
1265 | MacroCommand cmd; |
1266 | }; |
1267 | |
1268 | /** |
1269 | * Add used effort for @p resource. |
1270 | * Note that the used effort definition in @p value must contain entries for *all* dates. |
1271 | * If used effort is already defined it will be replaced. |
1272 | */ |
1273 | class KPLATOKERNEL_EXPORT AddCompletionUsedEffortCmd : public NamedCommand |
1274 | { |
1275 | public: |
1276 | AddCompletionUsedEffortCmd( Completion &completion, const Resource *resource, Completion::UsedEffort *value, const KUndo2MagicString& name = KUndo2MagicString() ); |
1277 | ~AddCompletionUsedEffortCmd(); |
1278 | void execute(); |
1279 | void unexecute(); |
1280 | |
1281 | private: |
1282 | Completion &m_completion; |
1283 | const Resource *m_resource; |
1284 | Completion::UsedEffort *oldvalue; |
1285 | Completion::UsedEffort *newvalue; |
1286 | bool m_newmine, m_oldmine; |
1287 | }; |
1288 | |
1289 | class KPLATOKERNEL_EXPORT AddCompletionActualEffortCmd : public NamedCommand |
1290 | { |
1291 | public: |
1292 | AddCompletionActualEffortCmd( Completion::UsedEffort &ue, const QDate &date, const Completion::UsedEffort::ActualEffort &value, const KUndo2MagicString& name = KUndo2MagicString() ); |
1293 | ~AddCompletionActualEffortCmd(); |
1294 | void execute(); |
1295 | void unexecute(); |
1296 | |
1297 | private: |
1298 | Completion::UsedEffort &m_usedEffort; |
1299 | QDate m_date; |
1300 | Completion::UsedEffort::ActualEffort oldvalue; |
1301 | Completion::UsedEffort::ActualEffort newvalue; |
1302 | }; |
1303 | |
1304 | |
1305 | class KPLATOKERNEL_EXPORT AddAccountCmd : public NamedCommand |
1306 | { |
1307 | public: |
1308 | AddAccountCmd( Project &project, Account *account, Account *parent = 0, int index = -1, const KUndo2MagicString& name = KUndo2MagicString() ); |
1309 | AddAccountCmd( Project &project, Account *account, const QString& parent, int index = -1, const KUndo2MagicString& name = KUndo2MagicString() ); |
1310 | ~AddAccountCmd(); |
1311 | void execute(); |
1312 | void unexecute(); |
1313 | |
1314 | protected: |
1315 | bool m_mine; |
1316 | |
1317 | private: |
1318 | Project &m_project; |
1319 | Account *m_account; |
1320 | Account *m_parent; |
1321 | int m_index; |
1322 | QString m_parentName; |
1323 | }; |
1324 | |
1325 | class KPLATOKERNEL_EXPORT RemoveAccountCmd : public NamedCommand |
1326 | { |
1327 | public: |
1328 | RemoveAccountCmd( Project &project, Account *account, const KUndo2MagicString& name = KUndo2MagicString() ); |
1329 | ~RemoveAccountCmd(); |
1330 | void execute(); |
1331 | void unexecute(); |
1332 | |
1333 | private: |
1334 | Project &m_project; |
1335 | Account *m_account; |
1336 | Account *m_parent; |
1337 | int m_index; |
1338 | bool m_isDefault; |
1339 | bool m_mine; |
1340 | |
1341 | }; |
1342 | |
1343 | class KPLATOKERNEL_EXPORT RenameAccountCmd : public NamedCommand |
1344 | { |
1345 | public: |
1346 | RenameAccountCmd( Account *account, const QString& value, const KUndo2MagicString& name = KUndo2MagicString() ); |
1347 | void execute(); |
1348 | void unexecute(); |
1349 | |
1350 | private: |
1351 | Account *m_account; |
1352 | QString m_oldvalue; |
1353 | QString m_newvalue; |
1354 | }; |
1355 | |
1356 | class KPLATOKERNEL_EXPORT ModifyAccountDescriptionCmd : public NamedCommand |
1357 | { |
1358 | public: |
1359 | ModifyAccountDescriptionCmd( Account *account, const QString& value, const KUndo2MagicString& name = KUndo2MagicString() ); |
1360 | void execute(); |
1361 | void unexecute(); |
1362 | |
1363 | private: |
1364 | Account *m_account; |
1365 | QString m_oldvalue; |
1366 | QString m_newvalue; |
1367 | }; |
1368 | |
1369 | class KPLATOKERNEL_EXPORT NodeModifyStartupCostCmd : public NamedCommand |
1370 | { |
1371 | public: |
1372 | NodeModifyStartupCostCmd( Node &node, double value, const KUndo2MagicString& name = KUndo2MagicString() ); |
1373 | void execute(); |
1374 | void unexecute(); |
1375 | |
1376 | private: |
1377 | Node &m_node; |
1378 | double m_oldvalue; |
1379 | double m_newvalue; |
1380 | }; |
1381 | |
1382 | class KPLATOKERNEL_EXPORT NodeModifyShutdownCostCmd : public NamedCommand |
1383 | { |
1384 | public: |
1385 | NodeModifyShutdownCostCmd( Node &node, double value, const KUndo2MagicString& name = KUndo2MagicString() ); |
1386 | void execute(); |
1387 | void unexecute(); |
1388 | |
1389 | private: |
1390 | Node &m_node; |
1391 | double m_oldvalue; |
1392 | double m_newvalue; |
1393 | }; |
1394 | |
1395 | class KPLATOKERNEL_EXPORT NodeModifyRunningAccountCmd : public NamedCommand |
1396 | { |
1397 | public: |
1398 | NodeModifyRunningAccountCmd( Node &node, Account *oldvalue, Account *newvalue, const KUndo2MagicString& name = KUndo2MagicString() ); |
1399 | void execute(); |
1400 | void unexecute(); |
1401 | |
1402 | private: |
1403 | Node &m_node; |
1404 | Account *m_oldvalue; |
1405 | Account *m_newvalue; |
1406 | }; |
1407 | |
1408 | class KPLATOKERNEL_EXPORT NodeModifyStartupAccountCmd : public NamedCommand |
1409 | { |
1410 | public: |
1411 | NodeModifyStartupAccountCmd( Node &node, Account *oldvalue, Account *newvalue, const KUndo2MagicString& name = KUndo2MagicString() ); |
1412 | void execute(); |
1413 | void unexecute(); |
1414 | |
1415 | private: |
1416 | Node &m_node; |
1417 | Account *m_oldvalue; |
1418 | Account *m_newvalue; |
1419 | }; |
1420 | |
1421 | class KPLATOKERNEL_EXPORT NodeModifyShutdownAccountCmd : public NamedCommand |
1422 | { |
1423 | public: |
1424 | NodeModifyShutdownAccountCmd( Node &node, Account *oldvalue, Account *newvalue, const KUndo2MagicString& name = KUndo2MagicString() ); |
1425 | void execute(); |
1426 | void unexecute(); |
1427 | |
1428 | private: |
1429 | Node &m_node; |
1430 | Account *m_oldvalue; |
1431 | Account *m_newvalue; |
1432 | }; |
1433 | |
1434 | class KPLATOKERNEL_EXPORT ModifyDefaultAccountCmd : public NamedCommand |
1435 | { |
1436 | public: |
1437 | ModifyDefaultAccountCmd( Accounts &acc, Account *oldvalue, Account *newvalue, const KUndo2MagicString& name = KUndo2MagicString() ); |
1438 | void execute(); |
1439 | void unexecute(); |
1440 | |
1441 | private: |
1442 | Accounts &m_accounts; |
1443 | Account *m_oldvalue; |
1444 | Account *m_newvalue; |
1445 | }; |
1446 | |
1447 | class KPLATOKERNEL_EXPORT ResourceModifyAccountCmd : public NamedCommand |
1448 | { |
1449 | public: |
1450 | ResourceModifyAccountCmd( Resource &resource, Account *oldvalue, Account *newvalue, const KUndo2MagicString& name = KUndo2MagicString() ); |
1451 | void execute(); |
1452 | void unexecute(); |
1453 | |
1454 | private: |
1455 | Resource &m_resource; |
1456 | Account *m_oldvalue; |
1457 | Account *m_newvalue; |
1458 | }; |
1459 | |
1460 | class KPLATOKERNEL_EXPORT ProjectModifyConstraintCmd : public NamedCommand |
1461 | { |
1462 | public: |
1463 | ProjectModifyConstraintCmd( Project &node, Node::ConstraintType c, const KUndo2MagicString& name = KUndo2MagicString() ); |
1464 | void execute(); |
1465 | void unexecute(); |
1466 | |
1467 | private: |
1468 | Project &m_node; |
1469 | Node::ConstraintType newConstraint; |
1470 | Node::ConstraintType oldConstraint; |
1471 | |
1472 | }; |
1473 | |
1474 | class KPLATOKERNEL_EXPORT ProjectModifyStartTimeCmd : public NamedCommand |
1475 | { |
1476 | public: |
1477 | ProjectModifyStartTimeCmd( Project &node, const QDateTime& dt, const KUndo2MagicString& name = KUndo2MagicString() ); |
1478 | void execute(); |
1479 | void unexecute(); |
1480 | |
1481 | private: |
1482 | Project &m_node; |
1483 | QDateTime newTime; |
1484 | DateTime oldTime; |
1485 | KDateTime::Spec m_spec; |
1486 | }; |
1487 | |
1488 | class KPLATOKERNEL_EXPORT ProjectModifyEndTimeCmd : public NamedCommand |
1489 | { |
1490 | public: |
1491 | ProjectModifyEndTimeCmd( Project &project, const QDateTime& dt, const KUndo2MagicString& name = KUndo2MagicString() ); |
1492 | void execute(); |
1493 | void unexecute(); |
1494 | |
1495 | private: |
1496 | Project &m_node; |
1497 | QDateTime newTime; |
1498 | DateTime oldTime; |
1499 | KDateTime::Spec m_spec; |
1500 | }; |
1501 | |
1502 | |
1503 | class KPLATOKERNEL_EXPORT AddScheduleManagerCmd : public NamedCommand |
1504 | { |
1505 | public: |
1506 | AddScheduleManagerCmd( Project &project, ScheduleManager *sm, int index = -1, const KUndo2MagicString& name = KUndo2MagicString() ); |
1507 | AddScheduleManagerCmd( ScheduleManager *parent, ScheduleManager *sm, int index = -1, const KUndo2MagicString& name = KUndo2MagicString() ); |
1508 | ~AddScheduleManagerCmd(); |
1509 | void execute(); |
1510 | void unexecute(); |
1511 | |
1512 | protected: |
1513 | Project &m_node; |
1514 | ScheduleManager *m_parent; |
1515 | ScheduleManager *m_sm; |
1516 | int m_index; |
1517 | MainSchedule *m_exp; |
1518 | bool m_mine; |
1519 | }; |
1520 | |
1521 | class KPLATOKERNEL_EXPORT DeleteScheduleManagerCmd : public AddScheduleManagerCmd |
1522 | { |
1523 | public: |
1524 | DeleteScheduleManagerCmd( Project &project, ScheduleManager *sm, const KUndo2MagicString& name = KUndo2MagicString() ); |
1525 | void execute(); |
1526 | void unexecute(); |
1527 | |
1528 | private: |
1529 | MacroCommand cmd; |
1530 | }; |
1531 | |
1532 | class KPLATOKERNEL_EXPORT MoveScheduleManagerCmd : public NamedCommand |
1533 | { |
1534 | public: |
1535 | MoveScheduleManagerCmd( ScheduleManager *sm, ScheduleManager *newparent, int newindex, const KUndo2MagicString& name = KUndo2MagicString() ); |
1536 | void execute(); |
1537 | void unexecute(); |
1538 | |
1539 | private: |
1540 | ScheduleManager *m_sm; |
1541 | ScheduleManager *m_oldparent; |
1542 | int m_oldindex; |
1543 | ScheduleManager *m_newparent; |
1544 | int m_newindex; |
1545 | MacroCommand m_cmd; |
1546 | }; |
1547 | |
1548 | class KPLATOKERNEL_EXPORT ModifyScheduleManagerNameCmd : public NamedCommand |
1549 | { |
1550 | public: |
1551 | ModifyScheduleManagerNameCmd( ScheduleManager &sm, const QString& value, const KUndo2MagicString& name = KUndo2MagicString() ); |
1552 | void execute(); |
1553 | void unexecute(); |
1554 | |
1555 | private: |
1556 | ScheduleManager &m_sm; |
1557 | QString oldvalue, newvalue; |
1558 | }; |
1559 | |
1560 | class KPLATOKERNEL_EXPORT ModifyScheduleManagerAllowOverbookingCmd : public NamedCommand |
1561 | { |
1562 | public: |
1563 | ModifyScheduleManagerAllowOverbookingCmd( ScheduleManager &sm, bool value, const KUndo2MagicString& name = KUndo2MagicString() ); |
1564 | void execute(); |
1565 | void unexecute(); |
1566 | |
1567 | private: |
1568 | ScheduleManager &m_sm; |
1569 | bool oldvalue, newvalue; |
1570 | }; |
1571 | |
1572 | class KPLATOKERNEL_EXPORT ModifyScheduleManagerDistributionCmd : public NamedCommand |
1573 | { |
1574 | public: |
1575 | ModifyScheduleManagerDistributionCmd( ScheduleManager &sm, bool value, const KUndo2MagicString& name = KUndo2MagicString() ); |
1576 | void execute(); |
1577 | void unexecute(); |
1578 | |
1579 | private: |
1580 | ScheduleManager &m_sm; |
1581 | bool oldvalue, newvalue; |
1582 | }; |
1583 | |
1584 | class KPLATOKERNEL_EXPORT CalculateScheduleCmd : public NamedCommand |
1585 | { |
1586 | public: |
1587 | CalculateScheduleCmd( Project &project, ScheduleManager *sm, const KUndo2MagicString& name = KUndo2MagicString() ); |
1588 | void execute(); |
1589 | void unexecute(); |
1590 | |
1591 | private: |
1592 | Project &m_node; |
1593 | QPointer<ScheduleManager> m_sm; |
1594 | bool m_first; |
1595 | MainSchedule *m_oldexpected; |
1596 | MainSchedule *m_newexpected; |
1597 | }; |
1598 | |
1599 | class KPLATOKERNEL_EXPORT BaselineScheduleCmd : public NamedCommand |
1600 | { |
1601 | public: |
1602 | explicit BaselineScheduleCmd( ScheduleManager &sm, const KUndo2MagicString& name = KUndo2MagicString() ); |
1603 | void execute(); |
1604 | void unexecute(); |
1605 | |
1606 | private: |
1607 | ScheduleManager &m_sm; |
1608 | }; |
1609 | |
1610 | class KPLATOKERNEL_EXPORT ResetBaselineScheduleCmd : public NamedCommand |
1611 | { |
1612 | public: |
1613 | explicit ResetBaselineScheduleCmd( ScheduleManager &sm, const KUndo2MagicString& name = KUndo2MagicString() ); |
1614 | void execute(); |
1615 | void unexecute(); |
1616 | |
1617 | private: |
1618 | ScheduleManager &m_sm; |
1619 | }; |
1620 | |
1621 | class KPLATOKERNEL_EXPORT ModifyScheduleManagerSchedulingDirectionCmd : public NamedCommand |
1622 | { |
1623 | public: |
1624 | ModifyScheduleManagerSchedulingDirectionCmd( ScheduleManager &sm, bool value, const KUndo2MagicString& name = KUndo2MagicString() ); |
1625 | void execute(); |
1626 | void unexecute(); |
1627 | |
1628 | private: |
1629 | ScheduleManager &m_sm; |
1630 | bool oldvalue, newvalue; |
1631 | }; |
1632 | |
1633 | class KPLATOKERNEL_EXPORT ModifyScheduleManagerSchedulerCmd : public NamedCommand |
1634 | { |
1635 | public: |
1636 | ModifyScheduleManagerSchedulerCmd( ScheduleManager &sm, int value, const KUndo2MagicString& name = KUndo2MagicString() ); |
1637 | void execute(); |
1638 | void unexecute(); |
1639 | |
1640 | private: |
1641 | ScheduleManager &m_sm; |
1642 | int oldvalue, newvalue; |
1643 | }; |
1644 | |
1645 | class KPLATOKERNEL_EXPORT ModifyScheduleManagerSchedulingGranularityCmd : public NamedCommand |
1646 | { |
1647 | public: |
1648 | ModifyScheduleManagerSchedulingGranularityCmd( ScheduleManager &sm, int value, const KUndo2MagicString& name = KUndo2MagicString() ); |
1649 | void execute(); |
1650 | void unexecute(); |
1651 | |
1652 | private: |
1653 | ScheduleManager &m_sm; |
1654 | int oldvalue, newvalue; |
1655 | }; |
1656 | |
1657 | class KPLATOKERNEL_EXPORT ModifyStandardWorktimeYearCmd : public NamedCommand |
1658 | { |
1659 | public: |
1660 | ModifyStandardWorktimeYearCmd( StandardWorktime *wt, double oldvalue, double newvalue, const KUndo2MagicString& name = KUndo2MagicString() ); |
1661 | void execute(); |
1662 | void unexecute(); |
1663 | private: |
1664 | StandardWorktime *swt; |
1665 | double m_oldvalue; |
1666 | double m_newvalue; |
1667 | }; |
1668 | |
1669 | class KPLATOKERNEL_EXPORT ModifyStandardWorktimeMonthCmd : public NamedCommand |
1670 | { |
1671 | public: |
1672 | ModifyStandardWorktimeMonthCmd( StandardWorktime *wt, double oldvalue, double newvalue, const KUndo2MagicString& name = KUndo2MagicString() ); |
1673 | void execute(); |
1674 | void unexecute(); |
1675 | private: |
1676 | StandardWorktime *swt; |
1677 | double m_oldvalue; |
1678 | double m_newvalue; |
1679 | }; |
1680 | |
1681 | class KPLATOKERNEL_EXPORT ModifyStandardWorktimeWeekCmd : public NamedCommand |
1682 | { |
1683 | public: |
1684 | ModifyStandardWorktimeWeekCmd( StandardWorktime *wt, double oldvalue, double newvalue, const KUndo2MagicString& name = KUndo2MagicString() ); |
1685 | void execute(); |
1686 | void unexecute(); |
1687 | private: |
1688 | StandardWorktime *swt; |
1689 | double m_oldvalue; |
1690 | double m_newvalue; |
1691 | }; |
1692 | |
1693 | class KPLATOKERNEL_EXPORT ModifyStandardWorktimeDayCmd : public NamedCommand |
1694 | { |
1695 | public: |
1696 | ModifyStandardWorktimeDayCmd( StandardWorktime *wt, double oldvalue, double newvalue, const KUndo2MagicString& name = KUndo2MagicString() ); |
1697 | void execute(); |
1698 | void unexecute(); |
1699 | private: |
1700 | StandardWorktime *swt; |
1701 | double m_oldvalue; |
1702 | double m_newvalue; |
1703 | }; |
1704 | |
1705 | class KPLATOKERNEL_EXPORT DocumentAddCmd : public NamedCommand |
1706 | { |
1707 | public: |
1708 | DocumentAddCmd( Documents& docs, Document *value, const KUndo2MagicString& name = KUndo2MagicString() ); |
1709 | ~DocumentAddCmd(); |
1710 | void execute(); |
1711 | void unexecute(); |
1712 | private: |
1713 | Documents& m_docs; |
1714 | Document *m_value; |
1715 | bool m_mine; |
1716 | }; |
1717 | |
1718 | class KPLATOKERNEL_EXPORT DocumentRemoveCmd : public NamedCommand |
1719 | { |
1720 | public: |
1721 | DocumentRemoveCmd( Documents& docs, Document *value, const KUndo2MagicString& name = KUndo2MagicString() ); |
1722 | ~DocumentRemoveCmd(); |
1723 | void execute(); |
1724 | void unexecute(); |
1725 | private: |
1726 | Documents& m_docs; |
1727 | Document *m_value; |
1728 | bool m_mine; |
1729 | }; |
1730 | |
1731 | class KPLATOKERNEL_EXPORT DocumentModifyUrlCmd : public NamedCommand |
1732 | { |
1733 | public: |
1734 | DocumentModifyUrlCmd( Document *doc, const KUrl &url, const KUndo2MagicString& name = KUndo2MagicString() ); |
1735 | void execute(); |
1736 | void unexecute(); |
1737 | private: |
1738 | Document *m_doc; |
1739 | KUrl m_value; |
1740 | KUrl m_oldvalue; |
1741 | }; |
1742 | |
1743 | class KPLATOKERNEL_EXPORT DocumentModifyNameCmd : public NamedCommand |
1744 | { |
1745 | public: |
1746 | DocumentModifyNameCmd( Document *doc, const QString &value, const KUndo2MagicString& name = KUndo2MagicString() ); |
1747 | void execute(); |
1748 | void unexecute(); |
1749 | private: |
1750 | Document *m_doc; |
1751 | QString m_value; |
1752 | QString m_oldvalue; |
1753 | }; |
1754 | |
1755 | class KPLATOKERNEL_EXPORT DocumentModifyTypeCmd : public NamedCommand |
1756 | { |
1757 | public: |
1758 | DocumentModifyTypeCmd( Document *doc, Document::Type value, const KUndo2MagicString& name = KUndo2MagicString() ); |
1759 | void execute(); |
1760 | void unexecute(); |
1761 | private: |
1762 | Document *m_doc; |
1763 | Document::Type m_value; |
1764 | Document::Type m_oldvalue; |
1765 | }; |
1766 | |
1767 | class KPLATOKERNEL_EXPORT DocumentModifyStatusCmd : public NamedCommand |
1768 | { |
1769 | public: |
1770 | DocumentModifyStatusCmd( Document *doc, const QString &value, const KUndo2MagicString& name = KUndo2MagicString() ); |
1771 | void execute(); |
1772 | void unexecute(); |
1773 | private: |
1774 | Document *m_doc; |
1775 | QString m_value; |
1776 | QString m_oldvalue; |
1777 | }; |
1778 | |
1779 | class KPLATOKERNEL_EXPORT DocumentModifySendAsCmd : public NamedCommand |
1780 | { |
1781 | public: |
1782 | DocumentModifySendAsCmd( Document *doc, const Document::SendAs value, const KUndo2MagicString& name = KUndo2MagicString() ); |
1783 | void execute(); |
1784 | void unexecute(); |
1785 | private: |
1786 | Document *m_doc; |
1787 | Document::SendAs m_value; |
1788 | Document::SendAs m_oldvalue; |
1789 | }; |
1790 | |
1791 | class KPLATOKERNEL_EXPORT WBSDefinitionModifyCmd : public NamedCommand |
1792 | { |
1793 | public: |
1794 | WBSDefinitionModifyCmd( Project &project, const WBSDefinition value, const KUndo2MagicString& name = KUndo2MagicString() ); |
1795 | void execute(); |
1796 | void unexecute(); |
1797 | private: |
1798 | Project &m_project; |
1799 | WBSDefinition m_newvalue, m_oldvalue; |
1800 | }; |
1801 | |
1802 | class KPLATOKERNEL_EXPORT InsertProjectCmd : public MacroCommand |
1803 | { |
1804 | public: |
1805 | InsertProjectCmd( Project &project, Node *parent, Node *after, const KUndo2MagicString& name = KUndo2MagicString() ); |
1806 | |
1807 | void execute(); |
1808 | void unexecute(); |
1809 | |
1810 | protected: |
1811 | void addAccounts( Account *account, Account *parent, QList<Account*> &unused, QMap<QString, Account*> &all ); |
1812 | void addCalendars( Calendar *calendar, Calendar *parent, QList<Calendar*> &unused, QMap<QString, Calendar*> &all ); |
1813 | void addChildNodes( Node *node ); |
1814 | |
1815 | private: |
1816 | Project *m_project; |
1817 | Node *m_parent; |
1818 | Node *m_after; |
1819 | |
1820 | }; |
1821 | |
1822 | class KPLATOKERNEL_EXPORT WorkPackageAddCmd : public NamedCommand |
1823 | { |
1824 | public: |
1825 | WorkPackageAddCmd( Project *project, Node *node, WorkPackage *wp, const KUndo2MagicString& name = KUndo2MagicString() ); |
1826 | ~WorkPackageAddCmd(); |
1827 | void execute(); |
1828 | void unexecute(); |
1829 | private: |
1830 | Project *m_project; |
1831 | Node *m_node; |
1832 | WorkPackage *m_wp; |
1833 | bool m_mine; |
1834 | |
1835 | }; |
1836 | |
1837 | class KPLATOKERNEL_EXPORT ModifyProjectLocaleCmd : public MacroCommand |
1838 | { |
1839 | public: |
1840 | ModifyProjectLocaleCmd( Project &project, const KUndo2MagicString &name ); |
1841 | void execute(); |
1842 | void unexecute(); |
1843 | private: |
1844 | Project &m_project; |
1845 | }; |
1846 | |
1847 | class KPLATOKERNEL_EXPORT ModifyCurrencySymolCmd : public NamedCommand |
1848 | { |
1849 | public: |
1850 | ModifyCurrencySymolCmd( KLocale *locale, const QString &value, const KUndo2MagicString& name = KUndo2MagicString() ); |
1851 | void execute(); |
1852 | void unexecute(); |
1853 | |
1854 | private: |
1855 | KLocale *m_locale; |
1856 | QString m_newvalue; |
1857 | QString m_oldvalue; |
1858 | }; |
1859 | |
1860 | class KPLATOKERNEL_EXPORT ModifyCurrencyFractionalDigitsCmd : public NamedCommand |
1861 | { |
1862 | public: |
1863 | ModifyCurrencyFractionalDigitsCmd( KLocale *locale, int value, const KUndo2MagicString& name = KUndo2MagicString() ); |
1864 | void execute(); |
1865 | void unexecute(); |
1866 | |
1867 | private: |
1868 | KLocale *m_locale; |
1869 | int m_newvalue; |
1870 | int m_oldvalue; |
1871 | }; |
1872 | |
1873 | class KPLATOKERNEL_EXPORT ModifyPositivePrefixCurrencySymolCmd : public NamedCommand |
1874 | { |
1875 | public: |
1876 | ModifyPositivePrefixCurrencySymolCmd( KLocale *locale, bool value, const KUndo2MagicString& name = KUndo2MagicString() ); |
1877 | void execute(); |
1878 | void unexecute(); |
1879 | |
1880 | private: |
1881 | KLocale *m_locale; |
1882 | bool m_newvalue; |
1883 | bool m_oldvalue; |
1884 | }; |
1885 | |
1886 | class KPLATOKERNEL_EXPORT ModifyNegativePrefixCurrencySymolCmd : public NamedCommand |
1887 | { |
1888 | public: |
1889 | ModifyNegativePrefixCurrencySymolCmd( KLocale *locale, bool value, const KUndo2MagicString& name = KUndo2MagicString() ); |
1890 | void execute(); |
1891 | void unexecute(); |
1892 | |
1893 | private: |
1894 | KLocale *m_locale; |
1895 | bool m_newvalue; |
1896 | bool m_oldvalue; |
1897 | }; |
1898 | |
1899 | class KPLATOKERNEL_EXPORT ModifyPositiveMonetarySignPositionCmd : public NamedCommand |
1900 | { |
1901 | public: |
1902 | ModifyPositiveMonetarySignPositionCmd( KLocale *locale, int value, const KUndo2MagicString& name = KUndo2MagicString() ); |
1903 | void execute(); |
1904 | void unexecute(); |
1905 | |
1906 | private: |
1907 | KLocale *m_locale; |
1908 | int m_newvalue; |
1909 | int m_oldvalue; |
1910 | }; |
1911 | |
1912 | class KPLATOKERNEL_EXPORT ModifyNegativeMonetarySignPositionCmd : public NamedCommand |
1913 | { |
1914 | public: |
1915 | ModifyNegativeMonetarySignPositionCmd( KLocale *locale, int value, const KUndo2MagicString& name = KUndo2MagicString() ); |
1916 | void execute(); |
1917 | void unexecute(); |
1918 | |
1919 | private: |
1920 | KLocale *m_locale; |
1921 | int m_newvalue; |
1922 | int m_oldvalue; |
1923 | }; |
1924 | |
1925 | class KPLATOKERNEL_EXPORT AddExternalAppointmentCmd : public NamedCommand |
1926 | { |
1927 | public: |
1928 | AddExternalAppointmentCmd( Resource *resource, const QString &pid, const QString &pname, const QDateTime &start, const QDateTime &end, double load, const KUndo2MagicString& name = KUndo2MagicString() ); |
1929 | void execute(); |
1930 | void unexecute(); |
1931 | |
1932 | private: |
1933 | Resource *m_resource; |
1934 | QString m_pid; |
1935 | QString m_pname; |
1936 | QDateTime m_start; |
1937 | QDateTime m_end; |
1938 | double m_load; |
1939 | }; |
1940 | |
1941 | class KPLATOKERNEL_EXPORT ClearExternalAppointmentCmd : public NamedCommand |
1942 | { |
1943 | public: |
1944 | ClearExternalAppointmentCmd( Resource *resource, const QString &pid, const KUndo2MagicString& name = KUndo2MagicString() ); |
1945 | ~ClearExternalAppointmentCmd(); |
1946 | void execute(); |
1947 | void unexecute(); |
1948 | |
1949 | private: |
1950 | Resource *m_resource; |
1951 | QString m_pid; |
1952 | Appointment *m_appointments; |
1953 | }; |
1954 | |
1955 | class KPLATOKERNEL_EXPORT ClearAllExternalAppointmentsCmd : public NamedCommand |
1956 | { |
1957 | public: |
1958 | explicit ClearAllExternalAppointmentsCmd( Project *project, const KUndo2MagicString& name = KUndo2MagicString() ); |
1959 | void execute(); |
1960 | void unexecute(); |
1961 | |
1962 | private: |
1963 | Project *m_project; |
1964 | MacroCommand m_cmd; |
1965 | }; |
1966 | |
1967 | } //KPlato namespace |
1968 | |
1969 | #endif //COMMAND_H |
1970 | |