whatsnextprint.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 "whatsnextprint.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 "calprintwhatsnextconfig_base.h"
40
41
42class WhatsNextPrintFactory : public KOrg::PrintPluginFactory {
43 public:
44 KOrg::PrintPlugin *create() { return new CalPrintWhatsNext; }
45};
46
47K_EXPORT_COMPONENT_FACTORY( libkorg_whatsnextprint, WhatsNextPrintFactory )
48
49
50/**************************************************************
51 * Print What's Next
52 **************************************************************/
53
54TQWidget *CalPrintWhatsNext::createConfigWidget( TQWidget *w )
55{
56 return new CalPrintWhatsNextConfig_Base( w );
57}
58
59void CalPrintWhatsNext::readSettingsWidget()
60{
61 CalPrintWhatsNextConfig_Base *cfg =
62 dynamic_cast<CalPrintWhatsNextConfig_Base*>( mConfigWidget );
63 if ( cfg ) {
64 mFromDate = cfg->mFromDate->date();
65 mToDate = cfg->mToDate->date();
66 mUseDateRange = (cfg->mDateRangeGroup->selectedId() == 1);
67 }
68}
69
70void CalPrintWhatsNext::setSettingsWidget()
71{
72 CalPrintWhatsNextConfig_Base *cfg =
73 dynamic_cast<CalPrintWhatsNextConfig_Base*>( mConfigWidget );
74 if ( cfg ) {
75 cfg->mFromDate->setDate( mFromDate );
76 cfg->mToDate->setDate( mToDate );
77
78 cfg->mDateRangeGroup->setButton( (mUseDateRange)?1:0 );
79 }
80}
81
82void CalPrintWhatsNext::loadConfig()
83{
84 if ( mConfig ) {
85 mUseDateRange = mConfig->readBoolEntry( "WhatsNextsInRange", false );
86 }
87 setSettingsWidget();
88}
89
90void CalPrintWhatsNext::saveConfig()
91{
92 kdDebug(5850) << "CalPrintWhatsNext::saveConfig()" << endl;
93
94 readSettingsWidget();
95 if ( mConfig ) {
96 mConfig->writeEntry( "WhatsNextsInRange", mUseDateRange );
97 }
98}
99
100void CalPrintWhatsNext::setDateRange( const TQDate& from, const TQDate& to )
101{
103 CalPrintWhatsNextConfig_Base *cfg =
104 dynamic_cast<CalPrintWhatsNextConfig_Base*>( mConfigWidget );
105 if ( cfg ) {
106 cfg->mFromDate->setDate( from );
107 cfg->mToDate->setDate( to );
108 }
109}
110
111void CalPrintWhatsNext::print( TQPainter &p, int width, int height )
112{
113}
114
115#endif
Base class for KOrganizer printing classes.
Definition: printplugin.h:52
virtual void setDateRange(const TQDate &from, const TQDate &to)
Set date range which should be printed.
Definition: printplugin.h:141