-rw-r--r-- | korganizer/calprinter.cpp | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/korganizer/calprinter.cpp b/korganizer/calprinter.cpp index 0cdf28e..d4bf988 100644 --- a/korganizer/calprinter.cpp +++ b/korganizer/calprinter.cpp | |||
@@ -1,64 +1,67 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 1998 Preston Brown | 3 | Copyright (c) 1998 Preston Brown |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qvbuttongroup.h> | 24 | // #include <qvbuttongroup.h> |
25 | #include <qwidgetstack.h> | 25 | #include <q3widgetstack.h> |
26 | #include <qradiobutton.h> | 26 | #include <qradiobutton.h> |
27 | #include <qlayout.h> | 27 | #include <qlayout.h> |
28 | #include <qpushbutton.h> | 28 | #include <qpushbutton.h> |
29 | #include <qcombobox.h> | 29 | #include <qcombobox.h> |
30 | #include <qlabel.h> | 30 | #include <qlabel.h> |
31 | #include <qvbox.h> | 31 | #include <q3vbox.h> |
32 | #include <qsplitter.h> | 32 | #include <qsplitter.h> |
33 | //Added by qt3to4: | ||
34 | #include <Q3GridLayout> | ||
35 | #include <Q3PtrList> | ||
33 | 36 | ||
34 | #include <kprinter.h> | 37 | #include <kprinter.h> |
35 | #include <kglobal.h> | 38 | #include <kglobal.h> |
36 | #include <ksimpleconfig.h> | 39 | #include <ksimpleconfig.h> |
37 | #include <kmessagebox.h> | 40 | #include <kmessagebox.h> |
38 | #include <kdebug.h> | 41 | #include <kdebug.h> |
39 | //#include <kdeversion.h> | 42 | //#include <kdeversion.h> |
40 | 43 | ||
41 | #include "koprefsdialog.h" | 44 | #include "koprefsdialog.h" |
42 | 45 | ||
43 | #include "calprinter.h" | 46 | #include "calprinter.h" |
44 | #ifndef KORG_NOPRINTER | 47 | #ifndef KORG_NOPRINTER |
45 | //#include "calprinter.moc" | 48 | //#include "calprinter.moc" |
46 | 49 | ||
47 | #include "calprintplugins.h" | 50 | #include "calprintplugins.h" |
48 | 51 | ||
49 | CalPrinter::CalPrinter( QWidget *parent, Calendar *calendar ) | 52 | CalPrinter::CalPrinter( QWidget *parent, Calendar *calendar ) |
50 | : QObject( parent, "CalPrinter" ) | 53 | : QObject( parent, "CalPrinter" ) |
51 | { | 54 | { |
52 | mCalendar = calendar; | 55 | mCalendar = calendar; |
53 | mParent = parent; | 56 | mParent = parent; |
54 | mPrinter = new KPrinter; | 57 | mPrinter = new KPrinter; |
55 | mPrinter->setOrientation( KPrinter::Portrait ); | 58 | mPrinter->setOrientation( KPrinter::Portrait ); |
56 | mConfig = new KConfig(locateLocal("config","korganizer_printing.rc" )); | 59 | mConfig = new KConfig(locateLocal("config","korganizer_printing.rc" )); |
57 | //KSimpleConfig( "korganizer_printing.rc" ); | 60 | //KSimpleConfig( "korganizer_printing.rc" ); |
58 | 61 | ||
59 | init( mPrinter, calendar ); | 62 | init( mPrinter, calendar ); |
60 | } | 63 | } |
61 | 64 | ||
62 | CalPrinter::~CalPrinter() | 65 | CalPrinter::~CalPrinter() |
63 | { | 66 | { |
64 | kdDebug() << "~CalPrinter()" << endl; | 67 | kdDebug() << "~CalPrinter()" << endl; |
@@ -145,95 +148,95 @@ void CalPrinter::doPrint( CalPrintBase *selectedStyle, bool preview ) | |||
145 | { | 148 | { |
146 | // FIXME: add a better caption to the Printingdialog | 149 | // FIXME: add a better caption to the Printingdialog |
147 | //mPrinter->setPreviewOnly( preview ); | 150 | //mPrinter->setPreviewOnly( preview ); |
148 | if ( preview || mPrinter->setup( mParent ) ) { | 151 | if ( preview || mPrinter->setup( mParent ) ) { |
149 | switch ( mPrintDialog->orientation() ) { | 152 | switch ( mPrintDialog->orientation() ) { |
150 | case eOrientPlugin: | 153 | case eOrientPlugin: |
151 | mPrinter->setOrientation( selectedStyle->orientation()); | 154 | mPrinter->setOrientation( selectedStyle->orientation()); |
152 | break; | 155 | break; |
153 | case eOrientPortrait: | 156 | case eOrientPortrait: |
154 | mPrinter->setOrientation( KPrinter::Portrait ); | 157 | mPrinter->setOrientation( KPrinter::Portrait ); |
155 | break; | 158 | break; |
156 | case eOrientLandscape: | 159 | case eOrientLandscape: |
157 | mPrinter->setOrientation( KPrinter::Landscape ); | 160 | mPrinter->setOrientation( KPrinter::Landscape ); |
158 | break; | 161 | break; |
159 | case eOrientPrinter: | 162 | case eOrientPrinter: |
160 | default: | 163 | default: |
161 | break; | 164 | break; |
162 | } | 165 | } |
163 | selectedStyle->doPrint(); | 166 | selectedStyle->doPrint(); |
164 | } | 167 | } |
165 | //mPrinter->setPreviewOnly( false ); | 168 | //mPrinter->setPreviewOnly( false ); |
166 | } | 169 | } |
167 | 170 | ||
168 | /////////////////////////////////////////////////////////////////////////////// | 171 | /////////////////////////////////////////////////////////////////////////////// |
169 | 172 | ||
170 | void CalPrinter::updateConfig() | 173 | void CalPrinter::updateConfig() |
171 | { | 174 | { |
172 | } | 175 | } |
173 | 176 | ||
174 | 177 | ||
175 | /****************************************************************************/ | 178 | /****************************************************************************/ |
176 | 179 | ||
177 | CalPrintDialog::CalPrintDialog( QPtrList<CalPrintBase> plugins, KPrinter *p, | 180 | CalPrintDialog::CalPrintDialog( Q3PtrList<CalPrintBase> plugins, KPrinter *p, |
178 | QWidget *parent, const char *name ) | 181 | QWidget *parent, const char *name ) |
179 | : KDialogBase( parent, name, /*modal*/true, i18n("Print"), Ok | Cancel ), | 182 | : KDialogBase( parent, name, /*modal*/true, i18n("Print"), Ok | Cancel ), |
180 | mPrinter( p ), mPrintPlugins( plugins ) | 183 | mPrinter( p ), mPrintPlugins( plugins ) |
181 | { | 184 | { |
182 | QVBox *page = new QVBox(this);//makeVBoxMainWidget(); | 185 | Q3VBox *page = new Q3VBox(this);//makeVBoxMainWidget(); |
183 | setMainWidget( page ); | 186 | setMainWidget( page ); |
184 | QHBox *printerLayout = new QHBox( page ); | 187 | Q3HBox *printerLayout = new Q3HBox( page ); |
185 | 188 | ||
186 | mPrinterLabel = new QLabel( printerLayout ); | 189 | mPrinterLabel = new QLabel( printerLayout ); |
187 | QPushButton *setupButton = new QPushButton( i18n("&Setup Printer..."), | 190 | QPushButton *setupButton = new QPushButton( i18n("&Setup Printer..."), |
188 | printerLayout ); | 191 | printerLayout ); |
189 | setupButton->setSizePolicy( QSizePolicy( | 192 | setupButton->setSizePolicy( QSizePolicy( |
190 | (QSizePolicy::SizeType)4, (QSizePolicy::SizeType)0, | 193 | (QSizePolicy::SizeType)4, (QSizePolicy::SizeType)0, |
191 | 0, 0, setupButton->sizePolicy().hasHeightForWidth() ) ); | 194 | 0, 0, setupButton->sizePolicy().hasHeightForWidth() ) ); |
192 | 195 | ||
193 | QSplitter *splitter = new QSplitter( page ); | 196 | QSplitter *splitter = new QSplitter( page ); |
194 | splitter->setOrientation( QSplitter::Horizontal ); | 197 | splitter->setOrientation( Qt::Horizontal ); |
195 | 198 | ||
196 | mTypeGroup = new QVButtonGroup( i18n("View Type"), splitter, "buttonGroup" ); | 199 | mTypeGroup = new Q3VButtonGroup( i18n("View Type"), splitter, "buttonGroup" ); |
197 | // use the minimal width possible = max width of the radio buttons, not extensible | 200 | // use the minimal width possible = max width of the radio buttons, not extensible |
198 | /* mTypeGroup->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)4, | 201 | /* mTypeGroup->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)4, |
199 | (QSizePolicy::SizeType)5, 0, 0, | 202 | (QSizePolicy::SizeType)5, 0, 0, |
200 | mTypeGroup->sizePolicy().hasHeightForWidth() ) );*/ | 203 | mTypeGroup->sizePolicy().hasHeightForWidth() ) );*/ |
201 | 204 | ||
202 | QWidget *splitterRight = new QWidget( splitter, "splitterRight" ); | 205 | QWidget *splitterRight = new QWidget( splitter, "splitterRight" ); |
203 | QGridLayout *splitterRightLayout = new QGridLayout( splitterRight ); | 206 | Q3GridLayout *splitterRightLayout = new Q3GridLayout( splitterRight ); |
204 | splitterRightLayout->setMargin( marginHint() ); | 207 | splitterRightLayout->setMargin( marginHint() ); |
205 | splitterRightLayout->setSpacing( spacingHint() ); | 208 | splitterRightLayout->setSpacing( spacingHint() ); |
206 | 209 | ||
207 | mConfigArea = new QWidgetStack( splitterRight, "configWidgetStack" ); | 210 | mConfigArea = new Q3WidgetStack( splitterRight, "configWidgetStack" ); |
208 | splitterRightLayout->addMultiCellWidget( mConfigArea, 0,0, 0,1 ); | 211 | splitterRightLayout->addMultiCellWidget( mConfigArea, 0,0, 0,1 ); |
209 | 212 | ||
210 | QLabel *orientationLabel = new QLabel( i18n("Page &orientation:"), | 213 | QLabel *orientationLabel = new QLabel( i18n("Page &orientation:"), |
211 | splitterRight, "orientationLabel" ); | 214 | splitterRight, "orientationLabel" ); |
212 | splitterRightLayout->addWidget( orientationLabel, 1, 0 ); | 215 | splitterRightLayout->addWidget( orientationLabel, 1, 0 ); |
213 | 216 | ||
214 | mOrientationSelection = new QComboBox( splitterRight, "orientationCombo" ); | 217 | mOrientationSelection = new QComboBox( splitterRight, "orientationCombo" ); |
215 | mOrientationSelection->insertItem( i18n("Use Default of Selected Style") ); | 218 | mOrientationSelection->insertItem( i18n("Use Default of Selected Style") ); |
216 | mOrientationSelection->insertItem( i18n("Use Default Setting of Printer") ); | 219 | mOrientationSelection->insertItem( i18n("Use Default Setting of Printer") ); |
217 | mOrientationSelection->insertItem( i18n("Portrait") ); | 220 | mOrientationSelection->insertItem( i18n("Portrait") ); |
218 | mOrientationSelection->insertItem( i18n("Landscape") ); | 221 | mOrientationSelection->insertItem( i18n("Landscape") ); |
219 | splitterRightLayout->addWidget( mOrientationSelection, 1, 1 ); | 222 | splitterRightLayout->addWidget( mOrientationSelection, 1, 1 ); |
220 | 223 | ||
221 | // signals and slots connections | 224 | // signals and slots connections |
222 | connect( setupButton, SIGNAL( clicked() ), SLOT( setupPrinter() ) ); | 225 | connect( setupButton, SIGNAL( clicked() ), SLOT( setupPrinter() ) ); |
223 | connect( mTypeGroup, SIGNAL( clicked( int ) ), SLOT( setPrintType( int ) ) ); | 226 | connect( mTypeGroup, SIGNAL( clicked( int ) ), SLOT( setPrintType( int ) ) ); |
224 | 227 | ||
225 | // buddies | 228 | // buddies |
226 | orientationLabel->setBuddy( mOrientationSelection ); | 229 | orientationLabel->setBuddy( mOrientationSelection ); |
227 | 230 | ||
228 | CalPrintBase *plug = mPrintPlugins.first(); | 231 | CalPrintBase *plug = mPrintPlugins.first(); |
229 | QRadioButton *radioButton; | 232 | QRadioButton *radioButton; |
230 | int id = 0; | 233 | int id = 0; |
231 | while ( plug ) { | 234 | while ( plug ) { |
232 | radioButton = new QRadioButton( plug->description(), mTypeGroup ); | 235 | radioButton = new QRadioButton( plug->description(), mTypeGroup ); |
233 | mTypeGroup->insert( radioButton, id ); | 236 | mTypeGroup->insert( radioButton, id ); |
234 | //radioButton->setMinimumHeight( radioButton->sizeHint().height() - 5 ); | 237 | //radioButton->setMinimumHeight( radioButton->sizeHint().height() - 5 ); |
235 | 238 | ||
236 | mConfigArea->addWidget( plug->configWidget( mConfigArea ), id ); | 239 | mConfigArea->addWidget( plug->configWidget( mConfigArea ), id ); |
237 | 240 | ||
238 | plug = mPrintPlugins.next(); | 241 | plug = mPrintPlugins.next(); |
239 | id++; | 242 | id++; |