From ce4a32fe52ef09d8f5ff1dd22c001110902b60a2 Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kdeprint/kmjob.cpp | 136 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644 kdeprint/kmjob.cpp (limited to 'kdeprint/kmjob.cpp') diff --git a/kdeprint/kmjob.cpp b/kdeprint/kmjob.cpp new file mode 100644 index 000000000..665c7474f --- /dev/null +++ b/kdeprint/kmjob.cpp @@ -0,0 +1,136 @@ +/* + * This file is part of the KDE libraries + * Copyright (c) 2001 Michael Goffioul + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License version 2 as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + **/ + +#include "kmjob.h" + +#include + +KMJob::KMJob() +: KMObject() +{ + init(); +} + +KMJob::KMJob(const KMJob& j) +: KMObject() +{ + init(); + copy(j); +} + +KMJob& KMJob::operator=(const KMJob& j) +{ + init(); + copy(j); + return *this; +} + +void KMJob::init() +{ + m_ID = -1; + m_state = KMJob::Error; + m_size = m_processedsize = 0; + m_type = KMJob::System; + m_pages = m_processedpages = 0; + m_remote = false; + m_attributes.resize(1, 0); +} + +void KMJob::copy(const KMJob& j) +{ + m_ID = j.m_ID; + m_name = j.m_name; + m_printer = j.m_printer; + m_owner = j.m_owner; + m_state = j.m_state; + m_size = j.m_size; + m_uri = j.m_uri; + m_type = j.m_type; + m_pages = j.m_pages; + m_processedsize = j.m_processedsize; + m_processedpages = j.m_processedpages; + m_remote = j.m_remote; + m_attributes = j.m_attributes; + + setDiscarded(false); +} + +QString KMJob::pixmap() +{ + // special case + if (m_type == KMJob::Threaded) + return QString::fromLatin1("exec"); + + // normal case + QString str("kdeprint_job"); + switch (m_state) + { + case KMJob::Printing: + str.append("_process"); + break; + case KMJob::Held: + str.append("_stopped"); + break; + case KMJob::Error: + str.append("_error"); + break; + case KMJob::Completed: + str.append("_completed"); + break; + case KMJob::Cancelled: + str.append("_cancelled"); + break; + default: + break; + } + return str; +} + +QString KMJob::stateString() +{ + QString str; + switch (m_state) + { + case KMJob::Printing: + str = i18n("Processing..."); + break; + case KMJob::Queued: + str = i18n("Queued"); + break; + case KMJob::Held: + str = i18n("Held"); + break; + case KMJob::Error: + str = i18n("Error"); + break; + case KMJob::Cancelled: + str = i18n("Canceled"); + break; + case KMJob::Aborted: + str = i18n("Aborted"); + break; + case KMJob::Completed: + str = i18n("Completed"); + break; + default: + str = i18n("Unknown State", "Unknown"); + break; + } + return str; +} -- cgit v1.2.1