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

KDEUI

kdialogjobuidelegate.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,2007 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 "kdialogjobuidelegate.h"
00023 
00024 #include <kmessagebox.h>
00025 #include <kjob.h>
00026 #include <QPointer>
00027 #include <QWidget>
00028 
00029 #if defined Q_WS_X11
00030 #include <QX11Info>
00031 #include <netwm.h>
00032 #endif
00033 
00034 class KDialogJobUiDelegate::Private
00035 {
00036 public:
00037     Private() : userTimestamp(0) { }
00038 
00039     QPointer<QWidget> errorParentWidget;
00040     unsigned long userTimestamp;
00041 };
00042 
00043 KDialogJobUiDelegate::KDialogJobUiDelegate()
00044     : d(new Private())
00045 {
00046     d->errorParentWidget = 0L;
00047 #if defined Q_WS_X11
00048     d->userTimestamp = QX11Info::appUserTime();
00049 #endif
00050 }
00051 
00052 KDialogJobUiDelegate::~KDialogJobUiDelegate()
00053 {
00054     delete d;
00055 }
00056 
00057 void KDialogJobUiDelegate::setWindow(QWidget *window)
00058 {
00059     d->errorParentWidget = window;
00060 }
00061 
00062 QWidget *KDialogJobUiDelegate::window() const
00063 {
00064     return d->errorParentWidget;
00065 }
00066 
00067 void KDialogJobUiDelegate::updateUserTimestamp( unsigned long time )
00068 {
00069 #if defined Q_WS_X11
00070   if( d->userTimestamp == 0 || NET::timestampCompare( time, d->userTimestamp ) > 0 )
00071       d->userTimestamp = time;
00072 #endif
00073 }
00074 
00075 unsigned long KDialogJobUiDelegate::userTimestamp() const
00076 {
00077     return d->userTimestamp;
00078 }
00079 
00080 void KDialogJobUiDelegate::showErrorMessage()
00081 {
00082     if ( job()->error() != KJob::KilledJobError )
00083     {
00084         KMessageBox::queuedMessageBox( d->errorParentWidget, KMessageBox::Error, job()->errorString() );
00085     }
00086 }
00087 
00088 void KDialogJobUiDelegate::slotWarning(KJob* /*job*/, const QString &plain, const QString &/*rich*/)
00089 {
00090     if (isAutoWarningHandlingEnabled())
00091     {
00092         static uint msgBoxDisplayed = 0;
00093         if ( msgBoxDisplayed == 0 ) // don't bomb the user with message boxes, only one at a time
00094         {
00095             msgBoxDisplayed++;
00096             KMessageBox::information( d->errorParentWidget, plain );
00097             msgBoxDisplayed--;
00098         }
00099         // otherwise just discard it.
00100     }
00101 }
00102 
00103 #include "kdialogjobuidelegate.moc"

KDEUI

Skip menu "KDEUI"
  • 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
  • Kross
  • KUtils
  • Nepomuk
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.4
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