summaryrefslogtreecommitdiff
path: root/src/bookmarks
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2010-05-04 09:19:16 +0200
committerAndrea Diamantini <adjam7@gmail.com>2010-05-04 09:19:16 +0200
commit7ea1b6add7ebef4d475801e15e89992e734617c1 (patch)
treea083886be1493a1616ef380e8ccad40e09e49e1f /src/bookmarks
parentFix conflicts (diff)
downloadrekonq-7ea1b6add7ebef4d475801e15e89992e734617c1.tar.xz
Memory leaks fixes
first bunch
Diffstat (limited to 'src/bookmarks')
-rw-r--r--src/bookmarks/bookmarkcontextmenu.cpp6
-rw-r--r--src/bookmarks/bookmarkcontextmenu.h3
-rw-r--r--src/bookmarks/bookmarksmanager.cpp9
-rw-r--r--src/bookmarks/bookmarkspanel.cpp9
-rw-r--r--src/bookmarks/bookmarkstreemodel.cpp2
-rw-r--r--src/bookmarks/bookmarkstreemodel.h2
6 files changed, 22 insertions, 9 deletions
diff --git a/src/bookmarks/bookmarkcontextmenu.cpp b/src/bookmarks/bookmarkcontextmenu.cpp
index df8bf5e0..47608710 100644
--- a/src/bookmarks/bookmarkcontextmenu.cpp
+++ b/src/bookmarks/bookmarkcontextmenu.cpp
@@ -49,6 +49,12 @@ BookmarkContextMenu::BookmarkContextMenu(const KBookmark & bookmark, KBookmarkMa
}
+BookmarkContextMenu::~BookmarkContextMenu()
+{
+ delete m_ac;
+}
+
+
void BookmarkContextMenu::setupActions()
{
KAction* action;
diff --git a/src/bookmarks/bookmarkcontextmenu.h b/src/bookmarks/bookmarkcontextmenu.h
index c8c903d8..ebbfd6e8 100644
--- a/src/bookmarks/bookmarkcontextmenu.h
+++ b/src/bookmarks/bookmarkcontextmenu.h
@@ -40,6 +40,8 @@ class BookmarkContextMenu : public KBookmarkContextMenu
public:
BookmarkContextMenu(const KBookmark & bk, KBookmarkManager * manager, KBookmarkOwner *owner, QWidget * parent = 0);
+ ~BookmarkContextMenu();
+
virtual void addActions();
private slots:
@@ -59,6 +61,7 @@ private:
void addFolderActions();
void addBookmarkActions();
void addSeparatorActions();
+
KActionCollection *m_ac;
};
diff --git a/src/bookmarks/bookmarksmanager.cpp b/src/bookmarks/bookmarksmanager.cpp
index 73127257..bfa8d238 100644
--- a/src/bookmarks/bookmarksmanager.cpp
+++ b/src/bookmarks/bookmarksmanager.cpp
@@ -302,6 +302,8 @@ BookmarkProvider::~BookmarkProvider()
delete m_actionCollection;
delete m_owner;
delete m_manager;
+
+ delete m_completion;
}
@@ -363,11 +365,8 @@ void BookmarkProvider::contextMenu(const QPoint &point)
if (!action)
return;
- KMenu *menu = new BookmarkContextMenu(action->bookmark(), bookmarkManager(), bookmarkOwner());
- if (!menu)
- return;
-
- menu->popup(bookmarkToolBar->mapToGlobal(point));
+ BookmarkContextMenu menu(action->bookmark(), bookmarkManager(), bookmarkOwner());
+ menu.exec(bookmarkToolBar->mapToGlobal(point));
}
diff --git a/src/bookmarks/bookmarkspanel.cpp b/src/bookmarks/bookmarkspanel.cpp
index 0f4e64b8..502af574 100644
--- a/src/bookmarks/bookmarkspanel.cpp
+++ b/src/bookmarks/bookmarkspanel.cpp
@@ -188,8 +188,13 @@ void BookmarksPanel::contextMenu(const QPoint &pos)
KBookmark selected = bookmarkForIndex(index);
- BookmarkContextMenu *menu = new BookmarkContextMenu(selected, Application::bookmarkProvider()->bookmarkManager(), Application::bookmarkProvider()->bookmarkOwner(), this);
- menu->popup(m_treeView->mapToGlobal(pos));
+ BookmarkContextMenu menu( selected,
+ Application::bookmarkProvider()->bookmarkManager(),
+ Application::bookmarkProvider()->bookmarkOwner(),
+ this
+ );
+
+ menu.exec(m_treeView->mapToGlobal(pos));
}
diff --git a/src/bookmarks/bookmarkstreemodel.cpp b/src/bookmarks/bookmarkstreemodel.cpp
index 654069c2..06732007 100644
--- a/src/bookmarks/bookmarkstreemodel.cpp
+++ b/src/bookmarks/bookmarkstreemodel.cpp
@@ -330,7 +330,7 @@ void BookmarksTreeModel::populate(BtmItem *node, KBookmarkGroup bmg)
}
-KBookmark BookmarksTreeModel::bookmarkForIndex(const QModelIndex index) const
+KBookmark BookmarksTreeModel::bookmarkForIndex(const QModelIndex &index) const
{
return static_cast<BtmItem*>(index.internalPointer())->getBkm();
}
diff --git a/src/bookmarks/bookmarkstreemodel.h b/src/bookmarks/bookmarkstreemodel.h
index d066e137..8dd0923c 100644
--- a/src/bookmarks/bookmarkstreemodel.h
+++ b/src/bookmarks/bookmarkstreemodel.h
@@ -97,7 +97,7 @@ private:
void resetModel();
void setRoot(KBookmarkGroup bmg);
void populate(BtmItem *node, KBookmarkGroup bmg);
- KBookmark bookmarkForIndex(const QModelIndex index) const;
+ KBookmark bookmarkForIndex(const QModelIndex &index) const;
};
#endif // BOOKMARKSTREEMODEL_H