Merge lp:~jonas-drange/ubuntu-ui-extras/clean-up-for-review into lp:~phablet-team/ubuntu-ui-extras/printer-components
- clean-up-for-review
- Merge into printer-components
Proposed by
Jonas G. Drange
Status: | Merged |
---|---|
Approved by: | Andrew Hayzen |
Approved revision: | 132 |
Merged at revision: | 132 |
Proposed branch: | lp:~jonas-drange/ubuntu-ui-extras/clean-up-for-review |
Merge into: | lp:~phablet-team/ubuntu-ui-extras/printer-components |
Diff against target: |
879 lines (+10/-453) 18 files modified
modules/Ubuntu/Components/Extras/Printers/backend/backend.cpp (+0/-78) modules/Ubuntu/Components/Extras/Printers/backend/backend.h (+0/-22) modules/Ubuntu/Components/Extras/Printers/backend/backend_cups.cpp (+0/-78) modules/Ubuntu/Components/Extras/Printers/backend/backend_cups.h (+0/-21) modules/Ubuntu/Components/Extras/Printers/cups/printerdriverloader.cpp (+0/-1) modules/Ubuntu/Components/Extras/Printers/enums.h (+0/-35) modules/Ubuntu/Components/Extras/Printers/i18n.cpp (+0/-2) modules/Ubuntu/Components/Extras/Printers/models/jobmodel.cpp (+0/-1) modules/Ubuntu/Components/Extras/Printers/models/printermodel.cpp (+3/-33) modules/Ubuntu/Components/Extras/Printers/models/printermodel.h (+0/-7) modules/Ubuntu/Components/Extras/Printers/printer/printer.cpp (+4/-47) modules/Ubuntu/Components/Extras/Printers/printer/printer.h (+0/-13) modules/Ubuntu/Components/Extras/Printers/printer/printerjob.cpp (+1/-1) modules/Ubuntu/Components/Extras/Printers/printer/printerjob.h (+1/-1) modules/Ubuntu/Components/Extras/Printers/printers/printers.cpp (+0/-21) modules/Ubuntu/Components/Extras/Printers/printers/printers.h (+1/-6) modules/Ubuntu/Components/Extras/Printers/structs.h (+0/-6) tests/unittests/Printers/mockbackend.h (+0/-80) |
To merge this branch: | bzr merge lp:~jonas-drange/ubuntu-ui-extras/clean-up-for-review |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Andrew Hayzen (community) | Approve | ||
Review via email: mp+318113@code.launchpad.net |
Commit message
drops a lot of code that was not used, and some TODOS/FIXMES that aren't necessary
Description of the change
drops a lot of code that was not used, and some TODOS/FIXMES that aren't necessary
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'modules/Ubuntu/Components/Extras/Printers/backend/backend.cpp' |
2 | --- modules/Ubuntu/Components/Extras/Printers/backend/backend.cpp 2017-02-21 10:46:29 +0000 |
3 | +++ modules/Ubuntu/Components/Extras/Printers/backend/backend.cpp 2017-02-23 14:15:28 +0000 |
4 | @@ -99,83 +99,6 @@ |
5 | return QString(); |
6 | } |
7 | |
8 | -QString PrinterBackend::printerSetLocation(const QString &name, |
9 | - const QString &location) |
10 | -{ |
11 | - Q_UNUSED(name); |
12 | - Q_UNUSED(location); |
13 | - return QString(); |
14 | -} |
15 | - |
16 | -QString PrinterBackend::printerSetShared(const QString &name, |
17 | - const bool shared) |
18 | -{ |
19 | - Q_UNUSED(name); |
20 | - Q_UNUSED(shared); |
21 | - return QString(); |
22 | -} |
23 | - |
24 | -QString PrinterBackend::printerSetJobSheets(const QString &name, |
25 | - const QString &start, |
26 | - const QString &end) |
27 | -{ |
28 | - Q_UNUSED(name); |
29 | - Q_UNUSED(start); |
30 | - Q_UNUSED(end); |
31 | - return QString(); |
32 | -} |
33 | - |
34 | -QString PrinterBackend::printerSetErrorPolicy(const QString &name, |
35 | - const PrinterEnum::ErrorPolicy &policy) |
36 | -{ |
37 | - Q_UNUSED(name); |
38 | - Q_UNUSED(policy); |
39 | - return QString(); |
40 | -} |
41 | - |
42 | - |
43 | -QString PrinterBackend::printerSetOpPolicy(const QString &name, |
44 | - const PrinterEnum::OperationPolicy &policy) |
45 | -{ |
46 | - Q_UNUSED(name); |
47 | - Q_UNUSED(policy); |
48 | - return QString(); |
49 | -} |
50 | - |
51 | -QString PrinterBackend::printerSetUsersAllowed(const QString &name, |
52 | - const QStringList &users) |
53 | -{ |
54 | - Q_UNUSED(name); |
55 | - Q_UNUSED(users); |
56 | - return QString(); |
57 | -} |
58 | - |
59 | -QString PrinterBackend::printerSetUsersDenied(const QString &name, |
60 | - const QStringList &users) |
61 | -{ |
62 | - Q_UNUSED(name); |
63 | - Q_UNUSED(users); |
64 | - return QString(); |
65 | -} |
66 | - |
67 | -QString PrinterBackend::printerAddOptionDefault(const QString &name, |
68 | - const QString &option, |
69 | - const QStringList &values) |
70 | -{ |
71 | - Q_UNUSED(name); |
72 | - Q_UNUSED(option); |
73 | - Q_UNUSED(values); |
74 | - return QString(); |
75 | -} |
76 | - |
77 | -QString PrinterBackend::printerDeleteOptionDefault(const QString &name, |
78 | - const QString &value) |
79 | -{ |
80 | - Q_UNUSED(name); |
81 | - Q_UNUSED(value); |
82 | - return QString(); |
83 | -} |
84 | - |
85 | QString PrinterBackend::printerAddOption(const QString &name, |
86 | const QString &option, |
87 | const QStringList &values) |
88 | @@ -202,7 +125,6 @@ |
89 | return QMap<QString, QVariant>(); |
90 | } |
91 | |
92 | -// FIXME: maybe have a PrinterDest iface that has a CupsDest impl? |
93 | cups_dest_t* PrinterBackend::makeDest(const QString &name, |
94 | const PrinterJob *options) |
95 | { |
96 | |
97 | === modified file 'modules/Ubuntu/Components/Extras/Printers/backend/backend.h' |
98 | --- modules/Ubuntu/Components/Extras/Printers/backend/backend.h 2017-02-21 10:46:29 +0000 |
99 | +++ modules/Ubuntu/Components/Extras/Printers/backend/backend.h 2017-02-23 14:15:28 +0000 |
100 | @@ -65,27 +65,6 @@ |
101 | const QString &reason = QString::null); |
102 | virtual QString printerSetInfo(const QString &name, |
103 | const QString &info); |
104 | - virtual QString printerSetLocation(const QString &name, |
105 | - const QString &location); |
106 | - virtual QString printerSetShared(const QString &name, |
107 | - const bool shared); |
108 | - virtual QString printerSetJobSheets(const QString &name, |
109 | - const QString &start, |
110 | - const QString &end); |
111 | - virtual QString printerSetErrorPolicy(const QString &name, |
112 | - const PrinterEnum::ErrorPolicy &policy); |
113 | - |
114 | - virtual QString printerSetOpPolicy(const QString &name, |
115 | - const PrinterEnum::OperationPolicy &policy); |
116 | - virtual QString printerSetUsersAllowed(const QString &name, |
117 | - const QStringList &users); |
118 | - virtual QString printerSetUsersDenied(const QString &name, |
119 | - const QStringList &users); |
120 | - virtual QString printerAddOptionDefault(const QString &name, |
121 | - const QString &option, |
122 | - const QStringList &values); |
123 | - virtual QString printerDeleteOptionDefault(const QString &name, |
124 | - const QString &value); |
125 | virtual QString printerAddOption(const QString &name, |
126 | const QString &option, |
127 | const QStringList &values); |
128 | @@ -94,7 +73,6 @@ |
129 | const QString &option) const; |
130 | virtual QMap<QString, QVariant> printerGetOptions( |
131 | const QString &name, const QStringList &options) const; |
132 | - // FIXME: maybe have a PrinterDest iface that has a CupsDest impl? |
133 | virtual cups_dest_t* makeDest(const QString &name, |
134 | const PrinterJob *options); |
135 | |
136 | |
137 | === modified file 'modules/Ubuntu/Components/Extras/Printers/backend/backend_cups.cpp' |
138 | --- modules/Ubuntu/Components/Extras/Printers/backend/backend_cups.cpp 2017-02-21 10:46:29 +0000 |
139 | +++ modules/Ubuntu/Components/Extras/Printers/backend/backend_cups.cpp 2017-02-23 14:15:28 +0000 |
140 | @@ -187,82 +187,6 @@ |
141 | return QString(); |
142 | } |
143 | |
144 | -QString PrinterCupsBackend::printerSetLocation(const QString &name, |
145 | - const QString &location) |
146 | -{ |
147 | - Q_UNUSED(name); |
148 | - Q_UNUSED(location); |
149 | - return QString(); |
150 | -} |
151 | - |
152 | -QString PrinterCupsBackend::printerSetShared(const QString &name, |
153 | - const bool shared) |
154 | -{ |
155 | - Q_UNUSED(name); |
156 | - Q_UNUSED(shared); |
157 | - return QString(); |
158 | -} |
159 | - |
160 | -QString PrinterCupsBackend::printerSetJobSheets(const QString &name, |
161 | - const QString &start, |
162 | - const QString &end) |
163 | -{ |
164 | - Q_UNUSED(name); |
165 | - Q_UNUSED(start); |
166 | - Q_UNUSED(end); |
167 | - return QString(); |
168 | -} |
169 | - |
170 | -QString PrinterCupsBackend::printerSetErrorPolicy(const QString &name, |
171 | - const PrinterEnum::ErrorPolicy &policy) |
172 | -{ |
173 | - Q_UNUSED(name); |
174 | - Q_UNUSED(policy); |
175 | - return QString(); |
176 | -} |
177 | - |
178 | -QString PrinterCupsBackend::printerSetOpPolicy(const QString &name, |
179 | - const PrinterEnum::OperationPolicy &policy) |
180 | -{ |
181 | - Q_UNUSED(name); |
182 | - Q_UNUSED(policy); |
183 | - return QString(); |
184 | -} |
185 | - |
186 | -QString PrinterCupsBackend::printerSetUsersAllowed(const QString &name, |
187 | - const QStringList &users) |
188 | -{ |
189 | - Q_UNUSED(name); |
190 | - Q_UNUSED(users); |
191 | - return QString(); |
192 | -} |
193 | - |
194 | -QString PrinterCupsBackend::printerSetUsersDenied(const QString &name, |
195 | - const QStringList &users) |
196 | -{ |
197 | - Q_UNUSED(name); |
198 | - Q_UNUSED(users); |
199 | - return QString(); |
200 | -} |
201 | - |
202 | -QString PrinterCupsBackend::printerAddOptionDefault(const QString &name, |
203 | - const QString &option, |
204 | - const QStringList &values) |
205 | -{ |
206 | - Q_UNUSED(name); |
207 | - Q_UNUSED(option); |
208 | - Q_UNUSED(values); |
209 | - return QString(); |
210 | -} |
211 | - |
212 | -QString PrinterCupsBackend::printerDeleteOptionDefault(const QString &name, |
213 | - const QString &value) |
214 | -{ |
215 | - Q_UNUSED(name); |
216 | - Q_UNUSED(value); |
217 | - return QString(); |
218 | -} |
219 | - |
220 | QString PrinterCupsBackend::printerAddOption(const QString &name, |
221 | const QString &option, |
222 | const QStringList &values) |
223 | @@ -371,11 +295,9 @@ |
224 | return ret; |
225 | } |
226 | |
227 | -// FIXME: maybe have a PrinterDest iface that has a CupsDest impl? |
228 | cups_dest_t* PrinterCupsBackend::makeDest(const QString &name, |
229 | const PrinterJob *options) |
230 | { |
231 | - // Get the cups dest |
232 | cups_dest_t *dest = getDest(name); |
233 | |
234 | if (options->collate()) { |
235 | |
236 | === modified file 'modules/Ubuntu/Components/Extras/Printers/backend/backend_cups.h' |
237 | --- modules/Ubuntu/Components/Extras/Printers/backend/backend_cups.h 2017-02-21 10:46:29 +0000 |
238 | +++ modules/Ubuntu/Components/Extras/Printers/backend/backend_cups.h 2017-02-23 14:15:28 +0000 |
239 | @@ -56,27 +56,6 @@ |
240 | const QString &reason = QString::null) override; |
241 | virtual QString printerSetInfo(const QString &name, |
242 | const QString &info) override; |
243 | - virtual QString printerSetLocation(const QString &name, |
244 | - const QString &location) override; |
245 | - virtual QString printerSetShared(const QString &name, |
246 | - const bool shared) override; |
247 | - virtual QString printerSetJobSheets(const QString &name, |
248 | - const QString &start, |
249 | - const QString &end) override; |
250 | - virtual QString printerSetErrorPolicy(const QString &name, |
251 | - const PrinterEnum::ErrorPolicy &policy) override; |
252 | - |
253 | - virtual QString printerSetOpPolicy(const QString &name, |
254 | - const PrinterEnum::OperationPolicy &policy) override; |
255 | - virtual QString printerSetUsersAllowed(const QString &name, |
256 | - const QStringList &users) override; |
257 | - virtual QString printerSetUsersDenied(const QString &name, |
258 | - const QStringList &users) override; |
259 | - virtual QString printerAddOptionDefault(const QString &name, |
260 | - const QString &option, |
261 | - const QStringList &values) override; |
262 | - virtual QString printerDeleteOptionDefault(const QString &name, |
263 | - const QString &value) override; |
264 | virtual QString printerAddOption(const QString &name, |
265 | const QString &option, |
266 | const QStringList &values) override; |
267 | |
268 | === modified file 'modules/Ubuntu/Components/Extras/Printers/cups/printerdriverloader.cpp' |
269 | --- modules/Ubuntu/Components/Extras/Printers/cups/printerdriverloader.cpp 2017-02-21 10:46:29 +0000 |
270 | +++ modules/Ubuntu/Components/Extras/Printers/cups/printerdriverloader.cpp 2017-02-23 14:15:28 +0000 |
271 | @@ -61,7 +61,6 @@ |
272 | QByteArray ppdMakeModel; |
273 | QByteArray ppdName; |
274 | |
275 | - // cups_option_t option; |
276 | QList<PrinterDriver> drivers; |
277 | |
278 | for (attr = ippFirstAttribute(response); attr != NULL && m_running; attr = ippNextAttribute(response)) { |
279 | |
280 | === modified file 'modules/Ubuntu/Components/Extras/Printers/enums.h' |
281 | --- modules/Ubuntu/Components/Extras/Printers/enums.h 2017-02-21 10:46:29 +0000 |
282 | +++ modules/Ubuntu/Components/Extras/Printers/enums.h 2017-02-23 14:15:28 +0000 |
283 | @@ -41,41 +41,6 @@ |
284 | }; |
285 | Q_ENUM(ColorModelType) |
286 | |
287 | - enum class ColorSpace |
288 | - { |
289 | - NSpace = 0, |
290 | - RGBSpace, |
291 | - RGBKSpace, |
292 | - GraySpace, |
293 | - CMYSpace, |
294 | - CMYKSpace, |
295 | - UnknownSpace, |
296 | - }; |
297 | - Q_ENUM(ColorSpace) |
298 | - |
299 | - enum class ColorOrganization |
300 | - { |
301 | - ChunkyOrganization = 0, |
302 | - BandedOrganization, |
303 | - PlanarOrganization, |
304 | - UnknownOrganization, |
305 | - }; |
306 | - Q_ENUM(ColorOrganization) |
307 | - |
308 | - enum class CartridgeType |
309 | - { |
310 | - BlackCartridge = 0, |
311 | - CyanCartridge, |
312 | - MagentaCartridge, |
313 | - YellowCartridge, |
314 | - RedCartridge, |
315 | - GreenCartridge, |
316 | - BlueCartridge, |
317 | - UnknownCartridge, |
318 | - WhiteCartridge, |
319 | - }; |
320 | - Q_ENUM(CartridgeType) |
321 | - |
322 | enum class DuplexMode |
323 | { |
324 | DuplexNone = 0, |
325 | |
326 | === modified file 'modules/Ubuntu/Components/Extras/Printers/i18n.cpp' |
327 | --- modules/Ubuntu/Components/Extras/Printers/i18n.cpp 2017-02-21 10:46:29 +0000 |
328 | +++ modules/Ubuntu/Components/Extras/Printers/i18n.cpp 2017-02-23 14:15:28 +0000 |
329 | @@ -28,8 +28,6 @@ |
330 | { |
331 | // Don't bind the domain or set textdomain as it changes the Apps domain |
332 | // as well. Instead store the domain and use it in the lookups |
333 | -// bindtextdomain(domain, localeDir); |
334 | -// textdomain(domain); |
335 | Q_UNUSED(localeDir); |
336 | |
337 | thisDomain = domain; |
338 | |
339 | === modified file 'modules/Ubuntu/Components/Extras/Printers/models/jobmodel.cpp' |
340 | --- modules/Ubuntu/Components/Extras/Printers/models/jobmodel.cpp 2017-02-21 10:46:29 +0000 |
341 | +++ modules/Ubuntu/Components/Extras/Printers/models/jobmodel.cpp 2017-02-23 14:15:28 +0000 |
342 | @@ -62,7 +62,6 @@ |
343 | Q_UNUSED(job_state); |
344 | Q_UNUSED(job_state_reasons); |
345 | Q_UNUSED(job_name); |
346 | - Q_UNUSED(job_impressions_completed); |
347 | |
348 | auto job = getJobById(job_id); |
349 | if (job) |
350 | |
351 | === modified file 'modules/Ubuntu/Components/Extras/Printers/models/printermodel.cpp' |
352 | --- modules/Ubuntu/Components/Extras/Printers/models/printermodel.cpp 2017-02-21 10:46:29 +0000 |
353 | +++ modules/Ubuntu/Components/Extras/Printers/models/printermodel.cpp 2017-02-23 14:15:28 +0000 |
354 | @@ -225,9 +225,6 @@ |
355 | ret = models; |
356 | } |
357 | break; |
358 | - // case CopiesRole: |
359 | - // ret = printer->copies(); |
360 | - // break; |
361 | case DefaultPrinterRole: |
362 | ret = printer->name() == m_backend->defaultPrinterName(); |
363 | break; |
364 | @@ -237,12 +234,6 @@ |
365 | case SupportedDuplexModesRole: |
366 | ret = printer->supportedDuplexStrings(); |
367 | break; |
368 | - // case PrintRangeRole: |
369 | - // ret = printer->printRange(); |
370 | - // break; |
371 | - // case PrintRangeModeRole: |
372 | - // ret = printer->printRangeMode(); |
373 | - // break; |
374 | case PrintQualityRole: |
375 | ret = printer->supportedPrintQualities().indexOf(printer->defaultPrintQuality()); |
376 | break; |
377 | @@ -268,19 +259,9 @@ |
378 | ret = sizes; |
379 | } |
380 | break; |
381 | - |
382 | - // case AccessControlRole: |
383 | - // ret = printer->accessControl(); |
384 | - // break; |
385 | - // case ErrorPolicyRole: |
386 | - // ret = printer->errorPolicy(); |
387 | - // break; |
388 | - // case UsersRole: |
389 | - // ret = printer->users(); |
390 | - // break; |
391 | - // case StateRole: |
392 | - // ret = printer->state(); |
393 | - // break; |
394 | + case StateRole: |
395 | + ret = QVariant::fromValue(printer->state()); |
396 | + break; |
397 | case PrinterRole: |
398 | ret = QVariant::fromValue(printer); |
399 | break; |
400 | @@ -302,10 +283,6 @@ |
401 | case AcceptJobsRole: |
402 | ret = printer->acceptJobs(); |
403 | break; |
404 | - |
405 | - // case LastStateMessageRole: |
406 | - // ret = printer->lastStateMessage(); |
407 | - // break; |
408 | } |
409 | } |
410 | |
411 | @@ -375,31 +352,24 @@ |
412 | names[Qt::DisplayRole] = "displayName"; |
413 | names[ColorModelRole] = "colorModel"; |
414 | names[SupportedColorModelsRole] = "supportedColorModels"; |
415 | - names[CopiesRole] = "copies"; |
416 | names[DefaultPrinterRole] = "default"; |
417 | names[DuplexRole] = "duplexMode"; |
418 | names[SupportedDuplexModesRole] = "supportedDuplexModes"; |
419 | names[NameRole] = "name"; |
420 | names[EnabledRole] = "printerEnabled"; |
421 | names[AcceptJobsRole] = "acceptJobs"; |
422 | - names[PrintRangeRole] = "printRange"; |
423 | - names[PrintRangeModeRole] = "printRangeMode"; |
424 | names[PdfModeRole] = "pdfMode"; |
425 | names[PrintQualityRole] = "printQuality"; |
426 | names[SupportedPrintQualitiesRole] = "supportedPrintQualities"; |
427 | names[DescriptionRole] = "description"; |
428 | names[PageSizeRole] = "pageSize"; |
429 | names[SupportedPageSizesRole] = "supportedPageSizes"; |
430 | - names[AccessControlRole] = "accessControl"; |
431 | - names[ErrorPolicyRole] = "errorPolicy"; |
432 | - names[UsersRole] = "users"; |
433 | names[StateRole] = "state"; |
434 | names[PrinterRole] = "printer"; |
435 | names[IsPdfRole] = "isPdf"; |
436 | names[IsLoadedRole] = "isLoaded"; |
437 | names[IsRawRole] = "isRaw"; |
438 | names[JobRole] = "jobs"; |
439 | - names[LastStateMessageRole] = "lastStateMessage"; |
440 | } |
441 | |
442 | return names; |
443 | |
444 | === modified file 'modules/Ubuntu/Components/Extras/Printers/models/printermodel.h' |
445 | --- modules/Ubuntu/Components/Extras/Printers/models/printermodel.h 2017-02-21 10:46:29 +0000 |
446 | +++ modules/Ubuntu/Components/Extras/Printers/models/printermodel.h 2017-02-23 14:15:28 +0000 |
447 | @@ -43,27 +43,20 @@ |
448 | // Qt::DisplayRole holds device name |
449 | ColorModelRole = Qt::UserRole, |
450 | SupportedColorModelsRole, |
451 | - CopiesRole, |
452 | DefaultPrinterRole, |
453 | DuplexRole, |
454 | SupportedDuplexModesRole, |
455 | NameRole, |
456 | EnabledRole, |
457 | AcceptJobsRole, |
458 | - PrintRangeRole, |
459 | - PrintRangeModeRole, |
460 | PdfModeRole, |
461 | PrintQualityRole, |
462 | SupportedPrintQualitiesRole, |
463 | DescriptionRole, |
464 | PageSizeRole, |
465 | SupportedPageSizesRole, |
466 | - AccessControlRole, |
467 | - ErrorPolicyRole, |
468 | - UsersRole, |
469 | StateRole, |
470 | PrinterRole, |
471 | - LastStateMessageRole, |
472 | |
473 | /* Indicates that this printer is a pseudo printer used to create |
474 | PDF files. */ |
475 | |
476 | === modified file 'modules/Ubuntu/Components/Extras/Printers/printer/printer.cpp' |
477 | --- modules/Ubuntu/Components/Extras/Printers/printer/printer.cpp 2017-02-21 10:46:29 +0000 |
478 | +++ modules/Ubuntu/Components/Extras/Printers/printer/printer.cpp 2017-02-23 14:15:28 +0000 |
479 | @@ -152,13 +152,11 @@ |
480 | |
481 | PrinterEnum::AccessControl Printer::accessControl() const |
482 | { |
483 | - // TODO: implement |
484 | return PrinterEnum::AccessControl::AccessAllow; |
485 | } |
486 | |
487 | PrinterEnum::ErrorPolicy Printer::errorPolicy() const |
488 | { |
489 | - // TODO: implement |
490 | return PrinterEnum::ErrorPolicy::RetryOnError; |
491 | } |
492 | |
493 | @@ -167,23 +165,11 @@ |
494 | return state() != PrinterEnum::State::ErrorState; |
495 | } |
496 | |
497 | -QStringList Printer::users() const |
498 | -{ |
499 | - // TODO: implement |
500 | - return QStringList(); |
501 | -} |
502 | - |
503 | PrinterEnum::State Printer::state() const |
504 | { |
505 | return m_backend->state(); |
506 | } |
507 | |
508 | -QString Printer::lastStateMessage() const |
509 | -{ |
510 | - // TODO: implement |
511 | - return QString(); |
512 | -} |
513 | - |
514 | bool Printer::acceptJobs() const |
515 | { |
516 | return m_acceptJobs; |
517 | @@ -211,14 +197,7 @@ |
518 | } |
519 | |
520 | QStringList vals({colorModel.name}); |
521 | - QString reply = m_backend->printerAddOption(name(), "ColorModel", vals); |
522 | - Q_UNUSED(reply); |
523 | -} |
524 | - |
525 | -void Printer::setAccessControl(const PrinterEnum::AccessControl &accessControl) |
526 | -{ |
527 | - // TODO: implement |
528 | - Q_UNUSED(accessControl); |
529 | + m_backend->printerAddOption(name(), "ColorModel", vals); |
530 | } |
531 | |
532 | void Printer::setDescription(const QString &description) |
533 | @@ -240,7 +219,7 @@ |
534 | } |
535 | |
536 | QStringList vals({Utils::duplexModeToPpdChoice(duplexMode)}); |
537 | - QString reply = m_backend->printerAddOption(name(), "Duplex", vals); |
538 | + m_backend->printerAddOption(name(), "Duplex", vals); |
539 | } |
540 | |
541 | void Printer::setEnabled(const bool enabled) |
542 | @@ -263,12 +242,6 @@ |
543 | } |
544 | } |
545 | |
546 | -void Printer::setErrorPolicy(const PrinterEnum::ErrorPolicy &errorPolicy) |
547 | -{ |
548 | - // TODO: implement |
549 | - Q_UNUSED(errorPolicy); |
550 | -} |
551 | - |
552 | void Printer::setDefaultPrintQuality(const PrintQuality &quality) |
553 | { |
554 | if (defaultPrintQuality() == quality) { |
555 | @@ -281,7 +254,7 @@ |
556 | } |
557 | |
558 | QStringList vals({quality.name}); |
559 | - QString reply = m_backend->printerAddOption(name(), quality.originalOption, vals); |
560 | + m_backend->printerAddOption(name(), quality.originalOption, vals); |
561 | } |
562 | |
563 | void Printer::setDefaultPageSize(const QPageSize &pageSize) |
564 | @@ -301,23 +274,10 @@ |
565 | } |
566 | |
567 | QStringList vals({pageSize.key()}); |
568 | - QString reply = m_backend->printerAddOption(name(), "PageSize", vals); |
569 | - |
570 | + m_backend->printerAddOption(name(), "PageSize", vals); |
571 | m_backend->refresh(); |
572 | } |
573 | |
574 | -void Printer::addUser(const QString &username) |
575 | -{ |
576 | - // TODO: implement |
577 | - Q_UNUSED(username); |
578 | -} |
579 | - |
580 | -void Printer::removeUser(const QString &username) |
581 | -{ |
582 | - // TODO: implement |
583 | - Q_UNUSED(username); |
584 | -} |
585 | - |
586 | QAbstractItemModel* Printer::jobs() |
587 | { |
588 | auto ret = &m_jobs; |
589 | @@ -339,9 +299,6 @@ |
590 | changed |= enabled() != other->enabled(); |
591 | changed |= state() != other->state(); |
592 | |
593 | - // TODO: accessControl |
594 | - // TODO: errorPolicy |
595 | - |
596 | // Return true if they are the same, so no change |
597 | return changed == false; |
598 | } |
599 | |
600 | === modified file 'modules/Ubuntu/Components/Extras/Printers/printer/printer.h' |
601 | --- modules/Ubuntu/Components/Extras/Printers/printer/printer.h 2017-02-21 10:46:29 +0000 |
602 | +++ modules/Ubuntu/Components/Extras/Printers/printer/printer.h 2017-02-23 14:15:28 +0000 |
603 | @@ -56,22 +56,18 @@ |
604 | QList<QPageSize> supportedPageSizes() const; |
605 | PrinterEnum::AccessControl accessControl() const; |
606 | PrinterEnum::ErrorPolicy errorPolicy() const; |
607 | - QStringList users() const; |
608 | PrinterEnum::State state() const; |
609 | - QString lastStateMessage() const; |
610 | bool acceptJobs() const; |
611 | bool holdsDefinition() const; |
612 | QAbstractItemModel* jobs(); |
613 | |
614 | PrinterEnum::PrinterType type() const; |
615 | |
616 | - void setAccessControl(const PrinterEnum::AccessControl &accessControl); |
617 | void setDefaultColorModel(const ColorModel &colorModel); |
618 | void setDescription(const QString &description); |
619 | void setDefaultDuplexMode(const PrinterEnum::DuplexMode &duplexMode); |
620 | void setEnabled(const bool enabled); |
621 | void setAcceptJobs(const bool accepting); |
622 | - void setErrorPolicy(const PrinterEnum::ErrorPolicy &errorPolicy); |
623 | void setDefaultPrintQuality(const PrintQuality &quality); |
624 | void setDefaultPageSize(const QPageSize &pageSize); |
625 | void setJobModel(JobModel* jobModel); |
626 | @@ -81,14 +77,8 @@ |
627 | |
628 | |
629 | public Q_SLOTS: |
630 | - // Add user that is either denied or allowed printer. See AccessControl. |
631 | - void addUser(const QString &username); |
632 | - |
633 | int printFile(const QString &filepath, const PrinterJob *options); |
634 | |
635 | - // Removes user. See addUser. |
636 | - void removeUser(const QString &username); |
637 | - |
638 | private: |
639 | void loadAcceptJobs(); |
640 | void loadColorModel(); |
641 | @@ -103,7 +93,4 @@ |
642 | bool m_acceptJobs; |
643 | }; |
644 | |
645 | -// FIXME: not necessary outside tests |
646 | -Q_DECLARE_METATYPE(QList<PrinterEnum::DuplexMode>) |
647 | - |
648 | #endif // USC_PRINTERS_PRINTER_H |
649 | |
650 | === modified file 'modules/Ubuntu/Components/Extras/Printers/printer/printerjob.cpp' |
651 | --- modules/Ubuntu/Components/Extras/Printers/printer/printerjob.cpp 2017-02-21 10:46:29 +0000 |
652 | +++ modules/Ubuntu/Components/Extras/Printers/printer/printerjob.cpp 2017-02-23 14:15:28 +0000 |
653 | @@ -220,7 +220,7 @@ |
654 | |
655 | QString PrinterJob::printerName() const |
656 | { |
657 | - return m_printerName; // Maybe check if it's a class. |
658 | + return m_printerName; |
659 | } |
660 | |
661 | void PrinterJob::printFile(const QUrl &url) |
662 | |
663 | === modified file 'modules/Ubuntu/Components/Extras/Printers/printer/printerjob.h' |
664 | --- modules/Ubuntu/Components/Extras/Printers/printer/printerjob.h 2017-02-21 10:46:29 +0000 |
665 | +++ modules/Ubuntu/Components/Extras/Printers/printer/printerjob.h 2017-02-23 14:15:28 +0000 |
666 | @@ -151,7 +151,7 @@ |
667 | QDateTime m_completed_time; |
668 | int m_copies; |
669 | QDateTime m_creation_time; |
670 | - PrinterBackend *m_backend; // TODO: Maybe use the printer's backend? |
671 | + PrinterBackend *m_backend; |
672 | QString m_printerName; |
673 | int m_duplex_mode; |
674 | int m_impressions_completed; |
675 | |
676 | === modified file 'modules/Ubuntu/Components/Extras/Printers/printers/printers.cpp' |
677 | --- modules/Ubuntu/Components/Extras/Printers/printers/printers.cpp 2017-02-22 14:36:29 +0000 |
678 | +++ modules/Ubuntu/Components/Extras/Printers/printers/printers.cpp 2017-02-23 14:15:28 +0000 |
679 | @@ -103,12 +103,6 @@ |
680 | return ret; |
681 | } |
682 | |
683 | -QAbstractItemModel* Printers::recentPrinters() |
684 | -{ |
685 | - // TODO: implement |
686 | - return Q_NULLPTR; |
687 | -} |
688 | - |
689 | QAbstractItemModel* Printers::printJobs() |
690 | { |
691 | auto ret = &m_jobs; |
692 | @@ -163,21 +157,6 @@ |
693 | } |
694 | } |
695 | |
696 | -QSharedPointer<Printer> Printers::getPrinterByName(const QString &name) |
697 | -{ |
698 | - // TODO: implement |
699 | - Q_UNUSED(name); |
700 | - |
701 | - return QSharedPointer<Printer>(Q_NULLPTR); |
702 | -} |
703 | -QSharedPointer<Printer> Printers::getJobOwner(const int &jobId) |
704 | -{ |
705 | - // TODO: implement |
706 | - Q_UNUSED(jobId); |
707 | - |
708 | - return QSharedPointer<Printer>(Q_NULLPTR); |
709 | -} |
710 | - |
711 | void Printers::prepareToAddPrinter() |
712 | { |
713 | m_drivers.load(); |
714 | |
715 | === modified file 'modules/Ubuntu/Components/Extras/Printers/printers/printers.h' |
716 | --- modules/Ubuntu/Components/Extras/Printers/printers/printers.h 2017-02-21 10:46:29 +0000 |
717 | +++ modules/Ubuntu/Components/Extras/Printers/printers/printers.h 2017-02-23 14:15:28 +0000 |
718 | @@ -36,10 +36,9 @@ |
719 | Q_OBJECT |
720 | Q_PROPERTY(QAbstractItemModel* allPrinters READ allPrinters CONSTANT) |
721 | Q_PROPERTY(QAbstractItemModel* allPrintersWithPdf READ allPrintersWithPdf CONSTANT) |
722 | - Q_PROPERTY(QAbstractItemModel* recentPrinters READ recentPrinters CONSTANT) |
723 | Q_PROPERTY(QAbstractItemModel* printJobs READ printJobs CONSTANT) |
724 | Q_PROPERTY(QAbstractItemModel* drivers READ drivers CONSTANT) |
725 | - Q_PROPERTY (QString driverFilter READ driverFilter WRITE setDriverFilter NOTIFY driverFilterChanged) |
726 | + Q_PROPERTY(QString driverFilter READ driverFilter WRITE setDriverFilter NOTIFY driverFilterChanged) |
727 | Q_PROPERTY(QString defaultPrinterName READ defaultPrinterName WRITE setDefaultPrinterName NOTIFY defaultPrinterNameChanged) |
728 | Q_PROPERTY(QString lastMessage READ lastMessage CONSTANT) |
729 | |
730 | @@ -52,7 +51,6 @@ |
731 | |
732 | QAbstractItemModel* allPrinters(); |
733 | QAbstractItemModel* allPrintersWithPdf(); |
734 | - QAbstractItemModel* recentPrinters(); |
735 | QAbstractItemModel* printJobs(); |
736 | QAbstractItemModel* drivers(); |
737 | QString driverFilter() const; |
738 | @@ -63,9 +61,6 @@ |
739 | void setDriverFilter(const QString &filter); |
740 | |
741 | public Q_SLOTS: |
742 | - QSharedPointer<Printer> getPrinterByName(const QString &name); |
743 | - QSharedPointer<Printer> getJobOwner(const int &jobId); |
744 | - |
745 | PrinterJob* createJob(const QString &printerName); |
746 | void cancelJob(const QString &printerName, const int jobId); |
747 | |
748 | |
749 | === modified file 'modules/Ubuntu/Components/Extras/Printers/structs.h' |
750 | --- modules/Ubuntu/Components/Extras/Printers/structs.h 2017-02-21 10:46:29 +0000 |
751 | +++ modules/Ubuntu/Components/Extras/Printers/structs.h 2017-02-23 14:15:28 +0000 |
752 | @@ -24,12 +24,6 @@ |
753 | #include <QDebug> |
754 | #include <QMetaType> |
755 | |
756 | -struct InkLevels |
757 | -{ |
758 | -public: |
759 | - QMap<PrinterEnum::CartridgeType, uint> levels; |
760 | -}; |
761 | - |
762 | struct ColorModel |
763 | { |
764 | public: |
765 | |
766 | === modified file 'tests/unittests/Printers/mockbackend.h' |
767 | --- tests/unittests/Printers/mockbackend.h 2017-02-23 13:37:29 +0000 |
768 | +++ tests/unittests/Printers/mockbackend.h 2017-02-23 14:15:28 +0000 |
769 | @@ -112,77 +112,6 @@ |
770 | return returnValue; |
771 | } |
772 | |
773 | - virtual QString printerSetLocation(const QString &name, |
774 | - const QString &location) override |
775 | - { |
776 | - locations.insert(name, location); |
777 | - return returnValue; |
778 | - } |
779 | - |
780 | - virtual QString printerSetShared(const QString &name, |
781 | - const bool shared) override |
782 | - { |
783 | - shareds.insert(name, shared); |
784 | - return returnValue; |
785 | - } |
786 | - |
787 | - virtual QString printerSetJobSheets(const QString &name, |
788 | - const QString &start, |
789 | - const QString &end) override |
790 | - { |
791 | - Q_UNUSED(name); |
792 | - Q_UNUSED(start); |
793 | - Q_UNUSED(end); |
794 | - return returnValue; |
795 | - } |
796 | - |
797 | - virtual QString printerSetErrorPolicy(const QString &name, |
798 | - const PrinterEnum::ErrorPolicy &policy) override |
799 | - { |
800 | - errorPolicies.insert(name, policy); |
801 | - return returnValue; |
802 | - } |
803 | - |
804 | - |
805 | - virtual QString printerSetOpPolicy(const QString &name, |
806 | - const PrinterEnum::OperationPolicy &policy) override |
807 | - { |
808 | - operationPolicies.insert(name, policy); |
809 | - return returnValue; |
810 | - } |
811 | - |
812 | - virtual QString printerSetUsersAllowed(const QString &name, |
813 | - const QStringList &users) override |
814 | - { |
815 | - printerOptions[name].insert("users-allowed", QVariant::fromValue(users)); |
816 | - return returnValue; |
817 | - } |
818 | - |
819 | - virtual QString printerSetUsersDenied(const QString &name, |
820 | - const QStringList &users) override |
821 | - { |
822 | - printerOptions[name].insert("users-denied", QVariant::fromValue(users)); |
823 | - return returnValue; |
824 | - } |
825 | - |
826 | - virtual QString printerAddOptionDefault(const QString &name, |
827 | - const QString &option, |
828 | - const QStringList &values) override |
829 | - { |
830 | - Q_UNUSED(name); |
831 | - Q_UNUSED(option); |
832 | - Q_UNUSED(values); |
833 | - return returnValue; |
834 | - } |
835 | - |
836 | - virtual QString printerDeleteOptionDefault(const QString &name, |
837 | - const QString &value) override |
838 | - { |
839 | - Q_UNUSED(name); |
840 | - Q_UNUSED(value); |
841 | - return returnValue; |
842 | - } |
843 | - |
844 | virtual QString printerAddOption(const QString &name, |
845 | const QString &option, |
846 | const QStringList &values) override |
847 | @@ -191,12 +120,9 @@ |
848 | return returnValue; |
849 | } |
850 | |
851 | - |
852 | - // TODO: const for both these getters (if possible)! |
853 | virtual QVariant printerGetOption(const QString &name, |
854 | const QString &option) const override |
855 | { |
856 | - // FIXME: if we're to return a variant, check that it can be converted |
857 | return printerOptions[name].value(option); |
858 | } |
859 | |
860 | @@ -210,7 +136,6 @@ |
861 | return opts; |
862 | } |
863 | |
864 | - // FIXME: maybe have a PrinterDest iface that has a CupsDest impl? |
865 | virtual cups_dest_t* makeDest(const QString &name, |
866 | const PrinterJob *options) override |
867 | { |
868 | @@ -452,11 +377,6 @@ |
869 | |
870 | Q_SIGNALS: |
871 | void printToFile(const QString &filepath, const QString &title); |
872 | - |
873 | -public Q_SLOTS: |
874 | - virtual void refresh() override |
875 | - { |
876 | - } |
877 | }; |
878 | |
879 | #endif // USC_PRINTERS_MOCK_BACKEND_H |
LGTM, tests still pass
100% tests passed, 0 tests failed out of 15
Total Test time (real) = 27.88 sec
Also the examples and ubuntu-printing-app still work :-)