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/dialogs/qprintdialog_unix.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    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 have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    4545
    4646#include "private/qabstractprintdialog_p.h"
    47 #include "qfiledialog_p.h"
    4847#include <QtGui/qmessagebox.h>
    4948#include "qprintdialog.h"
    5049#include "qfiledialog.h"
    5150#include <QtCore/qdir.h>
     51#include <QtGui/qevent.h>
    5252#include <QtGui/qfilesystemmodel.h>
    5353#include <QtGui/qstyleditemdelegate.h>
     
    5656#include <QtGui/qdialogbuttonbox.h>
    5757
     58#include "qfscompleter_p.h"
    5859#include "ui_qprintpropertieswidget.h"
    5960#include "ui_qprintsettingsoutput.h"
     
    193194          selected(-1),
    194195          selDescription(0),
    195           parentItem(pi) {};
     196          parentItem(pi) {}
    196197
    197198    ~QOptionTreeItem() {
    198199        while (!childItems.isEmpty())
    199200            delete childItems.takeFirst();
    200     };
     201    }
    201202
    202203    ItemType type;
     
    238239    Q_OBJECT
    239240public:
    240     QPPDOptionsEditor(QObject* parent = 0) : QStyledItemDelegate(parent) {};
    241     ~QPPDOptionsEditor() {};
     241    QPPDOptionsEditor(QObject* parent = 0) : QStyledItemDelegate(parent) {}
     242    ~QPPDOptionsEditor() {}
    242243
    243244    QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const;
     
    670671            QString printerName(QString::fromLocal8Bit(cupsPrinters[i].name));
    671672            if (cupsPrinters[i].instance)
    672                 printerName += QLatin1String("/") + QString::fromLocal8Bit(cupsPrinters[i].instance);
     673                printerName += QLatin1Char('/') + QString::fromLocal8Bit(cupsPrinters[i].instance);
    673674
    674675            widget.printers->addItem(printerName);
     
    696697    QFileSystemModel *fsm = new QFileSystemModel(widget.filename);
    697698    fsm->setRootPath(QDir::homePath());
    698 #if !defined(QT_NO_COMPLETER) && !defined(QT_NO_FILEDIALOG)
    699     widget.filename->setCompleter(new QFSCompletor(fsm, widget.filename));
     699#if !defined(QT_NO_FSCOMPLETER) && !defined(QT_NO_FILEDIALOG)
     700    widget.filename->setCompleter(new QFSCompleter(fsm, widget.filename));
    700701#endif
    701702#endif
     
    728729        filePrintersAdded = false;
    729730    }
    730     if (printer && filePrintersAdded && printer->printerName().isEmpty()) {
     731    if (printer && filePrintersAdded && (printer->outputFormat() != QPrinter::NativeFormat
     732                                         || printer->printerName().isEmpty()))
     733    {
    731734        if (printer->outputFormat() == QPrinter::PdfFormat)
    732735            widget.printers->setCurrentIndex(widget.printers->count() - 2);
     
    812815#endif
    813816        if (lprPrinters.count() > 0) {
    814             QString type = lprPrinters.at(index).name + QLatin1String("@") + lprPrinters.at(index).host;
     817            QString type = lprPrinters.at(index).name + QLatin1Char('@') + lprPrinters.at(index).host;
    815818            if (!lprPrinters.at(index).comment.isEmpty())
    816819            type += QLatin1String(", ") + lprPrinters.at(index).comment;
     
    833836void QUnixPrintWidgetPrivate::_q_btnBrowseClicked()
    834837{
    835     const int prevPrinter = widget.printers->currentIndex();
    836     widget.printers->setCurrentIndex(widget.printers->count() - 2); // the pdf one
    837 
    838838    QString filename = widget.filename->text();
    839839#ifndef QT_NO_FILEDIALOG
     
    847847        if (filename.endsWith(QString::fromLatin1(".ps"), Qt::CaseInsensitive))
    848848            widget.printers->setCurrentIndex(widget.printers->count() - 1); // the postscript one
    849     }
    850     else
    851         widget.printers->setCurrentIndex(prevPrinter);
     849        else if (filename.endsWith(QString::fromLatin1(".pdf"), Qt::CaseInsensitive))
     850            widget.printers->setCurrentIndex(widget.printers->count() - 2); // the pdf one
     851        else if (widget.printers->currentIndex() != widget.printers->count() - 1) // if ps is not selected, pdf is default
     852            widget.printers->setCurrentIndex(widget.printers->count() - 2); // the pdf one
     853    }
    852854}
    853855
     
    11931195    switch(section){
    11941196        case 0:
    1195             return QVariant(QApplication::translate("QPPDOptionsModel","Name"));
     1197            return QVariant(QApplication::translate("QPPDOptionsModel", "Name"));
    11961198        case 1:
    1197             return QVariant(QApplication::translate("QPPDOptionsModel","Value"));
     1199            return QVariant(QApplication::translate("QPPDOptionsModel", "Value"));
    11981200        default:
    11991201            return QVariant();
Note: See TracChangeset for help on using the changeset viewer.