Changeset 561 for trunk/tools/qdbus


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/tools/qdbus/qdbus/qdbus.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 tools applications 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**
     
    109109static void listObjects(const QString &service, const QString &path)
    110110{
    111     QDBusInterface iface(service, path.isEmpty() ? QLatin1String("/") : path,
    112                          QLatin1String("org.freedesktop.DBus.Introspectable"), connection);
    113     if (!iface.isValid()) {
    114         QDBusError err(iface.lastError());
    115         fprintf(stderr, "Cannot introspect object %s at %s:\n%s (%s)\n",
    116                 qPrintable(path.isEmpty() ? QString(QLatin1String("/")) : path), qPrintable(service),
    117                 qPrintable(err.name()), qPrintable(err.message()));
    118         exit(1);
    119     }
    120     QDBusReply<QString> xml = iface.call(QLatin1String("Introspect"));
    121 
    122     if (!xml.isValid())
    123         return;                 // silently
     111    // make a low-level call, to avoid introspecting the Introspectable interface
     112    QDBusMessage call = QDBusMessage::createMethodCall(service, path.isEmpty() ? QLatin1String("/") : path,
     113                                                       QLatin1String("org.freedesktop.DBus.Introspectable"),
     114                                                       QLatin1String("Introspect"));
     115    QDBusReply<QString> xml = connection.call(call);
     116
     117    if (path.isEmpty()) {
     118        // top-level
     119        if (xml.isValid()) {
     120            printf("/\n");
     121        } else {
     122            QDBusError err = xml.error();
     123            if (err.type() == QDBusError::ServiceUnknown)
     124                fprintf(stderr, "Service '%s' does not exist.\n", qPrintable(service));
     125            else
     126                printf("Error: %s\n%s\n", qPrintable(err.name()), qPrintable(err.message()));
     127            exit(2);
     128        }
     129    } else if (!xml.isValid()) {
     130        // this is not the first object, just fail silently
     131        return;
     132    }
    124133
    125134    QDomDocument doc;
     
    193202static void listAllInterfaces(const QString &service, const QString &path)
    194203{
    195     QDBusInterface iface(service, path, QLatin1String("org.freedesktop.DBus.Introspectable"), connection);
    196     if (!iface.isValid()) {
    197         QDBusError err(iface.lastError());
    198         fprintf(stderr, "Cannot introspect object %s at %s:\n%s (%s)\n",
    199                 qPrintable(path), qPrintable(service),
    200                 qPrintable(err.name()), qPrintable(err.message()));
    201         exit(1);
    202     }
    203     QDBusReply<QString> xml = iface.call(QLatin1String("Introspect"));
    204 
    205     if (!xml.isValid())
    206         return;                 // silently
     204    // make a low-level call, to avoid introspecting the Introspectable interface
     205    QDBusMessage call = QDBusMessage::createMethodCall(service, path.isEmpty() ? QLatin1String("/") : path,
     206                                                       QLatin1String("org.freedesktop.DBus.Introspectable"),
     207                                                       QLatin1String("Introspect"));
     208    QDBusReply<QString> xml = connection.call(call);
     209
     210    if (!xml.isValid()) {
     211        QDBusError err = xml.error();
     212        if (err.type() == QDBusError::ServiceUnknown)
     213            fprintf(stderr, "Service '%s' does not exist.\n", qPrintable(service));
     214        else
     215            printf("Error: %s\n%s\n", qPrintable(err.name()), qPrintable(err.message()));
     216        exit(2);
     217    }
    207218
    208219    QDomDocument doc;
     
    242253{
    243254    QDBusInterface iface(service, path, interface, connection);
    244     if (!iface.isValid()) {
    245         QDBusError err(iface.lastError());
    246         fprintf(stderr, "Interface '%s' not available in object %s at %s:\n%s (%s)\n",
    247                 qPrintable(interface), qPrintable(path), qPrintable(service),
    248                 qPrintable(err.name()), qPrintable(err.message()));
    249         exit(1);
    250     }
     255
     256    // Don't check whether the interface is valid to allow DBus try to
     257    // activate the service if possible.
    251258
    252259    QVariantList params;
     
    345352    if (reply.type() == QDBusMessage::ErrorMessage) {
    346353        QDBusError err = reply;
    347         printf("Error: %s\n%s\n", qPrintable(err.name()), qPrintable(err.message()));
     354        if (err.type() == QDBusError::ServiceUnknown)
     355            fprintf(stderr, "Service '%s' does not exist.\n", qPrintable(service));
     356        else
     357            printf("Error: %s\n%s\n", qPrintable(err.name()), qPrintable(err.message()));
    348358        exit(2);
    349359    } else if (reply.type() != QDBusMessage::ReplyMessage) {
     
    439449        exit(1);
    440450    }
    441     if (!bus->isServiceRegistered(service)) {
    442         fprintf(stderr, "Service '%s' does not exist.\n", qPrintable(service));
    443         exit(1);
    444     }
    445451
    446452    if (args.isEmpty()) {
    447         printf("/\n");
    448453        listObjects(service, QString());
    449454        exit(0);
  • trunk/tools/qdbus/qdbuscpp2xml/qdbuscpp2xml.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 tools applications 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**
  • trunk/tools/qdbus/qdbusviewer/main.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 tools applications 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**
  • trunk/tools/qdbus/qdbusviewer/propertydialog.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 tools applications 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**
  • trunk/tools/qdbus/qdbusviewer/propertydialog.h

    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 tools applications 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**
  • trunk/tools/qdbus/qdbusviewer/qdbusmodel.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 tools applications 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**
  • trunk/tools/qdbus/qdbusviewer/qdbusmodel.h

    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 tools applications 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**
  • trunk/tools/qdbus/qdbusviewer/qdbusviewer.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 tools applications 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**
     
    7777    tree->setContextMenuPolicy(Qt::CustomContextMenu);
    7878
    79     connect(tree, SIGNAL(activated(const QModelIndex&)), this, SLOT(activate(const QModelIndex&)));
     79    connect(tree, SIGNAL(activated(QModelIndex)), this, SLOT(activate(QModelIndex)));
    8080
    8181    refreshAction = new QAction(tr("&Refresh"), tree);
     
    442442    QMessageBox box(this);
    443443
    444     // TODO: Remove these variables for 4.6.0.  Must keep this way for 4.5.x due to string freeze.
    445     QString edition;
    446     QString info;
    447     QString moreInfo;
    448 
    449444    box.setText(QString::fromLatin1("<center><img src=\":/trolltech/qdbusviewer/images/qdbusviewer-128.png\">"
    450445                "<h3>%1</h3>"
    451                 "<p>Version %2 %3</p></center>"
    452                 "<p>%4</p>"
    453                 "<p>%5</p>"
    454                 "<p>Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).</p>"
    455                 "<p>The program is provided AS IS with NO WARRANTY OF ANY KIND,"
    456                 " INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A"
    457                 " PARTICULAR PURPOSE.<p/>")
    458             .arg(tr("D-Bus Viewer")).arg(QLatin1String(QT_VERSION_STR)).arg(edition).arg(info).arg(moreInfo));
     446                "<p>Version %2</p></center>"
     447                "<p>Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).</p>")
     448            .arg(tr("D-Bus Viewer")).arg(QLatin1String(QT_VERSION_STR)));
    459449    box.setWindowTitle(tr("D-Bus Viewer"));
    460450    box.exec();
  • trunk/tools/qdbus/qdbusviewer/qdbusviewer.h

    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 tools applications 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**
  • trunk/tools/qdbus/qdbusxml2cpp/qdbusxml2cpp.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 tools applications 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**
     
    8383    "Usage: " PROGRAMNAME " [options...] [xml-or-xml-file] [interfaces...]\n"
    8484    "Produces the C++ code to implement the interfaces defined in the input file.\n"
    85     "If no options are given, the code is written to the standard output.\n"
    8685    "\n"
    8786    "Options:\n"
     
    10099    "program will automatically append the suffixes and produce both files.\n"
    101100    "You can also use a colon (:) to separate the header name from the source file\n"
    102     "name, as in '-a filename_p.h:filename.cpp'.\n";
     101    "name, as in '-a filename_p.h:filename.cpp'.\n"
     102    "\n"
     103    "If you pass a dash (-) as the argument to either -p or -a, the output is written\n"
     104    "to the standard output\n";
    103105
    104106static const char includeList[] =
     
    612614            // getter:
    613615            if (property.access != QDBusIntrospection::Property::Write) {
    614                 hs << "    inline " << type << " " << getter << "() const" << endl;
    615                 if (type != "QVariant")
    616                     hs << "    { return qvariant_cast< " << type << " >(internalPropGet(\""
    617                        << property.name << "\")); }" << endl;
    618                 else
    619                     hs << "    { return internalPropGet(\"" << property.name << "\"); }" << endl;
     616                hs << "    inline " << type << " " << getter << "() const" << endl
     617                    << "    { return qvariant_cast< " << type << " >(property(\""
     618                    << property.name << "\")); }" << endl;
    620619            }
    621620
     
    623622            if (property.access != QDBusIntrospection::Property::Read) {
    624623                hs << "    inline void " << setter << "(" << constRefArg(type) << "value)" << endl
    625                    << "    { internalPropSet(\"" << property.name
     624                   << "    { setProperty(\"" << property.name
    626625                   << "\", qVariantFromValue(value)); }" << endl;
    627626            }
Note: See TracChangeset for help on using the changeset viewer.