korganizer

listprint.cpp
1/*
2 This file is part of KOrganizer.
3
4 Copyright (c) 2004 Reinhold Kainhofer <reinhold@kainhofer.com>
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
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19
20 As a special exception, permission is given to link this program
21 with any edition of TQt, and distribute the resulting executable,
22 without including the source code for TQt in the source distribution.
23*/
24
25#ifndef KORG_NOPRINTER
26
27#include "listprint.h"
28
29#include "calprintpluginbase.h"
30#include <libkcal/event.h>
31#include <libkcal/todo.h>
32#include <libkcal/calendar.h>
33#include <libtdepim/kdateedit.h>
34#include <tdeconfig.h>
35#include <kdebug.h>
36
37#include <tqbuttongroup.h>
38
39#include "calprintlistconfig_base.h"
40
41
42class ListPrintFactory : public KOrg::PrintPluginFactory {
43 public:
44 KOrg::PrintPlugin *create() { return new CalPrintList; }
45};
46
47K_EXPORT_COMPONENT_FACTORY( libkorg_listprint, ListPrintFactory )
48
49
50
51/**************************************************************
52 * Print Day
53 **************************************************************/
54
55TQWidget *CalPrintList::createConfigWidget( TQWidget *w )
56{
57 return new CalPrintListConfig_Base( w );
58}
59
61{
62 CalPrintListConfig_Base *cfg =
63 dynamic_cast<CalPrintListConfig_Base*>( mConfigWidget );
64 if ( cfg ) {
65 mFromDate = cfg->mFromDate->date();
66 mToDate = cfg->mToDate->date();
67 mUseDateRange = (cfg->mDateRangeGroup->selectedId() == 1);
68 }
69}
70
72{
73 CalPrintListConfig_Base *cfg =
74 dynamic_cast<CalPrintListConfig_Base*>( mConfigWidget );
75 if ( cfg ) {
76 cfg->mFromDate->setDate( mFromDate );
77 cfg->mToDate->setDate( mToDate );
78
79 cfg->mDateRangeGroup->setButton( (mUseDateRange)?1:0 );
80 }
81}
82
84{
85 if ( mConfig ) {
86 mUseDateRange = mConfig->readBoolEntry( "ListsInRange", false );
87 }
89}
90
92{
93 kdDebug(5850) << "CalPrintList::saveConfig()" << endl;
94
96 if ( mConfig ) {
97 mConfig->writeEntry( "ListsInRange", mUseDateRange );
98 }
99}
100
101void CalPrintList::setDateRange( const TQDate& from, const TQDate& to )
102{
104 CalPrintListConfig_Base *cfg =
105 dynamic_cast<CalPrintListConfig_Base*>( mConfigWidget );
106 if ( cfg ) {
107 cfg->mFromDate->setDate( from );
108 cfg->mToDate->setDate( to );
109 }
110}
111
112void CalPrintList::print( TQPainter &p, int width, int height )
113{
114}
115
116#endif
virtual void loadConfig()=0
Load print format configuration from config file.
virtual void saveConfig()=0
Write print format configuration to config file.
virtual void setSettingsWidget()
Set configuration widget to reflect settings of current object.
virtual void setDateRange(const TQDate &from, const TQDate &to)
Set date range which should be printed.
virtual void readSettingsWidget()
Read settings from configuration widget and apply them to current object.