Gentoo Archives: gentoo-commits

From: "Andreas HAttel (dilfridge)" <dilfridge@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in net-p2p/ktorrent/files: ktorrent-4.1.3-tasks.patch
Date: Fri, 30 Dec 2011 23:14:27
Message-Id: 20111230231415.12A442004B@flycatcher.gentoo.org
1 dilfridge 11/12/30 23:14:15
2
3 Added: ktorrent-4.1.3-tasks.patch
4 Log:
5 Version bump including a backport of the kde-4.8 support, bug 392343
6
7 (Portage version: 2.1.10.41/cvs/Linux x86_64)
8
9 Revision Changes Path
10 1.1 net-p2p/ktorrent/files/ktorrent-4.1.3-tasks.patch
11
12 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-p2p/ktorrent/files/ktorrent-4.1.3-tasks.patch?rev=1.1&view=markup
13 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-p2p/ktorrent/files/ktorrent-4.1.3-tasks.patch?rev=1.1&content-type=text/plain
14
15 Index: ktorrent-4.1.3-tasks.patch
16 ===================================================================
17 diff --git a/plasma/applet/CMakeLists.txt b/plasma/applet/CMakeLists.txt
18 index 3a72241..4307cf2 100644
19 --- a/plasma/applet/CMakeLists.txt
20 +++ b/plasma/applet/CMakeLists.txt
21 @@ -5,25 +5,15 @@ if(NOT QT_VERSION_OK)
22
23 else(NOT QT_VERSION_OK)
24
25 - set(TASKMANAGER_FOUND FALSE)
26 - FIND_PATH(TASKMANAGER_INCLUDE_DIR NAMES taskmanager.h PATHS ${KDE4_INCLUDE_DIR}/taskmanager ${INCLUDE_INSTALL_DIR}/taskmanager.h)
27 - FIND_LIBRARY(TASKMANAGER_LIBRARY NAMES taskmanager PATHS ${KDE4_LIB_DIR} ${LIB_INSTALL_DIR})
28 -
29 - if(TASKMANAGER_INCLUDE_DIR AND TASKMANAGER_LIBRARY)
30 - set(TASKMANAGER_FOUND TRUE)
31 - message(STATUS "Found libtaskmanager: ${TASKMANAGER_LIBRARY} ")
32 - include_directories(${TASKMANAGER_INCLUDE_DIR})
33 - set(ktapplet_SRCS applet.cpp chunkbar.cpp fadingitem.cpp fadingnavigationwidget.cpp)
34 -
35 - kde4_add_ui_files(ktapplet_SRCS appletconfig.ui)
36 -
37 - kde4_add_plugin(plasma_applet_ktorrent ${ktapplet_SRCS})
38 - target_link_libraries(plasma_applet_ktorrent ${KDE4_PLASMA_LIBS} ${KDE4_KIO_LIBS} ${TASKMANAGER_LIBRARY} ${LIBKTORRENT_LIBRARIES} ktcore)
39 -
40 - install(TARGETS plasma_applet_ktorrent DESTINATION ${PLUGIN_INSTALL_DIR})
41 - install(FILES plasma-applet-ktorrent.desktop DESTINATION ${SERVICES_INSTALL_DIR})
42 - endif(TASKMANAGER_INCLUDE_DIR AND TASKMANAGER_LIBRARY)
43 -
44 - macro_log_feature(TASKMANAGER_FOUND "libtaskmanager" "libtaskmanager library and header files" "http://www.kde.org/" FALSE "" "libtaskmanager is needed for KTorrent Plasmoid")
45 +
46 + set(ktapplet_SRCS applet.cpp chunkbar.cpp fadingitem.cpp fadingnavigationwidget.cpp)
47 +
48 + kde4_add_ui_files(ktapplet_SRCS appletconfig.ui)
49 +
50 + kde4_add_plugin(plasma_applet_ktorrent ${ktapplet_SRCS})
51 + target_link_libraries(plasma_applet_ktorrent ${KDE4_PLASMA_LIBS} ${KDE4_KIO_LIBS} ${LIBKTORRENT_LIBRARIES} ktcore)
52 +
53 + install(TARGETS plasma_applet_ktorrent DESTINATION ${PLUGIN_INSTALL_DIR})
54 + install(FILES plasma-applet-ktorrent.desktop DESTINATION ${SERVICES_INSTALL_DIR})
55
56 endif(NOT QT_VERSION_OK)
57 diff --git a/plasma/applet/applet.cpp b/plasma/applet/applet.cpp
58 index 59e7191..bf09479 100644
59 --- a/plasma/applet/applet.cpp
60 +++ b/plasma/applet/applet.cpp
61 @@ -21,6 +21,9 @@
62 #include "applet.h"
63 #include <QFile>
64 #include <QGraphicsLinearLayout>
65 +#include <QDBusConnection>
66 +#include <QDBusConnectionInterface>
67 +#include <QDBusMessage>
68 #include <KConfigDialog>
69 #include <KLocale>
70 #include <KRun>
71 @@ -31,12 +34,11 @@
72 #include <Plasma/IconWidget>
73 #endif
74 #include <Plasma/Label>
75 -#include <taskmanager/taskmanager.h>
76 -#include <taskmanager/task.h>
77 #include <util/functions.h>
78 #include "chunkbar.h"
79 #include "fadingnavigationwidget.h"
80
81 +
82 using namespace bt;
83
84 namespace ktplasma
85 @@ -174,7 +176,8 @@ namespace ktplasma
86 }
87 }
88
89 - void Applet::updateNavigation() {
90 + void Applet::updateNavigation()
91 + {
92 navigation->setEnabled(connected_to_app && !sources.empty()
93 && (sources.count() > 1 || !sources.contains(current_source)));
94 }
95 @@ -193,12 +196,14 @@ namespace ktplasma
96 }
97 }
98
99 - void Applet::updateSources() {
100 + void Applet::updateSources()
101 + {
102 sources = engine->sources();
103 sources.removeOne("core");
104 }
105
106 - void Applet::setSource(QString source) {
107 + void Applet::setSource(QString source)
108 + {
109 if (!current_source.isEmpty())
110 engine->disconnectSource(current_source,this);
111 clearData();
112 @@ -340,20 +345,39 @@ namespace ktplasma
113
114 void Applet::iconClicked()
115 {
116 - TaskManager::TaskDict tasks = TaskManager::TaskManager::self()->tasks();
117 - for (TaskManager::TaskDict::iterator i = tasks.begin();i != tasks.end();i ++)
118 + QDBusConnection session_bus = QDBusConnection::sessionBus();
119 + QDBusConnectionInterface* dbus_service = session_bus.interface();
120 + if (!session_bus.isConnected() || !dbus_service || !dbus_service->isServiceRegistered("org.ktorrent.ktorrent"))
121 {
122 - if (i.value()->className() == "ktorrent")
123 - {
124 - KWindowSystem::activateWindow(i.key());
125 - return;
126 - }
127 + // can't find the window, try launching it
128 + KUrl::List empty;
129 + KRun::run("ktorrent", empty, 0);
130 + }
131 + else
132 + {
133 + QDBusMessage msg = QDBusMessage::createMethodCall("org.ktorrent.ktorrent", "/ktorrent/MainWindow_1", "org.kde.KMainWindow", "winId");
134 + QDBusPendingCall call = session_bus.asyncCall(msg, 5000);
135 + QDBusPendingCallWatcher* watcher = new QDBusPendingCallWatcher(call ,this);
136 + connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), this, SLOT(dbusCallFinished(QDBusPendingCallWatcher*)));
137 }
138 -
139 - // can't find the window, try launching it
140 - KUrl::List empty;
141 - KRun::run("ktorrent", empty, 0);
142 }
143 +
144 + void Applet::dbusCallFinished(QDBusPendingCallWatcher* self)
145 + {
146 + if (self->isError())
147 + {
148 + // call failed, try launching it
149 + KUrl::List empty;
150 + KRun::run("ktorrent", empty, 0);
151 + }
152 + else
153 + {
154 + QDBusPendingReply<qlonglong> reply = *self;
155 + KWindowSystem::activateWindow(reply.value());
156 + }
157 + self->deleteLater();
158 + }
159 +
160
161 void Applet::clearData()
162 {
163 diff --git a/plasma/applet/applet.h b/plasma/applet/applet.h
164 index 29b3265..d396118 100644
165 --- a/plasma/applet/applet.h
166 +++ b/plasma/applet/applet.h
167 @@ -27,6 +27,7 @@
168 #include "fadingnavigationwidget.h"
169
170 class QGraphicsLinearLayout;
171 +class QDBusPendingCallWatcher;
172
173 namespace Plasma
174 {
175 @@ -68,6 +69,7 @@ namespace ktplasma
176 void iconClicked();
177 void selectPrev();
178 void selectNext();
179 + void dbusCallFinished(QDBusPendingCallWatcher* self);
180
181 private:
182 void updateTorrentCombo();