┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/panels
diff options
context:
space:
mode:
Diffstat (limited to 'src/panels')
-rw-r--r--src/panels/folders/folderspanel.cpp4
-rw-r--r--src/panels/folders/treeviewcontextmenu.cpp18
-rw-r--r--src/panels/information/filemetadataconfigurationdialog.cpp10
-rw-r--r--src/panels/information/informationpanelcontent.cpp14
-rw-r--r--src/panels/information/phononwidget.cpp8
-rw-r--r--src/panels/places/placesitem.cpp34
-rw-r--r--src/panels/places/placesitemeditdialog.cpp4
-rw-r--r--src/panels/places/placesitemmodel.cpp93
-rw-r--r--src/panels/places/placespanel.cpp30
-rw-r--r--src/panels/terminal/terminalpanel.cpp6
10 files changed, 113 insertions, 108 deletions
diff --git a/src/panels/folders/folderspanel.cpp b/src/panels/folders/folderspanel.cpp
index 13df9019b..3ad1bf3ff 100644
--- a/src/panels/folders/folderspanel.cpp
+++ b/src/panels/folders/folderspanel.cpp
@@ -109,7 +109,7 @@ void FoldersPanel::rename(const KFileItem& item)
bool FoldersPanel::urlChanged()
{
- if (!url().isValid() || url().scheme().contains("search")) {
+ if (!url().isValid() || url().scheme().contains(QStringLiteral("search"))) {
// Skip results shown by a search, as possible identical
// directory names are useless without parent-path information.
return false;
@@ -274,7 +274,7 @@ void FoldersPanel::slotLoadingCompleted()
// animations.
// TODO: Check whether it makes sense to allow accessing the
// view-internal delay for usecases like this.
- QTimer::singleShot(250, this, SLOT(startFadeInAnimation()));
+ QTimer::singleShot(250, this, &FoldersPanel::startFadeInAnimation);
}
if (!m_updateCurrentItem) {
diff --git a/src/panels/folders/treeviewcontextmenu.cpp b/src/panels/folders/treeviewcontextmenu.cpp
index e45fcd67e..ec4186db2 100644
--- a/src/panels/folders/treeviewcontextmenu.cpp
+++ b/src/panels/folders/treeviewcontextmenu.cpp
@@ -64,17 +64,17 @@ void TreeViewContextMenu::open()
KFileItemListProperties capabilities(KFileItemList() << m_fileItem);
// insert 'Cut', 'Copy' and 'Paste'
- QAction* cutAction = new QAction(QIcon::fromTheme("edit-cut"), i18nc("@action:inmenu", "Cut"), this);
+ QAction* cutAction = new QAction(QIcon::fromTheme(QStringLiteral("edit-cut")), i18nc("@action:inmenu", "Cut"), this);
cutAction->setEnabled(capabilities.supportsMoving());
connect(cutAction, &QAction::triggered, this, &TreeViewContextMenu::cut);
- QAction* copyAction = new QAction(QIcon::fromTheme("edit-copy"), i18nc("@action:inmenu", "Copy"), this);
+ QAction* copyAction = new QAction(QIcon::fromTheme(QStringLiteral("edit-copy")), i18nc("@action:inmenu", "Copy"), this);
connect(copyAction, &QAction::triggered, this, &TreeViewContextMenu::copy);
const QMimeData *mimeData = QApplication::clipboard()->mimeData();
bool canPaste;
const QString text = KIO::pasteActionText(mimeData, &canPaste, m_fileItem);
- QAction* pasteAction = new QAction(QIcon::fromTheme("edit-paste"), text, this);
+ QAction* pasteAction = new QAction(QIcon::fromTheme(QStringLiteral("edit-paste")), text, this);
connect(pasteAction, &QAction::triggered, this, &TreeViewContextMenu::paste);
pasteAction->setEnabled(canPaste);
@@ -86,18 +86,18 @@ void TreeViewContextMenu::open()
// insert 'Rename'
QAction* renameAction = new QAction(i18nc("@action:inmenu", "Rename..."), this);
renameAction->setEnabled(capabilities.supportsMoving());
- renameAction->setIcon(QIcon::fromTheme("edit-rename"));
+ renameAction->setIcon(QIcon::fromTheme(QStringLiteral("edit-rename")));
connect(renameAction, &QAction::triggered, this, &TreeViewContextMenu::rename);
popup->addAction(renameAction);
// insert 'Move to Trash' and (optionally) 'Delete'
- KSharedConfig::Ptr globalConfig = KSharedConfig::openConfig("kdeglobals", KConfig::IncludeGlobals);
+ KSharedConfig::Ptr globalConfig = KSharedConfig::openConfig(QStringLiteral("kdeglobals"), KConfig::IncludeGlobals);
KConfigGroup configGroup(globalConfig, "KDE");
bool showDeleteCommand = configGroup.readEntry("ShowDeleteCommand", false);
const QUrl url = m_fileItem.url();
if (url.isLocalFile()) {
- QAction* moveToTrashAction = new QAction(QIcon::fromTheme("user-trash"),
+ QAction* moveToTrashAction = new QAction(QIcon::fromTheme(QStringLiteral("user-trash")),
i18nc("@action:inmenu", "Move to Trash"), this);
const bool enableMoveToTrash = capabilities.isLocal() && capabilities.supportsMoving();
moveToTrashAction->setEnabled(enableMoveToTrash);
@@ -108,7 +108,7 @@ void TreeViewContextMenu::open()
}
if (showDeleteCommand) {
- QAction* deleteAction = new QAction(QIcon::fromTheme("edit-delete"), i18nc("@action:inmenu", "Delete"), this);
+ QAction* deleteAction = new QAction(QIcon::fromTheme(QStringLiteral("edit-delete")), i18nc("@action:inmenu", "Delete"), this);
deleteAction->setEnabled(capabilities.supportsDeleting());
connect(deleteAction, &QAction::triggered, this, &TreeViewContextMenu::deleteItem);
popup->addAction(deleteAction);
@@ -136,7 +136,7 @@ void TreeViewContextMenu::open()
if (!m_fileItem.isNull()) {
// insert 'Properties' entry
QAction* propertiesAction = new QAction(i18nc("@action:inmenu", "Properties"), this);
- propertiesAction->setIcon(QIcon::fromTheme("document-properties"));
+ propertiesAction->setIcon(QIcon::fromTheme(QStringLiteral("document-properties")));
connect(propertiesAction, &QAction::triggered, this, &TreeViewContextMenu::showProperties);
popup->addAction(propertiesAction);
}
@@ -199,7 +199,7 @@ void TreeViewContextMenu::moveToTrash()
uiDelegate.setWindow(m_parent);
if (uiDelegate.askDeleteConfirmation(list, KIO::JobUiDelegate::Trash, KIO::JobUiDelegate::DefaultConfirmation)) {
KIO::Job* job = KIO::trash(list);
- KIO::FileUndoManager::self()->recordJob(KIO::FileUndoManager::Trash, list, QUrl("trash:/"), job);
+ KIO::FileUndoManager::self()->recordJob(KIO::FileUndoManager::Trash, list, QUrl(QStringLiteral("trash:/")), job);
KJobWidgets::setWindow(job, m_parent);
job->ui()->setAutoErrorHandlingEnabled(true);
}
diff --git a/src/panels/information/filemetadataconfigurationdialog.cpp b/src/panels/information/filemetadataconfigurationdialog.cpp
index 2f8c16037..5671d34ef 100644
--- a/src/panels/information/filemetadataconfigurationdialog.cpp
+++ b/src/panels/information/filemetadataconfigurationdialog.cpp
@@ -46,8 +46,8 @@ FileMetaDataConfigurationDialog::FileMetaDataConfigurationDialog(QWidget* parent
QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
okButton->setDefault(true);
okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
- connect(buttonBox, SIGNAL(accepted()), this, SLOT(slotAccepted()));
- connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
+ connect(buttonBox, &QDialogButtonBox::accepted, this, &FileMetaDataConfigurationDialog::slotAccepted);
+ connect(buttonBox, &QDialogButtonBox::rejected, this, &FileMetaDataConfigurationDialog::reject);
buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
m_descriptionLabel = new QLabel(i18nc("@label::textbox",
@@ -68,16 +68,16 @@ FileMetaDataConfigurationDialog::FileMetaDataConfigurationDialog(QWidget* parent
topLayout->addWidget(m_configWidget);
mainLayout->addWidget(mainWidget);
mainLayout->addWidget(buttonBox);
-
- const KConfigGroup dialogConfig(KSharedConfig::openConfig("dolphinrc"),
+
+ const KConfigGroup dialogConfig(KSharedConfig::openConfig(QStringLiteral("dolphinrc")),
"FileMetaDataConfigurationDialog");
KWindowConfig::restoreWindowSize(windowHandle(), dialogConfig);
}
FileMetaDataConfigurationDialog::~FileMetaDataConfigurationDialog()
{
- KConfigGroup dialogConfig(KSharedConfig::openConfig("dolphinrc"),
+ KConfigGroup dialogConfig(KSharedConfig::openConfig(QStringLiteral("dolphinrc")),
"FileMetaDataConfigurationDialog");
KWindowConfig::saveWindowSize(windowHandle(), dialogConfig);
}
diff --git a/src/panels/information/informationpanelcontent.cpp b/src/panels/information/informationpanelcontent.cpp
index c18d4738e..6bfc4ed01 100644
--- a/src/panels/information/informationpanelcontent.cpp
+++ b/src/panels/information/informationpanelcontent.cpp
@@ -169,14 +169,14 @@ void InformationPanelContent::showItem(const KFileItem& item)
}
const QUrl itemUrl = item.url();
- const bool isSearchUrl = itemUrl.scheme().contains("search") && item.localPath().isEmpty();
+ const bool isSearchUrl = itemUrl.scheme().contains(QStringLiteral("search")) && item.localPath().isEmpty();
if (!applyPlace(itemUrl)) {
setNameLabelText(item.text());
if (isSearchUrl) {
// in the case of a search-URL the URL is not readable for humans
// (at least not useful to show in the Information Panel)
KIconLoader iconLoader;
- QPixmap icon = iconLoader.loadIcon("nepomuk",
+ QPixmap icon = iconLoader.loadIcon(QStringLiteral("nepomuk"),
KIconLoader::NoGroup,
KIconLoader::SizeEnormous);
m_preview->setPixmap(icon);
@@ -213,7 +213,7 @@ void InformationPanelContent::showItem(const KFileItem& item)
if (InformationPanelSettings::previewsShown()) {
const QString mimeType = item.mimetype();
- const bool usePhonon = mimeType.startsWith("audio/") || mimeType.startsWith("video/");
+ const bool usePhonon = mimeType.startsWith(QLatin1String("audio/")) || mimeType.startsWith(QLatin1String("video/"));
if (usePhonon) {
m_phononWidget->show();
m_phononWidget->setUrl(item.targetUrl());
@@ -240,7 +240,7 @@ void InformationPanelContent::showItems(const KFileItemList& items)
}
KIconLoader iconLoader;
- QPixmap icon = iconLoader.loadIcon("dialog-information",
+ QPixmap icon = iconLoader.loadIcon(QStringLiteral("dialog-information"),
KIconLoader::NoGroup,
KIconLoader::SizeEnormous);
m_preview->setPixmap(icon);
@@ -290,12 +290,12 @@ void InformationPanelContent::configureSettings(const QList<QAction*>& customCon
QMenu popup(this);
QAction* previewAction = popup.addAction(i18nc("@action:inmenu", "Preview"));
- previewAction->setIcon(QIcon::fromTheme("view-preview"));
+ previewAction->setIcon(QIcon::fromTheme(QStringLiteral("view-preview")));
previewAction->setCheckable(true);
previewAction->setChecked(InformationPanelSettings::previewsShown());
QAction* configureAction = popup.addAction(i18nc("@action:inmenu", "Configure..."));
- configureAction->setIcon(QIcon::fromTheme("configure"));
+ configureAction->setIcon(QIcon::fromTheme(QStringLiteral("configure")));
popup.addSeparator();
foreach (QAction* action, customContextMenuActions) {
@@ -403,7 +403,7 @@ void InformationPanelContent::setNameLabelText(const QString& text)
QTextLine line = textLayout.createLine();
while (line.isValid()) {
line.setLineWidth(m_nameLabel->width());
- wrappedText += processedText.mid(line.textStart(), line.textLength());
+ wrappedText += processedText.midRef(line.textStart(), line.textLength());
line = textLayout.createLine();
if (line.isValid()) {
diff --git a/src/panels/information/phononwidget.cpp b/src/panels/information/phononwidget.cpp
index 1d6361f19..e4885ab76 100644
--- a/src/panels/information/phononwidget.cpp
+++ b/src/panels/information/phononwidget.cpp
@@ -38,6 +38,8 @@
class EmbeddedVideoPlayer : public Phonon::VideoWidget
{
+ Q_OBJECT
+
public:
EmbeddedVideoPlayer(QWidget *parent = 0) :
Phonon::VideoWidget(parent)
@@ -128,13 +130,13 @@ void PhononWidget::showEvent(QShowEvent *event)
m_playButton->setToolTip(i18n("play"));
m_playButton->setIconSize(buttonSize);
- m_playButton->setIcon(QIcon::fromTheme("media-playback-start"));
+ m_playButton->setIcon(QIcon::fromTheme(QStringLiteral("media-playback-start")));
m_playButton->setAutoRaise(true);
connect(m_playButton, &QToolButton::clicked, this, &PhononWidget::play);
m_stopButton->setToolTip(i18n("stop"));
m_stopButton->setIconSize(buttonSize);
- m_stopButton->setIcon(QIcon::fromTheme("media-playback-stop"));
+ m_stopButton->setIcon(QIcon::fromTheme(QStringLiteral("media-playback-stop")));
m_stopButton->setAutoRaise(true);
m_stopButton->hide();
connect(m_stopButton, &QToolButton::clicked, this, &PhononWidget::stop);
@@ -231,3 +233,5 @@ void PhononWidget::applyVideoSize()
m_videoPlayer->setSizeHint(m_videoSize);
}
}
+
+#include "phononwidget.moc"
diff --git a/src/panels/places/placesitem.cpp b/src/panels/places/placesitem.cpp
index 2a9c88e4e..a04064d0b 100644
--- a/src/panels/places/placesitem.cpp
+++ b/src/panels/places/placesitem.cpp
@@ -58,7 +58,7 @@ void PlacesItem::setUrl(const QUrl &url)
// like QUrl. Hence do a manual check to prevent that
// setting an equal URL results in an itemsChanged()
// signal.
- if (dataValue("url").value<QUrl>() != url) {
+ if (dataValue("url").toUrl() != url) {
delete m_trashDirLister;
if (url.scheme() == QLatin1String("trash")) {
// The trash icon must always be updated dependent on whether
@@ -79,7 +79,7 @@ void PlacesItem::setUrl(const QUrl &url)
QUrl PlacesItem::url() const
{
- return dataValue("url").value<QUrl>();
+ return dataValue("url").toUrl();
}
void PlacesItem::setUdi(const QString& udi)
@@ -131,7 +131,7 @@ void PlacesItem::setBookmark(const KBookmark& bookmark)
delete m_mtp;
- const QString udi = bookmark.metaDataItem("UDI");
+ const QString udi = bookmark.metaDataItem(QStringLiteral("UDI"));
if (udi.isEmpty()) {
setIcon(bookmark.icon());
setText(i18nc("KFile System Bookmarks", bookmark.text().toUtf8().constData()));
@@ -143,10 +143,10 @@ void PlacesItem::setBookmark(const KBookmark& bookmark)
const GroupType type = groupType();
if (icon().isEmpty()) {
switch (type) {
- case RecentlySavedType: setIcon("chronometer"); break;
- case SearchForType: setIcon("system-search"); break;
+ case RecentlySavedType: setIcon(QStringLiteral("chronometer")); break;
+ case SearchForType: setIcon(QStringLiteral("system-search")); break;
case PlacesType:
- default: setIcon("folder");
+ default: setIcon(QStringLiteral("folder"));
}
}
@@ -159,7 +159,7 @@ void PlacesItem::setBookmark(const KBookmark& bookmark)
default: Q_ASSERT(false); break;
}
- setHidden(bookmark.metaDataItem("IsHidden") == QLatin1String("true"));
+ setHidden(bookmark.metaDataItem(QStringLiteral("IsHidden")) == QLatin1String("true"));
}
KBookmark PlacesItem::bookmark() const
@@ -206,7 +206,7 @@ KBookmark PlacesItem::createBookmark(KBookmarkManager* manager,
KBookmark bookmark = root.addBookmark(text, url, iconName);
bookmark.setFullText(text);
- bookmark.setMetaDataItem("ID", generateNewId());
+ bookmark.setMetaDataItem(QStringLiteral("ID"), generateNewId());
return bookmark;
}
@@ -220,8 +220,8 @@ KBookmark PlacesItem::createDeviceBookmark(KBookmarkManager* manager,
}
KBookmark bookmark = root.createNewSeparator();
- bookmark.setMetaDataItem("UDI", udi);
- bookmark.setMetaDataItem("isSystemItem", "true");
+ bookmark.setMetaDataItem(QStringLiteral("UDI"), udi);
+ bookmark.setMetaDataItem(QStringLiteral("isSystemItem"), QStringLiteral("true"));
return bookmark;
}
@@ -270,8 +270,8 @@ void PlacesItem::initializeDevice(const QString& udi)
if (m_access) {
setUrl(QUrl::fromLocalFile(m_access->filePath()));
- QObject::connect(m_access.data(), SIGNAL(accessibilityChanged(bool,QString)),
- m_signalHandler.data(), SLOT(onAccessibilityChanged()));
+ QObject::connect(m_access.data(), &Solid::StorageAccess::accessibilityChanged,
+ m_signalHandler.data(), &PlacesItemSignalHandler::onAccessibilityChanged);
} else if (m_disc && (m_disc->availableContent() & Solid::OpticalDisc::Audio) != 0) {
Solid::Block *block = m_device.as<Solid::Block>();
if (block) {
@@ -296,7 +296,7 @@ void PlacesItem::onTrashDirListerCompleted()
Q_ASSERT(url().scheme() == QLatin1String("trash"));
const bool isTrashEmpty = m_trashDirLister->items().isEmpty();
- setIcon(isTrashEmpty ? "user-trash" : "user-trash-full");
+ setIcon(isTrashEmpty ? QStringLiteral("user-trash") : QStringLiteral("user-trash-full"));
}
void PlacesItem::updateBookmarkForRole(const QByteArray& role)
@@ -317,11 +317,11 @@ void PlacesItem::updateBookmarkForRole(const QByteArray& role)
} else if (role == "url") {
m_bookmark.setUrl(url());
} else if (role == "udi)") {
- m_bookmark.setMetaDataItem("UDI", udi());
+ m_bookmark.setMetaDataItem(QStringLiteral("UDI"), udi());
} else if (role == "isSystemItem") {
- m_bookmark.setMetaDataItem("isSystemItem", isSystemItem() ? "true" : "false");
+ m_bookmark.setMetaDataItem(QStringLiteral("isSystemItem"), isSystemItem() ? QStringLiteral("true") : QStringLiteral("false"));
} else if (role == "isHidden") {
- m_bookmark.setMetaDataItem("IsHidden", isHidden() ? "true" : "false");
+ m_bookmark.setMetaDataItem(QStringLiteral("IsHidden"), isHidden() ? QStringLiteral("true") : QStringLiteral("false"));
}
}
@@ -332,6 +332,6 @@ QString PlacesItem::generateNewId()
// " (V2)" to indicate that the ID has been generated by
// a new version of the places view.
static int count = 0;
- return QString::number(QDateTime::currentDateTime().toTime_t()) +
+ return QString::number(QDateTime::currentDateTimeUtc().toTime_t()) +
'/' + QString::number(count++) + " (V2)";
}
diff --git a/src/panels/places/placesitemeditdialog.cpp b/src/panels/places/placesitemeditdialog.cpp
index d035b0403..7d365310f 100644
--- a/src/panels/places/placesitemeditdialog.cpp
+++ b/src/panels/places/placesitemeditdialog.cpp
@@ -119,8 +119,8 @@ void PlacesItemEditDialog::initialize()
m_okButton = buttonBox->button(QDialogButtonBox::Ok);
m_okButton->setDefault(true);
m_okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
- connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
- connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
+ connect(buttonBox, &QDialogButtonBox::accepted, this, &PlacesItemEditDialog::accept);
+ connect(buttonBox, &QDialogButtonBox::rejected, this, &PlacesItemEditDialog::reject);
setModal(true);
m_okButton->setDefault(true);
diff --git a/src/panels/places/placesitemmodel.cpp b/src/panels/places/placesitemmodel.cpp
index 0d8ac6981..a42cb0403 100644
--- a/src/panels/places/placesitemmodel.cpp
+++ b/src/panels/places/placesitemmodel.cpp
@@ -249,7 +249,7 @@ QAction* PlacesItemModel::ejectAction(int index) const
{
const PlacesItem* item = placesItem(index);
if (item && item->device().is<Solid::OpticalDisc>()) {
- return new QAction(QIcon::fromTheme("media-eject"), i18nc("@item", "Eject '%1'", item->text()), 0);
+ return new QAction(QIcon::fromTheme(QStringLiteral("media-eject")), i18nc("@item", "Eject '%1'", item->text()), 0);
}
return 0;
@@ -288,10 +288,10 @@ QAction* PlacesItemModel::teardownAction(int index) const
text = i18nc("@item", "Release '%1'", label);
} else if (removable || hotPluggable) {
text = i18nc("@item", "Safely Remove '%1'", label);
- iconName = "media-eject";
+ iconName = QStringLiteral("media-eject");
} else {
text = i18nc("@item", "Unmount '%1'", label);
- iconName = "media-eject";
+ iconName = QStringLiteral("media-eject");
}
if (iconName.isEmpty()) {
@@ -367,7 +367,7 @@ QMimeData* PlacesItemModel::createMimeData(const KItemSet& indexes) const
QDataStream stream(&itemData, QIODevice::WriteOnly);
- foreach (int index, indexes) {
+ for (int index : indexes) {
const QUrl itemUrl = placesItem(index)->url();
if (itemUrl.isValid()) {
urls << itemUrl;
@@ -416,7 +416,7 @@ void PlacesItemModel::dropMimeDataBefore(int index, const QMimeData* mimeData)
const int dropIndex = groupedDropIndex(index, newItem);
insertItem(dropIndex, newItem);
- } else if (mimeData->hasFormat("text/uri-list")) {
+ } else if (mimeData->hasFormat(QStringLiteral("text/uri-list"))) {
// One or more items must be added to the model
const QList<QUrl> urls = KUrlMimeData::urlsFromMimeData(mimeData);
for (int i = urls.count() - 1; i >= 0; --i) {
@@ -428,7 +428,7 @@ void PlacesItemModel::dropMimeDataBefore(int index, const QMimeData* mimeData)
}
if ((url.isLocalFile() && !QFileInfo(url.toLocalFile()).isDir())
- || url.scheme() == "trash") {
+ || url.scheme() == QLatin1String("trash")) {
// Only directories outside the trash are allowed
continue;
}
@@ -534,7 +534,7 @@ void PlacesItemModel::onItemChanged(int index, const QSet<QByteArray>& changedRo
if (changedRoles.contains("isHidden")) {
if (!m_hiddenItemsShown && changedItem->isHidden()) {
m_hiddenItemToRemove = index;
- QTimer::singleShot(0, this, SLOT(hideItem()));
+ QTimer::singleShot(0, this, static_cast<void (PlacesItemModel::*)()>(&PlacesItemModel::hideItem));
}
}
}
@@ -638,7 +638,7 @@ void PlacesItemModel::updateBookmarks()
// a hidden item. The content of the bookmark might
// have been changed, so an update is done.
found = true;
- if (newBookmark.metaDataItem("UDI").isEmpty()) {
+ if (newBookmark.metaDataItem(QStringLiteral("UDI")).isEmpty()) {
item->setBookmark(newBookmark);
item->setText(i18nc("KFile System Bookmarks", newBookmark.text().toUtf8().constData()));
}
@@ -647,7 +647,7 @@ void PlacesItemModel::updateBookmarks()
}
if (!found) {
- const QString udi = newBookmark.metaDataItem("UDI");
+ const QString udi = newBookmark.metaDataItem(QStringLiteral("UDI"));
/*
* See Bug 304878
@@ -782,6 +782,7 @@ void PlacesItemModel::loadBookmarks()
}
// Create items for devices that have not been stored as bookmark yet
+ devicesItems.reserve(devicesItems.count() + devices.count());
foreach (const QString& udi, devices) {
const KBookmark bookmark = PlacesItem::createDeviceBookmark(m_bookmarkManager, udi);
devicesItems.append(new PlacesItem(bookmark));
@@ -810,9 +811,9 @@ void PlacesItemModel::loadBookmarks()
bool PlacesItemModel::acceptBookmark(const KBookmark& bookmark,
const QSet<QString>& availableDevices) const
{
- const QString udi = bookmark.metaDataItem("UDI");
+ const QString udi = bookmark.metaDataItem(QStringLiteral("UDI"));
const QUrl url = bookmark.url();
- const QString appName = bookmark.metaDataItem("OnlyInApp");
+ const QString appName = bookmark.metaDataItem(QStringLiteral("OnlyInApp"));
const bool deviceAvailable = availableDevices.contains(udi);
const bool allowedHere = (appName.isEmpty()
@@ -837,7 +838,7 @@ PlacesItem* PlacesItemModel::createSystemPlacesItem(const SystemBookmarkData& da
// for "Recently Saved" and "Search For" should be a setting available only
// in the Places Panel (see description of AppNamePrefix for more details).
const QString appName = KAboutData::applicationData().componentName() + AppNamePrefix;
- bookmark.setMetaDataItem("OnlyInApp", appName);
+ bookmark.setMetaDataItem(QStringLiteral("OnlyInApp"), appName);
}
PlacesItem* item = new PlacesItem(bookmark);
@@ -869,7 +870,7 @@ PlacesItem* PlacesItemModel::createSystemPlacesItem(const SystemBookmarkData& da
props.setViewMode(DolphinView::IconsView);
props.setPreviewsShown(true);
props.setVisibleRoles({"text"});
- } else if (data.url.scheme() == "timeline") {
+ } else if (data.url.scheme() == QLatin1String("timeline")) {
props.setViewMode(DolphinView::DetailsView);
props.setVisibleRoles({"text", "date"});
}
@@ -889,42 +890,42 @@ void PlacesItemModel::createSystemBookmarks()
// done here is because otherwise switching the language would not result in retranslating the
// bookmarks.
m_systemBookmarks.append(SystemBookmarkData(QUrl::fromLocalFile(KUser().homeDir()),
- "user-home",
+ QStringLiteral("user-home"),
I18N_NOOP2("KFile System Bookmarks", "Home")));
- m_systemBookmarks.append(SystemBookmarkData(QUrl("remote:/"),
- "network-workgroup",
+ m_systemBookmarks.append(SystemBookmarkData(QUrl(QStringLiteral("remote:/")),
+ QStringLiteral("network-workgroup"),
I18N_NOOP2("KFile System Bookmarks", "Network")));
- m_systemBookmarks.append(SystemBookmarkData(QUrl::fromLocalFile("/"),
- "folder-red",
+ m_systemBookmarks.append(SystemBookmarkData(QUrl::fromLocalFile(QStringLiteral("/")),
+ QStringLiteral("folder-red"),
I18N_NOOP2("KFile System Bookmarks", "Root")));
- m_systemBookmarks.append(SystemBookmarkData(QUrl("trash:/"),
- "user-trash",
+ m_systemBookmarks.append(SystemBookmarkData(QUrl(QStringLiteral("trash:/")),
+ QStringLiteral("user-trash"),
I18N_NOOP2("KFile System Bookmarks", "Trash")));
if (m_fileIndexingEnabled) {
- m_systemBookmarks.append(SystemBookmarkData(QUrl("timeline:/today"),
- "go-jump-today",
+ m_systemBookmarks.append(SystemBookmarkData(QUrl(QStringLiteral("timeline:/today")),
+ QStringLiteral("go-jump-today"),
I18N_NOOP2("KFile System Bookmarks", "Today")));
- m_systemBookmarks.append(SystemBookmarkData(QUrl("timeline:/yesterday"),
- "view-calendar-day",
+ m_systemBookmarks.append(SystemBookmarkData(QUrl(QStringLiteral("timeline:/yesterday")),
+ QStringLiteral("view-calendar-day"),
I18N_NOOP2("KFile System Bookmarks", "Yesterday")));
- m_systemBookmarks.append(SystemBookmarkData(QUrl("timeline:/thismonth"),
- "view-calendar-month",
+ m_systemBookmarks.append(SystemBookmarkData(QUrl(QStringLiteral("timeline:/thismonth")),
+ QStringLiteral("view-calendar-month"),
I18N_NOOP2("KFile System Bookmarks", "This Month")));
- m_systemBookmarks.append(SystemBookmarkData(QUrl("timeline:/lastmonth"),
- "view-calendar-month",
+ m_systemBookmarks.append(SystemBookmarkData(QUrl(QStringLiteral("timeline:/lastmonth")),
+ QStringLiteral("view-calendar-month"),
I18N_NOOP2("KFile System Bookmarks", "Last Month")));
- m_systemBookmarks.append(SystemBookmarkData(QUrl("search:/documents"),
- "folder-text",
+ m_systemBookmarks.append(SystemBookmarkData(QUrl(QStringLiteral("search:/documents")),
+ QStringLiteral("folder-text"),
I18N_NOOP2("KFile System Bookmarks", "Documents")));
- m_systemBookmarks.append(SystemBookmarkData(QUrl("search:/images"),
- "folder-images",
+ m_systemBookmarks.append(SystemBookmarkData(QUrl(QStringLiteral("search:/images")),
+ QStringLiteral("folder-images"),
I18N_NOOP2("KFile System Bookmarks", "Images")));
- m_systemBookmarks.append(SystemBookmarkData(QUrl("search:/audio"),
- "folder-sound",
+ m_systemBookmarks.append(SystemBookmarkData(QUrl(QStringLiteral("search:/audio")),
+ QStringLiteral("folder-sound"),
I18N_NOOP2("KFile System Bookmarks", "Audio Files")));
- m_systemBookmarks.append(SystemBookmarkData(QUrl("search:/videos"),
- "folder-videos",
+ m_systemBookmarks.append(SystemBookmarkData(QUrl(QStringLiteral("search:/videos")),
+ QStringLiteral("folder-videos"),
I18N_NOOP2("KFile System Bookmarks", "Videos")));
}
@@ -940,16 +941,16 @@ void PlacesItemModel::clear() {
void PlacesItemModel::initializeAvailableDevices()
{
- QString predicate("[[[[ StorageVolume.ignored == false AND [ StorageVolume.usage == 'FileSystem' OR StorageVolume.usage == 'Encrypted' ]]"
+ QString predicate(QStringLiteral("[[[[ StorageVolume.ignored == false AND [ StorageVolume.usage == 'FileSystem' OR StorageVolume.usage == 'Encrypted' ]]"
" OR "
"[ IS StorageAccess AND StorageDrive.driveType == 'Floppy' ]]"
" OR "
"OpticalDisc.availableContent & 'Audio' ]"
" OR "
- "StorageAccess.ignored == false ]");
+ "StorageAccess.ignored == false ]"));
- if (KProtocolInfo::isKnownProtocol("mtp")) {
+ if (KProtocolInfo::isKnownProtocol(QStringLiteral("mtp"))) {
predicate.prepend("[");
predicate.append(" OR PortableMediaPlayer.supportedProtocols == 'mtp']");
}
@@ -1076,12 +1077,12 @@ int PlacesItemModel::groupedDropIndex(int index, const PlacesItem* item) const
bool PlacesItemModel::equalBookmarkIdentifiers(const KBookmark& b1, const KBookmark& b2)
{
- const QString udi1 = b1.metaDataItem("UDI");
- const QString udi2 = b2.metaDataItem("UDI");
+ const QString udi1 = b1.metaDataItem(QStringLiteral("UDI"));
+ const QString udi2 = b2.metaDataItem(QStringLiteral("UDI"));
if (!udi1.isEmpty() && !udi2.isEmpty()) {
return udi1 == udi2;
} else {
- return b1.metaDataItem("ID") == b2.metaDataItem("ID");
+ return b1.metaDataItem(QStringLiteral("ID")) == b2.metaDataItem(QStringLiteral("ID"));
}
}
@@ -1140,13 +1141,13 @@ QUrl PlacesItemModel::createSearchUrl(const QUrl& url)
#ifdef HAVE_BALOO
const QString path = url.toDisplayString(QUrl::PreferLocalFile);
if (path.endsWith(QLatin1String("documents"))) {
- searchUrl = searchUrlForType("Document");
+ searchUrl = searchUrlForType(QStringLiteral("Document"));
} else if (path.endsWith(QLatin1String("images"))) {
- searchUrl = searchUrlForType("Image");
+ searchUrl = searchUrlForType(QStringLiteral("Image"));
} else if (path.endsWith(QLatin1String("audio"))) {
- searchUrl = searchUrlForType("Audio");
+ searchUrl = searchUrlForType(QStringLiteral("Audio"));
} else if (path.endsWith(QLatin1String("videos"))) {
- searchUrl = searchUrlForType("Video");
+ searchUrl = searchUrlForType(QStringLiteral("Video"));
} else {
Q_ASSERT(false);
}
diff --git a/src/panels/places/placespanel.cpp b/src/panels/places/placespanel.cpp
index 50ed7e73a..037d27c51 100644
--- a/src/panels/places/placespanel.cpp
+++ b/src/panels/places/placespanel.cpp
@@ -73,7 +73,7 @@ PlacesPanel::~PlacesPanel()
bool PlacesPanel::urlChanged()
{
- if (!url().isValid() || url().scheme().contains("search")) {
+ if (!url().isValid() || url().scheme().contains(QStringLiteral("search"))) {
// Skip results shown by a search, as possible identical
// directory names are useless without parent-path information.
return false;
@@ -186,26 +186,26 @@ void PlacesPanel::slotItemContextMenuRequested(int index, const QPointF& pos)
mainSeparator = menu.addSeparator();
}
} else {
- if (item->url() == QUrl("trash:/")) {
- emptyTrashAction = menu.addAction(QIcon::fromTheme("trash-empty"), i18nc("@action:inmenu", "Empty Trash"));
- emptyTrashAction->setEnabled(item->icon() == "user-trash-full");
+ if (item->url() == QUrl(QStringLiteral("trash:/"))) {
+ emptyTrashAction = menu.addAction(QIcon::fromTheme(QStringLiteral("trash-empty")), i18nc("@action:inmenu", "Empty Trash"));
+ emptyTrashAction->setEnabled(item->icon() == QLatin1String("user-trash-full"));
menu.addSeparator();
}
- addAction = menu.addAction(QIcon::fromTheme("document-new"), i18nc("@item:inmenu", "Add Entry..."));
+ addAction = menu.addAction(QIcon::fromTheme(QStringLiteral("document-new")), i18nc("@item:inmenu", "Add Entry..."));
mainSeparator = menu.addSeparator();
- editAction = menu.addAction(QIcon::fromTheme("document-properties"), i18nc("@item:inmenu", "Edit '%1'...", label));
+ editAction = menu.addAction(QIcon::fromTheme(QStringLiteral("document-properties")), i18nc("@item:inmenu", "Edit '%1'...", label));
}
if (!addAction) {
- addAction = menu.addAction(QIcon::fromTheme("document-new"), i18nc("@item:inmenu", "Add Entry..."));
+ addAction = menu.addAction(QIcon::fromTheme(QStringLiteral("document-new")), i18nc("@item:inmenu", "Add Entry..."));
}
QAction* openInNewTabAction = menu.addAction(i18nc("@item:inmenu", "Open '%1' in New Tab", label));
- openInNewTabAction->setIcon(QIcon::fromTheme("tab-new"));
+ openInNewTabAction->setIcon(QIcon::fromTheme(QStringLiteral("tab-new")));
QAction* removeAction = 0;
if (!isDevice && !item->isSystemItem()) {
- removeAction = menu.addAction(QIcon::fromTheme("edit-delete"), i18nc("@item:inmenu", "Remove '%1'", label));
+ removeAction = menu.addAction(QIcon::fromTheme(QStringLiteral("edit-delete")), i18nc("@item:inmenu", "Remove '%1'", label));
}
QAction* hideAction = menu.addAction(i18nc("@item:inmenu", "Hide '%1'", label));
@@ -240,7 +240,7 @@ void PlacesPanel::slotItemContextMenuRequested(int index, const QPointF& pos)
{KIconLoader::SizeLarge, I18N_NOOP2_NOSTRIP("Huge icon size", "Huge (%1x%2)")}
};
- QMap<QAction*, int> iconSizeActionMap;
+ QHash<QAction*, int> iconSizeActionMap;
QActionGroup* iconSizeGroup = new QActionGroup(iconSizeSubMenu);
for (int i = 0; i < iconSizeCount; ++i) {
@@ -309,7 +309,7 @@ void PlacesPanel::slotViewContextMenuRequested(const QPointF& pos)
{
QMenu menu(this);
- QAction* addAction = menu.addAction(QIcon::fromTheme("document-new"), i18nc("@item:inmenu", "Add Entry..."));
+ QAction* addAction = menu.addAction(QIcon::fromTheme(QStringLiteral("document-new")), i18nc("@item:inmenu", "Add Entry..."));
QAction* showAllAction = 0;
if (m_model->hiddenCount() > 0) {
@@ -421,7 +421,7 @@ void PlacesPanel::slotTrashUpdated(KJob* job)
emit errorMessage(job->errorString());
}
// as long as KIO doesn't do this, do it ourselves
- KNotification::event("Trash: emptied", QString(), QPixmap(), 0, KNotification::DefaultEvent);
+ KNotification::event(QStringLiteral("Trash: emptied"), QString(), QPixmap(), 0, KNotification::DefaultEvent);
}
void PlacesPanel::slotStorageSetupDone(int index, bool success)
@@ -457,7 +457,7 @@ void PlacesPanel::emptyTrash()
void PlacesPanel::addEntry()
{
const int index = m_controller->selectionManager()->currentItem();
- const QUrl url = m_model->data(index).value("url").value<QUrl>();
+ const QUrl url = m_model->data(index).value("url").toUrl();
QPointer<PlacesItemEditDialog> dialog = new PlacesItemEditDialog(this);
dialog->setWindowTitle(i18nc("@title:window", "Add Places Entry"));
@@ -480,7 +480,7 @@ void PlacesPanel::editEntry(int index)
dialog->setWindowTitle(i18nc("@title:window", "Edit Places Entry"));
dialog->setIcon(data.value("iconName").toString());
dialog->setText(data.value("text").toString());
- dialog->setUrl(data.value("url").value<QUrl>());
+ dialog->setUrl(data.value("url").toUrl());
dialog->setAllowGlobal(true);
if (dialog->exec() == QDialog::Accepted) {
PlacesItem* oldItem = m_model->placesItem(index);
@@ -522,7 +522,7 @@ void PlacesPanel::triggerItem(int index, Qt::MouseButton button)
} else {
m_triggerStorageSetupButton = Qt::NoButton;
- const QUrl url = m_model->data(index).value("url").value<QUrl>();
+ const QUrl url = m_model->data(index).value("url").toUrl();
if (!url.isEmpty()) {
if (button == Qt::MiddleButton) {
emit placeMiddleClicked(PlacesItemModel::convertedUrl(url));
diff --git a/src/panels/terminal/terminalpanel.cpp b/src/panels/terminal/terminalpanel.cpp
index ee88bd4c5..da68210c1 100644
--- a/src/panels/terminal/terminalpanel.cpp
+++ b/src/panels/terminal/terminalpanel.cpp
@@ -71,7 +71,7 @@ void TerminalPanel::dockVisibilityChanged()
this, SLOT(slotKonsolePartCurrentDirectoryChanged(QString)));
// Make sure this terminal does not prevent unmounting any removable drives
- changeDir(QUrl::fromLocalFile("/"));
+ changeDir(QUrl::fromLocalFile(QStringLiteral("/")));
// Because we have disconnected from the part's currentDirectoryChanged()
// signal, we have to update m_konsolePartCurrentDirectory manually. If this
@@ -105,7 +105,7 @@ void TerminalPanel::showEvent(QShowEvent* event)
if (!m_terminal) {
m_clearTerminal = true;
KPluginFactory* factory = 0;
- KService::Ptr service = KService::serviceByDesktopName("konsolepart");
+ KService::Ptr service = KService::serviceByDesktopName(QStringLiteral("konsolepart"));
if (service) {
factory = KPluginLoader(service->library()).factory();
}
@@ -171,7 +171,7 @@ void TerminalPanel::sendCdToTerminal(const QString& dir)
m_sendCdToTerminalHistory.enqueue(QDir(dir).canonicalPath());
if (m_clearTerminal) {
- m_terminal->sendInput(" clear\n");
+ m_terminal->sendInput(QStringLiteral(" clear\n"));
m_clearTerminal = false;
}
}