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

KDECore

kjobuidelegate.cpp

Go to the documentation of this file.
00001 /* This file is part of the KDE libraries
00002     Copyright (C) 2000 Stephan Kulow <coolo@kde.org>
00003                        David Faure <faure@kde.org>
00004     Copyright (C) 2006 Kevin Ottens <ervin@kde.org>
00005 
00006     This library is free software; you can redistribute it and/or
00007     modify it under the terms of the GNU Library General Public
00008     License as published by the Free Software Foundation; either
00009     version 2 of the License, or (at your option) any later version.
00010 
00011     This library is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014     Library General Public License for more details.
00015 
00016     You should have received a copy of the GNU Library General Public License
00017     along with this library; see the file COPYING.LIB.  If not, write to
00018     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019     Boston, MA 02110-1301, USA.
00020 */
00021 
00022 #include "kjobuidelegate.h"
00023 #include "kjob.h"
00024 
00025 class KJobUiDelegate::Private
00026 {
00027 public:
00028     Private(KJobUiDelegate *delegate)
00029         : q(delegate), job( 0 ),
00030           autoErrorHandling( false ),
00031           autoWarningHandling( true ) { }
00032 
00033     KJobUiDelegate * const q;
00034 
00035     KJob *job;
00036     bool autoErrorHandling : 1;
00037     bool autoWarningHandling : 1;
00038 
00039     void connectJob(KJob *job);
00040     void _k_result(KJob *job);
00041 };
00042 
00043 KJobUiDelegate::KJobUiDelegate()
00044     : QObject(), d(new Private(this))
00045 {
00046 
00047 }
00048 
00049 KJobUiDelegate::~KJobUiDelegate()
00050 {
00051     delete d;
00052 }
00053 
00054 bool KJobUiDelegate::setJob( KJob *job )
00055 {
00056     if ( d->job!=0 )
00057     {
00058         return false;
00059     }
00060 
00061     d->job = job;
00062     setParent( job );
00063 
00064     return true;
00065 }
00066 
00067 KJob *KJobUiDelegate::job()
00068 {
00069     return d->job;
00070 }
00071 
00072 void KJobUiDelegate::showErrorMessage()
00073 {
00074 }
00075 
00076 void KJobUiDelegate::setAutoErrorHandlingEnabled( bool enable)
00077 {
00078     d->autoErrorHandling = enable;
00079 }
00080 
00081 bool KJobUiDelegate::isAutoErrorHandlingEnabled() const
00082 {
00083     return d->autoErrorHandling;
00084 }
00085 
00086 void KJobUiDelegate::setAutoWarningHandlingEnabled( bool enable )
00087 {
00088     d->autoWarningHandling = enable;
00089 }
00090 
00091 bool KJobUiDelegate::isAutoWarningHandlingEnabled() const
00092 {
00093     return d->autoWarningHandling;
00094 }
00095 
00096 void KJobUiDelegate::slotWarning(KJob *job, const QString &plain,
00097                                   const QString &rich)
00098 {
00099     Q_UNUSED(job)
00100     Q_UNUSED(plain)
00101     Q_UNUSED(rich)
00102 }
00103 
00104 void KJobUiDelegate::connectJob(KJob *job)
00105 {
00106     connect(job, SIGNAL(result(KJob*)),
00107             this, SLOT(_k_result(KJob*)));
00108 
00109     connect(job, SIGNAL(warning(KJob*,QString,QString)),
00110             this, SLOT(slotWarning(KJob*,QString,QString)));
00111 }
00112 
00113 void KJobUiDelegate::Private::_k_result(KJob *job2)
00114 {
00115     Q_UNUSED(job2)
00116     if ( job->error() && autoErrorHandling )
00117         q->showErrorMessage();
00118 }
00119 
00120 #include "kjobuidelegate.moc"

KDECore

Skip menu "KDECore"
  • Main Page
  • Modules
  • 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
  • KPty
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.6.1
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