Qt 4.8
Typedefs | Functions | Variables
qcups.cpp File Reference
#include <qdebug.h>
#include "qcups_p.h"
#include <cups/language.h>
#include <qtextcodec.h>

Go to the source code of this file.

Typedefs

typedef int(* CupsAddOption) (const char *name, const char *value, int num_options, cups_option_t **options)
 
typedef void(* CupsFreeDests) (int num_dests, cups_dest_t *dests)
 
typedef void(* CupsFreeOptions) (int num_options, cups_option_t *options)
 
typedef int(* CupsGetDests) (cups_dest_t **dests)
 
typedef const char *(* CupsGetPPD) (const char *printer)
 
typedef const char *(* CupsLangEncoding) (cups_lang_t *language)
 
typedef cups_lang_t *(* CupsLangGet) (const char *language)
 
typedef int(* CupsMarkOptions) (ppd_file_t *ppd, int num_options, cups_option_t *options)
 
typedef int(* CupsPrintFile) (const char *name, const char *filename, const char *title, int num_options, cups_option_t *options)
 
typedef void(* CupsSetDests) (int num_dests, cups_dest_t *dests)
 
typedef int(* CupsTempFd) (char *name, int len)
 
typedef void(* PPDClose) (ppd_file_t *ppd)
 
typedef void(* PPDMarkDefaults) (ppd_file_t *ppd)
 
typedef int(* PPDMarkOption) (ppd_file_t *ppd, const char *keyword, const char *option)
 
typedef ppd_file_t *(* PPDOpenFile) (const char *filename)
 

Functions

static void resolveCups ()
 

Variables

static CupsAddOption _cupsAddOption = 0
 
static CupsFreeDests _cupsFreeDests = 0
 
static CupsFreeOptions _cupsFreeOptions = 0
 
static CupsGetDests _cupsGetDests = 0
 
static CupsGetPPD _cupsGetPPD = 0
 
static CupsLangEncoding _cupsLangEncoding = 0
 
static CupsLangGet _cupsLangGet = 0
 
static CupsMarkOptions _cupsMarkOptions = 0
 
static CupsPrintFile _cupsPrintFile = 0
 
static CupsSetDests _cupsSetDests = 0
 
static CupsTempFd _cupsTempFd = 0
 
static PPDClose _ppdClose = 0
 
static PPDMarkDefaults _ppdMarkDefaults = 0
 
static PPDMarkOption _ppdMarkOption = 0
 
static PPDOpenFile _ppdOpenFile = 0
 
static bool cupsLoaded = false
 
static int qt_cups_num_printers = 0
 

Typedef Documentation

◆ CupsAddOption

typedef int(* CupsAddOption) (const char *name, const char *value, int num_options, cups_option_t **options)

Definition at line 66 of file qcups.cpp.

◆ CupsFreeDests

typedef void(* CupsFreeDests) (int num_dests, cups_dest_t *dests)

Definition at line 54 of file qcups.cpp.

◆ CupsFreeOptions

typedef void(* CupsFreeOptions) (int num_options, cups_option_t *options)

Definition at line 62 of file qcups.cpp.

◆ CupsGetDests

typedef int(* CupsGetDests) (cups_dest_t **dests)

Definition at line 53 of file qcups.cpp.

◆ CupsGetPPD

typedef const char*(* CupsGetPPD) (const char *printer)

Definition at line 55 of file qcups.cpp.

◆ CupsLangEncoding

typedef const char*(* CupsLangEncoding) (cups_lang_t *language)

Definition at line 65 of file qcups.cpp.

◆ CupsLangGet

typedef cups_lang_t*(* CupsLangGet) (const char *language)

Definition at line 64 of file qcups.cpp.

◆ CupsMarkOptions

typedef int(* CupsMarkOptions) (ppd_file_t *ppd, int num_options, cups_option_t *options)

Definition at line 56 of file qcups.cpp.

◆ CupsPrintFile

typedef int(* CupsPrintFile) (const char *name, const char *filename, const char *title, int num_options, cups_option_t *options)

Definition at line 68 of file qcups.cpp.

◆ CupsSetDests

typedef void(* CupsSetDests) (int num_dests, cups_dest_t *dests)

Definition at line 63 of file qcups.cpp.

◆ CupsTempFd

typedef int(* CupsTempFd) (char *name, int len)

Definition at line 67 of file qcups.cpp.

◆ PPDClose

typedef void(* PPDClose) (ppd_file_t *ppd)

Definition at line 60 of file qcups.cpp.

◆ PPDMarkDefaults

typedef void(* PPDMarkDefaults) (ppd_file_t *ppd)

