Release 0.4.3-3maemo with patches to disable menus/actions, add ScrollArea and fix...
[keepassx] / src / lib / AutoTypeTreeWidget.cpp
1 /***************************************************************************
2  *   Copyright (C) 2005-2008 by Tarek Saidi                                *
3  *                                                                         *
4  *   This program is free software; you can redistribute it and/or modify  *
5  *   it under the terms of the GNU General Public License as published by  *
6  *   the Free Software Foundation; version 2 of the License.               *
7  *                                                                         *
8  *   This program is distributed in the hope that it will be useful,       *
9  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
10  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
11  *   GNU General Public License for more details.                          *
12  *                                                                         *
13  *   You should have received a copy of the GNU General Public License     *
14  *   along with this program; if not, write to the                         *
15  *   Free Software Foundation, Inc.,                                       *
16  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
17  ***************************************************************************/
18
19 #include "lib/AutoTypeTreeWidget.h"
20
21 void AutoTypeTreeWidget::mouseMoveEvent(QMouseEvent* event){
22         QTreeWidgetItem* item = itemAt(event->pos());
23         if(item){
24                 setCurrentItem(item);
25                 setCursor(Qt::PointingHandCursor);
26         }
27         else {
28                 unsetCursor();
29         }
30 }
31
32 void AutoTypeTreeWidget::keyPressEvent(QKeyEvent* event){
33         if(event->key()==Qt::Key_Return || event->key()==Qt::Key_Enter){
34                 emit returnPressed(currentItem());
35                 event->accept();
36         }
37         else {
38                 QTreeWidget::keyPressEvent(event);
39         }
40 }