Sophie

Sophie

distrib > Mageia > 3 > i586 > media > core-release-src > by-pkgid > da96feb7bedf649077e42a292b6dffb0 > files > 2

qtsingleapplication-2.6.1-6.mga3.src.rpm

diff -rupN qtsingleapplication-2.6_1-opensource.old/src/qtlocalpeer.cpp qtsingleapplication-2.6_1-opensource/src/qtlocalpeer.cpp
--- qtsingleapplication-2.6_1-opensource.old/src/qtlocalpeer.cpp	2009-12-16 05:43:33.000000000 -0500
+++ qtsingleapplication-2.6_1-opensource/src/qtlocalpeer.cpp	2010-08-09 20:10:25.000000000 -0400
@@ -48,6 +48,7 @@
 #include "qtlocalpeer.h"
 #include <QtCore/QCoreApplication>
 #include <QtCore/QTime>
+#include <QtDebug>
 
 #if defined(Q_OS_WIN)
 #include <QtCore/QLibrary>
@@ -138,6 +139,16 @@ bool QtLocalPeer::isClient()
 
 bool QtLocalPeer::sendMessage(const QString &message, int timeout)
 {
+    return sendMessage(message.toUtf8(), timeout);
+}
+
+bool QtLocalPeer::sendMessage(const char* message, int timeout)
+{
+    return sendMessage(QByteArray(message), timeout);
+}
+
+bool QtLocalPeer::sendMessage(const QByteArray &message, int timeout)
+{
     if (!isClient())
         return false;
 
@@ -160,9 +171,8 @@ bool QtLocalPeer::sendMessage(const QStr
     if (!connOk)
         return false;
 
-    QByteArray uMsg(message.toUtf8());
     QDataStream ds(&socket);
-    ds.writeBytes(uMsg.constData(), uMsg.size());
+    ds.writeBytes(message.constData(), message.size());
     bool res = socket.waitForBytesWritten(timeout);
     res &= socket.waitForReadyRead(timeout);   // wait for ack
     res &= (socket.read(qstrlen(ack)) == ack);
@@ -195,9 +205,9 @@ void QtLocalPeer::receiveConnection()
         delete socket;
         return;
     }
-    QString message(QString::fromUtf8(uMsg));
     socket->write(ack, qstrlen(ack));
     socket->waitForBytesWritten(1000);
     delete socket;
-    emit messageReceived(message); //### (might take a long time to return)
+    emit messageReceived(uMsg); //### (might take a long time to return)
+    emit messageReceived(QString::fromUtf8(uMsg));
 }
diff -rupN qtsingleapplication-2.6_1-opensource.old/src/qtlocalpeer.h qtsingleapplication-2.6_1-opensource/src/qtlocalpeer.h
--- qtsingleapplication-2.6_1-opensource.old/src/qtlocalpeer.h	2009-12-16 05:43:33.000000000 -0500
+++ qtsingleapplication-2.6_1-opensource/src/qtlocalpeer.h	2010-08-09 20:10:44.000000000 -0400
@@ -61,11 +61,15 @@ public:
     QtLocalPeer(QObject *parent = 0, const QString &appId = QString());
     bool isClient();
     bool sendMessage(const QString &message, int timeout);
+    bool sendMessage(const QByteArray &message, int timeout);
+    bool sendMessage(const char* message, int timeout);
     QString applicationId() const
         { return id; }
 
 Q_SIGNALS:
     void messageReceived(const QString &message);
+    void messageReceived(const QByteArray &message);
+    void messageReceived(const char* message);
 
 protected Q_SLOTS:
     void receiveConnection();
