Commit 9d2cfd12 authored by Martin Flöser's avatar Martin Flöser
Browse files

pasteclient: read selection in thread

parent b016765f
......@@ -21,6 +21,9 @@ add_executable(copyClient copyclient.cpp)
target_link_libraries(copyClient KF5::WaylandClient)
ecm_mark_as_test(copyClient)
add_executable(pasteClient pasteclient.cpp)
target_link_libraries(pasteClient KF5::WaylandClient)
ecm_mark_as_test(pasteClient)
find_package(Qt5Concurrent ${QT_MIN_VERSION} CONFIG QUIET)
if (Qt5Concurrent_FOUND)
add_executable(pasteClient pasteclient.cpp)
target_link_libraries(pasteClient Qt5::Concurrent KF5::WaylandClient)
ecm_mark_as_test(pasteClient)
endif()
\ No newline at end of file
......@@ -37,6 +37,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
#include <QImage>
#include <QMimeType>
#include <QThread>
#include <QtConcurrent>
// system
#include <unistd.h>
......@@ -161,12 +162,16 @@ void PasteClient::setupRegistry(Registry *registry)
}
dataOffer->receive((*it).name(), pipeFds[1]);
close(pipeFds[1]);
QFile readPipe;
if (readPipe.open(pipeFds[0], QIODevice::ReadOnly)) {
qDebug() << "Pasted: " << readPipe.readLine();
}
close(pipeFds[0]);
QCoreApplication::quit();
QtConcurrent::run(
[pipeFds] {
QFile readPipe;
if (readPipe.open(pipeFds[0], QIODevice::ReadOnly)) {
qDebug() << "Pasted: " << readPipe.readLine();
}
close(pipeFds[0]);
QCoreApplication::quit();
}
);
}
);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment