32 #include <wx/mimetype.h>
33 #include <wx/arrstr.h>
44 #if wxCHECK_VERSION(3, 0, 0)
45 #define wxOPEN wxFD_OPEN
81 wxTheMimeTypesManager->Initialize();
86 wxString extension = manual.AfterLast(_T(
'.'));
88 wxTheMimeTypesManager->GetFileTypeFromExtension(extension);
93 cmd = ft->GetOpenCommand(manual);
96 cmdStr = std::string(cmd.ToAscii());
102 if (!(cmdStr.find(
"evince") != std::string::npos ||
103 cmdStr.find(
"kpdf") != std::string::npos ||
104 cmdStr.find(
"kghostview") != std::string::npos ||
105 cmdStr.find(
"acroread") != std::string::npos ||
106 cmdStr.find(
"okular") != std::string::npos)) {
112 std::vector<std::string> viewers;
113 viewers.push_back(
"/usr/bin/evince");
114 viewers.push_back(
"/usr/bin/kpdf");
115 viewers.push_back(
"/usr/bin/kghostview");
116 viewers.push_back(
"/usr/bin/acroread");
117 viewers.push_back(
"/usr/bin/okular");
118 for (
unsigned int i = 0; i < viewers.size(); ++i) {
122 (viewers.at(i) +
" ").c_str()) + manual);
131 viewers.push_back(
"evince");
132 viewers.push_back(
"kpdf");
133 viewers.push_back(
"kghostview");
134 viewers.push_back(
"acroread");
135 viewers.push_back(
"okular");
137 std::vector<std::string> paths;
141 for (
unsigned int i = 0; i < paths.size(); ++i) {
142 for (
unsigned int j = 0; j < viewers.size(); ++j) {
143 std::string viewer = paths.at(i) +
DS + viewers.at(j);
147 (viewers.at(i) +
" ").c_str()) + manual);
219 wxString extension = manual.AfterLast(_T(
'.'));
220 wxString message = _T(
"No default PDF viewer found.");
221 message.Append(_T(
"Please select an executable program to view PDF "));
222 message.Append(_T(
"files with."));
225 errorDialog.ShowModal();
227 wxFileDialog execDialog(
228 parentWindow(), _T(
"Choose a pdf viewer executable"), _T(
""), _T(
""),
231 if (execDialog.ShowModal() == wxID_OK) {
232 wxString command = execDialog.GetPath();
233 command.Append(_T(
" "));
234 command.Append(manual);