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

KIO

  • sources
  • kde-4.12
  • kdelibs
  • kio
  • kio
kstatusbarofflineindicator.cpp
Go to the documentation of this file.
1 /* This file is part of the KDE project
2  Copyright (C) 2007 Will Stephenson <wstephenson@kde.org>
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Library General Public
6  License version 2 as published by the Free Software Foundation.
7 
8  This library is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  Library General Public License for more details.
12 
13  You should have received a copy of the GNU Library General Public License
14  along with this library. If not, write to the Free Software
15  Foundation, Inc., 51 Franklin Street, Fifth Floor,
16  Boston, MA 02110-1301, USA.
17 
18  As a special exception, permission is given to link this library
19  with any edition of Qt, and distribute the resulting executable,
20  without including the source code for Qt in the source distribution.
21 */
22 
23 #include "kstatusbarofflineindicator.h"
24 
25 #include <QLabel>
26 #include <QVBoxLayout>
27 #include <kiconloader.h>
28 #include <klocale.h>
29 
30 class KStatusBarOfflineIndicatorPrivate
31 {
32  public:
33  KStatusBarOfflineIndicatorPrivate( KStatusBarOfflineIndicator *parent )
34  : q(parent)
35  {
36  }
37 
38  void initialize();
39  void _k_networkStatusChanged( Solid::Networking::Status status );
40 
41  KStatusBarOfflineIndicator *q;
42 };
43 
44 KStatusBarOfflineIndicator::KStatusBarOfflineIndicator( QWidget * parent)
45  : QWidget( parent),
46  d( new KStatusBarOfflineIndicatorPrivate( this ) )
47 {
48  QVBoxLayout * layout = new QVBoxLayout( this );
49  layout->setMargin( 2 );
50  QLabel * label = new QLabel( this );
51  label->setPixmap( SmallIcon("network-disconnect") );
52  label->setToolTip( i18n( "The desktop is offline" ) );
53  layout->addWidget( label );
54  d->initialize();
55  connect( Solid::Networking::notifier(), SIGNAL(statusChanged(Solid::Networking::Status)),
56  SLOT(_k_networkStatusChanged(Solid::Networking::Status)) );
57 }
58 
59 KStatusBarOfflineIndicator::~KStatusBarOfflineIndicator()
60 {
61  delete d;
62 }
63 
64 void KStatusBarOfflineIndicatorPrivate::initialize()
65 {
66  _k_networkStatusChanged( Solid::Networking::status());
67 }
68 
69 void KStatusBarOfflineIndicatorPrivate::_k_networkStatusChanged( Solid::Networking::Status status )
70 {
71  if ( status == Solid::Networking::Connected || status == Solid::Networking::Unknown ) {
72  q->hide();
73  } else {
74  q->show();
75  }
76 }
77 
78 #include "kstatusbarofflineindicator.moc"
KStatusBarOfflineIndicator
Widget indicating network connection status using an icon and tooltip.
Definition: kstatusbarofflineindicator.h:42
i18n
QString i18n(const char *text)
KStatusBarOfflineIndicator::~KStatusBarOfflineIndicator
~KStatusBarOfflineIndicator()
Definition: kstatusbarofflineindicator.cpp:59
KStatusBarOfflineIndicator::KStatusBarOfflineIndicator
KStatusBarOfflineIndicator(QWidget *parent)
Default constructor.
Definition: kstatusbarofflineindicator.cpp:44
label
QString label(StandardShortcut id)
QWidget
kiconloader.h
klocale.h
kstatusbarofflineindicator.h
QLabel
SmallIcon
QPixmap SmallIcon(const QString &name, int force_size, int state, const QStringList &overlays)
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:50:03 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KIO

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

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal