[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/base/print-manager
From: Daniel Nicoletti <dantti85-kde () yahoo ! com ! br>
Date: 2010-04-01 3:34:33
Message-ID: 20100401033433.07CB7AC888 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1109785 by dantti:
PrintQueue now shows the printer status message, and printd installs properly
M +1 -0 printd/CMakeLists.txt
A printd/printd.desktop
M +9 -0 printqueue/PrintQueueModel.cpp
M +2 -0 printqueue/PrintQueueModel.h
M +14 -24 printqueue/PrintQueueUi.cpp
M +0 -1 printqueue/PrintQueueUi.h
M +78 -95 printqueue/PrintQueueUi.ui
--- trunk/playground/base/print-manager/printd/CMakeLists.txt #1109784:1109785
@@ -11,3 +11,4 @@
)
install(TARGETS kded_printd DESTINATION ${PLUGIN_INSTALL_DIR})
+install(FILES printd.desktop DESTINATION ${SERVICES_INSTALL_DIR}/kded)
\ No newline at end of file
--- trunk/playground/base/print-manager/printqueue/PrintQueueModel.cpp #1109784:1109785
@@ -52,7 +52,11 @@
cups_job_t *jobs;
num_jobs = cupsGetJobs(&jobs, m_destName.toUtf8(), 0, m_whichjobs);
+ m_processingJob.clear();
for (int i = 0; i < num_jobs; i++) {
+ if (jobs[i].state == IPP_JOB_PROCESSING) {
+ m_processingJob = QString::fromUtf8(jobs[i].title);
+ }
// try to find the job row
int job_row = jobRow(jobs[i].id);
if (job_row == -1) {
@@ -298,4 +302,9 @@
return Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsDropEnabled;
}
+QString PrintQueueModel::processingJob() const
+{
+ return m_processingJob;
+}
+
#include "PrintQueueModel.moc"
--- trunk/playground/base/print-manager/printqueue/PrintQueueModel.h #1109784:1109785
@@ -54,6 +54,7 @@
} Columns;
PrintQueueModel(const QString &destName, WId parentId, QObject *parent = 0);
+ QString processingJob() const;
Qt::ItemFlags flags(const QModelIndex &index) const;
QStringList mimeTypes() const;
@@ -73,6 +74,7 @@
private:
QString m_destName;
+ QString m_processingJob;
int m_whichjobs;
bool m_showPrinterColumn;
WId m_parentId;
--- trunk/playground/base/print-manager/printqueue/PrintQueueUi.cpp #1109784:1109785
@@ -23,7 +23,7 @@
#include "PrintQueueModel.h"
#include <ConfigureDialog.h>
-#include "QCups.h"
+#include <QCups.h>
#include <cups/cups.h>
#include "PrintQueueSortFilterProxyModel.h"
@@ -35,7 +35,7 @@
#include <KMessageBox>
#include <KDebug>
-#define PRINTER_ICON_SIZE 64
+#define PRINTER_ICON_SIZE 92
PrintQueueUi::PrintQueueUi(const QString &destName, bool isClass, QWidget *parent)
: QWidget(parent),
@@ -67,6 +67,8 @@
0,
true);
+ printerStatusMsgL->setText(QString());
+
// setup the jobs model
m_model = new PrintQueueModel(destName, winId(), this);
connect(m_model, SIGNAL(dataChanged( const QModelIndex &, const QModelIndex &)),
@@ -92,11 +94,12 @@
void PrintQueueUi::setState(int state, const QString &message)
{
- kDebug() << message;
if (state != m_lastState ||
- m_lastMessage != message) {
+ printerStatusMsgL->text() != message) {
// save the last state so the ui doesn't need to keep updating
- m_lastMessage = message;
+ if (printerStatusMsgL->text() != message) {
+ printerStatusMsgL->setText(message);
+ }
m_lastState = state;
QPixmap icon(m_printerIcon);
@@ -109,21 +112,11 @@
break;
case DEST_PRINTING :
if (!m_title.isNull()) {
-// int num_jobs;
-// cups_job_t *jobs;
-// num_jobs = cupsGetJobs(&jobs, m_destName.toUtf8(), 0, CUPS_WHICHJOBS_ACTIVE);
-//
-// QString jobTitle;
-// for (int i = 0; i < num_jobs; i++) {
-// if (jobs[i].state == IPP_JOB_PROCESSING) {
-// jobTitle = QString::fromUtf8(jobs[i].title);
-// break;
-// }
-// }
- if (message.isEmpty()) {
+ QString jobTitle = m_model->processingJob();
+ if (jobTitle.isEmpty()) {
statusL->setText(i18n("Printing..."));
} else {
- statusL->setText(i18n("Printing '%1'", message));
+ statusL->setText(i18n("Printing '%1'", jobTitle));
}
pausePrinterPB->setText(i18n("Pause Printer"));
pausePrinterPB->setIcon(KIcon("media-playback-pause"));
@@ -131,11 +124,7 @@
break;
case DEST_STOPED :
m_printerPaused = true;
-// if (!message.isEmpty()) {
- statusL->setText(i18n("Printer paused, '%1'", message));
-// } else {
-// statusL->setText(i18n("Printer paused"));
-// }
+ statusL->setText(i18n("Printer paused"));
pausePrinterPB->setText(i18n("Resume Printer"));
pausePrinterPB->setIcon(KIcon("media-playback-start"));
// create a paiter to paint the action icon over the key icon
@@ -245,7 +234,8 @@
}
// get printer-state
- setState(attributes["printer-state"].toInt(), attributes["printer-state-message"].toString());
+ setState(attributes["printer-state"].toInt(),
+ attributes["printer-state-message"].toString());
// store if the printer is a class
m_isClass = attributes["printer-type"].toInt() & CUPS_PRINTER_CLASS;
--- trunk/playground/base/print-manager/printqueue/PrintQueueUi.h #1109784:1109785
@@ -71,7 +71,6 @@
QPixmap m_warningIcon;
bool m_printerPaused;
char m_lastState;
- QString m_lastMessage;
};
#endif
--- trunk/playground/base/print-manager/printqueue/PrintQueueUi.ui #1109784:1109785
@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>550</width>
- <height>272</height>
+ <height>317</height>
</rect>
</property>
<property name="minimumSize">
@@ -23,6 +23,22 @@
<property name="margin">
<number>0</number>
</property>
+ <item row="0" column="2">
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Ignored</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
<item row="0" column="0" rowspan="4">
<widget class="QLabel" name="iconL">
<property name="sizePolicy">
@@ -34,51 +50,77 @@
<property name="text">
<string>Printer Icon</string>
</property>
+ <property name="margin">
+ <number>10</number>
+ </property>
+ <property name="indent">
+ <number>0</number>
+ </property>
</widget>
</item>
- <item row="4" column="0" colspan="3">
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QPushButton" name="pausePrinterPB">
- <property name="text">
- <string>Pause Printer</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="configurePrinterPB">
- <property name="text">
- <string>Configure</string>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
+ <item row="1" column="1" colspan="3">
+ <widget class="QLabel" name="statusL">
+ <property name="font">
+ <font>
+ <pointsize>12</pointsize>
+ </font>
+ </property>
+ <property name="text">
+ <string notr="true">Printer Status</string>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
</item>
- <item row="5" column="0" colspan="3">
+ <item row="2" column="1" colspan="3">
+ <widget class="QLabel" name="printerStatusMsgL">
+ <property name="text">
+ <string notr="true">printer status message</string>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ <property name="indent">
+ <number>10</number>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1">
+ <widget class="QPushButton" name="pausePrinterPB">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Pause Printer</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="2">
+ <widget class="QPushButton" name="configurePrinterPB">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Configure</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0" colspan="4">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Jobs</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
- <property name="topMargin">
+ <property name="margin">
<number>0</number>
</property>
- <property name="bottomMargin">
- <number>0</number>
- </property>
<item row="1" column="0" colspan="7">
<widget class="QTreeView" name="jobsView">
<property name="minimumSize">
@@ -215,63 +257,6 @@
</layout>
</widget>
</item>
- <item row="0" column="1">
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::Ignored</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>0</width>
- <height>0</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="1" column="1">
- <widget class="QLabel" name="statusL">
- <property name="font">
- <font>
- <pointsize>12</pointsize>
- </font>
- </property>
- <property name="text">
- <string notr="true">Printer Status</string>
- </property>
- <property name="indent">
- <number>5</number>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QLabel" name="currentL">
- <property name="text">
- <string notr="true">Current job</string>
- </property>
- <property name="indent">
- <number>15</number>
- </property>
- </widget>
- </item>
- <item row="3" column="1">
- <spacer name="verticalSpacer_2">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::Ignored</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>0</width>
- <height>0</height>
- </size>
- </property>
- </spacer>
- </item>
</layout>
</widget>
<customwidgets>
@@ -286,8 +271,6 @@
<tabstop>cancelJobPB</tabstop>
<tabstop>holdJobPB</tabstop>
<tabstop>resumeJobPB</tabstop>
- <tabstop>pausePrinterPB</tabstop>
- <tabstop>configurePrinterPB</tabstop>
</tabstops>
<resources/>
<connections/>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic