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 CalPrintDialog;
00044 class KConfig;
00045 class QComboBox;
00046 class QLabel;
00047 
00053 class KDE_EXPORT CalPrinter : public QObject, public KOrg::CalPrinterBase
00054 {
00055     Q_OBJECT
00056 
00057   public:
00058     enum ePrintOrientation {
00059       eOrientPlugin=0,
00060       eOrientPrinter,
00061       eOrientPortrait,
00062       eOrientLandscape
00063     };
00064   public:
00070     CalPrinter( QWidget *par, Calendar *cal, KOrg::CoreHelper *helper );
00071     virtual ~CalPrinter();
00072 
00073     void init( Calendar *calendar );
00074 
00081     void setDateRange( const QDate &start, const QDate &end );
00082 
00083   public slots:
00084     void updateConfig();
00085 
00086   private slots:
00087     void doPrint( KOrg::PrintPlugin *selectedStyle, CalPrinter::ePrintOrientation dlgorientation, bool preview = false );
00088 
00089   public:
00090     void print( int type, const QDate &fd, const QDate &td, 
00091                 Incidence::List selectedIncidences = Incidence::List(), bool preview = false );
00092 
00093     Calendar *calendar() const;
00094     KConfig *config() const;
00095 
00096   protected:
00097     KOrg::PrintPlugin::List mPrintPlugins;
00098 
00099   private:
00100     Calendar *mCalendar;
00101     QWidget *mParent;
00102     KConfig *mConfig;
00103     KOrg::CoreHelper *mCoreHelper;
00104 };
00105 
00106 class CalPrintDialog : public KDialogBase
00107 {
00108     Q_OBJECT
00109   public:
00110     CalPrintDialog( KOrg::PrintPlugin::List plugins,
00111                     QWidget *parent = 0, const char *name = 0 );
00112     virtual ~CalPrintDialog();
00113     KOrg::PrintPlugin *selectedPlugin();
00114     void setOrientation( CalPrinter::ePrintOrientation orientation );
00115     CalPrinter::ePrintOrientation orientation() { return mOrientation; }
00116 
00117   public slots:
00118     void setPrintType( int );
00119     void setPreview( bool );
00120 
00121   protected slots:
00122     void slotOk();
00123 
00124   private:
00125     QVButtonGroup *mTypeGroup;
00126     QWidgetStack *mConfigArea;
00127     QMap<int, KOrg::PrintPlugin*> mPluginIDs;
00128     QString mPreviewText;
00129     QComboBox *mOrientationSelection;
00130 
00131     CalPrinter::ePrintOrientation mOrientation;
00132 };
00133 
00134 #endif
00135 
00136 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys