diff options
| author | Peter Yard <peter.yard@nokia.com> | 2010-04-13 12:04:09 +1000 |
|---|---|---|
| committer | Peter Yard <peter.yard@nokia.com> | 2010-04-13 12:04:09 +1000 |
| commit | 298b8df5656e97d4b86cd8a8adba8878b1a6635c (patch) | |
| tree | 47cb395fd0958e5e9db732b5491e045f422989c0 /doc/src/snippets/service-snippets | |
| parent | 2c60c6cf7fa993fe97bc96f0fd5c1eb0c39d40b4 (diff) | |
QTMOBILITY-185 Docs. Further fixes for example documentation.
Diffstat (limited to 'doc/src/snippets/service-snippets')
10 files changed, 615 insertions, 0 deletions
diff --git a/doc/src/snippets/service-snippets/bluetoothtransfer.cpp b/doc/src/snippets/service-snippets/bluetoothtransfer.cpp new file mode 100644 index 0000000000..f1bbbe3475 --- /dev/null +++ b/doc/src/snippets/service-snippets/bluetoothtransfer.cpp @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Mobility Components. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtCore> + +#include "bluetoothtransfer.h" + +BluetoothTransfer::BluetoothTransfer(QObject *parent) + : QObject(parent) +{ +} + +//! [sendFile] +void BluetoothTransfer::sendFile(const QString &path) +{ + qDebug() << "BluetoothTransfer::sendFile()" << path; +} +//! [sendFile] diff --git a/doc/src/snippets/service-snippets/bluetoothtransfer.h b/doc/src/snippets/service-snippets/bluetoothtransfer.h new file mode 100644 index 0000000000..93faa9d21a --- /dev/null +++ b/doc/src/snippets/service-snippets/bluetoothtransfer.h @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Mobility Components. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef BLUETOOTHTRANSFER_H +#define BLUETOOTHTRANSFER_H + +#include <QObject> + +class BluetoothTransfer : public QObject +{ + Q_OBJECT +public: + BluetoothTransfer(QObject *parent = 0); + +public slots: + void sendFile(const QString &path); +}; + + +#endif diff --git a/doc/src/snippets/service-snippets/bluetoothtransferplugin.cpp b/doc/src/snippets/service-snippets/bluetoothtransferplugin.cpp new file mode 100644 index 0000000000..a09ae1129a --- /dev/null +++ b/doc/src/snippets/service-snippets/bluetoothtransferplugin.cpp @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Mobility Components. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <qserviceinterfacedescriptor.h> +#include <qabstractsecuritysession.h> +#include <qservicecontext.h> + +#include "bluetoothtransferplugin.h" +#include "bluetoothtransfer.h" + +QObject* BluetoothTransferPlugin::createInstance(const QServiceInterfaceDescriptor& descriptor, QServiceContext* context, QAbstractSecuritySession* session) +{ + Q_UNUSED(descriptor); + Q_UNUSED(context); + Q_UNUSED(session); + //! [createinstance] + return new BluetoothTransfer(this); + //! [createinstance] +} + +Q_EXPORT_PLUGIN2(serviceframework_bluetoothtransferplugin, BluetoothTransferPlugin) diff --git a/doc/src/snippets/service-snippets/bluetoothtransferplugin.h b/doc/src/snippets/service-snippets/bluetoothtransferplugin.h new file mode 100644 index 0000000000..c8efba0190 --- /dev/null +++ b/doc/src/snippets/service-snippets/bluetoothtransferplugin.h @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Mobility Components. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef BLUETOOTHTRANSFERPLUGIN_H +#define BLUETOOTHTRANSFERPLUGIN_H + +#include <QObject> + +#include <qserviceplugininterface.h> + +QTM_USE_NAMESPACE + +class BluetoothTransferPlugin : public QObject, + public QServicePluginInterface +{ + Q_OBJECT + Q_INTERFACES(QtMobility::QServicePluginInterface) +public: + QObject* createInstance(const QServiceInterfaceDescriptor& descriptor, + QServiceContext* context, + QAbstractSecuritySession* session); +}; + +#endif diff --git a/doc/src/snippets/service-snippets/filemanagerplugin.cpp b/doc/src/snippets/service-snippets/filemanagerplugin.cpp new file mode 100644 index 0000000000..a9d72e91f6 --- /dev/null +++ b/doc/src/snippets/service-snippets/filemanagerplugin.cpp @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Mobility Components. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <qserviceinterfacedescriptor.h> +#include <qabstractsecuritysession.h> +#include <qservicecontext.h> + +#include "filemanagerplugin.h" +#include "filemanagerstorage.h" +#include "filemanagertransfer.h" + +//! [createinstance-sig] +QObject* FileManagerPlugin::createInstance(const QServiceInterfaceDescriptor& descriptor, QServiceContext* context, QAbstractSecuritySession* session) +//! [createinstance-sig] +{ + Q_UNUSED(context); + Q_UNUSED(session); +//! [createinstance] + if (descriptor.interfaceName() == "com.nokia.qt.examples.FileStorage") + return new FileManagerStorage(this); + else if (descriptor.interfaceName() == "com.nokia.qt.examples.FileTransfer") + return new FileManagerTransfer(this); + else + return 0; +//! [createinstance] +} + +Q_EXPORT_PLUGIN2(serviceframework_filemanagerplugin, FileManagerPlugin) diff --git a/doc/src/snippets/service-snippets/filemanagerplugin.h b/doc/src/snippets/service-snippets/filemanagerplugin.h new file mode 100644 index 0000000000..a4431add71 --- /dev/null +++ b/doc/src/snippets/service-snippets/filemanagerplugin.h @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Mobility Components. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef FILEMANAGERPLUGIN_H +#define FILEMANAGERPLUGIN_H + +#include <QObject> + +#include <qserviceplugininterface.h> + +QTM_USE_NAMESPACE + +class FileManagerPlugin : public QObject, + public QServicePluginInterface +{ + Q_OBJECT + Q_INTERFACES(QtMobility::QServicePluginInterface) +public: + QObject* createInstance(const QServiceInterfaceDescriptor& descriptor, + QServiceContext* context, + QAbstractSecuritySession* session); +}; + +#endif diff --git a/doc/src/snippets/service-snippets/filemanagerstorage.cpp b/doc/src/snippets/service-snippets/filemanagerstorage.cpp new file mode 100644 index 0000000000..018c86b9d0 --- /dev/null +++ b/doc/src/snippets/service-snippets/filemanagerstorage.cpp @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Mobility Components. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtCore> + +#include "filemanagerstorage.h" + +FileManagerStorage::FileManagerStorage(QObject *parent) + : QObject(parent) +{ + directory = QCoreApplication::applicationDirPath(); +} + +void FileManagerStorage::setWorkingDirectory(const QString &path) +{ + directory = path; + emit workingDirectoryChanged(path); +} + +QString FileManagerStorage::workingDirectory() const +{ + return directory; +} + +void FileManagerStorage::copyFile(const QString ¤tPath, const QString &newPath) +{ + qDebug() << "FileManagerStorage::copyFile() from" << currentPath << "to" << newPath; +} diff --git a/doc/src/snippets/service-snippets/filemanagerstorage.h b/doc/src/snippets/service-snippets/filemanagerstorage.h new file mode 100644 index 0000000000..b54a2bcc16 --- /dev/null +++ b/doc/src/snippets/service-snippets/filemanagerstorage.h @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Mobility Components. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef FILEMANAGERSTORAGE_H +#define FILEMANAGERSTORAGE_H + +#include <QObject> + +class FileManagerStorage : public QObject +{ + Q_OBJECT + Q_PROPERTY(QString workingDirectory READ workingDirectory WRITE setWorkingDirectory) + +public: + FileManagerStorage(QObject *parent = 0); + + void setWorkingDirectory(const QString &path); + QString workingDirectory() const; + +signals: + void workingDirectoryChanged(const QString &newDir); + +public slots: + void copyFile(const QString ¤tPath, const QString &newPath); + +private: + QString directory; +}; + +#endif diff --git a/doc/src/snippets/service-snippets/filemanagertransfer.cpp b/doc/src/snippets/service-snippets/filemanagertransfer.cpp new file mode 100644 index 0000000000..c6a02bb588 --- /dev/null +++ b/doc/src/snippets/service-snippets/filemanagertransfer.cpp @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Mobility Components. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtCore> + +#include "filemanagertransfer.h" + +FileManagerTransfer::FileManagerTransfer(QObject *parent) + : QObject(parent) +{ +} + +void FileManagerTransfer::invokableMethod() +{ + qDebug() << "FileManagerTransfer::invokableMethod()"; +} + +void FileManagerTransfer::sendFile(const QString &path) +{ + qDebug() << "FileManagerTransfer::sendFile()" << path; +} diff --git a/doc/src/snippets/service-snippets/filemanagertransfer.h b/doc/src/snippets/service-snippets/filemanagertransfer.h new file mode 100644 index 0000000000..ee6697d4ae --- /dev/null +++ b/doc/src/snippets/service-snippets/filemanagertransfer.h @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Mobility Components. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef FILEMANAGERTRANSFER_H +#define FILEMANAGERTRANSFER_H + +#include <QObject> + +class FileManagerTransfer : public QObject +{ + Q_OBJECT +public: + FileManagerTransfer(QObject *parent = 0); + + Q_INVOKABLE void invokableMethod(); + +public slots: + void sendFile(const QString &path); +}; + +#endif |
