Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
KPimTextEdit
Commits
22b47f62
Commit
22b47f62
authored
Sep 19, 2021
by
Laurent Montel
😁
Browse files
Clear all menu
parent
db978ce4
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/emoticon/emoticonrecentlistview.cpp
View file @
22b47f62
...
...
@@ -5,12 +5,28 @@
*/
#include
"emoticonrecentlistview.h"
#include
<KLocalizedString>
#include
<QContextMenuEvent>
#include
<QMenu>
using
namespace
KPIMTextEdit
;
EmoticonRecentListView
::
EmoticonRecentListView
(
QWidget
*
parent
)
:
EmoticonListView
(
parent
)
{
setContextMenuPolicy
(
Qt
::
DefaultContextMenu
);
}
EmoticonRecentListView
::~
EmoticonRecentListView
()
{
}
void
EmoticonRecentListView
::
contextMenuEvent
(
QContextMenuEvent
*
event
)
{
if
(
model
()
->
rowCount
()
>
0
)
{
QMenu
menu
(
this
);
auto
clearRecent
=
new
QAction
(
i18n
(
"Clear Recents"
),
&
menu
);
connect
(
clearRecent
,
&
QAction
::
triggered
,
this
,
&
EmoticonRecentListView
::
clearAll
);
menu
.
addAction
(
clearRecent
);
menu
.
exec
(
event
->
globalPos
());
}
}
src/emoticon/emoticonrecentlistview.h
View file @
22b47f62
...
...
@@ -15,5 +15,11 @@ class KPIMTEXTEDIT_TESTS_EXPORT EmoticonRecentListView : public EmoticonListView
public:
explicit
EmoticonRecentListView
(
QWidget
*
parent
=
nullptr
);
~
EmoticonRecentListView
()
override
;
protected:
void
contextMenuEvent
(
QContextMenuEvent
*
event
)
override
;
Q_SIGNALS:
void
clearAll
();
};
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment