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 namespace KDEPrivate 00027 { 00028 00029 KUrlNavigatorMenu::KUrlNavigatorMenu(QWidget* parent) : 00030 KMenu(parent) 00031 { 00032 setAcceptDrops(true); 00033 } 00034 00035 KUrlNavigatorMenu::~KUrlNavigatorMenu() 00036 { 00037 } 00038 00039 void KUrlNavigatorMenu::dragEnterEvent(QDragEnterEvent* event) 00040 { 00041 if (event->mimeData()->hasUrls()) { 00042 event->acceptProposedAction(); 00043 } 00044 } 00045 00046 void KUrlNavigatorMenu::dragMoveEvent(QDragMoveEvent* event) 00047 { 00048 QMouseEvent mouseEvent(QMouseEvent(QEvent::MouseMove, event->pos(), 00049 Qt::LeftButton, event->mouseButtons(), event->keyboardModifiers())); 00050 mouseMoveEvent(&mouseEvent); 00051 } 00052 00053 void KUrlNavigatorMenu::dropEvent(QDropEvent* event) 00054 { 00055 QAction* action = actionAt(event->pos()); 00056 if (action != 0) { 00057 emit urlsDropped(action, event); 00058 } 00059 } 00060 00061 void KUrlNavigatorMenu::mouseReleaseEvent(QMouseEvent* event) 00062 { 00063 if (event->button() == Qt::MidButton) { 00064 QAction* action = actionAt(event->pos()); 00065 if (action != 0) { 00066 emit middleMouseButtonClicked(action); 00067 } 00068 } 00069 KMenu::mouseReleaseEvent(event); 00070 } 00071 00072 } // namespace KDEPrivate 00073 00074 #include "kurlnavigatormenu_p.moc"
KDE 4.7 API Reference