Ignore:
Timestamp:
Feb 11, 2010, 11:19:06 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.1 sources.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/gui/painting/qprinterinfo_unix.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    7676    bool                        m_isNull;
    7777    bool                        m_default;
    78     QList<QPrinter::PaperSize>  m_paperSizes;
     78    mutable bool                m_mustGetPaperSizes;
     79    mutable QList<QPrinter::PaperSize> m_paperSizes;
     80    int                         m_cupsPrinterIndex;
    7981
    8082    QPrinterInfo*               q_ptr;
     
    8284
    8385static QPrinterInfoPrivate nullQPrinterInfoPrivate;
     86
     87
     88
     89
     90
     91
     92
     93
     94
     95
    8496
    8597/////////////////////////////////////////////////////////////////////////////
     
    412424int qt_retrieveNisPrinters(QList<QPrinterDescription> *printers)
    413425{
     426
    414427    typedef int (*WildCast)(int, char *, int, char *, int, char *);
    415428    char printersConfByname[] = "printers.conf.byname";
     
    435448            return Success;
    436449    }
     450
    437451    return Unavail;
    438452}
     
    823837            QString printerName(QString::fromLocal8Bit(cupsPrinters[i].name));
    824838            if (cupsPrinters[i].instance)
    825                 printerName += QLatin1String("/") + QString::fromLocal8Bit(cupsPrinters[i].instance);
     839                printerName += QLatin1) + QString::fromLocal8Bit(cupsPrinters[i].instance);
    826840            list.append(QPrinterInfo(printerName));
    827841            if (cupsPrinters[i].is_default)
    828842                list[i].d_ptr->m_default = true;
    829             // Find paper sizes.
    830             cups.setCurrentPrinter(i);
    831             const ppd_option_t* sizes = cups.pageSizes();
    832             if (sizes) {
    833                 for (int j = 0; j < sizes->num_choices; ++j) {
    834                     list[i].d_ptr->m_paperSizes.append(
    835                             QPrinterInfoPrivate::string2PaperSize(
    836                             QLatin1String(sizes->choices[j].choice)));
    837                 }
    838             }
     843            list[i].d_ptr->m_cupsPrinterIndex = i;
    839844        }
    840845    } else {
     
    868873
    869874QPrinterInfo::QPrinterInfo()
    870 {
    871     d_ptr = &nullQPrinterInfoPrivate;
     875    : d_ptr(&nullQPrinterInfoPrivate)
     876{
    872877}
    873878
    874879QPrinterInfo::QPrinterInfo(const QPrinterInfo& src)
    875 {
    876     d_ptr = &nullQPrinterInfoPrivate;
     880    : d_ptr(&nullQPrinterInfoPrivate)
     881{
    877882    *this = src;
    878883}
    879884
    880885QPrinterInfo::QPrinterInfo(const QPrinter& printer)
    881 {
    882     d_ptr = new QPrinterInfoPrivate(printer.printerName());
     886    : d_ptr(new QPrinterInfoPrivate(printer.printerName()))
     887{
    883888
    884889    Q_D(QPrinterInfo);
     
    894899            QString printerName(QString::fromLocal8Bit(cupsPrinters[i].name));
    895900            if (cupsPrinters[i].instance)
    896                 printerName += QLatin1String("/") + QString::fromLocal8Bit(cupsPrinters[i].instance);
     901                printerName += QLatin1) + QString::fromLocal8Bit(cupsPrinters[i].instance);
    897902            if (printerName == printer.printerName()) {
    898903                if (cupsPrinters[i].is_default)
    899904                    d->m_default = true;
    900                 // Find paper sizes.
    901                 cups.setCurrentPrinter(i);
    902                 const ppd_option_t* sizes = cups.pageSizes();
    903                 if (sizes) {
    904                     for (int j = 0; j < sizes->num_choices; ++j) {
    905                         d->m_paperSizes.append(
    906                                 QPrinterInfoPrivate::string2PaperSize(
    907                                 QLatin1String(sizes->choices[j].choice)));
    908                     }
    909                 }
     905                d->m_cupsPrinterIndex = i;
    910906                return;
    911907            }
     
    930926
    931927    // Printer not found.
    932     delete d;
    933     d_ptr = &nullQPrinterInfoPrivate;
     928    d_ptr.reset(&nullQPrinterInfoPrivate);
    934929}
    935930
    936931QPrinterInfo::QPrinterInfo(const QString& name)
    937 {
    938     d_ptr = new QPrinterInfoPrivate(name);
     932    : d_ptr(new QPrinterInfoPrivate(name))
     933{
    939934    d_ptr->q_ptr = this;
    940935}
     
    942937QPrinterInfo::~QPrinterInfo()
    943938{
    944     if (d_ptr != &nullQPrinterInfoPrivate)
    945         delete d_ptr;
    946939}
    947940
     
    949942{
    950943    Q_ASSERT(d_ptr);
    951     if (d_ptr != &nullQPrinterInfoPrivate)
    952         delete d_ptr;
    953     d_ptr = new QPrinterInfoPrivate(*src.d_ptr);
     944    d_ptr.reset(new QPrinterInfoPrivate(*src.d_ptr));
    954945    d_ptr->q_ptr = this;
    955946    return *this;
     
    977968{
    978969    const Q_D(QPrinterInfo);
     970
     971
     972
     973
     974
     975
     976
     977
     978
     979
     980
     981
     982
     983
     984
     985
     986
     987
     988
     989
    979990    return d->m_paperSizes;
    980991}
     
    987998    m_isNull = true;
    988999    m_default = false;
     1000
     1001
    9891002    q_ptr = 0;
    9901003}
     
    9951008    m_isNull = false;
    9961009    m_default = false;
     1010
     1011
    9971012    q_ptr = 0;
    9981013}
Note: See TracChangeset for help on using the changeset viewer.