-rw-r--r-- | noncore/net/opietooth/manager/rfcpopup.cpp | 81 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/rfcpopup.h | 36 |
2 files changed, 117 insertions, 0 deletions
diff --git a/noncore/net/opietooth/manager/rfcpopup.cpp b/noncore/net/opietooth/manager/rfcpopup.cpp new file mode 100644 index 0000000..1b53f4b --- a/dev/null +++ b/noncore/net/opietooth/manager/rfcpopup.cpp | |||
@@ -0,0 +1,81 @@ | |||
1 | |||
2 | #include <qtimer.h> | ||
3 | |||
4 | #include "pppdialog.h" | ||
5 | #include "rfcpopup.h" | ||
6 | |||
7 | using namespace OpieTooth; | ||
8 | |||
9 | /* | ||
10 | * c'tor init the QAction | ||
11 | */ | ||
12 | RfcCommPopup::RfcCommPopup() | ||
13 | : QPopupMenu() { | ||
14 | qWarning("RfcCommPopup c'tor"); | ||
15 | |||
16 | QAction* a; | ||
17 | |||
18 | /* connect action */ | ||
19 | a = new QAction( ); // so it's get deleted | ||
20 | a->setText("Connect"); | ||
21 | a->addTo( this ); | ||
22 | connect( a, SIGNAL( activated() ), | ||
23 | this, SLOT( slotConnect() ) ); | ||
24 | |||
25 | |||
26 | /* disconnect action */ | ||
27 | a = new QAction( ); | ||
28 | a->setText("Disconnect"); | ||
29 | a->addTo( this ); | ||
30 | connect( a, SIGNAL( activated() ) , | ||
31 | this, SLOT( slotDisconnect() ) ); | ||
32 | |||
33 | |||
34 | /* foo action */ | ||
35 | a = new QAction( ); | ||
36 | a->setText("Foo"); | ||
37 | a->addTo( this ); | ||
38 | connect( a, SIGNAL( activated() ), | ||
39 | this, SLOT( slotFoo() ) ); | ||
40 | |||
41 | |||
42 | /* bar action */ | ||
43 | a = new QAction( ); | ||
44 | a->setText( "Bar" ); | ||
45 | a->addTo( this ); | ||
46 | connect( a, SIGNAL( activated() ), | ||
47 | this, SLOT( slotBar() ) ); | ||
48 | |||
49 | }; | ||
50 | |||
51 | |||
52 | RfcCommPopup::~RfcCommPopup() { | ||
53 | /* delete m_con; | ||
54 | delete m_dis; | ||
55 | delete m_foo; | ||
56 | delete m_bar; */ | ||
57 | } | ||
58 | |||
59 | |||
60 | void RfcCommPopup::slotConnect() { | ||
61 | qWarning("connect"); | ||
62 | PPPDialog pppDialog; | ||
63 | pppDialog.showMaximized(); | ||
64 | pppDialog.exec(); | ||
65 | } | ||
66 | |||
67 | |||
68 | void RfcCommPopup::slotDisconnect() { | ||
69 | qWarning("slot disconnected"); | ||
70 | } | ||
71 | |||
72 | |||
73 | void RfcCommPopup::slotFoo() { | ||
74 | qWarning("slotFoo"); | ||
75 | } | ||
76 | |||
77 | |||
78 | void RfcCommPopup::slotBar() { | ||
79 | qWarning("slotBar"); | ||
80 | }; | ||
81 | |||
diff --git a/noncore/net/opietooth/manager/rfcpopup.h b/noncore/net/opietooth/manager/rfcpopup.h new file mode 100644 index 0000000..c388f65 --- a/dev/null +++ b/noncore/net/opietooth/manager/rfcpopup.h | |||
@@ -0,0 +1,36 @@ | |||
1 | #ifndef RFCPOPUP_H | ||
2 | #define RFCPOPUP_H | ||
3 | |||
4 | #include <qpopupmenu.h> | ||
5 | #include <qaction.h> | ||
6 | |||
7 | namespace OpieTooth { | ||
8 | /** | ||
9 | * A simple reference implementation for | ||
10 | * the popup helper factory. | ||
11 | * This class derives from QPopupMenu and uses | ||
12 | * plugged QActions to do all the nasty in it's | ||
13 | * slots. After the work is done everything must | ||
14 | * be deleted. | ||
15 | */ | ||
16 | class RfcCommPopup : public QPopupMenu { | ||
17 | Q_OBJECT | ||
18 | public: | ||
19 | RfcCommPopup(); | ||
20 | ~RfcCommPopup(); | ||
21 | |||
22 | |||
23 | private: | ||
24 | QAction* m_con; | ||
25 | QAction* m_dis; | ||
26 | QAction* m_foo; | ||
27 | QAction* m_bar; | ||
28 | private slots: | ||
29 | void slotConnect(); | ||
30 | void slotDisconnect(); | ||
31 | void slotFoo(); | ||
32 | void slotBar(); | ||
33 | }; | ||
34 | }; | ||
35 | |||
36 | #endif | ||