xref: /haiku/src/preferences/printers/Printers.cpp (revision c237c4ce593ee823d9867fd997e51e4c447f5623)
1 /*
2  * Copyright 2001-2010, Haiku.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		Michael Pfeiffer
7  */
8 
9 
10 #include "Printers.h"
11 
12 #include <Locale.h>
13 
14 #include "pr_server.h"
15 #include "Messages.h"
16 #include "PrintersWindow.h"
17 #include "ScreenSettings.h"
18 
19 
20 int
21 main()
22 {
23 	PrintersApp app;
24 	app.Run();
25 	return 0;
26 }
27 
28 
29 PrintersApp::PrintersApp()
30 	: Inherited(PRINTERS_SIGNATURE)
31 {
32 }
33 
34 
35 void
36 PrintersApp::ReadyToRun()
37 {
38 	PrintersWindow* win = new PrintersWindow(new ScreenSettings());
39 	win->Show();
40 }
41 
42 
43 void
44 PrintersApp::MessageReceived(BMessage* msg)
45 {
46 	if (msg->what == B_PRINTER_CHANGED || msg->what == PRINTERS_ADD_PRINTER) {
47 			// broadcast message
48 		uint32 what = msg->what;
49 		if (what == PRINTERS_ADD_PRINTER)
50 			what = kMsgAddPrinter;
51 
52 		BWindow* w;
53 		for (int32 i = 0; (w = WindowAt(i)) != NULL; i++) {
54 			BMessenger msgr(NULL, w);
55 			msgr.SendMessage(what);
56 		}
57 	} else {
58 		BApplication::MessageReceived(msg);
59 	}
60 }
61 
62 
63 void
64 PrintersApp::ArgvReceived(int32 argc, char** argv)
65 {
66 	for (int i = 1; i < argc; i++) {
67 		// TODO: show a pre-filled add printer dialog here
68 	}
69 }
70 
71