Index: src/ictranslate/ICTranslateDlg.cpp =================================================================== diff -u -N -rf6fe924675e9de6120b6c1eac2430fa5b2946251 -re9d0e63fbb826dd00b7c590d2dcda5e5f41b4b14 --- src/ictranslate/ICTranslateDlg.cpp (.../ICTranslateDlg.cpp) (revision f6fe924675e9de6120b6c1eac2430fa5b2946251) +++ src/ictranslate/ICTranslateDlg.cpp (.../ICTranslateDlg.cpp) (revision e9d0e63fbb826dd00b7c590d2dcda5e5f41b4b14) @@ -6,6 +6,7 @@ #include "ICTranslateDlg.h" #include #include +#include "../libicpf/exception.h" #ifdef _DEBUG #define new DEBUG_NEW @@ -633,6 +634,12 @@ void CICTranslateDlg::OnFileSaveTranslationAs() { + if(!m_ldCustom.IsValidDescription()) + { + AfxMessageBox(_T("Please fill the Author, Language name and font with correct values before saving.")); + return; + } + CString strFilename = m_ldCustom.GetFilename(false); CString strPath = m_ldCustom.GetFilename(true); @@ -651,13 +658,30 @@ m_ldCustom.SetDirection(bRTL); // store translation with new name - m_ldCustom.WriteTranslation(dlg.GetPathName()); + try + { + m_ldCustom.WriteTranslation(dlg.GetPathName()); + } + catch(icpf::exception& e) + { + CString strInfo; + strInfo.Format(_T("Cannot write translation file.\nReason: %s"), e.get_desc()); + AfxMessageBox(strInfo); + return; + } m_ctlDstFilename.SetWindowText(m_ldCustom.GetFilename(true)); } } void CICTranslateDlg::OnFileSaveTranslation() { + // sanity checks + if(!m_ldCustom.IsValidDescription()) + { + AfxMessageBox(_T("Please fill the Author, Language name and font with correct values before saving.")); + return; + } + CString strPath = m_ldCustom.GetFilename(true); if(strPath.IsEmpty()) { @@ -676,7 +700,17 @@ bool bRTL = (m_ctlDstRTL.GetCheck() == BST_CHECKED); m_ldCustom.SetDirection(bRTL); - m_ldCustom.WriteTranslation(NULL); + try + { + m_ldCustom.WriteTranslation(NULL); + } + catch(icpf::exception& e) + { + CString strInfo; + strInfo.Format(_T("Cannot write translation file.\nReason: %s"), e.get_desc()); + AfxMessageBox(strInfo); + return; + } m_ctlDstFilename.SetWindowText(m_ldCustom.GetFilename(true)); } }