00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
#include <kiconloader.h>
00023
00024
#include "konnectorbar.h"
00025
00026
using namespace KSync;
00027
00028 KonnectorState::KonnectorState(
QWidget* parent )
00029 :
QLabel( parent ) {
00030 m_state = 1;
00031 m_pix[0] = ::SmallIcon( QString::fromLatin1(
"connect_established") );
00032 m_pix[1] = ::SmallIcon( QString::fromLatin1(
"connect_no") );
00033 setPixmap( m_pix[1] );
00034 }
00035 KonnectorState::~KonnectorState() {
00036
00037 }
00038
void KonnectorState::setState(
bool b) {
00039
00040
if (b )
00041 m_state = 0;
00042
else
00043 m_state = 1;
00044
00045 setPixmap( m_pix[m_state] );
00046 }
00047
bool KonnectorState::state()const {
00048
return ( m_state != 0 );
00049 }
00050
void KonnectorState::mousePressEvent(
QMouseEvent* ) {
00051 emit clicked( state() );
00052 }
00053
00054 KonnectorBar::KonnectorBar(
QWidget* parent )
00055 :
QHBox( parent ) {
00056 m_lbl =
new KonnectorLabel(
this);
00057 m_state =
new KonnectorState(
this);
00058 connect(m_state, SIGNAL(clicked(
bool) ),
00059
this, SIGNAL(
toggled(
bool) ) );
00060 }
00061 KonnectorBar::~KonnectorBar() {
00062 }
00063 void KonnectorBar::setName(
const QString& name ) {
00064 m_lbl->setText( name );
00065 }
00066 QString KonnectorBar::name()const{
00067
return m_lbl->text();
00068 }
00069 void KonnectorBar::setState(
bool b ) {
00070 m_state->setState( b );
00071 }
00072 bool KonnectorBar::state()const {
00073
return isOn();
00074 }
00075 bool KonnectorBar::isOn()const {
00076
return m_state->state();
00077 }
00078
00079
#include "konnectorbar.moc"