1
/* This file is part of the KDE project
2
Copyright (C) 2003 Waldo Bastian <bastian@kde.org>
3
Copyright (C) 2003 David Faure <faure@kde.org>
5
This program is free software; you can redistribute it and/or
6
modify it under the terms of the GNU General Public
7
License version 2 as published by the Free Software Foundation.
9
This program is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
General Public License for more details.
14
You should have received a copy of the GNU General Public License
15
along with this program; see the file COPYING. If not, write to
16
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17
Boston, MA 02111-1307, USA.
20
#ifndef _TYPESLISTITEM_H
21
#define _TYPESLISTITEM_H
23
#include <qlistview.h>
25
#include <kmimetype.h>
26
#include <kuserprofile.h>
28
class TypesListItem : public QListViewItem
32
* Create a filetype group
34
TypesListItem(QListView *parent, const QString & major );
37
* Create a filetype item inside a group
39
TypesListItem(TypesListItem *parent, KMimeType::Ptr mimetype, bool newItem=false);
42
* Create a filetype item not inside a group (used by keditfiletype)
44
TypesListItem(QListView *parent, KMimeType::Ptr mimetype);
48
QString name() const { return m_major + "/" + m_minor; }
49
QString majorType() const { return m_major; }
50
QString minorType() const { return m_minor; }
51
void setMinor(QString m) { m_minor = m; }
52
QString comment() const { return m_comment; }
53
void setComment(QString c) { m_comment = c; }
55
* Returns true if "this" is a group
57
bool isMeta() const { return metaType; }
59
* Returns true if the type is essential, i.e. can't be deleted
60
* (see KMimeType::checkEssentialMimeTypes)
62
bool isEssential() const;
63
QString icon() const { return m_icon; }
64
void setIcon(const QString& i);
65
QStringList patterns() const { return m_patterns; }
66
void setPatterns(const QStringList &p) { m_patterns = p; }
67
QStringList appServices() const;
68
void setAppServices(const QStringList &dsl) { m_appServices = dsl; }
69
QStringList embedServices() const;
70
void setEmbedServices(const QStringList &dsl) { m_embedServices = dsl; }
71
int autoEmbed() const { return m_autoEmbed; }
72
void setAutoEmbed( int a ) { m_autoEmbed = a; }
73
const KMimeType::Ptr& mimeType() const { return m_mimetype; }
75
// Whether the service s lists this mimetype explicitly
76
KMimeType::Ptr findImplicitAssociation(const QString &desktop);
78
bool isMimeTypeDirty() const; // whether the mimetype .desktop file needs saving
82
void refresh(); // update m_mimetype from ksycoca when Apply is pressed
84
static bool defaultEmbeddingSetting( const QString& major );
88
void getServiceOffers( QStringList & appServices, QStringList & embedServices ) const;
89
void saveServices( KConfig & profile, QStringList services, const QString & servicetype2 );
90
void initMeta( const QString & major );
91
void init(KMimeType::Ptr mimetype);
93
KMimeType::Ptr m_mimetype;
94
unsigned int groupCount:16; // shared between saveServices and sync
95
unsigned int m_autoEmbed:2; // 0 yes, 1 no, 2 use group setting
96
unsigned int metaType:1;
97
unsigned int m_bNewItem:1;
98
unsigned int m_bFullInit:1;
99
QString m_major, m_minor, m_comment, m_icon;
100
QStringList m_patterns;
101
QStringList m_appServices;
102
QStringList m_embedServices;
103
static QMap< QString, QStringList >* s_changedServices;