From a3923f8c24b80c5a686b54415fff2b27dea1ab7f Mon Sep 17 00:00:00 2001
From: hjk <qtc-committer@nokia.com>
Date: Mon, 15 Nov 2010 15:30:39 +0100
Subject: [PATCH] debugger: re-enable "Delete all breakpoints" etc

---
 src/plugins/debugger/breakhandler.cpp   |  8 ++++++++
 src/plugins/debugger/breakhandler.h     |  1 +
 src/plugins/debugger/breakwindow.cpp    | 22 +++++++++++-----------
 src/plugins/debugger/debuggerplugin.cpp |  2 +-
 4 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/src/plugins/debugger/breakhandler.cpp b/src/plugins/debugger/breakhandler.cpp
index 1230198b38a..82762209030 100644
--- a/src/plugins/debugger/breakhandler.cpp
+++ b/src/plugins/debugger/breakhandler.cpp
@@ -352,6 +352,14 @@ BreakpointId BreakHandler::findBreakpointByIndex(const QModelIndex &index) const
     return BreakpointId(-1);
 }
 
+BreakpointIds BreakHandler::findBreakpointsByIndex(const QList<QModelIndex> &list) const
+{
+    BreakpointIds ids;
+    foreach (const QModelIndex &index, list)
+        ids.append(findBreakpointByIndex(index));
+    return ids;
+}
+
 QVariant BreakHandler::data(const QModelIndex &mi, int role) const
 {
     static const QString empty = QString(QLatin1Char('-'));
diff --git a/src/plugins/debugger/breakhandler.h b/src/plugins/debugger/breakhandler.h
index 0bd8b27e3e1..3e552d9e04d 100644
--- a/src/plugins/debugger/breakhandler.h
+++ b/src/plugins/debugger/breakhandler.h
@@ -76,6 +76,7 @@ public:
     BreakpointId findWatchpointByAddress(quint64 address) const;
     BreakpointId findBreakpointByFunction(const QString &functionName) const;
     BreakpointId findBreakpointByIndex(const QModelIndex &index) const;
+    BreakpointIds findBreakpointsByIndex(const QList<QModelIndex> &list) const;
     void setWatchpointByAddress(quint64 address);
     bool hasWatchpointAt(quint64 address) const;
     void updateMarkers();
diff --git a/src/plugins/debugger/breakwindow.cpp b/src/plugins/debugger/breakwindow.cpp
index 8551ad920b8..9274d297d06 100644
--- a/src/plugins/debugger/breakwindow.cpp
+++ b/src/plugins/debugger/breakwindow.cpp
@@ -379,22 +379,22 @@ void BreakWindow::contextMenuEvent(QContextMenuEvent *ev)
 void BreakWindow::setBreakpointsEnabled(const QModelIndexList &list, bool enabled)
 {
     BreakHandler *handler = breakHandler();
-    foreach (const QModelIndex &index, list)
-        handler->setEnabled(handler->findBreakpointByIndex(index), enabled);
+    foreach (const BreakpointId id, handler->findBreakpointsByIndex(list))
+        handler->setEnabled(id, enabled);
 }
 
 void BreakWindow::setBreakpointsFullPath(const QModelIndexList &list, bool fullpath)
 {
     BreakHandler *handler = breakHandler();
-    foreach (const QModelIndex &index, list)
-       handler->setUseFullPath(handler->findBreakpointByIndex(index), fullpath);
+    foreach (const BreakpointId id, handler->findBreakpointsByIndex(list))
+       handler->setUseFullPath(id, fullpath);
 }
 
 void BreakWindow::deleteBreakpoints(const QModelIndexList &list)
 {
     BreakHandler *handler = breakHandler();
-    foreach (const QModelIndex &index, list)
-       handler->removeBreakpoint(handler->findBreakpointByIndex(index));
+    foreach (const BreakpointId id, handler->findBreakpointsByIndex(list))
+       handler->removeBreakpoint(id);
 }
 
 void BreakWindow::editBreakpoint(BreakpointId id, QWidget *parent)
@@ -416,7 +416,8 @@ void BreakWindow::editBreakpoints(const QModelIndexList &list)
     QTC_ASSERT(!list.isEmpty(), return);
 
     BreakHandler *handler = breakHandler();
-    const BreakpointId id = handler->findBreakpointByIndex(list.at(0));
+    const BreakpointIds ids = handler->findBreakpointsByIndex(list);
+    const BreakpointId id = ids.at(0);
 
     if (list.size() == 1) {
         editBreakpoint(id, this);
@@ -451,8 +452,7 @@ void BreakWindow::editBreakpoints(const QModelIndexList &list)
             && newThreadSpec == oldThreadSpec)
         return;
 
-    foreach (const QModelIndex &idx, list) {
-        BreakpointId id = handler->findBreakpointByIndex(idx);
+    foreach (const BreakpointId id, handler->findBreakpointsByIndex(list)) {
         handler->setCondition(id, newCondition.toLatin1());
         handler->setIgnoreCount(id, newIgnoreCount.toInt());
         handler->setThreadSpec(id, newThreadSpec.toLatin1());
@@ -463,8 +463,8 @@ void BreakWindow::associateBreakpoint(const QModelIndexList &list, int threadId)
 {
     BreakHandler *handler = breakHandler();
     QByteArray spec = QByteArray::number(threadId);
-    foreach (const QModelIndex &index, list)
-        handler->setThreadSpec(handler->findBreakpointByIndex(index), spec);
+    foreach (const BreakpointId id, handler->findBreakpointsByIndex(list))
+        handler->setThreadSpec(id, spec);
 }
 
 void BreakWindow::resizeColumnsToContents()
diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp
index ae064ff23db..74b68dd710f 100644
--- a/src/plugins/debugger/debuggerplugin.cpp
+++ b/src/plugins/debugger/debuggerplugin.cpp
@@ -1382,7 +1382,7 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments,
 {
     m_coreSettings = ICore::instance()->settings();
     m_debuggerSettings = new DebuggerSettings(m_coreSettings);
-    
+
     m_continuableContext = Context("Gdb.Continuable");
     m_interruptibleContext = Context("Gdb.Interruptible");
     m_undisturbableContext = Context("Gdb.Undisturbable");
-- 
GitLab