summarylogtreecommitdiffstats
path: root/disable-print-support.patch
blob: 7e00723e9a1f79aa2fe32a4bc76225c3600a259a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
diff -Naur krecipes-2.1.0.orig/src/actionshandlers/recipeactionshandler.cpp krecipes-2.1.0/src/actionshandlers/recipeactionshandler.cpp
--- krecipes-2.1.0.orig/src/actionshandlers/recipeactionshandler.cpp	2015-03-20 00:50:18.000000000 +0100
+++ krecipes-2.1.0/src/actionshandlers/recipeactionshandler.cpp	2017-02-07 04:35:34.049493887 +0100
@@ -25,12 +25,6 @@
 #include <kmenu.h>
 #include <KAction>
 #include <kprogressdialog.h>
-#include <QWebFrame>
-#include <KWebPage>
-#include <QPrintPreviewDialog>
-#include <QPrinter>
-#include <KTempDir>
-#include <KStandardDirs>
 
 #include "dialogs/selectcategoriesdialog.h"
 
@@ -268,32 +262,6 @@
 	}
 }
 
-void RecipeActionsHandler::recipePrint()
-{
-	QList<Q3ListViewItem *> items = parentListView->selectedItems();
-	if ( !items.isEmpty() ) {
-		QList<int> ids = recipeIDs( items );
-		printRecipes( ids, database );
-	}
-	else //if nothing selected, print all visible recipes
-	{
-		QList<int> ids = getAllVisibleItems();
-		if ( !ids.isEmpty() ) {
-			switch ( KMessageBox::questionYesNo( kapp->mainWidget(),
-			i18n("No recipes are currently selected.\n"
-			"Would you like to print all recipes in the current view?")) )
-			{
-			case KMessageBox::Yes:
-				printRecipes( ids, database );
-				break;
-			default: break;
-			}
-		}
-		else
-			KMessageBox::sorry( kapp->mainWidget(), i18n("No recipes selected."), i18n("Print") );
-	}
-}
-
 void RecipeActionsHandler::removeFromCategory()
 {
 	QList<Q3ListViewItem *> items = parentListView->selectedItems();
@@ -446,49 +414,6 @@
 	delete fd;
 }
 
-void RecipeActionsHandler::printRecipes( const QList<int> &ids, RecipeDB *database )
-{
-	//Create the temporary directory.
-	m_tempdir = new KTempDir(KStandardDirs::locateLocal("tmp", "krecipes-data-print"));
-	QString tmp_filename = m_tempdir->name() + "krecipes_recipe_view.html";
-	//Export to HTML in the temporary directory.
-	XSLTExporter html_generator( tmp_filename, "html" );
-	KConfigGroup config(KGlobal::config(), "Page Setup" );
-	QString styleFile = config.readEntry( "PrintLayout", KStandardDirs::locate( "appdata", "layouts/None.klo" ) );
-	if ( !styleFile.isEmpty() && QFile::exists( styleFile ) )
-		html_generator.setStyle( styleFile );
-
-	QString templateFile = config.readEntry( "PrintTemplate", KStandardDirs::locate( "appdata", "layouts/Default.xsl" ) );
-	if ( !templateFile.isEmpty() && QFile::exists( templateFile ) )
-		html_generator.setTemplate( templateFile );
-	html_generator.exporter( ids, database );
-	//Load the generated HTML. When loaded, RecipeActionsHandlerView::print(...) will be called.
-	m_printPage = new KWebPage;
-	connect(m_printPage, SIGNAL(loadFinished(bool)), SLOT(print(bool)));
-	m_printPage->mainFrame()->load( KUrl(tmp_filename) );
-}
-
-void RecipeActionsHandler::print(bool ok)
-{
-	Q_UNUSED(ok)
-	QPrinter printer;
-	QPointer<QPrintPreviewDialog> previewdlg = new QPrintPreviewDialog(&printer);
-	//Show the print preview dialog.
-	connect(previewdlg, SIGNAL(paintRequested(QPrinter *)),
-		m_printPage->mainFrame(), SLOT(print(QPrinter *)));
-	previewdlg->exec();
-	delete previewdlg;
-	//Remove the temporary directory which stores the HTML and free memory.
-	m_tempdir->unlink();
-	delete m_tempdir;
-	emit( printDone() );
-}
-
-void RecipeActionsHandler::printDoneSlot()
-{
-	delete m_printPage;
-}
-
 void RecipeActionsHandler::recipesToClipboard( const QList<int> &ids, RecipeDB *db )
 {
 	KConfigGroup config = KGlobal::config()->group("Export");
diff -Naur krecipes-2.1.0.orig/src/actionshandlers/recipeactionshandler.h krecipes-2.1.0/src/actionshandlers/recipeactionshandler.h
--- krecipes-2.1.0.orig/src/actionshandlers/recipeactionshandler.h	2015-03-20 00:50:18.000000000 +0100
+++ krecipes-2.1.0/src/actionshandlers/recipeactionshandler.h	2017-02-07 04:36:27.502518327 +0100
@@ -22,8 +22,6 @@
 class KMenu;
 class RecipeDB;
 class KAction;
-class KTempDir;
-class KWebPage;
 
 /** @brief A class that centralizes common actions for recipes such as saving and editing.
   * 
@@ -57,9 +55,6 @@
 	void recipeSelected( bool );
 	void recipeSelected( int id, int action );
 	void recipesSelected( const QList<int> &ids, int action );
-	
-	//For internal use only
-	void printDone();
 
 public slots:
 	void exec( ItemType type, const QPoint &p );
@@ -82,12 +77,6 @@
 	  */
 	void recipeExport();
 
-	/** Prints the recipe(s) currently selected in the list view, showing a dialog to preview */
-	void recipePrint();
-	
-	/** Prints the given recipes, showing a dialog to preview the result */
-	void printRecipes( const QList<int> &ids, RecipeDB *db );
-
 	/** Removes the recipe(s) currently selected in the list view from its current category */
 	void removeFromCategory();
 
@@ -110,10 +99,6 @@
 
 	void selectionChangedSlot();
 
-private slots:
-	void print( bool ok );
-	void printDoneSlot();
-
 private:
 	KMenu *kpop;
 	KMenu *catPop;
@@ -126,9 +111,6 @@
 
 	QList<int> getAllVisibleItems();
 	QList<int> recipeIDs( const QList<Q3ListViewItem *> &items ) const;
-
-	KTempDir * m_tempdir;
-	KWebPage * m_printPage;
 };
 
 #endif //RECIPEACTIONSHANDLER_H
