summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-reader/cbkmkselector.h
blob: 1a70048754454354cb0acb7491c3b3777113a7c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include <qwidget.h>
#include <qlistbox.h>
#include <qpushbutton.h>
#include <qlayout.h>

class CBkmkSelector : public QWidget
{

  Q_OBJECT

  QListBox* bkmkselector;
  QPushButton* exitButton;

signals:
  void selected(int i);
  void cancelled();
private slots:
  void slotSelected(QListBoxItem* t) { emit selected(bkmkselector->index(t)); }
  void slotSelected(int t) { emit selected(t); }
  void slotCancel() { emit cancelled(); }
public:
  CBkmkSelector( QWidget *parent=0, const char *name=0, WFlags f = 0) :
	QWidget(parent, name, f)
  {

//      QFont f("unifont", 16);
//      setFont( f );

    QVBoxLayout* grid = new QVBoxLayout(this);
    bkmkselector = new QListBox(this, "Bookmarks");
    exitButton = new QPushButton("Cancel", this);
    connect(bkmkselector, SIGNAL( selected(int) ), this, SLOT( slotSelected(int) ) );
    connect(bkmkselector, SIGNAL( clicked(QListBoxItem*) ), this, SLOT( slotSelected(QListBoxItem*) ) );
    connect(exitButton, SIGNAL( released() ), this, SLOT( slotCancel() ) );
    grid->addWidget(bkmkselector,1);
    grid->addWidget(exitButton);
  }
  void clear() { bkmkselector->clear(); }
  void insertItem(const QString& item) { bkmkselector->insertItem(item); }
  QString text(int index) const { return bkmkselector->text(index); }
  void setText(const QString& _l) { exitButton->setText(_l); }
};