X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/af159c44819297cece57e141e6f3ebdc2fa9b39f..3b59cdbfaf7df79499424c92ff6177736429ff8a:/src/common/mimetype.cpp diff --git a/src/common/mimetype.cpp b/src/common/mimetype.cpp index 8b895d7dee..3dab4f75fa 100644 --- a/src/common/mimetype.cpp +++ b/src/common/mimetype.cpp @@ -28,7 +28,9 @@ #ifndef WX_PRECOMP #include "wx/string.h" - #include "wx/icon.h" + #if wxUSE_GUI + #include "wx/icon.h" + #endif #endif //WX_PRECOMP // Doesn't compile in WIN16 mode @@ -43,7 +45,7 @@ #ifdef __WXMSW__ #include "wx/msw/registry.h" #include "windows.h" -#elif defined(__UNIX__) +#elif defined(__UNIX__) || defined(__WXPM__) #include "wx/ffile.h" #include "wx/textfile.h" #include "wx/dir.h" @@ -55,6 +57,9 @@ // other standard headers #include +// in case we're compiling in non-GUI mode +class WXDLLEXPORT wxIcon; + // ---------------------------------------------------------------------------- // private classes // ---------------------------------------------------------------------------- @@ -1339,7 +1344,7 @@ void wxGNOMEIconHandler::Init() { wxArrayString dirs; dirs.Add(_T("/usr/share")); - + wxString gnomedir; wxGetHomeDir( &gnomedir ); gnomedir += _T("/.gnome"); @@ -1385,7 +1390,7 @@ bool wxGNOMEIconHandler::GetIcon(const wxString& mimetype, wxIcon *icon) // KDE stores the icon info in its .kdelnk files. The file for mimetype/subtype // may be found in either of the following locations // -// 1. /usr/share/mimelnk/mimetype/subtype.kdelnk +// 1. $KDEDIR/share/mimelnk/mimetype/subtype.kdelnk // 2. ~/.kde/share/mimelnk/mimetype/subtype.kdelnk // // The format of a .kdelnk file is almost the same as the one used by @@ -1498,12 +1503,21 @@ void wxKDEIconHandler::LoadLinkFilesFromDir(const wxString& dirbase) void wxKDEIconHandler::Init() { wxArrayString dirs; - dirs.Add(_T("/usr/share")); - - wxString kdedir; - wxGetHomeDir( &kdedir ); - kdedir += _T("/.kde/share"); - dirs.Add( kdedir ); + + // the variable KDEDIR is set when KDE is running + const char *kdedir = getenv("KDEDIR"); + if ( kdedir ) + { + dirs.Add(wxString(kdedir) + _T("/share")); + } + else + { + // try to guess KDEDIR + dirs.Add(_T("/usr/share")); + dirs.Add(_T("/opt/kde/share")); + } + + dirs.Add(wxGetHomeDir() + _T("/.kde/share")); size_t nDirs = dirs.GetCount(); for ( size_t nDir = 0; nDir < nDirs; nDir++ )