Neel
2006-07-06 12:20:16 UTC
Hi,
I am trying to do file association with my application. I found some
thread related to the same.
http://groups.google.co.in/group/comp.sys.mac.oop.powerplant/browse_thread/thread/a64c4ec656acdaae/9f656a9b4bf6f3d4?q=click+on+file+and+open+application&rnum=9&auth=DQAAAHEAAAABFxdOMV9vO789R3WGUh_VLt1UustK-BRq7OsEqXEwGYw50rLjXQQtXMto7Mr5zGLe8HrS_QDTPPKSOvxr_CO1WlG3mC8veyAbumDBrc8rS1KNV9jDMqtxI8bai3ZAn073ADat12pf8xR4P5KwGt5N0vDlt54bRTvpKG9pBWRfoA
Exactly, My application save file with .SGF xnt, which contains some
xml tags. I can save file anywhere on the local disk.
I checked GetInfo option of one of .SGF file it shows as TextEdit
Document. I am trying to do file association with the same file so if i
double-click on file then my application should start automatically and
read the contents of the file and show.
Menually, when i set "Open with" option of GetInfo and selected my
application as destination, then after double-click it open my
application, now this is something i want to do it programatically.
I have already set my unique creator id, and succesfully set the
application icon. The same id i am setting using
SetFileCreator('PcSL'). Please suggest where did i make mistake.
Here is the snippet of code:
/****************************************************************/
PP_StandardDialogs::LFileDesignator designator;
NavDialogOptions* options = designator.GetDialogOptions();
if (options != nil)
options->dialogOptionFlags=kNavDefaultNavDlogOptions+kNavPreserveSaveFileExtension;
LFileTypeList fileTypeList(fileTypes_All);
designator.SetFileType('TEXT');
designator.SetFileCreator('PcSL');
std::string l_strLocalFName;
GetScanGroupFileName(&l_strLocalFName);
if (designator.AskDesignateFile("\pUntitled.sgf"))
{
string strFullpath;
strFullpath ="";
GetFullPathWithString(outFSSpec, strFullpath);
designator.GetFileSpec(outFSSpec);
if (GetFullPathWithString(outFSSpec, strFullpath))
l_strLocalFName = strFullpath;
}
else
{
return false;
}
if ( l_pobjMacFileIO.Open( (char *)l_strLocalFName.c_str(), "Mw+"))
{
Save(&l_pobjMacFileIO);
SaveConfigurationSettingsInSGF(&l_pobjMacFileIO);
l_pobjMacFileIO.Close();
designator.CompleteSave();
}
/***********************************************************************/
Thanks in advance.
Neel.
I am trying to do file association with my application. I found some
thread related to the same.
http://groups.google.co.in/group/comp.sys.mac.oop.powerplant/browse_thread/thread/a64c4ec656acdaae/9f656a9b4bf6f3d4?q=click+on+file+and+open+application&rnum=9&auth=DQAAAHEAAAABFxdOMV9vO789R3WGUh_VLt1UustK-BRq7OsEqXEwGYw50rLjXQQtXMto7Mr5zGLe8HrS_QDTPPKSOvxr_CO1WlG3mC8veyAbumDBrc8rS1KNV9jDMqtxI8bai3ZAn073ADat12pf8xR4P5KwGt5N0vDlt54bRTvpKG9pBWRfoA
Exactly, My application save file with .SGF xnt, which contains some
xml tags. I can save file anywhere on the local disk.
I checked GetInfo option of one of .SGF file it shows as TextEdit
Document. I am trying to do file association with the same file so if i
double-click on file then my application should start automatically and
read the contents of the file and show.
Menually, when i set "Open with" option of GetInfo and selected my
application as destination, then after double-click it open my
application, now this is something i want to do it programatically.
I have already set my unique creator id, and succesfully set the
application icon. The same id i am setting using
SetFileCreator('PcSL'). Please suggest where did i make mistake.
Here is the snippet of code:
/****************************************************************/
PP_StandardDialogs::LFileDesignator designator;
NavDialogOptions* options = designator.GetDialogOptions();
if (options != nil)
options->dialogOptionFlags=kNavDefaultNavDlogOptions+kNavPreserveSaveFileExtension;
LFileTypeList fileTypeList(fileTypes_All);
designator.SetFileType('TEXT');
designator.SetFileCreator('PcSL');
std::string l_strLocalFName;
GetScanGroupFileName(&l_strLocalFName);
if (designator.AskDesignateFile("\pUntitled.sgf"))
{
string strFullpath;
strFullpath ="";
GetFullPathWithString(outFSSpec, strFullpath);
designator.GetFileSpec(outFSSpec);
if (GetFullPathWithString(outFSSpec, strFullpath))
l_strLocalFName = strFullpath;
}
else
{
return false;
}
if ( l_pobjMacFileIO.Open( (char *)l_strLocalFName.c_str(), "Mw+"))
{
Save(&l_pobjMacFileIO);
SaveConfigurationSettingsInSGF(&l_pobjMacFileIO);
l_pobjMacFileIO.Close();
designator.CompleteSave();
}
/***********************************************************************/
Thanks in advance.
Neel.