Diffstat (limited to 'noncore/settings/tabmanager/tablistview.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/tabmanager/tablistview.h | 30 |
1 files changed, 1 insertions, 29 deletions
diff --git a/noncore/settings/tabmanager/tablistview.h b/noncore/settings/tabmanager/tablistview.h index 545ee38..97f9dec 100644 --- a/noncore/settings/tabmanager/tablistview.h +++ b/noncore/settings/tabmanager/tablistview.h | |||
@@ -1,93 +1,65 @@ | |||
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 | 1 | #ifndef TABLISTVIEW_H |
30 | #define TABLISTVIEW_H | 2 | #define TABLISTVIEW_H |
31 | 3 | ||
32 | #include <qlistview.h> | 4 | #include <qlistview.h> |
33 | #include <qcursor.h> | 5 | #include <qcursor.h> |
34 | #include <qapplication.h> | 6 | #include <qapplication.h> |
35 | 7 | ||
36 | class TabListView : public QListView { | 8 | class TabListView : public QListView { |
37 | Q_OBJECT | 9 | Q_OBJECT |
38 | 10 | ||
39 | signals: | 11 | signals: |
40 | void moveItem(QListViewItem *item, QListViewItem *newFolder); | 12 | void moveItem(QListViewItem *item, QListViewItem *newFolder); |
41 | 13 | ||
42 | public: | 14 | public: |
43 | TabListView( QWidget* parent = 0, const char* name = 0) : QListView(parent, name){ currentSelectedItem = NULL; | 15 | TabListView( QWidget* parent = 0, const char* name = 0) : QListView(parent, name){ currentSelectedItem = NULL; |
44 | connect(this, SIGNAL(pressed ( QListViewItem *)), this, SLOT(itemPressed(QListViewItem *))); | 16 | connect(this, SIGNAL(pressed ( QListViewItem *)), this, SLOT(itemPressed(QListViewItem *))); |
45 | internalCursor.setShape(0); | 17 | internalCursor.setShape(0); |
46 | }; | 18 | }; |
47 | 19 | ||
48 | protected: | 20 | protected: |
49 | void contentsMouseReleaseEvent(QMouseEvent* ){ | 21 | void contentsMouseReleaseEvent(QMouseEvent* ){ |
50 | QListViewItem *newGroup = this->currentItem(); | 22 | QListViewItem *newGroup = this->currentItem(); |
51 | // Make sure they are both real. | 23 | // Make sure they are both real. |
52 | if (currentSelectedItem == NULL || newGroup == NULL) | 24 | if (currentSelectedItem == NULL || newGroup == NULL) |
53 | return; | 25 | return; |
54 | // Make sure they are not the same | 26 | // Make sure they are not the same |
55 | if(this->isSelected(currentSelectedItem) == true) | 27 | if(this->isSelected(currentSelectedItem) == true) |
56 | return; | 28 | return; |
57 | 29 | ||
58 | // Ok we have two valid items. | 30 | // Ok we have two valid items. |
59 | if(newGroup->parent()) | 31 | if(newGroup->parent()) |
60 | newGroup = newGroup->parent(); | 32 | newGroup = newGroup->parent(); |
61 | 33 | ||
62 | // Just in case the parent was null | 34 | // Just in case the parent was null |
63 | if(newGroup == NULL) | 35 | if(newGroup == NULL) |
64 | return; | 36 | return; |
65 | 37 | ||
66 | // If the new folder and buddies current parent are the same don't do anything. | 38 | // If the new folder and buddies current parent are the same don't do anything. |
67 | if (newGroup != currentSelectedItem->parent()) | 39 | if (newGroup != currentSelectedItem->parent()) |
68 | moveItem(currentSelectedItem, newGroup); | 40 | moveItem(currentSelectedItem, newGroup); |
69 | currentSelectedItem = NULL; | 41 | currentSelectedItem = NULL; |
70 | qApp->restoreOverrideCursor(); | 42 | qApp->restoreOverrideCursor(); |
71 | }; | 43 | }; |
72 | 44 | ||
73 | private slots: | 45 | private slots: |
74 | void itemPressed(QListViewItem *item){ | 46 | void itemPressed(QListViewItem *item){ |
75 | if(item == NULL || !item->parent()){ | 47 | if(item == NULL || !item->parent()){ |
76 | if(item == NULL) | 48 | if(item == NULL) |
77 | qDebug("Item is NULL"); | 49 | qDebug("Item is NULL"); |
78 | return; | 50 | return; |
79 | } | 51 | } |
80 | 52 | ||
81 | currentSelectedItem = item; | 53 | currentSelectedItem = item; |
82 | internalCursor.setShape(13); | 54 | internalCursor.setShape(13); |
83 | qApp->setOverrideCursor(internalCursor); | 55 | qApp->setOverrideCursor(internalCursor); |
84 | }; | 56 | }; |
85 | 57 | ||
86 | 58 | ||
87 | private: | 59 | private: |
88 | QListViewItem *currentSelectedItem; | 60 | QListViewItem *currentSelectedItem; |
89 | QCursor internalCursor; | 61 | QCursor internalCursor; |
90 | }; | 62 | }; |
91 | 63 | ||
92 | #endif | 64 | #endif |
93 | 65 | ||