]> git.pld-linux.org Git - packages/QtSingleApplication.git/blob - clementine.patch
up to 2.6.1
[packages/QtSingleApplication.git] / clementine.patch
1 --- QtSingleApplication-2.6.1/src/qtlocalpeer.cpp~      2015-02-22 21:20:10.000000000 +0200
2 +++ QtSingleApplication-2.6.1/src/qtlocalpeer.cpp       2015-02-22 21:21:00.011791211 +0200
3 @@ -42,6 +42,7 @@
4  #include "qtlocalpeer.h"
5  #include <QCoreApplication>
6  #include <QTime>
7 +#include <QtDebug>
8  
9  #if defined(Q_OS_WIN)
10  #include <QLibrary>
11 @@ -138,6 +137,11 @@
12  
13  bool QtLocalPeer::sendMessage(const QString &message, int timeout)
14  {
15 +    return sendMessage(message.toUtf8(), timeout);
16 +}
17 +
18 +bool QtLocalPeer::sendMessage(const QByteArray &message, int timeout)
19 +{
20      if (!isClient())
21          return false;
22  
23 @@ -160,9 +164,8 @@
24      if (!connOk)
25          return false;
26  
27 -    QByteArray uMsg(message.toUtf8());
28      QDataStream ds(&socket);
29 -    ds.writeBytes(uMsg.constData(), uMsg.size());
30 +    ds.writeBytes(message.constData(), message.size());
31      bool res = socket.waitForBytesWritten(timeout);
32      res &= socket.waitForReadyRead(timeout);   // wait for ack
33      res &= (socket.read(qstrlen(ack)) == ack);
34 @@ -189,10 +190,10 @@
35          delete socket;
36          return;
37      }
38 -    QString message(QString::fromUtf8(uMsg));
39      socket->write(ack, qstrlen(ack));
40      socket->waitForBytesWritten(1000);
41      socket->waitForDisconnected(1000); // make sure client reads ack
42      delete socket;
43 -    emit messageReceived(message); //### (might take a long time to return)
44 +    emit messageReceived(uMsg); //### (might take a long time to return)
45 +    emit messageReceived(QString::fromUtf8(uMsg));
46  }
47 --- qtsingleapplication-2.6_1-opensource/src/qtlocalpeer.h      2009-12-16 10:43:33.000000000 +0000
48 +++ qtsingleapplication/src/qtlocalpeer.h       2010-07-10 16:26:16.000000000 +0100
49 @@ -61,11 +59,13 @@
50      QtLocalPeer(QObject *parent = 0, const QString &appId = QString());
51      bool isClient();
52      bool sendMessage(const QString &message, int timeout);
53 +    bool sendMessage(const QByteArray &message, int timeout);
54      QString applicationId() const
55          { return id; }
56  
57  Q_SIGNALS:
58      void messageReceived(const QString &message);
59 +    void messageReceived(const QByteArray &message);
60  
61  protected Q_SLOTS:
62      void receiveConnection();
63 --- qtsingleapplication-2.6_1-opensource/src/qtlockedfile_win.cpp       2009-12-16 10:43:33.000000000 +0000
64 +++ qtsingleapplication/src/qtlockedfile_win.cpp        2010-07-10 16:26:33.000000000 +0100
65 @@ -65,7 +65,7 @@
66  
67      Qt::HANDLE mutex;
68      if (doCreate) {
69 -        QT_WA( { mutex = CreateMutexW(NULL, FALSE, (TCHAR*)mname.utf16()); },
70 +        QT_WA( { mutex = CreateMutexW(NULL, FALSE, (WCHAR*)mname.utf16()); },
71                 { mutex = CreateMutexA(NULL, FALSE, mname.toLocal8Bit().constData()); } );
72          if (!mutex) {
73              qErrnoWarning("QtLockedFile::lock(): CreateMutex failed");
74 @@ -73,7 +73,7 @@
75          }
76      }
77      else {
78 -        QT_WA( { mutex = OpenMutexW(SYNCHRONIZE | MUTEX_MODIFY_STATE, FALSE, (TCHAR*)mname.utf16()); },
79 +        QT_WA( { mutex = OpenMutexW(SYNCHRONIZE | MUTEX_MODIFY_STATE, FALSE, (WCHAR*)mname.utf16()); },
80                 { mutex = OpenMutexA(SYNCHRONIZE | MUTEX_MODIFY_STATE, FALSE, mname.toLocal8Bit().constData()); } );
81          if (!mutex) {
82              if (GetLastError() != ERROR_FILE_NOT_FOUND)
83 --- qtsingleapplication-2.6_1-opensource/src/qtsingleapplication.cpp    2009-12-16 10:43:33.000000000 +0000
84 +++ qtsingleapplication/src/qtsingleapplication.cpp     2010-07-10 16:23:53.000000000 +0100
85 @@ -144,6 +144,7 @@
86      actWin = 0;
87      peer = new QtLocalPeer(this, appId);
88      connect(peer, SIGNAL(messageReceived(const QString&)), SIGNAL(messageReceived(const QString&)));
89 +    connect(peer, SIGNAL(messageReceived(const QByteArray&)), SIGNAL(messageReceived(const QByteArray&)));
90  }
91  
92  
93 @@ -265,6 +266,11 @@
94      return peer->sendMessage(message, timeout);
95  }
96  
97 +bool QtSingleApplication::sendMessage(const QByteArray &message, int timeout)
98 +{
99 +    return peer->sendMessage(message, timeout);
100 +}
101 +
102  
103  /*!
104      Returns the application identifier. Two processes with the same
105 @@ -291,10 +297,14 @@
106  void QtSingleApplication::setActivationWindow(QWidget* aw, bool activateOnMessage)
107  {
108      actWin = aw;
109 -    if (activateOnMessage)
110 +    if (activateOnMessage) {
111          connect(peer, SIGNAL(messageReceived(const QString&)), this, SLOT(activateWindow()));
112 -    else
113 +        connect(peer, SIGNAL(messageReceived(const QByteArray&)), this, SLOT(activateWindow()));
114 +    }
115 +    else {
116          disconnect(peer, SIGNAL(messageReceived(const QString&)), this, SLOT(activateWindow()));
117 +        disconnect(peer, SIGNAL(messageReceived(const QByteArray&)), this, SLOT(activateWindow()));
118 +    }
119  }
120  
121  
122 --- qtsingleapplication-2.6_1-opensource/src/qtsingleapplication.h      2009-12-16 10:43:33.000000000 +0000
123 +++ qtsingleapplication/src/qtsingleapplication.h       2010-07-10 16:23:53.000000000 +0100
124 @@ -91,11 +91,13 @@
125  
126  public Q_SLOTS:
127      bool sendMessage(const QString &message, int timeout = 5000);
128 +    bool sendMessage(const QByteArray &message, int timeout = 5000);
129      void activateWindow();
130  
131  
132  Q_SIGNALS:
133      void messageReceived(const QString &message);
134 +    void messageReceived(const QByteArray &message);
135  
136  
137  private:
138 --- qtsingleapplication-2.6_1-opensource/src/qtsinglecoreapplication.cpp        2009-12-16 10:43:33.000000000 +0000
139 +++ qtsingleapplication/src/qtsinglecoreapplication.cpp 2010-07-10 16:32:33.000000000 +0100
140 @@ -81,6 +81,7 @@
141  {
142      peer = new QtLocalPeer(this);
143      connect(peer, SIGNAL(messageReceived(const QString&)), SIGNAL(messageReceived(const QString&)));
144 +    connect(peer, SIGNAL(messageReceived(const QByteArray&)), SIGNAL(messageReceived(const QByteArray&)));
145  }
146  
147  
148 @@ -94,6 +95,7 @@
149  {
150      peer = new QtLocalPeer(this, appId);
151      connect(peer, SIGNAL(messageReceived(const QString&)), SIGNAL(messageReceived(const QString&)));
152 +    connect(peer, SIGNAL(messageReceived(const QByteArray&)), SIGNAL(messageReceived(const QByteArray&)));
153  }
154  
155  
156 @@ -133,6 +135,11 @@
157      return peer->sendMessage(message, timeout);
158  }
159  
160 +bool QtSingleCoreApplication::sendMessage(const QByteArray &message, int timeout)
161 +{
162 +    return peer->sendMessage(message, timeout);
163 +}
164 +
165  
166  /*!
167      Returns the application identifier. Two processes with the same
168 --- qtsingleapplication-2.6_1-opensource/src/qtsinglecoreapplication.h  2009-12-16 10:43:33.000000000 +0000
169 +++ qtsingleapplication/src/qtsinglecoreapplication.h   2010-07-10 16:32:33.000000000 +0100
170 @@ -62,10 +62,12 @@
171  
172  public Q_SLOTS:
173      bool sendMessage(const QString &message, int timeout = 5000);
174 +    bool sendMessage(const QByteArray &message, int timeout = 5000);
175  
176  
177  Q_SIGNALS:
178      void messageReceived(const QString &message);
179 +    void messageReceived(const QByteArray &message);
180  
181  
182  private:
This page took 0.110489 seconds and 4 git commands to generate.