1 /***************************************************************************
2 * KT list view item tasks implementation. *
3 * -------------------------------------------------------------------- *
4 * Copyright (C) 1999, Gary Meyer <gary@meyer.net> *
5 * -------------------------------------------------------------------- *
6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation; either version 2 of the License, or *
9 * (at your option) any later version. *
10 ***************************************************************************/
12 #include "ktlisttasks.h"
16 #include <klocale.h> // i18n()
17 #include <kglobalsettings.h>
23 #include "ktlisttask.h"
27 KTListTasks::KTListTasks(KTListItem
* parent
, CTCron
* _ctcron
) :
28 KTListItem(parent
, 0, _ctcron
)
33 KTListTasks::KTListTasks(Q3ListView
* parent
, CTCron
* _ctcron
) :
34 KTListItem(parent
, 0, _ctcron
)
39 QString
KTListTasks::getDescription()
44 void KTListTasks::create()
46 CTTask
* temptask
= new CTTask ("", "", getCTCron()->syscron
);
47 KTTask
* kttask
= new KTTask(temptask
,i18n("Edit Task"));
50 if (temptask
->dirty())
52 getCTCron()->task
.push_back(temptask
);
53 new KTListTask(this, getCTCron(), temptask
); // Qt will clean up
61 void KTListTasks::refresh()
63 setText(0, getDescription());
64 setPixmap(0, KTIcon::tasks(true));
67 void KTListTasks::print (KTPrint
& printer
) const
71 stnd
= printer
.getFont();
73 printer
.setFont(QFont( KGlobalSettings::generalFont().family(), 10, QFont::Bold
));
74 printer
.print (i18n("Task name:"), 1, KTPrint::alignTextLeft
);
75 printer
.print (i18n("Program:"), 2, KTPrint::alignTextCenter
);
76 printer
.print (i18n("Description:"),3,KTPrint::alignTextRight
);
78 printer
.setFont(stnd
);
80 //firstChild() does not return null if there are no children, therefore
81 //we need to check the validation of the pointer without terminating
82 //the application. This maybe a bug in QT 1.44
84 if (this->childCount() ==0) {
85 printer
.print(i18n("No tasks..."),1,KTPrint::alignTextLeft
, false);
86 printer
.levelColumns(20);
90 KTListItem
* ktli
= (KTListItem
*)this->firstChild();
95 ktli
= (KTListItem
*)ktli
->nextSibling();
96 printer
.levelColumns();
98 printer
.levelColumns(20);