Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit d019fa1f authored by Daniel Nicoletti's avatar Daniel Nicoletti

Add QT_NO_CAST_FROM_ASCII definition

parent be54a009
......@@ -39,9 +39,10 @@ add_definitions(
-DQT_USE_FAST_OPERATOR_PLUS
-DQT_NO_URL_CAST_FROM_STRING
-DQT_NO_CAST_FROM_BYTEARRAY
-DQT_NO_CAST_FROM_ASCII
)
remove_definitions(-DQT_NO_CAST_FROM_ASCII -DQT_NO_KEYWORDS)
remove_definitions(-DQT_NO_KEYWORDS)
# Generate config.h
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake
......
......@@ -44,7 +44,7 @@ AddPrinterAssistant::AddPrinterAssistant() :
m_addPrinterPage(0)
{
setWindowTitle(i18nc("@title:window", "Add a New Printer"));
setWindowIcon(QIcon::fromTheme("printer"));
setWindowIcon(QIcon::fromTheme(QLatin1String("printer")));
buttonBox()->removeButton(buttonBox()->button(QDialogButtonBox::Cancel));
// Needed so we have our dialog size saved
setAttribute(Qt::WA_DeleteOnClose);
......@@ -58,20 +58,20 @@ AddPrinterAssistant::AddPrinterAssistant() :
// Setup the busy cursor
m_busySeq = new KPixmapSequenceOverlayPainter(this);
m_busySeq->setSequence(KIconLoader::global()->loadPixmapSequence("process-working", KIconLoader::SizeSmallMedium));
m_busySeq->setSequence(KIconLoader::global()->loadPixmapSequence(QLatin1String("process-working"), KIconLoader::SizeSmallMedium));
m_busySeq->setAlignment(Qt::AlignHCenter | Qt::AlignBottom);
m_busySeq->setWidget(helpButton);
connect(finishButton(), &QPushButton::clicked, this, &AddPrinterAssistant::slotFinishButtonClicked);
// Restore the dialog size
KConfigGroup configGroup(KSharedConfig::openConfig("print-manager"), "AddPrinterAssistant");
KConfigGroup configGroup(KSharedConfig::openConfig(QLatin1String("print-manager")), "AddPrinterAssistant");
KWindowConfig::restoreWindowSize(windowHandle(), configGroup);
}
AddPrinterAssistant::~AddPrinterAssistant()
{
KConfigGroup configGroup(KSharedConfig::openConfig("print-manager"), "AddPrinterAssistant");
KConfigGroup configGroup(KSharedConfig::openConfig(QLatin1String("print-manager")), "AddPrinterAssistant");
KWindowConfig::saveWindowSize(windowHandle(), configGroup);
}
......
......@@ -28,7 +28,7 @@
ChooseSerial::ChooseSerial(QWidget *parent) :
GenericPage(parent),
ui(new Ui::ChooseSerial),
m_rx("\\?baud=(\\d+)"),
m_rx(QLatin1String("\\?baud=(\\d+)")),
m_isValid(false)
{
ui->setupUi(this);
......@@ -36,14 +36,14 @@ ChooseSerial::ChooseSerial(QWidget *parent) :
// setup default options
setWindowTitle(i18nc("@title:window", "Select a Printer to Add"));
ui->parityCB->addItem(i18nc("@label:listbox", "None"), "none");
ui->parityCB->addItem(i18nc("@label:listbox", "Even"), "even");
ui->parityCB->addItem(i18nc("@label:listbox", "Odd"), "odd");
ui->parityCB->addItem(i18nc("@label:listbox", "None"), QLatin1String("none"));
ui->parityCB->addItem(i18nc("@label:listbox", "Even"), QLatin1String("even"));
ui->parityCB->addItem(i18nc("@label:listbox", "Odd"), QLatin1String("odd"));
ui->flowCB->addItem(i18nc("@label:listbox", "None"), "none");
ui->flowCB->addItem(i18nc("@label:listbox", "XON/XOFF (Software)"), "soft");
ui->flowCB->addItem(i18nc("@label:listbox", "RTS/CTS (Hardware)"), "hard");
ui->flowCB->addItem(i18nc("@label:listbox", "DTR/DSR (Hardware)"), "dtrdsr");
ui->flowCB->addItem(i18nc("@label:listbox", "None"), QLatin1String("none"));
ui->flowCB->addItem(i18nc("@label:listbox", "XON/XOFF (Software)"), QLatin1String("soft"));
ui->flowCB->addItem(i18nc("@label:listbox", "RTS/CTS (Hardware)"), QLatin1String("hard"));
ui->flowCB->addItem(i18nc("@label:listbox", "DTR/DSR (Hardware)"), QLatin1String("dtrdsr"));
}
ChooseSerial::~ChooseSerial()
......@@ -113,7 +113,8 @@ QVariantHash ChooseSerial::values() const
QString bits = ui->bitsCB->currentText();
QString parity = ui->baudRateCB->itemData(ui->baudRateCB->currentIndex()).toString();
QString flow = ui->flowCB->itemData(ui->flowCB->currentIndex()).toString();
QString replace = QString("?baud=%1+bits=%2+parity=%3+flow=%4").arg(baudRate, bits, parity, flow);
QString replace = QString::fromLatin1("?baud=%1+bits=%2+parity=%3+flow=%4")
.arg(baudRate, bits, parity, flow);
deviceUri.replace(pos, deviceUri.size() - pos, replace);
ret[KCUPS_DEVICE_URI] = deviceUri;
return ret;
......
......@@ -32,7 +32,7 @@ ChooseUri::ChooseUri(QWidget *parent) :
{
ui->setupUi(this);
ui->searchTB->setIcon(QIcon::fromTheme("edit-find"));
ui->searchTB->setIcon(QIcon::fromTheme(QLatin1String("edit-find")));
// setup default options
setWindowTitle(i18nc("@title:window", "Select a Printer to Add"));
......@@ -145,7 +145,7 @@ void ChooseUri::getPrintersFinished(KCupsRequest *request)
if (request->hasError()) {
emit errorMessage(request->errorMsg());
} else {
emit insertDevice("network",
emit insertDevice(QLatin1String("network"),
url.authority(),
url.authority(),
QString(),
......
......@@ -35,7 +35,7 @@
DevicesModel::DevicesModel(QObject *parent)
: QStandardItemModel(parent),
m_request(0),
m_rx("[a-z]+://.*")
m_rx(QLatin1String("[a-z]+://.*"))
{
qDBusRegisterMetaType<MapSS>();
qDBusRegisterMetaType<MapSMapSS>();
......@@ -49,11 +49,11 @@ DevicesModel::DevicesModel(QObject *parent)
m_blacklistedURIs << QLatin1String("delete");
// Adds the other device which is meant for manual URI input
insertDevice("other",
insertDevice(QLatin1String("other"),
QString(),
i18nc("@item", "Manual URI"),
QString(),
"other",
QLatin1String("other"),
QString());
}
......
......@@ -25,9 +25,9 @@
#include <QHash>
#include <QVariant>
#define ADDING_PRINTER "add-new-printer"
#define PPD_NAME "ppd-name"
#define FILENAME "filename"
#define ADDING_PRINTER QLatin1String("add-new-printer")
#define PPD_NAME QLatin1String("ppd-name")
#define FILENAME QLatin1String("filename")
class GenericPage : public QWidget
{
......
......@@ -40,14 +40,14 @@ PageAddPrinter::PageAddPrinter(QWidget *parent) :
setWindowTitle(i18nc("@title:window", "Select a Printer to Add"));
// loads the standard key icon
QPixmap pixmap;
pixmap = KIconLoader::global()->loadIcon("printer",
pixmap = KIconLoader::global()->loadIcon(QLatin1String("printer"),
KIconLoader::NoGroup,
KIconLoader::SizeEnormous, // a not so huge icon
KIconLoader::DefaultState);
QPixmap icon(pixmap);
QPainter painter(&icon);
pixmap = KIconLoader::global()->loadIcon("dialog-information",
pixmap = KIconLoader::global()->loadIcon(QLatin1String("dialog-information"),
KIconLoader::NoGroup,
KIconLoader::SizeLarge, // a not so huge icon
KIconLoader::DefaultState);
......@@ -61,7 +61,7 @@ PageAddPrinter::PageAddPrinter(QWidget *parent) :
ui->printerL->setPixmap(icon);
// May contain any printable characters except "/", "#", and space
QRegExp rx("[^/#\\ ]*");
QRegExp rx(QLatin1String("[^/#\\ ]*"));
auto validator = new QRegExpValidator(rx, this);
ui->nameLE->setValidator(validator);
......
......@@ -39,14 +39,14 @@ PageChoosePrinters::PageChoosePrinters(const QVariantHash &args, QWidget *parent
setWindowTitle(i18nc("@title:window", "Select a Printer to Add"));
// loads the standard key icon
QPixmap pixmap;
pixmap = KIconLoader::global()->loadIcon("printer",
pixmap = KIconLoader::global()->loadIcon(QLatin1String("printer"),
KIconLoader::NoGroup,
KIconLoader::SizeEnormous, // a not so huge icon
KIconLoader::DefaultState);
QPixmap icon(pixmap);
QPainter painter(&icon);
pixmap = KIconLoader::global()->loadIcon("preferences-other",
pixmap = KIconLoader::global()->loadIcon(QLatin1String("preferences-other"),
KIconLoader::NoGroup,
KIconLoader::SizeLarge, // a not so huge icon
KIconLoader::DefaultState);
......
......@@ -32,16 +32,16 @@
int main(int argc, char **argv)
{
AddPrinter app(argc, argv);
app.setOrganizationDomain("org.kde");
app.setOrganizationDomain(QLatin1String("org.kde"));
KAboutData about("kde-add-printer",
KAboutData about(QLatin1String("kde-add-printer"),
i18n("Add Printer"),
PM_VERSION,
QLatin1String(PM_VERSION),
i18n("Tool for adding new printers"),
KAboutLicense::GPL,
i18n("(C) 2010-2018 Daniel Nicoletti"));
about.addAuthor(i18n("Daniel Nicoletti"), QString(), "dantti12@gmail.com");
about.addAuthor(QLatin1String("Daniel Nicoletti"), QString(), QLatin1String("dantti12@gmail.com"));
about.addAuthor(QStringLiteral("Lukáš Tinkl"), i18n("Port to Qt 5 / Plasma 5"), QStringLiteral("ltinkl@redhat.com"));
KAboutData::setApplicationData(about);
......@@ -49,29 +49,39 @@ int main(int argc, char **argv)
about.setupCommandLine(&parser);
parser.addVersionOption();
parser.addHelpOption();
parser.addOption(QCommandLineOption({"w", "parent-window"}, i18n("Parent Window ID"), "wid"));
parser.addOption(QCommandLineOption("add-printer", i18n("Add a new printer")));
parser.addOption(QCommandLineOption("add-class", i18n("Add a new printer class")));
parser.addOption(QCommandLineOption("change-ppd", i18n("Changes the PPD of a given printer"), "printer-name"));
parser.addOption(QCommandLineOption("new-printer-from-device", i18n("Changes the PPD of a given printer/deviceid"),
"printername/deviceid"));
QCommandLineOption parentWindowOpt({QLatin1String("w"), QLatin1String("parent-window")}, i18n("Parent Window ID"), QLatin1String("wid"));
parser.addOption(parentWindowOpt);
QCommandLineOption addPrinterOpt(QLatin1String("add-printer"), i18n("Add a new printer"));
parser.addOption(addPrinterOpt);
QCommandLineOption addClassOpt(QLatin1String("add-class"), i18n("Add a new printer class"));
parser.addOption(addClassOpt);
QCommandLineOption changePpdOpt(QLatin1String("change-ppd"), i18n("Changes the PPD of a given printer"), QLatin1String("printer-name"));
parser.addOption(changePpdOpt);
QCommandLineOption newPrinterDevOpt(QLatin1String("new-printer-from-device"), i18n("Changes the PPD of a given printer/deviceid"),
QLatin1String("printername/deviceid"));
parser.addOption(newPrinterDevOpt);
parser.process(app);
about.processCommandLine(&parser);
qulonglong wid = 0;
if (parser.isSet("w")) {
wid = parser.value("parent-window").toULongLong();
if (parser.isSet(parentWindowOpt)) {
wid = parser.value(parentWindowOpt).toULongLong();
}
if (parser.isSet("add-printer")) {
if (parser.isSet(addPrinterOpt)) {
app.addPrinter(wid);
} else if (parser.isSet("add-class")) {
} else if (parser.isSet(addClassOpt)) {
app.addClass(wid);
} else if (parser.isSet("change-ppd")) {
app.changePPD(wid, parser.value("change-ppd"));
} else if (parser.isSet("new-printer-from-device")) {
const QString value = parser.value("new-printer-from-device");
} else if (parser.isSet(changePpdOpt)) {
app.changePPD(wid, parser.value(changePpdOpt));
} else if (parser.isSet(newPrinterDevOpt)) {
const QString value = parser.value(newPrinterDevOpt);
const QStringList values = value.split(QLatin1String("/"));
if (values.size() == 2) {
app.newPrinterFromDevice(wid, values.first(), values.last());
......
......@@ -47,7 +47,7 @@ ConfigureDialog::ConfigureDialog(const QString &destName, bool isClass, QWidget
setModal(false);
setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel | QDialogButtonBox::Apply);
setWindowTitle(destName);
setWindowIcon(QIcon::fromTheme("configure"));
setWindowIcon(QIcon::fromTheme(QLatin1String("configure")));
enableButtonApply(false);
// Needed so we have our dialog size saved
setAttribute(Qt::WA_DeleteOnClose);
......@@ -101,7 +101,7 @@ ConfigureDialog::ConfigureDialog(const QString &destName, bool isClass, QWidget
modifyPrinter->setValues(printer);
page = new KPageWidgetItem(modifyPrinter, i18n("Modify Printer"));
page->setHeader(i18n("Configure"));
page->setIcon(QIcon::fromTheme("dialog-information"));
page->setIcon(QIcon::fromTheme(QLatin1String("dialog-information")));
// CONNECT this signal ONLY to the first Page
connect(modifyPrinter, &ModifyPrinter::changed, this, &ConfigureDialog::enableButtonApply);
addPage(page);
......@@ -112,7 +112,7 @@ ConfigureDialog::ConfigureDialog(const QString &destName, bool isClass, QWidget
printerOptions = new PrinterOptions(destName, isClass, isRemote, this);
page = new KPageWidgetItem(printerOptions, i18n("Printer Options"));
page->setHeader(i18n("Set the Default Printer Options"));
page->setIcon(QIcon::fromTheme("view-pim-tasks"));
page->setIcon(QIcon::fromTheme(QLatin1String("view-pim-tasks")));
addPage(page);
connect(modifyPrinter, &ModifyPrinter::ppdChanged, this, &ConfigureDialog::ppdChanged);
modifyPrinter->setCurrentMake(printerOptions->currentMake());
......@@ -123,13 +123,13 @@ ConfigureDialog::ConfigureDialog(const QString &destName, bool isClass, QWidget
printerBehavior->setValues(printer);
page = new KPageWidgetItem(printerBehavior, i18n("Banners, Policies and Allowed Users"));
page->setHeader(i18n("Banners, Policies and Allowed Users"));
page->setIcon(QIcon::fromTheme("feed-subscribe"));
page->setIcon(QIcon::fromTheme(QLatin1String("feed-subscribe")));
addPage(page);
// connect this after ALL pages were added, otherwise the slot will be called
connect(this, &ConfigureDialog::currentPageChanged, this, &ConfigureDialog::currentPageChanged);
KConfigGroup group(KSharedConfig::openConfig("print-manager"), "ConfigureDialog");
KConfigGroup group(KSharedConfig::openConfig(QLatin1String("print-manager")), "ConfigureDialog");
KWindowConfig::restoreWindowSize(windowHandle(), group);
connect(buttonBox(), &QDialogButtonBox::clicked, this, &ConfigureDialog::slotButtonClicked);
......@@ -144,7 +144,7 @@ void ConfigureDialog::ppdChanged()
ConfigureDialog::~ConfigureDialog()
{
KConfigGroup group(KSharedConfig::openConfig("print-manager"), "ConfigureDialog");
KConfigGroup group(KSharedConfig::openConfig(QLatin1String("print-manager")), "ConfigureDialog");
KWindowConfig::saveWindowSize(windowHandle(), group);
}
......
......@@ -36,12 +36,12 @@ ConfigurePrinterInterface::ConfigurePrinterInterface(QObject *parent) :
{
qCDebug(PM_CONFIGURE_PRINTER) << "Creating Helper";
(void) new ConfigurePrinterAdaptor(this);
if (!QDBusConnection::sessionBus().registerService("org.kde.ConfigurePrinter")) {
if (!QDBusConnection::sessionBus().registerService(QLatin1String("org.kde.ConfigurePrinter"))) {
qCDebug(PM_CONFIGURE_PRINTER) << "another helper is already running";
return;
}
if (!QDBusConnection::sessionBus().registerObject("/", this)) {
if (!QDBusConnection::sessionBus().registerObject(QLatin1String("/"), this)) {
qCDebug(PM_CONFIGURE_PRINTER) << "unable to register service interface to dbus";
return;
}
......
......@@ -77,12 +77,12 @@ void ModifyPrinter::on_makeCB_activated(int index)
return;
} else if (ui->makeCB->itemData(index).toUInt() == PPDFile) {
// set the QVariant type to bool makes it possible to know a file was selected
m_changedValues["ppd-name"] = true;
m_changedValues[QLatin1String("ppd-name")] = true;
} else if (ui->makeCB->itemData(index).toUInt() == PPDDefault) {
isDifferent = false;
m_changedValues.remove("ppd-name");
m_changedValues.remove(QLatin1String("ppd-name"));
} else if (ui->makeCB->itemData(index).toUInt() == PPDCustom) {
m_changedValues["ppd-name"] = ui->makeCB->itemData(index, PPDName).toString();
m_changedValues[QLatin1String("ppd-name")] = ui->makeCB->itemData(index, PPDName).toString();
} else {
qCWarning(PM_CONFIGURE_PRINTER) << "This should not happen";
return;
......@@ -212,11 +212,11 @@ void ModifyPrinter::save()
QVariantHash args = m_changedValues;
QString fileName;
qCDebug(PM_CONFIGURE_PRINTER) << args;
if (args.contains("ppd-name") &&
args["ppd-name"].type() == QVariant::Bool) {
if (args.contains(QLatin1String("ppd-name")) &&
args[QLatin1String("ppd-name")].type() == QVariant::Bool) {
fileName = ui->makeCB->itemData(ui->makeCB->currentIndex(), PPDFile).toString();
args.remove("ppd-name");
args.remove(QLatin1String("ppd-name"));
}
qCDebug(PM_CONFIGURE_PRINTER) << fileName;
......@@ -229,7 +229,7 @@ void ModifyPrinter::save()
request->waitTillFinished();
if (request) {
if (!request->hasError()) {
if (m_changedValues.contains("ppd-name")) {
if (m_changedValues.contains(QLatin1String("ppd-name"))) {
emit ppdChanged();
}
request->getPrinterAttributes(m_destName, m_isClass, neededValues());
......
......@@ -188,7 +188,7 @@ void PrinterBehavior::currentIndexChangedCB(int index)
QString attribute = comboBox->property("AttributeName").toString();
QVariant value;
// job-sheets-default has always two values
if (attribute == "job-sheets-default") {
if (attribute == QLatin1String("job-sheets-default")) {
QStringList values;
values << ui->startingBannerCB->itemData(ui->startingBannerCB->currentIndex()).toString();
values << ui->endingBannerCB->itemData(ui->endingBannerCB->currentIndex()).toString();
......@@ -208,13 +208,13 @@ void PrinterBehavior::currentIndexChangedCB(int index)
QString PrinterBehavior::errorPolicyString(const QString &policy) const
{
// TODO search for others policies of printer-error-policy-supported
if (policy == "abort-job") {
if (policy == QLatin1String("abort-job")) {
return i18n("Abort job");
} else if (policy == "retry-current-job") {
} else if (policy == QLatin1String("retry-current-job")) {
return i18n("Retry current job");
} else if (policy == "retry-job") {
} else if (policy == QLatin1String("retry-job")) {
return i18n("Retry job");
} else if (policy == "stop-printer") {
} else if (policy == QLatin1String("stop-printer")) {
return i18n("Stop printer");
}
return policy;
......@@ -223,9 +223,9 @@ QString PrinterBehavior::errorPolicyString(const QString &policy) const
QString PrinterBehavior::operationPolicyString(const QString &policy) const
{
// TODO search for others policies of printer-error-policy-supported
if (policy == "authenticated") {
if (policy == QLatin1String("authenticated")) {
return i18n("Authenticated");
} else if (policy == "default") {
} else if (policy == QLatin1String("default")) {
return i18n("Default");
}
return policy;
......@@ -234,19 +234,19 @@ QString PrinterBehavior::operationPolicyString(const QString &policy) const
QString PrinterBehavior::jobSheetsString(const QString &policy) const
{
// TODO search for others policies of printer-error-policy-supported
if (policy == "none") {
if (policy == QLatin1String("none")) {
return i18n("None");
} else if (policy == "classified") {
} else if (policy == QLatin1String("classified")) {
return i18n("Classified");
} else if (policy == "confidential") {
} else if (policy == QLatin1String("confidential")) {
return i18n("Confidential");
} else if (policy == "secret") {
} else if (policy == QLatin1String("secret")) {
return i18n("Secret");
} else if (policy == "standard") {
} else if (policy == QLatin1String("standard")) {
return i18n("Standard");
} else if (policy == "topsecret") {
} else if (policy == QLatin1String("topsecret")) {
return i18n("Topsecret");
} else if (policy == "unclassified") {
} else if (policy == QLatin1String("unclassified")) {
return i18n("Unclassified");
}
return policy;
......@@ -261,7 +261,7 @@ void PrinterBehavior::save()
if (ui->usersELB->property("different").toBool()) {
QStringList list = ui->usersELB->items();
if (list.isEmpty()) {
list << "all";
list << QLatin1String("all");
changedValues[KCUPS_REQUESTING_USER_NAME_ALLOWED] = list;
} else {
if (ui->allowRB->isChecked()) {
......
......@@ -68,7 +68,7 @@ PrinterOptions::PrinterOptions(const QString &destName, bool isClass, bool isRem
void PrinterOptions::on_autoConfigurePB_clicked()
{
QPointer<KCupsRequest> request = new KCupsRequest;
request->printCommand(m_destName, "AutoConfigure", i18n("Set Default Options"));
request->printCommand(m_destName, QLatin1String("AutoConfigure"), i18n("Set Default Options"));
request->waitTillFinished();
if (request) {
request->deleteLater();
......@@ -205,7 +205,7 @@ void PrinterOptions::createGroups()
// The python system-config-printer skips this one
// which has the same data as "PageSize", let's hope
// they did the right thing
if (oKeyword == "PageRegion") {
if (oKeyword == QLatin1String("PageRegion")) {
continue;
}
......@@ -775,7 +775,7 @@ void PrinterOptions::save()
if (m_isClass) {
request->addOrModifyClass(m_destName, values);
} else {
request->addOrModifyPrinter(m_destName, values, tempfile);
request->addOrModifyPrinter(m_destName, values, QString::fromUtf8(tempfile));
}
// Disable the widget till the request is processed
......
......@@ -59,7 +59,7 @@ SelectMakeModelDialog::SelectMakeModelDialog(const QString &make, const QString
// Setup the busy cursor
auto busySeq = new KPixmapSequenceOverlayPainter(this);
busySeq->setSequence(KIconLoader::global()->loadPixmapSequence("process-working", KIconLoader::SizeSmallMedium));
busySeq->setSequence(KIconLoader::global()->loadPixmapSequence(QLatin1String("process-working"), KIconLoader::SizeSmallMedium));
busySeq->setAlignment(Qt::AlignHCenter | Qt::AlignBottom);
busySeq->setWidget(button);
busySeq->start();
......@@ -67,7 +67,7 @@ SelectMakeModelDialog::SelectMakeModelDialog(const QString &make, const QString
qCDebug(PM_CONFIGURE_PRINTER) << make << makeModel;
// restore dlg size
KConfigGroup group(KSharedConfig::openConfig("print-manager"), "PPDDialog");
KConfigGroup group(KSharedConfig::openConfig(QLatin1String("print-manager")), "PPDDialog");
KWindowConfig::restoreWindowSize(windowHandle(), group);
// set data
......@@ -77,7 +77,7 @@ SelectMakeModelDialog::SelectMakeModelDialog(const QString &make, const QString
SelectMakeModelDialog::~SelectMakeModelDialog()
{
// save dlg size
KConfigGroup configGroup(KSharedConfig::openConfig("print-manager"), "PPDDialog");
KConfigGroup configGroup(KSharedConfig::openConfig(QLatin1String("print-manager")), "PPDDialog");
KWindowConfig::saveWindowSize(windowHandle(), configGroup);
}
......
......@@ -33,15 +33,15 @@
int main(int argc, char **argv)
{
ConfigurePrinter app(argc, argv);
app.setOrganizationDomain("org.kde");
app.setOrganizationDomain(QLatin1String("org.kde"));
KAboutData aboutData("ConfigurePrinter",
KAboutData aboutData(QLatin1String("ConfigurePrinter"),
i18n("Configure Printer"),
PM_VERSION,
QLatin1String(PM_VERSION),
i18n("ConfigurePrinter"),
KAboutLicense::GPL,
i18n("(C) 2010-2018 Daniel Nicoletti"));
aboutData.addAuthor(QStringLiteral("Daniel Nicoletti"), QString(), "dantti12@gmail.com");
aboutData.addAuthor(QStringLiteral("Daniel Nicoletti"), QString(), QLatin1String("dantti12@gmail.com"));
aboutData.addAuthor(QStringLiteral("Jan Grulich"), i18n("Port to Qt 5 / Plasma 5"), QStringLiteral("jgrulich@redhat.com"));
KAboutData::setApplicationData(aboutData);
......@@ -51,7 +51,7 @@ int main(int argc, char **argv)
aboutData.setupCommandLine(&parser);
parser.addVersionOption();
parser.addHelpOption();
parser.addPositionalArgument("printer", i18n("Printer to be configured"));
parser.addPositionalArgument(QLatin1String("printer"), i18n("Printer to be configured"));
parser.process(app);
aboutData.processCommandLine(&parser);
......
......@@ -29,7 +29,7 @@
void QmlPlugins::registerTypes(const char* uri)
{
Q_ASSERT(uri == QLatin1String("org.kde.plasma.printmanager"));
Q_ASSERT(QLatin1String(uri) == QLatin1String("org.kde.plasma.printmanager"));
qmlRegisterType<PrinterModel>(uri, 0, 2, "PrinterModel");
qmlRegisterType<PrinterSortFilterModel>(uri, 0, 2, "PrinterSortFilterModel");
qmlRegisterType<JobModel>(uri, 0, 2, "JobModel");
......
......@@ -36,7 +36,7 @@ ClassListWidget::ClassListWidget(QWidget *parent) :
m_request(0),
m_showClasses(false)
{
KConfigDialogManager::changedMap()->insert("ClassListWidget", SIGNAL(changed(QString)));
KConfigDialogManager::changedMap()->insert(QLatin1String("ClassListWidget"), SIGNAL(changed(QString)));
m_model = new QStandardItemModel(this);
setModel(m_model);
......@@ -44,7 +44,7 @@ ClassListWidget::ClassListWidget(QWidget *parent) :
// Setup the busy cursor
m_busySeq = new KPixmapSequenceOverlayPainter(this);
m_busySeq->setSequence(KPixmapSequence("process-working", KIconLoader::SizeSmallMedium));
m_busySeq->setSequence(KPixmapSequence(QLatin1String("process-working"), KIconLoader::SizeSmallMedium));
m_busySeq->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
m_busySeq->setWidget(viewport());
......
......@@ -435,7 +435,7 @@ void JobModel::updateJob(int pos, const KCupsJob &job)
QStringList JobModel::mimeTypes() const
{
return QStringList("application/x-cupsjobs");
return { QStringLiteral("application/x-cupsjobs") };
}
Qt::DropActions JobModel::supportedDropActions() const
......@@ -459,7 +459,7 @@ QMimeData* JobModel::mimeData(const QModelIndexList &indexes) const
}
}
mimeData->setData("application/x-cupsjobs", encodedData);
mimeData->setData(QLatin1String("application/x-cupsjobs"), encodedData);
return mimeData;
}
......@@ -476,11 +476,11 @@ bool JobModel::dropMimeData(const QMimeData *data,
return true;
}
if (!data->hasFormat("application/x-cupsjobs")) {
if (!data->hasFormat(QLatin1String("application/x-cupsjobs"))) {
return false;
}
QByteArray encodedData = data->data("application/x-cupsjobs");
QByteArray encodedData = data->data(QLatin1String("application/x-cupsjobs"));
QDataStream stream(&encodedData, QIODevice::ReadOnly);
bool ret = false;
......@@ -583,13 +583,13 @@ QString JobModel::jobStatus(ipp_jstate_e job_state)
{
case IPP_JOB_PENDING : return i18n("Pending");
case IPP_JOB_HELD : return i18n("On hold");
case IPP_JOB_PROCESSING : return "-";
case IPP_JOB_PROCESSING : return QLatin1String("-");
case IPP_JOB_STOPPED : return i18n("Stopped");
case IPP_JOB_CANCELED : return i18n("Canceled");
case IPP_JOB_ABORTED : return i18n("Aborted");
case IPP_JOB_COMPLETED : return i18n("Completed");
}
return "-";
return QLatin1String("-");
}
void JobModel::clear()
......
......@@ -357,20 +357,20 @@ int KCupsConnection::renewDBusSubscription(int subscriptionId, int leaseDuration
operation = IPP_CREATE_PRINTER_SUBSCRIPTION;
}
KIppRequest request(operation, "/");
KIppRequest request(operation, QLatin1String("/"));
request.addString(IPP_TAG_OPERATION, IPP_TAG_URI,
KCUPS_PRINTER_URI, QLatin1String("/"));
KCUPS_PRINTER_URI, QLatin1String("/"));
request.addInteger(IPP_TAG_SUBSCRIPTION, IPP_TAG_INTEGER,
KCUPS_NOTIFY_LEASE_DURATION, leaseDuration);
KCUPS_NOTIFY_LEASE_DURATION, leaseDuration);
if (operation == IPP_CREATE_PRINTER_SUBSCRIPTION) {
// Add the "notify-events" values to the request
request.addStringList(IPP_TAG_SUBSCRIPTION, IPP_TAG_KEYWORD,
KCUPS_NOTIFY_EVENTS, events);
request.addString(IPP_TAG_SUBSCRIPTION, IPP_TAG_KEYWORD,
KCUPS_NOTIFY_PULL_METHOD, "ippget");
KCUPS_NOTIFY_PULL_METHOD, QLatin1String("ippget"));
request.addString(IPP_TAG_SUBSCRIPTION, IPP_TAG_URI,
KCUPS_NOTIFY_RECIPIENT_URI, "dbus://");
KCUPS_NOTIFY_RECIPIENT_URI, QLatin1String("dbus://"));
} else {
request.addInteger(IPP_TAG_OPERATION, IPP_TAG_INTEGER,
KCUPS_NOTIFY_SUBSCRIPTION_ID, subscriptionId);
......@@ -462,65 +462,65 @@ QString KCupsConnection::eventForSignal(const QMetaMethod & signal) const
{
// Server signals
if (signal == QMetaMethod::fromSignal(&KCupsConnection::serverAudit)) {
return DBUS_SERVER_AUDIT;
return QStringLiteral(DBUS_SERVER_AUDIT);
}
if (signal == QMetaMethod::fromSignal(&KCupsConnection::serverStarted)) {
return DBUS_SERVER_STARTED;
return QStringLiteral(DBUS_SERVER_STARTED);
}
if (signal == QMetaMethod::fromSignal(&KCupsConnection::serverStopped)) {
return DBUS_SERVER_STOPPED;
return QStringLiteral(DBUS_SERVER_STOPPED);
}
if (signal == QMetaMethod::fromSignal(&KCupsConnection::serverRestarted)) {
return DBUS_SERVER_RESTARTED;
return QStringLiteral(DBUS_SERVER_RESTARTED);
}
// Printer signals
if (signal == QMetaMethod::fromSignal(&KCupsConnection::printerAdded)) {