Commit 571fe54d authored by Daniel Nicoletti's avatar Daniel Nicoletti

Disable deprecated before Qt 5.9

parent da015547
......@@ -33,9 +33,12 @@ find_package(CUPS "1.5" REQUIRED)
find_package(KF5 REQUIRED Config ConfigWidgets CoreAddons DBusAddons IconThemes I18n KCMUtils KIO
Notifications Plasma WidgetsAddons WindowSystem)
add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0)
add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS)
add_definitions(-DQT_NO_URL_CAST_FROM_STRING)
add_definitions(
-DQT_DISABLE_DEPRECATED_BEFORE=0x050900
-DQT_USE_FAST_CONCATENATION
-DQT_USE_FAST_OPERATOR_PLUS
-DQT_NO_URL_CAST_FROM_STRING
)
remove_definitions(-DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_FROM_BYTEARRAY -DQT_NO_KEYWORDS)
......
......@@ -71,22 +71,21 @@ JobModel::JobModel(QObject *parent) :
m_jobAttributes << KCUPS_JOB_PRINTER_STATE_MESSAGE;
m_jobAttributes << KCUPS_JOB_PRESERVED;
QHash<int, QByteArray> roles = roleNames();
roles[RoleJobId] = "jobId";
roles[RoleJobState] = "jobState";
roles[RoleJobName] = "jobName";
roles[RoleJobPages] = "jobPages";
roles[RoleJobSize] = "jobSize";
roles[RoleJobOwner] = "jobOwner";
roles[RoleJobCreatedAt] = "jobCreatedAt";
roles[RoleJobIconName] = "jobIconName";
roles[RoleJobCancelEnabled] = "jobCancelEnabled";
roles[RoleJobHoldEnabled] = "jobHoldEnabled";
roles[RoleJobReleaseEnabled] = "jobReleaseEnabled";
roles[RoleJobRestartEnabled] = "jobRestartEnabled";
roles[RoleJobPrinter] = "jobPrinter";
roles[RoleJobOriginatingHostName] = "jobFrom";
setRoleNames(roles);
m_roles = QStandardItemModel::roleNames();
m_roles[RoleJobId] = "jobId";
m_roles[RoleJobState] = "jobState";
m_roles[RoleJobName] = "jobName";
m_roles[RoleJobPages] = "jobPages";
m_roles[RoleJobSize] = "jobSize";
m_roles[RoleJobOwner] = "jobOwner";
m_roles[RoleJobCreatedAt] = "jobCreatedAt";
m_roles[RoleJobIconName] = "jobIconName";
m_roles[RoleJobCancelEnabled] = "jobCancelEnabled";
m_roles[RoleJobHoldEnabled] = "jobHoldEnabled";
m_roles[RoleJobReleaseEnabled] = "jobReleaseEnabled";
m_roles[RoleJobRestartEnabled] = "jobRestartEnabled";
m_roles[RoleJobPrinter] = "jobPrinter";
m_roles[RoleJobOriginatingHostName] = "jobFrom";
// This is emitted when a job change it's state
connect(KCupsConnection::global(), &KCupsConnection::jobState, this, &JobModel::insertUpdateJob);
......@@ -514,6 +513,11 @@ bool JobModel::dropMimeData(const QMimeData *data,
return ret;
}
QHash<int, QByteArray> JobModel::roleNames() const
{
return m_roles;
}
KCupsRequest* JobModel::modifyJob(int row, JobAction action, const QString &newDestName, const QModelIndex &parent)
{
Q_UNUSED(parent)
......
......@@ -100,6 +100,7 @@ public:
int row,
int column,
const QModelIndex &parent) Q_DECL_OVERRIDE;
virtual QHash<int,QByteArray> roleNames() const override;
Q_INVOKABLE void setWhichJobs(WhichJobs whichjobs);
KCupsRequest* modifyJob(int row, JobAction action, const QString &newDestName = QString(), const QModelIndex &parent = QModelIndex());
......@@ -141,6 +142,7 @@ private:
KCupsRequest *m_jobRequest;
QString m_destName;
QString m_processingJob;
QHash<int, QByteArray> m_roles;
int m_whichjobs;
WId m_parentId;
QStringList m_jobAttributes;
......
......@@ -221,7 +221,9 @@ void KIppRequestPrivate::addRequest(ipp_tag_t group, ipp_tag_t valueTag, const Q
void KIppRequestPrivate::addRawRequestsToIpp(ipp_t *ipp) const
{
// sort the values as CUPS requires it
qSort(rawRequests.begin(), rawRequests.end(), rawRequestGroupLessThan);
std::sort(rawRequests.begin(), rawRequests.end(), [] (const KCupsRawRequest &a, const KCupsRawRequest &b) {
return a.group < b.group;
});
const QList<KCupsRawRequest> &requests = rawRequests;
for (const KCupsRawRequest &request :requests) {
......
......@@ -58,9 +58,4 @@ static const char **qStringListToCharPtrPtr(const QStringList &list, QList<QByte
return ptr;
}
bool rawRequestGroupLessThan(const KCupsRawRequest &a, const KCupsRawRequest &b)
{
return a.group < b.group;
}
#endif // KIPPREQUEST_P_H
......@@ -56,25 +56,24 @@ PrinterModel::PrinterModel(QObject *parent) :
m_attributes << KCUPS_MARKER_NAMES;
m_attributes << KCUPS_MARKER_TYPES;
QHash<int, QByteArray> roles = roleNames();
roles[DestStatus] = "stateMessage";
roles[DestName] = "printerName";
roles[DestState] = "printerState";
roles[DestIsDefault] = "isDefault";
roles[DestIsShared] = "isShared";
roles[DestIsAcceptingJobs] = "isAcceptingJobs";
roles[DestIsPaused] = "isPaused";
roles[DestIsClass] = "isClass";
roles[DestLocation] = "location";
roles[DestDescription] = "info";
roles[DestKind] = "kind";
roles[DestType] = "type";
roles[DestCommands] = "commands";
roles[DestMarkerChangeTime] = "markerChangeTime";
roles[DestMarkers] = "markers";
roles[DestIconName] = "iconName";
roles[DestRemote] = "remote";
setRoleNames(roles);
m_roles = QStandardItemModel::roleNames();
m_roles[DestStatus] = "stateMessage";
m_roles[DestName] = "printerName";
m_roles[DestState] = "printerState";
m_roles[DestIsDefault] = "isDefault";
m_roles[DestIsShared] = "isShared";
m_roles[DestIsAcceptingJobs] = "isAcceptingJobs";
m_roles[DestIsPaused] = "isPaused";
m_roles[DestIsClass] = "isClass";
m_roles[DestLocation] = "location";
m_roles[DestDescription] = "info";
m_roles[DestKind] = "kind";
m_roles[DestType] = "type";
m_roles[DestCommands] = "commands";
m_roles[DestMarkerChangeTime] = "markerChangeTime";
m_roles[DestMarkers] = "markers";
m_roles[DestIconName] = "iconName";
m_roles[DestRemote] = "remote";
// This is emitted when a printer is added
connect(KCupsConnection::global(), &KCupsConnection::printerAdded, this, &PrinterModel::insertUpdatePrinter);
......@@ -189,6 +188,11 @@ bool PrinterModel::serverUnavailable() const
return m_unavailable;
}
QHash<int, QByteArray> PrinterModel::roleNames() const
{
return m_roles;
}
void PrinterModel::pausePrinter(const QString &printerName)
{
QPointer<KCupsRequest> request = new KCupsRequest;
......
......@@ -69,6 +69,8 @@ public:
int count() const;
bool serverUnavailable() const;
virtual QHash<int,QByteArray> roleNames() const override;
Q_INVOKABLE void pausePrinter(const QString &printerName);
Q_INVOKABLE void resumePrinter(const QString &printerName);
Q_INVOKABLE void rejectJobs(const QString &printerName);
......@@ -105,6 +107,7 @@ private slots:
private:
WId m_parentId;
QStringList m_attributes;
QHash<int, QByteArray> m_roles;
bool m_unavailable;
int destRow(const QString &destName);
......
......@@ -122,18 +122,18 @@ PrintQueueUi::PrintQueueUi(const KCupsPrinter &printer, QWidget *parent) :
connect(ui->jobsView->header(), &QHeaderView::customContextMenuRequested, this, &PrintQueueUi::showHeaderContextMenu);
QHeaderView *header = ui->jobsView->header();
header->setResizeMode(QHeaderView::Interactive);
header->setSectionResizeMode(QHeaderView::Interactive);
header->setStretchLastSection(false);
header->setResizeMode(JobModel::ColStatus, QHeaderView::ResizeToContents);
header->setResizeMode(JobModel::ColName, QHeaderView::Stretch);
header->setResizeMode(JobModel::ColUser, QHeaderView::ResizeToContents);
header->setResizeMode(JobModel::ColCreated, QHeaderView::ResizeToContents);
header->setResizeMode(JobModel::ColCompleted, QHeaderView::ResizeToContents);
header->setResizeMode(JobModel::ColPages, QHeaderView::ResizeToContents);
header->setResizeMode(JobModel::ColProcessed, QHeaderView::ResizeToContents);
header->setResizeMode(JobModel::ColSize, QHeaderView::ResizeToContents);
header->setResizeMode(JobModel::ColStatusMessage, QHeaderView::ResizeToContents);
header->setResizeMode(JobModel::ColPrinter, QHeaderView::ResizeToContents);
header->setSectionResizeMode(JobModel::ColStatus, QHeaderView::ResizeToContents);
header->setSectionResizeMode(JobModel::ColName, QHeaderView::Stretch);
header->setSectionResizeMode(JobModel::ColUser, QHeaderView::ResizeToContents);
header->setSectionResizeMode(JobModel::ColCreated, QHeaderView::ResizeToContents);
header->setSectionResizeMode(JobModel::ColCompleted, QHeaderView::ResizeToContents);
header->setSectionResizeMode(JobModel::ColPages, QHeaderView::ResizeToContents);
header->setSectionResizeMode(JobModel::ColProcessed, QHeaderView::ResizeToContents);
header->setSectionResizeMode(JobModel::ColSize, QHeaderView::ResizeToContents);
header->setSectionResizeMode(JobModel::ColStatusMessage, QHeaderView::ResizeToContents);
header->setSectionResizeMode(JobModel::ColPrinter, QHeaderView::ResizeToContents);
KConfigGroup printQueue(KSharedConfig::openConfig("print-manager"), "PrintQueue");
if (printQueue.hasKey("ColumnState")) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment