Commit 1b981721 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix clazy warning

parent cdf06e6e
......@@ -56,7 +56,7 @@ KKameraConfig::KKameraConfig(QWidget *parent, const QVariantList &)
#endif
m_devicePopup = new QMenu(this);
m_actions = new KActionCollection(this);
m_config = new KConfig(KProtocolInfo::config("camera"), KConfig::SimpleConfig);
m_config = new KConfig(KProtocolInfo::config(QStringLiteral("camera")), KConfig::SimpleConfig);
m_deviceModel = new QStandardItemModel(this);
m_context = gp_context_new();
......@@ -124,45 +124,45 @@ void KKameraConfig::displayGPSuccessDialogue()
// create actions, add to the toolbar
QAction *act;
act = m_actions->addAction("camera_add");
act->setIcon(QIcon::fromTheme("camera-photo"));
act = m_actions->addAction(QStringLiteral("camera_add"));
act->setIcon(QIcon::fromTheme(QStringLiteral("camera-photo")));
act->setText(i18n("Add"));
connect(act, &QAction::triggered, this, &KKameraConfig::slot_addCamera);
act->setWhatsThis(i18n("Click this button to add a new camera."));
m_toolbar->addAction(act);
m_toolbar->addSeparator();
act = m_actions->addAction("camera_test");
act->setIcon(QIcon::fromTheme("dialog-ok"));
act = m_actions->addAction(QStringLiteral("camera_test"));
act->setIcon(QIcon::fromTheme(QStringLiteral("dialog-ok")));
act->setText(i18n("Test"));
connect(act, &QAction::triggered, this, &KKameraConfig::slot_testCamera);
act->setWhatsThis(i18n("Click this button to test the connection to the selected camera."));
m_toolbar->addAction(act);
act = m_actions->addAction("camera_remove");
act->setIcon(QIcon::fromTheme("user-trash"));
act = m_actions->addAction(QStringLiteral("camera_remove"));
act->setIcon(QIcon::fromTheme(QStringLiteral("user-trash")));
act->setText(i18n("Remove"));
connect(act, &QAction::triggered, this, &KKameraConfig::slot_removeCamera);
act->setWhatsThis(i18n("Click this button to remove the selected camera from the list."));
m_toolbar->addAction(act);
act = m_actions->addAction("camera_configure");
act->setIcon(QIcon::fromTheme("configure"));
act = m_actions->addAction(QStringLiteral("camera_configure"));
act->setIcon(QIcon::fromTheme(QStringLiteral("configure")));
act->setText(i18n("Configure..."));
connect(act, &QAction::triggered, this, &KKameraConfig::slot_configureCamera);
act->setWhatsThis(i18n("Click this button to change the configuration of the selected camera.<br><br>The availability of this feature and the contents of the Configuration dialog depend on the camera model."));
m_toolbar->addAction(act);
act = m_actions->addAction("camera_summary");
act->setIcon(QIcon::fromTheme("hwinfo"));
act = m_actions->addAction(QStringLiteral("camera_summary"));
act->setIcon(QIcon::fromTheme(QStringLiteral("hwinfo")));
act->setText(i18n("Information"));
connect(act, &QAction::triggered, this, &KKameraConfig::slot_cameraSummary);
act->setWhatsThis(i18n("Click this button to view a summary of the current status of the selected camera.<br><br>The availability of this feature and the contents of the Information dialog depend on the camera model."));
m_toolbar->addAction(act);
m_toolbar->addSeparator();
act = m_actions->addAction("camera_cancel");
act->setIcon(QIcon::fromTheme("process-stop"));
act = m_actions->addAction(QStringLiteral("camera_cancel"));
act->setIcon(QIcon::fromTheme(QStringLiteral("process-stop")));
act->setText(i18n("Cancel"));
connect(act, &QAction::triggered, this, &KKameraConfig::slot_cancelOperation);
act->setWhatsThis(i18n("Click this button to cancel the current camera operation."));
......@@ -179,7 +179,7 @@ void KKameraConfig::populateDeviceListView()
QStandardItem *deviceItem = new QStandardItem;
deviceItem->setEditable(false);
deviceItem->setText(it.key());
deviceItem->setIcon(QIcon::fromTheme("camera-photo"));
deviceItem->setIcon(QIcon::fromTheme(QStringLiteral("camera-photo")));
m_deviceModel->appendRow(deviceItem);
}
}
......@@ -210,9 +210,9 @@ void KKameraConfig::load(void)
KCamera *kcamera;
for (it = groupList.begin(); it != groupList.end(); it++) {
if (*it != "<default>") {
if (*it != QStringLiteral("<default>")) {
KConfigGroup cg(m_config, *it);
if (cg.readEntry("Path").contains("usb:")) {
if (cg.readEntry("Path").contains(QStringLiteral("usb:"))) {
continue;
}
......@@ -256,8 +256,8 @@ void KKameraConfig::load(void)
}
}
if (ports.contains("usb:") && names[ports["usb:"]]!="usb:") {
ports.remove("usb:");
if (ports.contains(QStringLiteral("usb:")) && names[ports[QStringLiteral("usb:")]]!=QStringLiteral("usb:")) {
ports.remove(QStringLiteral("usb:"));
}
QMap<QString,QString>::iterator portit;
......@@ -284,17 +284,17 @@ void KKameraConfig::beforeCameraOperation()
{
m_cancelPending = false;
m_actions->action("camera_test")->setEnabled(false);
m_actions->action("camera_remove")->setEnabled(false);
m_actions->action("camera_configure")->setEnabled(false);
m_actions->action("camera_summary")->setEnabled(false);
m_actions->action(QStringLiteral("camera_test"))->setEnabled(false);
m_actions->action(QStringLiteral("camera_remove"))->setEnabled(false);
m_actions->action(QStringLiteral("camera_configure"))->setEnabled(false);
m_actions->action(QStringLiteral("camera_summary"))->setEnabled(false);
m_actions->action("camera_cancel")->setEnabled(true);
m_actions->action(QStringLiteral("camera_cancel"))->setEnabled(true);
}
void KKameraConfig::afterCameraOperation()
{
m_actions->action("camera_cancel")->setEnabled(false);
m_actions->action(QStringLiteral("camera_cancel"))->setEnabled(false);
// if we're regaining control after a Cancel...
if (m_cancelPending) {
......@@ -398,7 +398,7 @@ void KKameraConfig::slot_cancelOperation()
{
m_cancelPending = true;
// Prevent the user from keeping clicking Cancel
m_actions->action("camera_cancel")->setEnabled(false);
m_actions->action(QStringLiteral("camera_cancel"))->setEnabled(false);
// and indicate that the click on Cancel did have some effect
qApp->setOverrideCursor(Qt::WaitCursor);
}
......@@ -408,10 +408,10 @@ void KKameraConfig::slot_deviceMenu(const QPoint &point)
QModelIndex index = m_deviceSel->indexAt(point);
if (index.isValid()) {
m_devicePopup->clear();
m_devicePopup->addAction(m_actions->action("camera_test"));
m_devicePopup->addAction(m_actions->action("camera_remove"));
m_devicePopup->addAction(m_actions->action("camera_configure"));
m_devicePopup->addAction(m_actions->action("camera_summary"));
m_devicePopup->addAction(m_actions->action(QStringLiteral("camera_test")));
m_devicePopup->addAction(m_actions->action(QStringLiteral("camera_remove")));
m_devicePopup->addAction(m_actions->action(QStringLiteral("camera_configure")));
m_devicePopup->addAction(m_actions->action(QStringLiteral("camera_summary")));
m_devicePopup->exec(m_deviceSel->viewport()->mapToGlobal(point));
}
}
......@@ -419,10 +419,10 @@ void KKameraConfig::slot_deviceMenu(const QPoint &point)
void KKameraConfig::slot_deviceSelected(const QModelIndex &index)
{
bool isValid = index.isValid();
m_actions->action("camera_test")->setEnabled(isValid);
m_actions->action("camera_remove")->setEnabled(isValid);
m_actions->action("camera_configure")->setEnabled(isValid);
m_actions->action("camera_summary")->setEnabled(isValid);
m_actions->action(QStringLiteral("camera_test"))->setEnabled(isValid);
m_actions->action(QStringLiteral("camera_remove"))->setEnabled(isValid);
m_actions->action(QStringLiteral("camera_configure"))->setEnabled(isValid);
m_actions->action(QStringLiteral("camera_summary"))->setEnabled(isValid);
}
void KKameraConfig::cbGPIdle(GPContext * /*context*/, void * /*data*/)
......
......@@ -231,8 +231,8 @@ void KCamera::save(KConfig *config)
QString KCamera::portName()
{
const QString port = m_path.left(m_path.indexOf(QLatin1Char(':'))).toLower();
if (port == "serial") return i18n("Serial");
if (port == "usb") return i18n("USB");
if (port == QStringLiteral("serial")) return i18n("Serial");
if (port == QStringLiteral("usb")) return i18n("USB");
return i18n("Unknown port");
}
......@@ -278,10 +278,10 @@ QStringList KCamera::supportedPorts()
initInformation();
QStringList ports;
if (m_abilities.port & GP_PORT_SERIAL) {
ports.append(QLatin1String("serial"));
ports.append(QStringLiteral("serial"));
}
if (m_abilities.port & GP_PORT_USB) {
ports.append(QLatin1String("usb"));
ports.append(QStringLiteral("usb"));
}
return ports;
}
......@@ -482,9 +482,9 @@ void KameraDeviceSelectDialog::save()
m_device->setModel(m_modelSel->currentIndex().data(Qt::DisplayRole).toString());
if (m_serialRB->isChecked()) {
m_device->setPath("serial:" + m_serialPortCombo->currentText());
m_device->setPath(QStringLiteral("serial:") + m_serialPortCombo->currentText());
} else if ( m_USBRB->isChecked() ) {
m_device->setPath("usb:");
m_device->setPath(QStringLiteral("usb:"));
}
}
......
......@@ -86,7 +86,7 @@ int kdemain(int argc, char **argv)
{
QCoreApplication app(argc, argv);
QCoreApplication::setApplicationName("kio_kamera");
QCoreApplication::setApplicationName(QStringLiteral("kio_kamera"));
KLocalizedString::setApplicationDomain("kio_kamera");
#ifdef DEBUG_KAMERA_KIO
......@@ -117,7 +117,7 @@ m_camera(NULL)
// (will init m_camera, since the m_camera's configuration is empty)
m_camera = 0;
m_file = NULL;
m_config = new KConfig(KProtocolInfo::config("camera"), KConfig::SimpleConfig);
m_config = new KConfig(KProtocolInfo::config(QStringLiteral("camera")), KConfig::SimpleConfig);
m_context = gp_context_new();
actiondone = true;
cameraopen = false;
......@@ -228,14 +228,14 @@ void KameraProtocol::closeCamera(void)
return;
}
static QString fix_foldername(QString ofolder) {
static QString fix_foldername(const QString &ofolder) {
QString folder = ofolder;
if (folder.length() > 1) {
while ((folder.length()>1) && (folder.right(1) == "/"))
while ((folder.length()>1) && (folder.right(1) == QStringLiteral("/")))
folder = folder.left(folder.length()-1);
}
if (folder.length() == 0) {
folder = "/";
folder = QStringLiteral("/");
}
return folder;
}
......@@ -425,12 +425,12 @@ void KameraProtocol::stat(const QUrl &url)
QUrl rooturl(url);
qCDebug(KAMERA_KIOSLAVE) << "redirecting to /";
rooturl.setPath("/");
rooturl.setPath(QStringLiteral("/"));
redirection(rooturl);
finished();
return;
}
if(url.path() == "/")
if(url.path() == QStringLiteral("/"))
statRoot();
else
statRegular(url);
......@@ -453,7 +453,7 @@ void KameraProtocol::statRoot(void)
idletime = MAXIDLETIME;
}
void KameraProtocol::split_url2camerapath(QString url,
void KameraProtocol::split_url2camerapath(const QString &url,
QString &directory,
QString &file
) {
......@@ -698,13 +698,13 @@ void KameraProtocol::listDir(const QUrl &yurl)
* port usb: and usb:001,042 entries. */
if (ports.contains("usb:") &&
names.contains(ports["usb:"]) &&
names[ports["usb:"]] != "usb:") {
ports.remove("usb:");
names[ports[QStringLiteral("usb:")]] != QStringLiteral("usb:")) {
ports.remove(QStringLiteral("usb:"));
}
for (it = groupList.begin(); it != groupList.end(); it++) {
QString m_cfgPath;
if (*it == "<default>") {
if (*it == QStringLiteral("<default>")) {
continue;
}
......@@ -755,7 +755,7 @@ void KameraProtocol::listDir(const QUrl &yurl)
if (!current_camera.isEmpty() && !current_port.isEmpty()) {
rooturl.setPath(QLatin1Char('/')+current_camera+QLatin1Char('@')+current_port+QLatin1Char('/'));
} else {
rooturl.setPath("/");
rooturl.setPath(QStringLiteral("/"));
}
redirection(rooturl);
finished();
......@@ -775,7 +775,7 @@ void KameraProtocol::listDir(const QUrl &yurl)
gp_list_new(&specialList);
int gpr;
if (!directory.compare("/")) {
if (!directory.compare(QStringLiteral("/"))) {
CameraText text;
if (GP_OK == gp_camera_get_manual(m_camera, &text, m_context)) {
gp_list_append(specialList,"manual.txt",NULL);
......@@ -826,18 +826,18 @@ void KameraProtocol::listDir(const QUrl &yurl)
translateFileToUDS(entry, info, QString::fromLocal8Bit(name));
listEntry(entry);
}
if (!directory.compare("/")) {
if (!directory.compare(QStringLiteral("/"))) {
CameraText text;
if (GP_OK == gp_camera_get_manual(m_camera, &text, m_context)) {
translateTextToUDS(entry, "manual.txt", text.text);
translateTextToUDS(entry, QStringLiteral("manual.txt"), text.text);
listEntry(entry);
}
if (GP_OK == gp_camera_get_about(m_camera, &text, m_context)) {
translateTextToUDS(entry, "about.txt", text.text);
translateTextToUDS(entry, QStringLiteral("about.txt"), text.text);
listEntry(entry);
}
if (GP_OK == gp_camera_get_summary(m_camera, &text, m_context)) {
translateTextToUDS(entry, "summary.txt", text.text);
translateTextToUDS(entry, QStringLiteral("summary.txt"), text.text);
listEntry(entry);
}
}
......@@ -900,7 +900,7 @@ void KameraProtocol::setCamera(const QString& camera, const QString& port)
idx = gp_port_info_list_lookup_path(port_info_list, tocstr(port));
/* Handle erronously passed usb:XXX,YYY */
if ((idx < 0) && port.startsWith("usb:")) {
if ((idx < 0) && port.startsWith(QStringLiteral("usb:"))) {
idx = gp_port_info_list_lookup_path(port_info_list, "usb:");
}
if (idx < 0) {
......@@ -972,7 +972,7 @@ void KameraProtocol::translateTextToUDS(KIO::UDSEntry &udsEntry,
udsEntry.fastInsert(KIO::UDSEntry::UDS_DISPLAY_NAME,fn);
udsEntry.fastInsert(KIO::UDSEntry::UDS_SIZE,strlen(text));
udsEntry.fastInsert(KIO::UDSEntry::UDS_ACCESS,(S_IRUSR | S_IRGRP | S_IROTH));
udsEntry.fastInsert(KIO::UDSEntry::UDS_MIME_TYPE, QString("text/plain"));
udsEntry.fastInsert(KIO::UDSEntry::UDS_MIME_TYPE, QStringLiteral("text/plain"));
}
// translate a CameraFileInfo to a UDSFieldType
......@@ -1029,7 +1029,7 @@ void KameraProtocol::translateDirectoryToUDS(KIO::UDSEntry &udsEntry,
udsEntry.fastInsert(KIO::UDSEntry::UDS_ACCESS,
S_IRUSR | S_IRGRP | S_IROTH |S_IWUSR | S_IWGRP |
S_IWOTH | S_IXUSR | S_IXOTH | S_IXGRP);
udsEntry.fastInsert(KIO::UDSEntry::UDS_MIME_TYPE, QString("inode/directory"));
udsEntry.fastInsert(KIO::UDSEntry::UDS_MIME_TYPE, QStringLiteral("inode/directory"));
}
bool KameraProtocol::cameraSupportsDel(void)
......
......@@ -56,7 +56,7 @@ private:
GPContext *m_context;
void split_url2camerapath(QString url, QString &directory, QString &file);
void split_url2camerapath(const QString &url, QString &directory, QString &file);
void setCamera(const QString &cam, const QString &port);
void reparseConfiguration(void) override;
bool openCamera(QString& str);
......
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