diff -rupN qtsingleapplication-2.6_1-opensource.old/src/qtlockedfile_win.cpp qtsingleapplication-2.6_1-opensource/src/qtlockedfile_win.cpp
--- qtsingleapplication-2.6_1-opensource.old/src/qtlockedfile_win.cpp	2009-12-16 05:43:33.000000000 -0500
+++ qtsingleapplication-2.6_1-opensource/src/qtlockedfile_win.cpp	2010-08-09 14:21:42.000000000 -0400
@@ -65,7 +65,7 @@ Qt::HANDLE QtLockedFile::getMutexHandle(
 
     Qt::HANDLE mutex;
     if (doCreate) {
-        QT_WA( { mutex = CreateMutexW(NULL, FALSE, (TCHAR*)mname.utf16()); },
+        QT_WA( { mutex = CreateMutexW(NULL, FALSE, (WCHAR*)mname.utf16()); },
                { mutex = CreateMutexA(NULL, FALSE, mname.toLocal8Bit().constData()); } );
         if (!mutex) {
             qErrnoWarning("QtLockedFile::lock(): CreateMutex failed");
@@ -73,7 +73,7 @@ Qt::HANDLE QtLockedFile::getMutexHandle(
         }
     }
     else {
-        QT_WA( { mutex = OpenMutexW(SYNCHRONIZE | MUTEX_MODIFY_STATE, FALSE, (TCHAR*)mname.utf16()); },
+        QT_WA( { mutex = OpenMutexW(SYNCHRONIZE | MUTEX_MODIFY_STATE, FALSE, (WCHAR*)mname.utf16()); },
                { mutex = OpenMutexA(SYNCHRONIZE | MUTEX_MODIFY_STATE, FALSE, mname.toLocal8Bit().constData()); } );
         if (!mutex) {
             if (GetLastError() != ERROR_FILE_NOT_FOUND)
diff -rupN qtsingleapplication-2.6_1-opensource.old/src/qtsingleapplication.cpp qtsingleapplication-2.6_1-opensource/src/qtsingleapplication.cpp
--- qtsingleapplication-2.6_1-opensource.old/src/qtsingleapplication.cpp	2009-12-16 05:43:33.000000000 -0500
+++ qtsingleapplication-2.6_1-opensource/src/qtsingleapplication.cpp	2010-08-09 20:11:56.000000000 -0400
@@ -144,6 +144,8 @@ void QtSingleApplication::sysInit(const 
     actWin = 0;
     peer = new QtLocalPeer(this, appId);
     connect(peer, SIGNAL(messageReceived(const QString&)), SIGNAL(messageReceived(const QString&)));
+    connect(peer, SIGNAL(messageReceived(const QByteArray&)), SIGNAL(messageReceived(const QByteArray&)));
+    connect(peer, SIGNAL(messageReceived(const char*)), SIGNAL(messageReceived(const char*)));
 }
 
 
@@ -265,6 +267,16 @@ bool QtSingleApplication::sendMessage(co
     return peer->sendMessage(message, timeout);
 }
 
+bool QtSingleApplication::sendMessage(const QByteArray &message, int timeout)
+{
+    return peer->sendMessage(message, timeout);
+}
+
+bool QtSingleApplication::sendMessage(const char* message, int timeout)
+{
+    return peer->sendMessage(message, timeout);
+}
+
 
 /*!
     Returns the application identifier. Two processes with the same
@@ -291,10 +303,16 @@ QString QtSingleApplication::id() const
 void QtSingleApplication::setActivationWindow(QWidget* aw, bool activateOnMessage)
 {
     actWin = aw;
-    if (activateOnMessage)
+    if (activateOnMessage) {
         connect(peer, SIGNAL(messageReceived(const QString&)), this, SLOT(activateWindow()));
-    else
+        connect(peer, SIGNAL(messageReceived(const QByteArray&)), this, SLOT(activateWindow()));
+        connect(peer, SIGNAL(messageReceived(const char*)), this, SLOT(activateWindow()));
+    }
+    else {
         disconnect(peer, SIGNAL(messageReceived(const QString&)), this, SLOT(activateWindow()));
+        disconnect(peer, SIGNAL(messageReceived(const QByteArray&)), this, SLOT(activateWindow()));
+        disconnect(peer, SIGNAL(messageReceived(const char*)), this, SLOT(activateWindow()));
+    }
 }
 
 
diff -rupN qtsingleapplication-2.6_1-opensource.old/src/qtsingleapplication.h qtsingleapplication-2.6_1-opensource/src/qtsingleapplication.h
--- qtsingleapplication-2.6_1-opensource.old/src/qtsingleapplication.h	2009-12-16 05:43:33.000000000 -0500
+++ qtsingleapplication-2.6_1-opensource/src/qtsingleapplication.h	2010-08-09 20:11:04.000000000 -0400
@@ -91,11 +91,15 @@ public:
 
 public Q_SLOTS:
     bool sendMessage(const QString &message, int timeout = 5000);
+    bool sendMessage(const QByteArray &message, int timeout = 5000);
+    bool sendMessage(const char* message, int timeout = 5000);
     void activateWindow();
 
 
 Q_SIGNALS:
     void messageReceived(const QString &message);
+    void messageReceived(const QByteArray &message);
+    void messageReceived(const char* message);
 
 
 private:
diff -rupN qtsingleapplication-2.6_1-opensource.old/src/qtsinglecoreapplication.cpp qtsingleapplication-2.6_1-opensource/src/qtsinglecoreapplication.cpp
--- qtsingleapplication-2.6_1-opensource.old/src/qtsinglecoreapplication.cpp	2009-12-16 05:43:33.000000000 -0500
+++ qtsingleapplication-2.6_1-opensource/src/qtsinglecoreapplication.cpp	2010-08-09 20:12:45.000000000 -0400
@@ -81,6 +81,8 @@ QtSingleCoreApplication::QtSingleCoreApp
 {
     peer = new QtLocalPeer(this);
     connect(peer, SIGNAL(messageReceived(const QString&)), SIGNAL(messageReceived(const QString&)));
+    connect(peer, SIGNAL(messageReceived(const QByteArray&)), SIGNAL(messageReceived(const QByteArray&)));
+    connect(peer, SIGNAL(messageReceived(const char*)), SIGNAL(messageReceived(const char*)));
 }
 
 
@@ -94,6 +96,8 @@ QtSingleCoreApplication::QtSingleCoreApp
 {
     peer = new QtLocalPeer(this, appId);
     connect(peer, SIGNAL(messageReceived(const QString&)), SIGNAL(messageReceived(const QString&)));
+    connect(peer, SIGNAL(messageReceived(const QByteArray&)), SIGNAL(messageReceived(const QByteArray&)));
+    connect(peer, SIGNAL(messageReceived(const char*)), SIGNAL(messageReceived(const char*)));
 }
 
 
@@ -133,6 +137,15 @@ bool QtSingleCoreApplication::sendMessag
     return peer->sendMessage(message, timeout);
 }
 
+bool QtSingleCoreApplication::sendMessage(const QByteArray &message, int timeout)
+{
+    return peer->sendMessage(message, timeout);
+}
+
+bool QtSingleCoreApplication::sendMessage(const char* message, int timeout)
+{
+    return peer->sendMessage(message, timeout);
+}
 
 /*!
     Returns the application identifier. Two processes with the same
diff -rupN qtsingleapplication-2.6_1-opensource.old/src/qtsinglecoreapplication.h qtsingleapplication-2.6_1-opensource/src/qtsinglecoreapplication.h
--- qtsingleapplication-2.6_1-opensource.old/src/qtsinglecoreapplication.h	2009-12-16 05:43:33.000000000 -0500
+++ qtsingleapplication-2.6_1-opensource/src/qtsinglecoreapplication.h	2010-08-09 20:12:24.000000000 -0400
@@ -62,10 +62,14 @@ public:
 
 public Q_SLOTS:
     bool sendMessage(const QString &message, int timeout = 5000);
+    bool sendMessage(const QByteArray &message, int timeout = 5000);
+    bool sendMessage(const char* message, int timeout = 5000);
 
 
 Q_SIGNALS:
     void messageReceived(const QString &message);
+    void messageReceived(const QByteArray &message);
+    void messageReceived(const char* message);
 
 
 private: