/* * Copyright (C) 2007 Christopher Blauvelt * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License version 2 as * published by the Free Software Foundation * * This program 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 General Public License for more details * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef SOLIDDEVICEENGINE_H #define SOLIDDEVICEENGINE_H #include #include #include #include #include #include #include #include #include #include #include #include "devicesignalmapmanager.h" #include "devicesignalmapper.h" enum State { Idle = 0, Mounting = 1, Unmounting = 2 }; enum OperationResult { Working = 0, Successful = 1, Unsuccessful =2 }; /** * This class evaluates the basic expressions given in the interface. */ class SolidDeviceEngine : public Plasma::DataEngine { Q_OBJECT friend class SolidDeviceService; public: SolidDeviceEngine( QObject* parent, const QVariantList& args); ~SolidDeviceEngine(); Plasma::Service *serviceForSource (const QString& source); protected: bool sourceRequestEvent(const QString &name); bool updateSourceEvent(const QString& source); private: bool populateDeviceData(const QString &name); qulonglong freeDiskSpace(const QString &mountPoint); bool updateFreeSpace(const QString &udi); bool updateEmblems(const QString &udi); bool updateInUse(const QString &udi); bool forceUpdateAccessibility(const QString &udi); void listenForNewDevices(); //predicate in string form, list of devices by udi QMap m_predicatemap; //udi, corresponding device QMap m_devicemap; //udi, corresponding encrypted container udi; QMap m_encryptedContainerMap; DeviceSignalMapManager *m_signalmanager; Solid::DeviceNotifier *m_notifier; private Q_SLOTS: void deviceAdded(const QString &udi); void deviceRemoved(const QString &udi); void deviceChanged(const QString& udi, const QString &property, const QVariant &value); void sourceWasRemoved(const QString &source); void setMountingState(const QString &udi); void setUnmountingState(const QString &udi); void setIdleState(Solid::ErrorType error, QVariant errorData, const QString &udi); void deviceContentChanged(const QString &udi, const bool hascontent); }; #endif