mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-25 03:12:56 +00:00
replace resolveCups() function with its body
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
e363dd6fee
commit
91a74c0b49
1 changed files with 9 additions and 16 deletions
|
@ -31,16 +31,6 @@ QT_BEGIN_NAMESPACE
|
|||
static bool cupsLoaded = false;
|
||||
static int qt_cups_num_printers = 0;
|
||||
|
||||
static inline void resolveCups()
|
||||
{
|
||||
cups_dest_t *printers;
|
||||
int num_printers = cupsGetDests(&printers);
|
||||
if (num_printers)
|
||||
cupsFreeDests(num_printers, printers);
|
||||
qt_cups_num_printers = num_printers;
|
||||
cupsLoaded = true;
|
||||
}
|
||||
|
||||
// ================ CUPS Support class ========================
|
||||
|
||||
QCUPSSupport::QCUPSSupport()
|
||||
|
@ -51,9 +41,6 @@ QCUPSSupport::QCUPSSupport()
|
|||
currPrinterIndex(0),
|
||||
currPPD(0)
|
||||
{
|
||||
if (!cupsLoaded)
|
||||
resolveCups();
|
||||
|
||||
// getting all available printers
|
||||
if (!isAvailable())
|
||||
return;
|
||||
|
@ -140,8 +127,14 @@ int QCUPSSupport::currentPrinterIndex() const
|
|||
|
||||
bool QCUPSSupport::isAvailable()
|
||||
{
|
||||
if(!cupsLoaded)
|
||||
resolveCups();
|
||||
if (!cupsLoaded) {
|
||||
cups_dest_t *printers = nullptr;
|
||||
int num_printers = cupsGetDests(&printers);
|
||||
if (num_printers)
|
||||
cupsFreeDests(num_printers, printers);
|
||||
qt_cups_num_printers = num_printers;
|
||||
cupsLoaded = true;
|
||||
}
|
||||
|
||||
return (qt_cups_num_printers > 0);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue