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