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

KDECore

  • sources
  • kde-4.12
  • kdelibs
  • 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 
25 class KJobUiDelegate::Private
26 {
27 public:
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 
43 KJobUiDelegate::KJobUiDelegate()
44  : QObject(), d(new Private(this))
45 {
46 
47 }
48 
49 KJobUiDelegate::~KJobUiDelegate()
50 {
51  delete d;
52 }
53 
54 bool 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 
67 KJob *KJobUiDelegate::job()
68 {
69  return d->job;
70 }
71 
72 void KJobUiDelegate::showErrorMessage()
73 {
74 }
75 
76 void KJobUiDelegate::setAutoErrorHandlingEnabled( bool enable)
77 {
78  d->autoErrorHandling = enable;
79 }
80 
81 bool KJobUiDelegate::isAutoErrorHandlingEnabled() const
82 {
83  return d->autoErrorHandling;
84 }
85 
86 void KJobUiDelegate::setAutoWarningHandlingEnabled( bool enable )
87 {
88  d->autoWarningHandling = enable;
89 }
90 
91 bool KJobUiDelegate::isAutoWarningHandlingEnabled() const
92 {
93  return d->autoWarningHandling;
94 }
95 
96 void 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 
104 void 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 
113 void 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"
QString
KJobUiDelegate::KJobUiDelegate
KJobUiDelegate()
Constructs a new KJobUiDelegate.
Definition: kjobuidelegate.cpp:43
QObject
kjobuidelegate.h
KJobUiDelegate::isAutoErrorHandlingEnabled
bool isAutoErrorHandlingEnabled() const
Returns whether automatic error handling is enabled or disabled.
Definition: kjobuidelegate.cpp:81
KJobUiDelegate::isAutoWarningHandlingEnabled
bool isAutoWarningHandlingEnabled() const
Returns whether automatic warning handling is enabled or disabled.
Definition: kjobuidelegate.cpp:91
KJobUiDelegate::~KJobUiDelegate
virtual ~KJobUiDelegate()
Destroys a KJobUiDelegate.
Definition: kjobuidelegate.cpp:49
KJobUiDelegate::setAutoErrorHandlingEnabled
void setAutoErrorHandlingEnabled(bool enable)
Enable or disable the automatic error handling.
Definition: kjobuidelegate.cpp:76
KJobUiDelegate::setAutoWarningHandlingEnabled
void setAutoWarningHandlingEnabled(bool enable)
Enable or disable the automatic warning handling.
Definition: kjobuidelegate.cpp:86
KJobUiDelegate
The base class for all KJob UI delegate.
Definition: kjobuidelegate.h:39
KJobUiDelegate::slotWarning
virtual void slotWarning(KJob *job, const QString &plain, const QString &rich)
Definition: kjobuidelegate.cpp:96
KJobUiDelegate::showErrorMessage
virtual void showErrorMessage()
Display a dialog box to inform the user of the error given by this job.
Definition: kjobuidelegate.cpp:72
kjob.h
KJobUiDelegate::job
KJob * job()
Retrieves the current job this UI delegate is attached to.
Definition: kjobuidelegate.cpp:67
KJob
The base class for all jobs.
Definition: kjob.h:84
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:47:08 by doxygen 1.8.7 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 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