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

KDECore

  • kdecore
  • jobs
kjobuidelegate.cpp
Go to the documentation of this file.
1/* This file is part of the KDE libraries
2 Copyright (C) 2000 Stephan Kulow <coolo@kde.org>
3 David Faure <faure@kde.org>
4 Copyright (C) 2006 Kevin Ottens <ervin@kde.org>
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version.
10
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
15
16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, USA.
20*/
21
22#include "kjobuidelegate.h"
23#include "kjob.h"
24
25class KJobUiDelegate::Private
26{
27public:
28 Private(KJobUiDelegate *delegate)
29 : q(delegate), job( 0 ),
30 autoErrorHandling( false ),
31 autoWarningHandling( true ) { }
32
33 KJobUiDelegate * const q;
34
35 KJob *job;
36 bool autoErrorHandling : 1;
37 bool autoWarningHandling : 1;
38
39 void connectJob(KJob *job);
40 void _k_result(KJob *job);
41};
42
43KJobUiDelegate::KJobUiDelegate()
44 : QObject(), d(new Private(this))
45{
46
47}
48
49KJobUiDelegate::~KJobUiDelegate()
50{
51 delete d;
52}
53
54bool KJobUiDelegate::setJob( KJob *job )
55{
56 if ( d->job!=0 )
57 {
58 return false;
59 }
60
61 d->job = job;
62 setParent( job );
63
64 return true;
65}
66
67KJob *KJobUiDelegate::job()
68{
69 return d->job;
70}
71
72void KJobUiDelegate::showErrorMessage()
73{
74}
75
76void KJobUiDelegate::setAutoErrorHandlingEnabled( bool enable)
77{
78 d->autoErrorHandling = enable;
79}
80
81bool KJobUiDelegate::isAutoErrorHandlingEnabled() const
82{
83 return d->autoErrorHandling;
84}
85
86void KJobUiDelegate::setAutoWarningHandlingEnabled( bool enable )
87{
88 d->autoWarningHandling = enable;
89}
90
91bool KJobUiDelegate::isAutoWarningHandlingEnabled() const
92{
93 return d->autoWarningHandling;
94}
95
96void KJobUiDelegate::slotWarning(KJob *job, const QString &plain,
97 const QString &rich)
98{
99 Q_UNUSED(job)
100 Q_UNUSED(plain)
101 Q_UNUSED(rich)
102}
103
104void KJobUiDelegate::connectJob(KJob *job)
105{
106 connect(job, SIGNAL(result(KJob*)),
107 this, SLOT(_k_result(KJob*)));
108
109 connect(job, SIGNAL(warning(KJob*,QString,QString)),
110 this, SLOT(slotWarning(KJob*,QString,QString)));
111}
112
113void KJobUiDelegate::Private::_k_result(KJob *job2)
114{
115 Q_UNUSED(job2)
116 if ( job->error() && autoErrorHandling )
117 q->showErrorMessage();
118}
119
120#include "kjobuidelegate.moc"
KJobUiDelegate
The base class for all KJob UI delegate.
Definition: kjobuidelegate.h:40
KJobUiDelegate::isAutoErrorHandlingEnabled
bool isAutoErrorHandlingEnabled() const
Returns whether automatic error handling is enabled or disabled.
Definition: kjobuidelegate.cpp:81
KJobUiDelegate::job
KJob * job()
Retrieves the current job this UI delegate is attached to.
Definition: kjobuidelegate.cpp:67
KJobUiDelegate::isAutoWarningHandlingEnabled
bool isAutoWarningHandlingEnabled() const
Returns whether automatic warning handling is enabled or disabled.
Definition: kjobuidelegate.cpp:91
KJobUiDelegate::KJobUiDelegate
KJobUiDelegate()
Constructs a new KJobUiDelegate.
Definition: kjobuidelegate.cpp:43
KJobUiDelegate::~KJobUiDelegate
virtual ~KJobUiDelegate()
Destroys a KJobUiDelegate.
Definition: kjobuidelegate.cpp:49
KJobUiDelegate::showErrorMessage
virtual void showErrorMessage()
Display a dialog box to inform the user of the error given by this job.
Definition: kjobuidelegate.cpp:72
KJobUiDelegate::setAutoErrorHandlingEnabled
void setAutoErrorHandlingEnabled(bool enable)
Enable or disable the automatic error handling.
Definition: kjobuidelegate.cpp:76
KJobUiDelegate::slotWarning
virtual void slotWarning(KJob *job, const QString &plain, const QString &rich)
Definition: kjobuidelegate.cpp:96
KJobUiDelegate::setAutoWarningHandlingEnabled
void setAutoWarningHandlingEnabled(bool enable)
Enable or disable the automatic warning handling.
Definition: kjobuidelegate.cpp:86
KJob
The base class for all jobs.
Definition: kjob.h:85
KJob::error
int error() const
Returns the error code, if there has been an error.
Definition: kjob.cpp:220
QObject
QString
kjob.h
kjobuidelegate.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDECore

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

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 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
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
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