Index: ossp-pkg/as/as-gui/Makefile.in RCS File: /v/ossp/cvs/ossp-pkg/as/as-gui/Makefile.in,v rcsdiff -q -kk '-r1.41' '-r1.42' -u '/v/ossp/cvs/ossp-pkg/as/as-gui/Makefile.in,v' 2>/dev/null --- Makefile.in 2003/02/07 16:37:55 1.41 +++ Makefile.in 2003/02/08 18:10:09 1.42 @@ -72,9 +72,9 @@ TARGET_PROGS = as-gui TARGET_MANS = as-gui.1 as-gui.conf.5 -SRCS = as_main.cpp as_gui.cpp as_assist.cpp as_slot.cpp as_dataop.cpp as_except.cpp as_generic.cpp as_amount.cpp as_table.cpp as_panel.cpp as_pref.cpp as_user.cpp as_rand.cpp as_crc.cpp as_uuid.cpp as_version.cpp +SRCS = as_main.cpp as_gui.cpp as_assist.cpp as_slot.cpp as_dataop.cpp as_except.cpp as_generic.cpp as_amount.cpp as_table.cpp as_panel.cpp as_sfile.cpp as_pref.cpp as_user.cpp as_rand.cpp as_crc.cpp as_uuid.cpp as_version.cpp -OBJS = as_main.o as_gui.o as_assist.o as_slot.o as_dataop.o as_except.o as_generic.o as_amount.o as_table.o as_panel.o as_pref.o as_user.o as_rand.o as_crc.o as_uuid.o as_version.o +OBJS = as_main.o as_gui.o as_assist.o as_slot.o as_dataop.o as_except.o as_generic.o as_amount.o as_table.o as_panel.o as_sfile.o as_pref.o as_user.o as_rand.o as_crc.o as_uuid.o as_version.o GRAFX = gfx/ossplogo.xpm Index: ossp-pkg/as/as-gui/TODO RCS File: /v/ossp/cvs/ossp-pkg/as/as-gui/TODO,v rcsdiff -q -kk '-r1.81' '-r1.82' -u '/v/ossp/cvs/ossp-pkg/as/as-gui/TODO,v' 2>/dev/null --- TODO 2003/02/06 16:47:19 1.81 +++ TODO 2003/02/08 18:10:09 1.82 @@ -64,6 +64,7 @@ No need to have upd slots for non-changeable upd controls Before openDoc, closeEvent should be used instead of new code Align CRC field data to left edge of table items +Make Simplefile class non-Qt specific Screwey user notes ;-) ---------------------- Index: ossp-pkg/as/as-gui/as_sfile.cpp RCS File: /v/ossp/cvs/ossp-pkg/as/as-gui/as_sfile.cpp,v co -q -kk -p'1.1' '/v/ossp/cvs/ossp-pkg/as/as-gui/as_sfile.cpp,v' | diff -u /dev/null - -L'ossp-pkg/as/as-gui/as_sfile.cpp' 2>/dev/null --- ossp-pkg/as/as-gui/as_sfile.cpp +++ - 2025-04-18 21:42:09.636518479 +0200 @@ -0,0 +1,63 @@ +// +// OSSP asgui - Accounting system graphical user interface +// Copyright (c) 2002-2003 The OSSP Project (http://www.ossp.org/) +// Copyright (c) 2002-2003 Cable & Wireless Deutschland (http://www.cw.com/de/) +// Copyright (c) 2002-2003 Ralf S. Engelschall +// Copyright (c) 2002-2003 Michael Schloh von Bennewitz +// +// This file is part of OSSP asgui, an accounting system graphical user +// interface which can be found at http://www.ossp.org/pkg/tool/asgui/. +// +// Permission to use, copy, modify, and distribute this software for +// any purpose with or without fee is hereby granted, provided that +// the above copyright notice and this permission notice appear in all +// copies. +// +// THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED +// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +// IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +// USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// as_sfile.cpp: ISO C++ implementation +// + +#include "as_sfile.h" +#include "as_except.h" + + +// +// Serialize a backup of an incoming file object +// +void Simplefile::makeBackup(void) +{ + QFile Filein; // Input readonly file + QFile Filebak; // Backup writeonly file + QString Fname; // Filename of input file + QTextStream Streamin; // Stream to read from (Filein) + QTextStream Streambak; // Stream to write to (Filebak) + + try { + Q_ASSERT(!this->exists()); // Conditionally short circuit + Fname = this->name(); // Copy filename from original + Filein.setName(Fname); // Set filename of original + Filein.open(IO_ReadOnly); // Open original read-only + Filebak.setName(Fname + ".bak"); // Set filename of backup + Filebak.open(IO_WriteOnly); // Open backup write-only + Streamin.setDevice(&Filein); // Set incoming stream + Streambak.setDevice(&Filebak); // Set outgoing stream + Streambak << Streamin.read(); // Do actual writing + Filein.close(); // Close original + Filebak.close(); // Close backup + } + catch (Genexcept& Genex) { + Genex.reportErr(); + } +} Index: ossp-pkg/as/as-gui/as_sfile.h RCS File: /v/ossp/cvs/ossp-pkg/as/as-gui/as_sfile.h,v co -q -kk -p'1.1' '/v/ossp/cvs/ossp-pkg/as/as-gui/as_sfile.h,v' | diff -u /dev/null - -L'ossp-pkg/as/as-gui/as_sfile.h' 2>/dev/null --- ossp-pkg/as/as-gui/as_sfile.h +++ - 2025-04-18 21:42:09.639246428 +0200 @@ -0,0 +1,47 @@ +// +// OSSP asgui - Accounting system graphical user interface +// Copyright (c) 2002-2003 The OSSP Project (http://www.ossp.org/) +// Copyright (c) 2002-2003 Cable & Wireless Deutschland (http://www.cw.com/de/) +// Copyright (c) 2002-2003 Ralf S. Engelschall +// Copyright (c) 2002-2003 Michael Schloh von Bennewitz +// +// This file is part of OSSP asgui, an accounting system graphical user +// interface which can be found at http://www.ossp.org/pkg/tool/asgui/. +// +// Permission to use, copy, modify, and distribute this software for +// any purpose with or without fee is hereby granted, provided that +// the above copyright notice and this permission notice appear in all +// copies. +// +// THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED +// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +// IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +// USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. +// +// as_sfile.h: ISO C++ interface +// + +#ifndef SIMPLEFILE_H +#define SIMPLEFILE_H + +#include +#include + + +class Simplefile : public QFile +{ +public: + Simplefile(void) : QFile() {}; + Simplefile(const QString &Name) : QFile(Name) {}; + void makeBackup(void); +}; + +#endif // SIMPLEFILE_H Index: ossp-pkg/as/as-gui/as_slot.cpp RCS File: /v/ossp/cvs/ossp-pkg/as/as-gui/as_slot.cpp,v rcsdiff -q -kk '-r1.115' '-r1.116' -u '/v/ossp/cvs/ossp-pkg/as/as-gui/as_slot.cpp,v' 2>/dev/null --- as_slot.cpp 2003/02/07 16:37:55 1.115 +++ as_slot.cpp 2003/02/08 18:10:09 1.116 @@ -46,8 +46,9 @@ #include "as_generic.h" // Generic classes #include "as_uuid.h" // UUID classes #include "as_datedit.h" // Derived from QDateEdit -#include "as_crc.h" // Useful qualistring class -#include "as_panel.h" // For prefpanel class +#include "as_crc.h" // Useful Qualistring class +#include "as_panel.h" // For Prefpanel class +#include "as_sfile.h" // For Simplefile class // RPC headers #ifdef HAVE_ESOAP @@ -431,8 +432,7 @@ void Titraqform::saveFile(void) { QString Fname; - QFile Filevents, Filebak; - QTextStream Streamevents, Streambak; + Simplefile Filevents; try { Fname = *this->getFilename(); @@ -449,21 +449,9 @@ } } - Filevents.setName(Fname); // Construct a file to back up and write - - // Make a backup before overwriting - if (Filevents.exists()) { - Filevents.open(IO_ReadOnly); - Filebak.setName(Fname + ".bak"); - Filebak.open(IO_WriteOnly); - Streamevents.setDevice(&Filevents); - Streambak.setDevice(&Filebak); - Streambak << Streamevents.read(); - Filevents.close(); - Filebak.close(); - } - - this->saveData(Filevents); // Pass to helper method + Filevents.setName(Fname); // Construct a file to write + Filevents.makeBackup(); // Back up to filename.bak + this->saveData(Filevents); // Pass to helper method } catch (Genexcept& Genex) { Genex.reportErr();