Index: vcl/inc/salptype.hxx =================================================================== RCS file: /cvs/gsl/vcl/inc/salptype.hxx,v retrieving revision 1.1.1.1 diff -u -p -u -r1.1.1.1 salptype.hxx --- vcl/inc/salptype.hxx 19 Sep 2000 10:23:06 -0000 1.1.1.1 +++ vcl/inc/salptype.hxx 29 May 2003 14:09:26 -0000 @@ -80,8 +80,9 @@ // - SalPrinterError - // ------------------- -#define SAL_PRINTER_ERROR_GENERALERROR 1 -#define SAL_PRINTER_ERROR_ABORT 2 +#define SAL_PRINTER_ERROR_GENERALERROR 1 +#define SAL_PRINTER_ERROR_ABORT 2 +#define SAL_PRINTER_ERROR_NO_PRINTER 3 // ------------------- Index: vcl/source/gdi/print.cxx =================================================================== RCS file: /cvs/gsl/vcl/source/gdi/print.cxx,v retrieving revision 1.41 diff -u -p -u -r1.41 print.cxx --- vcl/source/gdi/print.cxx 15 Apr 2003 16:05:54 -0000 1.41 +++ vcl/source/gdi/print.cxx 29 May 2003 14:11:18 -0000 @@ -1694,6 +1694,9 @@ ULONG ImplSalPrinterErrorCodeToVCL( ULON case SAL_PRINTER_ERROR_ABORT: nVCLError = PRINTER_ABORT; break; + case SAL_PRINTER_ERROR_NO_PRINTER: + nVCLError = ERRCODE_IO_NOTEXISTS; + break; default: nVCLError = PRINTER_GENERALERROR; break; @@ -1867,6 +1870,8 @@ BOOL Printer::EndJob() mnCurPage = 0; + BOOL success = TRUE; + if ( mpPrinter ) { mbPrinting = FALSE; @@ -1874,7 +1879,13 @@ BOOL Printer::EndJob() maJobName.Erase(); mbDevOutput = FALSE; - mpPrinter->EndJob(); + if (! mpPrinter->EndJob() ) + { + mnError = ImplSalPrinterErrorCodeToVCL( mpPrinter->GetErrorCode() ); + if ( !mnError ) + mnError = PRINTER_GENERALERROR; + success = FALSE; + } // Hier den Drucker nicht asyncron zerstoeren, da es // W95 nicht verkraftet, wenn gleichzeitig gedruckt wird // und ein Druckerobjekt zerstoert wird @@ -1885,7 +1896,7 @@ BOOL Printer::EndJob() else mpQPrinter->EndQueuePrint(); - return TRUE; + return success; } #else ImplSVData* pSVData = ImplGetSVData(); Index: sfx2/source/view/makefile.mk =================================================================== RCS file: /cvs/framework/sfx2/source/view/makefile.mk,v retrieving revision 1.4 diff -u -p -u -r1.4 makefile.mk --- sfx2/source/view/makefile.mk 18 Jun 2001 10:52:07 -0000 1.4 +++ sfx2/source/view/makefile.mk 29 May 2003 14:15:19 -0000 @@ -109,6 +109,8 @@ SLOFILES = \ $(SLO)$/topfrm.obj \ $(SLO)$/sfxbasecontroller.obj +CFLAGS+=`pkg-config --cflags glib-2.0` + # --- Targets ------------------------------------------------------- .INCLUDE : target.mk Index: sfx2/source/view/viewprn.cxx =================================================================== RCS file: /cvs/framework/sfx2/source/view/viewprn.cxx,v retrieving revision 1.15 diff -u -p -u -r1.15 viewprn.cxx --- sfx2/source/view/viewprn.cxx 17 Apr 2003 16:10:43 -0000 1.15 +++ sfx2/source/view/viewprn.cxx 29 May 2003 14:17:39 -0000 @@ -98,6 +98,8 @@ #include #pragma hdrstop +#include + #include "viewsh.hxx" #include "viewimp.hxx" #include "viewfrm.hxx" @@ -745,14 +747,31 @@ void SfxViewShell::ExecPrint_Impl( SfxRe if ( bDontModifyDoc && bOldFlag != pObjSh->IsEnableSetModified() ) pObjSh->EnableSetModified( bOldFlag ); - if ( nError != PRINTER_ABORT ) - { - // "real" problem (not simply printing cancelled by user) - String aMsg( SfxResId( STR_NOSTARTPRINTER ) ); - if ( !bIsAPI ) - ErrorBox( NULL, WB_OK | WB_DEF_OK, aMsg ).Execute(); - rReq.SetReturnValue(SfxBoolItem(0,FALSE)); - } + String aMsg( SfxResId( STR_NOSTARTPRINTER ) ); +#ifdef UNX + if ( nError == ERRCODE_IO_NOTEXISTS ) + { + ErrorBox box ( NULL, WB_OK | WB_DEF_OK, aMsg ); +#define BUTTONID_ADD_PRN 77 + box.AddButton( ::rtl::OUString( SfxResId( STR_ADDPRINTER ) ), + BUTTONID_ADD_PRN, 0, 0 ); + if (box.Execute () == BUTTONID_ADD_PRN) + { + const char *argv[] = { "gnome-cups-add", NULL }; + g_spawn_async (NULL, (gchar **)argv, + NULL, G_SPAWN_SEARCH_PATH, + NULL, NULL, NULL, NULL); + } + } + else +#endif + if ( nError != PRINTER_ABORT ) + { + // "real" problem (not simply printing cancelled by user) + if ( !bIsAPI ) + ErrorBox( NULL, WB_OK | WB_DEF_OK, aMsg ).Execute(); + rReq.SetReturnValue(SfxBoolItem(0,FALSE)); + } rReq.Ignore(); } Index: sfx2/source/view/view.hrc =================================================================== RCS file: /cvs/framework/sfx2/source/view/view.hrc,v retrieving revision 1.5 diff -u -p -u -r1.5 view.hrc --- sfx2/source/view/view.hrc 30 Jul 2001 11:15:41 -0000 1.5 +++ sfx2/source/view/view.hrc 15 Jul 2003 11:58:12 -0000 @@ -112,6 +112,7 @@ #define MSG_CANT_CLOSE (RID_SFX_VIEW_START+42) #define TP_FRAMEPROPERTIES (RID_SFX_VIEW_START+44) +#define STR_ADDPRINTER (RID_SFX_VIEW_START+45) #define FT_FRAMENAME 3 #define ED_FRAMENAME 4 Index: sfx2/source/view/view.src =================================================================== RCS file: /cvs/framework/sfx2/source/view/view.src,v retrieving revision 1.41 diff -u -p -u -r1.41 view.src --- sfx2/source/view/view.src 22 Jul 2003 16:18:03 -0000 1.41 +++ sfx2/source/view/view.src 29 Aug 2003 14:31:34 -0000 @@ -65,6 +65,12 @@ #include "sfxlocal.hrc" // Strings --------------------------------------------------------------- +String STR_ADDPRINTER +{ + TEXT = "Drucker hinzufügen"; + TEXT [ English ] = "Add Printer"; + TEXT [ english_us ] = "Add Printer"; +}; String STR_NODEFPRINTER { TEXT = "Kein Standarddrucker gefunden.\nBitte wählen Sie einen Drucker aus und versuchen Sie es noch einmal." ;