• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

KIO

kstatusbarofflineindicator.cpp

Go to the documentation of this file.
00001 /*  This file is part of the KDE project
00002     Copyright (C) 2007 Will Stephenson <wstephenson@kde.org>
00003 
00004     This library is free software; you can redistribute it and/or
00005     modify it under the terms of the GNU Library General Public
00006     License version 2 as published by the Free Software Foundation.
00007 
00008     This library is distributed in the hope that it will be useful,
00009     but WITHOUT ANY WARRANTY; without even the implied warranty of
00010     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011     Library General Public License for more details.
00012 
00013     You should have received a copy of the GNU Library General Public License
00014     along with this library.  If not, write to the Free Software
00015     Foundation, Inc., 51 Franklin Street, Fifth Floor,
00016     Boston, MA 02110-1301, USA.
00017 
00018     As a special exception, permission is given to link this library
00019     with any edition of Qt, and distribute the resulting executable,
00020     without including the source code for Qt in the source distribution.
00021 */
00022 
00023 #include "kstatusbarofflineindicator.h"
00024 
00025 #include <QLabel>
00026 #include <QVBoxLayout>
00027 #include <kiconloader.h>
00028 #include <klocale.h>
00029 
00030 class KStatusBarOfflineIndicatorPrivate
00031 {
00032     public:
00033         KStatusBarOfflineIndicatorPrivate( KStatusBarOfflineIndicator *parent )
00034             : q(parent)
00035         {
00036         }
00037 
00038         void initialize();
00039         void _k_networkStatusChanged( Solid::Networking::Status status );
00040 
00041         KStatusBarOfflineIndicator *q;
00042 };
00043 
00044 KStatusBarOfflineIndicator::KStatusBarOfflineIndicator( QWidget * parent)
00045     : QWidget( parent),
00046       d( new KStatusBarOfflineIndicatorPrivate( this ) )
00047 {
00048     QVBoxLayout * layout = new QVBoxLayout( this );
00049     layout->setMargin( 3 );
00050     layout->setSpacing( 1 );
00051     QLabel * label = new QLabel( this );
00052     label->setPixmap( SmallIcon("network-disconnect") );
00053     label->setToolTip( i18n( "The desktop is offline" ) );
00054     layout->addWidget( label );
00055     d->initialize();
00056     connect( Solid::Networking::notifier(), SIGNAL(statusChanged(Solid::Networking::Status)),
00057              SLOT(_k_networkStatusChanged(Solid::Networking::Status)) );
00058 }
00059 
00060 KStatusBarOfflineIndicator::~KStatusBarOfflineIndicator()
00061 {
00062     delete d;
00063 }
00064 
00065 void KStatusBarOfflineIndicatorPrivate::initialize()
00066 {
00067     _k_networkStatusChanged( Solid::Networking::status());
00068 }
00069 
00070 void KStatusBarOfflineIndicatorPrivate::_k_networkStatusChanged( Solid::Networking::Status status )
00071 {
00072     if ( status == Solid::Networking::Connected || status == Solid::Networking::Unknown ) {
00073         q->hide();
00074     } else {
00075         q->show();
00076     }
00077 }
00078 
00079 #include "kstatusbarofflineindicator.moc"

KIO

Skip menu "KIO"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.7
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal