[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/utils/filelight/src/part/radialMap
From: Martin Tobias Holmedahl Sandsmark <sandsmark () samfundet ! no>
Date: 2009-10-31 2:25:02
Message-ID: 1256955902.106156.21928.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1042913 by sandsmark:
remove the need to rescan after deleting a file. code written late and might not be \
suitable for minors, and most definitely needs some fixing.
M +1 -0 widget.cpp
M +1 -0 widget.h
M +16 -5 widgetEvents.cpp
--- trunk/playground/utils/filelight/src/part/radialMap/widget.cpp #1042912:1042913
@@ -40,6 +40,7 @@
: QWidget(parent)
, m_tree(0)
, m_focus(0)
+ , m_toBeDeleted(0)
, m_map(isSummary)
, m_rootSegment(0) //TODO we don't delete it, *shrug*
, m_isSummary(isSummary)
--- trunk/playground/utils/filelight/src/part/radialMap/widget.h #1042912:1042913
@@ -119,6 +119,7 @@
SegmentTip *m_tip;
Segment *m_rootSegment;
const bool m_isSummary;
+ const Segment *m_toBeDeleted;
};
}
--- trunk/playground/utils/filelight/src/part/radialMap/widgetEvents.cpp \
#1042912:1042913 @@ -217,8 +217,9 @@
url.populateMimeData(mimedata);
QApplication::clipboard()->setMimeData(mimedata , \
QClipboard::Clipboard); } else if (clicked == deleteItem) {
- const KUrl url = Widget::url(m_focus->file());
- const QString message = m_focus->file()->isDirectory()
+ m_toBeDeleted = m_focus;
+ const KUrl url = Widget::url(m_toBeDeleted->file());
+ const QString message = m_toBeDeleted->file()->isDirectory()
? i18n("<qt>The directory at <i>'%1'</i> \
will be <b>recursively</b> and <b>permanently</b> deleted.</qt>", \
url.prettyUrl())
: i18n("<qt><i>'%1'</i> will be \
<b>permanently</b> deleted.</qt>", url.prettyUrl());
const int userIntention = KMessageBox::warningContinueCancel(
@@ -261,9 +262,19 @@
void RadialMap::Widget::deleteJobFinished(KJob *job)
{
QApplication::restoreOverrideCursor();
- if (!job->error())
- invalidate();
- else
+ if (!job->error() && m_toBeDeleted) {
+ const Directory *dir = m_toBeDeleted->file()->parent();
+ Iterator<File> *fileIterator = 0;
+ for (Iterator<File> it = dir->iterator(); it != dir->end(); ++it) {
+ if (m_toBeDeleted->file() == (*it))
+ it.remove();
+ }
+ m_map.make(m_tree, true);
+ repaint();
+
+ //delete m_toBeDeleted->file(); // TODO: this seems to be cleaned up \
elsewhere? Make sure of it. + m_toBeDeleted = 0;
+ } else
KMessageBox::error(this, job->errorString(), i18n("Error while deleting"));
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic