summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Kurz <[email protected]>2017-08-03 18:43:43 +0200
committerDenis Kurz <[email protected]>2017-08-21 20:02:45 +0200
commit9c883f1de2bcab1198ef03fc502afa937d72b286 (patch)
tree452e42670d5b02e6e0b71a117163cb9057668dc4
parent4d7c0948c5301f259ac21ceb46a0197fd571f706 (diff)
Move QMenu allocation from heap to stack
-rw-r--r--src/searchdialog/searchwindow.cpp40
1 files changed, 19 insertions, 21 deletions
diff --git a/src/searchdialog/searchwindow.cpp b/src/searchdialog/searchwindow.cpp
index 0d27b79..c68ec6a 100644
--- a/src/searchdialog/searchwindow.cpp
+++ b/src/searchdialog/searchwindow.cpp
@@ -771,34 +771,32 @@ void SearchWindow::slotContextMenuRequested(const QPoint &)
return;
}
- QMenu *menu = new QMenu(this);
updateContextMenuActions();
+ QMenu menu(this);
// show most used actions
- menu->addAction(mReplyAction);
- menu->addAction(mReplyAllAction);
- menu->addAction(mReplyListAction);
- menu->addAction(mForwardActionMenu);
- menu->addSeparator();
- menu->addAction(mJumpToFolderAction);
- menu->addSeparator();
+ menu.addAction(mReplyAction);
+ menu.addAction(mReplyAllAction);
+ menu.addAction(mReplyListAction);
+ menu.addAction(mForwardActionMenu);
+ menu.addSeparator();
+ menu.addAction(mJumpToFolderAction);
+ menu.addSeparator();
QAction *act = mAkonadiStandardAction->createAction(Akonadi::StandardActionManager::CopyItems);
mAkonadiStandardAction->setActionText(Akonadi::StandardActionManager::CopyItems, ki18np("Copy Message", "Copy %1 Messages"));
- menu->addAction(act);
+ menu.addAction(act);
act = mAkonadiStandardAction->createAction(Akonadi::StandardActionManager::CutItems);
mAkonadiStandardAction->setActionText(Akonadi::StandardActionManager::CutItems, ki18np("Cut Message", "Cut %1 Messages"));
- menu->addAction(act);
- menu->addAction(mAkonadiStandardAction->createAction(Akonadi::StandardActionManager::CopyItemToMenu));
- menu->addAction(mAkonadiStandardAction->createAction(Akonadi::StandardActionManager::MoveItemToMenu));
- menu->addSeparator();
- menu->addAction(mSaveAsAction);
- menu->addAction(mSaveAtchAction);
- menu->addAction(mPrintAction);
- menu->addSeparator();
- menu->addAction(mClearAction);
- menu->exec(QCursor::pos(), nullptr);
-
- delete menu;
+ menu.addAction(act);
+ menu.addAction(mAkonadiStandardAction->createAction(Akonadi::StandardActionManager::CopyItemToMenu));
+ menu.addAction(mAkonadiStandardAction->createAction(Akonadi::StandardActionManager::MoveItemToMenu));
+ menu.addSeparator();
+ menu.addAction(mSaveAsAction);
+ menu.addAction(mSaveAtchAction);
+ menu.addAction(mPrintAction);
+ menu.addSeparator();
+ menu.addAction(mClearAction);
+ menu.exec(QCursor::pos(), nullptr);
}
void SearchWindow::slotClearSelection()