Commit fe95f36a authored by Martin Tobias Holmedahl Sandsmark's avatar Martin Tobias Holmedahl Sandsmark
Browse files

fix the size stuff when deleting a file

parent 54c2df54
......@@ -24,6 +24,7 @@
#include <QtCore/QByteArray> //qstrdup
#include <QtCore/QFile> //decodeName()
#include <QtCore/QDebug>
#include <kglobal.h>
#include <klocale.h>
......@@ -232,7 +233,7 @@ public:
delete [] m_name;
}
const Folder *parent() const {
Folder *parent() const {
return m_parent;
}
const char *name8Bit() const {
......@@ -297,6 +298,16 @@ public:
{
append(new File(name, size, this));
}
/// removes a file
void remove(const File *f) {
for (Iterator<File> it = iterator(); it != end(); ++it)
if (f == (*it))
it.remove();
for (Folder *d = this; d; d = d->parent())
d->m_size -= f->size();
}
private:
void append(File *p)
......
......@@ -77,9 +77,7 @@ void RadialMap::Map::make(const Folder *tree, bool refresh)
//colour the segments
colorise();
if (!refresh) {
m_centerText = tree->humanReadableSize();
}
m_centerText = tree->humanReadableSize();
//paint the pixmap
paint();
......
......@@ -277,11 +277,8 @@ void RadialMap::Widget::deleteJobFinished(KJob *job)
{
QApplication::restoreOverrideCursor();
if (!job->error() && m_toBeDeleted) {
const Folder *dir = m_toBeDeleted->file()->parent();
for (Iterator<File> it = dir->iterator(); it != dir->end(); ++it) {
if (m_toBeDeleted->file() == (*it))
it.remove();
}
m_toBeDeleted->file()->parent()->remove(m_toBeDeleted->file());
delete m_toBeDeleted->file();
m_map.make(m_tree, true);
repaint();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment