From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1ShJKd-0007Au-2W for garchives@archives.gentoo.org; Wed, 20 Jun 2012 11:44:19 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id F1030E07C0; Wed, 20 Jun 2012 11:44:11 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 0E5B5E07C0 for ; Wed, 20 Jun 2012 11:44:10 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 43AEF1B400E for ; Wed, 20 Jun 2012 11:44:10 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 1DB3FE5435 for ; Wed, 20 Jun 2012 11:44:08 +0000 (UTC) From: "Andreas Hüttel" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Andreas Hüttel" Message-ID: <1340192621.0beb40a3423f2a6237e75992aba020f982a72cef.dilfridge@gentoo> Subject: [gentoo-commits] proj/kde:master commit in: kde-base/kdelibs/, kde-base/kdelibs/files/ X-VCS-Repository: proj/kde X-VCS-Files: kde-base/kdelibs/files/kdelibs-4.8.90-udisks2.patch kde-base/kdelibs/files/kdelibs-4.8.90-udisks2_post.patch kde-base/kdelibs/files/kdelibs-4.8.90-udisks2_prep.patch kde-base/kdelibs/kdelibs-4.8.90.ebuild kde-base/kdelibs/kdelibs-9999.ebuild X-VCS-Directories: kde-base/kdelibs/ kde-base/kdelibs/files/ X-VCS-Committer: dilfridge X-VCS-Committer-Name: Andreas Hüttel X-VCS-Revision: 0beb40a3423f2a6237e75992aba020f982a72cef X-VCS-Branch: master Date: Wed, 20 Jun 2012 11:44:08 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: 396d1189-7649-4951-bc93-4a2419a3d8ea X-Archives-Hash: 328f0b1c637651f72b516653e3a0b993 commit: 0beb40a3423f2a6237e75992aba020f982a72cef Author: Andreas K. Huettel physik uni-r <= DOT> de> AuthorDate: Wed Jun 20 11:43:41 2012 +0000 Commit: Andreas H=C3=BCttel gentoo org> CommitDate: Wed Jun 20 11:43:41 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/kde.git;a=3Dc= ommit;h=3D0beb40a3 [kde-base/kdelibs] Properly apply udisks2 patch (Portage version: 2.2.0_alpha110/git/Linux x86_64, RepoMan options: --for= ce, unsigned Manifest commit) --- .../kdelibs/files/kdelibs-4.8.90-udisks2.patch | 3643 ++++++++++++++= ++++++ .../files/kdelibs-4.8.90-udisks2_post.patch | 113 - .../files/kdelibs-4.8.90-udisks2_prep.patch | 65 - kde-base/kdelibs/kdelibs-4.8.90.ebuild | 5 +- kde-base/kdelibs/kdelibs-9999.ebuild | 5 +- 5 files changed, 3645 insertions(+), 186 deletions(-) diff --git a/kde-base/kdelibs/files/kdelibs-4.8.90-udisks2.patch b/kde-ba= se/kdelibs/files/kdelibs-4.8.90-udisks2.patch new file mode 100644 index 0000000..294ceb8 --- /dev/null +++ b/kde-base/kdelibs/files/kdelibs-4.8.90-udisks2.patch @@ -0,0 +1,3643 @@ +diff -ruN kdelibs-4.8.90.orig/solid/solid/CMakeLists.txt kdelibs-4.8.90/= solid/solid/CMakeLists.txt +--- kdelibs-4.8.90.orig/solid/solid/CMakeLists.txt 2012-05-23 01:45:27.0= 00000000 +0200 ++++ kdelibs-4.8.90/solid/solid/CMakeLists.txt 2012-06-20 13:39:51.000000= 000 +0200 +@@ -1,6 +1,7 @@ + set( EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR} ) + add_subdirectory( ifaces ) + include_directories( ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY= _DIR} ) ++include_directories( ${QT_QTDBUS_INCLUDE_DIR} ) +=20 + if(WIN32) + include_directories( ${KDEWIN_INCLUDES} ) +@@ -39,7 +40,6 @@ +=20 + file(MAKE_DIRECTORY + ${CMAKE_CURRENT_BINARY_DIR}/backends/fakehw +- ${CMAKE_CURRENT_BINARY_DIR}/backends/hal + ${CMAKE_CURRENT_BINARY_DIR}/backends/udev + ${CMAKE_CURRENT_BINARY_DIR}/backends/wmi + ) +@@ -225,33 +225,6 @@ + endif( UDEV_FOUND ) +=20 +=20 +- message(STATUS "Building Solid HAL backend." ) +- set(solid_LIB_SRCS ${solid_LIB_SRCS} +- backends/hal/halacadapter.cpp +- backends/hal/halaudiointerface.cpp +- backends/hal/halbattery.cpp +- backends/hal/halblock.cpp +- backends/hal/halbutton.cpp +- backends/hal/halcamera.cpp +- backends/hal/halcdrom.cpp +- backends/hal/haldeviceinterface.cpp +- backends/hal/haldvbinterface.cpp +- backends/hal/halfstabhandling.cpp +- backends/hal/halgenericinterface.cpp +- backends/hal/haldevice.cpp +- backends/hal/halmanager.cpp +- backends/hal/halnetworkinterface.cpp +- backends/hal/halserialinterface.cpp +- backends/hal/halopticaldisc.cpp +- backends/hal/halportablemediaplayer.cpp +- backends/hal/halprocessor.cpp +- backends/hal/halstorageaccess.cpp +- backends/hal/halstorage.cpp +- backends/hal/halvideo.cpp +- backends/hal/halvolume.cpp +- backends/hal/halsmartcardreader.cpp +- ) +- + message(STATUS "Building Solid UPower backend." ) + set(solid_LIB_SRCS ${solid_LIB_SRCS} + backends/upower/upowermanager.cpp +@@ -264,18 +237,19 @@ +=20 + # FIXME: this should work on more Unix systems + if (CMAKE_SYSTEM_NAME MATCHES Linux) +- message(STATUS "Building Solid UDisks backend." ) ++ message(STATUS "Building Solid UDisks2 backend." ) + set(solid_LIB_SRCS ${solid_LIB_SRCS} +- backends/udisks/udisksmanager.cpp +- backends/udisks/udisksdevice.cpp +- backends/udisks/udisksblock.cpp +- backends/udisks/udisksstoragevolume.cpp +- backends/udisks/udisksdeviceinterface.cpp +- backends/udisks/udisksopticaldisc.cpp +- backends/udisks/udisksopticaldrive.cpp +- backends/udisks/udisksstoragedrive.cpp +- backends/udisks/udisksstorageaccess.cpp +- backends/udisks/udisksgenericinterface.cpp ++ backends/udisks2/udisksmanager.cpp ++ backends/udisks2/udisksdevice.cpp ++ backends/udisks2/udisksblock.cpp ++ backends/udisks2/udisksstoragevolume.cpp ++ backends/udisks2/udisksdeviceinterface.cpp ++ backends/udisks2/udisksopticaldisc.cpp ++ backends/udisks2/udisksopticaldrive.cpp ++ backends/udisks2/udisksstoragedrive.cpp ++ backends/udisks2/udisksstorageaccess.cpp ++ backends/udisks2/udisksgenericinterface.cpp ++ backends/udisks2/dbus/manager.cpp + ) + endif (CMAKE_SYSTEM_NAME MATCHES Linux) +=20 +diff -ruN kdelibs-4.8.90.orig/solid/solid/backends/udisks2/dbus/manager.= cpp kdelibs-4.8.90/solid/solid/backends/udisks2/dbus/manager.cpp +--- kdelibs-4.8.90.orig/solid/solid/backends/udisks2/dbus/manager.cpp 19= 70-01-01 01:00:00.000000000 +0100 ++++ kdelibs-4.8.90/solid/solid/backends/udisks2/dbus/manager.cpp 2012-06= -20 13:39:24.000000000 +0200 +@@ -0,0 +1,26 @@ ++/* ++ * This file was generated by qdbusxml2cpp version 0.7 ++ * Command line was: qdbusxml2cpp -p manager manager.xml ++ * ++ * qdbusxml2cpp is Copyright (C) 2011 Nokia Corporation and/or its subs= idiary(-ies). ++ * ++ * This is an auto-generated file. ++ * This file may have been hand-edited. Look for HAND-EDIT comments ++ * before re-generating it. ++ */ ++ ++#include "manager.h" ++ ++/* ++ * Implementation of interface class OrgFreedesktopDBusObjectManagerInt= erface ++ */ ++ ++OrgFreedesktopDBusObjectManagerInterface::OrgFreedesktopDBusObjectManag= erInterface(const QString &service, const QString &path, const QDBusConne= ction &connection, QObject *parent) ++ : QDBusAbstractInterface(service, path, staticInterfaceName(), conn= ection, parent) ++{ ++} ++ ++OrgFreedesktopDBusObjectManagerInterface::~OrgFreedesktopDBusObjectMana= gerInterface() ++{ ++} ++ +diff -ruN kdelibs-4.8.90.orig/solid/solid/backends/udisks2/dbus/manager.= h kdelibs-4.8.90/solid/solid/backends/udisks2/dbus/manager.h +--- kdelibs-4.8.90.orig/solid/solid/backends/udisks2/dbus/manager.h 1970= -01-01 01:00:00.000000000 +0100 ++++ kdelibs-4.8.90/solid/solid/backends/udisks2/dbus/manager.h 2012-06-2= 0 13:39:24.000000000 +0200 +@@ -0,0 +1,59 @@ ++/* ++ * This file was generated by qdbusxml2cpp version 0.7 ++ * Command line was: qdbusxml2cpp -p manager manager.xml ++ * ++ * qdbusxml2cpp is Copyright (C) 2011 Nokia Corporation and/or its subs= idiary(-ies). ++ * ++ * This is an auto-generated file. ++ * Do not edit! All changes made to it will be lost. ++ */ ++ ++#ifndef MANAGER_H_1329493525 ++#define MANAGER_H_1329493525 ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "../udisks2.h" ++ ++/* ++ * Proxy class for interface org.freedesktop.DBus.ObjectManager ++ */ ++class OrgFreedesktopDBusObjectManagerInterface: public QDBusAbstractInt= erface ++{ ++ Q_OBJECT ++public: ++ static inline const char *staticInterfaceName() ++ { return "org.freedesktop.DBus.ObjectManager"; } ++ ++public: ++ OrgFreedesktopDBusObjectManagerInterface(const QString &service, co= nst QString &path, const QDBusConnection &connection, QObject *parent =3D= 0); ++ ++ ~OrgFreedesktopDBusObjectManagerInterface(); ++ ++public Q_SLOTS: // METHODS ++ inline QDBusPendingReply GetManagedObjects() ++ { ++ QList argumentList; ++ return asyncCallWithArgumentList(QLatin1String("GetManagedObjec= ts"), argumentList); ++ } ++ ++Q_SIGNALS: // SIGNALS ++ void InterfacesAdded(const QDBusObjectPath &object_path, const QVar= iantMapMap &interfaces_and_properties); ++ void InterfacesRemoved(const QDBusObjectPath &object_path, const QS= tringList &interfaces); ++}; ++ ++namespace org { ++ namespace freedesktop { ++ namespace DBus { ++ typedef ::OrgFreedesktopDBusObjectManagerInterface ObjectManager; ++ } ++ } ++} ++#endif +diff -ruN kdelibs-4.8.90.orig/solid/solid/backends/udisks2/dbus/manager.= xml kdelibs-4.8.90/solid/solid/backends/udisks2/dbus/manager.xml +--- kdelibs-4.8.90.orig/solid/solid/backends/udisks2/dbus/manager.xml 19= 70-01-01 01:00:00.000000000 +0100 ++++ kdelibs-4.8.90/solid/solid/backends/udisks2/dbus/manager.xml 2012-06= -20 13:39:24.000000000 +0200 +@@ -0,0 +1,21 @@ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ +diff -ruN kdelibs-4.8.90.orig/solid/solid/backends/udisks2/udisks2.h kde= libs-4.8.90/solid/solid/backends/udisks2/udisks2.h +--- kdelibs-4.8.90.orig/solid/solid/backends/udisks2/udisks2.h 1970-01-0= 1 01:00:00.000000000 +0100 ++++ kdelibs-4.8.90/solid/solid/backends/udisks2/udisks2.h 2012-06-20 13:= 39:24.000000000 +0200 +@@ -0,0 +1,77 @@ ++/* ++ Copyright 2012 Luk=C3=A1=C5=A1 Tinkl ++ ++ This library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) version 3, or any ++ later version accepted by the membership of KDE e.V. (or its ++ successor approved by the membership of KDE e.V.), which shall ++ act as a proxy defined in Section 6 of version 3 of the license. ++ ++ This library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with this library. If not, see . ++*/ ++ ++#ifndef SOLID_BACKENDS_UDISKS2_H ++#define SOLID_BACKENDS_UDISKS2_H ++ ++#include ++#include ++#include ++#include ++#include ++ ++typedef QList QByteArrayList; ++Q_DECLARE_METATYPE(QByteArrayList) ++ ++typedef QMap QVariantMapMap; ++Q_DECLARE_METATYPE(QVariantMapMap) ++ ++typedef QMap DBUSManagerStruct; ++Q_DECLARE_METATYPE(DBUSManagerStruct) ++ ++/* UDisks2 */ ++#define UD2_DBUS_SERVICE "org.freedesktop.UDisks2" ++#define UD2_DBUS_PATH "/org/freedesktop/UDisks2" ++#define UD2_UDI_DISKS_PREFIX "/org/freedesktop/UDisks2" ++#define UD2_DBUS_PATH_MANAGER "/org/freedesktop/UDisks2/Mana= ger" ++#define UD2_DBUS_PATH_DRIVES "/org/freedesktop/UDisks2/driv= es/" ++#define UD2_DBUS_PATH_JOBS "/org/freedesktop/UDisks2/jobs= /" ++#define DBUS_INTERFACE_PROPS "org.freedesktop.DBus.Properti= es" ++#define DBUS_INTERFACE_INTROSPECT "org.freedesktop.DBus.Introspe= ctable" ++#define DBUS_INTERFACE_MANAGER "org.freedesktop.DBus.ObjectMa= nager" ++#define UD2_DBUS_INTERFACE_BLOCK "org.freedesktop.UDisks2.Block= " ++#define UD2_DBUS_INTERFACE_DRIVE "org.freedesktop.UDisks2.Drive= " ++#define UD2_DBUS_INTERFACE_PARTITION "org.freedesktop.UDisks2.Parti= tion" ++#define UD2_DBUS_INTERFACE_PARTITIONTABLE "org.freedesktop.UDisks2.Pa= rtitionTable" ++#define UD2_DBUS_INTERFACE_FILESYSTEM "org.freedesktop.UDisks2.Files= ystem" ++#define UD2_DBUS_INTERFACE_ENCRYPTED "org.freedesktop.UDisks2.Encry= pted" ++#define UD2_DBUS_INTERFACE_SWAP "org.freedesktop.UDisks2.Swaps= pace" ++ ++/* errors */ ++#define UD2_ERROR_UNAUTHORIZED "org.freedesktop.PolicyKit.Er= ror.NotAuthorized" ++#define UD2_ERROR_BUSY "org.freedesktop.UDisks2.Erro= r.DeviceBusy" ++#define UD2_ERROR_FAILED "org.freedesktop.UDisks2.Erro= r.Failed" ++#define UD2_ERROR_CANCELED "org.freedesktop.UDisks2.Erro= r.Cancelled" ++#define UD2_ERROR_INVALID_OPTION "org.freedesktop.UDisks2.Erro= r.OptionNotPermitted" ++#define UD2_ERROR_MISSING_DRIVER "org.freedesktop.UDisks2.Erro= r.NotSupported" ++ ++#define UD2_ERROR_ALREADY_MOUNTED "org.freedesktop.UDisks2.Erro= r.AlreadyMounted" ++#define UD2_ERROR_NOT_MOUNTED "org.freedesktop.UDisks2.Erro= r.NotMounted" ++#define UD2_ERROR_MOUNTED_BY_OTHER_USER "org.freedesktop.UDisks2.Erro= r.MountedByOtherUser" ++#define UD2_ERROR_ALREADY_UNMOUNTING "org.freedesktop.UDisks2.Erro= r.AlreadyUnmounting" ++#define UD2_ERROR_TIMED_OUT "org.freedesktop.UDisks2.Erro= r.Timedout" ++#define UD2_ERROR_WOULD_WAKEUP "org.freedesktop.UDisks2.Erro= r.WouldWakeup" ++#define UD2_ERROR_ALREADY_CANCELLED "org.freedesktop.UDisks2.Erro= r.AlreadyCancelled" ++ ++#define UD2_ERROR_NOT_AUTHORIZED "org.freedesktop.UDisks2.Erro= r.NotAuthorized" ++#define UD2_ERROR_NOT_AUTHORIZED_CAN_OBTAIN "org.freedesktop.UDisks2.E= rror.NotAuthorizedCanObtain" ++#define UD2_ERROR_NOT_AUTHORIZED_DISMISSED "org.freedesktop.UDisks2.E= rror.NotAuthorizedDismissed" ++ ++#endif // SOLID_BACKENDS_UDISKS2_H +diff -ruN kdelibs-4.8.90.orig/solid/solid/backends/udisks2/udisksblock.c= pp kdelibs-4.8.90/solid/solid/backends/udisks2/udisksblock.cpp +--- kdelibs-4.8.90.orig/solid/solid/backends/udisks2/udisksblock.cpp 197= 0-01-01 01:00:00.000000000 +0100 ++++ kdelibs-4.8.90/solid/solid/backends/udisks2/udisksblock.cpp 2012-06-= 20 13:39:24.000000000 +0200 +@@ -0,0 +1,84 @@ ++/* ++ Copyright 2012 Luk=C3=A1=C5=A1 Tinkl ++ ++ This library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) version 3, or any ++ later version accepted by the membership of KDE e.V. (or its ++ successor approved by the membership of KDE e.V.), which shall ++ act as a proxy defined in Section 6 of version 3 of the license. ++ ++ This library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with this library. If not, see . ++*/ ++ ++#include ++ ++#include ++#include ++#include ++ ++#include "udisksblock.h" ++#include "dbus/manager.h" ++ ++using namespace Solid::Backends::UDisks2; ++ ++Block::Block(Device *dev) ++ : DeviceInterface(dev) ++{ ++ m_devNum =3D m_device->prop("DeviceNumber").toULongLong(); ++ m_devFile =3D QFile::decodeName(m_device->prop("Device").toByteArra= y()); ++ ++ // we have a drive (non-block device for udisks), so let's find the= corresponding (real) block device ++ if (m_devNum =3D=3D 0 || m_devFile.isEmpty()) { ++ org::freedesktop::DBus::ObjectManager manager(UD2_DBUS_SERVICE,= UD2_DBUS_PATH, QDBusConnection::systemBus()); ++ QDBusPendingReply reply =3D manager.GetManag= edObjects(); ++ reply.waitForFinished(); ++ if (!reply.isError()) { // enum devices ++ Q_FOREACH(const QDBusObjectPath &path, reply.value().keys()= ) { ++ const QString udi =3D path.path(); ++ ++ if (udi =3D=3D UD2_DBUS_PATH_MANAGER || udi =3D=3D UD2_= UDI_DISKS_PREFIX || udi.startsWith(UD2_DBUS_PATH_JOBS)) ++ continue; ++ ++ Device device(udi); ++ if (device.drivePath() =3D=3D dev->udi()) { ++ m_devNum =3D device.prop("DeviceNumber").toULongLon= g(); ++ m_devFile =3D QFile::decodeName(device.prop("Device= ").toByteArray()); ++ break; ++ } ++ } ++ } ++ else // show error ++ { ++ qWarning() << "Failed enumerating UDisks2 objects:" << repl= y.error().name() << "\n" << reply.error().message(); ++ } ++ } ++ ++ qDebug() << "devnum:" << m_devNum << "dev file:" << m_devFile; ++} ++ ++Block::~Block() ++{ ++} ++ ++QString Block::device() const ++{ ++ return m_devFile; ++} ++ ++int Block::deviceMinor() const ++{ ++ return MINOR(m_devNum); ++} ++ ++int Block::deviceMajor() const ++{ ++ return MAJOR(m_devNum); ++} +diff -ruN kdelibs-4.8.90.orig/solid/solid/backends/udisks2/udisksblock.h= kdelibs-4.8.90/solid/solid/backends/udisks2/udisksblock.h +--- kdelibs-4.8.90.orig/solid/solid/backends/udisks2/udisksblock.h 1970-= 01-01 01:00:00.000000000 +0100 ++++ kdelibs-4.8.90/solid/solid/backends/udisks2/udisksblock.h 2012-06-20= 13:39:24.000000000 +0200 +@@ -0,0 +1,56 @@ ++/* ++ Copyright 2012 Luk=C3=A1=C5=A1 Tinkl ++ ++ This library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) version 3, or any ++ later version accepted by the membership of KDE e.V. (or its ++ successor approved by the membership of KDE e.V.), which shall ++ act as a proxy defined in Section 6 of version 3 of the license. ++ ++ This library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with this library. If not, see . ++*/ ++ ++#ifndef UDISKS2BLOCK_H ++#define UDISKS2BLOCK_H ++ ++#include ++#include "udisksdeviceinterface.h" ++ ++namespace Solid ++{ ++namespace Backends ++{ ++namespace UDisks2 ++{ ++ ++class Block: public DeviceInterface, virtual public Solid::Ifaces::Bloc= k ++{ ++ ++ Q_OBJECT ++ Q_INTERFACES(Solid::Ifaces::Block) ++ ++public: ++ Block(Device *dev); ++ virtual ~Block(); ++ ++ virtual QString device() const; ++ virtual int deviceMinor() const; ++ virtual int deviceMajor() const; ++private: ++ dev_t m_devNum; ++ QString m_devFile; ++}; ++ ++} ++} ++} ++ ++#endif // UDISKS2BLOCK_H +diff -ruN kdelibs-4.8.90.orig/solid/solid/backends/udisks2/udisksdevice.= cpp kdelibs-4.8.90/solid/solid/backends/udisks2/udisksdevice.cpp +--- kdelibs-4.8.90.orig/solid/solid/backends/udisks2/udisksdevice.cpp 19= 70-01-01 01:00:00.000000000 +0100 ++++ kdelibs-4.8.90/solid/solid/backends/udisks2/udisksdevice.cpp 2012-06= -20 13:39:24.000000000 +0200 +@@ -0,0 +1,910 @@ ++/* ++ Copyright 2010 Michael Zanetti ++ Copyright 2010-2012 Luk=C3=A1=C5=A1 Tinkl ++ ++ This library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) version 3, or any ++ later version accepted by the membership of KDE e.V. (or its ++ successor approved by the membership of KDE e.V.), which shall ++ act as a proxy defined in Section 6 of version 3 of the license. ++ ++ This library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with this library. If not, see . ++*/ ++ ++#include "udisksdevice.h" ++#include "udisksblock.h" ++#include "udisksdeviceinterface.h" ++#include "udisksstoragevolume.h" ++#include "udisksopticaldisc.h" ++#include "udisksopticaldrive.h" ++#include "udisksstorageaccess.h" ++#include "udisksgenericinterface.h" ++ ++#include ++#include ++#include ++ ++#include ++ ++#include ++#include ++#include ++#include ++ ++#include ++ ++using namespace Solid::Backends::UDisks2; ++ ++// Adapted from KLocale as Solid needs to be Qt-only ++static QString formatByteSize(double size) ++{ ++ // Per IEC 60027-2 ++ ++ // Binary prefixes ++ //Tebi-byte TiB 2^40 1,099,511,627,776 b= ytes ++ //Gibi-byte GiB 2^30 1,073,741,824 bytes ++ //Mebi-byte MiB 2^20 1,048,576 bytes ++ //Kibi-byte KiB 2^10 1,024 bytes ++ ++ QString s; ++ // Gibi-byte ++ if ( size >=3D 1073741824.0 ) ++ { ++ size /=3D 1073741824.0; ++ if ( size > 1024 ) // Tebi-byte ++ s =3D QObject::tr("%1 TiB").arg(QLocale().toString(size / 1= 024.0, 'f', 1)); ++ else ++ s =3D QObject::tr("%1 GiB").arg(QLocale().toString(size, 'f= ', 1)); ++ } ++ // Mebi-byte ++ else if ( size >=3D 1048576.0 ) ++ { ++ size /=3D 1048576.0; ++ s =3D QObject::tr("%1 MiB").arg(QLocale().toString(size, 'f', 1= )); ++ } ++ // Kibi-byte ++ else if ( size >=3D 1024.0 ) ++ { ++ size /=3D 1024.0; ++ s =3D QObject::tr("%1 KiB").arg(QLocale().toString(size, 'f', 1= )); ++ } ++ // Just byte ++ else if ( size > 0 ) ++ { ++ s =3D QObject::tr("%1 B").arg(QLocale().toString(size, 'f', 1))= ; ++ } ++ // Nothing ++ else ++ { ++ s =3D QObject::tr("0 B"); ++ } ++ return s; ++} ++ ++Device::Device(const QString &udi) ++ : Solid::Ifaces::Device() ++ , m_udi(udi) ++{ ++ m_device =3D new QDBusInterface(UD2_DBUS_SERVICE, m_udi, ++ QString(), // no interface, we aggreg= ate them ++ QDBusConnection::systemBus()); ++ ++ if (m_device->isValid()) { ++ QDBusConnection::systemBus().connect(UD2_DBUS_SERVICE, m_udi, D= BUS_INTERFACE_PROPS, "PropertiesChanged", this, ++ SLOT(slotPropertiesChanged= (QString,QVariantMap,QStringList))); ++ ++ QDBusConnection::systemBus().connect(UD2_DBUS_SERVICE, UD2_DBUS= _PATH, DBUS_INTERFACE_MANAGER, "InterfacesAdded", ++ this, SLOT(slotInterfacesA= dded(QDBusObjectPath,QVariantMapMap))); ++ QDBusConnection::systemBus().connect(UD2_DBUS_SERVICE, UD2_DBUS= _PATH, DBUS_INTERFACE_MANAGER, "InterfacesRemoved", ++ this, SLOT(slotInterfacesR= emoved(QDBusObjectPath,QStringList))); ++ ++ initInterfaces(); ++ } ++} ++ ++Device::~Device() ++{ ++ delete m_device; ++} ++ ++QObject* Device::createDeviceInterface(const Solid::DeviceInterface::Ty= pe& type) ++{ ++ if (!queryDeviceInterface(type)) { ++ return 0; ++ } ++ ++ DeviceInterface *iface =3D 0; ++ switch (type) ++ { ++ case Solid::DeviceInterface::GenericInterface: ++ iface =3D new GenericInterface(this); ++ break; ++ case Solid::DeviceInterface::Block: ++ iface =3D new Block(this); ++ break; ++ case Solid::DeviceInterface::StorageAccess: ++ iface =3D new StorageAccess(this); ++ break; ++ case Solid::DeviceInterface::StorageDrive: ++ iface =3D new StorageDrive(this); ++ break; ++ case Solid::DeviceInterface::OpticalDrive: ++ iface =3D new OpticalDrive(this); ++ break; ++ case Solid::DeviceInterface::StorageVolume: ++ iface =3D new StorageVolume(this); ++ break; ++ case Solid::DeviceInterface::OpticalDisc: ++ iface =3D new OpticalDisc(this); ++ break; ++ default: ++ break; ++ } ++ return iface; ++} ++ ++bool Device::queryDeviceInterface(const Solid::DeviceInterface::Type& t= ype) const ++{ ++ switch (type) { ++ case Solid::DeviceInterface::GenericInterface: ++ return true; ++ case Solid::DeviceInterface::Block: ++ return isBlock(); ++ case Solid::DeviceInterface::StorageVolume: ++ return isStorageVolume(); ++ case Solid::DeviceInterface::StorageAccess: ++ return isStorageAccess(); ++ case Solid::DeviceInterface::StorageDrive: ++ return isDrive(); ++ case Solid::DeviceInterface::OpticalDrive: ++ return isOpticalDrive(); ++ case Solid::DeviceInterface::OpticalDisc: ++ return isOpticalDisc(); ++ default: ++ return false; ++ } ++} ++ ++QStringList Device::emblems() const ++{ ++ QStringList res; ++ ++ if (queryDeviceInterface(Solid::DeviceInterface::StorageAccess)) ++ { ++ const UDisks2::StorageAccess accessIface(const_cast(t= his)); ++ if (accessIface.isAccessible()) ++ { ++ if (isEncryptedContainer()) ++ res << "emblem-encrypted-unlocked"; ++ else ++ res << "emblem-mounted"; ++ } ++ else ++ { ++ if (isEncryptedContainer()) ++ res << "emblem-encrypted-locked"; ++ else ++ res << "emblem-unmounted"; ++ } ++ } ++ ++ return res; ++} ++ ++QString Device::description() const ++{ ++ const QString hintName =3D prop("HintName").toString(); ++ if (!hintName.isEmpty()) ++ return hintName; ++ ++ if (queryDeviceInterface(Solid::DeviceInterface::StorageDrive)) ++ return storageDescription(); ++ else if (queryDeviceInterface(Solid::DeviceInterface::StorageVolume= )) ++ return volumeDescription(); ++ else ++ return product(); ++} ++ ++QString Device::storageDescription() const ++{ ++ QString description; ++ const UDisks2::StorageDrive storageDrive(const_cast(this))= ; ++ Solid::StorageDrive::DriveType drive_type =3D storageDrive.driveTyp= e(); ++ bool drive_is_hotpluggable =3D storageDrive.isHotpluggable(); ++ ++ if (drive_type =3D=3D Solid::StorageDrive::CdromDrive) ++ { ++ const UDisks2::OpticalDrive opticalDrive(const_cast(th= is)); ++ Solid::OpticalDrive::MediumTypes mediumTypes =3D opticalDrive.s= upportedMedia(); ++ QString first; ++ QString second; ++ ++ first =3D QObject::tr("CD-ROM", "First item of %1%2 Drive sente= nce"); ++ if (mediumTypes & Solid::OpticalDrive::Cdr) ++ first =3D QObject::tr("CD-R", "First item of %1%2 Drive sen= tence"); ++ if (mediumTypes & Solid::OpticalDrive::Cdrw) ++ first =3D QObject::tr("CD-RW", "First item of %1%2 Drive se= ntence"); ++ ++ if (mediumTypes & Solid::OpticalDrive::Dvd) ++ second =3D QObject::tr("/DVD-ROM", "Second item of %1%2 Dri= ve sentence"); ++ if (mediumTypes & Solid::OpticalDrive::Dvdplusr) ++ second =3D QObject::tr("/DVD+R", "Second item of %1%2 Drive= sentence"); ++ if (mediumTypes & Solid::OpticalDrive::Dvdplusrw) ++ second =3D QObject::tr("/DVD+RW", "Second item of %1%2 Driv= e sentence"); ++ if (mediumTypes & Solid::OpticalDrive::Dvdr) ++ second =3D QObject::tr("/DVD-R", "Second item of %1%2 Drive= sentence"); ++ if (mediumTypes & Solid::OpticalDrive::Dvdrw) ++ second =3D QObject::tr("/DVD-RW", "Second item of %1%2 Driv= e sentence"); ++ if (mediumTypes & Solid::OpticalDrive::Dvdram) ++ second =3D QObject::tr("/DVD-RAM", "Second item of %1%2 Dri= ve sentence"); ++ if ((mediumTypes & Solid::OpticalDrive::Dvdr) && (mediumTypes &= Solid::OpticalDrive::Dvdplusr)) ++ { ++ if(mediumTypes & Solid::OpticalDrive::Dvdplusdl) ++ second =3D QObject::trUtf8("/DVD=C2=B1R DL", "Second it= em of %1%2 Drive sentence"); ++ else ++ second =3D QObject::trUtf8("/DVD=C2=B1R", "Second item = of %1%2 Drive sentence"); ++ } ++ if ((mediumTypes & Solid::OpticalDrive::Dvdrw) && (mediumTypes = & Solid::OpticalDrive::Dvdplusrw)) ++ { ++ if((mediumTypes & Solid::OpticalDrive::Dvdplusdl) || (mediu= mTypes & Solid::OpticalDrive::Dvdplusdlrw)) ++ second =3D QObject::trUtf8("/DVD=C2=B1RW DL", "Second i= tem of %1%2 Drive sentence"); ++ else ++ second =3D QObject::trUtf8("/DVD=C2=B1RW", "Second item= of %1%2 Drive sentence"); ++ } ++ if (mediumTypes & Solid::OpticalDrive::Bd) ++ second =3D QObject::tr("/BD-ROM", "Second item of %1%2 Driv= e sentence"); ++ if (mediumTypes & Solid::OpticalDrive::Bdr) ++ second =3D QObject::tr("/BD-R", "Second item of %1%2 Drive = sentence"); ++ if (mediumTypes & Solid::OpticalDrive::Bdre) ++ second =3D QObject::tr("/BD-RE", "Second item of %1%2 Drive= sentence"); ++ if (mediumTypes & Solid::OpticalDrive::HdDvd) ++ second =3D QObject::tr("/HD DVD-ROM", "Second item of %1%2 = Drive sentence"); ++ if (mediumTypes & Solid::OpticalDrive::HdDvdr) ++ second =3D QObject::tr("/HD DVD-R", "Second item of %1%2 Dr= ive sentence"); ++ if (mediumTypes & Solid::OpticalDrive::HdDvdrw) ++ second =3D QObject::tr("/HD DVD-RW", "Second item of %1%2 D= rive sentence"); ++ ++ if (drive_is_hotpluggable) ++ description =3D QObject::tr("External %1%2 Drive", "%1 is C= D-ROM/CD-R/etc; %2 is '/DVD-ROM'/'/DVD-R'/etc (with leading slash)").arg(= first).arg(second); ++ else ++ description =3D QObject::tr("%1%2 Drive", "%1 is CD-ROM/CD-= R/etc; %2 is '/DVD-ROM'/'/DVD-R'/etc (with leading slash)").arg(first).ar= g(second); ++ ++ return description; ++ } ++ ++ if (drive_type =3D=3D Solid::StorageDrive::Floppy) ++ { ++ if (drive_is_hotpluggable) ++ description =3D QObject::tr("External Floppy Drive"); ++ else ++ description =3D QObject::tr("Floppy Drive"); ++ ++ return description; ++ } ++ ++ bool drive_is_removable =3D storageDrive.isRemovable(); ++ ++ if (drive_type =3D=3D Solid::StorageDrive::HardDisk && !drive_is_re= movable) ++ { ++ QString size_str =3D formatByteSize(storageDrive.size()); ++ if (!size_str.isEmpty()) ++ { ++ if (drive_is_hotpluggable) ++ description =3D QObject::tr("%1 External Hard Drive", "= %1 is the size").arg(size_str); ++ else ++ description =3D QObject::tr("%1 Hard Drive", "%1 is the= size").arg(size_str); ++ } else { ++ if (drive_is_hotpluggable) ++ description =3D QObject::tr("External Hard Drive"); ++ else ++ description =3D QObject::tr("Hard Drive"); ++ } ++ ++ return description; ++ } ++ ++ QString vendormodel_str; ++ QString model =3D product(); ++ QString vendor_str =3D vendor(); ++ ++ if (vendor_str.isEmpty()) ++ { ++ if (!model.isEmpty()) ++ vendormodel_str =3D model; ++ } ++ else ++ { ++ if (model.isEmpty()) ++ vendormodel_str =3D vendor_str; ++ else ++ { ++ if (model.startsWith(vendor_str)) ++ { ++ // e.g. vendor is "Nokia" and model is "Nokia N950" we = do not want "Nokia Nokia N950" as description ++ vendormodel_str =3D model; ++ } ++ else ++ { ++ vendormodel_str =3D QObject::tr("%1 %2", "%1 is the ven= dor, %2 is the model of the device").arg(vendor_str).arg(model); ++ } ++ } ++ } ++ ++ if (vendormodel_str.isEmpty()) ++ description =3D QObject::tr("Drive"); ++ else ++ description =3D vendormodel_str; ++ ++ return description; ++} ++ ++QString Device::volumeDescription() const ++{ ++ QString description; ++ const UDisks2::StorageVolume storageVolume(const_cast(this= )); ++ QString volume_label =3D prop("IdLabel").toString(); ++ if (volume_label.isEmpty()) ++ volume_label =3D prop("Name").toString(); ++ if (!volume_label.isEmpty()) ++ return volume_label; ++ ++ UDisks2::Device storageDevice(drivePath()); ++ const UDisks2::StorageDrive storageDrive(&storageDevice); ++ Solid::StorageDrive::DriveType drive_type =3D storageDrive.driveTyp= e(); ++ ++ // Handle media in optical drives ++ if (drive_type =3D=3D Solid::StorageDrive::CdromDrive) ++ { ++ const UDisks2::OpticalDisc disc(const_cast(this)); ++ switch (disc.discType()) ++ { ++ case Solid::OpticalDisc::UnknownDiscType: ++ case Solid::OpticalDisc::CdRom: ++ description =3D QObject::tr("CD-ROM"); ++ break; ++ ++ case Solid::OpticalDisc::CdRecordable: ++ if (disc.isBlank()) ++ description =3D QObject::tr("Blank CD-R"); ++ else ++ description =3D QObject::tr("CD-R"); ++ break; ++ ++ case Solid::OpticalDisc::CdRewritable: ++ if (disc.isBlank()) ++ description =3D QObject::tr("Blank CD-RW"); ++ else ++ description =3D QObject::tr("CD-RW"); ++ break; ++ ++ case Solid::OpticalDisc::DvdRom: ++ description =3D QObject::tr("DVD-ROM"); ++ break; ++ ++ case Solid::OpticalDisc::DvdRam: ++ if (disc.isBlank()) ++ description =3D QObject::tr("Blank DVD-RAM"); ++ else ++ description =3D QObject::tr("DVD-RAM"); ++ break; ++ ++ case Solid::OpticalDisc::DvdRecordable: ++ if (disc.isBlank()) ++ description =3D QObject::tr("Blank DVD-R"); ++ else ++ description =3D QObject::tr("DVD-R"); ++ break; ++ ++ case Solid::OpticalDisc::DvdPlusRecordableDuallayer: ++ if (disc.isBlank()) ++ description =3D QObject::tr("Blank DVD+R Dual-Layer= "); ++ else ++ description =3D QObject::tr("DVD+R Dual-Layer"); ++ break; ++ ++ case Solid::OpticalDisc::DvdRewritable: ++ if (disc.isBlank()) ++ description =3D QObject::tr("Blank DVD-RW"); ++ else ++ description =3D QObject::tr("DVD-RW"); ++ break; ++ ++ case Solid::OpticalDisc::DvdPlusRecordable: ++ if (disc.isBlank()) ++ description =3D QObject::tr("Blank DVD+R"); ++ else ++ description =3D QObject::tr("DVD+R"); ++ break; ++ ++ case Solid::OpticalDisc::DvdPlusRewritable: ++ if (disc.isBlank()) ++ description =3D QObject::tr("Blank DVD+RW"); ++ else ++ description =3D QObject::tr("DVD+RW"); ++ break; ++ ++ case Solid::OpticalDisc::DvdPlusRewritableDuallayer: ++ if (disc.isBlank()) ++ description =3D QObject::tr("Blank DVD+RW Dual-Laye= r"); ++ else ++ description =3D QObject::tr("DVD+RW Dual-Layer"); ++ break; ++ ++ case Solid::OpticalDisc::BluRayRom: ++ description =3D QObject::tr("BD-ROM"); ++ break; ++ ++ case Solid::OpticalDisc::BluRayRecordable: ++ if (disc.isBlank()) ++ description =3D QObject::tr("Blank BD-R"); ++ else ++ description =3D QObject::tr("BD-R"); ++ break; ++ ++ case Solid::OpticalDisc::BluRayRewritable: ++ if (disc.isBlank()) ++ description =3D QObject::tr("Blank BD-RE"); ++ else ++ description =3D QObject::tr("BD-RE"); ++ break; ++ ++ case Solid::OpticalDisc::HdDvdRom: ++ description =3D QObject::tr("HD DVD-ROM"); ++ break; ++ ++ case Solid::OpticalDisc::HdDvdRecordable: ++ if (disc.isBlank()) ++ description =3D QObject::tr("Blank HD DVD-R"); ++ else ++ description =3D QObject::tr("HD DVD-R"); ++ break; ++ ++ case Solid::OpticalDisc::HdDvdRewritable: ++ if (disc.isBlank()) ++ description =3D QObject::tr("Blank HD DVD-RW"); ++ else ++ description =3D QObject::tr("HD DVD-RW"); ++ break; ++ } ++ ++ // Special case for pure audio disc ++ if (disc.availableContent() =3D=3D Solid::OpticalDisc::Audio) ++ description =3D QObject::tr("Audio CD"); ++ ++ return description; ++ } ++ ++ const bool drive_is_removable =3D storageDrive.isRemovable(); ++ const bool drive_is_hotpluggable =3D storageDrive.isHotpluggable(); ++ ++ QString size_str =3D formatByteSize(storageVolume.size()); ++ if (isEncryptedContainer()) ++ { ++ if (!size_str.isEmpty()) ++ description =3D QObject::tr("%1 Encrypted Container", "%1 i= s the size").arg(size_str); ++ else ++ description =3D QObject::tr("Encrypted Container"); ++ } ++ else if (drive_type =3D=3D Solid::StorageDrive::HardDisk && !drive_= is_removable) ++ { ++ if (!size_str.isEmpty()) ++ { ++ if (drive_is_hotpluggable) ++ description =3D QObject::tr("%1 External Hard Drive", "= %1 is the size").arg(size_str); ++ else ++ description =3D QObject::tr("%1 Hard Drive", "%1 is the= size").arg(size_str); ++ } ++ else ++ { ++ if (drive_is_hotpluggable) ++ description =3D QObject::tr("External Hard Drive"); ++ else ++ description =3D QObject::tr("Hard Drive"); ++ } ++ } ++ else ++ { ++ if (drive_is_removable) ++ description =3D QObject::tr("%1 Removable Media", "%1 is th= e size").arg(size_str); ++ else ++ description =3D QObject::tr("%1 Media", "%1 is the size").a= rg(size_str); ++ } ++ ++ return description; ++} ++ ++QString Device::icon() const ++{ ++ QString iconName =3D prop( "HintIconName" ).toString(); ++ ++ if ( !iconName.isEmpty() ) ++ { ++ return iconName; ++ } ++ else if (isDrive()) { ++ const bool isRemovable =3D prop("Removable").toBool(); ++ const QString conn =3D prop("ConnectionBus").toString(); ++ ++ if (isOpticalDrive()) ++ return "drive-optical"; ++ else if (isRemovable && !isOpticalDisc()) { ++ if (conn =3D=3D "usb") ++ return "drive-removable-media-usb"; ++ else ++ return "drive-removable-media"; ++ } ++ } ++ else if (isBlock()) { ++ Device drive(drivePath()); ++ ++ // handle media ++ const QString media =3D drive.prop("Media").toString(); ++ ++ if ( !media.isEmpty() ) ++ { ++ if ( isOpticalDisc() ) // optical stuff ++ { ++ bool isWritable =3D drive.prop("OpticalBlank").toBool()= ; ++ ++ const UDisks2::OpticalDisc disc(const_cast(thi= s)); ++ Solid::OpticalDisc::ContentTypes availContent =3D disc.= availableContent(); ++ ++ if (availContent & Solid::OpticalDisc::VideoDvd) // Vid= eo DVD ++ return "media-optical-dvd-video"; ++ else if ((availContent & Solid::OpticalDisc::VideoCd) |= | (availContent & Solid::OpticalDisc::SuperVideoCd)) // Video CD ++ return "media-optical-video"; ++ else if ((availContent & Solid::OpticalDisc::Data) && (= availContent & Solid::OpticalDisc::Audio)) // Mixed CD ++ return "media-optical-mixed-cd"; ++ else if (availContent & Solid::OpticalDisc::Audio) // A= udio CD ++ return "media-optical-audio"; ++ else if (availContent & Solid::OpticalDisc::Data) // Da= ta CD ++ return "media-optical-data"; ++ else if ( isWritable ) ++ return "media-optical-recordable"; ++ else ++ { ++ if ( media.startsWith( "optical_dvd" ) || media.sta= rtsWith( "optical_hddvd" ) ) // DVD ++ return "media-optical-dvd"; ++ else if ( media.startsWith( "optical_bd" ) ) // Blu= Ray ++ return "media-optical-blu-ray"; ++ } ++ ++ // fallback for every other optical disc ++ return "media-optical"; ++ } ++ ++ if ( media =3D=3D "flash_ms" ) // Flash & Co. ++ return "media-flash-memory-stick"; ++ else if ( media =3D=3D "flash_sd" || media =3D=3D "flash_sd= hc" || media =3D=3D "flash_sdxc" || media =3D=3D "flash_mmc" ) ++ return "media-flash-sd-mmc"; ++ else if ( media =3D=3D "flash_sm" ) ++ return "media-flash-smart-media"; ++ else if ( media =3D=3D "thumb" ) ++ return "drive-removable-media-usb-pendrive"; ++ else if ( media.startsWith( "flash" ) ) ++ return "media-flash"; ++ else if ( media =3D=3D "floppy" ) // the good ol' floppy ++ return "media-floppy"; ++ } ++ ++ if (drive.prop("ConnectionBus").toString() =3D=3D "sdio") // h= ack for SD cards connected thru sdio bus ++ return "media-flash-sd-mmc"; ++ ++ return drive.icon(); ++ } ++ ++ return "drive-harddisk"; // general fallback ++} ++ ++QString Device::product() const ++{ ++ QString product =3D prop("Model").toString(); ++ ++ if (!isDrive()) { ++ QString label =3D prop("IdLabel").toString(); ++ if (!label.isEmpty()) { ++ product =3D label; ++ } ++ } ++ ++ return product; ++} ++ ++QString Device::vendor() const ++{ ++ return prop("Vendor").toString(); ++} ++ ++QString Device::udi() const ++{ ++ return m_udi; ++} ++ ++QString Device::parentUdi() const ++{ ++ QString parent; ++ ++ if (isEncryptedContainer()) ++ parent =3D prop("CryptoBackingDevice").value()= .path(); ++ else if (propertyExists("Drive")) // block ++ parent =3D prop("Drive").value().path(); ++ else if (propertyExists("Table")) // partition ++ parent =3D prop("Table").value().path(); ++ else if (parent.isEmpty() || parent=3D=3D"/") { ++ parent =3D UD2_UDI_DISKS_PREFIX; ++ } ++ return parent; ++} ++ ++void Device::checkCache(const QString &key) const ++{ ++ if (m_cache.isEmpty()) // recreate the cache ++ allProperties(); ++ ++ if (m_cache.contains(key)) ++ return; ++ ++ QVariant reply =3D m_device->property(key.toUtf8()); ++ ++ if (reply.isValid()) { ++ m_cache.insert(key, reply); ++ } else { ++ //qDebug() << "got invalid reply for cache:" << key; ++ //m_cache.insert(key, QVariant()); ++ } ++} ++ ++QString Device::introspect() const ++{ ++ QDBusMessage call =3D QDBusMessage::createMethodCall(UD2_DBUS_SERVI= CE, m_udi, ++ DBUS_INTERFACE_I= NTROSPECT, "Introspect"); ++ QDBusPendingReply reply =3D QDBusConnection::systemBus().a= syncCall(call); ++ reply.waitForFinished(); ++ ++ if (reply.isValid()) ++ return reply.value(); ++ else { ++ return QString(); ++ } ++} ++ ++QVariant Device::prop(const QString &key) const ++{ ++ checkCache(key); ++ return m_cache.value(key); ++} ++ ++bool Device::propertyExists(const QString &key) const ++{ ++ checkCache(key); ++ return m_cache.contains(key); ++} ++ ++QVariantMap Device::allProperties() const ++{ ++ Q_FOREACH (const QString & iface, m_interfaces) { ++ if (iface.startsWith("org.freedesktop.DBus")) ++ continue; ++ QDBusMessage call =3D QDBusMessage::createMethodCall(UD2_DBUS_S= ERVICE, m_udi, DBUS_INTERFACE_PROPS, "GetAll"); ++ call << iface; ++ QDBusPendingReply reply =3D QDBusConnection::syste= mBus().asyncCall(call); ++ reply.waitForFinished(); ++ ++ if (reply.isValid()) ++ m_cache.unite(reply.value()); ++ else ++ qWarning() << "Error getting props:" << reply.error().name(= ) << reply.error().message(); ++ //qDebug() << "After iface" << iface << ", cache now contains" = << m_cache.size() << "items"; ++ } ++ ++ return m_cache; ++} ++ ++bool Device::hasInterface(const QString &name) const ++{ ++ return m_interfaces.contains(name); ++} ++ ++QStringList Device::interfaces() const ++{ ++ return m_interfaces; ++} ++ ++void Device::initInterfaces() ++{ ++ m_interfaces.clear(); ++ const QString xmlData =3D introspect(); ++ QDomDocument dom; ++ dom.setContent(xmlData); ++ QDomNodeList ifaceNodeList =3D dom.elementsByTagName("interface"); ++ for (int i =3D 0; i < ifaceNodeList.count(); i++) { ++ QDomElement ifaceElem =3D ifaceNodeList.item(i).toElement(); ++ if (!ifaceElem.isNull()) ++ m_interfaces.append(ifaceElem.attribute("name")); ++ } ++ //qDebug() << "Device" << m_udi << "has interfaces:" << m_interface= s; ++} ++ ++void Device::slotPropertiesChanged(const QString &ifaceName, const QVar= iantMap &changedProps, const QStringList &invalidatedProps) ++{ ++ //Q_UNUSED(ifaceName); ++ ++ qDebug() << m_udi << "'s interface" << ifaceName << "changed props:= "; ++ ++ QMap changeMap; ++ ++ Q_FOREACH(const QString & key, invalidatedProps) { ++ m_cache.remove(key); ++ changeMap.insert(key, Solid::GenericInterface::PropertyRemoved)= ; ++ qDebug() << "\t invalidated:" << key; ++ } ++ ++ QMapIterator i(changedProps); ++ while (i.hasNext()) { ++ i.next(); ++ const QString key =3D i.key(); ++ m_cache.insert(key, i.value()); // replace the value ++ changeMap.insert(key, Solid::GenericInterface::PropertyModified= ); ++ qDebug() << "\t modified:" << key << ":" << m_cache.value(key); ++ } ++ ++ Q_EMIT propertyChanged(changeMap); ++ Q_EMIT changed(); ++} ++ ++void Device::slotInterfacesAdded(const QDBusObjectPath &object_path, co= nst QVariantMapMap &interfaces_and_properties) ++{ ++ if (object_path.path() =3D=3D m_udi) { ++ m_interfaces.append(interfaces_and_properties.keys()); ++ } ++} ++ ++void Device::slotInterfacesRemoved(const QDBusObjectPath &object_path, = const QStringList &interfaces) ++{ ++ if (object_path.path() =3D=3D m_udi) { ++ Q_FOREACH(const QString & iface, interfaces) { ++ m_interfaces.removeAll(iface); ++ } ++ } ++} ++ ++ ++QString Device::errorToString(const QString & error) const ++{ ++ if (error =3D=3D UD2_ERROR_UNAUTHORIZED || error =3D=3D UD2_ERROR_N= OT_AUTHORIZED) ++ return QObject::tr("You are not authorized to perform this oper= ation"); ++ else if (error =3D=3D UD2_ERROR_BUSY) ++ return QObject::tr("The device is currently busy"); ++ else if (error =3D=3D UD2_ERROR_FAILED) ++ return QObject::tr("The requested operation has failed"); ++ else if (error =3D=3D UD2_ERROR_CANCELED) ++ return QObject::tr("The requested operation has been canceled")= ; ++ else if (error =3D=3D UD2_ERROR_INVALID_OPTION) ++ return QObject::tr("An invalid or malformed option has been giv= en"); ++ else if (error =3D=3D UD2_ERROR_MISSING_DRIVER) ++ return QObject::tr("The kernel driver for this filesystem type = is not available"); ++ else if (error =3D=3D UD2_ERROR_ALREADY_MOUNTED) ++ return QObject::tr("The device is already mounted"); ++ else if (error =3D=3D UD2_ERROR_NOT_MOUNTED) ++ return QObject::tr("The device is not mounted"); ++ else if (error =3D=3D UD2_ERROR_MOUNTED_BY_OTHER_USER) ++ return QObject::tr("The device is mounted by another user"); ++ else if (error =3D=3D UD2_ERROR_ALREADY_UNMOUNTING) ++ return QObject::tr("The device is already unmounting"); ++ else if (error =3D=3D UD2_ERROR_TIMED_OUT) ++ return QObject::tr("The operation timed out"); ++ else if (error =3D=3D UD2_ERROR_WOULD_WAKEUP) ++ return QObject::tr("The operation would wake up a disk that is = in a deep-sleep state"); ++ else if (error =3D=3D UD2_ERROR_ALREADY_CANCELLED) ++ return QObject::tr("The operation has already been canceled"); ++ else ++ return QObject::tr("An unspecified error has occurred"); ++} ++ ++Solid::ErrorType Device::errorToSolidError(const QString & error) const ++{ ++ if (error =3D=3D UD2_ERROR_BUSY) ++ return Solid::DeviceBusy; ++ else if (error =3D=3D UD2_ERROR_FAILED) ++ return Solid::OperationFailed; ++ else if (error =3D=3D UD2_ERROR_CANCELED) ++ return Solid::UserCanceled; ++ else if (error =3D=3D UD2_ERROR_INVALID_OPTION) ++ return Solid::InvalidOption; ++ else if (error =3D=3D UD2_ERROR_MISSING_DRIVER) ++ return Solid::MissingDriver; ++ else ++ return Solid::UnauthorizedOperation; ++} ++ ++bool Device::isBlock() const ++{ ++ return hasInterface(UD2_DBUS_INTERFACE_BLOCK); ++} ++ ++bool Device::isPartition() const ++{ ++ return hasInterface(UD2_DBUS_INTERFACE_PARTITION); ++} ++ ++bool Device::isPartitionTable() const ++{ ++ return hasInterface(UD2_DBUS_INTERFACE_PARTITIONTABLE); ++} ++ ++bool Device::isStorageVolume() const ++{ ++ return isPartition() || isPartitionTable() || isStorageAccess() || = isOpticalDisc(); ++} ++ ++bool Device::isStorageAccess() const ++{ ++ return hasInterface(UD2_DBUS_INTERFACE_FILESYSTEM) || isEncryptedCo= ntainer(); ++} ++ ++bool Device::isDrive() const ++{ ++ return hasInterface(UD2_DBUS_INTERFACE_DRIVE); ++} ++ ++bool Device::isOpticalDrive() const ++{ ++ return isDrive() && !prop("MediaCompatibility").toStringList().filt= er("optical_").isEmpty(); ++} ++ ++bool Device::isOpticalDisc() const ++{ ++ const QString drv =3D drivePath(); ++ if (drv.isEmpty() || drv =3D=3D "/") ++ return false; ++ ++ Device drive(drv); ++ return drive.prop("Optical").toBool(); ++} ++ ++bool Device::mightBeOpticalDisc() const ++{ ++ const QString drv =3D drivePath(); ++ if (drv.isEmpty() || drv =3D=3D "/") ++ return false; ++ ++ Device drive(drv); ++ return drive.isOpticalDrive(); ++} ++ ++bool Device::isMounted() const ++{ ++ return propertyExists("MountPoints") && !qdbus_cast= (prop("MountPoints")).isEmpty(); ++} ++ ++bool Device::isEncryptedContainer() const ++{ ++ return hasInterface(UD2_DBUS_INTERFACE_ENCRYPTED); ++} ++ ++bool Device::isEncryptedCleartext() const ++{ ++ const QString holderDevice =3D prop("CryptoBackingDevice").toString= (); ++ if (holderDevice.isEmpty() || holderDevice =3D=3D "/") ++ return false; ++ else ++ return true; ++} ++ ++bool Device::isSwap() const ++{ ++ return hasInterface(UD2_DBUS_INTERFACE_SWAP); ++} ++ ++QString Device::drivePath() const ++{ ++ return prop("Drive").value().path(); ++} +diff -ruN kdelibs-4.8.90.orig/solid/solid/backends/udisks2/udisksdevice.= h kdelibs-4.8.90/solid/solid/backends/udisks2/udisksdevice.h +--- kdelibs-4.8.90.orig/solid/solid/backends/udisks2/udisksdevice.h 1970= -01-01 01:00:00.000000000 +0100 ++++ kdelibs-4.8.90/solid/solid/backends/udisks2/udisksdevice.h 2012-06-2= 0 13:39:24.000000000 +0200 +@@ -0,0 +1,112 @@ ++/* ++ Copyright 2010 Michael Zanetti ++ Copyright 2010-2012 Luk=C3=A1=C5=A1 Tinkl ++ ++ This library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) version 3, or any ++ later version accepted by the membership of KDE e.V. (or its ++ successor approved by the membership of KDE e.V.), which shall ++ act as a proxy defined in Section 6 of version 3 of the license. ++ ++ This library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with this library. If not, see . ++*/ ++ ++#ifndef UDISKS2DEVICE_H ++#define UDISKS2DEVICE_H ++ ++#include "udisks2.h" ++ ++#include ++#include ++#include ++ ++#include ++#include ++#include ++ ++namespace Solid ++{ ++namespace Backends ++{ ++namespace UDisks2 ++{ ++ ++class Device: public Solid::Ifaces::Device ++{ ++ Q_OBJECT ++public: ++ Device(const QString &udi); ++ virtual ~Device(); ++ ++ virtual QObject* createDeviceInterface(const Solid::DeviceInterface= ::Type& type); ++ virtual bool queryDeviceInterface(const Solid::DeviceInterface::Typ= e& type) const; ++ virtual QString description() const; ++ virtual QStringList emblems() const; ++ virtual QString icon() const; ++ virtual QString product() const; ++ virtual QString vendor() const; ++ virtual QString udi() const; ++ virtual QString parentUdi() const; ++ ++ QVariant prop(const QString &key) const; ++ bool propertyExists(const QString &key) const; ++ QVariantMap allProperties() const; ++ ++ bool hasInterface(const QString & name) const; ++ QStringList interfaces() const; ++ ++ QString errorToString(const QString & error) const; ++ Solid::ErrorType errorToSolidError(const QString & error) const; ++ ++ bool isBlock() const; ++ bool isPartition() const; ++ bool isPartitionTable() const; ++ bool isStorageVolume() const; ++ bool isStorageAccess() const; ++ bool isDrive() const; ++ bool isOpticalDrive() const; ++ bool isOpticalDisc() const; ++ bool mightBeOpticalDisc() const; ++ bool isMounted() const; ++ bool isEncryptedContainer() const; ++ bool isEncryptedCleartext() const; ++ bool isSwap() const; ++ ++ QString drivePath() const; ++ ++Q_SIGNALS: ++ void changed(); ++ void propertyChanged(const QMap &changes); ++ ++private Q_SLOTS: ++ void slotPropertiesChanged(const QString & ifaceName, const QVarian= tMap & changedProps, const QStringList & invalidatedProps); ++ void slotInterfacesAdded(const QDBusObjectPath &object_path, const = QVariantMapMap &interfaces_and_properties); ++ void slotInterfacesRemoved(const QDBusObjectPath &object_path, cons= t QStringList &interfaces); ++ ++private: ++ QString storageDescription() const; ++ QString volumeDescription() const; ++ mutable QDBusInterface *m_device; ++ QString m_udi; ++ mutable QVariantMap m_cache; ++ ++ void initInterfaces(); ++ QStringList m_interfaces; ++ ++ void checkCache(const QString &key) const; ++ QString introspect() const; ++}; ++ ++} ++} ++} ++ ++#endif // UDISKS2DEVICE_H +diff -ruN kdelibs-4.8.90.orig/solid/solid/backends/udisks2/udisksdevicei= nterface.cpp kdelibs-4.8.90/solid/solid/backends/udisks2/udisksdeviceinte= rface.cpp +--- kdelibs-4.8.90.orig/solid/solid/backends/udisks2/udisksdeviceinterfa= ce.cpp 1970-01-01 01:00:00.000000000 +0100 ++++ kdelibs-4.8.90/solid/solid/backends/udisks2/udisksdeviceinterface.cp= p 2012-06-20 13:39:24.000000000 +0200 +@@ -0,0 +1,33 @@ ++/* ++ Copyright 2010 Michael Zanetti ++ ++ This library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) version 3, or any ++ later version accepted by the membership of KDE e.V. (or its ++ successor approved by the membership of KDE e.V.), which shall ++ act as a proxy defined in Section 6 of version 3 of the license. ++ ++ This library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with this library. If not, see . ++*/ ++ ++#include "udisksdeviceinterface.h" ++ ++using namespace Solid::Backends::UDisks2; ++ ++DeviceInterface::DeviceInterface(Device *device) ++ : QObject(device), m_device(device) ++{ ++ ++} ++ ++DeviceInterface::~DeviceInterface() ++{ ++} +diff -ruN kdelibs-4.8.90.orig/solid/solid/backends/udisks2/udisksdevicei= nterface.h kdelibs-4.8.90/solid/solid/backends/udisks2/udisksdeviceinterf= ace.h +--- kdelibs-4.8.90.orig/solid/solid/backends/udisks2/udisksdeviceinterfa= ce.h 1970-01-01 01:00:00.000000000 +0100 ++++ kdelibs-4.8.90/solid/solid/backends/udisks2/udisksdeviceinterface.h = 2012-06-20 13:39:24.000000000 +0200 +@@ -0,0 +1,148 @@ ++/* ++ Copyright 2010 Michael Zanetti ++ ++ This library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) version 3, or any ++ later version accepted by the membership of KDE e.V. (or its ++ successor approved by the membership of KDE e.V.), which shall ++ act as a proxy defined in Section 6 of version 3 of the license. ++ ++ This library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with this library. If not, see . ++*/ ++ ++#ifndef UDISKS2DEVICEINTERFACE_H ++#define UDISKS2DEVICEINTERFACE_H ++ ++#include ++#include "udisksdevice.h" ++ ++#include ++#include ++ ++namespace Solid ++{ ++namespace Backends ++{ ++namespace UDisks2 ++{ ++ ++class DeviceInterface : public QObject, virtual public Solid::Ifaces::D= eviceInterface ++{ ++ Q_OBJECT ++ Q_INTERFACES(Solid::Ifaces::DeviceInterface) ++public: ++ DeviceInterface(Device *device); ++ virtual ~DeviceInterface(); ++ ++protected: ++ Device *m_device; ++ ++public: ++ inline static QStringList toStringList(Solid::DeviceInterface::Type= type) ++ { ++ QStringList list; ++ ++ switch(type) ++ { ++ case Solid::DeviceInterface::GenericInterface: ++ list << "generic"; ++ break; ++ case Solid::DeviceInterface::Processor: ++ // Doesn't exist with UDisks ++ break; ++ case Solid::DeviceInterface::Block: ++ list << "block"; ++ break; ++ case Solid::DeviceInterface::StorageAccess: ++ list << "volume"; ++ break; ++ case Solid::DeviceInterface::StorageDrive: ++ list << "storage"; ++ break; ++ case Solid::DeviceInterface::OpticalDrive: ++ list << "storage.cdrom"; ++ break; ++ case Solid::DeviceInterface::StorageVolume: ++ list << "volume"; ++ break; ++ case Solid::DeviceInterface::OpticalDisc: ++ list << "volume.disc"; ++ break; ++ case Solid::DeviceInterface::Camera: ++ // Doesn't exist with UDisks ++ break; ++ case Solid::DeviceInterface::PortableMediaPlayer: ++ // Doesn't exist with UDisks ++ break; ++ case Solid::DeviceInterface::NetworkInterface: ++ // Doesn't exist with UDisks ++ break; ++ case Solid::DeviceInterface::AcAdapter: ++ // Doesn't exist with UDisks ++ break; ++ case Solid::DeviceInterface::Battery: ++ // Doesn't exist with UDisks ++ break; ++ case Solid::DeviceInterface::Button: ++ // Doesn't exist with UDisks ++ break; ++ case Solid::DeviceInterface::AudioInterface: ++ // Doesn't exist with UDisks ++ break; ++ case Solid::DeviceInterface::DvbInterface: ++ // Doesn't exist with UDisks ++ break; ++ case Solid::DeviceInterface::Video: ++ // Doesn't exist with UDisks ++ break; ++ case Solid::DeviceInterface::SerialInterface: ++ // Doesn't exist with UDisks ++ break; ++ case Solid::DeviceInterface::InternetGateway: ++ break; ++ case Solid::DeviceInterface::SmartCardReader: ++ // Doesn't exist with UDisks ++ case Solid::DeviceInterface::NetworkShare: ++ // Doesn't exist with UDisks ++ break; ++ case Solid::DeviceInterface::Unknown: ++ break; ++ case Solid::DeviceInterface::Last: ++ break; ++ } ++ ++ return list; ++ } ++ ++ inline static Solid::DeviceInterface::Type fromString(const QString= &capability) ++ { ++ if (capability =3D=3D "generic") ++ return Solid::DeviceInterface::GenericInterface; ++ else if (capability =3D=3D "block") ++ return Solid::DeviceInterface::Block; ++ else if (capability =3D=3D "storage") ++ return Solid::DeviceInterface::StorageDrive; ++ else if (capability =3D=3D "storage.cdrom") ++ return Solid::DeviceInterface::OpticalDrive; ++ else if (capability =3D=3D "volume") ++ return Solid::DeviceInterface::StorageVolume; ++ else if (capability =3D=3D "volume.disc") ++ return Solid::DeviceInterface::OpticalDisc; ++ else ++ return Solid::DeviceInterface::Unknown; ++ } ++}; ++ ++} ++} ++} ++ ++#endif // UDISKS2DEVICEINTERFACE_H +diff -ruN kdelibs-4.8.90.orig/solid/solid/backends/udisks2/udisksgeneric= interface.cpp kdelibs-4.8.90/solid/solid/backends/udisks2/udisksgenericin= terface.cpp +--- kdelibs-4.8.90.orig/solid/solid/backends/udisks2/udisksgenericinterf= ace.cpp 1970-01-01 01:00:00.000000000 +0100 ++++ kdelibs-4.8.90/solid/solid/backends/udisks2/udisksgenericinterface.c= pp 2012-06-20 13:39:24.000000000 +0200 +@@ -0,0 +1,53 @@ ++/* ++ Copyright 2009 Pino Toscano ++ Copyright 2012 Luk=C3=A1=C5=A1 Tinkl ++ ++ This library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) version 3, or any ++ later version accepted by the membership of KDE e.V. (or its ++ successor approved by the membership of KDE e.V.), which shall ++ act as a proxy defined in Section 6 of version 3 of the license. ++ ++ This library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with this library. If not, see . ++*/ ++ ++#include "udisksgenericinterface.h" ++ ++#include "udisksdevice.h" ++ ++using namespace Solid::Backends::UDisks2; ++ ++GenericInterface::GenericInterface(Device *device) ++ : DeviceInterface(device) ++{ ++ connect(device, SIGNAL(propertyChanged(QMap)), ++ this, SIGNAL(propertyChanged(QMap))); ++} ++ ++GenericInterface::~GenericInterface() ++{ ++} ++ ++QVariant GenericInterface::property(const QString &key) const ++{ ++ return m_device->prop(key); ++} ++ ++QVariantMap GenericInterface::allProperties() const ++{ ++ return m_device->allProperties(); ++} ++ ++bool GenericInterface::propertyExists(const QString &key) const ++{ ++ return m_device->propertyExists(key); ++} ++ +diff -ruN kdelibs-4.8.90.orig/solid/solid/backends/udisks2/udisksgeneric= interface.h kdelibs-4.8.90/solid/solid/backends/udisks2/udisksgenericinte= rface.h +--- kdelibs-4.8.90.orig/solid/solid/backends/udisks2/udisksgenericinterf= ace.h 1970-01-01 01:00:00.000000000 +0100 ++++ kdelibs-4.8.90/solid/solid/backends/udisks2/udisksgenericinterface.h= 2012-06-20 13:39:24.000000000 +0200 +@@ -0,0 +1,57 @@ ++/* ++ Copyright 2009 Pino Toscano ++ ++ This library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) version 3, or any ++ later version accepted by the membership of KDE e.V. (or its ++ successor approved by the membership of KDE e.V.), which shall ++ act as a proxy defined in Section 6 of version 3 of the license. ++ ++ This library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with this library. If not, see . ++*/ ++ ++#ifndef SOLID_BACKENDS_UDISKS2_GENERICINTERFACE_H ++#define SOLID_BACKENDS_UDISKS2_GENERICINTERFACE_H ++ ++#include ++#include ++#include "udisksdeviceinterface.h" ++ ++namespace Solid ++{ ++namespace Backends ++{ ++namespace UDisks2 ++{ ++class Device; ++ ++class GenericInterface : public DeviceInterface, virtual public Solid::= Ifaces::GenericInterface ++{ ++ Q_OBJECT ++ Q_INTERFACES(Solid::Ifaces::GenericInterface) ++ ++public: ++ GenericInterface(Device *device); ++ virtual ~GenericInterface(); ++ ++ virtual QVariant property(const QString &key) const; ++ virtual QVariantMap allProperties() const; ++ virtual bool propertyExists(const QString &key) const; ++ ++Q_SIGNALS: ++ void propertyChanged(const QMap &changes); ++ void conditionRaised(const QString &condition, const QString &reaso= n); ++}; ++} ++} ++} ++ ++#endif // SOLID_BACKENDS_UDISKS2_GENERICINTERFACE_H +diff -ruN kdelibs-4.8.90.orig/solid/solid/backends/udisks2/udisksmanager= .cpp kdelibs-4.8.90/solid/solid/backends/udisks2/udisksmanager.cpp +--- kdelibs-4.8.90.orig/solid/solid/backends/udisks2/udisksmanager.cpp 1= 970-01-01 01:00:00.000000000 +0100 ++++ kdelibs-4.8.90/solid/solid/backends/udisks2/udisksmanager.cpp 2012-0= 6-20 13:39:24.000000000 +0200 +@@ -0,0 +1,227 @@ ++/* ++ Copyright 2012 Luk=C3=A1=C5=A1 Tinkl ++ ++ This library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) version 3, or any ++ later version accepted by the membership of KDE e.V. (or its ++ successor approved by the membership of KDE e.V.), which shall ++ act as a proxy defined in Section 6 of version 3 of the license. ++ ++ This library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with this library. If not, see . ++*/ ++ ++#include "udisksmanager.h" ++ ++#include ++#include ++ ++#include "../shared/rootdevice.h" ++ ++using namespace Solid::Backends::UDisks2; ++using namespace Solid::Backends::Shared; ++ ++Manager::Manager(QObject *parent) ++ : Solid::Ifaces::DeviceManager(parent), ++ m_manager(UD2_DBUS_SERVICE, ++ UD2_DBUS_PATH, ++ QDBusConnection::systemBus()) ++{ ++ m_supportedInterfaces ++ << Solid::DeviceInterface::GenericInterface ++ << Solid::DeviceInterface::Block ++ << Solid::DeviceInterface::StorageAccess ++ << Solid::DeviceInterface::StorageDrive ++ << Solid::DeviceInterface::OpticalDrive ++ << Solid::DeviceInterface::OpticalDisc ++ << Solid::DeviceInterface::StorageVolume; ++ ++ qDBusRegisterMetaType >(); ++ qDBusRegisterMetaType(); ++ qDBusRegisterMetaType(); ++ qDBusRegisterMetaType(); ++ qDBusRegisterMetaType(); ++ ++ bool serviceFound =3D m_manager.isValid(); ++ if (!serviceFound) { ++ // find out whether it will be activated automatically ++ QDBusMessage message =3D QDBusMessage::createMethodCall("org.fr= eedesktop.DBus", ++ "/org/fre= edesktop/DBus", ++ "org.free= desktop.DBus", ++ "ListActi= vatableNames"); ++ ++ QDBusReply reply =3D QDBusConnection::systemBus().= call(message); ++ if (reply.isValid() && reply.value().contains(UD2_DBUS_SERVICE)= ) { ++ QDBusConnection::systemBus().interface()->startService(UD2_= DBUS_SERVICE); ++ serviceFound =3D true; ++ } ++ } ++ ++ if (serviceFound) { ++ connect(&m_manager, SIGNAL(InterfacesAdded(QDBusObjectPath, QVa= riantMapMap)), ++ this, SLOT(slotInterfacesAdded(QDBusObjectPath,QVariant= MapMap))); ++ connect(&m_manager, SIGNAL(InterfacesRemoved(QDBusObjectPath,QS= tringList)), ++ this, SLOT(slotInterfacesRemoved(QDBusObjectPath,QStrin= gList))); ++ } ++} ++ ++Manager::~Manager() ++{ ++} ++ ++QObject* Manager::createDevice(const QString& udi) ++{ ++ if (udi=3D=3DudiPrefix()) { ++ RootDevice *root =3D new RootDevice(udi); ++ ++ root->setProduct(tr("Storage")); ++ root->setDescription(tr("Storage devices")); ++ root->setIcon("server-database"); // Obviously wasn't meant for= that, but maps nicely in oxygen icon set :-p ++ ++ return root; ++ } else if (deviceCache().contains(udi)) { ++ return new Device(udi); ++ } else { ++ return 0; ++ } ++} ++ ++QStringList Manager::devicesFromQuery(const QString& parentUdi, Solid::= DeviceInterface::Type type) ++{ ++ QStringList result; ++ ++ if (!parentUdi.isEmpty()) ++ { ++ Q_FOREACH (const QString &udi, deviceCache()) ++ { ++ Device device(udi); ++ if (device.queryDeviceInterface(type) && device.parentUdi()= =3D=3D parentUdi) ++ result << udi; ++ } ++ ++ return result; ++ } ++ else if (type !=3D Solid::DeviceInterface::Unknown) ++ { ++ Q_FOREACH (const QString &udi, deviceCache()) ++ { ++ Device device(udi); ++ if (device.queryDeviceInterface(type)) ++ result << udi; ++ } ++ ++ return result; ++ } ++ ++ return deviceCache(); ++} ++ ++QStringList Manager::allDevices() ++{ ++ m_deviceCache.clear(); ++ ++ QDBusPendingReply reply =3D m_manager.GetManaged= Objects(); ++ reply.waitForFinished(); ++ if (!reply.isError()) { // enum devices ++ m_deviceCache << udiPrefix(); ++ ++ Q_FOREACH(const QDBusObjectPath &path, reply.value().keys()) { ++ const QString udi =3D path.path(); ++ qDebug() << "Adding device" << udi; ++ ++ if (udi =3D=3D UD2_DBUS_PATH_MANAGER || udi =3D=3D UD2_UDI_= DISKS_PREFIX || udi.startsWith(UD2_DBUS_PATH_JOBS)) ++ continue; ++ ++ Device device(udi); ++ if (device.mightBeOpticalDisc()) { ++ QDBusConnection::systemBus().connect(UD2_DBUS_SERVICE, = udi, DBUS_INTERFACE_PROPS, "PropertiesChanged", this, ++ SLOT(slotMediaChan= ged(QDBusMessage))); ++ if (!device.isOpticalDisc()) // skip empty CD disc ++ continue; ++ } ++ ++ m_deviceCache.append(udi); ++ } ++ } ++ else // show error ++ { ++ qWarning() << "Failed enumerating UDisks2 objects:" << reply.er= ror().name() << "\n" << reply.error().message(); ++ } ++ ++ return m_deviceCache; ++} ++ ++ ++QSet< Solid::DeviceInterface::Type > Manager::supportedInterfaces() con= st ++{ ++ return m_supportedInterfaces; ++} ++ ++QString Manager::udiPrefix() const ++{ ++ return UD2_UDI_DISKS_PREFIX; ++} ++ ++void Manager::slotInterfacesAdded(const QDBusObjectPath &object_path, c= onst QVariantMapMap &interfaces_and_properties) ++{ ++ const QString udi =3D object_path.path(); ++ ++ qDebug() << udi << "has new interfaces:" << interfaces_and_properti= es.keys(); ++ ++ // new device, we don't know it yet ++ if (!m_deviceCache.contains(udi)) { ++ m_deviceCache.append(udi); ++ Q_EMIT deviceAdded(udi); ++ } ++} ++ ++void Manager::slotInterfacesRemoved(const QDBusObjectPath &object_path,= const QStringList &interfaces) ++{ ++ const QString udi =3D object_path.path(); ++ ++ qDebug() << udi << "lost interfaces:" << interfaces; ++ ++ Device device(udi); ++ ++ if (!udi.isEmpty() && (interfaces.isEmpty() || device.interfaces().= isEmpty() || device.interfaces().contains(UD2_DBUS_INTERFACE_FILESYSTEM))= ) { ++ Q_EMIT deviceRemoved(udi); ++ m_deviceCache.removeAll(udi); ++ } ++} ++ ++void Manager::slotMediaChanged(const QDBusMessage & msg) ++{ ++ const QVariantMap properties =3D qdbus_cast(msg.argume= nts().at(1)); ++ ++ if (!properties.contains("Size")) // react only on Size changes ++ return; ++ ++ const QString udi =3D msg.path(); ++ qulonglong size =3D properties.value("Size").toULongLong(); ++ qDebug() << "MEDIA CHANGED in" << udi << "; size is:" << size; ++ ++ if (!m_deviceCache.contains(udi) && size > 0) { // we don't know th= e optdisc, got inserted ++ m_deviceCache.append(udi); ++ Q_EMIT deviceAdded(udi); ++ } ++ ++ if (m_deviceCache.contains(udi) && size =3D=3D 0) { // we know the= optdisc, got removed ++ Q_EMIT deviceRemoved(udi); ++ m_deviceCache.removeAll(udi); ++ } ++} ++ ++const QStringList & Manager::deviceCache() ++{ ++ if (m_deviceCache.isEmpty()) ++ allDevices(); ++ ++ return m_deviceCache; ++} +diff -ruN kdelibs-4.8.90.orig/solid/solid/backends/udisks2/udisksmanager= .h kdelibs-4.8.90/solid/solid/backends/udisks2/udisksmanager.h +--- kdelibs-4.8.90.orig/solid/solid/backends/udisks2/udisksmanager.h 197= 0-01-01 01:00:00.000000000 +0100 ++++ kdelibs-4.8.90/solid/solid/backends/udisks2/udisksmanager.h 2012-06-= 20 13:39:24.000000000 +0200 +@@ -0,0 +1,69 @@ ++/* ++ Copyright 2010 Michael Zanetti ++ Copyright 2010-2012 Luk=C3=A1=C5=A1 Tinkl ++ ++ This library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) version 3, or any ++ later version accepted by the membership of KDE e.V. (or its ++ successor approved by the membership of KDE e.V.), which shall ++ act as a proxy defined in Section 6 of version 3 of the license. ++ ++ This library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with this library. If not, see . ++*/ ++ ++#ifndef UDISKS2MANAGER_H ++#define UDISKS2MANAGER_H ++ ++#include "udisks2.h" ++#include "udisksdevice.h" ++#include "dbus/manager.h" ++ ++#include "solid/ifaces/devicemanager.h" ++ ++#include ++#include ++ ++namespace Solid ++{ ++namespace Backends ++{ ++namespace UDisks2 ++{ ++ ++class Manager: public Solid::Ifaces::DeviceManager ++{ ++ Q_OBJECT ++ ++public: ++ Manager(QObject *parent); ++ virtual QObject* createDevice(const QString& udi); ++ virtual QStringList devicesFromQuery(const QString& parentUdi, Soli= d::DeviceInterface::Type type); ++ virtual QStringList allDevices(); ++ virtual QSet< Solid::DeviceInterface::Type > supportedInterfaces() = const; ++ virtual QString udiPrefix() const; ++ virtual ~Manager(); ++ ++private Q_SLOTS: ++ void slotInterfacesAdded(const QDBusObjectPath &object_path, const = QVariantMapMap &interfaces_and_properties); ++ void slotInterfacesRemoved(const QDBusObjectPath &object_path, cons= t QStringList &interfaces); ++ void slotMediaChanged(const QDBusMessage &msg); ++ ++private: ++ const QStringList &deviceCache(); ++ QSet m_supportedInterfaces; ++ org::freedesktop::DBus::ObjectManager m_manager; ++ QStringList m_deviceCache; ++}; ++ ++} ++} ++} ++#endif // UDISKS2MANAGER_H +diff -ruN kdelibs-4.8.90.orig/solid/solid/backends/udisks2/udisksoptical= disc.cpp kdelibs-4.8.90/solid/solid/backends/udisks2/udisksopticaldisc.cp= p +--- kdelibs-4.8.90.orig/solid/solid/backends/udisks2/udisksopticaldisc.c= pp 1970-01-01 01:00:00.000000000 +0100 ++++ kdelibs-4.8.90/solid/solid/backends/udisks2/udisksopticaldisc.cpp 20= 12-06-20 13:39:24.000000000 +0200 +@@ -0,0 +1,277 @@ ++/* ++ Copyright 2010 Michael Zanetti ++ Copyright 2010 - 2012 Luk=C3=A1=C5=A1 Tinkl ++ ++ This library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) version 3, or any ++ later version accepted by the membership of KDE e.V. (or its ++ successor approved by the membership of KDE e.V.), which shall ++ act as a proxy defined in Section 6 of version 3 of the license. ++ ++ This library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with this library. If not, see . ++*/ ++ ++#include ++#include ++#include ++#include ++ ++#include ++#include ++ ++#include "../shared/udevqtclient.h" ++ ++#include "udisks2.h" ++#include "udisksopticaldisc.h" ++ ++// inspired by http://cgit.freedesktop.org/hal/tree/hald/linux/probing/= probe-volume.c ++static Solid::OpticalDisc::ContentType advancedDiscDetect(const QByteAr= ray & device_file) ++{ ++ /* the discs block size */ ++ unsigned short bs; ++ /* the path table size */ ++ unsigned short ts; ++ /* the path table location (in blocks) */ ++ unsigned int tl; ++ /* length of the directory name in current path table entry */ ++ unsigned char len_di =3D 0; ++ /* the number of the parent directory's path table entry */ ++ unsigned int parent =3D 0; ++ /* filename for the current path table entry */ ++ char dirname[256]; ++ /* our position into the path table */ ++ int pos =3D 0; ++ /* the path table record we're on */ ++ int curr_record =3D 1; ++ ++ Solid::OpticalDisc::ContentType result =3D Solid::OpticalDisc::NoCo= ntent; ++ ++ int fd =3D open(device_file.constData(), O_RDONLY); ++ ++ /* read the block size */ ++ lseek (fd, 0x8080, SEEK_CUR); ++ if (read (fd, &bs, 2) !=3D 2) ++ { ++ qDebug("Advanced probing on %s failed while reading block size"= , qPrintable(device_file)); ++ goto out; ++ } ++ ++ /* read in size of path table */ ++ lseek (fd, 2, SEEK_CUR); ++ if (read (fd, &ts, 2) !=3D 2) ++ { ++ qDebug("Advanced probing on %s failed while reading path table = size", qPrintable(device_file)); ++ goto out; ++ } ++ ++ /* read in which block path table is in */ ++ lseek (fd, 6, SEEK_CUR); ++ if (read (fd, &tl, 4) !=3D 4) ++ { ++ qDebug("Advanced probing on %s failed while reading path table = block", qPrintable(device_file)); ++ goto out; ++ } ++ ++ /* seek to the path table */ ++ lseek (fd, bs * tl, SEEK_SET); ++ ++ /* loop through the path table entries */ ++ while (pos < ts) ++ { ++ /* get the length of the filename of the current entry */ ++ if (read (fd, &len_di, 1) !=3D 1) ++ { ++ qDebug("Advanced probing on %s failed, cannot read more ent= ries", qPrintable(device_file)); ++ break; ++ } ++ ++ /* get the record number of this entry's parent ++ i'm pretty sure that the 1st entry is always the top directo= ry */ ++ lseek (fd, 5, SEEK_CUR); ++ if (read (fd, &parent, 2) !=3D 2) ++ { ++ qDebug("Advanced probing on %s failed, couldn't read parent= entry", qPrintable(device_file)); ++ break; ++ } ++ ++ /* read the name */ ++ if (read (fd, dirname, len_di) !=3D len_di) ++ { ++ qDebug("Advanced probing on %s failed, couldn't read the en= try name", qPrintable(device_file)); ++ break; ++ } ++ dirname[len_di] =3D 0; ++ ++ /* if we found a folder that has the root as a parent, and the = directory name matches ++ one of the special directories then set the properties accor= dingly */ ++ if (parent =3D=3D 1) ++ { ++ if (!strcasecmp (dirname, "VIDEO_TS")) ++ { ++ qDebug("Disc in %s is a Video DVD", qPrintable(device_f= ile)); ++ result =3D Solid::OpticalDisc::VideoDvd; ++ break; ++ } ++ else if (!strcasecmp (dirname, "BDMV")) ++ { ++ qDebug("Disc in %s is a Blu-ray video disc", qPrintable= (device_file)); ++ result =3D Solid::OpticalDisc::VideoBluRay; ++ break; ++ } ++ else if (!strcasecmp (dirname, "VCD")) ++ { ++ qDebug("Disc in %s is a Video CD", qPrintable(device_fi= le)); ++ result =3D Solid::OpticalDisc::VideoCd; ++ break; ++ } ++ else if (!strcasecmp (dirname, "SVCD")) ++ { ++ qDebug("Disc in %s is a Super Video CD", qPrintable(dev= ice_file)); ++ result =3D Solid::OpticalDisc::SuperVideoCd; ++ break; ++ } ++ } ++ ++ /* all path table entries are padded to be even, ++ so if this is an odd-length table, seek a byte to fix it */ ++ if (len_di%2 =3D=3D 1) ++ { ++ lseek (fd, 1, SEEK_CUR); ++ pos++; ++ } ++ ++ /* update our position */ ++ pos +=3D 8 + len_di; ++ curr_record++; ++ } ++ ++ close(fd); ++ return result; ++ ++out: ++ /* go back to the start of the file */ ++ lseek (fd, 0, SEEK_SET); ++ close(fd); ++ return result; ++} ++ ++using namespace Solid::Backends::UDisks2; ++ ++OpticalDisc::OpticalDisc(Device *dev) ++ : StorageVolume(dev), m_needsReprobe(true), m_cachedContent(Solid::= OpticalDisc::NoContent) ++{ ++ UdevQt::Client client(this); ++ m_udevDevice =3D client.deviceByDeviceFile(device()); ++ //qDebug() << "udev device:" << m_udevDevice.name() << "valid:" << = m_udevDevice.isValid(); ++ /*qDebug() << "\tProperties:" << */ m_udevDevice.deviceProperties()= ; // initialize the properties DB so that it doesn't crash further down, = #298416 ++ ++ m_drive =3D new Device(m_device->prop("Drive").value().path()); ++ QDBusConnection::systemBus().connect(UD2_DBUS_SERVICE, m_drive->udi= (), DBUS_INTERFACE_PROPS, "PropertiesChanged", this, ++ SLOT(slotDrivePropertiesChange= d(QString,QVariantMap,QStringList))); ++} ++ ++OpticalDisc::~OpticalDisc() ++{ ++ delete m_drive; ++} ++ ++qulonglong OpticalDisc::capacity() const ++{ ++ return m_device->prop("Size").toULongLong(); ++} ++ ++bool OpticalDisc::isRewritable() const ++{ ++ // the hard way, udisks has no notion of a disc "rewritability" ++ const QString mediaType =3D media(); ++ return mediaType =3D=3D "optical_cd_rw" || mediaType =3D=3D "optica= l_dvd_rw" || mediaType =3D=3D "optical_dvd_ram" || ++ mediaType =3D=3D "optical_dvd_plus_rw" || mediaType =3D=3D = "optical_dvd_plus_rw_dl" || ++ mediaType =3D=3D "optical_bd_re" || mediaType =3D=3D "optic= al_hddvd_rw"; ++} ++ ++bool OpticalDisc::isBlank() const ++{ ++ return m_drive->prop("OpticalBlank").toBool(); ++} ++ ++bool OpticalDisc::isAppendable() const ++{ ++ //qDebug() << "appendable prop" << m_udevDevice.deviceProperty("ID_= CDROM_MEDIA_STATE"); ++ return m_udevDevice.deviceProperty("ID_CDROM_MEDIA_STATE").toString= () =3D=3D QLatin1String("appendable"); ++} ++ ++Solid::OpticalDisc::DiscType OpticalDisc::discType() const ++{ ++ QMap map; ++ map[Solid::OpticalDisc::CdRom] =3D "optical_cd"; ++ map[Solid::OpticalDisc::CdRecordable] =3D "optical_cd_r"; ++ map[Solid::OpticalDisc::CdRewritable] =3D "optical_cd_rw"; ++ map[Solid::OpticalDisc::DvdRom] =3D "optical_dvd"; ++ map[Solid::OpticalDisc::DvdRecordable] =3D "optical_dvd_r"; ++ map[Solid::OpticalDisc::DvdRewritable] =3D"optical_dvd_rw"; ++ map[Solid::OpticalDisc::DvdRam] =3D"optical_dvd_ram"; ++ map[Solid::OpticalDisc::DvdPlusRecordable] =3D"optical_dvd_plus_r"; ++ map[Solid::OpticalDisc::DvdPlusRewritable] =3D"optical_dvd_plus_rw"= ; ++ map[Solid::OpticalDisc::DvdPlusRecordableDuallayer] =3D"optical_dvd= _plus_r_dl"; ++ map[Solid::OpticalDisc::DvdPlusRewritableDuallayer] =3D"optical_dvd= _plus_rw_dl"; ++ map[Solid::OpticalDisc::BluRayRom] =3D"optical_bd"; ++ map[Solid::OpticalDisc::BluRayRecordable] =3D"optical_bd_r"; ++ map[Solid::OpticalDisc::BluRayRewritable] =3D"optical_bd_re"; ++ map[Solid::OpticalDisc::HdDvdRom] =3D"optical_hddvd"; ++ map[Solid::OpticalDisc::HdDvdRecordable] =3D"optical_hddvd_r"; ++ map[Solid::OpticalDisc::HdDvdRewritable] =3D"optical_hddvd_rw"; ++ // TODO add these to Solid ++ //map[Solid::OpticalDisc::MagnetoOptical] =3D"optical_mo"; ++ //map[Solid::OpticalDisc::MountRainer] =3D"optical_mrw"; ++ //map[Solid::OpticalDisc::MountRainerWritable] =3D"optical_mrw_w"; ++ ++ return map.key(media(), Solid::OpticalDisc::UnknownDiscType); // F= IXME optimize, lookup by value, not key ++} ++ ++Solid::OpticalDisc::ContentTypes OpticalDisc::availableContent() const ++{ ++ if (isBlank()) { ++ m_needsReprobe =3D false; ++ return Solid::OpticalDisc::NoContent; ++ } ++ ++ if (m_needsReprobe) { ++ m_cachedContent =3D Solid::OpticalDisc::NoContent; ++ const bool hasData =3D m_drive->prop("OpticalNumDataTracks").to= UInt() > 0; ++ const bool hasAudio =3D m_drive->prop("OpticalNumAudioTracks").= toUInt() > 0; ++ ++ if ( hasData ) { ++ m_cachedContent |=3D Solid::OpticalDisc::Data; ++ m_cachedContent |=3D advancedDiscDetect(m_device->prop("Dev= ice").toByteArray()); ++ } ++ if ( hasAudio ) ++ m_cachedContent |=3D Solid::OpticalDisc::Audio; ++ ++ m_needsReprobe =3D false; ++ } ++ ++ return m_cachedContent; ++} ++ ++void OpticalDisc::slotDrivePropertiesChanged(const QString &ifaceName, = const QVariantMap &changedProps, const QStringList &invalidatedProps) ++{ ++ Q_UNUSED(ifaceName); ++ ++ if (changedProps.keys().contains("Media") || invalidatedProps.conta= ins("Media")) { ++ m_needsReprobe =3D true; ++ m_cachedContent =3D Solid::OpticalDisc::NoContent; ++ } ++} ++ ++QString OpticalDisc::media() const ++{ ++ return m_drive->prop("Media").toString(); ++} +diff -ruN kdelibs-4.8.90.orig/solid/solid/backends/udisks2/udisksoptical= disc.h kdelibs-4.8.90/solid/solid/backends/udisks2/udisksopticaldisc.h +--- kdelibs-4.8.90.orig/solid/solid/backends/udisks2/udisksopticaldisc.h= 1970-01-01 01:00:00.000000000 +0100 ++++ kdelibs-4.8.90/solid/solid/backends/udisks2/udisksopticaldisc.h 2012= -06-20 13:39:24.000000000 +0200 +@@ -0,0 +1,69 @@ ++/* ++ Copyright 2010 Michael Zanetti ++ Copyright 2010 - 2012 Luk=C3=A1=C5=A1 Tinkl ++ ++ This library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) version 3, or any ++ later version accepted by the membership of KDE e.V. (or its ++ successor approved by the membership of KDE e.V.), which shall ++ act as a proxy defined in Section 6 of version 3 of the license. ++ ++ This library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with this library. If not, see . ++*/ ++ ++#ifndef UDISKS2OPTICALDISC_H ++#define UDISKS2OPTICALDISC_H ++ ++#include ++ ++#include "../shared/udevqtdevice.h" ++ ++#include "udisksstoragevolume.h" ++#include "udisksdevice.h" ++ ++namespace Solid ++{ ++namespace Backends ++{ ++namespace UDisks2 ++{ ++ ++class OpticalDisc: public StorageVolume, virtual public Solid::Ifaces::= OpticalDisc ++{ ++ Q_OBJECT ++ Q_INTERFACES(Solid::Ifaces::OpticalDisc) ++ ++public: ++ OpticalDisc(Device *dev); ++ virtual ~OpticalDisc(); ++ ++ virtual qulonglong capacity() const; ++ virtual bool isRewritable() const; ++ virtual bool isBlank() const; ++ virtual bool isAppendable() const; ++ virtual Solid::OpticalDisc::DiscType discType() const; ++ virtual Solid::OpticalDisc::ContentTypes availableContent() const; ++ ++private Q_SLOTS: ++ void slotDrivePropertiesChanged(const QString & ifaceName, const QV= ariantMap & changedProps, const QStringList & invalidatedProps); ++ ++private: ++ QString media() const; ++ mutable bool m_needsReprobe; ++ mutable Solid::OpticalDisc::ContentTypes m_cachedContent; ++ Device * m_drive; ++ UdevQt::Device m_udevDevice; ++}; ++ ++} ++} ++} ++#endif // UDISKS2OPTICALDISC_H +diff -ruN kdelibs-4.8.90.orig/solid/solid/backends/udisks2/udisksoptical= drive.cpp kdelibs-4.8.90/solid/solid/backends/udisks2/udisksopticaldrive.= cpp +--- kdelibs-4.8.90.orig/solid/solid/backends/udisks2/udisksopticaldrive.= cpp 1970-01-01 01:00:00.000000000 +0100 ++++ kdelibs-4.8.90/solid/solid/backends/udisks2/udisksopticaldrive.cpp 2= 012-06-20 13:39:24.000000000 +0200 +@@ -0,0 +1,188 @@ ++/* ++ Copyright 2010 Michael Zanetti ++ Copyright 2010-2012 Luk=C3=A1=C5=A1 Tinkl ++ ++ This library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) version 3, or any ++ later version accepted by the membership of KDE e.V. (or its ++ successor approved by the membership of KDE e.V.), which shall ++ act as a proxy defined in Section 6 of version 3 of the license. ++ ++ This library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with this library. If not, see . ++*/ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++ ++#include "udisksopticaldrive.h" ++#include "udisks2.h" ++#include "udisksdevice.h" ++ ++using namespace Solid::Backends::UDisks2; ++ ++OpticalDrive::OpticalDrive(Device *device) ++ : StorageDrive(device), m_ejectInProgress(false), m_readSpeed(0), m= _writeSpeed(0), m_speedsInit(false) ++{ ++ m_device->registerAction("eject", this, ++ SLOT(slotEjectRequested()), ++ SLOT(slotEjectDone(int, const QString&))); ++ ++ connect(m_device, SIGNAL(changed()), this, SLOT(slotChanged())); ++} ++ ++OpticalDrive::~OpticalDrive() ++{ ++} ++ ++bool OpticalDrive::eject() ++{ ++ if (m_ejectInProgress) ++ return false; ++ m_ejectInProgress =3D true; ++ m_device->broadcastActionRequested("eject"); ++ ++ QDBusConnection c =3D QDBusConnection::systemBus(); ++ ++ QString path =3D m_device->udi(); ++ ++ QDBusMessage msg =3D QDBusMessage::createMethodCall(UD2_DBUS_SERVIC= E, path, UD2_DBUS_INTERFACE_DRIVE, "Eject"); ++ msg << QVariantMap(); ++ return c.callWithCallback(msg, this, SLOT(slotDBusReply(const QDBus= Message &)), SLOT(slotDBusError(const QDBusError &))); ++} ++ ++void OpticalDrive::slotDBusReply(const QDBusMessage &/*reply*/) ++{ ++ m_ejectInProgress =3D false; ++ m_device->broadcastActionDone("eject"); ++} ++ ++void OpticalDrive::slotDBusError(const QDBusError &error) ++{ ++ m_ejectInProgress =3D false; ++ m_device->broadcastActionDone("eject", m_device->errorToSolidError(= error.name()), ++ m_device->errorToString(error.name())= + ": " +error.message()); ++} ++ ++void OpticalDrive::slotEjectRequested() ++{ ++ m_ejectInProgress =3D true; ++ Q_EMIT ejectRequested(m_device->udi()); ++} ++ ++void OpticalDrive::slotEjectDone(int error, const QString &errorString) ++{ ++ m_ejectInProgress =3D false; ++ Q_EMIT ejectDone(static_cast(error), errorString,= m_device->udi()); ++} ++ ++void OpticalDrive::initReadWriteSpeeds() const ++{ ++#if 0 ++ int read_speed, write_speed; ++ char *write_speeds =3D 0; ++ QByteArray device_file =3D QFile::encodeName(m_device->property("De= vice").toString()); ++ ++ //qDebug("Doing open (\"%s\", O_RDONLY | O_NONBLOCK)", device_file.= constData()); ++ int fd =3D open(device_file, O_RDONLY | O_NONBLOCK); ++ if (fd < 0) { ++ qWarning("Cannot open %s: %s", device_file.constData(), strerro= r (errno)); ++ return; ++ } ++ ++ if (get_read_write_speed(fd, &read_speed, &write_speed, &write_spee= ds) >=3D 0) { ++ m_readSpeed =3D read_speed; ++ m_writeSpeed =3D write_speed; ++ ++ QStringList list =3D QString::fromLatin1(write_speeds).split(',= ', QString::SkipEmptyParts); ++ Q_FOREACH (const QString & speed, list) ++ m_writeSpeeds.append(speed.toInt()); ++ ++ free(write_speeds); ++ ++ m_speedsInit =3D true; ++ } ++ ++ close(fd); ++#endif ++} ++ ++QList OpticalDrive::writeSpeeds() const ++{ ++ if (!m_speedsInit) ++ initReadWriteSpeeds(); ++ //qDebug() << "solid write speeds:" << m_writeSpeeds; ++ return m_writeSpeeds; ++} ++ ++int OpticalDrive::writeSpeed() const ++{ ++ if (!m_speedsInit) ++ initReadWriteSpeeds(); ++ return m_writeSpeed; ++} ++ ++int OpticalDrive::readSpeed() const ++{ ++ if (!m_speedsInit) ++ initReadWriteSpeeds(); ++ return m_readSpeed; ++} ++ ++Solid::OpticalDrive::MediumTypes OpticalDrive::supportedMedia() const ++{ ++ const QStringList mediaTypes =3D m_device->prop("MediaCompatibility= ").toStringList(); ++ Solid::OpticalDrive::MediumTypes supported; ++ ++ QMap map; ++ map[Solid::OpticalDrive::Cdr] =3D "optical_cd_r"; ++ map[Solid::OpticalDrive::Cdrw] =3D "optical_cd_rw"; ++ map[Solid::OpticalDrive::Dvd] =3D "optical_dvd"; ++ map[Solid::OpticalDrive::Dvdr] =3D "optical_dvd_r"; ++ map[Solid::OpticalDrive::Dvdrw] =3D"optical_dvd_rw"; ++ map[Solid::OpticalDrive::Dvdram] =3D"optical_dvd_ram"; ++ map[Solid::OpticalDrive::Dvdplusr] =3D"optical_dvd_plus_r"; ++ map[Solid::OpticalDrive::Dvdplusrw] =3D"optical_dvd_plus_rw"; ++ map[Solid::OpticalDrive::Dvdplusdl] =3D"optical_dvd_plus_r_dl"; ++ map[Solid::OpticalDrive::Dvdplusdlrw] =3D"optical_dvd_plus_rw_dl"; ++ map[Solid::OpticalDrive::Bd] =3D"optical_bd"; ++ map[Solid::OpticalDrive::Bdr] =3D"optical_bd_r"; ++ map[Solid::OpticalDrive::Bdre] =3D"optical_bd_re"; ++ map[Solid::OpticalDrive::HdDvd] =3D"optical_hddvd"; ++ map[Solid::OpticalDrive::HdDvdr] =3D"optical_hddvd_r"; ++ map[Solid::OpticalDrive::HdDvdrw] =3D"optical_hddvd_rw"; ++ // TODO add these to Solid ++ //map[Solid::OpticalDrive::Mo] =3D"optical_mo"; ++ //map[Solid::OpticalDrive::Mr] =3D"optical_mrw"; ++ //map[Solid::OpticalDrive::Mrw] =3D"optical_mrw_w"; ++ ++ Q_FOREACH ( const Solid::OpticalDrive::MediumType & type, map.keys(= ) ) ++ { ++ if ( mediaTypes.contains( map[type] ) ) ++ { ++ supported |=3D type; ++ } ++ } ++ ++ return supported; ++} ++ ++void OpticalDrive::slotChanged() ++{ ++ m_speedsInit =3D false; // reset the read/write speeds, changes eg.= with an inserted media ++} +diff -ruN kdelibs-4.8.90.orig/solid/solid/backends/udisks2/udisksoptical= drive.h kdelibs-4.8.90/solid/solid/backends/udisks2/udisksopticaldrive.h +--- kdelibs-4.8.90.orig/solid/solid/backends/udisks2/udisksopticaldrive.= h 1970-01-01 01:00:00.000000000 +0100 ++++ kdelibs-4.8.90/solid/solid/backends/udisks2/udisksopticaldrive.h 201= 2-06-20 13:39:24.000000000 +0200 +@@ -0,0 +1,81 @@ ++/* ++ Copyright 2010 Michael Zanetti ++ Copyright 2010-2012 Luk=C3=A1=C5=A1 Tinkl ++ ++ This library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) version 3, or any ++ later version accepted by the membership of KDE e.V. (or its ++ successor approved by the membership of KDE e.V.), which shall ++ act as a proxy defined in Section 6 of version 3 of the license. ++ ++ This library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with this library. If not, see . ++*/ ++ ++#ifndef UDISKS2OPTICALDRIVE_H ++#define UDISKS2OPTICALDRIVE_H ++ ++#include ++#include "udisksstoragedrive.h" ++ ++namespace Solid ++{ ++namespace Backends ++{ ++namespace UDisks2 ++{ ++ ++class OpticalDrive: public StorageDrive, virtual public Solid::Ifaces::= OpticalDrive ++{ ++ Q_OBJECT ++ Q_INTERFACES(Solid::Ifaces::OpticalDrive) ++ ++public: ++ OpticalDrive(Device *device); ++ virtual ~OpticalDrive(); ++ ++Q_SIGNALS: ++ void ejectPressed(const QString &udi); ++ void ejectDone(Solid::ErrorType error, QVariant errorData, const QS= tring &udi); ++ void ejectRequested(const QString &udi); ++ ++public: ++ virtual bool eject(); ++ virtual QList writeSpeeds() const; ++ virtual int writeSpeed() const; ++ virtual int readSpeed() const; ++ virtual Solid::OpticalDrive::MediumTypes supportedMedia() const; ++ ++private Q_SLOTS: ++ void slotDBusReply(const QDBusMessage &reply); ++ void slotDBusError(const QDBusError &error); ++ ++ void slotEjectRequested(); ++ void slotEjectDone(int error, const QString &errorString); ++ ++ void slotChanged(); ++ ++private: ++ void initReadWriteSpeeds() const; ++ ++ bool m_ejectInProgress; ++ ++ // read/write speeds ++ mutable int m_readSpeed; ++ mutable int m_writeSpeed; ++ mutable QList m_writeSpeeds; ++ mutable bool m_speedsInit; ++}; ++ ++} ++} ++} ++ ++#endif // UDISKS2OPTICALDRIVE_H +diff -ruN kdelibs-4.8.90.orig/solid/solid/backends/udisks2/udisksstorage= access.cpp kdelibs-4.8.90/solid/solid/backends/udisks2/udisksstorageacces= s.cpp +--- kdelibs-4.8.90.orig/solid/solid/backends/udisks2/udisksstorageaccess= .cpp 1970-01-01 01:00:00.000000000 +0100 ++++ kdelibs-4.8.90/solid/solid/backends/udisks2/udisksstorageaccess.cpp = 2012-06-20 13:39:24.000000000 +0200 +@@ -0,0 +1,359 @@ ++/* ++ Copyright 2009 Pino Toscano ++ Copyright 2009-2012 Luk=C3=A1=C5=A1 Tinkl ++ ++ This library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) version 3, or any ++ later version accepted by the membership of KDE e.V. (or its ++ successor approved by the membership of KDE e.V.), which shall ++ act as a proxy defined in Section 6 of version 3 of the license. ++ ++ This library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with this library. If not, see . ++*/ ++ ++#include "udisksstorageaccess.h" ++#include "udisks2.h" ++ ++#include ++#include ++#include ++#include ++ ++using namespace Solid::Backends::UDisks2; ++ ++StorageAccess::StorageAccess(Device *device) ++ : DeviceInterface(device), m_setupInProgress(false), m_teardownInPr= ogress(false), m_passphraseRequested(false) ++{ ++ updateCache(); ++ QDBusConnection::systemBus().connect(UD2_DBUS_SERVICE, m_device->ud= i(), DBUS_INTERFACE_PROPS, "PropertiesChanged", this, ++ SLOT(slotPropertiesChanged(QSt= ring,QVariantMap,QStringList))); ++ ++ // Delay connecting to DBus signals to avoid the related time penal= ty ++ // in hot paths such as predicate matching ++ QTimer::singleShot(0, this, SLOT(connectDBusSignals())); ++} ++ ++StorageAccess::~StorageAccess() ++{ ++} ++ ++void StorageAccess::connectDBusSignals() ++{ ++ m_device->registerAction("setup", this, ++ SLOT(slotSetupRequested()), ++ SLOT(slotSetupDone(int, const QString&))); ++ ++ m_device->registerAction("teardown", this, ++ SLOT(slotTeardownRequested()), ++ SLOT(slotTeardownDone(int, const QString&)= )); ++} ++ ++bool StorageAccess::isLuksDevice() const ++{ ++ return m_device->isEncryptedContainer(); // encrypted device ++} ++ ++bool StorageAccess::isAccessible() const ++{ ++ if (isLuksDevice()) { // check if the cleartext slave is mounted ++ if (m_clearTextPath.isEmpty() || m_clearTextPath =3D=3D "/") ++ return false; ++ Device holderDevice(m_clearTextPath); ++ return holderDevice.isMounted(); ++ } ++ ++ return m_device->isMounted(); ++} ++ ++QString StorageAccess::filePath() const ++{ ++ if (!isAccessible()) ++ return QString(); ++ ++ QByteArrayList mntPoints; ++ ++ if (isLuksDevice()) { // encrypted (and unlocked) device ++ if (m_clearTextPath.isEmpty() || m_clearTextPath =3D=3D "/") ++ return QString(); ++ Device holderDevice(m_clearTextPath); ++ mntPoints =3D qdbus_cast(holderDevice.prop("Mou= ntPoints")); ++ if (!mntPoints.isEmpty()) ++ return QFile::decodeName(mntPoints.first()); // FIXME Solid= doesn't support multiple mount points ++ else ++ return QString(); ++ } ++ ++ mntPoints =3D qdbus_cast(m_device->prop("MountPoint= s")); ++ ++ if (!mntPoints.isEmpty()) ++ return QFile::decodeName(mntPoints.first()); // FIXME Solid doe= sn't support multiple mount points ++ else ++ return QString(); ++} ++ ++bool StorageAccess::isIgnored() const ++{ ++ return m_device->prop("HintIgnore").toBool(); // FIXME tune ++} ++ ++bool StorageAccess::setup() ++{ ++ if ( m_teardownInProgress || m_setupInProgress ) ++ return false; ++ m_setupInProgress =3D true; ++ m_device->broadcastActionRequested("setup"); ++ ++ if (m_device->isEncryptedContainer()) ++ return requestPassphrase(); ++ else ++ return mount(); ++} ++ ++bool StorageAccess::teardown() ++{ ++ if ( m_teardownInProgress || m_setupInProgress ) ++ return false; ++ m_teardownInProgress =3D true; ++ m_device->broadcastActionRequested("teardown"); ++ ++ return unmount(); ++} ++ ++void StorageAccess::slotPropertiesChanged(const QString &ifaceName, con= st QVariantMap &changedProps, const QStringList &invalidatedProps) ++{ ++ Q_UNUSED(ifaceName); ++ ++ if (changedProps.keys().contains("MountPoints") || invalidatedProps= .contains("MountPoints")) { ++ Q_EMIT accessibilityChanged(isAccessible(), isLuksDevice() ? m_= clearTextPath : m_device->udi()); ++ } ++} ++ ++void StorageAccess::updateCache() ++{ ++ m_isAccessible =3D isAccessible(); ++} ++ ++void StorageAccess::checkAccessibility() ++{ ++ const bool old_isAccessible =3D m_isAccessible; ++ updateCache(); ++ ++ if (old_isAccessible !=3D m_isAccessible) { ++ Q_EMIT accessibilityChanged(m_isAccessible, isLuksDevice() ? m_= clearTextPath : m_device->udi()); ++ } ++} ++ ++void StorageAccess::slotDBusReply( const QDBusMessage & reply ) ++{ ++ if (m_setupInProgress) ++ { ++ if (isLuksDevice() && !isAccessible()) { // unlocked device, no= w mount it ++ if (reply.type() =3D=3D QDBusMessage::ReplyMessage) // we'= ve got a response from Unlock ++ m_clearTextPath =3D reply.arguments().value(0).value().path(); ++ mount(); ++ } ++ else // Don't broadcast setupDone unless the setup is really do= ne. (Fix kde#271156) ++ { ++ m_setupInProgress =3D false; ++ m_device->broadcastActionDone("setup"); ++ ++ checkAccessibility(); ++ } ++ } ++ else if (m_teardownInProgress) // FIXME ++ { ++ if (isLuksDevice() && !m_clearTextPath.isEmpty() && m_clearText= Path !=3D "/") // unlocked device, lock it ++ { ++ callCryptoTeardown(); ++ } ++ else if (!m_clearTextPath.isEmpty() && m_clearTextPath !=3D "/"= ) { ++ callCryptoTeardown(true); // Lock crypted parent ++ } ++ else ++ { ++ if (m_device->prop("Ejectable").toBool() && !m_device->isOp= ticalDisc()) // optical drives have their Eject method ++ { ++ // try to "eject" (aka safely remove) from the (parent)= drive, e.g. SD card from a reader ++ QString drivePath =3D m_device->prop("Drive").value().path(); ++ if (!drivePath.isEmpty() || drivePath !=3D "/") ++ { ++ QDBusConnection c =3D QDBusConnection::systemBus(); ++ QDBusMessage msg =3D QDBusMessage::createMethodCall= (UD2_DBUS_SERVICE, drivePath, UD2_DBUS_INTERFACE_DRIVE, "Eject"); ++ msg << QVariantMap(); // options, unused now ++ c.call(msg, QDBus::NoBlock); ++ } ++ } ++ ++ m_teardownInProgress =3D false; ++ m_device->broadcastActionDone("teardown"); ++ ++ checkAccessibility(); ++ } ++ } ++} ++ ++void StorageAccess::slotDBusError( const QDBusError & error ) ++{ ++ if (m_setupInProgress) ++ { ++ m_setupInProgress =3D false; ++ m_device->broadcastActionDone("setup", m_device->errorToSolidEr= ror(error.name()), ++ m_device->errorToString(error.nam= e()) + ": " +error.message()); ++ ++ checkAccessibility(); ++ } ++ else if (m_teardownInProgress) ++ { ++ m_teardownInProgress =3D false; ++ m_clearTextPath.clear(); ++ m_device->broadcastActionDone("teardown", m_device->errorToSoli= dError(error.name()), ++ m_device->errorToString(error.nam= e()) + ": " + error.message()); ++ checkAccessibility(); ++ } ++} ++ ++void StorageAccess::slotSetupRequested() ++{ ++ m_setupInProgress =3D true; ++ Q_EMIT setupRequested(m_device->udi()); ++} ++ ++void StorageAccess::slotSetupDone(int error, const QString &errorString= ) ++{ ++ m_setupInProgress =3D false; ++ Q_EMIT setupDone(static_cast(error), errorString,= m_device->udi()); ++} ++ ++void StorageAccess::slotTeardownRequested() ++{ ++ m_teardownInProgress =3D true; ++ Q_EMIT teardownRequested(m_device->udi()); ++} ++ ++void StorageAccess::slotTeardownDone(int error, const QString &errorStr= ing) ++{ ++ m_teardownInProgress =3D false; ++ m_clearTextPath.clear(); ++ Q_EMIT teardownDone(static_cast(error), errorStri= ng, m_device->udi()); ++} ++ ++bool StorageAccess::mount() ++{ ++ QString path =3D m_device->udi(); ++ ++ if (isLuksDevice()) { // mount options for the cleartext volume ++ path =3D m_clearTextPath; ++ } ++ ++ QDBusConnection c =3D QDBusConnection::systemBus(); ++ QDBusMessage msg =3D QDBusMessage::createMethodCall(UD2_DBUS_SERVIC= E, path, UD2_DBUS_INTERFACE_FILESYSTEM, "Mount"); ++ ++ msg << QVariantMap(); // options, unused now ++ ++ return c.callWithCallback(msg, this, ++ SLOT(slotDBusReply(const QDBusMessage &))= , ++ SLOT(slotDBusError(const QDBusError &))); ++} ++ ++bool StorageAccess::unmount() ++{ ++ QString path =3D m_device->udi(); ++ ++ if (isLuksDevice()) { // unmount options for the cleartext volume ++ path =3D m_clearTextPath; ++ } ++ ++ QDBusConnection c =3D QDBusConnection::systemBus(); ++ QDBusMessage msg =3D QDBusMessage::createMethodCall(UD2_DBUS_SERVIC= E, path, UD2_DBUS_INTERFACE_FILESYSTEM, "Unmount"); ++ ++ msg << QVariantMap(); // options, unused now ++ ++ return c.callWithCallback(msg, this, ++ SLOT(slotDBusReply(const QDBusMessage &))= , ++ SLOT(slotDBusError(const QDBusError &)), ++ s_unmountTimeout); ++} ++ ++QString StorageAccess::generateReturnObjectPath() ++{ ++ static int number =3D 1; ++ ++ return "/org/kde/solid/UDisks2StorageAccess_"+QString::number(numbe= r++); ++} ++ ++bool StorageAccess::requestPassphrase() ++{ ++ QString udi =3D m_device->udi(); ++ QString returnService =3D QDBusConnection::sessionBus().baseService= (); ++ m_lastReturnObject =3D generateReturnObjectPath(); ++ ++ QDBusConnection::sessionBus().registerObject(m_lastReturnObject, th= is, QDBusConnection::ExportScriptableSlots); ++ ++ QWidget *activeWindow =3D QApplication::activeWindow(); ++ uint wId =3D 0; ++ if (activeWindow!=3D0) ++ wId =3D (uint)activeWindow->winId(); ++ ++ QString appId =3D QCoreApplication::applicationName(); ++ ++ QDBusInterface soliduiserver("org.kde.kded5", "/modules/soliduiserv= er", "org.kde.SolidUiServer"); ++ QDBusReply reply =3D soliduiserver.call("showPassphraseDialog= ", udi, returnService, ++ m_lastReturnObject, wId= , appId); ++ m_passphraseRequested =3D reply.isValid(); ++ if (!m_passphraseRequested) ++ qWarning() << "Failed to call the SolidUiServer, D-Bus said:" <= < reply.error(); ++ ++ return m_passphraseRequested; ++} ++ ++void StorageAccess::passphraseReply(const QString & passphrase) ++{ ++ if (m_passphraseRequested) ++ { ++ QDBusConnection::sessionBus().unregisterObject(m_lastReturnObje= ct); ++ m_passphraseRequested =3D false; ++ if (!passphrase.isEmpty()) ++ callCryptoSetup(passphrase); ++ else ++ { ++ m_setupInProgress =3D false; ++ m_device->broadcastActionDone("setup"); ++ } ++ } ++} ++ ++void StorageAccess::callCryptoSetup(const QString & passphrase) ++{ ++ QDBusConnection c =3D QDBusConnection::systemBus(); ++ QDBusMessage msg =3D QDBusMessage::createMethodCall(UD2_DBUS_SERVIC= E, m_device->udi(), UD2_DBUS_INTERFACE_ENCRYPTED, "Unlock"); ++ ++ msg << passphrase; ++ msg << QVariantMap(); // options, unused now ++ ++ c.callWithCallback(msg, this, ++ SLOT(slotDBusReply(const QDBusMessage &)), ++ SLOT(slotDBusError(const QDBusError &))); ++} ++ ++bool StorageAccess::callCryptoTeardown(bool actOnParent) ++{ ++ QDBusConnection c =3D QDBusConnection::systemBus(); ++ QDBusMessage msg =3D QDBusMessage::createMethodCall(UD2_DBUS_SERVIC= E, ++ actOnParent ? (m_= device->prop("CryptoBackingDevice").value().path()) : m_= device->udi(), ++ UD2_DBUS_INTERFAC= E_ENCRYPTED, "Lock"); ++ msg << QVariantMap(); // options, unused now ++ ++ m_clearTextPath.clear(); ++ ++ return c.callWithCallback(msg, this, ++ SLOT(slotDBusReply(const QDBusMessage &))= , ++ SLOT(slotDBusError(const QDBusError &))); ++} +diff -ruN kdelibs-4.8.90.orig/solid/solid/backends/udisks2/udisksstorage= access.h kdelibs-4.8.90/solid/solid/backends/udisks2/udisksstorageaccess.= h +--- kdelibs-4.8.90.orig/solid/solid/backends/udisks2/udisksstorageaccess= .h 1970-01-01 01:00:00.000000000 +0100 ++++ kdelibs-4.8.90/solid/solid/backends/udisks2/udisksstorageaccess.h 20= 12-06-20 13:39:24.000000000 +0200 +@@ -0,0 +1,104 @@ ++/* ++ Copyright 2009 Pino Toscano ++ Copyright 2009-2012 Luk=C3=A1=C5=A1 Tinkl ++ ++ This library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) version 3, or any ++ later version accepted by the membership of KDE e.V. (or its ++ successor approved by the membership of KDE e.V.), which shall ++ act as a proxy defined in Section 6 of version 3 of the license. ++ ++ This library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with this library. If not, see . ++*/ ++ ++#ifndef UDISKS2STORAGEACCESS_H ++#define UDISKS2STORAGEACCESS_H ++ ++#include ++#include "udisksdeviceinterface.h" ++ ++#include ++#include ++ ++namespace Solid ++{ ++namespace Backends ++{ ++namespace UDisks2 ++{ ++class StorageAccess : public DeviceInterface, virtual public Solid::Ifa= ces::StorageAccess ++{ ++ Q_OBJECT ++ Q_INTERFACES(Solid::Ifaces::StorageAccess) ++ ++public: ++ StorageAccess(Device *device); ++ virtual ~StorageAccess(); ++ ++ virtual bool isAccessible() const; ++ virtual QString filePath() const; ++ virtual bool isIgnored() const; ++ virtual bool setup(); ++ virtual bool teardown(); ++ ++Q_SIGNALS: ++ void accessibilityChanged(bool accessible, const QString &udi); ++ void setupDone(Solid::ErrorType error, QVariant errorData, const QS= tring &udi); ++ void teardownDone(Solid::ErrorType error, QVariant errorData, const= QString &udi); ++ void setupRequested(const QString &udi); ++ void teardownRequested(const QString &udi); ++ ++public Q_SLOTS: ++ Q_SCRIPTABLE Q_NOREPLY void passphraseReply(const QString & passphr= ase); ++ ++private Q_SLOTS: ++ void slotPropertiesChanged(const QString & ifaceName, const QVarian= tMap & changedProps, const QStringList & invalidatedProps); ++ void slotDBusReply(const QDBusMessage & reply); ++ void slotDBusError(const QDBusError & error); ++ ++ void connectDBusSignals(); ++ ++ void slotSetupRequested(); ++ void slotSetupDone(int error, const QString &errorString); ++ void slotTeardownRequested(); ++ void slotTeardownDone(int error, const QString &errorString); ++ ++private: ++ /// @return true if this device is luks and unlocked ++ bool isLuksDevice() const; ++ ++ void updateCache(); ++ void checkAccessibility(); ++ ++ bool mount(); ++ bool unmount(); ++ ++ bool requestPassphrase(); ++ void callCryptoSetup( const QString & passphrase ); ++ bool callCryptoTeardown( bool actOnParent=3Dfalse ); ++ ++ QString generateReturnObjectPath(); ++ ++private: ++ bool m_isAccessible; ++ bool m_setupInProgress; ++ bool m_teardownInProgress; ++ bool m_passphraseRequested; ++ QString m_lastReturnObject; ++ QString m_clearTextPath; // path to the unlocked cleartext device ++ ++ static const int s_unmountTimeout =3D 0x7fffffff; ++}; ++} ++} ++} ++ ++#endif // UDISKS2STORAGEACCESS_H +diff -ruN kdelibs-4.8.90.orig/solid/solid/backends/udisks2/udisksstorage= drive.cpp kdelibs-4.8.90/solid/solid/backends/udisks2/udisksstoragedrive.= cpp +--- kdelibs-4.8.90.orig/solid/solid/backends/udisks2/udisksstoragedrive.= cpp 1970-01-01 01:00:00.000000000 +0100 ++++ kdelibs-4.8.90/solid/solid/backends/udisks2/udisksstoragedrive.cpp 2= 012-06-20 13:39:24.000000000 +0200 +@@ -0,0 +1,147 @@ ++/* ++ Copyright 2010 Michael Zanetti ++ Copyright 2010-2012 Luk=C3=A1=C5=A1 Tinkl ++ ++ This library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) version 3, or any ++ later version accepted by the membership of KDE e.V. (or its ++ successor approved by the membership of KDE e.V.), which shall ++ act as a proxy defined in Section 6 of version 3 of the license. ++ ++ This library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with this library. If not, see . ++*/ ++ ++#include "udisksstoragedrive.h" ++ ++#include "../shared/udevqtclient.h" ++ ++#include ++#include ++ ++using namespace Solid::Backends::UDisks2; ++ ++StorageDrive::StorageDrive(Device *dev) ++ : Block(dev) ++{ ++ UdevQt::Client client(this); ++ m_udevDevice =3D client.deviceByDeviceFile(device()); ++ m_udevDevice.deviceProperties(); ++} ++ ++StorageDrive::~StorageDrive() ++{ ++} ++ ++qulonglong StorageDrive::size() const ++{ ++ return m_device->prop("Size").toULongLong(); ++} ++ ++bool StorageDrive::isHotpluggable() const ++{ ++ const Solid::StorageDrive::Bus _bus =3D bus(); ++ return _bus =3D=3D Solid::StorageDrive::Usb || _bus =3D=3D Solid::S= torageDrive::Ieee1394; ++} ++ ++bool StorageDrive::isRemovable() const ++{ ++ return m_device->prop("MediaRemovable").toBool() || m_device->prop(= "Removable").toBool(); ++} ++ ++Solid::StorageDrive::DriveType StorageDrive::driveType() const ++{ ++ const QStringList mediaTypes =3D m_device->prop("MediaCompatibility= ").toStringList(); ++ ++ if ( m_device->isOpticalDrive() ) // optical disks ++ { ++ return Solid::StorageDrive::CdromDrive; ++ } ++ else if ( mediaTypes.contains( "floppy" ) ) ++ { ++ return Solid::StorageDrive::Floppy; ++ } ++#if 0 // TODO add to Solid ++ else if ( mediaTypes.contains( "floppy_jaz" ) ) ++ { ++ return Solid::StorageDrive::Jaz; ++ } ++ else if ( mediaTypes.contains( "floppy_zip" ) ) ++ { ++ return Solid::StorageDrive::Zip; ++ } ++ else if ( mediaTypes.contains( "flash" ) ) ++ { ++ return Solid::StorageDrive::Flash; ++ } ++#endif ++ else if ( mediaTypes.contains( "flash_cf" ) ) ++ { ++ return Solid::StorageDrive::CompactFlash; ++ } ++ else if ( mediaTypes.contains( "flash_ms" ) ) ++ { ++ return Solid::StorageDrive::MemoryStick; ++ } ++ else if ( mediaTypes.contains( "flash_sm" ) ) ++ { ++ return Solid::StorageDrive::SmartMedia; ++ } ++ else if ( mediaTypes.contains( "flash_sd" ) || mediaTypes.contains(= "flash_sdhc" ) ++ || mediaTypes.contains( "flash_mmc" ) || mediaTypes.conta= ins("flash_sdxc") ) ++ { ++ return Solid::StorageDrive::SdMmc; ++ } ++ // FIXME: udisks2 doesn't know about xD cards ++ else ++ { ++ return Solid::StorageDrive::HardDisk; ++ } ++} ++ ++Solid::StorageDrive::Bus StorageDrive::bus() const ++{ ++ const QString bus =3D m_device->prop("ConnectionBus").toString(); ++ const QString udevBus =3D m_udevDevice.deviceProperty("ID_BUS").toS= tring(); ++ ++ //qDebug() << "bus:" << bus << "udev bus:" << udevBus; ++ ++ if (udevBus =3D=3D "ata") ++ { ++ if (m_udevDevice.deviceProperty("ID_ATA_SATA").toInt() =3D=3D 1= ) // serial ATA ++ return Solid::StorageDrive::Sata; ++ else // parallel (classical) ATA ++ return Solid::StorageDrive::Ide; ++ } ++ else if (bus =3D=3D "usb") ++ { ++ return Solid::StorageDrive::Usb; ++ } ++ else if (bus =3D=3D "ieee1394") ++ { ++ return Solid::StorageDrive::Ieee1394; ++ } ++ else if (udevBus =3D=3D "scsi") ++ { ++ return Solid::StorageDrive::Scsi; ++ } ++#if 0 // TODO add these to Solid ++ else if ( bus =3D=3D "sdio" ) ++ { ++ return Solid::StorageDrive::SDIO; ++ } ++ else if ( bus =3D=3D "virtual" ) ++ { ++ return Solid::StorageDrive::Virtual; ++ } ++#endif ++ else ++ return Solid::StorageDrive::Platform; ++} +diff -ruN kdelibs-4.8.90.orig/solid/solid/backends/udisks2/udisksstorage= drive.h kdelibs-4.8.90/solid/solid/backends/udisks2/udisksstoragedrive.h +--- kdelibs-4.8.90.orig/solid/solid/backends/udisks2/udisksstoragedrive.= h 1970-01-01 01:00:00.000000000 +0100 ++++ kdelibs-4.8.90/solid/solid/backends/udisks2/udisksstoragedrive.h 201= 2-06-20 13:39:24.000000000 +0200 +@@ -0,0 +1,61 @@ ++/* ++ Copyright 2010 Michael Zanetti ++ Copyright 2010-2012 Luk=C3=A1=C5=A1 Tinkl ++ ++ This library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) version 3, or any ++ later version accepted by the membership of KDE e.V. (or its ++ successor approved by the membership of KDE e.V.), which shall ++ act as a proxy defined in Section 6 of version 3 of the license. ++ ++ This library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with this library. If not, see . ++*/ ++ ++#ifndef UDISKS2STORAGEDRIVE_H ++#define UDISKS2STORAGEDRIVE_H ++ ++#include ++ ++#include "../shared/udevqtdevice.h" ++ ++#include "udisksblock.h" ++ ++namespace Solid ++{ ++namespace Backends ++{ ++namespace UDisks2 ++{ ++ ++class StorageDrive: public Block, virtual public Solid::Ifaces::Storage= Drive ++{ ++ Q_OBJECT ++ Q_INTERFACES(Solid::Ifaces::StorageDrive) ++ ++public: ++ StorageDrive(Device *dev); ++ virtual ~StorageDrive(); ++ ++ virtual qulonglong size() const; ++ virtual bool isHotpluggable() const; ++ virtual bool isRemovable() const; ++ virtual Solid::StorageDrive::DriveType driveType() const; ++ virtual Solid::StorageDrive::Bus bus() const; ++ ++private: ++ UdevQt::Device m_udevDevice; ++}; ++ ++} ++} ++} ++ ++#endif // UDISK2SSTORAGEDRIVE_H +diff -ruN kdelibs-4.8.90.orig/solid/solid/backends/udisks2/udisksstorage= volume.cpp kdelibs-4.8.90/solid/solid/backends/udisks2/udisksstoragevolum= e.cpp +--- kdelibs-4.8.90.orig/solid/solid/backends/udisks2/udisksstoragevolume= .cpp 1970-01-01 01:00:00.000000000 +0100 ++++ kdelibs-4.8.90/solid/solid/backends/udisks2/udisksstoragevolume.cpp = 2012-06-20 13:39:24.000000000 +0200 +@@ -0,0 +1,105 @@ ++/* ++ Copyright 2010 Michael Zanetti ++ Copyright 2010-2012 Luk=C3=A1=C5=A1 Tinkl ++ ++ This library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) version 3, or any ++ later version accepted by the membership of KDE e.V. (or its ++ successor approved by the membership of KDE e.V.), which shall ++ act as a proxy defined in Section 6 of version 3 of the license. ++ ++ This library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with this library. If not, see . ++*/ ++ ++#include "udisksstoragevolume.h" ++#include "udisks2.h" ++ ++using namespace Solid::Backends::UDisks2; ++ ++StorageVolume::StorageVolume(Device *device) ++ : Block(device) ++{ ++} ++ ++StorageVolume::~StorageVolume() ++{ ++} ++ ++QString StorageVolume::encryptedContainerUdi() const ++{ ++ const QString path =3D m_device->prop("CryptoBackingDevice").value<= QDBusObjectPath>().path(); ++ if ( path.isEmpty() || path =3D=3D "/") ++ return QString(); ++ else ++ return path; ++} ++ ++qulonglong StorageVolume::size() const ++{ ++ return m_device->prop("Size").toULongLong(); ++} ++ ++QString StorageVolume::uuid() const ++{ ++ return m_device->prop("IdUUID").toString(); ++} ++ ++QString StorageVolume::label() const ++{ ++ QString label =3D m_device->prop("HintName").toString(); ++ if (label.isEmpty()) ++ label =3D m_device->prop("IdLabel").toString(); ++ if (label.isEmpty()) ++ label =3D m_device->prop("Name").toString(); ++ return label; ++} ++ ++QString StorageVolume::fsType() const ++{ ++ return m_device->prop("IdType").toString(); ++} ++ ++Solid::StorageVolume::UsageType StorageVolume::usage() const ++{ ++ const QString usage =3D m_device->prop("IdUsage").toString(); ++ ++ if (m_device->hasInterface(UD2_DBUS_INTERFACE_FILESYSTEM)) ++ { ++ return Solid::StorageVolume::FileSystem; ++ } ++ else if (m_device->isPartitionTable()) ++ { ++ return Solid::StorageVolume::PartitionTable; ++ } ++ else if (usage =3D=3D "raid") ++ { ++ return Solid::StorageVolume::Raid; ++ } ++ else if (m_device->isEncryptedContainer()) ++ { ++ return Solid::StorageVolume::Encrypted; ++ } ++ else if (usage =3D=3D "unused" || usage.isEmpty()) ++ { ++ return Solid::StorageVolume::Unused; ++ } ++ else ++ { ++ return Solid::StorageVolume::Other; ++ } ++} ++ ++bool StorageVolume::isIgnored() const ++{ ++ const Solid::StorageVolume::UsageType usg =3D usage(); ++ return m_device->prop("HintIgnore").toBool() || m_device->isSwap() = || ++ ((usg =3D=3D Solid::StorageVolume::Unused || usg =3D=3D Sol= id::StorageVolume::Other || usg =3D=3D Solid::StorageVolume::PartitionTab= le) && !m_device->isOpticalDisc()); ++} +diff -ruN kdelibs-4.8.90.orig/solid/solid/backends/udisks2/udisksstorage= volume.h kdelibs-4.8.90/solid/solid/backends/udisks2/udisksstoragevolume.= h +--- kdelibs-4.8.90.orig/solid/solid/backends/udisks2/udisksstoragevolume= .h 1970-01-01 01:00:00.000000000 +0100 ++++ kdelibs-4.8.90/solid/solid/backends/udisks2/udisksstoragevolume.h 20= 12-06-20 13:39:24.000000000 +0200 +@@ -0,0 +1,57 @@ ++/* ++ Copyright 2010 Michael Zanetti ++ ++ This library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) version 3, or any ++ later version accepted by the membership of KDE e.V. (or its ++ successor approved by the membership of KDE e.V.), which shall ++ act as a proxy defined in Section 6 of version 3 of the license. ++ ++ This library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with this library. If not, see . ++*/ ++ ++#ifndef UDISKS2STORAGEVOLUME_H ++#define UDISKS2STORAGEVOLUME_H ++ ++#include ++#include "udisksblock.h" ++ ++ ++namespace Solid ++{ ++namespace Backends ++{ ++namespace UDisks2 ++{ ++ ++class StorageVolume: public Block, virtual public Solid::Ifaces::Storag= eVolume ++{ ++ Q_OBJECT ++ Q_INTERFACES(Solid::Ifaces::StorageVolume) ++ ++public: ++ StorageVolume(Device *device); ++ virtual ~StorageVolume(); ++ ++ virtual QString encryptedContainerUdi() const; ++ virtual qulonglong size() const; ++ virtual QString uuid() const; ++ virtual QString label() const; ++ virtual QString fsType() const; ++ virtual Solid::StorageVolume::UsageType usage() const; ++ virtual bool isIgnored() const; ++}; ++ ++} ++} ++} ++ ++#endif // UDISKS2STORAGEVOLUME_H +diff -ruN kdelibs-4.8.90.orig/solid/solid/managerbase.cpp kdelibs-4.8.90= /solid/solid/managerbase.cpp +--- kdelibs-4.8.90.orig/solid/solid/managerbase.cpp 2012-05-23 01:45:29.= 000000000 +0200 ++++ kdelibs-4.8.90/solid/solid/managerbase.cpp 2012-06-20 13:39:51.00000= 0000 +0200 +@@ -21,7 +21,7 @@ + #include "managerbase_p.h" +=20 + #include +-#if !defined (Q_WS_WIN) && !defined (Q_OS_MAC) ++#if !defined (Q_OS_WIN) && !defined (Q_OS_MAC) + #include + #endif +=20 +@@ -30,8 +30,7 @@ + #if defined (Q_OS_MAC) + #include "backends/iokit/iokitmanager.h" + #elif defined (Q_OS_UNIX) +-#include "backends/hal/halmanager.h" +-#include "backends/udisks/udisksmanager.h" ++#include "backends/udisks2/udisksmanager.h" + #include "backends/upower/upowermanager.h" +=20 + #if defined (HUPNP_FOUND) +@@ -44,7 +43,7 @@ +=20 + #include "backends/fstab/fstabmanager.h" +=20 +-#elif defined (Q_WS_WIN) && defined(HAVE_WBEM) && !defined(_WIN32_WCE) ++#elif defined (Q_OS_WIN) && defined(HAVE_WBEM) && !defined(_WIN32_WCE) + #include "backends/wmi/wmimanager.h" + #endif +=20 +@@ -68,25 +67,16 @@ + # if defined(Q_OS_MAC) + m_backends << new Solid::Backends::IOKit::IOKitManager(0); +=20 +-# elif defined(Q_WS_WIN) && defined(HAVE_WBEM) && !defined(_WIN3= 2_WCE) ++# elif defined(Q_OS_WIN) && defined(HAVE_WBEM) && !defined(_WIN3= 2_WCE) + m_backends << new Solid::Backends::Wmi::WmiManager(0); +=20 +-# elif defined(Q_OS_UNIX) && !defined(Q_OS_LINUX) +- m_backends << new Solid::Backends::Hal::HalManager(0); +- + # elif defined(Q_OS_LINUX) +- bool solidHalLegacyEnabled +- =3D QString::fromLocal8Bit(qgetenv("SOLID_HAL_LEGACY"))= .toInt()=3D=3D1; +- if (solidHalLegacyEnabled) { +- m_backends << new Solid::Backends::Hal::HalManager(0); +- } else { + # if defined(UDEV_FOUND) + m_backends << new Solid::Backends::UDev::UDevManage= r(0); + # endif +- m_backends << new Solid::Backends::UDisks::UDisksManage= r(0) ++ m_backends << new Solid::Backends::UDisks2::Manager(0) + << new Solid::Backends::UPower::UPowerManage= r(0) + << new Solid::Backends::Fstab::FstabManager(= 0); +- } + # endif +=20 + # if defined (HUPNP_FOUND) +diff -ruN kdelibs-4.8.90.orig/solid/tests/CMakeLists.txt kdelibs-4.8.90/= solid/tests/CMakeLists.txt +--- kdelibs-4.8.90.orig/solid/tests/CMakeLists.txt 2012-05-23 01:45:29.0= 00000000 +0200 ++++ kdelibs-4.8.90/solid/tests/CMakeLists.txt 2012-06-20 13:39:02.000000= 000 +0200 +@@ -16,20 +16,6 @@ + add_definitions(-DTEST_DATA=3D"\\"${CMAKE_CURRENT_SOURCE_DIR}/../solid/= backends/fakehw/fakecomputer.xml\\"") +=20 +=20 +-########### halbasictest ############### +- +-if(NOT WIN32 AND NOT APPLE) +-set(halbasictest_SRCS halbasictest.cpp ) +- +-kde4_add_executable(halbasictest ${halbasictest_SRCS}) +- +-if(WIN32) +- set_target_properties(halbasictest PROPERTIES COMPILE_FLAGS -DSOLID_E= XPORT=3D) +-endif(WIN32) +- +-target_link_libraries(halbasictest solid_static ${KDEWIN_LIBRARIES} ${Q= T_QTCORE_LIBRARY} ${QT_QTDBUS_LIBRARY} ${QT_QTXML_LIBRARY} ${QT_QTTEST_LI= BRARY} ) +-endif(NOT WIN32 AND NOT APPLE) +- + ########### solidhwtest ############### +=20 + set(solidhwtest_SRCS=20 diff --git a/kde-base/kdelibs/files/kdelibs-4.8.90-udisks2_post.patch b/k= de-base/kdelibs/files/kdelibs-4.8.90-udisks2_post.patch deleted file mode 100644 index 68ad5f4..0000000 --- a/kde-base/kdelibs/files/kdelibs-4.8.90-udisks2_post.patch +++ /dev/null @@ -1,113 +0,0 @@ -diff -ruN kdelibs-4.8.90.orig/solid/solid/CMakeLists.txt kdelibs-4.8.90/= solid/solid/CMakeLists.txt ---- kdelibs-4.8.90.orig/solid/solid/CMakeLists.txt 2012-06-19 22:42:38.2= 67962759 +0200 -+++ kdelibs-4.8.90/solid/solid/CMakeLists.txt 2012-06-19 22:44:23.050968= 201 +0200 -@@ -40,7 +40,6 @@ -=20 - file(MAKE_DIRECTORY - ${CMAKE_CURRENT_BINARY_DIR}/backends/fakehw -- ${CMAKE_CURRENT_BINARY_DIR}/backends/hal - ${CMAKE_CURRENT_BINARY_DIR}/backends/udev - ${CMAKE_CURRENT_BINARY_DIR}/backends/wmi - ) -@@ -226,33 +225,6 @@ - endif( UDEV_FOUND ) -=20 -=20 -- message(STATUS "Building Solid HAL backend." ) -- set(solid_LIB_SRCS ${solid_LIB_SRCS} -- backends/hal/halacadapter.cpp -- backends/hal/halaudiointerface.cpp -- backends/hal/halbattery.cpp -- backends/hal/halblock.cpp -- backends/hal/halbutton.cpp -- backends/hal/halcamera.cpp -- backends/hal/halcdrom.cpp -- backends/hal/haldeviceinterface.cpp -- backends/hal/haldvbinterface.cpp -- backends/hal/halfstabhandling.cpp -- backends/hal/halgenericinterface.cpp -- backends/hal/haldevice.cpp -- backends/hal/halmanager.cpp -- backends/hal/halnetworkinterface.cpp -- backends/hal/halserialinterface.cpp -- backends/hal/halopticaldisc.cpp -- backends/hal/halportablemediaplayer.cpp -- backends/hal/halprocessor.cpp -- backends/hal/halstorageaccess.cpp -- backends/hal/halstorage.cpp -- backends/hal/halvideo.cpp -- backends/hal/halvolume.cpp -- backends/hal/halsmartcardreader.cpp -- ) -- - message(STATUS "Building Solid UPower backend." ) - set(solid_LIB_SRCS ${solid_LIB_SRCS} - backends/upower/upowermanager.cpp -@@ -265,18 +237,19 @@ -=20 - # FIXME: this should work on more Unix systems - if (CMAKE_SYSTEM_NAME MATCHES Linux) -- message(STATUS "Building Solid UDisks backend." ) -+ message(STATUS "Building Solid UDisks2 backend." ) - set(solid_LIB_SRCS ${solid_LIB_SRCS} -- backends/udisks/udisksmanager.cpp -- backends/udisks/udisksdevice.cpp -- backends/udisks/udisksblock.cpp -- backends/udisks/udisksstoragevolume.cpp -- backends/udisks/udisksdeviceinterface.cpp -- backends/udisks/udisksopticaldisc.cpp -- backends/udisks/udisksopticaldrive.cpp -- backends/udisks/udisksstoragedrive.cpp -- backends/udisks/udisksstorageaccess.cpp -- backends/udisks/udisksgenericinterface.cpp -+ backends/udisks2/udisksmanager.cpp -+ backends/udisks2/udisksdevice.cpp -+ backends/udisks2/udisksblock.cpp -+ backends/udisks2/udisksstoragevolume.cpp -+ backends/udisks2/udisksdeviceinterface.cpp -+ backends/udisks2/udisksopticaldisc.cpp -+ backends/udisks2/udisksopticaldrive.cpp -+ backends/udisks2/udisksstoragedrive.cpp -+ backends/udisks2/udisksstorageaccess.cpp -+ backends/udisks2/udisksgenericinterface.cpp -+ backends/udisks2/dbus/manager.cpp - ) - endif (CMAKE_SYSTEM_NAME MATCHES Linux) -=20 -diff -ruN kdelibs-4.8.90.orig/solid/solid/managerbase.cpp kdelibs-4.8.90= /solid/solid/managerbase.cpp ---- kdelibs-4.8.90.orig/solid/solid/managerbase.cpp 2012-06-19 22:42:38.= 267962759 +0200 -+++ kdelibs-4.8.90/solid/solid/managerbase.cpp 2012-06-19 22:44:23.05096= 8201 +0200 -@@ -30,8 +30,7 @@ - #if defined (Q_OS_MAC) - #include "backends/iokit/iokitmanager.h" - #elif defined (Q_OS_UNIX) --#include "backends/hal/halmanager.h" --#include "backends/udisks/udisksmanager.h" -+#include "backends/udisks2/udisksmanager.h" - #include "backends/upower/upowermanager.h" -=20 - #if defined (HUPNP_FOUND) -@@ -71,22 +70,13 @@ - # elif defined(Q_OS_WIN) && defined(HAVE_WBEM) && !defined(_WIN3= 2_WCE) - m_backends << new Solid::Backends::Wmi::WmiManager(0); -=20 --# elif defined(Q_OS_UNIX) && !defined(Q_OS_LINUX) -- m_backends << new Solid::Backends::Hal::HalManager(0); -- - # elif defined(Q_OS_LINUX) -- bool solidHalLegacyEnabled -- =3D QString::fromLocal8Bit(qgetenv("SOLID_HAL_LEGACY"))= .toInt()=3D=3D1; -- if (solidHalLegacyEnabled) { -- m_backends << new Solid::Backends::Hal::HalManager(0); -- } else { - # if defined(UDEV_FOUND) - m_backends << new Solid::Backends::UDev::UDevManage= r(0); - # endif -- m_backends << new Solid::Backends::UDisks::UDisksManage= r(0) -+ m_backends << new Solid::Backends::UDisks2::Manager(0) - << new Solid::Backends::UPower::UPowerManage= r(0) - << new Solid::Backends::Fstab::FstabManager(= 0); -- } - # endif -=20 - # if defined (HUPNP_FOUND) diff --git a/kde-base/kdelibs/files/kdelibs-4.8.90-udisks2_prep.patch b/k= de-base/kdelibs/files/kdelibs-4.8.90-udisks2_prep.patch deleted file mode 100644 index 2962837..0000000 --- a/kde-base/kdelibs/files/kdelibs-4.8.90-udisks2_prep.patch +++ /dev/null @@ -1,65 +0,0 @@ -diff -up kdelibs-4.8.2/solid/solid/CMakeLists.txt.udisks2_prep kdelibs-4= .8.2/solid/solid/CMakeLists.txt ---- kdelibs-4.8.2/solid/solid/CMakeLists.txt.udisks2_prep 2011-07-27 13:= 34:38.000000000 -0500 -+++ kdelibs-4.8.2/solid/solid/CMakeLists.txt 2012-04-17 16:02:06.1539859= 74 -0500 -@@ -1,6 +1,7 @@ - set( EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR} ) - add_subdirectory( ifaces ) - include_directories( ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY= _DIR} ) -+include_directories( ${QT_QTDBUS_INCLUDE_DIR} ) -=20 - if(WIN32) - include_directories( ${KDEWIN_INCLUDES} ) -diff -up kdelibs-4.8.2/solid/solid/managerbase.cpp.udisks2_prep kdelibs-= 4.8.2/solid/solid/managerbase.cpp ---- kdelibs-4.8.2/solid/solid/managerbase.cpp.udisks2_prep 2011-07-27 13= :34:39.000000000 -0500 -+++ kdelibs-4.8.2/solid/solid/managerbase.cpp 2012-04-17 16:02:06.154985= 961 -0500 -@@ -21,7 +21,7 @@ - #include "managerbase_p.h" -=20 - #include --#if !defined (Q_WS_WIN) && !defined (Q_OS_MAC) -+#if !defined (Q_OS_WIN) && !defined (Q_OS_MAC) - #include - #endif -=20 -@@ -44,7 +44,7 @@ -=20 - #include "backends/fstab/fstabmanager.h" -=20 --#elif defined (Q_WS_WIN) && defined(HAVE_WBEM) && !defined(_WIN32_WCE) -+#elif defined (Q_OS_WIN) && defined(HAVE_WBEM) && !defined(_WIN32_WCE) - #include "backends/wmi/wmimanager.h" - #endif -=20 -@@ -68,7 +68,7 @@ void Solid::ManagerBasePrivate::loadBack - # if defined(Q_OS_MAC) - m_backends << new Solid::Backends::IOKit::IOKitManager(0); -=20 --# elif defined(Q_WS_WIN) && defined(HAVE_WBEM) && !defined(_WIN3= 2_WCE) -+# elif defined(Q_OS_WIN) && defined(HAVE_WBEM) && !defined(_WIN3= 2_WCE) - m_backends << new Solid::Backends::Wmi::WmiManager(0); -=20 - # elif defined(Q_OS_UNIX) && !defined(Q_OS_LINUX) -diff -up kdelibs-4.8.2/solid/tests/CMakeLists.txt.udisks2_prep kdelibs-4= .8.2/solid/tests/CMakeLists.txt ---- kdelibs-4.8.2/solid/tests/CMakeLists.txt.udisks2_prep 2011-10-20 15:= 52:04.000000000 -0500 -+++ kdelibs-4.8.2/solid/tests/CMakeLists.txt 2012-04-17 16:02:44.5845055= 27 -0500 -@@ -16,20 +16,6 @@ target_link_libraries(fakehardwaretest s - add_definitions(-DTEST_DATA=3D"\\"${CMAKE_CURRENT_SOURCE_DIR}/../solid/= backends/fakehw/fakecomputer.xml\\"") -=20 -=20 --########### halbasictest ############### -- --if(NOT WIN32 AND NOT APPLE) --set(halbasictest_SRCS halbasictest.cpp ) -- --kde4_add_executable(halbasictest ${halbasictest_SRCS}) -- --if(WIN32) -- set_target_properties(halbasictest PROPERTIES COMPILE_FLAGS -DSOLID_E= XPORT=3D) --endif(WIN32) -- --target_link_libraries(halbasictest solid_static ${KDEWIN_LIBRARIES} ${Q= T_QTCORE_LIBRARY} ${QT_QTDBUS_LIBRARY} ${QT_QTXML_LIBRARY} ${QT_QTTEST_LI= BRARY} ) --endif(NOT WIN32 AND NOT APPLE) -- - ########### solidhwtest ############### -=20 - set(solidhwtest_SRCS=20 diff --git a/kde-base/kdelibs/kdelibs-4.8.90.ebuild b/kde-base/kdelibs/kd= elibs-4.8.90.ebuild index 0a72c9e..2503764 100644 --- a/kde-base/kdelibs/kdelibs-4.8.90.ebuild +++ b/kde-base/kdelibs/kdelibs-4.8.90.ebuild @@ -22,7 +22,6 @@ LICENSE=3D"LGPL-2.1" IUSE=3D"3dnow acl alsa altivec +bzip2 debug doc fam +handbook jpeg2k ker= beros lzma mmx nls openexr +policykit semantic-desktop spell sse sse2 ssl +udev +ud= isks +upower upnp zeroconf" -SRC_URI+=3D" http://dev.gentoo.org/~dilfridge/distfiles/kdelibs-4.8.90-u= disks2_backend.patch.bz2" =20 REQUIRED_USE=3D" udisks? ( udev ) @@ -130,9 +129,7 @@ PATCHES=3D( "${FILESDIR}/${PN}-4.8.1-norpath.patch" "${FILESDIR}/${PN}-4.8.2-calculator_key.patch" "${FILESDIR}/${PN}-4.8.4-bytecode.patch" - "${FILESDIR}/${PN}-4.8.90-udisks2_prep.patch" - "${WORKDIR}/${PN}-4.8.90-udisks2_backend.patch" - "${FILESDIR}/${PN}-4.8.90-udisks2_post.patch" + "${FILESDIR}/${PN}-4.8.90-udisks2.patch" ) =20 pkg_pretend() { diff --git a/kde-base/kdelibs/kdelibs-9999.ebuild b/kde-base/kdelibs/kdel= ibs-9999.ebuild index 7e7d1d4..219ece9 100644 --- a/kde-base/kdelibs/kdelibs-9999.ebuild +++ b/kde-base/kdelibs/kdelibs-9999.ebuild @@ -22,7 +22,6 @@ LICENSE=3D"LGPL-2.1" IUSE=3D"3dnow acl alsa altivec +bzip2 debug doc fam +handbook jpeg2k ker= beros lzma mmx nls openexr +policykit semantic-desktop spell sse sse2 ssl +udev +ud= isks +upower upnp zeroconf" -SRC_URI+=3D" http://dev.gentoo.org/~dilfridge/distfiles/kdelibs-4.8.90-u= disks2_backend.patch.bz2" =20 REQUIRED_USE=3D" udisks? ( udev ) @@ -130,9 +129,7 @@ PATCHES=3D( "${FILESDIR}/${PN}-4.8.1-norpath.patch" "${FILESDIR}/${PN}-4.8.2-calculator_key.patch" "${FILESDIR}/${PN}-4.8.4-bytecode.patch" - "${FILESDIR}/${PN}-4.8.90-udisks2_prep.patch" - "${WORKDIR}/${PN}-4.8.90-udisks2_backend.patch" - "${FILESDIR}/${PN}-4.8.90-udisks2_post.patch" + "${FILESDIR}/${PN}-4.8.90-udisks2.patch" ) =20 pkg_pretend() {