KTorrent 4.1.3, fix build with KDE 4.8

svn path=/nixpkgs/trunk/; revision=31713
This commit is contained in:
Yury G. Kudryashov 2012-01-19 20:28:05 +00:00
parent 8899e60693
commit d38c5e7ee4
5 changed files with 199 additions and 37 deletions

View File

@ -1,28 +1,26 @@
{ stdenv, fetchurl, cmake, qt4, kdelibs, automoc4, phonon, qimageblitz, qca2, eigen,
kdegraphics, lcms, jasper, libgphoto2, kdepimlibs, gettext, soprano, kdeedu,
lcms, jasper, libgphoto2, kdepimlibs, gettext, soprano, libjpeg, libtiff,
liblqr1, lensfun, pkgconfig, qjson, libkdcraw, opencv, libkexiv2, libkipi, boost,
shared_desktop_ontologies, marble }:
shared_desktop_ontologies, marble, clapack, mysql }:
stdenv.mkDerivation rec {
name = "digikam-2.4.1";
name = "digikam-2.5.0";
src = fetchurl {
url = "mirror://sourceforge/digikam/${name}.tar.bz2";
sha256 = "0fyyhc26syd1d1m8jqyg2i66hwd523mh419ln8y944jkrjj6gadc";
sha256 = "06l52j8i45vyfj3b81ivifqsqdjlcj4g68d8w06c5lhzniwjqaam";
};
buildInputs = [ cmake qt4 kdelibs kdegraphics automoc4 phonon qimageblitz qca2 eigen
lcms jasper libgphoto2 kdepimlibs gettext soprano kdeedu liblqr1 lensfun
pkgconfig qjson libkdcraw opencv libkexiv2 libkipi boost shared_desktop_ontologies
marble ];
buildNativeInputs = [ cmake automoc4 pkgconfig ];
KDEDIRS=kdeedu;
buildInputs = [ qt4 kdelibs phonon qimageblitz qca2 eigen lcms libjpeg libtiff
jasper libgphoto2 kdepimlibs gettext soprano liblqr1 lensfun qjson libkdcraw
opencv libkexiv2 libkipi boost shared_desktop_ontologies marble mysql ];
# Make digikam find some FindXXXX.cmake
preConfigure = ''
cp ${qjson}/share/apps/cmake/modules/FindQJSON.cmake cmake/modules;
cp ${marble}/share/apps/cmake/modules/FindMarble.cmake cmake/modules;
'';
KDEDIRS="${marble}:${qjson}";
patches = [ ./libkvkontakte-not-topdir.patch ./ftbfs-libkipi.patch ];
meta = {
description = "Photo Management Program";

View File

@ -5,14 +5,14 @@ stdenv.mkDerivation rec {
name = pname + "-" + version;
pname = "ktorrent";
version = "4.1.1";
version = "4.1.3";
src = fetchurl {
url = "${meta.homepage}/downloads/${version}/${name}.tar.bz2";
sha256 = "1h0fqh344sfwfbvnwhn00k8czb14568flapjf4754zss6bxpw4g4";
sha256 = "0ih68bml6ic3mxk5l4ypgmxwyg9mglp57gw5igrnm5yszm7jz19g";
};
patches = [ ./find-workspace.diff ];
patches = [ ./find-workspace.diff ./drop-taskmanager-dependency.patch ];
KDEDIRS = libktorrent;

View File

@ -0,0 +1,175 @@
commit 6d4a6ae51692966862ccb20d17cb217717519d40
Author: Joris Guisson <joris.guisson@gmail.com>
Date: Wed Nov 23 20:17:08 2011 +0100
Use dbus to show ktorrent window from plasma applet. This removes the dependency on libtaskmanager.
BUG: 287309
Changelog removed by Yury G. Kudryashov
diff --git a/plasma/applet/CMakeLists.txt b/plasma/applet/CMakeLists.txt
index 3a72241..4307cf2 100644
--- a/plasma/applet/CMakeLists.txt
+++ b/plasma/applet/CMakeLists.txt
@@ -5,25 +5,15 @@ if(NOT QT_VERSION_OK)
else(NOT QT_VERSION_OK)
- set(TASKMANAGER_FOUND FALSE)
- FIND_PATH(TASKMANAGER_INCLUDE_DIR NAMES taskmanager.h PATHS ${KDE4_INCLUDE_DIR}/taskmanager ${INCLUDE_INSTALL_DIR}/taskmanager.h)
- FIND_LIBRARY(TASKMANAGER_LIBRARY NAMES taskmanager PATHS ${KDE4_LIB_DIR} ${LIB_INSTALL_DIR})
-
- if(TASKMANAGER_INCLUDE_DIR AND TASKMANAGER_LIBRARY)
- set(TASKMANAGER_FOUND TRUE)
- message(STATUS "Found libtaskmanager: ${TASKMANAGER_LIBRARY} ")
- include_directories(${TASKMANAGER_INCLUDE_DIR})
- set(ktapplet_SRCS applet.cpp chunkbar.cpp fadingitem.cpp fadingnavigationwidget.cpp)
-
- kde4_add_ui_files(ktapplet_SRCS appletconfig.ui)
-
- kde4_add_plugin(plasma_applet_ktorrent ${ktapplet_SRCS})
- target_link_libraries(plasma_applet_ktorrent ${KDE4_PLASMA_LIBS} ${KDE4_KIO_LIBS} ${TASKMANAGER_LIBRARY} ${LIBKTORRENT_LIBRARIES} ktcore)
-
- install(TARGETS plasma_applet_ktorrent DESTINATION ${PLUGIN_INSTALL_DIR})
- install(FILES plasma-applet-ktorrent.desktop DESTINATION ${SERVICES_INSTALL_DIR})
- endif(TASKMANAGER_INCLUDE_DIR AND TASKMANAGER_LIBRARY)
-
- macro_log_feature(TASKMANAGER_FOUND "libtaskmanager" "libtaskmanager library and header files" "http://www.kde.org/" FALSE "" "libtaskmanager is needed for KTorrent Plasmoid")
+
+ set(ktapplet_SRCS applet.cpp chunkbar.cpp fadingitem.cpp fadingnavigationwidget.cpp)
+
+ kde4_add_ui_files(ktapplet_SRCS appletconfig.ui)
+
+ kde4_add_plugin(plasma_applet_ktorrent ${ktapplet_SRCS})
+ target_link_libraries(plasma_applet_ktorrent ${KDE4_PLASMA_LIBS} ${KDE4_KIO_LIBS} ${LIBKTORRENT_LIBRARIES} ktcore)
+
+ install(TARGETS plasma_applet_ktorrent DESTINATION ${PLUGIN_INSTALL_DIR})
+ install(FILES plasma-applet-ktorrent.desktop DESTINATION ${SERVICES_INSTALL_DIR})
endif(NOT QT_VERSION_OK)
diff --git a/plasma/applet/applet.cpp b/plasma/applet/applet.cpp
index 59e7191..bf09479 100644
--- a/plasma/applet/applet.cpp
+++ b/plasma/applet/applet.cpp
@@ -21,6 +21,9 @@
#include "applet.h"
#include <QFile>
#include <QGraphicsLinearLayout>
+#include <QDBusConnection>
+#include <QDBusConnectionInterface>
+#include <QDBusMessage>
#include <KConfigDialog>
#include <KLocale>
#include <KRun>
@@ -31,12 +34,11 @@
#include <Plasma/IconWidget>
#endif
#include <Plasma/Label>
-#include <taskmanager/taskmanager.h>
-#include <taskmanager/task.h>
#include <util/functions.h>
#include "chunkbar.h"
#include "fadingnavigationwidget.h"
+
using namespace bt;
namespace ktplasma
@@ -174,7 +176,8 @@ namespace ktplasma
}
}
- void Applet::updateNavigation() {
+ void Applet::updateNavigation()
+ {
navigation->setEnabled(connected_to_app && !sources.empty()
&& (sources.count() > 1 || !sources.contains(current_source)));
}
@@ -193,12 +196,14 @@ namespace ktplasma
}
}
- void Applet::updateSources() {
+ void Applet::updateSources()
+ {
sources = engine->sources();
sources.removeOne("core");
}
- void Applet::setSource(QString source) {
+ void Applet::setSource(QString source)
+ {
if (!current_source.isEmpty())
engine->disconnectSource(current_source,this);
clearData();
@@ -340,20 +345,39 @@ namespace ktplasma
void Applet::iconClicked()
{
- TaskManager::TaskDict tasks = TaskManager::TaskManager::self()->tasks();
- for (TaskManager::TaskDict::iterator i = tasks.begin();i != tasks.end();i ++)
+ QDBusConnection session_bus = QDBusConnection::sessionBus();
+ QDBusConnectionInterface* dbus_service = session_bus.interface();
+ if (!session_bus.isConnected() || !dbus_service || !dbus_service->isServiceRegistered("org.ktorrent.ktorrent"))
{
- if (i.value()->className() == "ktorrent")
- {
- KWindowSystem::activateWindow(i.key());
- return;
- }
+ // can't find the window, try launching it
+ KUrl::List empty;
+ KRun::run("ktorrent", empty, 0);
+ }
+ else
+ {
+ QDBusMessage msg = QDBusMessage::createMethodCall("org.ktorrent.ktorrent", "/ktorrent/MainWindow_1", "org.kde.KMainWindow", "winId");
+ QDBusPendingCall call = session_bus.asyncCall(msg, 5000);
+ QDBusPendingCallWatcher* watcher = new QDBusPendingCallWatcher(call ,this);
+ connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), this, SLOT(dbusCallFinished(QDBusPendingCallWatcher*)));
}
-
- // can't find the window, try launching it
- KUrl::List empty;
- KRun::run("ktorrent", empty, 0);
}
+
+ void Applet::dbusCallFinished(QDBusPendingCallWatcher* self)
+ {
+ if (self->isError())
+ {
+ // call failed, try launching it
+ KUrl::List empty;
+ KRun::run("ktorrent", empty, 0);
+ }
+ else
+ {
+ QDBusPendingReply<qlonglong> reply = *self;
+ KWindowSystem::activateWindow(reply.value());
+ }
+ self->deleteLater();
+ }
+
void Applet::clearData()
{
diff --git a/plasma/applet/applet.h b/plasma/applet/applet.h
index 29b3265..d396118 100644
--- a/plasma/applet/applet.h
+++ b/plasma/applet/applet.h
@@ -27,6 +27,7 @@
#include "fadingnavigationwidget.h"
class QGraphicsLinearLayout;
+class QDBusPendingCallWatcher;
namespace Plasma
{
@@ -68,6 +69,7 @@ namespace ktplasma
void iconClicked();
void selectPrev();
void selectNext();
+ void dbusCallFinished(QDBusPendingCallWatcher* self);
private:
void updateTorrentCombo();

View File

@ -1,19 +1,4 @@
Fix finding taskmanager.h and kworkspace.h
diff --git a/plasma/applet/CMakeLists.txt b/plasma/applet/CMakeLists.txt
index 3a72241..69b1205 100644
--- a/plasma/applet/CMakeLists.txt
+++ b/plasma/applet/CMakeLists.txt
@@ -6,7 +6,9 @@ if(NOT QT_VERSION_OK)
else(NOT QT_VERSION_OK)
set(TASKMANAGER_FOUND FALSE)
- FIND_PATH(TASKMANAGER_INCLUDE_DIR NAMES taskmanager.h PATHS ${KDE4_INCLUDE_DIR}/taskmanager ${INCLUDE_INSTALL_DIR}/taskmanager.h)
+ FIND_PATH(TASKMANAGER_INCLUDE_DIR
+ NAMES taskmanager/taskmanager.h
+ HINTS ${KDE4_INCLUDE_DIR} ${INCLUDE_INSTALL_DIR})
FIND_LIBRARY(TASKMANAGER_LIBRARY NAMES taskmanager PATHS ${KDE4_LIB_DIR} ${LIB_INSTALL_DIR})
if(TASKMANAGER_INCLUDE_DIR AND TASKMANAGER_LIBRARY)
Fix finding kworkspace.h
diff --git a/plugins/shutdown/CMakeLists.txt b/plugins/shutdown/CMakeLists.txt
index 59e5470..5b932ff 100644
--- a/plugins/shutdown/CMakeLists.txt

View File

@ -1,18 +1,22 @@
{ stdenv, fetchurl, kdelibs, cmake, gmp, qca2, boost, gettext, qt4, automoc4
, phonon, libgcrypt }:
let
mp_ = "1.3";
version = "1.${mp_}";
version4 = "4.${mp_}";
in
stdenv.mkDerivation rec {
name = pname + "-" + version;
pname = "libktorrent";
version = "1.1.1";
src = fetchurl {
url = "http://ktorrent.org/downloads/4.1.1/${name}.tar.bz2";
sha256 = "06d93xpshxawz49hqh6pvypir4ygm1f781hs7yim5k6b7shivfs1";
url = "http://ktorrent.org/downloads/${version4}/${name}.tar.bz2";
sha256 = "0mvvx6mdfy0pyhk6lwwmmbd3pd2ai6n2rf5kdjqhpkm9wbrck85n";
};
buildInputs =
[ cmake kdelibs qt4 automoc4 phonon gmp qca2 boost libgcrypt gettext ];
buildNativeInputs = [ cmake automoc4 gettext ];
buildInputs = [ kdelibs phonon gmp qca2 boost libgcrypt ];
enableParallelBuilding = true;