diff -Naur krecipes-2.1.0.orig/src/CMakeLists.txt krecipes-2.1.0/src/CMakeLists.txt
--- krecipes-2.1.0.orig/src/CMakeLists.txt	2015-03-20 00:50:18.000000000 +0100
+++ krecipes-2.1.0/src/CMakeLists.txt	2017-02-07 04:46:04.978747428 +0100
@@ -342,7 +342,7 @@
    ${krecipesdialogs_SRCS}
    ${krecipesactionshandlers_SRCS})
 
-target_link_libraries(krecipes krecipescommon ${KDE4_KHTML_LIBS} ${KDE4_KDEUI_LIBS} ${KDE4_KDE3SUPPORT_LIBS} ${QT_QTSQL_LIBRARY} ${LIBXSLT_LIBRARIES} ${LIBXML2_LIBRARIES} ${QT_QTWEBKIT_LIBRARY} ${KDE4_KDEWEBKIT_LIBS})
+target_link_libraries(krecipes krecipescommon ${KDE4_KHTML_LIBS} ${KDE4_KDEUI_LIBS} ${KDE4_KDE3SUPPORT_LIBS} ${QT_QTSQL_LIBRARY} ${LIBXSLT_LIBRARIES} ${LIBXML2_LIBRARIES})
 
 
 install(TARGETS krecipes ${INSTALL_TARGETS_DEFAULT_ARGS})
diff -Naur krecipes-2.1.0.orig/src/dialogs/dietviewdialog.cpp krecipes-2.1.0/src/dialogs/dietviewdialog.cpp
--- krecipes-2.1.0.orig/src/dialogs/dietviewdialog.cpp	2015-03-20 00:50:18.000000000 +0100
+++ krecipes-2.1.0/src/dialogs/dietviewdialog.cpp	2017-02-07 04:43:55.559593993 +0100
@@ -27,8 +27,6 @@
 	setModal( false );
 	KVBox *page = new KVBox( this );
 	setMainWidget(page);
-	setButtonText( KDialog::User1, KStandardGuiItem::print().text() );
-	setButtonIcon( KDialog::User1, KIcon( "document-print" ) );
 
 	setButtonText( KDialog::User2, i18nc( "@action:button", "Create &Shopping List" ) );
 	setButtonIcon( KDialog::User2, KIcon( "view-pim-tasks" ) );
@@ -42,7 +40,6 @@
 
 	connect ( this, SIGNAL( user2Clicked() ), this, SLOT( slotOk() ) );
 	connect ( this, SIGNAL( closeClicked() ), this, SLOT( close() ) );
-	connect ( this, SIGNAL( user1Clicked() ), this, SLOT( print() ) );
 
 	// Show the diet
 	showDiet( recipeList, dayNumber, mealNumber, dishNumbers );
@@ -130,11 +127,6 @@
 	dietView->end();
 }
 
-void DietViewDialog::print( void )
-{
-	dietView->view()->print();
-}
-
 void DietViewDialog::slotOk( void )
 {
 	emit signalOk();
diff -Naur krecipes-2.1.0.orig/src/dialogs/dietviewdialog.h krecipes-2.1.0/src/dialogs/dietviewdialog.h
--- krecipes-2.1.0.orig/src/dialogs/dietviewdialog.h	2015-03-20 00:50:18.000000000 +0100
+++ krecipes-2.1.0/src/dialogs/dietviewdialog.h	2017-02-07 04:44:09.153167219 +0100
@@ -35,7 +35,6 @@
 	// Private methods
 	void showDiet( const RecipeList &recipeList, int dayNumber, int mealNumber, const QList <int> &dishNumbers );
 private slots:
-	void print( void );
 	void slotOk( void );
 signals:
 	void signalOk( void );
diff -Naur krecipes-2.1.0.orig/src/dialogs/shoppinglistviewdialog.cpp krecipes-2.1.0/src/dialogs/shoppinglistviewdialog.cpp
--- krecipes-2.1.0.orig/src/dialogs/shoppinglistviewdialog.cpp	2015-03-20 00:50:18.000000000 +0100
+++ krecipes-2.1.0/src/dialogs/shoppinglistviewdialog.cpp	2017-02-07 04:44:32.020249405 +0100
@@ -30,7 +30,6 @@
 	this->setCaption( i18nc( "@title:window", "Shopping List" ) );
 	this->setModal( true );
 	this->setButtons( KDialog::Close | KDialog::User1 );
-	this->setButtonGuiItem( KDialog::User1 , KStandardGuiItem::print() );
 	this->setDefaultButton( KDialog::Close );
 	this->showButtonSeparator( false );
 	
@@ -42,7 +41,6 @@
 
 	setInitialSize( QSize(350, 450) );
 
-	connect ( this, SIGNAL( user1Clicked() ), this, SLOT( print() ) );
 	connect ( this, SIGNAL( closeClicked() ), this, SLOT( accept() ) );
 
 	//---------- Sort the list --------
@@ -102,9 +100,4 @@
 
 }
 
-void ShoppingListViewDialog::print()
-{
-	shoppingListView->view() ->print();
-}
-
 #include "shoppinglistviewdialog.moc"
diff -Naur krecipes-2.1.0.orig/src/dialogs/shoppinglistviewdialog.h krecipes-2.1.0/src/dialogs/shoppinglistviewdialog.h
--- krecipes-2.1.0.orig/src/dialogs/shoppinglistviewdialog.h	2015-03-20 00:50:18.000000000 +0100
+++ krecipes-2.1.0/src/dialogs/shoppinglistviewdialog.h	2017-02-07 04:43:22.252362998 +0100
@@ -30,9 +30,6 @@
 	ShoppingListViewDialog( QWidget *parent, const IngredientList &ingredientList );
 	~ShoppingListViewDialog();
 
-public slots:
-	void print();
-
 private:
 
 	// Widgets
diff -Naur krecipes-2.1.0.orig/src/krecipes.cpp krecipes-2.1.0/src/krecipes.cpp
--- krecipes-2.1.0.orig/src/krecipes.cpp	2015-03-20 00:50:18.000000000 +0100
+++ krecipes-2.1.0/src/krecipes.cpp	2017-02-07 04:39:25.659516260 +0100
@@ -134,7 +134,6 @@
 	switch ( panel ) {
 	case RecipeView: {
 			exportAction->setEnabled( show );
-			printAction->setEnabled( show );
 			reloadAction->setEnabled( show );
 			copyToClipboardAction->setEnabled( show );
 			showRecipeAction->setEnabled( false );
@@ -149,13 +148,11 @@
 			break;
 		}
 	case RecipeEdit: {
-			printAction->setEnabled( show );
 			exportAction->setEnabled( false );
 			showRecipeAction->setEnabled( show );
 			break;
 		}
 	case SelectP: {
-			printAction->setEnabled( show );
 			exportAction->setEnabled( show );
 			if (show)
 				m_view->selectPanel->haveSelectedItems();
@@ -164,7 +161,6 @@
 			break;
 		}
 	case MatcherP: {
-			printAction->setEnabled( show );
 			exportAction->setEnabled( show );
 			if (show) 
 				m_view->ingredientMatcherPanel->haveSelectedItems();
@@ -187,8 +183,6 @@
 void Krecipes::setupActions()
 {
 
-	printAction =  KStandardAction::print( this, SLOT( filePrint() ), actionCollection() );
-
 	reloadAction = new KAction( this );
 	reloadAction->setText( i18nc("@action:inmenu Reload Recipe", "Reloa&d" ) );
 	reloadAction->setIcon( KIcon( "view-refresh" ) );
@@ -412,7 +406,6 @@
 	updateActions( SelectP, true );
 	updateActions( RecipeView, false );
 	exportAction->setEnabled( true );
-	printAction->setEnabled( true );
 
 	createGUI();
 }
@@ -490,11 +483,6 @@
 	m_view->exportToClipboard();
 }
 
-void Krecipes::filePrint()
-{
-	m_view->printRequested();
-}
-
 void Krecipes::import()
 {
 	QPointer<KFileDialog> file_dialog = new KFileDialog( KUrl(), QString(
diff -Naur krecipes-2.1.0.orig/src/krecipes.h krecipes-2.1.0/src/krecipes.h
--- krecipes-2.1.0.orig/src/krecipes.h	2015-03-20 00:50:18.000000000 +0100
+++ krecipes-2.1.0/src/krecipes.h	2017-02-07 04:40:25.833352673 +0100
@@ -73,7 +73,6 @@
 	void fileSave();
 	void fileExport();
 	void fileToClipboard();
-	void filePrint();
 	//void optionsShowToolbar();
 	void optionsShowStatusbar();
 	void optionsConfigureKeys();
@@ -114,7 +113,6 @@
 	KAction *saveAction;
 	KAction *exportAction;
 	KAction *editAction;
-	KAction *printAction;
 	KAction *reloadAction;
 	KAction *copyToClipboardAction;
 	KAction *converterAction;
diff -Naur krecipes-2.1.0.orig/src/krecipesview.cpp krecipes-2.1.0/src/krecipesview.cpp
--- krecipes-2.1.0.orig/src/krecipesview.cpp	2015-03-20 00:50:18.000000000 +0100
+++ krecipes-2.1.0/src/krecipesview.cpp	2017-02-07 04:38:06.279134978 +0100
@@ -382,21 +382,6 @@
 	button8->setTitle( i18n( "Ingredient Matcher" ) );
 }
 
-void KrecipesView::printRequested()
-{
-	QWidget * vis_panel = rightPanel->visiblePanel();
-	if ( vis_panel == viewPanel ) {
-		m_actionshandler.printRecipes( viewPanel->currentRecipes(), database );
-	}
-	else if ( vis_panel == selectPanel ) {
-		selectPanel->getActionsHandler()->recipePrint();
-	}
-	else if ( vis_panel == ingredientMatcherPanel ) {
-		ingredientMatcherPanel->getActionsHandler()->recipePrint();
-	}
-
-}
-
 void KrecipesView::cut()
 {
 	QWidget * vis_panel = rightPanel->visiblePanel();
diff -Naur krecipes-2.1.0.orig/src/krecipesview.h krecipes-2.1.0/src/krecipesview.h
--- krecipes-2.1.0.orig/src/krecipesview.h	2015-03-20 00:50:18.000000000 +0100
+++ krecipes-2.1.0/src/krecipesview.h	2017-02-07 04:38:26.065864217 +0100
@@ -88,11 +88,6 @@
 	virtual QString currentDatabase() const;
 	RecipeDB *database;
 
-	/**
-	 * Print this view to any medium -- paper or not
-	 */
-	void printRequested();
-
 	virtual void show ( void ); //Needed to make sure that the raise() is done after the construction of all the widgets, otherwise childEvent in the PanelDeco is called only _after_ the raise(), and can't be shown.
 
 signals: