KFile
kurlnavigatormenu.cpp
Go to the documentation of this file.
00001 /* 00002 Copyright (C) 2009 by Rahman Duran <rahman.duran@gmail.com> 00003 00004 This library is free software; you can redistribute it and/or modify 00005 it under the terms of the GNU Library General Public License as published 00006 by the Free Software Foundation; either version 2 of the License or 00007 ( at your option ) version 3 or, at the discretion of KDE e.V. 00008 ( which shall act as a proxy as in section 14 of the GPLv3 ), any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public License 00016 along with this library; see the file COPYING.LIB. If not, write to 00017 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00018 Boston, MA 02110-1301, USA. 00019 */ 00020 00021 00022 #include "kurlnavigatormenu_p.h" 00023 00024 #include <QtGui/QKeyEvent> 00025 00026 KUrlNavigatorMenu::KUrlNavigatorMenu(QWidget* parent) : 00027 KMenu(parent) 00028 { 00029 setAcceptDrops(true); 00030 } 00031 00032 KUrlNavigatorMenu::~KUrlNavigatorMenu() 00033 { 00034 } 00035 00036 void KUrlNavigatorMenu::dragEnterEvent(QDragEnterEvent* event) 00037 { 00038 if (event->mimeData()->hasUrls()) { 00039 event->acceptProposedAction(); 00040 } 00041 } 00042 00043 void KUrlNavigatorMenu::dragMoveEvent(QDragMoveEvent* event) 00044 { 00045 QMouseEvent mouseEvent(QMouseEvent(QEvent::MouseMove, event->pos(), 00046 Qt::LeftButton, event->mouseButtons(), event->keyboardModifiers())); 00047 mouseMoveEvent(&mouseEvent); 00048 } 00049 00050 void KUrlNavigatorMenu::dropEvent(QDropEvent* event) 00051 { 00052 QAction* action = actionAt(event->pos()); 00053 if (action != 0) { 00054 emit urlsDropped(action, event); 00055 } 00056 } 00057 00058 void KUrlNavigatorMenu::mouseReleaseEvent(QMouseEvent* event) 00059 { 00060 if (event->button() == Qt::MidButton) { 00061 QAction* action = actionAt(event->pos()); 00062 if (action != 0) { 00063 emit middleMouseButtonClicked(action); 00064 } 00065 } 00066 KMenu::mouseReleaseEvent(event); 00067 } 00068 00069 #include "kurlnavigatormenu_p.moc"
KDE 4.6 API Reference