summaryrefslogtreecommitdiff
path: root/examples/todayplugin/examplepluginwidget.cpp
blob: 10fd39a5316fbf9e1f59547e78eaa71f2c410355 (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
 * examplepluginwidget.cpp
 *
 * email       : harlekin@handhelds.org
 *
 */

#include <qpe/config.h>
#include <qpe/qcopenvelope_qws.h>

#include "examplepluginwidget.h"


ExamplePluginWidget::ExamplePluginWidget( QWidget *parent,  const char* name)
    : QWidget(parent,  name ) {

    m_exampleLabel = 0l;
    m_layout = 0l;

    if ( m_exampleLabel )  {
        delete m_exampleLabel;
    }

   // since here a OClickableLabel is used, the plugin part will be clickable, and the actions
   // that should be triggered when clicked are defined in  slotClicked()
   // of course also normal widgets can be used.
    m_exampleLabel = new Opie::Ui::OClickableLabel( this );
    connect( m_exampleLabel, SIGNAL( clicked() ), this, SLOT( slotClicked() ) );

    if ( m_layout )  {
        delete m_layout;
    }
    m_layout = new QHBoxLayout( this );
    m_layout->setAutoAdd( true );

    readConfig();
    getInfo();
}


ExamplePluginWidget::~ExamplePluginWidget() {
    delete m_exampleLabel;
    delete m_layout;
}


void ExamplePluginWidget::readConfig() {
// we dont have any config entries in this plugin
// normally this method is used after today config was used
}


void ExamplePluginWidget::refresh()  {

}

void ExamplePluginWidget::getInfo() {
    m_exampleLabel->setText(  tr("Example text")  );
}

void ExamplePluginWidget::slotClicked() {
   getInfo();
}