Definition at line 58 of file qcups.cpp.

◆ PPDMarkOption

typedef int(* PPDMarkOption)(ppd_file_t *ppd, const char *keyword, const char *option)

Definition at line 59 of file qcups.cpp.

◆ PPDOpenFile

typedef ppd_file_t*(* PPDOpenFile) (const char *filename)

Definition at line 57 of file qcups.cpp.

Function Documentation

◆ resolveCups()

static void resolveCups ( )
static

Definition at line 88 of file qcups.cpp.

Referenced by QCUPSSupport::isAvailable(), and QCUPSSupport::QCUPSSupport().

89 {
90  QLibrary cupsLib(QLatin1String("cups"), 2);
91  if(cupsLib.load()) {
92  _cupsGetDests = (CupsGetDests) cupsLib.resolve("cupsGetDests");
93  _cupsFreeDests = (CupsFreeDests) cupsLib.resolve("cupsFreeDests");
94  _cupsGetPPD = (CupsGetPPD) cupsLib.resolve("cupsGetPPD");
95  _cupsLangGet = (CupsLangGet) cupsLib.resolve("cupsLangGet");
96  _cupsLangEncoding = (CupsLangEncoding) cupsLib.resolve("cupsLangEncoding");
97  _ppdOpenFile = (PPDOpenFile) cupsLib.resolve("ppdOpenFile");
98  _ppdMarkDefaults = (PPDMarkDefaults) cupsLib.resolve("ppdMarkDefaults");
99  _ppdClose = (PPDClose) cupsLib.resolve("ppdClose");
100  _cupsMarkOptions = (CupsMarkOptions) cupsLib.resolve("cupsMarkOptions");
101  _ppdMarkOption = (PPDMarkOption) cupsLib.resolve("ppdMarkOption");
102  _cupsFreeOptions = (CupsFreeOptions) cupsLib.resolve("cupsFreeOptions");
103  _cupsSetDests = (CupsSetDests) cupsLib.resolve("cupsSetDests");
104  _cupsAddOption = (CupsAddOption) cupsLib.resolve("cupsAddOption");
105  _cupsTempFd = (CupsTempFd) cupsLib.resolve("cupsTempFd");
106  _cupsPrintFile = (CupsPrintFile) cupsLib.resolve("cupsPrintFile");
107 
108  if (_cupsGetDests && _cupsFreeDests) {
109  cups_dest_t *printers;
110  int num_printers = _cupsGetDests(&printers);
111  if (num_printers)
112  _cupsFreeDests(num_printers, printers);
113  qt_cups_num_printers = num_printers;
114  }
115  }
116  cupsLoaded = true;
117 }
static PPDMarkOption _ppdMarkOption
Definition: qcups.cpp:79
static CupsGetPPD _cupsGetPPD
Definition: qcups.cpp:74
int(* CupsTempFd)(char *name, int len)
Definition: qcups.cpp:67
int(* CupsMarkOptions)(ppd_file_t *ppd, int num_options, cups_option_t *options)
Definition: qcups.cpp:56
void(* CupsSetDests)(int num_dests, cups_dest_t *dests)
Definition: qcups.cpp:63
static CupsLangEncoding _cupsLangEncoding
Definition: qcups.cpp:83
static int qt_cups_num_printers
Definition: qcups.cpp:71
static CupsAddOption _cupsAddOption
Definition: qcups.cpp:84
static CupsSetDests _cupsSetDests
Definition: qcups.cpp:81
static CupsMarkOptions _cupsMarkOptions
Definition: qcups.cpp:78
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
static CupsPrintFile _cupsPrintFile
Definition: qcups.cpp:86
void(* PPDMarkDefaults)(ppd_file_t *ppd)
Definition: qcups.cpp:58
int(* PPDMarkOption)(ppd_file_t *ppd, const char *keyword, const char *option)
Definition: qcups.cpp:59
static PPDMarkDefaults _ppdMarkDefaults
Definition: qcups.cpp:76
static CupsFreeDests _cupsFreeDests
Definition: qcups.cpp:73
ppd_file_t *(* PPDOpenFile)(const char *filename)
Definition: qcups.cpp:57
int(* CupsGetDests)(cups_dest_t **dests)
Definition: qcups.cpp:53
static CupsFreeOptions _cupsFreeOptions
Definition: qcups.cpp:80
static CupsGetDests _cupsGetDests
Definition: qcups.cpp:72
void(* CupsFreeDests)(int num_dests, cups_dest_t *dests)
Definition: qcups.cpp:54
int(* CupsPrintFile)(const char *name, const char *filename, const char *title, int num_options, cups_option_t *options)
Definition: qcups.cpp:68
const char *(* CupsLangEncoding)(cups_lang_t *language)
Definition: qcups.cpp:65
static bool cupsLoaded
Definition: qcups.cpp:70
const char *(* CupsGetPPD)(const char *printer)
Definition: qcups.cpp:55
void(* PPDClose)(ppd_file_t *ppd)
Definition: qcups.cpp:60
void(* CupsFreeOptions)(int num_options, cups_option_t *options)
Definition: qcups.cpp:62
static PPDClose _ppdClose
Definition: qcups.cpp:77
int(* CupsAddOption)(const char *name, const char *value, int num_options, cups_option_t **options)
Definition: qcups.cpp:66
static PPDOpenFile _ppdOpenFile
Definition: qcups.cpp:75
static CupsTempFd _cupsTempFd
Definition: qcups.cpp:85
cups_lang_t *(* CupsLangGet)(const char *language)
Definition: qcups.cpp:64
static CupsLangGet _cupsLangGet
Definition: qcups.cpp:82
The QLibrary class loads shared libraries at runtime.
Definition: qlibrary.h:62

