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