• Skip to content
  • Skip to link menu
KDE 4.1 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

KDED

kmimeassociations.h

Go to the documentation of this file.
00001 /*  This file is part of the KDE libraries
00002  *  Copyright 2008  David Faure  <faure@kde.org>
00003  *
00004  *  This library is free software; you can redistribute it and/or modify
00005  *  it under the terms of the GNU Lesser General Public License as published by
00006  *  the Free Software Foundation; either version 2 of the License or ( at
00007  *  your option ) version 3 or, at the discretion of KDE e.V. ( which shall
00008  *  act as a proxy as in section 14 of the GPLv3 ), any later version.
00009  *
00010  *  This library is distributed in the hope that it will be useful,
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  *  Library General Public License for more details.
00014  *
00015  *  You should have received a copy of the GNU Lesser General Public License
00016  *  along with this library; see the file COPYING.LIB.  If not, write to
00017  *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018  *  Boston, MA 02110-1301, USA.
00019  */
00020 
00021 #ifndef KDED_KMIMEASSOCIATIONS_H
00022 #define KDED_KMIMEASSOCIATIONS_H
00023 
00024 #include <QSet>
00025 #include <QStringList>
00026 #include <QHash>
00027 #include <kserviceoffer.h>
00028 class KConfigGroup;
00029 
00030 struct ServiceTypeOffersData {
00031     QList<KServiceOffer> offers; // service + initial preference + allow as default
00032     QSet<KService::Ptr> offerSet; // for quick contains() check
00033 };
00034 
00035 class KOfferHash
00036 {
00037 public:
00038     KOfferHash() {}
00039     QList<KServiceOffer> offersFor(const QString& serviceType) const {
00040         QHash<QString, ServiceTypeOffersData>::const_iterator it = m_serviceTypeData.find(serviceType);
00041         if (it != m_serviceTypeData.end())
00042             return (*it).offers;
00043         return QList<KServiceOffer>();
00044     }
00045     void addServiceOffer(const QString& serviceType, const KServiceOffer& offer);
00046     void removeServiceOffer(const QString& serviceType, KService::Ptr service);
00047 
00048 private:
00049     KOfferHash(const KOfferHash&); // forbidden
00050     QHash<QString, ServiceTypeOffersData> m_serviceTypeData;
00051 };
00052 
00053 
00059 class KMimeAssociations
00060 {
00061 public:
00062     explicit KMimeAssociations(KOfferHash& offerHash);
00063 
00064     // Read mimeapps.list files
00065     bool parseAllMimeAppsList();
00066 
00067     void parseMimeAppsList(const QString& file, int basePreference);
00068 
00069 private:
00070     void parseAddedAssociations(const KConfigGroup& group, const QString& file, int basePreference);
00071     void parseRemovedAssociations(const KConfigGroup& group, const QString& file);
00072 
00073     KOfferHash& m_offerHash;
00074 };
00075 
00076 #endif /* KMIMEASSOCIATIONS_H */

KDED

Skip menu "KDED"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • KIO
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal