Commit e827a139 authored by Daniel Nicoletti's avatar Daniel Nicoletti

cleanup kded module

parent 74cc553c
......@@ -29,11 +29,9 @@
#include <KCupsRequest.h>
#include <QIcon>
#include <QtDBus/QDBusMessage>
#include <QtDBus/QDBusConnection>
#include <QtDBus/QDBusServiceWatcher>
#include <QtDBus/QDBusReply>
#include <QDBusMessage>
#include <QDBusConnection>
#include <QDBusServiceWatcher>
#include <QDBusPendingReply>
#include <QDBusPendingCallWatcher>
......@@ -145,41 +143,34 @@ bool NewPrinterNotification::registerService()
void NewPrinterNotification::configurePrinter()
{
QProcess::startDetached(QLatin1String("configure-printer"), { sender()->property(PRINTER_NAME).toString() });
}
void NewPrinterNotification::searchDrivers()
{
const QString printerName = sender()->property(PRINTER_NAME).toString();
qCDebug(PM_KDED) << "configure printer tool" << printerName;
QProcess::startDetached(QLatin1String("configure-printer"), { printerName });
}
void NewPrinterNotification::printTestPage()
{
qCDebug(PM_KDED);
QPointer<KCupsRequest> request = new KCupsRequest;
request->printTestPage(sender()->property(PRINTER_NAME).toString(), false);
request->waitTillFinished();
if (request) {
request->deleteLater();
}
const QString printerName = sender()->property(PRINTER_NAME).toString();
qCDebug(PM_KDED) << "printing test page for" << printerName;
auto request = new KCupsRequest;
connect(request, &KCupsRequest::finished, request, &KCupsRequest::deleteLater);
request->printTestPage(printerName, false);
}
void NewPrinterNotification::findDriver()
{
qCDebug(PM_KDED);
const QString printerName = sender()->property(PRINTER_NAME).toString();
qCDebug(PM_KDED) << "find driver for" << printerName;
// This function will show the PPD browser dialog
// to choose a better PPD to the already added printer
KToolInvocation::kdeinitExec(QLatin1String("kde-add-printer"), {
QLatin1String("--change-ppd"),
sender()->property(PRINTER_NAME).toString()
printerName
});
}
void NewPrinterNotification::installDriver()
{
qCDebug(PM_KDED);
}
void NewPrinterNotification::setupPrinterNotification(KNotification *notify, const QString &make, const QString &model, const QString &description, const QString &arg)
{
// name is a URI, no queue was generated, because no suitable
......
/***************************************************************************
* Copyright (C) 2010-2012 by Daniel Nicoletti *
* Copyright (C) 2010-2018 by Daniel Nicoletti *
* dantti12@gmail.com *
* *
* This program is free software; you can redistribute it and/or modify *
......@@ -21,8 +21,7 @@
#ifndef NEW_PRINTER_NOTIFICATION_H
#define NEW_PRINTER_NOTIFICATION_H
#include <QtDBus/QDBusContext>
#include <QThread>
#include <QDBusContext>
class KNotification;
class NewPrinterNotification : public QObject, protected QDBusContext
......@@ -33,25 +32,20 @@ public:
NewPrinterNotification(QObject *parent);
~NewPrinterNotification();
public slots:
public:
void GetReady();
void NewPrinter(int status, const QString &name, const QString &make, const QString &model, const QString &des, const QString &cmd);
private slots:
private:
bool registerService();
void configurePrinter();
void searchDrivers();
void printTestPage();
void findDriver();
void installDriver();
private:
void setupPrinterNotification(KNotification *notify, const QString &make, const QString &model, const QString &description, const QString &arg);
void getMissingExecutables(KNotification *notify, int status, const QString &name, const QString &ppdFileName);
void checkPrinterCurrentDriver(KNotification *notify, const QString &name);
void printerReadyNotification(KNotification *notify, const QString &name);
QThread *m_thread;
QString m_destName;
};
#endif // NEW_PRINTER_NOTIFICATION_H
......@@ -38,5 +38,4 @@ PrintManagerKded::~PrintManagerKded()
{
}
#include "moc_PrintManagerKded.cpp"
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