korganizer

calprinter.h

00001 /*
00002     This file is part of KOrganizer.
00003 
00004     Copyright (c) 1998 Preston Brown <pbrown@kde.org>
00005     Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
00006 
00007     This program is free software; you can redistribute it and/or modify
00008     it under the terms of the GNU General Public License as published by
00009     the Free Software Foundation; either version 2 of the License, or
00010     (at your option) any later version.
00011 
00012     This program is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00015     GNU General Public License for more details.
00016 
00017     You should have received a copy of the GNU General Public License
00018     along with this program; if not, write to the Free Software
00019     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020 
00021     As a special exception, permission is given to link this program
00022     with any edition of Qt, and distribute the resulting executable,
00023     without including the source code for Qt in the source distribution.
00024 */
00025 #ifndef _CALPRINTER_H
00026 #define _CALPRINTER_H
00027 
00028 #ifndef KORG_NOPRINTER
00029 
00030 #include <qptrlist.h>
00031 #include <kdialogbase.h>
00032 #include <korganizer/baseview.h>
00033 #include <korganizer/printplugin.h>
00034 #include <kdepimmacros.h>
00035 
00036 namespace KOrg {
00037 class CoreHelper;
00038 }
00039 using namespace KCal;
00040 
00041 class QVButtonGroup;
00042 class QWidgetStack;
00043 class KPrinter;
00044 class CalPrintDialog;
00045 class KConfig;
00046 class QComboBox;
00047 class QLabel;
00048 class CalPrintHelper;
00049 
00050 
00056 class KDE_EXPORT CalPrinter : public QObject, public KOrg::CalPrinterBase
00057 {
00058     Q_OBJECT
00059 
00060   public:
00061     enum ePrintOrientation {
00062       eOrientPlugin=0,
00063       eOrientPrinter,
00064       eOrientPortrait,
00065       eOrientLandscape
00066     };
00067   public:
00073     CalPrinter( QWidget *par, Calendar *cal, KOrg::CoreHelper *helper );
00074     virtual ~CalPrinter();
00075 
00076     void init( KPrinter *printer, Calendar *calendar );
00077 
00084     void setDateRange( const QDate &start, const QDate &end );
00085 
00086   public slots:
00087     void updateConfig();
00088 
00089   private slots:
00090     void doPrint( KOrg::PrintPlugin *selectedStyle, bool preview );
00091 
00092   public:
00093     void preview( PrintType type, const QDate &fd, const QDate &td );
00094     void print( PrintType type, const QDate &fd, const QDate &td );
00095 
00096     KPrinter *printer() const;
00097     Calendar *calendar() const;
00098     KConfig *config() const;
00099 
00100   protected:
00101     KOrg::PrintPlugin::List mPrintPlugins;
00102 
00103   private:
00104     KPrinter *mPrinter;
00105     Calendar *mCalendar;
00106     QWidget *mParent;
00107     KConfig *mConfig;
00108     KOrg::CoreHelper *mCoreHelper;
00109     CalPrintHelper *mHelper;
00110     CalPrintDialog *mPrintDialog;
00111 };
00112 
00113 class CalPrintDialog : public KDialogBase
00114 {
00115     Q_OBJECT
00116   public:
00117     CalPrintDialog( KOrg::PrintPlugin::List plugins, KPrinter *p,
00118                     QWidget *parent = 0, const char *name = 0 );
00119     virtual ~CalPrintDialog();
00120     KOrg::PrintPlugin *selectedPlugin();
00121     CalPrinter::ePrintOrientation orientation() { return mOrientation; }
00122 
00123   public slots:
00124     void setPrintType( int );
00125     void setPreview( bool );
00126 
00127   protected slots:
00128     void slotOk();
00129 
00130   private:
00131     KPrinter *mPrinter;
00132     QVButtonGroup *mTypeGroup;
00133     QWidgetStack *mConfigArea;
00134     KOrg::PrintPlugin::List mPrintPlugins;
00135     QString mPreviewText;
00136     QComboBox *mOrientationSelection;
00137 
00138     CalPrinter::ePrintOrientation mOrientation;
00139 };
00140 
00141 #endif
00142 
00143 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys