1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-14 11:02:19 +01:00
falkonOfficial/src/lib/3rdparty/qtlocalpeer.h

87 lines
2.9 KiB
C
Raw Normal View History

2011-03-02 16:57:41 +01:00
/****************************************************************************
**
2011-03-02 16:57:41 +01:00
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
2011-03-02 16:57:41 +01:00
** This file is part of a Qt Solutions component.
**
** Commercial Usage
2011-03-02 16:57:41 +01:00
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Solutions Commercial License Agreement provided
** with the Software or, alternatively, in accordance with the terms
** contained in a written agreement between you and Nokia.
**
2011-03-02 16:57:41 +01:00
** 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.
**
2011-03-02 16:57:41 +01:00
** 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.
**
** GNU General Public License Usage
2011-03-02 16:57:41 +01:00
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
2011-03-02 16:57:41 +01:00
** Please note Third Party Software included with Qt Solutions may impose
** additional restrictions and it is the user's responsibility to ensure
** that they have met the licensing requirements of the GPL, LGPL, or Qt
** Solutions Commercial license and the relevant license of the Third
** Party Software they are using.
**
2011-03-02 16:57:41 +01:00
** If you are unsure which license is appropriate for your use, please
** contact Nokia at qt-info@nokia.com.
**
2011-03-02 16:57:41 +01:00
****************************************************************************/
#include <QtNetwork/QLocalServer>
#include <QtNetwork/QLocalSocket>
#include <QtCore/QDir>
2012-02-01 18:31:50 +01:00
#if defined(Q_OS_HAIKU) || defined(Q_OS_OS2)
2012-01-13 21:20:13 +01:00
#include <unistd.h>
#endif
namespace QtLP_Private
{
2011-03-02 16:57:41 +01:00
#include "qtlockedfile.h"
}
class QtLocalPeer : public QObject
{
Q_OBJECT
public:
QtLocalPeer(QObject* parent = 0, const QString &appId = QString());
2011-03-02 16:57:41 +01:00
bool isClient();
bool sendMessage(const QString &message, int timeout);
QString applicationId() const
{ return id; }
2011-03-02 16:57:41 +01:00
Q_SIGNALS:
void messageReceived(const QString &message);
protected Q_SLOTS:
void receiveConnection();
protected:
QString id;
QString socketName;
QLocalServer* server;
QtLP_Private::QtLockedFile lockFile;
private:
static const char* ack;
};