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:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/examples/xml/streambookmarks/frank.xbel

    r2 r561  
    7272        <folder folded="no">
    7373            <title>Qt</title>
    74             <bookmark href="http://doc.trolltech.com/2.3/">
     74            <bookmark href="http:///2.3/">
    7575                <title>Qt 2.3 Reference</title>
    7676            </bookmark>
    77             <bookmark href="http://doc.trolltech.com/3.3/">
     77            <bookmark href="http:///3.3/">
    7878                <title>Qt 3.3 Reference</title>
    7979            </bookmark>
    80             <bookmark href="http://doc.trolltech.com/4.0/">
     80            <bookmark href="http:///4.0/">
    8181                <title>Qt 4.0 Reference</title>
    8282            </bookmark>
    83             <bookmark href="http://qtsoftware.com/">
    84                 <title>Trolltech Home Page</title>
     83            <bookmark href="http://qt.com/">
     84                <title> Home Page</title>
    8585            </bookmark>
    8686        </folder>
  • trunk/examples/xml/streambookmarks/jennifer.xbel

    r2 r561  
    55        <title>Qt Resources</title>
    66        <folder folded="yes">
    7             <title>Trolltech Partners</title>
     7            <title> Partners</title>
    88            <bookmark href="http://partners.trolltech.com/partners/training.html">
    99                <title>Training Partners</title>
     
    4646            </bookmark>
    4747        </folder>
    48         <bookmark href="http://doc.trolltech.com/qq/">
     48        <bookmark href="http:///qq/">
    4949            <title>Qt Quarterly</title>
    5050        </bookmark>
    51         <bookmark href="http://qtsoftware.com/">
    52             <title>Trolltech's home page</title>
     51        <bookmark href="http://qt.com/">
     52            <title> home page</title>
    5353        </bookmark>
    54         <bookmark href="http://doc.trolltech.com/4.0/">
     54        <bookmark href="http:///4.0/">
    5555            <title>Qt 4.0 documentation</title>
    5656        </bookmark>
    57         <bookmark href="http://qtsoftware.com/developer/faqs/">
     57        <bookmark href="http://qt.com/developer/faqs/">
    5858            <title>Frequently Asked Questions</title>
    5959        </bookmark>
  • trunk/examples/xml/streambookmarks/main.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 examples 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**
  • trunk/examples/xml/streambookmarks/mainwindow.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 examples 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**
     
    9292    if (!reader.read(&file)) {
    9393        QMessageBox::warning(this, tr("QXmlStream Bookmarks"),
    94                              tr("Parse error in file %1 at line %2, column %3:\n%4")
     94                             tr("Parse error in file %1")
    9595                             .arg(fileName)
    96                              .arg(reader.lineNumber())
    97                              .arg(reader.columnNumber())
    9896                             .arg(reader.errorString()));
    9997    } else {
     
    142140{
    143141    openAct = new QAction(tr("&Open..."), this);
    144     openAct->setShortcut(tr("Ctrl+O"));
     142    openAct->setShortcut);
    145143    connect(openAct, SIGNAL(triggered()), this, SLOT(open()));
    146144
    147145    saveAsAct = new QAction(tr("&Save As..."), this);
    148     saveAsAct->setShortcut(tr("Ctrl+S"));
     146    saveAsAct->setShortcut);
    149147    connect(saveAsAct, SIGNAL(triggered()), this, SLOT(saveAs()));
    150148
    151149    exitAct = new QAction(tr("E&xit"), this);
    152     exitAct->setShortcut(tr("Ctrl+Q"));
     150    exitAct->setShortcut);
    153151    connect(exitAct, SIGNAL(triggered()), this, SLOT(close()));
    154152
  • trunk/examples/xml/streambookmarks/mainwindow.h

    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 examples 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**
  • trunk/examples/xml/streambookmarks/streambookmarks.pro

    r2 r561  
    1313sources.path = $$[QT_INSTALL_EXAMPLES]/xml/streambookmarks
    1414INSTALLS += target sources
     15
     16
  • trunk/examples/xml/streambookmarks/xbelreader.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 examples 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**
     
    6161bool XbelReader::read(QIODevice *device)
    6262{
    63     setDevice(device);
     63    setDevice(device);
    6464
    65     while (!atEnd()) {
    66         readNext();
    67 
    68         if (isStartElement()) {
    69             if (name() == "xbel" && attributes().value("version") == "1.0")
    70                 readXBEL();
    71             else
    72                 raiseError(QObject::tr("The file is not an XBEL version 1.0 file."));
    73         }
     65    if (xml.readNextStartElement()) {
     66        if (xml.name() == "xbel" && xml.attributes().value("version") == "1.0")
     67            readXBEL();
     68        else
     69            xml.raiseError(QObject::tr("The file is not an XBEL version 1.0 file."));
    7470    }
    7571
    76     return !error();
     72    return !error();
    7773}
    7874//! [1]
    7975
    8076//! [2]
    81 void XbelReader::readUnknownElement()
     77QString XbelReader::errorString() const
    8278{
    83     Q_ASSERT(isStartElement());
    84 
    85     while (!atEnd()) {
    86         readNext();
    87 
    88         if (isEndElement())
    89             break;
    90 
    91         if (isStartElement())
    92             readUnknownElement();
    93     }
     79    return QObject::tr("%1\nLine %2, column %3")
     80            .arg(xml.errorString())
     81            .arg(xml.lineNumber())
     82            .arg(xml.columnNumber());
    9483}
    9584//! [2]
     
    9887void XbelReader::readXBEL()
    9988{
    100     Q_ASSERT(isStartElement() && name() == "xbel");
     89    Q_ASSERT(name() == "xbel");
    10190
    102     while (!atEnd()) {
    103         readNext();
    104 
    105         if (isEndElement())
    106             break;
    107 
    108         if (isStartElement()) {
    109             if (name() == "folder")
    110                 readFolder(0);
    111             else if (name() == "bookmark")
    112                 readBookmark(0);
    113             else if (name() == "separator")
    114                 readSeparator(0);
    115             else
    116                 readUnknownElement();
    117         }
     91    while (xml.readNextStartElement()) {
     92        if (xml.name() == "folder")
     93            readFolder(0);
     94        else if (xml.name() == "bookmark")
     95            readBookmark(0);
     96        else if (xml.name() == "separator")
     97            readSeparator(0);
     98        else
     99            xml.skipCurrentElement();
    118100    }
    119101}
     
    123105void XbelReader::readTitle(QTreeWidgetItem *item)
    124106{
    125     Q_ASSERT(isStartElement() && name() == "title");
     107    Q_ASSERT(name() == "title");
    126108
    127     QString title = readElementText();
     109    QString title = readElementText();
    128110    item->setText(0, title);
    129111}
     
    133115void XbelReader::readSeparator(QTreeWidgetItem *item)
    134116{
     117
     118
    135119    QTreeWidgetItem *separator = createChildItem(item);
    136120    separator->setFlags(item->flags() & ~Qt::ItemIsSelectable);
    137121    separator->setText(0, QString(30, 0xB7));
    138     readElementText();
     122    t();
    139123}
    140124//! [5]
     
    142126void XbelReader::readFolder(QTreeWidgetItem *item)
    143127{
    144     Q_ASSERT(isStartElement() && name() == "folder");
     128    Q_ASSERT(name() == "folder");
    145129
    146130    QTreeWidgetItem *folder = createChildItem(item);
    147     bool folded = (attributes().value("folded") != "no");
     131    bool folded = (attributes().value("folded") != "no");
    148132    treeWidget->setItemExpanded(folder, !folded);
    149133
    150     while (!atEnd()) {
    151         readNext();
    152 
    153         if (isEndElement())
    154             break;
    155 
    156         if (isStartElement()) {
    157             if (name() == "title")
    158                 readTitle(folder);
    159             else if (name() == "folder")
    160                 readFolder(folder);
    161             else if (name() == "bookmark")
    162                 readBookmark(folder);
    163             else if (name() == "separator")
    164                 readSeparator(folder);
    165             else
    166                 readUnknownElement();
    167         }
     134    while (xml.readNextStartElement()) {
     135        if (xml.name() == "title")
     136            readTitle(folder);
     137        else if (xml.name() == "folder")
     138            readFolder(folder);
     139        else if (xml.name() == "bookmark")
     140            readBookmark(folder);
     141        else if (xml.name() == "separator")
     142            readSeparator(folder);
     143        else
     144            xml.skipCurrentElement();
    168145    }
    169146}
     
    171148void XbelReader::readBookmark(QTreeWidgetItem *item)
    172149{
    173     Q_ASSERT(isStartElement() && name() == "bookmark");
     150    Q_ASSERT(name() == "bookmark");
    174151
    175152    QTreeWidgetItem *bookmark = createChildItem(item);
     
    177154    bookmark->setIcon(0, bookmarkIcon);
    178155    bookmark->setText(0, QObject::tr("Unknown title"));
    179     bookmark->setText(1, attributes().value("href").toString());
    180     while (!atEnd()) {
    181         readNext();
     156    bookmark->setText(1, xml.attributes().value("href").toString());
    182157
    183         if (isEndElement())
    184             break;
    185 
    186         if (isStartElement()) {
    187             if (name() == "title")
    188                 readTitle(bookmark);
    189             else
    190                 readUnknownElement();
    191         }
     158    while (xml.readNextStartElement()) {
     159        if (xml.name() == "title")
     160            readTitle(bookmark);
     161        else
     162            xml.skipCurrentElement();
    192163    }
    193164}
     
    201172        childItem = new QTreeWidgetItem(treeWidget);
    202173    }
    203     childItem->setData(0, Qt::UserRole, name().toString());
     174    childItem->setData(0, Qt::UserRole, name().toString());
    204175    return childItem;
    205176}
  • trunk/examples/xml/streambookmarks/xbelreader.h

    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 examples 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**
     
    5252
    5353//! [0]
    54 class XbelReader : public QXmlStreamReader
     54class XbelReader
    5555{
    5656public:
     
    6161    bool read(QIODevice *device);
    6262
     63
     64
    6365private:
    6466//! [2]
    65     void readUnknownElement();
    6667    void readXBEL();
    6768    void readTitle(QTreeWidgetItem *item);
     
    7273    QTreeWidgetItem *createChildItem(QTreeWidgetItem *item);
    7374
     75
    7476    QTreeWidget *treeWidget;
    7577//! [2]
  • trunk/examples/xml/streambookmarks/xbelwriter.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 examples 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**
     
    4848    : treeWidget(treeWidget)
    4949{
    50     setAutoFormatting(true);
     50    setAutoFormatting(true);
    5151}
    5252//! [0]
     
    5555bool XbelWriter::writeFile(QIODevice *device)
    5656{
    57     setDevice(device);
     57    setDevice(device);
    5858
    59     writeStartDocument();
    60     writeDTD("<!DOCTYPE xbel>");
    61     writeStartElement("xbel");
    62     writeAttribute("version", "1.0");
     59    writeStartDocument();
     60    writeDTD("<!DOCTYPE xbel>");
     61    writeStartElement("xbel");
     62    writeAttribute("version", "1.0");
    6363    for (int i = 0; i < treeWidget->topLevelItemCount(); ++i)
    6464        writeItem(treeWidget->topLevelItem(i));
    6565
    66     writeEndDocument();
     66    writeEndDocument();
    6767    return true;
    6868}
     
    7575    if (tagName == "folder") {
    7676        bool folded = !treeWidget->isItemExpanded(item);
    77         writeStartElement(tagName);
    78         writeAttribute("folded", folded ? "yes" : "no");
    79         writeTextElement("title", item->text(0));
     77        writeStartElement(tagName);
     78        writeAttribute("folded", folded ? "yes" : "no");
     79        writeTextElement("title", item->text(0));
    8080        for (int i = 0; i < item->childCount(); ++i)
    8181            writeItem(item->child(i));
    82         writeEndElement();
     82        writeEndElement();
    8383    } else if (tagName == "bookmark") {
    84         writeStartElement(tagName);
     84        writeStartElement(tagName);
    8585        if (!item->text(1).isEmpty())
    86             writeAttribute("href", item->text(1));
    87         writeTextElement("title", item->text(0));
    88         writeEndElement();
     86            writeAttribute("href", item->text(1));
     87        writeTextElement("title", item->text(0));
     88        writeEndElement();
    8989    } else if (tagName == "separator") {
    90         writeEmptyElement(tagName);
     90        writeEmptyElement(tagName);
    9191    }
    9292}
  • trunk/examples/xml/streambookmarks/xbelwriter.h

    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 examples 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**
     
    5151
    5252//! [0]
    53 class XbelWriter : public QXmlStreamWriter
     53class XbelWriter
    5454{
    5555public:
     
    5959private:
    6060    void writeItem(QTreeWidgetItem *item);
     61
    6162    QTreeWidget *treeWidget;
    6263};
Note: See TracChangeset for help on using the changeset viewer.