/* This file is part of the KDE Project Copyright (c) 2004 Kévin Ottens This library 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 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "medium.h" #include #include const QString Medium::SEPARATOR = "---"; Medium::Medium(const QString &id, const QString &name) { m_properties+= id; /* ID */ m_properties+= name; /* NAME */ m_properties+= name; /* LABEL */ m_properties+= QString::null; /* USER_LABEL */ m_properties+= "false"; /* MOUNTABLE */ m_properties+= QString::null; /* DEVICE_NODE */ m_properties+= QString::null; /* MOUNT_POINT */ m_properties+= QString::null; /* FS_TYPE */ m_properties+= "false"; /* MOUNTED */ m_properties+= QString::null; /* BASE_URL */ m_properties+= QString::null; /* MIME_TYPE */ m_properties+= QString::null; /* ICON_NAME */ m_properties+= "false"; /* ENCRYPTED */ m_properties+= QString::null; /* CLEAR_DEVICE_UDI */ loadUserLabel(); m_halmounted = false; } Medium::Medium() { m_properties+= QString::null; /* ID */ m_properties+= QString::null; /* NAME */ m_properties+= QString::null; /* LABEL */ m_properties+= QString::null; /* USER_LABEL */ m_properties+= QString::null; /* MOUNTABLE */ m_properties+= QString::null; /* DEVICE_NODE */ m_properties+= QString::null; /* MOUNT_POINT */ m_properties+= QString::null; /* FS_TYPE */ m_properties+= QString::null; /* MOUNTED */ m_properties+= QString::null; /* BASE_URL */ m_properties+= QString::null; /* MIME_TYPE */ m_properties+= QString::null; /* ICON_NAME */ m_properties+= QString::null; /* ENCRYPTED */ m_properties+= QString::null; /* CLEAR_DEVICE_UDI */ m_halmounted = false; } const Medium Medium::create(const QStringList &properties) { Medium m; if ( properties.size() >= PROPERTIES_COUNT ) { m.m_properties[ID] = properties[ID]; m.m_properties[NAME] = properties[NAME]; m.m_properties[LABEL] = properties[LABEL]; m.m_properties[USER_LABEL] = properties[USER_LABEL]; m.m_properties[MOUNTABLE] = properties[MOUNTABLE]; m.m_properties[DEVICE_NODE] = properties[DEVICE_NODE]; m.m_properties[MOUNT_POINT] = properties[MOUNT_POINT]; m.m_properties[FS_TYPE] = properties[FS_TYPE]; m.m_properties[MOUNTED] = properties[MOUNTED]; m.m_properties[BASE_URL] = properties[BASE_URL]; m.m_properties[MIME_TYPE] = properties[MIME_TYPE]; m.m_properties[ICON_NAME] = properties[ICON_NAME]; m.m_properties[ENCRYPTED] = properties[ENCRYPTED]; m.m_properties[CLEAR_DEVICE_UDI] = properties[CLEAR_DEVICE_UDI]; } return m; } Medium::List Medium::createList(const QStringList &properties) { List l; if ( properties.size() % (PROPERTIES_COUNT+1) == 0) { int media_count = properties.size()/(PROPERTIES_COUNT+1); QStringList props = properties; for(int i=0; i