author | pohly <pohly> | 2005-05-05 14:39:33 (UTC) |
---|---|---|
committer | pohly <pohly> | 2005-05-05 14:39:33 (UTC) |
commit | 39fbfd5eb7e45d73d38e8a2ce9437a3d7e1b8e91 (patch) (unidiff) | |
tree | 96e66fdc18dca4d4ab8611133e072f57dea224b9 /noncore/apps/opie-reader/cbkmkselector.h | |
parent | 279fc4fd1986074acbadd3a8e86fcf3968a8dd5c (diff) | |
download | opie-39fbfd5eb7e45d73d38e8a2ce9437a3d7e1b8e91.zip opie-39fbfd5eb7e45d73d38e8a2ce9437a3d7e1b8e91.tar.gz opie-39fbfd5eb7e45d73d38e8a2ce9437a3d7e1b8e91.tar.bz2 |
new opie-reader sources with support for ArriereGo, Reb input and flite output plugins
Diffstat (limited to 'noncore/apps/opie-reader/cbkmkselector.h') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/cbkmkselector.h | 64 |
1 files changed, 55 insertions, 9 deletions
diff --git a/noncore/apps/opie-reader/cbkmkselector.h b/noncore/apps/opie-reader/cbkmkselector.h index 42951e5..ec0c6e8 100644 --- a/noncore/apps/opie-reader/cbkmkselector.h +++ b/noncore/apps/opie-reader/cbkmkselector.h | |||
@@ -5,2 +5,12 @@ | |||
5 | 5 | ||
6 | class CBkmkSelectorItem : public QListBoxText | ||
7 | { | ||
8 | int m_ref; | ||
9 | public: | ||
10 | CBkmkSelectorItem(const QString& _t, int ref) : QListBoxText(_t), m_ref(ref) | ||
11 | { | ||
12 | } | ||
13 | int reference() { return m_ref; } | ||
14 | }; | ||
15 | |||
6 | class CBkmkSelector : public QWidget | 16 | class CBkmkSelector : public QWidget |
@@ -12,3 +22,16 @@ class CBkmkSelector : public QWidget | |||
12 | QPushButton* exitButton; | 22 | QPushButton* exitButton; |
13 | 23 | /* | |
24 | void keyPressEvent ( QKeyEvent * e ) | ||
25 | { | ||
26 | if ((e->key() == Key_Return) || (e->key() == Key_Space)) | ||
27 | { | ||
28 | emit selected(reinterpret_cast<CBkmkSelectorItem*>(bkmkselector->item(bkmkselector->currentItem()))->reference()); | ||
29 | e->accept(); | ||
30 | } | ||
31 | else | ||
32 | { | ||
33 | e->ignore(); | ||
34 | } | ||
35 | } | ||
36 | */ | ||
14 | signals: | 37 | signals: |
@@ -17,5 +40,18 @@ signals: | |||
17 | private slots: | 40 | private slots: |
18 | void slotSelected(QListBoxItem* t) { emit selected(bkmkselector->index(t)); } | 41 | void slotSelected(QListBoxItem* t) |
19 | void slotSelected(int t) { emit selected(t); } | 42 | { |
43 | if (t != NULL) | ||
44 | { | ||
45 | emit selected(reinterpret_cast<CBkmkSelectorItem*>(t)->reference()); | ||
46 | } | ||
47 | } | ||
48 | //void slotSelected(int t) { emit selected(t); } | ||
20 | void slotCancel() { emit cancelled(); } | 49 | void slotCancel() { emit cancelled(); } |
50 | void slotSort() | ||
51 | { | ||
52 | bkmkselector->sort(); | ||
53 | #ifdef USEQPE | ||
54 | setCurrentItem(bkmkselector->currentItem()); | ||
55 | #endif | ||
56 | } | ||
21 | public: | 57 | public: |
@@ -29,15 +65,25 @@ public: | |||
29 | QVBoxLayout* grid = new QVBoxLayout(this); | 65 | QVBoxLayout* grid = new QVBoxLayout(this); |
30 | bkmkselector = new QListBox(this, "Bookmarks"); | 66 | QHBoxLayout* hgrid = new QHBoxLayout(); |
31 | exitButton = new QPushButton("Cancel", this); | 67 | bkmkselector = new QListBox(this, tr("Bookmarks")); |
32 | connect(bkmkselector, SIGNAL( selected(int) ), this, SLOT( slotSelected(int) ) ); | 68 | QPushButton* _sort = new QPushButton(tr("Sort"), this); |
69 | connect(_sort, SIGNAL(clicked()), this, SLOT( slotSort() ) ); | ||
70 | exitButton = new QPushButton(tr("Cancel"), this); | ||
71 | // connect(bkmkselector, SIGNAL( selected(int) ), this, SLOT( slotSelected(int) ) ); | ||
33 | connect(bkmkselector, SIGNAL( clicked(QListBoxItem*) ), this, SLOT( slotSelected(QListBoxItem*) ) ); | 72 | connect(bkmkselector, SIGNAL( clicked(QListBoxItem*) ), this, SLOT( slotSelected(QListBoxItem*) ) ); |
73 | connect(bkmkselector, SIGNAL( returnPressed(QListBoxItem*) ), this, SLOT( slotSelected(QListBoxItem*) ) ); | ||
34 | connect(exitButton, SIGNAL( clicked() ), this, SLOT( slotCancel() ) ); | 74 | connect(exitButton, SIGNAL( clicked() ), this, SLOT( slotCancel() ) ); |
35 | grid->addWidget(bkmkselector,1); | 75 | grid->addWidget(bkmkselector,1); |
36 | grid->addWidget(exitButton); | 76 | grid->addLayout(hgrid); |
77 | hgrid->addWidget(_sort); | ||
78 | hgrid->addWidget(exitButton); | ||
37 | } | 79 | } |
38 | void clear() { bkmkselector->clear(); } | 80 | void clear() { bkmkselector->clear(); } |
39 | void insertItem(const QString& item) { bkmkselector->insertItem(item); } | 81 | void insertItem(const QString& _item, int ref) |
82 | { | ||
83 | CBkmkSelectorItem* item = new CBkmkSelectorItem(_item, ref); | ||
84 | bkmkselector->insertItem(item); | ||
85 | } | ||
40 | QString text(int index) const { return bkmkselector->text(index); } | 86 | QString text(int index) const { return bkmkselector->text(index); } |
41 | void setText(const QString& _l) { exitButton->setText(_l); } | 87 | void setText(const QString& _l) { exitButton->setText(_l); } |
88 | void setCurrentItem(int _i) { bkmkselector->setCurrentItem(_i); } | ||
42 | }; | 89 | }; |
43 | |||