Fixed 'Open with...' behaviour in Gnome.

This commit is contained in:
Gerald Schmidt 2007-08-30 23:43:34 +00:00
parent e01e25560f
commit cab393815f
3 changed files with 14 additions and 4 deletions

View File

@ -41,7 +41,7 @@ bool MyServerConnection::OnPoke(
return false; return false;
if (item == (wxString)IPC_NO_FILE) { ; } if (item == (wxString)IPC_NO_FILE) { ; }
else if (frame->isOpen(item)) { frame->activateTab(item); } else if (frame->isOpen(item)) { frame->activateTab(item); }
else { frame->openFile(item); } else { frame->openFile((wxString&)item); }
frame->Raise(); frame->Raise();
return true; return true;
} }

View File

@ -1085,7 +1085,7 @@ void MyFrame::handleCommandLine()
} }
else else
{ {
std::cout << "Usage: xmlcopyeditor [-ws --version --help] [<file>] [<file2>]" << std::endl; std::cout << "Usage: xmlcopyeditor [--version --help -ws] [<file>] [<file2>]" << std::endl << "Options -w (import Microsoft Word document) and -s (open Spelling and style check) are provided for integration with Microsoft Office and only available on Windows" << std::endl;
} }
exit(0); exit(0);
default: default:
@ -2717,8 +2717,18 @@ void MyFrame::OnOpen(wxCommandEvent& event)
break; break;
} }
bool MyFrame::openFile(const wxString& fileName, bool largeFile) bool MyFrame::openFile(wxString& fileName, bool largeFile)
{ {
#ifndef __WXMSW__
// truncate string up to file:/ portion added by GNOME
wxString filePrefix = _T("file:");
int index = fileName.Find(filePrefix.c_str());
if (index != -1)
{
fileName = fileName.Mid((size_t)index + filePrefix.Length());
}
#endif
if (!wxFileName::FileExists(fileName)) if (!wxFileName::FileExists(fileName))
{ {
wxString message; wxString message;

View File

@ -305,7 +305,7 @@ class MyFrame : public wxFrame
void messagePane(const wxString& s, int iconType = CONST_INFO); void messagePane(const wxString& s, int iconType = CONST_INFO);
// public to allow IPC access // public to allow IPC access
bool openFile(const wxString& fileName, bool largeFile = false); bool openFile(wxString& fileName, bool largeFile = false);
bool isOpen(const wxString& fileName); bool isOpen(const wxString& fileName);
void activateTab(const wxString& fileName); void activateTab(const wxString& fileName);
private: private: