-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,299 +1,302 @@ | |||
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; |
65 | 68 | ||
66 | CalPrintBase *plug = mPrintPlugins.first(); | 69 | CalPrintBase *plug = mPrintPlugins.first(); |
67 | while ( plug ) { | 70 | while ( plug ) { |
68 | plug->doSaveConfig(); | 71 | plug->doSaveConfig(); |
69 | plug = mPrintPlugins.next(); | 72 | plug = mPrintPlugins.next(); |
70 | } | 73 | } |
71 | mConfig->sync(); | 74 | mConfig->sync(); |
72 | delete mConfig; | 75 | delete mConfig; |
73 | delete mPrintDialog; | 76 | delete mPrintDialog; |
74 | delete mPrinter; | 77 | delete mPrinter; |
75 | } | 78 | } |
76 | 79 | ||
77 | void CalPrinter::init( KPrinter *printer, Calendar *calendar ) | 80 | void CalPrinter::init( KPrinter *printer, Calendar *calendar ) |
78 | { | 81 | { |
79 | mPrintPlugins.setAutoDelete( true ); | 82 | mPrintPlugins.setAutoDelete( true ); |
80 | mPrintPlugins.append( new CalPrintDay( printer, calendar, mConfig ) ); | 83 | mPrintPlugins.append( new CalPrintDay( printer, calendar, mConfig ) ); |
81 | mPrintPlugins.append( new CalPrintWeek( printer, calendar, mConfig ) ); | 84 | mPrintPlugins.append( new CalPrintWeek( printer, calendar, mConfig ) ); |
82 | mPrintPlugins.append( new CalPrintMonth( printer, calendar, mConfig ) ); | 85 | mPrintPlugins.append( new CalPrintMonth( printer, calendar, mConfig ) ); |
83 | mPrintPlugins.append( new CalPrintTodos( printer, calendar, mConfig ) ); | 86 | mPrintPlugins.append( new CalPrintTodos( printer, calendar, mConfig ) ); |
84 | 87 | ||
85 | // TODO_RK: Add a plugin interface here | 88 | // TODO_RK: Add a plugin interface here |
86 | mPrintDialog = new CalPrintDialog( mPrintPlugins, mPrinter, mParent ); | 89 | mPrintDialog = new CalPrintDialog( mPrintPlugins, mPrinter, mParent ); |
87 | 90 | ||
88 | CalPrintBase *plug = mPrintPlugins.first(); | 91 | CalPrintBase *plug = mPrintPlugins.first(); |
89 | while ( plug ) { | 92 | while ( plug ) { |
90 | connect( mPrintDialog, SIGNAL( okClicked() ), | 93 | connect( mPrintDialog, SIGNAL( okClicked() ), |
91 | plug, SLOT( readSettingsWidget() ) ); | 94 | plug, SLOT( readSettingsWidget() ) ); |
92 | 95 | ||
93 | plug->doLoadConfig(); | 96 | plug->doLoadConfig(); |
94 | 97 | ||
95 | plug = mPrintPlugins.next(); | 98 | plug = mPrintPlugins.next(); |
96 | } | 99 | } |
97 | } | 100 | } |
98 | 101 | ||
99 | void CalPrinter::setupPrinter() | 102 | void CalPrinter::setupPrinter() |
100 | { | 103 | { |
101 | KMessageBox::sorry( mParent, i18n("Not implemented.") ); | 104 | KMessageBox::sorry( mParent, i18n("Not implemented.") ); |
102 | #if 0 | 105 | #if 0 |
103 | KOPrefsDialog *optionsDlg = new KOPrefsDialog(mParent); | 106 | KOPrefsDialog *optionsDlg = new KOPrefsDialog(mParent); |
104 | optionsDlg->readConfig(); | 107 | optionsDlg->readConfig(); |
105 | optionsDlg->showPrinterTab(); | 108 | optionsDlg->showPrinterTab(); |
106 | connect(optionsDlg, SIGNAL(configChanged()), | 109 | connect(optionsDlg, SIGNAL(configChanged()), |
107 | mParent, SLOT(updateConfig())); | 110 | mParent, SLOT(updateConfig())); |
108 | optionsDlg->show(); | 111 | optionsDlg->show(); |
109 | #endif | 112 | #endif |
110 | } | 113 | } |
111 | 114 | ||
112 | void CalPrinter::setDateRange( const QDate &fd, const QDate &td ) | 115 | void CalPrinter::setDateRange( const QDate &fd, const QDate &td ) |
113 | { | 116 | { |
114 | CalPrintBase *plug = mPrintPlugins.first(); | 117 | CalPrintBase *plug = mPrintPlugins.first(); |
115 | while ( plug ) { | 118 | while ( plug ) { |
116 | plug->setDateRange( fd, td ); | 119 | plug->setDateRange( fd, td ); |
117 | plug = mPrintPlugins.next(); | 120 | plug = mPrintPlugins.next(); |
118 | } | 121 | } |
119 | } | 122 | } |
120 | 123 | ||
121 | void CalPrinter::preview( PrintType type, const QDate &fd, const QDate &td ) | 124 | void CalPrinter::preview( PrintType type, const QDate &fd, const QDate &td ) |
122 | { | 125 | { |
123 | mPrintDialog->setPreview( true ); | 126 | mPrintDialog->setPreview( true ); |
124 | mPrintDialog->setPrintType( int( type ) ); | 127 | mPrintDialog->setPrintType( int( type ) ); |
125 | setDateRange( fd, td ); | 128 | setDateRange( fd, td ); |
126 | 129 | ||
127 | if ( mPrintDialog->exec() == QDialog::Accepted ) { | 130 | if ( mPrintDialog->exec() == QDialog::Accepted ) { |
128 | doPrint( mPrintDialog->selectedPlugin(), true ); | 131 | doPrint( mPrintDialog->selectedPlugin(), true ); |
129 | } | 132 | } |
130 | } | 133 | } |
131 | 134 | ||
132 | void CalPrinter::print( PrintType type, const QDate &fd, const QDate &td ) | 135 | void CalPrinter::print( PrintType type, const QDate &fd, const QDate &td ) |
133 | { | 136 | { |
134 | mPrintDialog->resize( 640, 440 ); | 137 | mPrintDialog->resize( 640, 440 ); |
135 | mPrintDialog->setPreview( false ); | 138 | mPrintDialog->setPreview( false ); |
136 | mPrintDialog->setPrintType( int( type ) ); | 139 | mPrintDialog->setPrintType( int( type ) ); |
137 | setDateRange( fd, td ); | 140 | setDateRange( fd, td ); |
138 | 141 | ||
139 | if ( mPrintDialog->exec() == QDialog::Accepted ) { | 142 | if ( mPrintDialog->exec() == QDialog::Accepted ) { |
140 | doPrint( mPrintDialog->selectedPlugin(), false ); | 143 | doPrint( mPrintDialog->selectedPlugin(), false ); |
141 | } | 144 | } |
142 | } | 145 | } |
143 | 146 | ||
144 | void CalPrinter::doPrint( CalPrintBase *selectedStyle, bool preview ) | 147 | 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++; |
240 | } | 243 | } |
241 | 244 | ||
242 | // setMinimumSize( minimumSizeHint() ); | 245 | // setMinimumSize( minimumSizeHint() ); |
243 | //resize( minimumSizeHint() ); | 246 | //resize( minimumSizeHint() ); |
244 | } | 247 | } |
245 | 248 | ||
246 | CalPrintDialog::~CalPrintDialog() | 249 | CalPrintDialog::~CalPrintDialog() |
247 | { | 250 | { |
248 | } | 251 | } |
249 | 252 | ||
250 | void CalPrintDialog::setupPrinter() | 253 | void CalPrintDialog::setupPrinter() |
251 | { | 254 | { |
252 | if ( mPrinter->setup( this ) ) { | 255 | if ( mPrinter->setup( this ) ) { |
253 | setPrinterLabel(); | 256 | setPrinterLabel(); |
254 | } | 257 | } |
255 | } | 258 | } |
256 | 259 | ||
257 | void CalPrintDialog::setPreview(bool preview) | 260 | void CalPrintDialog::setPreview(bool preview) |
258 | { | 261 | { |
259 | 262 | ||
260 | setButtonText(KDialogBase::Ok, preview ? i18n("&Preview") : i18n("&Print...") ); | 263 | setButtonText(KDialogBase::Ok, preview ? i18n("&Preview") : i18n("&Print...") ); |
261 | 264 | ||
262 | mPreviewText = preview ? i18n("<qt>Preview for printer <b>%1</b></qt>") | 265 | mPreviewText = preview ? i18n("<qt>Preview for printer <b>%1</b></qt>") |
263 | : i18n( "<qt>Printing on printer <b>%1</b></qt>"); | 266 | : i18n( "<qt>Printing on printer <b>%1</b></qt>"); |
264 | setPrinterLabel(); | 267 | setPrinterLabel(); |
265 | } | 268 | } |
266 | 269 | ||
267 | void CalPrintDialog::setPrinterLabel() | 270 | void CalPrintDialog::setPrinterLabel() |
268 | { | 271 | { |
269 | QString printerName( mPrinter->printerName() ); | 272 | QString printerName( mPrinter->printerName() ); |
270 | if ( printerName.isEmpty() ) | 273 | if ( printerName.isEmpty() ) |
271 | mPrinterLabel->setText( mPreviewText.arg( i18n("[Unconfigured]") ) ); | 274 | mPrinterLabel->setText( mPreviewText.arg( i18n("[Unconfigured]") ) ); |
272 | else | 275 | else |
273 | mPrinterLabel->setText( mPreviewText.arg( printerName ) ); | 276 | mPrinterLabel->setText( mPreviewText.arg( printerName ) ); |
274 | } | 277 | } |
275 | 278 | ||
276 | void CalPrintDialog::setPrintType( int i ) | 279 | void CalPrintDialog::setPrintType( int i ) |
277 | { | 280 | { |
278 | // TODO: Make a safe correlation between type and the radio button | 281 | // TODO: Make a safe correlation between type and the radio button |
279 | 282 | ||
280 | mTypeGroup->setButton( i ); | 283 | mTypeGroup->setButton( i ); |
281 | mConfigArea->raiseWidget( i ); | 284 | mConfigArea->raiseWidget( i ); |
282 | } | 285 | } |
283 | 286 | ||
284 | CalPrintBase *CalPrintDialog::selectedPlugin() | 287 | CalPrintBase *CalPrintDialog::selectedPlugin() |
285 | { | 288 | { |
286 | int pos = mTypeGroup->id( mTypeGroup->selected() ); | 289 | int pos = mTypeGroup->id( mTypeGroup->selected() ); |
287 | if ( pos < 0 ) return 0; | 290 | if ( pos < 0 ) return 0; |
288 | CalPrintBase *retval = mPrintPlugins.at( pos ); | 291 | CalPrintBase *retval = mPrintPlugins.at( pos ); |
289 | return retval; | 292 | return retval; |
290 | } | 293 | } |
291 | 294 | ||
292 | void CalPrintDialog::slotOk() | 295 | void CalPrintDialog::slotOk() |
293 | { | 296 | { |
294 | mOrientation = (CalPrinter::ePrintOrientation)mOrientationSelection->currentItem(); | 297 | mOrientation = (CalPrinter::ePrintOrientation)mOrientationSelection->currentItem(); |
295 | KDialogBase::slotOk(); | 298 | KDialogBase::slotOk(); |
296 | emit okClicked(); | 299 | emit okClicked(); |
297 | } | 300 | } |
298 | 301 | ||
299 | #endif | 302 | #endif |