[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: Re: KTar/Karchive problem
From: Albert Astals Cid <astals11 () terra ! es>
Date: 2005-04-19 21:54:00
Message-ID: 200504192354.00676.astals11 () terra ! es
[Download RAW message or body]
Anyone has anything better to suggest?
If not may i commit this patch?
Albert
A Dimarts 19 Abril 2005 22:31, Adriaan de Groot va escriure:
> On Tuesday 19 April 2005 18:12, Albert Astals Cid wrote:
> > karchive has
> > virtual void close();
> > that calls
> > virtual bool closeArchive();
> > that classes that inherit have to implement.
> >
> > The problem is that in KTar, closeArchive can fail and return false but
> > the application has no way to know, as close() is void.
> >
> > Am i wrong? Or is this a bug? If it has to be fixed can this be changed
> > in a binary compatible way?
>
> You can add a non-virtual member function closeSucceeded() and maintain the
> result of the closeArchive() call in the private data d-pointer.
["karchive.patch" (text/x-diff)]
? karchive.patch
Index: karchive.cpp
===================================================================
RCS file: /home/kde/kdelibs/kio/kio/karchive.cpp,v
retrieving revision 1.22
diff -u -r1.22 karchive.cpp
--- karchive.cpp 10 Sep 2004 19:43:59 -0000 1.22
+++ karchive.cpp 19 Apr 2005 21:52:42 -0000
@@ -53,6 +53,7 @@
{
public:
KArchiveDirectory* rootDir;
+ bool closeSucceeded;
};
class PosSortedPtrList : public QPtrList<KArchiveFile> {
@@ -110,7 +111,7 @@
return;
// moved by holger to allow kzip to write the zip central dir
// to the file in closeArchive()
- closeArchive();
+ d->closeSucceeded = closeArchive();
if ( m_dev )
m_dev->close();
@@ -120,6 +121,11 @@
m_open = false;
}
+bool KArchive::closeSucceeded()
+{
+ return d->closeSucceeded;
+}
+
const KArchiveDirectory* KArchive::directory() const
{
// rootDir isn't const so that parsing-on-demand is possible
Index: karchive.h
===================================================================
RCS file: /home/kde/kdelibs/kio/kio/karchive.h,v
retrieving revision 1.30
diff -u -r1.30 karchive.h
--- karchive.h 9 Jan 2005 08:28:37 -0000 1.30
+++ karchive.h 19 Apr 2005 21:52:43 -0000
@@ -69,6 +69,13 @@
virtual void close();
/**
+ * Use to check if close had any problem
+ * @return true if close succeded without problems
+ */
+ // TODO KDE4 merge with above
+ bool closeSucceeded();
+
+ /**
* Checks whether the archive is open.
* @return true if the archive is opened
*/
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic