Diffstat (limited to 'examples/todayplugin/examplepluginwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | examples/todayplugin/examplepluginwidget.cpp | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/examples/todayplugin/examplepluginwidget.cpp b/examples/todayplugin/examplepluginwidget.cpp new file mode 100644 index 0000000..14f1020 --- a/dev/null +++ b/examples/todayplugin/examplepluginwidget.cpp | |||
@@ -0,0 +1,71 @@ | |||
1 | /* | ||
2 | * examplepluginwidget.cpp | ||
3 | * | ||
4 | * copyright : (c) 2004 by Maximilian Reiß | ||
5 | * email : harlekin@handhelds.org | ||
6 | * | ||
7 | */ | ||
8 | /*************************************************************************** | ||
9 | * * | ||
10 | * This program is free software; you can redistribute it and/or modify * | ||
11 | * it under the terms of the GNU General Public License as published by * | ||
12 | * the Free Software Foundation; either version 2 of the License, or * | ||
13 | * (at your option) any later version. * | ||
14 | * * | ||
15 | ***************************************************************************/ | ||
16 | |||
17 | #include <qpe/config.h> | ||
18 | #include <qpe/qcopenvelope_qws.h> | ||
19 | |||
20 | #include "examplepluginwidget.h" | ||
21 | |||
22 | ExamplePluginWidget::ExamplePluginWidget( QWidget *parent, const char* name) | ||
23 | : QWidget(parent, name ) { | ||
24 | |||
25 | m_exampleLabel = 0l; | ||
26 | m_layout = 0l; | ||
27 | |||
28 | if ( m_exampleLabel ) { | ||
29 | delete m_exampleLabel; | ||
30 | } | ||
31 | |||
32 | // since here a OClickableLabel is used, the plugin part will be clickable, and the actions | ||
33 | // that should be triggered when clicked are defined in slotClicked() | ||
34 | // of course also normal widgets can be used. | ||
35 | m_exampleLabel = new OClickableLabel( this ); | ||
36 | connect( m_exampleLabel, SIGNAL( clicked() ), this, SLOT( slotClicked() ) ); | ||
37 | |||
38 | if ( m_layout ) { | ||
39 | delete m_layout; | ||
40 | } | ||
41 | m_layout = new QHBoxLayout( this ); | ||
42 | m_layout->setAutoAdd( true ); | ||
43 | |||
44 | readConfig(); | ||
45 | getInfo(); | ||
46 | } | ||
47 | |||
48 | |||
49 | ExamplePluginWidget::~ExamplePluginWidget() { | ||
50 | delete m_exampleLabel; | ||
51 | delete m_layout; | ||
52 | } | ||
53 | |||
54 | |||
55 | void ExamplePluginWidget::readConfig() { | ||
56 | // we dont have any config entries in this plugin | ||
57 | // normally this method is used after today config was used | ||
58 | } | ||
59 | |||
60 | |||
61 | void ExamplePluginWidget::refresh() { | ||
62 | |||
63 | } | ||
64 | |||
65 | void ExamplePluginWidget::getInfo() { | ||
66 | m_exampleLabel->setText( "Example text" ); | ||
67 | } | ||
68 | |||
69 | void ExamplePluginWidget::slotClicked() { | ||
70 | getInfo(); | ||
71 | } | ||