korganizer
whatsnextprint.cpp00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef KORG_NOPRINTER
00026
00027 #include "whatsnextprint.h"
00028
00029 #include "calprintpluginbase.h"
00030 #include <libkcal/event.h>
00031 #include <libkcal/todo.h>
00032 #include <libkcal/calendar.h>
00033 #include <libkdepim/kdateedit.h>
00034 #include <kconfig.h>
00035 #include <kdebug.h>
00036
00037 #include <qbuttongroup.h>
00038
00039 #include "calprintwhatsnextconfig_base.h"
00040
00041
00042 class WhatsNextPrintFactory : public KOrg::PrintPluginFactory {
00043 public:
00044 KOrg::PrintPlugin *create() { return new CalPrintWhatsNext; }
00045 };
00046
00047 K_EXPORT_COMPONENT_FACTORY( libkorg_whatsnextprint, WhatsNextPrintFactory )
00048
00049
00050
00051
00052
00053
00054 QWidget *CalPrintWhatsNext::createConfigWidget( QWidget *w )
00055 {
00056 return new CalPrintWhatsNextConfig_Base( w );
00057 }
00058
00059 void CalPrintWhatsNext::readSettingsWidget()
00060 {
00061 CalPrintWhatsNextConfig_Base *cfg =
00062 dynamic_cast<CalPrintWhatsNextConfig_Base*>( mConfigWidget );
00063 if ( cfg ) {
00064 mFromDate = cfg->mFromDate->date();
00065 mToDate = cfg->mToDate->date();
00066 mUseDateRange = (cfg->mDateRangeGroup->selectedId() == 1);
00067 }
00068 }
00069
00070 void CalPrintWhatsNext::setSettingsWidget()
00071 {
00072 CalPrintWhatsNextConfig_Base *cfg =
00073 dynamic_cast<CalPrintWhatsNextConfig_Base*>( mConfigWidget );
00074 if ( cfg ) {
00075 cfg->mFromDate->setDate( mFromDate );
00076 cfg->mToDate->setDate( mToDate );
00077
00078 cfg->mDateRangeGroup->setButton( (mUseDateRange)?1:0 );
00079 }
00080 }
00081
00082 void CalPrintWhatsNext::loadConfig()
00083 {
00084 if ( mConfig ) {
00085 mUseDateRange = mConfig->readBoolEntry( "WhatsNextsInRange", false );
00086 }
00087 setSettingsWidget();
00088 }
00089
00090 void CalPrintWhatsNext::saveConfig()
00091 {
00092 kdDebug(5850) << "CalPrintWhatsNext::saveConfig()" << endl;
00093
00094 readSettingsWidget();
00095 if ( mConfig ) {
00096 mConfig->writeEntry( "WhatsNextsInRange", mUseDateRange );
00097 }
00098 }
00099
00100 void CalPrintWhatsNext::setDateRange( const QDate& from, const QDate& to )
00101 {
00102 CalPrintPluginBase::setDateRange( from, to );
00103 CalPrintWhatsNextConfig_Base *cfg =
00104 dynamic_cast<CalPrintWhatsNextConfig_Base*>( mConfigWidget );
00105 if ( cfg ) {
00106 cfg->mFromDate->setDate( from );
00107 cfg->mToDate->setDate( to );
00108 }
00109 }
00110
00111 void CalPrintWhatsNext::print( QPainter &p, int width, int height )
00112 {
00113 }
00114
00115 #endif
|