Variable Documentation

◆ _cupsAddOption

CupsAddOption _cupsAddOption = 0
static

Definition at line 84 of file qcups.cpp.

Referenced by QCUPSSupport::isAvailable(), resolveCups(), and QCUPSSupport::saveOptions().

◆ _cupsFreeDests

CupsFreeDests _cupsFreeDests = 0
static

Definition at line 73 of file qcups.cpp.

Referenced by QCUPSSupport::isAvailable(), resolveCups(), and QCUPSSupport::~QCUPSSupport().

◆ _cupsFreeOptions

CupsFreeOptions _cupsFreeOptions = 0
static

Definition at line 80 of file qcups.cpp.

Referenced by QCUPSSupport::isAvailable(), resolveCups(), and QCUPSSupport::saveOptions().

◆ _cupsGetDests

CupsGetDests _cupsGetDests = 0
static

Definition at line 72 of file qcups.cpp.

Referenced by QCUPSSupport::isAvailable(), QCUPSSupport::QCUPSSupport(), and resolveCups().

◆ _cupsGetPPD

CupsGetPPD _cupsGetPPD = 0
static

◆ _cupsLangEncoding

CupsLangEncoding _cupsLangEncoding = 0
static

Definition at line 83 of file qcups.cpp.

Referenced by QCUPSSupport::isAvailable(), QCUPSSupport::QCUPSSupport(), and resolveCups().

◆ _cupsLangGet

CupsLangGet _cupsLangGet = 0
static

Definition at line 82 of file qcups.cpp.

Referenced by QCUPSSupport::isAvailable(), QCUPSSupport::QCUPSSupport(), and resolveCups().

◆ _cupsMarkOptions

CupsMarkOptions _cupsMarkOptions = 0
static

◆ _cupsPrintFile

CupsPrintFile _cupsPrintFile = 0
static

Definition at line 86 of file qcups.cpp.

Referenced by QCUPSSupport::printFile(), and resolveCups().

◆ _cupsSetDests

CupsSetDests _cupsSetDests = 0
static

Definition at line 81 of file qcups.cpp.

Referenced by QCUPSSupport::isAvailable(), resolveCups(), and QCUPSSupport::saveOptions().

◆ _cupsTempFd

CupsTempFd _cupsTempFd = 0
static

Definition at line 85 of file qcups.cpp.

Referenced by resolveCups(), and QCUPSSupport::tempFd().

◆ _ppdClose

PPDClose _ppdClose = 0
static

◆ _ppdMarkDefaults

PPDMarkDefaults _ppdMarkDefaults = 0
static

◆ _ppdMarkOption

PPDMarkOption _ppdMarkOption = 0
static

Definition at line 79 of file qcups.cpp.

Referenced by QCUPSSupport::isAvailable(), QCUPSSupport::markOption(), and resolveCups().

◆ _ppdOpenFile

PPDOpenFile _ppdOpenFile = 0
static

◆ cupsLoaded

bool cupsLoaded = false
static

Definition at line 70 of file qcups.cpp.

Referenced by QCUPSSupport::isAvailable(), QCUPSSupport::QCUPSSupport(), and resolveCups().

◆ qt_cups_num_printers

int qt_cups_num_printers = 0
static

Definition at line 71 of file qcups.cpp.

Referenced by QCUPSSupport::isAvailable(), QCUPSSupport::QCUPSSupport(), and resolveCups().