1 | /* |
2 | Copyright (C) 2009 by Rahman Duran <rahman.duran@gmail.com> |
3 | |
4 | This library is free software; you can redistribute it and/or modify |
5 | it under the terms of the GNU Library General Public License as published |
6 | by the Free Software Foundation; either version 2 of the License or |
7 | ( at your option ) version 3 or, at the discretion of KDE e.V. |
8 | ( which shall act as a proxy as in section 14 of the GPLv3 ), any later version. |
9 | |
10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. |
14 | |
15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
18 | Boston, MA 02110-1301, USA. |
19 | */ |
20 | |
21 | |
22 | #include "kurlnavigatormenu_p.h" |
23 | |
24 | #include <QtGui/QKeyEvent> |
25 | |
26 | namespace KDEPrivate |
27 | { |
28 | |
29 | KUrlNavigatorMenu::(QWidget* parent) : |
30 | KMenu(parent) |
31 | { |
32 | setAcceptDrops(true); |
33 | } |
34 | |
35 | KUrlNavigatorMenu::() |
36 | { |
37 | } |
38 | |
39 | void KUrlNavigatorMenu::(QDragEnterEvent* event) |
40 | { |
41 | if (event->mimeData()->hasUrls()) { |
42 | event->acceptProposedAction(); |
43 | } |
44 | } |
45 | |
46 | void KUrlNavigatorMenu::(QDragMoveEvent* event) |
47 | { |
48 | QMouseEvent mouseEvent(QMouseEvent(QEvent::MouseMove, event->pos(), |
49 | Qt::LeftButton, event->mouseButtons(), event->keyboardModifiers())); |
50 | mouseMoveEvent(&mouseEvent); |
51 | } |
52 | |
53 | void KUrlNavigatorMenu::(QDropEvent* event) |
54 | { |
55 | QAction* action = actionAt(event->pos()); |
56 | if (action != 0) { |
57 | emit urlsDropped(action, event); |
58 | } |
59 | } |
60 | |
61 | void KUrlNavigatorMenu::(QMouseEvent* event) |
62 | { |
63 | if (event->button() == Qt::MidButton) { |
64 | QAction* action = actionAt(event->pos()); |
65 | if (action != 0) { |
66 | emit middleMouseButtonClicked(action); |
67 | } |
68 | } |
69 | KMenu::mouseReleaseEvent(event); |
70 | } |
71 | |
72 | } // namespace KDEPrivate |
73 | |
74 | #include "kurlnavigatormenu_p.moc" |
75 | |