+    // Name of the application
+    wxString nameapp;
+    nIndex = wxNOT_FOUND;
+#if wxUSE_INTL // try "Name[locale name]" first
+    wxLocale *locale = wxGetLocale();
+    if ( locale )
+        nIndex = file.pIndexOf(_T("Name[")+locale->GetName()+_T("]="));
+#endif // wxUSE_INTL
+    if(nIndex == wxNOT_FOUND)
+        nIndex = file.pIndexOf( wxT("Name=") );
+    if(nIndex != wxNOT_FOUND)
+        nameapp = file.GetCmd(nIndex);
+
+    // Icon of the application.
+    wxString nameicon, namemini;
+    nIndex = wxNOT_FOUND;
+#if wxUSE_INTL // try "Icon[locale name]" first
+    if ( locale )
+        nIndex = file.pIndexOf(_T("Icon[")+locale->GetName()+_T("]="));
+#endif // wxUSE_INTL
+    if(nIndex == wxNOT_FOUND)
+        nIndex = file.pIndexOf( wxT("Icon=") );
+    if(nIndex != wxNOT_FOUND) {
+        nameicon = wxString(wxT("--icon ")) + file.GetCmd(nIndex);
+        namemini = wxString(wxT("--miniicon ")) + file.GetCmd(nIndex);
+    }
+
+    // Replace some of the field code in the 'Exec' entry.
+    // TODO: deal with %d, %D, %n, %N, %k and %v (but last one is deprecated)
+    nIndex = file.pIndexOf( wxT("Exec=") );
+    if (nIndex == wxNOT_FOUND)
+        return;
+    wxString sCmd = file.GetCmd(nIndex);
+    // we expect %f; others including  %F and %U and %u are possible
+    sCmd.Replace(wxT("%F"), wxT("%f"));
+    sCmd.Replace(wxT("%U"), wxT("%f"));
+    sCmd.Replace(wxT("%u"), wxT("%f"));
+    if (0 == sCmd.Replace ( wxT("%f"), wxT("%s") ))
+        sCmd = sCmd + wxT(" %s");
+    sCmd.Replace(wxT("%c"), nameapp);
+    sCmd.Replace(wxT("%i"), nameicon);
+    sCmd.Replace(wxT("%m"), namemini);
+
+    wxStringTokenizer tokenizer(mimetypes, _T(";"));
+    while(tokenizer.HasMoreTokens()) {
+        wxString mimetype = tokenizer.GetNextToken().Lower();
+        nIndex = m_aTypes.Index(mimetype);
+        if(nIndex != wxNOT_FOUND) { // is this a known MIME type?
+            wxMimeTypeCommands* entry = m_aEntries[nIndex];
+            entry->AddOrReplaceVerb(wxT("open"), sCmd);