Changeset 561 for trunk/src/gui/painting/qprinterinfo_unix.cpp
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/vendor/nokia/qt/4.6.1 merged eligible /branches/vendor/nokia/qt/current merged eligible /branches/vendor/trolltech/qt/current 3-149
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/src/gui/painting/qprinterinfo_unix.cpp
r2 r561 2 2 ** 3 3 ** 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]) 5 6 ** 6 7 ** This file is part of the QtGui module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 76 76 bool m_isNull; 77 77 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; 79 81 80 82 QPrinterInfo* q_ptr; … … 82 84 83 85 static QPrinterInfoPrivate nullQPrinterInfoPrivate; 86 87 88 89 90 91 92 93 94 95 84 96 85 97 ///////////////////////////////////////////////////////////////////////////// … … 412 424 int qt_retrieveNisPrinters(QList<QPrinterDescription> *printers) 413 425 { 426 414 427 typedef int (*WildCast)(int, char *, int, char *, int, char *); 415 428 char printersConfByname[] = "printers.conf.byname"; … … 435 448 return Success; 436 449 } 450 437 451 return Unavail; 438 452 } … … 823 837 QString printerName(QString::fromLocal8Bit(cupsPrinters[i].name)); 824 838 if (cupsPrinters[i].instance) 825 printerName += QLatin1 String("/") + QString::fromLocal8Bit(cupsPrinters[i].instance);839 printerName += QLatin1) + QString::fromLocal8Bit(cupsPrinters[i].instance); 826 840 list.append(QPrinterInfo(printerName)); 827 841 if (cupsPrinters[i].is_default) 828 842 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; 839 844 } 840 845 } else { … … 868 873 869 874 QPrinterInfo::QPrinterInfo() 870 { 871 d_ptr = &nullQPrinterInfoPrivate; 875 : d_ptr(&nullQPrinterInfoPrivate) 876 { 872 877 } 873 878 874 879 QPrinterInfo::QPrinterInfo(const QPrinterInfo& src) 875 { 876 d_ptr = &nullQPrinterInfoPrivate; 880 : d_ptr(&nullQPrinterInfoPrivate) 881 { 877 882 *this = src; 878 883 } 879 884 880 885 QPrinterInfo::QPrinterInfo(const QPrinter& printer) 881 { 882 d_ptr = new QPrinterInfoPrivate(printer.printerName()); 886 : d_ptr(new QPrinterInfoPrivate(printer.printerName())) 887 { 883 888 884 889 Q_D(QPrinterInfo); … … 894 899 QString printerName(QString::fromLocal8Bit(cupsPrinters[i].name)); 895 900 if (cupsPrinters[i].instance) 896 printerName += QLatin1 String("/") + QString::fromLocal8Bit(cupsPrinters[i].instance);901 printerName += QLatin1) + QString::fromLocal8Bit(cupsPrinters[i].instance); 897 902 if (printerName == printer.printerName()) { 898 903 if (cupsPrinters[i].is_default) 899 904 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; 910 906 return; 911 907 } … … 930 926 931 927 // Printer not found. 932 delete d; 933 d_ptr = &nullQPrinterInfoPrivate; 928 d_ptr.reset(&nullQPrinterInfoPrivate); 934 929 } 935 930 936 931 QPrinterInfo::QPrinterInfo(const QString& name) 937 { 938 d_ptr = new QPrinterInfoPrivate(name); 932 : d_ptr(new QPrinterInfoPrivate(name)) 933 { 939 934 d_ptr->q_ptr = this; 940 935 } … … 942 937 QPrinterInfo::~QPrinterInfo() 943 938 { 944 if (d_ptr != &nullQPrinterInfoPrivate)945 delete d_ptr;946 939 } 947 940 … … 949 942 { 950 943 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)); 954 945 d_ptr->q_ptr = this; 955 946 return *this; … … 977 968 { 978 969 const Q_D(QPrinterInfo); 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 979 990 return d->m_paperSizes; 980 991 } … … 987 998 m_isNull = true; 988 999 m_default = false; 1000 1001 989 1002 q_ptr = 0; 990 1003 } … … 995 1008 m_isNull = false; 996 1009 m_default = false; 1010 1011 997 1012 q_ptr = 0; 998 1013 }
Note:
See TracChangeset
for help on using the changeset viewer.