diff options
Diffstat (limited to 'kioslave/media/libmediacommon')
18 files changed, 0 insertions, 1556 deletions
diff --git a/kioslave/media/libmediacommon/CMakeLists.txt b/kioslave/media/libmediacommon/CMakeLists.txt deleted file mode 100644 index 2059e35a8..000000000 --- a/kioslave/media/libmediacommon/CMakeLists.txt +++ /dev/null @@ -1,41 +0,0 @@ -################################################# -# -# (C) 2010-2011 Serghei Amelian -# serghei (DOT) amelian (AT) gmail.com -# -# Improvements and feedback are welcome -# -# This file is released under GPL >= 2 -# -################################################# - -include_directories( - ${CMAKE_CURRENT_BINARY_DIR} - ${TDE_INCLUDE_DIR} - ${TQT_INCLUDE_DIRS} -) - -link_directories( - ${TQT_LIBRARY_DIRS} -) - - -##### other data ################################ - -install( FILES mediamanagersettings.kcfg DESTINATION ${KCFG_INSTALL_DIR} ) - - -##### mediacommon (static) ###################### - -set( target mediacommon ) - -set( ${target}_SRCS - medium.cpp actionlistboxitem.cpp notifieraction.cpp - notifierserviceaction.cpp notifiernothingaction.cpp - notifieropenaction.cpp notifiersettings.cpp - mediamanagersettings.kcfgc -) - -tde_add_library( ${target} STATIC_PIC AUTOMOC - SOURCES ${${target}_SRCS} -) diff --git a/kioslave/media/libmediacommon/Makefile.am b/kioslave/media/libmediacommon/Makefile.am deleted file mode 100644 index dd27d265a..000000000 --- a/kioslave/media/libmediacommon/Makefile.am +++ /dev/null @@ -1,11 +0,0 @@ -INCLUDES = $(all_includes) -METASOURCES = AUTO - -noinst_LTLIBRARIES = libmediacommon.la -libmediacommon_la_SOURCES = medium.cpp actionlistboxitem.cpp \ - notifieraction.cpp notifierserviceaction.cpp \ - notifiernothingaction.cpp notifieropenaction.cpp \ - notifiersettings.cpp mediamanagersettings.kcfgc - -kde_kcfg_DATA = mediamanagersettings.kcfg - diff --git a/kioslave/media/libmediacommon/actionlistboxitem.cpp b/kioslave/media/libmediacommon/actionlistboxitem.cpp deleted file mode 100644 index 271d2e487..000000000 --- a/kioslave/media/libmediacommon/actionlistboxitem.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/* This file is part of the KDE Project - Copyright (c) 2005 Jean-Remy Falleri <jr.falleri@laposte.net> - Copyright (c) 2005 Kévin Ottens <ervin ipsquad net> - - 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 "actionlistboxitem.h" - -#include <klocale.h> - -#include <tqpixmap.h> - -ActionListBoxItem::ActionListBoxItem(NotifierAction *action, TQString mimetype, TQListBox *parent) - : TQListBoxPixmap(parent, action->pixmap()), - m_action(action) -{ - TQString text = m_action->label(); - - if ( m_action->autoMimetypes().contains( mimetype ) ) - { - text += " (" + i18n( "Auto Action" ) + ")"; - } - - setText( text ); -} - -ActionListBoxItem::~ActionListBoxItem() -{ -} - -NotifierAction *ActionListBoxItem::action() const -{ - return m_action; -} diff --git a/kioslave/media/libmediacommon/actionlistboxitem.h b/kioslave/media/libmediacommon/actionlistboxitem.h deleted file mode 100644 index 254f065de..000000000 --- a/kioslave/media/libmediacommon/actionlistboxitem.h +++ /dev/null @@ -1,40 +0,0 @@ -/* This file is part of the KDE Project - Copyright (c) 2005 Jean-Remy Falleri <jr.falleri@laposte.net> - Copyright (c) 2005 K�vin Ottens <ervin ipsquad net> - - 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. -*/ - -#ifndef _ACTIONLISTBOXITEM_H_ -#define _ACTIONLISTBOXITEM_H_ - -#include <tqlistbox.h> -#include <tqstring.h> - -#include "notifieraction.h" - -class ActionListBoxItem : public TQListBoxPixmap -{ -public: - ActionListBoxItem(NotifierAction *action, TQString mimetype, TQListBox *parent); - ~ActionListBoxItem(); - - NotifierAction *action() const; - -private: - NotifierAction *m_action; -}; - -#endif diff --git a/kioslave/media/libmediacommon/mediamanagersettings.kcfg b/kioslave/media/libmediacommon/mediamanagersettings.kcfg deleted file mode 100644 index 2994680cd..000000000 --- a/kioslave/media/libmediacommon/mediamanagersettings.kcfg +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE kcfg SYSTEM "http://www.kde.org/standards/kcfg/1.0/kcfg.dtd"> - -<kcfg> - <kcfgfile name="mediamanagerrc"/> - <group name="Global"> - <entry name="HalBackendEnabled" type="Bool"> - <label>Enable HAL backend</label> - <whatsthis>When HAL (Hardware Abstraction Layer) support is enabled, TDE will use it to gather information on the storage media available in your system.</whatsthis> - <default>true</default> - </entry> - <entry name="TdeHardwareBackendEnabled" type="Bool"> - <label>Enable TDE hardware library backend</label> - <whatsthis>When TDE hardware library support is enabled, TDE will use it to gather information on the storage media available in your system.</whatsthis> - <default>true</default> - </entry> - <entry name="CdPollingEnabled" type="Bool"> - <label>Enable CD polling</label> - <whatsthis>Allows TDE to poll CD-Rom or DVD-Rom drives itself in order to detect medium insert.</whatsthis> - <default>true</default> - </entry> - <entry name="AutostartEnabled" type="Bool"> - <label>Enable medium application autostart after mount</label> - <whatsthis>Allows TDE to autostart application after a medium mount if it contains an Autostart or an Autoopen file.</whatsthis> - <default>true</default> - </entry> - </group> -</kcfg> diff --git a/kioslave/media/libmediacommon/mediamanagersettings.kcfgc b/kioslave/media/libmediacommon/mediamanagersettings.kcfgc deleted file mode 100644 index bbc58d92e..000000000 --- a/kioslave/media/libmediacommon/mediamanagersettings.kcfgc +++ /dev/null @@ -1,4 +0,0 @@ -File=mediamanagersettings.kcfg -ClassName=MediaManagerSettings -Singleton=true -Mutators=true diff --git a/kioslave/media/libmediacommon/medium.cpp b/kioslave/media/libmediacommon/medium.cpp deleted file mode 100644 index 38d68725b..000000000 --- a/kioslave/media/libmediacommon/medium.cpp +++ /dev/null @@ -1,268 +0,0 @@ -/* This file is part of the KDE Project - Copyright (c) 2004 Kévin Ottens <ervin ipsquad net> - - 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 <kconfig.h> -#include <klocale.h> - -const TQString Medium::SEPARATOR = "---"; - -Medium::Medium(const TQString id, TQString uuid, const TQString name) -{ - m_properties+= id; /* ID */ - m_properties+= uuid; /* UUID */ - m_properties+= name; /* NAME */ - m_properties+= name; /* LABEL */ - m_properties+= TQString::null; /* USER_LABEL */ - - m_properties+= "false"; /* MOUNTABLE */ - m_properties+= TQString::null; /* DEVICE_NODE */ - m_properties+= TQString::null; /* MOUNT_POINT */ - m_properties+= TQString::null; /* FS_TYPE */ - m_properties+= "false"; /* MOUNTED */ - m_properties+= TQString::null; /* BASE_URL */ - m_properties+= TQString::null; /* MIME_TYPE */ - m_properties+= TQString::null; /* ICON_NAME */ - m_properties+= "false"; /* ENCRYPTED */ - m_properties+= TQString::null; /* CLEAR_DEVICE_UDI */ - m_properties+= "false"; /* HIDDEN */ - - loadUserLabel(); - - m_halmounted = false; -} - -Medium::Medium() -{ - m_properties+= TQString::null; /* ID */ - m_properties+= TQString::null; /* UUID */ - m_properties+= TQString::null; /* NAME */ - m_properties+= TQString::null; /* LABEL */ - m_properties+= TQString::null; /* USER_LABEL */ - - m_properties+= TQString::null; /* MOUNTABLE */ - m_properties+= TQString::null; /* DEVICE_NODE */ - m_properties+= TQString::null; /* MOUNT_POINT */ - m_properties+= TQString::null; /* FS_TYPE */ - m_properties+= TQString::null; /* MOUNTED */ - m_properties+= TQString::null; /* BASE_URL */ - m_properties+= TQString::null; /* MIME_TYPE */ - m_properties+= TQString::null; /* ICON_NAME */ - m_properties+= TQString::null; /* ENCRYPTED */ - m_properties+= TQString::null; /* CLEAR_DEVICE_UDI */ - m_properties+= "false"; /* HIDDEN */ - - m_halmounted = false; -} - -const Medium Medium::create(const TQStringList &properties) -{ - Medium m; - - if ( properties.size() >= PROPERTIES_COUNT ) - { - m.m_properties[ID] = properties[ID]; - m.m_properties[UUID] = properties[UUID]; - 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]; - m.m_properties[HIDDEN] = properties[HIDDEN]; - } - - return m; -} - -Medium::MList Medium::createList(const TQStringList &properties) -{ - MList l; - - if ( properties.size() % (PROPERTIES_COUNT+1) == 0) - { - int media_count = properties.size()/(PROPERTIES_COUNT+1); - - TQStringList props = properties; - - for(int i=0; i<media_count; i++) - { - const Medium m = create(props); - l.append(m); - - TQStringList::iterator first = props.begin(); - TQStringList::iterator last = props.find(SEPARATOR); - ++last; - props.erase(first, last); - } - } - - return l; -} - - -void Medium::setName(const TQString &name) -{ - m_properties[NAME] = name; -} - -void Medium::setLabel(const TQString &label) -{ - m_properties[LABEL] = label; -} - -void Medium::setEncrypted(bool state) -{ - m_properties[ENCRYPTED] = ( state ? "true" : "false" ); -} - -void Medium::setHidden(bool state) -{ - m_properties[HIDDEN] = ( state ? "true" : "false" ); -} - -void Medium::setUserLabel(const TQString &label) -{ - TDEConfig cfg("mediamanagerrc"); - cfg.setGroup("UserLabels"); - - TQString entry_name = m_properties[UUID]; - - if ( label.isNull() ) - { - cfg.deleteEntry(entry_name); - } - else - { - cfg.writeEntry(entry_name, label); - } - - m_properties[USER_LABEL] = label; -} - -void Medium::loadUserLabel() -{ - TDEConfig cfg("mediamanagerrc"); - cfg.setGroup("UserLabels"); - - TQString entry_name = m_properties[UUID]; - - if ( cfg.hasKey(entry_name) ) - { - m_properties[USER_LABEL] = cfg.readEntry(entry_name); - } - else - { - m_properties[USER_LABEL] = TQString::null; - } -} - - -bool Medium::mountableState(bool mounted) -{ - if ( m_properties[DEVICE_NODE].isEmpty() - || ( mounted && m_properties[MOUNT_POINT].isEmpty() ) ) - { - return false; - } - - m_properties[MOUNTABLE] = "true"; - m_properties[MOUNTED] = ( mounted ? "true" : "false" ); - - return true; -} - -void Medium::mountableState(const TQString &deviceNode, - const TQString &mountPoint, - const TQString &fsType, bool mounted) -{ - m_properties[MOUNTABLE] = "true"; - m_properties[DEVICE_NODE] = deviceNode; - m_properties[MOUNT_POINT] = mountPoint; - m_properties[FS_TYPE] = fsType; - m_properties[MOUNTED] = ( mounted ? "true" : "false" ); -} - -void Medium::mountableState(const TQString &deviceNode, - const TQString &clearDeviceUdi, - const TQString &mountPoint, - const TQString &fsType, bool mounted) -{ - m_properties[MOUNTABLE] = "true"; - m_properties[DEVICE_NODE] = deviceNode; - m_properties[CLEAR_DEVICE_UDI] = clearDeviceUdi; - m_properties[MOUNT_POINT] = mountPoint; - m_properties[FS_TYPE] = fsType; - m_properties[MOUNTED] = ( mounted ? "true" : "false" ); -} - -void Medium::unmountableState(const TQString &baseURL) -{ - m_properties[MOUNTABLE] = "false"; - m_properties[BASE_URL] = baseURL; -} - -void Medium::setMimeType(const TQString &mimeType) -{ - m_properties[MIME_TYPE] = mimeType; -} - -void Medium::setIconName(const TQString &iconName) -{ - m_properties[ICON_NAME] = iconName; -} - -bool Medium::needMounting() const -{ - return isMountable() && !isMounted(); -} - -bool Medium::needDecryption() const -{ - return isEncrypted() && clearDeviceUdi().isEmpty(); -} - -KURL Medium::prettyBaseURL() const -{ - if ( !baseURL().isEmpty() ) - return baseURL(); - - return KURL( mountPoint() ); -} - -TQString Medium::prettyLabel() const -{ - if ( !userLabel().isEmpty() ) - { - return userLabel(); - } - else - { - return label(); - } -} - diff --git a/kioslave/media/libmediacommon/medium.h b/kioslave/media/libmediacommon/medium.h deleted file mode 100644 index e45dccbfd..000000000 --- a/kioslave/media/libmediacommon/medium.h +++ /dev/null @@ -1,127 +0,0 @@ -/* This file is part of the KDE Project - Copyright (c) 2004 K�vin Ottens <ervin ipsquad net> - - 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. -*/ - -#ifndef _MEDIUM_H_ -#define _MEDIUM_H_ - -#include <tqstring.h> -#include <tqstringlist.h> -#include <kurl.h> -#include <tqmap.h> - -class Medium -{ -public: - typedef TQValueList<Medium> MList; - - static const uint ID = 0; - static const uint UUID = 1; - static const uint NAME = 2; - static const uint LABEL = 3; - static const uint USER_LABEL = 4; - static const uint MOUNTABLE = 5; - static const uint DEVICE_NODE = 6; - static const uint MOUNT_POINT = 7; - static const uint FS_TYPE = 8; - static const uint MOUNTED = 9; - static const uint BASE_URL = 10; - static const uint MIME_TYPE = 11; - static const uint ICON_NAME = 12; - static const uint ENCRYPTED = 13; - static const uint CLEAR_DEVICE_UDI = 14; - static const uint HIDDEN = 15; - static const uint PROPERTIES_COUNT = 16; - static const TQString SEPARATOR; - - Medium(const TQString id, TQString uuid, const TQString name); - static const Medium create(const TQStringList &properties); - static MList createList(const TQStringList &properties); - - const TQStringList &properties() const { return m_properties; } - - TQString id() const { return m_properties[ID]; } - TQString uuid() const { return m_properties[UUID]; } - TQString name() const { return m_properties[NAME]; } - TQString label() const { return m_properties[LABEL]; } - TQString userLabel() const { return m_properties[USER_LABEL]; } - bool isMountable() const { return m_properties[MOUNTABLE]=="true"; } - TQString deviceNode() const { return m_properties[DEVICE_NODE]; } - TQString mountPoint() const { return m_properties[MOUNT_POINT]; } - TQString fsType() const { return m_properties[FS_TYPE]; } - bool isMounted() const { return m_properties[MOUNTED]=="true"; } - TQString baseURL() const { return m_properties[BASE_URL]; } - TQString mimeType() const { return m_properties[MIME_TYPE]; } - TQString iconName() const { return m_properties[ICON_NAME]; } - bool isEncrypted() const { return m_properties[ENCRYPTED]=="true"; }; - TQString clearDeviceUdi() const { return m_properties[CLEAR_DEVICE_UDI]; }; - bool hidden() const { return m_properties[HIDDEN]=="true"; }; - - bool needMounting() const; - bool needDecryption() const; - KURL prettyBaseURL() const; - TQString prettyLabel() const; - - void setName(const TQString &name); - void setLabel(const TQString &label); - void setUserLabel(const TQString &label); - void setEncrypted(bool state); - void setHidden(bool state); - - bool mountableState(bool mounted); - void mountableState(const TQString &deviceNode, - const TQString &mountPoint, - const TQString &fsType, bool mounted); - void mountableState(const TQString &deviceNode, - const TQString &clearDeviceUdi, - const TQString &mountPoint, - const TQString &fsType, bool mounted); - void unmountableState(const TQString &baseURL = TQString::null); - - void setMimeType(const TQString &mimeType); - void setIconName(const TQString &iconName); - void setHalMounted(bool flag) const { m_halmounted = flag; } - bool halMounted() const { return m_halmounted; } - -//private: - Medium(); - -private: - void loadUserLabel(); - - TQStringList m_properties; - mutable bool m_halmounted; - -friend class TQValueListNode<const Medium>; -}; - -namespace MediaManagerUtils { - static inline TQMap<TQString,TQString> splitOptions(const TQStringList & options) - { - TQMap<TQString,TQString> valids; - - for (TQStringList::ConstIterator it = options.begin(); it != options.end(); ++it) - { - TQString key = (*it).left((*it).find('=')); - TQString value = (*it).mid((*it).find('=') + 1); - valids[key] = value; - } - return valids; - } -} - -#endif diff --git a/kioslave/media/libmediacommon/notifieraction.cpp b/kioslave/media/libmediacommon/notifieraction.cpp deleted file mode 100644 index 0dfc4110e..000000000 --- a/kioslave/media/libmediacommon/notifieraction.cpp +++ /dev/null @@ -1,97 +0,0 @@ -/* This file is part of the KDE Project - Copyright (c) 2005 Jean-Remy Falleri <jr.falleri@laposte.net> - Copyright (c) 2005 Kévin Ottens <ervin ipsquad net> - - 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 "notifieraction.h" - -#include <tqfile.h> -#include <kglobal.h> -#include <kiconloader.h> -#include <kicontheme.h> - -NotifierAction::NotifierAction() -{ -} - -NotifierAction::~NotifierAction() -{ -} - -void NotifierAction::setIconName(const TQString &iconName) -{ - m_iconName = iconName; -} - -void NotifierAction::setLabel(const TQString &label) -{ - m_label = label; -} - -TQString NotifierAction::iconName() const -{ - return m_iconName; -} - -TQPixmap NotifierAction::pixmap() const -{ - TQFile f( m_iconName ); - - if ( f.exists() ) - { - return TQPixmap( m_iconName ); - } - else - { - TQString path = TDEGlobal::iconLoader()->iconPath( m_iconName, -32 ); - return TQPixmap( path ); - } -} - -TQString NotifierAction::label() const -{ - return m_label; -} - -void NotifierAction::addAutoMimetype( const TQString &mimetype ) -{ - if ( !m_autoMimetypes.contains( mimetype ) ) - { - m_autoMimetypes.append( mimetype ); - } -} - -void NotifierAction::removeAutoMimetype( const TQString &mimetype ) -{ - m_autoMimetypes.remove( mimetype ); -} - -TQStringList NotifierAction::autoMimetypes() -{ - return m_autoMimetypes; -} - -bool NotifierAction::isWritable() const -{ - return false; -} - -bool NotifierAction::supportsMimetype(const TQString &/*mimetype*/) const -{ - return true; -} - diff --git a/kioslave/media/libmediacommon/notifieraction.h b/kioslave/media/libmediacommon/notifieraction.h deleted file mode 100644 index 21e2f01f4..000000000 --- a/kioslave/media/libmediacommon/notifieraction.h +++ /dev/null @@ -1,60 +0,0 @@ -/* This file is part of the KDE Project - Copyright (c) 2005 Jean-Remy Falleri <jr.falleri@laposte.net> - Copyright (c) 2005 K�vin Ottens <ervin ipsquad net> - - 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. -*/ - -#ifndef _NOTIFIERACTION_H_ -#define _NOTIFIERACTION_H_ - -#include <kfileitem.h> -#include <tqstring.h> -#include <tqpixmap.h> - -class NotifierSettings; - -class NotifierAction -{ -public: - NotifierAction(); - virtual ~NotifierAction(); - - virtual TQString label() const; - virtual TQString iconName() const; - virtual void setLabel( const TQString &label ); - virtual void setIconName( const TQString &icon ); - - TQPixmap pixmap() const; - - TQStringList autoMimetypes(); - - virtual TQString id() const = 0; - virtual bool isWritable() const; - virtual bool supportsMimetype( const TQString &mimetype ) const; - virtual void execute( KFileItem &medium ) = 0; - -private: - void addAutoMimetype( const TQString &mimetype ); - void removeAutoMimetype( const TQString &mimetype ); - - TQString m_label; - TQString m_iconName; - TQStringList m_autoMimetypes; - - friend class NotifierSettings; -}; - -#endif diff --git a/kioslave/media/libmediacommon/notifiernothingaction.cpp b/kioslave/media/libmediacommon/notifiernothingaction.cpp deleted file mode 100644 index 6a86ad92f..000000000 --- a/kioslave/media/libmediacommon/notifiernothingaction.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/* This file is part of the KDE Project - Copyright (c) 2005 Jean-Remy Falleri <jr.falleri@laposte.net> - Copyright (c) 2005 Kévin Ottens <ervin ipsquad net> - - 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 "notifiernothingaction.h" - -#include <klocale.h> - -NotifierNothingAction::NotifierNothingAction() - : NotifierAction() -{ - setIconName("button_cancel"); - setLabel(i18n("Do Nothing")); -} - -TQString NotifierNothingAction::id() const -{ - return "#NothinAction"; -} - -void NotifierNothingAction::execute(KFileItem &/*medium*/) -{ -} - diff --git a/kioslave/media/libmediacommon/notifiernothingaction.h b/kioslave/media/libmediacommon/notifiernothingaction.h deleted file mode 100644 index 2c0d22cfb..000000000 --- a/kioslave/media/libmediacommon/notifiernothingaction.h +++ /dev/null @@ -1,34 +0,0 @@ -/* This file is part of the KDE Project - Copyright (c) 2005 Jean-Remy Falleri <jr.falleri@laposte.net> - Copyright (c) 2005 K�vin Ottens <ervin ipsquad net> - - 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. -*/ - -#ifndef _NOTIFIERNOTHINGACTION_H_ -#define _NOTIFIERNOTHINGACTION_H_ - -#include "notifieraction.h" - -class NotifierNothingAction : public NotifierAction -{ -public: - NotifierNothingAction(); - virtual TQString id() const; - virtual void execute(KFileItem &medium); -}; - -#endif - diff --git a/kioslave/media/libmediacommon/notifieropenaction.cpp b/kioslave/media/libmediacommon/notifieropenaction.cpp deleted file mode 100644 index 4d6d8025c..000000000 --- a/kioslave/media/libmediacommon/notifieropenaction.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/* This file is part of the KDE Project - Copyright (c) 2005 Jean-Remy Falleri <jr.falleri@laposte.net> - Copyright (c) 2005 Kévin Ottens <ervin ipsquad net> - - 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 "notifieropenaction.h" - -#include <klocale.h> - -NotifierOpenAction::NotifierOpenAction() - : NotifierAction() -{ - setIconName("window_new"); - setLabel(i18n("Open in New Window")); -} - -TQString NotifierOpenAction::id() const -{ - return "#OpenAction"; -} - -void NotifierOpenAction::execute(KFileItem &medium) -{ - medium.run(); -} - -bool NotifierOpenAction::supportsMimetype( const TQString &mimetype ) const -{ - return !mimetype.contains( "blank" ) && !mimetype.contains( "encrypted" ); -} - diff --git a/kioslave/media/libmediacommon/notifieropenaction.h b/kioslave/media/libmediacommon/notifieropenaction.h deleted file mode 100644 index 4fe8a614e..000000000 --- a/kioslave/media/libmediacommon/notifieropenaction.h +++ /dev/null @@ -1,34 +0,0 @@ -/* This file is part of the KDE Project - Copyright (c) 2005 Jean-Remy Falleri <jr.falleri@laposte.net> - Copyright (c) 2005 K�vin Ottens <ervin ipsquad net> - - 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. -*/ - -#ifndef _NOTIFIEROPENACTION_H_ -#define _NOTIFIEROPENACTION_H_ - -#include "notifieraction.h" - -class NotifierOpenAction : public NotifierAction -{ -public: - NotifierOpenAction(); - virtual TQString id() const; - virtual void execute(KFileItem &medium); - bool supportsMimetype( const TQString &mimetype ) const; -}; - -#endif diff --git a/kioslave/media/libmediacommon/notifierserviceaction.cpp b/kioslave/media/libmediacommon/notifierserviceaction.cpp deleted file mode 100644 index c7bece4f8..000000000 --- a/kioslave/media/libmediacommon/notifierserviceaction.cpp +++ /dev/null @@ -1,166 +0,0 @@ -/* This file is part of the KDE Project - Copyright (c) 2005 Jean-Remy Falleri <jr.falleri@laposte.net> - Copyright (c) 2005 Kévin Ottens <ervin ipsquad net> - - 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 "notifierserviceaction.h" - -#include <tqdir.h> -#include <tqfile.h> -#include <tqfileinfo.h> -#include <kstddirs.h> -#include <kdesktopfile.h> -#include <klocale.h> - -NotifierServiceAction::NotifierServiceAction() - : NotifierAction() -{ - NotifierAction::setIconName("button_cancel"); - NotifierAction::setLabel(i18n("Unknown")); - - m_service.m_strName = "New Service"; - m_service.m_strIcon = "button_cancel"; - m_service.m_strExec = "konqueror %u"; -} - -TQString NotifierServiceAction::id() const -{ - if (m_filePath.isEmpty() || m_service.m_strName.isEmpty()) - { - return TQString(); - } - else - { - return "#Service:"+m_filePath; - } -} - -void NotifierServiceAction::setIconName( const TQString &icon ) -{ - m_service.m_strIcon = icon; - NotifierAction::setIconName( icon ); -} - -void NotifierServiceAction::setLabel( const TQString &label ) -{ - m_service.m_strName = label; - NotifierAction::setLabel( label ); - - updateFilePath(); -} - -void NotifierServiceAction::execute(KFileItem &medium) -{ - KURL::List urls = KURL::List( medium.url() ); - KDEDesktopMimeType::executeService( urls, m_service ); -} - -void NotifierServiceAction::setService(KDEDesktopMimeType::Service service) -{ - NotifierAction::setIconName( service.m_strIcon ); - NotifierAction::setLabel( service.m_strName ); - - m_service = service; - - updateFilePath(); -} - -KDEDesktopMimeType::Service NotifierServiceAction::service() const -{ - return m_service; -} - -void NotifierServiceAction::setFilePath(const TQString &filePath) -{ - m_filePath = filePath; -} - -TQString NotifierServiceAction::filePath() const -{ - return m_filePath; -} - -void NotifierServiceAction::updateFilePath() -{ - if ( !m_filePath.isEmpty() ) return; - - TQString action_name = m_service.m_strName; - action_name.replace( " ", "_" ); - - TQDir actions_dir( locateLocal( "data", "konqueror/servicemenus/", true ) ); - - TQString filename = actions_dir.absFilePath( action_name + ".desktop" ); - - int counter = 1; - while ( TQFile::exists( filename ) ) - { - filename = actions_dir.absFilePath( action_name - + TQString::number( counter ) - + ".desktop" ); - counter++; - } - - m_filePath = filename; -} - -void NotifierServiceAction::setMimetypes(const TQStringList &mimetypes) -{ - m_mimetypes = mimetypes; -} - -TQStringList NotifierServiceAction::mimetypes() -{ - return m_mimetypes; -} - -bool NotifierServiceAction::isWritable() const -{ - TQFileInfo info( m_filePath ); - - if ( info.exists() ) - { - return info.isWritable(); - } - else - { - info = TQFileInfo( info.dirPath() ); - return info.isWritable(); - } -} - -bool NotifierServiceAction::supportsMimetype(const TQString &mimetype) const -{ - return m_mimetypes.contains(mimetype); -} - -void NotifierServiceAction::save() const -{ - TQFile::remove( m_filePath ); - KDesktopFile desktopFile(m_filePath); - - desktopFile.setGroup(TQString("Desktop Action ") + m_service.m_strName); - desktopFile.writeEntry(TQString("Icon"), m_service.m_strIcon); - desktopFile.writeEntry(TQString("Name"), m_service.m_strName); - desktopFile.writeEntry(TQString("Exec"), m_service.m_strExec); - - desktopFile.setDesktopGroup(); - - desktopFile.writeEntry(TQString("ServiceTypes"), m_mimetypes, ","); - desktopFile.writeEntry(TQString("Actions"), - TQStringList(m_service.m_strName),";"); -} - diff --git a/kioslave/media/libmediacommon/notifierserviceaction.h b/kioslave/media/libmediacommon/notifierserviceaction.h deleted file mode 100644 index 829193fba..000000000 --- a/kioslave/media/libmediacommon/notifierserviceaction.h +++ /dev/null @@ -1,61 +0,0 @@ -/* This file is part of the KDE Project - Copyright (c) 2005 Jean-Remy Falleri <jr.falleri@laposte.net> - Copyright (c) 2005 K�vin Ottens <ervin ipsquad net> - - 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. -*/ - -#ifndef _NOTIFIERSERVICEACTION_H_ -#define _NOTIFIERSERVICEACTION_H_ - -#include <kmimetype.h> -#include <tqstring.h> - -#include "notifieraction.h" - -class NotifierServiceAction : public NotifierAction -{ -public: - NotifierServiceAction(); - virtual TQString id() const; - virtual void execute(KFileItem &item); - - virtual void setIconName( const TQString &icon ); - virtual void setLabel( const TQString &label ); - - void setService(KDEDesktopMimeType::Service service); - KDEDesktopMimeType::Service service() const; - - void setFilePath(const TQString &filePath); - TQString filePath() const; - - void setMimetypes(const TQStringList &mimetypes); - TQStringList mimetypes(); - - virtual bool isWritable() const; - virtual bool supportsMimetype(const TQString &mimetype) const; - - void save() const; - -private: - void updateFilePath(); - - KDEDesktopMimeType::Service m_service; - TQString m_filePath; - TQStringList m_mimetypes; -}; - -#endif - diff --git a/kioslave/media/libmediacommon/notifiersettings.cpp b/kioslave/media/libmediacommon/notifiersettings.cpp deleted file mode 100644 index 254e591cb..000000000 --- a/kioslave/media/libmediacommon/notifiersettings.cpp +++ /dev/null @@ -1,391 +0,0 @@ -/* This file is part of the KDE Project - Copyright (c) 2005 Jean-Remy Falleri <jr.falleri@laposte.net> - Copyright (c) 2005 Kévin Ottens <ervin ipsquad net> - - 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 "notifiersettings.h" - -#include <kglobal.h> -#include <kdesktopfile.h> -#include <kstandarddirs.h> -#include <tqdir.h> -#include <tqfile.h> - -#include "notifieropenaction.h" -#include "notifiernothingaction.h" - - -NotifierSettings::NotifierSettings() -{ - m_supportedMimetypes.append( "media/removable_unmounted" ); - m_supportedMimetypes.append( "media/removable_unmounted_encrypted" ); - m_supportedMimetypes.append( "media/removable_unmounted_decrypted" ); - m_supportedMimetypes.append( "media/removable_mounted" ); - m_supportedMimetypes.append( "media/removable_mounted_decrypted" ); - m_supportedMimetypes.append( "media/camera_unmounted" ); - m_supportedMimetypes.append( "media/camera_mounted" ); - m_supportedMimetypes.append( "media/gphoto2camera" ); - m_supportedMimetypes.append( "media/cdrom_unmounted" ); - m_supportedMimetypes.append( "media/cdrom_unmounted_encrypted" ); - m_supportedMimetypes.append( "media/cdrom_unmounted_decrypted" ); - m_supportedMimetypes.append( "media/cdrom_mounted" ); - m_supportedMimetypes.append( "media/cdrom_mounted_decrypted" ); - m_supportedMimetypes.append( "media/dvd_unmounted" ); - m_supportedMimetypes.append( "media/dvd_unmounted_encrypted" ); - m_supportedMimetypes.append( "media/dvd_unmounted_decrypted" ); - m_supportedMimetypes.append( "media/dvd_mounted" ); - m_supportedMimetypes.append( "media/dvd_mounted_decrypted" ); - m_supportedMimetypes.append( "media/cdwriter_unmounted" ); - m_supportedMimetypes.append( "media/cdwriter_unmounted_encrypted" ); - m_supportedMimetypes.append( "media/cdwriter_unmounted_decrypted" ); - m_supportedMimetypes.append( "media/cdwriter_mounted" ); - m_supportedMimetypes.append( "media/cdwriter_mounted_decrypted" ); - m_supportedMimetypes.append( "media/blankcd" ); - m_supportedMimetypes.append( "media/blankdvd" ); - m_supportedMimetypes.append( "media/audiocd" ); - m_supportedMimetypes.append( "media/dvdvideo" ); - m_supportedMimetypes.append( "media/vcd" ); - m_supportedMimetypes.append( "media/svcd" ); - - reload(); -} - -NotifierSettings::~NotifierSettings() -{ - while ( !m_actions.isEmpty() ) - { - NotifierAction *a = m_actions.first(); - m_actions.remove( a ); - delete a; - } - - while ( !m_deletedActions.isEmpty() ) - { - NotifierServiceAction *a = m_deletedActions.first(); - m_deletedActions.remove( a ); - delete a; - } -} - -TQValueList<NotifierAction*> NotifierSettings::actions() -{ - return m_actions; -} - -const TQStringList &NotifierSettings::supportedMimetypes() -{ - return m_supportedMimetypes; -} - -TQValueList<NotifierAction*> NotifierSettings::actionsForMimetype( const TQString &mimetype ) -{ - TQValueList<NotifierAction*> result; - - TQValueList<NotifierAction*>::iterator it = m_actions.begin(); - TQValueList<NotifierAction*>::iterator end = m_actions.end(); - - for ( ; it!=end; ++it ) - { - if ( (*it)->supportsMimetype( mimetype ) ) - { - result.append( *it ); - } - } - - return result; -} - -bool NotifierSettings::addAction( NotifierServiceAction *action ) -{ - if ( !m_idMap.contains( action->id() ) ) - { - m_actions.insert( --m_actions.end(), action ); - m_idMap[ action->id() ] = action; - return true; - } - return false; -} - -bool NotifierSettings::deleteAction( NotifierServiceAction *action ) -{ - if ( action->isWritable() ) - { - m_actions.remove( action ); - m_idMap.remove( action->id() ); - m_deletedActions.append( action ); - - TQStringList auto_mimetypes = action->autoMimetypes(); - TQStringList::iterator it = auto_mimetypes.begin(); - TQStringList::iterator end = auto_mimetypes.end(); - - for ( ; it!=end; ++it ) - { - action->removeAutoMimetype( *it ); - m_autoMimetypesMap.remove( *it ); - } - - return true; - } - return false; -} - -void NotifierSettings::setAutoAction( const TQString &mimetype, NotifierAction *action ) -{ - resetAutoAction( mimetype ); - m_autoMimetypesMap[mimetype] = action; - action->addAutoMimetype( mimetype ); -} - - -void NotifierSettings::resetAutoAction( const TQString &mimetype ) -{ - if ( m_autoMimetypesMap.contains( mimetype ) ) - { - NotifierAction *action = m_autoMimetypesMap[mimetype]; - action->removeAutoMimetype( mimetype ); - m_autoMimetypesMap.remove(mimetype); - } -} - -void NotifierSettings::clearAutoActions() -{ - TQMap<TQString,NotifierAction*>::iterator it = m_autoMimetypesMap.begin(); - TQMap<TQString,NotifierAction*>::iterator end = m_autoMimetypesMap.end(); - - for ( ; it!=end; ++it ) - { - NotifierAction *action = it.data(); - TQString mimetype = it.key(); - - if ( action ) - action->removeAutoMimetype( mimetype ); - m_autoMimetypesMap[mimetype] = 0L; - } -} - -NotifierAction *NotifierSettings::autoActionForMimetype( const TQString &mimetype ) -{ - if ( m_autoMimetypesMap.contains( mimetype ) ) - { - return m_autoMimetypesMap[mimetype]; - } - else - { - return 0L; - } -} - -void NotifierSettings::reload() -{ - while ( !m_actions.isEmpty() ) - { - NotifierAction *a = m_actions.first(); - m_actions.remove( a ); - delete a; - } - - while ( !m_deletedActions.isEmpty() ) - { - NotifierServiceAction *a = m_deletedActions.first(); - m_deletedActions.remove( a ); - delete a; - } - - m_idMap.clear(); - m_autoMimetypesMap.clear(); - - NotifierOpenAction *open = new NotifierOpenAction(); - m_actions.append( open ); - m_idMap[ open->id() ] = open; - - TQValueList<NotifierServiceAction*> services = listServices(); - - TQValueList<NotifierServiceAction*>::iterator serv_it = services.begin(); - TQValueList<NotifierServiceAction*>::iterator serv_end = services.end(); - - for ( ; serv_it!=serv_end; ++serv_it ) - { - m_actions.append( *serv_it ); - m_idMap[ (*serv_it)->id() ] = *serv_it; - } - - NotifierNothingAction *nothing = new NotifierNothingAction(); - m_actions.append( nothing ); - m_idMap[ nothing->id() ] = nothing; - - TDEConfig config( "medianotifierrc", true ); - TQMap<TQString,TQString> auto_actions_map = config.entryMap( "Auto Actions" ); - - TQMap<TQString,TQString>::iterator auto_it = auto_actions_map.begin(); - TQMap<TQString,TQString>::iterator auto_end = auto_actions_map.end(); - - for ( ; auto_it!=auto_end; ++auto_it ) - { - TQString mime = auto_it.key(); - TQString action_id = auto_it.data(); - - if ( m_idMap.contains( action_id ) ) - { - setAutoAction( mime, m_idMap[action_id] ); - } - else - { - config.deleteEntry( mime ); - } - } -} -void NotifierSettings::save() -{ - TQValueList<NotifierAction*>::iterator act_it = m_actions.begin(); - TQValueList<NotifierAction*>::iterator act_end = m_actions.end(); - - for ( ; act_it!=act_end; ++act_it ) - { - NotifierServiceAction *service; - if ( ( service=dynamic_cast<NotifierServiceAction*>( *act_it ) ) - && service->isWritable() ) - { - service->save(); - } - } - - while ( !m_deletedActions.isEmpty() ) - { - NotifierServiceAction *a = m_deletedActions.first(); - m_deletedActions.remove( a ); - TQFile::remove( a->filePath() ); - delete a; - } - - KSimpleConfig config( "medianotifierrc" ); - config.setGroup( "Auto Actions" ); - - TQMap<TQString,NotifierAction*>::iterator auto_it = m_autoMimetypesMap.begin(); - TQMap<TQString,NotifierAction*>::iterator auto_end = m_autoMimetypesMap.end(); - - for ( ; auto_it!=auto_end; ++auto_it ) - { - if ( auto_it.data()!=0L ) - { - config.writeEntry( auto_it.key(), auto_it.data()->id() ); - } - else - { - config.deleteEntry( auto_it.key() ); - } - } -} - -TQValueList<NotifierServiceAction*> NotifierSettings::loadActions( KDesktopFile &desktop ) const -{ - desktop.setDesktopGroup(); - - TQValueList<NotifierServiceAction*> services; - - const TQString filename = desktop.fileName(); - const TQStringList mimetypes = desktop.readListEntry( "ServiceTypes" ); - - TQValueList<KDEDesktopMimeType::Service> type_services - = KDEDesktopMimeType::userDefinedServices(filename, true); - - TQValueList<KDEDesktopMimeType::Service>::iterator service_it = type_services.begin(); - TQValueList<KDEDesktopMimeType::Service>::iterator service_end = type_services.end(); - for (; service_it!=service_end; ++service_it) - { - NotifierServiceAction *service_action - = new NotifierServiceAction(); - - service_action->setService( *service_it ); - service_action->setFilePath( filename ); - service_action->setMimetypes( mimetypes ); - - services += service_action; - } - - return services; -} - - -bool NotifierSettings::shouldLoadActions( KDesktopFile &desktop, const TQString &mimetype ) const -{ - desktop.setDesktopGroup(); - - if ( desktop.hasKey( "Actions" ) - && desktop.hasKey( "ServiceTypes" ) - && !desktop.readBoolEntry( "X-TDE-MediaNotifierHide", false ) ) - { - const TQStringList actions = desktop.readListEntry( "Actions" ); - - if ( actions.size()!=1 ) - { - return false; - } - - const TQStringList types = desktop.readListEntry( "ServiceTypes" ); - - if ( mimetype.isEmpty() ) - { - TQStringList::ConstIterator type_it = types.begin(); - TQStringList::ConstIterator type_end = types.end(); - for (; type_it != type_end; ++type_it) - { - if ( (*type_it).startsWith( "media/" ) ) - { - return true; - } - } - } - else if ( types.contains(mimetype) ) - { - return true; - } - } - - return false; -} - -TQValueList<NotifierServiceAction*> NotifierSettings::listServices( const TQString &mimetype ) const -{ - TQValueList<NotifierServiceAction*> services; - TQStringList dirs = TDEGlobal::dirs()->findDirs("data", "konqueror/servicemenus/"); - - TQStringList::ConstIterator dir_it = dirs.begin(); - TQStringList::ConstIterator dir_end = dirs.end(); - for (; dir_it != dir_end; ++dir_it) - { - TQDir dir( *dir_it ); - - TQStringList entries = dir.entryList( "*.desktop", TQDir::Files ); - - TQStringList::ConstIterator entry_it = entries.begin(); - TQStringList::ConstIterator entry_end = entries.end(); - - for (; entry_it != entry_end; ++entry_it ) - { - TQString filename = *dir_it + *entry_it; - - KDesktopFile desktop( filename, true ); - - if ( shouldLoadActions(desktop, mimetype) ) - { - services+=loadActions(desktop); - } - } - } - - return services; -} diff --git a/kioslave/media/libmediacommon/notifiersettings.h b/kioslave/media/libmediacommon/notifiersettings.h deleted file mode 100644 index dee5c440b..000000000 --- a/kioslave/media/libmediacommon/notifiersettings.h +++ /dev/null @@ -1,63 +0,0 @@ -/* This file is part of the KDE Project - Copyright (c) 2005 Jean-Remy Falleri <jr.falleri@laposte.net> - Copyright (c) 2005 K�vin Ottens <ervin ipsquad net> - - 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. -*/ - -#ifndef _NOTIFIERSETTINGS_H_ -#define _NOTIFIERSETTINGS_H_ - -#include <tqvaluelist.h> -#include <tqmap.h> - -#include "notifieraction.h" -#include "notifierserviceaction.h" - - -class NotifierSettings -{ -public: - NotifierSettings(); - ~NotifierSettings(); - - TQValueList<NotifierAction*> actions(); - TQValueList<NotifierAction*> actionsForMimetype( const TQString &mimetype ); - - bool addAction( NotifierServiceAction *action ); - bool deleteAction( NotifierServiceAction *action ); - - void setAutoAction( const TQString &mimetype, NotifierAction *action ); - void resetAutoAction( const TQString &mimetype ); - void clearAutoActions(); - NotifierAction *autoActionForMimetype( const TQString &mimetype ); - - const TQStringList &supportedMimetypes(); - - void reload(); - void save(); - -private: - TQValueList<NotifierServiceAction*> listServices( const TQString &mimetype = TQString() ) const; - bool shouldLoadActions( KDesktopFile &desktop, const TQString &mimetype ) const; - TQValueList<NotifierServiceAction*> loadActions( KDesktopFile &desktop ) const; - - TQStringList m_supportedMimetypes; - TQValueList<NotifierAction*> m_actions; - TQValueList<NotifierServiceAction*> m_deletedActions; - TQMap<TQString,NotifierAction*> m_idMap; - TQMap<TQString,NotifierAction*> m_autoMimetypesMap; -}; -#endif |