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

kget

  • sources
  • kde-4.12
  • kdenetwork
  • kget
  • core
job.cpp
Go to the documentation of this file.
1 /* This file is part of the KDE project
2 
3  Copyright (C) 2005 Dario Massarin <nekkar@libero.it>
4  Copyright (C) 2009 Lukas Appelhans <l.appelhans@gmx.de>
5 
6  This program is free software; you can redistribute it and/or
7  modify it under the terms of the GNU 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 
12 #include "core/job.h"
13 
14 #include "core/jobqueue.h"
15 #include "core/scheduler.h"
16 
17 #include <kdebug.h>
18 
19 Job::Job(Scheduler * scheduler, JobQueue * parent)
20  : QObject(parent),
21  m_jobQueue(parent),
22  m_scheduler(scheduler),
23  m_status(Stopped),
24  m_policy(None)
25 {
26  m_error.id = -1;
27  m_error.type = AutomaticRetry;
28 }
29 
30 Job::~Job()
31 {
32 }
33 
34 void Job::setStatus(Status jobStatus)
35 {
36  if(jobStatus == m_status)
37  return;
38  if (m_status == Aborted) {
39  m_error.id = -1;
40  m_error.text.clear();
41  m_error.pixmap = QPixmap();
42  m_error.type = AutomaticRetry;
43  }
44  m_status = jobStatus;
45  m_scheduler->jobChangedEvent(this, m_status);
46 }
47 
48 void Job::setStartStatus(Status jobStatus)
49 {
50  kDebug(5001) << "Setting start status to " << jobStatus;
51  m_startStatus = jobStatus;
52 }
53 
54 void Job::setPolicy(Policy jobPolicy)
55 {
56  if(jobPolicy == m_policy)
57  return;
58 
59  kDebug(5001) << "Job::setPolicy(" << jobPolicy << ")";
60 
61  m_policy = jobPolicy;
62  m_scheduler->jobChangedEvent(this, m_policy);
63 }
64 
65 void Job::setError(const QString &text, const QPixmap &pixmap, ErrorType type, int errorId)
66 {
67  setStatus(Job::Aborted);
68  m_error.id = errorId;
69  m_error.text = text;
70  m_error.pixmap = pixmap;
71  m_error.type = type;
72 }
73 
74 void Job::resolveError(int errorId)
75 {
76  Q_UNUSED(errorId)
77 }
Job::Error::pixmap
QPixmap pixmap
Definition: job.h:76
Scheduler
Scheduler class: what handle all the jobs in kget.
Definition: scheduler.h:32
Job::ErrorType
ErrorType
Describes different types of errors and how the scheduler should manage them.
Definition: job.h:68
Job::AutomaticRetry
Definition: job.h:69
Job::Status
Status
The status property describes the current job status.
Definition: job.h:42
Job::Error::type
ErrorType type
Definition: job.h:77
QObject
Job::Job
Job(Scheduler *scheduler, JobQueue *parent)
Definition: job.cpp:19
Job::setStartStatus
void setStartStatus(Status jobStatus)
Definition: job.cpp:48
scheduler.h
jobqueue.h
Job::setStatus
void setStatus(Status jobStatus)
Definition: job.cpp:34
Scheduler::jobChangedEvent
virtual void jobChangedEvent(Job *job, Job::Status status)
Definition: scheduler.cpp:170
Job::Policy
Policy
The policy property describes how the scheduler should manage this job.
Definition: job.h:57
Job::Error::id
int id
Definition: job.h:74
Job::Aborted
The job is stopped.
Definition: job.h:45
Job::~Job
virtual ~Job()
Definition: job.cpp:30
job.h
Job::m_scheduler
Scheduler * m_scheduler
Definition: job.h:119
Job::setPolicy
void setPolicy(Policy jobPolicy)
Definition: job.cpp:54
JobQueue
Definition: jobqueue.h:32
Job::resolveError
virtual void resolveError(int errorId)
Definition: job.cpp:74
Job::Error::text
QString text
Definition: job.h:75
Job::setError
void setError(const QString &text, const QPixmap &pixmap, ErrorType type=AutomaticRetry, int errorId=-1)
Definition: job.cpp:65
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:53:17 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kget

Skip menu "kget"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdenetwork API Reference

Skip menu "kdenetwork API Reference"
  • kget
  • kopete
  •   kopete
  •   libkopete
  • krdc
  • krfb

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