Fix Kjobs appearing as empty sometimes, should be removed in kde 4.7.2

This commit is contained in:
Manuel 2011-09-11 11:05:24 +00:00
parent 85e01770d7
commit c44f21c52f
2 changed files with 112 additions and 5 deletions

View File

@ -16,7 +16,7 @@ pkgname=('kde-runtime'
arch=('i686' 'x86_64')
pkgver=${_kdever}
pkgrel=4
pkgrel=5
pkgdesc="split package"
url="http://www.kde.org"
license=('GPL' 'LGPL' 'FDL')
@ -31,20 +31,23 @@ source=($_mirror/${pkgbase}-$_kdever.tar.bz2
branding.svgz
# 01_knetattach_use_sftp.patch
# 02_oxygenify_knetattach_icon.patch
03_disable_logout_sound.patch)
03_disable_logout_sound.patch
# 04_disable_nepomuk_popups.patch
# http://chakra-project.org/sources/kde-runtime/kde-runtime-95f65b882149d398553e8934318658301c84dd29.diff
# http://chakra-project.org/sources/kde-runtime/kde-runtime-ebaf3b457b94a8be7a894b8eed81940cb7bb818f.diff)
# http://chakra-project.org/sources/kde-runtime/kde-runtime-ebaf3b457b94a8be7a894b8eed81940cb7bb818f.diff
fix-empty-jobs.patch)
md5sums=(`grep ${pkgbase}-$_kdever.tar.bz2 ../kde-sc.md5 | cut -d" " -f1`
'68cd8eb57db22c2f2ed554b721253bc2' # branding.svgz
# '45fa12b8baf21c4fc845147afcea2bc1' # 01_knetattach_use_sftp.patch
# '1f0225f31d5f44e753e966fd3a032f00' # 02_oxygenify_knetattach_icon.patch
'a434bf282ee391b2f857184be59a3b6f') # 03_disable_logout_sound.patch
'a434bf282ee391b2f857184be59a3b6f' # 03_disable_logout_sound.patch
# 'a3c844d7bbd9a31f39b1b877ae521340' # 04_disable_nepomuk_popups.patch
# '286b55c6f8d11ee960739443993bc292' # kde-runtime-95f65b882149d398553e8934318658301c84dd29.diff
# '23e58fefbe59872f346b2470e3c9973b' # kde-runtime-ebaf3b457b94a8be7a894b8eed81940cb7bb818f.diff
'bf39497d3a8ba27751d10c2d4b913a5d') # fix-empty-jobs.patch
@ -61,11 +64,16 @@ build()
patch -Np1 -i ${srcdir}/03_disable_logout_sound.patch
#patch -Np1 -i ${srcdir}/04_disable_nepomuk_popups.patch
#msg "add hotfixes ..."
msg "add hotfixes ..."
# FIXME: remove this?
# see: http://mail.kde.org/pipermail/release-team/2011-July/005149.html
#patch -Np1 -i ${srcdir}/kde-runtime-ebaf3b457b94a8be7a894b8eed81940cb7bb818f.diff
#patch -Np1 -i ${srcdir}/kde-runtime-95f65b882149d398553e8934318658301c84dd29.diff
# see: http://www.afiestas.org/two-annoying-bugs-fixed-in-kdirwatch-and-kuiserver/
patch -Np1 -i ${srcdir}/fix-empty-jobs.patch
# copy our branding stuff
cp -f ${srcdir}/branding.svgz ${srcdir}/${pkgbase}-${pkgver}/desktoptheme/oxygen/widgets/
cp -f ${srcdir}/branding.svgz ${srcdir}/${pkgbase}-${pkgver}/desktoptheme/air/widgets/

View File

@ -0,0 +1,99 @@
--- a/kuiserver/jobview.cpp
+++ b/kuiserver/jobview.cpp
@@ -32,6 +32,10 @@
JobView::JobView(uint jobId, QObject *parent)
: QObject(parent),
+ m_capabilities(-1),
+ m_percent(-1),
+ m_totalAmount(0),
+ m_processAmount(0),
m_jobId(jobId),
m_state(Running),
m_isTerminated(false),
@@ -110,6 +114,9 @@ void JobView::setTotalAmount(qulonglong
pair.second->asyncCall(QLatin1String("setTotalAmount"), amount, unit);
}
+ m_totalAmount = amount;
+ m_totalUnit = unit;
+
if (unit == "bytes") {
m_sizeTotal = amount ? KGlobal::locale()->formatByteSize(amount) : QString();
@@ -135,6 +142,9 @@ void JobView::setProcessedAmount(qulongl
pair.second->asyncCall(QLatin1String("setProcessedAmount"), amount, unit);
}
+ m_processAmount = amount;
+ m_processUnit = unit;
+
if (unit == "bytes") {
m_sizeProcessed = amount ? KGlobal::locale()->formatByteSize(amount) : QString();
@@ -316,6 +326,47 @@ void JobView::addJobContact(const QStrin
connect(client, SIGNAL(cancelRequested()), this, SIGNAL(cancelRequested()));
Q_ASSERT(!m_objectPaths.contains(address));
m_objectPaths.insert(address, pair);
+
+ //If the job already has any information, send it to the contact
+ if (m_capabilities > -1) {
+ client->asyncCall(QLatin1String("setCapabilities"), m_capabilities);
+ }
+
+ if (!m_applicationName.isEmpty()) {
+ client->asyncCall(QLatin1String("setAppName"), m_applicationName);
+ }
+
+ if (!m_appIconName.isEmpty()) {
+ client->asyncCall(QLatin1String("setAppIconName"), m_appIconName);
+ }
+
+ if (m_percent > -1) {
+ client->asyncCall(QLatin1String("setPercent"), m_percent);
+ }
+
+ if (!m_infoMessage.isEmpty()) {
+ client->asyncCall(QLatin1String("setInfoMessage"), m_infoMessage);
+ }
+
+ if (!m_descFields.isEmpty()) {
+ QHashIterator<uint, QPair <QString, QString > > i(m_descFields);
+ while (i.hasNext()) {
+ i.next();
+ client->asyncCall(QLatin1String("setDescriptionField"), i.key(), i.value().first, i.value().second);
+ }
+ }
+
+ if (m_state == Suspended) {
+ client->asyncCall(QLatin1String("setSuspended"), true);
+ }
+
+ if (m_processAmount > 0) {
+ client->asyncCall(QLatin1String("setProcessedAmount"), m_processAmount, m_processUnit);
+ }
+
+ if (m_totalAmount > 0) {
+ client->asyncCall(QLatin1String("setTotalAmount"), m_totalAmount, m_totalUnit);
+ }
}
QStringList JobView::jobContacts()
--- a/kuiserver/jobview.h
+++ b/kuiserver/jobview.h
@@ -200,6 +200,14 @@ private:
QString m_error; ///< The error message of the job, set when it's terminated
+ QString m_totalUnit; ///< The unit used in setTotalAmount
+
+ qulonglong m_totalAmount; ///< The amount used in setTotalAmount
+
+ QString m_processUnit; ///< The unit used in setProcessedAmount
+
+ qulonglong m_processAmount; ///< The processed amount (setProcessedAmount)
+
QHash<uint, QPair<QString, QString> > m_descFields;
QVariant m_destUrl;