summaryrefslogtreecommitdiff
path: root/noncore/settings/tabmanager/tablistview.h
Unidiff
Diffstat (limited to 'noncore/settings/tabmanager/tablistview.h') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/tabmanager/tablistview.h93
1 files changed, 93 insertions, 0 deletions
diff --git a/noncore/settings/tabmanager/tablistview.h b/noncore/settings/tabmanager/tablistview.h
new file mode 100644
index 0000000..545ee38
--- a/dev/null
+++ b/noncore/settings/tabmanager/tablistview.h
@@ -0,0 +1,93 @@
1/*
2
3               =. This file is part of the OPIE Project
4             .=l. Copyright (c) 2002 Benjamin Meyer <meyerb@sharpsec.com>
5           .>+-=
6 _;:,     .>    :=|. This library is free software; you can
7.> <`_,   >  .   <= redistribute it and/or modify it under
8:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
9.="- .-=="i,     .._ License as published by the Free Software
10 - .   .-<_>     .<> Foundation; either version 2 of the License,
11     ._= =}       : or (at your option) any later version.
12    .%`+i>       _;_.
13    .i_,=:_.      -<s. This library is distributed in the hope that
14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
15    : ..    .:,     . . . without even the implied warranty of
16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
18..}^=.=       =       ; Library General Public License for more
19++=   -.     .`     .: details.
20 :     =  ...= . :.=-
21 -.   .:....=;==+<; You should have received a copy of the GNU
22  -_. . .   )=.  = Library General Public License along with
23    --        :-=` this library; see the file COPYING.LIB.
24 If not, write to the Free Software Foundation,
25 Inc., 59 Temple Place - Suite 330,
26 Boston, MA 02111-1307, USA.
27
28*/
29#ifndef TABLISTVIEW_H
30#define TABLISTVIEW_H
31
32#include <qlistview.h>
33#include <qcursor.h>
34#include <qapplication.h>
35
36class TabListView : public QListView {
37 Q_OBJECT
38
39signals:
40 void moveItem(QListViewItem *item, QListViewItem *newFolder);
41
42public:
43 TabListView( QWidget* parent = 0, const char* name = 0) : QListView(parent, name){ currentSelectedItem = NULL;
44 connect(this, SIGNAL(pressed ( QListViewItem *)), this, SLOT(itemPressed(QListViewItem *)));
45 internalCursor.setShape(0);
46 };
47
48protected:
49 void contentsMouseReleaseEvent(QMouseEvent* ){
50 QListViewItem *newGroup = this->currentItem();
51 // Make sure they are both real.
52 if (currentSelectedItem == NULL || newGroup == NULL)
53 return;
54 // Make sure they are not the same
55 if(this->isSelected(currentSelectedItem) == true)
56 return;
57
58 // Ok we have two valid items.
59 if(newGroup->parent())
60 newGroup = newGroup->parent();
61
62 // Just in case the parent was null
63 if(newGroup == NULL)
64 return;
65
66 // If the new folder and buddies current parent are the same don't do anything.
67 if (newGroup != currentSelectedItem->parent())
68 moveItem(currentSelectedItem, newGroup);
69 currentSelectedItem = NULL;
70 qApp->restoreOverrideCursor();
71};
72
73private slots:
74 void itemPressed(QListViewItem *item){
75 if(item == NULL || !item->parent()){
76 if(item == NULL)
77 qDebug("Item is NULL");
78 return;
79 }
80
81 currentSelectedItem = item;
82 internalCursor.setShape(13);
83 qApp->setOverrideCursor(internalCursor);
84};
85
86
87private:
88 QListViewItem *currentSelectedItem;
89 QCursor internalCursor;
90};
91
92#endif
93