Attached is a patch that almost entirely fixes bug 343. The only
problems are:
1 I was unable to determine the nature of the errors that I have not added
new error messages for. If someone else wants to do the appropriate
defintions that would be fine, but I would be happy to, if only someone
were to enlighten me as to their nature.
2 While I think I have avoided breaking the i18n code, it adds no new
(visible) functionality, just potential hooks. Someone with more language
skill than I should translate the messages.
Thanks
Sam TH
diff -ur abi-0.7.7/src/af/util/xp/ut_types.h abi-change/src/af/util/xp/ut_types.h
--- abi-0.7.7/src/af/util/xp/ut_types.h Sun Oct 17 10:28:09 1999
+++ abi-change/src/af/util/xp/ut_types.h Sun Jan 9 06:24:13 2000
@@ -63,7 +63,8 @@
typedef UT_sint32 UT_ErrorCode;
#define UT_OK ((UT_ErrorCode) 0)
#define UT_OUTOFMEM ((UT_ErrorCode) -100)
-
+#define UT_SaveWriteError ((UT_ErrorCode) -201)
+#define UT_SaveOtherError ((UT_ErrorCode) -200) // This should
+eventually dissapear.
/*
The MSVC debug runtime library can track leaks back to the
diff -ur abi-0.7.7/src/text/fmt/xp/fv_View.cpp abi-change/src/text/fmt/xp/fv_View.cpp
--- abi-0.7.7/src/text/fmt/xp/fv_View.cpp Wed Dec 8 17:14:31 1999
+++ abi-change/src/text/fmt/xp/fv_View.cpp Sun Jan 9 06:24:15 2000
@@ -4046,22 +4046,23 @@
}
}
-UT_Bool FV_View::cmdSave(void)
-{
- if (!m_pDoc->save())
- return UT_FALSE;
- notifyListeners(AV_CHG_SAVE);
- return UT_TRUE;
+UT_ErrorCode FV_View::cmdSave(void)
+{
+ UT_ErrorCode tmpVar;
+ tmpVar = m_pDoc->save();
+ if (!tmpVar)
+ notifyListners(AV_CHG_SAVE);
+ return tmpVar;
}
-UT_Bool FV_View::cmdSaveAs(const char * szFilename, int ieft)
+UT_ErrorCode FV_View::cmdSaveAs(const char * szFilename, int ieft)
{
- if (!m_pDoc->saveAs(szFilename, ieft))
- return UT_FALSE;
-
- notifyListeners(AV_CHG_SAVE);
- return UT_TRUE;
+ UT_ErrorCode = tmpVar;
+ tmpVar = m_pDoc->save(szFilename, ieft);
+ if (!tmpVar)
+ notifyListners(AV_CHG_SAVE);
+ return tmpVar;
}
void FV_View::cmdCut(void)
diff -ur abi-0.7.7/src/text/ptbl/xp/pd_Document.cpp
abi-change/src/text/ptbl/xp/pd_Document.cpp
--- abi-0.7.7/src/text/ptbl/xp/pd_Document.cpp Sun Sep 26 13:17:31 1999
+++ abi-change/src/text/ptbl/xp/pd_Document.cpp Sun Jan 9 06:24:15 2000
@@ -146,10 +146,10 @@
return UT_TRUE;
}
-UT_Bool PD_Document::saveAs(const char * szFilename, int ieft)
+UT_ErrorCode PD_Document::saveAs(const char * szFilename, int ieft)
{
if (!szFilename)
- return UT_FALSE;
+ return UT_SaveOtherError;
IE_Exp * pie = NULL;
IEStatus ies;
@@ -158,7 +158,7 @@
if (ies != IES_OK)
{
UT_DEBUGMSG(("PD_Document::Save -- could not construct exporter\n"));
- return UT_FALSE;
+ return UT_SaveOtherError;
}
ies = pie->writeFile(szFilename);
@@ -167,7 +167,7 @@
if (ies != IES_OK)
{
UT_DEBUGMSG(("PD_Document::Save -- could not write file\n"));
- return UT_FALSE;
+ return UT_SaveWriteError;
}
// no file name currently set - make this filename the filename
@@ -180,20 +180,20 @@
char * szFilenameCopy = NULL;
if (!UT_cloneString(szFilenameCopy,szFilename))
- return UT_FALSE;
+ return UT_SaveOtherError;
m_szFilename = szFilenameCopy;
// save the type we just saved as
m_lastSavedAsType = (IEFileType) ieft;
_setClean();
- return UT_TRUE;
+ return UT_OK;
}
UT_Bool PD_Document::save(void)
{
if (!m_szFilename || !*m_szFilename)
- return UT_FALSE;
+ return UT_SaveOtherError;
IE_Exp * pie = NULL;
IEStatus ies;
@@ -202,7 +202,7 @@
if (ies != IES_OK)
{
UT_DEBUGMSG(("PD_Document::Save -- could not construct exporter\n"));
- return UT_FALSE;
+ return UT_SaveOtherError;
}
ies = pie->writeFile(m_szFilename);
@@ -211,11 +211,11 @@
if (ies != IES_OK)
{
UT_DEBUGMSG(("PD_Document::Save -- could not write file\n"));
- return UT_FALSE;
+ return UT_SaveWriteError;
}
_setClean();
- return UT_TRUE;
+ return UT_OK;
}
//////////////////////////////////////////////////////////////////
diff -ur abi-0.7.7/src/wp/ap/xp/ap_EditMethods.cpp
abi-change/src/wp/ap/xp/ap_EditMethods.cpp
--- abi-0.7.7/src/wp/ap/xp/ap_EditMethods.cpp Fri Dec 3 23:15:11 1999
+++ abi-change/src/wp/ap/xp/ap_EditMethods.cpp Tue Jan 11 01:47:54 2000
@@ -747,7 +747,7 @@
// TODO we want to abstract things further and make us think about
// TODO localization of the question strings....
-static void s_TellSaveFailed(XAP_Frame * pFrame, const char * fileName)
+static void s_TellSaveFailed(XAP_Frame * pFrame, const char * fileName, UT_ErrorCode
+errorCode)
{
pFrame->raise();
@@ -762,7 +762,12 @@
const XAP_StringSet * pSS = pFrame->getApp()->getStringSet();
- pDialog->setMessage(pSS->getValue(AP_STRING_ID_MSG_SaveFailed), fileName);
+ if (errorCode == -201) // We have a write error
+ pDialog->setMessage(pSS->getValue(AP_STRING_ID_MSG_SaveFailedWrite),
+fileName);
+
+ else // The generic case - should be eliminated eventually
+ pDialog->setMessage(pSS->getValue(AP_STRING_ID_MSG_SaveFailed), fileName);
+
pDialog->setButtons(XAP_Dialog_MessageBox::b_O);
pDialog->setDefaultAnswer(XAP_Dialog_MessageBox::a_OK);
@@ -1293,11 +1298,12 @@
// can only save without prompting if filename already known
if (!pFrame->getFilename())
return EX(fileSaveAs);
-
- if (!pAV_View->cmdSave())
+ UT_ErrorCode bSaved;
+ bSaved = pAV_View->cmdSave();
+ if (bSaved)
{
// throw up a dialog
- s_TellSaveFailed(pFrame, pFrame->getFilename());
+ s_TellSaveFailed(pFrame, pFrame->getFilename(), bSaved);
return UT_FALSE;
}
@@ -1325,13 +1331,13 @@
return UT_FALSE;
UT_DEBUGMSG(("fileSaveAs: saving as [%s]\n",pNewFile));
+ UT_ErrorCode bSaved;
+ bSaved = pAV_View->cmdSaveAs(pNewFile, (int) ieft);
- UT_Bool bSaved = pAV_View->cmdSaveAs(pNewFile,(int) ieft);
-
- if (!bSaved)
+ if (bSaved)
{
// throw up a dialog
- s_TellSaveFailed(pFrame, pNewFile);
+ s_TellSaveFailed(pFrame, pNewFile, bSaved);
free(pNewFile);
return UT_FALSE;
}
Only in abi-change/src/wp/ap/xp: ap_EditMethods.cpp~
diff -ur abi-0.7.7/src/wp/ap/xp/ap_String_Id.h abi-change/src/wp/ap/xp/ap_String_Id.h
--- abi-0.7.7/src/wp/ap/xp/ap_String_Id.h Wed Nov 17 14:21:33 1999
+++ abi-change/src/wp/ap/xp/ap_String_Id.h Tue Jan 11 01:53:26 2000
@@ -26,6 +26,7 @@
// Message Boxes used in AP_EditMethods
dcl(MSG_SaveFailed, "Could not write to the file %s.")
+dcl(MSG_SaveFailedWrite, "Writing error when attempting to save %s")
dcl(MSG_RevertBuffer, "Revert to saved copy of %s?")
dcl(MSG_QueryExit, "Close all windows and exit?")
dcl(MSG_ConfirmSave, "Save changes to %s?")
Only in abi-change/src/wp/ap/xp: ap_String_Id.h~
diff -ur abi-0.7.7/user/wp/strings/CaES.strings
abi-change/user/wp/strings/CaES.strings
--- abi-0.7.7/user/wp/strings/CaES.strings Thu Dec 2 01:27:32 1999
+++ abi-change/user/wp/strings/CaES.strings Tue Jan 11 01:56:18 2000
@@ -77,6 +77,7 @@
<Strings class="AP"
MSG_SaveFailed="�s impossible escriure al fitxer %s."
+MSG_SaveFailedWrite="�s impossible escriure al fitxer %s."
MSG_RevertBuffer="Voleu obrir '%s' tal com estava la darrera vegada que es va desar?"
MSG_QueryExit="Voleu tancar totes les finestres i sortir?"
MSG_ConfirmSave="Voleu desar els canvis fets a %s?"
Only in abi-change/user/wp/strings: CaES.strings~
diff -ur abi-0.7.7/user/wp/strings/DaDK.strings
abi-change/user/wp/strings/DaDK.strings
--- abi-0.7.7/user/wp/strings/DaDK.strings Mon Nov 8 13:43:15 1999
+++ abi-change/user/wp/strings/DaDK.strings Tue Jan 11 01:56:41 2000
@@ -75,6 +75,7 @@
<Strings class="AP"
MSG_SaveFailed="Kunne ikke skrive til filen %s."
+MSG_SaveFailedWrite="Kunne ikke skrive til filen %s."
MSG_RevertBuffer="Return�r til gemt kopi af %s?"
MSG_QueryExit="Luk alle vinduer og afslut?"
MSG_ConfirmSave="Gem �ndringer til %s?"
Only in abi-change/user/wp/strings: DaDK.strings~
diff -ur abi-0.7.7/user/wp/strings/DeDE.strings
abi-change/user/wp/strings/DeDE.strings
--- abi-0.7.7/user/wp/strings/DeDE.strings Fri Oct 8 01:39:48 1999
+++ abi-change/user/wp/strings/DeDE.strings Tue Jan 11 01:57:41 2000
@@ -73,6 +73,7 @@
<Strings class="AP"
MSG_SaveFailed="Konnte Datei %s nicht schreiben."
+MSG_SaveFailedWrite="Konnte Datei %s nicht schreiben."
MSG_RevertBuffer="Revert to saved copy of %s?"
MSG_QueryExit="Alle Fenster schlie�en und beenden?"
MSG_ConfirmSave="�nderungen in %s speichern?"
Only in abi-change/user/wp/strings: DeDE.strings~
diff -ur abi-0.7.7/user/wp/strings/DuNL.strings
abi-change/user/wp/strings/DuNL.strings
--- abi-0.7.7/user/wp/strings/DuNL.strings Fri Oct 8 01:39:48 1999
+++ abi-change/user/wp/strings/DuNL.strings Tue Jan 11 01:58:07 2000
@@ -71,6 +71,7 @@
<Strings class="AP"
MSG_SaveFailed="Kon niet schrijven naar het bestand %s."
+MSG_SaveFailedWrite="Kon niet schrijven naar het bestand %s."
MSG_RevertBuffer="Bewaarde copie van %s openen?"
MSG_QueryExit="Sluit alle vensters en verlaat programma?"
MSG_ConfirmSave="Bewaar veranderingen naar %s?"
Only in abi-change/user/wp/strings: DuNL.strings~
diff -ur abi-0.7.7/user/wp/strings/EsES.strings
abi-change/user/wp/strings/EsES.strings
--- abi-0.7.7/user/wp/strings/EsES.strings Fri Oct 8 01:39:48 1999
+++ abi-change/user/wp/strings/EsES.strings Tue Jan 11 01:58:30 2000
@@ -77,6 +77,7 @@
<Strings class="AP"
MSG_SaveFailed="Imposible escribir en el fichero %s."
+MSG_SaveFailedWrite="Imposible escribir en el fichero %s."
MSG_RevertBuffer="�Abrir '%s' tal cual estaba la ultima vez que se guardo?"
MSG_QueryExit="�Cerrar todas las ventanas y salir?"
MSG_ConfirmSave="�Guardar los cambios hechos en %s?"
Only in abi-change/user/wp/strings: EsES.strings~
diff -ur abi-0.7.7/user/wp/strings/FiFI.strings
abi-change/user/wp/strings/FiFI.strings
--- abi-0.7.7/user/wp/strings/FiFI.strings Tue Nov 16 17:20:49 1999
+++ abi-change/user/wp/strings/FiFI.strings Tue Jan 11 01:58:53 2000
@@ -77,6 +77,7 @@
<Strings class="AP"
MSG_SaveFailed="Ei voinut kirjoittaa tiedostoon %s."
+MSG_SaveFailedWrite="Ei voinut kirjoittaa tiedostoon %s."
MSG_RevertBuffer="Palataanko tallennettuun kopioon %s tiedostosta?"
MSG_QueryExit="Suljetaanko kaikki ikkunat ja poistutaan"
MSG_ConfirmSave="Tallennetaanko muutokset %s tiedostoon?"
Only in abi-change/user/wp/strings: FiFI.strings~
diff -ur abi-0.7.7/user/wp/strings/FrFR.strings
abi-change/user/wp/strings/FrFR.strings
--- abi-0.7.7/user/wp/strings/FrFR.strings Fri Oct 8 01:25:22 1999
+++ abi-change/user/wp/strings/FrFR.strings Tue Jan 11 01:59:08 2000
@@ -77,6 +77,7 @@
<Strings class="AP"
MSG_SaveFailed="Impossible d'�crire dans le fichier %s."
+MSG_SaveFailedWrite="Impossible d'�crire dans le fichier %s."
MSG_RevertBuffer="Ouvrir '%s' tel qu'il �tait au dernier enregistrement?"
MSG_QueryExit="Fermer toutes les fen�tres et quitter?"
MSG_ConfirmSave="Voulez vous enregistrer les modifications apport�es � %s?"
Only in abi-change/user/wp/strings: FrFR.strings~
diff -ur abi-0.7.7/user/wp/strings/ItIT.strings
abi-change/user/wp/strings/ItIT.strings
--- abi-0.7.7/user/wp/strings/ItIT.strings Fri Oct 8 01:39:48 1999
+++ abi-change/user/wp/strings/ItIT.strings Tue Jan 11 01:59:25 2000
@@ -71,6 +71,7 @@
<Strings class="AP"
MSG_SaveFailed="Impossibile scrivere il file %s."
+MSG_SaveFailedWrite="Impossibile scrivere il file %s."
MSG_RevertBuffer="Ripristina la copia salvato di %s?"
MSG_QueryExit="Chiudere tutte le finestre ed uscire?"
MSG_ConfirmSave="Salvare le modifice a %s?"
Only in abi-change/user/wp/strings: ItIT.strings~
diff -ur abi-0.7.7/user/wp/strings/NoNO.strings
abi-change/user/wp/strings/NoNO.strings
--- abi-0.7.7/user/wp/strings/NoNO.strings Fri Oct 8 01:39:48 1999
+++ abi-change/user/wp/strings/NoNO.strings Tue Jan 11 01:59:43 2000
@@ -75,6 +75,7 @@
<Strings class="AP"
MSG_SaveFailed="Kunne ikke skrive til filen %s."
+MSG_SaveFailedWrite="Kunne ikke skrive til filen %s."
MSG_RevertBuffer="Returner til lagret kopi av %s?"
MSG_QueryExit="Lukk alle vinduer og avslutt?"
MSG_ConfirmSave="Lagre endringer til %s?"
Only in abi-change/user/wp/strings: NoNO.strings~
diff -ur abi-0.7.7/user/wp/strings/PtPT.strings
abi-change/user/wp/strings/PtPT.strings
--- abi-0.7.7/user/wp/strings/PtPT.strings Tue Nov 9 16:21:19 1999
+++ abi-change/user/wp/strings/PtPT.strings Tue Jan 11 02:00:10 2000
@@ -77,6 +77,7 @@
<Strings class="AP"
MSG_SaveFailed="Imposs�vel escrever no ficheiro %s."
+MSG_SaveFailedWrite="Imposs�vel escrever no ficheiro %s."
MSG_RevertBuffer="Reabrir '%s' tal e qual como estava da ultima vez que foi
guardado?"
MSG_QueryExit="Fechar todas as janelas e sair?"
MSG_ConfirmSave="Guardar altera��es em %s?"
Only in abi-change/user/wp/strings: PtPT.strings~