summaryrefslogtreecommitdiff
path: root/library/mimetype.cpp
authoreilers <eilers>2003-08-08 14:45:49 (UTC)
committer eilers <eilers>2003-08-08 14:45:49 (UTC)
commit14d394e6c107b037a09a31a92605034fe50f7813 (patch) (unidiff)
tree800699cf4dc9681c3eb023340634dd6a15fd04c8 /library/mimetype.cpp
parentdbc6ea35f5535a1f69deb7ebbafc0f721721dbf2 (diff)
downloadopie-14d394e6c107b037a09a31a92605034fe50f7813.zip
opie-14d394e6c107b037a09a31a92605034fe50f7813.tar.gz
opie-14d394e6c107b037a09a31a92605034fe50f7813.tar.bz2
Merged branches from BRANCH_1_0
Diffstat (limited to 'library/mimetype.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--library/mimetype.cpp64
1 files changed, 64 insertions, 0 deletions
diff --git a/library/mimetype.cpp b/library/mimetype.cpp
index ef5d619..d0a578e 100644
--- a/library/mimetype.cpp
+++ b/library/mimetype.cpp
@@ -130,50 +130,102 @@ MimeType::Private& MimeType::data()
130 return *d; 130 return *d;
131} 131}
132 132
133/*!
134 \class MimeType mimetype.h
135 \brief The MimeType class provides MIME type information.
136
137 A MimeType object is a light-weight value which
138 provides information about a MIME type.
139
140 \ingroup qtopiaemb
141*/
142
143/*!
144 Constructs a MimeType.
145 Normally, \a ext_or_id is a MIME type,
146 but if \a ext_or_id starts with / or contains no /,
147 it is interpretted as a filename and the
148 extension (eg. .txt) is used as the
149 MIME type.
150*/
133MimeType::MimeType( const QString& ext_or_id ) 151MimeType::MimeType( const QString& ext_or_id )
134{ 152{
135 init(ext_or_id); 153 init(ext_or_id);
136} 154}
137 155
156/*!
157 Constructs a MimeType from the type() of \a lnk.
158*/
138MimeType::MimeType( const DocLnk& lnk ) 159MimeType::MimeType( const DocLnk& lnk )
139{ 160{
140 init(lnk.type()); 161 init(lnk.type());
141} 162}
142 163
164/*!
165 Returns the MIME type identifier.
166*/
143QString MimeType::id() const 167QString MimeType::id() const
144{ 168{
145 return i; 169 return i;
146} 170}
147 171
172/*!
173 Returns a description of the MIME Type. This is usually based
174 on the application() associated with the type.
175*/
148QString MimeType::description() const 176QString MimeType::description() const
149{ 177{
150 MimeTypeData* d = data(i); 178 MimeTypeData* d = data(i);
151 return d ? d->description() : QString::null; 179 return d ? d->description() : QString::null;
152} 180}
153 181
182/*!
183 Returns a small QPixmap appropriate for the MIME type.
184*/
154QPixmap MimeType::pixmap() const 185QPixmap MimeType::pixmap() const
155{ 186{
156 MimeTypeData* d = data(i); 187 MimeTypeData* d = data(i);
157 return d ? d->regIcon() : QPixmap(); 188 return d ? d->regIcon() : QPixmap();
158} 189}
159 190
191/*!
192 \internal
193 This function is not generally available.
194*/
160QString MimeType::extension() const 195QString MimeType::extension() const
161{ 196{
162 return extensions().first(); 197 return extensions().first();
163} 198}
164 199
200
201/*!
202 \internal
203 This function is not generally available.
204*/
165QStringList MimeType::extensions() const 205QStringList MimeType::extensions() const
166{ 206{
167 loadExtensions(); 207 loadExtensions();
168 return *(*extFor).find(i); 208 return *(*extFor).find(i);
169} 209}
170 210
211/*!
212 Returns a larger QPixmap appropriate for the MIME type.
213*/
171QPixmap MimeType::bigPixmap() const 214QPixmap MimeType::bigPixmap() const
172{ 215{
173 MimeTypeData* d = data(i); 216 MimeTypeData* d = data(i);
174 return d ? d->bigIcon() : QPixmap(); 217 return d ? d->bigIcon() : QPixmap();
175} 218}
176 219
220/*!
221 Returns the AppLnk defining the application associated
222 with this MIME type, or 0 if none is associated.
223
224 The caller must not retain the pointer,
225 but of course you can dereference it to take a copy if needed.
226
227 \sa Service::binding()
228*/
177const AppLnk* MimeType::application() const 229const AppLnk* MimeType::application() const
178{ 230{
179 MimeTypeData* d = data(i); 231 MimeTypeData* d = data(i);
@@ -189,6 +241,9 @@ static QString serviceBinding(const QString& service)
189 return "Service-"+svrc; 241 return "Service-"+svrc;
190} 242}
191 243
244/*!
245 \internal
246*/
192void MimeType::registerApp( const AppLnk& lnk ) 247void MimeType::registerApp( const AppLnk& lnk )
193{ 248{
194 QStringList list = lnk.mimeTypes(); 249 QStringList list = lnk.mimeTypes();
@@ -213,6 +268,9 @@ void MimeType::registerApp( const AppLnk& lnk )
213 } 268 }
214} 269}
215 270
271/*!
272 \internal
273*/
216void MimeType::clear() 274void MimeType::clear()
217{ 275{
218 delete d; 276 delete d;
@@ -286,11 +344,17 @@ MimeTypeData* MimeType::data(const QString& id)
286 return d; 344 return d;
287} 345}
288 346
347/*!
348 Returns a Qtopia folder containing application definitions.
349*/
289QString MimeType::appsFolderName() 350QString MimeType::appsFolderName()
290{ 351{
291 return QPEApplication::qpeDir() + "apps"; 352 return QPEApplication::qpeDir() + "apps";
292} 353}
293 354
355/*!
356 Reloads application definitions.
357*/
294void MimeType::updateApplications() 358void MimeType::updateApplications()
295{ 359{
296 clear(); 360 clear();