author | mickeyl <mickeyl> | 2005-05-24 20:06:37 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2005-05-24 20:06:37 (UTC) |
commit | 2848aca68964a46fb2f786cc01a9b2583d599511 (patch) (unidiff) | |
tree | 7fb18a2e165acd069ae5cbe0fa18205b67bfdae8 /noncore/unsupported/tabmanager/tablistview.h | |
parent | 1ce0e947a999c2a98d6f6a78e69a8d1f433d7cba (diff) | |
download | opie-2848aca68964a46fb2f786cc01a9b2583d599511.zip opie-2848aca68964a46fb2f786cc01a9b2583d599511.tar.gz opie-2848aca68964a46fb2f786cc01a9b2583d599511.tar.bz2 |
tabmanager -> unsupported
Diffstat (limited to 'noncore/unsupported/tabmanager/tablistview.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/unsupported/tabmanager/tablistview.h | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/noncore/unsupported/tabmanager/tablistview.h b/noncore/unsupported/tabmanager/tablistview.h new file mode 100644 index 0000000..54b87b6 --- a/dev/null +++ b/noncore/unsupported/tabmanager/tablistview.h | |||
@@ -0,0 +1,69 @@ | |||
1 | #ifndef TABLISTVIEW_H | ||
2 | #define TABLISTVIEW_H | ||
3 | |||
4 | /* OPIE */ | ||
5 | #include <opie2/odebug.h> | ||
6 | |||
7 | /* QT */ | ||
8 | #include <qlistview.h> | ||
9 | #include <qcursor.h> | ||
10 | #include <qapplication.h> | ||
11 | |||
12 | class TabListView : public QListView { | ||
13 | Q_OBJECT | ||
14 | |||
15 | signals: | ||
16 | void moveItem(QListViewItem *item, QListViewItem *newFolder); | ||
17 | |||
18 | public: | ||
19 | TabListView( QWidget* parent = 0, const char* name = 0) : QListView(parent, name){ currentSelectedItem = NULL; | ||
20 | connect(this, SIGNAL(pressed ( QListViewItem *)), this, SLOT(itemPressed(QListViewItem *))); | ||
21 | internalCursor.setShape(0); | ||
22 | }; | ||
23 | |||
24 | protected: | ||
25 | void contentsMouseReleaseEvent(QMouseEvent* ){ | ||
26 | QListViewItem *newGroup = this->currentItem(); | ||
27 | // Make sure they are both real. | ||
28 | if (currentSelectedItem == NULL || newGroup == NULL) | ||
29 | return; | ||
30 | // Make sure they are not the same | ||
31 | if(this->isSelected(currentSelectedItem) == true) | ||
32 | return; | ||
33 | |||
34 | // Ok we have two valid items. | ||
35 | if(newGroup->parent()) | ||
36 | newGroup = newGroup->parent(); | ||
37 | |||
38 | // Just in case the parent was null | ||
39 | if(newGroup == NULL) | ||
40 | return; | ||
41 | |||
42 | // If the new folder and buddies current parent are the same don't do anything. | ||
43 | if (newGroup != currentSelectedItem->parent()) | ||
44 | moveItem(currentSelectedItem, newGroup); | ||
45 | currentSelectedItem = NULL; | ||
46 | qApp->restoreOverrideCursor(); | ||
47 | }; | ||
48 | |||
49 | private slots: | ||
50 | void itemPressed(QListViewItem *item){ | ||
51 | if(item == NULL || !item->parent()){ | ||
52 | if(item == NULL) | ||
53 | odebug << "Item is NULL" << oendl; | ||
54 | return; | ||
55 | } | ||
56 | |||
57 | currentSelectedItem = item; | ||
58 | internalCursor.setShape(13); | ||
59 | qApp->setOverrideCursor(internalCursor); | ||
60 | }; | ||
61 | |||
62 | |||
63 | private: | ||
64 | QListViewItem *currentSelectedItem; | ||
65 | QCursor internalCursor; | ||
66 | }; | ||
67 | |||
68 | #endif | ||
69 | |||