summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-reader/CAnnoEdit.h
Unidiff
Diffstat (limited to 'noncore/apps/opie-reader/CAnnoEdit.h') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-reader/CAnnoEdit.h58
1 files changed, 58 insertions, 0 deletions
diff --git a/noncore/apps/opie-reader/CAnnoEdit.h b/noncore/apps/opie-reader/CAnnoEdit.h
new file mode 100644
index 0000000..3cc9f78
--- a/dev/null
+++ b/noncore/apps/opie-reader/CAnnoEdit.h
@@ -0,0 +1,58 @@
1#ifndef __CANNOEDIT_H
2#define __CANNOEDIT_H
3#include <qlabel.h>
4#include <qlayout.h>
5#include <qpushbutton.h>
6#include <qlineedit.h>
7#include <qmultilineedit.h>
8
9class CAnnoEdit : public QWidget
10{
11 Q_OBJECT
12
13 QLineEdit* m_name;
14 QMultiLineEdit* m_anno;
15 size_t m_posn;
16 public:
17 void setPosn(size_t p) { m_posn = p; }
18 size_t getPosn() { return m_posn; }
19 void setName(const QString& name)
20 {
21 m_name->setText(name);
22 }
23 void setAnno(const QString& name)
24 {
25 m_anno->setText(name);
26 m_anno->setEdited(false);
27 }
28 bool edited() { return m_anno->edited(); }
29 CAnnoEdit(QWidget *parent=0, const char *name=0, WFlags f = 0) :
30 QWidget(parent, name, f)
31 {
32 QVBoxLayout* grid = new QVBoxLayout(this);
33 m_name = new QLineEdit(this, "Name");
34 m_anno = new QMultiLineEdit(this, "Annotation");
35 QPushButton* exitButton = new QPushButton("Okay", this);
36 connect(exitButton, SIGNAL( released() ), this, SLOT( slotOkay() ) );
37 QPushButton* cancelButton = new QPushButton("Cancel", this);
38 connect(cancelButton, SIGNAL( released() ), this, SLOT( slotCancel() ) );
39 QLabel *l = new QLabel("Text",this);
40 grid->addWidget(l);
41 grid->addWidget(m_name);
42 l = new QLabel("Annotation",this);
43 grid->addWidget(l);
44 grid->addWidget(m_anno,1);
45 QHBoxLayout* hgrid = new QHBoxLayout(grid);
46 hgrid->addWidget(cancelButton);
47 hgrid->addWidget(exitButton);
48 }
49 private slots:
50 void slotOkay() { emit finished(m_name->text(), m_anno->text()); }
51 void slotCancel() { emit cancelled(); }
52 public:
53 signals:
54 void finished(const QString&, const QString&);
55 void cancelled();
56};
57
58#endif