• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdepimlibs-4.14.10 API Reference
  • KDE Home
  • Contact Us
 

kpimutils

  • kpimutils
progressindicatorlabel.cpp
1/*
2 Copyright (c) 2013 Montel Laurent <montel@kde.org>
3
4 This library is free software; you can redistribute it and/or modify it
5 under the terms of the GNU Library General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or (at your
7 option) any later version.
8
9 This library is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12 License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 02110-1301, USA.
18*/
19
20
21#include "progressindicatorlabel.h"
22#include "progressindicatorwidget.h"
23
24#include <QHBoxLayout>
25
26namespace KPIMUtils {
27class ProgressIndicatorLabelPrivate
28{
29public:
30 ProgressIndicatorLabelPrivate(const QString &_label, ProgressIndicatorLabel *qq)
31 : labelStr(_label),
32 q(qq)
33 {
34 QHBoxLayout *lay = new QHBoxLayout;
35 lay->setMargin(0);
36 q->setLayout(lay);
37 indicator = new ProgressIndicatorWidget;
38 lay->addWidget(indicator);
39 label = new QLabel;
40 lay->addWidget(label);
41 }
42
43 ~ProgressIndicatorLabelPrivate()
44 {
45 }
46
47 void setActiveLabel(const QString &str)
48 {
49 if (indicator->isActive()) {
50 label->setText(str);
51 }
52 }
53
54 void start()
55 {
56 indicator->start();
57 label->setText(labelStr);
58 }
59
60 void stop()
61 {
62 indicator->stop();
63 label->clear();
64 }
65
66 QString labelStr;
67 QLabel *label;
68 ProgressIndicatorWidget *indicator;
69 ProgressIndicatorLabel *q;
70};
71
72ProgressIndicatorLabel::ProgressIndicatorLabel(const QString &label, QWidget *parent)
73 : QWidget(parent),
74 d(new ProgressIndicatorLabelPrivate(label, this))
75{
76}
77
78ProgressIndicatorLabel::ProgressIndicatorLabel(QWidget *parent)
79 : QWidget(parent),
80 d(new ProgressIndicatorLabelPrivate(QString(), this))
81{
82}
83
84ProgressIndicatorLabel::~ProgressIndicatorLabel()
85{
86 delete d;
87}
88
89void ProgressIndicatorLabel::start()
90{
91 d->start();
92}
93
94void ProgressIndicatorLabel::stop()
95{
96 d->stop();
97}
98
99void ProgressIndicatorLabel::setActiveLabel(const QString &label)
100{
101 d->setActiveLabel(label);
102}
103
104}
105
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Thu Jul 21 2022 00:00:00 by doxygen 1.9.5 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kpimutils

Skip menu "kpimutils"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • Modules
  • Related Pages

kdepimlibs-4.14.10 API Reference

Skip menu "kdepimlibs-4.14.10 API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
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