mirror of
https://github.com/edeproject/ede.git
synced 2023-08-10 21:13:03 +03:00
Importing EDE2 code to svn... NOTE: It doesn't compile! Stuff thats broken: edewm, eworkpanel, eiconman,
emenueditor
This commit is contained in:
68
edelib2/MimeType.h
Normal file
68
edelib2/MimeType.h
Normal file
@ -0,0 +1,68 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* edelib::MimeType - Detection of file types and handling
|
||||
* Part of Equinox Desktop Environment (EDE).
|
||||
* Copyright (c) 2000-2006 EDE Authors.
|
||||
*
|
||||
* This program is licenced under terms of the
|
||||
* GNU General Public Licence version 2 or newer.
|
||||
* See COPYING for details.
|
||||
*/
|
||||
|
||||
|
||||
/*! \class edelib::MimeType
|
||||
|
||||
This detects the type of file using "magic" (fingerprint
|
||||
usualy found in the first several bytes) and, if that fails,
|
||||
"extension" (part of filename after last dot). To avoid code
|
||||
duplication, GNU file is used.
|
||||
|
||||
Also this class suggests the command to be used for opening.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _edelib_MimeType_h_
|
||||
#define _edelib_MimeType_h_
|
||||
|
||||
#include "Icon.h"
|
||||
|
||||
namespace edelib {
|
||||
|
||||
class MimeType
|
||||
{
|
||||
public:
|
||||
|
||||
/*! Constructor takes filename and all interesting data is
|
||||
returned with methods listed below. filename must contain
|
||||
full path. Set usefind to false to avoid using GNU/find
|
||||
command.*/
|
||||
|
||||
MimeType(const char* filename, bool usefind=true);
|
||||
|
||||
// Silence compiler warning
|
||||
virtual ~MimeType();
|
||||
|
||||
/*! Returns a string describing file type i.e. "PNG Image" */
|
||||
const char* type_string() { if (cur_typestr) return cur_typestr; else return 0;}
|
||||
|
||||
/*! String that can be executed to open the given file
|
||||
or perform some default action (e.g. for .desktop files,
|
||||
the program that will be launched) */
|
||||
const char* command() { if (cur_command) return cur_command; else return 0; }
|
||||
|
||||
/*! Returns edelib::Icon for files of this type. Parameter is
|
||||
edelib::Icon::IconSize */
|
||||
Icon* icon(int size) { if(cur_iconname) return Icon::get(cur_iconname,size); else return 0; }
|
||||
|
||||
const char* id() { if(cur_id) return cur_id; else return 0; }
|
||||
|
||||
private:
|
||||
char *cur_id, *cur_typestr, *cur_command, *cur_iconname, *cur_filename;
|
||||
void set_found(char *id);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user